@arcgis/core 4.34.0-next.81 → 4.34.0-next.83

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 (106) hide show
  1. package/assets/esri/core/workers/RemoteClient.js +1 -1
  2. package/assets/esri/core/workers/chunks/{9789f178ece126c4006d.js → 25ea02dd7d45a90cbb3b.js} +1 -1
  3. package/assets/esri/core/workers/chunks/{6271a706ac3fcba91432.js → 609abf071c4ea24955c2.js} +1 -1
  4. package/assets/esri/core/workers/chunks/{afb2770c4abbff9bab3d.js → 71c2a8e5a17803d3e949.js} +1 -1
  5. package/assets/esri/core/workers/chunks/77705d0c7c17bd46d81a.js +1 -0
  6. package/assets/esri/core/workers/chunks/{22f196d173711ebd64c7.js → 8513c9282c44bb0a736e.js} +1 -1
  7. package/assets/esri/core/workers/chunks/{db2396bf062468ee8b60.js → 8bdbd94a59269e216fba.js} +1 -1
  8. package/assets/esri/core/workers/chunks/{ecac5ca00c742bfb5898.js → 998d164b3e0b99a0ff1e.js} +1 -1
  9. package/assets/esri/core/workers/chunks/{96e483db7dd1f5dbb07a.js → 9a6fa91dd204f64d2590.js} +1 -1
  10. package/assets/esri/core/workers/chunks/a1196637268b89281780.js +1 -0
  11. package/assets/esri/core/workers/chunks/a1b08aab73747f4e7e25.js +1 -0
  12. package/assets/esri/core/workers/chunks/{b6c4712e00fce87bd0f4.js → aa1eb7b4d9ccda725da5.js} +1 -1
  13. package/assets/esri/core/workers/chunks/{20ae2316d927415f3df9.js → b43473e84b3f7fa2634d.js} +1 -1
  14. package/assets/esri/core/workers/chunks/{b168b6ffc16cd509d316.js → bd028badc07270eda3d0.js} +1 -1
  15. package/assets/esri/core/workers/chunks/{6593b419339e7598b760.js → d5363e5637d37e89a25f.js} +1 -1
  16. package/assets/esri/core/workers/chunks/{81a8addcb858086ff9ee.js → e17df11c98dbd869302b.js} +1 -1
  17. package/assets/esri/core/workers/chunks/e1b3ae6426886e2fab07.js +1 -0
  18. package/assets/esri/core/workers/chunks/e4acc3c2b6d865ed1940.js +1 -0
  19. package/assets/esri/core/workers/chunks/{6e2a3abc3dbc342212c4.js → f35003a90163847fe1e2.js} +1 -1
  20. package/assets/esri/core/workers/chunks/{a99752aec4602b5eeeaf.js → f8f85207b382c1ea038c.js} +11 -3
  21. package/assets/esri/core/workers/chunks/{9c5dcef2a75d4bb9b3d6.js → fcac475e4e82911b3126.js} +1 -1
  22. package/assets/esri/libs/lyr3d/lyr3DMain.wasm +0 -0
  23. package/assets/esri/libs/lyr3d/lyr3DWorker.wasm +0 -0
  24. package/chunks/CutFillComposition.glsl.js +8 -0
  25. package/chunks/CutFillMask.glsl.js +6 -0
  26. package/config.js +1 -1
  27. package/geometry/Extent.js +1 -1
  28. package/geometry/support/aaBoundingRect.js +1 -1
  29. package/interfaces.d.ts +53 -83
  30. package/kernel.js +1 -1
  31. package/layers/ImageryLayer.js +1 -1
  32. package/layers/ImageryTileLayer.js +1 -1
  33. package/layers/Lyr3DWasmPerSceneView.js +1 -1
  34. package/layers/support/ElevationSampler.js +1 -1
  35. package/layers/support/rasterDatasets/BaseRaster.js +1 -1
  36. package/layers/support/rasterDatasets/datasetUtils.js +1 -1
  37. package/layers/support/tiles3DUtils.js +1 -1
  38. package/package.json +1 -1
  39. package/portal/schemas/definitions.js +1 -1
  40. package/smartMapping/renderers/color.js +1 -1
  41. package/smartMapping/renderers/location.js +1 -1
  42. package/smartMapping/renderers/predominance.js +1 -1
  43. package/smartMapping/renderers/relationship.js +1 -1
  44. package/smartMapping/renderers/size.js +1 -1
  45. package/smartMapping/renderers/type.js +1 -1
  46. package/smartMapping/statistics/summaryStatistics.js +1 -1
  47. package/smartMapping/support/adapters/FeatureLayerAdapter.js +1 -1
  48. package/smartMapping/support/adapters/support/utils.js +1 -1
  49. package/smartMapping/support/utils.js +1 -1
  50. package/support/elevationInfoUtils.js +1 -1
  51. package/support/revision.js +1 -1
  52. package/tables/elements.js +1 -1
  53. package/views/2d/engine/Stage.js +1 -1
  54. package/views/2d/engine/webgl/shaderGraph/techniques/TextureStatisticsTechnique.js +1 -1
  55. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/TextureStatisticsDiffShader.js +1 -1
  56. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/TextureStatisticsMinMaxSumShader.js +1 -1
  57. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/TextureStatisticsStdDevShader.js +1 -1
  58. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/TextureStatisticsSumOfSquaredDiffShader.js +1 -1
  59. package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementCutFillComputation.js +1 -1
  60. package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementCutFillController.js +1 -1
  61. package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementCutFillVisualization.js +1 -1
  62. package/views/3d/layers/FlowSubView3D.js +1 -1
  63. package/views/3d/layers/GaussianSplatLayerView3D.js +1 -1
  64. package/views/3d/support/DisplayQualityProfile.js +1 -1
  65. package/views/3d/support/QualitySettings.js +1 -1
  66. package/views/3d/support/engineContent/line.js +1 -1
  67. package/views/3d/support/flow/StreamlineResources3D.js +1 -1
  68. package/views/3d/support/flow/StreamlineResources3DOverlay.js +1 -1
  69. package/views/3d/support/flow/StreamlineResources3DShape.js +1 -1
  70. package/views/3d/support/flow/geometryUtils.js +1 -1
  71. package/views/3d/support/gaussianSplatting/GaussianSplatDataStore.js +1 -1
  72. package/views/3d/terrain/OverlayManager.js +1 -1
  73. package/views/3d/terrain/Queue.js +5 -0
  74. package/views/3d/terrain/TerrainSurface.js +1 -1
  75. package/views/3d/terrain/Tile.js +1 -1
  76. package/views/3d/terrain/isTerrainSurfaceLayer.js +1 -1
  77. package/views/3d/webgl-engine/core/shaderLibrary/attributes/MaskedColor.glsl.js +15 -7
  78. package/views/3d/webgl-engine/lib/CutFillColor.js +5 -0
  79. package/views/3d/webgl-engine/lib/GaussianSplatRenderNode.js +1 -1
  80. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  81. package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
  82. package/views/3d/webgl-engine/shaders/CutFillComposition.glsl.js +5 -0
  83. package/views/3d/webgl-engine/shaders/CutFillCompositionTechnique.js +5 -0
  84. package/views/3d/webgl-engine/shaders/CutFillMask.glsl.js +5 -0
  85. package/views/3d/webgl-engine/shaders/CutFillMaskTechnique.js +5 -0
  86. package/views/3d/webgl.js +1 -1
  87. package/views/support/DefaultsFromMap.js +1 -1
  88. package/widgets/Editor/CreateFeaturesWorkflow.js +1 -1
  89. package/widgets/Editor/EditorViewModel.js +1 -1
  90. package/widgets/Editor/SplitFeatureWorkflow.js +5 -0
  91. package/widgets/Editor/SplitFeatureWorkflowData.js +5 -0
  92. package/widgets/Editor/UpdateWorkflow.js +1 -1
  93. package/widgets/Editor/support/splitFeatureUtils.js +1 -1
  94. package/widgets/Editor/workflowUtils.js +1 -1
  95. package/widgets/Legend/support/ActiveLayerInfo.js +1 -1
  96. package/widgets/Search/SearchViewModel.js +1 -1
  97. package/widgets/Search.js +1 -1
  98. package/widgets/UtilityNetworkTrace/UtilityNetworkTraceViewModel.js +1 -1
  99. package/widgets/UtilityNetworkTrace.js +1 -1
  100. package/widgets/VersionManagement/VersionManagementViewModel.js +1 -1
  101. package/assets/esri/core/workers/chunks/07a355a9c95154971aab.js +0 -1
  102. package/assets/esri/core/workers/chunks/22a66db7d73e733917e3.js +0 -1
  103. package/assets/esri/core/workers/chunks/5f079be7f322768aef21.js +0 -1
  104. package/assets/esri/core/workers/chunks/cb3b88959b2f048e54a5.js +0 -1
  105. package/assets/esri/core/workers/chunks/da1a5537e2f2ca6cc247.js +0 -1
  106. package/views/3d/support/gaussianSplatting/GaussianSplatQualitySettings.js +0 -5
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import t from"../../../Graphic.js";import{pickRandom as r}from"../../../core/arrayUtils.js";import i from"../../../core/Error.js";import{throwIfAborted as s}from"../../../core/promiseUtils.js";import{property as a}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import{subclass as o}from"../../../core/accessorSupport/decorators/subclass.js";import{isHostedAgolService as n}from"../../../layers/support/arcgisLayerUrl.js";import{isTimeOnlyField as l,isNumericField as u}from"../../../layers/support/fieldUtils.js";import{generateRenderer as m}from"../../../rest/generateRenderer.js";import c from"../../../rest/support/GenerateRendererParameters.js";import p from"../../../rest/support/StatisticDefinition.js";import h from"../../../rest/support/UniqueValueDefinition.js";import{getArcadeForPredominantCategory as d,getSQLForPredominantCategoryName as y}from"../../statistics/support/predominanceUtils.js";import{mergeWhereClauses as f,getRangeExpr as F,getSQLFilterForNormalization as S}from"../../statistics/support/utils.js";import{WorkerClient as g}from"../../statistics/support/WorkerClient.js";import{isAnyDateField as w,fieldDelimiter as v}from"../utils.js";import x from"./InMemoryLayerAdapter.js";import{getQueryParamsForExpr as _,getDataRange as q,getAttributeBinsQuery as E,processQueryAttributeBinsResult as z,binParamsFromGenRend as V}from"./support/histogramUtils.js";import{ensureFeaturesJSON as L,getSummaryStatsQuery as T,getSummaryStatisticsFromFeatureSet as Q,getUVQuery as j,getUniqueValuesFromFeatureSet as b,defaultNumBins as N,updateQueryWithFeatureFilter as C,getHistogramFromFeatureSet as B,getFieldExpr as M,getDomainsForFields as R,getBins as I,getPredominantCategoriesFromUVInfos as $,getMissingFields as O}from"./support/utils.js";import{processSummaryStatisticsResult as A,createUVResult as k,getEqualIntervalBins as D,createClassBreaksDefinition as G,resolveCBResult as U}from"../../../statistics/utils.js";import{getScaleToResolutionFactor as P}from"../../../views/2d/viewpointUtils.js";const J=5,W=2e4,H=4e5;let Z=class extends x{constructor(){super(...arguments),this.adapterName="feature-layer-adapter"}_isStatsSupportedOnService(){const e=this.layer;if(!e.capabilities?.query?.supportsStatistics||"multipatch"===this.geometryType&&!n(e.url)&&e.version<10.5)throw new i(`${this.adapterName}:not-supported`,"Layer does not support statistics query");return Promise.resolve()}_fetchFeaturesFromService(e,t){return this.layer.queryFeatures(e,{signal:t}).then(e=>e.features)}_fetchFeaturesJSONFromService(e,t){return this._fetchFeaturesFromService(e,t).then(L)}_summaryStatsFromGenRend(e){const t=e.normalizationType,r=e.normalizationField;return this.classBreaks({field:e.field,numClasses:J,classificationMethod:"standard-deviation",standardDeviationInterval:.25,normalizationType:t,normalizationField:"field"===t?r:void 0,minValue:e.minValue,maxValue:e.maxValue,filter:e.filter,signal:e.signal}).then(t=>{let r,i,s;if(t.classBreakInfos?.some(e=>(e.hasAvg&&(r=e),!!r)),r){const e=r.maxValue-r.minValue;i=r.minValue+e/2,s=4*e}const a={min:t.minValue,max:t.maxValue,avg:i,stddev:s};return A(a,e.outStatisticTypes)})}async _summaryStatsFromServiceQuery(e,t){await this._isStatsSupportedOnService(),"percent-of-total"===e.normalizationType&&(e.normalizationTotal=await this._getNormalizationTotal(e.field,e.normalizationType,e.filter));const r=w(t)||l(t),i="capabilities"in this.layer?this.layer.capabilities:null,s=T(this,e,t,i?.query?.supportsPercentileStatistics??!1),a=await this.layer.queryFeatures(s,{signal:e.signal}),o=Q(a,r);return A(o,e.outStatisticTypes)}_uvFromGenRenderer(e,t){const r=e.field??void 0,i=new h({attributeField:r}),s=new c({classificationDefinition:i});return this.generateRenderer(s,e.signal).then(e=>{const t={},i=this.getField(r);return e.uniqueValues.forEach(e=>{let r=e.value;null!=r&&""!==r&&("string"!=typeof r||""!==r.trim()&&"<null>"!==r.toLowerCase())||(r=null),null==t[r]?t[r]={count:e.count,data:u(i)&&r?Number(r):r}:t[r].count=t[r].count+e.count}),{count:t}}).then(r=>k(r,[t],e.returnAllCodedValues))}async _uvFromServiceQuery(e,t){return this._isStatsSupportedOnService().then(()=>this.layer.queryFeatures(j(this,e),{signal:e.signal})).then(t=>b(t,{layer:this,field:e.field,field2:e.field2,field3:e.field3,fieldDelimiter:v,view:e.view,signal:e.signal})).then(r=>k(r,t,e.returnAllCodedValues,v))}_getNormalizationTotal(e,t,r,i){return e&&"percent-of-total"===t?this.summaryStatistics({field:e,outStatisticTypes:{include:["sum"]},filter:r,signal:i}).then(e=>e.sum):Promise.resolve(null)}_histogramForExpr(e){return this._getNormalizationTotal(e.field,e.normalizationType,e.filter,e.signal).then(t=>{const r=_(e,this,t);return q(r,this,e.minValue,e.maxValue).then(i=>{const s=i.min,a=i.max;if(null==s||null==a)return{bins:[],minValue:s,maxValue:a,normalizationTotal:t};const o=e.numBins||N,n=D(s,a,o),l=K(r.sqlExpression,n,null!=e.minValue&&null!=e.maxValue),u=new p({statisticType:"count",outStatisticFieldName:"countOFExpr",onStatisticField:"1"}),m=this.layer.createQuery();return m.where=f(m.where,r.sqlWhere),m.sqlFormat="standard",m.outStatistics=[u],m.groupByFieldsForStatistics=[l],m.orderByFields=[l],C(m,e.filter),this._isStatsSupportedOnService().then(()=>this.layer.queryFeatures(m,{signal:r.signal})).then(e=>B(e,s,a,o,t))})})}async _histogramFromQueryAttributeBins(e){const{field:t,normalizationType:r,filter:i,signal:s}=e,a=await this._getNormalizationTotal(t,r,i,s),o=this.layer.createQuery(),{query:n,min:l,max:u}=await E(e,this,a,o?.where);if(!n)return{bins:[],minValue:l,maxValue:u,normalizationTotal:a};const m=await this.layer.queryAttributeBins(n,{signal:s});return z(m,t?this.getField(t):null,{minValue:l,maxValue:u,normalizationTotal:a})}_classBreaksFromGenRend(e){const{field:t,normalizationType:r,normalizationField:i,normalizationTotal:s,signal:a}=e,o=S({field:t,normalizationType:r,normalizationField:i}),n=M({field:t,normalizationType:r,normalizationField:i,normalizationTotal:s,layer:this}),l=F(n,e.minValue,e.maxValue),u=G({field:t,normalizationType:r,normalizationField:i,classificationMethod:e.classificationMethod,standardDeviationInterval:e.standardDeviationInterval,breakCount:e.numClasses||J}),m=new c({classificationDefinition:u});return m.where=f(o,l),this.generateRenderer(m,a).then(t=>U(t,e.classificationMethod))}async summaryStatistics(e){const{field:t,normalizationType:r,valueExpression:a,sqlExpression:o,view:n,features:u,useFeaturesInView:m}=e,c=t?this.getField(t):null,p=w(c)||l(c),h=a&&!(o&&this.supportsSQLExpression),d=this._hasLocalSource||u||m,y=n&&"3d"===n.type;if(d||h)return h||u||m||y?this._summaryStatsFromMemory(e,c):this._summaryStatsFromClientQuery(e,c);if(!this.supportsSQLExpression&&(p||o||"natural-log"===r||"square-root"===r))throw new i(`${this.adapterName}:not-supported`,"Layer does not support standardized SQL expression for queries");return(r&&!this.supportsSQLExpression?this._summaryStatsFromGenRend(e):this._summaryStatsFromServiceQuery(e,c)).catch(()=>(s(e.signal),this._summaryStatsFromMemory(e,c)))}async uniqueValues(e){const{valueExpression:t,sqlExpression:r,features:i,useFeaturesInView:a,signal:o}=e,n=t&&!(r&&this.supportsSQLExpression),l=this._hasLocalSource||i||a||n,u=e.view,m=u&&"3d"===u.type,c=await R(e,this);return l?n||i||a||m?this._uvFromMemory(e,c):this._uvFromClientQuery(e,c):this._uvFromServiceQuery(e,c).catch(t=>(s(o),!e.field||e.field2||e.field3||e.filter?t:this._uvFromGenRenderer(e,c[0]))).catch(()=>(s(o),m?this._uvFromMemory(e,c):this._uvFromClientQuery(e,c)))}async histogram(e){const{field:t,normalizationType:r,normalizationField:a,classificationMethod:o,view:n,filter:u,signal:m}=e,c=t?this.getField(t):null,p=w(c)||l(c),h=e.valueExpression||e.sqlExpression,d=e.valueExpression&&!(e.sqlExpression&&this.supportsSQLExpression),y=this._hasLocalSource||e.features||e.useFeaturesInView||d,f=this.supportsSQLExpression,S=!o||"equal-interval"===o,g=e.minValue,v=e.maxValue,x=null!=g&&null!=v,_=e.numBins||N;if(y)return this._histogramFromMemory(e);if(this.layer.capabilities?.operations?.supportsQueryBins&&e.useQueryAttributeBins)try{return await this._histogramFromQueryAttributeBins(e)}catch{return s(m),this._histogramFromQueryAttributeBinsFromMemory(e)}if((h||f)&&S){if(!f&&(h||"natural-log"===r||"square-root"===r))throw new i(`${this.adapterName}:not-supported`,"Layer does not support standardized SQL expression for queries");return this._histogramForExpr(e)}if(p&&S)throw new i(`${this.adapterName}:not-supported`,"Normalization and date field are not allowed when layer does not support standardized SQL expression for queries");return r||!S?V(e,this).then(s=>{if(!x)return I(this,s,t,_,n,u,m);if(g>s.max||v<s.min)throw new i(`${this.adapterName}:insufficient-data`,"Range defined by 'minValue' and 'maxValue' does not intersect available data range of the field");if(S)return I(this,{min:g,max:v,sqlExpr:s.sqlExpr,excludeZerosExpr:s.excludeZerosExpr},t,_,n,u,m);{const i={field:t,normalizationType:r,normalizationField:a,normalizationTotal:s.normTotal,layer:this},o=M(i),l=F(o,g,v);return V(e,this,l).then(e=>I(this,e,t,_,n,u,m))}}):this._histogramForField(e)}async classBreaks(e){const t=!1!==e.analyzeData,r=this._hasLocalSource||e.features||e.useFeaturesInView||e.valueExpression||e.filter;if(t&&r)return this._classBreaksFromMemory(e);return(t?this._classBreaksFromGenRend(e):this._classBreaksFromInterpolation(e)).catch(()=>(s(e.signal),this._classBreaksFromMemory(e)))}async queryFeatureCount(e){if(this._hasLocalSource)throw new i(`${this.adapterName}:not-supported`,"Layer does not support count query");const t=this.layer,r=t.createQuery();return r.where=f(r.where,e.whereClause),C(r,e.filter),t.queryFeatureCount(r,{signal:e.signal})}async generateRenderer(e,t){const r=this.layer;if(this._hasLocalSource||r.version<10.1)throw new i(`${this.adapterName}:not-supported`,"Layer does not support generateRenderer operation (requires ArcGIS Server version 10.1+)");const s=r.createQuery();return e.where=f(e.where,s.where),m(r.parsedUrl?.path??"",{source:r.dynamicDataSource??void 0,gdbVersion:r.gdbVersion??void 0},e,{signal:t})}async predominantCategories(e){if(!this._hasLocalSource&&!this.supportsSQLExpression)throw new i(`${this.adapterName}:not-supported`,"Layer does not support advanced SQL expressions and standardized queries");const{fields:t,view:r,signal:s,filter:a}=e,o=d(t),n=y(t),l=r&&this._hasLocalSource?await this._uvFromMemory({valueExpression:o,view:r,signal:s,filter:a}):await this._uvFromServiceQuery({sqlExpression:n.expression,valueExpression:o,signal:s,filter:a});return $(l.uniqueValueInfos,t)}async getSampleFeatures(e,i){const{view:a,requiredFields:o,returnGeometry:n,filter:l,signal:u}=e,m=e.sampleSize;if(null==m||0===m)return[];const c=this.layer.createQuery(),p=1,h="json"===i;c.outSpatialReference=a?.spatialReference,c.returnGeometry=!!n,c.outFields=o,C(c,l);let d=[],y=!1;if(a)try{const s=await a.whenLayerView(this.layer);if(y=!O(this,o,s).length,y){if(m>=1&&!e.filter&&"getSampleFeatures"in s){await this._waitForLayerViewUpdate(s);const e=await s.getSampleFeatures({minFeatureCount:m,sampleSize:m});if(null!=e)return h?e:e.map(e=>t.fromJSON(e))}if(d=await this._fetchFeaturesFromMemory(s,c,u,i),d.length>=m&&m>0)return r(d,m,p)}}catch(f){s(u)}try{if(this._hasLocalSource)return y?d:h?await this._fetchFeaturesJSONFromService(c,u):await this._fetchFeaturesFromService(c,u);const t=await this.queryFeatureCount({view:a,filter:l,signal:u}),i=this.layer.capabilities.query.maxRecordCount;let s=-1===m?t:m;if(s=i&&s>i?i:s,t<=d.length||d.length>=i)return d;if(c.maxAllowableOffset=e.resolution||(a?a.extent.width/a.width/a.scale:P(this.layer.spatialReference))*H,t<=s)return h?await this._fetchFeaturesJSONFromService(c,u):await this._fetchFeaturesFromService(c,u);if(t<=W){const e=this.layer.createQuery();C(e,l);const t=await this.layer.queryObjectIds();return c.objectIds=r(t,s,p),h?await this._fetchFeaturesJSONFromService(c,u):await this._fetchFeaturesFromService(c,u)}return this.layer.capabilities?.query?.supportsPagination&&(c.num=Math.min(s,W)),h?await this._fetchFeaturesJSONFromService(c,u):await this._fetchFeaturesFromService(c,u)}catch(f){return s(u),d}}load(e){const t=this.layer.load(e).then(async t=>{this.geometryType=t.geometryType,this.objectIdField=t.objectIdField,this.supportsSQLExpression=t.capabilities?.query?.supportsSqlExpression,this._hasLocalSource=!t.url&&!!t.source,this.hasQueryEngine=this._hasLocalSource,this.minScale=t.minScale,this.maxScale=t.maxScale,this.fullExtent=t.fullExtent,this.workerClient=g.getInstance(),await this.workerClient.open(e.signal)});return this.addResolvingPromise(t),Promise.resolve(this)}};function K(e,t,r){const i=[],s=t.length;return t.forEach((t,a)=>{const[o,n]=t;let l=null;l=0!==a||r?a!==s-1||r?f(`${e} >= ${o}`,`${e} ${a===s-1?" <= ":" < "} ${n}`):`${e} >= ${o}`:`${e} < ${n}`,i.push("WHEN ("+l+") THEN "+(a+1))}),["CASE",i.join(" "),"ELSE 0","END"].join(" ")}e([a({readOnly:!0})],Z.prototype,"adapterName",void 0),e([a({constructOnly:!0})],Z.prototype,"layer",void 0),Z=e([o("esri.smartMapping.support.adapters.FeatureLayerAdapter")],Z);export{Z as default};
5
+ import{__decorate as e}from"tslib";import t from"../../../Graphic.js";import{pickRandom as r}from"../../../core/arrayUtils.js";import i from"../../../core/Error.js";import{throwIfAborted as s}from"../../../core/promiseUtils.js";import{property as a}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import{subclass as o}from"../../../core/accessorSupport/decorators/subclass.js";import{isHostedAgolService as n}from"../../../layers/support/arcgisLayerUrl.js";import{isTimeOnlyField as l,isNumericField as u}from"../../../layers/support/fieldUtils.js";import{generateRenderer as c}from"../../../rest/generateRenderer.js";import m from"../../../rest/support/GenerateRendererParameters.js";import h from"../../../rest/support/StatisticDefinition.js";import p from"../../../rest/support/UniqueValueDefinition.js";import{getArcadeForPredominantCategory as d,getSQLForPredominantCategoryName as y}from"../../statistics/support/predominanceUtils.js";import{mergeWhereClauses as f,getRangeExpr as F,getSQLFilterForNormalization as S}from"../../statistics/support/utils.js";import{WorkerClient as g}from"../../statistics/support/WorkerClient.js";import{isAnyDateField as v,isIntegerField as w,castIntegerFieldToFloat as _,fieldDelimiter as x}from"../utils.js";import q from"./InMemoryLayerAdapter.js";import{getQueryParamsForExpr as E,getDataRange as z,getAttributeBinsQuery as V,processQueryAttributeBinsResult as L,binParamsFromGenRend as T}from"./support/histogramUtils.js";import{ensureFeaturesJSON as b,getSummaryStatsQuery as j,getSummaryStatisticsFromFeatureSet as Q,getSummaryStatsQueryForFields as N,getUVQuery as M,getUniqueValuesFromFeatureSet as B,defaultNumBins as C,updateQueryWithFeatureFilter as $,getHistogramFromFeatureSet as O,getFieldExpr as R,getDomainsForFields as I,getBins as k,getPredominantCategoriesFromUVInfos as A,getMissingFields as D}from"./support/utils.js";import{processSummaryStatisticsResult as G,createUVResult as U,getEqualIntervalBins as P,createClassBreaksDefinition as J,resolveCBResult as W}from"../../../statistics/utils.js";import{getScaleToResolutionFactor as H}from"../../../views/2d/viewpointUtils.js";const Z=5,K=2e4,X=4e5;let Y=class extends q{constructor(){super(...arguments),this.adapterName="feature-layer-adapter"}_isStatsSupportedOnService(){const e=this.layer;if(!e.capabilities?.query?.supportsStatistics||"multipatch"===this.geometryType&&!n(e.url)&&e.version<10.5)throw new i(`${this.adapterName}:not-supported`,"Layer does not support statistics query");return Promise.resolve()}_fetchFeaturesFromService(e,t){return this.layer.queryFeatures(e,{signal:t}).then(e=>e.features)}_fetchFeaturesJSONFromService(e,t){return this._fetchFeaturesFromService(e,t).then(b)}_summaryStatsFromGenRend(e){const t=e.normalizationType,r=e.normalizationField;return this.classBreaks({field:e.field,numClasses:Z,classificationMethod:"standard-deviation",standardDeviationInterval:.25,normalizationType:t,normalizationField:"field"===t?r:void 0,minValue:e.minValue,maxValue:e.maxValue,filter:e.filter,signal:e.signal}).then(t=>{let r,i,s;if(t.classBreakInfos?.some(e=>(e.hasAvg&&(r=e),!!r)),r){const e=r.maxValue-r.minValue;i=r.minValue+e/2,s=4*e}const a={min:t.minValue,max:t.maxValue,avg:i,stddev:s};return G(a,e.outStatisticTypes)})}async _summaryStatsFromServiceQuery(e,t){await this._isStatsSupportedOnService(),"percent-of-total"===e.normalizationType&&(e.normalizationTotal=await this._getNormalizationTotal(e.field,e.normalizationType,e.filter));const r=v(t)||l(t),i="capabilities"in this.layer?this.layer.capabilities:null,s=j(this,e,t,i?.query?.supportsPercentileStatistics??!1),a=await this.layer.queryFeatures(s,{signal:e.signal}),o=Q(a,r);return G(o,e.outStatisticTypes)}async _summaryStatsForFieldsBasic(e){const{outStatisticTypes:t,fields:r}=e,i=50,s=[];for(let n=0;n<r.length;n+=i){const t=r.slice(n,n+i),a=N(this,e,t);s.push(this.layer.queryFeatures(a,{signal:e.signal}))}const a=(await Promise.all(s)).flatMap(e=>e.features).map(e=>e.attributes).reduce((e,t)=>Object.assign(e,t),{}),o={};for(const n in a){const e=n.match(/^(\w+)_value_/);if(null==a[n]||!e)continue;switch(e[1]){case"min":o.min=null==o.min?a[n]:Math.min(o.min,a[n]);break;case"max":o.max=null==o.max?a[n]:Math.max(o.max,a[n]);break;case"sum":o.sum=(o.sum||0)+a[n];break;case"count":o.count=(o.count||0)+a[n]}}return G(o,t)}async _summaryStatsForFieldsAdvanced(e,t){const{outStatisticTypes:r,fields:i}=e,s=r?.exclude?.includes("variance")||r?.include&&!r.include.includes("variance"),a=r?.exclude?.includes("stddev")||r?.include&&!r.include.includes("stddev");if(null==t.sum||!t.count||s&&a)return t;t.avg=t.sum/t.count;const o=50,n=[];for(let u=0;u<i.length;u+=o){const r=i.slice(u,u+o),s=N(this,e,r);s.outStatistics=[];for(const e of r){const r=`sumOfSquares_${e}`,i=`(power(${w(this.layer,e)?_(e):e} - ${t.avg}, 2))`,a=new h({statisticType:"sum",onStatisticField:i,outStatisticFieldName:r});s.outStatistics.push(a)}n.push(this.layer.queryFeatures(s,{signal:e.signal}))}const l=(await Promise.all(n)).reduce((e,t)=>e+Object.values(t.features[0].attributes).reduce((e,t)=>e+t,0),0);return t.variance=l/(t.count-1),t.stddev=Math.sqrt(t.variance),G(t,r)}async _summaryStatsForFields(e){const t=await this._summaryStatsForFieldsBasic(e);return this._summaryStatsForFieldsAdvanced(e,t)}_uvFromGenRenderer(e,t){const r=e.field??void 0,i=new p({attributeField:r}),s=new m({classificationDefinition:i});return this.generateRenderer(s,e.signal).then(e=>{const t={},i=this.getField(r);return e.uniqueValues.forEach(e=>{let r=e.value;null!=r&&""!==r&&("string"!=typeof r||""!==r.trim()&&"<null>"!==r.toLowerCase())||(r=null),null==t[r]?t[r]={count:e.count,data:u(i)&&r?Number(r):r}:t[r].count=t[r].count+e.count}),{count:t}}).then(r=>U(r,[t],e.returnAllCodedValues))}async _uvFromServiceQuery(e,t){return this._isStatsSupportedOnService().then(()=>this.layer.queryFeatures(M(this,e),{signal:e.signal})).then(t=>B(t,{layer:this,field:e.field,field2:e.field2,field3:e.field3,fieldDelimiter:x,view:e.view,signal:e.signal})).then(r=>U(r,t,e.returnAllCodedValues,x))}_getNormalizationTotal(e,t,r,i){return e&&"percent-of-total"===t?this.summaryStatistics({field:e,outStatisticTypes:{include:["sum"]},filter:r,signal:i}).then(e=>e.sum):Promise.resolve(null)}_histogramForExpr(e){return this._getNormalizationTotal(e.field,e.normalizationType,e.filter,e.signal).then(t=>{const r=E(e,this,t);return z(r,this,e.minValue,e.maxValue).then(i=>{const s=i.min,a=i.max;if(null==s||null==a)return{bins:[],minValue:s,maxValue:a,normalizationTotal:t};const o=e.numBins||C,n=P(s,a,o),l=ee(r.sqlExpression,n,null!=e.minValue&&null!=e.maxValue),u=new h({statisticType:"count",outStatisticFieldName:"countOFExpr",onStatisticField:"1"}),c=this.layer.createQuery();return c.where=f(c.where,r.sqlWhere),c.sqlFormat="standard",c.outStatistics=[u],c.groupByFieldsForStatistics=[l],c.orderByFields=[l],$(c,e.filter),this._isStatsSupportedOnService().then(()=>this.layer.queryFeatures(c,{signal:r.signal})).then(e=>O(e,s,a,o,t))})})}async _histogramFromQueryAttributeBins(e){const{field:t,normalizationType:r,filter:i,signal:s}=e,a=await this._getNormalizationTotal(t,r,i,s),o=this.layer.createQuery(),{query:n,min:l,max:u}=await V(e,this,a,o?.where);if(!n)return{bins:[],minValue:l,maxValue:u,normalizationTotal:a};const c=await this.layer.queryAttributeBins(n,{signal:s});return L(c,t?this.getField(t):null,{minValue:l,maxValue:u,normalizationTotal:a})}_classBreaksFromGenRend(e){const{field:t,normalizationType:r,normalizationField:i,normalizationTotal:s,signal:a}=e,o=S({field:t,normalizationType:r,normalizationField:i}),n=R({field:t,normalizationType:r,normalizationField:i,normalizationTotal:s,layer:this}),l=F(n,e.minValue,e.maxValue),u=J({field:t,normalizationType:r,normalizationField:i,classificationMethod:e.classificationMethod,standardDeviationInterval:e.standardDeviationInterval,breakCount:e.numClasses||Z}),c=new m({classificationDefinition:u});return c.where=f(o,l),this.generateRenderer(c,a).then(t=>W(t,e.classificationMethod))}async summaryStatistics(e){const{field:t,fields:r,normalizationType:a,valueExpression:o,sqlExpression:n,view:u,features:c,useFeaturesInView:m}=e,h=t?this.getField(t):null,p=v(h)||l(h),d=o&&!(n&&this.supportsSQLExpression),y=this._hasLocalSource||c||m,f=u&&"3d"===u.type;if(r?.length)return this._summaryStatsForFields({...e,fields:r});if(y||d)return d||c||m||f?this._summaryStatsFromMemory(e,h):this._summaryStatsFromClientQuery(e,h);if(!this.supportsSQLExpression&&(p||n||"natural-log"===a||"square-root"===a))throw new i(`${this.adapterName}:not-supported`,"Layer does not support standardized SQL expression for queries");return(a&&!this.supportsSQLExpression?this._summaryStatsFromGenRend(e):this._summaryStatsFromServiceQuery(e,h)).catch(()=>(s(e.signal),this._summaryStatsFromMemory(e,h)))}async uniqueValues(e){const{valueExpression:t,sqlExpression:r,features:i,useFeaturesInView:a,signal:o}=e,n=t&&!(r&&this.supportsSQLExpression),l=this._hasLocalSource||i||a||n,u=e.view,c=u&&"3d"===u.type,m=await I(e,this);return l?n||i||a||c?this._uvFromMemory(e,m):this._uvFromClientQuery(e,m):this._uvFromServiceQuery(e,m).catch(t=>(s(o),!e.field||e.field2||e.field3||e.filter?t:this._uvFromGenRenderer(e,m[0]))).catch(()=>(s(o),c?this._uvFromMemory(e,m):this._uvFromClientQuery(e,m)))}async histogram(e){const{field:t,normalizationType:r,normalizationField:a,classificationMethod:o,view:n,filter:u,signal:c}=e,m=t?this.getField(t):null,h=v(m)||l(m),p=e.valueExpression||e.sqlExpression,d=e.valueExpression&&!(e.sqlExpression&&this.supportsSQLExpression),y=this._hasLocalSource||e.features||e.useFeaturesInView||d,f=this.supportsSQLExpression,S=!o||"equal-interval"===o,g=e.minValue,w=e.maxValue,_=null!=g&&null!=w,x=e.numBins||C;if(y)return this._histogramFromMemory(e);if(this.layer.capabilities?.operations?.supportsQueryBins&&e.useQueryAttributeBins)try{return await this._histogramFromQueryAttributeBins(e)}catch{return s(c),this._histogramFromQueryAttributeBinsFromMemory(e)}if((p||f)&&S){if(!f&&(p||"natural-log"===r||"square-root"===r))throw new i(`${this.adapterName}:not-supported`,"Layer does not support standardized SQL expression for queries");return this._histogramForExpr(e)}if(h&&S)throw new i(`${this.adapterName}:not-supported`,"Normalization and date field are not allowed when layer does not support standardized SQL expression for queries");return r||!S?T(e,this).then(s=>{if(!_)return k(this,s,t,x,n,u,c);if(g>s.max||w<s.min)throw new i(`${this.adapterName}:insufficient-data`,"Range defined by 'minValue' and 'maxValue' does not intersect available data range of the field");if(S)return k(this,{min:g,max:w,sqlExpr:s.sqlExpr,excludeZerosExpr:s.excludeZerosExpr},t,x,n,u,c);{const i={field:t,normalizationType:r,normalizationField:a,normalizationTotal:s.normTotal,layer:this},o=R(i),l=F(o,g,w);return T(e,this,l).then(e=>k(this,e,t,x,n,u,c))}}):this._histogramForField(e)}async classBreaks(e){const t=!1!==e.analyzeData,r=this._hasLocalSource||e.features||e.useFeaturesInView||e.valueExpression||e.filter;if(t&&r)return this._classBreaksFromMemory(e);return(t?this._classBreaksFromGenRend(e):this._classBreaksFromInterpolation(e)).catch(()=>(s(e.signal),this._classBreaksFromMemory(e)))}async queryFeatureCount(e){if(this._hasLocalSource)throw new i(`${this.adapterName}:not-supported`,"Layer does not support count query");const t=this.layer,r=t.createQuery();return r.where=f(r.where,e.whereClause),$(r,e.filter),t.queryFeatureCount(r,{signal:e.signal})}async generateRenderer(e,t){const r=this.layer;if(this._hasLocalSource||r.version<10.1)throw new i(`${this.adapterName}:not-supported`,"Layer does not support generateRenderer operation (requires ArcGIS Server version 10.1+)");const s=r.createQuery();return e.where=f(e.where,s.where),c(r.parsedUrl?.path??"",{source:r.dynamicDataSource??void 0,gdbVersion:r.gdbVersion??void 0},e,{signal:t})}async predominantCategories(e){if(!this._hasLocalSource&&!this.supportsSQLExpression)throw new i(`${this.adapterName}:not-supported`,"Layer does not support advanced SQL expressions and standardized queries");const{fields:t,view:r,signal:s,filter:a}=e,o=d(t),n=y(t),l=r&&this._hasLocalSource?await this._uvFromMemory({valueExpression:o,view:r,signal:s,filter:a}):await this._uvFromServiceQuery({sqlExpression:n.expression,valueExpression:o,signal:s,filter:a});return A(l.uniqueValueInfos,t)}async getSampleFeatures(e,i){const{view:a,requiredFields:o,returnGeometry:n,filter:l,signal:u}=e,c=e.sampleSize;if(null==c||0===c)return[];const m=this.layer.createQuery(),h=1,p="json"===i;m.outSpatialReference=a?.spatialReference,m.returnGeometry=!!n,m.outFields=o,$(m,l);let d=[],y=!1;if(a)try{const s=await a.whenLayerView(this.layer);if(y=!D(this,o,s).length,y){if(c>=1&&!e.filter&&"getSampleFeatures"in s){await this._waitForLayerViewUpdate(s);const e=await s.getSampleFeatures({minFeatureCount:c,sampleSize:c});if(null!=e)return p?e:e.map(e=>t.fromJSON(e))}if(d=await this._fetchFeaturesFromMemory(s,m,u,i),d.length>=c&&c>0)return r(d,c,h)}}catch(f){s(u)}try{if(this._hasLocalSource)return y?d:p?await this._fetchFeaturesJSONFromService(m,u):await this._fetchFeaturesFromService(m,u);const t=await this.queryFeatureCount({view:a,filter:l,signal:u}),i=this.layer.capabilities.query.maxRecordCount;let s=-1===c?t:c;if(s=i&&s>i?i:s,t<=d.length||d.length>=i)return d;if(m.maxAllowableOffset=e.resolution||(a?a.extent.width/a.width/a.scale:H(this.layer.spatialReference))*X,t<=s)return p?await this._fetchFeaturesJSONFromService(m,u):await this._fetchFeaturesFromService(m,u);if(t<=K){const e=this.layer.createQuery();$(e,l);const t=await this.layer.queryObjectIds();return m.objectIds=r(t,s,h),p?await this._fetchFeaturesJSONFromService(m,u):await this._fetchFeaturesFromService(m,u)}return this.layer.capabilities?.query?.supportsPagination&&(m.num=Math.min(s,K)),p?await this._fetchFeaturesJSONFromService(m,u):await this._fetchFeaturesFromService(m,u)}catch(f){return s(u),d}}load(e){const t=this.layer.load(e).then(async t=>{this.geometryType=t.geometryType,this.objectIdField=t.objectIdField,this.supportsSQLExpression=t.capabilities?.query?.supportsSqlExpression,this._hasLocalSource=!t.url&&!!t.source,this.hasQueryEngine=this._hasLocalSource,this.minScale=t.minScale,this.maxScale=t.maxScale,this.fullExtent=t.fullExtent,this.workerClient=g.getInstance(),await this.workerClient.open(e.signal)});return this.addResolvingPromise(t),Promise.resolve(this)}};function ee(e,t,r){const i=[],s=t.length;return t.forEach((t,a)=>{const[o,n]=t;let l=null;l=0!==a||r?a!==s-1||r?f(`${e} >= ${o}`,`${e} ${a===s-1?" <= ":" < "} ${n}`):`${e} >= ${o}`:`${e} < ${n}`,i.push("WHEN ("+l+") THEN "+(a+1))}),["CASE",i.join(" "),"ELSE 0","END"].join(" ")}e([a({readOnly:!0})],Y.prototype,"adapterName",void 0),e([a({constructOnly:!0})],Y.prototype,"layer",void 0),Y=e([o("esri.smartMapping.support.adapters.FeatureLayerAdapter")],Y);export{Y as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{isSome as e}from"../../../../core/arrayUtils.js";import{throwIfAborted as t}from"../../../../core/promiseUtils.js";import{CodedValue as n}from"../../../../layers/support/CodedValue.js";import"../../../../core/has.js";import l from"../../../../layers/support/CodedValueDomain.js";import"../../../../layers/support/Domain.js";import"../../../../layers/support/InheritedDomain.js";import"../../../../layers/support/RangeDomain.js";import i from"../../../../layers/support/Field.js";import{isStringField as o,isTimeOnlyField as a}from"../../../../layers/support/fieldUtils.js";import r from"../../../../rest/support/StatisticDefinition.js";import{noDominantCategoryField as s}from"../../../statistics/support/predominanceUtils.js";import{getRangeExpr as u,getSQLFilterForNormalization as c,mergeWhereClauses as m}from"../../../statistics/support/utils.js";import{isIntegerField as f,isAnyDateField as p,getDateDiffSQL as d,castIntegerFieldToFloat as y}from"../../utils.js";import{isNullCountSupported as g,statisticTypes as x,getEqualIntervalBins as v,processNullValue as h}from"../../../../statistics/utils.js";const F=/_value$/i,w=Math.LOG10E,E={SECOND:1e3,MINUTE:6e4,HOUR:36e5},S=10;function T(e){return e.map(e=>e.toJSON())}function V(e,t){const n=[],l=e.layer,i="featureReduction"in l?l.featureReduction:null,o="binning"===i?.type,a=null!=i&&"fields"in i?i.fields?.map(e=>e.name?.toLowerCase()).filter(Boolean):[];if(!o||!t)return n;for(const r of t)a.includes(r.toLowerCase())||n.push(r);return n}function z(e,t,n){const l=[];if(t)for(const i of t){const t=e.getField(i);t&&n&&"availableFields"in n&&!n.availableFields?.includes(t.name)&&l.push(t.name)}return l}function $(e,t){const n=e&&e.features;if(0===n?.length)return{avg:null,count:0,max:null,median:null,min:null,nullcount:0,stddev:null,sum:null,variance:null};const l=n?.[0]?.attributes,i={};for(const o in l)i[o.replace(F,"").toLowerCase()]=l[o];return null!=i.totalcount&&i.totalcount>=i.count&&(i.nullcount=i.totalcount-i.count),delete i.totalcount,i.min===i.max&&null!=i.min&&null==i.stddev&&(i.stddev=i.variance=0),t&&(["min","max","avg","stddev","sum","variance"].forEach(e=>{null!=i[e]&&(i[e]=Math.ceil(i[e]))}),i.min===i.max&&null!=i.min&&(i.avg=i.min,i.stddev=i.variance=0)),i}function C(e){const t=[],n=e.classBreaks,l=n[0].minValue,i=n[n.length-1].maxValue;n.forEach(e=>{t.push([e.minValue,e.maxValue])});const o={field:e.field,normalizationType:e.normalizationType,normalizationField:e.normalizationField,normalizationTotal:e.normalizationTotal,layer:e.layer};return{min:l,max:i,intervals:t,sqlExpr:j(o),excludeZerosExpr:e.where,normTotal:e.normalizationTotal}}function j(e){const{field:t,normalizationType:n,normalizationField:l,normalizationTotal:i,layer:o}=e,a=f(o,t);let r=t;return"percent-of-total"===n?r=`((${a?y(t):t} / ${i}) * 100)`:"log"===n?r=`(log(${t}) * ${w})`:"field"===n?r=`(${a?y(t):t} / ${l})`:"natural-log"===n?r=`(log(${a?y(t):t}))`:"square-root"===n&&(r=`(power(${a?y(t):t}, 0.5))`),r}function q(e,t){let n;if(t=t.toLowerCase(),e)for(const l in e)if(l.toLowerCase()!==t){n=e[l];break}return n}function b(e,t){let n;if(t=t.toLowerCase(),e)for(const l in e)if(l.toLowerCase()===t){n=e[l];break}return n}function O(e,t,n,l,i){const o={},a="countOFExpr";e&&e.features&&e.features.forEach(e=>{const t=e.attributes,n=q(t,a),l=b(t,a);null!=n&&null!=l&&0!==n&&(o[n]=l)});const r=[];return v(t,n,l).forEach((e,t)=>{const n=(t+1).toString();r.push({minValue:e[0],maxValue:e[1],count:o.hasOwnProperty(n)?o[n]:0})}),{bins:r,minValue:t,maxValue:n,normalizationTotal:i}}async function L(e,n){const l=e&&e.features,{field:i,field2:o,field3:a,fieldDelimiter:r,layer:s,view:u,signal:c,labels:m}=n,f=`countOF${!(!i||!o)?"Expr":i||"Expr"}`,p={};let d=!1;for(const t of l){const e=t.attributes,n=b(e,f);let l=i?b(e,i):q(e,f),s=o?b(e,o):null,u=a?b(e,a):null;null===l&&0===n&&(d=!0),(null==l||"string"==typeof l&&""===l.trim())&&(l=null),o&&(null==s||"string"==typeof s&&""===s.trim())&&(s=null),a&&(null==u||"string"==typeof u&&""===u.trim())&&(u=null);let c=l;o&&(c=`${h(c)}${r}${h(s)}`,a&&(c=`${c}${r}${h(u)}`)),null==p[c]?p[c]={count:n,data:c}:p[c].count=p[c].count+n}if(i&&d){const e=i+" is NULL";try{const t=await s.queryFeatureCount({whereClause:e,view:u,signal:c});return p.null.count=p.null.count+t,R(p,m)}catch{return t(c),R(p,m)}}return R(p,m)}function R(e,t){if(t)for(const n in e)e[n].label=t[n];return{count:e}}async function D(e,t,i){const o=e?i.getField(e):null,a=o?i.getFieldDomain(o.name):null;if(a)return a;const{uniqueValueInfos:r}=await i.uniqueValues({field:e,sqlWhere:t.sqlWhere,features:t.features,useFeaturesInView:t.useFeaturesInView,view:t.view,signal:t.signal}),s=r.map(e=>new n({code:e.value}));return new l({codedValues:s})}async function I(e,t){if(!e.returnAllCodedValues)return[];const{field:n,field2:l,field3:i}=e;if(n&&!l){const e=n?t.getField(n):null,l=e?t.getFieldDomain(e.name):null;return l?[l]:[]}const o=[];return n&&(o.push(D(n,e,t)),l&&(o.push(D(l,e,t)),i&&o.push(D(i,e,t)))),Promise.all(o)}function N(e,t){return d(e,new Date(0),t,"milliseconds").sqlExpression}function U(e,t){return`EXTRACT(${t} FROM ${e}) * ${E[t]}`}function M(e){if(!e)return null;return y(["HOUR","MINUTE","SECOND"].map(t=>`(${U(e,t)})`).join(" + "))}function B(e){return{viewingMode:"2d"===e.type?"map":e.viewingMode,scale:e.scale,spatialReference:e.spatialReference?.toJSON()}}function Q(e,t){const n=new Set(e.map(e=>e.value)),l=t.filter(e=>!n.has(e));for(const i of l)e.push({value:i,count:0});e.sort((e,n)=>t.indexOf(e.value)-t.indexOf(n.value));for(const i of e)i.value===s&&(i.value=null);return{predominantCategoryInfos:e}}function P(t){const n="featureReduction"in t?t.featureReduction:null;return((null!=n&&"fields"in n?n.fields:null)??[]).map(e=>{const n=W(e,t.fieldsIndex);return n?new i({type:n,name:e.name,alias:e.alias}):null}).filter(e)}function W(e,t){switch(e.statisticType){case"avg":case"avg_angle":return"double";case"count":return"integer";case"min":case"max":case"sum":return e.onStatisticField?t.get(e.onStatisticField)?.type??null:e.onStatisticExpression?"string"===e.onStatisticExpression.returnType?null:"double":null;case"mode":return e.onStatisticField?t.get(e.onStatisticField)?.type??null:e.onStatisticExpression?"string"===e.onStatisticExpression.returnType?"string":"double":null;default:return null}}function _(e,t){return p(t)?N(e,t?.name):a(t)?M(t?.name):null}function k(e,t,n,l=!0){const{field:i,normalizationType:a,normalizationField:s,normalizationTotal:f,minValue:p,maxValue:d,filter:y}=t,v=e.supportsSQLExpression?_(e,n)||t.sqlExpression:null,h=j({field:i,normalizationType:a,normalizationField:s,normalizationTotal:f,layer:e}),F=v||h,w=F?u(F,p,d):null,E=c({field:i,normalizationField:s,normalizationType:a}),S=m(t.sqlWhere,E),T=m(S,w),V=g({normalizationField:s,normalizationType:a,sqlExpression:v,supportsSQLExpression:e.supportsSQLExpression,minValue:p,maxValue:d}),z=o(e.getField(i??void 0)),{include:$,exclude:C}=t.outStatisticTypes||{},q=x.filter(e=>(!$||$.includes(e))&&(!C||!C.includes(e))&&("nullcount"===e?V:!z||"count"===e)&&("median"!==e||l)),b=e.createQuery();return b.where=m(b.where,T),b.sqlFormat=v?"standard":null,b.outStatistics=q.map(t=>{const n=new r;let l=null,i=null,o=`${t}_value`;if("variance"===t)l="var",i=F;else if("nullcount"===t){const t=e.objectIdField;l="count",i=t&&e.getField(t)?t:"1",o="totalcount_value"}else"median"===t?(l="percentile-continuous",i=F,n.statisticParameters={value:.5}):(l=t,i=F);return n.statisticType=l,n.onStatisticField=i,n.outStatisticFieldName=o,n}),A(b,y),b}function A(e,t){t&&(e.geometry=t.geometry,e.spatialRelationship=t.spatialRelationship)}function H(e,t){const{field:n,field2:l,field3:i,sqlExpression:o}=t,a=!(!n||!l),r=e.createQuery();return r.where=m(r.where,t.sqlWhere),r.sqlFormat=o?"standard":null,r.outStatistics=[J(a?null:n,a?"1":o)].filter(Boolean),r.groupByFieldsForStatistics=[n||o,l,i].filter(Boolean),A(r,t.filter),r}function J(e,t){const n="countOF"+(e||"Expr"),l=new r;return l.statisticType="count",l.onStatisticField=t?"1":e,l.outStatisticFieldName=n,l}function Z(e,t,n,l=S,i,o,a){const{min:r,max:s,normTotal:u,excludeZerosExpr:c}=t,m=t.intervals||v(r,s,l),f=t.sqlExpr||n;return G(e,m,f,c,i,o,a).then(e=>({bins:e.map((e,t)=>({minValue:m[t][0],maxValue:m[t][1],count:"fulfilled"===e.status?e.value:0})),minValue:r,maxValue:s,normalizationTotal:u}))}function G(e,t,n,l,i,o,a){const r=[],s=t.length;for(let u=0;u<s;u++){const e=m(l,m(n+" >= "+t[u][0],null!==t[u][1]?n+(u===s-1?" <= ":" < ")+t[u][1]:""));r.push(e)}return Promise.allSettled(r.map(t=>e.queryFeatureCount({whereClause:t,view:i,filter:o,signal:a})))}export{S as defaultNumBins,T as ensureFeaturesJSON,C as generateBinParams,W as getAggregateFieldType,Z as getBins,I as getDomainsForFields,P as getFeatureReductionFields,j as getFieldExpr,O as getHistogramFromFeatureSet,z as getMissingFields,V as getMissingFieldsForBinning,Q as getPredominantCategoriesFromUVInfos,_ as getSQLExpressionForDateOrTimeField,$ as getSummaryStatisticsFromFeatureSet,k as getSummaryStatsQuery,H as getUVQuery,L as getUniqueValuesFromFeatureSet,B as getViewInfoParams,M as msForTimeOnlyFieldSQL,N as msSinceUnixEpochSQL,A as updateQueryWithFeatureFilter};
5
+ import{isSome as t}from"../../../../core/arrayUtils.js";import{throwIfAborted as e}from"../../../../core/promiseUtils.js";import{CodedValue as n}from"../../../../layers/support/CodedValue.js";import"../../../../core/has.js";import i from"../../../../layers/support/CodedValueDomain.js";import"../../../../layers/support/Domain.js";import"../../../../layers/support/InheritedDomain.js";import"../../../../layers/support/RangeDomain.js";import l from"../../../../layers/support/Field.js";import{isStringField as o,isTimeOnlyField as a}from"../../../../layers/support/fieldUtils.js";import r from"../../../../rest/support/StatisticDefinition.js";import{noDominantCategoryField as s}from"../../../statistics/support/predominanceUtils.js";import{getRangeExpr as u,getSQLFilterForNormalization as c,mergeWhereClauses as m}from"../../../statistics/support/utils.js";import{isIntegerField as f,isAnyDateField as p,getDateDiffSQL as d,castIntegerFieldToFloat as y}from"../../utils.js";import{isNullCountSupported as g,statisticTypes as x,getEqualIntervalBins as h,processNullValue as v}from"../../../../statistics/utils.js";const F=/_value$/i,w=Math.LOG10E,S={SECOND:1e3,MINUTE:6e4,HOUR:36e5},E=10;function T(t){return t.map(t=>t.toJSON())}function V(t,e){const n=[],i=t.layer,l="featureReduction"in i?i.featureReduction:null,o="binning"===l?.type,a=null!=l&&"fields"in l?l.fields?.map(t=>t.name?.toLowerCase()).filter(Boolean):[];if(!o||!e)return n;for(const r of e)a.includes(r.toLowerCase())||n.push(r);return n}function $(t,e,n){const i=[];if(e)for(const l of e){const e=t.getField(l);e&&n&&"availableFields"in n&&!n.availableFields?.includes(e.name)&&i.push(e.name)}return i}function z(t,e){const n=t&&t.features;if(0===n?.length)return{avg:null,count:0,max:null,median:null,min:null,nullcount:0,stddev:null,sum:null,variance:null};const i=n?.[0]?.attributes,l={};for(const o in i)l[o.replace(F,"").toLowerCase()]=i[o];return null!=l.totalcount&&l.totalcount>=l.count&&(l.nullcount=l.totalcount-l.count),delete l.totalcount,l.min===l.max&&null!=l.min&&null==l.stddev&&(l.stddev=l.variance=0),e&&(["min","max","avg","stddev","sum","variance"].forEach(t=>{null!=l[t]&&(l[t]=Math.ceil(l[t]))}),l.min===l.max&&null!=l.min&&(l.avg=l.min,l.stddev=l.variance=0)),l}function C(t){const e=[],n=t.classBreaks,i=n[0].minValue,l=n[n.length-1].maxValue;n.forEach(t=>{e.push([t.minValue,t.maxValue])});const o={field:t.field,normalizationType:t.normalizationType,normalizationField:t.normalizationField,normalizationTotal:t.normalizationTotal,layer:t.layer};return{min:i,max:l,intervals:e,sqlExpr:j(o),excludeZerosExpr:t.where,normTotal:t.normalizationTotal}}function j(t){const{field:e,normalizationType:n,normalizationField:i,normalizationTotal:l,layer:o}=t,a=f(o,e);let r=e;return"percent-of-total"===n?r=`((${a?y(e):e} / ${l}) * 100)`:"log"===n?r=`(log(${e}) * ${w})`:"field"===n?r=`(${a?y(e):e} / ${i})`:"natural-log"===n?r=`(log(${a?y(e):e}))`:"square-root"===n&&(r=`(power(${a?y(e):e}, 0.5))`),r}function q(t,e){let n;if(e=e.toLowerCase(),t)for(const i in t)if(i.toLowerCase()!==e){n=t[i];break}return n}function b(t,e){let n;if(e=e.toLowerCase(),t)for(const i in t)if(i.toLowerCase()===e){n=t[i];break}return n}function O(t,e,n,i,l){const o={},a="countOFExpr";t&&t.features&&t.features.forEach(t=>{const e=t.attributes,n=q(e,a),i=b(e,a);null!=n&&null!=i&&0!==n&&(o[n]=i)});const r=[];return h(e,n,i).forEach((t,e)=>{const n=(e+1).toString();r.push({minValue:t[0],maxValue:t[1],count:o.hasOwnProperty(n)?o[n]:0})}),{bins:r,minValue:e,maxValue:n,normalizationTotal:l}}async function L(t,n){const i=t&&t.features,{field:l,field2:o,field3:a,fieldDelimiter:r,layer:s,view:u,signal:c,labels:m}=n,f=`countOF${!(!l||!o)?"Expr":l||"Expr"}`,p={};let d=!1;for(const e of i){const t=e.attributes,n=b(t,f);let i=l?b(t,l):q(t,f),s=o?b(t,o):null,u=a?b(t,a):null;null===i&&0===n&&(d=!0),(null==i||"string"==typeof i&&""===i.trim())&&(i=null),o&&(null==s||"string"==typeof s&&""===s.trim())&&(s=null),a&&(null==u||"string"==typeof u&&""===u.trim())&&(u=null);let c=i;o&&(c=`${v(c)}${r}${v(s)}`,a&&(c=`${c}${r}${v(u)}`)),null==p[c]?p[c]={count:n,data:c}:p[c].count=p[c].count+n}if(l&&d){const t=l+" is NULL";try{const e=await s.queryFeatureCount({whereClause:t,view:u,signal:c});return p.null.count=p.null.count+e,R(p,m)}catch{return e(c),R(p,m)}}return R(p,m)}function R(t,e){if(e)for(const n in t)t[n].label=e[n];return{count:t}}async function D(t,e,l){const o=t?l.getField(t):null,a=o?l.getFieldDomain(o.name):null;if(a)return a;const{uniqueValueInfos:r}=await l.uniqueValues({field:t,sqlWhere:e.sqlWhere,features:e.features,useFeaturesInView:e.useFeaturesInView,view:e.view,signal:e.signal}),s=r.map(t=>new n({code:t.value}));return new i({codedValues:s})}async function I(t,e){if(!t.returnAllCodedValues)return[];const{field:n,field2:i,field3:l}=t;if(n&&!i){const t=n?e.getField(n):null,i=t?e.getFieldDomain(t.name):null;return i?[i]:[]}const o=[];return n&&(o.push(D(n,t,e)),i&&(o.push(D(i,t,e)),l&&o.push(D(l,t,e)))),Promise.all(o)}function N(t,e){return d(t,new Date(0),e,"milliseconds").sqlExpression}function U(t,e){return`EXTRACT(${e} FROM ${t}) * ${S[e]}`}function M(t){if(!t)return null;return y(["HOUR","MINUTE","SECOND"].map(e=>`(${U(t,e)})`).join(" + "))}function Q(t){return{viewingMode:"2d"===t.type?"map":t.viewingMode,scale:t.scale,spatialReference:t.spatialReference?.toJSON()}}function B(t,e){const n=new Set(t.map(t=>t.value)),i=e.filter(t=>!n.has(t));for(const l of i)t.push({value:l,count:0});t.sort((t,n)=>e.indexOf(t.value)-e.indexOf(n.value));for(const l of t)l.value===s&&(l.value=null);return{predominantCategoryInfos:t}}function _(e){const n="featureReduction"in e?e.featureReduction:null;return((null!=n&&"fields"in n?n.fields:null)??[]).map(t=>{const n=P(t,e.fieldsIndex);return n?new l({type:n,name:t.name,alias:t.alias}):null}).filter(t)}function P(t,e){switch(t.statisticType){case"avg":case"avg_angle":return"double";case"count":return"integer";case"min":case"max":case"sum":return t.onStatisticField?e.get(t.onStatisticField)?.type??null:t.onStatisticExpression?"string"===t.onStatisticExpression.returnType?null:"double":null;case"mode":return t.onStatisticField?e.get(t.onStatisticField)?.type??null:t.onStatisticExpression?"string"===t.onStatisticExpression.returnType?"string":"double":null;default:return null}}function W(t,e){return p(e)?N(t,e?.name):a(e)?M(e?.name):null}function k(t,e,n){let i=null;for(const l of n){const n=l?t.getField(l):null,o=A(t,{...e,field:l,outStatisticTypes:{include:["min","max","sum","count"]}},n,!0,!0);i?i.outStatistics=i.outStatistics.concat(o.outStatistics):i=o}return i.where=t.createQuery()?.where,i}function A(t,e,n,i=!0,l=!1){const{field:a,normalizationType:s,normalizationField:f,normalizationTotal:p,minValue:d,maxValue:y,filter:h}=e,v=t.supportsSQLExpression?W(t,n)||e.sqlExpression:null,F=j({field:a,normalizationType:s,normalizationField:f,normalizationTotal:p,layer:t}),w=v||F,S=w?u(w,d,y):null,E=c({field:a,normalizationField:f,normalizationType:s}),T=m(e.sqlWhere,E),V=m(T,S),$=g({normalizationField:f,normalizationType:s,sqlExpression:v,supportsSQLExpression:t.supportsSQLExpression,minValue:d,maxValue:y}),z=o(t.getField(a??void 0)),{include:C,exclude:q}=e.outStatisticTypes||{},b=x.filter(t=>(!C||C.includes(t))&&(!q||!q.includes(t))&&("nullcount"===t?$:!z||"count"===t)&&("median"!==t||i)),O=t.createQuery();return O.where=m(O.where,V),O.sqlFormat=v?"standard":null,O.outStatistics=b.map(e=>{const n=new r;let i=null,o=null,s=`${e}_value${l?`_${a}`:""}`;if("variance"===e)i="var",o=w;else if("nullcount"===e){const e=t.objectIdField;i="count",o=e&&t.getField(e)?e:"1",s="totalcount_value"}else"median"===e?(i="percentile-continuous",o=w,n.statisticParameters={value:.5}):(i=e,o=w);return n.statisticType=i,n.onStatisticField=o,n.outStatisticFieldName=s,n}),H(O,h),O}function H(t,e){e&&(t.geometry=e.geometry,t.spatialRelationship=e.spatialRelationship)}function J(t,e){const{field:n,field2:i,field3:l,sqlExpression:o}=e,a=!(!n||!i),r=t.createQuery();return r.where=m(r.where,e.sqlWhere),r.sqlFormat=o?"standard":null,r.outStatistics=[Z(a?null:n,a?"1":o)].filter(Boolean),r.groupByFieldsForStatistics=[n||o,i,l].filter(Boolean),H(r,e.filter),r}function Z(t,e){const n="countOF"+(t||"Expr"),i=new r;return i.statisticType="count",i.onStatisticField=e?"1":t,i.outStatisticFieldName=n,i}function G(t,e,n,i=E,l,o,a){const{min:r,max:s,normTotal:u,excludeZerosExpr:c}=e,m=e.intervals||h(r,s,i),f=e.sqlExpr||n;return X(t,m,f,c,l,o,a).then(t=>({bins:t.map((t,e)=>({minValue:m[e][0],maxValue:m[e][1],count:"fulfilled"===t.status?t.value:0})),minValue:r,maxValue:s,normalizationTotal:u}))}function X(t,e,n,i,l,o,a){const r=[],s=e.length;for(let u=0;u<s;u++){const t=m(i,m(n+" >= "+e[u][0],null!==e[u][1]?n+(u===s-1?" <= ":" < ")+e[u][1]:""));r.push(t)}return Promise.allSettled(r.map(e=>t.queryFeatureCount({whereClause:e,view:l,filter:o,signal:a})))}export{E as defaultNumBins,T as ensureFeaturesJSON,C as generateBinParams,P as getAggregateFieldType,G as getBins,I as getDomainsForFields,_ as getFeatureReductionFields,j as getFieldExpr,O as getHistogramFromFeatureSet,$ as getMissingFields,V as getMissingFieldsForBinning,B as getPredominantCategoriesFromUVInfos,W as getSQLExpressionForDateOrTimeField,z as getSummaryStatisticsFromFeatureSet,A as getSummaryStatsQuery,k as getSummaryStatsQueryForFields,J as getUVQuery,L as getUniqueValuesFromFeatureSet,Q as getViewInfoParams,M as msForTimeOnlyFieldSQL,N as msSinceUnixEpochSQL,H as updateQueryWithFeatureFilter};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{formatDate as t,convertDateFormatToIntlOptions as e,formatTimestamp as n,formatTimeOnly as o,formatDateOnly as r}from"../../intl/date.js";import{isDateField as i,isDateOnlyField as s,isTimestampOffsetField as a}from"../../layers/support/fieldUtils.js";import{getWellKnownBasemapId as l}from"../../support/basemapUtils.js";import{loadArcade as u}from"../../support/loadArcade.js";import{utc as m}from"../../time/constants.js";import{getTimeZoneFormattingOptions as d}from"../../time/timeZoneUtils.js";const f=",",c={light:["streets","gray","topo","terrain","oceans","osm","gray-vector","streets-vector","topo-vector","streets-relief-vector","streets-navigation-vector","topo-3d","navigation-3d","streets-3d","osm-3d","gray-3d"],dark:["satellite","hybrid","dark-gray","dark-gray-vector","streets-night-vector","navigation-dark-3d","streets-dark-3d","dark-gray-3d"]},p="percent-of-total",g="field",y={exclude:["median"]},h={years:365,months:30,days:1,hours:1/24,minutes:1/1440,seconds:1/86400,milliseconds:1/864e5},v=new Set(["integer","small-integer"]);let T=null;const Z=["date","date-only","timestamp-offset"];function $(t){return i(t)||s(t)||a(t)}async function U(t){const{field:e,field2:n,field3:o,normalizationField:r,valueExpression:i}=t;let s=[];if(i){if(!T){const{arcadeUtils:t}=await u();T=t}s=T.extractFieldNames(i)}return e&&s.push(e),n&&s.push(n),o&&s.push(o),r&&s.push(r),s}function w(t){let e=t.normalizationType;return e||(t.normalizationField?e=g:null!=t.normalizationTotal&&(e=p)),e??void 0}function S(t){return String(t).padStart(2,"0")}function k(t,e,n){let o;if("date"===e||"number"===e){"number"===e&&(t=new Date(t));o=`TIMESTAMP'${n?t.getFullYear():t.getUTCFullYear()}-${S((n?t.getMonth():t.getUTCMonth())+1)}-${S(n?t.getDate():t.getUTCDate())} ${S(n?t.getHours():t.getUTCHours())}:${S(n?t.getMinutes():t.getUTCMinutes())}:${S(n?t.getSeconds():t.getUTCSeconds())}'`}else o=t;return o}function C(t,e,n,o){const{hasQueryEngine:r}=t,i=`(${k(n,D(t,n),r)} - ${k(e,D(t,e),r)})`;let s=h[o],a="/";s<1&&(s=1/s,a="*");return{sqlExpression:1===s?i:`(${i} ${a} ${s})`,sqlWhere:null}}function D(t,e){if(e instanceof Date)return"date";if("number"==typeof e)return"number";if("string"==typeof e){const n=t.getField(e);if("<now>"===e.toLowerCase())return;if(i(n))return"field"}}function F(t,e=c){for(const n in e)if(e[n].includes(t))return n}function b(t,e,n=!0){let o=null;return t&&("string"==typeof t?e.includes(t)&&(o=t):o=l(t)),n?o||"gray":o}function j(t,e){const n=e&&t.getField(e);return!!n&&v.has(n.type)}function M(t){return`cast(${t} as float)`}function N(i,s){const{format:a,timeZoneOptions:l,fieldType:u}=s??{};let f,c;if(l&&({timeZone:f,timeZoneName:c}=d(l.layerTimeZone,l.datesInUnknownTimezone,l.viewTimeZone,e(a||"short-date-short-time"),u)),"string"==typeof i&&isNaN(Date.parse("time-only"===u?`1970-01-01T${i}Z`:i)))return i;switch(u){case"date-only":{const n=e(a||"short-date");return"string"==typeof i?r(i,{...n}):t(i,{...n,timeZone:m})}case"time-only":{const n=e(a||"short-time");return"string"==typeof i?o(i,n):t(i,{...n,timeZone:m})}case"timestamp-offset":{if(!f&&"string"==typeof i&&new Date(i).toISOString()!==i)return i;const o=a||l?e(a||"short-date-short-time"):void 0,r=o?{...o,timeZone:f,timeZoneName:c}:void 0;return"string"==typeof i?n(i,r):t(i,r)}default:{const n=a||l?e(a||"short-date-short-time"):void 0;return t("string"==typeof i?new Date(i):i,n?{...n,timeZone:f,timeZoneName:c}:void 0)}}}export{M as castIntegerFieldToFloat,Z as dateTypes,c as defaultBasemapGroups,y as defaultStatisticTypes,f as fieldDelimiter,N as formatAnyDate,F as getBasemapGroup,b as getBasemapId,C as getDateDiffSQL,D as getDateType,U as getFieldsList,w as getNormalizationType,$ as isAnyDateField,j as isIntegerField,h as unitValueInDays};
5
+ import{formatDate as t,convertDateFormatToIntlOptions as e,formatTimestamp as n,formatTimeOnly as o,formatDateOnly as r}from"../../intl/date.js";import{isDateField as i,isDateOnlyField as s,isTimestampOffsetField as a}from"../../layers/support/fieldUtils.js";import{getWellKnownBasemapId as l}from"../../support/basemapUtils.js";import{loadArcade as u}from"../../support/loadArcade.js";import{utc as d}from"../../time/constants.js";import{getTimeZoneFormattingOptions as m}from"../../time/timeZoneUtils.js";const f=",",c={light:["streets","gray","topo","terrain","oceans","osm","gray-vector","streets-vector","topo-vector","streets-relief-vector","streets-navigation-vector","topo-3d","navigation-3d","streets-3d","osm-3d","gray-3d"],dark:["satellite","hybrid","dark-gray","dark-gray-vector","streets-night-vector","navigation-dark-3d","streets-dark-3d","dark-gray-3d"]},p="percent-of-total",g="field",y={exclude:["median"]},h={years:365,months:30,days:1,hours:1/24,minutes:1/1440,seconds:1/86400,milliseconds:1/864e5},v=new Set(["integer","small-integer"]);let T=null;const Z=["date","date-only","timestamp-offset"];function $(t){return i(t)||s(t)||a(t)}async function U(t){const{field:e,field2:n,field3:o,normalizationField:r,valueExpression:i,fields:s}=t;let a=[];if(i){if(!T){const{arcadeUtils:t}=await u();T=t}a=T.extractFieldNames(i)}return e&&a.push(e),n&&a.push(n),o&&a.push(o),r&&a.push(r),s&&a.push(...s),a}function w(t){let e=t.normalizationType;return e||(t.normalizationField?e=g:null!=t.normalizationTotal&&(e=p)),e??void 0}function S(t){return String(t).padStart(2,"0")}function k(t,e,n){let o;if("date"===e||"number"===e){"number"===e&&(t=new Date(t));o=`TIMESTAMP'${n?t.getFullYear():t.getUTCFullYear()}-${S((n?t.getMonth():t.getUTCMonth())+1)}-${S(n?t.getDate():t.getUTCDate())} ${S(n?t.getHours():t.getUTCHours())}:${S(n?t.getMinutes():t.getUTCMinutes())}:${S(n?t.getSeconds():t.getUTCSeconds())}'`}else o=t;return o}function C(t,e,n,o){const{hasQueryEngine:r}=t,i=`(${k(n,D(t,n),r)} - ${k(e,D(t,e),r)})`;let s=h[o],a="/";s<1&&(s=1/s,a="*");return{sqlExpression:1===s?i:`(${i} ${a} ${s})`,sqlWhere:null}}function D(t,e){if(e instanceof Date)return"date";if("number"==typeof e)return"number";if("string"==typeof e){const n=t.getField(e);if("<now>"===e.toLowerCase())return;if(i(n))return"field"}}function F(t,e=c){for(const n in e)if(e[n].includes(t))return n}function b(t,e,n=!0){let o=null;return t&&("string"==typeof t?e.includes(t)&&(o=t):o=l(t)),n?o||"gray":o}function j(t,e){const n=e&&t.getField(e);return!!n&&v.has(n.type)}function M(t){return`cast(${t} as float)`}function N(i,s){const{format:a,timeZoneOptions:l,fieldType:u}=s??{};let f,c;if(l&&({timeZone:f,timeZoneName:c}=m(l.layerTimeZone,l.datesInUnknownTimezone,l.viewTimeZone,e(a||"short-date-short-time"),u)),"string"==typeof i&&isNaN(Date.parse("time-only"===u?`1970-01-01T${i}Z`:i)))return i;switch(u){case"date-only":{const n=e(a||"short-date");return"string"==typeof i?r(i,{...n}):t(i,{...n,timeZone:d})}case"time-only":{const n=e(a||"short-time");return"string"==typeof i?o(i,n):t(i,{...n,timeZone:d})}case"timestamp-offset":{if(!f&&"string"==typeof i&&new Date(i).toISOString()!==i)return i;const o=a||l?e(a||"short-date-short-time"):void 0,r=o?{...o,timeZone:f,timeZoneName:c}:void 0;return"string"==typeof i?n(i,r):t(i,r)}default:{const n=a||l?e(a||"short-date-short-time"):void 0;return t("string"==typeof i?new Date(i):i,n?{...n,timeZone:f,timeZoneName:c}:void 0)}}}export{M as castIntegerFieldToFloat,Z as dateTypes,c as defaultBasemapGroups,y as defaultStatisticTypes,f as fieldDelimiter,N as formatAnyDate,F as getBasemapGroup,b as getBasemapId,C as getDateDiffSQL,D as getDateType,U as getFieldsList,w as getNormalizationType,$ as isAnyDateField,j as isIntegerField,h as unitValueInDays};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{verticalLengthUnitFromSpatialReference as e,convertUnit as n}from"../core/unitUtils.js";import{getMetersPerUnit as t}from"../symbols/support/unitConversionUtils.js";function o(e){return e?j:z}function r(e,n){return n?.mode?n.mode:o(e).mode}function u(e,n){return null!=n?n:o(e)}function i(e,n){return r(null==e||(e.hasZ??!1),n)}function s(e,n){return u(null==e||(e.hasZ??!1),n)}function l(e){const n=g(e);return i(e.geometry,n)}function a(e){const n=g(e),t=i(e.geometry,n),o=null!=n&&"on-the-ground"!==t?R(n):0,r=n?.featureExpressionInfo;return{mode:t,offset:o,featureExpressionInfo:r}}function f(e){return v(a(e))}function c(e){return v(e)||d(e)}function d(e){return"0"===e?.featureExpressionInfo?.expression}function v(e){if(!e)return!1;if("on-the-ground"===e.mode)return!1;const n=e?.featureExpressionInfo?e.featureExpressionInfo.expression:null;return!(!n||"0"===n)}function g(e){return e.layer&&"elevationInfo"in e.layer?e.layer.elevationInfo:null}function h(t,o){if(!t?.offset)return 0;const{offset:r,unit:u}=t;if("decimal-degrees"===u)return 0;const i="unknown"!==u&&u?u:"meters",s=e(o);return s?n(r,i,s):0}function p(e,n,t){if(!t?.mode)return;const o=e.hasZ?e.z:0,r=h(t,e.spatialReference);switch(t.mode){case"absolute-height":return o-r;case"on-the-ground":return 0;case"relative-to-ground":return o-((n.elevationProvider.getElevation(e.x,e.y,o,e.spatialReference,"ground")??0)+r);case"relative-to-scene":return o-((n.elevationProvider.getElevation(e.x,e.y,o,e.spatialReference,"scene")??0)+r)}}function m(e,n,t,o=null){return E(e,n.x,n.y,n.hasZ?n.z:0,n.spatialReference,t,o)}function x(e,n,t,o,r=null){return E(e,n[0],n[1],n.length>2?n[2]:0,t,o,r)}function E(e,n,t,o,r,u,i=null){if(null==u)return;const s=null!=i?i.mode:"absolute-height";if("on-the-ground"===s)return 0;const{absoluteZ:l}=b(n,t,o,r,e,u);return I(l,n,t,o,r,e,i,s)}function b(e,n,t,o,r,u){const i=h(u,o);switch(u.mode){case"absolute-height":return{absoluteZ:t+i,elevation:0};case"on-the-ground":{const t=r.elevationProvider.getElevation(e,n,0,o,"ground")??0;return{absoluteZ:t,elevation:t}}case"relative-to-ground":{const u=r.elevationProvider.getElevation(e,n,t,o,"ground")??0;return{absoluteZ:t+u+i,elevation:u}}case"relative-to-scene":{const u=r.elevationProvider.getElevation(e,n,t,o,"scene")??0;return{absoluteZ:t+u+i,elevation:u}}}}function I(e,n,t,o,r,u,i,s){const l=h(i,r);switch(s){case"absolute-height":return e-l;case"relative-to-ground":return e-((u.elevationProvider.getElevation(n,t,o,r,"ground")??0)+l);case"relative-to-scene":return e-((u.elevationProvider.getElevation(n,t,o,r,"scene")??0)+l)}}function y(e,n){if(null==n)return!1;const{mode:t}=n;return null!=t&&("scene"===e&&"relative-to-scene"===t||"ground"===e&&"absolute-height"!==t)}function Z(e,n,t){return t&&t.mode!==n?`${e} only support ${n} elevation mode`:null}function P(e,n,t){return t?.mode===n?`${e} do not support ${n} elevation mode`:null}function w(e,n){return null!=n?.featureExpressionInfo&&"0"!==n.featureExpressionInfo.expression?`${e} do not support featureExpressionInfo`:null}function $(e,n){n&&e.warn(".elevationInfo=",n)}function R(e){return(e?.offset??0)*t(e?.unit)}const j={mode:"absolute-height",offset:0},z={mode:"on-the-ground",offset:null};export{j as absoluteHeightElevationInfo,y as elevationContextAffectsAlignment,Z as elevationModeRequiredMessage,P as elevationModeUnsupportedMessage,d as featureExpressionInfoIsZero,w as featureExpressionUnsupportedMessage,m as getConvertedElevation,x as getConvertedElevationFromVector,E as getConvertedElevationFromXYZ,u as getEffectiveElevationInfo,r as getEffectiveElevationMode,h as getElevationOffset,R as getElevationOffsetInMeters,s as getGeometryEffectiveElevationInfo,i as getGeometryEffectiveElevationMode,a as getGraphicEffectiveElevationInfo,l as getGraphicEffectiveElevationMode,p as getZForElevationMode,c as hasFeatureExpressionInfo,f as hasGraphicFeatureExpressionInfo,$ as logInvalidElevationInfoWarning,z as onTheGroundElevationInfo,b as zValueInAbsoluteHeightMode};
5
+ import{memoize as e}from"../core/memoize.js";import{verticalLengthUnitFromSpatialReference as n,convertUnit as t}from"../core/unitUtils.js";import{getMetersPerUnit as o}from"../symbols/support/unitConversionUtils.js";function r(e){return e?z:U}function u(e,n){return n?.mode?n.mode:r(e).mode}function i(e,n){return null!=n?n:r(e)}function s(e,n){return u(null==e||(e.hasZ??!1),n)}function l(e,n){return i(null==e||(e.hasZ??!1),n)}function a(e){const n=m(e);return s(e.geometry,n)}function f(e){const n=m(e),t=s(e.geometry,n),o=null!=n&&"on-the-ground"!==t?j(n):0,r=n?.featureExpressionInfo;return{mode:t,offset:o,featureExpressionInfo:r}}function c(e){return g(f(e))}function d(e){return g(e)||v(e)}function v(e){return"0"===e?.featureExpressionInfo?.expression}function g(e){if(!e)return!1;if("on-the-ground"===e.mode)return!1;const n=e?.featureExpressionInfo?e.featureExpressionInfo.expression:null;return!(!n||"0"===n)}function m(e){return e.layer&&"elevationInfo"in e.layer?e.layer.elevationInfo:null}const p=e((e,o)=>{if(!e?.offset)return 0;const{offset:r,unit:u}=e;if("decimal-degrees"===u)return 0;const i="unknown"!==u&&u?u:"meters",s=n(o);return s?t(r,i,s):0});function h(e,n,t){if(!t?.mode)return;const o=e.hasZ?e.z:0,r=p(t,e.spatialReference);switch(t.mode){case"absolute-height":return o-r;case"on-the-ground":return 0;case"relative-to-ground":return o-((n.elevationProvider.getElevation(e.x,e.y,o,e.spatialReference,"ground")??0)+r);case"relative-to-scene":return o-((n.elevationProvider.getElevation(e.x,e.y,o,e.spatialReference,"scene")??0)+r)}}function x(e,n,t,o=null){return b(e,n.x,n.y,n.hasZ?n.z:0,n.spatialReference,t,o)}function E(e,n,t,o,r=null){return b(e,n[0],n[1],n.length>2?n[2]:0,t,o,r)}function b(e,n,t,o,r,u,i=null){if(null==u)return;const s=null!=i?i.mode:"absolute-height";if("on-the-ground"===s)return 0;const{absoluteZ:l}=I(n,t,o,r,e,u);return y(l,n,t,o,r,e,i,s)}function I(e,n,t,o,r,u){const i=p(u,o);switch(u.mode){case"absolute-height":return{absoluteZ:t+i,elevation:0};case"on-the-ground":{const t=r.elevationProvider.getElevation(e,n,0,o,"ground")??0;return{absoluteZ:t,elevation:t}}case"relative-to-ground":{const u=r.elevationProvider.getElevation(e,n,t,o,"ground")??0;return{absoluteZ:t+u+i,elevation:u}}case"relative-to-scene":{const u=r.elevationProvider.getElevation(e,n,t,o,"scene")??0;return{absoluteZ:t+u+i,elevation:u}}}}function y(e,n,t,o,r,u,i,s){const l=p(i,r);switch(s){case"absolute-height":return e-l;case"relative-to-ground":return e-((u.elevationProvider.getElevation(n,t,o,r,"ground")??0)+l);case"relative-to-scene":return e-((u.elevationProvider.getElevation(n,t,o,r,"scene")??0)+l)}}function Z(e,n){if(null==n)return!1;const{mode:t}=n;return null!=t&&("scene"===e&&"relative-to-scene"===t||"ground"===e&&"absolute-height"!==t)}function P(e,n,t){return t&&t.mode!==n?`${e} only support ${n} elevation mode`:null}function w(e,n,t){return t?.mode===n?`${e} do not support ${n} elevation mode`:null}function $(e,n){return null!=n?.featureExpressionInfo&&"0"!==n.featureExpressionInfo.expression?`${e} do not support featureExpressionInfo`:null}function R(e,n){n&&e.warn(".elevationInfo=",n)}function j(e){return(e?.offset??0)*o(e?.unit)}const z={mode:"absolute-height",offset:0},U={mode:"on-the-ground",offset:null};export{z as absoluteHeightElevationInfo,Z as elevationContextAffectsAlignment,P as elevationModeRequiredMessage,w as elevationModeUnsupportedMessage,v as featureExpressionInfoIsZero,$ as featureExpressionUnsupportedMessage,x as getConvertedElevation,E as getConvertedElevationFromVector,b as getConvertedElevationFromXYZ,i as getEffectiveElevationInfo,u as getEffectiveElevationMode,p as getElevationOffset,j as getElevationOffsetInMeters,l as getGeometryEffectiveElevationInfo,s as getGeometryEffectiveElevationMode,f as getGraphicEffectiveElevationInfo,a as getGraphicEffectiveElevationMode,h as getZForElevationMode,d as hasFeatureExpressionInfo,c as hasGraphicFeatureExpressionInfo,R as logInvalidElevationInfoWarning,U as onTheGroundElevationInfo,I as zValueInAbsoluteHeightMode};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- const c="20250911",e="3280a2682bd702eaae066edc95f2dfc21e0bc73c";export{c as buildDate,e as commitHash};
5
+ const c="20250913",b="e4bcc3ff3df8a2b3e8372cd8bc976cc9848bfca2";export{c as buildDate,b as commitHash};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- export{default as AttributeTableAttachmentElement}from"./elements/AttributeTableAttachmentElement.js";export{default as AttributeTableFieldElement}from"./elements/AttributeTableFieldElement.js";export{default as AttributeTableGroupElement}from"./elements/AttributeTableGroupElement.js";export{default as AttributeTableRelationshipElement}from"./elements/AttributeTableRelationshipElement.js";
5
+ import{deprecatedModule as e}from"../core/deprecate.js";import t from"../core/Logger.js";export{default as AttributeTableAttachmentElement}from"./elements/AttributeTableAttachmentElement.js";export{default as AttributeTableFieldElement}from"./elements/AttributeTableFieldElement.js";export{default as AttributeTableGroupElement}from"./elements/AttributeTableGroupElement.js";export{default as AttributeTableRelationshipElement}from"./elements/AttributeTableRelationshipElement.js";e(t.getLogger("esri.tables.elements"),"esri.tables.elements",{replacement:"Individual element module imports",version:"4.34",warnOnce:!0});
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../../core/Error.js";import has from"../../../core/has.js";import{removeMaybe as t}from"../../../core/maybe.js";import{addFrameTask as r}from"../../../core/scheduling.js";import{signal as s}from"../../../core/signal.js";import{create as i}from"../../../core/libs/gl-matrix-2/factories/mat3f32.js";import{CIMAnalyzer as n}from"../../../symbols/cim/cimAnalyzer.js";import{Container as a}from"./Container.js";import{MAX_TILE_RESHUFFLES_PER_FRAME as o}from"./webgl/definitions.js";import h from"./webgl/Painter.js";import{ArrayBufferPool as d}from"./webgl/PooledUint32Array.js";import{Profiler as l}from"./webgl/Profiler.js";import{TileReshuffleManager as m}from"./webgl/TileReshuffleManager.js";import{startup as u,shutdown as c}from"./webgl/shaderGraph/techniques/TechniqueRegistry.js";import{MeshWriterRegistry as p}from"./webgl/shaderGraph/techniques/mesh/MeshWriterRegistry.js";import{Timeline as g}from"../support/Timeline.js";import{SizedPixelFormat as f,SizedDepthStencilFormat as _,PixelType as b}from"../../webgl/enums.js";import{FramebufferObject as w}from"../../webgl/FramebufferObject.js";import{RenderbufferDescriptor as R}from"../../webgl/RenderbufferDescriptor.js";import{RenderingContext as y}from"../../webgl/RenderingContext.js";import{RenderingContextOptions as x}from"../../webgl/RenderingContextOptions.js";import{TextureDescriptor as C}from"../../webgl/TextureDescriptor.js";const P=2e3;class j extends a{constructor(t,i,a){super(),this.meshWriterRegistry=new p,this._trash=new Set,this._renderRemainingTime=0,this._lastFrameRenderTime=0,this._renderRequested=s(!1),this.stage=this,this._stationary=!0,this._reshuffleManager=new m,this._managedCanvas=a,this.context=new y(this._managedCanvas.gl,i.contextOptions??new x),this.painter=new h(this.context,this),this._cimAnalyzer=new n(this.painter.textureManager.resourceManager),has("esri-2d-profiler")&&null!=t&&(this._debugOutput=document.createElement("div"),this._debugOutput.setAttribute("style","margin: 24px 64px; position: absolute; color: red;"),t.appendChild(this._debugOutput));const o=()=>this.highlightGradient;this._renderParameters={drawPhase:0,state:this.state,pixelRatio:window.devicePixelRatio,stationary:!1,globalOpacity:1,blendMode:null,deltaTime:-1,time:0,inFadeTransition:!1,effects:null,context:this.context,painter:this.painter,timeline:i.timeline||new g,renderingOptions:i.renderingOptions,requestRender:()=>this.requestRender(),allowDelayedRender:!1,requireFBO:!1,profiler:new l(this.context,this._debugOutput),dataUploadCounter:0,get highlightGradient(){return o()},reshuffleManager:this._reshuffleManager,backgroundColor:i.backgroundColor};let c=e=>this.renderFrame(e);null!=i.renderFrame&&(c=i.renderFrame),this._taskHandle=r({render:e=>c(e)}),this._taskHandle.pause(),this._lostWebGLContextHandle=this._managedCanvas.events.on("webgl-context-lost",t=>this.emit("webgl-error",{error:new e("webgl-context-lost",t.statusMessage)})),this._bufferPool=new d,u()}destroy(){super.destroy(),c(this.context),this.removeAllChildren(),this._emptyTrash(),this._taskHandle=t(this._taskHandle),this._lostWebGLContextHandle=t(this._lostWebGLContextHandle),this._managedCanvas.destroy(),this._debugOutput?.parentNode?.removeChild(this._debugOutput),this._bufferPool.destroy(),this.painter.dispose(),this.context.dispose(),this._managedCanvas=null}get textureManager(){return this.painter.textureManager}get profiler(){return this._renderParameters.profiler}get backgroundColor(){return this._renderParameters.backgroundColor}set backgroundColor(e){this._renderParameters.backgroundColor=e,this.requestRender()}get canvas(){return this._managedCanvas.canvas}get bufferPool(){return this._bufferPool}get cimAnalyzer(){return this._cimAnalyzer}get renderingOptions(){return this._renderingOptions}set renderingOptions(e){this._renderingOptions=e,this.requestRender()}get renderRequested(){return this._renderRequested.value}get state(){return this._state}set state(e){this._state=e,this.requestRender()}get stationary(){return this._stationary}set stationary(e){this._stationary!==e&&(this._stationary=e,this.requestRender())}trashDisplayObject(e){this._trash.add(e),this.requestRender()}untrashDisplayObject(e){return this._trash.delete(e)}requestRender(){this._renderRemainingTime=P,this.renderRequested||(this._renderRequested.value=!0,this._taskHandle.resume())}renderFrame(e){const t=this._lastFrameRenderTime?e.time-this._lastFrameRenderTime:0;this._renderRemainingTime-=t,this._renderRemainingTime<=0&&this._taskHandle.pause(),this._lastFrameRenderTime=e.time,this._renderRequested.value=!1,this._renderParameters.state=this._state,this._renderParameters.stationary=this.stationary,this._renderParameters.pixelRatio=window.devicePixelRatio,this._renderParameters.globalOpacity=1,this._renderParameters.time=e.time,this._renderParameters.deltaTime=e.deltaTime,this._renderParameters.effects=null,this.processRender(this._renderParameters),this._emptyTrash()}_createTransforms(){return{displayViewScreenMat3:i()}}renderChildren(e){for(const t of this.children)t.beforeRender(e);this._reshuffleManager.reshuffle(o),this._managedCanvas.render(e,()=>this._renderChildren(this.children,e));for(const t of this.children)t.afterRender(e)}_renderChildren(e,t){const r=this.context;this.painter.textureUploadManager.upload(),r.resetInfo(),t.profiler.recordStart("drawLayers"),t.dataUploadCounter=0,this.painter.beforeRenderPhases(t,t.backgroundColor,this.state.padding),t.drawPhase=1;for(const s of e)s.processRender(t);if(this.children.some(e=>e.hasHighlight)){t.drawPhase=16;for(const r of e)r.processRender(t)}if(this.children.some(e=>e.hasLabels)){t.drawPhase=2;for(const r of e)r.processRender(t)}if(has("esri-tiles-debug")){t.drawPhase=64;for(const r of e)r.processRender(t)}this.painter.afterRenderPhases(t),t.profiler.recordEnd("drawLayers"),r.logInfo()}doRender(e){const t=this.context,{state:r,pixelRatio:s}=e;this._managedCanvas.resize(e),t.setViewport(0,0,s*r.size[0],s*r.size[1]),t.setDepthWriteEnabled(!0),t.setStencilWriteMask(255),this.renderChildren(e)}async takeScreenshot(e,t,r,s){const i=Math.round(this.state.size[0]*e.resolutionScale),n=Math.round(this.state.size[1]*e.resolutionScale),a=e.resolutionScale,o=this.context,h=this._state.clone();if(null!=s){const e=h.viewpoint;h.viewpoint.rotation=s,h.viewpoint=e}const d={...this._renderParameters,drawPhase:null,globalOpacity:1,stationary:!0,state:h,pixelRatio:a,time:performance.now(),deltaTime:0,blendMode:null,effects:null,inFadeTransition:!1,backgroundColor:r},l=new C(i,n);l.wrapMode=33071,l.internalFormat=f.RGBA8,l.isImmutable=!0;const m=new w(o,l,new R(_.DEPTH24_STENCIL8,i,n)),u=o.getBoundFramebufferObject(),c=o.getViewport();o.bindFramebuffer(m),o.setViewport(0,0,i,n),this._renderChildren(t??this.children,d);const p=this._readbackScreenshot(m,{...e.cropArea,y:n-(e.cropArea.y+e.cropArea.height)});o.bindFramebuffer(u),o.setViewport(c.x,c.y,c.width,c.height),this.requestRender();const g=await p;let b;return 1===e.outputScale?b=g:(b=new ImageData(Math.round(g.width*e.outputScale),Math.round(g.height*e.outputScale)),(await import("../../support/screenshotUtils.js")).resampleHermite(g,b,!0)),m.dispose(),b}async _readbackScreenshot(e,t){const r=(await import("../../support/screenshotUtils.js")).createEmptyImageData(t.width,t.height,document.createElement("canvas"));return await e.readPixelsAsync(t.x,t.y,t.width,t.height,6408,b.UNSIGNED_BYTE,new Uint8Array(r.data.buffer)),r}_emptyTrash(){for(;this._trash.size>0;){const e=Array.from(this._trash);this._trash.clear();for(const t of e)t.processDetach()}}}export{j as Stage,P as extraRenderTime};
5
+ import e from"../../../core/Error.js";import has from"../../../core/has.js";import{removeMaybe as t}from"../../../core/maybe.js";import{addFrameTask as r}from"../../../core/scheduling.js";import{signal as s}from"../../../core/signal.js";import{create as i}from"../../../core/libs/gl-matrix-2/factories/mat3f32.js";import{CIMAnalyzer as n}from"../../../symbols/cim/cimAnalyzer.js";import{Container as a}from"./Container.js";import{MAX_TILE_RESHUFFLES_PER_FRAME as o}from"./webgl/definitions.js";import h from"./webgl/Painter.js";import{ArrayBufferPool as d}from"./webgl/PooledUint32Array.js";import{Profiler as l}from"./webgl/Profiler.js";import{TileReshuffleManager as m}from"./webgl/TileReshuffleManager.js";import{startup as u,shutdown as c}from"./webgl/shaderGraph/techniques/TechniqueRegistry.js";import{MeshWriterRegistry as p}from"./webgl/shaderGraph/techniques/mesh/MeshWriterRegistry.js";import{Timeline as g}from"../support/Timeline.js";import{SizedPixelFormat as f,SizedDepthStencilFormat as _,PixelType as b}from"../../webgl/enums.js";import{FramebufferObject as w}from"../../webgl/FramebufferObject.js";import{RenderbufferDescriptor as R}from"../../webgl/RenderbufferDescriptor.js";import{RenderingContext as y}from"../../webgl/RenderingContext.js";import{RenderingContextOptions as x}from"../../webgl/RenderingContextOptions.js";import{TextureDescriptor as C}from"../../webgl/TextureDescriptor.js";const P=2e3;class j extends a{constructor(t,i,a){super(),this.meshWriterRegistry=new p,this._trash=new Set,this._renderRemainingTime=0,this._lastFrameRenderTime=0,this._renderRequested=s(!1),this.stage=this,this._stationary=!0,this._reshuffleManager=new m,this._managedCanvas=a,this.context=new y(this._managedCanvas.gl,i.contextOptions??new x),this.painter=new h(this.context,this),this._cimAnalyzer=new n(this.painter.textureManager.resourceManager),has("esri-2d-profiler")&&null!=t&&(this._debugOutput=document.createElement("div"),this._debugOutput.setAttribute("style","margin: 24px 64px; position: absolute; color: red;"),t.appendChild(this._debugOutput));const o=()=>this.highlightGradient;this._renderParameters={drawPhase:0,state:this.state,pixelRatio:window.devicePixelRatio,stationary:!1,globalOpacity:1,blendMode:null,deltaTime:-1,time:0,inFadeTransition:!1,effects:null,context:this.context,painter:this.painter,timeline:i.timeline||new g,renderingOptions:i.renderingOptions,requestRender:()=>this.requestRender(),allowDelayedRender:!1,requireFBO:!1,profiler:new l(this.context,this._debugOutput),dataUploadCounter:0,get highlightGradient(){return o()},reshuffleManager:this._reshuffleManager,backgroundColor:i.backgroundColor};let c=e=>this.renderFrame(e);null!=i.renderFrame&&(c=i.renderFrame),this._taskHandle=r({render:e=>c(e)}),this._taskHandle.pause(),this._lostWebGLContextHandle=this._managedCanvas.events.on("webgl-context-lost",t=>this.emit("webgl-error",{error:new e("webgl-context-lost",t.statusMessage)})),this._bufferPool=new d,u()}destroy(){super.destroy(),c(this.context),this.removeAllChildren(),this._emptyTrash(),this._taskHandle=t(this._taskHandle),this._lostWebGLContextHandle=t(this._lostWebGLContextHandle),this._managedCanvas.destroy(),this._debugOutput?.parentNode?.removeChild(this._debugOutput),this._bufferPool.destroy(),this.painter.dispose(),this.context.dispose(),this._managedCanvas=null}get textureManager(){return this.painter.textureManager}get profiler(){return this._renderParameters.profiler}get backgroundColor(){return this._renderParameters.backgroundColor}set backgroundColor(e){this._renderParameters.backgroundColor=e,this.requestRender()}get canvas(){return this._managedCanvas.canvas}get bufferPool(){return this._bufferPool}get cimAnalyzer(){return this._cimAnalyzer}get renderingOptions(){return this._renderingOptions}set renderingOptions(e){this._renderingOptions=e,this.requestRender()}get renderRequested(){return this._renderRequested.value}get state(){return this._state}set state(e){this._state=e,this.requestRender()}get stationary(){return this._stationary}set stationary(e){this._stationary!==e&&(this._stationary=e,this.requestRender())}trashDisplayObject(e){this._trash.add(e),this.requestRender()}untrashDisplayObject(e){return this._trash.delete(e)}requestRender(){this._renderRemainingTime=P,this.renderRequested||(this._renderRequested.value=!0,this._taskHandle.resume())}renderFrame(e){const t=this._lastFrameRenderTime?e.time-this._lastFrameRenderTime:0;this._renderRemainingTime-=t,this._renderRemainingTime<=0&&this._taskHandle.pause(),this._lastFrameRenderTime=e.time,this._renderRequested.value=!1,this._renderParameters.state=this._state,this._renderParameters.stationary=this.stationary,this._renderParameters.pixelRatio=window.devicePixelRatio,this._renderParameters.globalOpacity=1,this._renderParameters.time=e.time,this._renderParameters.deltaTime=e.deltaTime,this._renderParameters.effects=null,this.processRender(this._renderParameters),this._emptyTrash()}_createTransforms(){return{displayViewScreenMat3:i()}}renderChildren(e){this._reshuffleManager.reshuffle(o),this._managedCanvas.render(e,()=>this._renderChildren(this.children,e))}_renderChildren(e,t){for(const s of e)s.beforeRender(t);const r=this.context;this.painter.textureUploadManager.upload(),r.resetInfo(),t.profiler.recordStart("drawLayers"),t.dataUploadCounter=0,this.painter.beforeRenderPhases(t,t.backgroundColor,this.state.padding),t.drawPhase=1;for(const s of e)s.processRender(t);if(this.children.some(e=>e.hasHighlight)){t.drawPhase=16;for(const r of e)r.processRender(t)}if(this.children.some(e=>e.hasLabels)){t.drawPhase=2;for(const r of e)r.processRender(t)}if(has("esri-tiles-debug")){t.drawPhase=64;for(const r of e)r.processRender(t)}this.painter.afterRenderPhases(t),t.profiler.recordEnd("drawLayers"),r.logInfo();for(const s of e)s.afterRender(t)}doRender(e){const t=this.context,{state:r,pixelRatio:s}=e;this._managedCanvas.resize(e),t.setViewport(0,0,s*r.size[0],s*r.size[1]),t.setDepthWriteEnabled(!0),t.setStencilWriteMask(255),this.renderChildren(e)}async takeScreenshot(e,t,r,s){const i=Math.round(this.state.size[0]*e.resolutionScale),n=Math.round(this.state.size[1]*e.resolutionScale),a=e.resolutionScale,o=this.context,h=this._state.clone();if(null!=s){const e=h.viewpoint;h.viewpoint.rotation=s,h.viewpoint=e}const d={...this._renderParameters,drawPhase:null,globalOpacity:1,stationary:!0,state:h,pixelRatio:a,time:performance.now(),deltaTime:0,blendMode:null,effects:null,inFadeTransition:!1,backgroundColor:r},l=new C(i,n);l.wrapMode=33071,l.internalFormat=f.RGBA8,l.isImmutable=!0;const m=new w(o,l,new R(_.DEPTH24_STENCIL8,i,n)),u=o.getBoundFramebufferObject(),c=o.getViewport();o.bindFramebuffer(m),o.setViewport(0,0,i,n),this._renderChildren(t??this.children,d);const p=this._readbackScreenshot(m,{...e.cropArea,y:n-(e.cropArea.y+e.cropArea.height)});o.bindFramebuffer(u),o.setViewport(c.x,c.y,c.width,c.height),this.requestRender();const g=await p;let b;return 1===e.outputScale?b=g:(b=new ImageData(Math.round(g.width*e.outputScale),Math.round(g.height*e.outputScale)),(await import("../../support/screenshotUtils.js")).resampleHermite(g,b,!0)),m.dispose(),b}async _readbackScreenshot(e,t){const r=(await import("../../support/screenshotUtils.js")).createEmptyImageData(t.width,t.height,document.createElement("canvas"));return await e.readPixelsAsync(t.x,t.y,t.width,t.height,6408,b.UNSIGNED_BYTE,new Uint8Array(r.data.buffer)),r}_emptyTrash(){for(;this._trash.size>0;){const e=Array.from(this._trash);this._trash.clear();for(const t of e)t.processDetach()}}}export{j as Stage,P as extraRenderTime};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import"../../../../../../core/has.js";import{isPowerOfTwo as e,nextPowerOfTwo as t}from"../../../../../../core/mathUtils.js";import{disposeMaybe as r}from"../../../../../../core/maybe.js";import{simplePipelineState as s}from"../utils.js";import{Technique as u}from"./Technique.js";import{TextureStatisticsDiffShader as i}from"./shaders/TextureStatisticsDiffShader.js";import{TextureStatisticsMinMaxSumShader as o}from"./shaders/TextureStatisticsMinMaxSumShader.js";import{TextureStatisticsStdDevShader as a}from"./shaders/TextureStatisticsStdDevShader.js";import{TextureStatisticsSumOfSquaredDiffShader as f}from"./shaders/TextureStatisticsSumOfSquaredDiffShader.js";import{getWebGLCapabilities as n}from"../../../../../webgl/capabilities.js";import{ColorAttachment2 as h,ColorAttachment3 as l,SizedPixelFormat as m,PixelType as c,ColorAttachment0 as x,ColorAttachment1 as T}from"../../../../../webgl/enums.js";import{FramebufferObject as b}from"../../../../../webgl/FramebufferObject.js";import{Texture as d}from"../../../../../webgl/Texture.js";import{TextureDescriptor as p}from"../../../../../webgl/TextureDescriptor.js";const _=1048576;class F extends u{constructor(){super(...arguments),this.type=32,this._width=0,this._height=0,this._framebuffers=null,this._minTexture=null,this._maxTexture=null,this._sumTexture=null,this._resultsFramebuffer=null,this._startFramebuffer=null,this._diffFramebuffer=null,this._scaleFbo=null,this.shaders={textureStatisticsMinMaxSum:new o,textureStatisticsSum:new f,textureStatisticsDiff:new i,textureStatisticsStdDev:new a}}dispose(){this.shaders.textureStatisticsMinMaxSum=null,this._framebuffers&&(this._framebuffers.forEach(e=>r(e)),this._framebuffers=null),r(this._resultsFramebuffer),r(this._startFramebuffer),r(this._diffFramebuffer),r(this._scaleFbo),r(this._minTexture),r(this._maxTexture),r(this._sumTexture)}get minValuesTexture(){return this._minTexture||null}get maxValuesTexture(){return this._maxTexture||null}get meanValuesTexture(){return this._resultsFramebuffer?.getColorTexture(h)||null}get stdDevValuesTexture(){return this._resultsFramebuffer?.getColorTexture(l)||null}get statsFbo(){return this._resultsFramebuffer}render(t,r){const{context:u,painter:i}=t;let o=r.fbo.width,a=r.fbo.height,f=r.fbo;const n=u.gl,h=u.getBoundFramebufferObject();if(o*a>_||!e(o)||!e(a)){const t=o/a;if(o*a>_){const e=Math.max(Math.floor(Math.sqrt(_/t)),1);o=Math.max(Math.floor(t*e),1),a=e}e(o)||(o=S(o)),e(a)||(a=S(a)),this._scaleFbo?this._scaleFbo.resize(o,a):this._scaleFbo=g(u,o,a,c.UNSIGNED_BYTE,m.RGBA8),u.bindFramebuffer(this._scaleFbo),u.setViewport(0,0,o,a),i.blitTexture(u,f.getColorTexture(x),9728),f=this._scaleFbo}this._updateResources(t,f),i.setPipelineState({...s,color:{write:[!0,!0,!0,!0],blendMode:"none"}});const l=this._applyReductionPass(t);n.readBuffer(n.COLOR_ATTACHMENT2),l.copyToTexture(0,0,1,1,0,0,this._sumTexture),n.readBuffer(n.COLOR_ATTACHMENT1),l.copyToTexture(0,0,1,1,0,0,this._maxTexture),n.readBuffer(n.COLOR_ATTACHMENT0),l.copyToTexture(0,0,1,1,0,0,this._minTexture);const T=r.fbo.getColorTexture(x);if(!T)throw new Error("Start buffer color texture is not available, cannot compute diff.");this._computeDiff(t,T,this._sumTexture,o,a);const b=this._applySecondReductionPass(t,o,a).getColorTexture(x);this._computeSdtDev(t,this._minTexture,this._maxTexture,this._sumTexture,b,o,a),u.bindFramebuffer(h),u.setViewport(0,0,o,a),u.setDrawBuffers([x]),i.setPipelineState(s)}_applyReductionPass(e){const{context:t,painter:r}=e,s=this.shaders.textureStatisticsMinMaxSum,u=this._framebuffers;if(null===u)throw new Error("Framebuffers are not initialized, cannot apply reduction pass.");t.setDrawBuffers([x,T,h]);const i=this._startFramebuffer;let o=i.getColorTexture(x),a=i.getColorTexture(T),f=i.getColorTexture(h);const n=u;for(const l of n){t.setViewport(0,0,l.width,l.height),t.bindFramebuffer(l),t.setClearColor(0,0,0,0),t.clear(16384);const e={shader:s,uniforms:{config:{minTexture:{texture:o,unit:1},maxTexture:{texture:a,unit:2},sumTexture:{texture:f,unit:3},width:l.width,height:l.height}},defines:null,optionalAttributes:null,useComputeBuffer:!1};r.submitDrawMesh(t,e,r.quadMesh),o=l.getColorTexture(x),a=l.getColorTexture(T),f=l.getColorTexture(h)}return u.at(-1)}_applySecondReductionPass(e,t,r){const{context:s,painter:u}=e,i=this.shaders.textureStatisticsSum,o=this._framebuffers;if(null===o||null==this._diffFramebuffer)throw new Error("Framebuffers are not initialized, cannot apply reduction pass.");s.setDrawBuffers([x]);let a=this._diffFramebuffer.getColorTexture(x);const f=o;for(const n of f){s.setViewport(0,0,n.width,n.height),s.bindFramebuffer(n),s.setClearColor(0,0,0,0),s.clear(16384);const e={shader:i,uniforms:{config:{sumTexture:{texture:a,unit:2},width:n.width,height:n.height}},defines:null,optionalAttributes:null,useComputeBuffer:!1};u.submitDrawMesh(s,e,u.quadMesh),a=n.getColorTexture(x)}return o.at(-1)}_updateResources(e,t){const{context:r}=e,s=t.width,u=t.height;if(null===this._startFramebuffer){if(!n().supportsColorBufferFloat)throw new Error("WebGL does not support color buffer float, cannot compute texture statistics.");const e=g(r,s,u,c.UNSIGNED_BYTE,m.RGBA8,3),i=e.getColorTexture(x),o=e.getColorTexture(T),a=e.getColorTexture(h);t.copyToTexture(0,0,s,u,0,0,i),t.copyToTexture(0,0,s,u,0,0,o),t.copyToTexture(0,0,s,u,0,0,a),this._startFramebuffer=e,this._diffFramebuffer=g(r,s,u,c.FLOAT,m.RGBA32F),this._resultsFramebuffer=g(r,1,1,c.FLOAT,m.RGBA32F,4),this._minTexture=C(r,1,1,c.FLOAT,m.RGBA32F),this._maxTexture=C(r,1,1,c.FLOAT,m.RGBA32F),this._sumTexture=C(r,1,1,c.FLOAT,m.RGBA32F)}else{const e=this._startFramebuffer;e.resize(s,u);const r=e.getColorTexture(x),i=e.getColorTexture(T),o=e.getColorTexture(h);t.copyToTexture(0,0,s,u,0,0,r),t.copyToTexture(0,0,s,u,0,0,i),t.copyToTexture(0,0,s,u,0,0,o),this._diffFramebuffer.resize(s,u)}if(this._width===s&&this._height===u&&null!==this._framebuffers)return;const i=(this._framebuffers||[]).reverse();this._framebuffers=null,this._width=s,this._height=u,this._framebuffers=this._updateFramebuffers(r,s,u,i,3)}_updateFramebuffers(e,t,s,u,i=1){const o=[];let a=t,f=s;for(;a>1||f>1;){const t=Math.max(1,Math.floor(a/2)),r=Math.max(1,Math.floor(f/2)),s=w(e,t,r,u,i);o.push(s),a=t,f=r}return o.at(-1),u.forEach(e=>r(e)),u.length=0,o}_computeDiff(e,t,r,s,u){const{context:i,painter:o}=e;i.bindFramebuffer(this._diffFramebuffer),i.setDrawBuffers([x]),i.setViewport(0,0,s,u),i.setClearColor(0,0,0,0),i.clear(16384);const a={shader:this.shaders.textureStatisticsDiff,uniforms:{config:{inputTexture:{texture:t,unit:1},sumTexture:{texture:r,unit:2},numTexels:s*u}},defines:null,optionalAttributes:null,useComputeBuffer:!1};o.submitDrawMesh(i,a,o.quadMesh)}_computeSdtDev(e,t,r,s,u,i,o){const{context:a,painter:f}=e;a.bindFramebuffer(this._resultsFramebuffer),a.setDrawBuffers([x,T,h,l]),a.setViewport(0,0,1,1),a.setClearColor(0,0,0,0),a.clear(16384);const n={shader:this.shaders.textureStatisticsStdDev,uniforms:{config:{minTexture:{texture:t,unit:1},maxTexture:{texture:r,unit:2},sumTexture:{texture:s,unit:3},diffSqTexture:{texture:u,unit:4},numTexels:i*o}},defines:null,optionalAttributes:null,useComputeBuffer:!1};f.submitDrawMesh(a,n,f.quadMesh)}}function w(e,t,r,s,u=1){let i=s.pop();return void 0!==i?i.resize(t,r):i=g(e,t,r,c.FLOAT,m.RGBA32F,u),i}function g(e,t,r,s,u,i=1){if(i<1||i>4)throw new Error("Number of color attachments must be between 1 and 4.");const o=new b(e,C(e,t,r,s,u));for(let a=1;a<i;a++){const i=C(e,t,r,s,u);o.attachColorTexture(i,x+a)}return o}function C(e,t,r,s,u){const i=new p(t,r);return i.samplingMode=9728,i.wrapMode=33071,i.pixelFormat=6408,i.dataType=s,i.internalFormat=u,new d(e,i)}function S(e){const r=t(e),s=r/2;return Math.abs(r-e)<Math.abs(s-e)?r:s}export{F as TextureStatisticsTechnique};
5
+ import"../../../../../../core/has.js";import{isPowerOfTwo as e,nextPowerOfTwo as t}from"../../../../../../core/mathUtils.js";import{disposeMaybe as r}from"../../../../../../core/maybe.js";import{simplePipelineState as s}from"../utils.js";import{Technique as u}from"./Technique.js";import{TextureStatisticsDiffShader as o}from"./shaders/TextureStatisticsDiffShader.js";import{TextureStatisticsMinMaxSumShader as i}from"./shaders/TextureStatisticsMinMaxSumShader.js";import{TextureStatisticsStdDevShader as a}from"./shaders/TextureStatisticsStdDevShader.js";import{TextureStatisticsSumOfSquaredDiffShader as f}from"./shaders/TextureStatisticsSumOfSquaredDiffShader.js";import{getWebGLCapabilities as n}from"../../../../../webgl/capabilities.js";import{ColorAttachment2 as l,ColorAttachment3 as h,SizedPixelFormat as m,PixelType as x,ColorAttachment0 as c,ColorAttachment1 as T}from"../../../../../webgl/enums.js";import{FramebufferObject as p}from"../../../../../webgl/FramebufferObject.js";import{Texture as d}from"../../../../../webgl/Texture.js";import{TextureDescriptor as b}from"../../../../../webgl/TextureDescriptor.js";const _=1048576;class F extends u{constructor(){super(...arguments),this.type=32,this._width=0,this._height=0,this._framebuffers=null,this._minTexture=null,this._maxTexture=null,this._sumTexture=null,this._numOfNoDataTexture=null,this._resultsFramebuffer=null,this._startFramebuffer=null,this._diffFramebuffer=null,this._scaleFbo=null,this.shaders={textureStatisticsMinMaxSum:new i,textureStatisticsSum:new f,textureStatisticsDiff:new o,textureStatisticsStdDev:new a}}dispose(){this.shaders.textureStatisticsMinMaxSum=null,this._framebuffers&&(this._framebuffers.forEach(e=>r(e)),this._framebuffers=null),r(this._resultsFramebuffer),r(this._startFramebuffer),r(this._diffFramebuffer),r(this._scaleFbo),r(this._minTexture),r(this._maxTexture),r(this._sumTexture),r(this._numOfNoDataTexture)}get minValuesTexture(){return this._minTexture||null}get maxValuesTexture(){return this._maxTexture||null}get meanValuesTexture(){return this._resultsFramebuffer?.getColorTexture(l)||null}get stdDevValuesTexture(){return this._resultsFramebuffer?.getColorTexture(h)||null}get statsFbo(){return this._resultsFramebuffer}render(t,r){const{context:u,painter:o}=t;let i=r.fbo.width,a=r.fbo.height,f=r.fbo;const n=u.gl,l=u.getBoundFramebufferObject();if(i*a>_||!e(i)||!e(a)){const t=i/a;if(i*a>_){const e=Math.max(Math.floor(Math.sqrt(_/t)),1);i=Math.max(Math.floor(t*e),1),a=e}e(i)||(i=S(i)),e(a)||(a=S(a)),this._scaleFbo?this._scaleFbo.resize(i,a):this._scaleFbo=w(u,i,a,x.UNSIGNED_BYTE,m.RGBA8),u.bindFramebuffer(this._scaleFbo),u.setViewport(0,0,i,a),o.blitTexture(u,f.getColorTexture(c),9728),f=this._scaleFbo}this._updateResources(t,f),o.setPipelineState({...s,color:{write:[!0,!0,!0,!0],blendMode:"none"}});const h=this._applyReductionPass(t);n.readBuffer(n.COLOR_ATTACHMENT3),h.copyToTexture(0,0,1,1,0,0,this._numOfNoDataTexture),n.readBuffer(n.COLOR_ATTACHMENT2),h.copyToTexture(0,0,1,1,0,0,this._sumTexture),n.readBuffer(n.COLOR_ATTACHMENT1),h.copyToTexture(0,0,1,1,0,0,this._maxTexture),n.readBuffer(n.COLOR_ATTACHMENT0),h.copyToTexture(0,0,1,1,0,0,this._minTexture);const T=r.fbo.getColorTexture(c);if(!T)throw new Error("Start buffer color texture is not available, cannot compute diff.");this._computeDiff(t,T,this._sumTexture,this._numOfNoDataTexture,i,a);const p=this._applySecondReductionPass(t,i,a).getColorTexture(c);this._computeSdtDev(t,this._minTexture,this._maxTexture,this._sumTexture,this._numOfNoDataTexture,p,i,a),u.bindFramebuffer(l),u.setViewport(0,0,i,a),u.setDrawBuffers([c]),o.setPipelineState(s)}_applyReductionPass(e){const{context:t,painter:r}=e,s=this.shaders.textureStatisticsMinMaxSum,u=this._framebuffers;if(null===u)throw new Error("Framebuffers are not initialized, cannot apply reduction pass.");t.setDrawBuffers([c,T,l]);const o=this._startFramebuffer;let i=o.getColorTexture(c),a=o.getColorTexture(T),f=o.getColorTexture(l),n=o.getColorTexture(h);const m=u;let x=0;for(const p of m){t.setViewport(0,0,p.width,p.height),t.bindFramebuffer(p),t.setClearColor(0,0,0,0),t.clear(16384);const e={shader:s,uniforms:{config:{minTexture:{texture:i,unit:1},maxTexture:{texture:a,unit:2},sumTexture:{texture:f,unit:3},numOfNoDataTexture:{texture:n,unit:4},width:p.width,height:p.height,isFirstPass:0===x?1:0}},defines:null,optionalAttributes:null,useComputeBuffer:!1};r.submitDrawMesh(t,e,r.quadMesh),i=p.getColorTexture(c),a=p.getColorTexture(T),f=p.getColorTexture(l),n=p.getColorTexture(h),x++}return u.at(-1)}_applySecondReductionPass(e,t,r){const{context:s,painter:u}=e,o=this.shaders.textureStatisticsSum,i=this._framebuffers;if(null===i||null==this._diffFramebuffer)throw new Error("Framebuffers are not initialized, cannot apply reduction pass.");s.setDrawBuffers([c]);let a=this._diffFramebuffer.getColorTexture(c);const f=i;for(const n of f){s.setViewport(0,0,n.width,n.height),s.bindFramebuffer(n),s.setClearColor(0,0,0,0),s.clear(16384);const e={shader:o,uniforms:{config:{sumTexture:{texture:a,unit:2},width:n.width,height:n.height}},defines:null,optionalAttributes:null,useComputeBuffer:!1};u.submitDrawMesh(s,e,u.quadMesh),a=n.getColorTexture(c)}return i.at(-1)}_updateResources(e,t){const{context:r}=e,s=t.width,u=t.height;if(null===this._startFramebuffer){if(!n().supportsColorBufferFloat)throw new Error("WebGL does not support color buffer float, cannot compute texture statistics.");const e=t.getColorTexture(c);if(!e)throw new Error("Input FBO does not have a color attachment 0, cannot compute texture statistics.");const o=e.descriptor,{dataType:i,internalFormat:a}=o,f=w(r,s,u,i,a??m.RGBA8,4),p=f.getColorTexture(c),d=f.getColorTexture(T),b=f.getColorTexture(l),_=f.getColorTexture(h);t.copyToTexture(0,0,s,u,0,0,p),t.copyToTexture(0,0,s,u,0,0,d),t.copyToTexture(0,0,s,u,0,0,b),t.copyToTexture(0,0,s,u,0,0,_),this._startFramebuffer=f,this._diffFramebuffer=w(r,s,u,x.FLOAT,m.RGBA32F),this._resultsFramebuffer=w(r,1,1,x.FLOAT,m.RGBA32F,4),this._minTexture=C(r,1,1,x.FLOAT,m.RGBA32F),this._maxTexture=C(r,1,1,x.FLOAT,m.RGBA32F),this._sumTexture=C(r,1,1,x.FLOAT,m.RGBA32F),this._numOfNoDataTexture=C(r,1,1,x.FLOAT,m.R32F)}else{const e=this._startFramebuffer;e.resize(s,u);const r=e.getColorTexture(c),o=e.getColorTexture(T),i=e.getColorTexture(l),a=e.getColorTexture(h);t.copyToTexture(0,0,s,u,0,0,r),t.copyToTexture(0,0,s,u,0,0,o),t.copyToTexture(0,0,s,u,0,0,i),t.copyToTexture(0,0,s,u,0,0,a),this._diffFramebuffer.resize(s,u)}if(this._width===s&&this._height===u&&null!==this._framebuffers)return;const o=(this._framebuffers||[]).reverse();this._framebuffers=null,this._width=s,this._height=u,this._framebuffers=this._updateFramebuffers(r,s,u,o,4)}_updateFramebuffers(e,t,s,u,o=1){const i=[];let a=t,f=s;for(;a>1||f>1;){const t=Math.max(1,Math.floor(a/2)),r=Math.max(1,Math.floor(f/2)),s=g(e,t,r,u,o);i.push(s),a=t,f=r}return i.at(-1),u.forEach(e=>r(e)),u.length=0,i}_computeDiff(e,t,r,s,u,o){const{context:i,painter:a}=e;i.bindFramebuffer(this._diffFramebuffer),i.setDrawBuffers([c]),i.setViewport(0,0,u,o),i.setClearColor(0,0,0,0),i.clear(16384);const f={shader:this.shaders.textureStatisticsDiff,uniforms:{config:{inputTexture:{texture:t,unit:1},sumTexture:{texture:r,unit:2},numOfNoDataTexture:{texture:s,unit:3},numTexels:u*o}},defines:null,optionalAttributes:null,useComputeBuffer:!1};a.submitDrawMesh(i,f,a.quadMesh)}_computeSdtDev(e,t,r,s,u,o,i,a){const{context:f,painter:n}=e;f.bindFramebuffer(this._resultsFramebuffer),f.setDrawBuffers([c,T,l,h]),f.setViewport(0,0,1,1),f.setClearColor(0,0,0,0),f.clear(16384);const m={shader:this.shaders.textureStatisticsStdDev,uniforms:{config:{minTexture:{texture:t,unit:1},maxTexture:{texture:r,unit:2},sumTexture:{texture:s,unit:3},numOfNoDataTexture:{texture:u,unit:4},diffSqTexture:{texture:o,unit:5},numTexels:i*a}},defines:null,optionalAttributes:null,useComputeBuffer:!1};n.submitDrawMesh(f,m,n.quadMesh)}}function g(e,t,r,s,u=1){let o=s.pop();return void 0!==o?o.resize(t,r):o=w(e,t,r,x.FLOAT,m.RGBA32F,u),o}function w(e,t,r,s,u,o=1){if(o<1||o>4)throw new Error("Number of color attachments must be between 1 and 4.");const i=new p(e,C(e,t,r,s,u));for(let a=1;a<o;a++){const o=C(e,t,r,s,u);i.attachColorTexture(o,c+a)}return i}function C(e,t,r,s,u){const o=new b(t,r);return o.samplingMode=9728,o.wrapMode=33071,o.pixelFormat=6408,o.dataType=s,o.internalFormat=u,new d(e,o)}function S(e){const r=t(e),s=r/2;return Math.abs(r-e)<Math.abs(s-e)?r:s}export{F as TextureStatisticsTechnique};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as t,__param as e}from"tslib";import{location as o,uniform as r,input as s,VertexInput as i,UniformGroup as p,GraphShaderModule as n,FragmentOutput as u,FragmentInput as l}from"../../GraphShaderModule.js";import{Vec2 as m,Sampler2D as d,Float as x,Vec4 as a,texture2D as c,texelFetch as f,Int as v,IVec2 as g}from"../../graph/glsl.js";import{uvToClip as y}from"./utils.js";class h extends i{}t([o(0,m)],h.prototype,"position",void 0);class T extends l{}class w extends p{}t([r(d)],w.prototype,"inputTexture",void 0),t([r(d)],w.prototype,"sumTexture",void 0),t([r(x)],w.prototype,"numTexels",void 0);class j extends n{constructor(){super(...arguments),this.type="TextureStatisticsDiffShader"}vertex(t){const e=t.position;return{uv:e,glPosition:new a(y(e),0,1)}}fragment(t){const{inputTexture:e,sumTexture:o}=this.config,r=new u,s=c(e,t.uv),i=f(o,new g(0,0),new v(0)),p=this.config.numTexels,n=i.divide(p),l=s.subtract(n);return r.fragColor=l.multiply(l),r}}t([r(w)],j.prototype,"config",void 0),t([e(0,s(h))],j.prototype,"vertex",null),t([e(0,s(T))],j.prototype,"fragment",null);export{j as TextureStatisticsDiffShader};
5
+ import{__decorate as t,__param as e}from"tslib";import{location as o,uniform as r,input as s,VertexInput as i,UniformGroup as n,GraphShaderModule as p,FragmentOutput as u,FragmentInput as l}from"../../GraphShaderModule.js";import{Vec2 as a,Sampler2D as m,Float as x,Vec4 as c,texture2D as d,texelFetch as f,Int as v,IVec2 as y,step as g}from"../../graph/glsl.js";import{uvToClip as T}from"./utils.js";class w extends i{}t([o(0,a)],w.prototype,"position",void 0);class h extends l{}class b extends n{}t([r(m)],b.prototype,"inputTexture",void 0),t([r(m)],b.prototype,"sumTexture",void 0),t([r(m)],b.prototype,"numOfNoDataTexture",void 0),t([r(x)],b.prototype,"numTexels",void 0);class j extends p{constructor(){super(...arguments),this.type="TextureStatisticsDiffShader"}vertex(t){const e=t.position;return{uv:e,glPosition:new c(T(e),0,1)}}fragment(t){const{inputTexture:e,numOfNoDataTexture:o,sumTexture:r}=this.config,s=new u,i=d(e,t.uv),n=f(r,new y(0,0),new v(0)),p=f(o,new y(0,0),new v(0)).r,l=this.config.numTexels.subtract(p),a=n.divide(l),m=g(i.a,new x(0)),c=new x(1).subtract(m).multiply(i.subtract(a));return s.fragColor=c.multiply(c),s}}t([r(b)],j.prototype,"config",void 0),t([e(0,s(w))],j.prototype,"vertex",null),t([e(0,s(h))],j.prototype,"fragment",null);export{j as TextureStatisticsDiffShader};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as t,__param as e}from"tslib";import{location as o,uniform as r,input as d,VertexInput as n,UniformGroup as a,GraphShaderModule as i,FragmentOutput as s,FragmentInput as p}from"../../GraphShaderModule.js";import{Vec2 as u,Sampler2D as m,Int as x,Vec4 as l,IVec2 as w,texelFetch as g,min as y,max as c}from"../../graph/glsl.js";import{uvToClip as f,sum4 as v}from"./utils.js";class h extends n{}t([o(0,u)],h.prototype,"position",void 0);class T extends p{}class S extends a{}t([r(m)],S.prototype,"minTexture",void 0),t([r(m)],S.prototype,"maxTexture",void 0),t([r(m)],S.prototype,"sumTexture",void 0),t([r(x)],S.prototype,"width",void 0),t([r(x)],S.prototype,"height",void 0);class j extends i{constructor(){super(...arguments),this.type="TextureStatisticsMinMaxSumShader"}vertex(t){const e=t.position;return{uv:e,glPosition:new l(f(e),0,1)}}fragment(t){const e=new s,{minTexture:o,maxTexture:r,sumTexture:d}=this.config,n=t.glFragCoord.xy,a=new w(n.multiply(2)),i=new x(0),p=g(o,a,i),u=g(o,a.add(new w(-1,0)),i),m=g(o,a.add(new w(0,-1)),i),l=g(o,a.add(new w(-1,-1)),i),f=y(y(p,u),y(m,l)),h=g(r,a,i),T=g(r,a.add(new w(-1,0)),i),S=g(r,a.add(new w(0,-1)),i),j=g(r,a.add(new w(-1,-1)),i),D=c(c(h,T),c(S,j)),M=g(d,a,i),b=g(d,a.add(new w(-1,0)),i),C=g(d,a.add(new w(0,-1)),i),F=g(d,a.add(new w(-1,-1)),i),G=v(M,b,C,F);return e.fragData0=f,e.fragData1=D,e.fragData2=G,e}}t([r(S)],j.prototype,"config",void 0),t([e(0,d(h))],j.prototype,"vertex",null),t([e(0,d(T))],j.prototype,"fragment",null);export{j as TextureStatisticsMinMaxSumShader};
5
+ import{__decorate as t,__param as e}from"tslib";import{location as n,uniform as o,input as r,VertexInput as a,UniformGroup as i,GraphShaderModule as s,FragmentOutput as d,FragmentInput as u}from"../../GraphShaderModule.js";import{Vec2 as p,Sampler2D as l,Int as w,Vec4 as m,IVec2 as c,texelFetch as y,Float as f,step as x,min as g,max as v}from"../../graph/glsl.js";import{maxRepresentableInt as h}from"./constants.js";import{uvToClip as T,sum4 as D}from"./utils.js";class b extends a{}t([n(0,p)],b.prototype,"position",void 0);class j extends u{}class S extends i{}t([o(l)],S.prototype,"minTexture",void 0),t([o(l)],S.prototype,"maxTexture",void 0),t([o(l)],S.prototype,"sumTexture",void 0),t([o(l)],S.prototype,"numOfNoDataTexture",void 0),t([o(w)],S.prototype,"width",void 0),t([o(w)],S.prototype,"height",void 0),t([o(w)],S.prototype,"isFirstPass",void 0);class F extends s{constructor(){super(...arguments),this.type="TextureStatisticsMinMaxSumShader"}vertex(t){const e=t.position;return{uv:e,glPosition:new m(T(e),0,1)}}fragment(t){const e=new d,{minTexture:n,maxTexture:o,sumTexture:r,numOfNoDataTexture:a}=this.config,i=t.glFragCoord.xy,s=new c(i.multiply(2)),u=new w(0),p=y(n,s,u),l=y(n,s.add(new c(-1,0)),u),x=y(n,s.add(new c(0,-1)),u),g=y(n,s.add(new c(-1,-1)),u),v=M(M(p,M(l,new m(h))),M(x,M(g,new m(h)))),T=y(o,s,u),b=y(o,s.add(new c(-1,0)),u),j=y(o,s.add(new c(0,-1)),u),S=y(o,s.add(new c(-1,-1)),u),F=P(P(T,P(b,new m(-h))),P(j,P(S,new m(-h)))),C=y(r,s,u),G=y(r,s.add(new c(-1,0)),u),k=y(r,s.add(new c(0,-1)),u),q=y(r,s.add(new c(-1,-1)),u),z=D(N(C),N(G),N(k),N(q)),A=y(a,s,u),B=y(a,s.add(new c(-1,0)),u),E=y(a,s.add(new c(0,-1)),u),H=y(a,s.add(new c(-1,-1)),u),I=new f(this.config.isFirstPass),J=D(O(A,I),O(B,I),O(E,I),O(H,I));return e.fragData0=v,e.fragData1=F,e.fragData2=z,e.fragData3=J,e}}function M(t,e){const n=x(t.a,new f(0));return g(t,e).multiply(new f(1).subtract(n)).add(e.multiply(n))}function P(t,e){const n=x(t.a,new f(0));return v(t,e).multiply(new f(1).subtract(n)).add(e.multiply(n))}function N(t){const e=x(t.a,new f(0)),n=new f(1).subtract(e);return t.multiply(n)}function O(t,e){const n=x(t.a,new f(0)),o=new f(1).subtract(e);return e.multiply(n).multiply(new m(1)).add(o.multiply(t))}t([o(S)],F.prototype,"config",void 0),t([e(0,r(b))],F.prototype,"vertex",null),t([e(0,r(j))],F.prototype,"fragment",null);export{F as TextureStatisticsMinMaxSumShader};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as t,__param as e}from"tslib";import{location as o,uniform as r,input as i,VertexInput as s,UniformGroup as p,GraphShaderModule as n,FragmentOutput as a,FragmentInput as d}from"../../GraphShaderModule.js";import{Vec2 as u,Sampler2D as x,Float as m,Vec4 as f,IVec2 as l,Int as g,texelFetch as v,sqrt as c}from"../../graph/glsl.js";import{uvToClip as y}from"./utils.js";class T extends s{}t([o(0,u)],T.prototype,"position",void 0);class h extends d{}class S extends p{}t([r(x)],S.prototype,"minTexture",void 0),t([r(x)],S.prototype,"maxTexture",void 0),t([r(x)],S.prototype,"sumTexture",void 0),t([r(x)],S.prototype,"diffSqTexture",void 0),t([r(m)],S.prototype,"numTexels",void 0);class w extends n{constructor(){super(...arguments),this.type="TextureStatisticsStdDevShader"}vertex(t){const e=t.position;return{uv:e,glPosition:new f(y(e),0,1)}}fragment(t){const e=new a,{minTexture:o,maxTexture:r,sumTexture:i,diffSqTexture:s}=this.config,p=t.glFragCoord.xy,n=new l(p),d=new g(0),u=v(o,n,d),x=v(r,n,d),m=v(i,n,d),y=v(s,n,d),T=this.config.numTexels,h=m.divide(T),S=new f(y.divide(T)),w=c(S);return e.fragData0=u,e.fragData1=x,e.fragData2=h,e.fragData3=w,e}}t([r(S)],w.prototype,"config",void 0),t([e(0,i(T))],w.prototype,"vertex",null),t([e(0,i(h))],w.prototype,"fragment",null);export{w as TextureStatisticsStdDevShader};
5
+ import{__decorate as t,__param as e}from"tslib";import{location as o,uniform as r,input as i,VertexInput as s,UniformGroup as a,GraphShaderModule as p,FragmentOutput as n,FragmentInput as u}from"../../GraphShaderModule.js";import{Vec2 as d,Sampler2D as x,Float as m,Vec4 as f,IVec2 as l,Int as g,texelFetch as v,sqrt as c}from"../../graph/glsl.js";import{uvToClip as T}from"./utils.js";class y extends s{}t([o(0,d)],y.prototype,"position",void 0);class h extends u{}class D extends a{}t([r(x)],D.prototype,"minTexture",void 0),t([r(x)],D.prototype,"maxTexture",void 0),t([r(x)],D.prototype,"sumTexture",void 0),t([r(x)],D.prototype,"numOfNoDataTexture",void 0),t([r(x)],D.prototype,"diffSqTexture",void 0),t([r(m)],D.prototype,"numTexels",void 0);class S extends p{constructor(){super(...arguments),this.type="TextureStatisticsStdDevShader"}vertex(t){const e=t.position;return{uv:e,glPosition:new f(T(e),0,1)}}fragment(t){const e=new n,{minTexture:o,maxTexture:r,numOfNoDataTexture:i,sumTexture:s,diffSqTexture:a}=this.config,p=t.glFragCoord.xy,u=new l(p),d=new g(0),x=v(o,u,d),m=v(r,u,d),f=v(s,u,d),T=v(i,u,d).r,y=v(a,u,d),h=this.config.numTexels.subtract(T),D=f.divide(h),S=y.divide(h),w=c(S);return e.fragData0=x,e.fragData1=m,e.fragData2=D,e.fragData3=w,e}}t([r(D)],S.prototype,"config",void 0),t([e(0,i(y))],S.prototype,"vertex",null),t([e(0,i(h))],S.prototype,"fragment",null);export{S as TextureStatisticsStdDevShader};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as t,__param as e}from"tslib";import{location as o,uniform as r,input as s,VertexInput as i,UniformGroup as n,GraphShaderModule as p,FragmentOutput as a,FragmentInput as d}from"../../GraphShaderModule.js";import{Vec2 as l,Sampler2D as u,Int as f,Vec4 as m,IVec2 as g,texelFetch as c}from"../../graph/glsl.js";import{uvToClip as x,sum4 as w}from"./utils.js";class y extends i{}t([o(0,l)],y.prototype,"position",void 0);class h extends d{}class v extends n{}t([r(u)],v.prototype,"sumTexture",void 0),t([r(f)],v.prototype,"width",void 0),t([r(f)],v.prototype,"height",void 0);class S extends p{constructor(){super(...arguments),this.type="TextureStatisticsSumOfSquaredDiffShader"}vertex(t){const e=t.position;return{uv:e,glPosition:new m(x(e),0,1)}}fragment(t){const e=new a,{sumTexture:o}=this.config,r=t.glFragCoord.xy,s=new g(r.multiply(2)),i=new f(0),n=c(o,s,i),p=c(o,s.add(new g(-1,0)),i),d=c(o,s.add(new g(0,-1)),i),l=c(o,s.add(new g(-1,-1)),i),u=w(n,p,d,l);return e.fragData0=u,e.fragData1=new m(0),e.fragData2=new m(0),e}}t([r(v)],S.prototype,"config",void 0),t([e(0,s(y))],S.prototype,"vertex",null),t([e(0,s(h))],S.prototype,"fragment",null);export{S as TextureStatisticsSumOfSquaredDiffShader};
5
+ import{__decorate as t,__param as e}from"tslib";import{location as o,uniform as r,input as s,VertexInput as a,UniformGroup as n,GraphShaderModule as i,FragmentOutput as p,FragmentInput as d}from"../../GraphShaderModule.js";import{Vec2 as l,Sampler2D as u,Int as f,Vec4 as g,IVec2 as m,texelFetch as c}from"../../graph/glsl.js";import{uvToClip as w,sum4 as x}from"./utils.js";class y extends a{}t([o(0,l)],y.prototype,"position",void 0);class h extends d{}class v extends n{}t([r(u)],v.prototype,"sumTexture",void 0),t([r(f)],v.prototype,"width",void 0),t([r(f)],v.prototype,"height",void 0);class D extends i{constructor(){super(...arguments),this.type="TextureStatisticsSumOfSquaredDiffShader"}vertex(t){const e=t.position;return{uv:e,glPosition:new g(w(e),0,1)}}fragment(t){const e=new p,{sumTexture:o}=this.config,r=t.glFragCoord.xy,s=new m(r.multiply(2)),a=new f(0),n=c(o,s,a),i=c(o,s.add(new m(-1,0)),a),d=c(o,s.add(new m(0,-1)),a),l=c(o,s.add(new m(-1,-1)),a),u=x(n,i,d,l);return e.fragData0=u,e.fragData1=new g(0),e.fragData2=new g(0),e.fragData3=new g(0),e}}t([r(v)],D.prototype,"config",void 0),t([e(0,s(y))],D.prototype,"vertex",null),t([e(0,s(h))],D.prototype,"fragment",null);export{D as TextureStatisticsSumOfSquaredDiffShader};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import r from"../../../../core/Accessor.js";import{property as t}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as o}from"../../../../core/accessorSupport/decorators/subclass.js";import{i as n}from"../../../../chunks/vec32.js";import{fromValues as s,create as i}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as a,width as c,height as p,expand as d}from"../../../../geometry/support/aaBoundingRect.js";import{vectorCoordinates as l}from"../../../../geometry/support/coordinateSystem.js";let m=class extends r{constructor(e){super(e),this.rawResult=null}get localOrigin(){const{extent:e}=this;return s(e.center.x,e.center.y,0)}get localOriginRenderSpace(){const{extent:e,localOrigin:r,renderCoordsHelper:t}=this,o=i();return t.toRenderCoords(r,e.spatialReference,o),o}get cameraPositionRenderSpace(){const{localOriginRenderSpace:e,renderCoordsHelper:r}=this,t=i();return r.setAltitude(t,g,e),t}get cameraDimensions(){const{extent:e,renderCoordsHelper:r}=this;if(2===r.viewingMode)return{width:e.width,height:e.height};const t=a();this._expandBoundingRect(e.xmin,e.ymin,t),this._expandBoundingRect(e.xmax,e.ymin,t),this._expandBoundingRect(e.xmin,e.ymax,t),this._expandBoundingRect(e.xmax,e.ymax,t);return{width:c(t),height:p(t)}}get cameraNearFar(){return{near:x,far:R}}get upVector(){return this.renderCoordsHelper.worldBasisAtPosition(this.cameraPositionRenderSpace,2,i())}get northVector(){return this.renderCoordsHelper.worldBasisAtPosition(this.cameraPositionRenderSpace,1,i())}get eastVector(){return this.renderCoordsHelper.worldBasisAtPosition(this.cameraPositionRenderSpace,0,i())}_expandBoundingRect(e,r,t){const{extent:o,eastVector:s,northVector:i,upVector:a,renderCoordsHelper:c}=this,p=o.center.z??0;n(u,e,r,p),c.toRenderCoords(u,o.spatialReference,u),l(u,s,i,a,h),d(t,h,t)}};e([t()],m.prototype,"renderCoordsHelper",void 0),e([t()],m.prototype,"extent",void 0),e([t()],m.prototype,"localOrigin",null),e([t()],m.prototype,"localOriginRenderSpace",null),e([t()],m.prototype,"cameraPositionRenderSpace",null),e([t()],m.prototype,"cameraDimensions",null),e([t()],m.prototype,"upVector",null),e([t()],m.prototype,"northVector",null),e([t()],m.prototype,"eastVector",null),e([t()],m.prototype,"rawResult",void 0),m=e([o("esri.views.3d.analysis.VolumeMeasurement.VolumeMeasurementCutFillComputation")],m);const u=i(),h=i(),g=9e3,x=0,R=2e4;export{m as VolumeMeasurementCutFillComputation};
5
+ import{__decorate as e}from"tslib";import r from"../../../../core/Accessor.js";import{property as t}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as o}from"../../../../core/accessorSupport/decorators/subclass.js";import{i as n}from"../../../../chunks/vec32.js";import{fromValues as s,create as i}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as c,fromExtent as a,width as p,height as d,expand as l}from"../../../../geometry/support/aaBoundingRect.js";import{vectorCoordinates as m}from"../../../../geometry/support/coordinateSystem.js";let u=class extends r{constructor(e){super(e),this.rawResult=null}get localOrigin(){const{extent:e}=this;return s(e.center.x,e.center.y,0)}get localOriginRenderSpace(){const{extent:e,localOrigin:r,renderCoordsHelper:t}=this,o=i();return t.toRenderCoords(r,e.spatialReference,o),o}get cameraPositionRenderSpace(){const{localOriginRenderSpace:e,renderCoordsHelper:r}=this,t=i();return r.setAltitude(t,R,e),t}get boundingRect(){const{extent:e,renderCoordsHelper:r}=this,t=c();return 2===r.viewingMode?a(e,t):(this._expandBoundingRect(e.xmin,e.ymin,t),this._expandBoundingRect(e.xmax,e.ymin,t),this._expandBoundingRect(e.xmin,e.ymax,t),this._expandBoundingRect(e.xmax,e.ymax,t)),t}get cameraDimensions(){const{boundingRect:e}=this;return{width:p(e),height:d(e)}}get cameraNearFar(){return{near:x,far:y}}get upVector(){return this.renderCoordsHelper.worldBasisAtPosition(this.cameraPositionRenderSpace,2,i())}get northVector(){return this.renderCoordsHelper.worldBasisAtPosition(this.cameraPositionRenderSpace,1,i())}get eastVector(){return this.renderCoordsHelper.worldBasisAtPosition(this.cameraPositionRenderSpace,0,i())}_expandBoundingRect(e,r,t){const{extent:o,eastVector:s,northVector:i,upVector:c,renderCoordsHelper:a}=this,p=o.center.z??0;n(g,e,r,p),a.toRenderCoords(g,o.spatialReference,g),m(g,s,i,c,h),l(t,h,t)}};e([t()],u.prototype,"renderCoordsHelper",void 0),e([t()],u.prototype,"extent",void 0),e([t()],u.prototype,"localOrigin",null),e([t()],u.prototype,"localOriginRenderSpace",null),e([t()],u.prototype,"cameraPositionRenderSpace",null),e([t()],u.prototype,"boundingRect",null),e([t()],u.prototype,"cameraDimensions",null),e([t()],u.prototype,"upVector",null),e([t()],u.prototype,"northVector",null),e([t()],u.prototype,"eastVector",null),e([t()],u.prototype,"rawResult",void 0),u=e([o("esri.views.3d.analysis.VolumeMeasurement.VolumeMeasurementCutFillComputation")],u);const g=i(),h=i(),R=9e3,x=0,y=2e4;export{u as VolumeMeasurementCutFillComputation};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import t from"../../../../core/Accessor.js";import o from"../../../../core/Logger.js";import{syncAndInitial as i,watch as r,when as s,initial as n}from"../../../../core/reactiveUtils.js";import{property as a}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/RandomLCG.js";import{subclass as l}from"../../../../core/accessorSupport/decorators/subclass.js";import{e as p}from"../../../../chunks/earcut.js";import{create as m}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{UpdatingHandles as u}from"../../../../core/support/UpdatingHandles.js";import{projectOrLoad as d}from"../../../../geometry/projectionUtils.js";import{computeTranslationToOriginAndRotation as c}from"../../../../geometry/projection/computeTranslationToOriginAndRotation.js";import{projectBoundingRect as h}from"../../../../geometry/projection/projectBoundingRect.js";import{empty as y,fromExtent as g,intersects as f}from"../../../../geometry/support/aaBoundingRect.js";import{newDoubleArray as v}from"../../../../geometry/support/DoubleArray.js";import{t as _}from"../../../../chunks/vec3.js";import w from"../../../../symbols/support/ElevationInfo.js";import{logFailedGeometryProjectionError as j}from"../support/projectionUtils.js";import{VolumeMeasurementCutFillComputation as C}from"./VolumeMeasurementCutFillComputation.js";import G from"./VolumeMeasurementResult.js";import{getRawResult as D}from"./volumeMeasurementUtils.js";import{ElevationContext as R}from"../../layers/graphics/ElevationContext.js";import{getElevationAtPoint as V}from"../../support/ElevationProvider.js";import{geometryToRenderInfo as H}from"../../support/renderInfoUtils/polygon.js";import{CutFillDepth as x,TargetGeometry as b}from"../../webgl-engine/lib/CutFillDepth.js";let A=class extends t{constructor(e){super(e),this._computation=null,this._updatingHandles=new u}initialize(){const e=this.view;this._renderer=new x({view:e}),this._updatingHandles.add(()=>({geometry:this.analysis.geometry,projectedGeometry:d(this.analysis.geometry,this.view.spatialReference)}),({geometry:e,projectedGeometry:t})=>{null==t.pending?this._onGeometryChange(e,t.geometry):this._updatingHandles.addPromise(t.pending)},i),this.addHandles([this._createElevationUpdateHandle(),r(()=>[this.analysis.measureType,this.analysisViewData.elevationAlignedGeometry,this.analysisViewData.effectiveTargetElevation],()=>this._updateTargetGeometry(),n),r(()=>this.analysisViewData.targetGeometry,e=>{if(!e||!this._computation)return;const t=this._getGeometryAttributes(e,this._computation.extent,this._computation.localOrigin);this._renderer.setup(this._computation,t),this._renderer.start()},n),s(()=>this._renderer.done,()=>this._updateResult())])}destroy(){this._updatingHandles.destroy(),this._renderer.destroy()}get updating(){return this._renderer.updating||this._updatingHandles.updating}get result(){const e=this._computation?.rawResult;return e?new G({measureType:this.analysis.measureType,rawResult:e,unit:this.analysisViewData.effectiveDisplayUnits.volume}):null}_createComputation(e){const{renderCoordsHelper:t}=this.view;this._computation=new C({extent:e,renderCoordsHelper:t})}_updateComputation(e){this._computation?this._computation.extent=e:this._createComputation(e)}_removeComputation(){this._computation=null}_createElevationUpdateHandle(){const e=t=>{const o=this.analysis.geometry;if(null==o||"ground"!==t.context)return;const i=d(o,this.view.spatialReference);if(null!=i.pending)return this._updatingHandles.addPromise(i.pending),void i.pending.finally(()=>e(t));const r=i.geometry;null!=r&&null!=r.extent&&(h(t.extent,t.spatialReference,T,this.view.spatialReference),g(r.extent,U),f(T,U)&&this._onGeometryChange(o,r))};return this.view.elevationProvider.on("elevation-change",t=>e(t))}_onGeometryChange(e,t){const{elevationProvider:i}=this.view,{valid:r}=this.analysis;if(null==e||!r)return this.analysisViewData.elevationAlignedGeometry=null,void this._removeComputation();if(null==t)return j(this.analysis,e.spatialReference,o.getLogger(this)),void(this.analysisViewData.elevationAlignedGeometry=null);this._updateComputation(t.extent);const s=t.clone();E(i,s),this.analysisViewData.elevationAlignedGeometry=s}_updateTargetGeometry(){const{measureType:e}=this.analysis,{elevationAlignedGeometry:t,effectiveTargetElevation:o}=this.analysisViewData;if(!t)return void(this.analysisViewData.targetGeometry=null);if("stockpile"===e||null==o)return void(this.analysisViewData.targetGeometry=t);const i=t.clone();i.rings[0].forEach(e=>{e[2]=o}),this.analysisViewData.targetGeometry=i}_updateResult(){if(!this._computation)return;const{cameraDimensions:e,cameraNearFar:{near:t,far:o}}=this._computation,{width:i,height:r}=this._renderer,s=e.width/i*(e.height/r),n=this._renderer.getDepth(),a=e=>e*(o-t)+t,l=a(n.cut)*s,p=a(n.fill)*s;this._computation.rawResult=D(Math.abs(l),p)}_getGeometryAttributes(e,t,o){const{elevationProvider:i,renderCoordsHelper:r}=this.view,s=H(e,i,r,R.fromElevationInfo(new w({mode:"absolute-height"}))),{polygons:n}=s,a=n[0],l=p(a.position,a.holeIndices,3),u=v(3*a.count),d=m(),h=m();return c(t.spatialReference,o,d,r.spatialReference),h[12]=-d[12],h[13]=-d[13],h[14]=-d[14],_(u,a.position,h),new b(u,l)}};function E(e,t){t.rings[0].forEach(t=>{t[2]=V(e,t,"ground")??0})}e([a({constructOnly:!0})],A.prototype,"analysis",void 0),e([a({constructOnly:!0})],A.prototype,"analysisViewData",void 0),e([a({constructOnly:!0})],A.prototype,"view",void 0),e([a()],A.prototype,"updating",null),e([a()],A.prototype,"result",null),e([a()],A.prototype,"_renderer",void 0),e([a()],A.prototype,"_computation",void 0),e([a({readOnly:!0})],A.prototype,"_updatingHandles",void 0),A=e([l("esri.views.3d.analysis.VolumeMeasurement.VolumeMeasurementCutFillController")],A);const T=y(),U=y();export{A as VolumeMeasurementCutFillController};
5
+ import{__decorate as e}from"tslib";import t from"../../../../core/Accessor.js";import i from"../../../../core/Logger.js";import{syncAndInitial as o,watch as r,when as n,initial as s}from"../../../../core/reactiveUtils.js";import{property as a}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/RandomLCG.js";import{subclass as l}from"../../../../core/accessorSupport/decorators/subclass.js";import{e as p}from"../../../../chunks/earcut.js";import{create as m}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{UpdatingHandles as u}from"../../../../core/support/UpdatingHandles.js";import{projectOrLoad as c}from"../../../../geometry/projectionUtils.js";import{computeTranslationToOriginAndRotation as d}from"../../../../geometry/projection/computeTranslationToOriginAndRotation.js";import{projectBoundingRect as h}from"../../../../geometry/projection/projectBoundingRect.js";import{width as y,height as g,empty as f,fromExtent as v,intersects as _}from"../../../../geometry/support/aaBoundingRect.js";import{newDoubleArray as w}from"../../../../geometry/support/DoubleArray.js";import{t as j}from"../../../../chunks/vec3.js";import R from"../../../../symbols/support/ElevationInfo.js";import{logFailedGeometryProjectionError as x}from"../support/projectionUtils.js";import{VolumeMeasurementCutFillComputation as C}from"./VolumeMeasurementCutFillComputation.js";import G from"./VolumeMeasurementResult.js";import{getRawResult as D}from"./volumeMeasurementUtils.js";import{ElevationContext as V}from"../../layers/graphics/ElevationContext.js";import{getElevationAtPoint as H}from"../../support/ElevationProvider.js";import{geometryToRenderInfo as b}from"../../support/renderInfoUtils/polygon.js";import{CutFillDepth as A,TargetGeometry as E}from"../../webgl-engine/lib/CutFillDepth.js";import{euclideanDirectDistance as T}from"../../../support/euclideanLengthMeasurementUtils.js";let U=class extends t{constructor(e){super(e),this._computation=null,this._updatingHandles=new u}initialize(){const e=this.view;this._renderer=new A({view:e}),this._updatingHandles.add(()=>({geometry:this.analysis.geometry,projectedGeometry:c(this.analysis.geometry,this.view.spatialReference)}),({geometry:e,projectedGeometry:t})=>{null==t.pending?this._onGeometryChange(e,t.geometry):this._updatingHandles.addPromise(t.pending)},o),this.addHandles([this._createElevationUpdateHandle(),r(()=>[this.analysis.measureType,this.analysisViewData.elevationAlignedGeometry,this.analysisViewData.effectiveTargetElevation],()=>this._updateTargetGeometry(),s),r(()=>this.analysisViewData.targetGeometry,e=>{if(!e||!this._computation)return;const t=this._getGeometryAttributes(e,this._computation.extent,this._computation.localOrigin);this._renderer.setup(this._computation,t),this._renderer.start()},s),n(()=>this._renderer.done,()=>this._updateResult())])}destroy(){this._updatingHandles.destroy(),this._renderer.destroy()}get updating(){return this._renderer.updating||this._updatingHandles.updating}get result(){const e=this._computation?.rawResult;return e?new G({measureType:this.analysis.measureType,rawResult:e,unit:this.analysisViewData.effectiveDisplayUnits.volume}):null}_createComputation(e){const{renderCoordsHelper:t}=this.view;this._computation=new C({extent:e,renderCoordsHelper:t})}_updateComputation(e){this._computation?this._computation.extent=e:this._createComputation(e)}_removeComputation(){this._computation=null}_createElevationUpdateHandle(){const e=t=>{const i=this.analysis.geometry;if(null==i||"ground"!==t.context)return;const o=c(i,this.view.spatialReference);if(null!=o.pending)return this._updatingHandles.addPromise(o.pending),void o.pending.finally(()=>e(t));const r=o.geometry;null!=r&&null!=r.extent&&(h(t.extent,t.spatialReference,P,this.view.spatialReference),v(r.extent,F),_(P,F)&&this._onGeometryChange(i,r))};return this.view.elevationProvider.on("elevation-change",t=>e(t))}_onGeometryChange(e,t){const{elevationProvider:o}=this.view,{valid:r}=this.analysis;if(null==e||!r)return this.analysisViewData.elevationAlignedGeometry=null,void this._removeComputation();if(null==t)return x(this.analysis,e.spatialReference,i.getLogger(this)),void(this.analysisViewData.elevationAlignedGeometry=null);this._updateComputation(t.extent);const n=t.clone();M(o,n),this.analysisViewData.elevationAlignedGeometry=n}_updateTargetGeometry(){const{measureType:e}=this.analysis,{elevationAlignedGeometry:t,effectiveTargetElevation:i}=this.analysisViewData;if(!t)return void(this.analysisViewData.targetGeometry=null);if("stockpile"===e||null==i)return void(this.analysisViewData.targetGeometry=t);const o=t.clone();o.rings[0].forEach(e=>{e[2]=i}),this.analysisViewData.targetGeometry=o}_updateResult(){if(!this._computation)return;const{spatialReference:e,viewingMode:t}=this.view,{extent:i,boundingRect:o,cameraNearFar:{near:r,far:n}}=this._computation,{width:s,height:a}=this._renderer;let l,p;"local"===t&&e.isWebMercator?({width:l,height:p}=O(i)):(l=y(o),p=g(o));const m=l/s*(p/a),u=this._renderer.getDepth(),c=e=>e*(n-r)+r,d=c(u.cut)*m,h=c(u.fill)*m;this._computation.rawResult=D(Math.abs(d),h)}_getGeometryAttributes(e,t,i){const{elevationProvider:o,renderCoordsHelper:r}=this.view,n=b(e,o,r,V.fromElevationInfo(new R({mode:"absolute-height"}))),{polygons:s}=n,a=s[0],l=p(a.position,a.holeIndices,3),u=w(3*a.count),c=m(),h=m();return d(t.spatialReference,i,c,r.spatialReference),h[12]=-c[12],h[13]=-c[13],h[14]=-c[14],j(u,a.position,h),new E(u,l)}};function M(e,t){t.rings[0].forEach(t=>{t[2]=H(e,t,"ground")??0})}function O(e){const t=T([e.xmin,e.ymin,0],[e.xmax,e.ymin,0],e.spatialReference),i=T([e.xmin,e.ymin,0],[e.xmin,e.ymax,0],e.spatialReference);return{width:t?.value??0,height:i?.value??0}}e([a({constructOnly:!0})],U.prototype,"analysis",void 0),e([a({constructOnly:!0})],U.prototype,"analysisViewData",void 0),e([a({constructOnly:!0})],U.prototype,"view",void 0),e([a()],U.prototype,"updating",null),e([a()],U.prototype,"result",null),e([a()],U.prototype,"_renderer",void 0),e([a()],U.prototype,"_computation",void 0),e([a({readOnly:!0})],U.prototype,"_updatingHandles",void 0),U=e([l("esri.views.3d.analysis.VolumeMeasurement.VolumeMeasurementCutFillController")],U);const P=f(),F=f();export{U as VolumeMeasurementCutFillController};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import t from"../../../../Color.js";import i from"../../../../core/Accessor.js";import{destroyMaybe as o}from"../../../../core/maybe.js";import{watch as s}from"../../../../core/reactiveUtils.js";import{property as r}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as n}from"../../../../core/accessorSupport/decorators/subclass.js";import{i as l}from"../../../../chunks/vec32.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{cutFillConfiguration as m}from"./VolumeMeasurementConfiguration.js";import{LineVisualElement as c}from"../../interactive/visualElements/LineVisualElement.js";import{OutlineVisualElement as p}from"../../interactive/visualElements/OutlineVisualElement.js";import{GeodesicSegment as h}from"../../interactive/visualElements/support/Segment.js";import{createStipplePatternSimple as u}from"../../webgl-engine/materials/lineStippleUtils.js";let d=class extends i{get visible(){return this.analysisViewData.visible&&null!=this.analysisViewData.elevationAlignedGeometry&&null!=this.analysisViewData.targetGeometry}constructor(e){super(e)}initialize(){const{accentColor:e}=this.view.effectiveTheme,i={view:this.view,isDecoration:!0},o=m,r={...i,width:o.geometryOutlineWidth},n=t.toUnitRGBA(e),l=t.toUnitRGBA(o.targetGeometryOutlineColor);this._elevationAlignedGeometry=new p({...r,isDraped:!0,color:n}),this._targetGeometry=new p({...r,color:l});const a={...i,attached:!0,width:o.projectionLineWidth,stipplePattern:u(o.projectionLineStippleSize),renderOccluded:4},h=t.toUnitRGBA(o.cutProjectionLineColor),d=t.toUnitRGBA(o.fillProjectionLineColor);this._cutProjectionLines=new c({...a,color:h}),this._fillProjectionLines=new c({...a,color:d}),this.addHandles([s(()=>[this.analysisViewData.elevationAlignedGeometry,this.analysisViewData.targetGeometry,this.visible],()=>this._updateVisualElements()),s(()=>this.view.effectiveTheme.accentColor,e=>{this._elevationAlignedGeometry.color=t.toUnitRGBA(e)})])}destroy(){this._elevationAlignedGeometry=o(this._elevationAlignedGeometry),this._targetGeometry=o(this._targetGeometry),this._cutProjectionLines=o(this._cutProjectionLines),this._fillProjectionLines=o(this._fillProjectionLines)}_updateVisualElements(){this._updateGeometries(),this._updateProjectionLines()}_updateGeometries(){const e=this.visible,{elevationAlignedGeometry:t,targetGeometry:i}=this.analysisViewData;this._elevationAlignedGeometry.geometry=t,this._elevationAlignedGeometry.visible=e,this._targetGeometry.geometry=i,this._targetGeometry.visible=e}_updateProjectionLines(){const e=this.visible,{elevationAlignedGeometry:t,targetGeometry:i}=this.analysisViewData;if(this._cutProjectionLines.visible=e,this._fillProjectionLines.visible=e,!t||!i)return;const{renderCoordsHelper:o}=this.view,s=o.spatialReference,r=[],n=[],a=t.spatialReference;for(let m=0;m<t.rings[0].length;++m){const e=t.rings[0][m],c=l(y,e[0],e[1],e[2]);o.toRenderCoords(c,a,c);const p=i.rings[0][m],u=l(v,p[0],p[1],p[2]);o.toRenderCoords(u,a,u);const d=new h(c,u,s);c[2]>u[2]?r.push(d):n.push(d)}this._cutProjectionLines.setGeometryFromSegments(r),this._fillProjectionLines.setGeometryFromSegments(n)}};e([r({constructOnly:!0})],d.prototype,"view",void 0),e([r({constructOnly:!0})],d.prototype,"analysisViewData",void 0),e([r({readOnly:!0})],d.prototype,"visible",null),d=e([n("esri.views.3d.analysis.VolumeMeasurement.VolumeMeasurementCutFillVisualization")],d);const y=a(),v=a();export{d as VolumeMeasurementCutFillVisualization};
5
+ import{__decorate as e}from"tslib";import t from"../../../../Color.js";import i from"../../../../core/Accessor.js";import{destroyMaybe as o}from"../../../../core/maybe.js";import{watch as s,initial as r}from"../../../../core/reactiveUtils.js";import{property as n}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as l}from"../../../../core/accessorSupport/decorators/subclass.js";import{e as a}from"../../../../chunks/earcut.js";import{create as m}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{i as c}from"../../../../chunks/vec32.js";import{create as p,fromValues as u}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{computeTranslationToOriginAndRotation as h}from"../../../../geometry/projection/computeTranslationToOriginAndRotation.js";import{newDoubleArray as d}from"../../../../geometry/support/DoubleArray.js";import{newIndexArray as y}from"../../../../geometry/support/Indices.js";import{t as g}from"../../../../chunks/vec3.js";import f from"../../../../symbols/support/ElevationInfo.js";import{cutFillConfiguration as v}from"./VolumeMeasurementConfiguration.js";import{LineVisualElement as j}from"../../interactive/visualElements/LineVisualElement.js";import{OutlineVisualElement as _}from"../../interactive/visualElements/OutlineVisualElement.js";import{GeodesicSegment as G}from"../../interactive/visualElements/support/Segment.js";import{ElevationContext as w}from"../../layers/graphics/ElevationContext.js";import{extrudePolygon as b}from"../../layers/graphics/Graphics3DExtrudeSymbolLayer.js";import{geometryToRenderInfo as C}from"../../support/renderInfoUtils/polygon.js";import{CutFillColor as V,VolumeGeometry as L}from"../../webgl-engine/lib/CutFillColor.js";import{createStipplePatternSimple as R}from"../../webgl-engine/materials/lineStippleUtils.js";let A=class extends i{get visible(){return this.analysisViewData.visible&&null!=this.analysisViewData.elevationAlignedGeometry&&null!=this.analysisViewData.targetGeometry}constructor(e){super(e),this._elevationContext=w.fromElevationInfo(new f({mode:"absolute-height"})),this._extrusionHeight=1e4}initialize(){const{view:e}=this,{accentColor:i}=e.effectiveTheme,o={view:e,isDecoration:!0},n=v,l={...o,width:n.geometryOutlineWidth},a=t.toUnitRGBA(i),m=t.toUnitRGBA(n.targetGeometryOutlineColor);this._elevationAlignedGeometry=new _({...l,isDraped:!0,color:a}),this._targetGeometry=new _({...l,color:m});const c={...o,attached:!0,width:n.projectionLineWidth,stipplePattern:R(n.projectionLineStippleSize),renderOccluded:4},p=t.toUnitRGBA(n.cutProjectionLineColor),u=t.toUnitRGBA(n.fillProjectionLineColor);this._cutProjectionLines=new j({...c,color:p}),this._fillProjectionLines=new j({...c,color:u}),this._cutFillRenderNode=new V({view:e,cutColor:n.cutColor,fillColor:n.fillColor}),this.addHandles([s(()=>[this.analysisViewData.elevationAlignedGeometry,this.analysisViewData.targetGeometry,this.visible],()=>this._updateVisualElements()),s(()=>this.view.effectiveTheme.accentColor,e=>{this._elevationAlignedGeometry.color=t.toUnitRGBA(e)}),s(()=>this.analysisViewData.targetGeometry,()=>this._updateCutFillGeometry(),r),s(()=>this.visible,()=>this._updateCutFillVisibility())])}destroy(){this._elevationAlignedGeometry=o(this._elevationAlignedGeometry),this._targetGeometry=o(this._targetGeometry),this._cutProjectionLines=o(this._cutProjectionLines),this._fillProjectionLines=o(this._fillProjectionLines),this._cutFillRenderNode.destroy()}_updateVisualElements(){this._updateGeometries(),this._updateProjectionLines()}_updateGeometries(){const e=this.visible,{elevationAlignedGeometry:t,targetGeometry:i}=this.analysisViewData;this._elevationAlignedGeometry.geometry=t,this._elevationAlignedGeometry.visible=e,this._targetGeometry.geometry=i,this._targetGeometry.visible=e}_updateProjectionLines(){const e=this.visible,{elevationAlignedGeometry:t,targetGeometry:i}=this.analysisViewData;if(this._cutProjectionLines.visible=e,this._fillProjectionLines.visible=e,!t||!i)return;const{renderCoordsHelper:o}=this.view,s=o.spatialReference,r=[],n=[],l=t.spatialReference;for(let a=0;a<t.rings[0].length;++a){const e=t.rings[0][a],m=c(P,e[0],e[1],e[2]);o.toRenderCoords(m,l,m);const p=i.rings[0][a],u=c(x,p[0],p[1],p[2]);o.toRenderCoords(u,l,u);const h=new G(m,u,s);m[2]>u[2]?r.push(h):n.push(h)}this._cutProjectionLines.setGeometryFromSegments(r),this._fillProjectionLines.setGeometryFromSegments(n)}_updateCutFillVisibility(){this.visible?this._cutFillRenderNode.enable():this._cutFillRenderNode.disable()}_updateCutFillGeometry(){const{renderCoordsHelper:e}=this.view,{targetGeometry:t}=this.analysisViewData;if(!t?.extent)return;const{center:i}=t.extent,o=u(i.x,i.y,0),s=p();e.toRenderCoords(o,t.spatialReference,s);const r=this._getExtrudedVolumes(t,this._extrusionHeight,o),n=this._getExtrudedVolumes(t,-this._extrusionHeight,o);this._cutFillRenderNode.updateGeometries(r,n,s)}_getExtrudedVolumes(e,t,i){const{renderCoordsHelper:o,spatialReference:s,elevationProvider:r}=this.view,n=p(),l=1===o.viewingMode;l||o.worldUpAtPosition([0,0,0],n);const c=C(e,r,o,this._elevationContext),{polygons:u,mapPositions:f,position:v}=c,j=u[0],_=j.count,G=a(j.mapPositions,j.holeIndices,3),w=G.length,V=6*_,R=y(V+w),A=y(w),P=d(3*V),x=d(3*V);b(v,f,G,j,P,null,x,null,R,A,t,n,l);const D=m(),E=m();return h(s,i,D,o.spatialReference),E[12]=-D[12],E[13]=-D[13],E[14]=-D[14],g(P,P,E),new L(P,A,R,x)}};e([n({constructOnly:!0})],A.prototype,"view",void 0),e([n({constructOnly:!0})],A.prototype,"analysisViewData",void 0),e([n({readOnly:!0})],A.prototype,"visible",null),A=e([l("esri.views.3d.analysis.VolumeMeasurement.VolumeMeasurementCutFillVisualization")],A);const P=p(),x=p();export{A as VolumeMeasurementCutFillVisualization};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import{equals as t}from"../../../core/arrayUtils.js";import"../../../core/has.js";import{removeMaybe as i,abortMaybe as r}from"../../../core/maybe.js";import{debounce as s,ignoreAbortErrors as o,throwIfAborted as l}from"../../../core/promiseUtils.js";import{watch as n,when as a,sync as u,whenOnce as d}from"../../../core/reactiveUtils.js";import{addFrameTask as p}from"../../../core/scheduling.js";import{Seconds as h,secondsFromMilliseconds as c}from"../../../core/time.js";import{getMetersPerVerticalUnitForSR as m}from"../../../core/unitUtils.js";import{property as _}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/Logger.js";import{subclass as f}from"../../../core/accessorSupport/decorators/subclass.js";import{getReferenceEllipsoid as g}from"../../../geometry/ellipsoidUtils.js";import{projectOrLoad as y}from"../../../geometry/projectionUtils.js";import{fromExtent as w,intersection as v,toExtent as T,intersects as b}from"../../../geometry/support/aaBoundingRect.js";import R from"../../../symbols/support/ElevationInfo.js";import{simulationSettingsEqual as S,getPositions as j,getFlowSimulationSettings as L}from"../../2d/engine/flow/utils.js";import A from"./SubView3D.js";import{makeScheduleFunction as U}from"./support/makeScheduleFunction.js";import{thresholdForLoadingAllTiles as P,fadeOutTime as E,fadeInTime as x,defaultTransitionDuration as I,transitionDurationFactor as k,averageLoadingTimeSmoothingFactor as C}from"../support/flow/constants.js";import{FlowWorkerHandle as q}from"../support/flow/FlowWorkerHandle.js";import{materialParametersFromRenderer as z,createStreamlineGeometry as M}from"../support/flow/geometryUtils.js";import{boundingRectOfTiles as V}from"../support/flow/loadUtils.js";import{StreamlineResources3DOverlay as D}from"../support/flow/StreamlineResources3DOverlay.js";import{StreamlineResources3DShape as F}from"../support/flow/StreamlineResources3DShape.js";import B from"../support/flow/VisualQuery3D.js";import{tilesAreRelated as W}from"../terrain/tileUtils.js";import{isScreenSizePerspectiveEnabled as G}from"../webgl-engine/lib/screenSizePerspectiveUtils.js";import{RibbonLineMaterial as H}from"../webgl-engine/materials/RibbonLineMaterial.js";import{isInEffectiveScaleRange as O,hasLayerBasedScaleVisibility as N}from"../../support/layerViewUtils.js";import{TaskPriority as Q}from"../../support/Scheduler.js";let J=class extends A{constructor(e){super(e),this.type="flow",this.renderedTiles=null,this.requireLoad=!1,this.workerHandle=null,this._averageLoadingTime=h(0),this._abortController=null,this._frameTask=null,this._tilesUpdateIsWaiting=!1,this._transitionEnabled=!0,this._debugAllowAutoLoading=!0,this.emissiveStrength=0,this._overrideMaterialParameters=null,this._overrideSimulationSettings=null,this._updateTask=null,this._debouncedTileUpdate=s(async()=>{const{allTiles:e}=this.surface,t=this._getTileFilterFunction(),i=new Set;function*r(r){for(let s=0;s<e.length;++s){const o=e.at(s);t(o)&&i.add(o),r.madeProgress(),r.done&&(r=yield)}}await this._frameTask.scheduleGenerator(r),this.renderedTiles=i}),this._transitionEnabled=!0}initialize(){const{surface:e,view:t}=this,{resourceController:i}=t;this.workerHandle=new q(U(i)),this._frameTask=i.scheduler.registerTask(Q.FLOW_GENERATOR),this._updateTask=p({update:this._update.bind(this)}),this.addHandles([n(()=>this.simulationSettings,()=>this.triggerLoad(),{sync:!0,equals:(e,t)=>null==e&&null==t||null!=e&&null!=t&&S(e,t)}),n(()=>{const{elevationInfo:e}=this;return[this._clippingArea,this._visible,this._draped,this.view.state.contentPixelRatio,e?.mode,e?.offset,e?.unit]},()=>this.triggerLoad(),u),n(()=>this._materialParameters,e=>{this._resources?.setMaterialParameters(e),this._lastResources?.setMaterialParameters(e)}),e.on("tiles-changed",()=>this._triggerTilesUpdate()),t.enableFeatureTiles(),n(()=>[this._dataBounds,this._featureTilesBounds,this._loadAllTiles],()=>this._triggerTilesUpdate()),a(()=>!t.featureTiles?.updating,()=>this._triggerTilesUpdate())]),this._triggerTilesUpdate()}destroy(){this._updateTask=i(this._updateTask),this.abort(),this.clear()}abort(){this._abortController=r(this._abortController),this.requireLoad=!1}get _clippingArea(){const e=y(this.view.clippingArea,this.surface.spatialReference).geometry;return null==e?null:w(e)}get _dataBounds(){const e=y(this.layer.fullExtent,this.surface.spatialReference).geometry;return null==e?null:w(e)}get _draped(){return"on-the-ground"===this.elevationInfo.mode}get _ellipsoidRadius(){return g(this.view.spatialReference).radius}get _loadAllTiles(){const{position:e}=this.view.camera,t=e.z;if(null==t)return!1;return t*m(e.spatialReference)/this._ellipsoidRadius>=P}get _featureTilesBounds(){const e=this.view.featureTiles?.filterExtent,t=y(e,this.surface.spatialReference).geometry;return null==t?null:w(t)}get _flowRenderer(){const e=this.layer.renderer;return"flow"!==e?.type?null:e}get _materialParameters(){return{...z(this._flowRenderer,this.layerView.fullOpacity,this.emissiveStrength),fadeInTime:x,fadeOutTime:E,...this._overrideMaterialParameters,screenSizePerspective:!this._draped&&G(this.layer.screenSizePerspectiveEnabled)?this.view.screenSizePerspective.parameters:null}}get _opacity(){return this.layerView.fullOpacity}get _transitionDuration(){const{_averageLoadingTime:e}=this;return h(0===e?I:this._averageLoadingTime*k)}get _visible(){const e=this._flowRenderer?.color;return this.visibleAtCurrentScale&&this.layer.effectiveVisible&&this._opacity>0&&(null==e||e.a>0)}get elevationInfo(){return this.layer.elevationInfo??K}startPositions(e){if(!this._transitionEnabled)return[];const{_flowRenderer:t,_resources:i}=this;return null==t||null==i?[]:j(i.streamlines,i.query,e,t.flowSpeed)}get needsMagnitude(){return this._flowRenderer?.hasVisualVariables()??!1}get layer(){return this.layerView.layer}get updating(){return this.updatingHandles.updating||this.requireLoad}get visibleAtCurrentScale(){return!N()||O(this.layer.effectiveScaleRange,this.view.scale)}get simulationSettings(){const{_flowRenderer:e,_overrideSimulationSettings:t}=this;if(null==e)return null;let i=L(e);return i.segmentLength=i.lineCollisionWidth/2,i.onlyForwardTracing=!1,null!=t&&(i={...i,...t}),i}get surface(){return this.view.basemapTerrain}doRefresh(){this.triggerLoad()}clear(){this._resources?.detach(),this._resources=null,this._lastResources?.detach(),this._lastResources=null}_update(e){if(!this.requireLoad||this.updatingHandles.updating)return;const t=c(e.time);if(this._transitionEnabled&&!this._lastResourceIsTransitioned(t))return;const{renderedTiles:i}=this;if(null==i||0===i.size)return;const r=async()=>{const e=performance.now();await this._load(i,t,this._transitionDuration);const r=h((performance.now()-e)/1e3);this._updateAverageLoadingTime(r)};this.updatingHandles.addPromise(o(r())),this.requireLoad=!1}_updateAverageLoadingTime(e){const t=C;this._averageLoadingTime=h(t*e+(1-t)*this._averageLoadingTime)}triggerLoad(){this._debugAllowAutoLoading&&(this.requireLoad=!0)}async _load(e,t,i){const{view:r}=this;if(!this._visible)return void this.clear();if(0===e.size)return;const s=this._computeExtent(e);if(null==s)return;const o=this._transitionEnabled&&null!=this._resources?h(t+i):t,n=new B(s,this.layerView.timeExtent,this._viewSizeWithEqualRatio(s),r.state.contentPixelRatio,o);null==this._abortController&&(this._abortController=new AbortController);const a=this._abortController,u=await this._loadStreamlines(n,a.signal);if(l(a.signal),this._visible&&null!=u){u.attach(),this._lastResources?.detach(),this._transitionEnabled?this._lastResources=this._resources:this._resources?.detach(),this._resources=u;const e=performance.now()/1e3,t=this._transitionEnabled&&e>o?e:o;null!=this._lastResources&&(this._lastResources.endTime=t),this._resources.startTime=t}}async _loadStreamlines(e,t){const i=await this.fetchDataAndGenerateStreamlines(e,t);if(null==i||0===i.length)return null;const r=await this._createGeometry(e,i);return this._draped?new D(e,i,r,this.surface.overlayManager):new F(e,i,r,this.view.stage)}async fetchDataAndGenerateStreamlines(e,t){return null}async _createGeometry(e,t){const i=new H(this._materialParameters,this.view.state.isGlobal),r=new Array,{elevationInfo:s,_draped:o,view:l}=this;function*n(n){for(let a=0;a<t.length;++a)r.push(M(l,e,t[a],s,i,o)),n.madeProgress(),n.done&&(n=yield)}return await this._frameTask.scheduleGenerator(n),r}_computeExtent(e){const{spatialReference:t}=this.surface;if(null==t)return null;const i=V(e);return null==i?null:(v(i,this._clippingArea,i),T(i,t))}_triggerTilesUpdate(){if(this._tilesUpdateIsWaiting)return;this._tilesUpdateIsWaiting=!0;const e=async()=>{await d(()=>this.view.stationary),this._tilesUpdateIsWaiting=!1,await this._debouncedTileUpdate()};this.updatingHandles.addPromise(o(e()))}_getTileFilterFunction(){const{_dataBounds:e,view:i,_featureTilesBounds:r}=this;if(this._loadAllTiles)return t=>t.leaf&&X(e,t.extent);const s=t=>t.rendered&&t.visible&&X(e,t.extent),{featureTiles:o}=i;if(!o)return s;const l=o.tiles.filter(e=>e.measures.visible);return e=>s(e)&&X(r,e.extent)&&l.some(({lij:i})=>t(i,e.lij)||W(i,e.lij))}_viewSizeWithEqualRatio(e){const t=(e.xmax-e.xmin)/(e.ymax-e.ymin),[i,r]=this.view.size;return i<r?[i,Math.floor(i/t)]:[Math.floor(r*t),r]}_lastResourceIsTransitioned(e){const{_lastResources:t,_resources:i,_flowRenderer:r}=this;if(null==t||null==i||null==r)return!0;return i.startTime+E<e}get test(){}};e([_()],J.prototype,"type",void 0),e([_()],J.prototype,"renderedTiles",void 0),e([_()],J.prototype,"_resources",void 0),e([_()],J.prototype,"_lastResources",void 0),e([_()],J.prototype,"requireLoad",void 0),e([_()],J.prototype,"_averageLoadingTime",void 0),e([_()],J.prototype,"emissiveStrength",void 0),e([_()],J.prototype,"_clippingArea",null),e([_()],J.prototype,"_dataBounds",null),e([_()],J.prototype,"_draped",null),e([_()],J.prototype,"_ellipsoidRadius",null),e([_()],J.prototype,"_loadAllTiles",null),e([_()],J.prototype,"_featureTilesBounds",null),e([_()],J.prototype,"_flowRenderer",null),e([_()],J.prototype,"_materialParameters",null),e([_()],J.prototype,"_opacity",null),e([_()],J.prototype,"_transitionDuration",null),e([_()],J.prototype,"_visible",null),e([_()],J.prototype,"elevationInfo",null),e([_()],J.prototype,"needsMagnitude",null),e([_()],J.prototype,"layer",null),e([_()],J.prototype,"updating",null),e([_()],J.prototype,"visibleAtCurrentScale",null),e([_()],J.prototype,"_overrideMaterialParameters",void 0),e([_()],J.prototype,"_overrideSimulationSettings",void 0),e([_()],J.prototype,"simulationSettings",null),e([_()],J.prototype,"surface",null),J=e([f("esri.views.3d.layers.FlowSubView3D")],J);const K=new R({mode:"on-the-ground"});function X(e,t){return null==e||null==t||b(e,t)}export{J as default};
5
+ import{__decorate as e}from"tslib";import{equals as t}from"../../../core/arrayUtils.js";import"../../../core/has.js";import{removeMaybe as i,abortMaybe as r}from"../../../core/maybe.js";import{debounce as s,ignoreAbortErrors as o,throwIfAborted as l}from"../../../core/promiseUtils.js";import{watch as a,when as n,sync as u,whenOnce as d}from"../../../core/reactiveUtils.js";import{addFrameTask as p}from"../../../core/scheduling.js";import{Seconds as h,secondsFromMilliseconds as c}from"../../../core/time.js";import{getMetersPerVerticalUnitForSR as m}from"../../../core/unitUtils.js";import{property as _}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/Logger.js";import{subclass as f}from"../../../core/accessorSupport/decorators/subclass.js";import{getReferenceEllipsoid as g}from"../../../geometry/ellipsoidUtils.js";import{projectOrLoad as y}from"../../../geometry/projectionUtils.js";import{fromExtent as w,intersection as v,toExtent as T,intersects as b}from"../../../geometry/support/aaBoundingRect.js";import R from"../../../symbols/support/ElevationInfo.js";import{simulationSettingsEqual as S,getPositions as j,getFlowSimulationSettings as L}from"../../2d/engine/flow/utils.js";import A from"./SubView3D.js";import{makeScheduleFunction as P}from"./support/makeScheduleFunction.js";import{thresholdForLoadingAllTiles as U,fadeOutTime as E,fadeInTime as x,defaultTransitionDuration as I,transitionDurationFactor as V,averageLoadingTimeSmoothingFactor as k}from"../support/flow/constants.js";import{FlowWorkerHandle as C}from"../support/flow/FlowWorkerHandle.js";import{materialParametersFromRenderer as q,createStreamlineGeometry as z}from"../support/flow/geometryUtils.js";import{boundingRectOfTiles as M}from"../support/flow/loadUtils.js";import{StreamlineResources3DOverlay as D}from"../support/flow/StreamlineResources3DOverlay.js";import{StreamlineResources3DShape as F}from"../support/flow/StreamlineResources3DShape.js";import B from"../support/flow/VisualQuery3D.js";import{tilesAreRelated as W}from"../terrain/tileUtils.js";import{isScreenSizePerspectiveEnabled as G}from"../webgl-engine/lib/screenSizePerspectiveUtils.js";import{RibbonLineMaterial as H}from"../webgl-engine/materials/RibbonLineMaterial.js";import{isInEffectiveScaleRange as O,hasLayerBasedScaleVisibility as N}from"../../support/layerViewUtils.js";import{TaskPriority as Q}from"../../support/Scheduler.js";let J=class extends A{constructor(e){super(e),this.type="flow",this.renderedTiles=null,this.requireLoad=!1,this.workerHandle=null,this._averageLoadingTime=h(0),this._abortController=null,this._frameTask=null,this._tilesUpdateIsWaiting=!1,this._transitionEnabled=!0,this._debugAllowAutoLoading=!0,this.emissiveStrength=0,this._overrideMaterialParameters=null,this._overrideSimulationSettings=null,this._updateTask=null,this._debouncedTileUpdate=s(async()=>{const{allTiles:e}=this.surface,t=this._getTileFilterFunction(),i=new Set;function*r(r){for(let s=0;s<e.length;++s){const o=e.at(s);t(o)&&i.add(o),r.madeProgress(),r.done&&(r=yield)}}await this._frameTask.scheduleGenerator(r),this.renderedTiles=i}),this._transitionEnabled=!0}initialize(){const{surface:e,view:t}=this,{resourceController:i}=t;this.workerHandle=new C(P(i)),this._frameTask=i.scheduler.registerTask(Q.FLOW_GENERATOR),this._updateTask=p({update:this._update.bind(this)}),this.addHandles([a(()=>this.simulationSettings,()=>this.triggerLoad(),{sync:!0,equals:(e,t)=>null==e&&null==t||null!=e&&null!=t&&S(e,t)}),a(()=>{const{elevationInfo:e}=this;return[this._clippingArea,this._visible,this._draped,this.view.state.contentPixelRatio,e?.mode,e?.offset,e?.unit]},()=>this.triggerLoad(),u),a(()=>this._materialParameters,e=>{this._resources?.setMaterialParameters(e),this._lastResources?.setMaterialParameters(e)}),e.on("tiles-changed",()=>this._triggerTilesUpdate()),t.enableFeatureTiles(),a(()=>[this._dataBounds,this._featureTilesBounds,this._loadAllTiles],()=>this._triggerTilesUpdate()),a(()=>this._flowRenderer,(e,t)=>{const i=t?.visualVariables??[],r=e?.visualVariables??[];r.length===i.length&&r.every((e,t)=>e.type===i[t].type)||this.clear()}),n(()=>!t.featureTiles?.updating,()=>this._triggerTilesUpdate())]),this._triggerTilesUpdate()}destroy(){this._updateTask=i(this._updateTask),this.abort(),this.clear()}abort(){this._abortController=r(this._abortController),this.requireLoad=!1}get _clippingArea(){const e=y(this.view.clippingArea,this.surface.spatialReference).geometry;return null==e?null:w(e)}get _dataBounds(){const e=y(this.layer.fullExtent,this.surface.spatialReference).geometry;return null==e?null:w(e)}get _draped(){return"on-the-ground"===this.elevationInfo.mode}get _ellipsoidRadius(){return g(this.view.spatialReference).radius}get _loadAllTiles(){const{position:e}=this.view.camera,t=e.z;if(null==t)return!1;return t*m(e.spatialReference)/this._ellipsoidRadius>=U}get _featureTilesBounds(){const e=this.view.featureTiles?.filterExtent,t=y(e,this.surface.spatialReference).geometry;return null==t?null:w(t)}get _flowRenderer(){const e=this.layer.renderer;return"flow"!==e?.type?null:e}get _materialParameters(){return{...q(this._flowRenderer,this.layerView.fullOpacity,this.emissiveStrength),fadeInTime:x,fadeOutTime:E,...this._overrideMaterialParameters,hasSlicePlane:this.layerView.slicePlaneEnabled,screenSizePerspective:!this._draped&&G(this.layer.screenSizePerspectiveEnabled)?this.view.screenSizePerspective.parameters:null}}get _opacity(){return this.layerView.fullOpacity}get _transitionDuration(){const{_averageLoadingTime:e}=this;return h(0===e?I:this._averageLoadingTime*V)}get _visible(){const e=this._flowRenderer?.color;return this.visibleAtCurrentScale&&this.layer.effectiveVisible&&this._opacity>0&&(null==e||e.a>0)}get elevationInfo(){return this.layer.elevationInfo??K}startPositions(e){if(!this._transitionEnabled)return[];const{_flowRenderer:t,_resources:i}=this;return null==t||null==i?[]:j(i.streamlines,i.query,e,t.flowSpeed)}get needsMagnitude(){return this._flowRenderer?.hasVisualVariables()??!1}get layer(){return this.layerView.layer}get updating(){return this.updatingHandles.updating||this.requireLoad}get visibleAtCurrentScale(){return!N()||O(this.layer.effectiveScaleRange,this.view.scale)}get simulationSettings(){const{_flowRenderer:e,_overrideSimulationSettings:t}=this;if(null==e)return null;let i=L(e);return i.segmentLength=i.lineCollisionWidth/2,i.onlyForwardTracing=!1,null!=t&&(i={...i,...t}),i}get surface(){return this.view.basemapTerrain}doRefresh(){this.triggerLoad()}clear(){this._resources?.detach(),this._resources=null,this._lastResources?.detach(),this._lastResources=null}_update(e){if(!this.requireLoad||this.updatingHandles.updating)return;const t=c(e.time);if(this._transitionEnabled&&!this._lastResourceIsTransitioned(t))return;const{renderedTiles:i}=this;if(null==i||0===i.size)return;const r=async()=>{const e=performance.now();await this._load(i,t,this._transitionDuration);const r=h((performance.now()-e)/1e3);this._updateAverageLoadingTime(r)};this.updatingHandles.addPromise(o(r())),this.requireLoad=!1}_updateAverageLoadingTime(e){const t=k;this._averageLoadingTime=h(t*e+(1-t)*this._averageLoadingTime)}triggerLoad(){this._debugAllowAutoLoading&&(this.requireLoad=!0)}async _load(e,t,i){const{view:r}=this;if(!this._visible)return void this.clear();if(0===e.size)return;const s=this._computeExtent(e);if(null==s)return;const o=this._transitionEnabled&&null!=this._resources?h(t+i):t,a=new B(s,this.layerView.timeExtent,this._viewSizeWithEqualRatio(s),r.state.contentPixelRatio,o);null==this._abortController&&(this._abortController=new AbortController);const n=this._abortController,u=await this._loadStreamlines(a,n.signal);if(l(n.signal),this._visible&&null!=u){u.attach(),this._lastResources?.detach(),this._transitionEnabled?this._lastResources=this._resources:this._resources?.detach(),this._resources=u;const e=performance.now()/1e3,t=this._transitionEnabled&&e>o?e:o;null!=this._lastResources&&(this._lastResources.endTime=t),this._resources.startTime=t}}async _loadStreamlines(e,t){const i=await this.fetchDataAndGenerateStreamlines(e,t);if(null==i||0===i.length)return null;const{geometries:r,material:s}=await this._createGeometry(e,i);return this._draped?new D(e,i,s,r,this.surface.overlayManager):new F(e,i,s,r,this.view.stage)}async fetchDataAndGenerateStreamlines(e,t){return null}async _createGeometry(e,t){const i=new H(this._materialParameters,this.view.state.isGlobal),r=new Array,{elevationInfo:s,_draped:o,view:l}=this;function*a(a){for(let n=0;n<t.length;++n)r.push(z(l,e,t[n],s,i,o)),a.madeProgress(),a.done&&(a=yield)}return await this._frameTask.scheduleGenerator(a),{geometries:r,material:i}}_computeExtent(e){const{spatialReference:t}=this.surface;if(null==t)return null;const i=M(e);return null==i?null:(v(i,this._clippingArea,i),T(i,t))}_triggerTilesUpdate(){if(this._tilesUpdateIsWaiting)return;this._tilesUpdateIsWaiting=!0;const e=async()=>{await d(()=>this.view.stationary),this._tilesUpdateIsWaiting=!1,await this._debouncedTileUpdate()};this.updatingHandles.addPromise(o(e()))}_getTileFilterFunction(){const{_dataBounds:e,view:i,_featureTilesBounds:r}=this;if(this._loadAllTiles)return t=>t.leaf&&X(e,t.extent);const s=t=>t.rendered&&t.visible&&X(e,t.extent),{featureTiles:o}=i;if(!o)return s;const l=o.tiles.filter(e=>e.measures.visible);return e=>s(e)&&X(r,e.extent)&&l.some(({lij:i})=>t(i,e.lij)||W(i,e.lij))}_viewSizeWithEqualRatio(e){const t=(e.xmax-e.xmin)/(e.ymax-e.ymin),[i,r]=this.view.size;return i<r?[i,Math.floor(i/t)]:[Math.floor(r*t),r]}_lastResourceIsTransitioned(e){const{_lastResources:t,_resources:i,_flowRenderer:r}=this;if(null==t||null==i||null==r)return!0;return i.startTime+E<e}get test(){}};e([_()],J.prototype,"type",void 0),e([_()],J.prototype,"renderedTiles",void 0),e([_()],J.prototype,"_resources",void 0),e([_()],J.prototype,"_lastResources",void 0),e([_()],J.prototype,"requireLoad",void 0),e([_()],J.prototype,"_averageLoadingTime",void 0),e([_()],J.prototype,"emissiveStrength",void 0),e([_()],J.prototype,"_clippingArea",null),e([_()],J.prototype,"_dataBounds",null),e([_()],J.prototype,"_draped",null),e([_()],J.prototype,"_ellipsoidRadius",null),e([_()],J.prototype,"_loadAllTiles",null),e([_()],J.prototype,"_featureTilesBounds",null),e([_()],J.prototype,"_flowRenderer",null),e([_()],J.prototype,"_materialParameters",null),e([_()],J.prototype,"_opacity",null),e([_()],J.prototype,"_transitionDuration",null),e([_()],J.prototype,"_visible",null),e([_()],J.prototype,"elevationInfo",null),e([_()],J.prototype,"needsMagnitude",null),e([_()],J.prototype,"layer",null),e([_()],J.prototype,"updating",null),e([_()],J.prototype,"visibleAtCurrentScale",null),e([_()],J.prototype,"_overrideMaterialParameters",void 0),e([_()],J.prototype,"_overrideSimulationSettings",void 0),e([_()],J.prototype,"simulationSettings",null),e([_()],J.prototype,"surface",null),J=e([f("esri.views.3d.layers.FlowSubView3D")],J);const K=new R({mode:"on-the-ground"});function X(e,t){return null==e||null==t||b(e,t)}export{J as default};