@arcgis/core 4.34.0-next.93 → 4.34.0-next.94

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (165) hide show
  1. package/analysis/ElevationProfile/ElevationProfileDisplayUnits.d.ts +4 -0
  2. package/analysis/ElevationProfile/{ElevationProfileUnits.js → ElevationProfileDisplayUnits.js} +1 -1
  3. package/analysis/ElevationProfile/ElevationProfileUnits.d.ts +1 -1
  4. package/analysis/ElevationProfile/ElevationProfileViewOptions.js +1 -1
  5. package/analysis/ElevationProfileAnalysis.js +1 -1
  6. package/assets/esri/core/workers/RemoteClient.js +1 -1
  7. package/assets/esri/core/workers/chunks/{db5a985ccc6b7d0ad855.js → 176f56de787bf486be9f.js} +1 -1
  8. package/assets/esri/core/workers/chunks/{ad67e5eb4b8c0c14cea6.js → 1fc7df018c8f802565a6.js} +1 -1
  9. package/assets/esri/core/workers/chunks/20f4c6d8b310ecab97be.js +1 -0
  10. package/assets/esri/core/workers/chunks/25639559336109ff3df1.js +1 -0
  11. package/assets/esri/core/workers/chunks/26081b6486c623735657.js +1 -0
  12. package/assets/esri/core/workers/chunks/2698f656405876f4bd20.js +1 -0
  13. package/assets/esri/core/workers/chunks/{4660798b3b45dcb5cecb.js → 2b9c9a35a6e1f56920b5.js} +2 -2
  14. package/assets/esri/core/workers/chunks/98381404f2d99a1f9341.js +1 -0
  15. package/assets/esri/core/workers/chunks/{992b1389710d716d3450.js → a410dcf80d17a2383337.js} +1 -1
  16. package/assets/esri/core/workers/chunks/{d9d86cf0500fa29d1d43.js → a98b284b147258629947.js} +1 -1
  17. package/assets/esri/core/workers/chunks/b1ccbc2fef7f7e5e04f7.js +1 -0
  18. package/assets/esri/core/workers/chunks/c4641c2c130c7b8bcdee.js +1 -0
  19. package/assets/esri/core/workers/chunks/c9159ebf930af3f336f3.js +1 -0
  20. package/assets/esri/core/workers/chunks/{8de9e50de0ac66ae1573.js → ce2fcaa21d6efcdf4da5.js} +1 -1
  21. package/assets/esri/core/workers/chunks/d2df6e685d6cffc5f486.js +1 -0
  22. package/assets/esri/core/workers/chunks/{c27783ce7ea51a5e49c5.js → e153b61560a7a869db63.js} +1 -1
  23. package/assets/esri/core/workers/chunks/e2c293331515f3bd0355.js +1 -0
  24. package/assets/esri/core/workers/chunks/ec7b156425f25d231078.js +1 -0
  25. package/assets/esri/core/workers/chunks/fb456e7425e09df17d8c.js +1 -0
  26. package/assets/esri/core/workers/chunks/{f6806780ca2aa591475a.js → fe1dcf9f81da4adbb1fe.js} +1 -1
  27. package/assets/esri/libs/parquet/pkg/bundle_bg.wasm +0 -0
  28. package/chunks/WaterSurface.glsl.js +0 -1
  29. package/chunks/bundle.js +1 -1
  30. package/colorUtils.js +1 -1
  31. package/config.js +1 -1
  32. package/interfaces.d.ts +229 -97
  33. package/kernel.js +1 -1
  34. package/layers/GaussianSplatLayer.js +1 -1
  35. package/layers/graphics/controllers/I3SOnDemandController.js +1 -1
  36. package/layers/graphics/dehydratedFeatureComparison.js +1 -1
  37. package/layers/orientedImagery/transformations/imageToWorld.js +1 -1
  38. package/layers/support/rasterDatasets/InMemoryRaster.js +1 -1
  39. package/networks/UtilityNetwork.js +1 -1
  40. package/networks/support/NetworkSystemLayers.js +1 -1
  41. package/package.json +2 -1
  42. package/popup/content/AttachmentsContent.js +1 -1
  43. package/portal/schemas/definitions.js +1 -1
  44. package/rest/knowledgeGraphService.js +1 -1
  45. package/support/revision.js +1 -1
  46. package/views/2d/analysis/ElevationProfile/ElevationProfileInputVisualization2D.js +1 -1
  47. package/views/2d/analysis/ElevationProfile/ElevationProfileLineVisualization2D.js +1 -1
  48. package/views/2d/analysis/ElevationProfileAnalysisView2D.js +1 -1
  49. package/views/2d/layers/imagery/BaseImageryTileSubView2D.js +1 -1
  50. package/views/2d/layers/imagery/ImageryTileView2D.js +1 -1
  51. package/views/3d/analysis/ElevationProfile/ElevationProfileInputVisualization3D.js +1 -1
  52. package/views/3d/analysis/ElevationProfile/ElevationProfileLineSceneComputation.js +1 -1
  53. package/views/3d/analysis/ElevationProfile/ElevationProfileLineVisualization3D.js +1 -1
  54. package/views/3d/analysis/ElevationProfileAnalysisView3D.js +1 -1
  55. package/views/3d/layers/FlowSubView3D.js +1 -1
  56. package/views/3d/layers/graphics/Graphics3DMeshFillSymbolLayer.js +1 -1
  57. package/views/3d/layers/graphics/objectResourceUtils.js +1 -1
  58. package/views/3d/support/GaussianSplatSortWorker.js +1 -1
  59. package/views/3d/support/flow/FlowSubViewTiles3D.js +1 -1
  60. package/views/3d/support/gaussianSplatting/GaussianSplatDataStore.js +1 -1
  61. package/views/3d/webgl-engine/core/shaderTechnique/ShaderTechnique.js +1 -1
  62. package/views/3d/webgl-engine/effects/blit/Blit.js +1 -1
  63. package/views/3d/webgl-engine/effects/transparency/OITBlendTechnique.js +1 -1
  64. package/views/3d/webgl-engine/lib/CompositingHelper.js +1 -1
  65. package/views/3d/webgl-engine/shaders/GaussianSplatDepthCompositionTechnique.js +1 -1
  66. package/views/PopupView.js +1 -1
  67. package/views/View.js +1 -1
  68. package/views/View2D.js +1 -1
  69. package/views/analysis/ElevationProfile/ElevationProfileChart.js +1 -1
  70. package/views/analysis/ElevationProfile/ElevationProfileController.js +1 -1
  71. package/views/analysis/ElevationProfile/ElevationProfileHoveredPointsVisualization.js +1 -1
  72. package/views/analysis/ElevationProfile/ElevationProfileLineComputation.js +1 -1
  73. package/views/analysis/ElevationProfile/ElevationProfileLineInputComputation.js +1 -1
  74. package/views/analysis/ElevationProfile/ElevationProfileResult.js +1 -1
  75. package/views/analysis/ElevationProfile/ElevationProfileTool.js +1 -1
  76. package/views/analysis/ElevationProfile/elevationProfileGeometryUtils.js +1 -1
  77. package/views/analysis/ElevationProfile/elevationProfileInputVisualizationUtils.js +1 -1
  78. package/views/interactive/snapping/LineSnapper.js +1 -1
  79. package/views/interactive/snapping/ParallelLineSnapper.js +1 -1
  80. package/views/interactive/snapping/RightAngleSnapper.js +1 -1
  81. package/views/interactive/snapping/RightAngleTriangleSnapper.js +1 -1
  82. package/views/interactive/snapping/snappingUtils.js +1 -1
  83. package/views/popupAdapter.js +5 -0
  84. package/views/webgl/ContextState.js +1 -1
  85. package/views/webgl/RenderingContext.js +1 -1
  86. package/views/webgl/enums.js +1 -1
  87. package/widgets/Attachments/AttachmentsViewModel.js +1 -1
  88. package/widgets/Attachments.js +1 -1
  89. package/widgets/ElevationProfile/support/chartUtils.js +1 -1
  90. package/widgets/Feature/FeatureMedia/chartCommon.js +1 -1
  91. package/widgets/Feature/FeatureMedia/pieChart.js +1 -1
  92. package/widgets/Feature/FeatureMedia/xyChart.js +1 -1
  93. package/widgets/Feature/FeatureViewModel.js +1 -1
  94. package/widgets/FeatureTable/support/ColumnTemplateBase.js +1 -1
  95. package/widgets/FeatureTable/support/TableTemplate.js +1 -1
  96. package/widgets/Features/FeaturesViewModel.js +1 -1
  97. package/widgets/Legend/LegendViewModel.js +1 -1
  98. package/widgets/Legend/support/ActiveLayerInfo.js +1 -1
  99. package/widgets/Legend.js +1 -1
  100. package/widgets/Search/SearchResultRenderer.js +1 -1
  101. package/widgets/Search/SearchViewModel.js +1 -1
  102. package/widgets/Search.js +1 -1
  103. package/widgets/support/chartUtilsAm5.js +1 -1
  104. package/assets/esri/core/workers/chunks/0b24a6c06d1becbb6815.js +0 -1
  105. package/assets/esri/core/workers/chunks/19f1bfe815896d4983af.js +0 -1
  106. package/assets/esri/core/workers/chunks/22c3a21bc9f32c429c48.js +0 -1
  107. package/assets/esri/core/workers/chunks/3b2ef975831eb75b40fb.js +0 -1
  108. package/assets/esri/core/workers/chunks/5eb7f6f5121c8830c561.js +0 -1
  109. package/assets/esri/core/workers/chunks/6c3b585b9cb6bb640fb0.js +0 -1
  110. package/assets/esri/core/workers/chunks/8b9a50cfaa5a7df02dad.js +0 -1
  111. package/assets/esri/core/workers/chunks/8ff2daef892881ff2019.js +0 -1
  112. package/assets/esri/core/workers/chunks/a6a2d4602dfeb62e0ecc.js +0 -1
  113. package/assets/esri/core/workers/chunks/c95e6bef8c97cf647869.js +0 -1
  114. package/assets/esri/core/workers/chunks/ce175801937e80e3c487.js +0 -1
  115. package/assets/esri/core/workers/chunks/d71836cf70b9604832f1.js +0 -1
  116. package/chunks/Button.js +0 -5
  117. package/chunks/ColorSet.js +0 -5
  118. package/chunks/DefaultTheme.js +0 -5
  119. package/chunks/LineSeries.js +0 -5
  120. package/chunks/ResponsiveTheme.js +0 -5
  121. package/chunks/Theme.js +0 -5
  122. package/chunks/Tick.js +0 -5
  123. package/chunks/Tooltip.js +0 -5
  124. package/chunks/ar.js +0 -5
  125. package/chunks/bg_BG.js +0 -5
  126. package/chunks/bs_BA.js +0 -5
  127. package/chunks/ca_ES.js +0 -5
  128. package/chunks/chartUtilsAm5.js +0 -5
  129. package/chunks/cs_CZ.js +0 -5
  130. package/chunks/da_DK.js +0 -5
  131. package/chunks/de_CH.js +0 -5
  132. package/chunks/de_DE.js +0 -5
  133. package/chunks/el_GR.js +0 -5
  134. package/chunks/en_CA.js +0 -5
  135. package/chunks/en_US.js +0 -5
  136. package/chunks/es_ES.js +0 -5
  137. package/chunks/et_EE.js +0 -5
  138. package/chunks/fi_FI.js +0 -5
  139. package/chunks/fr_FR.js +0 -5
  140. package/chunks/he_IL.js +0 -5
  141. package/chunks/hr_HR.js +0 -5
  142. package/chunks/hu_HU.js +0 -5
  143. package/chunks/id_ID.js +0 -5
  144. package/chunks/it_IT.js +0 -5
  145. package/chunks/ja_JP.js +0 -5
  146. package/chunks/ko_KR.js +0 -5
  147. package/chunks/lt_LT.js +0 -5
  148. package/chunks/lv_LV.js +0 -5
  149. package/chunks/nb_NO.js +0 -5
  150. package/chunks/nl_NL.js +0 -5
  151. package/chunks/pl_PL.js +0 -5
  152. package/chunks/pt_BR.js +0 -5
  153. package/chunks/pt_PT.js +0 -5
  154. package/chunks/ro_RO.js +0 -5
  155. package/chunks/ru_RU.js +0 -5
  156. package/chunks/sk_SK.js +0 -5
  157. package/chunks/sl_SL.js +0 -5
  158. package/chunks/sr_RS.js +0 -5
  159. package/chunks/sv_SE.js +0 -5
  160. package/chunks/th_TH.js +0 -5
  161. package/chunks/tr_TR.js +0 -5
  162. package/chunks/uk_UA.js +0 -5
  163. package/chunks/vi_VN.js +0 -5
  164. package/chunks/zh_Hans.js +0 -5
  165. package/chunks/zh_Hant.js +0 -5
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{__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}from"../../../core/promiseUtils.js";import{watch as l}from"../../../core/reactiveUtils.js";import{formatDecimal as p,unitName as c}from"../../../core/unitFormatUtils.js";import{property as d}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as h}from"../../../core/accessorSupport/decorators/subclass.js";import{getEpsilon as u}from"../../../core/libs/gl-matrix-2/math/common.js";import{isDarkMode as f}from"../../../support/modeUtils.js";import{getConfig as m,notAvailable as g}from"./constants.js";import{getAdjustedBounds as x}from"./elevationProfileChartBoundsUtils.js";import{themeLight as _,themeDark as y}from"./elevationProfileChartTheme.js";import{binaryFindClosest as v}from"./elevationProfileGenerationUtils.js";import{isInputSketched as A}from"./elevationProfileGeometryUtils.js";import{c as T,N as b}from"../../../chunks/chartUtilsAm5.js";import{fetchMessageBundle as P}from"../../../intl/messages.js";import{X as S,a as L,V as M,A as w,b as F,L as C}from"../../../chunks/LineSeries.js";import{b as j,d as k,a as I,C as z}from"../../../chunks/Theme.js";import{T as X}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(!A(this.analysisView?.analysis))return t.refined;let e=0;for(const{samples:i}of t.lines)e+=i?.length??0;return t.refined||e<=m().largeChartSamples}get spinnerVisible(){return null!=this._chartData&&(this.analysisView?.progress??0)<1}get _updateParameters(){const{messages:t,_unitsMessages:e}=this;if(t&&e)return{data:this._chartData,messages:t,unitsMessages:e}}get _chartData(){const{analysisView:t,uniformScaling:e}=this;if(!this._hasInput||!t)return;const{analysis:i,effectiveUnits:s,progress:o,statistics:n}=t;return{lines:this._lineData,statistics:n,effectiveUnits:s,refined:1===o,uniformScaling:e,dynamicElevationRange:i.profiles.some(t=>"scene"===t.type)}}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=_,this._data=null,this._seriesInfos=new Map,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}zoomOut(){this._chartInfo?.xAxis.zoom(0,1),this._chartInfo?.yAxis.zoom(0,1)}async _initializeChart(t){const[s,o]=await Promise.all([T(this.container),P("esri/core/t9n/Units")]);a(t);const n=$(this.container),r=f(this.container),p=r?y:_;s.setThemes(r?[e.new(s),i.new(s)]:[e.new(s)]),this._rtl=n,this._theme=p,this._unitsMessages=o;const c=s.container.children.push(S.new(s,{panX:!0,panY:!0,paddingTop:p.paddingTop,paddingBottom:p.paddingBottom,paddingLeft:n?p.paddingRight:p.paddingLeft,paddingRight:n?p.paddingLeft:p.paddingRight,maxTooltipDistance:-1}));c.zoomOutButton.set("forceHidden",!0);const d=c.xAxes.push(this._createXAxis(s)),h=c.yAxes.push(this._createYAxis(s));this._chartInfo={chart:c,xAxis:d,yAxis:h};const u=L.new(c.root,{behavior:"none",xAxis:d,yAxis:h,snapToSeriesBy:"y"});u.lineY.set("visible",!1),c.set("cursor",u),this._initializeTest(c),this.addHandles([this._setupZoomHandling(),this._setupCursorHandling(),q(s),l(()=>this._updateParameters,this._update.bind(this))]),this._update(this._updateParameters)}_initializeTest(t){}_update(t){if(!t||this.destroyed)return;const e=this._data,i=t.data;if(i===e&&t.messages===this.messages&&t.unitsMessages===this._unitsMessages)return;const s=e!==i,o=e?.effectiveUnits!==i?.effectiveUnits,n=e?.uniformScaling!==i?.uniformScaling;this._data=i,this._chartInfo?.chart.get("cursor")?.set("forceHidden",!i?.refined),(s||o)&&(this._updateAxes(),this._updateSeries()),n&&this.zoomOut(),this._updateTooltips()}_createXAxis(t){const e=this._theme,i=M.new(t,{renderer:w.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:k,centerY:k,fill:j(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",X.new(t,{paddingBottom:0,paddingLeft:0,paddingRight:0,paddingTop:0}));return o.get("background")?.setAll({fill:j(e.axisTooltipBackgroundColor),stroke:void 0}),o.label.setAll({fill:j(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:j(e.axisGridStroke)}),i}_createYAxis(t){const e=this._theme,i=this._rtl,s=M.new(t,{renderer:F.new(t,{})});s.setAll({baseValue:m().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:k,centerY:I,fill:j(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:j(e.axisGridStroke)}),s}_setupZoomHandling(){const t=this._chartInfo;if(!t)return n();const{xAxis:e,yAxis:i}=t,s=()=>{this.onRangeChange?.(O(e),O(i))},o=t=>[t.on("start",s),t.on("end",s)];return N([...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 N([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===O(i)?(l=0,p=o):(l=G(i),p=W(i)),t=B(t,l,p,0,o)}if(null!=r&&null!=a){1===O(s)?(l=r,p=a):(l=G(s),p=W(s)),e=B(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}=x({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 this._seriesInfos.clear(),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=D(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=j(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",z.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(E);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 v(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=m().formatPrecision,l=H(s.chartTooltip,{name:Z(t,s),elevation:null!=e?p(o,e,i.effectiveUnits.elevation,a):g});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=m().formatPrecision;return null!=s?p(e,s.distance,t.effectiveUnits.distance,o):"-"}_makeFormatter(t,e){const i=b.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})} ${c(n,o.effectiveUnits[e],"abbr")}`},i}};function D(t,e,i,s){const{id:o}=s,n=U(t,`line-${o}`),r=R(t,e,i);n.setAll({dy:s.strokeOffsetY,tooltip:r}),n.strokes.template.setAll({strokeWidth:s.strokeWidth});let a=null;return s.fillEnabled&&(a=U(t,`fill-${o}`),a.fills.template.setAll({fillOpacity:1,visible:!0})),{id:o,line:n,fill:a}}function U({chart:t,xAxis:e,yAxis:i},s){return C.new(t.root,{connect:!1,excludeFromTotal:!0,fill:void 0,id:s,stroke:void 0,valueXField:"distance",valueYField:"elevation",xAxis:e,yAxis:i})}function R({chart:t},e,i){const s=X.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:j(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:j(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 O(t){const e=Math.abs((t.get("end")??0)-(t.get("start")??0)),i=0!==e?1/e:1;return Math.abs(1-i)<u()?1:i}function B(t,e,i,s,o){return(e+t*(i-e)-s)/(o-s)}function E({y:t},{y:e}){return null==t?1:null==e?-1:e-t}function G(t){return t.positionToValue(t.get("start")??0)}function W(t){return t.positionToValue(t.get("end")??1)}function Z(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 $(t){const e=t?.closest("[dir]");return null!==e&&e instanceof HTMLElement&&"rtl"===e.dir||"rtl"===document.dir}function N(t){return r(t.map(q))}function q(t){return n(()=>t?.dispose())}t([d()],Y.prototype,"view",void 0),t([d()],Y.prototype,"analysisView",void 0),t([d()],Y.prototype,"container",void 0),t([d()],Y.prototype,"messages",void 0),t([d()],Y.prototype,"onRangeChange",void 0),t([d()],Y.prototype,"onCursorPositionChange",void 0),t([d()],Y.prototype,"uniformScaling",void 0),t([d()],Y.prototype,"chartVisible",null),t([d()],Y.prototype,"spinnerVisible",null),t([d()],Y.prototype,"test",void 0),t([d()],Y.prototype,"_theme",void 0),t([d()],Y.prototype,"_data",void 0),t([d()],Y.prototype,"_seriesInfos",void 0),t([d()],Y.prototype,"_pointerIsOver",void 0),t([d()],Y.prototype,"_rtl",void 0),t([d()],Y.prototype,"_chartInfo",void 0),t([d()],Y.prototype,"_unitsMessages",void 0),t([d()],Y.prototype,"_updateParameters",null),t([d()],Y.prototype,"_chartData",null),t([d()],Y.prototype,"_hasInput",null),t([d()],Y.prototype,"_lineData",null),Y=t([h("esri.views.analysis.ElevationProfile.ElevationProfileChart")],Y);export{Y as ElevationProfileChart};
5
+ import{__decorate as t}from"tslib";import*as e from"@amcharts/amcharts5/index.js";import{XYChart as i,XYCursor as s,ValueAxis as o,AxisRendererX as n,AxisRendererY as r,LineSeries as a}from"@amcharts/amcharts5/xy.js";import l from"@amcharts/amcharts5/themes/Dark.js";import p from"@amcharts/amcharts5/themes/Responsive.js";import"../../../intl.js";import c from"../../../core/Accessor.js";import{createTask as d}from"../../../core/asyncUtils.js";import{makeHandle as h,handlesGroup as u}from"../../../core/handleUtils.js";import"../../../core/has.js";import{throwIfAborted as m}from"../../../core/promiseUtils.js";import{watch as f}from"../../../core/reactiveUtils.js";import{formatDecimal as g,unitName as x}from"../../../core/unitFormatUtils.js";import{property as _}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as y}from"../../../core/accessorSupport/decorators/subclass.js";import{getEpsilon as v}from"../../../core/libs/gl-matrix-2/math/common.js";import{isDarkMode as A}from"../../../support/modeUtils.js";import{getConfig as T,notAvailable as b}from"./constants.js";import{getAdjustedBounds as P}from"./elevationProfileChartBoundsUtils.js";import{themeLight as S,themeDark as M}from"./elevationProfileChartTheme.js";import{binaryFindClosest as w}from"./elevationProfileGenerationUtils.js";import{createRoot as F}from"../../../widgets/support/chartUtilsAm5.js";import{fetchMessageBundle as L}from"../../../intl/messages.js";import{substitute as C}from"../../../intl/substitute.js";import{formatNumber as j}from"../../../intl/number.js";let z=class extends c{get chartVisible(){const t=this._chartData;if(null==t)return!1;let e=0;for(const{samples:i}of t.lines)e+=i?.length??0;return t.refined||e<=T().largeChartSamples}get spinnerVisible(){return null!=this._chartData&&(this.analysisView?.progress??0)<1}get _updateParameters(){const{messages:t,_unitsMessages:e}=this;if(t&&e)return{data:this._chartData,messages:t,unitsMessages:e}}get _chartData(){const{analysisView:t,uniformScaling:e}=this;if(!this._hasGeometry||!t)return;const{analysis:i,effectiveDisplayUnits:s,progress:o,statistics:n}=t;return{lines:this._lineData,statistics:n,effectiveUnits:s,refined:1===o,uniformScaling:e,dynamicElevationRange:i.profiles.some(t=>"scene"===t.type)}}get _hasGeometry(){return null!=this.analysisView?.analysis.geometry}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=S,this._data=null,this._seriesInfos=new Map,this._pointerIsOver=!1,this._rtl=!1,this._chartInfo=null,this._unitsMessages=null}initialize(){this.addHandles(d(t=>this._initializeChart(t)))}destroy(){this._chartInfo=null,this._seriesInfos.clear(),this._data=null}zoomOut(){this._chartInfo?.xAxis.zoom(0,1),this._chartInfo?.yAxis.zoom(0,1)}async _initializeChart(t){const[e,o]=await Promise.all([F(this.container),L("esri/core/t9n/Units")]);m(t);const n=R(this.container),r=A(this.container),a=r?M:S;e.setThemes(r?[p.new(e),l.new(e)]:[p.new(e)]),this._rtl=n,this._theme=a,this._unitsMessages=o;const c=e.container.children.push(i.new(e,{panX:!0,panY:!0,paddingTop:a.paddingTop,paddingBottom:a.paddingBottom,paddingLeft:n?a.paddingRight:a.paddingLeft,paddingRight:n?a.paddingLeft:a.paddingRight,maxTooltipDistance:-1}));c.zoomOutButton.set("forceHidden",!0);const d=c.xAxes.push(this._createXAxis(e)),h=c.yAxes.push(this._createYAxis(e));this._chartInfo={chart:c,xAxis:d,yAxis:h};const u=s.new(c.root,{behavior:"none",xAxis:d,yAxis:h,snapToSeriesBy:"y"});u.lineY.set("visible",!1),c.set("cursor",u),this._initializeTest(c),this.addHandles([this._setupZoomHandling(),this._setupCursorHandling(),G(e),f(()=>this._updateParameters,this._update.bind(this))]),this._update(this._updateParameters)}_initializeTest(t){}_update(t){if(!t||this.destroyed)return;const e=this._data,i=t.data;if(i===e&&t.messages===this.messages&&t.unitsMessages===this._unitsMessages)return;const s=e!==i,o=e?.effectiveUnits!==i?.effectiveUnits,n=e?.uniformScaling!==i?.uniformScaling;this._data=i,this._chartInfo?.chart.get("cursor")?.set("forceHidden",!i?.refined),(s||o)&&(this._updateAxes(),this._updateSeries()),n&&this.zoomOut(),this._updateTooltips()}_createXAxis(t){const i=this._theme,s=o.new(t,{renderer:n.new(t,{})});s.setAll({extraMax:0,extraMin:0,maxDeviation:0,numberFormatter:this._makeFormatter(t,"distance"),strictMinMax:!0,strictMinMaxSelection:!0}),s.axisHeader.set("forceHidden",!0);const r=s.get("renderer");r.setAll({inside:!1,minGridDistance:i.xAxisMinGridDistance}),r.labels.template.setAll({centerX:e.p0,centerY:e.p0,fill:e.color(i.axisLabelsColor),fontFamily:i.fontFamily,fontSize:i.axisLabelsFontSize,fontWeight:i.axisLabelsFontWeight,maxPosition:i.xAxisMaxLabelPosition,minPosition:i.xAxisMinLabelPosition,paddingLeft:0,paddingRight:0,paddingTop:i.xAxisLabelsSpacing});const a=s.set("tooltip",e.Tooltip.new(t,{paddingBottom:0,paddingLeft:0,paddingRight:0,paddingTop:0}));return a.get("background")?.setAll({fill:e.color(i.axisTooltipBackgroundColor),stroke:void 0}),a.label.setAll({fill:e.color(i.axisTooltipLabelColor),fontFamily:i.fontFamily,fontSize:i.axisTooltipFontSize,paddingBottom:i.axisTooltipPaddingBottom,paddingLeft:i.axisTooltipPaddingHorizontal,paddingRight:i.axisTooltipPaddingHorizontal,paddingTop:i.axisTooltipPaddingTop,direction:this._rtl?"rtl":"ltr"}),r.grid.template.setAll({strokeOpacity:1,stroke:e.color(i.axisGridStroke)}),s}_createYAxis(t){const i=this._theme,s=this._rtl,n=o.new(t,{renderer:r.new(t,{})});n.setAll({baseValue:T().noDataValue,extraMax:0,extraMin:0,maxDeviation:0,numberFormatter:this._makeFormatter(t,"elevation"),strictMinMax:!0,strictMinMaxSelection:!0,tooltip:void 0}),n.axisHeader.set("visible",!1);const a=n.get("renderer");return a.setAll({minGridDistance:i.yAxisMinGridDistance,opposite:s,inside:!0}),a.labels.template.setAll({centerX:e.p0,centerY:e.p100,fill:e.color(i.axisLabelsColor),fontFamily:i.fontFamily,fontSize:i.axisLabelsFontSize,fontWeight:i.axisLabelsFontWeight,maxPosition:i.yAxisMaxLabelPosition,minPosition:i.yAxisMinLabelPosition,paddingBottom:0,paddingLeft:s?0:i.yAxisLabelSpacing,paddingRight:s?i.yAxisLabelSpacing:0,paddingTop:0,textAlign:"start"}),a.grid.template.setAll({strokeOpacity:1,stroke:e.color(i.axisGridStroke)}),n}_setupZoomHandling(){const t=this._chartInfo;if(!t)return h();const{xAxis:e,yAxis:i}=t,s=()=>{this.onRangeChange?.(H(e),H(i))},o=t=>[t.on("start",s),t.on("end",s)];return B([...o(e),...o(i)])}_setupCursorHandling(){const t=this._chartInfo;if(!t)return h();const{chart:e,xAxis:i,yAxis:s}=t,o=e.get("cursor"),n=e.plotContainer.events,r=t=>{this._pointerIsOver=t,this._updateTooltips()},a=()=>{r(!1),this.onCursorPositionChange?.(null,null)};return B([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===H(i)?(l=0,p=o):(l=V(i),p=U(i)),t=X(t,l,p,0,o)}if(null!=r&&null!=a){1===H(s)?(l=r,p=a):(l=V(s),p=U(s)),e=X(e,l,p,r,a)}}this.onCursorPositionChange?.(t,e)}),n.on("pointerover",()=>r(!0)),n.on("pointerout",a),n.on("blur",a)])}_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}=P({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 this._seriesInfos.clear(),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=I(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,i){const s=e.color(i.color.toCss()),o=i.samples??[],n=o.length>0,{line:r,fill:a}=t;r.set("visible",n),r.set("stroke",s),a?.set("visible",n),a?.set("fill",e.Color.lighten(s,this._theme.seriesFillLighten)),r.data.setAll(o),a?.data.setAll(o)}_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(Y);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 w(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=T().formatPrecision,l=C(s.chartTooltip,{name:O(t,s),elevation:null!=e?g(o,e,i.effectiveUnits.elevation,a):b});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=T().formatPrecision;return null!=s?g(e,s.distance,t.effectiveUnits.distance,o):"-"}_makeFormatter(t,i){const s=e.NumberFormatter.new(t,{});return s.format=(t,e,s)=>{const o=this._data,n=this._unitsMessages;if(!o||!n||"string"==typeof t)return"";return`${j(t,{maximumFractionDigits:s})} ${x(n,o.effectiveUnits[i],"abbr")}`},s}};function I(t,e,i,s){const{id:o}=s,n=k(t,`line-${o}`),r=D(t,e,i);n.setAll({dy:s.strokeOffsetY,tooltip:r}),n.strokes.template.setAll({strokeWidth:s.strokeWidth});let a=null;return s.fillEnabled&&(a=k(t,`fill-${o}`),a.fills.template.setAll({fillOpacity:1,visible:!0})),{id:o,line:n,fill:a}}function k({chart:t,xAxis:e,yAxis:i},s){return a.new(t.root,{connect:!1,excludeFromTotal:!0,fill:void 0,id:s,stroke:void 0,valueXField:"distance",valueYField:"elevation",xAxis:e,yAxis:i})}function D({chart:t},i,s){const o=e.Tooltip.new(t.root,{autoTextColor:!1,forceHidden:!0,getFillFromSprite:!1,getLabelFillFromSprite:!1,pointerOrientation:"vertical",visible:!1}),n=i.seriesTooltipPaddingHorizontal,r=i.seriesTooltipPaddingVertical;return o.label.setAll({fill:e.color(i.seriesTooltipLabelColor),fontFamily:i.fontFamily,fontSize:i.seriesTooltipFontSize,paddingBottom:r,paddingLeft:n,paddingRight:n,paddingTop:r,textAlign:s?"end":"start",direction:"ltr"}),o.get("background")?.setAll({stroke:void 0,fill:e.color(i.seriesTooltipBackgroundColor)}),o.adapters.add("dy",t=>{const e=i.seriesTooltipSpacing,s=o.get("pointTo")?.y??0;return(t??0)+(o.y()>s?e:-e)}),o}function H(t){const e=Math.abs((t.get("end")??0)-(t.get("start")??0)),i=0!==e?1/e:1;return Math.abs(1-i)<v()?1:i}function X(t,e,i,s,o){return(e+t*(i-e)-s)/(o-s)}function Y({y:t},{y:e}){return null==t?1:null==e?-1:e-t}function V(t){return t.positionToValue(t.get("start")??0)}function U(t){return t.positionToValue(t.get("end")??1)}function O(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 R(t){const e=t?.closest("[dir]");return null!==e&&e instanceof HTMLElement&&"rtl"===e.dir||"rtl"===document.dir}function B(t){return u(t.map(G))}function G(t){return h(()=>t?.dispose())}t([_()],z.prototype,"view",void 0),t([_()],z.prototype,"analysisView",void 0),t([_()],z.prototype,"container",void 0),t([_()],z.prototype,"messages",void 0),t([_()],z.prototype,"onRangeChange",void 0),t([_()],z.prototype,"onCursorPositionChange",void 0),t([_()],z.prototype,"uniformScaling",void 0),t([_()],z.prototype,"chartVisible",null),t([_()],z.prototype,"spinnerVisible",null),t([_()],z.prototype,"test",void 0),t([_()],z.prototype,"_theme",void 0),t([_()],z.prototype,"_data",void 0),t([_()],z.prototype,"_seriesInfos",void 0),t([_()],z.prototype,"_pointerIsOver",void 0),t([_()],z.prototype,"_rtl",void 0),t([_()],z.prototype,"_chartInfo",void 0),t([_()],z.prototype,"_unitsMessages",void 0),t([_()],z.prototype,"_updateParameters",null),t([_()],z.prototype,"_chartData",null),t([_()],z.prototype,"_hasGeometry",null),t([_()],z.prototype,"_lineData",null),z=t([y("esri.views.analysis.ElevationProfile.ElevationProfileChart")],z);export{z 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{__decorate as t}from"tslib";import e from"../../../core/Accessor.js";import{min as o}from"../../../core/arrayUtils.js";import{createTask as i}from"../../../core/asyncUtils.js";import{makeHandle as s}from"../../../core/handleUtils.js";import{LRUCache as r}from"../../../core/LRUCache.js";import{mapCollection as a}from"../../../core/mapCollectionUtils.js";import{destroyMaybe as n,abortMaybe as l}from"../../../core/maybe.js";import{memoize as p}from"../../../core/memoize.js";import{throwIfAborted as u,throwIfAbortError as m}from"../../../core/promiseUtils.js";import{watch as c,syncAndInitial as h,on as _}from"../../../core/reactiveUtils.js";import{throttle as d}from"../../../core/throttle.js";import{adaptiveLengthUnit as f,adaptiveVerticalLengthUnit as v}from"../../../core/unitUtils.js";import{property as y}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import{subclass as g}from"../../../core/accessorSupport/decorators/subclass.js";import{ElevationQueryTileCache as C}from"../../../layers/support/ElevationQueryTileCache.js";import{hasGraphicFeatureExpressionInfo as P,getGraphicEffectiveElevationInfo as j}from"../../../support/elevationInfoUtils.js";import{getDefaultUnitForView as T}from"../../../support/getDefaultUnitForView.js";import{getConfig as U}from"./constants.js";import{ElevationProfileGenerationError as w}from"./ElevationProfileGenerationError.js";import{createProfileQueue as R,generateProfiles as M}from"./elevationProfileGenerationUtils.js";import{isValidInputPath as z,getInputGeometry as D,getInputGraphic as E}from"./elevationProfileGeometryUtils.js";import{getBoundsInMeters as b,mergeStatistics as I}from"./elevationProfileStatisticsUtils.js";let x=class extends e{constructor(t){super(t),this.error=null,this._getEffectiveUnitsMemoized=p((t,e)=>({distance:t,elevation:e})),this._updateTask=null,this._queue=null,this._currentTileCache=null,this._parametersPerComputation=new Map,this._getUpdateParametersMemoized=p((t,e,o)=>({stationary:t,activeComputations:e,generationParameters:o})),this._getGenerationParametersMemoized=p((t,e,o,i,s,r,a)=>z(e)&&null!=i?{view:t,geometry:e,elevationInfo:o,options:r,queue:i,cache:s,slicePlane:a}:null),this._getElevationInfoMemoized=p((t,e)=>({mode:t,offset:e})),this._getOptionsMemoized=p((t,e)=>{const{densificationMaxSamples:o,maxTotalSamples:i}=U();return{samplingDistance:t,densificationMaxSamples:Math.round(o/e),maxTotalSamples:i}}),this._updateThrottled=d(t=>this._update(t),U().updateThrottleMillis)}initialize(){this._computationsCollection=a(()=>this.analysis.profiles,t=>this.computationFactory.create({controller:this,profile:t,onInvalidate:t=>this._invalidateComputation(t)}),{recycleItems:!0}),this.addHandles([this._computationsCollection.on("change",()=>{this._parametersPerComputation.clear(),this._updateThrottled(this._updateParameters)}),c(()=>this._updateParameters,t=>this._updateThrottled(t),h),this._updateThrottled]);const t="3d"===this.view.type?this.view.resourceController:void 0;this._queue=R(t?.scheduler),t?.addUpdatingObject(this)}destroy(){this._abortUpdate(),this._parametersPerComputation.clear(),this._computationsCollection?.destroy(),this._queue=n(this._queue),this._currentTileCache=n(this._currentTileCache)}get effectiveUnits(){const t=b(this._activeComputations.map(t=>t.result.rawResult)),e=this.analysis.units,o=T(this.view),i=f(t.maxDistance,"meters",e.distance??o),s=v(t.maxElevation,"meters",e.elevation??o);return this._getEffectiveUnitsMemoized(i,s)}get progress(){let t=0,e=0;for(const o of this._activeComputations)t++,e+=o.progress;return t>0?e/t:0}get updating(){const{progress:t}=this;return t>0&&t<1||!!this._queue?.updating||this._updateThrottled.hasPendingUpdates()||null!=this._updateTask&&!this._updateTask.finished}get results(){return this._computations.map(t=>t.result)}get statistics(){return I(this._activeComputations.map(t=>t.result.statistics))}get hoveredPoints(){return this._computations.map(t=>t.hoveredPoint)}onElevationChange(t){const{view:e}=this;return"3d"===e?.type?_(()=>e.elevationProvider,"elevation-change",t,{onListenerAdd:t,onListenerRemove:t}):s()}get _tileCache(){this._currentTileCache=n(this._currentTileCache);const t=this.view;if("3d"===t?.type){const e=t.basemapTerrain?.elevationQueryCache;if(null!=e)return e}return null==this._currentTileCache&&(this._currentTileCache=new C(new r(20971520))),this._currentTileCache}get _computations(){return this._computationsCollection?.toArray()??[]}get _activeComputations(){return this._computations.filter(t=>t.profile.enabled&&t.available)}get _minDemResolution(){const t=this._minDemResolutions;return t.length>0?o(t):null}get _minDemResolutions(){const t=[];for(const{minDemResolution:e}of this._activeComputations)null!=e&&t.push(e);return t}get _updateParameters(){const{view:t}=this;return this._getUpdateParametersMemoized(t?.stationary??!0,this._activeComputations,this._generationParameters)}get _generationParameters(){const{view:t}=this;return null!=t&&t.ready?this._getGenerationParametersMemoized(t,this._inputGeometry,this._elevationInfo,this._queue,this._tileCache,this._options,"3d"===t.type?t.slice.plane:null):null}get _inputGeometry(){return D(this.analysis.input)}get _elevationInfo(){const t=E(this.analysis.input);if(!t)return null;const e=t?P(t)?null:j(t):null;return null!=e?this._getElevationInfoMemoized(e.mode,e.offset):null}get _options(){const t=this._activeComputations.length;let e=this._minDemResolution??U().defaultDemResolution;return e=parseFloat(e.toFixed(2)),this._getOptionsMemoized(e,t)}_update({stationary:t,activeComputations:e,generationParameters:o}){this._abortUpdate(),t&&(null!=o?this._updateTask=i(async t=>{this.error=null;const i=e.filter(t=>!this._isComputationValid(t,o)),s=M({...o,providers:i},{signal:t});try{for await(const e of s){u(t),this._clearInvalidResults(o);for(let t=0;t<i.length;t++)i[t].setResult(e[t])}for(const t of i)this._parametersPerComputation.set(t,o)}catch(r){m(r),this._abortUpdate(),this.error=r instanceof w?r:new w("unknown"),i.forEach(t=>{t.clearResult()})}}):this._clearResults())}_abortUpdate(){this._updateTask=l(this._updateTask)}_isComputationValid(t,e){return this._parametersPerComputation.has(t)&&this._parametersPerComputation.get(t)===e}_invalidateComputation(t){this._parametersPerComputation.delete(t),this._updateThrottled(this._updateParameters)}_clearInvalidResults(t){for(const e of this._computations)this._isComputationValid(e,t)||(e.clearResult(),this._parametersPerComputation.delete(e))}_clearResults(){for(const t of this._computations)t.clearResult(),this._parametersPerComputation.delete(t)}};t([y({constructOnly:!0})],x.prototype,"analysis",void 0),t([y({constructOnly:!0})],x.prototype,"analysisViewData",void 0),t([y({constructOnly:!0})],x.prototype,"computationFactory",void 0),t([y({constructOnly:!0})],x.prototype,"view",void 0),t([y()],x.prototype,"error",void 0),t([y({readOnly:!0})],x.prototype,"effectiveUnits",null),t([y()],x.prototype,"progress",null),t([y()],x.prototype,"updating",null),t([y()],x.prototype,"results",null),t([y()],x.prototype,"statistics",null),t([y()],x.prototype,"hoveredPoints",null),t([y()],x.prototype,"_queue",void 0),t([y()],x.prototype,"_tileCache",null),t([y()],x.prototype,"_computationsCollection",void 0),t([y()],x.prototype,"_computations",null),t([y()],x.prototype,"_activeComputations",null),t([y({readOnly:!0})],x.prototype,"_minDemResolution",null),t([y()],x.prototype,"_minDemResolutions",null),t([y()],x.prototype,"_updateParameters",null),t([y()],x.prototype,"_generationParameters",null),t([y()],x.prototype,"_inputGeometry",null),t([y()],x.prototype,"_elevationInfo",null),t([y()],x.prototype,"_options",null),x=t([g("esri.views.analysis.ElevationProfile.ElevationProfileController")],x);export{x as ElevationProfileController};
5
+ import{__decorate as t}from"tslib";import e from"../../../core/Accessor.js";import{min as o}from"../../../core/arrayUtils.js";import{createTask as i}from"../../../core/asyncUtils.js";import{makeHandle as s}from"../../../core/handleUtils.js";import{LRUCache as r}from"../../../core/LRUCache.js";import{mapCollection as a}from"../../../core/mapCollectionUtils.js";import{destroyMaybe as n,abortMaybe as l}from"../../../core/maybe.js";import{memoize as p}from"../../../core/memoize.js";import{throwIfAborted as u,throwIfAbortError as m}from"../../../core/promiseUtils.js";import{watch as c,syncAndInitial as h,on as d}from"../../../core/reactiveUtils.js";import{throttle as _}from"../../../core/throttle.js";import{adaptiveLengthUnit as f,adaptiveVerticalLengthUnit as v}from"../../../core/unitUtils.js";import{property as y}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import{subclass as g}from"../../../core/accessorSupport/decorators/subclass.js";import{ElevationQueryTileCache as C}from"../../../layers/support/ElevationQueryTileCache.js";import{absoluteHeightElevationInfo as P}from"../../../support/elevationInfoUtils.js";import{getDefaultUnitForView as U}from"../../../support/getDefaultUnitForView.js";import{getConfig as j}from"./constants.js";import{ElevationProfileGenerationError as T}from"./ElevationProfileGenerationError.js";import{createProfileQueue as w,generateProfiles as R}from"./elevationProfileGenerationUtils.js";import{isValidInputPath as D}from"./elevationProfileGeometryUtils.js";import{getBoundsInMeters as M,mergeStatistics as b}from"./elevationProfileStatisticsUtils.js";let z=class extends e{constructor(t){super(t),this.error=null,this._getEffectiveUnitsMemoized=p((t,e)=>({distance:t,elevation:e})),this._updateTask=null,this._queue=null,this._currentTileCache=null,this._parametersPerComputation=new Map,this._getUpdateParametersMemoized=p((t,e,o)=>({stationary:t,activeComputations:e,generationParameters:o})),this._getGenerationParametersMemoized=p((t,e,o,i,s,r,a)=>D(e)&&null!=i?{view:t,geometry:e,elevationInfo:o,options:r,queue:i,cache:s,slicePlane:a}:null),this._getOptionsMemoized=p((t,e)=>{const{densificationMaxSamples:o,maxTotalSamples:i}=j();return{samplingDistance:t,densificationMaxSamples:Math.round(o/e),maxTotalSamples:i}}),this._updateThrottled=_(t=>this._update(t),j().updateThrottleMillis)}initialize(){this._computationsCollection=a(()=>this.analysis.profiles,t=>this.computationFactory.create({controller:this,profile:t,onInvalidate:t=>this._invalidateComputation(t)}),{recycleItems:!0}),this.addHandles([this._computationsCollection.on("change",()=>{this._parametersPerComputation.clear(),this._updateThrottled(this._updateParameters)}),c(()=>this._updateParameters,t=>this._updateThrottled(t),h),this._updateThrottled]);const t="3d"===this.view.type?this.view.resourceController:void 0;this._queue=w(t?.scheduler),t?.addUpdatingObject(this)}destroy(){this._abortUpdate(),this._parametersPerComputation.clear(),this._computationsCollection?.destroy(),this._queue=n(this._queue),this._currentTileCache=n(this._currentTileCache)}get effectiveDisplayUnits(){const t=M(this._activeComputations.map(t=>t.result.rawResult)),e=this.analysis.displayUnits,o=U(this.view),i=f(t.maxDistance,"meters",e.distance??o),s=v(t.maxElevation,"meters",e.elevation??o);return this._getEffectiveUnitsMemoized(i,s)}get progress(){let t=0,e=0;for(const o of this._activeComputations)t++,e+=o.progress;return t>0?e/t:0}get updating(){const{progress:t}=this;return t>0&&t<1||!!this._queue?.updating||this._updateThrottled.hasPendingUpdates()||null!=this._updateTask&&!this._updateTask.finished}get results(){return this._computations.map(t=>t.result)}get statistics(){return b(this._activeComputations.map(t=>t.result.statistics))}get hoveredPoints(){return this._computations.map(t=>t.hoveredPoint)}onElevationChange(t){const{view:e}=this;return"3d"===e?.type?d(()=>e.elevationProvider,"elevation-change",t,{onListenerAdd:t,onListenerRemove:t}):s()}get _tileCache(){this._currentTileCache=n(this._currentTileCache);const t=this.view;if("3d"===t?.type){const e=t.basemapTerrain?.elevationQueryCache;if(null!=e)return e}return null==this._currentTileCache&&(this._currentTileCache=new C(new r(20971520))),this._currentTileCache}get _computations(){return this._computationsCollection?.toArray()??[]}get _activeComputations(){return this._computations.filter(t=>t.profile.enabled&&t.available)}get _minDemResolution(){const t=this._minDemResolutions;return t.length>0?o(t):null}get _minDemResolutions(){const t=[];for(const{minDemResolution:e}of this._activeComputations)null!=e&&t.push(e);return t}get _updateParameters(){const{view:t}=this;return this._getUpdateParametersMemoized(t?.stationary??!0,this._activeComputations,this._generationParameters)}get _generationParameters(){const{view:t}=this;return null!=t&&t.ready?this._getGenerationParametersMemoized(t,this.analysis.geometry,this.elevationInfo,this._queue,this._tileCache,this._options,"3d"===t.type?t.slice.plane:null):null}get elevationInfo(){return this.analysis.elevationInfo??P}get _options(){const t=this._activeComputations.length;let e=this._minDemResolution??j().defaultDemResolution;return e=parseFloat(e.toFixed(2)),this._getOptionsMemoized(e,t)}_update({stationary:t,activeComputations:e,generationParameters:o}){this._abortUpdate(),t&&(null!=o?this._updateTask=i(async t=>{this.error=null;const i=e.filter(t=>!this._isComputationValid(t,o)),s=R({...o,providers:i},{signal:t});try{for await(const e of s){u(t),this._clearInvalidResults(o);for(let t=0;t<i.length;t++)i[t].setResult(e[t])}for(const t of i)this._parametersPerComputation.set(t,o)}catch(r){m(r),this._abortUpdate(),this.error=r instanceof T?r:new T("unknown"),i.forEach(t=>{t.clearResult()})}}):this._clearResults())}_abortUpdate(){this._updateTask=l(this._updateTask)}_isComputationValid(t,e){return this._parametersPerComputation.has(t)&&this._parametersPerComputation.get(t)===e}_invalidateComputation(t){this._parametersPerComputation.delete(t),this._updateThrottled(this._updateParameters)}_clearInvalidResults(t){for(const e of this._computations)this._isComputationValid(e,t)||(e.clearResult(),this._parametersPerComputation.delete(e))}_clearResults(){for(const t of this._computations)t.clearResult(),this._parametersPerComputation.delete(t)}};t([y({constructOnly:!0})],z.prototype,"analysis",void 0),t([y({constructOnly:!0})],z.prototype,"analysisViewData",void 0),t([y({constructOnly:!0})],z.prototype,"computationFactory",void 0),t([y({constructOnly:!0})],z.prototype,"view",void 0),t([y()],z.prototype,"error",void 0),t([y({readOnly:!0})],z.prototype,"effectiveDisplayUnits",null),t([y()],z.prototype,"progress",null),t([y()],z.prototype,"updating",null),t([y()],z.prototype,"results",null),t([y()],z.prototype,"statistics",null),t([y()],z.prototype,"hoveredPoints",null),t([y()],z.prototype,"_queue",void 0),t([y()],z.prototype,"_tileCache",null),t([y()],z.prototype,"_computationsCollection",void 0),t([y()],z.prototype,"_computations",null),t([y()],z.prototype,"_activeComputations",null),t([y({readOnly:!0})],z.prototype,"_minDemResolution",null),t([y()],z.prototype,"_minDemResolutions",null),t([y()],z.prototype,"_updateParameters",null),t([y()],z.prototype,"_generationParameters",null),t([y()],z.prototype,"elevationInfo",null),t([y()],z.prototype,"_options",null),z=t([g("esri.views.analysis.ElevationProfile.ElevationProfileController")],z);export{z as ElevationProfileController};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as o}from"tslib";import t from"../../../core/Accessor.js";import e from"../../../core/Collection.js";import{watch as r,syncAndInitial as i}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 n}from"../../../core/accessorSupport/decorators/subclass.js";import{getInputGeometry as l}from"./elevationProfileGeometryUtils.js";import{ElevationProfileHoveredPointVisualization as a}from"./ElevationProfileHoveredPointVisualization.js";let p=class extends t{constructor(o){super(o),this._hoveredPoints=new e}initialize(){const{analysisViewData:o}=this,{analysis:t}=o;this.addHandles([r(()=>{const{hoveredPoints:e,visible:r,updating:i}=o;return r?i?null:e.map((o,e)=>{const r=t.profiles.at(e);return!0===r?.viewOptions.hoveredPointVisible&&null!=o?{hoveredPoint:o,color:r.color}:null}).filter(o=>!!o):[]},o=>this._update(o),i),r(()=>l(t.input),()=>this._update([]),i)])}destroy(){this._hoveredPoints.drain(o=>o.destroy())}get updating(){return!1}_update(o){if(!o)return;const{view:t,_hoveredPoints:e}=this,r=o.length;for(;e.length>r;)e.pop()?.destroy();for(;e.length<r;){const o=new a({view:t});e.push(o)}for(let i=0;i<r;++i){const t=o[i],s=e.at(r-1-i);s.position=t.hoveredPoint,s.color=t.color}}};o([s()],p.prototype,"view",void 0),o([s()],p.prototype,"analysisViewData",void 0),o([s()],p.prototype,"_hoveredPoints",void 0),o([s()],p.prototype,"updating",null),p=o([n("esri.views.analysis.ElevationProfile.ElevationProfileHoveredPointsVisualization")],p);export{p as ElevationProfileHoveredPointsVisualization};
5
+ import{__decorate as o}from"tslib";import t from"../../../core/Accessor.js";import e from"../../../core/Collection.js";import{watch as r,syncAndInitial as i}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 n}from"../../../core/accessorSupport/decorators/subclass.js";import{ElevationProfileHoveredPointVisualization as a}from"./ElevationProfileHoveredPointVisualization.js";let l=class extends t{constructor(o){super(o),this._hoveredPoints=new e}initialize(){const{analysisViewData:o}=this,{analysis:t}=o;this.addHandles([r(()=>{const{hoveredPoints:e,visible:r,updating:i}=o;return r?i?null:e.map((o,e)=>{const r=t.profiles.at(e);return!0===r?.viewOptions.hoveredPointVisible&&null!=o?{hoveredPoint:o,color:r.color}:null}).filter(o=>!!o):[]},o=>this._update(o),i),r(()=>t.geometry,()=>this._update([]),i)])}destroy(){this._hoveredPoints.drain(o=>o.destroy())}get updating(){return!1}_update(o){if(!o)return;const{view:t,_hoveredPoints:e}=this,r=o.length;for(;e.length>r;)e.pop()?.destroy();for(;e.length<r;){const o=new a({view:t});e.push(o)}for(let i=0;i<r;++i){const t=o[i],s=e.at(r-1-i);s.position=t.hoveredPoint,s.color=t.color}}};o([s()],l.prototype,"view",void 0),o([s()],l.prototype,"analysisViewData",void 0),o([s()],l.prototype,"_hoveredPoints",void 0),o([s()],l.prototype,"updating",null),l=o([n("esri.views.analysis.ElevationProfile.ElevationProfileHoveredPointsVisualization")],l);export{l as ElevationProfileHoveredPointsVisualization};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as o}from"tslib";import t from"../../../core/Accessor.js";import{watch as e,sync as r}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{getConfig as l}from"./constants.js";import n from"./ElevationProfileResult.js";let p=class extends t{constructor(o){super(o),this.result=new n({computation:this}),this.numSamplesForPreview=30,this.numSamplesPerChunk=200}initialize(){this.addHandles([e(()=>[this.controller.analysis.input],()=>this.onInvalidate(this),r)])}setResult(o){this.result.rawResult=o}clearResult(){this.setResult(null)}get progress(){return this.result.progress}get hoveredPoint(){return this.result.hoveredPoint}get available(){return!0}get minDemResolution(){return l().defaultDemResolution}};o([s({constructOnly:!0})],p.prototype,"controller",void 0),o([s({constructOnly:!0})],p.prototype,"profile",void 0),o([s({constructOnly:!0})],p.prototype,"onInvalidate",void 0),o([s()],p.prototype,"result",void 0),o([s({readOnly:!0})],p.prototype,"progress",null),o([s()],p.prototype,"hoveredPoint",null),o([s()],p.prototype,"available",null),o([s()],p.prototype,"numSamplesForPreview",void 0),o([s()],p.prototype,"numSamplesPerChunk",void 0),o([s({readOnly:!0})],p.prototype,"minDemResolution",null),p=o([i("esri.views.analysis.ElevationProfile.ElevationProfileLineComputation")],p);export{p as ElevationProfileLineComputation};
5
+ import{__decorate as o}from"tslib";import t from"../../../core/Accessor.js";import{watch as e,sync as r}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{getConfig as l}from"./constants.js";import n from"./ElevationProfileResult.js";let p=class extends t{constructor(o){super(o),this.result=new n({computation:this}),this.numSamplesForPreview=30,this.numSamplesPerChunk=200}initialize(){this.addHandles([e(()=>{const{geometry:o,elevationInfo:t}=this.controller.analysis;return[o,t]},()=>this.onInvalidate(this),r)])}setResult(o){this.result.rawResult=o}clearResult(){this.setResult(null)}get progress(){return this.result.progress}get hoveredPoint(){return this.result.hoveredPoint}get available(){return!0}get minDemResolution(){return l().defaultDemResolution}};o([s({constructOnly:!0})],p.prototype,"controller",void 0),o([s({constructOnly:!0})],p.prototype,"profile",void 0),o([s({constructOnly:!0})],p.prototype,"onInvalidate",void 0),o([s()],p.prototype,"result",void 0),o([s({readOnly:!0})],p.prototype,"progress",null),o([s()],p.prototype,"hoveredPoint",null),o([s()],p.prototype,"available",null),o([s()],p.prototype,"numSamplesForPreview",void 0),o([s()],p.prototype,"numSamplesPerChunk",void 0),o([s({readOnly:!0})],p.prototype,"minDemResolution",null),p=o([i("esri.views.analysis.ElevationProfile.ElevationProfileLineComputation")],p);export{p as ElevationProfileLineComputation};
@@ -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{memoize as t}from"../../../core/memoize.js";import{watch as o}from"../../../core/reactiveUtils.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 i}from"../../../core/accessorSupport/decorators/subclass.js";import{GeometryDescriptor as n}from"../../../layers/support/GeometryDescriptor.js";import{getGraphicEffectiveElevationInfo as s}from"../../../support/elevationInfoUtils.js";import{getInputGraphic as a}from"./elevationProfileGeometryUtils.js";import{ElevationProfileLineComputation as l}from"./ElevationProfileLineComputation.js";let p=class extends l{constructor(){super(...arguments),this.type="input",this.numSamplesForPreview=50,this.numSamplesPerChunk=500,this._getQueryElevationDependenciesMemoized=t((e,t,o,r,i)=>e&&o?{elevationInfo:e,visibleLayers:t,view:o,stationary:r,spatialReference:i}:null)}get available(){return!this.controller.analysisViewData.sketchGraphic?.geometry}initialize(){const e=()=>this.onInvalidate(this);this.addHandles([o(()=>this._queryElevationDependencies,e),this.controller.onElevationChange(e)])}async queryElevation(e,{noDataValue:t,signal:o}){const r=this._queryElevationDependencies;if(null==r)throw new Error(`${this.declaredClass}: no dependencies`);const{view:i,elevationInfo:s,spatialReference:a}=r;if("on-the-ground"===s.mode&&"3d"===i.type&&a){const r=await n.fromGeometry(e).project(a,o);if(!r)return{geometry:e,noDataValue:t};const s=i.elevationProvider;return r.coordinates.forEach(e=>{e.z=s.getElevation(e.x,e.y,0,a,"ground")??0}),{geometry:r.export(),noDataValue:t}}return{geometry:e,noDataValue:t}}get _queryElevationDependencies(){const{view:e}=this.controller;return this._getQueryElevationDependenciesMemoized(this._elevationInfo,this._visibleLayers,e,e.stationary,e.spatialReference)}get _elevationInfo(){const e=a(this.controller.analysis.input);return e?s(e):null}get _visibleLayers(){return"3d"!==this.controller.view.type?[]:this.controller.view?.map?.allLayers?.toArray().filter(e=>("graphics"!==e.type||!e.internal)&&e.visible)??[]}};e([r()],p.prototype,"available",null),e([r()],p.prototype,"_queryElevationDependencies",null),e([r()],p.prototype,"_elevationInfo",null),e([r()],p.prototype,"_visibleLayers",null),p=e([i("esri.views.analysis.ElevationProfile.ElevationProfileLineInputComputation")],p);export{p as ElevationProfileLineInputComputation};
5
+ import{__decorate as e}from"tslib";import{memoize as t}from"../../../core/memoize.js";import{watch as o}from"../../../core/reactiveUtils.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 i}from"../../../core/accessorSupport/decorators/subclass.js";import{GeometryDescriptor as n}from"../../../layers/support/GeometryDescriptor.js";import{ElevationProfileLineComputation as s}from"./ElevationProfileLineComputation.js";let a=class extends s{constructor(){super(...arguments),this.type="input",this.numSamplesForPreview=50,this.numSamplesPerChunk=500,this._getQueryElevationDependenciesMemoized=t((e,t,o,r,i)=>e&&o?{elevationInfo:e,visibleLayers:t,view:o,stationary:r,spatialReference:i}:null)}initialize(){const e=()=>this.onInvalidate(this);this.addHandles([o(()=>this._queryElevationDependencies,e),this.controller.onElevationChange(e)])}async queryElevation(e,{noDataValue:t,signal:o}){const r=this._queryElevationDependencies;if(null==r)throw new Error(`${this.declaredClass}: no dependencies`);const{view:i,elevationInfo:s,spatialReference:a}=r;if("on-the-ground"===s.mode&&"3d"===i.type&&a){const r=await n.fromGeometry(e).project(a,o);if(!r)return{geometry:e,noDataValue:t};const s=i.elevationProvider;return r.coordinates.forEach(e=>{e.z=s.getElevation(e.x,e.y,0,a,"ground")??0}),{geometry:r.export(),noDataValue:t}}return{geometry:e,noDataValue:t}}get _queryElevationDependencies(){const{view:e}=this.controller;return this._getQueryElevationDependenciesMemoized(this.controller.elevationInfo,this._visibleLayers,e,e.stationary,e.spatialReference)}get _visibleLayers(){return"3d"!==this.controller.view.type?[]:this.controller.view?.map?.allLayers?.toArray().filter(e=>("graphics"!==e.type||!e.internal)&&e.visible)??[]}};e([r()],a.prototype,"_queryElevationDependencies",null),e([r()],a.prototype,"_visibleLayers",null),a=e([i("esri.views.analysis.ElevationProfile.ElevationProfileLineInputComputation")],a);export{a as ElevationProfileLineInputComputation};
@@ -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{Clonable as e}from"../../../core/Clonable.js";import{memoize as o}from"../../../core/memoize.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 l from"../../../geometry/Point.js";import{binaryFindClosest as i}from"./elevationProfileGenerationUtils.js";import{convertSamples as n,convertStatistics as a}from"./elevationProfileUnitUtils.js";let p=class extends e{constructor(t){super(t),this._getSamplesMemoized=o((t,e)=>n(t,e)),this._getStatisticsMemoized=o((t,e)=>a(t,e)),this.rawResult=null}get available(){const{computation:t}=this;return t.profile.enabled&&t.available}get profile(){return this.computation.profile}get progress(){return null!=this.rawResult&&this.computation.profile.enabled?this.rawResult.progress:0}get samples(){return this._getSamplesMemoized(this.rawResult,this.computation.controller.effectiveUnits)}get statistics(){return this._getStatisticsMemoized(this.rawResult,this.computation.controller.effectiveUnits)}get hoveredPoint(){if(!this.computation.profile.enabled)return null;const t=this.computation.controller.analysisViewData.hoveredPosition;if(null==t)return null;const{rawResult:e,samples:o}=this;if(null==o||null==e)return null;const r=o.length;if(0===r)return null;const s=o[r-1].distance,n=i(o,t*s,t=>t.distance);if(null==n)return null;const{x:a,y:p,z:u}=n;return null==u?null:new l({x:a,y:p,z:u,spatialReference:e.spatialReference})}};t([r()],p.prototype,"available",null),t([r({readOnly:!0})],p.prototype,"profile",null),t([r({readOnly:!0})],p.prototype,"progress",null),t([r()],p.prototype,"samples",null),t([r()],p.prototype,"statistics",null),t([r({constructOnly:!0})],p.prototype,"computation",void 0),t([r()],p.prototype,"rawResult",void 0),t([r()],p.prototype,"hoveredPoint",null),p=t([s("esri.views.analysis.ElevationProfile.ElevationProfileResult")],p);export{p as default};
5
+ import{__decorate as t}from"tslib";import{Clonable as e}from"../../../core/Clonable.js";import{memoize as o}from"../../../core/memoize.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 l from"../../../geometry/Point.js";import{binaryFindClosest as i}from"./elevationProfileGenerationUtils.js";import{convertSamples as n,convertStatistics as a}from"./elevationProfileUnitUtils.js";let p=class extends e{constructor(t){super(t),this._getSamplesMemoized=o((t,e)=>n(t,e)),this._getStatisticsMemoized=o((t,e)=>a(t,e)),this.rawResult=null}get available(){const{computation:t}=this;return t.profile.enabled&&t.available}get profile(){return this.computation.profile}get progress(){return null!=this.rawResult&&this.computation.profile.enabled?this.rawResult.progress:0}get samples(){return this._getSamplesMemoized(this.rawResult,this.computation.controller.effectiveDisplayUnits)}get statistics(){return this._getStatisticsMemoized(this.rawResult,this.computation.controller.effectiveDisplayUnits)}get hoveredPoint(){if(!this.computation.profile.enabled)return null;const t=this.computation.controller.analysisViewData.hoveredPosition;if(null==t)return null;const{rawResult:e,samples:o}=this;if(null==o||null==e)return null;const r=o.length;if(0===r)return null;const s=o[r-1].distance,n=i(o,t*s,t=>t.distance);if(null==n)return null;const{x:a,y:p,z:u}=n;return null==u?null:new l({x:a,y:p,z:u,spatialReference:e.spatialReference})}};t([r()],p.prototype,"available",null),t([r({readOnly:!0})],p.prototype,"profile",null),t([r({readOnly:!0})],p.prototype,"progress",null),t([r()],p.prototype,"samples",null),t([r()],p.prototype,"statistics",null),t([r({constructOnly:!0})],p.prototype,"computation",void 0),t([r()],p.prototype,"rawResult",void 0),t([r()],p.prototype,"hoveredPoint",null),p=t([s("esri.views.analysis.ElevationProfile.ElevationProfileResult")],p);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{__decorate as t}from"tslib";import e from"../../../Graphic.js";import i from"../../../core/Accessor.js";import{isSome as s}from"../../../core/arrayUtils.js";import{createTask as a}from"../../../core/asyncUtils.js";import"../../../core/has.js";import{makeHandle as r,handlesGroup as o}from"../../../core/handleUtils.js";import{ignoreAbortErrors as n,isAborted as p,createResolver as c,throwIfAborted as l,createAbortError as h,onAbort as d}from"../../../core/promiseUtils.js";import{watch as m,syncAndInitial as u}from"../../../core/reactiveUtils.js";import{property as y}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/Logger.js";import{subclass as _}from"../../../core/accessorSupport/decorators/subclass.js";import{UpdatingHandles as f}from"../../../core/support/UpdatingHandles.js";import k from"../../../layers/GraphicsLayer.js";import g from"../../../symbols/CIMSymbol.js";import w from"../../../symbols/SimpleLineSymbol.js";import{isPolylineGraphic as v,isPolyline as b,isValidInputGraphic as G}from"./elevationProfileGeometryUtils.js";import{ViewEventPriorities as S}from"../../input/InputManager.js";import{isCancelEvent as O}from"../../interactive/interactiveToolUtils.js";import I from"../../../widgets/Sketch/SketchViewModel.js";const j=Symbol("main"),V=Symbol("interactive-operation");let M=class extends i{constructor(t){super(t),this._updatingHandles=new f,this._activeOperationInfo=null}initialize(){const{view:t}=this;this._graphicsLayer=new k({listMode:"hide",internal:!0,elevationInfo:{mode:"absolute-height",offset:null}}),this._sketchViewModel=new I({layer:this._graphicsLayer,view:t,defaultCreateOptions:{mode:"click",hasZ:!0},updateOnGraphicClick:!1,defaultUpdateOptions:{reshapeOptions:{shapeOperation:"none"},enableRotation:!1,enableScaling:!1,enableMoveAllGraphics:!1,enableZ:!1,multipleSelectionEnabled:!1,toggleToolOnClick:!1,tool:"reshape"},polylineSymbol:this._lineSymbol,activeLineSymbol:this._lineSymbol}),this.addHandles(m(()=>({map:t.map,internalGraphicsLayer:this._graphicsLayer,state:this.state}),({map:t,internalGraphicsLayer:e,state:i})=>{switch(D(t,e),i){case"idle":case"selected":case"reshaping-disabled":this._stopOperation(),this._ensureUpdatedSketchGraphic();break;case"reshaping":this._startReshape()}},u),j)}destroy(){this._sketchViewModel.destroy();const t=this._graphicsLayer;t&&this.view.map?.remove(t),t.destroy()}get sketchGraphic(){return this._get("sketchGraphic")}set sketchGraphic(t){t!==this._get("sketchGraphic")&&(this._set("sketchGraphic",t),U(this._graphicsLayer,t),this._updateInputFromSketchGraphic())}get state(){const{analysis:t,visible:e,interactive:i}=this.analysisViewData;if(!e)return"idle";switch(this._activeOperationInfo?.type){case"place":return this._sketchViewModel.createGraphic===this.sketchGraphic?"sketching":"awaiting-sketch";case"pick-graphic":return"picking";default:{const{input:e}=t;return e?v(e)?"selected":i?"reshaping":"reshaping-disabled":"idle"}}}get updating(){return this._sketchViewModel.updating||this._updatingHandles.updating}get _lineSymbol(){return L(this.view.type)}place(t){return this._startOperation("place",t,(e,i)=>{const s=this.analysisViewData.analysis.clone(),a=this._sketchViewModel.on("create",t=>{switch(t.state){case"complete":this._updateInputFromSketchGraphic(),this._stopOperation();break;case"cancel":this._stopOperation();break;case"active":this._updateInputFromSketchGraphic();break;case"start":this.sketchGraphic=t.graphic}});return this._ensureUpdatedSketchGraphic(),this._updatingHandles.addPromise(n(this._sketchViewModel.create("polyline"))),r(()=>(a.remove(),this._sketchViewModel.cancel(),this._updateInputFromSketchGraphic(),this.analysisViewData.analysis.valid?p(t)||s.equals(this.analysisViewData.analysis)?i():void e():(this._clearInput(),i())))})}async pickGraphic(t){return this._startOperation("pick-graphic",t,(t,e)=>{const{view:i}=this;i.closePopup();let s=null;const n=r=>{r.defer(async()=>{s?.abort(),s=a(async s=>{const{results:a}=await i.hitTest(r);l(s);const o=a.filter(t=>"graphic"===t.type).map(t=>t.graphic).find(G);o?(r.preventDefault(),r.stopPropagation(),this.sketchGraphic=null,this.analysisViewData.analysis.input=o,t(),this._stopOperation()):e()}),await s.promise})},p=t=>{O(t)&&(e(),this._stopOperation())};return i.focus(),o([i.on("immediate-click",n,S.TOOL),i.on("key-down",p,S.TOOL),i.acquireCursor("crosshair","high"),r(()=>{s?.abort(),e()})])})}_startReshape(){this._stopOperation();const t=this._sketchViewModel.on("update",t=>{this._updateInputFromSketchGraphic(),"complete"===t.state&&("reshaping"===this.state?this._startReshape():this._stopOperation())});this._replaceHandles(r(()=>{t.remove(),this._sketchViewModel.cancel()}),V);const e=this._ensureUpdatedSketchGraphic();e&&this._updatingHandles.addPromise(n(this._sketchViewModel.update(e,{tool:"reshape"})))}async _startOperation(t,e,i){const s=this._activeOperationInfo,a=c(),r={type:t,promise:a.promise};if(this._activeOperationInfo=r,s){const t=s.promise.catch(()=>{});this._stopOperation(),await t,l(e)}this.analysisViewData.interactive=!0;const o=i(()=>a.resolve({}),()=>a.reject(h()));this._replaceHandles([o,d(e,()=>this._stopOperation())],V);try{return await a.promise}finally{this._activeOperationInfo===r&&(this._activeOperationInfo=null)}}_stopOperation(){this.removeHandles(V)}_ensureUpdatedSketchGraphic(){const{input:t}=this.analysisViewData.analysis;return b(t)?(this.sketchGraphic??=new e({symbol:this._lineSymbol,geometry:t}),this.sketchGraphic.geometry=t,this.sketchGraphic):(this.sketchGraphic=null,null)}_clearInput(){this.sketchGraphic=null,this.analysisViewData.analysis.input=null}_updateInputFromSketchGraphic(){const t=this.sketchGraphic,{analysis:e}=this.analysisViewData;e.input=v(t)?t.geometry:null}_replaceHandles(t,e){this.removeHandles(e),this.addHandles((Array.isArray(t)?t:[t]).filter(s),e)}};function L(t){if("2d"===t){const t={type:"CIMSolidStroke",enable:!0,capStyle:"Butt",joinStyle:"Round",width:1.5};return new g({data:{type:"CIMSymbolReference",symbol:{type:"CIMLineSymbol",symbolLayers:[{...t,effects:[{type:"CIMGeometricEffectDashes",dashTemplate:[5,4],lineDashEnding:"FullGap",controlPointEnding:"NoConstraint"}],color:[0,0,0,255]},{...t,color:[255,255,255,255]}]}}})}return new w({color:[0,0,0,0]})}function D(t,e){e&&(e.removeFromParent(),t?.add(e))}function U({graphics:t},e){e?(t.includes(e)||t.add(e),1!==t.length&&t.removeMany(t.filter(t=>t!==e))):t.removeAll()}t([y({constructOnly:!0})],M.prototype,"analysisViewData",void 0),t([y({constructOnly:!0})],M.prototype,"view",void 0),t([y()],M.prototype,"sketchGraphic",null),t([y({nonNullable:!0})],M.prototype,"state",null),t([y()],M.prototype,"updating",null),t([y()],M.prototype,"_activeOperationInfo",void 0),t([y()],M.prototype,"_lineSymbol",null),M=t([_("esri.views.analysis.ElevationProfile.ElevationProfileTool")],M);export{M as ElevationProfileTool};
5
+ import{__decorate as e}from"tslib";import t from"../../../Graphic.js";import i from"../../../core/Accessor.js";import{isSome as s}from"../../../core/arrayUtils.js";import{createTask as a}from"../../../core/asyncUtils.js";import"../../../core/has.js";import{makeHandle as r,handlesGroup as o}from"../../../core/handleUtils.js";import{ignoreAbortErrors as n,isAborted as l,createResolver as c,throwIfAborted as p,createAbortError as h,onAbort as m}from"../../../core/promiseUtils.js";import{watch as d,syncAndInitial as y}from"../../../core/reactiveUtils.js";import{property as u}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/Logger.js";import{subclass as _}from"../../../core/accessorSupport/decorators/subclass.js";import{UpdatingHandles as f}from"../../../core/support/UpdatingHandles.js";import g from"../../../layers/GraphicsLayer.js";import{getGraphicEffectiveElevationInfo as k}from"../../../support/elevationInfoUtils.js";import v from"../../../symbols/CIMSymbol.js";import b from"../../../symbols/SimpleLineSymbol.js";import w from"../../../symbols/support/ElevationInfo.js";import{isPolyline as G,isValidInputGraphic as S}from"./elevationProfileGeometryUtils.js";import{ViewEventPriorities as O}from"../../input/InputManager.js";import{isCancelEvent as j}from"../../interactive/interactiveToolUtils.js";import M from"../../../widgets/Sketch/SketchViewModel.js";const V=Symbol("main"),I=Symbol("interactive-operation");let L=class extends i{constructor(e){super(e),this._updatingHandles=new f,this._activeOperationInfo=null}initialize(){const{view:e}=this;this._graphicsLayer=new g({listMode:"hide",internal:!0,elevationInfo:{mode:"absolute-height",offset:null}}),this._sketchViewModel=new M({layer:this._graphicsLayer,view:e,defaultCreateOptions:{mode:"click",hasZ:!0},updateOnGraphicClick:!1,defaultUpdateOptions:{reshapeOptions:{shapeOperation:"none"},enableRotation:!1,enableScaling:!1,enableMoveAllGraphics:!1,enableZ:!1,multipleSelectionEnabled:!1,toggleToolOnClick:!1,tool:"reshape"},polylineSymbol:this._lineSymbol,activeLineSymbol:this._lineSymbol}),this.addHandles(d(()=>({map:e.map,internalGraphicsLayer:this._graphicsLayer,state:this.state,sketchGraphicVisible:this._analysis.viewOptions.geometryVisualizationVisible}),({map:e,internalGraphicsLayer:t,state:i,sketchGraphicVisible:s})=>{H(e,t);const a=this.sketchGraphic;switch(a&&(a.visible=!0),i){case"idle":case"reshaping-disabled":a&&!s&&(a.visible=!1),this._stopOperation(),this._ensureUpdatedSketchGraphic();break;case"reshaping":this._startReshape()}},y),V)}destroy(){this._sketchViewModel.destroy();const e=this._graphicsLayer;e&&this.view.map?.remove(e),e.destroy()}get sketchGraphic(){return this._get("sketchGraphic")}set sketchGraphic(e){e!==this._get("sketchGraphic")&&(this._set("sketchGraphic",e),A(this._graphicsLayer,e),this._updateAnalysisFromSketchGraphic())}get state(){const{visible:e,interactive:t}=this.analysisViewData;if(!e)return"idle";switch(this._activeOperationInfo?.type){case"place":return this._sketchViewModel.createGraphic===this.sketchGraphic?"sketching":"awaiting-sketch";case"pick-graphic":return"picking";default:return this._analysis.geometry?t?"reshaping":"reshaping-disabled":"idle"}}get updating(){return this._sketchViewModel.updating||this._updatingHandles.updating}get _analysis(){return this.analysisViewData.analysis}get _lineSymbol(){return U(this.view.type)}place(e){return this._startOperation("place",e,(t,i)=>{this.analysisViewData.interactive=!0;const s=this._analysis.clone(),a=this._sketchViewModel.on("create",e=>{switch(e.state){case"start":this.sketchGraphic=e.graphic;break;case"active":this._updateAnalysisFromSketchGraphic();break;case"complete":this._updateAnalysisFromSketchGraphic(),this._stopOperation();break;case"cancel":this._stopOperation()}});return this._ensureUpdatedSketchGraphic(),this._updatingHandles.addPromise(n(this._sketchViewModel.create("polyline"))),r(()=>(a.remove(),this._sketchViewModel.cancel(),this._updateAnalysisFromSketchGraphic(),this._analysis.valid?l(e)||s.equals(this._analysis)?i():void t({}):(this._clear(),i())))})}async pickGraphic(e){return this._startOperation("pick-graphic",e,(e,t)=>{const{view:i}=this;i.closePopup();let s=null;const n=r=>{r.defer(async()=>{s?.abort(),s=a(async s=>{const{results:a}=await i.hitTest(r);p(s);const o=a.filter(e=>"graphic"===e.type).map(e=>e.graphic).find(S);o?(r.preventDefault(),r.stopPropagation(),this.sketchGraphic=null,this._analysis.geometry=o.geometry,this._analysis.elevationInfo=new w({...k(o)}),e({graphic:o}),this._stopOperation()):t()}),await s.promise})},l=e=>{j(e)&&(t(),this._stopOperation())};return i.focus(),o([i.on("immediate-click",n,O.TOOL),i.on("key-down",l,O.TOOL),i.acquireCursor("crosshair","high"),r(()=>{s?.abort(),t()})])})}_startReshape(){this._stopOperation();const e=this._sketchViewModel.on("update",e=>{this._updateAnalysisFromSketchGraphic(),"complete"===e.state&&("reshaping"===this.state?this._startReshape():this._stopOperation())});this._replaceHandles(r(()=>{e.remove(),this._sketchViewModel.cancel()}),I);const t=this._ensureUpdatedSketchGraphic();t&&this._updatingHandles.addPromise(n(this._sketchViewModel.update(t,{tool:"reshape"})))}async _startOperation(e,t,i){const s=this._activeOperationInfo,a=c(),r={type:e,promise:a.promise};if(this._activeOperationInfo=r,s){const e=s.promise.catch(()=>{});this._stopOperation(),await e,p(t)}const o=i(e=>a.resolve(e),()=>a.reject(h()));this._replaceHandles([o,m(t,()=>this._stopOperation())],I);try{return await a.promise}finally{this._activeOperationInfo===r&&(this._activeOperationInfo=null)}}_stopOperation(){this.removeHandles(I)}_ensureUpdatedSketchGraphic(){const{geometry:e}=this._analysis;if(!e)return this.sketchGraphic=null,null;const i=this.sketchGraphic??=new t({symbol:this._lineSymbol,geometry:e});return i.geometry=e,i}_clear(){this.sketchGraphic=null,this._analysis.clear()}_updateAnalysisFromSketchGraphic(){let e=this.sketchGraphic?.geometry;G(e)||(e=null);const t=this._analysis;t.geometry!==e&&(t.geometry=e)}_replaceHandles(e,t){this.removeHandles(t),this.addHandles((Array.isArray(e)?e:[e]).filter(s),t)}};function U(e){if("2d"===e){const e={type:"CIMSolidStroke",enable:!0,capStyle:"Butt",joinStyle:"Round",width:1.5};return new v({data:{type:"CIMSymbolReference",symbol:{type:"CIMLineSymbol",symbolLayers:[{...e,effects:[{type:"CIMGeometricEffectDashes",dashTemplate:[5,4],lineDashEnding:"FullGap",controlPointEnding:"NoConstraint"}],color:[0,0,0,255]},{...e,color:[255,255,255,255]}]}}})}return new b({color:[0,0,0,0]})}function H(e,t){t&&(t.removeFromParent(),e?.add(t))}function A({graphics:e},t){t?(e.includes(t)||e.add(t),1!==e.length&&e.removeMany(e.filter(e=>e!==t))):e.removeAll()}e([u({constructOnly:!0})],L.prototype,"analysisViewData",void 0),e([u({constructOnly:!0})],L.prototype,"view",void 0),e([u()],L.prototype,"sketchGraphic",null),e([u({nonNullable:!0})],L.prototype,"state",null),e([u()],L.prototype,"updating",null),e([u()],L.prototype,"_activeOperationInfo",void 0),e([u()],L.prototype,"_analysis",null),e([u()],L.prototype,"_lineSymbol",null),L=e([_("esri.views.analysis.ElevationProfile.ElevationProfileTool")],L);export{L as ElevationProfileTool};
@@ -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=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};
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=O(e);h=f([n],"meters")[0];const r=w(h,i);if(B(e,h,r)>a)throw new g("too-complex");const j=R(n,t,o);({densifiedPath:m,distances:d}=G(j,r,P)),m=u(m,s)}else{await c([{source:y,dest:s}],p),h=v;const r=w(h,i);if(B(e,h,r)>a)throw new g("too-complex");const l=R(e,t,o);({densifiedPath:m,distances:d}=z(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 b(e)&&U(e?.geometry)}function U(e){return!b(e)&&null!=e&&"polyline"===e.type}function b(e){return null!=e&&"geometry"in e}function A(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 z(e,t,n){const{hasZ:r}=e;return A(e,t,n,W,r?L:I)}function G(e,t,n){const{hasZ:r}=e;return A(e,t,n,E,r?D:k)}function E(e,t,n){return e.distance=0,h(e,t,n,e.spatialReference),e.from=t,e.to=n,e}function W(e,t,n){return e.from=t,e.to=n,e.distance=o(n,t)*e.metersPerSR,e}function k({from:e,azimuth:t,spatialReference:n},r){return m([0,0],e,t,r,n)}function D({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 I({from:e,to:t,distance:n},r){return s([0,0],e,t,r/n)}function L({from:e,to:t,distance:n},r){return i([0,0,0],e,t,r/n)}function O(e){return p(e.spatialReference)?e:u(e,l.WGS84)}function q(e){return e.paths.reduce((e,t)=>e+t.length,0)}function B(e,t,n){return q(e)+Math.floor(t/n)+Math.max(0,e.paths.reduce(e=>1+e,0)-1)}export{q as countPoints,y as densifyPath,b as isGraphic,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{handlesGroup as i}from"../../../core/handleUtils.js";import{watch as t,syncAndInitial as e}from"../../../core/reactiveUtils.js";import{isPolylineGraphic as r}from"./elevationProfileGeometryUtils.js";function n(n){return i([t(()=>{const{analysis:i,sketchGraphic:t,toolState:e,visible:a}=n.analysisViewData,{input:h,viewOptions:o}=i,{highlightEnabled:l}=o,s=r(h)?h:null,p=s?.layer;return{inputGraphic:s,inputGraphicLayer:p,sketchGraphic:t,toolState:e,visible:a,highlightEnabled:l}},({inputGraphic:i,inputGraphicLayer:t,sketchGraphic:e,toolState:r,visible:a,highlightEnabled:h})=>{if(n.onRemove(),!a)return;if(null!=e&&"reshaping"!==r&&"sketching"!==r)return n.onShowSketchedGraphic(e);return i&&!e&&h?n.onHighlight(i,t):void 0},e)])}export{n as connectVisualization};
5
+ import{handlesGroup as i}from"../../../core/handleUtils.js";import{watch as e,syncAndInitial as t}from"../../../core/reactiveUtils.js";function o(o){return i([e(()=>{const{analysis:i,sketchGraphic:e,toolState:t,visible:r}=o.analysisViewData,{geometryVisualizationVisible:s}=i.viewOptions;return{geometryVisualizationVisible:s,geometry:i.geometry,sketchGraphic:e,toolState:t,visible:r}},({geometryVisualizationVisible:i,sketchGraphic:e,toolState:t,visible:r})=>{if(o.onRemove(),r)return i&&null!=e&&"reshaping"!==t&&"sketching"!==t?o.onShowSketchedGraphic(e):void 0},t)])}export{o as connectVisualization};
@@ -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{cyclicalPI as e,cyclical2PI as t}from"../../../core/Cyclical.js";import{valueInUnit as s,createAngle as r}from"../../../core/quantityUtils.js";import{create as i}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{absoluteHeightElevationInfo as o}from"../../../support/elevationInfoUtils.js";import{fromAnyMapPoint as n,markAsTarget as a,fromVec3 as l}from"../sketch/normalizedPoint.js";import{SnappingAlgorithm as p}from"./SnappingAlgorithm.js";import{editEdgeToSnappingEdge as h,squaredScreenDistance as c}from"./snappingUtils.js";import{LineSnappingCandidate as d}from"./candidates/LineSnappingCandidate.js";import{vectorToScreenPoint as m}from"../support/viewUtils.js";import{radiansGeographicBetweenVec as g,pointFromDistanceAlongAzimuth as f}from"../../support/angularMeasurementUtils.js";import{projectPointToLineLike as u}from"../../support/geometry3dUtils.js";class x extends p{constructor(e,t,s){super(e,t),this._geodesicLengthMeasurementUtils=s}snapNewVertex(e,t){const s=t.editGeometryOperations.data.parts[0],r=s.segments.length,i=[];if(r<1)return i;const{spatialReference:n}=t,a=m(e,n,o,this.view),{view:l}=this,p=s.segments[r-1];let c=p;do{if(this.edgeExceedsShortLineThreshold(c,t)){const s=h(c,l,t);this._processCandidateProposal(s.left,s.right,e,a,t,i)}c=c.leftVertex.leftSegment}while(c&&c!==p);return i}snapExistingVertex(e,t){const s=[],r=t.vertexHandle,i=r.part;if(i.segments.length<2)return s;const{view:a}=this,{spatialReference:l}=t,p=m(e,l,o,a),c=r.leftSegment,d=r.rightSegment;c&&d&&this.edgeExceedsShortLineThreshold(c,t)&&this.edgeExceedsShortLineThreshold(d,t)&&this._processCandidateProposal(n(c.leftVertex.pos,a,t),n(d.rightVertex.pos,a,t),e,p,t,s);const g=i.segments[0];let f=g;do{if(f!==r.leftSegment&&f!==r.rightSegment&&this.edgeExceedsShortLineThreshold(f,t)){const r=h(f,a,t);this._processCandidateProposal(r.left,r.right,e,p,t,s)}f=f.rightVertex.rightSegment}while(f&&f!==g);return s}_processCandidateProposal(e,t,s,r,n,p){const{spatialReference:h,pointer:g}=n,f=i();S(f,e,t,s,n,this._geodesicLengthMeasurementUtils);const u=a(l(f));c(r,m(u,h,o,this.view))<this.squaredProximityThreshold(g)&&p.push(new d({lineStart:e,lineEnd:t,targetPoint:u,isDraped:"on-the-ground"===n.elevationInfo?.mode}))}}function S(e,t,s,r,i,o){j(e,t,s,r,i,o)||v(e,r,t,s)}function j(i,o,n,a,{spatialReference:l},p){const h=g(o,n,l,l);if(null==h)return!1;const c=g(n,a,l,l);if(null==c)return!1;const d=p.geodesicDistance(n,a,l);if(null==d)return!1;const m=Math.abs(e.shortestSignedDiff(h,c))>Math.PI/2?t.normalize(h+Math.PI):h;return f(i,n,l,s(d,"meters"),r(m,"radians","geographic"),"geodesic"),i[2]=a[2],!0}function v(e,t,s,r){u(t,{start:s,end:r,type:1},e),e[2]=t[2]}export{x as LineSnapper};
5
+ import{cyclicalPI as e,cyclical2PI as t}from"../../../core/Cyclical.js";import{valueInUnit as s,createAngle as r}from"../../../core/quantityUtils.js";import{create as i}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{absoluteHeightElevationInfo as o}from"../../../support/elevationInfoUtils.js";import{fromAnyMapPoint as n,markAsTarget as a,fromVec3 as l}from"../sketch/normalizedPoint.js";import{SnappingAlgorithm as p}from"./SnappingAlgorithm.js";import{isLine as h,editEdgeToSnappingEdge as c,squaredScreenDistance as d}from"./snappingUtils.js";import{LineSnappingCandidate as m}from"./candidates/LineSnappingCandidate.js";import{vectorToScreenPoint as g}from"../support/viewUtils.js";import{radiansGeographicBetweenVec as f,pointFromDistanceAlongAzimuth as u}from"../../support/angularMeasurementUtils.js";import{projectPointToLineLike as x}from"../../support/geometry3dUtils.js";class S extends p{constructor(e,t,s){super(e,t),this._geodesicLengthMeasurementUtils=s}snapNewVertex(e,t){const s=t.editGeometryOperations.data.parts[0],r=s.segments.length,i=[];if(r<1)return i;const{spatialReference:n}=t,a=g(e,n,o,this.view),{view:l}=this,p=s.segments[r-1];let d=p;do{if(h(d)&&this.edgeExceedsShortLineThreshold(d,t)){const s=c(d,l,t);this._processCandidateProposal(s.left,s.right,e,a,t,i)}d=d.leftVertex.leftSegment}while(d&&d!==p);return i}snapExistingVertex(e,t){const s=[],r=t.vertexHandle,i=r.part;if(i.segments.length<2)return s;const{view:a}=this,{spatialReference:l}=t,p=g(e,l,o,a),d=r.leftSegment,m=r.rightSegment;h(d)&&h(m)&&this.edgeExceedsShortLineThreshold(d,t)&&this.edgeExceedsShortLineThreshold(m,t)&&this._processCandidateProposal(n(d.leftVertex.pos,a,t),n(m.rightVertex.pos,a,t),e,p,t,s);const f=i.segments[0];let u=f;do{if(h(u)&&u!==r.leftSegment&&u!==r.rightSegment&&this.edgeExceedsShortLineThreshold(u,t)){const r=c(u,a,t);this._processCandidateProposal(r.left,r.right,e,p,t,s)}u=u.rightVertex.rightSegment}while(u&&u!==f);return s}_processCandidateProposal(e,t,s,r,n,p){const{spatialReference:h,pointer:c}=n,f=i();j(f,e,t,s,n,this._geodesicLengthMeasurementUtils);const u=a(l(f));d(r,g(u,h,o,this.view))<this.squaredProximityThreshold(c)&&p.push(new m({lineStart:e,lineEnd:t,targetPoint:u,isDraped:"on-the-ground"===n.elevationInfo?.mode}))}}function j(e,t,s,r,i,o){v(e,t,s,r,i,o)||w(e,r,t,s)}function v(i,o,n,a,{spatialReference:l},p){const h=f(o,n,l,l);if(null==h)return!1;const c=f(n,a,l,l);if(null==c)return!1;const d=p.geodesicDistance(n,a,l);if(null==d)return!1;const m=Math.abs(e.shortestSignedDiff(h,c))>Math.PI/2?t.normalize(h+Math.PI):h;return u(i,n,l,s(d,"meters"),r(m,"radians","geographic"),"geodesic"),i[2]=a[2],!0}function w(e,t,s,r){x(t,{start:s,end:r,type:1},e),e[2]=t[2]}export{S as LineSnapper};
@@ -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{squaredDistance as e}from"../../../core/libs/gl-matrix-2/math/vec2.js";import{create as t}from"../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{absoluteHeightElevationInfo as r}from"../../../support/elevationInfoUtils.js";import{fromAnyMapPoint as i,asVec2 as s,markAsTarget as n,fromValues as o}from"../sketch/normalizedPoint.js";import{defaults as l}from"./Settings.js";import{SnappingAlgorithm as a}from"./SnappingAlgorithm.js";import{editEdgeToSnappingEdge as c,squaredScreenDistance as h}from"./snappingUtils.js";import{ParallelLineSnappingCandidate as p}from"./candidates/ParallelLineSnappingCandidate.js";import{vectorToScreenPoint as g}from"../support/viewUtils.js";import{projectPointToLine as f}from"../../support/geometry2dUtils.js";class m extends a{snapNewVertex(e,t){const s=t.editGeometryOperations.data.parts[0],n=s.segments.length,o=s.vertices.length,l=[];if(n<2)return l;const{view:a}=this,h=g(e,t.spatialReference,r,a),p=i(s.vertices[o-1].pos,a,t),f=i(s.vertices[0].pos,a,t),m=s.segments[n-1];let d=m;do{if(this.edgeExceedsShortLineThreshold(d,t)){const r=c(d,a,t);this._checkEdgeForParallelLines(r,p,e,h,t,l),this._checkEdgeForParallelLines(r,f,e,h,t,l)}d=d.leftVertex.leftSegment}while(d&&d!==m);return l}snapExistingVertex(e,t){const s=[],n=t.vertexHandle,o=n.part;if(o.segments.length<3)return s;const{view:l}=this,a=g(e,t.spatialReference,r,l),h=n.leftSegment,p=n.rightSegment,f=o.vertices[0],m=i(f.pos,l,t),d=o.vertices.length,u=o.vertices[d-1],v=i(u.pos,l,t),x=o.segments[0];let L=x;do{if(L!==h&&L!==p&&this.edgeExceedsShortLineThreshold(L,t)){const r=c(L,l,t);h&&this._checkEdgeForParallelLines(r,i(h.leftVertex.pos,l,t),e,a,t,s),p&&this._checkEdgeForParallelLines(r,i(p.rightVertex.pos,l,t),e,a,t,s),n===f?this._checkEdgeForParallelLines(r,v,e,a,t,s):n===u&&this._checkEdgeForParallelLines(r,m,e,a,t,s)}L=L.rightVertex.rightSegment}while(L&&L!==x);return s}_checkEdgeForParallelLines(t,i,a,c,m,v){const x=t.left,L=t.right;if(f(u,s(i),s(x),s(L)),e(u,s(i))<l.parallelLineThreshold)return;f(u,s(a),s(x),s(L),s(i));const{spatialReference:P,pointer:j}=m,E=n(o(u[0],u[1],a[2]));if(h(c,g(E,P,r,this.view))<this.squaredProximityThreshold(j)){if(this.isVertical(E,i,m)||this.isVertical(x,L,m))return;if(d(t,v))return;v.push(new p({referenceLine:t,lineStart:i,targetPoint:E,isDraped:"on-the-ground"===m.elevationInfo?.mode}))}}}function d(t,r){const i=t.left,n=t.right;for(const o of r)if(f(u,s(n),s(o.constraint.start),s(o.constraint.end),s(i)),e(u,s(n))<l.parallelLineThreshold)return o.addReferenceLine(t),!0;return!1}const u=t();export{m as ParallelLineSnapper};
5
+ import{squaredDistance as e}from"../../../core/libs/gl-matrix-2/math/vec2.js";import{create as t}from"../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{absoluteHeightElevationInfo as r}from"../../../support/elevationInfoUtils.js";import{fromAnyMapPoint as i,asVec2 as s,markAsTarget as n,fromValues as o}from"../sketch/normalizedPoint.js";import{defaults as l}from"./Settings.js";import{SnappingAlgorithm as a}from"./SnappingAlgorithm.js";import{isLine as c,editEdgeToSnappingEdge as h,squaredScreenDistance as p}from"./snappingUtils.js";import{ParallelLineSnappingCandidate as g}from"./candidates/ParallelLineSnappingCandidate.js";import{vectorToScreenPoint as m}from"../support/viewUtils.js";import{projectPointToLine as f}from"../../support/geometry2dUtils.js";class d extends a{snapNewVertex(e,t){const s=t.editGeometryOperations.data.parts[0],n=s.segments.length,o=s.vertices.length,l=[];if(n<2)return l;const{view:a}=this,p=m(e,t.spatialReference,r,a),g=s.vertices[0],f=s.vertices[o-1],d=c(f.leftSegment)?i(f.pos,a,t):null,u=c(g.rightSegment)?i(g.pos,a,t):null,v=s.segments[n-1];let x=v;do{if(c(x)&&this.edgeExceedsShortLineThreshold(x,t)){const r=h(x,a,t);d&&this._checkEdgeForParallelLines(r,d,e,p,t,l),u&&this._checkEdgeForParallelLines(r,u,e,p,t,l)}x=x.leftVertex.leftSegment}while(x&&x!==v);return l}snapExistingVertex(e,t){const s=[],n=t.vertexHandle,o=n.part;if(o.segments.length<3)return s;const{view:l}=this,a=m(e,t.spatialReference,r,l),p=n.leftSegment,g=n.rightSegment,f=o.vertices[0],d=i(f.pos,l,t),u=o.vertices.length,v=o.vertices[u-1],x=i(v.pos,l,t),L=o.segments[0];let S=L;do{if(c(S)&&S!==p&&S!==g&&this.edgeExceedsShortLineThreshold(S,t)){const r=h(S,l,t);c(p)&&this._checkEdgeForParallelLines(r,i(p.leftVertex.pos,l,t),e,a,t,s),c(g)&&this._checkEdgeForParallelLines(r,i(g.rightVertex.pos,l,t),e,a,t,s),n===f?this._checkEdgeForParallelLines(r,x,e,a,t,s):n===v&&this._checkEdgeForParallelLines(r,d,e,a,t,s)}S=S.rightVertex.rightSegment}while(S&&S!==L);return s}_checkEdgeForParallelLines(t,i,a,c,h,d){const x=t.left,L=t.right;if(f(v,s(i),s(x),s(L)),e(v,s(i))<l.parallelLineThreshold)return;f(v,s(a),s(x),s(L),s(i));const{spatialReference:S,pointer:P}=h,j=n(o(v[0],v[1],a[2]));if(p(c,m(j,S,r,this.view))<this.squaredProximityThreshold(P)){if(this.isVertical(j,i,h)||this.isVertical(x,L,h))return;if(u(t,d))return;d.push(new g({referenceLine:t,lineStart:i,targetPoint:j,isDraped:"on-the-ground"===h.elevationInfo?.mode}))}}}function u(t,r){const i=t.left,n=t.right;for(const o of r)if(f(v,s(n),s(o.constraint.start),s(o.constraint.end),s(i)),e(v,s(n))<l.parallelLineThreshold)return o.addReferenceLine(t),!0;return!1}const v=t();export{d as ParallelLineSnapper};
@@ -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{cyclical2PI as e}from"../../../core/Cyclical.js";import{createAngle as t,valueInUnit as r}from"../../../core/quantityUtils.js";import{subtract as i,dot as n,squaredLength as s,scaleAndAdd as o}from"../../../core/libs/gl-matrix-2/math/vec2.js";import{create as a}from"../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{b as c,d as p,i as g}from"../../../chunks/vec32.js";import{create as h}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{absoluteHeightElevationInfo as l}from"../../../support/elevationInfoUtils.js";import{VerticalHalfPlaneConstraint as m}from"../sketch/constraints.js";import{fromAnyMapPoint as f,asVec2 as d,markAsTarget as u,fromValues as x,fromVec3 as S}from"../sketch/normalizedPoint.js";import{SnappingAlgorithm as v}from"./SnappingAlgorithm.js";import{squaredScreenDistance as V}from"./snappingUtils.js";import{RightAngleSnappingCandidate as j}from"./candidates/RightAngleSnappingCandidate.js";import{vectorToScreenPoint as k}from"../support/viewUtils.js";import{radiansGeographicBetweenVec as C,pointFromDistanceAlongAzimuth as _}from"../../support/angularMeasurementUtils.js";class w extends v{constructor(e,t,r){super(e,t),this._geodesicLengthMeasurementUtils=r}snapNewVertex(e,t){const r=t.editGeometryOperations.data.parts[0],i=[];if(r.vertices.length<2)return i;const{view:n}=this,s=k(e,t.spatialReference,l,n),o=r.vertices.at(-1);this._checkForSnappingCandidate(1,i,o.leftSegment,o,o.leftSegment.leftVertex,e,s,t);const a=r.vertices[0];return this._checkForSnappingCandidate(2,i,a.rightSegment,a,a.rightSegment.rightVertex,e,s,t),i}snapExistingVertex(e,t){const r=[],i=t.vertexHandle;if(i.part.vertices.length<3)return r;const{view:n}=this,s=k(e,t.spatialReference,l,n),o=i.leftSegment,a=i.rightSegment;if(o?.leftVertex.leftSegment){const i=o.leftVertex.leftSegment;this._checkForSnappingCandidate(3,r,i,i.rightVertex,i.leftVertex,e,s,t)}if(a?.rightVertex.rightSegment){const i=a.rightVertex.rightSegment;this._checkForSnappingCandidate(3,r,i,i.leftVertex,i.rightVertex,e,s,t)}return r}_checkForSnappingCandidate(e,t,r,i,n,s,o,a){if(!this.edgeExceedsShortLineThreshold(r,a))return;const c=this.view,p=f(i.pos,c,a),g=f(n.pos,c,a);y(M,g,p,s,a,this._geodesicLengthMeasurementUtils),this._checkForSnappingCandidateAlongProjectedRay(e,t,g,p,M,s,o,a)}_checkForSnappingCandidateAlongProjectedRay(e,t,r,a,p,g,f,v){const{spatialReference:C,pointer:_}=v,w=i(U,d(g),d(a)),y=n(p,w)/s(p),F=o(U,d(a),p,y),R=u(x(F[0],F[1],g[2]));if(V(f,k(R,C,l,this.view))>this.squaredProximityThreshold(_)||this.isVertical(R,a,v)||this.isVertical(a,r,v))return;const M=c(h(),a,p,Math.sign(y));t.push(new j({targetPoint:R,constraint:new m(a,S(M)),previousVertex:r,otherVertex:a,otherVertexType:1,selfSnappingType:e,isDraped:"on-the-ground"===v.elevationInfo?.mode}))}}function y(e,t,r,i,n,s){F(e,t,r,i,n,s)||R(e,t,r)}function F(i,n,s,o,{spatialReference:a},c){const g=C(n,s,a,a);if(null==g)return!1;const l=C(s,o,a,a);if(null==l)return!1;const m=Math.sign(e.shortestSignedDiff(g,l))*Math.PI*.5,f=t(g+m,"radians","geographic"),d=h(),u=c.geodesicDistance(s,o,a);return null!=u&&(_(d,s,a,r(u,"meters"),f,"geodesic"),p(i,d,s),!0)}function R(e,t,r){const n=i(U,d(r),d(t));g(e,n[1],-n[0],0)}const U=a(),M=h();export{w as RightAngleSnapper};
5
+ import{cyclical2PI as e}from"../../../core/Cyclical.js";import{createAngle as t,valueInUnit as r}from"../../../core/quantityUtils.js";import{subtract as i,dot as n,squaredLength as s,scaleAndAdd as o}from"../../../core/libs/gl-matrix-2/math/vec2.js";import{create as a}from"../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{b as c,d as p,i as g}from"../../../chunks/vec32.js";import{create as h}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{absoluteHeightElevationInfo as l}from"../../../support/elevationInfoUtils.js";import{VerticalHalfPlaneConstraint as m}from"../sketch/constraints.js";import{fromAnyMapPoint as f,asVec2 as d,markAsTarget as u,fromValues as x,fromVec3 as S}from"../sketch/normalizedPoint.js";import{SnappingAlgorithm as v}from"./SnappingAlgorithm.js";import{isLine as V,squaredScreenDistance as j}from"./snappingUtils.js";import{RightAngleSnappingCandidate as k}from"./candidates/RightAngleSnappingCandidate.js";import{vectorToScreenPoint as C}from"../support/viewUtils.js";import{radiansGeographicBetweenVec as _,pointFromDistanceAlongAzimuth as w}from"../../support/angularMeasurementUtils.js";class y extends v{constructor(e,t,r){super(e,t),this._geodesicLengthMeasurementUtils=r}snapNewVertex(e,t){const r=t.editGeometryOperations.data.parts[0],i=[];if(r.vertices.length<2)return i;const{view:n}=this,s=C(e,t.spatialReference,l,n),o=r.vertices.at(-1);V(o.leftSegment)&&this._checkForSnappingCandidate(1,i,o.leftSegment,o,o.leftSegment.leftVertex,e,s,t);const a=r.vertices[0];return V(a.rightSegment)&&this._checkForSnappingCandidate(2,i,a.rightSegment,a,a.rightSegment.rightVertex,e,s,t),i}snapExistingVertex(e,t){const r=[],i=t.vertexHandle;if(i.part.vertices.length<3)return r;const{view:n}=this,s=C(e,t.spatialReference,l,n),o=i.leftSegment,a=i.rightSegment;if(V(o?.leftVertex.leftSegment)){const i=o.leftVertex.leftSegment;this._checkForSnappingCandidate(3,r,i,i.rightVertex,i.leftVertex,e,s,t)}if(V(a)&&V(a.rightVertex.rightSegment)){const i=a.rightVertex.rightSegment;this._checkForSnappingCandidate(3,r,i,i.leftVertex,i.rightVertex,e,s,t)}return r}_checkForSnappingCandidate(e,t,r,i,n,s,o,a){if(!V(r)||!this.edgeExceedsShortLineThreshold(r,a))return;const c=this.view,p=f(i.pos,c,a),g=f(n.pos,c,a);F(P,g,p,s,a,this._geodesicLengthMeasurementUtils),this._checkForSnappingCandidateAlongProjectedRay(e,t,g,p,P,s,o,a)}_checkForSnappingCandidateAlongProjectedRay(e,t,r,a,p,g,f,v){const{spatialReference:V,pointer:_}=v,w=i(M,d(g),d(a)),y=n(p,w)/s(p),F=o(M,d(a),p,y),R=u(x(F[0],F[1],g[2]));if(j(f,C(R,V,l,this.view))>this.squaredProximityThreshold(_)||this.isVertical(R,a,v)||this.isVertical(a,r,v))return;const U=c(h(),a,p,Math.sign(y));t.push(new k({targetPoint:R,constraint:new m(a,S(U)),previousVertex:r,otherVertex:a,otherVertexType:1,selfSnappingType:e,isDraped:"on-the-ground"===v.elevationInfo?.mode}))}}function F(e,t,r,i,n,s){R(e,t,r,i,n,s)||U(e,t,r)}function R(i,n,s,o,{spatialReference:a},c){const g=_(n,s,a,a);if(null==g)return!1;const l=_(s,o,a,a);if(null==l)return!1;const m=Math.sign(e.shortestSignedDiff(g,l))*Math.PI*.5,f=t(g+m,"radians","geographic"),d=h(),u=c.geodesicDistance(s,o,a);return null!=u&&(w(d,s,a,r(u,"meters"),f,"geodesic"),p(i,d,s),!0)}function U(e,t,r){const n=i(M,d(r),d(t));g(e,n[1],-n[0],0)}const M=a(),P=h();export{y as RightAngleSnapper};
@@ -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{lerp as e,distance as t}from"../../../core/libs/gl-matrix-2/math/vec2.js";import{create as i}from"../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{absoluteHeightElevationInfo as r}from"../../../support/elevationInfoUtils.js";import{fromAnyMapPoint as s,asVec2 as o,markAsTarget as n,fromValues as p}from"../sketch/normalizedPoint.js";import{SnappingAlgorithm as a}from"./SnappingAlgorithm.js";import{squaredScreenDistance as l}from"./snappingUtils.js";import{RightAngleTriangleSnappingCandidate as m}from"./candidates/RightAngleTriangleSnappingCandidate.js";import{vectorToScreenPoint as d}from"../support/viewUtils.js";import{projectPointToCircle as h}from"../../support/geometry2dUtils.js";class c extends a{snapNewVertex(e,t){const i=t.editGeometryOperations.data.parts[0],r=[],o=i.vertices.length;if("polygon"!==t.editGeometryOperations.data.type||o<2)return r;const{view:n}=this,p=i.vertices[0],a=i.vertices[o-1],l=s(p.pos,n,t),m=s(a.pos,n,t);return this._processCandidateProposal(l,m,e,t,r),r}snapExistingVertex(e,t){const i=[],r=t.vertexHandle,o=r.part;if(o.segments.length<2)return i;if("polyline"===t.editGeometryOperations.data.type&&(0===r.index||r.index===o.vertices.length-1))return i;const{view:n}=this,p=s(r.leftSegment.leftVertex.pos,n,t),a=s(r.rightSegment.rightVertex.pos,n,t);return this._processCandidateProposal(p,a,e,t,i),i}_processCandidateProposal(i,s,a,c,g){if(!this.exceedsShortLineThreshold(i,s,c))return;const v=e(f,o(i),o(s),.5),x=.5*t(o(i),o(s)),u=h(f,o(a),v,x),j=n(p(u[0],u[1],a[2])),{spatialReference:y,pointer:w}=c,P=d(a,y,r,this.view);if(l(P,d(j,y,r,this.view))<this.squaredProximityThreshold(w)){if(this.isVertical(i,j,c)||this.isVertical(j,s,c))return;g.push(new m({targetPoint:j,point1:i,point2:s,isDraped:"on-the-ground"===c.elevationInfo?.mode}))}}}const f=i();export{c as RightAngleTriangleSnapper};
5
+ import{lerp as e,distance as t}from"../../../core/libs/gl-matrix-2/math/vec2.js";import{create as i}from"../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{absoluteHeightElevationInfo as r}from"../../../support/elevationInfoUtils.js";import{fromAnyMapPoint as s,asVec2 as o,markAsTarget as n,fromValues as p}from"../sketch/normalizedPoint.js";import{SnappingAlgorithm as a}from"./SnappingAlgorithm.js";import{squaredScreenDistance as l}from"./snappingUtils.js";import{RightAngleTriangleSnappingCandidate as m}from"./candidates/RightAngleTriangleSnappingCandidate.js";import{vectorToScreenPoint as g}from"../support/viewUtils.js";import{projectPointToCircle as d}from"../../support/geometry2dUtils.js";class h extends a{snapNewVertex(e,t){const i=t.editGeometryOperations.data.parts[0],r=[],o=i.vertices.length;if("polygon"!==t.editGeometryOperations.data.type||o<2)return r;const{view:n}=this,p=i.vertices[0],a=i.vertices[o-1];if(a.leftSegment&&"line"!==a.leftSegment.type||a.rightSegment&&"line"!==a.rightSegment.type)return r;const l=s(p.pos,n,t),m=s(a.pos,n,t);return this._processCandidateProposal(l,m,e,t,r),r}snapExistingVertex(e,t){const i=[],r=t.vertexHandle,o=r.part;if(o.segments.length<2)return i;if("polyline"===t.editGeometryOperations.data.type&&(0===r.index||r.index===o.vertices.length-1))return i;if("line"!==r.leftSegment?.type||"line"!==r.rightSegment?.type)return i;const{view:n}=this,p=s(r.leftSegment.leftVertex.pos,n,t),a=s(r.rightSegment.rightVertex.pos,n,t);return this._processCandidateProposal(p,a,e,t,i),i}_processCandidateProposal(i,s,a,h,c){if(!this.exceedsShortLineThreshold(i,s,h))return;const u=e(f,o(i),o(s),.5),v=.5*t(o(i),o(s)),x=d(f,o(a),u,v),y=n(p(x[0],x[1],a[2])),{spatialReference:S,pointer:j}=h,w=g(a,S,r,this.view);if(l(w,g(y,S,r,this.view))<this.squaredProximityThreshold(j)){if(this.isVertical(i,y,h)||this.isVertical(y,s,h))return;c.push(new m({targetPoint:y,point1:i,point2:s,isDraped:"on-the-ground"===h.elevationInfo?.mode}))}}}const f=i();export{h as RightAngleTriangleSnapper};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{watch as e,syncAndInitial as t}from"../../../core/reactiveUtils.js";import{intersection as r}from"../../../core/SetUtils.js";import{sqlAnd as n}from"../../../core/sql.js";import{mergeTimeExtents as o}from"../../../core/timeUtils.js";import{s as i}from"../../../chunks/vec32.js";import{makeDehydratedPoint as s}from"../../../layers/graphics/dehydratedPoint.js";import a from"../../../rest/support/Query.js";import{ViewEventPriorities as p}from"../../input/InputManager.js";import{snappingKeys as l}from"../keybindings.js";import{fromAnyMapPoint as c}from"../sketch/normalizedPoint.js";import{isWebMap as m}from"../../../webmap/utils.js";const d=Symbol("grid-placement-graphic");function g(e,t){const r=e.length===t.length&&e[0]===t[0]&&e[1]===t[1];switch(e.length){case 2:return r;case 3:return r&&e[2]===t[2];case 4:return r&&e[2]===t[2]&&e[3]===t[3]}return!1}function u(e,t){const r=e.x-t.x,n=e.y-t.y;return r*r+n*n}function f(e,t){return Math.sqrt(u(e,t))}function h(e,t){t.sort((t,r)=>i(t.targetPoint,e)-i(r.targetPoint,e))}function y({parameters:{point:e,distance:t,returnEdge:r,vertexMode:i,coordinateHelper:{spatialReference:p},filter:l},mode:c,returnZ:m,filter:d}){const g=d?.clone()??new a({where:"1=1"});return g.returnZ=m??"3d"===c,l&&(g.geometry=l.geometry,g.distance=l.distance,g.spatialRelationship=l.spatialRelationship,g.where=n(g.where,l.where),g.timeExtent=o(g.timeExtent,l.timeExtent),g.objectIds=w(g.objectIds,l.objectIds)),{point:s(e[0],e[1],e[2],p.toJSON()),mode:c,distance:t,returnEdge:r,vertexMode:i,query:g.toJSON()}}function w(e,t){return e||t?t?e?Array.from(r(new Set(e),new Set(t))):t:e:null}function j(e,t,r){return{left:c(e.leftVertex.pos,t,r),right:c(e.rightVertex.pos,t,r)}}const b=Symbol("snapping-toggle");function v(r,n=()=>{}){const o=e(()=>({view:r.view,snappingOptions:r.snappingOptions}),({view:e,snappingOptions:t})=>{if(r.removeHandles(b),!e||!t)return;const o=p.TOOL,i=[e.on("key-down",e=>{e.key!==l.toggle||e.repeat||(t.enabledToggled=!0,n())},o),e.on("key-up",e=>{e.key===l.toggle&&(t.enabledToggled=!1,n())},o),e.on("pointer-move",e=>{const r=e.native.ctrlKey;t.enabledToggled!==r&&(t.enabledToggled=r,n())},o)];r.addHandles(i,b)},t);r.addHandles(o)}function x(e){return m(e)&&"utilityNetworks"in e&&!!e.utilityNetworks?.length}export{j as editEdgeToSnappingEdge,d as gridPlacementGraphicSymbol,x as isUtilityNetworkWebMap,y as makeSnappingQuery,g as objectEqual,f as screenDistance,v as setupSnappingToggleHandles,h as sortCandidatesInPlace,u as squaredScreenDistance};
5
+ import{watch as e,syncAndInitial as t}from"../../../core/reactiveUtils.js";import{intersection as n}from"../../../core/SetUtils.js";import{sqlAnd as r}from"../../../core/sql.js";import{mergeTimeExtents as o}from"../../../core/timeUtils.js";import{s as i}from"../../../chunks/vec32.js";import{makeDehydratedPoint as s}from"../../../layers/graphics/dehydratedPoint.js";import a from"../../../rest/support/Query.js";import{ViewEventPriorities as p}from"../../input/InputManager.js";import{snappingKeys as l}from"../keybindings.js";import{fromAnyMapPoint as c}from"../sketch/normalizedPoint.js";import{isWebMap as m}from"../../../webmap/utils.js";const d=Symbol("grid-placement-graphic");function u(e,t){const n=e.length===t.length&&e[0]===t[0]&&e[1]===t[1];switch(e.length){case 2:return n;case 3:return n&&e[2]===t[2];case 4:return n&&e[2]===t[2]&&e[3]===t[3]}return!1}function g(e,t){const n=e.x-t.x,r=e.y-t.y;return n*n+r*r}function f(e,t){return Math.sqrt(g(e,t))}function y(e,t){t.sort((t,n)=>i(t.targetPoint,e)-i(n.targetPoint,e))}function h({parameters:{point:e,distance:t,returnEdge:n,vertexMode:i,coordinateHelper:{spatialReference:p},filter:l},mode:c,returnZ:m,filter:d}){const u=d?.clone()??new a({where:"1=1"});return u.returnZ=m??"3d"===c,l&&(u.geometry=l.geometry,u.distance=l.distance,u.spatialRelationship=l.spatialRelationship,u.where=r(u.where,l.where),u.timeExtent=o(u.timeExtent,l.timeExtent),u.objectIds=w(u.objectIds,l.objectIds)),{point:s(e[0],e[1],e[2],p.toJSON()),mode:c,distance:t,returnEdge:n,vertexMode:i,query:u.toJSON()}}function w(e,t){return e||t?t?e?Array.from(n(new Set(e),new Set(t))):t:e:null}function j(e,t,n){return{left:c(e.leftVertex.pos,t,n),right:c(e.rightVertex.pos,t,n)}}const b=Symbol("snapping-toggle");function v(n,r=()=>{}){const o=e(()=>({view:n.view,snappingOptions:n.snappingOptions}),({view:e,snappingOptions:t})=>{if(n.removeHandles(b),!e||!t)return;const o=p.TOOL,i=[e.on("key-down",e=>{e.key!==l.toggle||e.repeat||(t.enabledToggled=!0,r())},o),e.on("key-up",e=>{e.key===l.toggle&&(t.enabledToggled=!1,r())},o),e.on("pointer-move",e=>{const n=e.native.ctrlKey;t.enabledToggled!==n&&(t.enabledToggled=n,r())},o)];n.addHandles(i,b)},t);n.addHandles(o)}function x(e){return m(e)&&"utilityNetworks"in e&&!!e.utilityNetworks?.length}function k(e){return"line"===e?.type}export{j as editEdgeToSnappingEdge,d as gridPlacementGraphicSymbol,k as isLine,x as isUtilityNetworkWebMap,h as makeSnappingQuery,u as objectEqual,f as screenDistance,v as setupSnappingToggleHandles,y as sortCandidatesInPlace,g as squaredScreenDistance};
@@ -0,0 +1,5 @@
1
+ /*
2
+ All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
+ See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
+ */
5
+ const e="popup",n="manual";function o(e){const{popupElement:n,popup:o}=e||{};return n??o??null}function i(e){return null!=e&&"open"in e&&"declaredClass"in e}function p(e){return!!e&&"arcgis-popup"===e.tagName.toLowerCase()}function t(o,t,a){const[l,u,c]=t;if(a){const[n,o,t]=a;n&&i(o)&&(o.view=null,n.remove(o,e),o!==u&&u&&o.destroy()),n&&t&&p(t)&&(t.view=null,n.remove(t,e),t!==c&&c&&t.remove())}l&&i(u)&&(u.view=o,l.add(u,{key:e,position:n,internal:!0})),l&&c&&p(c)&&(c.view=o,l.add(c,{key:e,position:n,internal:!0}))}async function a(e,n){const{popup:o,popupElement:t}=e;if(i(o)){const e=await o.viewModel.handleViewClick(n);await o.open(e)}else if(t&&p(t)){const e=await t.handleViewClick(n);await t.open(e)}else n?.defer(async()=>{await e.setupPopup();const{popup:o,popupElement:t}=e;if(i(o)&&!e.destroyed&&e.ready&&e.popupEnabled){const e=await o.viewModel.handleViewClick(n);await o.open(e)}else if(t&&p(t)){const e=await t.handleViewClick(n);await t.open(e)}})}function l(e,n){const{popup:o,popupElement:t}=e;if(i(o))return o.open(n);t&&p(t)&&t.open(n)}function u(e,n){i(e)&&e.close(),n&&p(n)&&(n.visible=!1)}export{t as addPopup,u as closePopup,i as isPopup,p as isPopupElement,l as openPopupWithOptions,a as openPopupWithViewClick,o as popupFromView};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- class t{constructor(){this.blend=!1,this.blendColor={r:0,g:0,b:0,a:0},this.blendFunction={srcRGB:1,dstRGB:0,srcAlpha:1,dstAlpha:0},this.blendEquation={mode:32774,modeAlpha:32774},this.colorMask={r:!0,g:!0,b:!0,a:!0},this.faceCulling=!1,this.cullFace=1029,this.frontFace=2305,this.scissorTest=!1,this.scissorRect={x:0,y:0,width:0,height:0},this.depthTest=!1,this.depthFunction=513,this.clearDepth=1,this.depthWrite=!0,this.depthRange={zNear:0,zFar:1},this.viewport=null,this.stencilTest=!1,this.polygonOffsetFill=!1,this.polygonOffset=[0,0],this.stencilFunction={face:1032,func:519,ref:0,mask:1},this.clearStencil=0,this.stencilWriteMask=1,this.stencilOperation={face:1032,fail:7680,zFail:7680,zPass:7680},this.clearColor={r:0,g:0,b:0,a:0},this.program=null,this.vertexBuffer=null,this.indexBuffer=null,this.uniformBuffer=null,this.pixelPackBuffer=null,this.pixelUnpackBuffer=null,this.copyReadBuffer=null,this.copyWriteBuffer=null,this.transformFeedbackBuffer=null,this.uniformBufferBindingPoints=new Array,this.transformBufferBindingPoints=new Array,this.readFramebuffer=null,this.drawFramebuffer=null,this.drawBuffers={defaultFramebuffer:[1029],fbos:new WeakMap},this.renderbuffer=null,this.activeTexture=0,this.textureUnitMap=new Array,this.vertexArrayObject=null}}export{t as ContextState};
5
+ import{DrawBufferBack as t}from"./enums.js";class e{constructor(){this.blend=!1,this.blendColor={r:0,g:0,b:0,a:0},this.blendFunction={srcRGB:1,dstRGB:0,srcAlpha:1,dstAlpha:0},this.blendEquation={mode:32774,modeAlpha:32774},this.colorMask={r:!0,g:!0,b:!0,a:!0},this.faceCulling=!1,this.cullFace=1029,this.frontFace=2305,this.scissorTest=!1,this.scissorRect={x:0,y:0,width:0,height:0},this.depthTest=!1,this.depthFunction=513,this.clearDepth=1,this.depthWrite=!0,this.depthRange={zNear:0,zFar:1},this.viewport=null,this.stencilTest=!1,this.polygonOffsetFill=!1,this.polygonOffset=[0,0],this.stencilFunction={face:1032,func:519,ref:0,mask:1},this.clearStencil=0,this.stencilWriteMask=1,this.stencilOperation={face:1032,fail:7680,zFail:7680,zPass:7680},this.clearColor={r:0,g:0,b:0,a:0},this.program=null,this.vertexBuffer=null,this.indexBuffer=null,this.uniformBuffer=null,this.pixelPackBuffer=null,this.pixelUnpackBuffer=null,this.copyReadBuffer=null,this.copyWriteBuffer=null,this.transformFeedbackBuffer=null,this.uniformBufferBindingPoints=new Array,this.transformBufferBindingPoints=new Array,this.readFramebuffer=null,this.drawFramebuffer=null,this.drawBuffers={defaultFramebuffer:[t],fbos:new WeakMap},this.renderbuffer=null,this.activeTexture=0,this.textureUnitMap=new Array,this.vertexArrayObject=null}}export{e as ContextState};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import has from"../../core/has.js";import{disposeMaybe as t}from"../../core/maybe.js";import{after as e}from"../../core/promiseUtils.js";import{Milliseconds as s}from"../../core/time.js";import{webglDebugEnabled as i,checkWebGLError as a,getErrorMessage as r}from"./checkWebGLError.js";import{ContextState as n}from"./ContextState.js";import{ColorAttachment0 as l,baseTextureUnit as h,ResourceType as f,PrimitiveType as o}from"./enums.js";import{InstanceCounter as u}from"./InstanceCounter.js";import{Parameters as c}from"./Parameters.js";import{ProgramCache as d}from"./ProgramCache.js";import{StateTracker as _}from"./renderState.js";import{Texture as b}from"./Texture.js";import{WebGLDriverTest as g}from"./WebGLDriverTest.js";import{Capabilities as p}from"./capabilities/Capabilities.js";let m=class{constructor(t,e){this.gl=t,this.instanceCounter=new u,this._programCache=new d(this),this._transformFeedbackRequestInfo=null,this._state=new n,this._numOfDrawCalls=0,this._numOfTriangles=0,this._options=e,this.configure(e)}configure(e){this._options=e,this._capabilities=new p(this.gl,e),this._parameters=new c(this.gl,this._capabilities,e),b.TEXTURE_UNIT_FOR_UPDATES=this._parameters.maxTextureImageUnits-1;const s=this.gl.getParameter(this.gl.VIEWPORT);this._state=new n,this._state.viewport={x:s[0],y:s[1],width:s[2],height:s[3]},this._stateTracker=new _({setBlending:t=>{if(t){this.setBlendingEnabled(!0),this.setBlendEquationSeparate(t.opRgb,t.opAlpha),this.setBlendFunctionSeparate(t.srcRgb,t.dstRgb,t.srcAlpha,t.dstAlpha);const e=t.color;this.setBlendColor(e.r,e.g,e.b,e.a)}else this.setBlendingEnabled(!1)},setCulling:t=>{t?(this.setFaceCullingEnabled(!0),this.setCullFace(t.face),this.setFrontFace(t.mode)):this.setFaceCullingEnabled(!1)},setPolygonOffset:t=>{t?(this.setPolygonOffsetFillEnabled(!0),this.setPolygonOffset(t.factor,t.units)):this.setPolygonOffsetFillEnabled(!1)},setDepthTest:t=>{t?(this.setDepthTestEnabled(!0),this.setDepthFunction(t.func)):this.setDepthTestEnabled(!1)},setStencilTest:t=>{if(t){this.setStencilTestEnabled(!0);const e=t.function;this.setStencilFunction(e.func,e.ref,e.mask);const s=t.operation;this.setStencilOp(s.fail,s.zFail,s.zPass)}else this.setStencilTestEnabled(!1)},setDepthWrite:t=>{t?(this.setDepthWriteEnabled(!0),this.setDepthRange(t.zNear,t.zFar)):this.setDepthWriteEnabled(!1)},setColorWrite:t=>{t?this.setColorMask(t.r,t.g,t.b,t.a):this.setColorMask(!1,!1,!1,!1)},setStencilWrite:t=>{t?this.setStencilWriteMask(t.mask):this.setStencilWriteMask(0)},setDrawBuffers:t=>{if(t)this.setDrawBuffers(t.buffers);else{const{drawFramebuffer:t}=this._state;null===t?this.setDrawBuffers([1029]):0===t.colorAttachments.length?this.setDrawBuffers([0]):this.setDrawBuffers([l])}}}),this.enforceState(),t(this._driverTest),this._driverTest=new g(this)}updateOptions(t){this._options={...this._options,...t},this._parameters=new c(this.gl,this._capabilities,this._options)}dispose(){this._driverTest=t(this._driverTest),this._programCache=t(this._programCache),this.bindVAO(null),this.unbindBuffer(34962),this.unbindBuffer(34963),this.unbindBuffer(35345),this._state.uniformBufferBindingPoints.length=0,this.unbindBuffer(35051),this.unbindBuffer(35052),this.unbindBuffer(36662),this.unbindBuffer(36663),this._state.textureUnitMap.length=0,this._state=null,this._capabilities=null,this._stateTracker=null,i()&&console.log(this.instanceCounter.resourceInformation)}get driverTest(){return this._driverTest}get contextAttributes(){return this.gl.getContextAttributes()}get parameters(){return this._parameters}get programCache(){return this._programCache}setPipelineState(t){this._stateTracker.setPipeline(t)}setBlendingEnabled(t){this._state.blend!==t&&(!0===t?this.gl.enable(this.gl.BLEND):this.gl.disable(this.gl.BLEND),this._state.blend=t,this._stateTracker.invalidateBlending())}externalProgramUpdate(){this._state.program?.stop(),this._state.program=null}externalTextureUnitUpdate(t,e){for(let s=0;s<t.length;++s)this._state.textureUnitMap[t[s]]=null;e>=0&&(this._state.activeTexture=e)}externalVertexArrayObjectUpdate(){this.gl.bindVertexArray(null),this._state.vertexArrayObject=null,this._state.vertexBuffer=null,this._state.indexBuffer=null}externalVertexBufferUpdate(){this._state.vertexBuffer=null}externalIndexBufferUpdate(){this._state.indexBuffer=null}setBlendColor(t,e,s,i){t===this._state.blendColor.r&&e===this._state.blendColor.g&&s===this._state.blendColor.b&&i===this._state.blendColor.a||(this.gl.blendColor(t,e,s,i),this._state.blendColor.r=t,this._state.blendColor.g=e,this._state.blendColor.b=s,this._state.blendColor.a=i,this._stateTracker.invalidateBlending())}setBlendFunction(t,e){t===this._state.blendFunction.srcRGB&&e===this._state.blendFunction.dstRGB||(this.gl.blendFunc(t,e),this._state.blendFunction.srcRGB=t,this._state.blendFunction.srcAlpha=t,this._state.blendFunction.dstRGB=e,this._state.blendFunction.dstAlpha=e,this._stateTracker.invalidateBlending())}setBlendFunctionSeparate(t,e,s,i){this._state.blendFunction.srcRGB===t&&this._state.blendFunction.srcAlpha===s&&this._state.blendFunction.dstRGB===e&&this._state.blendFunction.dstAlpha===i||(this.gl.blendFuncSeparate(t,e,s,i),this._state.blendFunction.srcRGB=t,this._state.blendFunction.srcAlpha=s,this._state.blendFunction.dstRGB=e,this._state.blendFunction.dstAlpha=i,this._stateTracker.invalidateBlending())}setBlendEquation(t){this._state.blendEquation.mode!==t&&(this.gl.blendEquation(t),this._state.blendEquation.mode=t,this._state.blendEquation.modeAlpha=t,this._stateTracker.invalidateBlending())}setBlendEquationSeparate(t,e){this._state.blendEquation.mode===t&&this._state.blendEquation.modeAlpha===e||(this.gl.blendEquationSeparate(t,e),this._state.blendEquation.mode=t,this._state.blendEquation.modeAlpha=e,this._stateTracker.invalidateBlending())}setColorMask(t,e,s,i){this._state.colorMask.r===t&&this._state.colorMask.g===e&&this._state.colorMask.b===s&&this._state.colorMask.a===i||(this.gl.colorMask(t,e,s,i),this._state.colorMask.r=t,this._state.colorMask.g=e,this._state.colorMask.b=s,this._state.colorMask.a=i,this._stateTracker.invalidateColorWrite())}setClearColor(t,e,s,i){this._state.clearColor.r===t&&this._state.clearColor.g===e&&this._state.clearColor.b===s&&this._state.clearColor.a===i||(this.gl.clearColor(t,e,s,i),this._state.clearColor.r=t,this._state.clearColor.g=e,this._state.clearColor.b=s,this._state.clearColor.a=i)}setFaceCullingEnabled(t){this._state.faceCulling!==t&&(!0===t?this.gl.enable(this.gl.CULL_FACE):this.gl.disable(this.gl.CULL_FACE),this._state.faceCulling=t,this._stateTracker.invalidateCulling())}setPolygonOffsetFillEnabled(t){this._state.polygonOffsetFill!==t&&(!0===t?this.gl.enable(this.gl.POLYGON_OFFSET_FILL):this.gl.disable(this.gl.POLYGON_OFFSET_FILL),this._state.polygonOffsetFill=t,this._stateTracker.invalidatePolygonOffset())}setPolygonOffset(t,e){this._state.polygonOffset[0]===t&&this._state.polygonOffset[1]===e||(this._state.polygonOffset[0]=t,this._state.polygonOffset[1]=e,this.gl.polygonOffset(t,e),this._stateTracker.invalidatePolygonOffset())}setCullFace(t){this._state.cullFace!==t&&(this.gl.cullFace(t),this._state.cullFace=t,this._stateTracker.invalidateCulling())}setFrontFace(t){this._state.frontFace!==t&&(this.gl.frontFace(t),this._state.frontFace=t,this._stateTracker.invalidateCulling())}setScissorTestEnabled(t){this._state.scissorTest!==t&&(!0===t?this.gl.enable(this.gl.SCISSOR_TEST):this.gl.disable(this.gl.SCISSOR_TEST),this._state.scissorTest=t)}setScissorRect(t,e,s,i){this._state.scissorRect.x===t&&this._state.scissorRect.y===e&&this._state.scissorRect.width===s&&this._state.scissorRect.height===i||(this.gl.scissor(t,e,s,i),this._state.scissorRect.x=t,this._state.scissorRect.y=e,this._state.scissorRect.width=s,this._state.scissorRect.height=i)}setDepthTestEnabled(t){this._state.depthTest!==t&&(!0===t?this.gl.enable(this.gl.DEPTH_TEST):this.gl.disable(this.gl.DEPTH_TEST),this._state.depthTest=t,this._stateTracker.invalidateDepthTest())}setClearDepth(t){this._state.clearDepth!==t&&(this.gl.clearDepth(t),this._state.clearDepth=t)}setDepthFunction(t){this._state.depthFunction!==t&&(this.gl.depthFunc(t),this._state.depthFunction=t,this._stateTracker.invalidateDepthTest())}setDepthWriteEnabled(t){this._state.depthWrite!==t&&(this.gl.depthMask(t),this._state.depthWrite=t,this._stateTracker.invalidateDepthWrite())}setDepthRange(t,e){this._state.depthRange.zNear===t&&this._state.depthRange.zFar===e||(this.gl.depthRange(t,e),this._state.depthRange.zNear=t,this._state.depthRange.zFar=e,this._stateTracker.invalidateDepthWrite())}setStencilTestEnabled(t){this._state.stencilTest!==t&&(!0===t?this.gl.enable(this.gl.STENCIL_TEST):this.gl.disable(this.gl.STENCIL_TEST),this._state.stencilTest=t,this._stateTracker.invalidateStencilTest())}setClearStencil(t){t!==this._state.clearStencil&&(this.gl.clearStencil(t),this._state.clearStencil=t)}setStencilFunction(t,e,s){this._state.stencilFunction.func===t&&this._state.stencilFunction.ref===e&&this._state.stencilFunction.mask===s||(this.gl.stencilFunc(t,e,s),this._state.stencilFunction.face=1032,this._state.stencilFunction.func=t,this._state.stencilFunction.ref=e,this._state.stencilFunction.mask=s,this._stateTracker.invalidateStencilTest())}setStencilFunctionSeparate(t,e,s,i){this._state.stencilFunction.face===t&&this._state.stencilFunction.func===e&&this._state.stencilFunction.ref===s&&this._state.stencilFunction.mask===i||(this.gl.stencilFuncSeparate(t,e,s,i),this._state.stencilFunction.face=t,this._state.stencilFunction.func=e,this._state.stencilFunction.ref=s,this._state.stencilFunction.mask=i,this._stateTracker.invalidateStencilTest())}setStencilWriteMask(t){this._state.stencilWriteMask!==t&&(this.gl.stencilMask(t),this._state.stencilWriteMask=t,this._stateTracker.invalidateStencilWrite())}setStencilOp(t,e,s){1032===this._state.stencilOperation.face&&this._state.stencilOperation.fail===t&&this._state.stencilOperation.zFail===e&&this._state.stencilOperation.zPass===s||(this.gl.stencilOp(t,e,s),this._state.stencilOperation.face=1032,this._state.stencilOperation.fail=t,this._state.stencilOperation.zFail=e,this._state.stencilOperation.zPass=s,this._stateTracker.invalidateStencilTest())}setStencilOpSeparate(t,e,s,i){this._state.stencilOperation.face===t&&this._state.stencilOperation.fail===e&&this._state.stencilOperation.zFail===s&&this._state.stencilOperation.zPass===i||(this.gl.stencilOpSeparate(t,e,s,i),this._state.stencilOperation.face=t,this._state.stencilOperation.fail=e,this._state.stencilOperation.zFail=s,this._state.stencilOperation.zPass=i,this._stateTracker.invalidateStencilTest())}setActiveTexture(t,e=!1){const s=this._state.activeTexture;return t>=0&&(e||t!==this._state.activeTexture)&&(this.gl.activeTexture(h+t),this._state.activeTexture=t),s}setDrawBuffers(t){const{drawFramebuffer:e}=this._state,s=null===e,i=s?this._state.drawBuffers.defaultFramebuffer:this._state.drawBuffers.fbos.get(e);if(i?.length!==t.length||!i.every((e,s)=>e===t[s]))if(t.length>this.parameters.maxDrawBuffers)console.error("Setting more active draw buffers than GL.MAX_DRAW_BUFFERS allows.");else{if(s){if(t.length>1)return void console.error("The default framebuffer can only have one active draw buffer.");if(1029!==t[0]&&0!==t[0])return void console.error("The default framebuffer can only use the constants GL.BACK or GL.NONE as draw buffers.")}s||!t.includes(1029)?(this.gl.drawBuffers(t),s?this._state.drawBuffers.defaultFramebuffer=t:this._state.drawBuffers.fbos.set(e,t),this._stateTracker.invalidateDrawBuffers()):console.error("A framebuffer object can only use the constants GL.COLOR_ATTACHMENTi or GL.NONE as draw buffers.")}}clear(t,e=255){if(t){if(16384&t){const t=this._state.drawFramebuffer?.colorAttachments;t&&this.setDrawBuffers(t),this.setColorMask(!0,!0,!0,!0)}256&t&&this.setDepthWriteEnabled(!0),1024&t&&this.setStencilWriteMask(e),this.gl.clear(t)}}clearFramebuffer(t,e=!1,s=!1){let i=0;if(t){const e=1e-13,s=Math.max(e,t[3]);this.setClearColor(t[0],t[1],t[2],s),i|=16384}e&&(i|=256),!1===s?s=0:(!0===s&&(s=255),i|=1024),i&&this.clear(i,s)}clearBuffer(t,e,s=6144,i=void 0){this.gl.clearBufferfv(s,t,e,i)}clearBufferInteger(t,e,s=6144,i=void 0){this.gl.clearBufferiv(s,t,e,i)}clearBufferUnsignedInteger(t,e,s=6144,i=void 0){this.gl.clearBufferuiv(s,t,e,i)}drawArrays(t,e,s){if(this._transformFeedbackRequestInfo){if(t!==this._transformFeedbackRequestInfo.primitiveType)throw new Error("DrawArrays called during transform feedback, but primitiveType does not match that of the current transform feedback request");if(null==this._state.program?.hasTransformFeedbackVaryings)throw new Error("DrawArrays called during transform feedback, but the shader program was not linked with a transform feedback varying")}if(i()&&(this._numOfDrawCalls++,this._numOfTriangles+=F(t,s),has("enable-feature:webgl-debug:textureReadWrite"))){const t=this._state.textureUnitMap;for(let e=0;e<t.length;e++){const s=t[e];if(null!=s&&s===this._state.drawFramebuffer?.colorTexture)throw new Error(`Detected readWrite. Texture already bound at index ${e}`)}}this.gl.drawArrays(t,e,s),a(this.gl)}drawArraysInstanced(t,e,s,i){this.gl.drawArraysInstanced(t,e,s,i),a(this.gl)}drawElements(t,e,s,a){if(this._transformFeedbackRequestInfo)throw new Error("Cannot called drawElements during a transform feedback request");if(i()&&(this._numOfDrawCalls++,this._numOfTriangles+=F(t,e)),this.gl.drawElements(t,e,s,a),i()){const i=r(this.gl);if(i){const r=this.getBoundVAO(),n=r?.indexBuffer,l=r?.buffers,h={indexBuffer:n,vertexBuffers:l},f={mode:t,count:e,type:s,offset:a},o=n?.size??0,u=a+e,c=o<u?`. Buffer is too small. Attempted to draw index ${u} of ${o}`:"";console.error(`drawElements: ${i}${c}`,{args:f,vao:h})}}}drawElementsInstanced(t,e,s,i,r){this.gl.drawElementsInstanced(t,e,s,i,r),a(this.gl)}logInfo(){i()&&console.log(`DrawCalls: ${this._numOfDrawCalls}, Triangles: ${this._numOfTriangles}`)}resetInfo(){i()&&(this._numOfDrawCalls=0,this._numOfTriangles=0)}get capabilities(){return this._capabilities}setViewport(t,e,s,i){s=Math.max(Math.round(s),1),i=Math.max(Math.round(i),1);const a=this._state.viewport;a.x===t&&a.y===e&&a.width===s&&a.height===i||(a.x=t,a.y=e,a.width=s,a.height=i,this.gl.viewport(t,e,s,i))}setViewport4fv(t){this.setViewport(t[0],t[1],t[2],t[3])}restoreViewport({x:t,y:e,width:s,height:i}){this.setViewport(t,e,s,i)}getViewport(){const t=this._state.viewport;return{x:t.x,y:t.y,width:t.width,height:t.height}}useProgram(t){this._state.program!==t&&(this._state.program?.stop(),this._state.program=t,this.gl.useProgram(t?.glName??null))}bindTexture(t,e,s=!1){(e>=this.parameters.maxTextureImageUnits||e<0)&&console.error("Input texture unit is out of range of available units!");const i=this._state.textureUnitMap[e];return null==t?.glName?(null!=i&&(this.setActiveTexture(e,s),this.gl.bindTexture(i.descriptor.target,null)),this._state.textureUnitMap[e]=null,i):s||i!==t?(this.setActiveTexture(e,s),this.gl.bindTexture(t.descriptor.target,t.glName),t.applyChanges(),this._state.textureUnitMap[e]=t,i):(t.isDirty&&(this.setActiveTexture(e,s),t.applyChanges()),i)}unbindTexture(t){if(null!=t)for(let e=0;e<this.parameters.maxTextureImageUnits;e++)this._state.textureUnitMap[e]===t&&(this.bindTexture(null,e),this._state.textureUnitMap[e]=null)}bindFramebuffer(t,e=!1){if(e||this._state.readFramebuffer!==t||this._state.drawFramebuffer!==t){if(this._stateTracker.invalidateDrawBuffers(),null==t)return this.gl.bindFramebuffer(36160,null),void(this._state.readFramebuffer=this._state.drawFramebuffer=null);t.initializeAndBind(36160),this._state.readFramebuffer=t,this._state.drawFramebuffer=t}}bindFramebufferSeparate(t,e,s=!1){const i=36008===e,a=i?this._state.readFramebuffer:this._state.drawFramebuffer;(s||a!==t)&&(null==t?this.gl.bindFramebuffer(e,null):t.initializeAndBind(e),i?this._state.readFramebuffer=t??null:(this._stateTracker.invalidateDrawBuffers(),this._state.drawFramebuffer=t??null))}blitFramebuffer(t,e,s=16384,i=9728,a=0,r=0,n=t.width,l=t.height,h=0,f=0,o=e.width,u=e.height){this.bindFramebufferSeparate(t,36008,!0),this.bindFramebufferSeparate(e,36009,!0),this.gl.blitFramebuffer(a,r,n,l,h,f,o,u,s,i)}bindBuffer(t,e){if(t)switch(e??=t.bufferType,e){case 34962:this._state.vertexBuffer=B(this.gl,t,e,this._state.vertexBuffer);break;case 34963:this._state.indexBuffer=B(this.gl,t,e,this._state.indexBuffer);break;case 35345:this._state.uniformBuffer=B(this.gl,t,e,this._state.uniformBuffer);break;case 35051:this._state.pixelPackBuffer=B(this.gl,t,e,this._state.pixelPackBuffer);break;case 35052:this._state.pixelUnpackBuffer=B(this.gl,t,e,this._state.pixelUnpackBuffer);break;case 36662:this._state.copyReadBuffer=B(this.gl,t,e,this._state.copyReadBuffer);break;case 36663:this._state.copyWriteBuffer=B(this.gl,t,e,this._state.copyWriteBuffer);break;case 35982:this._state.transformFeedbackBuffer=B(this.gl,t,e,this._state.transformFeedbackBuffer)}}bindRenderbuffer(t){const e=this.gl;t||(e.bindRenderbuffer(e.RENDERBUFFER,null),this._state.renderbuffer=null),this._state.renderbuffer!==t&&(e.bindRenderbuffer(e.RENDERBUFFER,t.glName),this._state.renderbuffer=t)}_getBufferBinding(t,e){if(e>=this.parameters.maxUniformBufferBindings||e<0)return console.error("Uniform buffer binding point is out of range!"),null;const s=35345===t?this._state.uniformBufferBindingPoints:this._state.transformBufferBindingPoints;let i=s[e];return null==i&&(i={buffer:null,offset:0,size:0},s[e]=i),i}bindBufferBase(t,e,s){const i=this._getBufferBinding(t,e);null!=i&&(i.buffer===s&&0===i.offset&&0===i.size||(this.gl.bindBufferBase(t,e,s?s.glName:null),i.buffer=s,i.offset=0,i.size=0))}bindBufferRange(t,e,s,i,a){const r=this._getBufferBinding(t,e);null!=r&&(r.buffer===s&&r.offset===i&&r.size===a||(i%this._parameters.uniformBufferOffsetAlignment===0?(this.gl.bindBufferRange(t,e,s.glName,i,a),r.buffer=s,r.offset=i,r.size=a):console.error("Uniform buffer binding offset is not a multiple of the context offset alignment")))}bindUBO(t,e,s,a){null!=e?(i()&&(a??e.byteLength)>this._parameters.maxUniformBlockSize&&console.error("Attempting to bind more data than the maximum uniform block size"),e.initialize(),void 0!==s&&void 0!==a?this.bindBufferRange(35345,t,e.buffer,s,a):this.bindBufferBase(35345,t,e.buffer)):this.bindBufferBase(35345,t,null)}unbindUBO(t){for(let e=0,s=this._state.uniformBufferBindingPoints.length;e<s;e++){const s=this._state.uniformBufferBindingPoints[e];null!=s&&s.buffer===t.buffer&&this.bindBufferBase(35345,e,null)}}unbindBuffer(t){switch(t){case 34962:this._state.vertexBuffer=B(this.gl,null,t,this._state.vertexBuffer);break;case 34963:this._state.indexBuffer=B(this.gl,null,t,this._state.indexBuffer);break;case 35345:this._state.uniformBuffer=B(this.gl,null,t,this._state.uniformBuffer);break;case 35051:this._state.pixelPackBuffer=B(this.gl,null,t,this._state.pixelPackBuffer);break;case 35052:this._state.pixelUnpackBuffer=B(this.gl,null,t,this._state.pixelUnpackBuffer);break;case 36662:this._state.copyReadBuffer=B(this.gl,null,t,this._state.copyReadBuffer);break;case 36663:this._state.copyWriteBuffer=B(this.gl,null,t,this._state.copyWriteBuffer)}}bindVAO(t,e){if(null==t)return this._state.vertexArrayObject?.unbind(),void(this._state.vertexArrayObject=null);this._state.vertexArrayObject!==t&&(t.bind(e),this._state.vertexArrayObject=t)}bindTransformFeedback(t){const{gl:e}=this;e.bindTransformFeedback(e.TRANSFORM_FEEDBACK,t.glName)}beginTransformFeedback(t,e){if(this._transformFeedbackRequestInfo)throw new Error("Already in a transform feedback request");const{gl:s}=this;s.bindTransformFeedback(s.TRANSFORM_FEEDBACK,t.glName),s.beginTransformFeedback(e),this._transformFeedbackRequestInfo={primitiveType:e}}endTransformFeedback(){if(!this._transformFeedbackRequestInfo)throw new Error("Not in a transform feedback request");const{gl:t}=this;t.endTransformFeedback(),t.bindTransformFeedback(t.TRANSFORM_FEEDBACK,null),this._transformFeedbackRequestInfo=null}async clientWaitAsync(t=s(10)){const{gl:i}=this,a=i.fenceSync(37143,0);if(!a)throw new Error("Client wait failed, could not create sync object");let r;this.instanceCounter.increment(f.Sync,a),i.flush();do{await e(t),r=i.clientWaitSync(a,0,0)}while(37147===r);if(this.instanceCounter.decrement(f.Sync,a),i.deleteSync(a),37149===r)throw new Error("Client wait failed")}getBoundFramebufferObject(t=36160){return 36008===t?this._state.readFramebuffer:this._state.drawFramebuffer}temporaryBindFramebufferObject(t,e,s=!1){const i=this.getBoundFramebufferObject();try{this.bindFramebuffer(t,s),e()}finally{this.bindFramebuffer(i,s)}}getBoundVAO(){return this._state.vertexArrayObject}resetState(){this.useProgram(null),this.bindVAO(null),this.bindFramebuffer(null,!0),this.unbindBuffer(34962),this.unbindBuffer(34963),this.unbindBuffer(35345),this._state.uniformBufferBindingPoints.length=0,this.unbindBuffer(35051),this.unbindBuffer(35052),this.unbindBuffer(36662),this.unbindBuffer(36663);for(let t=0;t<this.parameters.maxTextureImageUnits;++t)this.bindTexture(null,t);this.setBlendingEnabled(!1),this.setBlendFunction(1,0),this.setBlendEquation(32774),this.setBlendColor(0,0,0,0),this.setFaceCullingEnabled(!1),this.setCullFace(1029),this.setFrontFace(2305),this.setPolygonOffsetFillEnabled(!1),this.setPolygonOffset(0,0),this.setScissorTestEnabled(!1),this.setScissorRect(0,0,this.gl.canvas.width,this.gl.canvas.height),this.setDepthTestEnabled(!1),this.setDepthFunction(513),this.setDepthRange(0,1),this.setStencilTestEnabled(!1),this.setStencilFunction(519,0,0),this.setStencilOp(7680,7680,7680),this.setClearColor(0,0,0,0),this.setClearDepth(1),this.setClearStencil(0),this.setColorMask(!0,!0,!0,!0),this.setStencilWriteMask(4294967295),this.setDepthWriteEnabled(!0),this.setDrawBuffers([1029]),this.setViewport(0,0,this.gl.canvas.width,this.gl.canvas.height)}enforceState(){const{gl:t}=this;t.bindVertexArray(null);for(let s=0;s<this.parameters.maxVertexAttributes;s++)t.disableVertexAttribArray(s);this._state.vertexBuffer?t.bindBuffer(this._state.vertexBuffer.bufferType,this._state.vertexBuffer.glName):t.bindBuffer(34962,null),this._state.indexBuffer?t.bindBuffer(this._state.indexBuffer.bufferType,this._state.indexBuffer.glName):t.bindBuffer(34963,null),this._state.uniformBuffer?t.bindBuffer(this._state.uniformBuffer.bufferType,this._state.uniformBuffer.glName):t.bindBuffer(35345,null);for(let s=0;s<this._parameters.maxUniformBufferBindings;s++){const e=this._state.uniformBufferBindingPoints[s];if(null!=e){const{buffer:i,offset:a,size:r}=e;null!==i?0===a&&0===r?t.bindBufferBase(35345,s,i.glName):t.bindBufferRange(35345,s,i.glName,a,r):t.bindBufferBase(35345,s,null)}}if(this._state.pixelPackBuffer?t.bindBuffer(this._state.pixelPackBuffer.bufferType,this._state.pixelPackBuffer.glName):t.bindBuffer(35051,null),this._state.pixelUnpackBuffer?t.bindBuffer(this._state.pixelUnpackBuffer.bufferType,this._state.pixelUnpackBuffer.glName):t.bindBuffer(35052,null),this._state.copyReadBuffer?t.bindBuffer(this._state.copyReadBuffer.bufferType,this._state.copyReadBuffer.glName):t.bindBuffer(36662,null),this._state.copyWriteBuffer?t.bindBuffer(this._state.copyWriteBuffer.bufferType,this._state.copyWriteBuffer.glName):t.bindBuffer(36663,null),t.bindFramebuffer(36008,null),t.readBuffer(t.BACK),this._state.readFramebuffer&&(t.bindFramebuffer(36008,this._state.readFramebuffer.glName),t.readBuffer(l)),t.bindFramebuffer(36009,this._state.drawFramebuffer?.glName??null),null===this._state.drawFramebuffer){const e=this._state.drawBuffers.defaultFramebuffer;t.drawBuffers(e??[1029])}else{const e=this._state.drawBuffers.fbos.get(this._state.drawFramebuffer);t.drawBuffers(e??[l])}if(this._state.vertexArrayObject){const t=this._state.vertexArrayObject;this._state.vertexArrayObject&&(this._state.vertexArrayObject.unbind(),this._state.vertexArrayObject=null),this.bindVAO(t)}t.useProgram(this._state.program?.glName??null),t.blendColor(this._state.blendColor.r,this._state.blendColor.g,this._state.blendColor.b,this._state.blendColor.a),t.bindRenderbuffer(t.RENDERBUFFER,this._state.renderbuffer?.glName??null),!0===this._state.blend?t.enable(this.gl.BLEND):t.disable(this.gl.BLEND),t.blendEquationSeparate(this._state.blendEquation.mode,this._state.blendEquation.modeAlpha),t.blendFuncSeparate(this._state.blendFunction.srcRGB,this._state.blendFunction.dstRGB,this._state.blendFunction.srcAlpha,this._state.blendFunction.dstAlpha),t.clearColor(this._state.clearColor.r,this._state.clearColor.g,this._state.clearColor.b,this._state.clearColor.a),t.clearDepth(this._state.clearDepth),t.clearStencil(this._state.clearStencil),t.colorMask(this._state.colorMask.r,this._state.colorMask.g,this._state.colorMask.b,this._state.colorMask.a),t.cullFace(this._state.cullFace),t.depthFunc(this._state.depthFunction),t.depthRange(this._state.depthRange.zNear,this._state.depthRange.zFar),!0===this._state.depthTest?t.enable(t.DEPTH_TEST):t.disable(t.DEPTH_TEST),t.depthMask(this._state.depthWrite),t.frontFace(this._state.frontFace),t.lineWidth(1),!0===this._state.faceCulling?t.enable(t.CULL_FACE):t.disable(t.CULL_FACE),t.polygonOffset(this._state.polygonOffset[0],this._state.polygonOffset[1]),!0===this._state.polygonOffsetFill?t.enable(t.POLYGON_OFFSET_FILL):t.disable(t.POLYGON_OFFSET_FILL),t.scissor(this._state.scissorRect.x,this._state.scissorRect.y,this._state.scissorRect.width,this._state.scissorRect.height),!0===this._state.scissorTest?t.enable(t.SCISSOR_TEST):t.disable(t.SCISSOR_TEST),t.stencilFunc(this._state.stencilFunction.func,this._state.stencilFunction.ref,this._state.stencilFunction.mask),t.stencilOpSeparate(this._state.stencilOperation.face,this._state.stencilOperation.fail,this._state.stencilOperation.zFail,this._state.stencilOperation.zPass),!0===this._state.stencilTest?t.enable(t.STENCIL_TEST):t.disable(t.STENCIL_TEST),t.stencilMask(this._state.stencilWriteMask);for(let s=0;s<this.parameters.maxTextureImageUnits;s++){t.activeTexture(h+s),t.bindTexture(3553,null),t.bindTexture(34067,null),t.bindTexture(32879,null),t.bindTexture(35866,null);const e=this._state.textureUnitMap[s];null!=e&&t.bindTexture(e.descriptor.target,e.glName)}t.activeTexture(h+this._state.activeTexture);const e=this._state.viewport;t.viewport(e.x,e.y,e.width,e.height),this.resetInfo()}};function B(t,e,s,i){return e?i!==e&&t.bindBuffer(s,e.glName):t.bindBuffer(s,null),e}function F(t,e){switch(t){case o.POINTS:return 2*e;case o.TRIANGLES:return e/3;case o.TRIANGLE_STRIP:case o.TRIANGLE_FAN:return e-2;default:return 0}}export{m as RenderingContext};
5
+ import has from"../../core/has.js";import{disposeMaybe as t}from"../../core/maybe.js";import{after as e}from"../../core/promiseUtils.js";import{Milliseconds as s}from"../../core/time.js";import{webglDebugEnabled as i,checkWebGLError as a,getErrorMessage as r}from"./checkWebGLError.js";import{ContextState as n}from"./ContextState.js";import{DrawBufferBack as l,DrawBufferNone as h,ColorAttachment0 as f,baseTextureUnit as o,ResourceType as u,PrimitiveType as c}from"./enums.js";import{InstanceCounter as d}from"./InstanceCounter.js";import{Parameters as _}from"./Parameters.js";import{ProgramCache as b}from"./ProgramCache.js";import{StateTracker as g}from"./renderState.js";import{Texture as p}from"./Texture.js";import{WebGLDriverTest as m}from"./WebGLDriverTest.js";import{Capabilities as B}from"./capabilities/Capabilities.js";let F=class{constructor(t,e){this.gl=t,this.instanceCounter=new d,this._programCache=new b(this),this._transformFeedbackRequestInfo=null,this._state=new n,this._numOfDrawCalls=0,this._numOfTriangles=0,this._options=e,this.configure(e)}configure(e){this._options=e,this._capabilities=new B(this.gl,e),this._parameters=new _(this.gl,this._capabilities,e),p.TEXTURE_UNIT_FOR_UPDATES=this._parameters.maxTextureImageUnits-1;const s=this.gl.getParameter(this.gl.VIEWPORT);this._state=new n,this._state.viewport={x:s[0],y:s[1],width:s[2],height:s[3]},this._stateTracker=new g({setBlending:t=>{if(t){this.setBlendingEnabled(!0),this.setBlendEquationSeparate(t.opRgb,t.opAlpha),this.setBlendFunctionSeparate(t.srcRgb,t.dstRgb,t.srcAlpha,t.dstAlpha);const e=t.color;this.setBlendColor(e.r,e.g,e.b,e.a)}else this.setBlendingEnabled(!1)},setCulling:t=>{t?(this.setFaceCullingEnabled(!0),this.setCullFace(t.face),this.setFrontFace(t.mode)):this.setFaceCullingEnabled(!1)},setPolygonOffset:t=>{t?(this.setPolygonOffsetFillEnabled(!0),this.setPolygonOffset(t.factor,t.units)):this.setPolygonOffsetFillEnabled(!1)},setDepthTest:t=>{t?(this.setDepthTestEnabled(!0),this.setDepthFunction(t.func)):this.setDepthTestEnabled(!1)},setStencilTest:t=>{if(t){this.setStencilTestEnabled(!0);const e=t.function;this.setStencilFunction(e.func,e.ref,e.mask);const s=t.operation;this.setStencilOp(s.fail,s.zFail,s.zPass)}else this.setStencilTestEnabled(!1)},setDepthWrite:t=>{t?(this.setDepthWriteEnabled(!0),this.setDepthRange(t.zNear,t.zFar)):this.setDepthWriteEnabled(!1)},setColorWrite:t=>{t?this.setColorMask(t.r,t.g,t.b,t.a):this.setColorMask(!1,!1,!1,!1)},setStencilWrite:t=>{t?this.setStencilWriteMask(t.mask):this.setStencilWriteMask(0)},setDrawBuffers:t=>{if(t)this.setDrawBuffers(t.buffers);else{const{drawFramebuffer:t}=this._state;null===t?this.setDrawBuffers([l]):0===t.colorAttachments.length?this.setDrawBuffers([h]):this.setDrawBuffers([f])}}}),this.enforceState(),t(this._driverTest),this._driverTest=new m(this)}updateOptions(t){this._options={...this._options,...t},this._parameters=new _(this.gl,this._capabilities,this._options)}dispose(){this._driverTest=t(this._driverTest),this._programCache=t(this._programCache),this.bindVAO(null),this.unbindBuffer(34962),this.unbindBuffer(34963),this.unbindBuffer(35345),this._state.uniformBufferBindingPoints.length=0,this.unbindBuffer(35051),this.unbindBuffer(35052),this.unbindBuffer(36662),this.unbindBuffer(36663),this._state.textureUnitMap.length=0,this._state=null,this._capabilities=null,this._stateTracker=null,i()&&console.log(this.instanceCounter.resourceInformation)}get driverTest(){return this._driverTest}get contextAttributes(){return this.gl.getContextAttributes()}get parameters(){return this._parameters}get programCache(){return this._programCache}setPipelineState(t){this._stateTracker.setPipeline(t)}setBlendingEnabled(t){this._state.blend!==t&&(!0===t?this.gl.enable(this.gl.BLEND):this.gl.disable(this.gl.BLEND),this._state.blend=t,this._stateTracker.invalidateBlending())}externalProgramUpdate(){this._state.program?.stop(),this._state.program=null}externalTextureUnitUpdate(t,e){for(let s=0;s<t.length;++s)this._state.textureUnitMap[t[s]]=null;e>=0&&(this._state.activeTexture=e)}externalVertexArrayObjectUpdate(){this.gl.bindVertexArray(null),this._state.vertexArrayObject=null,this._state.vertexBuffer=null,this._state.indexBuffer=null}externalVertexBufferUpdate(){this._state.vertexBuffer=null}externalIndexBufferUpdate(){this._state.indexBuffer=null}setBlendColor(t,e,s,i){t===this._state.blendColor.r&&e===this._state.blendColor.g&&s===this._state.blendColor.b&&i===this._state.blendColor.a||(this.gl.blendColor(t,e,s,i),this._state.blendColor.r=t,this._state.blendColor.g=e,this._state.blendColor.b=s,this._state.blendColor.a=i,this._stateTracker.invalidateBlending())}setBlendFunction(t,e){t===this._state.blendFunction.srcRGB&&e===this._state.blendFunction.dstRGB||(this.gl.blendFunc(t,e),this._state.blendFunction.srcRGB=t,this._state.blendFunction.srcAlpha=t,this._state.blendFunction.dstRGB=e,this._state.blendFunction.dstAlpha=e,this._stateTracker.invalidateBlending())}setBlendFunctionSeparate(t,e,s,i){this._state.blendFunction.srcRGB===t&&this._state.blendFunction.srcAlpha===s&&this._state.blendFunction.dstRGB===e&&this._state.blendFunction.dstAlpha===i||(this.gl.blendFuncSeparate(t,e,s,i),this._state.blendFunction.srcRGB=t,this._state.blendFunction.srcAlpha=s,this._state.blendFunction.dstRGB=e,this._state.blendFunction.dstAlpha=i,this._stateTracker.invalidateBlending())}setBlendEquation(t){this._state.blendEquation.mode!==t&&(this.gl.blendEquation(t),this._state.blendEquation.mode=t,this._state.blendEquation.modeAlpha=t,this._stateTracker.invalidateBlending())}setBlendEquationSeparate(t,e){this._state.blendEquation.mode===t&&this._state.blendEquation.modeAlpha===e||(this.gl.blendEquationSeparate(t,e),this._state.blendEquation.mode=t,this._state.blendEquation.modeAlpha=e,this._stateTracker.invalidateBlending())}setColorMask(t,e,s,i){this._state.colorMask.r===t&&this._state.colorMask.g===e&&this._state.colorMask.b===s&&this._state.colorMask.a===i||(this.gl.colorMask(t,e,s,i),this._state.colorMask.r=t,this._state.colorMask.g=e,this._state.colorMask.b=s,this._state.colorMask.a=i,this._stateTracker.invalidateColorWrite())}setClearColor(t,e,s,i){this._state.clearColor.r===t&&this._state.clearColor.g===e&&this._state.clearColor.b===s&&this._state.clearColor.a===i||(this.gl.clearColor(t,e,s,i),this._state.clearColor.r=t,this._state.clearColor.g=e,this._state.clearColor.b=s,this._state.clearColor.a=i)}setFaceCullingEnabled(t){this._state.faceCulling!==t&&(!0===t?this.gl.enable(this.gl.CULL_FACE):this.gl.disable(this.gl.CULL_FACE),this._state.faceCulling=t,this._stateTracker.invalidateCulling())}setPolygonOffsetFillEnabled(t){this._state.polygonOffsetFill!==t&&(!0===t?this.gl.enable(this.gl.POLYGON_OFFSET_FILL):this.gl.disable(this.gl.POLYGON_OFFSET_FILL),this._state.polygonOffsetFill=t,this._stateTracker.invalidatePolygonOffset())}setPolygonOffset(t,e){this._state.polygonOffset[0]===t&&this._state.polygonOffset[1]===e||(this._state.polygonOffset[0]=t,this._state.polygonOffset[1]=e,this.gl.polygonOffset(t,e),this._stateTracker.invalidatePolygonOffset())}setCullFace(t){this._state.cullFace!==t&&(this.gl.cullFace(t),this._state.cullFace=t,this._stateTracker.invalidateCulling())}setFrontFace(t){this._state.frontFace!==t&&(this.gl.frontFace(t),this._state.frontFace=t,this._stateTracker.invalidateCulling())}setScissorTestEnabled(t){this._state.scissorTest!==t&&(!0===t?this.gl.enable(this.gl.SCISSOR_TEST):this.gl.disable(this.gl.SCISSOR_TEST),this._state.scissorTest=t)}setScissorRect(t,e,s,i){this._state.scissorRect.x===t&&this._state.scissorRect.y===e&&this._state.scissorRect.width===s&&this._state.scissorRect.height===i||(this.gl.scissor(t,e,s,i),this._state.scissorRect.x=t,this._state.scissorRect.y=e,this._state.scissorRect.width=s,this._state.scissorRect.height=i)}setDepthTestEnabled(t){this._state.depthTest!==t&&(!0===t?this.gl.enable(this.gl.DEPTH_TEST):this.gl.disable(this.gl.DEPTH_TEST),this._state.depthTest=t,this._stateTracker.invalidateDepthTest())}setClearDepth(t){this._state.clearDepth!==t&&(this.gl.clearDepth(t),this._state.clearDepth=t)}setDepthFunction(t){this._state.depthFunction!==t&&(this.gl.depthFunc(t),this._state.depthFunction=t,this._stateTracker.invalidateDepthTest())}setDepthWriteEnabled(t){this._state.depthWrite!==t&&(this.gl.depthMask(t),this._state.depthWrite=t,this._stateTracker.invalidateDepthWrite())}setDepthRange(t,e){this._state.depthRange.zNear===t&&this._state.depthRange.zFar===e||(this.gl.depthRange(t,e),this._state.depthRange.zNear=t,this._state.depthRange.zFar=e,this._stateTracker.invalidateDepthWrite())}setStencilTestEnabled(t){this._state.stencilTest!==t&&(!0===t?this.gl.enable(this.gl.STENCIL_TEST):this.gl.disable(this.gl.STENCIL_TEST),this._state.stencilTest=t,this._stateTracker.invalidateStencilTest())}setClearStencil(t){t!==this._state.clearStencil&&(this.gl.clearStencil(t),this._state.clearStencil=t)}setStencilFunction(t,e,s){this._state.stencilFunction.func===t&&this._state.stencilFunction.ref===e&&this._state.stencilFunction.mask===s||(this.gl.stencilFunc(t,e,s),this._state.stencilFunction.face=1032,this._state.stencilFunction.func=t,this._state.stencilFunction.ref=e,this._state.stencilFunction.mask=s,this._stateTracker.invalidateStencilTest())}setStencilFunctionSeparate(t,e,s,i){this._state.stencilFunction.face===t&&this._state.stencilFunction.func===e&&this._state.stencilFunction.ref===s&&this._state.stencilFunction.mask===i||(this.gl.stencilFuncSeparate(t,e,s,i),this._state.stencilFunction.face=t,this._state.stencilFunction.func=e,this._state.stencilFunction.ref=s,this._state.stencilFunction.mask=i,this._stateTracker.invalidateStencilTest())}setStencilWriteMask(t){this._state.stencilWriteMask!==t&&(this.gl.stencilMask(t),this._state.stencilWriteMask=t,this._stateTracker.invalidateStencilWrite())}setStencilOp(t,e,s){1032===this._state.stencilOperation.face&&this._state.stencilOperation.fail===t&&this._state.stencilOperation.zFail===e&&this._state.stencilOperation.zPass===s||(this.gl.stencilOp(t,e,s),this._state.stencilOperation.face=1032,this._state.stencilOperation.fail=t,this._state.stencilOperation.zFail=e,this._state.stencilOperation.zPass=s,this._stateTracker.invalidateStencilTest())}setStencilOpSeparate(t,e,s,i){this._state.stencilOperation.face===t&&this._state.stencilOperation.fail===e&&this._state.stencilOperation.zFail===s&&this._state.stencilOperation.zPass===i||(this.gl.stencilOpSeparate(t,e,s,i),this._state.stencilOperation.face=t,this._state.stencilOperation.fail=e,this._state.stencilOperation.zFail=s,this._state.stencilOperation.zPass=i,this._stateTracker.invalidateStencilTest())}setActiveTexture(t,e=!1){const s=this._state.activeTexture;return t>=0&&(e||t!==this._state.activeTexture)&&(this.gl.activeTexture(o+t),this._state.activeTexture=t),s}setDrawBuffers(t){const{drawFramebuffer:e}=this._state,s=null===e,i=s?this._state.drawBuffers.defaultFramebuffer:this._state.drawBuffers.fbos.get(e);if(i?.length!==t.length||!i.every((e,s)=>e===t[s]))if(t.length>this.parameters.maxDrawBuffers)console.error("Setting more active draw buffers than GL.MAX_DRAW_BUFFERS allows.");else{if(s){if(t.length>1)return void console.error("The default framebuffer can only have one active draw buffer.");if(t[0]!==l&&t[0]!==h)return void console.error("The default framebuffer can only use the constants GL.BACK or GL.NONE as draw buffers.")}s||!t.includes(l)?(this.gl.drawBuffers(t),s?this._state.drawBuffers.defaultFramebuffer=t:this._state.drawBuffers.fbos.set(e,t),this._stateTracker.invalidateDrawBuffers()):console.error("A framebuffer object can only use the constants GL.COLOR_ATTACHMENTi or GL.NONE as draw buffers.")}}clear(t,e=255){if(t){if(16384&t){const t=this._state.drawFramebuffer?.colorAttachments;t&&this.setDrawBuffers(t),this.setColorMask(!0,!0,!0,!0)}256&t&&this.setDepthWriteEnabled(!0),1024&t&&this.setStencilWriteMask(e),this.gl.clear(t)}}clearFramebuffer(t,e=!1,s=!1){let i=0;if(t){const e=1e-13,s=Math.max(e,t[3]);this.setClearColor(t[0],t[1],t[2],s),i|=16384}e&&(i|=256),!1===s?s=0:(!0===s&&(s=255),i|=1024),i&&this.clear(i,s)}clearBuffer(t,e,s=6144,i=void 0){this.gl.clearBufferfv(s,t,e,i)}clearBufferInteger(t,e,s=6144,i=void 0){this.gl.clearBufferiv(s,t,e,i)}clearBufferUnsignedInteger(t,e,s=6144,i=void 0){this.gl.clearBufferuiv(s,t,e,i)}drawArrays(t,e,s){if(this._transformFeedbackRequestInfo){if(t!==this._transformFeedbackRequestInfo.primitiveType)throw new Error("DrawArrays called during transform feedback, but primitiveType does not match that of the current transform feedback request");if(null==this._state.program?.hasTransformFeedbackVaryings)throw new Error("DrawArrays called during transform feedback, but the shader program was not linked with a transform feedback varying")}if(i()&&(this._numOfDrawCalls++,this._numOfTriangles+=x(t,s),has("enable-feature:webgl-debug:textureReadWrite"))){const t=this._state.textureUnitMap;for(let e=0;e<t.length;e++){const s=t[e];if(null!=s&&s===this._state.drawFramebuffer?.colorTexture)throw new Error(`Detected readWrite. Texture already bound at index ${e}`)}}this.gl.drawArrays(t,e,s),a(this.gl)}drawArraysInstanced(t,e,s,i){this.gl.drawArraysInstanced(t,e,s,i),a(this.gl)}drawElements(t,e,s,a){if(this._transformFeedbackRequestInfo)throw new Error("Cannot called drawElements during a transform feedback request");if(i()&&(this._numOfDrawCalls++,this._numOfTriangles+=x(t,e)),this.gl.drawElements(t,e,s,a),i()){const i=r(this.gl);if(i){const r=this.getBoundVAO(),n=r?.indexBuffer,l=r?.buffers,h={indexBuffer:n,vertexBuffers:l},f={mode:t,count:e,type:s,offset:a},o=n?.size??0,u=a+e,c=o<u?`. Buffer is too small. Attempted to draw index ${u} of ${o}`:"";console.error(`drawElements: ${i}${c}`,{args:f,vao:h})}}}drawElementsInstanced(t,e,s,i,r){this.gl.drawElementsInstanced(t,e,s,i,r),a(this.gl)}logInfo(){i()&&console.log(`DrawCalls: ${this._numOfDrawCalls}, Triangles: ${this._numOfTriangles}`)}resetInfo(){i()&&(this._numOfDrawCalls=0,this._numOfTriangles=0)}get capabilities(){return this._capabilities}setViewport(t,e,s,i){s=Math.max(Math.round(s),1),i=Math.max(Math.round(i),1);const a=this._state.viewport;a.x===t&&a.y===e&&a.width===s&&a.height===i||(a.x=t,a.y=e,a.width=s,a.height=i,this.gl.viewport(t,e,s,i))}setViewport4fv(t){this.setViewport(t[0],t[1],t[2],t[3])}restoreViewport({x:t,y:e,width:s,height:i}){this.setViewport(t,e,s,i)}getViewport(){const t=this._state.viewport;return{x:t.x,y:t.y,width:t.width,height:t.height}}useProgram(t){this._state.program!==t&&(this._state.program?.stop(),this._state.program=t,this.gl.useProgram(t?.glName??null))}bindTexture(t,e,s=!1){(e>=this.parameters.maxTextureImageUnits||e<0)&&console.error("Input texture unit is out of range of available units!");const i=this._state.textureUnitMap[e];return null==t?.glName?(null!=i&&(this.setActiveTexture(e,s),this.gl.bindTexture(i.descriptor.target,null)),this._state.textureUnitMap[e]=null,i):s||i!==t?(this.setActiveTexture(e,s),this.gl.bindTexture(t.descriptor.target,t.glName),t.applyChanges(),this._state.textureUnitMap[e]=t,i):(t.isDirty&&(this.setActiveTexture(e,s),t.applyChanges()),i)}unbindTexture(t){if(null!=t)for(let e=0;e<this.parameters.maxTextureImageUnits;e++)this._state.textureUnitMap[e]===t&&(this.bindTexture(null,e),this._state.textureUnitMap[e]=null)}bindFramebuffer(t,e=!1){if(e||this._state.readFramebuffer!==t||this._state.drawFramebuffer!==t){if(this._stateTracker.invalidateDrawBuffers(),null==t)return this.gl.bindFramebuffer(36160,null),void(this._state.readFramebuffer=this._state.drawFramebuffer=null);t.initializeAndBind(36160),this._state.readFramebuffer=t,this._state.drawFramebuffer=t}}bindFramebufferSeparate(t,e,s=!1){const i=36008===e,a=i?this._state.readFramebuffer:this._state.drawFramebuffer;(s||a!==t)&&(null==t?this.gl.bindFramebuffer(e,null):t.initializeAndBind(e),i?this._state.readFramebuffer=t??null:(this._stateTracker.invalidateDrawBuffers(),this._state.drawFramebuffer=t??null))}blitFramebuffer(t,e,s=16384,i=9728,a=0,r=0,n=t.width,l=t.height,h=0,f=0,o=e.width,u=e.height){this.bindFramebufferSeparate(t,36008,!0),this.bindFramebufferSeparate(e,36009,!0),this.gl.blitFramebuffer(a,r,n,l,h,f,o,u,s,i)}bindBuffer(t,e){if(t)switch(e??=t.bufferType,e){case 34962:this._state.vertexBuffer=T(this.gl,t,e,this._state.vertexBuffer);break;case 34963:this._state.indexBuffer=T(this.gl,t,e,this._state.indexBuffer);break;case 35345:this._state.uniformBuffer=T(this.gl,t,e,this._state.uniformBuffer);break;case 35051:this._state.pixelPackBuffer=T(this.gl,t,e,this._state.pixelPackBuffer);break;case 35052:this._state.pixelUnpackBuffer=T(this.gl,t,e,this._state.pixelUnpackBuffer);break;case 36662:this._state.copyReadBuffer=T(this.gl,t,e,this._state.copyReadBuffer);break;case 36663:this._state.copyWriteBuffer=T(this.gl,t,e,this._state.copyWriteBuffer);break;case 35982:this._state.transformFeedbackBuffer=T(this.gl,t,e,this._state.transformFeedbackBuffer)}}bindRenderbuffer(t){const e=this.gl;t||(e.bindRenderbuffer(e.RENDERBUFFER,null),this._state.renderbuffer=null),this._state.renderbuffer!==t&&(e.bindRenderbuffer(e.RENDERBUFFER,t.glName),this._state.renderbuffer=t)}_getBufferBinding(t,e){if(e>=this.parameters.maxUniformBufferBindings||e<0)return console.error("Uniform buffer binding point is out of range!"),null;const s=35345===t?this._state.uniformBufferBindingPoints:this._state.transformBufferBindingPoints;let i=s[e];return null==i&&(i={buffer:null,offset:0,size:0},s[e]=i),i}bindBufferBase(t,e,s){const i=this._getBufferBinding(t,e);null!=i&&(i.buffer===s&&0===i.offset&&0===i.size||(this.gl.bindBufferBase(t,e,s?s.glName:null),i.buffer=s,i.offset=0,i.size=0))}bindBufferRange(t,e,s,i,a){const r=this._getBufferBinding(t,e);null!=r&&(r.buffer===s&&r.offset===i&&r.size===a||(i%this._parameters.uniformBufferOffsetAlignment===0?(this.gl.bindBufferRange(t,e,s.glName,i,a),r.buffer=s,r.offset=i,r.size=a):console.error("Uniform buffer binding offset is not a multiple of the context offset alignment")))}bindUBO(t,e,s,a){null!=e?(i()&&(a??e.byteLength)>this._parameters.maxUniformBlockSize&&console.error("Attempting to bind more data than the maximum uniform block size"),e.initialize(),void 0!==s&&void 0!==a?this.bindBufferRange(35345,t,e.buffer,s,a):this.bindBufferBase(35345,t,e.buffer)):this.bindBufferBase(35345,t,null)}unbindUBO(t){for(let e=0,s=this._state.uniformBufferBindingPoints.length;e<s;e++){const s=this._state.uniformBufferBindingPoints[e];null!=s&&s.buffer===t.buffer&&this.bindBufferBase(35345,e,null)}}unbindBuffer(t){switch(t){case 34962:this._state.vertexBuffer=T(this.gl,null,t,this._state.vertexBuffer);break;case 34963:this._state.indexBuffer=T(this.gl,null,t,this._state.indexBuffer);break;case 35345:this._state.uniformBuffer=T(this.gl,null,t,this._state.uniformBuffer);break;case 35051:this._state.pixelPackBuffer=T(this.gl,null,t,this._state.pixelPackBuffer);break;case 35052:this._state.pixelUnpackBuffer=T(this.gl,null,t,this._state.pixelUnpackBuffer);break;case 36662:this._state.copyReadBuffer=T(this.gl,null,t,this._state.copyReadBuffer);break;case 36663:this._state.copyWriteBuffer=T(this.gl,null,t,this._state.copyWriteBuffer)}}bindVAO(t,e){if(null==t)return this._state.vertexArrayObject?.unbind(),void(this._state.vertexArrayObject=null);this._state.vertexArrayObject!==t&&(t.bind(e),this._state.vertexArrayObject=t)}bindTransformFeedback(t){const{gl:e}=this;e.bindTransformFeedback(e.TRANSFORM_FEEDBACK,t.glName)}beginTransformFeedback(t,e){if(this._transformFeedbackRequestInfo)throw new Error("Already in a transform feedback request");const{gl:s}=this;s.bindTransformFeedback(s.TRANSFORM_FEEDBACK,t.glName),s.beginTransformFeedback(e),this._transformFeedbackRequestInfo={primitiveType:e}}endTransformFeedback(){if(!this._transformFeedbackRequestInfo)throw new Error("Not in a transform feedback request");const{gl:t}=this;t.endTransformFeedback(),t.bindTransformFeedback(t.TRANSFORM_FEEDBACK,null),this._transformFeedbackRequestInfo=null}async clientWaitAsync(t=s(10)){const{gl:i}=this,a=i.fenceSync(37143,0);if(!a)throw new Error("Client wait failed, could not create sync object");let r;this.instanceCounter.increment(u.Sync,a),i.flush();do{await e(t),r=i.clientWaitSync(a,0,0)}while(37147===r);if(this.instanceCounter.decrement(u.Sync,a),i.deleteSync(a),37149===r)throw new Error("Client wait failed")}getBoundFramebufferObject(t=36160){return 36008===t?this._state.readFramebuffer:this._state.drawFramebuffer}temporaryBindFramebufferObject(t,e,s=!1){const i=this.getBoundFramebufferObject();try{this.bindFramebuffer(t,s),e()}finally{this.bindFramebuffer(i,s)}}getBoundVAO(){return this._state.vertexArrayObject}resetState(){this.useProgram(null),this.bindVAO(null),this.bindFramebuffer(null,!0),this.unbindBuffer(34962),this.unbindBuffer(34963),this.unbindBuffer(35345),this._state.uniformBufferBindingPoints.length=0,this.unbindBuffer(35051),this.unbindBuffer(35052),this.unbindBuffer(36662),this.unbindBuffer(36663);for(let t=0;t<this.parameters.maxTextureImageUnits;++t)this.bindTexture(null,t);this.setBlendingEnabled(!1),this.setBlendFunction(1,0),this.setBlendEquation(32774),this.setBlendColor(0,0,0,0),this.setFaceCullingEnabled(!1),this.setCullFace(1029),this.setFrontFace(2305),this.setPolygonOffsetFillEnabled(!1),this.setPolygonOffset(0,0),this.setScissorTestEnabled(!1),this.setScissorRect(0,0,this.gl.canvas.width,this.gl.canvas.height),this.setDepthTestEnabled(!1),this.setDepthFunction(513),this.setDepthRange(0,1),this.setStencilTestEnabled(!1),this.setStencilFunction(519,0,0),this.setStencilOp(7680,7680,7680),this.setClearColor(0,0,0,0),this.setClearDepth(1),this.setClearStencil(0),this.setColorMask(!0,!0,!0,!0),this.setStencilWriteMask(4294967295),this.setDepthWriteEnabled(!0),this.setDrawBuffers([l]),this.setViewport(0,0,this.gl.canvas.width,this.gl.canvas.height)}enforceState(){const{gl:t}=this;t.bindVertexArray(null);for(let s=0;s<this.parameters.maxVertexAttributes;s++)t.disableVertexAttribArray(s);this._state.vertexBuffer?t.bindBuffer(this._state.vertexBuffer.bufferType,this._state.vertexBuffer.glName):t.bindBuffer(34962,null),this._state.indexBuffer?t.bindBuffer(this._state.indexBuffer.bufferType,this._state.indexBuffer.glName):t.bindBuffer(34963,null),this._state.uniformBuffer?t.bindBuffer(this._state.uniformBuffer.bufferType,this._state.uniformBuffer.glName):t.bindBuffer(35345,null);for(let s=0;s<this._parameters.maxUniformBufferBindings;s++){const e=this._state.uniformBufferBindingPoints[s];if(null!=e){const{buffer:i,offset:a,size:r}=e;null!==i?0===a&&0===r?t.bindBufferBase(35345,s,i.glName):t.bindBufferRange(35345,s,i.glName,a,r):t.bindBufferBase(35345,s,null)}}if(this._state.pixelPackBuffer?t.bindBuffer(this._state.pixelPackBuffer.bufferType,this._state.pixelPackBuffer.glName):t.bindBuffer(35051,null),this._state.pixelUnpackBuffer?t.bindBuffer(this._state.pixelUnpackBuffer.bufferType,this._state.pixelUnpackBuffer.glName):t.bindBuffer(35052,null),this._state.copyReadBuffer?t.bindBuffer(this._state.copyReadBuffer.bufferType,this._state.copyReadBuffer.glName):t.bindBuffer(36662,null),this._state.copyWriteBuffer?t.bindBuffer(this._state.copyWriteBuffer.bufferType,this._state.copyWriteBuffer.glName):t.bindBuffer(36663,null),t.bindFramebuffer(36008,null),t.readBuffer(t.BACK),this._state.readFramebuffer&&(t.bindFramebuffer(36008,this._state.readFramebuffer.glName),t.readBuffer(f)),t.bindFramebuffer(36009,this._state.drawFramebuffer?.glName??null),null===this._state.drawFramebuffer){const e=this._state.drawBuffers.defaultFramebuffer;t.drawBuffers(e??[l])}else{const e=this._state.drawBuffers.fbos.get(this._state.drawFramebuffer);t.drawBuffers(e??[f])}if(this._state.vertexArrayObject){const t=this._state.vertexArrayObject;this._state.vertexArrayObject&&(this._state.vertexArrayObject.unbind(),this._state.vertexArrayObject=null),this.bindVAO(t)}t.useProgram(this._state.program?.glName??null),t.blendColor(this._state.blendColor.r,this._state.blendColor.g,this._state.blendColor.b,this._state.blendColor.a),t.bindRenderbuffer(t.RENDERBUFFER,this._state.renderbuffer?.glName??null),!0===this._state.blend?t.enable(this.gl.BLEND):t.disable(this.gl.BLEND),t.blendEquationSeparate(this._state.blendEquation.mode,this._state.blendEquation.modeAlpha),t.blendFuncSeparate(this._state.blendFunction.srcRGB,this._state.blendFunction.dstRGB,this._state.blendFunction.srcAlpha,this._state.blendFunction.dstAlpha),t.clearColor(this._state.clearColor.r,this._state.clearColor.g,this._state.clearColor.b,this._state.clearColor.a),t.clearDepth(this._state.clearDepth),t.clearStencil(this._state.clearStencil),t.colorMask(this._state.colorMask.r,this._state.colorMask.g,this._state.colorMask.b,this._state.colorMask.a),t.cullFace(this._state.cullFace),t.depthFunc(this._state.depthFunction),t.depthRange(this._state.depthRange.zNear,this._state.depthRange.zFar),!0===this._state.depthTest?t.enable(t.DEPTH_TEST):t.disable(t.DEPTH_TEST),t.depthMask(this._state.depthWrite),t.frontFace(this._state.frontFace),t.lineWidth(1),!0===this._state.faceCulling?t.enable(t.CULL_FACE):t.disable(t.CULL_FACE),t.polygonOffset(this._state.polygonOffset[0],this._state.polygonOffset[1]),!0===this._state.polygonOffsetFill?t.enable(t.POLYGON_OFFSET_FILL):t.disable(t.POLYGON_OFFSET_FILL),t.scissor(this._state.scissorRect.x,this._state.scissorRect.y,this._state.scissorRect.width,this._state.scissorRect.height),!0===this._state.scissorTest?t.enable(t.SCISSOR_TEST):t.disable(t.SCISSOR_TEST),t.stencilFunc(this._state.stencilFunction.func,this._state.stencilFunction.ref,this._state.stencilFunction.mask),t.stencilOpSeparate(this._state.stencilOperation.face,this._state.stencilOperation.fail,this._state.stencilOperation.zFail,this._state.stencilOperation.zPass),!0===this._state.stencilTest?t.enable(t.STENCIL_TEST):t.disable(t.STENCIL_TEST),t.stencilMask(this._state.stencilWriteMask);for(let s=0;s<this.parameters.maxTextureImageUnits;s++){t.activeTexture(o+s),t.bindTexture(3553,null),t.bindTexture(34067,null),t.bindTexture(32879,null),t.bindTexture(35866,null);const e=this._state.textureUnitMap[s];null!=e&&t.bindTexture(e.descriptor.target,e.glName)}t.activeTexture(o+this._state.activeTexture);const e=this._state.viewport;t.viewport(e.x,e.y,e.width,e.height),this.resetInfo()}};function T(t,e,s,i){return e?i!==e&&t.bindBuffer(s,e.glName):t.bindBuffer(s,null),e}function x(t,e){switch(t){case c.POINTS:return 2*e;case c.TRIANGLES:return e/3;case c.TRIANGLE_STRIP:case c.TRIANGLE_FAN:return e-2;default:return 0}}export{F as RenderingContext};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- const _={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6},R={BYTE:5120,UNSIGNED_BYTE:5121,SHORT:5122,UNSIGNED_SHORT:5123,INT:5124,UNSIGNED_INT:5125,FLOAT:5126,HALF_FLOAT:5131},E={RGBA4:32854,R16F:33325,RG16F:33327,RGB32F:34837,RGBA16F:34842,R32F:33326,RG32F:33328,RGBA32F:34836,R11F_G11F_B10F:35898,RGB8:32849,RGBA8:32856,RGB5_A1:32855,R8:33321,RG8:33323,R8I:33329,R8UI:33330,R16I:33331,R16UI:33332,R32I:33333,R32UI:33334,RG8I:33335,RG8UI:33336,RG16I:33337,RG16UI:33338,RG32I:33339,RG32UI:33340,RGB16F:34843,RGB9_E5:35901,SRGB8:35905,SRGB8_ALPHA8:35907,RGB565:36194,RGBA32UI:36208,RGB32UI:36209,RGBA16UI:36214,RGB16UI:36215,RGBA8UI:36220,RGB8UI:36221,RGBA32I:36226,RGB32I:36227,RGBA16I:36232,RGB16I:36233,RGBA8I:36238,RGB8I:36239,R8_SNORM:36756,RG8_SNORM:36757,RGB8_SNORM:36758,RGBA8_SNORM:36759,RGB10_A2:32857,RGB10_A2UI:36975},S=Object.values(E),G={DEPTH24_STENCIL8:35056,DEPTH32F_STENCIL8:36013},T={DEPTH_COMPONENT16:33189,DEPTH_COMPONENT24:33190,DEPTH_COMPONENT32F:36012},N={FLOAT:R.FLOAT,UNSIGNED_BYTE:R.UNSIGNED_BYTE,UNSIGNED_INT_24_8:34042,UNSIGNED_SHORT_4_4_4_4:32819,UNSIGNED_SHORT_5_5_5_1:32820,UNSIGNED_SHORT_5_6_5:33635,BYTE:R.BYTE,UNSIGNED_SHORT:R.UNSIGNED_SHORT,SHORT:R.SHORT,UNSIGNED_INT:R.UNSIGNED_INT,INT:R.INT,HALF_FLOAT:5131,UNSIGNED_INT_2_10_10_10_REV:33640,UNSIGNED_INT_10F_11F_11F_REV:35899,UNSIGNED_INT_5_9_9_9_REV:35902,FLOAT_32_UNSIGNED_INT_24_8_REV:36269},I=33984,O={Texture:0,TileTexture:1,BufferObject:2,VertexArrayObject:3,Shader:4,Program:5,FramebufferObject:6,Renderbuffer:7,TransformFeedback:8,Sync:9,UNCOUNTED:10,LinesOfCode:10,Uniform:11,COUNT:12},B=0,A=36064,D=36065,C=36066,U=36067,P=36068,F=36069,H=36070,e=36071,L=36072,M=36073,r=36074,f=36075,t=36076,X=36077,a=36078,b=36079,c=33306,n=36096,o=36128,u={COMPRESSED_RGB_S3TC_DXT1_EXT:33776,COMPRESSED_RGBA_S3TC_DXT1_EXT:33777,COMPRESSED_RGBA_S3TC_DXT3_EXT:33778,COMPRESSED_RGBA_S3TC_DXT5_EXT:33779,COMPRESSED_R11_EAC:37488,COMPRESSED_SIGNED_R11_EAC:37489,COMPRESSED_RG11_EAC:37490,COMPRESSED_SIGNED_RG11_EAC:37491,COMPRESSED_RGB8_ETC2:37492,COMPRESSED_SRGB8_ETC2:37493,COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2:37494,COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2:37495,COMPRESSED_RGBA8_ETC2_EAC:37496,COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:37497};export{A as ColorAttachment0,D as ColorAttachment1,r as ColorAttachment10,f as ColorAttachment11,t as ColorAttachment12,X as ColorAttachment13,a as ColorAttachment14,b as ColorAttachment15,C as ColorAttachment2,U as ColorAttachment3,P as ColorAttachment4,F as ColorAttachment5,H as ColorAttachment6,e as ColorAttachment7,L as ColorAttachment8,M as ColorAttachment9,B as ColorAttachmentDisabled,u as CompressedTextureFormat,R as DataType,n as DepthAttachment,c as DepthStencilAttachment,N as PixelType,_ as PrimitiveType,O as ResourceType,T as SizedDepthFormat,G as SizedDepthStencilFormat,E as SizedPixelFormat,o as StencilAttachment,I as baseTextureUnit,S as sizedPixelFormatValues};
5
+ const _={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6},R={BYTE:5120,UNSIGNED_BYTE:5121,SHORT:5122,UNSIGNED_SHORT:5123,INT:5124,UNSIGNED_INT:5125,FLOAT:5126,HALF_FLOAT:5131},E={RGBA4:32854,R16F:33325,RG16F:33327,RGB32F:34837,RGBA16F:34842,R32F:33326,RG32F:33328,RGBA32F:34836,R11F_G11F_B10F:35898,RGB8:32849,RGBA8:32856,RGB5_A1:32855,R8:33321,RG8:33323,R8I:33329,R8UI:33330,R16I:33331,R16UI:33332,R32I:33333,R32UI:33334,RG8I:33335,RG8UI:33336,RG16I:33337,RG16UI:33338,RG32I:33339,RG32UI:33340,RGB16F:34843,RGB9_E5:35901,SRGB8:35905,SRGB8_ALPHA8:35907,RGB565:36194,RGBA32UI:36208,RGB32UI:36209,RGBA16UI:36214,RGB16UI:36215,RGBA8UI:36220,RGB8UI:36221,RGBA32I:36226,RGB32I:36227,RGBA16I:36232,RGB16I:36233,RGBA8I:36238,RGB8I:36239,R8_SNORM:36756,RG8_SNORM:36757,RGB8_SNORM:36758,RGBA8_SNORM:36759,RGB10_A2:32857,RGB10_A2UI:36975},S=Object.values(E),G={DEPTH24_STENCIL8:35056,DEPTH32F_STENCIL8:36013},T={DEPTH_COMPONENT16:33189,DEPTH_COMPONENT24:33190,DEPTH_COMPONENT32F:36012},N={FLOAT:R.FLOAT,UNSIGNED_BYTE:R.UNSIGNED_BYTE,UNSIGNED_INT_24_8:34042,UNSIGNED_SHORT_4_4_4_4:32819,UNSIGNED_SHORT_5_5_5_1:32820,UNSIGNED_SHORT_5_6_5:33635,BYTE:R.BYTE,UNSIGNED_SHORT:R.UNSIGNED_SHORT,SHORT:R.SHORT,UNSIGNED_INT:R.UNSIGNED_INT,INT:R.INT,HALF_FLOAT:5131,UNSIGNED_INT_2_10_10_10_REV:33640,UNSIGNED_INT_10F_11F_11F_REV:35899,UNSIGNED_INT_5_9_9_9_REV:35902,FLOAT_32_UNSIGNED_INT_24_8_REV:36269},I=33984,O={Texture:0,TileTexture:1,BufferObject:2,VertexArrayObject:3,Shader:4,Program:5,FramebufferObject:6,Renderbuffer:7,TransformFeedback:8,Sync:9,UNCOUNTED:10,LinesOfCode:10,Uniform:11,COUNT:12},B=1029,A=0,D=36064,C=36065,U=36066,P=36067,F=36068,H=36069,e=36070,L=36071,M=36072,r=36073,f=36074,t=36075,X=36076,a=36077,b=36078,c=36079,n=33306,o=36096,u=36128,Y={COMPRESSED_RGB_S3TC_DXT1_EXT:33776,COMPRESSED_RGBA_S3TC_DXT1_EXT:33777,COMPRESSED_RGBA_S3TC_DXT3_EXT:33778,COMPRESSED_RGBA_S3TC_DXT5_EXT:33779,COMPRESSED_R11_EAC:37488,COMPRESSED_SIGNED_R11_EAC:37489,COMPRESSED_RG11_EAC:37490,COMPRESSED_SIGNED_RG11_EAC:37491,COMPRESSED_RGB8_ETC2:37492,COMPRESSED_SRGB8_ETC2:37493,COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2:37494,COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2:37495,COMPRESSED_RGBA8_ETC2_EAC:37496,COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:37497};export{D as ColorAttachment0,C as ColorAttachment1,f as ColorAttachment10,t as ColorAttachment11,X as ColorAttachment12,a as ColorAttachment13,b as ColorAttachment14,c as ColorAttachment15,U as ColorAttachment2,P as ColorAttachment3,F as ColorAttachment4,H as ColorAttachment5,e as ColorAttachment6,L as ColorAttachment7,M as ColorAttachment8,r as ColorAttachment9,Y as CompressedTextureFormat,R as DataType,o as DepthAttachment,n as DepthStencilAttachment,B as DrawBufferBack,A as DrawBufferNone,N as PixelType,_ as PrimitiveType,O as ResourceType,T as SizedDepthFormat,G as SizedDepthStencilFormat,E as SizedPixelFormat,u as StencilAttachment,I as baseTextureUnit,S as sizedPixelFormatValues};