@arcgis/core 4.22.0-next.20211204 → 4.22.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (167) hide show
  1. package/PopupTemplate.js +1 -1
  2. package/assets/esri/core/workers/RemoteClient.js +1 -1
  3. package/assets/esri/core/workers/chunks/{44ccee36f8c74f4f134e.js → 025df54bafc05c183182.js} +1 -1
  4. package/assets/esri/core/workers/chunks/{23af0b02208e20d5c07e.js → 22c0032451a4e1d43167.js} +1 -1
  5. package/assets/esri/core/workers/chunks/28f9b48b59bf1347facd.js +1 -0
  6. package/assets/esri/core/workers/chunks/{ff9a9e705237c55f78ff.js → 49bf6ce6b31a0028cee1.js} +1 -1
  7. package/assets/esri/core/workers/chunks/{02ce52ca0084536bc066.js → 4f4cc4ebd68dbd5ee9c3.js} +1 -1
  8. package/assets/esri/core/workers/chunks/{058955b87ce2aa1b1809.js → 5915752b754997630665.js} +1 -1
  9. package/assets/esri/core/workers/chunks/60bfe5450b85b0d4605f.js +1 -0
  10. package/assets/esri/core/workers/chunks/{f3da8b797c8e1fcb1c21.js → 63161320a58a0b1702a2.js} +1 -1
  11. package/assets/esri/core/workers/chunks/{96a62dc1e07f3ef20a30.js → 67482a0c298e41ea47f5.js} +1 -1
  12. package/assets/esri/core/workers/chunks/{52aa3b44bddb10caa343.js → 753846665158c1c321ee.js} +1 -1
  13. package/assets/esri/core/workers/chunks/{8bc4ea821be16a752226.js → 764126387018aa548f58.js} +1 -1
  14. package/assets/esri/core/workers/chunks/{bc0b85bc1e5116836ba4.js → 79ddc2e92f0f057f6be3.js} +1 -1
  15. package/assets/esri/core/workers/chunks/{07bfb7bb4447aeacd87a.js → 7db1818ed9e834402e98.js} +1 -1
  16. package/assets/esri/core/workers/chunks/8150ec4b80adcf5fca86.js +1 -0
  17. package/assets/esri/core/workers/chunks/{6210b23872c362f51b12.js → 89d1c5f6ed167515ad24.js} +1 -1
  18. package/assets/esri/core/workers/chunks/{4417dfcb2ba50ac9f199.js → 8ac288ac3ff8e61b98c4.js} +1 -1
  19. package/assets/esri/core/workers/chunks/95b085ff097005995ced.js +1 -0
  20. package/assets/esri/core/workers/chunks/{e02a3d456525e76ddb60.js → a680a6acb45fa65436e6.js} +1 -1
  21. package/assets/esri/core/workers/chunks/{489147cf21d55f47d0e6.js → ab635e54fda321961683.js} +1 -1
  22. package/assets/esri/core/workers/chunks/{44145763617ea985cce4.js → c32a849111ae061ae194.js} +1 -1
  23. package/assets/esri/core/workers/chunks/{6a1ce00bcb689ea95bcb.js → dab0bfa26073cf325e08.js} +1 -1
  24. package/assets/esri/core/workers/chunks/{b6b46f8e6a7d8d3cef50.js → db00e63a7c4fdf635a8c.js} +1 -1
  25. package/assets/esri/widgets/Editor/t9n/Editor_ar.json +1 -1
  26. package/assets/esri/widgets/Editor/t9n/Editor_bg.json +1 -1
  27. package/assets/esri/widgets/Editor/t9n/Editor_bs.json +1 -1
  28. package/assets/esri/widgets/Editor/t9n/Editor_ca.json +1 -1
  29. package/assets/esri/widgets/Editor/t9n/Editor_cs.json +1 -1
  30. package/assets/esri/widgets/Editor/t9n/Editor_da.json +1 -1
  31. package/assets/esri/widgets/Editor/t9n/Editor_de.json +1 -1
  32. package/assets/esri/widgets/Editor/t9n/Editor_el.json +1 -1
  33. package/assets/esri/widgets/Editor/t9n/Editor_es.json +1 -1
  34. package/assets/esri/widgets/Editor/t9n/Editor_et.json +1 -1
  35. package/assets/esri/widgets/Editor/t9n/Editor_fi.json +1 -1
  36. package/assets/esri/widgets/Editor/t9n/Editor_fr.json +1 -1
  37. package/assets/esri/widgets/Editor/t9n/Editor_he.json +1 -1
  38. package/assets/esri/widgets/Editor/t9n/Editor_hr.json +1 -1
  39. package/assets/esri/widgets/Editor/t9n/Editor_hu.json +1 -1
  40. package/assets/esri/widgets/Editor/t9n/Editor_id.json +1 -1
  41. package/assets/esri/widgets/Editor/t9n/Editor_it.json +1 -1
  42. package/assets/esri/widgets/Editor/t9n/Editor_ja.json +1 -1
  43. package/assets/esri/widgets/Editor/t9n/Editor_ko.json +1 -1
  44. package/assets/esri/widgets/Editor/t9n/Editor_lt.json +1 -1
  45. package/assets/esri/widgets/Editor/t9n/Editor_lv.json +1 -1
  46. package/assets/esri/widgets/Editor/t9n/Editor_nb.json +1 -1
  47. package/assets/esri/widgets/Editor/t9n/Editor_nl.json +1 -1
  48. package/assets/esri/widgets/Editor/t9n/Editor_pl.json +1 -1
  49. package/assets/esri/widgets/Editor/t9n/Editor_pt-BR.json +1 -1
  50. package/assets/esri/widgets/Editor/t9n/Editor_pt-PT.json +1 -1
  51. package/assets/esri/widgets/Editor/t9n/Editor_ro.json +1 -1
  52. package/assets/esri/widgets/Editor/t9n/Editor_ru.json +1 -1
  53. package/assets/esri/widgets/Editor/t9n/Editor_sk.json +1 -1
  54. package/assets/esri/widgets/Editor/t9n/Editor_sl.json +1 -1
  55. package/assets/esri/widgets/Editor/t9n/Editor_sr.json +1 -1
  56. package/assets/esri/widgets/Editor/t9n/Editor_sv.json +1 -1
  57. package/assets/esri/widgets/Editor/t9n/Editor_th.json +1 -1
  58. package/assets/esri/widgets/Editor/t9n/Editor_tr.json +1 -1
  59. package/assets/esri/widgets/Editor/t9n/Editor_uk.json +1 -1
  60. package/assets/esri/widgets/Editor/t9n/Editor_vi.json +1 -1
  61. package/assets/esri/widgets/Editor/t9n/Editor_zh-CN.json +1 -1
  62. package/assets/esri/widgets/Editor/t9n/Editor_zh-HK.json +1 -1
  63. package/assets/esri/widgets/Editor/t9n/Editor_zh-TW.json +1 -1
  64. package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_nb.json +1 -1
  65. package/chunks/Clouds.glsl.js +4 -4
  66. package/chunks/RibbonLine.glsl.js +55 -61
  67. package/config.js +1 -1
  68. package/copyright.txt +47 -19
  69. package/interfaces.d.ts +183 -46
  70. package/layers/CSVLayer.js +1 -1
  71. package/layers/GeoJSONLayer.js +1 -1
  72. package/layers/mixins/ArcGISImageService.js +1 -1
  73. package/layers/mixins/operationalLayers.js +1 -1
  74. package/layers/support/layersCreator.js +1 -1
  75. package/package.json +1 -1
  76. package/renderers/VectorFieldRenderer.js +1 -1
  77. package/renderers/support/RasterSymbolizer.js +1 -1
  78. package/renderers/support/rasterRendererHelper.js +1 -1
  79. package/support/revision.js +1 -1
  80. package/views/2d/MapViewConstraints.js +1 -1
  81. package/views/2d/constraints/ZoomConstraint.js +1 -1
  82. package/views/2d/engine/Stage.js +1 -1
  83. package/views/2d/engine/webgl/shaders/sources/shaderRepository.js +1 -1
  84. package/views/2d/layers/FeatureLayerView2D.js +1 -1
  85. package/views/2d/layers/imagery/ImageryGraphicsView2D.js +1 -1
  86. package/views/3d/environment/Clouds.glsl.js +1 -1
  87. package/views/3d/environment/CloudsGenerator.js +1 -1
  88. package/views/3d/environment/NoiseTextureAtlas.js +1 -1
  89. package/views/MapView.js +1 -1
  90. package/views/MapViewBase.js +1 -1
  91. package/views/webgl/Program.js +1 -1
  92. package/widgets/Histogram.js +1 -1
  93. package/widgets/Legend/support/ActiveLayerInfo.js +1 -1
  94. package/widgets/Sketch/SketchViewModel.js +1 -1
  95. package/widgets/UtilityNetworkTrace.js +1 -1
  96. package/assets/esri/core/t9n/Units_no.json +0 -1
  97. package/assets/esri/core/workers/chunks/01c79caf64e297e1b221.js +0 -1
  98. package/assets/esri/core/workers/chunks/aa57f2c380132c746730.js +0 -1
  99. package/assets/esri/core/workers/chunks/b17afdfe4450f69298ad.js +0 -1
  100. package/assets/esri/core/workers/chunks/deba37055be7c2d7da26.js +0 -1
  101. package/assets/esri/identity/t9n/identity_no.json +0 -1
  102. package/assets/esri/smartMapping/t9n/smartMapping_no.json +0 -1
  103. package/assets/esri/t9n/basemaps_no.json +0 -1
  104. package/assets/esri/t9n/common_no.json +0 -1
  105. package/assets/esri/widgets/AreaMeasurement2D/t9n/AreaMeasurement2D_no.json +0 -1
  106. package/assets/esri/widgets/AreaMeasurement3D/t9n/AreaMeasurement3D_no.json +0 -1
  107. package/assets/esri/widgets/Attachments/t9n/Attachments_no.json +0 -1
  108. package/assets/esri/widgets/Attribution/t9n/Attribution_no.json +0 -1
  109. package/assets/esri/widgets/BasemapGallery/t9n/BasemapGallery_no.json +0 -1
  110. package/assets/esri/widgets/BasemapLayerList/t9n/BasemapLayerList_no.json +0 -1
  111. package/assets/esri/widgets/BasemapToggle/t9n/BasemapToggle_no.json +0 -1
  112. package/assets/esri/widgets/Bookmarks/t9n/Bookmarks_no.json +0 -1
  113. package/assets/esri/widgets/BuildingExplorer/t9n/BuildingExplorer_no.json +0 -1
  114. package/assets/esri/widgets/Compass/t9n/Compass_no.json +0 -1
  115. package/assets/esri/widgets/CoordinateConversion/t9n/CoordinateConversion_no.json +0 -1
  116. package/assets/esri/widgets/Daylight/t9n/Daylight_no.json +0 -1
  117. package/assets/esri/widgets/DirectLineMeasurement3D/t9n/DirectLineMeasurement3D_no.json +0 -1
  118. package/assets/esri/widgets/Directions/t9n/Directions_no.json +0 -1
  119. package/assets/esri/widgets/Directions/t9n/Printout_no.json +0 -1
  120. package/assets/esri/widgets/DistanceMeasurement2D/t9n/DistanceMeasurement2D_no.json +0 -1
  121. package/assets/esri/widgets/Editor/t9n/Editor_no.json +0 -1
  122. package/assets/esri/widgets/ElevationProfile/t9n/ElevationProfile_no.json +0 -1
  123. package/assets/esri/widgets/Expand/t9n/Expand_no.json +0 -1
  124. package/assets/esri/widgets/Feature/t9n/Feature_no.json +0 -1
  125. package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_no.json +0 -1
  126. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_no.json +0 -1
  127. package/assets/esri/widgets/FeatureTemplates/t9n/FeatureTemplates_no.json +0 -1
  128. package/assets/esri/widgets/FloorFilter/t9n/FloorFilter_no.json +0 -1
  129. package/assets/esri/widgets/Fullscreen/t9n/Fullscreen_no.json +0 -1
  130. package/assets/esri/widgets/Histogram/t9n/Histogram_no.json +0 -1
  131. package/assets/esri/widgets/HistogramRangeSlider/t9n/HistogramRangeSlider_no.json +0 -1
  132. package/assets/esri/widgets/Home/t9n/Home_no.json +0 -1
  133. package/assets/esri/widgets/LayerList/t9n/LayerList_no.json +0 -1
  134. package/assets/esri/widgets/Legend/t9n/Legend_no.json +0 -1
  135. package/assets/esri/widgets/LineOfSight/t9n/LineOfSight_no.json +0 -1
  136. package/assets/esri/widgets/Locate/t9n/Locate_no.json +0 -1
  137. package/assets/esri/widgets/Measurement/t9n/Measurement_no.json +0 -1
  138. package/assets/esri/widgets/NavigationToggle/t9n/NavigationToggle_no.json +0 -1
  139. package/assets/esri/widgets/Popup/t9n/Popup_no.json +0 -1
  140. package/assets/esri/widgets/Print/t9n/Print_no.json +0 -1
  141. package/assets/esri/widgets/ScaleBar/t9n/ScaleBar_no.json +0 -1
  142. package/assets/esri/widgets/ScaleRangeSlider/t9n/ScaleRangeSlider_no.json +0 -1
  143. package/assets/esri/widgets/Search/t9n/Search_no.json +0 -1
  144. package/assets/esri/widgets/ShadowCast/t9n/ShadowCast_no.json +0 -1
  145. package/assets/esri/widgets/Sketch/t9n/Sketch_no.json +0 -1
  146. package/assets/esri/widgets/Slice/t9n/Slice_no.json +0 -1
  147. package/assets/esri/widgets/Slider/t9n/Slider_no.json +0 -1
  148. package/assets/esri/widgets/Swipe/t9n/Swipe_no.json +0 -1
  149. package/assets/esri/widgets/TableList/t9n/TableList_no.json +0 -1
  150. package/assets/esri/widgets/TimeSlider/t9n/TimeSlider_no.json +0 -1
  151. package/assets/esri/widgets/Track/t9n/Track_no.json +0 -1
  152. package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_no.json +0 -1
  153. package/assets/esri/widgets/Zoom/t9n/Zoom_no.json +0 -1
  154. package/assets/esri/widgets/smartMapping/ClassedColorSlider/t9n/ClassedColorSlider_no.json +0 -1
  155. package/assets/esri/widgets/smartMapping/ClassedSizeSlider/t9n/ClassedSizeSlider_no.json +0 -1
  156. package/assets/esri/widgets/smartMapping/ColorSizeSlider/t9n/ColorSizeSlider_no.json +0 -1
  157. package/assets/esri/widgets/smartMapping/ColorSlider/t9n/ColorSlider_no.json +0 -1
  158. package/assets/esri/widgets/smartMapping/HeatmapSlider/t9n/HeatmapSlider_no.json +0 -1
  159. package/assets/esri/widgets/smartMapping/OpacitySlider/t9n/OpacitySlider_no.json +0 -1
  160. package/assets/esri/widgets/smartMapping/SizeSlider/t9n/SizeSlider_no.json +0 -1
  161. package/assets/esri/widgets/support/SelectionToolbar/t9n/SelectionToolbar_no.json +0 -1
  162. package/assets/esri/widgets/support/SnappingControls/t9n/SnappingControls_no.json +0 -1
  163. package/assets/esri/widgets/support/t9n/ColorPicker_no.json +0 -1
  164. package/assets/esri/widgets/support/t9n/DatePicker_no.json +0 -1
  165. package/assets/esri/widgets/support/t9n/TimePicker_no.json +0 -1
  166. package/assets/esri/widgets/support/t9n/timezone_no.json +0 -1
  167. package/assets/esri/widgets/support/t9n/uriUtils_no.json +0 -1
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.22/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../AggregateGraphic.js";import"../../../geometry.js";import i from"../../../Graphic.js";import r from"../../../core/Collection.js";import s from"../../../core/Error.js";import a from"../../../core/has.js";import{clone as n}from"../../../core/lang.js";import o from"../../../core/Logger.js";import{andThen as l,isSome as h,unwrap as u,isNone as d}from"../../../core/maybe.js";import{debounce as p,isAbortError as c}from"../../../core/promiseUtils.js";import{react as y}from"../../../core/reactiveUtils.js";import{init as f,whenFalseOnce as g}from"../../../core/watchUtils.js";import{property as m}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as _}from"../../../core/accessorSupport/decorators/subclass.js";import v from"../../../layers/effects/FeatureEffectView.js";import b from"../../../layers/support/FeatureFilter.js";import{calculateTolerance as R}from"../../../renderers/support/clickToleranceUtils.js";import x from"../../../rest/support/FeatureSet.js";import w from"../../../rest/support/Query.js";import{MAX_FILTERS as S}from"../engine/webgl/definitions.js";import{LayerView2DMixin as U}from"./LayerView2D.js";import{createSchema as F}from"./features/schemaUtils.js";import{createOrReuseTileRenderer as C}from"./features/tileRenderers.js";import{computePxBuffer as O}from"./features/support/pixelBuffering.js";import{findSizeVV as I,createClusterCountSizeVariable as E,isClusterCompatibleRenderer as q,createClusterRenderer as T}from"./support/clusterUtils.js";import j from"./support/FeatureCommandQueue.js";import V from"./support/FeatureLayerProxy.js";import{toJSONGeometryType as P}from"./support/util.js";import{TileManager as N}from"../tiling/TileManager.js";import{FeatureLayerView as k}from"../../layers/FeatureLayerView.js";import L from"../../layers/LayerView.js";import{RefreshableLayerView as H}from"../../layers/RefreshableLayerView.js";import{createQueryGeometry as z}from"../../support/drapedUtils.js";import J from"../../webgl/capabilities.js";import B from"../../../geometry/Extent.js";function Q(e){return e&&"openPorts"in e}const M=o.getLogger("esri.views.2d.layers.FeatureLayerView2D");let A=class extends(k(H(U(L)))){constructor(){super(...arguments),this._pipelineIsUpdating=!0,this._commandsQueue=new j({process:e=>{switch(e.type){case"processed-edit":return this._doEdit(e);case"refresh":return this._doRefresh(e.dataChanged);case"update":return this._doUpdate()}}}),this._visibilityOverrides=new Set,this._highlightIds=new Map,this._lastPixelBuffer=0,this._updateHighlight=p((async()=>this._proxy.setHighlight(Array.from(this._highlightIds.keys())))),this._uploadsLocked=!1,this._needsClusterSizeUpdate=!1,this.featureEffectView=new v,this._lastDefinitionExpression=null}destroy(){var e,t;l(this._updateClusterSizeTask,(e=>e.remove())),null==(e=this._proxy)||e.destroy(),null==(t=this.tileRenderer)||t.destroy(),this._commandsQueue.destroy()}initialize(){this.addResolvingPromise(Promise.all([this._initProxy(),this._initServiceOptions()])),this.handles.add([this.on("valueRangesChanged",(e=>{this._set("_aggregateValueRanges",e.valueRanges)})),y((()=>this.featureEffect),(e=>{this.featureEffectView.featureEffect=e}),{initial:!0,sync:!0})])}async _initProxy(){if("isTable"in this.layer&&this.layer.isTable)throw new s("featurelayerview:table-not-supported","table feature layer can't be displayed",{layer:this.layer});this._proxy&&this._proxy.destroy();const e=this._createClientOptions();return this._set("_proxy",new V({client:e})),this._proxy.when()}async _initServiceOptions(){this._set("_serviceOptions",await this._createServiceOptions())}get orderByFields(){return"stream"!==this._serviceOptions.type&&this._serviceOptions.orderByFields}get labelsVisible(){const e="subtype-group"===this.layer.type?this.layer.sublayers.items:[this.layer];return!this.suspended&&e.some((e=>e.labelingInfo&&e.labelsVisible))}get queryMode(){return this._serviceOptions.type}get renderingConfigHash(){if(!this.layer)return null;const e=this.availableFields,t=this.layer,i=this.view.floors,{definitionExpression:r}=t,s="subtype-group"!==this.layer.type&&this.layer.labelsVisible&&this.layer.labelingInfo,a="renderer"in t&&t.renderer,n="feature"===t.type?t.gdbVersion:void 0,o="feature"===t.type&&t.historicMoment?t.historicMoment.getTime():void 0,{timeExtent:l}=this,u="customParameters"in t?JSON.stringify(t.customParameters):void 0,d="apiKey"in t?t.apiKey:void 0,p="stream"===t.type?`${JSON.stringify(t.geometryDefinition)}${t.definitionExpression}`:null,c=JSON.stringify(this.clips),y=t.featureReduction&&t.featureReduction.toJSON(),f="orderBy"in this.layer&&JSON.stringify(this.layer.orderBy),g="sublayers"in this.layer&&this.layer.sublayers.items.reduce(((e,t)=>e+`${t.visible?1:0}.${JSON.stringify(t.renderer)}.${t.labelsVisible}\n.${JSON.stringify(t.labelingInfo)}`),"");return JSON.stringify({orderBy:f,sublayerHash:g,filterHash:h(this.filter)&&this.filter.toJSON(),effectHash:h(this.featureEffect)&&this.featureEffect.toJSON(),streamFilter:p,gdbVersion:n,definitionExpression:r,historicMoment:o,availableFields:e,renderer:a,labelingInfo:s,timeExtent:l,floors:i,clipsHash:c,featureReduction:y,customParameters:u,apiKey:d})}async fetchPopupFeatures(e,t){var i;if(h(t)&&0===t.clientGraphics.length)return[];if(!("cluster"===(null==(i=this.layer.featureReduction)?void 0:i.type))){const i=R({renderer:"renderer"in this.layer&&this.layer.renderer,event:h(t)&&t.event}),r=z(e,i,this.view),{features:s}=await this.queryVisibleFeatures(new w({geometry:r,outFields:["*"],returnGeometry:!0}));t=h(t)?t:{};const a=new Set(t.clientGraphics.map((e=>e.getObjectId())));for(const e of s)a.has(e.getObjectId())||t.clientGraphics.push(e)}return super.fetchPopupFeatures(e,t)}highlight(e){var t;let s;return e instanceof i?s=[e.getObjectId()]:"number"==typeof e||"string"==typeof e?s=[e]:Array.isArray(e)&&e.length>0?s="number"==typeof e[0]||"string"==typeof e[0]?e:e.map((e=>null==e?void 0:e.getObjectId())):r.isCollection(e)&&e.length>0&&(s=e.map((e=>null==e?void 0:e.getObjectId())).toArray()),s=null==(t=s)?void 0:t.filter((e=>null!=e)),s&&s.length?(this._addHighlight(s),{remove:()=>this._removeHighlight(s)}):{remove:()=>{}}}hasHighlight(){return!!this._highlightIds.size}async hitTest(e,r){if(!this.tileRenderer)return null;const s=await this.tileRenderer.hitTest(r);if(0===s.length)return null;const{features:a,aggregates:n}=await this._proxy.getFeatures(s);return[...n.map((e=>this._createHittestResult(t.fromJSON(e)))),...a.map((e=>this._createHittestResult(i.fromJSON(e))))]}async queryAggregates(){return(await this._proxy.getAggregates()).map((e=>t.fromJSON(e)))}queryStatistics(){return this._proxy.queryStatistics()}async querySummaryStatistics(e,t,i){const r={...t,scale:this.view.scale};return this._proxy.querySummaryStatistics(this._cleanUpQuery(e),r,i)}async queryUniqueValues(e,t,i){const r={...t,scale:this.view.scale};return this._proxy.queryUniqueValues(this._cleanUpQuery(e),r,i)}async queryClassBreaks(e,t,i){const r={...t,scale:this.view.scale};return this._proxy.queryClassBreaks(this._cleanUpQuery(e),r,i)}async queryHistogram(e,t,i){const r={...t,scale:this.view.scale};return this._proxy.queryHistogram(this._cleanUpQuery(e),r,i)}queryFeatures(e,t){return this.queryFeaturesJSON(e,t).then((e=>{const t=x.fromJSON(e);return t.features.forEach((e=>this._setLayersForFeature(e))),t}))}queryVisibleFeatures(e,t){return this._proxy.queryVisibleFeatures(this._cleanUpQuery(e),t).then((e=>{const t=x.fromJSON(e);return t.features.forEach((e=>this._setLayersForFeature(e))),t}))}queryFeaturesJSON(e,t){return this._proxy.queryFeatures(this._cleanUpQuery(e),t)}queryObjectIds(e,t){return this._proxy.queryObjectIds(this._cleanUpQuery(e),t)}queryFeatureCount(e,t){return this._proxy.queryFeatureCount(this._cleanUpQuery(e),t)}queryExtent(e,t){return this._proxy.queryExtent(this._cleanUpQuery(e),t).then((e=>({count:e.count,extent:B.fromJSON(e.extent)})))}setVisibility(e,t){t?this._visibilityOverrides.delete(e):this._visibilityOverrides.add(e),this._update()}update(e){if(!this._tileStrategy||!this.tileRenderer)return;const{hasMissingTiles:t,added:i,removed:r}=this._tileStrategy.update(e);(i.length||r.length)&&this._proxy.updateTiles({added:i,removed:r}),t&&this.requestUpdate(),this.notifyChange("updating")}attach(){this.view.timeline.record(`${this.layer.title} (FeatureLayer) Attach`),this._tileStrategy=new N({acquireTile:e=>this._acquireTile(e),releaseTile:e=>this._releaseTile(e),tileInfoView:this.view.featuresTilingScheme,buffer:0}),this.handles.add(f(this,"renderingConfigHash",(()=>this._update())),"attach"),"stream"!==this.layer.type&&this.handles.add(this.layer.on("edits",(e=>this._edit(e))),"attach")}detach(){this.container.removeAllChildren(),this.handles.remove("attach"),this.tileRenderer&&(this.tileRenderer.uninstall(this.container),this.tileRenderer=null),this._tileStrategy&&(this._tileStrategy.destroy(),this._tileStrategy=null),this._tileRendererHash=null}moveStart(){this.requestUpdate()}viewChange(){this.requestUpdate()}moveEnd(){this.requestUpdate()}isUpdating(){var e;const t="renderer"in this.layer&&null!=this.layer.renderer,i=this._commandsQueue.updating,r=null!=this._updatingRequiredFieldsPromise,s=!this._proxy||!this._proxy.isReady,n=this._pipelineIsUpdating,o=null===this.tileRenderer||(null==(e=this.tileRenderer)?void 0:e.updating),l=t&&(i||r||s||n||o);return a("esri-2d-log-updating")&&console.log(`Updating FLV2D: ${l}\n -> hasRenderer ${t}\n -> hasPendingCommand ${i}\n -> updatingRequiredFields ${r}\n -> updatingProxy ${s}\n -> updatingPipeline ${n}\n -> updatingTileRenderer ${o}\n`),l}_createClientOptions(){return{setUpdating:e=>{this._set("_pipelineIsUpdating",e)},emitEvent:e=>{this.emit(e.name,e.event)}}}async _detectQueryMode(e){if("path"in e&&("feature"===this.layer.type||"subtype-group"===this.layer.type)&&"point"===this.layer.geometryType&&this.layer.capabilities.query.supportsPagination&&!this.layer.capabilities.operations.supportsEditing&&a("featurelayer-snapshot-enabled"))try{const e=await this.layer.queryFeatureCount();if(e<=a("featurelayer-snapshot-point-min-threshold"))return{mode:"snapshot",featureCount:e};const t=a("featurelayer-snapshot-point-max-threshold"),i=a("featurelayer-snapshot-point-coverage"),r=this.view.extent,s=u(this.layer.fullExtent),n=null==s?void 0:s.clone().intersection(r),o=h(n)?n.width*n.height:0,l=(null==s?void 0:s.width)*(null==s?void 0:s.height),d=0===l?0:o/l;if(e<=t&&d>=i)return{mode:"snapshot",featureCount:e}}catch(t){M.warn("mapview-feature-layer","Encountered an error when querying for featureCount",{error:t})}return{mode:"on-demand"}}async _createServiceOptions(){var e;const t=this.layer;if("stream"===t.type)return null;const{capabilities:i,objectIdField:r}=t,s=t.fields.map((e=>e.toJSON())),a=h(t.fullExtent)&&t.fullExtent.toJSON(),o=P(t.geometryType),l=t.timeInfo&&t.timeInfo.toJSON()||null,u=t.spatialReference?t.spatialReference.toJSON():null,d="feature"===t.type?t.globalIdField:null;let p;"ogc-feature"===t.type?p=t.source.getFeatureDefinition():Q(t.source)?p=await t.source.openPorts():t.parsedUrl&&(p=n(t.parsedUrl),"dynamicDataSource"in t&&t.dynamicDataSource&&(p.query={layer:JSON.stringify({source:t.dynamicDataSource})}));const c="datesInUnknownTimezone"in this.layer&&this.layer.datesInUnknownTimezone,y=null!=(e="subtypeField"in this.layer&&this.layer.subtypeField)?e:null,{mode:f,featureCount:g}=await this._detectQueryMode(p);let m=this.layer.objectIdField;if("feature"===this.layer.type&&h(this.layer.orderBy)&&this.layer.orderBy.length){const e=!this.layer.orderBy[0].valueExpression&&this.layer.orderBy[0].field;e&&(m=e)}return{type:f,timeReferenceUnknownClient:c,subtypeField:y,featureCount:g,globalIdField:d,maxRecordCount:i.query.maxRecordCount,tileMaxRecordCount:i.query.tileMaxRecordCount,capabilities:i,fields:s,fullExtent:a,geometryType:o,objectIdField:r,source:p,timeInfo:l,spatialReference:u,orderByFields:m}}async _createMemoryServiceOptions(e){const t=await e.openPorts();return{...this._createServiceOptions(),type:"memory",source:t}}_cleanUpQuery(e){const t=w.from(e)||this.createQuery();return t.outSpatialReference||(t.outSpatialReference=this.view.spatialReference),t}async _update(){return this._commandsQueue.push({type:"update"})}async _edit(e){if(this._validateEdit(e))return this._commandsQueue.push({type:"edit",edits:e})}async doRefresh(e){return this._commandsQueue.push({type:"refresh",dataChanged:e})}_validateEdit(e){const t="globalIdField"in this.layer&&this.layer.globalIdField,i=e.deletedFeatures.some((e=>-1===e.objectId||!e.objectId)),r=t&&this.availableFields.includes(t);return i&&!r?(M.error(new s("mapview-apply-edits",`Editing the specified service requires the layer's globalIdField, ${t} to be included the layer's outFields for updates to be reflected on the map`)),null):e}async _doUpdate(){try{if(this.destroyed||!this._hasRequiredSupport(this.layer)||!this._tileStrategy)return;const{featureEffectView:t,filter:i}=this;await this._updateRequiredFields();const{renderer:r}=this._getEffectiveRenderer();this._set("_effectiveRenderer",r);const s=this._createSchemaConfig(),a=P(this.layer.geometryType),n=await O(r,a,this.container.stage.resourceManager,this.layer.fields,this.layer.spatialReference,this.layer.featureReduction),o=this._createConfiguration(s,i,t.filter),l=this._lastDefinitionExpression!==o.definitionExpression;this._lastDefinitionExpression=o.definitionExpression,this._lastPixelBuffer=0===n?0:Math.max(n,this._lastPixelBuffer),o.schema.source.pixelBuffer=this._lastPixelBuffer;const h=this._createTileRendererHash(r);if("snapshot"===this._serviceOptions.type&&(o.schema.source.featureCount=this._serviceOptions.featureCount),h!==this._tileRendererHash){await this._initTileRenderer(r);const e=this._serviceOptions;this.tileRenderer.onConfigUpdate(r);const t=this.layer;"stream"!==t.type&&Q(t.source)&&(e.source=await t.source.openPorts()),"stream"===t.type&&await this._initServiceOptions();const i={added:this._tileStrategy.tileKeys(),removed:[]};await this._proxy.startup(this.view.featuresTilingScheme,o,e,i),this.hasHighlight()&&await this._proxy.setHighlight(Array.from(this._highlightIds.keys())),await this._onceTilesUpdated(),this.tileRenderer.onConfigUpdate(r)}else{"snapshot"===this._serviceOptions.type&&l&&(o.schema.source.featureCount=await this.layer.queryFeatureCount());const t=await this._proxy.update(o);(t.mesh||t.targets.aggregate)&&this._lockGPUUploads();try{await this._proxy.applyUpdate(t)}catch(e){c(e)||M.error(e)}(t.mesh||t.targets.aggregate)&&this._unlockGPUUploads(),this.tileRenderer.onConfigUpdate(r),this._updateClusterSizeVariable(),this._forceAttributeTextureUpload()}this._tileRendererHash=h,this.tileRenderer.invalidateLabels(),this.requestUpdate()}catch(e){}}async _doEdit(e){try{await this._proxy.onEdits(e)}catch(t){c(t),0}}async _doRefresh(e){this._lockGPUUploads();try{await this._proxy.refresh(e)}catch(t){c(t),0}this._unlockGPUUploads()}_updateClusterSizeVariable(){this._needsClusterSizeUpdate&&(this.tileRenderer.onConfigUpdate(this._effectiveRenderer),this._needsClusterSizeUpdate=!1)}_createUpdateClusterSizeTask(e,t){return this.watch("_aggregateValueRanges",(async i=>{this._updateClusterEffectiveRendererSizeVariable(e,t,i),this._needsClusterSizeUpdate=!0,this._uploadsLocked||this._updateClusterSizeVariable()}))}async _updateClusterEffectiveRendererSizeVariable(e,t,i){if(e.dynamicClusterSize&&"visualVariables"in e&&e.visualVariables){const r=I(e.visualVariables);if(h(r)&&"cluster_count"===r.field){const s=e.visualVariables.indexOf(r);e.visualVariables[s]=E(t,i);const a=e.clone();a.dynamicClusterSize=!0,this._set("_effectiveRenderer",a)}}}_getEffectiveRenderer(){const e="renderer"in this.layer&&this.layer.renderer,t=this.layer.featureReduction;if(h(this._updateClusterSizeTask)&&(this._updateClusterSizeTask.remove(),this._updateClusterSizeTask=null),t&&"cluster"===t.type&&q(e)){const i=t,r=[],s=T(r,e,i,this._aggregateValueRanges);return l(this._updateClusterSizeTask,(e=>e.remove())),this._updateClusterSizeTask=this._createUpdateClusterSizeTask(s,i),{renderer:s,aggregateFields:r,featureReduction:t}}return{renderer:e,aggregateFields:[],featureReduction:null}}_acquireTile(e){const t=this.tileRenderer.acquireTile(e);return t.once("attach",(()=>{this.requestUpdate()})),t}_releaseTile(e){this.tileRenderer.releaseTile(e)}async _initTileRenderer(e){const t=await C(e,{layerView:this,tileInfoView:this.view.featuresTilingScheme,layer:this.layer});return this.tileRenderer&&(this._tileStrategy.clear(),this.tileRenderer.uninstall(this.container),this.tileRenderer.destroy(),this.tileRenderer=null),this.destroyed?null:(this._proxy.tileRenderer=t,this._set("tileRenderer",t),this.tileRenderer.install(this.container),this.tileRenderer.onConfigUpdate(e),this.requestUpdate(),this.tileRenderer)}_createTileRendererHash(e){return`${"heatmap"===e.type?"heatmap":"symbol"}.${"dot-density"===e.type}`}get hasFilter(){const e=!!("floorInfo"in this.layer&&this.layer.floorInfo&&this.view.floors&&this.view.floors.length);return!!this.filter||e||!!this._visibilityOverrides.size||!!this.timeExtent}_injectOverrides(e){const t=h(e)?e.timeExtent:null,i=h(this.timeExtent)&&h(t)?this.timeExtent.intersection(t):this.timeExtent||t;let r=null;const s="floorInfo"in this.layer&&this.layer.floorInfo;if(s){const t=h(e)&&e.where;r=this._addFloorFilterClause(t)}if(!this._visibilityOverrides.size&&!i&&!s)return h(e)?e.toJSON():null;(e=h(e)&&e.clone()||new b).timeExtent=i,r&&(e.where=r);const a=e.toJSON();return a.hiddenIds=Array.from(this._visibilityOverrides),a}_addFloorFilterClause(e){const t=this.layer;let i=e||"";if("floorInfo"in t&&t.floorInfo){var r;let e=this.view.floors;if(!e||!e.length)return i;null!=(r=t.floorInfo.viewAllLevelIds)&&r.length&&(e=t.floorInfo.viewAllLevelIds);const s=e.filter((e=>""!==e)).map((e=>"'"+e+"'"));s.push("''");const a=t.floorInfo.floorField;let n="("+a+" IN ({ids}) OR "+a+" IS NULL)";if(n=n.replace("{ids}",s.join(", ")),h(i)&&i.includes(a)){let e=new RegExp("AND \\("+a+".*NULL\\)","g");i=i.replace(e,""),e=new RegExp("\\("+a+".*NULL\\)","g"),i=i.replace(e,""),i=i.replace(/\s+/g," ").trim()}i=""!==i?"("+i+") AND "+n:n}return""!==i?i:null}_createConfiguration(e,t,i){const r="feature"===this.layer.type&&this.layer.historicMoment?this.layer.historicMoment.getTime():void 0,s="feature"===this.layer.type?this.layer.gdbVersion:void 0,a=new Array(S),n=this._injectOverrides(t);a[0]=n,a[1]=h(i)?i.toJSON():null;const o=F(e);if(d(o))return null;const l=J();return{definitionExpression:this.layer.definitionExpression,availableFields:this.availableFields,gdbVersion:s,historicMoment:r,devicePixelRatio:window.devicePixelRatio||1,filters:a,schema:o,supportsTextureFloat:l.supportsTextureFloat,maxTextureSize:l.maxTextureSize}}_hasRequiredSupport(e){var t;return!("renderer"in e&&"dot-density"===(null==(t=e.renderer)?void 0:t.type)&&!J().supportsTextureFloat)||(M.error(new s("webgl-missing-extension","Missing WebGL extension OES_Texture_Float which is required for DotDensity")),!1)}_onceTilesUpdated(){return this.requestUpdate(),g(this,"_pipelineIsUpdating",!1)}_lockGPUUploads(){this.tileRenderer&&(this._uploadsLocked=!0,this.tileRenderer.lockGPUUploads())}_unlockGPUUploads(){this.tileRenderer&&(this._uploadsLocked=!1,this.tileRenderer.unlockGPUUploads())}_forceAttributeTextureUpload(){this.tileRenderer&&this.tileRenderer.forceAttributeTextureUpload()}_createSchemaConfig(){const e="feature"===this.layer.type?this.layer.historicMoment:null,t="feature"===this.layer.type?this.layer.gdbVersion:null;return{renderer:"renderer"in this.layer&&this.layer.renderer,spatialReference:this.layer.spatialReference,timeExtent:this.layer.timeExtent,definitionExpression:this.layer.definitionExpression,featureReduction:this.layer.featureReduction,fields:this.layer.fields,geometryType:this.layer.geometryType,historicMoment:e,labelsVisible:"labelsVisible"in this.layer&&this.layer.labelsVisible,labelingInfo:"labelingInfo"in this.layer&&this.layer.labelingInfo,availableFields:this.availableFields,featureEffect:this.featureEffect,filter:this.filter,gdbVersion:t,pixelBuffer:0,orderBy:"orderBy"in this.layer&&this.layer.orderBy?this.layer.orderBy:null,customParameters:{..."customParameters"in this.layer?this.layer.customParameters:void 0,token:"apiKey"in this.layer?this.layer.apiKey:void 0}}}_addHighlight(e){for(const t of e)if(this._highlightIds.has(t)){const e=this._highlightIds.get(t);this._highlightIds.set(t,e+1)}else this._highlightIds.set(t,1);this._updateHighlight().catch((e=>{c(e)||M.error(e)}))}_removeHighlight(e){for(const t of e)if(this._highlightIds.has(t)){const e=this._highlightIds.get(t)-1;0===e?this._highlightIds.delete(t):this._highlightIds.set(t,e)}this._updateHighlight().catch((e=>{c(e)||M.error(e)}))}_setLayersForFeature(e){const t=this.layer;e.layer=t,e.sourceLayer=t}_createHittestResult(e){return this._setLayersForFeature(e),h(e.geometry)&&(e.geometry.spatialReference=this.view.spatialReference),e}};e([m()],A.prototype,"_serviceOptions",void 0),e([m()],A.prototype,"_proxy",void 0),e([m()],A.prototype,"_pipelineIsUpdating",void 0),e([m()],A.prototype,"_effectiveRenderer",void 0),e([m()],A.prototype,"_aggregateValueRanges",void 0),e([m()],A.prototype,"_commandsQueue",void 0),e([m()],A.prototype,"featureEffectView",void 0),e([m()],A.prototype,"labelsVisible",null),e([m({readOnly:!0})],A.prototype,"queryMode",null),e([m()],A.prototype,"renderingConfigHash",null),e([m()],A.prototype,"tileRenderer",void 0),e([m()],A.prototype,"updating",void 0),A=e([_("esri.views.2d.layers.FeatureLayerView2D")],A);const $=A;export{$ as default};
5
+ import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../AggregateGraphic.js";import"../../../geometry.js";import i from"../../../Graphic.js";import r from"../../../core/Collection.js";import s from"../../../core/Error.js";import a from"../../../core/has.js";import{clone as n}from"../../../core/lang.js";import o from"../../../core/Logger.js";import{andThen as l,isSome as h,unwrap as u,isNone as d}from"../../../core/maybe.js";import{debounce as p,isAbortError as c}from"../../../core/promiseUtils.js";import{react as y}from"../../../core/reactiveUtils.js";import{init as f,whenFalseOnce as g}from"../../../core/watchUtils.js";import{property as m}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as _}from"../../../core/accessorSupport/decorators/subclass.js";import v from"../../../layers/effects/FeatureEffectView.js";import b from"../../../layers/support/FeatureFilter.js";import{calculateTolerance as R}from"../../../renderers/support/clickToleranceUtils.js";import x from"../../../rest/support/FeatureSet.js";import w from"../../../rest/support/Query.js";import{MAX_FILTERS as S}from"../engine/webgl/definitions.js";import{LayerView2DMixin as U}from"./LayerView2D.js";import{createSchema as F}from"./features/schemaUtils.js";import{createOrReuseTileRenderer as I}from"./features/tileRenderers.js";import{computePxBuffer as C}from"./features/support/pixelBuffering.js";import{findSizeVV as O,createClusterCountSizeVariable as E,isClusterCompatibleRenderer as q,createClusterRenderer as T}from"./support/clusterUtils.js";import j from"./support/FeatureCommandQueue.js";import V from"./support/FeatureLayerProxy.js";import{toJSONGeometryType as P}from"./support/util.js";import{TileManager as N}from"../tiling/TileManager.js";import{FeatureLayerView as k}from"../../layers/FeatureLayerView.js";import L from"../../layers/LayerView.js";import{RefreshableLayerView as H}from"../../layers/RefreshableLayerView.js";import{createQueryGeometry as z}from"../../support/drapedUtils.js";import J from"../../webgl/capabilities.js";import B from"../../../geometry/Extent.js";function Q(e){return e&&"openPorts"in e}const M=o.getLogger("esri.views.2d.layers.FeatureLayerView2D");let A=class extends(k(H(U(L)))){constructor(){super(...arguments),this._pipelineIsUpdating=!0,this._commandsQueue=new j({process:e=>{switch(e.type){case"processed-edit":return this._doEdit(e);case"refresh":return this._doRefresh(e.dataChanged);case"update":return this._doUpdate()}}}),this._visibilityOverrides=new Set,this._highlightIds=new Map,this._lastPixelBuffer=0,this._updateHighlight=p((async()=>this._proxy.setHighlight(Array.from(this._highlightIds.keys())))),this._uploadsLocked=!1,this._needsClusterSizeUpdate=!1,this.featureEffectView=new v,this._lastDefinitionExpression=null}destroy(){var e,t;l(this._updateClusterSizeTask,(e=>e.remove())),null==(e=this._proxy)||e.destroy(),null==(t=this.tileRenderer)||t.destroy(),this._commandsQueue.destroy()}initialize(){this.addResolvingPromise(Promise.all([this._initProxy(),this._initServiceOptions()])),this.handles.add([this.on("valueRangesChanged",(e=>{this._set("_aggregateValueRanges",e.valueRanges)})),y((()=>this.featureEffect),(e=>{this.featureEffectView.featureEffect=e}),{initial:!0,sync:!0})])}async _initProxy(){if("isTable"in this.layer&&this.layer.isTable)throw new s("featurelayerview:table-not-supported","table feature layer can't be displayed",{layer:this.layer});this._proxy&&this._proxy.destroy();const e=this._createClientOptions();return this._set("_proxy",new V({client:e})),this._proxy.when()}async _initServiceOptions(){this._set("_serviceOptions",await this._createServiceOptions())}get orderByFields(){return"stream"!==this._serviceOptions.type&&this._serviceOptions.orderByFields}get labelsVisible(){const e="subtype-group"===this.layer.type?this.layer.sublayers.items:[this.layer];return!this.suspended&&e.some((e=>e.labelingInfo&&e.labelsVisible))}get queryMode(){return this._serviceOptions.type}get renderingConfigHash(){if(!this.layer)return null;const e=this.availableFields,t=this.layer,i=this.view.floors,{definitionExpression:r}=t,s="subtype-group"!==this.layer.type&&this.layer.labelsVisible&&this.layer.labelingInfo,a="renderer"in t&&t.renderer,n="feature"===t.type?t.gdbVersion:void 0,o="feature"===t.type&&t.historicMoment?t.historicMoment.getTime():void 0,{timeExtent:l}=this,u="customParameters"in t?JSON.stringify(t.customParameters):void 0,d="apiKey"in t?t.apiKey:void 0,p="stream"===t.type?`${JSON.stringify(t.geometryDefinition)}${t.definitionExpression}`:null,c=JSON.stringify(this.clips),y=t.featureReduction&&t.featureReduction.toJSON(),f="orderBy"in this.layer&&JSON.stringify(this.layer.orderBy),g="sublayers"in this.layer&&this.layer.sublayers.items.reduce(((e,t)=>e+`${t.visible?1:0}.${JSON.stringify(t.renderer)}.${t.labelsVisible}\n.${JSON.stringify(t.labelingInfo)}`),"");return JSON.stringify({orderBy:f,sublayerHash:g,filterHash:h(this.filter)&&this.filter.toJSON(),effectHash:h(this.featureEffect)&&this.featureEffect.toJSON(),streamFilter:p,gdbVersion:n,definitionExpression:r,historicMoment:o,availableFields:e,renderer:a,labelingInfo:s,timeExtent:l,floors:i,clipsHash:c,featureReduction:y,customParameters:u,apiKey:d})}async fetchPopupFeatures(e,t){var i;if(h(t)&&0===t.clientGraphics.length)return[];if(!("cluster"===(null==(i=this.layer.featureReduction)?void 0:i.type))){const i=R({renderer:"renderer"in this.layer&&this.layer.renderer,event:h(t)&&t.event}),r=z(e,i,this.view),{features:s}=await this.queryVisibleFeatures(new w({geometry:r,outFields:["*"],returnGeometry:!0}));t=h(t)?t:{};const a=new Set(t.clientGraphics.map((e=>e.getObjectId())));for(const e of s)a.has(e.getObjectId())||t.clientGraphics.push(e)}return super.fetchPopupFeatures(e,t)}highlight(e){var t;let s;return e instanceof i?s=[e.getObjectId()]:"number"==typeof e||"string"==typeof e?s=[e]:Array.isArray(e)&&e.length>0?s="number"==typeof e[0]||"string"==typeof e[0]?e:e.map((e=>null==e?void 0:e.getObjectId())):r.isCollection(e)&&e.length>0&&(s=e.map((e=>null==e?void 0:e.getObjectId())).toArray()),s=null==(t=s)?void 0:t.filter((e=>null!=e)),s&&s.length?(this._addHighlight(s),{remove:()=>this._removeHighlight(s)}):{remove:()=>{}}}hasHighlight(){return!!this._highlightIds.size}async hitTest(e,r){if(!this.tileRenderer)return null;const s=await this.tileRenderer.hitTest(r);if(0===s.length)return null;const{features:a,aggregates:n}=await this._proxy.getFeatures(s);return[...n.map((e=>this._createHittestResult(t.fromJSON(e)))),...a.map((e=>this._createHittestResult(i.fromJSON(e))))]}async queryAggregates(){return(await this._proxy.getAggregates()).map((e=>t.fromJSON(e)))}queryStatistics(){return this._proxy.queryStatistics()}async querySummaryStatistics(e,t,i){const r={...t,scale:this.view.scale};return this._proxy.querySummaryStatistics(this._cleanUpQuery(e),r,i)}async queryUniqueValues(e,t,i){const r={...t,scale:this.view.scale};return this._proxy.queryUniqueValues(this._cleanUpQuery(e),r,i)}async queryClassBreaks(e,t,i){const r={...t,scale:this.view.scale};return this._proxy.queryClassBreaks(this._cleanUpQuery(e),r,i)}async queryHistogram(e,t,i){const r={...t,scale:this.view.scale};return this._proxy.queryHistogram(this._cleanUpQuery(e),r,i)}queryFeatures(e,t){return this.queryFeaturesJSON(e,t).then((e=>{const t=x.fromJSON(e);return t.features.forEach((e=>this._setLayersForFeature(e))),t}))}queryVisibleFeatures(e,t){return this._proxy.queryVisibleFeatures(this._cleanUpQuery(e),t).then((e=>{const t=x.fromJSON(e);return t.features.forEach((e=>this._setLayersForFeature(e))),t}))}queryFeaturesJSON(e,t){return this._proxy.queryFeatures(this._cleanUpQuery(e),t)}queryObjectIds(e,t){return this._proxy.queryObjectIds(this._cleanUpQuery(e),t)}queryFeatureCount(e,t){return this._proxy.queryFeatureCount(this._cleanUpQuery(e),t)}queryExtent(e,t){return this._proxy.queryExtent(this._cleanUpQuery(e),t).then((e=>({count:e.count,extent:B.fromJSON(e.extent)})))}setVisibility(e,t){t?this._visibilityOverrides.delete(e):this._visibilityOverrides.add(e),this._update()}update(e){if(!this._tileStrategy||!this.tileRenderer)return;const{hasMissingTiles:t,added:i,removed:r}=this._tileStrategy.update(e);(i.length||r.length)&&this._proxy.updateTiles({added:i,removed:r}),t&&this.requestUpdate(),this.notifyChange("updating")}attach(){this.view.timeline.record(`${this.layer.title} (FeatureLayer) Attach`),this._tileStrategy=new N({acquireTile:e=>this._acquireTile(e),releaseTile:e=>this._releaseTile(e),tileInfoView:this.view.featuresTilingScheme,buffer:0}),this.handles.add(f(this,"renderingConfigHash",(()=>this._update())),"attach"),"stream"!==this.layer.type&&this.handles.add(this.layer.on("edits",(e=>this._edit(e))),"attach")}detach(){this.container.removeAllChildren(),this.handles.remove("attach"),this.tileRenderer&&(this.tileRenderer.uninstall(this.container),this.tileRenderer=null),this._tileStrategy&&(this._tileStrategy.destroy(),this._tileStrategy=null),this._tileRendererHash=null}moveStart(){this.requestUpdate()}viewChange(){this.requestUpdate()}moveEnd(){this.requestUpdate()}isUpdating(){var e;const t="renderer"in this.layer&&null!=this.layer.renderer,i=this._commandsQueue.updating,r=null!=this._updatingRequiredFieldsPromise,s=!this._proxy||!this._proxy.isReady,n=this._pipelineIsUpdating,o=null===this.tileRenderer||(null==(e=this.tileRenderer)?void 0:e.updating),l=t&&(i||r||s||n||o);return a("esri-2d-log-updating")&&console.log(`Updating FLV2D: ${l}\n -> hasRenderer ${t}\n -> hasPendingCommand ${i}\n -> updatingRequiredFields ${r}\n -> updatingProxy ${s}\n -> updatingPipeline ${n}\n -> updatingTileRenderer ${o}\n`),l}_createClientOptions(){return{setUpdating:e=>{this._set("_pipelineIsUpdating",e)},emitEvent:e=>{this.emit(e.name,e.event)}}}async _detectQueryMode(e){var t;const i="path"in e,r="editingInfo"in this.layer&&(null==(t=this.layer.editingInfo)?void 0:t.lastEditDate),s=!!this.layer.refreshInterval,n=!r&&s;if(i&&("feature"===this.layer.type||"subtype-group"===this.layer.type)&&"point"===this.layer.geometryType&&this.layer.capabilities.query.supportsPagination&&!this.layer.capabilities.operations.supportsEditing&&!n&&a("featurelayer-snapshot-enabled"))try{const e=await this.layer.queryFeatureCount();if(e<=a("featurelayer-snapshot-point-min-threshold"))return{mode:"snapshot",featureCount:e};const t=a("featurelayer-snapshot-point-max-threshold"),i=a("featurelayer-snapshot-point-coverage"),r=this.view.extent,s=u(this.layer.fullExtent),n=null==s?void 0:s.clone().intersection(r),o=h(n)?n.width*n.height:0,l=(null==s?void 0:s.width)*(null==s?void 0:s.height),d=0===l?0:o/l;if(e<=t&&d>=i)return{mode:"snapshot",featureCount:e}}catch(o){M.warn("mapview-feature-layer","Encountered an error when querying for featureCount",{error:o})}return{mode:"on-demand"}}async _createServiceOptions(){var e;const t=this.layer;if("stream"===t.type)return null;const{capabilities:i,objectIdField:r}=t,s=t.fields.map((e=>e.toJSON())),a=h(t.fullExtent)&&t.fullExtent.toJSON(),o=P(t.geometryType),l=t.timeInfo&&t.timeInfo.toJSON()||null,u=t.spatialReference?t.spatialReference.toJSON():null,d="feature"===t.type?t.globalIdField:null;let p;"ogc-feature"===t.type?p=t.source.getFeatureDefinition():Q(t.source)?p=await t.source.openPorts():t.parsedUrl&&(p=n(t.parsedUrl),"dynamicDataSource"in t&&t.dynamicDataSource&&(p.query={layer:JSON.stringify({source:t.dynamicDataSource})}));const c="datesInUnknownTimezone"in this.layer&&this.layer.datesInUnknownTimezone,y=null!=(e="subtypeField"in this.layer&&this.layer.subtypeField)?e:null,{mode:f,featureCount:g}=await this._detectQueryMode(p);let m=this.layer.objectIdField;if("feature"===this.layer.type&&h(this.layer.orderBy)&&this.layer.orderBy.length){const e=!this.layer.orderBy[0].valueExpression&&this.layer.orderBy[0].field;e&&(m=e)}return{type:f,timeReferenceUnknownClient:c,subtypeField:y,featureCount:g,globalIdField:d,maxRecordCount:i.query.maxRecordCount,tileMaxRecordCount:i.query.tileMaxRecordCount,capabilities:i,fields:s,fullExtent:a,geometryType:o,objectIdField:r,source:p,timeInfo:l,spatialReference:u,orderByFields:m}}async _createMemoryServiceOptions(e){const t=await e.openPorts();return{...this._createServiceOptions(),type:"memory",source:t}}_cleanUpQuery(e){const t=w.from(e)||this.createQuery();return t.outSpatialReference||(t.outSpatialReference=this.view.spatialReference),t}async _update(){return this._commandsQueue.push({type:"update"})}async _edit(e){if(this._validateEdit(e))return this._commandsQueue.push({type:"edit",edits:e})}async doRefresh(e){return this._commandsQueue.push({type:"refresh",dataChanged:e})}_validateEdit(e){const t="globalIdField"in this.layer&&this.layer.globalIdField,i=e.deletedFeatures.some((e=>-1===e.objectId||!e.objectId)),r=t&&this.availableFields.includes(t);return i&&!r?(M.error(new s("mapview-apply-edits",`Editing the specified service requires the layer's globalIdField, ${t} to be included the layer's outFields for updates to be reflected on the map`)),null):e}async _doUpdate(){try{if(this.destroyed||!this._hasRequiredSupport(this.layer)||!this._tileStrategy)return;const{featureEffectView:t,filter:i}=this;await this._updateRequiredFields();const{renderer:r}=this._getEffectiveRenderer();this._set("_effectiveRenderer",r);const s=this._createSchemaConfig(),a=P(this.layer.geometryType),n=await C(r,a,this.view.resourceManager,this.layer.fields,this.layer.spatialReference,this.layer.featureReduction),o=this._createConfiguration(s,i,t.filter),l=this._lastDefinitionExpression!==o.definitionExpression;this._lastDefinitionExpression=o.definitionExpression,this._lastPixelBuffer=0===n?0:Math.max(n,this._lastPixelBuffer),o.schema.source.pixelBuffer=this._lastPixelBuffer;const h=this._createTileRendererHash(r);if("snapshot"===this._serviceOptions.type&&(o.schema.source.featureCount=this._serviceOptions.featureCount),h!==this._tileRendererHash){await this._initTileRenderer(r);const e=this._serviceOptions;this.tileRenderer.onConfigUpdate(r);const t=this.layer;"stream"!==t.type&&Q(t.source)&&(e.source=await t.source.openPorts()),"stream"===t.type&&await this._initServiceOptions();const i={added:this._tileStrategy.tileKeys(),removed:[]};await this._proxy.startup(this.view.featuresTilingScheme,o,e,i),this.hasHighlight()&&await this._proxy.setHighlight(Array.from(this._highlightIds.keys())),await this._onceTilesUpdated(),this.tileRenderer.onConfigUpdate(r)}else{"snapshot"===this._serviceOptions.type&&l&&(o.schema.source.featureCount=await this.layer.queryFeatureCount());const t=await this._proxy.update(o);(t.mesh||t.targets.aggregate)&&this._lockGPUUploads();try{await this._proxy.applyUpdate(t)}catch(e){c(e)||M.error(e)}(t.mesh||t.targets.aggregate)&&this._unlockGPUUploads(),this.tileRenderer.onConfigUpdate(r),this._updateClusterSizeVariable(),this._forceAttributeTextureUpload()}this._tileRendererHash=h,this.tileRenderer.invalidateLabels(),this.requestUpdate()}catch(e){}}async _doEdit(e){try{await this._proxy.onEdits(e)}catch(t){c(t),0}}async _doRefresh(e){this._lockGPUUploads();try{await this._proxy.refresh(e)}catch(t){c(t),0}this._unlockGPUUploads()}_updateClusterSizeVariable(){this._needsClusterSizeUpdate&&(this.tileRenderer.onConfigUpdate(this._effectiveRenderer),this._needsClusterSizeUpdate=!1)}_createUpdateClusterSizeTask(e,t){return this.watch("_aggregateValueRanges",(async i=>{this._updateClusterEffectiveRendererSizeVariable(e,t,i),this._needsClusterSizeUpdate=!0,this._uploadsLocked||this._updateClusterSizeVariable()}))}async _updateClusterEffectiveRendererSizeVariable(e,t,i){if(e.dynamicClusterSize&&"visualVariables"in e&&e.visualVariables){const r=O(e.visualVariables);if(h(r)&&"cluster_count"===r.field){const s=e.visualVariables.indexOf(r);e.visualVariables[s]=E(t,i);const a=e.clone();a.dynamicClusterSize=!0,this._set("_effectiveRenderer",a)}}}_getEffectiveRenderer(){const e="renderer"in this.layer&&this.layer.renderer,t=this.layer.featureReduction;if(h(this._updateClusterSizeTask)&&(this._updateClusterSizeTask.remove(),this._updateClusterSizeTask=null),t&&"cluster"===t.type&&q(e)){const i=t,r=[],s=T(r,e,i,this._aggregateValueRanges);return l(this._updateClusterSizeTask,(e=>e.remove())),this._updateClusterSizeTask=this._createUpdateClusterSizeTask(s,i),{renderer:s,aggregateFields:r,featureReduction:t}}return{renderer:e,aggregateFields:[],featureReduction:null}}_acquireTile(e){const t=this.tileRenderer.acquireTile(e);return t.once("attach",(()=>{this.requestUpdate()})),t}_releaseTile(e){this.tileRenderer.releaseTile(e)}async _initTileRenderer(e){const t=await I(e,{layerView:this,tileInfoView:this.view.featuresTilingScheme,layer:this.layer});return this.tileRenderer&&(this._tileStrategy.clear(),this.tileRenderer.uninstall(this.container),this.tileRenderer.destroy(),this.tileRenderer=null),this.destroyed?null:(this._proxy.tileRenderer=t,this._set("tileRenderer",t),this.tileRenderer.install(this.container),this.tileRenderer.onConfigUpdate(e),this.requestUpdate(),this.tileRenderer)}_createTileRendererHash(e){return`${"heatmap"===e.type?"heatmap":"symbol"}.${"dot-density"===e.type}`}get hasFilter(){const e=!!("floorInfo"in this.layer&&this.layer.floorInfo&&this.view.floors&&this.view.floors.length);return!!this.filter||e||!!this._visibilityOverrides.size||!!this.timeExtent}_injectOverrides(e){const t=h(e)?e.timeExtent:null,i=h(this.timeExtent)&&h(t)?this.timeExtent.intersection(t):this.timeExtent||t;let r=null;const s="floorInfo"in this.layer&&this.layer.floorInfo;if(s){const t=h(e)&&e.where;r=this._addFloorFilterClause(t)}if(!this._visibilityOverrides.size&&!i&&!s)return h(e)?e.toJSON():null;(e=h(e)&&e.clone()||new b).timeExtent=i,r&&(e.where=r);const a=e.toJSON();return a.hiddenIds=Array.from(this._visibilityOverrides),a}_addFloorFilterClause(e){const t=this.layer;let i=e||"";if("floorInfo"in t&&t.floorInfo){var r;let e=this.view.floors;if(!e||!e.length)return i;null!=(r=t.floorInfo.viewAllLevelIds)&&r.length&&(e=t.floorInfo.viewAllLevelIds);const s=e.filter((e=>""!==e)).map((e=>"'"+e+"'"));s.push("''");const a=t.floorInfo.floorField;let n="("+a+" IN ({ids}) OR "+a+" IS NULL)";if(n=n.replace("{ids}",s.join(", ")),h(i)&&i.includes(a)){let e=new RegExp("AND \\("+a+".*NULL\\)","g");i=i.replace(e,""),e=new RegExp("\\("+a+".*NULL\\)","g"),i=i.replace(e,""),i=i.replace(/\s+/g," ").trim()}i=""!==i?"("+i+") AND "+n:n}return""!==i?i:null}_createConfiguration(e,t,i){const r="feature"===this.layer.type&&this.layer.historicMoment?this.layer.historicMoment.getTime():void 0,s="feature"===this.layer.type?this.layer.gdbVersion:void 0,a=new Array(S),n=this._injectOverrides(t);a[0]=n,a[1]=h(i)?i.toJSON():null;const o=F(e);if(d(o))return null;const l=J();return{definitionExpression:this.layer.definitionExpression,availableFields:this.availableFields,gdbVersion:s,historicMoment:r,devicePixelRatio:window.devicePixelRatio||1,filters:a,schema:o,supportsTextureFloat:l.supportsTextureFloat,maxTextureSize:l.maxTextureSize}}_hasRequiredSupport(e){var t;return!("renderer"in e&&"dot-density"===(null==(t=e.renderer)?void 0:t.type)&&!J().supportsTextureFloat)||(M.error(new s("webgl-missing-extension","Missing WebGL extension OES_Texture_Float which is required for DotDensity")),!1)}_onceTilesUpdated(){return this.requestUpdate(),g(this,"_pipelineIsUpdating",!1)}_lockGPUUploads(){this.tileRenderer&&(this._uploadsLocked=!0,this.tileRenderer.lockGPUUploads())}_unlockGPUUploads(){this.tileRenderer&&(this._uploadsLocked=!1,this.tileRenderer.unlockGPUUploads())}_forceAttributeTextureUpload(){this.tileRenderer&&this.tileRenderer.forceAttributeTextureUpload()}_createSchemaConfig(){const e="feature"===this.layer.type?this.layer.historicMoment:null,t="feature"===this.layer.type?this.layer.gdbVersion:null;return{renderer:"renderer"in this.layer&&this.layer.renderer,spatialReference:this.layer.spatialReference,timeExtent:this.layer.timeExtent,definitionExpression:this.layer.definitionExpression,featureReduction:this.layer.featureReduction,fields:this.layer.fields,geometryType:this.layer.geometryType,historicMoment:e,labelsVisible:"labelsVisible"in this.layer&&this.layer.labelsVisible,labelingInfo:"labelingInfo"in this.layer&&this.layer.labelingInfo,availableFields:this.availableFields,featureEffect:this.featureEffect,filter:this.filter,gdbVersion:t,pixelBuffer:0,orderBy:"orderBy"in this.layer&&this.layer.orderBy?this.layer.orderBy:null,customParameters:{..."customParameters"in this.layer?this.layer.customParameters:void 0,token:"apiKey"in this.layer?this.layer.apiKey:void 0}}}_addHighlight(e){for(const t of e)if(this._highlightIds.has(t)){const e=this._highlightIds.get(t);this._highlightIds.set(t,e+1)}else this._highlightIds.set(t,1);this._updateHighlight().catch((e=>{c(e)||M.error(e)}))}_removeHighlight(e){for(const t of e)if(this._highlightIds.has(t)){const e=this._highlightIds.get(t)-1;0===e?this._highlightIds.delete(t):this._highlightIds.set(t,e)}this._updateHighlight().catch((e=>{c(e)||M.error(e)}))}_setLayersForFeature(e){const t=this.layer;e.layer=t,e.sourceLayer=t}_createHittestResult(e){return this._setLayersForFeature(e),h(e.geometry)&&(e.geometry.spatialReference=this.view.spatialReference),e}};e([m()],A.prototype,"_serviceOptions",void 0),e([m()],A.prototype,"_proxy",void 0),e([m()],A.prototype,"_pipelineIsUpdating",void 0),e([m()],A.prototype,"_effectiveRenderer",void 0),e([m()],A.prototype,"_aggregateValueRanges",void 0),e([m()],A.prototype,"_commandsQueue",void 0),e([m()],A.prototype,"featureEffectView",void 0),e([m()],A.prototype,"labelsVisible",null),e([m({readOnly:!0})],A.prototype,"queryMode",null),e([m()],A.prototype,"renderingConfigHash",null),e([m()],A.prototype,"tileRenderer",void 0),e([m()],A.prototype,"updating",void 0),A=e([_("esri.views.2d.layers.FeatureLayerView2D")],A);const D=A;export{D as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.22/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../Graphic.js";import r from"../../../../request.js";import i from"../../../../core/Accessor.js";import s from"../../../../core/Logger.js";import{isSome as a}from"../../../../core/maybe.js";import{debounce as o,isAbortError as n}from"../../../../core/promiseUtils.js";import{property as p}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/arrayUtils.js";import"../../../../core/has.js";import"../../../../core/accessorSupport/ensureType.js";import{enumeration as c}from"../../../../core/accessorSupport/decorators/enumeration.js";import{subclass as h}from"../../../../core/accessorSupport/decorators/subclass.js";import l from"../../../../geometry/Extent.js";import{projectExtent as m}from"../../../../layers/support/rasterFunctions/rasterProjectionHelper.js";import{snapImageToSymbolTile as u}from"../../../../layers/support/rasterFunctions/vectorFieldUtils.js";import{GraphicsCollection as d}from"../../../../support/GraphicsCollection.js";import{Container as y}from"../../engine/Container.js";import g from"../graphics/GraphicContainer.js";import x from"../graphics/GraphicsView2D.js";const f=s.getLogger("esri.views.2d.layers.imagery.ImageryGraphicsView2D");let _=class extends i{constructor(){super(...arguments),this.attached=!1,this.container=new y,this.updateRequested=!1,this._graphicsView=null,this._projectFullExtentPromise=null,this._dataParameters={exportParametersVersion:0,extents:[],tileResolution:0,time:""},this.type="Graphics",this._graphics=new d,this._updateGraphics=o((async(e,t)=>{if(!e.stationary)return;const r=e.state,i=new l({xmin:r.extent.xmin,ymin:r.extent.ymin,xmax:r.extent.xmax,ymax:r.extent.ymax,spatialReference:r.spatialReference}),[s,o]=e.state.size,n={};n.timeExtent=this.timeExtent,n.requestAsImageElement=!1,n.signal=t,null==this._projectFullExtentPromise&&(this._projectFullExtentPromise=this._getProjectedFullExtent(i.spatialReference));const p="vector-field"===this.layer.renderer.type?this.layer.renderer.symbolTileSize:50,c=await this._projectFullExtentPromise,{extent:h,resolution:m,width:d,height:y}=u(i,s,o,p,c),g=await this.layer.fetchImage(h,d,y,n),x=this.layer.renderer;if("vector-field"===x.type){const t=g.pixelData.pixelBlock,r=x.sizeVariables[0];!a(t)||r.minDataValue&&r.maxDataValue||(r.minDataValue=t.statistics[0].minValue,r.maxDataValue=t.statistics[0].maxValue),this._pixelData={extent:h,pixelBlock:t};const i=h.clone().normalize(),s={exportParametersVersion:this.layer.exportImageServiceParameters.version,extents:i,tileResolution:m,time:JSON.stringify(this.timeExtent||"")},o=this._canReuseVectorFieldData(s)?this._dataParameters.extents:[],n=await x.getGraphicsFromPixelData(g.pixelData,"vector-uv"===this.layer.rasterInfo.dataType,o);if(o.length){const e=this._graphics.items.filter((e=>a(e.geometry)&&o.some((t=>t.intersects(e.geometry)))&&!i.some((t=>t.intersects(e.geometry)))));this._graphics.removeMany(e),this._graphics.addMany(n)}else this._graphics.set("items",n);this._graphicsView.update(e),this._dataParameters=s}}))}destroy(){this.attached&&(this.detach(),this.attached=!1),this.updateRequested=!1}get updating(){return!this.attached||this.isUpdating()}update(e){this._updateGraphics(e).catch((e=>{n(e)||f.error(e)}))}hitTest(e){return new t({attributes:{},geometry:e.clone(),layer:this.layer})}attach(){this._graphicsView=new x({view:this.view,graphics:this._graphics,requestUpdateCallback:()=>this.requestUpdate(),container:new g(this.view.featuresTilingScheme)}),this.attached=!0}detach(){this._graphics.destroy(),this._graphicsView.destroy(),this.container.removeChild(this._graphicsView.container),this._graphicsView=null}install(e){this.container.addChild(this._graphicsView.container),e.addChild(this.container)}uninstall(e){this.container.removeChild(this._graphicsView.container),e.removeChild(this.container)}isUpdating(){return this._graphicsView.updating||this.updateRequested}getPixelData(){return this.updating?null:this._pixelData}redraw(){}requestUpdate(){this.updateRequested||(this.updateRequested=!0,this.view.requestUpdate())}async _getProjectedFullExtent(e){try{return await m(this.layer.fullExtent,e)}catch(t){try{const t=(await r(this.layer.url,{query:{option:"footprints",outSR:e.wkid||JSON.stringify(e.toJSON()),f:"json"}})).data.featureCollection.layers[0].layerDefinition.extent;return t?l.fromJSON(t):null}catch{return null}}}_canReuseVectorFieldData(e){const t=this._dataParameters.exportParametersVersion===e.exportParametersVersion,r=this._dataParameters.time===e.time,i=Math.abs(this._dataParameters.tileResolution-e.tileResolution)/e.tileResolution<.01,s=this._dataParameters.extents.some((t=>e.extents.some((e=>t.intersects(e)))));return t&&r&&i&&s}};e([p()],_.prototype,"attached",void 0),e([p()],_.prototype,"container",void 0),e([p()],_.prototype,"layer",void 0),e([p()],_.prototype,"timeExtent",void 0),e([p()],_.prototype,"view",void 0),e([p()],_.prototype,"updateRequested",void 0),e([p()],_.prototype,"updating",null),e([c({graphics:"Graphics"})],_.prototype,"type",void 0),_=e([h("esri.views.2d.layers.imagery.ImageryGraphicsView2D")],_);const w=_;export{w as default};
5
+ import{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../Graphic.js";import r from"../../../../request.js";import i from"../../../../core/Accessor.js";import s from"../../../../core/Logger.js";import{isSome as a}from"../../../../core/maybe.js";import{debounce as o,isAbortError as n}from"../../../../core/promiseUtils.js";import{property as c}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/arrayUtils.js";import"../../../../core/has.js";import"../../../../core/accessorSupport/ensureType.js";import{enumeration as p}from"../../../../core/accessorSupport/decorators/enumeration.js";import{subclass as h}from"../../../../core/accessorSupport/decorators/subclass.js";import l from"../../../../geometry/Extent.js";import{projectExtent as m}from"../../../../layers/support/rasterFunctions/rasterProjectionHelper.js";import{snapImageToSymbolTile as u}from"../../../../layers/support/rasterFunctions/vectorFieldUtils.js";import{GraphicsCollection as d}from"../../../../support/GraphicsCollection.js";import{Container as y}from"../../engine/Container.js";import g from"../graphics/GraphicContainer.js";import x from"../graphics/GraphicsView2D.js";const f=s.getLogger("esri.views.2d.layers.imagery.ImageryGraphicsView2D");let _=class extends i{constructor(){super(...arguments),this.attached=!1,this.container=new y,this.updateRequested=!1,this._graphicsView=null,this._projectFullExtentPromise=null,this._dataParameters={exportParametersVersion:0,extents:[],tileResolution:0,time:"",isOceanStyle:!1,isOceanographic:!1},this.type="Graphics",this._graphics=new d,this._updateGraphics=o((async(e,t)=>{if(!e.stationary)return;const r=e.state,i=new l({xmin:r.extent.xmin,ymin:r.extent.ymin,xmax:r.extent.xmax,ymax:r.extent.ymax,spatialReference:r.spatialReference}),[s,o]=e.state.size,n={};n.timeExtent=this.timeExtent,n.requestAsImageElement=!1,n.signal=t,null==this._projectFullExtentPromise&&(this._projectFullExtentPromise=this._getProjectedFullExtent(i.spatialReference));const c="vector-field"===this.layer.renderer.type?this.layer.renderer.symbolTileSize:50,p=await this._projectFullExtentPromise,{extent:h,resolution:m,width:d,height:y}=u(i,s,o,c,p),g=await this.layer.fetchImage(h,d,y,n),x=this.layer.renderer;if("vector-field"===x.type){const t=g.pixelData.pixelBlock,r=x.sizeVariables[0];!a(t)||r.minDataValue&&r.maxDataValue||(r.minDataValue=t.statistics[0].minValue,r.maxDataValue=t.statistics[0].maxValue),this._pixelData={extent:h,pixelBlock:t};const i=h.clone().normalize(),s={exportParametersVersion:this.layer.exportImageServiceParameters.version,extents:i,tileResolution:m,time:JSON.stringify(this.timeExtent||""),isOceanStyle:"flow-to"===x.flowRepresentation,isOceanographic:"ocean-current-kn"===x.style||"ocean-current-m"===x.style},o=this._canReuseVectorFieldData(s)?this._dataParameters.extents:[],n=await x.getGraphicsFromPixelData(g.pixelData,"vector-uv"===this.layer.rasterInfo.dataType,o);if(o.length){const e=this._graphics.items.filter((e=>a(e.geometry)&&o.some((t=>t.intersects(e.geometry)))&&!i.some((t=>t.intersects(e.geometry)))));this._graphics.removeMany(e),this._graphics.addMany(n)}else this._graphics.set("items",n);this._graphicsView.update(e),this._dataParameters=s}}))}destroy(){this.attached&&(this.detach(),this.attached=!1),this.updateRequested=!1}get updating(){return!this.attached||this.isUpdating()}update(e){this._updateGraphics(e).catch((e=>{n(e)||f.error(e)}))}hitTest(e){return new t({attributes:{},geometry:e.clone(),layer:this.layer})}attach(){this._graphicsView=new x({view:this.view,graphics:this._graphics,requestUpdateCallback:()=>this.requestUpdate(),container:new g(this.view.featuresTilingScheme)}),this.attached=!0}detach(){this._graphics.destroy(),this._graphicsView.destroy(),this.container.removeChild(this._graphicsView.container),this._graphicsView=null}install(e){this.container.addChild(this._graphicsView.container),e.addChild(this.container)}uninstall(e){this.container.removeChild(this._graphicsView.container),e.removeChild(this.container)}isUpdating(){return this._graphicsView.updating||this.updateRequested}getPixelData(){return this.updating?null:this._pixelData}redraw(){}requestUpdate(){this.updateRequested||(this.updateRequested=!0,this.view.requestUpdate())}async _getProjectedFullExtent(e){try{return await m(this.layer.fullExtent,e)}catch(t){try{const t=(await r(this.layer.url,{query:{option:"footprints",outSR:e.wkid||JSON.stringify(e.toJSON()),f:"json"}})).data.featureCollection.layers[0].layerDefinition.extent;return t?l.fromJSON(t):null}catch{return null}}}_canReuseVectorFieldData(e){const t=this._dataParameters.exportParametersVersion===e.exportParametersVersion,r=this._dataParameters.time===e.time,i=Math.abs(this._dataParameters.tileResolution-e.tileResolution)/e.tileResolution<.01,s=this._dataParameters.extents.some((t=>e.extents.some((e=>t.intersects(e))))),a=this._dataParameters.isOceanStyle===e.isOceanStyle,o=this._dataParameters.isOceanographic===e.isOceanographic;return t&&r&&i&&s&&a&&o}};e([c()],_.prototype,"attached",void 0),e([c()],_.prototype,"container",void 0),e([c()],_.prototype,"layer",void 0),e([c()],_.prototype,"timeExtent",void 0),e([c()],_.prototype,"view",void 0),e([c()],_.prototype,"updateRequested",void 0),e([c()],_.prototype,"updating",null),e([p({graphics:"Graphics"})],_.prototype,"type",void 0),_=e([h("esri.views.2d.layers.imagery.ImageryGraphicsView2D")],_);const w=_;export{w 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.22/esri/copyright.txt for details.
4
4
  */
5
- import"../webgl-engine/core/shaderModules/interfaces.js";import"../webgl-engine/core/shaderModules/ShaderBuilder.js";export{b as build}from"../../../chunks/Clouds.glsl.js";
5
+ import"./NoiseTextureAtlas.js";import"../webgl-engine/core/shaderModules/interfaces.js";import"../webgl-engine/core/shaderModules/ShaderBuilder.js";export{b as build}from"../../../chunks/Clouds.glsl.js";
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.22/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../core/Accessor.js";import s from"../../../core/has.js";import{lerp as i}from"../../../core/mathUtils.js";import{removeMaybe as r,releaseMaybe as o,disposeMaybe as h,destroyMaybe as a,isNone as n}from"../../../core/maybe.js";import{property as c}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/arrayUtils.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as u}from"../../../core/accessorSupport/decorators/subclass.js";import{f as m}from"../../../chunks/mat3.js";import{c as d}from"../../../chunks/mat3f64.js";import{q as p}from"../../../chunks/mat4.js";import{c as l}from"../../../chunks/mat4f64.js";import{f,z as _}from"../../../chunks/vec3f32.js";import{getReferenceEllipsoid as g}from"../../../geometry/projectionEllipsoid.js";import{CloudsTechniqueConfiguration as y,CloudsTechnique as b}from"./CloudsTechnique.js";import{NoiseTextureAtlas as S}from"./NoiseTextureAtlas.js";import{createQuadVAO as v}from"../webgl-engine/lib/glUtil3D.js";import{TaskPriority as x}from"../../support/Scheduler.js";import w from"../../webgl/FramebufferObject.js";let T=class extends t{constructor(e){super(e),this._frameTask=null,this._techniques=[],this._techniqueConfiguration=new y,this._cubeMapSize=s("esri-mobile")?1024:2048,this._viewMat3=d(),this._eye=_(),this._didRenderFaces=!1,this._raymarchingStepType=0,this._cloudRadius=0,this._viewMatrix=l();const t=j.sunny;this.coverage=i(t.coverage[1],t.coverage[0],.5),this.density=i(t.density[1],t.density[0],.5),this.absorption=i(t.absorption[1],t.absorption[0],.5),this.cloudSize=i(t.cloudSize[1],t.cloudSize[0],.5),this.detailSize=i(t.detailSize[1],t.detailSize[0],.5),this.smoothness=i(t.smoothness[1],t.smoothness[0],.5),this.cloudHeight=i(t.cloudHeight[1],t.cloudHeight[0],.5),this.raymarchingStepType=t.raymarchingStepType}_getTechnique(e){const t=this._techniques[e];return t||(this._techniqueConfiguration.steps=e,this._techniques[e]=new b({rctx:this.rctx,viewingMode:this.view.state.viewingMode},this._techniqueConfiguration),this._techniques[e])}initialize(){this._vao=v(this.rctx);const e=g(this.view.spatialReference);this._cloudRadius=.5*e.radius,this.resetRenderFlags(),this._frameTask=this.view.resourceController.scheduler.registerTask(x.CLOUDS_GENERATOR,this)}destroy(){this._frameTask=r(this._frameTask),this._techniques.forEach((e=>o(e))),this._techniques=null,this._frameBufferCube=h(this._frameBufferCube),this._vao=h(this._vao),this._noiseTextureAtlas=a(this._noiseTextureAtlas)}set coverage(e){this._coverage=e,this.resetRenderFlags()}get coverage(){return this._coverage}set density(e){this._density=this.remap(e,0,1,0,.3),this.resetRenderFlags()}set cloudSize(e){this._cloudSize=this.remap(Math.max(.01,1-e),0,1,0,.02),this.resetRenderFlags()}set detailSize(e){this._detailSize=this.remap(Math.max(.01,1-e),0,1,0,.2),this.resetRenderFlags()}set smoothness(e){this._smoothness=this.remap(1-e,0,1,0,.5),this.resetRenderFlags()}set absorption(e){this._sigmaE=1+e,this._power=this.remap(e,0,1,35,120),this.resetRenderFlags()}get absorption(){return this._sigmaE-1}set cloudHeight(e){this._cloudHeight=this.remap(e,0,1,0,1500),this.resetRenderFlags()}get cloudHeight(){return this._cloudHeight}set raymarchingStepType(e){this._raymarchingStepType=e,this.resetRenderFlags()}get noiseTextureAtlas(){return n(this._noiseTextureAtlas)&&(this._noiseTextureAtlas=new S(this.rctx,this.view),this._noiseTextureAtlas.render(128,this.rctx)),this._noiseTextureAtlas}get frameBufferCube(){if(n(this._frameBufferCube)){const e={target:34067,pixelFormat:6408,dataType:5121,wrapMode:33071,samplingMode:9729,hasMipmap:!1,width:this._cubeMapSize,height:this._cubeMapSize};this._frameBufferCube=new w(this.rctx,{colorTarget:2,width:this._cubeMapSize,height:this._cubeMapSize},e)}return this._frameBufferCube}get cubeMap(){return this._frameBufferCube}resetRenderFlags(){this._didRenderFaces=!1}remap(e,t,s,i,r){return i+(e-t)*(r-i)/(s-t)}get running(){return!this._didRenderFaces}runTask(e){if(0===this.coverage||n(this._vao))return void(this._didRenderFaces=!0);const t=this.rctx.getViewport();this.rctx.setViewport(0,0,this._cubeMapSize,this._cubeMapSize),this.rctx.bindFramebuffer(this.frameBufferCube,!1,34069);const s=this._getTechnique(this._raymarchingStepType),i=s.program;this.rctx.useProgram(i),i.bindTexture(this.noiseTextureAtlas.textureAtlas,"cloudShapeTexture"),i.setUniform1f("cloudRadius",this._cloudRadius),i.setUniform1f("halfCubeMapSize",.5*this._cubeMapSize),i.setUniform1f("power",this._power),i.setUniform1f("sigmaE",this._sigmaE),i.setUniform1f("density",this._density),i.setUniform1f("cloudSize",this._cloudSize),i.setUniform1f("detailSize",this._detailSize),i.setUniform1f("smoothness",this._smoothness),i.setUniform1f("cloudHeight",this._cloudHeight),i.setUniform1f("coverage",this._coverage),this.rctx.bindVAO(this._vao),i.assertCompatibleVertexAttributeLocations(this._vao),s.bindPipelineState(this.rctx);for(let r=0;r<5;r++){const e=z[r],t=R[r];p(this._viewMatrix,this._eye,e,t),m(this._viewMat3,this._viewMatrix),i.setUniformMatrix3fv("viewMatrix",this._viewMat3);const s=34069+r;this.frameBufferCube.framebufferTexture2D(this.frameBufferCube.colorAttachment.glName,this.rctx.gl,36064,s),this.rctx.gl.drawArrays(this.rctx.gl.TRIANGLE_STRIP,0,4),this.rctx.gl.flush()}this._didRenderFaces=!0,this.rctx.setViewport(t.x,t.y,t.width,t.height),e.madeProgress(),this.requestRender()}get test(){return{coverage:this._coverage,density:this.remap(this._density,0,.3,0,1),absorption:this._sigmaE-1,cloudSize:1-this.remap(this._cloudSize,0,.02,0,1),detailSize:1-this.remap(this._detailSize,0,.2,0,1),smoothness:1-this.remap(this._smoothness,0,.5,0,1),cloudHeight:this.remap(this._cloudHeight,0,1500,0,1)}}};e([c({constructOnly:!0})],T.prototype,"rctx",void 0),e([c({constructOnly:!0})],T.prototype,"view",void 0),e([c({constructOnly:!0})],T.prototype,"requestRender",void 0),e([c()],T.prototype,"_frameTask",void 0),e([c()],T.prototype,"_didRenderFaces",void 0),e([c({readOnly:!0})],T.prototype,"running",null),T=e([u("esri.views.3d.environment.CloudsGenerator")],T);const z=[f(1,0,0),f(-1,0,0),f(0,1,0),f(0,-1,0),f(0,0,1)],R=[f(0,1,0),f(0,1,0),f(0,0,-1),f(0,0,1),f(0,1,0)];class M{constructor(e,t,s,i,r,o,h,a,n=.5){this.coverage=e,this.density=t,this.absorption=s,this.cloudSize=i,this.detailSize=r,this.smoothness=o,this.cloudHeight=h,this.raymarchingStepType=a,this.median=n}}const j={sunny:new M([.1,.7],[.02,.02],[0,0],[.86,.86],[.8,.8],[.5,.5],[.05,.05],0),cloudy:new M([.24,.7],[.135,.2],[0,0],[.5,.5],[.65,.7],[.3,.3],[1,1],2),rainy:new M([.5,.9],[.2,.5],[.3,.6],[.4,.4],[.7,.7],[.5,.5],[1,1],2),foggy:new M([.8,.8],[.5,.5],[0,0],[.85,.85],[.75,.75],[.8,.8],[.3,.3],1)};export{T as CloudsGenerator,j as cloudPresets};
5
+ import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../core/Accessor.js";import s from"../../../core/has.js";import{lerp as i}from"../../../core/mathUtils.js";import{removeMaybe as r,releaseMaybe as o,disposeMaybe as h,destroyMaybe as a,isNone as n}from"../../../core/maybe.js";import{property as c}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/arrayUtils.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as u}from"../../../core/accessorSupport/decorators/subclass.js";import{f as m}from"../../../chunks/mat3.js";import{c as d}from"../../../chunks/mat3f64.js";import{q as p}from"../../../chunks/mat4.js";import{c as f}from"../../../chunks/mat4f64.js";import{f as l,z as _}from"../../../chunks/vec3f32.js";import{getReferenceEllipsoid as g}from"../../../geometry/projectionEllipsoid.js";import{CloudsTechniqueConfiguration as y,CloudsTechnique as b}from"./CloudsTechnique.js";import{NoiseTextureAtlas as v}from"./NoiseTextureAtlas.js";import{createQuadVAO as S}from"../webgl-engine/lib/glUtil3D.js";import{TaskPriority as x}from"../../support/Scheduler.js";import w from"../../webgl/FramebufferObject.js";let T=class extends t{constructor(e){super(e),this._frameTask=null,this._techniques=[],this._techniqueConfiguration=new y,this._cubeMapSize=s("esri-mobile")?1024:2048,this._viewMat3=d(),this._eye=_(),this._didRenderFaces=!1,this._raymarchingStepType=0,this._cloudRadius=0,this._viewMatrix=f();const t=j.sunny;this.coverage=i(t.coverage[1],t.coverage[0],.5),this.density=i(t.density[1],t.density[0],.5),this.absorption=i(t.absorption[1],t.absorption[0],.5),this.cloudSize=i(t.cloudSize[1],t.cloudSize[0],.5),this.detailSize=i(t.detailSize[1],t.detailSize[0],.5),this.smoothness=i(t.smoothness[1],t.smoothness[0],.5),this.cloudHeight=i(t.cloudHeight[1],t.cloudHeight[0],.5),this.raymarchingStepType=t.raymarchingStepType}_getTechnique(e){const t=this._techniques[e];return t||(this._techniqueConfiguration.steps=e,this._techniques[e]=new b({rctx:this.rctx,viewingMode:this.view.state.viewingMode},this._techniqueConfiguration),this._techniques[e])}initialize(){this._vao=S(this.rctx);const e=g(this.view.spatialReference);this._cloudRadius=.5*e.radius,this.resetRenderFlags(),this._frameTask=this.view.resourceController.scheduler.registerTask(x.CLOUDS_GENERATOR,this)}destroy(){this._frameTask=r(this._frameTask),this._techniques.forEach((e=>o(e))),this._techniques=null,this._frameBufferCube=h(this._frameBufferCube),this._vao=h(this._vao),this._noiseTexture=a(this._noiseTexture)}set coverage(e){this._coverage=e,this.resetRenderFlags()}get coverage(){return this._coverage}set density(e){this._density=this.remap(e,0,1,0,.3),this.resetRenderFlags()}set cloudSize(e){this._cloudSize=this.remap(Math.max(.01,1-e),0,1,0,.02),this.resetRenderFlags()}set detailSize(e){this._detailSize=this.remap(Math.max(.01,1-e),0,1,0,.2),this.resetRenderFlags()}set smoothness(e){this._smoothness=this.remap(1-e,0,1,0,.5),this.resetRenderFlags()}set absorption(e){this._sigmaE=1+e,this._power=this.remap(e,0,1,35,120),this.resetRenderFlags()}get absorption(){return this._sigmaE-1}set cloudHeight(e){this._cloudHeight=this.remap(e,0,1,0,1500),this.resetRenderFlags()}get cloudHeight(){return this._cloudHeight}set raymarchingStepType(e){this._raymarchingStepType=e,this.resetRenderFlags()}_ensureNoiseTexture(){return n(this._noiseTexture)&&(this._noiseTexture=new v(this.rctx,this.view),this._noiseTexture.render(this.rctx)),this._noiseTexture}get frameBufferCube(){if(n(this._frameBufferCube)){const e={target:34067,pixelFormat:6408,dataType:5121,wrapMode:33071,samplingMode:9729,hasMipmap:!1,width:this._cubeMapSize,height:this._cubeMapSize};this._frameBufferCube=new w(this.rctx,{colorTarget:2,width:this._cubeMapSize,height:this._cubeMapSize},e)}return this._frameBufferCube}get cubeMap(){return this._frameBufferCube}resetRenderFlags(){this._didRenderFaces=!1}remap(e,t,s,i,r){return i+(e-t)*(r-i)/(s-t)}get running(){return!this._didRenderFaces}runTask(e){if(0===this.coverage||n(this._vao))return void(this._didRenderFaces=!0);const t=this._ensureNoiseTexture().textureAtlas;if(n(t))return void(this._didRenderFaces=!0);const s=this.rctx.getViewport();this.rctx.setViewport(0,0,this._cubeMapSize,this._cubeMapSize),this.rctx.bindFramebuffer(this.frameBufferCube,!1,34069);const i=this._getTechnique(this._raymarchingStepType),r=i.program;this.rctx.useProgram(r),r.bindTexture(t,"cloudShapeTexture"),r.setUniform1f("cloudRadius",this._cloudRadius),r.setUniform1f("halfCubeMapSize",.5*this._cubeMapSize),r.setUniform1f("power",this._power),r.setUniform1f("sigmaE",this._sigmaE),r.setUniform1f("density",this._density),r.setUniform1f("cloudSize",this._cloudSize),r.setUniform1f("detailSize",this._detailSize),r.setUniform1f("smoothness",this._smoothness),r.setUniform1f("cloudHeight",this._cloudHeight),r.setUniform1f("coverage",this._coverage),this.rctx.bindVAO(this._vao),r.assertCompatibleVertexAttributeLocations(this._vao),i.bindPipelineState(this.rctx);for(let o=0;o<5;o++){const e=z[o],t=R[o];p(this._viewMatrix,this._eye,e,t),m(this._viewMat3,this._viewMatrix),r.setUniformMatrix3fv("viewMatrix",this._viewMat3);const s=34069+o;this.frameBufferCube.framebufferTexture2D(this.frameBufferCube.colorAttachment.glName,this.rctx.gl,36064,s),this.rctx.gl.drawArrays(this.rctx.gl.TRIANGLE_STRIP,0,4),this.rctx.gl.flush()}this.rctx.setViewport(s.x,s.y,s.width,s.height),this.requestRender(),this._didRenderFaces=!0,e.madeProgress()}get test(){return{coverage:this._coverage,density:this.remap(this._density,0,.3,0,1),absorption:this._sigmaE-1,cloudSize:1-this.remap(this._cloudSize,0,.02,0,1),detailSize:1-this.remap(this._detailSize,0,.2,0,1),smoothness:1-this.remap(this._smoothness,0,.5,0,1),cloudHeight:this.remap(this._cloudHeight,0,1500,0,1)}}};e([c({constructOnly:!0})],T.prototype,"rctx",void 0),e([c({constructOnly:!0})],T.prototype,"view",void 0),e([c({constructOnly:!0})],T.prototype,"requestRender",void 0),e([c()],T.prototype,"_frameTask",void 0),e([c()],T.prototype,"_didRenderFaces",void 0),e([c({readOnly:!0})],T.prototype,"running",null),T=e([u("esri.views.3d.environment.CloudsGenerator")],T);const z=[l(1,0,0),l(-1,0,0),l(0,1,0),l(0,-1,0),l(0,0,1)],R=[l(0,1,0),l(0,1,0),l(0,0,-1),l(0,0,1),l(0,1,0)];class M{constructor(e,t,s,i,r,o,h,a,n=.5){this.coverage=e,this.density=t,this.absorption=s,this.cloudSize=i,this.detailSize=r,this.smoothness=o,this.cloudHeight=h,this.raymarchingStepType=a,this.median=n}}const j={sunny:new M([.1,.7],[.02,.02],[0,0],[.86,.86],[.8,.8],[.5,.5],[.05,.05],0),cloudy:new M([.24,.7],[.135,.2],[0,0],[.5,.5],[.65,.7],[.3,.3],[1,1],2),rainy:new M([.5,.9],[.2,.5],[.3,.6],[.4,.4],[.7,.7],[.5,.5],[1,1],2),foggy:new M([.8,.8],[.5,.5],[0,0],[.85,.85],[.75,.75],[.8,.8],[.3,.3],1)};export{T as CloudsGenerator,j as cloudPresets};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.22/esri/copyright.txt for details.
4
4
  */
5
- import{releaseMaybe as e,disposeMaybe as t,isNone as i}from"../../../core/maybe.js";import"../../webgl/BufferObject.js";import r from"../../webgl/FramebufferObject.js";import"../../../core/has.js";import"../../webgl/checkWebGLError.js";import"../../webgl/enums.js";import"../../../chunks/builtins.js";import s from"../../webgl/Texture.js";import"../../webgl/VertexArrayObject.js";import{NoiseTextureAtlasTechnique as o}from"./NoiseTextureAtlasTechnique.js";import{createQuadVAO as h}from"../webgl-engine/lib/glUtil3D.js";class a{constructor(e,t){this._shapeTextureDescriptor={target:3553,pixelFormat:6408,dataType:5121,wrapMode:33071,samplingMode:9729,hasMipmap:!1,width:1,height:1},this._tileSize=1,this._tileRows=1,this._frameBuffer=new r(e,{colorTarget:0}),this._vao=h(e),this.textureAtlas=new s(e,this._shapeTextureDescriptor,null),this._technique=new o({rctx:e,viewingMode:t.state.viewingMode},null)}destroy(){this._technique=e(this._technique),this._frameBuffer=t(this._frameBuffer),this._vao=t(this._vao),this.textureAtlas=t(this.textureAtlas)}render(e,t){if(i(this._vao)||i(this.textureAtlas))return!1;this._tileSize=e,this._tileRows=Math.ceil(Math.sqrt(this._tileSize));const r=(e+2)*this._tileRows;this._frameBuffer.resize(r,r),this.textureAtlas.resize(r,r),this._frameBuffer.attachColorTexture(this.textureAtlas),t.bindFramebuffer(this._frameBuffer);const s=this._technique.program;t.bindVAO(this._vao),s.assertCompatibleVertexAttributeLocations(this._vao),this._technique.bindPipelineState(t),t.useProgram(s),s.setUniform1f("tileSize",this._tileSize),s.setUniform1f("tileRows",this._tileRows);const o=t.getViewport();return t.setViewport(0,0,r,r),t.gl.drawArrays(t.gl.TRIANGLE_STRIP,0,4),this._frameBuffer.detachColorTexture(),t.setViewport(o.x,o.y,o.width,o.height),!0}}export{a as NoiseTextureAtlas};
5
+ import e from"../../../core/has.js";import{releaseMaybe as t,disposeMaybe as r,isNone as i}from"../../../core/maybe.js";import"../../webgl/BufferObject.js";import s from"../../webgl/FramebufferObject.js";import"../../webgl/checkWebGLError.js";import"../../webgl/enums.js";import"../../../chunks/builtins.js";import o from"../../webgl/Texture.js";import"../../webgl/VertexArrayObject.js";import{NoiseTextureAtlasTechnique as a}from"./NoiseTextureAtlasTechnique.js";import{createQuadVAO as h}from"../webgl-engine/lib/glUtil3D.js";const f=e("esri-mobile")?64:128,u=Math.ceil(Math.sqrt(f)),m=(f+2)*u;class l{constructor(e,t){this._shapeTextureDescriptor={target:3553,pixelFormat:6408,dataType:5121,wrapMode:33071,samplingMode:9729,hasMipmap:!1,width:1,height:1},this._frameBuffer=new s(e,{colorTarget:0}),this._vao=h(e),this.textureAtlas=new o(e,this._shapeTextureDescriptor,null),this._technique=new a({rctx:e,viewingMode:t.state.viewingMode},null)}destroy(){this._technique=t(this._technique),this._frameBuffer=r(this._frameBuffer),this._vao=r(this._vao),this.textureAtlas=r(this.textureAtlas)}render(e){if(i(this._vao)||i(this.textureAtlas))return!1;this._frameBuffer.resize(m,m),this.textureAtlas.resize(m,m),this._frameBuffer.attachColorTexture(this.textureAtlas),e.bindFramebuffer(this._frameBuffer);const t=this._technique.program;e.bindVAO(this._vao),t.assertCompatibleVertexAttributeLocations(this._vao),this._technique.bindPipelineState(e),e.useProgram(t),t.setUniform1f("tileSize",f),t.setUniform1f("tileRows",u);const r=e.getViewport();return e.setViewport(0,0,m,m),e.gl.drawArrays(e.gl.TRIANGLE_STRIP,0,4),this._frameBuffer.detachColorTexture(),e.setViewport(r.x,r.y,r.width,r.height),!0}}export{m as ATLAS_SIZE,l as NoiseTextureAtlas,u as TILE_ROWS,f as TILE_SIZE};
package/views/MapView.js CHANGED
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.22/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../chunks/tslib.es6.js";import t from"../Graphic.js";import i from"../core/Collection.js";import r from"../core/CollectionFlattener.js";import s from"../core/Error.js";import a from"../core/has.js";import{isIterable as n}from"../core/iteratorUtils.js";import o from"../core/Logger.js";import{isSome as h}from"../core/maybe.js";import{init as l}from"../core/watchUtils.js";import{initialize as p}from"../core/workers/workers.js";import{property as d}from"../core/accessorSupport/decorators/property.js";import"../core/arrayUtils.js";import"../core/accessorSupport/ensureType.js";import{subclass as c}from"../core/accessorSupport/decorators/subclass.js";import{BreakpointsOwner as u}from"./BreakpointsOwner.js";import{DOMContainer as g}from"./DOMContainer.js";import m from"./MapViewBase.js";import w from"./2d/input/MapViewInputManager.js";import f from"./2d/support/HighlightOptions.js";import y from"./support/createScreenshotPlan.js";import{getMaximumResolutionScale as v,getFormatAndQuality as V}from"./support/screenshotUtils.js";import{isSupportedScreenPointEvent as b,createScreenPointFromSupportedEvent as _}from"./support/screenUtils.js";import{check as M}from"./support/WebGLRequirements.js";import j from"./ui/2d/DefaultUI2D.js";import L from"../webmap/background/ColorBackground.js";const O=o.getLogger("esri.views.MapView");let S,C,k,E,x,N;async function W(){const[,{GraphicsView2D:e,GraphicContainer:t,LabelManager:i,MapViewNavigation:r,MagnifierView2D:s,Stage:a}]=await Promise.all([import("./webgl.js"),import("./2d/mapViewDeps.js")]);C=e,k=t,E=i,x=r,N=s,S=a}let P=class extends(u(g(m))){constructor(e){super(e),this._magnifierView=null,this._stage=null,this._resolveWhenReady=[],this.rootLayerViews=new r({getCollections:()=>{var e,t;return[null==(e=this.basemapView)?void 0:e.baseLayerViews,this.layerViews,null==(t=this.basemapView)?void 0:t.referenceLayerViews]},getChildrenFunction:()=>null}),this.floors=new i,this.graphicsView=null,this.highlightOptions=new f,this.inputManager=new w({view:this}),this.mapViewNavigation=null,this.supersampleScreenshotsEnabled=!1,this.ui=new j,this.rendering=!1,p()}destroy(){this.rootLayerViews.destroy(),this.inputManager.destroy(),this._set("inputManager",null)}get background(){return this.get("map.initialViewProperties.background")||null}set background(e){void 0===e?this._clearOverride("background"):this._override("background",e)}get textureManager(){return this._stage.painter.textureManager}get navigating(){return!(!this.mapViewNavigation||!this.mapViewNavigation.interacting)}toMap(e){if(b(e)){const t=_(this,e);return super.toMap(t)}return super.toMap(e)}async hitTest(e,t){const i=b(e)?_(this,e):e;if(!this.ready||isNaN(i.x)||isNaN(i.y))return{screenPoint:i,results:[]};let r=new Set,s=!1,a=null,n=null;null!=t&&t.include?q(t.include,U(this,(e=>r.add(e)),(e=>{a||(a=new Set),a.add(e)}),(e=>r.add(e)),(()=>s=!0))):(s=!0,r=new Set(this.allLayerViews)),null!=t&&t.exclude&&q(t.exclude,U(this,(e=>r.delete(e)),(e=>{n||(n=new Set),n.add(e)})));const o=this.allLayerViews.filter((e=>!e.suspended&&r.has(e))).reverse(),l=this.toMap(i);let p=(await Promise.all([s?this.graphicsView.hitTest(l):null,...o.map((e=>e.hitTest(l,i)))])).filter(h).flat();return a&&(p=p.filter((e=>a.has(G(e))))),n&&(p=p.filter((e=>!n.has(G(e))))),{screenPoint:i,results:p.map((e=>({mapPoint:l,graphic:e})))}}takeScreenshot(e){e=e||{};const t=this.supersampleScreenshotsEnabled?Math.min(4,v(this.size,Math.min(4096,this._stage.context.parameters.maxTextureSize))):1;let i;e.layers?(i=[],e.layers.forEach((e=>{const t=this.allLayerViews.find((t=>t.layer.id===e.id));t&&"container"in t&&t.container&&i.push(t.container)}))):i=this._stage.children;const{format:r,quality:s}=V(e.format,e.quality),a=y(e,t,this.size,this.padding,r,s,i,e.rotation);return this._stage.takeScreenshot(a)}on(e,t,i,r){const s=this.inputManager&&this.viewEvents.on(e,t,i,r);return s||super.on(e,t)}hasEventListener(e){return super.hasEventListener(e)||this.viewEvents.hasHandler(e)}whenLayerView(e){return super.whenLayerView(e)}graphicChanged(e){if(this.graphicsView){this.graphicsView.graphicUpdateHandler(e)}}whenReady(){return new Promise((e=>{this.ready?e(this):this._resolveWhenReady.push(e)}))}forceDOMReadyCycle(){this.forceReadyCycle()}validate(){let e=M({checkMajorWebPerformanceCaveat:!1});return a("safari")&&a("safari")<9&&(e=new s("mapview:browser-not-supported","This browser is not supported by MapView (Safari < 9)",{type:"safari",requiredVersion:9,detectedVersion:a("safari")})),h(e)?(O.warn("#validate()",e.message),Promise.reject(e)):W()}_startup(){this.timeline.begin("MapView Startup"),super._startup(),this.graphics.owner=this;const e={disabledExtensions:this.deactivatedWebGLExtensions,debugWebGLExtensions:this.debugWebGLExtensions},t=new S(this.surface,{canvas:this.renderCanvas,supersampleScreenshots:this.supersampleScreenshotsEnabled,contextOptions:e,renderingOptions:this.renderingOptions,timeline:this.timeline}),i=new C({view:this,graphics:this.graphics,requestUpdateCallback:()=>this.requestUpdate(),container:new k(this.featuresTilingScheme)}),r=new x({view:this,animationManager:this.animationManager}),s=new E({view:this});this._magnifierView=new N,this._magnifierView.magnifier=this.magnifier,this._stage=t,this.frameTask.graphicsView=i,this._set("graphicsView",i),this._set("mapViewNavigation",r),this._set("labelManager",s),this.handles.add([this.rootLayerViews.on("change",(()=>this._updateStageChildren())),t.on("post-render",(()=>this._set("rendering",t.renderRequested))),t.on("will-render",(()=>this._set("rendering",t.renderRequested))),t.on("webgl-error",(e=>this.fatalError=e.error)),l(this,"stationary",(e=>t.stationary=e),!0),l(this,"state.id",(()=>t.state=this.state),!0),l(this,"background",(e=>{t.background=e,this._magnifierView.background=e}),!0),l(this,"magnifier",(e=>this._magnifierView.magnifier=e),!0),l(this,"renderingOptions",(e=>t.renderingOptions=e),!0),l(this,"highlightOptions",(()=>t.highlightOptions=this.highlightOptions),!0)],"map-view"),t.state=this.state,this._updateStageChildren();const a=this._resolveWhenReady;this._resolveWhenReady=[],a.forEach((e=>e(this))),this.timeline.end("MapView Startup")}_teardown(){this.handles.remove("map-view"),this.layerViewManager.clear(),this.labelManager.destroy(),this._magnifierView.destroy(),this._stage.destroy();this.graphicsView.destroy(),this.mapViewNavigation.destroy(),this._stage=null,this._set("graphicsView",null),this._magnifierView=null,this._set("labelManager",null),this._set("mapViewNavigation",null),this.graphics.owner=null,super._teardown()}_updateStageChildren(){this._stage.removeAllChildren(),this.rootLayerViews.forEach((e=>{this._stage.addChild(e.container)}));const e=this.graphicsView;this._stage.addChild(e.container),this._stage.addChild(this._magnifierView)}};e([d({type:L})],P.prototype,"background",null),e([d()],P.prototype,"floors",void 0),e([d()],P.prototype,"graphicsView",void 0),e([d({type:f})],P.prototype,"highlightOptions",void 0),e([d({readOnly:!0})],P.prototype,"inputManager",void 0),e([d({readOnly:!0})],P.prototype,"textureManager",null),e([d({readOnly:!0})],P.prototype,"mapViewNavigation",void 0),e([d({type:Boolean})],P.prototype,"navigating",null),e([d({type:Boolean,constructOnly:!0})],P.prototype,"supersampleScreenshotsEnabled",void 0),e([d({type:j})],P.prototype,"ui",void 0),e([d({readOnly:!0})],P.prototype,"rendering",void 0),e([d({constructOnly:!0})],P.prototype,"renderCanvas",void 0),e([d({constructOnly:!0})],P.prototype,"deactivatedWebGLExtensions",void 0),e([d({constructOnly:!0})],P.prototype,"debugWebGLExtensions",void 0),P=e([c("esri.views.MapView")],P);const R=P;function G(e){const t=e.getObjectId();var i,r,s,a;return t?`${null!=(i=null!=(r=null==(s=e.layer)?void 0:s.uid)?r:null==(a=e.sourceLayer)?void 0:a.uid)?i:"MapView"}/${t}`:`"MapView/${e.uid}`}function U(e,i,r,s,a){return n=>{if(n instanceof t){if(n.layer===e)null==a||a();else{const t=e.allLayerViews.find((e=>e.layer===n.layer));t&&(null==s||s(t))}r(G(n))}else{const t=e.allLayerViews.find((e=>e.layer===n));t&&i(t)}}}function q(e,t){if(e)if(n(e))for(const i of e)if(n(i))for(const e of i)t(e);else t(i);else t(e)}export{R as default};
5
+ import{_ as e}from"../chunks/tslib.es6.js";import t from"../Graphic.js";import i from"../core/Collection.js";import r from"../core/CollectionFlattener.js";import s from"../core/Error.js";import a from"../core/has.js";import{isIterable as n}from"../core/iteratorUtils.js";import o from"../core/Logger.js";import{isSome as h}from"../core/maybe.js";import{init as l}from"../core/watchUtils.js";import{initialize as p}from"../core/workers/workers.js";import{property as d}from"../core/accessorSupport/decorators/property.js";import"../core/arrayUtils.js";import"../core/accessorSupport/ensureType.js";import{subclass as c}from"../core/accessorSupport/decorators/subclass.js";import{BreakpointsOwner as u}from"./BreakpointsOwner.js";import{DOMContainer as g}from"./DOMContainer.js";import m from"./MapViewBase.js";import w from"./2d/input/MapViewInputManager.js";import y from"./2d/support/HighlightOptions.js";import f from"./support/createScreenshotPlan.js";import{getMaximumResolutionScale as v,getFormatAndQuality as V}from"./support/screenshotUtils.js";import{isSupportedScreenPointEvent as b,createScreenPointFromSupportedEvent as _}from"./support/screenUtils.js";import{check as M}from"./support/WebGLRequirements.js";import j from"./ui/2d/DefaultUI2D.js";import L from"../webmap/background/ColorBackground.js";const O=o.getLogger("esri.views.MapView");let S,C,k,E,x,N;async function W(){const[,{GraphicsView2D:e,GraphicContainer:t,LabelManager:i,MapViewNavigation:r,MagnifierView2D:s,Stage:a}]=await Promise.all([import("./webgl.js"),import("./2d/mapViewDeps.js")]);C=e,k=t,E=i,x=r,N=s,S=a}let P=class extends(u(g(m))){constructor(e){super(e),this._magnifierView=null,this._stage=null,this._resolveWhenReady=[],this.rootLayerViews=new r({getCollections:()=>{var e,t;return[null==(e=this.basemapView)?void 0:e.baseLayerViews,this.layerViews,null==(t=this.basemapView)?void 0:t.referenceLayerViews]},getChildrenFunction:()=>null}),this.floors=new i,this.graphicsView=null,this.highlightOptions=new y,this.inputManager=new w({view:this}),this.mapViewNavigation=null,this.supersampleScreenshotsEnabled=!1,this.ui=new j,this.rendering=!1,p()}destroy(){this.rootLayerViews.destroy(),this.inputManager.destroy(),this._set("inputManager",null)}get background(){return this.get("map.initialViewProperties.background")||null}set background(e){void 0===e?this._clearOverride("background"):this._override("background",e)}get resourceManager(){return this._stage.resourceManager}get textureManager(){return this._stage.painter.textureManager}get navigating(){return!(!this.mapViewNavigation||!this.mapViewNavigation.interacting)}toMap(e){if(b(e)){const t=_(this,e);return super.toMap(t)}return super.toMap(e)}async hitTest(e,t){const i=b(e)?_(this,e):e;if(!this.ready||isNaN(i.x)||isNaN(i.y))return{screenPoint:i,results:[]};let r=new Set,s=!1,a=null,n=null;null!=t&&t.include?q(t.include,U(this,(e=>r.add(e)),(e=>{a||(a=new Set),a.add(e)}),(e=>r.add(e)),(()=>s=!0))):(s=!0,r=new Set(this.allLayerViews)),null!=t&&t.exclude&&q(t.exclude,U(this,(e=>r.delete(e)),(e=>{n||(n=new Set),n.add(e)})));const o=this.allLayerViews.filter((e=>!e.suspended&&r.has(e))).reverse(),l=this.toMap(i);let p=(await Promise.all([s?this.graphicsView.hitTest(l):null,...o.map((e=>e.hitTest(l,i)))])).filter(h).flat();return a&&(p=p.filter((e=>a.has(G(e))))),n&&(p=p.filter((e=>!n.has(G(e))))),{screenPoint:i,results:p.map((e=>({mapPoint:l,graphic:e})))}}takeScreenshot(e){e=e||{};const t=this.supersampleScreenshotsEnabled?Math.min(4,v(this.size,Math.min(4096,this._stage.context.parameters.maxTextureSize))):1;let i;e.layers?(i=[],e.layers.forEach((e=>{const t=this.allLayerViews.find((t=>t.layer.id===e.id));t&&"container"in t&&t.container&&i.push(t.container)}))):i=this._stage.children;const{format:r,quality:s}=V(e.format,e.quality),a=f(e,t,this.size,this.padding,r,s,i,e.rotation);return this._stage.takeScreenshot(a)}on(e,t,i,r){const s=this.inputManager&&this.viewEvents.on(e,t,i,r);return s||super.on(e,t)}hasEventListener(e){return super.hasEventListener(e)||this.viewEvents.hasHandler(e)}whenLayerView(e){return super.whenLayerView(e)}graphicChanged(e){if(this.graphicsView){this.graphicsView.graphicUpdateHandler(e)}}whenReady(){return new Promise((e=>{this.ready?e(this):this._resolveWhenReady.push(e)}))}forceDOMReadyCycle(){this.forceReadyCycle()}validate(){let e=M({checkMajorWebPerformanceCaveat:!1});return a("safari")&&a("safari")<9&&(e=new s("mapview:browser-not-supported","This browser is not supported by MapView (Safari < 9)",{type:"safari",requiredVersion:9,detectedVersion:a("safari")})),h(e)?(O.warn("#validate()",e.message),Promise.reject(e)):W()}_startup(){this.timeline.begin("MapView Startup"),super._startup(),this.graphics.owner=this;const e={disabledExtensions:this.deactivatedWebGLExtensions,debugWebGLExtensions:this.debugWebGLExtensions},t=new S(this.surface,{canvas:this.renderCanvas,supersampleScreenshots:this.supersampleScreenshotsEnabled,contextOptions:e,renderingOptions:this.renderingOptions,timeline:this.timeline}),i=new C({view:this,graphics:this.graphics,requestUpdateCallback:()=>this.requestUpdate(),container:new k(this.featuresTilingScheme)}),r=new x({view:this,animationManager:this.animationManager}),s=new E({view:this});this._magnifierView=new N,this._magnifierView.magnifier=this.magnifier,this._stage=t,this.frameTask.graphicsView=i,this._set("graphicsView",i),this._set("mapViewNavigation",r),this._set("labelManager",s),this.handles.add([this.rootLayerViews.on("change",(()=>this._updateStageChildren())),t.on("post-render",(()=>this._set("rendering",t.renderRequested))),t.on("will-render",(()=>this._set("rendering",t.renderRequested))),t.on("webgl-error",(e=>this.fatalError=e.error)),l(this,"stationary",(e=>t.stationary=e),!0),l(this,"state.id",(()=>t.state=this.state),!0),l(this,"background",(e=>{t.background=e,this._magnifierView.background=e}),!0),l(this,"magnifier",(e=>this._magnifierView.magnifier=e),!0),l(this,"renderingOptions",(e=>t.renderingOptions=e),!0),l(this,"highlightOptions",(()=>t.highlightOptions=this.highlightOptions),!0)],"map-view"),t.state=this.state,this._updateStageChildren();const a=this._resolveWhenReady;this._resolveWhenReady=[],a.forEach((e=>e(this))),this.timeline.end("MapView Startup")}_teardown(){this.handles.remove("map-view"),this.layerViewManager.clear(),this.labelManager.destroy(),this._magnifierView.destroy(),this._stage.destroy();this.graphicsView.destroy(),this.mapViewNavigation.destroy(),this._stage=null,this._set("graphicsView",null),this._magnifierView=null,this._set("labelManager",null),this._set("mapViewNavigation",null),this.graphics.owner=null,super._teardown()}_updateStageChildren(){this._stage.removeAllChildren(),this.rootLayerViews.forEach((e=>{this._stage.addChild(e.container)}));const e=this.graphicsView;this._stage.addChild(e.container),this._stage.addChild(this._magnifierView)}};e([d({type:L})],P.prototype,"background",null),e([d()],P.prototype,"floors",void 0),e([d()],P.prototype,"graphicsView",void 0),e([d({type:y})],P.prototype,"highlightOptions",void 0),e([d({readOnly:!0})],P.prototype,"inputManager",void 0),e([d({readOnly:!0})],P.prototype,"resourceManager",null),e([d({readOnly:!0})],P.prototype,"textureManager",null),e([d({readOnly:!0})],P.prototype,"mapViewNavigation",void 0),e([d({type:Boolean})],P.prototype,"navigating",null),e([d({type:Boolean,constructOnly:!0})],P.prototype,"supersampleScreenshotsEnabled",void 0),e([d({type:j})],P.prototype,"ui",void 0),e([d({readOnly:!0})],P.prototype,"rendering",void 0),e([d({constructOnly:!0})],P.prototype,"renderCanvas",void 0),e([d({constructOnly:!0})],P.prototype,"deactivatedWebGLExtensions",void 0),e([d({constructOnly:!0})],P.prototype,"debugWebGLExtensions",void 0),P=e([c("esri.views.MapView")],P);const R=P;function G(e){const t=e.getObjectId();var i,r,s,a;return t?`${null!=(i=null!=(r=null==(s=e.layer)?void 0:s.uid)?r:null==(a=e.sourceLayer)?void 0:a.uid)?i:"MapView"}/${t}`:`"MapView/${e.uid}`}function U(e,i,r,s,a){return n=>{if(n instanceof t){if(n.layer===e)null==a||a();else{const t=e.allLayerViews.find((e=>e.layer===n.layer));t&&(null==s||s(t))}r(G(n))}else{const t=e.allLayerViews.find((e=>e.layer===n));t&&i(t)}}}function q(e,t){if(e)if(n(e))for(const i of e)if(n(i))for(const e of i)t(e);else t(i);else t(e)}export{R 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.22/esri/copyright.txt for details.
4
4
  */
5
- import{_ as t}from"../chunks/tslib.es6.js";import"../geometry.js";import e from"../Viewpoint.js";import i from"../core/Error.js";import s from"../core/Logger.js";import{isSome as n,isNone as a}from"../core/maybe.js";import{throwIfAborted as r}from"../core/promiseUtils.js";import{createScreenPoint as o}from"../core/screenUtils.js";import{whenTrueOnce as l}from"../core/watchUtils.js";import{property as p}from"../core/accessorSupport/decorators/property.js";import"../core/arrayUtils.js";import"../core/has.js";import"../core/accessorSupport/ensureType.js";import{subclass as h}from"../core/accessorSupport/decorators/subclass.js";import{canProject as d,project as m}from"../geometry/support/webMercatorUtils.js";import u from"../layers/support/TileInfo.js";import{PopupView as c}from"./PopupView.js";import g from"./View.js";import y from"./ViewAnimation.js";import f from"./2d/AnimationManager.js";import w from"./2d/FrameTask.js";import{layerView2DImporter as _}from"./2d/layerViewModuleImportUtils.js";import v from"./2d/MapViewConstraints.js";import T from"./2d/PaddedViewState.js";import"./2d/tiling/PagedTileQueue.js";import z from"./2d/tiling/TileInfoView.js";import"./2d/tiling/TileKey.js";import"./2d/tiling/TileQueue.js";import"./2d/tiling/TileStrategy.js";import{centerAt as V,setExtent as S,rotateTo as x,scaleTo as R,copy as j,createAsync as b,resize as O,extentToScale as M}from"./2d/viewpointUtils.js";import I from"./2d/layers/features/support/TileStore.js";import{Timeline as k}from"./2d/support/Timeline.js";import P from"../geometry/Point.js";import G from"../geometry/Extent.js";import E from"../geometry/SpatialReference.js";const L=s.getLogger("esri.views.MapView");function N(t){return t&&"esri.Viewpoint"===t.declaredClass}const q=160;let A=class extends(c(g)){constructor(t){super(t),this._stationaryTimer=null,this.frameTask=new w(this),this.featuresTilingScheme=null,this.fullOpacity=1,this.graphicsView=null,this.initialExtent=null,this.map=null,this.labelManager=null,this.renderingOptions={samplingMode:"dynamic",edgeLabelsVisible:!0,labelsAnimationTime:125,labelCollisionsEnabled:!0},this.resizeAlign="center",this.supportsGround=!1,this.timeline=new k,this.type="2d",this.constraints=new v,this.padding={top:0,right:0,bottom:0,left:0};const e=this.handles,i=()=>this.notifyChange("updating");e.add([this.watch("viewpoint",(()=>{this._lastStationaryEventTimestamp=performance.now(),this._flipStationary(q)}),!0),this.on("resize",(t=>this._resizeHandler(t))),this.watch("animationManager.animation",(t=>{this.animation=t})),this.allLayerViews.on("change",(()=>{i(),e.remove("map-view-base-layerViewsUpdating"),e.add(this.allLayerViews.map((t=>t.watch("updating",i))),"map-view-base-layerViewsUpdating")}))],"map-view-base")}destroy(){this.destroyed||(this._set("preconditionsReady",!1),this._gotoTask=this.frameTask=null)}get _defaultsFromMapSettings(){return{required:{tileInfo:!0,heightModelInfo:!1,extent:!1}}}set animation(t){const e=this._get("animation");if(t===e)return;if(e&&e.stop(),!t||t.isFulfilled())return void this._set("animation",null);this._set("animation",t),this.frameTask.animationInProgress=!0;const i=()=>{t===this._get("animation")&&(this._set("animation",null),this.frameTask.requestFrame()),this.frameTask.animationInProgress=!1};t.when(i,i)}get center(){if(!this.ready)return this._get("center");const{center:t,spatialReference:e}=this.state.paddedViewState;return new P({x:t[0],y:t[1],spatialReference:e})}set center(t){if(null==t)return;if(!this._normalizeInput(t))return void L.error("#center",`incompatible spatialReference ${JSON.stringify(t.spatialReference)} with view's spatialReference ${JSON.stringify(this.spatialReference)}`);if(!this.ready)return this._set("center",t),void this.notifyChange("initialExtentRequired");const e=this.viewpoint;V(e,e,t),this.viewpoint=e}set constraints(t){const e=this._get("constraints");e&&(this.handles.remove("map-view-base-constraints"),e.destroy()),this._set("constraints",t),t&&(t.view=this,this.ready&&(this.state.viewpoint=t.fit(this.state.paddedViewState.viewpoint)),this.handles.add(t.on("update",(()=>{this.ready&&this.state&&(this.state.viewpoint=t.fit(this.state.paddedViewState.viewpoint))})),"map-view-base-constraints"))}get extent(){return this.ready?this.state.paddedViewState.extent.clone():this._get("extent")}set extent(t){if(null==t)return;const e=this._normalizeInput(t);if(!e)return void L.error("#center",`incompatible spatialReference ${JSON.stringify(t.spatialReference)} with view's spatialReference ${JSON.stringify(this.spatialReference)}`);if(!e.width||!e.height)return void L.error("#extent","invalid extent size");if(!this.ready)return this._set("extent",e),this._set("center",null),this._set("viewpoint",null),this._set("scale",0),this._set("zoom",-1),void this.notifyChange("initialExtentRequired");const i=this.viewpoint;S(i,i,e,this.size,{constraints:this.constraints}),this.viewpoint=i}get graphicsTileStore(){return new I(this.featuresTilingScheme)}get initialExtentRequired(){const t=this._normalizeInput(this.center),e=this._normalizeInput(this.viewpoint),i=this._normalizeInput(this.extent),{scale:s,constraints:a}=this;let r=this.zoom;return!this.get("map.initialViewProperties.viewpoint")&&(!i&&(a.effectiveLODs||(r=-1),(!t||0===s&&-1===r)&&(!e||!n(e.targetGeometry)||"extent"!==e.targetGeometry.type&&!e.scale)))}get padding(){return this.ready?this.state.padding:this._get("padding")}set padding(t){this.ready?(this.state.padding=t,this._set("padding",this.state.padding)):this._set("padding",t)}get resolution(){return this.state?this.state.resolution:0}get rotation(){return this.ready?this.state.rotation:this._get("rotation")}set rotation(t){if(isNaN(t))return;if(!this.ready)return void this._set("rotation",t);const e=this.viewpoint;x(e,e,t),this.viewpoint=e}get scale(){return this.ready?this.state.scale:this._get("scale")}set scale(t){if(!t||isNaN(t))return;if(!this.ready){this._set("scale",t),this._set("zoom",-1);const e=this._get("extent");return e&&(this._set("extent",null),this._set("center",e.center)),void this.notifyChange("initialExtentRequired")}const e=this.viewpoint;R(e,e,t),this.viewpoint=e}get stationary(){return!(this.animation||this.navigating||this._get("resizing")||this._stationaryTimer)}get updating(){return!this.destroyed&&(!0===this.get("layerViewManager.updating")||!0===this.get("labelManager.updating")||!0===this.get("graphicsView.updating")||this.allLayerViews.some((t=>!t.destroyed&&!("layerViews"in t)&&!0===t.updating)))}get viewpoint(){if(!this.ready)return this._get("viewpoint");const t=this.state.paddedViewState;return t&&t.viewpoint.clone()}set viewpoint(t){if(null==t)return;const i=this._normalizeInput(t);if(!i)return void(!t.scale||isNaN(t.scale)?L.error("#viewpoint",`invalid scale value of ${t.scale}`):a(t.targetGeometry)?L.error("#viewpoint","geometry not defined"):L.error("#viewpoint",`incompatible spatialReference ${JSON.stringify(t.targetGeometry.spatialReference)} with view's spatialReference ${JSON.stringify(this.spatialReference)}`));if(!this.ready)return this._set("viewpoint",i),this._set("extent",null),this._set("center",null),this._set("zoom",-1),this._set("scale",0),void this.notifyChange("initialExtentRequired");const s=new e({targetGeometry:new P,scale:0,rotation:0});j(s,i),this.constraints.constrain(s,this.state.paddedViewState.viewpoint),this.state.viewpoint=s,this.frameTask.requestFrame(),this._set("viewpoint",s)}get zoom(){return this.ready?this.constraints.scaleToZoom(this.scale):this._get("zoom")}set zoom(t){if(null==t)return;if(!this.ready){this.notifyChange("initialExtentRequired"),this._set("zoom",t),this._set("scale",0);const e=this._get("extent");e&&(this._set("extent",null),this._set("center",e.center))}if(!this.constraints.effectiveLODs)return;const e=this.viewpoint;R(e,e,this.constraints.zoomToScale(t)),this.viewpoint=e,this._set("zoom",this.constraints.scaleToZoom(this.scale))}goTo(t,e){if(t)return this.animation&&(this.animation=null),this._createAnimation(),l(this,"ready",e&&e.signal).then((()=>{const i={animate:!0,...e},s=b(t,this);return this.animation.update(s),this._gotoTask={},i.animate?this._gotoAnimated(s,i):this._gotoImmediate(s,i)}));L.error("#goTo()","target cannot be null or undefined")}hitTest(t){return Promise.reject("Should be implemented by subclasses")}popupHitTest(t){return this.hitTest(t).then((e=>({...e,mapPoint:this.toMap(t)})))}toMap(t){if(!this.ready)return null;const e=[0,0],[i,s]=this.state.toMap(e,[t.x,t.y]),n=this.spatialReference;return new P({x:i,y:s,spatialReference:n})}toScreen(t){if(!this.ready)return null;const e=this._normalizeInput(t),i=[e.x,e.y];return this.state.toScreen(i,i),o(i[0],i[1])}pixelSizeAt(){return this.ready?this.state.resolution:(L.error("#pixelSizeAt()","Map view cannot be used before it is ready"),null)}requestUpdate(){this.ready&&this.frameTask.requestUpdate()}getDefaultSpatialReference(){var t,e,i;return this.map&&"initialViewProperties"in this.map&&(null==(t=this.map)||null==(e=t.initialViewProperties)?void 0:e.spatialReference)||(null==(i=this.defaultsFromMap)?void 0:i.spatialReference)||null}getSpatialReferenceSupport({layer:t}){return t||this._get("ready")||null!==this._getDefaultViewpoint()?{}:null}importLayerView(t){return _.importLayerView(t)}hasLayerViewModule(t){return _.hasLayerViewModule(t)}_createAnimation(){return this.animation&&!this.animation.done||(this.animation=new y),this.animation}_cancellableGoTo(t,e,i){const s=()=>t===this._gotoTask,n=i.then((()=>{s()&&(this.animation=null)})).catch((t=>{throw s()&&(this.animation=null,e.done||(e.stop(),this.frameTask.animationInProgress=!1)),t})),a=new Promise((t=>t(n)));return e.when().catch((()=>{s()&&a.cancel&&a.cancel()})),a}_gotoImmediate(t,e){const s=this._gotoTask,n=this.animation,a=t.then((t=>{if(r(e),s!==this._gotoTask)throw new i("view:goto-interrupted","Goto was interrupted");this.viewpoint=n.target=t,n.finish()}));return this._cancellableGoTo(s,n,a)}_gotoAnimated(t,e){const s=this._gotoTask,n=this.animation,a=t.then((t=>{if(r(e),s!==this._gotoTask)throw new i("view:goto-interrupted","Goto was interrupted");return n.update(t),this.animationManager.animate(n,this.viewpoint,e),n.when().then((()=>{}),(()=>{}))}));return this._cancellableGoTo(s,n,a)}_resizeHandler(t){const e=this.state;if(!e)return;let i=this.state.paddedViewState.viewpoint;const s=this.state.paddedViewState.size.concat();e.size=[t.width,t.height],O(i,i,s,this.state.paddedViewState.size,this.resizeAlign),i=this.constraints.constrain(i,null),this.state.viewpoint=i}_startup(){const t=this._getDefaultViewpoint();this.constraints.view=this,this.constraints.fit(t),this._set("animationManager",new f({view:this})),this._set("state",new T({padding:this._get("padding"),size:this.size,viewpoint:t})),this._set("featuresTilingScheme",new z(u.create({spatialReference:this.spatialReference,size:512,numLODs:36}))),this._set("ready",!0),this.frameTask&&this.frameTask.start()}_teardown(){this.frameTask&&this.frameTask.stop(),this._set("ready",!1),this._stationaryTimer&&(clearTimeout(this._stationaryTimer),this._stationaryTimer=null);const{center:[t,e],spatialReference:i,rotation:s,scale:n}=this.state.paddedViewState,a=new P({x:t,y:e,spatialReference:i});this._set("viewpoint",null),this._set("extent",null),this._set("center",a),this._set("zoom",-1),this._set("rotation",s),this._set("scale",n),this._set("spatialReference",i),this.constraints.view=null,this.animationManager.destroy(),this._set("animationManager",null),this._set("state",null),this.animation=null}_flipStationary(t){return null!==this._stationaryTimer||(this._stationaryTimer=setTimeout((()=>{this._stationaryTimer=null;const t=performance.now()-this._lastStationaryEventTimestamp;t<q&&(this._stationaryTimer=this._flipStationary(t))}),t)),this._stationaryTimer}_normalizeInput(t,e=this.spatialReference){const i=t&&t.targetGeometry||t;return e?i?e.equals(i.spatialReference)?t:d(i,e)?N(t)?(t.targetGeometry=m(i,e),t):m(i,e):null:null:t}_getDefaultViewpoint(){const t=this.constraints,i={zoom:this._get("zoom"),scale:this._get("scale"),center:this._normalizeInput(this._get("center")),extent:this._normalizeInput(this._get("extent")),rotation:this._get("rotation"),viewpoint:this._normalizeInput(this._get("viewpoint")),spatialReference:this._userSpatialReference};t.effectiveLODs?-1!==i.zoom&&(i.scale=t.zoomToScale(i.zoom)):i.zoom=-1;let s=null,a=null,r=0;const o=i.viewpoint&&i.viewpoint.rotation,l=i.viewpoint&&i.viewpoint.targetGeometry;n(l)&&("extent"===l.type?s=l:"point"===l.type&&(a=l,r=i.viewpoint.scale));const p=this._normalizeInput(this.get("map.initialViewProperties.viewpoint.targetGeometry.extent")),h=this._normalizeInput(this.initialExtent),d=i.extent||s||p||h,m=i.center||a||d&&d.center,u=this.get("map.initialViewProperties.viewpoint.scale"),c=i.scale||r||u||d&&M(d,this.size),g=this.get("map.initialViewProperties.viewpoint.rotation"),y=i.rotation||o||g||0;return m&&c?new e({targetGeometry:m,scale:c,rotation:y}):null}};t([p()],A.prototype,"_stationaryTimer",void 0),t([p()],A.prototype,"_defaultsFromMapSettings",null),t([p()],A.prototype,"animation",null),t([p({readOnly:!0})],A.prototype,"animationManager",void 0),t([p({value:null,type:P,dependsOn:["state.id","ready"]})],A.prototype,"center",null),t([p({type:v})],A.prototype,"constraints",null),t([p({value:null,type:G,dependsOn:["state.id","ready"]})],A.prototype,"extent",null),t([p({readOnly:!0})],A.prototype,"featuresTilingScheme",void 0),t([p()],A.prototype,"fullOpacity",void 0),t([p({readOnly:!0})],A.prototype,"graphicsTileStore",null),t([p()],A.prototype,"graphicsView",void 0),t([p({type:G})],A.prototype,"initialExtent",void 0),t([p({dependsOn:["map.initialViewProperties?.viewpoint","constraints.effectiveLODs"]})],A.prototype,"initialExtentRequired",null),t([p()],A.prototype,"map",void 0),t([p()],A.prototype,"labelManager",void 0),t([p({value:{top:0,right:0,bottom:0,left:0},cast:t=>({top:0,right:0,bottom:0,left:0,...t})})],A.prototype,"padding",null),t([p({type:Object})],A.prototype,"renderingOptions",void 0),t([p()],A.prototype,"resizeAlign",void 0),t([p({readOnly:!0,dependsOn:["state.id"]})],A.prototype,"resolution",null),t([p({value:0,type:Number,dependsOn:["state.id","ready"]})],A.prototype,"rotation",null),t([p({value:0,type:Number,dependsOn:["state.id","ready"]})],A.prototype,"scale",null),t([p({type:E,dependsOn:["map.initialViewProperties?.spatialReference","defaultsFromMap.ready"]})],A.prototype,"spatialReference",void 0),t([p({readOnly:!0})],A.prototype,"state",void 0),t([p({dependsOn:["animation","navigating","resizing","_stationaryTimer"]})],A.prototype,"stationary",null),t([p({readOnly:!0})],A.prototype,"supportsGround",void 0),t([p({type:k,readOnly:!0})],A.prototype,"timeline",void 0),t([p({readOnly:!0})],A.prototype,"type",void 0),t([p({readOnly:!0,dependsOn:["layerViewManager.updating","labelManager.updating","graphicsView?.updating"]})],A.prototype,"updating",null),t([p({value:null,type:e,dependsOn:["state.id","ready"]})],A.prototype,"viewpoint",null),t([p({value:-1,dependsOn:["state.id"]})],A.prototype,"zoom",null),A=t([h("esri.views.MapViewBase")],A);const U=A;export{U as default};
5
+ import{_ as t}from"../chunks/tslib.es6.js";import"../geometry.js";import e from"../Viewpoint.js";import i from"../core/Error.js";import s from"../core/Logger.js";import{isSome as n,isNone as a}from"../core/maybe.js";import{throwIfAborted as r}from"../core/promiseUtils.js";import{createScreenPoint as o}from"../core/screenUtils.js";import{whenTrueOnce as l}from"../core/watchUtils.js";import{property as p}from"../core/accessorSupport/decorators/property.js";import"../core/arrayUtils.js";import"../core/has.js";import"../core/accessorSupport/ensureType.js";import{subclass as h}from"../core/accessorSupport/decorators/subclass.js";import{canProject as d,project as m}from"../geometry/support/webMercatorUtils.js";import u from"../layers/support/TileInfo.js";import{PopupView as c}from"./PopupView.js";import g from"./View.js";import y from"./ViewAnimation.js";import f from"./2d/AnimationManager.js";import w from"./2d/FrameTask.js";import{layerView2DImporter as _}from"./2d/layerViewModuleImportUtils.js";import v from"./2d/MapViewConstraints.js";import T from"./2d/PaddedViewState.js";import"./2d/tiling/PagedTileQueue.js";import z from"./2d/tiling/TileInfoView.js";import"./2d/tiling/TileKey.js";import"./2d/tiling/TileQueue.js";import"./2d/tiling/TileStrategy.js";import{centerAt as V,setExtent as S,rotateTo as x,scaleTo as R,copy as j,createAsync as b,resize as O,extentToScale as M}from"./2d/viewpointUtils.js";import I from"./2d/layers/features/support/TileStore.js";import{Timeline as k}from"./2d/support/Timeline.js";import P from"../geometry/Point.js";import G from"../geometry/Extent.js";import E from"../geometry/SpatialReference.js";const L=s.getLogger("esri.views.MapView");function N(t){return t&&"esri.Viewpoint"===t.declaredClass}const q=160;let A=class extends(c(g)){constructor(t){super(t),this._stationaryTimer=null,this.frameTask=new w(this),this.featuresTilingScheme=null,this.fullOpacity=1,this.graphicsView=null,this.initialExtent=null,this.map=null,this.labelManager=null,this.renderingOptions={samplingMode:"dynamic",edgeLabelsVisible:!0,labelsAnimationTime:125,labelCollisionsEnabled:!0},this.resizeAlign="center",this.supportsGround=!1,this.timeline=new k,this.type="2d",this.constraints=new v,this.padding={top:0,right:0,bottom:0,left:0};const e=this.handles,i=()=>this.notifyChange("updating");e.add([this.watch("viewpoint",(()=>{this._lastStationaryEventTimestamp=performance.now(),this._flipStationary(q)}),!0),this.on("resize",(t=>this._resizeHandler(t))),this.watch("animationManager.animation",(t=>{this.animation=t})),this.allLayerViews.on("change",(()=>{i(),e.remove("map-view-base-layerViewsUpdating"),e.add(this.allLayerViews.map((t=>t.watch("updating",i))),"map-view-base-layerViewsUpdating")}))],"map-view-base")}destroy(){this.destroyed||(this._set("preconditionsReady",!1),this._gotoTask=this.frameTask=null)}get _defaultsFromMapSettings(){return{required:{tileInfo:!0,heightModelInfo:!1,extent:!1}}}set animation(t){const e=this._get("animation");if(t===e)return;if(e&&e.stop(),!t||t.isFulfilled())return void this._set("animation",null);this._set("animation",t),this.frameTask.animationInProgress=!0;const i=()=>{t===this._get("animation")&&(this._set("animation",null),this.frameTask.requestFrame()),this.frameTask.animationInProgress=!1};t.when(i,i)}get center(){if(!this.ready)return this._get("center");const{center:t,spatialReference:e}=this.state.paddedViewState;return new P({x:t[0],y:t[1],spatialReference:e})}set center(t){if(null==t)return;if(!this._normalizeInput(t))return void L.error("#center",`incompatible spatialReference ${JSON.stringify(t.spatialReference)} with view's spatialReference ${JSON.stringify(this.spatialReference)}`);if(!this.ready)return this._set("center",t),void this.notifyChange("initialExtentRequired");const e=this.viewpoint;V(e,e,t),this.viewpoint=e}set constraints(t){const e=this._get("constraints");e&&(this.handles.remove("map-view-base-constraints"),e.destroy()),this._set("constraints",t),t&&(t.view=this,this.ready&&(this.state.viewpoint=t.fit(this.state.paddedViewState.viewpoint)),this.handles.add(t.on("update",(()=>{this.ready&&this.state&&(this.state.viewpoint=t.fit(this.state.paddedViewState.viewpoint))})),"map-view-base-constraints"))}get extent(){return this.ready?this.state.paddedViewState.extent.clone():this._get("extent")}set extent(t){if(null==t)return;const e=this._normalizeInput(t);if(!e)return void L.error("#center",`incompatible spatialReference ${JSON.stringify(t.spatialReference)} with view's spatialReference ${JSON.stringify(this.spatialReference)}`);if(!e.width||!e.height)return void L.error("#extent","invalid extent size");if(!this.ready)return this._set("extent",e),this._set("center",null),this._set("viewpoint",null),this._set("scale",0),this._set("zoom",-1),void this.notifyChange("initialExtentRequired");const i=this.viewpoint;S(i,i,e,this.size,{constraints:this.constraints}),this.viewpoint=i}get graphicsTileStore(){return new I(this.featuresTilingScheme)}get initialExtentRequired(){const t=this._normalizeInput(this.center),e=this._normalizeInput(this.viewpoint),i=this._normalizeInput(this.extent),{scale:s,constraints:a}=this;let r=this.zoom;return!this.get("map.initialViewProperties.viewpoint")&&(!i&&(a.effectiveLODs||(r=-1),(!t||0===s&&-1===r)&&(!e||!n(e.targetGeometry)||"extent"!==e.targetGeometry.type&&!e.scale)))}get padding(){return this.ready?this.state.padding:this._get("padding")}set padding(t){this.ready?(this.state.padding=t,this._set("padding",this.state.padding)):this._set("padding",t)}get resolution(){return this.state?this.state.resolution:0}get rotation(){return this.ready?this.state.rotation:this._get("rotation")}set rotation(t){if(isNaN(t))return;if(!this.ready)return void this._set("rotation",t);const e=this.viewpoint;x(e,e,t),this.viewpoint=e}get scale(){return this.ready?this.state.scale:this._get("scale")}set scale(t){if(!t||isNaN(t))return;if(!this.ready){this._set("scale",t),this._set("zoom",-1);const e=this._get("extent");return e&&(this._set("extent",null),this._set("center",e.center)),void this.notifyChange("initialExtentRequired")}const e=this.viewpoint;R(e,e,t),this.viewpoint=e}get stationary(){return!(this.animation||this.navigating||this._get("resizing")||this._stationaryTimer)}get updating(){return!this.destroyed&&(!0===this.get("layerViewManager.updating")||!0===this.get("labelManager.updating")||!0===this.get("graphicsView.updating")||this.allLayerViews.some((t=>!t.destroyed&&!("layerViews"in t)&&!0===t.updating)))}get viewpoint(){if(!this.ready)return this._get("viewpoint");const t=this.state.paddedViewState;return t&&t.viewpoint.clone()}set viewpoint(t){if(null==t)return;const i=this._normalizeInput(t);if(!i)return void(!t.scale||isNaN(t.scale)?L.error("#viewpoint",`invalid scale value of ${t.scale}`):a(t.targetGeometry)?L.error("#viewpoint","geometry not defined"):L.error("#viewpoint",`incompatible spatialReference ${JSON.stringify(t.targetGeometry.spatialReference)} with view's spatialReference ${JSON.stringify(this.spatialReference)}`));if(!this.ready)return this._set("viewpoint",i),this._set("extent",null),this._set("center",null),this._set("zoom",-1),this._set("scale",0),void this.notifyChange("initialExtentRequired");const s=new e({targetGeometry:new P,scale:0,rotation:0});j(s,i),this.constraints.constrain(s,this.state.paddedViewState.viewpoint),this.state.viewpoint=s,this.frameTask.requestFrame(),this._set("viewpoint",s)}get zoom(){return this.ready?this.constraints.scaleToZoom(this.scale):this._get("zoom")}set zoom(t){if(null==t)return;if(!this.ready){this.notifyChange("initialExtentRequired"),this._set("zoom",t),this._set("scale",0);const e=this._get("extent");e&&(this._set("extent",null),this._set("center",e.center))}if(!this.constraints.effectiveLODs)return;const e=this.viewpoint;R(e,e,this.constraints.zoomToScale(t)),this.viewpoint=e,this._set("zoom",this.constraints.scaleToZoom(this.scale))}goTo(t,e){if(t)return this.animation&&(this.animation=null),this._createAnimation(),l(this,"ready",e&&e.signal).then((()=>{const i={animate:!0,...e},s=b(t,this);return this.animation.update(s),this._gotoTask={},i.animate?this._gotoAnimated(s,i):this._gotoImmediate(s,i)}));L.error("#goTo()","target cannot be null or undefined")}hitTest(t){return Promise.reject("Should be implemented by subclasses")}popupHitTest(t){return this.hitTest(t).then((e=>({...e,mapPoint:this.toMap(t)})))}toMap(t){if(!this.ready)return null;const e=[0,0],[i,s]=this.state.toMap(e,[t.x,t.y]),n=this.spatialReference;return new P({x:i,y:s,spatialReference:n})}toScreen(t){if(!this.ready)return null;const e=this._normalizeInput(t),i=[e.x,e.y];return this.state.toScreen(i,i),o(i[0],i[1])}pixelSizeAt(){return this.ready?this.state.resolution:(L.error("#pixelSizeAt()","Map view cannot be used before it is ready"),null)}requestUpdate(){this.ready&&this.frameTask.requestUpdate()}getDefaultSpatialReference(){var t,e,i;return this.map&&"initialViewProperties"in this.map&&(null==(t=this.map)||null==(e=t.initialViewProperties)?void 0:e.spatialReference)||(null==(i=this.defaultsFromMap)?void 0:i.spatialReference)||null}getSpatialReferenceSupport({layer:t}){return t||this._get("ready")||null!==this._getDefaultViewpoint()?{}:null}importLayerView(t){return _.importLayerView(t)}hasLayerViewModule(t){return _.hasLayerViewModule(t)}_createAnimation(){return this.animation&&!this.animation.done||(this.animation=new y),this.animation}_cancellableGoTo(t,e,i){const s=()=>t===this._gotoTask,n=i.then((()=>{s()&&(this.animation=null)})).catch((t=>{throw s()&&(this.animation=null,e.done||(e.stop(),this.frameTask.animationInProgress=!1)),t})),a=new Promise((t=>t(n)));return e.when().catch((()=>{s()&&a.cancel&&a.cancel()})),a}_gotoImmediate(t,e){const s=this._gotoTask,n=this.animation,a=t.then((t=>{if(r(e),s!==this._gotoTask)throw new i("view:goto-interrupted","Goto was interrupted");this.viewpoint=n.target=t,n.finish()}));return this._cancellableGoTo(s,n,a)}_gotoAnimated(t,e){const s=this._gotoTask,n=this.animation,a=t.then((t=>{if(r(e),s!==this._gotoTask)throw new i("view:goto-interrupted","Goto was interrupted");return n.update(t),this.animationManager.animate(n,this.viewpoint,e),n.when().then((()=>{}),(()=>{}))}));return this._cancellableGoTo(s,n,a)}_resizeHandler(t){const e=this.state;if(!e)return;let i=this.state.paddedViewState.viewpoint;const s=this.state.paddedViewState.size.concat();e.size=[t.width,t.height],O(i,i,s,this.state.paddedViewState.size,this.resizeAlign),i=this.constraints.constrain(i,null),this.state.viewpoint=i}_startup(){const t=this._getDefaultViewpoint();this.constraints.view=this,this.constraints.fit(t),this._set("animationManager",new f({view:this})),this._set("state",new T({padding:this._get("padding"),size:this.size,viewpoint:t})),this._set("featuresTilingScheme",new z(u.create({spatialReference:this.spatialReference,size:512,numLODs:36}))),this._set("ready",!0),this.frameTask&&this.frameTask.start()}_teardown(){this.frameTask&&this.frameTask.stop(),this._set("ready",!1),this._stationaryTimer&&(clearTimeout(this._stationaryTimer),this._stationaryTimer=null);const{center:[t,e],spatialReference:i,rotation:s,scale:n}=this.state.paddedViewState,a=new P({x:t,y:e,spatialReference:i});this._set("viewpoint",null),this._set("extent",null),this._set("center",a),this._set("zoom",-1),this._set("rotation",s),this._set("scale",n),this._set("spatialReference",i),this.constraints.view=null,this.animationManager.destroy(),this._set("animationManager",null),this._set("state",null),this.animation=null}_flipStationary(t){return null!==this._stationaryTimer||(this._stationaryTimer=setTimeout((()=>{this._stationaryTimer=null;const t=performance.now()-this._lastStationaryEventTimestamp;t<q&&(this._stationaryTimer=this._flipStationary(t))}),t)),this._stationaryTimer}_normalizeInput(t,e=this.spatialReference){const i=t&&t.targetGeometry||t;return e?i?e.equals(i.spatialReference)?t:d(i,e)?N(t)?(t.targetGeometry=m(i,e),t):m(i,e):null:null:t}_getDefaultViewpoint(){const t=this.constraints,i={zoom:this._get("zoom"),scale:this._get("scale"),center:this._normalizeInput(this._get("center")),extent:this._normalizeInput(this._get("extent")),rotation:this._get("rotation"),viewpoint:this._normalizeInput(this._get("viewpoint")),spatialReference:this._userSpatialReference};t.effectiveLODs?-1!==i.zoom&&(i.scale=t.zoomToScale(i.zoom)):i.zoom=-1;let s=null,a=null,r=0;const o=i.viewpoint&&i.viewpoint.rotation,l=i.viewpoint&&i.viewpoint.targetGeometry;n(l)&&("extent"===l.type?s=l:"point"===l.type&&(a=l,r=i.viewpoint.scale));const p=this._normalizeInput(this.get("map.initialViewProperties.viewpoint.targetGeometry.extent")),h=this._normalizeInput(this.initialExtent),d=i.extent||s||p||h,m=i.center||a||d&&d.center,u=this.get("map.initialViewProperties.viewpoint.scale"),c=i.scale||r||u||d&&M(d,this.size),g=this.get("map.initialViewProperties.viewpoint.rotation"),y=i.rotation||o||g||0;return m&&c?new e({targetGeometry:m,scale:c,rotation:y}):null}};t([p()],A.prototype,"_stationaryTimer",void 0),t([p()],A.prototype,"_defaultsFromMapSettings",null),t([p()],A.prototype,"animation",null),t([p({readOnly:!0})],A.prototype,"animationManager",void 0),t([p({value:null,type:P,dependsOn:["state.id","ready"]})],A.prototype,"center",null),t([p({type:v})],A.prototype,"constraints",null),t([p({value:null,type:G,dependsOn:["state.id","ready"]})],A.prototype,"extent",null),t([p({readOnly:!0})],A.prototype,"featuresTilingScheme",void 0),t([p()],A.prototype,"fullOpacity",void 0),t([p({readOnly:!0})],A.prototype,"graphicsTileStore",null),t([p()],A.prototype,"graphicsView",void 0),t([p({type:G})],A.prototype,"initialExtent",void 0),t([p({dependsOn:["map.initialViewProperties?.viewpoint","constraints.effectiveLODs","spatialReference"]})],A.prototype,"initialExtentRequired",null),t([p()],A.prototype,"map",void 0),t([p()],A.prototype,"labelManager",void 0),t([p({value:{top:0,right:0,bottom:0,left:0},cast:t=>({top:0,right:0,bottom:0,left:0,...t})})],A.prototype,"padding",null),t([p({type:Object})],A.prototype,"renderingOptions",void 0),t([p()],A.prototype,"resizeAlign",void 0),t([p({readOnly:!0,dependsOn:["state.id"]})],A.prototype,"resolution",null),t([p({value:0,type:Number,dependsOn:["state.id","ready"]})],A.prototype,"rotation",null),t([p({value:0,type:Number,dependsOn:["state.id","ready"]})],A.prototype,"scale",null),t([p({type:E,dependsOn:["map.initialViewProperties?.spatialReference","defaultsFromMap.ready"]})],A.prototype,"spatialReference",void 0),t([p({readOnly:!0})],A.prototype,"state",void 0),t([p({dependsOn:["animation","navigating","resizing","_stationaryTimer"]})],A.prototype,"stationary",null),t([p({readOnly:!0})],A.prototype,"supportsGround",void 0),t([p({type:k,readOnly:!0})],A.prototype,"timeline",void 0),t([p({readOnly:!0})],A.prototype,"type",void 0),t([p({readOnly:!0,dependsOn:["layerViewManager.updating","labelManager.updating","graphicsView?.updating"]})],A.prototype,"updating",null),t([p({value:null,type:e,dependsOn:["state.id","ready"]})],A.prototype,"viewpoint",null),t([p({value:-1,dependsOn:["state.id"]})],A.prototype,"zoom",null),A=t([h("esri.views.MapViewBase")],A);const U=A;export{U 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.22/esri/copyright.txt for details.
4
4
  */
5
- import"../../core/has.js";import{isSome as t,isNone as o}from"../../core/maybe.js";import{webglValidateShadersEnabled as i}from"./checkWebGLError.js";import{ResourceType as r}from"./enums.js";import{transpileShader as n}from"./ShaderTranspiler.js";class e{constructor(t,o,i,n){this._context=t,this._locations=n,this._nameToUniformLocation={},this._nameToUniform1={},this._nameToUniform1v={},this._nameToUniform2={},this._nameToUniform3={},this._nameToUniform4={},this._nameToUniformMatrix3={},this._nameToUniformMatrix4={},t||console.error("RenderingContext isn't initialized!"),0===o.length&&console.error("Shaders source should not be empty!"),this._vShader=m(this._context,35633,o),this._fShader=m(this._context,35632,i),this._vShader&&this._fShader||console.error("Error loading shaders!"),this._context.instanceCounter.increment(r.VertexShader,this),this._context.instanceCounter.increment(r.FragmentShader,this)}get glName(){if(t(this._glName))return this._glName;if(o(this._vShader))return null;const n=this._context.gl,e=n.createProgram();return n.attachShader(e,this._vShader),n.attachShader(e,this._fShader),this._locations.forEach(((t,o)=>n.bindAttribLocation(e,t,o))),n.linkProgram(e),i()&&!n.getProgramParameter(e,n.LINK_STATUS)&&console.error("Could not initialize shader\nVALIDATE_STATUS: "+n.getProgramParameter(e,n.VALIDATE_STATUS)+", gl error ["+n.getError()+"]infoLog: "+n.getProgramInfoLog(e)),this._glName=e,this._context.instanceCounter.increment(r.Program,this),e}dispose(){const t=this._context.gl;this._vShader&&(t.deleteShader(this._vShader),this._vShader=null,this._context.instanceCounter.decrement(r.VertexShader,this)),this._fShader&&(t.deleteShader(this._fShader),this._fShader=null,this._context.instanceCounter.decrement(r.FragmentShader,this)),this._glName&&(t.deleteProgram(this._glName),this._glName=null,this._context.instanceCounter.decrement(r.Program,this))}_getUniformLocation(t){return void 0===this._nameToUniformLocation[t]&&(this._nameToUniformLocation[t]=this._context.gl.getUniformLocation(this.glName,t)),this._nameToUniformLocation[t]}hasUniform(t){return null!==this._getUniformLocation(t)}setUniform1i(t,o){const i=this._nameToUniform1[t];if(void 0===i||o!==i){this._context.useProgram(this);this._context.gl.uniform1i(this._getUniformLocation(t),o),this._nameToUniform1[t]=o}}setUniform1iv(t,o){const i=this._nameToUniform1v[t];if(s(i,o)){this._context.useProgram(this);this._context.gl.uniform1iv(this._getUniformLocation(t),o),void 0===i?this._nameToUniform1v[t]=Array.from(o):f(o,i)}}setUniform2iv(t,o){const i=this._nameToUniform2[t];if(s(i,o)){this._context.useProgram(this);this._context.gl.uniform2iv(this._getUniformLocation(t),o),void 0===i?this._nameToUniform2[t]=Array.from(o):f(o,i)}}setUniform3iv(t,o){const i=this._nameToUniform3[t];if(s(i,o)){this._context.useProgram(this);this._context.gl.uniform3iv(this._getUniformLocation(t),o),void 0===i?this._nameToUniform3[t]=Array.from(o):f(o,i)}}setUniform4iv(t,o){const i=this._nameToUniform4[t];if(s(i,o)){this._context.useProgram(this);this._context.gl.uniform4iv(this._getUniformLocation(t),o),void 0===i?this._nameToUniform4[t]=Array.from(o):f(o,i)}}setUniform1f(t,o){const i=this._nameToUniform1[t];if(void 0===i||o!==i){this._context.useProgram(this);this._context.gl.uniform1f(this._getUniformLocation(t),o),this._nameToUniform1[t]=o}}setUniform1fv(t,o){const i=this._nameToUniform1v[t];if(s(i,o)){this._context.useProgram(this);this._context.gl.uniform1fv(this._getUniformLocation(t),o),void 0===i?this._nameToUniform1v[t]=Array.from(o):f(o,i)}}setUniform2f(t,o,i){const r=this._nameToUniform2[t];if(void 0===r||o!==r[0]||i!==r[1]){this._context.useProgram(this);this._context.gl.uniform2f(this._getUniformLocation(t),o,i),void 0===r?this._nameToUniform2[t]=[o,i]:(r[0]=o,r[1]=i)}}setUniform2fv(t,o){const i=this._nameToUniform2[t];if(s(i,o)){this._context.useProgram(this);this._context.gl.uniform2fv(this._getUniformLocation(t),o),void 0===i?this._nameToUniform2[t]=Array.from(o):f(o,i)}}setUniform3f(t,o,i,r){const n=this._nameToUniform3[t];if(void 0===n||o!==n[0]||i!==n[1]||r!==n[2]){this._context.useProgram(this);this._context.gl.uniform3f(this._getUniformLocation(t),o,i,r),void 0===n?this._nameToUniform3[t]=[o,i,r]:(n[0]=o,n[1]=i,n[2]=r)}}setUniform3fv(t,o){const i=this._nameToUniform3[t];if(s(i,o)){this._context.useProgram(this);this._context.gl.uniform3fv(this._getUniformLocation(t),o),void 0===i?this._nameToUniform3[t]=Array.from(o):f(o,i)}}setUniform4f(t,o,i,r,n){const e=this._nameToUniform4[t];if(void 0===e||o!==e[0]||i!==e[1]||r!==e[2]||n!==e[3]){this._context.useProgram(this);this._context.gl.uniform4f(this._getUniformLocation(t),o,i,r,n),void 0===e?this._nameToUniform4[t]=[o,i,r,n]:(e[0]=o,e[1]=i,e[2]=r,e[3]=n)}}setUniform4fv(t,o){const i=this._nameToUniform4[t];if(s(i,o)){this._context.useProgram(this);this._context.gl.uniform4fv(this._getUniformLocation(t),o),void 0===i?this._nameToUniform4[t]=Array.from(o):f(o,i)}}setUniformMatrix3fv(t,o,i=!1,r=!1){const n=this._nameToUniformMatrix3[t];if(r?n!==o:c(n,o)){this._context.useProgram(this);this._context.gl.uniformMatrix3fv(this._getUniformLocation(t),i,o),void 0===n?this._nameToUniformMatrix3[t]=Array.from(o):f(o,n)}}setUniformMatrix4fv(t,o,i=!1){const r=this._nameToUniformMatrix4[t];if(_(r,o)){this._context.useProgram(this);this._context.gl.uniformMatrix4fv(this._getUniformLocation(t),i,o),void 0===r?this._nameToUniformMatrix4[t]=Array.from(o):f(o,r)}}assertCompatibleVertexAttributeLocations(t){t.locations!==this._locations&&console.error("VertexAttributeLocations are incompatible")}stop(){}}function s(t,i){if(o(t)||t.length!==i.length)return!0;for(let o=0;o<t.length;++o)if(t[o]!==i[o])return!0;return!1}function m(t,o,r){const e="webgl2"===t.webglVersion?n(r,o):r,s=t.gl,m=s.createShader(o);return s.shaderSource(m,e),s.compileShader(m),i()&&!s.getShaderParameter(m,s.COMPILE_STATUS)&&(console.error("Compile error in ".concat(35633===o?"vertex":"fragment"," shader")),console.error(s.getShaderInfoLog(m)),console.error(a(e)),"webgl2"===t.webglVersion&&(console.log("Shader source before transpilation:"),console.log(r))),m}function a(t){let o=2;return t.replace(/\n/g,(()=>"\n"+h(o++)+":"))}function h(t){return t>=1e3?t.toString():(" "+t).slice(-3)}function f(t,o){for(let i=0;i<t.length;++i)o[i]=t[i]}function c(t,i){return!!o(t)||(9!==t.length?s(t,i):9!==t.length||t[0]!==i[0]||t[1]!==i[1]||t[2]!==i[2]||t[3]!==i[3]||t[4]!==i[4]||t[5]!==i[5]||t[6]!==i[6]||t[7]!==i[7]||t[8]!==i[8])}function _(t,i){return!!o(t)||(16!==t.length?s(t,i):16!==t.length||t[0]!==i[0]||t[1]!==i[1]||t[2]!==i[2]||t[3]!==i[3]||t[4]!==i[4]||t[5]!==i[5]||t[6]!==i[6]||t[7]!==i[7]||t[8]!==i[8]||t[9]!==i[9]||t[10]!==i[10]||t[11]!==i[11]||t[12]!==i[12]||t[13]!==i[13]||t[14]!==i[14]||t[15]!==i[15])}export{e as Program};
5
+ import"../../core/has.js";import{isSome as t,isNone as o}from"../../core/maybe.js";import{webglValidateShadersEnabled as i}from"./checkWebGLError.js";import{ResourceType as r}from"./enums.js";import{transpileShader as e}from"./ShaderTranspiler.js";class n{constructor(t,o,i,e){this._context=t,this._locations=e,this._nameToUniformLocation={},this._nameToUniform1={},this._nameToUniform1v={},this._nameToUniform2={},this._nameToUniform3={},this._nameToUniform4={},this._nameToUniformMatrix3={},this._nameToUniformMatrix4={},t||console.error("RenderingContext isn't initialized!"),0===o.length&&console.error("Shaders source should not be empty!"),this._vShader=m(this._context,35633,o),this._fShader=m(this._context,35632,i),this._vShader&&this._fShader||console.error("Error loading shaders!"),this._context.instanceCounter.increment(r.VertexShader,this),this._context.instanceCounter.increment(r.FragmentShader,this)}get glName(){if(t(this._glName))return this._glName;if(o(this._vShader))return null;const e=this._context.gl,n=e.createProgram();return e.attachShader(n,this._vShader),e.attachShader(n,this._fShader),this._locations.forEach(((t,o)=>e.bindAttribLocation(n,t,o))),e.linkProgram(n),i()&&!e.getProgramParameter(n,e.LINK_STATUS)&&console.error(`Could not link shader\nvalidated: ${e.getProgramParameter(n,e.VALIDATE_STATUS)}, gl error ${e.getError()}, vertex: ${e.getShaderParameter(this._vShader,e.COMPILE_STATUS)}, fragment: ${e.getShaderParameter(this._fShader,e.COMPILE_STATUS)}, info log: ${e.getProgramInfoLog(n)}`),this._glName=n,this._context.instanceCounter.increment(r.Program,this),n}dispose(){const t=this._context.gl;this._vShader&&(t.deleteShader(this._vShader),this._vShader=null,this._context.instanceCounter.decrement(r.VertexShader,this)),this._fShader&&(t.deleteShader(this._fShader),this._fShader=null,this._context.instanceCounter.decrement(r.FragmentShader,this)),this._glName&&(t.deleteProgram(this._glName),this._glName=null,this._context.instanceCounter.decrement(r.Program,this))}_getUniformLocation(t){return void 0===this._nameToUniformLocation[t]&&(this._nameToUniformLocation[t]=this._context.gl.getUniformLocation(this.glName,t)),this._nameToUniformLocation[t]}hasUniform(t){return null!==this._getUniformLocation(t)}setUniform1i(t,o){const i=this._nameToUniform1[t];if(void 0===i||o!==i){this._context.useProgram(this);this._context.gl.uniform1i(this._getUniformLocation(t),o),this._nameToUniform1[t]=o}}setUniform1iv(t,o){const i=this._nameToUniform1v[t];if(s(i,o)){this._context.useProgram(this);this._context.gl.uniform1iv(this._getUniformLocation(t),o),void 0===i?this._nameToUniform1v[t]=Array.from(o):f(o,i)}}setUniform2iv(t,o){const i=this._nameToUniform2[t];if(s(i,o)){this._context.useProgram(this);this._context.gl.uniform2iv(this._getUniformLocation(t),o),void 0===i?this._nameToUniform2[t]=Array.from(o):f(o,i)}}setUniform3iv(t,o){const i=this._nameToUniform3[t];if(s(i,o)){this._context.useProgram(this);this._context.gl.uniform3iv(this._getUniformLocation(t),o),void 0===i?this._nameToUniform3[t]=Array.from(o):f(o,i)}}setUniform4iv(t,o){const i=this._nameToUniform4[t];if(s(i,o)){this._context.useProgram(this);this._context.gl.uniform4iv(this._getUniformLocation(t),o),void 0===i?this._nameToUniform4[t]=Array.from(o):f(o,i)}}setUniform1f(t,o){const i=this._nameToUniform1[t];if(void 0===i||o!==i){this._context.useProgram(this);this._context.gl.uniform1f(this._getUniformLocation(t),o),this._nameToUniform1[t]=o}}setUniform1fv(t,o){const i=this._nameToUniform1v[t];if(s(i,o)){this._context.useProgram(this);this._context.gl.uniform1fv(this._getUniformLocation(t),o),void 0===i?this._nameToUniform1v[t]=Array.from(o):f(o,i)}}setUniform2f(t,o,i){const r=this._nameToUniform2[t];if(void 0===r||o!==r[0]||i!==r[1]){this._context.useProgram(this);this._context.gl.uniform2f(this._getUniformLocation(t),o,i),void 0===r?this._nameToUniform2[t]=[o,i]:(r[0]=o,r[1]=i)}}setUniform2fv(t,o){const i=this._nameToUniform2[t];if(s(i,o)){this._context.useProgram(this);this._context.gl.uniform2fv(this._getUniformLocation(t),o),void 0===i?this._nameToUniform2[t]=Array.from(o):f(o,i)}}setUniform3f(t,o,i,r){const e=this._nameToUniform3[t];if(void 0===e||o!==e[0]||i!==e[1]||r!==e[2]){this._context.useProgram(this);this._context.gl.uniform3f(this._getUniformLocation(t),o,i,r),void 0===e?this._nameToUniform3[t]=[o,i,r]:(e[0]=o,e[1]=i,e[2]=r)}}setUniform3fv(t,o){const i=this._nameToUniform3[t];if(s(i,o)){this._context.useProgram(this);this._context.gl.uniform3fv(this._getUniformLocation(t),o),void 0===i?this._nameToUniform3[t]=Array.from(o):f(o,i)}}setUniform4f(t,o,i,r,e){const n=this._nameToUniform4[t];if(void 0===n||o!==n[0]||i!==n[1]||r!==n[2]||e!==n[3]){this._context.useProgram(this);this._context.gl.uniform4f(this._getUniformLocation(t),o,i,r,e),void 0===n?this._nameToUniform4[t]=[o,i,r,e]:(n[0]=o,n[1]=i,n[2]=r,n[3]=e)}}setUniform4fv(t,o){const i=this._nameToUniform4[t];if(s(i,o)){this._context.useProgram(this);this._context.gl.uniform4fv(this._getUniformLocation(t),o),void 0===i?this._nameToUniform4[t]=Array.from(o):f(o,i)}}setUniformMatrix3fv(t,o,i=!1,r=!1){const e=this._nameToUniformMatrix3[t];if(r?e!==o:c(e,o)){this._context.useProgram(this);this._context.gl.uniformMatrix3fv(this._getUniformLocation(t),i,o),void 0===e?this._nameToUniformMatrix3[t]=Array.from(o):f(o,e)}}setUniformMatrix4fv(t,o,i=!1){const r=this._nameToUniformMatrix4[t];if(_(r,o)){this._context.useProgram(this);this._context.gl.uniformMatrix4fv(this._getUniformLocation(t),i,o),void 0===r?this._nameToUniformMatrix4[t]=Array.from(o):f(o,r)}}assertCompatibleVertexAttributeLocations(t){t.locations!==this._locations&&console.error("VertexAttributeLocations are incompatible")}stop(){}}function s(t,i){if(o(t)||t.length!==i.length)return!0;for(let o=0;o<t.length;++o)if(t[o]!==i[o])return!0;return!1}function m(t,o,r){const n="webgl2"===t.webglVersion?e(r,o):r,s=t.gl,m=s.createShader(o);return s.shaderSource(m,n),s.compileShader(m),i()&&!s.getShaderParameter(m,s.COMPILE_STATUS)&&(console.error("Compile error in ".concat(35633===o?"vertex":"fragment"," shader")),console.error(s.getShaderInfoLog(m)),console.error(a(n)),"webgl2"===t.webglVersion&&(console.log("Shader source before transpilation:"),console.log(r))),m}function a(t){let o=2;return t.replace(/\n/g,(()=>"\n"+h(o++)+":"))}function h(t){return t>=1e3?t.toString():(" "+t).slice(-3)}function f(t,o){for(let i=0;i<t.length;++i)o[i]=t[i]}function c(t,i){return!!o(t)||(9!==t.length?s(t,i):9!==t.length||t[0]!==i[0]||t[1]!==i[1]||t[2]!==i[2]||t[3]!==i[3]||t[4]!==i[4]||t[5]!==i[5]||t[6]!==i[6]||t[7]!==i[7]||t[8]!==i[8])}function _(t,i){return!!o(t)||(16!==t.length?s(t,i):16!==t.length||t[0]!==i[0]||t[1]!==i[1]||t[2]!==i[2]||t[3]!==i[3]||t[4]!==i[4]||t[5]!==i[5]||t[6]!==i[6]||t[7]!==i[7]||t[8]!==i[8]||t[9]!==i[9]||t[10]!==i[10]||t[11]!==i[11]||t[12]!==i[12]||t[13]!==i[13]||t[14]!==i[14]||t[15]!==i[15])}export{n as Program};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.22/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../chunks/tslib.es6.js";import"../intl.js";import{isSome as t}from"../core/maybe.js";import{aliasOf as i}from"../core/accessorSupport/decorators/aliasOf.js";import"../core/arrayUtils.js";import"../core/has.js";import"../core/accessorSupport/ensureType.js";import{property as s}from"../core/accessorSupport/decorators/property.js";import{subclass as r}from"../core/accessorSupport/decorators/subclass.js";import{R as a}from"../chunks/ResizeObserver.js";import n from"./Widget.js";import o from"./Histogram/HistogramViewModel.js";import"./support/widgetUtils.js";import{messageBundle as l}from"./support/decorators/messageBundle.js";import"../core/Logger.js";import{tsx as d}from"./support/jsxFactory.js";import{substitute as h}from"../intl/substitute.js";var u;const c={base:"esri-histogram",horizontalLayout:"esri-histogram--horizontal",verticalLayout:"esri-histogram--vertical",content:"esri-histogram__content",svg:"esri-histogram__svg",bar:"esri-histogram__bar",bars:"esri-histogram__bars",label:"esri-histogram__label",dataLines:"esri-histogram__data-lines",dataLinesSubgroup:"esri-histogram__data-lines-subgroup",dataLine:"esri-histogram__data-line",averageLabel:"esri-histogram__average-label",averageDataLine:"esri-histogram__average-data-line",averageSymbol:"esri-histogram__average-symbol",esriWidget:"esri-widget",widgetIcon:"esri-icon-edit",disabled:"esri-disabled"};let g=u=class extends n{constructor(e,t){super(e,t),this._bgFillId=null,this._containerNode=null,this._containerOffsetHeight=0,this._containerOffsetWidth=0,this._defaultBarColor="#d8d8d8",this._observer=null,this.average=null,this.barCreatedFunction=null,this.bins=null,this.dataLines=null,this.dataLineCreatedFunction=null,this.dataLineUpdatedFunction=null,this.label=void 0,this.labelFormatFunction=null,this.max=null,this.messages=null,this.min=null,this.state=null,this.viewModel=new o,this._observer=new a((()=>this._storeContainerDimensions())),this._bgFillId=`${this.id}-bg-fill`}destroy(){this._containerNode&&this._observer.unobserve(this._containerNode)}set layout(e){"vertical"!==e&&(e="horizontal"),this._set("layout",e)}static fromHistogramResult(e){const{bins:t,maxValue:i,minValue:s}=e;return new u({bins:t,max:i,min:s})}render(){const{label:e,layout:t,state:i}=this,s=this.classes(c.base,c.esriWidget,"horizontal"===t?c.horizontalLayout:c.verticalLayout,"disabled"===i?c.disabled:null);return d("div",{"aria-label":e,afterCreate:this._afterContainerNodeCreate,bind:this,class:s,"data-node-ref":"_containerNode"},"ready"===i?this.renderContent():null)}renderContent(){if(!this._containerNode)return;const e=this._bgFillId,t=`clip-path: url(#${e})`;return d("div",{class:c.content},d("svg",{class:c.svg,xmlns:"http://www.w3.org/2000/svg"},d("defs",null,this.renderFillDefinition(e)),d("g",{style:t},this.renderBarsGroup()),this.renderLinesGroup()))}renderBarsGroup(){return d("g",{class:this.classes(c.bars)},this.renderBars())}renderBars(){const{layout:e,viewModel:{binRange:t,range:i}}=this;if(!t||!i)return;const s=t/i,[r,a]=this._getContainerDimensions();if(0===r&&0===a)return;if(0===r&&0!==a)return void this.scheduleRender();const[n,o]="vertical"===e?[r*s,a]:[r,a*s];return this._getBarDimensions(n,o).map((([e,t],i)=>this.renderBar(i,e,t)))}renderBar(e,t,i){const{bins:s,layout:r,max:a,messages:n,viewModel:{range:o}}=this,[l,u]=this._getContainerDimensions(),g=s.slice()[e],{count:p,maxValue:m,minValue:b}=g,_=a-m,[v,f]="vertical"===r?[0,_*(l/o)]:[u-i-_*(u/o),l-t],L=h(n.barLabel,{count:p,maxValue:m,minValue:b});return d("rect",{"aria-label":L,afterCreate:this._afterBarCreate,bind:this,class:c.bar,"data-index":e,fill:this._defaultBarColor,height:t,role:"img","shape-rendering":"crispEdges","stroke-width":"0",width:i,x:v,y:f})}renderLinesGroup(){return d("g",{class:this.classes(c.dataLines)},this.renderAverageLine(),this.renderCustomLines())}renderAverageLine(){const{average:e}=this;if(!t(e))return;const i=[d("tspan",{class:this.classes(c.averageSymbol)},"x̄ "),d("tspan",{class:this.classes(c.averageLabel)},this.labelFormatFunction?this.labelFormatFunction(e,"average"):e)];return d("g",{afterCreate:this._afterLinesSubgroupCreate,afterUpdate:this._afterLinesSubgroupUpdate,bind:this,class:this.classes(c.dataLinesSubgroup)},d("title",{key:"title"},e),this.renderLine(e,this.classes(c.averageDataLine)),this.renderLabel(e,i))}renderCustomLines(){if(this.dataLines&&this.dataLines.length)return this.dataLines.map((({value:e,label:t},i)=>this.renderLineSubgroup(i,e,t)))}renderLineSubgroup(e,t,i){return d("g",{afterCreate:this._afterLinesSubgroupCreate,afterUpdate:this._afterLinesSubgroupUpdate,bind:this,class:this.classes(c.dataLinesSubgroup),"data-index":e},d("title",{key:"title"},t),this.renderLine(t),this.renderLabel(t,i))}renderLine(e,t){const[i,s,r,a]=this._getLinePosition(e);return d("line",{class:this.classes(c.dataLine,t),x1:i,x2:s,y1:r,y2:a,"shape-rendering":"crispEdges"})}renderLabel(e,t,i){const[s,r]=this._getLabelPosition(e),a=2;return d("text",{class:this.classes(c.label,i),"text-anchor":"end",transform:"horizontal"===this.layout?"rotate(270)":null,x:s,y:r-a},t)}renderFillDefinition(e){const[t,i]=this._getContainerDimensions();return d("clipPath",{id:e},d("rect",{x:"0",y:"0",width:i,height:t}))}_afterContainerNodeCreate(e){this._containerNode&&this._observer.unobserve(this._containerNode),this._containerNode=e,this._observer.observe(this._containerNode),this._storeContainerDimensions()}_afterBarCreate(e){if(this.barCreatedFunction){const t=e.dataset?parseInt(e.dataset.index,10):e.getAttribute("data-index")?parseInt(e.getAttribute("data-index"),10):null;this.barCreatedFunction(isNaN(t)?null:t,e)}}_afterLinesSubgroupCreate(e){if(this.dataLineCreatedFunction){const t=e.dataset?parseInt(e.dataset.index,10):e.getAttribute("data-index")?parseInt(e.getAttribute("data-index"),10):null,i=e.childNodes[0],s=e.childNodes[1]?e.childNodes[1]:null;this.dataLineCreatedFunction(i,s,isNaN(t)?null:t)}}_afterLinesSubgroupUpdate(e){if(this.dataLineUpdatedFunction){const t=e.dataset?parseInt(e.dataset.index,10):e.getAttribute("data-index")?parseInt(e.getAttribute("data-index"),10):null,i=e.childNodes[0],s=e.childNodes[1]?e.childNodes[1]:null;this.dataLineUpdatedFunction(i,s,isNaN(t)?null:t)}}_storeContainerDimensions(){const{_containerNode:e}=this;e&&(this._containerOffsetHeight=e.offsetHeight,this._containerOffsetWidth=e.offsetWidth)}_getContainerDimensions(){return[this._containerOffsetHeight,this._containerOffsetWidth]}_getBarDimensions(e,t){const{bins:i,layout:s}=this,r=i?i.map((e=>e.count)):[],a=Math.max.apply(Math,r);return r.map((i=>"vertical"===s?[e/r.length,0!==a?i/a*t:0]:[0!==a?i/a*e:0,t/r.length]))}_getLinePosition(e){const{layout:t,min:i,viewModel:{range:s}}=this,r=Math.round((e-i)/s*100)/100,[a,n]=this._getContainerDimensions(),[o,l]=[r*n||1,a-r*a||1];return"vertical"===t?[0,"100%",l,l]:[o,o,"100%",0]}_getLabelPosition(e){const{layout:t,min:i,viewModel:{range:s}}=this,r=Math.round((e-i)/s*100)/100,[a,n]=this._getContainerDimensions();return"vertical"===t?[n,a-r*a]:[0,r*n]}};e([s()],g.prototype,"_containerOffsetHeight",void 0),e([s()],g.prototype,"_containerOffsetWidth",void 0),e([i("viewModel.average")],g.prototype,"average",void 0),e([s()],g.prototype,"barCreatedFunction",void 0),e([i("viewModel.bins")],g.prototype,"bins",void 0),e([s()],g.prototype,"dataLines",void 0),e([s()],g.prototype,"dataLineCreatedFunction",void 0),e([s()],g.prototype,"dataLineUpdatedFunction",void 0),e([s({aliasOf:{source:"messages.widgetLabel",overridable:!0}})],g.prototype,"label",void 0),e([i("viewModel.labelFormatFunction")],g.prototype,"labelFormatFunction",void 0),e([s({value:"horizontal"})],g.prototype,"layout",null),e([i("viewModel.max")],g.prototype,"max",void 0),e([s(),l("esri/widgets/Histogram/t9n/Histogram")],g.prototype,"messages",void 0),e([i("viewModel.min")],g.prototype,"min",void 0),e([i("viewModel.state")],g.prototype,"state",void 0),e([s()],g.prototype,"viewModel",void 0),g=u=e([r("esri.widgets.Histogram")],g);const p=g;export{p as default};
5
+ import{_ as e}from"../chunks/tslib.es6.js";import"../intl.js";import{isSome as t}from"../core/maybe.js";import{aliasOf as i}from"../core/accessorSupport/decorators/aliasOf.js";import"../core/arrayUtils.js";import"../core/has.js";import"../core/accessorSupport/ensureType.js";import{property as s}from"../core/accessorSupport/decorators/property.js";import{subclass as r}from"../core/accessorSupport/decorators/subclass.js";import{R as a}from"../chunks/ResizeObserver.js";import n from"./Widget.js";import o from"./Histogram/HistogramViewModel.js";import"./support/widgetUtils.js";import{messageBundle as l}from"./support/decorators/messageBundle.js";import"../core/Logger.js";import{tsx as d}from"./support/jsxFactory.js";import{substitute as h}from"../intl/substitute.js";var u;const c={base:"esri-histogram",horizontalLayout:"esri-histogram--horizontal",verticalLayout:"esri-histogram--vertical",content:"esri-histogram__content",svg:"esri-histogram__svg",bar:"esri-histogram__bar",bars:"esri-histogram__bars",label:"esri-histogram__label",dataLines:"esri-histogram__data-lines",dataLinesSubgroup:"esri-histogram__data-lines-subgroup",dataLine:"esri-histogram__data-line",averageLabel:"esri-histogram__average-label",averageDataLine:"esri-histogram__average-data-line",averageSymbol:"esri-histogram__average-symbol",esriWidget:"esri-widget",widgetIcon:"esri-icon-edit",disabled:"esri-disabled"};let g=u=class extends n{constructor(e,t){super(e,t),this._bgFillId=null,this._containerNode=null,this._containerOffsetHeight=0,this._containerOffsetWidth=0,this._defaultBarColor="#d8d8d8",this._observer=null,this.average=null,this.barCreatedFunction=null,this.bins=null,this.dataLines=null,this.dataLineCreatedFunction=null,this.dataLineUpdatedFunction=null,this.label=void 0,this.labelFormatFunction=null,this.max=null,this.messages=null,this.min=null,this.state=null,this.viewModel=new o,this._observer=new a((()=>{this._storeContainerDimensions(),this.scheduleRender()})),this._bgFillId=`${this.id}-bg-fill`}destroy(){this._containerNode&&this._observer.unobserve(this._containerNode)}set layout(e){"vertical"!==e&&(e="horizontal"),this._set("layout",e)}static fromHistogramResult(e){const{bins:t,maxValue:i,minValue:s}=e;return new u({bins:t,max:i,min:s})}render(){const{label:e,layout:t,state:i}=this,s=this.classes(c.base,c.esriWidget,"horizontal"===t?c.horizontalLayout:c.verticalLayout,"disabled"===i?c.disabled:null);return d("div",{"aria-label":e,afterCreate:this._afterContainerNodeCreate,bind:this,class:s,"data-node-ref":"_containerNode"},"ready"===i?this.renderContent():null)}renderContent(){if(!this._containerNode)return;const e=this._bgFillId,t=`clip-path: url(#${e})`;return d("div",{class:c.content},d("svg",{class:c.svg,xmlns:"http://www.w3.org/2000/svg"},d("defs",null,this.renderFillDefinition(e)),d("g",{style:t},this.renderBarsGroup()),this.renderLinesGroup()))}renderBarsGroup(){return d("g",{class:this.classes(c.bars)},this.renderBars())}renderBars(){const{layout:e,viewModel:{binRange:t,range:i}}=this;if(!t||!i)return;const s=t/i,[r,a]=this._getContainerDimensions();if(0===r&&0===a)return;if(0===r&&0!==a)return void this.scheduleRender();const[n,o]="vertical"===e?[r*s,a]:[r,a*s];return this._getBarDimensions(n,o).map((([e,t],i)=>this.renderBar(i,e,t)))}renderBar(e,t,i){const{bins:s,layout:r,max:a,messages:n,viewModel:{range:o}}=this,[l,u]=this._getContainerDimensions(),g=s.slice()[e],{count:p,maxValue:m,minValue:b}=g,_=a-m,[v,f]="vertical"===r?[0,_*(l/o)]:[u-i-_*(u/o),l-t],L=h(n.barLabel,{count:p,maxValue:m,minValue:b});return d("rect",{"aria-label":L,afterCreate:this._afterBarCreate,bind:this,class:c.bar,"data-index":e,fill:this._defaultBarColor,height:t,role:"img","shape-rendering":"crispEdges","stroke-width":"0",width:i,x:v,y:f})}renderLinesGroup(){return d("g",{class:this.classes(c.dataLines)},this.renderAverageLine(),this.renderCustomLines())}renderAverageLine(){const{average:e}=this;if(!t(e))return;const i=[d("tspan",{class:this.classes(c.averageSymbol)},"x̄ "),d("tspan",{class:this.classes(c.averageLabel)},this.labelFormatFunction?this.labelFormatFunction(e,"average"):e)];return d("g",{afterCreate:this._afterLinesSubgroupCreate,afterUpdate:this._afterLinesSubgroupUpdate,bind:this,class:this.classes(c.dataLinesSubgroup)},d("title",{key:"title"},e),this.renderLine(e,this.classes(c.averageDataLine)),this.renderLabel(e,i))}renderCustomLines(){if(this.dataLines&&this.dataLines.length)return this.dataLines.map((({value:e,label:t},i)=>this.renderLineSubgroup(i,e,t)))}renderLineSubgroup(e,t,i){return d("g",{afterCreate:this._afterLinesSubgroupCreate,afterUpdate:this._afterLinesSubgroupUpdate,bind:this,class:this.classes(c.dataLinesSubgroup),"data-index":e},d("title",{key:"title"},t),this.renderLine(t),this.renderLabel(t,i))}renderLine(e,t){const[i,s,r,a]=this._getLinePosition(e);return d("line",{class:this.classes(c.dataLine,t),x1:i,x2:s,y1:r,y2:a,"shape-rendering":"crispEdges"})}renderLabel(e,t,i){const[s,r]=this._getLabelPosition(e),a=2;return d("text",{class:this.classes(c.label,i),"text-anchor":"end",transform:"horizontal"===this.layout?"rotate(270)":null,x:s,y:r-a},t)}renderFillDefinition(e){const[t,i]=this._getContainerDimensions();return d("clipPath",{id:e},d("rect",{x:"0",y:"0",width:i,height:t}))}_afterContainerNodeCreate(e){this._containerNode&&this._observer.unobserve(this._containerNode),this._containerNode=e,this._observer.observe(this._containerNode),this._storeContainerDimensions()}_afterBarCreate(e){if(this.barCreatedFunction){const t=e.dataset?parseInt(e.dataset.index,10):e.getAttribute("data-index")?parseInt(e.getAttribute("data-index"),10):null;this.barCreatedFunction(isNaN(t)?null:t,e)}}_afterLinesSubgroupCreate(e){if(this.dataLineCreatedFunction){const t=e.dataset?parseInt(e.dataset.index,10):e.getAttribute("data-index")?parseInt(e.getAttribute("data-index"),10):null,i=e.childNodes[0],s=e.childNodes[1]?e.childNodes[1]:null;this.dataLineCreatedFunction(i,s,isNaN(t)?null:t)}}_afterLinesSubgroupUpdate(e){if(this.dataLineUpdatedFunction){const t=e.dataset?parseInt(e.dataset.index,10):e.getAttribute("data-index")?parseInt(e.getAttribute("data-index"),10):null,i=e.childNodes[0],s=e.childNodes[1]?e.childNodes[1]:null;this.dataLineUpdatedFunction(i,s,isNaN(t)?null:t)}}_storeContainerDimensions(){const{_containerNode:e}=this;e&&(this._containerOffsetHeight=e.offsetHeight,this._containerOffsetWidth=e.offsetWidth)}_getContainerDimensions(){return[this._containerOffsetHeight,this._containerOffsetWidth]}_getBarDimensions(e,t){const{bins:i,layout:s}=this,r=i?i.map((e=>e.count)):[],a=Math.max.apply(Math,r);return r.map((i=>"vertical"===s?[e/r.length,0!==a?i/a*t:0]:[0!==a?i/a*e:0,t/r.length]))}_getLinePosition(e){const{layout:t,min:i,viewModel:{range:s}}=this,r=Math.round((e-i)/s*100)/100,[a,n]=this._getContainerDimensions(),[o,l]=[r*n||1,a-r*a||1];return"vertical"===t?[0,"100%",l,l]:[o,o,"100%",0]}_getLabelPosition(e){const{layout:t,min:i,viewModel:{range:s}}=this,r=Math.round((e-i)/s*100)/100,[a,n]=this._getContainerDimensions();return"vertical"===t?[n,a-r*a]:[0,r*n]}};e([s()],g.prototype,"_containerOffsetHeight",void 0),e([s()],g.prototype,"_containerOffsetWidth",void 0),e([i("viewModel.average")],g.prototype,"average",void 0),e([s()],g.prototype,"barCreatedFunction",void 0),e([i("viewModel.bins")],g.prototype,"bins",void 0),e([s()],g.prototype,"dataLines",void 0),e([s()],g.prototype,"dataLineCreatedFunction",void 0),e([s()],g.prototype,"dataLineUpdatedFunction",void 0),e([s({aliasOf:{source:"messages.widgetLabel",overridable:!0}})],g.prototype,"label",void 0),e([i("viewModel.labelFormatFunction")],g.prototype,"labelFormatFunction",void 0),e([s({value:"horizontal"})],g.prototype,"layout",null),e([i("viewModel.max")],g.prototype,"max",void 0),e([s(),l("esri/widgets/Histogram/t9n/Histogram")],g.prototype,"messages",void 0),e([i("viewModel.min")],g.prototype,"min",void 0),e([i("viewModel.state")],g.prototype,"state",void 0),e([s()],g.prototype,"viewModel",void 0),g=u=e([r("esri.widgets.Histogram")],g);const p=g;export{p as default};