@arcgis/core 4.30.0-next.20240213 → 4.30.0-next.20240214

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 (116) hide show
  1. package/TimeExtent.js +1 -1
  2. package/assets/esri/core/workers/RemoteClient.js +1 -1
  3. package/assets/esri/core/workers/chunks/051c00021039f20ad935.js +1 -0
  4. package/assets/esri/core/workers/chunks/08ba549f9c4afc42a21c.js +1 -0
  5. package/assets/esri/core/workers/chunks/{a384f29cb3256401962a.js → 1629a8c2085dce59cd1b.js} +1 -1
  6. package/assets/esri/core/workers/chunks/18512caeeb03b9759ab1.js +1 -0
  7. package/assets/esri/core/workers/chunks/{cc1c958aad790a44048b.js → 1ca28af7c516d8283bb0.js} +1 -1
  8. package/assets/esri/core/workers/chunks/1f8a0fb32b96e50f5909.js +1 -0
  9. package/assets/esri/core/workers/chunks/25f7e92cb4934c4930be.js +1 -0
  10. package/assets/esri/core/workers/chunks/2649166d1a462c7f8338.js +1 -0
  11. package/assets/esri/core/workers/chunks/51e4f771bfe352967c97.js +1 -0
  12. package/assets/esri/core/workers/chunks/5467bacd2771e6b1cdfa.js +1 -0
  13. package/assets/esri/core/workers/chunks/5638d95e600ff271c5b1.js +1 -0
  14. package/assets/esri/core/workers/chunks/58f088b08e12c5435dbc.js +1 -0
  15. package/assets/esri/core/workers/chunks/5aef1e898618f8dda2c9.js +1 -0
  16. package/assets/esri/core/workers/chunks/656ec8a14df0e4b68433.js +1 -0
  17. package/assets/esri/core/workers/chunks/66f21348fb68c83b9dc3.js +1108 -0
  18. package/assets/esri/core/workers/chunks/{eb2d6f1ee63b40ae0736.js → 774b655498289b1b36bb.js} +1 -1
  19. package/assets/esri/core/workers/chunks/9310f1de92d9b82dc803.js +1 -0
  20. package/assets/esri/core/workers/chunks/{f03d62ab7806b68d0b62.js → 9fbf61675e2a5374f754.js} +1 -1
  21. package/assets/esri/core/workers/chunks/a0b017a34cafd08ce945.js +1 -0
  22. package/assets/esri/core/workers/chunks/a28711db61c1df2d7bac.js +1 -0
  23. package/assets/esri/core/workers/chunks/aa9b46bcb75c96731de3.js +1 -0
  24. package/assets/esri/core/workers/chunks/c83da4659646ce3f5b50.js +1 -0
  25. package/assets/esri/core/workers/chunks/{05ebb9cec0e1826b283f.js → cafcc53175f9d4c5de2f.js} +1 -1
  26. package/assets/esri/core/workers/chunks/{1c6914ded7db720f7bf7.js → daf6eab5dd198ca9a67b.js} +1 -1
  27. package/assets/esri/core/workers/chunks/e03edeaf3af46495449e.js +1 -0
  28. package/assets/esri/core/workers/chunks/e0c9f29eedfa71554445.js +1 -0
  29. package/assets/esri/core/workers/chunks/e123017c670f22266768.js +1 -0
  30. package/assets/esri/core/workers/chunks/eba3a6f0a66b51b8ec12.js +1 -0
  31. package/assets/esri/core/workers/chunks/ebb294c82207f3ff9f04.js +1 -0
  32. package/assets/esri/core/workers/chunks/{e4da908079417cc2f495.js → ee0c77889059815a31b2.js} +1 -1
  33. package/assets/esri/core/workers/chunks/f36e55302b45e2936a5b.js +1 -0
  34. package/assets/esri/core/workers/chunks/f85e67d4a18603ccaaed.js +1 -0
  35. package/assets/esri/core/workers/chunks/f90bbebd2dc07a77ce09.js +1 -0
  36. package/chunks/vec32.js +1 -1
  37. package/interfaces.d.ts +131 -66
  38. package/layers/WFSLayer.js +1 -1
  39. package/layers/buildingSublayers/BuildingComponentSublayer.js +1 -1
  40. package/layers/graphics/sources/FeatureLayerSource.js +1 -1
  41. package/layers/mixins/ArcGISImageService.js +1 -1
  42. package/package.json +1 -1
  43. package/portal/Portal.js +1 -1
  44. package/portal/PortalGroup.js +1 -1
  45. package/portal/PortalUser.js +1 -1
  46. package/portal/support/geometryServiceUtils.js +1 -1
  47. package/rest/knowledgeGraph/wasmInterface/wasmToUpdateResponseFactories.js +1 -1
  48. package/rest/networks/support/Association.js +1 -1
  49. package/rest/places.js +1 -1
  50. package/rest/query/operations/pbfJSONFeatureSet.js +1 -1
  51. package/rest/support/ImageSampleParameters.js +1 -1
  52. package/smartMapping/support/adapters/FeatureLayerAdapter.js +1 -1
  53. package/smartMapping/support/adapters/SceneLayerAdapter.js +1 -1
  54. package/support/elevationInfoUtils.js +1 -1
  55. package/support/revision.js +1 -1
  56. package/symbols/cim/cimAnalyzer.js +1 -1
  57. package/symbols/cim/defaultCIMValues.js +1 -1
  58. package/symbols/cim/utils.js +1 -1
  59. package/views/2d/engine/webgl/shaderGraph/techniques/labels/LabelMeshWriter.js +1 -1
  60. package/views/2d/engine/webgl/shaderGraph/techniques/text/TextMeshWriter.js +1 -1
  61. package/views/3d/interactive/measurementTools/directLineMeasurement3D/DirectLineMeasurement3DView.js +1 -1
  62. package/views/3d/layers/BuildingComponentSublayerView3D.js +1 -1
  63. package/views/3d/layers/IntegratedMeshLayerView3D.js +1 -1
  64. package/views/3d/layers/SceneLayerView3D.js +1 -1
  65. package/views/3d/layers/graphics/Graphics3DMeshFillSymbolLayer.js +1 -1
  66. package/views/3d/layers/graphics/objectResourceUtils.js +1 -1
  67. package/views/3d/layers/support/FeatureTileVisibility3D.js +1 -1
  68. package/views/3d/state/helpers/SceneIntersectionHelper.js +1 -1
  69. package/views/3d/terrain/OverlayFramebufferObject.js +1 -1
  70. package/views/3d/terrain/OverlayRenderer.js +1 -1
  71. package/views/3d/webgl/RenderNode.js +1 -1
  72. package/views/3d/webgl-engine/collections/Component/Material/ComponentTechniqueConfiguration.js +1 -1
  73. package/views/3d/webgl-engine/core/FBOCache.js +1 -1
  74. package/views/3d/webgl-engine/core/shaderLibrary/shading/ComputeNormalTexture.glsl.js +9 -7
  75. package/views/3d/webgl-engine/core/shaderLibrary/shading/ScreenSpaceConstants.js +5 -0
  76. package/views/3d/webgl-engine/core/shaderLibrary/shading/Water.glsl.js +8 -8
  77. package/views/3d/webgl-engine/effects/debug/RenderNodeVisualizerNode.js +1 -1
  78. package/views/3d/webgl-engine/effects/highlight/Highlight.js +1 -1
  79. package/views/3d/webgl-engine/effects/smaa/SMAA.js +1 -1
  80. package/views/3d/webgl-engine/effects/ssao/SSAO.js +1 -1
  81. package/views/3d/webgl-engine/lib/GLTextureMaterial.js +1 -1
  82. package/views/draw/drawSurfaces.js +1 -1
  83. package/views/layers/ImageryTileLayerView.js +1 -1
  84. package/webdoc/support/webdocLoadUtils.js +1 -1
  85. package/webdoc/support/webdocSaveUtils.js +1 -1
  86. package/widgets/Editor.js +1 -1
  87. package/widgets/FeatureForm.js +1 -1
  88. package/widgets/Print/PrintViewModel.js +1 -1
  89. package/widgets/Search/support/locatorUtils.js +1 -1
  90. package/widgets/Sketch/SketchViewModel.js +1 -1
  91. package/assets/esri/core/workers/chunks/00b9e92f8df245a83921.js +0 -1
  92. package/assets/esri/core/workers/chunks/02ee044597c89c86b934.js +0 -1
  93. package/assets/esri/core/workers/chunks/143ccb14c9e915dd1412.js +0 -1
  94. package/assets/esri/core/workers/chunks/24649b410b757599a549.js +0 -1
  95. package/assets/esri/core/workers/chunks/2519b207894132d5ea91.js +0 -1
  96. package/assets/esri/core/workers/chunks/30f9b2a3417cbcfeecca.js +0 -1
  97. package/assets/esri/core/workers/chunks/42ab9c282bb267c3db03.js +0 -1
  98. package/assets/esri/core/workers/chunks/49afeac45250b15b5f36.js +0 -1
  99. package/assets/esri/core/workers/chunks/50bb67f2eeace5d50673.js +0 -1
  100. package/assets/esri/core/workers/chunks/50cdc59426ba859027e2.js +0 -1
  101. package/assets/esri/core/workers/chunks/58c5861d060c808813a1.js +0 -1
  102. package/assets/esri/core/workers/chunks/5dbb3ef6fdd25ac632ad.js +0 -1
  103. package/assets/esri/core/workers/chunks/61c4bb58ef9f2d99c75e.js +0 -1
  104. package/assets/esri/core/workers/chunks/6e50220f8e2d392e2855.js +0 -1
  105. package/assets/esri/core/workers/chunks/6fd8047741a0df006ddd.js +0 -1
  106. package/assets/esri/core/workers/chunks/7709248f59520aee6f51.js +0 -1
  107. package/assets/esri/core/workers/chunks/8852a64918caf80fc414.js +0 -1
  108. package/assets/esri/core/workers/chunks/94dfb80ab23dda92918b.js +0 -1
  109. package/assets/esri/core/workers/chunks/9ebbc75ba5c623a322aa.js +0 -1
  110. package/assets/esri/core/workers/chunks/a74c59cf5d1c4e63a4e1.js +0 -1
  111. package/assets/esri/core/workers/chunks/be562536212360943388.js +0 -1
  112. package/assets/esri/core/workers/chunks/d06d36815c2121484a13.js +0 -1
  113. package/assets/esri/core/workers/chunks/d5f06a7b0ea7951c8dd0.js +0 -1
  114. package/assets/esri/core/workers/chunks/de6d54df7ae32694fd70.js +0 -1
  115. package/assets/esri/core/workers/chunks/f13c4b9692dad5802a32.js +0 -1106
  116. package/assets/esri/core/workers/chunks/f1e8f7d1a98b9e207b1b.js +0 -1
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.30/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../Graphic.js";import{pickRandom as r}from"../../../core/arrayUtils.js";import i from"../../../core/Error.js";import{assertIsSome as s}from"../../../core/maybe.js";import{throwIfAborted as a}from"../../../core/promiseUtils.js";import{property as n}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 l}from"../../../layers/support/arcgisLayerUrl.js";import{isTimeOnlyField as u,isNumericField as m}from"../../../layers/support/fieldUtils.js";import{generateRenderer as c}from"../../../rest/generateRenderer.js";import h from"../../../rest/support/GenerateRendererParameters.js";import p from"../../../rest/support/StatisticDefinition.js";import d from"../../../rest/support/UniqueValueDefinition.js";import{getArcadeForPredominantCategory as f,getSQLForPredominantCategoryName as y}from"../../statistics/support/predominanceUtils.js";import{mergeWhereClauses as F,getSQLFilterForNormalization as S,getRangeExpr as g}from"../../statistics/support/utils.js";import{WorkerClient as v}from"../../statistics/support/WorkerClient.js";import{isAnyDateField as w,fieldDelimiter as x}from"../utils.js";import _ from"./InMemoryLayerAdapter.js";import{ensureFeaturesJSON as z,getSummaryStatsQuery as E,getSummaryStatisticsFromFeatureSet as q,getUVQuery as L,getUniqueValuesFromFeatureSet as T,getSQLExpressionForDateOrTimeField as V,getFieldExpr as j,defaultNumBins as Q,updateQueryWithFeatureFilter as b,getHistogramFromFeatureSet as N,generateBinParams as R,getDomainsForFields as C,getBins as I,getPredominantCategoriesFromUVInfos as M,getMissingFields as B}from"./support/utils.js";import{processSummaryStatisticsResult as $,createUVResult as k,getEqualIntervalBins as D,createClassBreaksDefinition as G,resolveCBResult as O}from"../../../statistics/utils.js";const P=5,A=2e4,U=4e5;let W=class extends _{constructor(){super(...arguments),this.adapterName="feature-layer-adapter"}_isStatsSupportedOnService(){const e=this.layer;if(!e.capabilities?.query?.supportsStatistics||"multipatch"===this.geometryType&&!l(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(z)}_summaryStatsFromGenRend(e){const t=e.normalizationType,r=e.normalizationField;return this.classBreaks({field:e.field,numClasses:P,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((e=>{let t,r,i;if(e.classBreakInfos?.some((e=>(e.hasAvg&&(t=e),!!t))),t){const e=t.maxValue-t.minValue;r=t.minValue+e/2,i=4*e}const s={min:e.minValue,max:e.maxValue,avg:r,stddev:i};return $(s)}))}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)||u(t),i=E(this,e,t),s=await this.layer.queryFeatures(i,{signal:e.signal}),a=q(s,r);return $(a)}_uvFromGenRenderer(e,t){const r=e.field??void 0,i=new d;i.attributeField=r;const s=new h;return s.classificationDefinition=i,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:m(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(L(this,e),{signal:e.signal}))).then((t=>T(t,{layer:this,field:e.field,field2:e.field2,field3:e.field3,fieldDelimiter:x,view:e.view,signal:e.signal}))).then((r=>k(r,t,e.returnAllCodedValues,x)))}_calcBinsSQL(e,t,r){const i=[],s=t.length;return t.forEach(((t,a)=>{const[n,o]=t;let l=null;l=0!==a||r?a!==s-1||r?F(`${e} >= ${n}`,`${e} ${a===s-1?" <= ":" < "} ${o}`):`${e} >= ${n}`:`${e} < ${o}`,i.push("WHEN ("+l+") THEN "+(a+1))})),["CASE",i.join(" "),"ELSE 0","END"].join(" ")}_getNormalizationTotal(e,t,r,i){return e&&"percent-of-total"===t?this.summaryStatistics({field:e,filter:r,signal:i}).then((e=>e.sum)):Promise.resolve(null)}_getQueryParamsForExpr(e,t){const r=e.valueExpression||e.sqlExpression,i=e.signal;if(!r){const{field:r,normalizationType:s,normalizationField:a}=e,n=r?this.getField(r):null,o=w(n)||u(n),l={field:r,normalizationType:s,normalizationField:a,normalizationTotal:t,layer:this};return{sqlExpression:o?V(this,n):j(l),sqlWhere:o?null:e.sqlWhere||S({field:r,normalizationType:s,normalizationField:a}),filter:e.filter,signal:i}}return{valueExpression:e.valueExpression,sqlExpression:e.sqlExpression,sqlWhere:e.sqlWhere,filter:e.filter,signal:i}}_getDataRange(e,t,r){return null!=t&&null!=r?Promise.resolve({min:t,max:r}):this.summaryStatistics(e).then((e=>({min:e.min,max:e.max})))}_histogramForExpr(e){return this._getNormalizationTotal(e.field,e.normalizationType,e.filter,e.signal).then((t=>{const r=this._getQueryParamsForExpr(e,t);return this._getDataRange(r,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 n=e.numBins||Q,o=D(s,a,n),l=this._calcBinsSQL(r.sqlExpression,o,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],b(m,e.filter),this._isStatsSupportedOnService().then((()=>this.layer.queryFeatures(m,{signal:r.signal}))).then((e=>N(e,s,a,n,t)))}))}))}_binParamsFromGenRend(e,t){const{field:r,normalizationType:i,normalizationField:s,signal:a}=e,n=S({field:r,normalizationType:i,normalizationField:s}),o=new h({classificationDefinition:G({field:r,normalizationType:i,normalizationField:s,classificationMethod:e.classificationMethod,standardDeviationInterval:e.standardDeviationInterval,breakCount:e.numBins||Q}),where:F(n,t)});return this.generateRenderer(o,a).then((e=>{const{normalizationTotal:t,classBreaks:a}=e;return R({field:r,normalizationType:i,normalizationField:s,normalizationTotal:t,classBreaks:a,where:n,layer:this})}))}_classBreaksFromGenRend(e){const{field:t,normalizationType:r,normalizationField:i,normalizationTotal:s,signal:a}=e,n=S({field:t,normalizationType:r,normalizationField:i}),o=j({field:t,normalizationType:r,normalizationField:i,normalizationTotal:s,layer:this}),l=g(o,e.minValue,e.maxValue),u=G({field:t,normalizationType:r,normalizationField:i,classificationMethod:e.classificationMethod,standardDeviationInterval:e.standardDeviationInterval,breakCount:e.numClasses||P}),m=new h;return m.classificationDefinition=u,m.where=F(n,l),this.generateRenderer(m,a).then((t=>O(t,e.classificationMethod)))}async summaryStatistics(e){const{field:t,normalizationType:r,sqlExpression:s,view:n,features:o,useFeaturesInView:l}=e,m=t?this.getField(t):null,c=w(m)||u(m),h=e.valueExpression||s,p=h&&!s,d=this._hasLocalSource||o||l,f=n&&"3d"===n.type;if(d||p)return p||o||l||f?this._summaryStatsFromMemory(e,m):this._summaryStatsFromClientQuery(e,m);if(!this.supportsSQLExpression&&(c||h||"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,m)).catch((()=>(a(e.signal),this._summaryStatsFromMemory(e,m))))}async uniqueValues(e){const{valueExpression:t,sqlExpression:r,features:i,useFeaturesInView:s,signal:n}=e,o=t&&(!r||!this.supportsSQLExpression),l=this._hasLocalSource||i||s||o,u=e.view,m=u&&"3d"===u.type,c=await C(e,this);return l?o||i||s||m?this._uvFromMemory(e,c):this._uvFromClientQuery(e,c):this._uvFromServiceQuery(e,c).catch((t=>(a(n),!e.field||e.field2||e.field3||e.filter?t:this._uvFromGenRenderer(e,c[0])))).catch((()=>(a(n),m?this._uvFromMemory(e,c):this._uvFromClientQuery(e,c))))}async histogram(e){const{field:t,normalizationType:r,normalizationField:s,classificationMethod:a,view:n,filter:o,signal:l}=e,m=t?this.getField(t):null,c=w(m)||u(m),h=e.valueExpression||e.sqlExpression,p=h&&!e.sqlExpression,d=this._hasLocalSource||e.features||e.useFeaturesInView||p,f=this.supportsSQLExpression,y=!a||"equal-interval"===a,F=e.minValue,S=e.maxValue,v=null!=F&&null!=S,x=e.numBins||Q;if(d)return this._histogramFromMemory(e);if((h||f)&&y){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(c&&y)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||!y?this._binParamsFromGenRend(e).then((a=>{if(!v)return I(this,a,t,x,n,o,l);if(F>a.max||S<a.min)throw new i(`${this.adapterName}:insufficient-data`,"Range defined by 'minValue' and 'maxValue' does not intersect available data range of the field");if(y)return I(this,{min:F,max:S,sqlExpr:a.sqlExpr,excludeZerosExpr:a.excludeZerosExpr},t,x,n,o,l);{const i={field:t,normalizationType:r,normalizationField:s,normalizationTotal:a.normTotal,layer:this},u=j(i),m=g(u,F,S);return this._binParamsFromGenRend(e,m).then((e=>I(this,e,t,x,n,o,l)))}})):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((()=>(a(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),b(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}=e,a=f(t),n=y(t),o=r&&this._hasLocalSource?await this._uvFromMemory({valueExpression:a,view:r,signal:s}):await this._uvFromServiceQuery({sqlExpression:n.expression,valueExpression:a,signal:s});return M(o.uniqueValueInfos,t)}async getSampleFeatures(e,i){const{view:n,requiredFields:o,returnGeometry:l,filter:u,signal:m}=e,c=e.sampleSize;if(null==c||0===c)return[];const h=this.layer.createQuery(),p=1,d="json"===i;h.outSpatialReference=n?.spatialReference,h.returnGeometry=!!l,h.outFields=o,b(h,u);let f=[],y=!1;if(n)try{const s=await n.whenLayerView(this.layer);if(y=!B(this,o,s).length,y){if(c>=1&&!e.filter&&"getSampleFeatures"in s){const e=await s.getSampleFeatures({minFeatureCount:c,sampleSize:c});if(null!=e)return d?e:e.map((e=>t.fromJSON(e)))}if(f=await this._fetchFeaturesFromMemory(s,h,m,i),f.length>=c&&c>0)return r(f,c,p)}}catch(F){a(m)}try{if(this._hasLocalSource)return y?f:d?this._fetchFeaturesJSONFromService(h,m):this._fetchFeaturesFromService(h,m);const t=await this.queryFeatureCount({view:n,filter:u,signal:m}),i=this.layer.capabilities.query.maxRecordCount;let a=-1===c?t:c;if(a=i&&a>i?i:a,t<=f.length||f.length>=i)return f;s(n,"FeatureLayerAdapter: must have a view");const o=n.extent.width/n.width/n.scale*U;if(h.maxAllowableOffset=e.resolution||o,t<=a)return d?this._fetchFeaturesJSONFromService(h,m):this._fetchFeaturesFromService(h,m);if(t<=A){const e=this.layer.createQuery();b(e,u);const t=await this.layer.queryObjectIds();return h.objectIds=r(t,a,p),d?this._fetchFeaturesJSONFromService(h,m):this._fetchFeaturesFromService(h,m)}return this.layer.capabilities?.query?.supportsPagination&&(h.num=Math.min(a,A)),d?this._fetchFeaturesJSONFromService(h,m):this._fetchFeaturesFromService(h,m)}catch(F){return a(m),f}}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=v.getInstance(),await this.workerClient.open(e.signal)}));return this.addResolvingPromise(t),Promise.resolve(this)}};e([n({constructOnly:!0})],W.prototype,"layer",void 0),W=e([o("esri.smartMapping.support.adapters.FeatureLayerAdapter")],W);const J=W;export{J as default};
5
+ import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../Graphic.js";import{pickRandom as r}from"../../../core/arrayUtils.js";import i from"../../../core/Error.js";import{assertIsSome as s}from"../../../core/maybe.js";import{throwIfAborted as a}from"../../../core/promiseUtils.js";import{property as n}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 l}from"../../../layers/support/arcgisLayerUrl.js";import{isTimeOnlyField as u,isNumericField as m}from"../../../layers/support/fieldUtils.js";import{generateRenderer as c}from"../../../rest/generateRenderer.js";import h from"../../../rest/support/GenerateRendererParameters.js";import p from"../../../rest/support/StatisticDefinition.js";import d from"../../../rest/support/UniqueValueDefinition.js";import{getArcadeForPredominantCategory as f,getSQLForPredominantCategoryName as y}from"../../statistics/support/predominanceUtils.js";import{mergeWhereClauses as F,getSQLFilterForNormalization as S,getRangeExpr as g}from"../../statistics/support/utils.js";import{WorkerClient as v}from"../../statistics/support/WorkerClient.js";import{isAnyDateField as w,fieldDelimiter as x}from"../utils.js";import _ from"./InMemoryLayerAdapter.js";import{ensureFeaturesJSON as z,getSummaryStatsQuery as E,getSummaryStatisticsFromFeatureSet as q,getUVQuery as L,getUniqueValuesFromFeatureSet as T,getSQLExpressionForDateOrTimeField as V,getFieldExpr as j,defaultNumBins as Q,updateQueryWithFeatureFilter as b,getHistogramFromFeatureSet as N,generateBinParams as R,getDomainsForFields as C,getBins as I,getPredominantCategoriesFromUVInfos as M,getMissingFields as B}from"./support/utils.js";import{processSummaryStatisticsResult as $,createUVResult as k,getEqualIntervalBins as D,createClassBreaksDefinition as G,resolveCBResult as O}from"../../../statistics/utils.js";const P=5,A=2e4,U=4e5;let W=class extends _{constructor(){super(...arguments),this.adapterName="feature-layer-adapter"}_isStatsSupportedOnService(){const e=this.layer;if(!e.capabilities?.query?.supportsStatistics||"multipatch"===this.geometryType&&!l(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(z)}_summaryStatsFromGenRend(e){const t=e.normalizationType,r=e.normalizationField;return this.classBreaks({field:e.field,numClasses:P,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((e=>{let t,r,i;if(e.classBreakInfos?.some((e=>(e.hasAvg&&(t=e),!!t))),t){const e=t.maxValue-t.minValue;r=t.minValue+e/2,i=4*e}const s={min:e.minValue,max:e.maxValue,avg:r,stddev:i};return $(s)}))}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)||u(t),i=E(this,e,t),s=await this.layer.queryFeatures(i,{signal:e.signal}),a=q(s,r);return $(a)}_uvFromGenRenderer(e,t){const r=e.field??void 0,i=new d({attributeField:r}),s=new h({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:m(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(L(this,e),{signal:e.signal}))).then((t=>T(t,{layer:this,field:e.field,field2:e.field2,field3:e.field3,fieldDelimiter:x,view:e.view,signal:e.signal}))).then((r=>k(r,t,e.returnAllCodedValues,x)))}_calcBinsSQL(e,t,r){const i=[],s=t.length;return t.forEach(((t,a)=>{const[n,o]=t;let l=null;l=0!==a||r?a!==s-1||r?F(`${e} >= ${n}`,`${e} ${a===s-1?" <= ":" < "} ${o}`):`${e} >= ${n}`:`${e} < ${o}`,i.push("WHEN ("+l+") THEN "+(a+1))})),["CASE",i.join(" "),"ELSE 0","END"].join(" ")}_getNormalizationTotal(e,t,r,i){return e&&"percent-of-total"===t?this.summaryStatistics({field:e,filter:r,signal:i}).then((e=>e.sum)):Promise.resolve(null)}_getQueryParamsForExpr(e,t){const r=e.valueExpression||e.sqlExpression,i=e.signal;if(!r){const{field:r,normalizationType:s,normalizationField:a}=e,n=r?this.getField(r):null,o=w(n)||u(n),l={field:r,normalizationType:s,normalizationField:a,normalizationTotal:t,layer:this};return{sqlExpression:o?V(this,n):j(l),sqlWhere:o?null:e.sqlWhere||S({field:r,normalizationType:s,normalizationField:a}),filter:e.filter,signal:i}}return{valueExpression:e.valueExpression,sqlExpression:e.sqlExpression,sqlWhere:e.sqlWhere,filter:e.filter,signal:i}}_getDataRange(e,t,r){return null!=t&&null!=r?Promise.resolve({min:t,max:r}):this.summaryStatistics(e).then((e=>({min:e.min,max:e.max})))}_histogramForExpr(e){return this._getNormalizationTotal(e.field,e.normalizationType,e.filter,e.signal).then((t=>{const r=this._getQueryParamsForExpr(e,t);return this._getDataRange(r,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 n=e.numBins||Q,o=D(s,a,n),l=this._calcBinsSQL(r.sqlExpression,o,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],b(m,e.filter),this._isStatsSupportedOnService().then((()=>this.layer.queryFeatures(m,{signal:r.signal}))).then((e=>N(e,s,a,n,t)))}))}))}_binParamsFromGenRend(e,t){const{field:r,normalizationType:i,normalizationField:s,signal:a}=e,n=S({field:r,normalizationType:i,normalizationField:s}),o=new h({classificationDefinition:G({field:r,normalizationType:i,normalizationField:s,classificationMethod:e.classificationMethod,standardDeviationInterval:e.standardDeviationInterval,breakCount:e.numBins||Q}),where:F(n,t)});return this.generateRenderer(o,a).then((e=>{const{normalizationTotal:t,classBreaks:a}=e;return R({field:r,normalizationType:i,normalizationField:s,normalizationTotal:t,classBreaks:a,where:n,layer:this})}))}_classBreaksFromGenRend(e){const{field:t,normalizationType:r,normalizationField:i,normalizationTotal:s,signal:a}=e,n=S({field:t,normalizationType:r,normalizationField:i}),o=j({field:t,normalizationType:r,normalizationField:i,normalizationTotal:s,layer:this}),l=g(o,e.minValue,e.maxValue),u=G({field:t,normalizationType:r,normalizationField:i,classificationMethod:e.classificationMethod,standardDeviationInterval:e.standardDeviationInterval,breakCount:e.numClasses||P}),m=new h({classificationDefinition:u});return m.where=F(n,l),this.generateRenderer(m,a).then((t=>O(t,e.classificationMethod)))}async summaryStatistics(e){const{field:t,normalizationType:r,sqlExpression:s,view:n,features:o,useFeaturesInView:l}=e,m=t?this.getField(t):null,c=w(m)||u(m),h=e.valueExpression||s,p=h&&!s,d=this._hasLocalSource||o||l,f=n&&"3d"===n.type;if(d||p)return p||o||l||f?this._summaryStatsFromMemory(e,m):this._summaryStatsFromClientQuery(e,m);if(!this.supportsSQLExpression&&(c||h||"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,m)).catch((()=>(a(e.signal),this._summaryStatsFromMemory(e,m))))}async uniqueValues(e){const{valueExpression:t,sqlExpression:r,features:i,useFeaturesInView:s,signal:n}=e,o=t&&(!r||!this.supportsSQLExpression),l=this._hasLocalSource||i||s||o,u=e.view,m=u&&"3d"===u.type,c=await C(e,this);return l?o||i||s||m?this._uvFromMemory(e,c):this._uvFromClientQuery(e,c):this._uvFromServiceQuery(e,c).catch((t=>(a(n),!e.field||e.field2||e.field3||e.filter?t:this._uvFromGenRenderer(e,c[0])))).catch((()=>(a(n),m?this._uvFromMemory(e,c):this._uvFromClientQuery(e,c))))}async histogram(e){const{field:t,normalizationType:r,normalizationField:s,classificationMethod:a,view:n,filter:o,signal:l}=e,m=t?this.getField(t):null,c=w(m)||u(m),h=e.valueExpression||e.sqlExpression,p=h&&!e.sqlExpression,d=this._hasLocalSource||e.features||e.useFeaturesInView||p,f=this.supportsSQLExpression,y=!a||"equal-interval"===a,F=e.minValue,S=e.maxValue,v=null!=F&&null!=S,x=e.numBins||Q;if(d)return this._histogramFromMemory(e);if((h||f)&&y){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(c&&y)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||!y?this._binParamsFromGenRend(e).then((a=>{if(!v)return I(this,a,t,x,n,o,l);if(F>a.max||S<a.min)throw new i(`${this.adapterName}:insufficient-data`,"Range defined by 'minValue' and 'maxValue' does not intersect available data range of the field");if(y)return I(this,{min:F,max:S,sqlExpr:a.sqlExpr,excludeZerosExpr:a.excludeZerosExpr},t,x,n,o,l);{const i={field:t,normalizationType:r,normalizationField:s,normalizationTotal:a.normTotal,layer:this},u=j(i),m=g(u,F,S);return this._binParamsFromGenRend(e,m).then((e=>I(this,e,t,x,n,o,l)))}})):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((()=>(a(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),b(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}=e,a=f(t),n=y(t),o=r&&this._hasLocalSource?await this._uvFromMemory({valueExpression:a,view:r,signal:s}):await this._uvFromServiceQuery({sqlExpression:n.expression,valueExpression:a,signal:s});return M(o.uniqueValueInfos,t)}async getSampleFeatures(e,i){const{view:n,requiredFields:o,returnGeometry:l,filter:u,signal:m}=e,c=e.sampleSize;if(null==c||0===c)return[];const h=this.layer.createQuery(),p=1,d="json"===i;h.outSpatialReference=n?.spatialReference,h.returnGeometry=!!l,h.outFields=o,b(h,u);let f=[],y=!1;if(n)try{const s=await n.whenLayerView(this.layer);if(y=!B(this,o,s).length,y){if(c>=1&&!e.filter&&"getSampleFeatures"in s){const e=await s.getSampleFeatures({minFeatureCount:c,sampleSize:c});if(null!=e)return d?e:e.map((e=>t.fromJSON(e)))}if(f=await this._fetchFeaturesFromMemory(s,h,m,i),f.length>=c&&c>0)return r(f,c,p)}}catch(F){a(m)}try{if(this._hasLocalSource)return y?f:d?this._fetchFeaturesJSONFromService(h,m):this._fetchFeaturesFromService(h,m);const t=await this.queryFeatureCount({view:n,filter:u,signal:m}),i=this.layer.capabilities.query.maxRecordCount;let a=-1===c?t:c;if(a=i&&a>i?i:a,t<=f.length||f.length>=i)return f;s(n,"FeatureLayerAdapter: must have a view");const o=n.extent.width/n.width/n.scale*U;if(h.maxAllowableOffset=e.resolution||o,t<=a)return d?this._fetchFeaturesJSONFromService(h,m):this._fetchFeaturesFromService(h,m);if(t<=A){const e=this.layer.createQuery();b(e,u);const t=await this.layer.queryObjectIds();return h.objectIds=r(t,a,p),d?this._fetchFeaturesJSONFromService(h,m):this._fetchFeaturesFromService(h,m)}return this.layer.capabilities?.query?.supportsPagination&&(h.num=Math.min(a,A)),d?this._fetchFeaturesJSONFromService(h,m):this._fetchFeaturesFromService(h,m)}catch(F){return a(m),f}}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=v.getInstance(),await this.workerClient.open(e.signal)}));return this.addResolvingPromise(t),Promise.resolve(this)}};e([n({constructOnly:!0})],W.prototype,"layer",void 0),W=e([o("esri.smartMapping.support.adapters.FeatureLayerAdapter")],W);const J=W;export{J as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.30/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../Graphic.js";import{pickRandom as r}from"../../../core/arrayUtils.js";import a from"../../../core/Error.js";import{timeout as s,throwIfAborted as i}from"../../../core/promiseUtils.js";import{whenOnce as o}from"../../../core/reactiveUtils.js";import{property as n}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import{subclass as l}from"../../../core/accessorSupport/decorators/subclass.js";import{kebabDict as u}from"../../../layers/support/fieldType.js";import{isNumericField as p}from"../../../layers/support/fieldUtils.js";import m from"../../../rest/support/FeatureSet.js";import{summaryStatistics as c,uniqueValues as d,classBreaks as h,histogram as f}from"../../statistics/support/statsWorker.js";import{WorkerClient as y}from"../../statistics/support/WorkerClient.js";import{getFieldsList as g,isAnyDateField as w,fieldDelimiter as F}from"../utils.js";import _ from"./FeatureLayerAdapter.js";import S from"./LayerAdapter.js";import{getMissingFields as v,ensureFeaturesJSON as x,getViewInfoParams as L,getUniqueValuesFromFeatureSet as C,getHistogramFromFeatureSet as E,getDomainsForFields as z}from"./support/utils.js";import{createUVResult as T}from"../../../statistics/utils.js";let A=class extends S{constructor(e){super(e),this._featureLayerAdapter=null,this.workerClient=null}destroy(){this.workerClient?.destroy()}_hasCachedStatistics(e){return this.layer.hasCachedStatistics(e)}_updateQuery(e,t=[],r=[]){if(!e||!r.length)return e;const a=this.layer.objectIdField,s=e.clone(),i=t.filter((e=>{const t=this.layer.getField(e);return!r.includes(t.name)})),o=i.some((e=>this.layer.getField(e).name===a));return s.outFields=o?i:[...i,a],s}async _fetchFeaturesFromMemory(e,t,r){if(!e)throw new a("scene-layer-adapter:insufficient-data","view is required to fetch the features from layerView");const n=await e.whenLayerView(this.layer),l=new AbortController,u=l.signal,p=o((()=>!n.updating),u);await s(p,5e3,l);const m=v(this,r,n);i(u);const c=this._updateQuery(t,r??[],m),d=await n.queryFeatures(c,{signal:u});i(u);const h=d.features;return m.length?n.whenGraphicAttributes(h,m):h}async _fetchFeaturesJSONFromMemory(e,t,r){return this._fetchFeaturesFromMemory(e,t,r).then(x)}_fetchFeaturesForStats(e,t){return g({field:e.field,normalizationField:e.normalizationField,valueExpression:e.valueExpression}).then((r=>this.getSampleFeatures({sampleSize:-1,view:e.view,returnGeometry:e.returnGeometry,requiredFields:r,signal:e.signal},t)))}async _processStatsFromMemoryParams(e){const t=e.features;if(t?.length){return t.length&&"declaredClass"in t[0]&&"esri.Graphic"===t[0].declaredClass?{graphics:t}:{featuresJSON:t}}const{view:r,field:s,normalizationField:i,valueExpression:o,signal:n}=e,l=await this._fetchFeaturesForStats({field:s,valueExpression:o,normalizationField:i,view:r,signal:n},null);if(!l?.length)throw new a("scene-layer-adapter:insufficient-data","No features are available to calculate statistics");return{graphics:l}}_generateFeatureSetForCachedHistogram(e,r=e.minimum,a=e.maximum,s){const i=[];for(let t=0;t<s;t++)i[t]=0;const o=e.counts.length,n=e.minimum,l=e.maximum;for(let t=0;t<o;t++){const u=(t+.5)/o,p=((1-u)*n+u*l-r)/(a-r)*s;p>=0&&p<=s&&(i[p===s?s-1:Math.floor(p)]+=e.counts[t])}const u=[];i.forEach(((e,r)=>{const a=new t({attributes:{}});a.attributes.EXPR_1=r+1,a.attributes.countOFExpr=e,u.push(a)}));const p=new m;return p.features=u,p}_getCachedStatistics(e,t){const r=this.layer;return e.valueExpression||e.sqlExpression||e.sqlWhere||e.minValue||e.maxValue?Promise.reject(new a("scene-layer-adapter:not-supported","This Layer does not support calculating statistics when 'valueExpression', 'sqlExpression', 'sqlWhere', 'minValue' or 'maxValue' is specified")):r.queryCachedStatistics(t?.name,{signal:e.signal}).then((e=>{const t=e.stats,{min:r,max:a,totalValuesCount:s}=t;let{avg:i,stddev:o,sum:n,variance:l,count:u}=t;return 0===r&&0===a||(i=0===i?null:i,n=0===n?null:n,o=0===o?null:o,l=0===l?null:l,u=0===u?null:u),null==u&&(null!=n&&null!=i?u=Math.round(n/i):null!=s&&(u=s)),{avg:i,count:u,max:a,min:r,stddev:o,sum:n,variance:l}}))}async _getNormalizationTotal(e,t,r){const s=(t?await this.workerClient.summaryStatistics({field:e},t):await c({attribute:{field:e},features:r})).sum;if(null==s)throw new a("scene-layer-adapter:invalid","invalid normalizationTotal");return s}async _getSummaryStatisticsFromMemory(e,t){const{view:r,field:a,normalizationField:s,valueExpression:i}=e,{featuresJSON:o,graphics:n}=await this._processStatsFromMemoryParams(e),l={field:a,valueExpression:i,normalizationType:e.normalizationType,normalizationField:s,normalizationTotal:e.normalizationTotal,minValue:e.minValue,maxValue:e.maxValue};return e.valueExpression&&r&&o&&(l.fieldType=t?.type?u.toJSON(t.type):null,l.viewInfoParams=L(r),l.timeZone=r.timeZone),"percent-of-total"===e.normalizationType&&null==e.normalizationTotal&&(l.normalizationTotal=await this._getNormalizationTotal(a,o,n)),o?this.workerClient.summaryStatistics(l,o):c({attribute:l,features:n})}_getCachedStatisticsForUniqueValues(e,r){const s=this.layer,i=r?.name,o=r&&e.field?this.getFieldDomain(e.field):null;return e.valueExpression||e.sqlExpression||e.sqlWhere?Promise.reject(new a("scene-layer-adapter:not-supported","This Layer does not support calculating statistics when 'valueExpression', 'sqlExpression' or 'sqlWhere' is specified")):s.queryCachedStatistics(i,{signal:e.signal}).then((a=>{const o=a.stats;if(!o.mostFrequentValues)throw new Error;const n=a.labels?.labels,l={},u=[],c="countOF"+i;o.mostFrequentValues.forEach((e=>{const a=new t({attributes:{}});a.attributes[i]=r&&r.name!==s.objectIdField&&(p(r)||w(r))?Number(e.value):e.value,a.attributes[c]=e.count,u.push(a)})),n&&n.forEach((e=>{l[e.value]=e.label}));const d=new m;return d.features=u,C(d,{layer:this,field:e.field,labels:l,view:e.view,signal:e.signal})})).then((t=>T(t,[o],e.returnAllCodedValues)))}async _getUniqueValuesFromMemory(e,t){const{view:r,field:a,field2:s,field3:i,valueExpression:o,returnAllCodedValues:n}=e,l={field:a,field2:s,field3:i,fieldDelimiter:F,valueExpression:o,domains:t,returnAllCodedValues:n},{featuresJSON:u,graphics:p}=await this._processStatsFromMemoryParams(e);return e.valueExpression&&r&&u&&(l.viewInfoParams=L(r),l.timeZone=r.timeZone),u?this.workerClient.uniqueValues(l,u):d({attribute:l,features:p})}_getCachedStatisticsForHistogram(e,t){const r=this.layer;return e.valueExpression||e.sqlExpression||e.sqlWhere||e.normalizationType?Promise.reject(new a("scene-layer-adapter:not-supported","This Layer does not support calculating statistics when 'valueExpression' or 'sqlExpression' or 'sqlWhere' or 'normalizationType' is specified")):r.queryCachedStatistics(t&&t.name,{signal:e.signal}).then((t=>{const r=t.stats,{minValue:a,maxValue:s}=e,i=null!=a?a:r.min,o=null!=s?s:r.max,n=e.numBins||10,l=this._generateFeatureSetForCachedHistogram(r.histogram,i,o,n);return E(l,i,o,n)}))}async _getClassBreaksFromMemory(e){const{view:t,field:r,normalizationField:a,valueExpression:s}=e,{featuresJSON:i,graphics:o}=await this._processStatsFromMemoryParams(e),n={field:r,valueExpression:s,normalizationType:e.normalizationType,normalizationField:a,normalizationTotal:e.normalizationTotal,minValue:e.minValue,maxValue:e.maxValue,standardDeviationInterval:e.standardDeviationInterval,classificationMethod:e.classificationMethod,numClasses:e.numClasses};return e.valueExpression&&t&&i&&(n.viewInfoParams=L(t),n.timeZone=t.timeZone),"percent-of-total"===e.normalizationType&&null==e.normalizationTotal&&(n.normalizationTotal=await this._getNormalizationTotal(r,i,o)),i?this.workerClient.classBreaks(n,i):h({attribute:n,features:o})}async _getHistogramFromMemory(e){const{view:t,field:r}=e,{featuresJSON:a,graphics:s}=await this._processStatsFromMemoryParams(e),i={field:r,valueExpression:e.valueExpression,normalizationType:e.normalizationType,normalizationField:e.normalizationField,normalizationTotal:e.normalizationTotal,minValue:e.minValue,maxValue:e.maxValue,standardDeviationInterval:e.standardDeviationInterval,classificationMethod:e.classificationMethod,numBins:e.numBins};return e.valueExpression&&t&&a&&(i.viewInfoParams=L(t),i.timeZone=t.timeZone),"percent-of-total"===e.normalizationType&&null==e.normalizationTotal&&(i.normalizationTotal=await this._getNormalizationTotal(r,a,s)),a?this.workerClient.histogram(i,a):f({attribute:i,features:s})}getField(e){return this.layer.getField(e??"")}getFieldUsageInfo(e){const t=this.getField(e);if(!t)return null;const r=this.layer.getFieldUsageInfo(t.name);return{supportsLabelingInfo:r.supportsLabelingInfo,supportsPopupTemplate:r.supportsPopupTemplate,supportsRenderer:r.supportsRenderer,supportsLayerQuery:r.supportsLayerQuery,supportsStatistics:!0}}getFieldDomain(e,t){return this._featureLayerAdapter?this._featureLayerAdapter.getFieldDomain(e,t):null}createQuery(){return this.layer.createQuery()}summaryStatistics(e){const t=this.getField(e.field);if(this._featureLayerAdapter)return this._featureLayerAdapter.summaryStatistics(e);if(e.filter)throw new a("scene-layer-adapter:not-supported","filter is not supported");return this._hasCachedStatistics(t?.name)?this._getCachedStatistics(e,t).catch((()=>(i(e.signal),this._getSummaryStatisticsFromMemory(e,t)))):this._getSummaryStatisticsFromMemory(e,t)}async uniqueValues(e){if(this._featureLayerAdapter)return this._featureLayerAdapter.uniqueValues(e);if(e.filter)throw new a("scene-layer-adapter:not-supported","filter is not supported");const t=await z(e,this),{field:r,field2:s}=e,o=r&&s,n=this.getField(r);return!o&&n&&this._hasCachedStatistics(n.name)?this._getCachedStatisticsForUniqueValues(e,n).catch((()=>(i(e.signal),this._getUniqueValuesFromMemory(e,t)))):this._getUniqueValuesFromMemory(e,t)}histogram(e){const t=this.getField(e.field);if(this._featureLayerAdapter)return this._featureLayerAdapter.histogram(e);if(e.filter)throw new a("scene-layer-adapter:not-supported","filter is not supported");return t&&this._hasCachedStatistics(t.name)?this._getCachedStatisticsForHistogram(e,t).catch((()=>(i(e.signal),this._getHistogramFromMemory(e)))):this._getHistogramFromMemory(e)}classBreaks(e){const t=this.getField(e.field);if(this._featureLayerAdapter)return this._featureLayerAdapter.classBreaks(e);if(e.filter)throw new a("scene-layer-adapter:not-supported","filter is not supported");return this._hasCachedStatistics(t?.name)?Promise.reject(new a("scene-layer-adapter:not-supported","Cached stats not supported")):this._getClassBreaksFromMemory(e)}queryFeatureCount(e){return this._featureLayerAdapter?this._featureLayerAdapter.queryFeatureCount(e):Promise.reject(new a("scene-layer-adapter:not-supported","SceneLayer without associated FeatureLayer does not support count query"))}generateRenderer(e,t){return this._featureLayerAdapter?this._featureLayerAdapter.generateRenderer(e,t):Promise.reject(new a("scene-layer-adapter:not-supported","SceneLayer without associated FeatureLayer does not support generateRenderer operation"))}heatmapStatistics(e){return this._featureLayerAdapter?this._featureLayerAdapter.heatmapStatistics(e):Promise.reject(new a("scene-layer-adapter:not-supported","SceneLayer without associated FeatureLayer does not support heatmapStatistics operation"))}async predominantCategories(e){if(this._featureLayerAdapter)return this._featureLayerAdapter.predominantCategories(e);throw new a("scene-layer-adapter:not-supported","SceneLayer without associated FeatureLayer does not support predominantCategories")}async getSampleFeatures(e,t){if(e.filter)throw new a("scene-layer-adapter:not-supported","filter is not supported");const{view:s,sampleSize:o,requiredFields:n,returnGeometry:l,signal:u}=e,p=1,m="json"===t,c=this.createQuery();c.outFields=n,c.returnGeometry=!!l,c.where=null,c.num=o;let d=[];try{if(d=m?await this._fetchFeaturesJSONFromMemory(s,c,n):await this._fetchFeaturesFromMemory(s,c,n),d.length&&null!=o&&o>0&&o<=d.length)return r(d,o,p)}catch(f){i(u)}let h=null;if(this._featureLayerAdapter){const r={...e};delete r.view,h=await this._featureLayerAdapter.getSampleFeatures(r,t)}return h&&h.length?h:r(d,d.length,p)}load(e){const t=this.layer.load(e).then((async t=>{this.workerClient=y.getInstance(),await this.workerClient.open(e.signal);const r=t.associatedLayer;if(this.geometryType=t.geometryType,null!=r){this._featureLayerAdapter=new _({layer:r});return this._featureLayerAdapter.load(e).then((()=>{this.objectIdField=this._featureLayerAdapter.objectIdField,this.supportsSQLExpression=this._featureLayerAdapter.supportsSQLExpression,this.minScale=this._featureLayerAdapter.minScale,this.maxScale=this._featureLayerAdapter.maxScale,this.fullExtent=this._featureLayerAdapter.fullExtent}))}this.objectIdField=t.objectIdField,this.supportsSQLExpression=!1,this.hasQueryEngine=!1,this.fullExtent=t.fullExtent}));return this.addResolvingPromise(t),Promise.resolve(this)}};e([n({constructOnly:!0})],A.prototype,"layer",void 0),A=e([l("esri.smartMapping.support.adapters.SceneLayerAdapter")],A);const j=A;export{j as default};
5
+ import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../Graphic.js";import{pickRandom as r}from"../../../core/arrayUtils.js";import a from"../../../core/Error.js";import{timeout as s,throwIfAborted as i}from"../../../core/promiseUtils.js";import{whenOnce as o}from"../../../core/reactiveUtils.js";import{property as n}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import{subclass as l}from"../../../core/accessorSupport/decorators/subclass.js";import{kebabDict as u}from"../../../layers/support/fieldType.js";import{isNumericField as p}from"../../../layers/support/fieldUtils.js";import m from"../../../rest/support/FeatureSet.js";import{summaryStatistics as c,uniqueValues as d,classBreaks as h,histogram as f}from"../../statistics/support/statsWorker.js";import{WorkerClient as y}from"../../statistics/support/WorkerClient.js";import{getFieldsList as g,isAnyDateField as w,fieldDelimiter as F}from"../utils.js";import _ from"./FeatureLayerAdapter.js";import S from"./LayerAdapter.js";import{getMissingFields as v,ensureFeaturesJSON as x,getViewInfoParams as L,getUniqueValuesFromFeatureSet as C,getHistogramFromFeatureSet as E,getDomainsForFields as z}from"./support/utils.js";import{createUVResult as T}from"../../../statistics/utils.js";let A=class extends S{constructor(e){super(e),this._featureLayerAdapter=null,this.workerClient=null}destroy(){this.workerClient?.destroy()}_hasCachedStatistics(e){return this.layer.hasCachedStatistics(e)}_updateQuery(e,t=[],r=[]){if(!e||!r.length)return e;const a=this.layer.objectIdField,s=e.clone(),i=t.filter((e=>{const t=this.layer.getField(e);return!r.includes(t.name)})),o=i.some((e=>this.layer.getField(e).name===a));return s.outFields=o?i:[...i,a],s}async _fetchFeaturesFromMemory(e,t,r){if(!e)throw new a("scene-layer-adapter:insufficient-data","view is required to fetch the features from layerView");const n=await e.whenLayerView(this.layer),l=new AbortController,u=l.signal,p=o((()=>!n.updating),u);await s(p,5e3,l);const m=v(this,r,n);i(u);const c=this._updateQuery(t,r??[],m),d=await n.queryFeatures(c,{signal:u});i(u);const h=d.features;return m.length?n.whenGraphicAttributes(h,m):h}async _fetchFeaturesJSONFromMemory(e,t,r){return this._fetchFeaturesFromMemory(e,t,r).then(x)}_fetchFeaturesForStats(e,t){return g({field:e.field,normalizationField:e.normalizationField,valueExpression:e.valueExpression}).then((r=>this.getSampleFeatures({sampleSize:-1,view:e.view,returnGeometry:e.returnGeometry,requiredFields:r,signal:e.signal},t)))}async _processStatsFromMemoryParams(e){const t=e.features;if(t?.length){return t.length&&"declaredClass"in t[0]&&"esri.Graphic"===t[0].declaredClass?{graphics:t}:{featuresJSON:t}}const{view:r,field:s,normalizationField:i,valueExpression:o,signal:n}=e,l=await this._fetchFeaturesForStats({field:s,valueExpression:o,normalizationField:i,view:r,signal:n},null);if(!l?.length)throw new a("scene-layer-adapter:insufficient-data","No features are available to calculate statistics");return{graphics:l}}_generateFeatureSetForCachedHistogram(e,r=e.minimum,a=e.maximum,s){const i=[];for(let t=0;t<s;t++)i[t]=0;const o=e.counts.length,n=e.minimum,l=e.maximum;for(let t=0;t<o;t++){const u=(t+.5)/o,p=((1-u)*n+u*l-r)/(a-r)*s;p>=0&&p<=s&&(i[p===s?s-1:Math.floor(p)]+=e.counts[t])}const u=[];return i.forEach(((e,r)=>{const a=new t({attributes:{}});a.attributes.EXPR_1=r+1,a.attributes.countOFExpr=e,u.push(a)})),new m({features:u})}_getCachedStatistics(e,t){const r=this.layer;return e.valueExpression||e.sqlExpression||e.sqlWhere||e.minValue||e.maxValue?Promise.reject(new a("scene-layer-adapter:not-supported","This Layer does not support calculating statistics when 'valueExpression', 'sqlExpression', 'sqlWhere', 'minValue' or 'maxValue' is specified")):r.queryCachedStatistics(t?.name,{signal:e.signal}).then((e=>{const t=e.stats,{min:r,max:a,totalValuesCount:s}=t;let{avg:i,stddev:o,sum:n,variance:l,count:u}=t;return 0===r&&0===a||(i=0===i?null:i,n=0===n?null:n,o=0===o?null:o,l=0===l?null:l,u=0===u?null:u),null==u&&(null!=n&&null!=i?u=Math.round(n/i):null!=s&&(u=s)),{avg:i,count:u,max:a,min:r,stddev:o,sum:n,variance:l}}))}async _getNormalizationTotal(e,t,r){const s=(t?await this.workerClient.summaryStatistics({field:e},t):await c({attribute:{field:e},features:r})).sum;if(null==s)throw new a("scene-layer-adapter:invalid","invalid normalizationTotal");return s}async _getSummaryStatisticsFromMemory(e,t){const{view:r,field:a,normalizationField:s,valueExpression:i}=e,{featuresJSON:o,graphics:n}=await this._processStatsFromMemoryParams(e),l={field:a,valueExpression:i,normalizationType:e.normalizationType,normalizationField:s,normalizationTotal:e.normalizationTotal,minValue:e.minValue,maxValue:e.maxValue};return e.valueExpression&&r&&o&&(l.fieldType=t?.type?u.toJSON(t.type):null,l.viewInfoParams=L(r),l.timeZone=r.timeZone),"percent-of-total"===e.normalizationType&&null==e.normalizationTotal&&(l.normalizationTotal=await this._getNormalizationTotal(a,o,n)),o?this.workerClient.summaryStatistics(l,o):c({attribute:l,features:n})}_getCachedStatisticsForUniqueValues(e,r){const s=this.layer,i=r?.name,o=r&&e.field?this.getFieldDomain(e.field):null;return e.valueExpression||e.sqlExpression||e.sqlWhere?Promise.reject(new a("scene-layer-adapter:not-supported","This Layer does not support calculating statistics when 'valueExpression', 'sqlExpression' or 'sqlWhere' is specified")):s.queryCachedStatistics(i,{signal:e.signal}).then((a=>{const o=a.stats;if(!o.mostFrequentValues)throw new Error;const n=a.labels?.labels,l={},u=[],c="countOF"+i;o.mostFrequentValues.forEach((e=>{const a=new t({attributes:{}});a.attributes[i]=r&&r.name!==s.objectIdField&&(p(r)||w(r))?Number(e.value):e.value,a.attributes[c]=e.count,u.push(a)})),n&&n.forEach((e=>{l[e.value]=e.label}));const d=new m({features:u});return C(d,{layer:this,field:e.field,labels:l,view:e.view,signal:e.signal})})).then((t=>T(t,[o],e.returnAllCodedValues)))}async _getUniqueValuesFromMemory(e,t){const{view:r,field:a,field2:s,field3:i,valueExpression:o,returnAllCodedValues:n}=e,l={field:a,field2:s,field3:i,fieldDelimiter:F,valueExpression:o,domains:t,returnAllCodedValues:n},{featuresJSON:u,graphics:p}=await this._processStatsFromMemoryParams(e);return e.valueExpression&&r&&u&&(l.viewInfoParams=L(r),l.timeZone=r.timeZone),u?this.workerClient.uniqueValues(l,u):d({attribute:l,features:p})}_getCachedStatisticsForHistogram(e,t){const r=this.layer;return e.valueExpression||e.sqlExpression||e.sqlWhere||e.normalizationType?Promise.reject(new a("scene-layer-adapter:not-supported","This Layer does not support calculating statistics when 'valueExpression' or 'sqlExpression' or 'sqlWhere' or 'normalizationType' is specified")):r.queryCachedStatistics(t&&t.name,{signal:e.signal}).then((t=>{const r=t.stats,{minValue:a,maxValue:s}=e,i=null!=a?a:r.min,o=null!=s?s:r.max,n=e.numBins||10,l=this._generateFeatureSetForCachedHistogram(r.histogram,i,o,n);return E(l,i,o,n)}))}async _getClassBreaksFromMemory(e){const{view:t,field:r,normalizationField:a,valueExpression:s}=e,{featuresJSON:i,graphics:o}=await this._processStatsFromMemoryParams(e),n={field:r,valueExpression:s,normalizationType:e.normalizationType,normalizationField:a,normalizationTotal:e.normalizationTotal,minValue:e.minValue,maxValue:e.maxValue,standardDeviationInterval:e.standardDeviationInterval,classificationMethod:e.classificationMethod,numClasses:e.numClasses};return e.valueExpression&&t&&i&&(n.viewInfoParams=L(t),n.timeZone=t.timeZone),"percent-of-total"===e.normalizationType&&null==e.normalizationTotal&&(n.normalizationTotal=await this._getNormalizationTotal(r,i,o)),i?this.workerClient.classBreaks(n,i):h({attribute:n,features:o})}async _getHistogramFromMemory(e){const{view:t,field:r}=e,{featuresJSON:a,graphics:s}=await this._processStatsFromMemoryParams(e),i={field:r,valueExpression:e.valueExpression,normalizationType:e.normalizationType,normalizationField:e.normalizationField,normalizationTotal:e.normalizationTotal,minValue:e.minValue,maxValue:e.maxValue,standardDeviationInterval:e.standardDeviationInterval,classificationMethod:e.classificationMethod,numBins:e.numBins};return e.valueExpression&&t&&a&&(i.viewInfoParams=L(t),i.timeZone=t.timeZone),"percent-of-total"===e.normalizationType&&null==e.normalizationTotal&&(i.normalizationTotal=await this._getNormalizationTotal(r,a,s)),a?this.workerClient.histogram(i,a):f({attribute:i,features:s})}getField(e){return this.layer.getField(e??"")}getFieldUsageInfo(e){const t=this.getField(e);if(!t)return null;const r=this.layer.getFieldUsageInfo(t.name);return{supportsLabelingInfo:r.supportsLabelingInfo,supportsPopupTemplate:r.supportsPopupTemplate,supportsRenderer:r.supportsRenderer,supportsLayerQuery:r.supportsLayerQuery,supportsStatistics:!0}}getFieldDomain(e,t){return this._featureLayerAdapter?this._featureLayerAdapter.getFieldDomain(e,t):null}createQuery(){return this.layer.createQuery()}summaryStatistics(e){const t=this.getField(e.field);if(this._featureLayerAdapter)return this._featureLayerAdapter.summaryStatistics(e);if(e.filter)throw new a("scene-layer-adapter:not-supported","filter is not supported");return this._hasCachedStatistics(t?.name)?this._getCachedStatistics(e,t).catch((()=>(i(e.signal),this._getSummaryStatisticsFromMemory(e,t)))):this._getSummaryStatisticsFromMemory(e,t)}async uniqueValues(e){if(this._featureLayerAdapter)return this._featureLayerAdapter.uniqueValues(e);if(e.filter)throw new a("scene-layer-adapter:not-supported","filter is not supported");const t=await z(e,this),{field:r,field2:s}=e,o=r&&s,n=this.getField(r);return!o&&n&&this._hasCachedStatistics(n.name)?this._getCachedStatisticsForUniqueValues(e,n).catch((()=>(i(e.signal),this._getUniqueValuesFromMemory(e,t)))):this._getUniqueValuesFromMemory(e,t)}histogram(e){const t=this.getField(e.field);if(this._featureLayerAdapter)return this._featureLayerAdapter.histogram(e);if(e.filter)throw new a("scene-layer-adapter:not-supported","filter is not supported");return t&&this._hasCachedStatistics(t.name)?this._getCachedStatisticsForHistogram(e,t).catch((()=>(i(e.signal),this._getHistogramFromMemory(e)))):this._getHistogramFromMemory(e)}classBreaks(e){const t=this.getField(e.field);if(this._featureLayerAdapter)return this._featureLayerAdapter.classBreaks(e);if(e.filter)throw new a("scene-layer-adapter:not-supported","filter is not supported");return this._hasCachedStatistics(t?.name)?Promise.reject(new a("scene-layer-adapter:not-supported","Cached stats not supported")):this._getClassBreaksFromMemory(e)}queryFeatureCount(e){return this._featureLayerAdapter?this._featureLayerAdapter.queryFeatureCount(e):Promise.reject(new a("scene-layer-adapter:not-supported","SceneLayer without associated FeatureLayer does not support count query"))}generateRenderer(e,t){return this._featureLayerAdapter?this._featureLayerAdapter.generateRenderer(e,t):Promise.reject(new a("scene-layer-adapter:not-supported","SceneLayer without associated FeatureLayer does not support generateRenderer operation"))}heatmapStatistics(e){return this._featureLayerAdapter?this._featureLayerAdapter.heatmapStatistics(e):Promise.reject(new a("scene-layer-adapter:not-supported","SceneLayer without associated FeatureLayer does not support heatmapStatistics operation"))}async predominantCategories(e){if(this._featureLayerAdapter)return this._featureLayerAdapter.predominantCategories(e);throw new a("scene-layer-adapter:not-supported","SceneLayer without associated FeatureLayer does not support predominantCategories")}async getSampleFeatures(e,t){if(e.filter)throw new a("scene-layer-adapter:not-supported","filter is not supported");const{view:s,sampleSize:o,requiredFields:n,returnGeometry:l,signal:u}=e,p=1,m="json"===t,c=this.createQuery();c.outFields=n,c.returnGeometry=!!l,c.where=null,c.num=o;let d=[];try{if(d=m?await this._fetchFeaturesJSONFromMemory(s,c,n):await this._fetchFeaturesFromMemory(s,c,n),d.length&&null!=o&&o>0&&o<=d.length)return r(d,o,p)}catch(f){i(u)}let h=null;if(this._featureLayerAdapter){const r={...e};delete r.view,h=await this._featureLayerAdapter.getSampleFeatures(r,t)}return h&&h.length?h:r(d,d.length,p)}load(e){const t=this.layer.load(e).then((async t=>{this.workerClient=y.getInstance(),await this.workerClient.open(e.signal);const r=t.associatedLayer;if(this.geometryType=t.geometryType,null!=r){this._featureLayerAdapter=new _({layer:r});return this._featureLayerAdapter.load(e).then((()=>{this.objectIdField=this._featureLayerAdapter.objectIdField,this.supportsSQLExpression=this._featureLayerAdapter.supportsSQLExpression,this.minScale=this._featureLayerAdapter.minScale,this.maxScale=this._featureLayerAdapter.maxScale,this.fullExtent=this._featureLayerAdapter.fullExtent}))}this.objectIdField=t.objectIdField,this.supportsSQLExpression=!1,this.hasQueryEngine=!1,this.fullExtent=t.fullExtent}));return this.addResolvingPromise(t),Promise.resolve(this)}};e([n({constructOnly:!0})],A.prototype,"layer",void 0),A=e([l("esri.smartMapping.support.adapters.SceneLayerAdapter")],A);const j=A;export{j as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.30/esri/copyright.txt for details.
4
4
  */
5
- import{getMetersPerUnit as e}from"../symbols/support/unitConversionUtils.js";function n(e){return e?y:Z}function t(e,t){return t?.mode?t.mode:n(e).mode}function o(e,t){return null!=t?t:n(e)}function r(e,n){return t(null!=e&&e.hasZ,n)}function u(e,n){return o(null!=e&&!!e.hasZ,n)}function l(e){const n=a(e);return r(e.geometry,n)}function i(n){const t=a(n),o=r(n.geometry,t);return{mode:o,offset:null!=t&&"on-the-ground"!==o?(t.offset??0)*e(t.unit??"meters"):0}}function s(e){if("on-the-ground"===l(e))return!1;const n=a(e),t=n?.featureExpressionInfo?n.featureExpressionInfo.expression:null;return!(!t||"0"===t)}function a(e){return e.layer&&"elevationInfo"in e.layer?e.layer.elevationInfo:null}function f(e,n,t){if(!t?.mode)return;const o=e.hasZ?e.z:0,r=null!=t.offset?t.offset:0;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 c(e,n,t,o=null){return v(e,n.x,n.y,n.hasZ?n.z:0,n.spatialReference,t,o)}function d(e,n,t,o,r=null){return v(e,n[0],n[1],n.length>2?n[2]:0,t,o,r)}function v(e,n,t,o,r,u,l=null){if(null==u)return;const i=null!=l?l.mode:"absolute-height";if("on-the-ground"===i)return 0;const{absoluteZ:s}=g(n,t,o,r,e,u);return h(s,n,t,o,r,e,l,i)}function g(e,n,t,o,r,u){const l=null!=u.offset?u.offset:0;switch(u.mode){case"absolute-height":return{absoluteZ:t+l,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+l,elevation:u}}case"relative-to-scene":{const u=r.elevationProvider.getElevation(e,n,t,o,"scene")??0;return{absoluteZ:t+u+l,elevation:u}}}}function h(e,n,t,o,r,u,l,i){const s=null!=l?.offset?l.offset:0;switch(i){case"absolute-height":return e-s;case"relative-to-ground":return e-((u.elevationProvider.getElevation(n,t,o,r,"ground")??0)+s);case"relative-to-scene":return e-((u.elevationProvider.getElevation(n,t,o,r,"scene")??0)+s)}}function m(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 b(e,n,t){return t?.mode===n?`${e} do not support ${n} elevation mode`:null}function E(e,n){return null!=n?.featureExpressionInfo&&"0"!==n.featureExpressionInfo.expression?`${e} do not support featureExpressionInfo`:null}function x(e,n){n&&e.warn(".elevationInfo=",n)}const y={mode:"absolute-height",offset:0},Z={mode:"on-the-ground",offset:null};export{y as absoluteHeightElevationInfo,m as elevationContextAffectsAlignment,p as elevationModeRequiredMessage,b as elevationModeUnsupportedMessage,E as featureExpressionUnsupportedMessage,c as getConvertedElevation,d as getConvertedElevationFromVector,v as getConvertedElevationFromXYZ,o as getEffectiveElevationInfo,t as getEffectiveElevationMode,u as getGeometryEffectiveElevationInfo,r as getGeometryEffectiveElevationMode,i as getGraphicEffectiveElevationInfo,l as getGraphicEffectiveElevationMode,f as getZForElevationMode,s as hasGraphicFeatureExpressionInfo,x as logInvalidElevationInfoWarning,Z as onTheGroundElevationInfo,g as zValueInAbsoluteHeightMode};
5
+ import{getMetersPerUnit as e}from"../symbols/support/unitConversionUtils.js";function n(e){return e?Z:I}function t(e,t){return t?.mode?t.mode:n(e).mode}function o(e,t){return null!=t?t:n(e)}function r(e,n){return t(null!=e&&e.hasZ,n)}function u(e,n){return o(null!=e&&!!e.hasZ,n)}function l(e){const n=a(e);return r(e.geometry,n)}function i(e){const n=a(e),t=r(e.geometry,n);return{mode:t,offset:null!=n&&"on-the-ground"!==t?y(n):0}}function s(e){if("on-the-ground"===l(e))return!1;const n=a(e),t=n?.featureExpressionInfo?n.featureExpressionInfo.expression:null;return!(!t||"0"===t)}function a(e){return e.layer&&"elevationInfo"in e.layer?e.layer.elevationInfo:null}function f(e,n,t){if(!t?.mode)return;const o=e.hasZ?e.z:0,r=null!=t.offset?t.offset:0;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 c(e,n,t,o=null){return v(e,n.x,n.y,n.hasZ?n.z:0,n.spatialReference,t,o)}function d(e,n,t,o,r=null){return v(e,n[0],n[1],n.length>2?n[2]:0,t,o,r)}function v(e,n,t,o,r,u,l=null){if(null==u)return;const i=null!=l?l.mode:"absolute-height";if("on-the-ground"===i)return 0;const{absoluteZ:s}=g(n,t,o,r,e,u);return h(s,n,t,o,r,e,l,i)}function g(e,n,t,o,r,u){const l=null!=u.offset?u.offset:0;switch(u.mode){case"absolute-height":return{absoluteZ:t+l,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+l,elevation:u}}case"relative-to-scene":{const u=r.elevationProvider.getElevation(e,n,t,o,"scene")??0;return{absoluteZ:t+u+l,elevation:u}}}}function h(e,n,t,o,r,u,l,i){const s=null!=l?.offset?l.offset:0;switch(i){case"absolute-height":return e-s;case"relative-to-ground":return e-((u.elevationProvider.getElevation(n,t,o,r,"ground")??0)+s);case"relative-to-scene":return e-((u.elevationProvider.getElevation(n,t,o,r,"scene")??0)+s)}}function m(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 b(e,n,t){return t?.mode===n?`${e} do not support ${n} elevation mode`:null}function E(e,n){return null!=n?.featureExpressionInfo&&"0"!==n.featureExpressionInfo.expression?`${e} do not support featureExpressionInfo`:null}function x(e,n){n&&e.warn(".elevationInfo=",n)}function y(n){return(n?.offset??0)*e(n?.unit)}const Z={mode:"absolute-height",offset:0},I={mode:"on-the-ground",offset:null};export{Z as absoluteHeightElevationInfo,m as elevationContextAffectsAlignment,p as elevationModeRequiredMessage,b as elevationModeUnsupportedMessage,E as featureExpressionUnsupportedMessage,c as getConvertedElevation,d as getConvertedElevationFromVector,v as getConvertedElevationFromXYZ,o as getEffectiveElevationInfo,t as getEffectiveElevationMode,y as getElevationOffsetInMeters,u as getGeometryEffectiveElevationInfo,r as getGeometryEffectiveElevationMode,i as getGraphicEffectiveElevationInfo,l as getGraphicEffectiveElevationMode,f as getZForElevationMode,s as hasGraphicFeatureExpressionInfo,x as logInvalidElevationInfoWarning,I as onTheGroundElevationInfo,g 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.30/esri/copyright.txt for details.
4
4
  */
5
- const c="20240213",d="0dc7267612dbcfc0180202659a8234afb5d42d5b";export{c as buildDate,d as commitHash};
5
+ const a="20240214",b="7781c751ac7e0755a5b8a988fbedd06016b35390";export{a 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.30/esri/copyright.txt for details.
4
4
  */
5
- import{isRGB as e}from"../../core/colorUtils.js";import{getFontFamily as r}from"../../core/fontUtils.js";import{clone as t}from"../../core/lang.js";import i from"../../core/Logger.js";import{pt2px as o,px2pt as a}from"../../core/screenUtils.js";import{numericHash as s}from"../../core/string.js";import{CIMSymbolHelper as l}from"./CIMSymbolHelper.js";import{defaultCIMValues as n}from"./defaultCIMValues.js";import{Alignment as p,LineCapStyle as c,LineJoinStyle as m}from"./enums.js";import{OverrideHelper as f}from"./OverrideHelper.js";import{getExtent as y,getSDFMetrics as h}from"./SDFHelper.js";import{colorToArray as d,normalizeAlpha as u,getSize as v,isCIMMarkerStrokePlacement as O,getTintColor as _,getValue as g,getDefaultCIMValue as S,getFillColor as k,getStrokeColor as M,getStrokeWidth as b,fromCIMFontDecoration as P,fromCIMFontStyle as C,fromCIMHorizontalAlignment as z,fromCIMVerticalAlignment as x,isValidCIMValue as L,uncapitalize as E}from"./utils.js";import{CIMEffectHelper as I}from"./effects/CIMEffectHelper.js";import{randomInsidePolygonTextureSize as V}from"../../views/2d/engine/webgl/definitions.js";const N=()=>i.getLogger("esri.symbols.cim.cimAnalyzer");function w(e){return e??c.Butt}function R(e){return e??m.Bevel}function A(e){const r=e.markerPlacement;return r&&r.angleToLine?p.MAP:p.SCREEN}class X{constructor(e){this._cimLayers=[],this._poMap={},this._primitiveOverrides=[],e&&(this._resourceManager=e)}analyzeSymbolReference(r,t,i){if(this._cimLayers=i??[],!r)return this._cimLayers;if(this._reset(),r.primitiveOverrides){this._primitiveOverrides=r.primitiveOverrides;for(const r of this._primitiveOverrides){const t=r.valueExpressionInfo;if(t)this._setPoMap(r.primitiveName,r.propertyName,t);else if(null!=r.value){let t=r.value;r.propertyName.includes("Color")&&(e(t)&&(t=d(t)),t=u(t)),this._setPoMap(r.primitiveName,r.propertyName,t)}}}return this._analyzeSymbol(r.symbol,t),this._cimLayers}_reset(){this._cimLayers=[],this._poMap={},this._primitiveOverrides=[]}_analyzeSymbol(e,r){switch(e?.type){case"CIMPointSymbol":case"CIMLineSymbol":case"CIMPolygonSymbol":this._analyzeMultiLayerSymbol(e,r)}}_analyzeMultiLayerSymbol(e,r){const t=e?.symbolLayers;if(!t)return;const i=e.effects;let o=p.SCREEN;const a=v(e)??0;"CIMPointSymbol"===e.type&&"Map"===e.angleAlignment&&(o=p.MAP);const s="CIMPolygonSymbol"===e.type;let l=t.length;for(;l--;){const n=t[l];if(!n||!1===n.enable)continue;let p;i?.length&&(p=[...i]);const c=n.effects;c?.length&&(i?p.push(...c):p=[...c]);let m=null;if(p){m=[];for(const e of p){const r=f.findEffectOverrides(e,this._primitiveOverrides);r&&m.push(r)}}const y=[];switch(f.findApplicableOverrides(n,this._primitiveOverrides,y),n.type){case"CIMSolidFill":this._analyzeSolidFill(n,m);break;case"CIMPictureFill":this._analyzePictureFill(n,m);break;case"CIMHatchFill":this._analyzeHatchFill(n,m);break;case"CIMGradientFill":this._analyzeGradientFill(n,m);break;case"CIMSolidStroke":this._analyzeSolidStroke(n,m,s,a);break;case"CIMPictureStroke":this._analyzePictureStroke(n,m,s,a);break;case"CIMGradientStroke":this._analyzeGradientStroke(n,m,s,a);break;case"CIMCharacterMarker":case"CIMPictureMarker":case"CIMVectorMarker":{"CIMLineSymbol"!==e.type&&"CIMPolygonSymbol"!==e.type||(o=A(n));const t=[],i=n.primitiveName;i&&t.push(i);const l=s&&O(n.markerPlacement);this._analyzeMarker(n,m,null,t,o,a,r,[],!1,l);break}default:N().error("Cannot analyze CIM layer",n.type)}}}_analyzeSolidFill(e,r){const{primitiveName:t,type:i}=e,o=u(e.color);this._cimLayers.push({type:"fill",spriteRasterizationParam:null,colorLocked:!!e.colorLocked,color:this._getValueOrOverrideExpression(i,t,"Color",o),height:0,angle:0,offsetX:0,offsetY:0,scaleX:1,effects:r,applyRandomOffset:!1,sampleAlphaOnly:!0,hasUnresolvedReplacementColor:!1})}_analyzePictureFill(e,r){const{primitiveName:t,type:i}=e,o=_(e),a=g(e.height,n.CIMPictureFill.height);let s=g(e.scaleX,1);if("width"in e&&"number"==typeof e.width){const r=e.width;let t=1;const i=this._resourceManager.getResource(e.url);null!=i&&(t=i.width/i.height),s/=t*(a/r)}const l={type:"sprite-rasterization-param",resource:e,overrides:this._getPrimitiveMaterialOverrides(t,i)};this._cimLayers.push({type:"fill",spriteRasterizationParam:l,colorLocked:!!e.colorLocked,effects:r,color:this._getValueOrOverrideExpression(i,t,"TintColor",o),height:this._getValueOrOverrideExpression(i,t,"Height",a),scaleX:this._getValueOrOverrideExpression(i,t,"ScaleX",s),angle:this._getValueOrOverrideExpression(i,t,"Rotation",g(e.rotation)),offsetX:this._getValueOrOverrideExpression(i,t,"OffsetX",g(e.offsetX)),offsetY:this._getValueOrOverrideExpression(i,t,"OffsetY",g(e.offsetY)),applyRandomOffset:!1,sampleAlphaOnly:!1,hasUnresolvedReplacementColor:!1})}_analyzeHatchFill(e,r){const{primitiveName:t,type:i}=e,o=this._analyzeMaterialOverrides(t,["Rotation","OffsetX","OffsetY"]),a=this._normalizePrimitiveOverrideProps(o);let s=[255,255,255,1],l=!1;if(e.lineSymbol?.symbolLayers)for(const n of e.lineSymbol.symbolLayers){if("CIMSolidStroke"!==n.type)continue;const e=n.primitiveName??t;l||!e||n.colorLocked||null==this._poMap[e]?.Color&&null==this._poMap[e]?.StrokeColor||(s=u(n.color),s=this._maybeGetValueOrOverrideExpression(e,"StrokeColor")??this._getValueOrOverrideExpression(i,e,"Color",s),l=!0);const r=this._maybeGetValueOrOverrideExpression(e,"StrokeWidth");if(r){let t=null,o=null;"number"==typeof r?t=r:o=r.valueExpressionInfo;let s=a.find((e=>"strokeWidth"===e.propertyName));s?s.propertyName="width":(s={type:"CIMPrimitiveOverride",primitiveName:e,propertyName:"width",valueExpressionInfo:o,value:t,defaultValue:S(i,"width")},a.push(s))}}const p={type:"sprite-rasterization-param",resource:e,overrides:a};this._cimLayers.push({type:"fill",spriteRasterizationParam:p,colorLocked:!!e.colorLocked,effects:r,color:s,height:this._getValueOrOverrideExpression(i,t,"Separation",g(e.separation,n.CIMHatchFill.separation)),scaleX:1,angle:this._getValueOrOverrideExpression(i,t,"Rotation",g(e.rotation)),offsetX:this._getValueOrOverrideExpression(i,t,"OffsetX",g(e.offsetX)),offsetY:this._getValueOrOverrideExpression(i,t,"OffsetY",g(e.offsetY)),applyRandomOffset:!1,sampleAlphaOnly:!0,hasUnresolvedReplacementColor:!l})}_analyzeGradientFill(e,r){this._cimLayers.push({type:"fill",spriteRasterizationParam:null,colorLocked:!!e.colorLocked,effects:r,color:[128,128,128,1],height:0,angle:0,offsetX:0,offsetY:0,scaleX:1,applyRandomOffset:!1,sampleAlphaOnly:!1,hasUnresolvedReplacementColor:!1})}_analyzeSolidStroke(e,r,t,i){const{primitiveName:o,type:a}=e,s=u(e.color),l=g(e.width,n.CIMSolidStroke.width),p=e.capStyle??c.Butt,m=R(e.joinStyle),f=e.miterLimit;let y,h,d=[];if(this._analyzePrimitiveOverrides(o,r,null,null)&&(d=this._getPrimitiveMaterialOverrides(o,a)),r&&r instanceof Array&&r.length>0){const e=r[r.length-1].effect;e&&"CIMGeometricEffectDashes"===e.type&&"NoConstraint"===e.lineDashEnding&&null===e.offsetAlongLine&&(y=e.dashTemplate,h=e.scaleDash,(r=[...r]).pop())}const v=void 0!==y?{type:"sprite-rasterization-param",resource:{type:"dash",dashTemplate:y,capStyle:p},overrides:d}:null;this._cimLayers.push({type:"line",spriteRasterizationParam:v,isOutline:t,colorLocked:!!e.colorLocked,effects:r,color:this._getValueOrOverrideExpression(a,o,"Color",s),width:this._getValueOrOverrideExpression(a,o,"Width",l),cap:this._getValueOrOverrideExpression(a,o,"CapStyle",p),join:this._getValueOrOverrideExpression(a,o,"JoinStyle",m),miterLimit:f&&this._getValueOrOverrideExpression(a,o,"MiterLimit",f),referenceWidth:i,zOrder:G(e.name),dashTemplate:y,scaleDash:h,sampleAlphaOnly:!0})}_analyzePictureStroke(e,r,t,i){const{primitiveName:o,type:a}=e,s=_(e),l=g(e.width,n.CIMPictureStroke.width),p=w(e.capStyle),c=R(e.joinStyle),m=e.miterLimit,f={type:"sprite-rasterization-param",resource:e,overrides:this._getPrimitiveMaterialOverrides(o,a)};this._cimLayers.push({type:"line",spriteRasterizationParam:f,isOutline:t,colorLocked:!!e.colorLocked,effects:r,color:this._getValueOrOverrideExpression(a,o,"TintColor",s),width:this._getValueOrOverrideExpression(a,o,"Width",l),cap:this._getValueOrOverrideExpression(a,o,"CapStyle",p),join:this._getValueOrOverrideExpression(a,o,"JoinStyle",c),miterLimit:m&&this._getValueOrOverrideExpression(a,o,"MiterLimit",m),referenceWidth:i,zOrder:G(e.name),dashTemplate:null,scaleDash:!1,sampleAlphaOnly:!1})}_analyzeGradientStroke(e,r,t,i){const{primitiveName:o,type:a}=e,s=g(e.width,n.CIMSolidStroke.width),l=w(e.capStyle),p=R(e.joinStyle),c=e.miterLimit;this._cimLayers.push({type:"line",spriteRasterizationParam:null,isOutline:t,colorLocked:!!e.colorLocked,effects:r,color:[128,128,128,1],width:this._getValueOrOverrideExpression(a,o,"Width",s),cap:this._getValueOrOverrideExpression(a,o,"CapStyle",l),join:this._getValueOrOverrideExpression(a,o,"JoinStyle",p),miterLimit:c&&this._getValueOrOverrideExpression(a,o,"MiterLimit",c),referenceWidth:i,zOrder:G(e.name),dashTemplate:null,scaleDash:!1,sampleAlphaOnly:!1})}_analyzeMarker(e,r,t,i,o,a,s,l,p=!1,c=!1){if(p||=!!e.colorLocked,this._analyzeMarkerInsidePolygon(e,r,p))return;const m=g(e.size,n.CIMVectorMarker.size),f=g(e.rotation),y=g(e.offsetX),h=g(e.offsetY),{primitiveName:d,type:u}=e,v=this._getValueOrOverrideExpression(u,d,"Size",m),O=this._getValueOrOverrideExpression(u,d,"Rotation",f),_=this._getValueOrOverrideExpression(u,d,"OffsetX",y),S=this._getValueOrOverrideExpression(u,d,"OffsetY",h);switch(e.type){case"CIMPictureMarker":this._analyzePictureMarker(e,r,t,i,o,a,v,O,_,S,l,p,c);break;case"CIMVectorMarker":this._analyzeVectorMarker(e,r,t,i,o,a,v,O,_,S,l,s,p,c)}}_analyzeMarkerInsidePolygon(e,r,t){const{markerPlacement:i,type:o}=e;if(!i||"CIMMarkerPlacementInsidePolygon"!==i.type)return!1;if("CIMVectorMarker"===o||"CIMPictureMarker"===o){const t=e.primitiveName;if(t&&this._analyzePrimitiveOverrides([t],r,null,null))return!1;const a=i.primitiveName;if(a&&this._analyzePrimitiveOverrides([a],r,null,null))return!1;if("CIMVectorMarker"===o){const{markerGraphics:r}=e;if(r)for(const e of r){const{symbol:r}=e;if("CIMPolygonSymbol"===r?.type&&r.symbolLayers){const{symbolLayers:e}=r;for(const r of e)if("CIMSolidStroke"===r.type)return!1}}}else{const{animatedSymbolProperties:r}=e;if(r)return!1}}const s=Math.abs(i.stepX),l=Math.abs(i.stepY);if(0===s||0===l)return!0;let n,p;if("Random"===i.gridType){const e=a(V),r=Math.max(Math.floor(e/s),1);n=l*Math.max(Math.floor(e/l),1);p=r*s/n}else i.shiftOddRows?(n=2*l,p=s/l*.5):(n=l,p=s/l);const c=_(e),m="CIMCharacterMarker"===e.type?null:{type:"sprite-rasterization-param",resource:e,overrides:[]};return this._cimLayers.push({type:"fill",spriteRasterizationParam:m,colorLocked:t,effects:r,color:c,height:n,scaleX:p,angle:i.gridAngle,offsetX:g(i.offsetX),offsetY:g(i.offsetY),applyRandomOffset:"Random"===i.gridType,sampleAlphaOnly:"CIMPictureMarker"!==e.type,hasUnresolvedReplacementColor:!0}),!0}_analyzePictureMarker(e,r,i,o,a,l,n,p,c,m,f,y,h){const{primitiveName:d,type:u}=e;let v=g(e.scaleX,1);const O=_(e);i||(i=this._createMarkerPlacementOverrideExpression(e.markerPlacement));const S=this._createAnimatedSymbolPropertiesOverrideExpression(e.animatedSymbolProperties),k=e.anchorPoint??{x:0,y:0};if("width"in e&&"number"==typeof e.width){const r=e.width;let t=1;const i=this._resourceManager.getResource(e.url);null!=i&&(t=i.width/i.height);v/=t*(g(e.size)/r)}const M=[...o];let b;e.primitiveName&&M.push(e.primitiveName),e.animatedSymbolProperties||S?b={type:"animated",url:e.url,urlHash:"H"+s(e.url),playAnimation:e.animatedSymbolProperties?.playAnimation,reverseAnimation:e.animatedSymbolProperties?.reverseAnimation,randomizeStartTime:e.animatedSymbolProperties?.randomizeStartTime,randomizeStartSeed:e.animatedSymbolProperties?.randomizeStartSeed,startTimeOffset:e.animatedSymbolProperties?.startTimeOffset,duration:e.animatedSymbolProperties?.duration,repeatType:e.animatedSymbolProperties?.repeatType,repeatDelay:e.animatedSymbolProperties?.repeatDelay}:(b=t(e),b.markerPlacement=null);const P={type:"sprite-rasterization-param",resource:b,overrides:this._getMaterialOverrides(M,u)};S&&P.overrides.push(...S.overrides),this._cimLayers.push({type:"marker",spriteRasterizationParam:P,colorLocked:y,effects:r,scaleSymbolsProportionally:!1,alignment:a,size:n,scaleX:this._getValueOrOverrideExpression(u,d,"ScaleX",v),rotation:p,offsetX:c,offsetY:m,transform:{type:"cim-marker-transform-param",params:f},color:this._getValueOrOverrideExpression(u,d,"TintColor",O),anchorPoint:{x:k.x,y:k.y},isAbsoluteAnchorPoint:"Relative"!==e.anchorPointUnits,outlineColor:[0,0,0,0],outlineWidth:0,frameHeight:0,widthRatio:1,rotateClockwise:!!e.rotateClockwise,referenceSize:l,sizeRatio:1,isOutline:h,markerPlacement:i,animatedSymbolProperties:S})}_analyzeVectorMarker(e,r,t,i,o,a,s,l,n,p,c,m,f,y){const h=e.markerGraphics;if(!h)return;const d=e.frame;let u=0;if(u=d?d.ymax-d.ymin:a,u){const r={offsetX:n,offsetY:p,rotation:l,size:s,frameHeight:u,rotateClockWise:!!e.rotateClockwise};c=[...c,r]}t||(t=this._createMarkerPlacementOverrideExpression(e.markerPlacement));for(const v of h)if(v){const s=v.symbol;if(!s)continue;const l=v.primitiveName;let n;if(l&&i.push(l),("CIMPointSymbol"===s.type||"CIMTextSymbol"===s.type)&&d){let r=0,t=0;const i=v.geometry;"x"in i&&"y"in i&&(r+=i.x-.5*(d.xmin+d.xmax),t+=i.y-.5*(d.ymin+d.ymax));const o=e.anchorPoint;o&&("Absolute"===e.anchorPointUnits?(r-=o.x,t-=o.y):d&&(r-=(d.xmax-d.xmin)*o.x,t-=(d.ymax-d.ymin)*o.y));const a={offsetX:r,offsetY:t,rotation:0,size:0,frameHeight:0,rotateClockWise:!1};n=[...c,a]}switch(s.type){case"CIMPointSymbol":case"CIMLineSymbol":case"CIMPolygonSymbol":m||Y(s)?this._analyzeMultiLayerGraphicNonSDF(e,r,t,null,v,i,o,a,n??c,u,f,y):this._analyzeMultiLayerGraphic(e,r,t,null,v,i,o,a,n??c,u,f,y);break;case"CIMTextSymbol":this._analyzeTextGraphic(r,t,v,i,o,a,n??c,f)}l&&i.pop()}}_analyzeMultiLayerGraphic(e,r,t,i,o,a,s,l,n,p,c,m){const f=o.symbol,d=f.symbolLayers;if(!d)return;let v=d.length;if(T(d))return void this._analyzeCompositeMarkerGraphic(e,r,t,i,o,d,s,l,n,p,c,m);const O=this._resourceManager.geometryEngine,_=I.applyEffects(f.effects,o.geometry,O);if(_)for(;v--;){const f=d[v];if(!f||!1===f.enable)continue;const g=f.primitiveName;switch(g&&a.push(g),f.type){case"CIMSolidFill":case"CIMSolidStroke":{const a=I.applyEffects(f.effects,_,O),d=y(a);if(!d)continue;const v="Relative"!==e.anchorPointUnits,[S,P,C,z]=h(d,e.frame,e.size,e.anchorPoint,v),x="CIMSolidFill"===f.type,L={type:"sdf",geom:a,asFill:x},{path:E}=f,V=x?u(k(f)):null==E?u(M(f)):[0,0,0,0],N=x?[0,0,0,0]:u(M(f)),w=b(f)??0;if(!x&&!w)break;const R=o.primitiveName;let A=null;x&&!f.colorLocked&&(A=this._maybeGetValueOrOverrideExpression(R,"FillColor"));let X=null;x||f.colorLocked||(X=this._maybeGetValueOrOverrideExpression(R,"StrokeColor"));const G=A??this._getValueOrOverrideExpression(f.type,g,"Color",V),F=X??this._getValueOrOverrideExpression(f.type,g,"Color",N),T=this._maybeGetValueOrOverrideExpression(R,"StrokeWidth")??this._getValueOrOverrideExpression(f.type,g,"Width",w),Y=E?{type:"sprite-rasterization-param",resource:{type:"path",path:E,asFill:x},overrides:[]}:{type:"sprite-rasterization-param",resource:L,overrides:[]};this._cimLayers.push({type:"marker",spriteRasterizationParam:Y,colorLocked:!!f.colorLocked||!!c,effects:r,scaleSymbolsProportionally:!!e.scaleSymbolsProportionally,alignment:s,anchorPoint:{x:P,y:C},isAbsoluteAnchorPoint:v,size:p,rotation:0,offsetX:0,offsetY:0,scaleX:1,transform:{type:"cim-marker-transform-param",params:n},frameHeight:p,widthRatio:z,rotateClockwise:!1,referenceSize:l,sizeRatio:S,color:G,outlineColor:F,outlineWidth:T,isOutline:m,markerPlacement:t,animatedSymbolProperties:i});break}case"CIMPictureMarker":case"CIMVectorMarker":f.markerPlacement?this._analyzeMultiLayerGraphicNonSDF(e,r,t,i,o,a,s,l,n,p,!!f.colorLocked||!!c,m):this._analyzeMarker(f,r,t,a,s,l,!1,n,c,m);break;default:this._analyzeMultiLayerGraphicNonSDF(e,r,t,i,o,a,s,l,n,p,!!f.colorLocked||!!c,m)}g&&a.pop()}}_analyzeTextGraphic(e,t,i,o,a,s,l,p){const c=[];f.findApplicableOverrides(i,this._primitiveOverrides,c);const m=i.geometry;if(!("x"in m)||!("y"in m))return;const y=i.symbol,h=P(y),d=C(y.fontStyleName),v=r(y.fontFamilyName);y.font={family:v,decoration:h,...d};const O=g(y.height,n.CIMTextSymbol.height),_=g(y.angle),S=g(y.offsetX),L=g(y.offsetY),E=u(k(y));let I=u(M(y)),V=b(y)??0;V||(I=u(k(y.haloSymbol)),V=g(y.haloSize));let N=!1;if(y.symbol?.symbolLayers)for(const r of y.symbol.symbolLayers){null!=u(k(r))&&(N=!!r.colorLocked)}const w=i.primitiveName;let R=null;N||(R=this._maybeGetValueOrOverrideExpression(w,"FillColor"));const A=this._maybeGetValueOrOverrideExpression(w,"TextSize"),X=this._maybeGetValueOrOverrideExpression(w,"TextAngle"),G=this._maybeGetValueOrOverrideExpression(w,"TextOffsetX"),F=this._maybeGetValueOrOverrideExpression(w,"TextOffsetY");let T=null,Y=null,j=0;if(y.callout&&"CIMBackgroundCallout"===y.callout.type){const e=y.callout;if(e.backgroundSymbol){const r=e.backgroundSymbol.symbolLayers;if(r)for(const e of r)"CIMSolidFill"===e.type?T=u(e.color):"CIMSolidStroke"===e.type&&(Y=u(e.color),j=g(e.width,n.CIMSolidStroke.width))}}const W=this._getValueOrOverrideExpression(y.type,i.primitiveName,"TextString",i.textString??"");if(null==W)return;const{fontStyleName:D}=y,H=v+(D?"-"+D.toLowerCase():"-regular"),U=this._getMaterialOverrides(o,y.type);U.push(...this._getPrimitiveMaterialOverrides(i.primitiveName,y.type));const B={type:"text-rasterization-param",resource:{type:"text",textString:i.textString??"",font:y.font,symbol:y,primitiveName:i.primitiveName},overrides:U};this._cimLayers.push({type:"text",lineWidth:null,textRasterizationParam:B,colorLocked:!!p||!!N,effects:e,alignment:a,anchorPoint:{x:0,y:0},isAbsoluteAnchorPoint:!1,fontName:H,decoration:h,weight:d.weight,style:d.style,size:A??O,angle:X??_,offsetX:G??S,offsetY:F??L,transform:{type:"cim-marker-transform-param",params:l},horizontalAlignment:z(y.horizontalAlignment),verticalAlignment:x(y.verticalAlignment),text:W,color:R??this._getValueOrOverrideExpression(y.type,i.primitiveName,"Color",E),outlineColor:I,outlineSize:V,backgroundColor:T,borderLineColor:Y,borderLineWidth:j,referenceSize:s,sizeRatio:1,markerPlacement:t})}_analyzeMultiLayerGraphicNonSDF(e,r,t,i,a,s,n,p,c,m,f,y){const h=this._buildSimpleMarker(e,a),d=e.primitiveName,u=this._analyzeMaterialOverrides(d,["Rotation","OffsetX","OffsetY"]),v=this._normalizePrimitiveOverrideProps(u),[O,_,g]=l.getTextureAnchor(h,this._resourceManager),S=this._getMaterialOverrides(s,e.type);S.push(...v);const k={type:"sprite-rasterization-param",resource:{...h,avoidSDFRasterization:!0},overrides:S};this._cimLayers.push({type:"marker",spriteRasterizationParam:k,colorLocked:f,effects:r,scaleSymbolsProportionally:!!e.scaleSymbolsProportionally,alignment:n,anchorPoint:{x:O,y:_},isAbsoluteAnchorPoint:!1,size:m,rotation:0,offsetX:0,offsetY:0,transform:{type:"cim-marker-transform-param",params:c},color:[255,255,255,1],outlineColor:[0,0,0,0],outlineWidth:0,scaleX:1,frameHeight:m,widthRatio:1,rotateClockwise:!!e.rotateClockwise,referenceSize:p,sizeRatio:g/o(e.size),isOutline:y,markerPlacement:t,animatedSymbolProperties:i})}_createMarkerPlacementOverrideExpression(e){if(!e)return null;const r=[];return f.findApplicableOverrides(e,this._primitiveOverrides,r),{type:"cim-marker-placement-info",placement:e,overrides:j(r)}}_createAnimatedSymbolPropertiesOverrideExpression(e){if(!e)return null;const r=[];return f.findApplicableOverrides(e,this._primitiveOverrides,r),{type:"cim-animation-info",animation:e,overrides:j(r)}}_buildSimpleMarker(e,r){return{type:e.type,enable:!0,name:e.name,colorLocked:e.colorLocked,primitiveName:e.primitiveName,anchorPoint:e.anchorPoint,anchorPointUnits:e.anchorPointUnits,offsetX:0,offsetY:0,rotateClockwise:e.rotateClockwise,rotation:0,size:e.size,billboardMode3D:e.billboardMode3D,depth3D:e.depth3D,frame:e.frame,markerGraphics:[r],scaleSymbolsProportionally:e.scaleSymbolsProportionally,respectFrame:e.respectFrame,clippingPath:e.clippingPath}}_analyzeCompositeMarkerGraphic(e,r,t,i,o,a,s,l,p,c,m,f){const d=o.geometry,v=a[0],O=a[1],_=y(d);if(!_)return;const S="Relative"!==e.anchorPointUnits,[k,M,b,P]=h(_,e.frame,e.size,e.anchorPoint,S),{path:C}=O,z=O.primitiveName,x=v.primitiveName,L=o.primitiveName;let E=null;O.colorLocked||m||(E=this._maybeGetValueOrOverrideExpression(L,"FillColor"));const I=E??this._getValueOrOverrideExpression(O.type,z,"Color",u(O.color));let V=null;v.colorLocked||m||(V=this._maybeGetValueOrOverrideExpression(L,"StrokeColor"));const N=V??this._getValueOrOverrideExpression(v.type,x,"Color",u(v.color)),w=this._maybeGetValueOrOverrideExpression(L,"StrokeWidth")??this._getValueOrOverrideExpression(v.type,x,"Width",g(v.width,n.CIMSolidStroke.width)),R={type:"sprite-rasterization-param",resource:C?{type:"path",path:C,asFill:!0}:{type:"sdf",geom:d,asFill:!0},overrides:[]};this._cimLayers.push({type:"marker",spriteRasterizationParam:R,colorLocked:m,effects:r,scaleSymbolsProportionally:!!e.scaleSymbolsProportionally,alignment:s,anchorPoint:{x:M,y:b},isAbsoluteAnchorPoint:S,size:c,rotation:0,offsetX:0,offsetY:0,scaleX:1,transform:{type:"cim-marker-transform-param",params:p},frameHeight:c,widthRatio:P,rotateClockwise:!1,referenceSize:l,sizeRatio:k,color:I,outlineColor:N,outlineWidth:w,isOutline:f,markerPlacement:t,animatedSymbolProperties:i})}_setPoMap(e,r,t){let i;this._poMap[e]?i=this._poMap[e]:(i={},this._poMap[e]=i),i[r]=t}_maybeGetValueOrOverrideExpression(e,r,t){return this._getValueOrOverrideExpression("",e,r,t,!1)}_getValueOrOverrideExpression(e,r,t,i,o=!0){if(o&&!L(i)&&(i=S(e,t.toLowerCase())),null==r)return i;const a=this._poMap[r];if(null==a)return i;const s=a[t];return"string"==typeof s||"number"==typeof s||Array.isArray(s)?s:s?{valueExpressionInfo:s,defaultValue:i}:i}_analyzePrimitiveOverrides(e,r,t,i){if(null==e)return!1;"string"==typeof e&&(e=[e]);for(const o of this._primitiveOverrides)if(e.includes(o.primitiveName)&&o.valueExpressionInfo)return!0;if(null!=r)for(const o of r)if(o?.overrides.length>0)return!0;if(null!=t)for(const o of t)if(o?.overrides.length>0)return!0;if(null!=i)for(const o of i)if(o?.overrides.length>0)return!0;return!1}_getMaterialOverrides(e,r){if(!e)return[];const t=[];for(const i of e)t.push(...this._getPrimitiveMaterialOverrides(i,r));return t}_getPrimitiveMaterialOverrides(e,r){if(!e)return[];const t=this._normalizePrimitiveOverrideProps(this._primitiveOverrides.filter((r=>r.primitiveName===e)));return t.forEach((e=>e.defaultValue=S(r,e.propertyName.toLowerCase()))),t}_analyzeMaterialOverrides(e,r){return this._primitiveOverrides.filter((t=>t.primitiveName!==e||!r.includes(t.propertyName)))}_normalizePrimitiveOverrideProps(e){return e.map((e=>({...e,propertyName:E(e.propertyName)})))}}function G(e){if(e&&0===e.indexOf("Level_")){const r=parseInt(e.substr(6),10);if(!isNaN(r))return r}return 0}function F(e,r){if(!r||0===r.length)return e;const i=t(e);return f.applyOverrides(i,r),i}const T=e=>e&&2===e.length&&e[0].enable&&e[1].enable&&"CIMSolidStroke"===e[0].type&&"CIMSolidFill"===e[1].type&&null==e[0].path&&null==e[1].path&&!e[0].effects&&!e[1].effects;function Y(e){const r=e.symbolLayers;if(!r||2!==r.length)return!1;const t=r.find((e=>e.effects?.find((e=>"CIMGeometricEffectDashes"===e.type)))),i=r.find((e=>e.effects?.find((e=>"CIMGeometricEffectAddControlPoints"===e.type))));return!!t||!!i}function j(e){return t(e).map((e=>({...e,propertyName:E(e.propertyName)})))}export{X as CIMAnalyzer,F as analyzeCIMResource};
5
+ import{isRGB as e}from"../../core/colorUtils.js";import{getFontFamily as r}from"../../core/fontUtils.js";import{clone as t}from"../../core/lang.js";import i from"../../core/Logger.js";import{pt2px as o,px2pt as a}from"../../core/screenUtils.js";import{numericHash as s}from"../../core/string.js";import{CIMSymbolHelper as l}from"./CIMSymbolHelper.js";import{defaultCIMValues as n}from"./defaultCIMValues.js";import{Alignment as p}from"./enums.js";import{OverrideHelper as c}from"./OverrideHelper.js";import{getExtent as m,getSDFMetrics as y}from"./SDFHelper.js";import{colorToArray as f,normalizeAlpha as h,getSize as d,isCIMMarkerStrokePlacement as u,getTintColor as v,getValue as O,getDefaultCIMValue as _,getEnum as g,getFillColor as S,getStrokeColor as k,getStrokeWidth as M,fromCIMFontDecoration as P,fromCIMFontStyle as b,fromCIMHorizontalAlignment as C,fromCIMVerticalAlignment as z,isValidCIMValue as x,uncapitalize as L}from"./utils.js";import{CIMEffectHelper as E}from"./effects/CIMEffectHelper.js";import{randomInsidePolygonTextureSize as I}from"../../views/2d/engine/webgl/definitions.js";const V=()=>i.getLogger("esri.symbols.cim.cimAnalyzer");function N(e){const r=e.markerPlacement;return r&&r.angleToLine?p.MAP:p.SCREEN}class w{constructor(e){this._cimLayers=[],this._poMap={},this._primitiveOverrides=[],e&&(this._resourceManager=e)}analyzeSymbolReference(r,t,i){if(this._cimLayers=i??[],!r)return this._cimLayers;if(this._reset(),r.primitiveOverrides){this._primitiveOverrides=r.primitiveOverrides;for(const r of this._primitiveOverrides){const t=r.valueExpressionInfo;if(t)this._setPoMap(r.primitiveName,r.propertyName,t);else if(null!=r.value){let t=r.value;r.propertyName.includes("Color")&&(e(t)&&(t=f(t)),t=h(t)),this._setPoMap(r.primitiveName,r.propertyName,t)}}}return this._analyzeSymbol(r.symbol,t),this._cimLayers}_reset(){this._cimLayers=[],this._poMap={},this._primitiveOverrides=[]}_analyzeSymbol(e,r){switch(e?.type){case"CIMPointSymbol":case"CIMLineSymbol":case"CIMPolygonSymbol":this._analyzeMultiLayerSymbol(e,r)}}_analyzeMultiLayerSymbol(e,r){const t=e?.symbolLayers;if(!t)return;const i=e.effects;let o=p.SCREEN;const a=d(e)??0;"CIMPointSymbol"===e.type&&"Map"===e.angleAlignment&&(o=p.MAP);const s="CIMPolygonSymbol"===e.type;let l=t.length;for(;l--;){const n=t[l];if(!n||!1===n.enable)continue;let p;i?.length&&(p=[...i]);const m=n.effects;m?.length&&(i?p.push(...m):p=[...m]);let y=null;if(p){y=[];for(const e of p){const r=c.findEffectOverrides(e,this._primitiveOverrides);r&&y.push(r)}}const f=[];switch(c.findApplicableOverrides(n,this._primitiveOverrides,f),n.type){case"CIMSolidFill":this._analyzeSolidFill(n,y);break;case"CIMPictureFill":this._analyzePictureFill(n,y);break;case"CIMHatchFill":this._analyzeHatchFill(n,y);break;case"CIMGradientFill":this._analyzeGradientFill(n,y);break;case"CIMSolidStroke":this._analyzeSolidStroke(n,y,s,a);break;case"CIMPictureStroke":this._analyzePictureStroke(n,y,s,a);break;case"CIMGradientStroke":this._analyzeGradientStroke(n,y,s,a);break;case"CIMCharacterMarker":case"CIMPictureMarker":case"CIMVectorMarker":{"CIMLineSymbol"!==e.type&&"CIMPolygonSymbol"!==e.type||(o=N(n));const t=[],i=n.primitiveName;i&&t.push(i);const l=s&&u(n.markerPlacement);this._analyzeMarker(n,y,null,t,o,a,r,[],!1,l);break}default:V().error("Cannot analyze CIM layer",n.type)}}}_analyzeSolidFill(e,r){const{primitiveName:t,type:i}=e,o=h(e.color);this._cimLayers.push({type:"fill",spriteRasterizationParam:null,colorLocked:!!e.colorLocked,color:this._getValueOrOverrideExpression(i,t,"Color",o),height:0,angle:0,offsetX:0,offsetY:0,scaleX:1,effects:r,applyRandomOffset:!1,sampleAlphaOnly:!0,hasUnresolvedReplacementColor:!1})}_analyzePictureFill(e,r){const{primitiveName:t,type:i}=e,o=v(e),a=O(e.height,n.CIMPictureFill.height);let s=O(e.scaleX,1);if("width"in e&&"number"==typeof e.width){const r=e.width;let t=1;const i=this._resourceManager.getResource(e.url);null!=i&&(t=i.width/i.height),s/=t*(a/r)}const l={type:"sprite-rasterization-param",resource:e,overrides:this._getPrimitiveMaterialOverrides(t,i)};this._cimLayers.push({type:"fill",spriteRasterizationParam:l,colorLocked:!!e.colorLocked,effects:r,color:this._getValueOrOverrideExpression(i,t,"TintColor",o),height:this._getValueOrOverrideExpression(i,t,"Height",a),scaleX:this._getValueOrOverrideExpression(i,t,"ScaleX",s),angle:this._getValueOrOverrideExpression(i,t,"Rotation",O(e.rotation)),offsetX:this._getValueOrOverrideExpression(i,t,"OffsetX",O(e.offsetX)),offsetY:this._getValueOrOverrideExpression(i,t,"OffsetY",O(e.offsetY)),applyRandomOffset:!1,sampleAlphaOnly:!1,hasUnresolvedReplacementColor:!1})}_analyzeHatchFill(e,r){const{primitiveName:t,type:i}=e,o=this._analyzeMaterialOverrides(t,["Rotation","OffsetX","OffsetY"]),a=this._normalizePrimitiveOverrideProps(o);let s=[255,255,255,1],l=!1;if(e.lineSymbol?.symbolLayers)for(const n of e.lineSymbol.symbolLayers){if("CIMSolidStroke"!==n.type)continue;const e=n.primitiveName??t;l||!e||n.colorLocked||null==this._poMap[e]?.Color&&null==this._poMap[e]?.StrokeColor||(s=h(n.color),s=this._maybeGetValueOrOverrideExpression(e,"StrokeColor")??this._getValueOrOverrideExpression(i,e,"Color",s),l=!0);const r=this._maybeGetValueOrOverrideExpression(e,"StrokeWidth");if(r){let t=null,o=null;"number"==typeof r?t=r:o=r.valueExpressionInfo;let s=a.find((e=>"strokeWidth"===e.propertyName));s?s.propertyName="width":(s={type:"CIMPrimitiveOverride",primitiveName:e,propertyName:"width",valueExpressionInfo:o,value:t,defaultValue:_(i,"width")},a.push(s))}}const p={type:"sprite-rasterization-param",resource:e,overrides:a};this._cimLayers.push({type:"fill",spriteRasterizationParam:p,colorLocked:!!e.colorLocked,effects:r,color:s,height:this._getValueOrOverrideExpression(i,t,"Separation",O(e.separation,n.CIMHatchFill.separation)),scaleX:1,angle:this._getValueOrOverrideExpression(i,t,"Rotation",O(e.rotation)),offsetX:this._getValueOrOverrideExpression(i,t,"OffsetX",O(e.offsetX)),offsetY:this._getValueOrOverrideExpression(i,t,"OffsetY",O(e.offsetY)),applyRandomOffset:!1,sampleAlphaOnly:!0,hasUnresolvedReplacementColor:!l})}_analyzeGradientFill(e,r){this._cimLayers.push({type:"fill",spriteRasterizationParam:null,colorLocked:!!e.colorLocked,effects:r,color:[128,128,128,1],height:0,angle:0,offsetX:0,offsetY:0,scaleX:1,applyRandomOffset:!1,sampleAlphaOnly:!1,hasUnresolvedReplacementColor:!1})}_analyzeSolidStroke(e,r,t,i){const{primitiveName:o,type:a}=e,s=h(e.color),l=O(e.width,n.CIMSolidStroke.width),p=g(e.capStyle,n.CIMSolidStroke.capstyle),c=g(e.joinStyle,n.CIMSolidStroke.joinstyle),m=e.miterLimit;let y,f,d=[];if(this._analyzePrimitiveOverrides(o,r,null,null)&&(d=this._getPrimitiveMaterialOverrides(o,a)),r&&r instanceof Array&&r.length>0){const e=r[r.length-1].effect;e&&"CIMGeometricEffectDashes"===e.type&&"NoConstraint"===e.lineDashEnding&&null===e.offsetAlongLine&&(y=e.dashTemplate,f=e.scaleDash,(r=[...r]).pop())}const u=void 0!==y?{type:"sprite-rasterization-param",resource:{type:"dash",dashTemplate:y,capStyle:p},overrides:d}:null;this._cimLayers.push({type:"line",spriteRasterizationParam:u,isOutline:t,colorLocked:!!e.colorLocked,effects:r,color:this._getValueOrOverrideExpression(a,o,"Color",s),width:this._getValueOrOverrideExpression(a,o,"Width",l),cap:this._getValueOrOverrideExpression(a,o,"CapStyle",p),join:this._getValueOrOverrideExpression(a,o,"JoinStyle",c),miterLimit:m&&this._getValueOrOverrideExpression(a,o,"MiterLimit",m),referenceWidth:i,zOrder:R(e.name),dashTemplate:y,scaleDash:f,sampleAlphaOnly:!0})}_analyzePictureStroke(e,r,t,i){const{primitiveName:o,type:a}=e,s=v(e),l=O(e.width,n.CIMPictureStroke.width),p=g(e.capStyle,n.CIMPictureStroke.capstyle),c=g(e.joinStyle,n.CIMPictureStroke.joinstyle),m=e.miterLimit,y={type:"sprite-rasterization-param",resource:e,overrides:this._getPrimitiveMaterialOverrides(o,a)};this._cimLayers.push({type:"line",spriteRasterizationParam:y,isOutline:t,colorLocked:!!e.colorLocked,effects:r,color:this._getValueOrOverrideExpression(a,o,"TintColor",s),width:this._getValueOrOverrideExpression(a,o,"Width",l),cap:this._getValueOrOverrideExpression(a,o,"CapStyle",p),join:this._getValueOrOverrideExpression(a,o,"JoinStyle",c),miterLimit:m&&this._getValueOrOverrideExpression(a,o,"MiterLimit",m),referenceWidth:i,zOrder:R(e.name),dashTemplate:null,scaleDash:!1,sampleAlphaOnly:!1})}_analyzeGradientStroke(e,r,t,i){const{primitiveName:o,type:a}=e,s=O(e.width,n.CIMSolidStroke.width),l=g(e.capStyle,n.CIMGradientStroke.capstyle),p=g(e.joinStyle,n.CIMGradientStroke.joinstyle),c=e.miterLimit;this._cimLayers.push({type:"line",spriteRasterizationParam:null,isOutline:t,colorLocked:!!e.colorLocked,effects:r,color:[128,128,128,1],width:this._getValueOrOverrideExpression(a,o,"Width",s),cap:this._getValueOrOverrideExpression(a,o,"CapStyle",l),join:this._getValueOrOverrideExpression(a,o,"JoinStyle",p),miterLimit:c&&this._getValueOrOverrideExpression(a,o,"MiterLimit",c),referenceWidth:i,zOrder:R(e.name),dashTemplate:null,scaleDash:!1,sampleAlphaOnly:!1})}_analyzeMarker(e,r,t,i,o,a,s,l,p=!1,c=!1){if(p||=!!e.colorLocked,this._analyzeMarkerInsidePolygon(e,r,p))return;const m=O(e.size,n.CIMVectorMarker.size),y=O(e.rotation),f=O(e.offsetX),h=O(e.offsetY),{primitiveName:d,type:u}=e,v=this._getValueOrOverrideExpression(u,d,"Size",m),_=this._getValueOrOverrideExpression(u,d,"Rotation",y),g=this._getValueOrOverrideExpression(u,d,"OffsetX",f),S=this._getValueOrOverrideExpression(u,d,"OffsetY",h);switch(e.type){case"CIMPictureMarker":this._analyzePictureMarker(e,r,t,i,o,a,v,_,g,S,l,p,c);break;case"CIMVectorMarker":this._analyzeVectorMarker(e,r,t,i,o,a,v,_,g,S,l,s,p,c)}}_analyzeMarkerInsidePolygon(e,r,t){const{markerPlacement:i,type:o}=e;if(!i||"CIMMarkerPlacementInsidePolygon"!==i.type)return!1;if("CIMVectorMarker"===o||"CIMPictureMarker"===o){const t=e.primitiveName;if(t&&this._analyzePrimitiveOverrides([t],r,null,null))return!1;const a=i.primitiveName;if(a&&this._analyzePrimitiveOverrides([a],r,null,null))return!1;if("CIMVectorMarker"===o){const{markerGraphics:r}=e;if(r)for(const e of r){const{symbol:r}=e;if("CIMPolygonSymbol"===r?.type&&r.symbolLayers){const{symbolLayers:e}=r;for(const r of e)if("CIMSolidStroke"===r.type)return!1}}}else{const{animatedSymbolProperties:r}=e;if(r)return!1}}const s=Math.abs(i.stepX),l=Math.abs(i.stepY);if(0===s||0===l)return!0;let n,p;if("Random"===i.gridType){const e=a(I),r=Math.max(Math.floor(e/s),1);n=l*Math.max(Math.floor(e/l),1);p=r*s/n}else i.shiftOddRows?(n=2*l,p=s/l*.5):(n=l,p=s/l);const c=v(e),m="CIMCharacterMarker"===e.type?null:{type:"sprite-rasterization-param",resource:e,overrides:[]};return this._cimLayers.push({type:"fill",spriteRasterizationParam:m,colorLocked:t,effects:r,color:c,height:n,scaleX:p,angle:i.gridAngle,offsetX:O(i.offsetX),offsetY:O(i.offsetY),applyRandomOffset:"Random"===i.gridType,sampleAlphaOnly:"CIMPictureMarker"!==e.type,hasUnresolvedReplacementColor:!0}),!0}_analyzePictureMarker(e,r,i,o,a,l,n,p,c,m,y,f,h){const{primitiveName:d,type:u}=e;let _=O(e.scaleX,1);const g=v(e);i||(i=this._createMarkerPlacementOverrideExpression(e.markerPlacement));const S=this._createAnimatedSymbolPropertiesOverrideExpression(e.animatedSymbolProperties),k=e.anchorPoint??{x:0,y:0};if("width"in e&&"number"==typeof e.width){const r=e.width;let t=1;const i=this._resourceManager.getResource(e.url);null!=i&&(t=i.width/i.height);_/=t*(O(e.size)/r)}const M=[...o];let P;e.primitiveName&&M.push(e.primitiveName),e.animatedSymbolProperties||S?P={type:"animated",url:e.url,urlHash:"H"+s(e.url),playAnimation:e.animatedSymbolProperties?.playAnimation,reverseAnimation:e.animatedSymbolProperties?.reverseAnimation,randomizeStartTime:e.animatedSymbolProperties?.randomizeStartTime,randomizeStartSeed:e.animatedSymbolProperties?.randomizeStartSeed,startTimeOffset:e.animatedSymbolProperties?.startTimeOffset,duration:e.animatedSymbolProperties?.duration,repeatType:e.animatedSymbolProperties?.repeatType,repeatDelay:e.animatedSymbolProperties?.repeatDelay}:(P=t(e),P.markerPlacement=null);const b={type:"sprite-rasterization-param",resource:P,overrides:this._getMaterialOverrides(M,u)};S&&b.overrides.push(...S.overrides),this._cimLayers.push({type:"marker",spriteRasterizationParam:b,colorLocked:f,effects:r,scaleSymbolsProportionally:!1,alignment:a,size:n,scaleX:this._getValueOrOverrideExpression(u,d,"ScaleX",_),rotation:p,offsetX:c,offsetY:m,transform:{type:"cim-marker-transform-param",params:y},color:this._getValueOrOverrideExpression(u,d,"TintColor",g),anchorPoint:{x:k.x,y:k.y},isAbsoluteAnchorPoint:"Relative"!==e.anchorPointUnits,outlineColor:[0,0,0,0],outlineWidth:0,frameHeight:0,widthRatio:1,rotateClockwise:!!e.rotateClockwise,referenceSize:l,sizeRatio:1,isOutline:h,markerPlacement:i,animatedSymbolProperties:S})}_analyzeVectorMarker(e,r,t,i,o,a,s,l,n,p,c,m,y,f){const h=e.markerGraphics;if(!h)return;const d=e.frame;let u=0;if(u=d?d.ymax-d.ymin:a,u){const r={offsetX:n,offsetY:p,rotation:l,size:s,frameHeight:u,rotateClockWise:!!e.rotateClockwise};c=[...c,r]}t||(t=this._createMarkerPlacementOverrideExpression(e.markerPlacement));for(const v of h)if(v){const s=v.symbol;if(!s)continue;const l=v.primitiveName;let n;if(l&&i.push(l),("CIMPointSymbol"===s.type||"CIMTextSymbol"===s.type)&&d){let r=0,t=0;const i=v.geometry;"x"in i&&"y"in i&&(r+=i.x-.5*(d.xmin+d.xmax),t+=i.y-.5*(d.ymin+d.ymax));const o=e.anchorPoint;o&&("Absolute"===e.anchorPointUnits?(r-=o.x,t-=o.y):d&&(r-=(d.xmax-d.xmin)*o.x,t-=(d.ymax-d.ymin)*o.y));const a={offsetX:r,offsetY:t,rotation:0,size:0,frameHeight:0,rotateClockWise:!1};n=[...c,a]}switch(s.type){case"CIMPointSymbol":case"CIMLineSymbol":case"CIMPolygonSymbol":m||X(s)?this._analyzeMultiLayerGraphicNonSDF(e,r,t,null,v,i,o,a,n??c,u,y,f):this._analyzeMultiLayerGraphic(e,r,t,null,v,i,o,a,n??c,u,y,f);break;case"CIMTextSymbol":this._analyzeTextGraphic(r,t,v,i,o,a,n??c,y)}l&&i.pop()}}_analyzeMultiLayerGraphic(e,r,t,i,o,a,s,l,n,p,c,f){const d=o.symbol,u=d.symbolLayers;if(!u)return;let v=u.length;if(G(u))return void this._analyzeCompositeMarkerGraphic(e,r,t,i,o,u,s,l,n,p,c,f);const O=this._resourceManager.geometryEngine,_=E.applyEffects(d.effects,o.geometry,O);if(_)for(;v--;){const d=u[v];if(!d||!1===d.enable)continue;const g=d.primitiveName;switch(g&&a.push(g),d.type){case"CIMSolidFill":case"CIMSolidStroke":{const a=E.applyEffects(d.effects,_,O),u=m(a);if(!u)continue;const v="Relative"!==e.anchorPointUnits,[P,b,C,z]=y(u,e.frame,e.size,e.anchorPoint,v),x="CIMSolidFill"===d.type,L={type:"sdf",geom:a,asFill:x},{path:I}=d,V=x?h(S(d)):null==I?h(k(d)):[0,0,0,0],N=x?[0,0,0,0]:h(k(d)),w=M(d)??0;if(!x&&!w)break;const R=o.primitiveName;let A=null;x&&!d.colorLocked&&(A=this._maybeGetValueOrOverrideExpression(R,"FillColor"));let G=null;x||d.colorLocked||(G=this._maybeGetValueOrOverrideExpression(R,"StrokeColor"));const X=A??this._getValueOrOverrideExpression(d.type,g,"Color",V),F=G??this._getValueOrOverrideExpression(d.type,g,"Color",N),T=this._maybeGetValueOrOverrideExpression(R,"StrokeWidth")??this._getValueOrOverrideExpression(d.type,g,"Width",w),Y=I?{type:"sprite-rasterization-param",resource:{type:"path",path:I,asFill:x},overrides:[]}:{type:"sprite-rasterization-param",resource:L,overrides:[]};this._cimLayers.push({type:"marker",spriteRasterizationParam:Y,colorLocked:!!d.colorLocked||!!c,effects:r,scaleSymbolsProportionally:!!e.scaleSymbolsProportionally,alignment:s,anchorPoint:{x:b,y:C},isAbsoluteAnchorPoint:v,size:p,rotation:0,offsetX:0,offsetY:0,scaleX:1,transform:{type:"cim-marker-transform-param",params:n},frameHeight:p,widthRatio:z,rotateClockwise:!1,referenceSize:l,sizeRatio:P,color:X,outlineColor:F,outlineWidth:T,isOutline:f,markerPlacement:t,animatedSymbolProperties:i});break}case"CIMPictureMarker":case"CIMVectorMarker":d.markerPlacement?this._analyzeMultiLayerGraphicNonSDF(e,r,t,i,o,a,s,l,n,p,!!d.colorLocked||!!c,f):this._analyzeMarker(d,r,t,a,s,l,!1,n,c,f);break;default:this._analyzeMultiLayerGraphicNonSDF(e,r,t,i,o,a,s,l,n,p,!!d.colorLocked||!!c,f)}g&&a.pop()}}_analyzeTextGraphic(e,t,i,o,a,s,l,p){const m=[];c.findApplicableOverrides(i,this._primitiveOverrides,m);const y=i.geometry;if(!("x"in y)||!("y"in y))return;const f=i.symbol,d=P(f),u=b(f.fontStyleName),v=r(f.fontFamilyName);f.font={family:v,decoration:d,...u};const _=O(f.height,n.CIMTextSymbol.height),g=O(f.angle),x=O(f.offsetX),L=O(f.offsetY),E=h(S(f));let I=h(k(f)),V=M(f)??0;V||(I=h(S(f.haloSymbol)),V=O(f.haloSize));let N=!1;if(f.symbol?.symbolLayers)for(const r of f.symbol.symbolLayers){null!=h(S(r))&&(N=!!r.colorLocked)}const w=i.primitiveName;let R=null;N||(R=this._maybeGetValueOrOverrideExpression(w,"FillColor"));const A=this._maybeGetValueOrOverrideExpression(w,"TextSize"),G=this._maybeGetValueOrOverrideExpression(w,"TextAngle"),X=this._maybeGetValueOrOverrideExpression(w,"TextOffsetX"),F=this._maybeGetValueOrOverrideExpression(w,"TextOffsetY");let T=null,Y=null,j=0;if(f.callout&&"CIMBackgroundCallout"===f.callout.type){const e=f.callout;if(e.backgroundSymbol){const r=e.backgroundSymbol.symbolLayers;if(r)for(const e of r)"CIMSolidFill"===e.type?T=h(e.color):"CIMSolidStroke"===e.type&&(Y=h(e.color),j=O(e.width,n.CIMSolidStroke.width))}}const W=this._getValueOrOverrideExpression(f.type,i.primitiveName,"TextString",i.textString??"");if(null==W)return;const{fontStyleName:D}=f,H=v+(D?"-"+D.toLowerCase():"-regular"),U=this._getMaterialOverrides(o,f.type);U.push(...this._getPrimitiveMaterialOverrides(i.primitiveName,f.type));const J={type:"text-rasterization-param",resource:{type:"text",textString:i.textString??"",font:f.font,symbol:f,primitiveName:i.primitiveName},overrides:U};this._cimLayers.push({type:"text",lineWidth:null,textRasterizationParam:J,colorLocked:!!p||!!N,effects:e,alignment:a,anchorPoint:{x:0,y:0},isAbsoluteAnchorPoint:!1,fontName:H,decoration:d,weight:u.weight,style:u.style,size:A??_,angle:G??g,offsetX:X??x,offsetY:F??L,transform:{type:"cim-marker-transform-param",params:l},horizontalAlignment:C(f.horizontalAlignment),verticalAlignment:z(f.verticalAlignment),text:W,color:R??this._getValueOrOverrideExpression(f.type,i.primitiveName,"Color",E),outlineColor:I,outlineSize:V,backgroundColor:T,borderLineColor:Y,borderLineWidth:j,referenceSize:s,sizeRatio:1,markerPlacement:t})}_analyzeMultiLayerGraphicNonSDF(e,r,t,i,a,s,n,p,c,m,y,f){const h=this._buildSimpleMarker(e,a),d=e.primitiveName,u=this._analyzeMaterialOverrides(d,["Rotation","OffsetX","OffsetY"]),v=this._normalizePrimitiveOverrideProps(u),[O,_,g]=l.getTextureAnchor(h,this._resourceManager),S=this._getMaterialOverrides(s,e.type);S.push(...v);const k={type:"sprite-rasterization-param",resource:{...h,avoidSDFRasterization:!0},overrides:S};this._cimLayers.push({type:"marker",spriteRasterizationParam:k,colorLocked:y,effects:r,scaleSymbolsProportionally:!!e.scaleSymbolsProportionally,alignment:n,anchorPoint:{x:O,y:_},isAbsoluteAnchorPoint:!1,size:m,rotation:0,offsetX:0,offsetY:0,transform:{type:"cim-marker-transform-param",params:c},color:[255,255,255,1],outlineColor:[0,0,0,0],outlineWidth:0,scaleX:1,frameHeight:m,widthRatio:1,rotateClockwise:!!e.rotateClockwise,referenceSize:p,sizeRatio:g/o(e.size),isOutline:f,markerPlacement:t,animatedSymbolProperties:i})}_createMarkerPlacementOverrideExpression(e){if(!e)return null;const r=[];return c.findApplicableOverrides(e,this._primitiveOverrides,r),{type:"cim-marker-placement-info",placement:e,overrides:F(r)}}_createAnimatedSymbolPropertiesOverrideExpression(e){if(!e)return null;const r=[];return c.findApplicableOverrides(e,this._primitiveOverrides,r),{type:"cim-animation-info",animation:e,overrides:F(r)}}_buildSimpleMarker(e,r){return{type:e.type,enable:!0,name:e.name,colorLocked:e.colorLocked,primitiveName:e.primitiveName,anchorPoint:e.anchorPoint,anchorPointUnits:e.anchorPointUnits,offsetX:0,offsetY:0,rotateClockwise:e.rotateClockwise,rotation:0,size:e.size,billboardMode3D:e.billboardMode3D,depth3D:e.depth3D,frame:e.frame,markerGraphics:[r],scaleSymbolsProportionally:e.scaleSymbolsProportionally,respectFrame:e.respectFrame,clippingPath:e.clippingPath}}_analyzeCompositeMarkerGraphic(e,r,t,i,o,a,s,l,p,c,f,d){const u=o.geometry,v=a[0],_=a[1],g=m(u);if(!g)return;const S="Relative"!==e.anchorPointUnits,[k,M,P,b]=y(g,e.frame,e.size,e.anchorPoint,S),{path:C}=_,z=_.primitiveName,x=v.primitiveName,L=o.primitiveName;let E=null;_.colorLocked||f||(E=this._maybeGetValueOrOverrideExpression(L,"FillColor"));const I=E??this._getValueOrOverrideExpression(_.type,z,"Color",h(_.color));let V=null;v.colorLocked||f||(V=this._maybeGetValueOrOverrideExpression(L,"StrokeColor"));const N=V??this._getValueOrOverrideExpression(v.type,x,"Color",h(v.color)),w=this._maybeGetValueOrOverrideExpression(L,"StrokeWidth")??this._getValueOrOverrideExpression(v.type,x,"Width",O(v.width,n.CIMSolidStroke.width)),R={type:"sprite-rasterization-param",resource:C?{type:"path",path:C,asFill:!0}:{type:"sdf",geom:u,asFill:!0},overrides:[]};this._cimLayers.push({type:"marker",spriteRasterizationParam:R,colorLocked:f,effects:r,scaleSymbolsProportionally:!!e.scaleSymbolsProportionally,alignment:s,anchorPoint:{x:M,y:P},isAbsoluteAnchorPoint:S,size:c,rotation:0,offsetX:0,offsetY:0,scaleX:1,transform:{type:"cim-marker-transform-param",params:p},frameHeight:c,widthRatio:b,rotateClockwise:!1,referenceSize:l,sizeRatio:k,color:I,outlineColor:N,outlineWidth:w,isOutline:d,markerPlacement:t,animatedSymbolProperties:i})}_setPoMap(e,r,t){let i;this._poMap[e]?i=this._poMap[e]:(i={},this._poMap[e]=i),i[r]=t}_maybeGetValueOrOverrideExpression(e,r,t){return this._getValueOrOverrideExpression("",e,r,t,!1)}_getValueOrOverrideExpression(e,r,t,i,o=!0){if(o&&!x(i)&&(i=_(e,t.toLowerCase())),null==r)return i;const a=this._poMap[r];if(null==a)return i;const s=a[t];return"string"==typeof s||"number"==typeof s||Array.isArray(s)?s:s?{valueExpressionInfo:s,defaultValue:i}:i}_analyzePrimitiveOverrides(e,r,t,i){if(null==e)return!1;"string"==typeof e&&(e=[e]);for(const o of this._primitiveOverrides)if(e.includes(o.primitiveName)&&o.valueExpressionInfo)return!0;if(null!=r)for(const o of r)if(o?.overrides.length>0)return!0;if(null!=t)for(const o of t)if(o?.overrides.length>0)return!0;if(null!=i)for(const o of i)if(o?.overrides.length>0)return!0;return!1}_getMaterialOverrides(e,r){if(!e)return[];const t=[];for(const i of e)t.push(...this._getPrimitiveMaterialOverrides(i,r));return t}_getPrimitiveMaterialOverrides(e,r){if(!e)return[];const t=this._normalizePrimitiveOverrideProps(this._primitiveOverrides.filter((r=>r.primitiveName===e)));return t.forEach((e=>e.defaultValue=_(r,e.propertyName.toLowerCase()))),t}_analyzeMaterialOverrides(e,r){return this._primitiveOverrides.filter((t=>t.primitiveName!==e||!r.includes(t.propertyName)))}_normalizePrimitiveOverrideProps(e){return e.map((e=>({...e,propertyName:L(e.propertyName)})))}}function R(e){if(e&&0===e.indexOf("Level_")){const r=parseInt(e.substr(6),10);if(!isNaN(r))return r}return 0}function A(e,r){if(!r||0===r.length)return e;const i=t(e);return c.applyOverrides(i,r),i}const G=e=>e&&2===e.length&&e[0].enable&&e[1].enable&&"CIMSolidStroke"===e[0].type&&"CIMSolidFill"===e[1].type&&null==e[0].path&&null==e[1].path&&!e[0].effects&&!e[1].effects;function X(e){const r=e.symbolLayers;if(!r||2!==r.length)return!1;const t=r.find((e=>e.effects?.find((e=>"CIMGeometricEffectDashes"===e.type)))),i=r.find((e=>e.effects?.find((e=>"CIMGeometricEffectAddControlPoints"===e.type))));return!!t||!!i}function F(e){return t(e).map((e=>({...e,propertyName:L(e.propertyName)})))}export{w as CIMAnalyzer,A as analyzeCIMResource};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.30/esri/copyright.txt for details.
4
4
  */
5
- const e={color:[128,128,128,1],outlinecolor:[0,0,0,1],backgroundcolor:[128,128,128,1],borderLineColor:[0,0,0,1]},t={CIMVectorMarker:{scalesymbolsproportionally:!1,respectframe:!0,anchorpointunits:"Relative",offsetX:0,offsetY:0,rotateclockwise:!1,rotation:0,size:10,enable:!0,colorlocked:!1},CIMPictureMarker:{scalex:1,texturefilter:"Draft",anchorpointunits:"Relative",offsetx:0,offsety:0,rotateclockwise:!1,rotation:0,size:10,enable:!0,colorlocked:!1},CIMTextSymbol:{angle:0,anglex:0,angley:0,halosize:1,height:10,horizontalalignment:"Left",kerning:!0,letterspacing:0,letterwidth:100,ligatures:!0,linegap:0,offsetx:0,offsety:0,strikethrough:!1,textcase:"Normal",textstring:"",underline:!1,verticalalignment:"Bottom",enable:!0,colorlocked:!1},CIMSolidStroke:{capstyle:"Round",joinstyle:"Round",miterlimit:4,width:4,enable:!0,colorlocked:!1},CIMPictureStroke:{texturefilter:"Draft",capstyle:"Round",joinstyle:"Round",miterlimit:4,width:4,enable:!0,colorlocked:!1},CIMSolidFill:{enable:!0,colorocked:!1},CIMPictureFill:{offsetx:0,offsety:0,rotation:0,scalex:1,height:10,texturefilter:"Draft",enable:!0,colorlocked:!1},CIMHatchFill:{offsetx:0,offsety:0,rotation:0,separation:4,enable:!0,colorlocked:!1},CIMGeometricEffectAddControlPoints:{angletolerance:120},CIMGeometricEffectArrow:{arrowtype:"OpenEnded",width:5},CIMGeometricEffectBuffer:{size:1},CIMGeometricEffectCut:{begincut:1,endcut:1,middlecut:0,invert:!1},CIMGeometricEffectDashes:{customendingoffset:0,linedashending:"NoConstraint",offsetalongline:0},CIMGeometricEffectDonut:{method:"Mitered",option:"Accurate",width:2},CIMGeometricEffectJog:{angle:225,length:20,position:50},CIMGeometricEffectControlMeasureLine:{rule:"FullGeometry"},CIMGeometricEffectMove:{offsetx:1,offsety:-1},CIMGeometricEffectOffset:{method:"Square",offset:1,option:"Fast"},CIMGeometricEffectRotate:{angle:15},CIMGeometricEffectScale:{xscalefactor:1.15,yscalefactor:1.15},CIMGeometricEffectWave:{amplitude:2,period:3,seed:1,waveform:"Sinus"},CIMMarkerPlacementAlongLine:{customendingoffset:0,endings:"WithHalfGap",offsetalongline:0,placeperpart:!0,angletoline:!0,offset:0},CIMMarkerPlacementAtExtremities:{extremityplacement:"Both",offsetalongline:0,angletoline:!0,offset:0},CIMMarkerPlacementAtRatioPositions:{beginposition:0,endposition:0,flipfirst:!0,angletoline:!0,offset:0},CIMMarkerPlacementInsidePolygon:{gridangle:0,gridtype:"Fixed",offsetx:0,offsety:0,randomness:100,seed:0,shiftoddrows:!1,stepx:16,stepy:16,clipping:"ClipAtBoundary"},CIMMarkerPlacementOnLine:{relativeto:"LineMiddle",startpointoffset:0,angletoline:!0,offset:0},CIMMarkerPlacementOnVertices:{placeperpart:!0,placeoncontrolpoints:!0,placeonendpoints:!0,placeonregularvertices:!0,angletoline:!0,offset:0},CIMMarkerPlacementPolygonCenter:{method:"OnPolygon",offsetx:0,offsety:0,clipatboundary:!1},CIMAnimatedSymbolProperties:{playanimation:!1,reverseanimation:!1,randomizestarttime:!1,randomizestartseed:0,starttimeoffset:0,duration:3,endingduration:3,useendingduration:!1,repeattype:"Loop",repeatdelay:0}};export{e as defaultCIMColor,t as defaultCIMValues};
5
+ const e={color:[128,128,128,1],outlinecolor:[0,0,0,1],backgroundcolor:[128,128,128,1],borderLineColor:[0,0,0,1]},t={CIMVectorMarker:{scalesymbolsproportionally:!1,respectframe:!0,anchorpointunits:"Relative",offsetX:0,offsetY:0,rotateclockwise:!1,rotation:0,size:10,enable:!0,colorlocked:!1},CIMPictureMarker:{scalex:1,texturefilter:"Draft",anchorpointunits:"Relative",offsetx:0,offsety:0,rotateclockwise:!1,rotation:0,size:10,enable:!0,colorlocked:!1},CIMTextSymbol:{angle:0,anglex:0,angley:0,halosize:1,height:10,horizontalalignment:"Left",kerning:!0,letterspacing:0,letterwidth:100,ligatures:!0,linegap:0,offsetx:0,offsety:0,strikethrough:!1,textcase:"Normal",textstring:"",underline:!1,verticalalignment:"Bottom",enable:!0,colorlocked:!1},CIMSolidStroke:{capstyle:"Round",joinstyle:"Round",miterlimit:4,width:4,enable:!0,colorlocked:!1},CIMPictureStroke:{texturefilter:"Draft",capstyle:"Round",joinstyle:"Round",miterlimit:4,width:4,enable:!0,colorlocked:!1},CIMGradientStroke:{capstyle:"Round",joinstyle:"Round",miterlimit:4,width:4,enable:!0,colorlocked:!1},CIMSolidFill:{enable:!0,colorocked:!1},CIMPictureFill:{offsetx:0,offsety:0,rotation:0,scalex:1,height:10,texturefilter:"Draft",enable:!0,colorlocked:!1},CIMHatchFill:{offsetx:0,offsety:0,rotation:0,separation:4,enable:!0,colorlocked:!1},CIMGeometricEffectAddControlPoints:{angletolerance:120},CIMGeometricEffectArrow:{arrowtype:"OpenEnded",width:5},CIMGeometricEffectBuffer:{size:1},CIMGeometricEffectCut:{begincut:1,endcut:1,middlecut:0,invert:!1},CIMGeometricEffectDashes:{customendingoffset:0,linedashending:"NoConstraint",offsetalongline:0},CIMGeometricEffectDonut:{method:"Mitered",option:"Accurate",width:2},CIMGeometricEffectJog:{angle:225,length:20,position:50},CIMGeometricEffectControlMeasureLine:{rule:"FullGeometry"},CIMGeometricEffectMove:{offsetx:1,offsety:-1},CIMGeometricEffectOffset:{method:"Square",offset:1,option:"Fast"},CIMGeometricEffectRotate:{angle:15},CIMGeometricEffectScale:{xscalefactor:1.15,yscalefactor:1.15},CIMGeometricEffectWave:{amplitude:2,period:3,seed:1,waveform:"Sinus"},CIMMarkerPlacementAlongLine:{customendingoffset:0,endings:"WithHalfGap",offsetalongline:0,placeperpart:!0,angletoline:!0,offset:0},CIMMarkerPlacementAtExtremities:{extremityplacement:"Both",offsetalongline:0,angletoline:!0,offset:0},CIMMarkerPlacementAtRatioPositions:{beginposition:0,endposition:0,flipfirst:!0,angletoline:!0,offset:0},CIMMarkerPlacementInsidePolygon:{gridangle:0,gridtype:"Fixed",offsetx:0,offsety:0,randomness:100,seed:0,shiftoddrows:!1,stepx:16,stepy:16,clipping:"ClipAtBoundary"},CIMMarkerPlacementOnLine:{relativeto:"LineMiddle",startpointoffset:0,angletoline:!0,offset:0},CIMMarkerPlacementOnVertices:{placeperpart:!0,placeoncontrolpoints:!0,placeonendpoints:!0,placeonregularvertices:!0,angletoline:!0,offset:0},CIMMarkerPlacementPolygonCenter:{method:"OnPolygon",offsetx:0,offsety:0,clipatboundary:!1},CIMAnimatedSymbolProperties:{playanimation:!1,reverseanimation:!1,randomizestarttime:!1,randomizestartseed:0,starttimeoffset:0,duration:3,endingduration:3,useendingduration:!1,repeattype:"Loop",repeatdelay:0}};export{e as defaultCIMColor,t as defaultCIMValues};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.30/esri/copyright.txt for details.
4
4
  */
5
- import{defaultCIMColor as e,defaultCIMValues as t}from"./defaultCIMValues.js";function r(e){return"function"==typeof e}function n(e,t,n,o){return r(e)?e(t,n,o):e}function o(e){return[e.r,e.g,e.b,e.a]}const i=" /-,\n";function a(e){let t=e.length;for(;t--;)if(!i.includes(e.charAt(t)))return!1;return!0}function s(e,t){const r=[];let n=0,o=-1;do{if(o=e.indexOf("[",n),o>=n){if(o>n){const t=e.substr(n,o-n);r.push([t,null,a(t)])}if(n=o+1,o=e.indexOf("]",n),o>=n){if(o>n){const i=t[e.substr(n,o-n)];i&&r.push([null,i,!1])}n=o+1}}}while(-1!==o);if(n<e.length-1){const t=e.substr(n);r.push([t,null,a(t)])}return r}function l(e,t,r,n){let o="",i=null;for(const a of t){const[t,n,s]=a;if(t)s?i=t:(i&&(o+=i,i=null),o+=t);else{let t=n;null!=r&&(t=B(n,r));const a=e.attributes[t];a&&(i&&(o+=i,i=null),o+=a)}}return c(o,n)}function c(e,t){switch("string"!=typeof e&&(e=String(e)),t){case"LowerCase":return e.toLowerCase();case"Allcaps":return e.toUpperCase();default:return e}}function u(e,t,r,n,o,i,a=!0){const s=t/o,l=r/i,c=Math.ceil(s/2),u=Math.ceil(l/2);for(let f=0;f<i;f++)for(let r=0;r<o;r++){const M=4*(r+(a?i-f-1:f)*o);let y=0,m=0,C=0,b=0,I=0,h=0,p=0;const d=(f+.5)*l;for(let n=Math.floor(f*l);n<(f+1)*l;n++){const o=Math.abs(d-(n+.5))/u,i=(r+.5)*s,a=o*o;for(let l=Math.floor(r*s);l<(r+1)*s;l++){let r=Math.abs(i-(l+.5))/c;const o=Math.sqrt(a+r*r);o>=-1&&o<=1&&(y=2*o*o*o-3*o*o+1,y>0&&(r=4*(l+n*t),p+=y*e[r+3],C+=y,e[r+3]<255&&(y=y*e[r+3]/250),b+=y*e[r],I+=y*e[r+1],h+=y*e[r+2],m+=y))}}n[M]=b/m,n[M+1]=I/m,n[M+2]=h/m,n[M+3]=p/C}}function f(e){return e?[e[0],e[1],e[2],e[3]/255]:[0,0,0,0]}function M(e){return e.data?.symbol??null}function y(e){return"CIMVectorMarker"===e.type||"CIMPictureMarker"===e.type||"CIMBarChartMarker"===e.type||"CIMCharacterMarker"===e.type||"CIMPieChartMarker"===e.type||"CIMStackedBarChartMarker"===e.type}function m(e){return"CIMGradientStroke"===e.type||"CIMPictureStroke"===e.type||"CIMSolidStroke"===e.type}function C(e){return null!=e&&("CIMGradientFill"===e.type||"CIMHatchFill"===e.type||"CIMPictureFill"===e.type||"CIMSolidFill"===e.type||"CIMWaterFill"===e.type)}function b(e){return null!=e&&("CIMMarkerPlacementAlongLineRandomSize"===e.type||"CIMMarkerPlacementAlongLineSameSize"===e.type||"CIMMarkerPlacementAlongLineVariableSize"===e.type||"CIMMarkerPlacementAtExtremities"===e.type||"CIMMarkerPlacementAtMeasuredUnits"===e.type||"CIMMarkerPlacementAtRatioPositions"===e.type||"CIMMarkerPlacementOnLine"===e.type||"CIMMarkerPlacementOnVertices"===e.type)}const I=(e,t=0)=>null==e||isNaN(e)?t:e,h=e=>e.tintColor?f(e.tintColor):[255,255,255,1],p=e=>{if(!e)return!1;for(const t of e)switch(t.type){case"CIMGeometricEffectBuffer":case"CIMGeometricEffectOffset":case"CIMGeometricEffectDonut":return!0}return!1};function d(){return import("../../geometry/geometryEngineJSON.js")}function k(e){if(!e)return"normal";switch(e.toLowerCase()){case"italic":return"italic";case"oblique":return"oblique";default:return"normal"}}function S(e){if(!e)return"normal";switch(e.toLowerCase()){case"bold":return"bold";case"bolder":return"bolder";case"lighter":return"lighter";default:return"normal"}}function g(e){let t="normal",r="normal";if(e){const n=e.toLowerCase();n.includes("italic")?t="italic":n.includes("oblique")&&(t="oblique"),n.includes("bold")?r="bold":n.includes("light")&&(r="lighter")}return{style:t,weight:r}}function P(e){return e.underline?"underline":e.strikethrough?"line-through":"none"}function w(e){if(!e)return null;switch(e.type){case"CIMPolygonSymbol":if(e.symbolLayers)for(const t of e.symbolLayers){const e=w(t);if(null!=e)return e}break;case"CIMTextSymbol":return w(e.symbol);case"CIMSolidFill":return e.color}return null}function L(e){if(e)switch(e.type){case"CIMPolygonSymbol":case"CIMLineSymbol":{const t=e.symbolLayers;if(t)for(const e of t){const t=L(e);if(null!=t)return t}break}case"CIMTextSymbol":return L(e.symbol);case"CIMSolidStroke":return e.color}}function T(e){if(e)switch(e.type){case"CIMPolygonSymbol":case"CIMLineSymbol":if(e.symbolLayers)for(const t of e.symbolLayers){const e=T(t);if(void 0!==e)return e}break;case"CIMTextSymbol":return T(e.symbol);case"CIMSolidStroke":case"CIMGradientStroke":case"CIMPictureStroke":return e.width}}function x(e){switch(e){case"Left":default:return"left";case"Right":return"right";case"Center":case"Justify":return"center"}}function A(e){switch(e){case"Top":default:return"top";case"Center":return"middle";case"Baseline":return"baseline";case"Bottom":return"bottom"}}function F(e){return(e?Object.keys(e):[]).map((t=>({name:t,alias:t,type:"string"==typeof e[t]?"esriFieldTypeString":"esriFieldTypeDouble"})))}const G=e=>e.includes("data:image/svg+xml");function N(e){if(!e)return null;switch(e.type){case"CIMPointSymbol":case"CIMTextSymbol":return"esriGeometryPoint";case"CIMLineSymbol":return"esriGeometryPolyline";case"CIMPolygonSymbol":return"esriGeometryPolygon";default:return null}}function V(e){return e?e.charAt(0).toLowerCase()+e.substring(1):e}function z(e,t,r,n,o,i){const{infos:a}=i;let s=1,l=0,c=0,u=0;for(const{offsetX:y,offsetY:m,rotation:C,size:b,frameHeight:I,rotateClockWise:h}of a){c=R(y,m,l,s,c),u=v(y,m,l,s,u),I&&(s*=b/I),l=H(C,h,l)}const f=R(n,o,l,s,c),M=v(n,o,l,s,u);return{size:e*s,rotation:H(t,r,l),offsetX:f,offsetY:M}}function O(e){if(null==e)return!1;if(Array.isArray(e))return e.every((e=>O(e)));switch(typeof e){case"string":return!!e;case"number":return!isNaN(e)}}function E(r,n){if("color"===n||"outlinecolor"===n||"backgroundcolor"===n||"borderLineColor"===n)return[...e[n]];const o=t[r];if(!o||"boolean"==typeof o[n])throw new Error(`InternalError: default value for type ${r}.`);return o[n]}function D(e){return e?.dashTemplate&&"string"==typeof e.dashTemplate&&(e.dashTemplate=e.dashTemplate.split(" ").map(Number)),e}function j(e){if(null==e)return"Normal";switch(e.type){case"CIMTextSymbol":return e.textCase??"Normal";case"CIMPointSymbol":case"CIMLineSymbol":case"CIMPolygonSymbol":{const t=e.symbolLayers;if(!t)return"Normal";for(const e of t)if("CIMVectorMarker"===e.type)return j(e)}break;case"CIMVectorMarker":{const t=e.markerGraphics;if(!t)return"Normal";for(const e of t)if(e.symbol)return j(e.symbol)}}return"Normal"}function q(e){if(e)switch(e.type){case"CIMTextSymbol":return e.height;case"CIMPointSymbol":{let r=0;if(e.symbolLayers)for(const n of e.symbolLayers)if(n)switch(n.type){case"CIMCharacterMarker":case"CIMPictureMarker":case"CIMVectorMarker":case"CIMObjectMarker3D":case"CIMglTFMarker3D":{const e=n.size??t.CIMVectorMarker.size;e>r&&(r=e);break}}return r}case"CIMLineSymbol":case"CIMPolygonSymbol":{let r=0;if(e.symbolLayers)for(const n of e.symbolLayers)if(n)switch(n.type){case"CIMSolidStroke":case"CIMPictureStroke":case"CIMGradientStroke":{const e=n.width;null!=e&&e>r&&(r=e);break}case"CIMCharacterMarker":case"CIMPictureMarker":case"CIMVectorMarker":case"CIMObjectMarker3D":case"CIMglTFMarker3D":if(n.markerPlacement&&b(n.markerPlacement)){const e=n.size??t.CIMVectorMarker.size;e>r&&(r=e)}break;case"CIMPictureFill":{const e=n.height;null!=e&&e>r&&(r=e)}}return r}}}function B(e,t){if(null!==t){const r=t.get(e);return r?r.name:e}return e}function v(e,t,r,n,o){const i=r*Math.PI/180;if(i){const r=Math.cos(i);return(Math.sin(i)*e+r*t)*n+o}return t*n+o}function R(e,t,r,n,o){const i=r*Math.PI/180;if(i){return(Math.cos(i)*e-Math.sin(i)*t)*n+o}return e*n+o}function H(e,t,r){return t?r-e:r+e}export{c as adjustTextCase,s as analyzeTextParts,z as applyParentTransform,l as assignTextValuesFromFeature,F as attributesToFields,o as colorToArray,n as evaluateValueOrFunction,P as fromCIMFontDecoration,g as fromCIMFontStyle,x as fromCIMHorizontalAlignment,A as fromCIMVerticalAlignment,E as getDefaultCIMValue,B as getFieldName,w as getFillColor,k as getFontStyle,S as getFontWeight,q as getSize,L as getStrokeColor,T as getStrokeWidth,j as getTextCasing,h as getTintColor,I as getValue,d as importGeometryEngine,C as isCIMFill,y as isCIMMarker,b as isCIMMarkerStrokePlacement,m as isCIMStroke,r as isFeatureValueFn,p as isGeometryEngineRequired,G as isSVGImage,O as isValidCIMValue,N as mapCIMSymbolToGeometryType,f as normalizeAlpha,D as normalizeDashTemplate,u as resampleHermite,M as toCIMSymbolJSON,V as uncapitalize};
5
+ import{defaultCIMColor as e,defaultCIMValues as t}from"./defaultCIMValues.js";function r(e){return"function"==typeof e}function n(e,t,n,o){return r(e)?e(t,n,o):e}function o(e){return[e.r,e.g,e.b,e.a]}const i=" /-,\n";function a(e){let t=e.length;for(;t--;)if(!i.includes(e.charAt(t)))return!1;return!0}function s(e,t){const r=[];let n=0,o=-1;do{if(o=e.indexOf("[",n),o>=n){if(o>n){const t=e.substr(n,o-n);r.push([t,null,a(t)])}if(n=o+1,o=e.indexOf("]",n),o>=n){if(o>n){const i=t[e.substr(n,o-n)];i&&r.push([null,i,!1])}n=o+1}}}while(-1!==o);if(n<e.length-1){const t=e.substr(n);r.push([t,null,a(t)])}return r}function l(e,t,r,n){let o="",i=null;for(const a of t){const[t,n,s]=a;if(t)s?i=t:(i&&(o+=i,i=null),o+=t);else{let t=n;null!=r&&(t=v(n,r));const a=e.attributes[t];a&&(i&&(o+=i,i=null),o+=a)}}return c(o,n)}function c(e,t){switch("string"!=typeof e&&(e=String(e)),t){case"LowerCase":return e.toLowerCase();case"Allcaps":return e.toUpperCase();default:return e}}function u(e,t,r,n,o,i,a=!0){const s=t/o,l=r/i,c=Math.ceil(s/2),u=Math.ceil(l/2);for(let f=0;f<i;f++)for(let r=0;r<o;r++){const M=4*(r+(a?i-f-1:f)*o);let y=0,m=0,C=0,b=0,I=0,h=0,p=0;const d=(f+.5)*l;for(let n=Math.floor(f*l);n<(f+1)*l;n++){const o=Math.abs(d-(n+.5))/u,i=(r+.5)*s,a=o*o;for(let l=Math.floor(r*s);l<(r+1)*s;l++){let r=Math.abs(i-(l+.5))/c;const o=Math.sqrt(a+r*r);o>=-1&&o<=1&&(y=2*o*o*o-3*o*o+1,y>0&&(r=4*(l+n*t),p+=y*e[r+3],C+=y,e[r+3]<255&&(y=y*e[r+3]/250),b+=y*e[r],I+=y*e[r+1],h+=y*e[r+2],m+=y))}}n[M]=b/m,n[M+1]=I/m,n[M+2]=h/m,n[M+3]=p/C}}function f(e){return e?[e[0],e[1],e[2],e[3]/255]:[0,0,0,0]}function M(e){return e.data?.symbol??null}function y(e){return"CIMVectorMarker"===e.type||"CIMPictureMarker"===e.type||"CIMBarChartMarker"===e.type||"CIMCharacterMarker"===e.type||"CIMPieChartMarker"===e.type||"CIMStackedBarChartMarker"===e.type}function m(e){return"CIMGradientStroke"===e.type||"CIMPictureStroke"===e.type||"CIMSolidStroke"===e.type}function C(e){return null!=e&&("CIMGradientFill"===e.type||"CIMHatchFill"===e.type||"CIMPictureFill"===e.type||"CIMSolidFill"===e.type||"CIMWaterFill"===e.type)}function b(e){return null!=e&&("CIMMarkerPlacementAlongLineRandomSize"===e.type||"CIMMarkerPlacementAlongLineSameSize"===e.type||"CIMMarkerPlacementAlongLineVariableSize"===e.type||"CIMMarkerPlacementAtExtremities"===e.type||"CIMMarkerPlacementAtMeasuredUnits"===e.type||"CIMMarkerPlacementAtRatioPositions"===e.type||"CIMMarkerPlacementOnLine"===e.type||"CIMMarkerPlacementOnVertices"===e.type)}const I=(e,t=0)=>null==e||isNaN(e)?t:e,h=(e,t)=>e??t,p=e=>e.tintColor?f(e.tintColor):[255,255,255,1],d=e=>{if(!e)return!1;for(const t of e)switch(t.type){case"CIMGeometricEffectBuffer":case"CIMGeometricEffectOffset":case"CIMGeometricEffectDonut":return!0}return!1};function k(){return import("../../geometry/geometryEngineJSON.js")}function S(e){if(!e)return"normal";switch(e.toLowerCase()){case"italic":return"italic";case"oblique":return"oblique";default:return"normal"}}function g(e){if(!e)return"normal";switch(e.toLowerCase()){case"bold":return"bold";case"bolder":return"bolder";case"lighter":return"lighter";default:return"normal"}}function P(e){let t="normal",r="normal";if(e){const n=e.toLowerCase();n.includes("italic")?t="italic":n.includes("oblique")&&(t="oblique"),n.includes("bold")?r="bold":n.includes("light")&&(r="lighter")}return{style:t,weight:r}}function w(e){return e.underline?"underline":e.strikethrough?"line-through":"none"}function L(e){if(!e)return null;switch(e.type){case"CIMPolygonSymbol":if(e.symbolLayers)for(const t of e.symbolLayers){const e=L(t);if(null!=e)return e}break;case"CIMTextSymbol":return L(e.symbol);case"CIMSolidFill":return e.color}return null}function T(e){if(e)switch(e.type){case"CIMPolygonSymbol":case"CIMLineSymbol":{const t=e.symbolLayers;if(t)for(const e of t){const t=T(e);if(null!=t)return t}break}case"CIMTextSymbol":return T(e.symbol);case"CIMSolidStroke":return e.color}}function x(e){if(e)switch(e.type){case"CIMPolygonSymbol":case"CIMLineSymbol":if(e.symbolLayers)for(const t of e.symbolLayers){const e=x(t);if(void 0!==e)return e}break;case"CIMTextSymbol":return x(e.symbol);case"CIMSolidStroke":case"CIMGradientStroke":case"CIMPictureStroke":return e.width}}function A(e){switch(e){case"Left":default:return"left";case"Right":return"right";case"Center":case"Justify":return"center"}}function F(e){switch(e){case"Top":default:return"top";case"Center":return"middle";case"Baseline":return"baseline";case"Bottom":return"bottom"}}function G(e){return(e?Object.keys(e):[]).map((t=>({name:t,alias:t,type:"string"==typeof e[t]?"esriFieldTypeString":"esriFieldTypeDouble"})))}const N=e=>e.includes("data:image/svg+xml");function V(e){if(!e)return null;switch(e.type){case"CIMPointSymbol":case"CIMTextSymbol":return"esriGeometryPoint";case"CIMLineSymbol":return"esriGeometryPolyline";case"CIMPolygonSymbol":return"esriGeometryPolygon";default:return null}}function z(e){return e?e.charAt(0).toLowerCase()+e.substring(1):e}function O(e,t,r,n,o,i){const{infos:a}=i;let s=1,l=0,c=0,u=0;for(const{offsetX:y,offsetY:m,rotation:C,size:b,frameHeight:I,rotateClockWise:h}of a){c=H(y,m,l,s,c),u=R(y,m,l,s,u),I&&(s*=b/I),l=J(C,h,l)}const f=H(n,o,l,s,c),M=R(n,o,l,s,u);return{size:e*s,rotation:J(t,r,l),offsetX:f,offsetY:M}}function E(e){if(null==e)return!1;if(Array.isArray(e))return e.every((e=>E(e)));switch(typeof e){case"string":return!!e;case"number":return!isNaN(e)}}function D(r,n){if("color"===n||"outlinecolor"===n||"backgroundcolor"===n||"borderLineColor"===n)return[...e[n]];const o=t[r];if(!o||"boolean"==typeof o[n])throw new Error(`InternalError: default value for type ${r}.`);return o[n]}function j(e){return e?.dashTemplate&&"string"==typeof e.dashTemplate&&(e.dashTemplate=e.dashTemplate.split(" ").map(Number)),e}function q(e){if(null==e)return"Normal";switch(e.type){case"CIMTextSymbol":return e.textCase??"Normal";case"CIMPointSymbol":case"CIMLineSymbol":case"CIMPolygonSymbol":{const t=e.symbolLayers;if(!t)return"Normal";for(const e of t)if("CIMVectorMarker"===e.type)return q(e)}break;case"CIMVectorMarker":{const t=e.markerGraphics;if(!t)return"Normal";for(const e of t)if(e.symbol)return q(e.symbol)}}return"Normal"}function B(e){if(e)switch(e.type){case"CIMTextSymbol":return e.height;case"CIMPointSymbol":{let r=0;if(e.symbolLayers)for(const n of e.symbolLayers)if(n)switch(n.type){case"CIMCharacterMarker":case"CIMPictureMarker":case"CIMVectorMarker":case"CIMObjectMarker3D":case"CIMglTFMarker3D":{const e=n.size??t.CIMVectorMarker.size;e>r&&(r=e);break}}return r}case"CIMLineSymbol":case"CIMPolygonSymbol":{let r=0;if(e.symbolLayers)for(const n of e.symbolLayers)if(n)switch(n.type){case"CIMSolidStroke":case"CIMPictureStroke":case"CIMGradientStroke":{const e=n.width;null!=e&&e>r&&(r=e);break}case"CIMCharacterMarker":case"CIMPictureMarker":case"CIMVectorMarker":case"CIMObjectMarker3D":case"CIMglTFMarker3D":if(n.markerPlacement&&b(n.markerPlacement)){const e=n.size??t.CIMVectorMarker.size;e>r&&(r=e)}break;case"CIMPictureFill":{const e=n.height;null!=e&&e>r&&(r=e)}}return r}}}function v(e,t){if(null!==t){const r=t.get(e);return r?r.name:e}return e}function R(e,t,r,n,o){const i=r*Math.PI/180;if(i){const r=Math.cos(i);return(Math.sin(i)*e+r*t)*n+o}return t*n+o}function H(e,t,r,n,o){const i=r*Math.PI/180;if(i){return(Math.cos(i)*e-Math.sin(i)*t)*n+o}return e*n+o}function J(e,t,r){return t?r-e:r+e}export{c as adjustTextCase,s as analyzeTextParts,O as applyParentTransform,l as assignTextValuesFromFeature,G as attributesToFields,o as colorToArray,n as evaluateValueOrFunction,w as fromCIMFontDecoration,P as fromCIMFontStyle,A as fromCIMHorizontalAlignment,F as fromCIMVerticalAlignment,D as getDefaultCIMValue,h as getEnum,v as getFieldName,L as getFillColor,S as getFontStyle,g as getFontWeight,B as getSize,T as getStrokeColor,x as getStrokeWidth,q as getTextCasing,p as getTintColor,I as getValue,k as importGeometryEngine,C as isCIMFill,y as isCIMMarker,b as isCIMMarkerStrokePlacement,m as isCIMStroke,r as isFeatureValueFn,d as isGeometryEngineRequired,N as isSVGImage,E as isValidCIMValue,V as mapCIMSymbolToGeometryType,f as normalizeAlpha,j as normalizeDashTemplate,u as resampleHermite,M as toCIMSymbolJSON,z as uncapitalize};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.30/esri/copyright.txt for details.
4
4
  */
5
- import{memoize as e}from"../../../../../../../core/MapUtils.js";import{fromRotation as t}from"../../../../../../../core/libs/gl-matrix-2/math/mat2d.js";import{create as i}from"../../../../../../../core/libs/gl-matrix-2/factories/mat2df32.js";import{getXAnchorDirection as s,getYAnchorDirection as a}from"../../../alignmentUtils.js";import{getDisplayIdTexel as n}from"../../../DisplayId.js";import{LabelMetric as r}from"../../../collisions/LabelMetric.js";import{smoothPaths as o,pathDivide as h}from"../../../mesh/templates/segmentUtils.js";import{getMinMaxZoom as l,processColorInput as c}from"../fill/meshWriterUtils.js";import{TextMeshWriter as m}from"../text/TextMeshWriter.js";const d=1,u=0,g=25,p=128,f=e((e=>{let t=0;if(0===e)return 1/0;for(;!(e%2);)t++,e/=2;return t}));class x extends m{constructor(){super(...arguments),this._zoomLevel=0}_write(e,t,i,s){if(this._zoomLevel=s||0,null!=i)throw new Error("InternalError: EffectGeometry not support for LabelMeshWriter");switch(t.geometryType){case"esriGeometryPoint":{const i=t.readXForDisplay(),s=t.readYForDisplay();return this._writePoint(e,i,s,t)}case"esriGeometryEnvelope":case"esriGeometryPolygon":case"esriGeometryMultipoint":{const i=t.readCentroidForDisplay();if(!i)return;const[s,a]=i.coords;return this._writePoint(e,s,a,t)}case"esriGeometryPolyline":{const i=t.readLegacyGeometryForDisplay();this._writeLines(e,t,i)}}}_writePoint(e,t,i,o){const h=this._getShaping();if(!h)return;let l=this._getPointReferenceBounds();l||(l={offsetX:0,offsetY:0,size:0});const c=h.boundsT,m=s(this.evaluatedMeshParams.horizontalAlignment),d=a(this.evaluatedMeshParams.verticalAlignment),u=this.evaluatedMeshParams.scaleInfo?.maxScale??0,g=this.evaluatedMeshParams.scaleInfo?.minScale??0,p=n(o.getDisplayId());e.metricStart(new r(p,t,i,m,d,u,g,l)),e.metricBoxWrite(c),this._writeGlyphs(e,o.getDisplayId(),t,i,h,0,l),e.metricEnd()}_getPointReferenceBounds(){if(!this._references)return null;for(const e of this._references){const t=e.getBoundsInfo();if(t)return t}return null}_writeLines(e,t,i){const{repeatLabel:s,scaleInfo:a}=this.evaluatedMeshParams,n=this.evaluatedMeshParams.repeatLabelDistance||128,r=this._getShaping();if(!r)return;this._current={out:e,id:t.getDisplayId(),shaping:r,zoomRange:l(a,this.getTileInfo()),referenceBounds:this._getPointReferenceBounds()||{offsetX:0,offsetY:0,size:0}};const c=o(i.paths,r.bounds.width),m=this._placeSubdivGlyphs.bind(this),u=(r.bounds.width+n)/(1<<d);for(const o of c)h(o,u,m,!!s)}_placeSubdivGlyphs(e,t,i,s){const{allowOverrun:a,labelPosition:n,repeatLabelDistance:r}=this.evaluatedMeshParams,o=this._current.zoomRange[0],h=f(t),l=this._current.shaping.bounds.width/(1<<d),c=Math.sqrt(r||p)/(1<<d),m=Math.min(i,s-i),u=this._current.shaping.isMultiline?g:Math.log2(m/(c+l/2)),x=0===t?u:Math.min(h,u),_=Math.max(o,this._zoomLevel+d-x),M=this._zoomLevel-_,y=this._current.shaping.bounds.width/2*2**M;this._current.shaping.isMultiline?0===t&&this._placeStraight(e,_):a&&M<0?this._placeStraightAlong(e,o):"parallel"===n?this._placeStraightAlong(e,_):"curved"===n&&this._placeCurved(e,_,y)}_placeStraight(e,s){const{out:a,id:n,shaping:r,zoomRange:o,referenceBounds:h}=this._current,{x:l,y:c}=e,m=e.angle*(180/Math.PI)%360,d=(e.angle*(180/Math.PI)+180)%360;if(r.textBox){const l=Math.max(s,o[0],0),c=Math.min(g,o[1]),u=t(i(),-e.angle),[p,f]=r.shapeBackground(u),x={minZoom:l,maxZoom:c,clipAngle:m,mapAligned:!0,isLineLabel:!0};a.recordStart(this.instanceId,this.attributeLayout,r.glyphs[0].textureBinding),this._writeTextBox(a,n,e.x,e.y,f,h,x),a.recordEnd(),x.clipAngle=d,a.recordStart(this.instanceId,this.attributeLayout,r.glyphs[0].textureBinding),this._writeTextBox(a,n,e.x,e.y,f,h,x),a.recordEnd()}for(const t of r.glyphs)t.minZoom=s,t.maxZoom=o[1],t.angle=e.angle,this._writeLineGlyph(a,n,l,c,r.bounds,t,m,h,!0),t.angle=e.angle+Math.PI,this._writeLineGlyph(a,n,l,c,r.bounds,t,d,h,!0)}_placeCurved(e,t,i){const{out:s,id:a}=this._current,o=e.clone(),h=e.angle*(180/Math.PI)%360,l=(e.angle*(180/Math.PI)+180)%360,c=n(a),m=this.evaluatedMeshParams.scaleInfo?.maxScale??0,d=this.evaluatedMeshParams.scaleInfo?.minScale??0;s.metricStart(new r(c,e.x,e.y,0,0,m,d,null)),this._placeFirst(o,t,1,h),this._placeBack(e,o,t,i,1,h),this._placeForward(e,o,t,i,1,h),this._placeFirst(o,t,0,l),this._placeBack(e,o,t,i,0,l),this._placeForward(e,o,t,i,0,l),s.metricEnd()}_placeStraightAlong(e,s){const{out:a,id:o,shaping:h,zoomRange:l,referenceBounds:c}=this._current,{boxBorderLineColor:m,boxBackgroundColor:d}=this.evaluatedMeshParams,u=e.clone(),p=e.angle*(180/Math.PI)%360,f=(e.angle*(180/Math.PI)+180)%360;if(h.glyphs.length>0&&(m||d)){const n=Math.max(s,l[0],0),r=Math.min(g,l[1]),m=t(i(),-e.angle),[d,u]=h.shapeBackground(m),x={minZoom:n,maxZoom:r,clipAngle:p,mapAligned:!0,isLineLabel:!0};a.recordStart(this.instanceId,this.attributeLayout,h.glyphs[0].textureBinding),this._writeTextBox(a,o,e.x,e.y,u,c,x),a.recordEnd(),x.clipAngle=f,a.recordStart(this.instanceId,this.attributeLayout,h.glyphs[0].textureBinding),this._writeTextBox(a,o,e.x,e.y,u,c,x),a.recordEnd()}const x=n(o),_=this.evaluatedMeshParams.scaleInfo?.maxScale??0,M=this.evaluatedMeshParams.scaleInfo?.minScale??0;a.metricStart(new r(x,e.x,e.y,0,0,_,M,null)),this._placeFirst(u,s,1,p,!0),this._placeFirst(u,s,0,f,!0),a.metricEnd()}_placeBack(e,t,i,s,a,n){const r=e.clone();let o=e.backwardLength+u;for(;r.prev()&&!(o>=s);)this._placeOnSegment(r,t,o,i,-1,a,n),o+=r.length+u}_placeForward(e,t,i,s,a,n){const r=e.clone();let o=e.remainingLength+u;for(;r.next()&&!(o>=s);)this._placeOnSegment(r,t,o,i,1,a,n),o+=r.length+u}_placeFirst(e,t,i,s,a=!1){const n=e,{out:r,id:o,shaping:h,zoomRange:l,referenceBounds:c}=this._current,m=h.glyphs;for(const d of m){const m=d.x>h.bounds.x?i:1-i,p=m*e.remainingLength+(1-m)*e.backwardLength,f=Math.abs(d.x+d.width/2-h.bounds.x),x=Math.max(0,this._zoomLevel+Math.log2(f/(p+u))),_=Math.max(t,a?0:x);d.maxZoom=Math.min(l[1],g),d.angle=e.angle+(1-i)*Math.PI,d.minZoom=Math.max(l[0],_),r.metricBoxWrite(d.bounds),this._writeLineGlyph(r,o,n.x,n.y,h.bounds,d,s,c,!0)}}_placeOnSegment(e,t,i,s,a,n,r){const{out:o,id:h,shaping:l,referenceBounds:c}=this._current,m=l.glyphs,d=e.dx/e.length,g=e.dy/e.length,p={x:e.x+i*-a*d,y:e.y+i*-a*g};for(const f of m){const t=f.x>l.bounds.x?n:1-n;if(!(t&&1===a||!t&&-1===a))continue;const m=Math.abs(f.x+f.width/2-l.bounds.x),d=Math.max(0,this._zoomLevel+Math.log2(m/i)-.1),g=Math.max(s,this._zoomLevel+Math.log2(m/(i+e.length+u)));0!==d&&(f.angle=e.angle+(1-n)*Math.PI,f.minZoom=g,f.maxZoom=d,this._writeLineGlyph(o,h,p.x,p.y,l.bounds,f,r,c,!0))}}_writeLineGlyph(e,t,i,s,a,n,r,o,h){const l=i+a.x,m=s+a.y,d=2*(this.evaluatedMeshParams.minPixelBuffer?this.evaluatedMeshParams.minPixelBuffer/this._textMeshTransformProps.fontSize:1),u=Math.max(a.width,a.height)*d;e.recordStart(this.instanceId,this.attributeLayout,n.textureBinding),e.recordBounds(l,m,u,u);const{texcoords:g,offsets:p}=n,f=this._textMeshTransformProps.fontSize;this._writeQuad(e,t,i,s,{texcoords:g,offsets:p,fontSize:f,color:c(this.evaluatedMeshParams.color),isBackground:!1,referenceBounds:o,minZoom:Math.max(this._current.zoomRange[0],n.minZoom),maxZoom:Math.min(this._current.zoomRange[1],n.maxZoom),clipAngle:r,mapAligned:h,isLineLabel:!0}),e.recordEnd()}}export{x as LabelMeshWriter};
5
+ import{memoize as e}from"../../../../../../../core/MapUtils.js";import{fromRotation as t}from"../../../../../../../core/libs/gl-matrix-2/math/mat2d.js";import{create as i}from"../../../../../../../core/libs/gl-matrix-2/factories/mat2df32.js";import{getXAnchorDirection as s,getYAnchorDirection as a}from"../../../alignmentUtils.js";import{getDisplayIdTexel as n}from"../../../DisplayId.js";import{LabelMetric as r}from"../../../collisions/LabelMetric.js";import{smoothPaths as o,pathDivide as h}from"../../../mesh/templates/segmentUtils.js";import{getMinMaxZoom as l,processColorInput as c}from"../fill/meshWriterUtils.js";import{TextMeshWriter as m,maxLabelZoom as d}from"../text/TextMeshWriter.js";const u=1,g=0,p=128,f=e((e=>{let t=0;if(0===e)return 1/0;for(;!(e%2);)t++,e/=2;return t}));class x extends m{constructor(){super(...arguments),this._zoomLevel=0}_write(e,t,i,s){if(this._zoomLevel=s||0,null!=i)throw new Error("InternalError: EffectGeometry not support for LabelMeshWriter");switch(t.geometryType){case"esriGeometryPoint":{const i=t.readXForDisplay(),s=t.readYForDisplay();return this._writePoint(e,i,s,t)}case"esriGeometryEnvelope":case"esriGeometryPolygon":case"esriGeometryMultipoint":{const i=t.readCentroidForDisplay();if(!i)return;const[s,a]=i.coords;return this._writePoint(e,s,a,t)}case"esriGeometryPolyline":{const i=t.readLegacyGeometryForDisplay();this._writeLines(e,t,i)}}}_writePoint(e,t,i,o){const h=this._getShaping();if(!h)return;let l=this._getPointReferenceBounds();l||(l={offsetX:0,offsetY:0,size:0});const c=h.boundsT,m=s(this.evaluatedMeshParams.horizontalAlignment),d=a(this.evaluatedMeshParams.verticalAlignment),u=this.evaluatedMeshParams.scaleInfo?.maxScale??0,g=this.evaluatedMeshParams.scaleInfo?.minScale??0,p=n(o.getDisplayId());e.metricStart(new r(p,t,i,m,d,u,g,l)),e.metricBoxWrite(c),this._writeGlyphs(e,o.getDisplayId(),t,i,h,0,l),e.metricEnd()}_getPointReferenceBounds(){if(!this._references)return null;for(const e of this._references){const t=e.getBoundsInfo();if(t)return t}return null}_writeLines(e,t,i){const{repeatLabel:s,scaleInfo:a}=this.evaluatedMeshParams,n=this.evaluatedMeshParams.repeatLabelDistance||128,r=this._getShaping();if(!r)return;this._current={out:e,id:t.getDisplayId(),shaping:r,zoomRange:l(a,this.getTileInfo()),referenceBounds:this._getPointReferenceBounds()||{offsetX:0,offsetY:0,size:0}};const c=o(i.paths,r.bounds.width),m=this._placeSubdivGlyphs.bind(this),d=(r.bounds.width+n)/(1<<u);for(const o of c)h(o,d,m,!!s)}_placeSubdivGlyphs(e,t,i,s){const{allowOverrun:a,labelPosition:n,repeatLabelDistance:r}=this.evaluatedMeshParams,o=this._current.zoomRange[0],h=f(t),l=this._current.shaping.bounds.width/(1<<u),c=Math.sqrt(r||p)/(1<<u),m=Math.min(i,s-i),g=this._current.shaping.isMultiline?d:Math.log2(m/(c+l/2)),x=0===t?g:Math.min(h,g),_=Math.max(o,this._zoomLevel+u-x),M=this._zoomLevel-_,y=this._current.shaping.bounds.width/2*2**M;this._current.shaping.isMultiline?0===t&&this._placeStraight(e,_):a&&M<0?this._placeStraightAlong(e,o):"parallel"===n?this._placeStraightAlong(e,_):"curved"===n&&this._placeCurved(e,_,y)}_placeStraight(e,s){const{out:a,id:n,shaping:r,zoomRange:o,referenceBounds:h}=this._current,{x:l,y:c}=e,m=e.angle*(180/Math.PI)%360,u=(e.angle*(180/Math.PI)+180)%360;if(r.textBox){const l=Math.max(s,o[0],0),c=Math.min(d,o[1]),g=t(i(),-e.angle),[p,f]=r.shapeBackground(g),x={minZoom:l,maxZoom:c,clipAngle:m,mapAligned:!0,isLineLabel:!0};a.recordStart(this.instanceId,this.attributeLayout,r.glyphs[0].textureBinding),this._writeTextBox(a,n,e.x,e.y,f,h,x),a.recordEnd(),x.clipAngle=u,a.recordStart(this.instanceId,this.attributeLayout,r.glyphs[0].textureBinding),this._writeTextBox(a,n,e.x,e.y,f,h,x),a.recordEnd()}for(const t of r.glyphs)t.minZoom=s,t.maxZoom=o[1],t.angle=e.angle,this._writeLineGlyph(a,n,l,c,r.bounds,t,m,h,!0),t.angle=e.angle+Math.PI,this._writeLineGlyph(a,n,l,c,r.bounds,t,u,h,!0)}_placeCurved(e,t,i){const{out:s,id:a}=this._current,o=e.clone(),h=e.angle*(180/Math.PI)%360,l=(e.angle*(180/Math.PI)+180)%360,c=n(a),m=this.evaluatedMeshParams.scaleInfo?.maxScale??0,d=this.evaluatedMeshParams.scaleInfo?.minScale??0;s.metricStart(new r(c,e.x,e.y,0,0,m,d,null)),this._placeFirst(o,t,1,h),this._placeBack(e,o,t,i,1,h),this._placeForward(e,o,t,i,1,h),this._placeFirst(o,t,0,l),this._placeBack(e,o,t,i,0,l),this._placeForward(e,o,t,i,0,l),s.metricEnd()}_placeStraightAlong(e,s){const{out:a,id:o,shaping:h,zoomRange:l,referenceBounds:c}=this._current,{boxBorderLineColor:m,boxBackgroundColor:u}=this.evaluatedMeshParams,g=e.clone(),p=e.angle*(180/Math.PI)%360,f=(e.angle*(180/Math.PI)+180)%360;if(h.glyphs.length>0&&(m||u)){const n=Math.max(s,l[0],0),r=Math.min(d,l[1]),m=t(i(),-e.angle),[u,g]=h.shapeBackground(m),x={minZoom:n,maxZoom:r,clipAngle:p,mapAligned:!0,isLineLabel:!0};a.recordStart(this.instanceId,this.attributeLayout,h.glyphs[0].textureBinding),this._writeTextBox(a,o,e.x,e.y,g,c,x),a.recordEnd(),x.clipAngle=f,a.recordStart(this.instanceId,this.attributeLayout,h.glyphs[0].textureBinding),this._writeTextBox(a,o,e.x,e.y,g,c,x),a.recordEnd()}const x=n(o),_=this.evaluatedMeshParams.scaleInfo?.maxScale??0,M=this.evaluatedMeshParams.scaleInfo?.minScale??0;a.metricStart(new r(x,e.x,e.y,0,0,_,M,null)),this._placeFirst(g,s,1,p,!0),this._placeFirst(g,s,0,f,!0),a.metricEnd()}_placeBack(e,t,i,s,a,n){const r=e.clone();let o=e.backwardLength+g;for(;r.prev()&&!(o>=s);)this._placeOnSegment(r,t,o,i,-1,a,n),o+=r.length+g}_placeForward(e,t,i,s,a,n){const r=e.clone();let o=e.remainingLength+g;for(;r.next()&&!(o>=s);)this._placeOnSegment(r,t,o,i,1,a,n),o+=r.length+g}_placeFirst(e,t,i,s,a=!1){const n=e,{out:r,id:o,shaping:h,zoomRange:l,referenceBounds:c}=this._current,m=h.glyphs;for(const u of m){const m=u.x>h.bounds.x?i:1-i,p=m*e.remainingLength+(1-m)*e.backwardLength,f=Math.abs(u.x+u.width/2-h.bounds.x),x=Math.max(0,this._zoomLevel+Math.log2(f/(p+g))),_=Math.max(t,a?0:x);u.maxZoom=Math.min(l[1],d),u.angle=e.angle+(1-i)*Math.PI,u.minZoom=Math.max(l[0],_),r.metricBoxWrite(u.bounds),this._writeLineGlyph(r,o,n.x,n.y,h.bounds,u,s,c,!0)}}_placeOnSegment(e,t,i,s,a,n,r){const{out:o,id:h,shaping:l,referenceBounds:c}=this._current,m=l.glyphs,d=e.dx/e.length,u=e.dy/e.length,p={x:e.x+i*-a*d,y:e.y+i*-a*u};for(const f of m){const t=f.x>l.bounds.x?n:1-n;if(!(t&&1===a||!t&&-1===a))continue;const m=Math.abs(f.x+f.width/2-l.bounds.x),d=Math.max(0,this._zoomLevel+Math.log2(m/i)-.1),u=Math.max(s,this._zoomLevel+Math.log2(m/(i+e.length+g)));0!==d&&(f.angle=e.angle+(1-n)*Math.PI,f.minZoom=u,f.maxZoom=d,this._writeLineGlyph(o,h,p.x,p.y,l.bounds,f,r,c,!0))}}_writeLineGlyph(e,t,i,s,a,n,r,o,h){const l=i+a.x,m=s+a.y,d=2*(this.evaluatedMeshParams.minPixelBuffer?this.evaluatedMeshParams.minPixelBuffer/this._textMeshTransformProps.fontSize:1),u=Math.max(a.width,a.height)*d;e.recordStart(this.instanceId,this.attributeLayout,n.textureBinding),e.recordBounds(l,m,u,u);const{texcoords:g,offsets:p}=n,f=this._textMeshTransformProps.fontSize;this._writeQuad(e,t,i,s,{texcoords:g,offsets:p,fontSize:f,color:c(this.evaluatedMeshParams.color),isBackground:!1,referenceBounds:o,minZoom:Math.max(this._current.zoomRange[0],n.minZoom),maxZoom:Math.min(this._current.zoomRange[1],n.maxZoom),clipAngle:r,mapAligned:h,isLineLabel:!0}),e.recordEnd()}}export{x as LabelMeshWriter};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.30/esri/copyright.txt for details.
4
4
  */
5
- import{clamp as t}from"../../../../../../../core/mathUtils.js";import{pt2px as e}from"../../../../../../../core/screenUtils.js";import{GeometryCursor as o}from"../../../../../../../geometry/GeometryCursor.js";import{CIMMarkerPlacementHelper as r}from"../../../../../../../symbols/cim/placements/CIMMarkerPlacementHelper.js";import{getXDirection as i,getYDirection as s}from"../../../alignmentUtils.js";import{minMaxZoomPrecisionFactor as n,magicLabelLineHeight as a,glyphSize as c}from"../../../definitions.js";import{shapeGlyphs as l}from"../../../mesh/templates/shapingUtils.js";import{packBitset as h,processColorInput as p}from"../fill/meshWriterUtils.js";import{getGeometryEngine as f}from"../mesh/loadGeometryEngine.js";import{MeshWriter as m}from"../mesh/MeshWriter.js";import{bitsetTextIsBackground as d,bitsetTextIsMapAligned as u}from"../shaders/constants.js";import{TextMeshTransformProps as g}from"./TextParams.js";import{DataType as x}from"../../../../../../webgl/enums.js";const y=[4,4],_=[16,4],P={topLeft:_,topRight:_,bottomLeft:_,bottomRight:_},S=[4,2],k=[4,6],b={topLeft:S,topRight:S,bottomLeft:k,bottomRight:k},T={topLeft:S,topRight:k,bottomLeft:S,bottomRight:k},B={topLeft:k,topRight:k,bottomLeft:y,bottomRight:y},R={topLeft:y,topRight:y,bottomLeft:k,bottomRight:k},w={topLeft:k,topRight:y,bottomLeft:k,bottomRight:y},M={topLeft:y,topRight:k,bottomLeft:y,bottomRight:k},z={createComputedParams:t=>t,attributes:{pos:{type:x.SHORT,count:2,pack:"position",packPrecisionFactor:10},id:{type:x.UNSIGNED_BYTE,count:3,pack:"id"},bitset:{type:x.UNSIGNED_BYTE,count:1,packTessellation:({isBackground:t,mapAligned:e})=>h([[d,t],[u,!!e]])},zoomRange:{type:x.UNSIGNED_SHORT,count:2,packPrecisionFactor:n,packTessellation:({minZoom:t,maxZoom:e})=>[t||0,e||100]},offset:{type:x.SHORT,count:2,packPrecisionFactor:8,packAlternating:{count:4,packTessellation:({offsets:t})=>{const{bottomLeft:e,bottomRight:o,topLeft:r,topRight:i}=t;return[r,i,e,o]}}},textureUV:{type:x.SHORT,count:2,packPrecisionFactor:4,packAlternating:{count:4,packTessellation:({texcoords:t})=>{const{bottomLeft:e,bottomRight:o,topLeft:r,topRight:i}=t;return[r,i,e,o]}}},color:{type:x.UNSIGNED_BYTE,count:4,normalized:!0,packTessellation:({color:t})=>t},fontSize:{type:x.UNSIGNED_SHORT,count:1,packPrecisionFactor:4,packTessellation:({fontSize:t})=>e(t)},referenceSize:{type:x.UNSIGNED_BYTE,count:1,packPrecisionFactor:4,packTessellation:({fontSize:t},{referenceSize:o})=>e(o??t)},haloColor:{type:x.UNSIGNED_BYTE,count:4,normalized:!0,pack:({haloColor:t})=>p(t)},haloFontSize:{type:x.UNSIGNED_SHORT,count:1,packPrecisionFactor:4,pack:({haloFontSize:t})=>e(t)},clipAngle:{type:x.UNSIGNED_BYTE,count:1,packTessellation:({clipAngle:t})=>E(t||0)},referenceSymbol:{type:x.BYTE,count:4,packPrecisionFactor:1,packTessellation:(t,o)=>{if(!t.referenceBounds)return[0,0,0,0];const r=i(o.horizontalAlignment),n=s(o.verticalAlignment),{offsetX:a,offsetY:c,size:l}=t.referenceBounds;return[e(a),-e(c),e(l),r+1<<2|n+1]}}}};class L extends m{constructor(){super(...arguments),this.vertexSpec=z,this._textMeshParamsPropsInitialized=!1}ensurePacked(t,e,o){super.ensurePacked(t,e,o),this._textMeshParamsPropsInitialized&&!this._evaluator.hasDynamicProperties||(this._textMeshTransformProps=new g(this.evaluatedMeshParams),this._textMeshParamsPropsInitialized=!0)}_write(t,e,o){const r=this._getShaping();if(!r)return;const i=e.getDisplayId();if(null!=this.evaluatedMeshParams.placement)return this._writePlacedTextMarkers(t,e,r,o);if(o&&o.nextPath())return o.nextPoint(),this._writeGlyphs(t,i,o.x,o.y,r,0);if("esriGeometryPolygon"===e.geometryType){const o=e.readCentroidForDisplay();if(!o)return;const[s,n]=o.coords;return this._writeGlyphs(t,i,s,n,r,0)}if("esriGeometryMultipoint"===e.geometryType){const o=e.readGeometryForDisplay();return void o?.forEachVertex(((e,o)=>this._writeGlyphs(t,i,e,o,r,0)))}const s=e.readXForDisplay(),n=e.readYForDisplay();return this._writeGlyphs(t,i,s,n,r,0)}_writePlacedTextMarkers(t,i,s,n){const a=n??o.fromFeatureSetReaderCIM(i);if(!a)return;const c=-1,l=r.getPlacement(a,c,this.evaluatedMeshParams.placement,e(1),t.id,f());if(!l)return;const h=i.getDisplayId();let p=l.next();for(;null!=p;){const e=p.tx,o=-p.ty,r=-p.getAngle();this._writeGlyphs(t,h,e,o,s,r),p=l.next()}}_getShaping(){const o=this._textMeshTransformProps,r=this.evaluatedMeshParams;if(!r.glyphs?.glyphs.length)return null;const i=Math.round(e(o.fontSize)),s=e(o.offsetX),n=e(o.offsetY),h=t(e(r.lineWidth),32,512),p=a*t(r.lineHeightRatio,.25,4);return l(r.glyphs,{scale:i/c,angle:o.postAngle,xOffset:s,yOffset:n,horizontalAlignment:r.horizontalAlignment,verticalAlignment:r.verticalAlignment,maxLineWidth:h,lineHeight:p,decoration:r.decoration,borderLineSizePx:e(r.boxBorderLineSize),hasBackground:!!r.boxBackgroundColor,useCIMAngleBehavior:r.useCIMAngleBehavior})}_writeGlyphs(t,o,r,i,s,n,a){const c=this.evaluatedMeshParams,l=this._textMeshTransformProps,h=l.fontSize,f=e(l.offsetX),m=e(l.offsetY);0!==n&&s.setRotation(n);const d=s.bounds,u=r+d.x+f,g=i+d.y-m,x=2*(c.minPixelBuffer?c.minPixelBuffer/h:1),y=Math.max(d.width,d.height)*x;s.textBox&&(t.recordStart(this.instanceId,this.attributeLayout,s.glyphs[0].textureBinding),t.recordBounds(u,g,y,y),this._writeTextBox(t,o,r,i,s.textBox,a),t.recordEnd());for(const e of s.glyphs){t.recordStart(this.instanceId,this.attributeLayout,e.textureBinding),t.recordBounds(u,g,y,y);const{texcoords:s,offsets:n}=e;this._writeQuad(t,o,r,i,{texcoords:s,offsets:n,fontSize:h,color:p(c.color),isBackground:!1,referenceBounds:a}),t.recordEnd()}0!==n&&s.setRotation(-n)}_writeTextBox(t,e,o,r,i,s,n){const a=this.evaluatedMeshParams,{fontSize:c}=this._textMeshTransformProps,{boxBackgroundColor:l,boxBorderLineColor:h}=a,f={isBackground:!0,fontSize:c,referenceBounds:s,...n};l&&(this._writeQuad(t,e,o,r,{texcoords:P,offsets:i.main,color:p(l),...f}),h||(this._writeQuad(t,e,o,r,{texcoords:B,offsets:i.top,color:p(l),...f}),this._writeQuad(t,e,o,r,{texcoords:R,offsets:i.bot,color:p(l),...f}),this._writeQuad(t,e,o,r,{texcoords:w,offsets:i.left,color:p(l),...f}),this._writeQuad(t,e,o,r,{texcoords:M,offsets:i.right,color:p(l),...f}))),h&&(this._writeQuad(t,e,o,r,{texcoords:b,offsets:i.top,color:p(h),...f}),this._writeQuad(t,e,o,r,{texcoords:b,offsets:i.bot,color:p(h),...f}),this._writeQuad(t,e,o,r,{texcoords:T,offsets:i.left,color:p(h),...f}),this._writeQuad(t,e,o,r,{texcoords:T,offsets:i.right,color:p(h),...f}))}_writeQuad(t,e,o,r,i){const s=t.vertexCount();this._writeVertex(t,e,o,r,i),t.indexWrite(s+0),t.indexWrite(s+1),t.indexWrite(s+2),t.indexWrite(s+1),t.indexWrite(s+3),t.indexWrite(s+2)}}const E=t=>Math.round(t*(254/360));export{L as TextMeshWriter,z as TextVertexSpec};
5
+ import{clamp as t}from"../../../../../../../core/mathUtils.js";import{pt2px as e}from"../../../../../../../core/screenUtils.js";import{GeometryCursor as o}from"../../../../../../../geometry/GeometryCursor.js";import{CIMMarkerPlacementHelper as r}from"../../../../../../../symbols/cim/placements/CIMMarkerPlacementHelper.js";import{getXDirection as i,getYDirection as s}from"../../../alignmentUtils.js";import{minMaxZoomPrecisionFactor as n,magicLabelLineHeight as a,glyphSize as c}from"../../../definitions.js";import{shapeGlyphs as l}from"../../../mesh/templates/shapingUtils.js";import{packBitset as h,processColorInput as p}from"../fill/meshWriterUtils.js";import{getGeometryEngine as f}from"../mesh/loadGeometryEngine.js";import{MeshWriter as m}from"../mesh/MeshWriter.js";import{bitsetTextIsBackground as d,bitsetTextIsMapAligned as u}from"../shaders/constants.js";import{TextMeshTransformProps as g}from"./TextParams.js";import{DataType as x}from"../../../../../../webgl/enums.js";const y=28,_=[4,4],P=[16,4],S={topLeft:P,topRight:P,bottomLeft:P,bottomRight:P},k=[4,2],b=[4,6],T={topLeft:k,topRight:k,bottomLeft:b,bottomRight:b},B={topLeft:k,topRight:b,bottomLeft:k,bottomRight:b},R={topLeft:b,topRight:b,bottomLeft:_,bottomRight:_},w={topLeft:_,topRight:_,bottomLeft:b,bottomRight:b},M={topLeft:b,topRight:_,bottomLeft:b,bottomRight:_},z={topLeft:_,topRight:b,bottomLeft:_,bottomRight:b},L={createComputedParams:t=>t,attributes:{pos:{type:x.SHORT,count:2,pack:"position",packPrecisionFactor:10},id:{type:x.UNSIGNED_BYTE,count:3,pack:"id"},bitset:{type:x.UNSIGNED_BYTE,count:1,packTessellation:({isBackground:t,mapAligned:e})=>h([[d,t],[u,!!e]])},zoomRange:{type:x.UNSIGNED_SHORT,count:2,packPrecisionFactor:n,packTessellation:({minZoom:t,maxZoom:e})=>[t||0,e||y]},offset:{type:x.SHORT,count:2,packPrecisionFactor:8,packAlternating:{count:4,packTessellation:({offsets:t})=>{const{bottomLeft:e,bottomRight:o,topLeft:r,topRight:i}=t;return[r,i,e,o]}}},textureUV:{type:x.SHORT,count:2,packPrecisionFactor:4,packAlternating:{count:4,packTessellation:({texcoords:t})=>{const{bottomLeft:e,bottomRight:o,topLeft:r,topRight:i}=t;return[r,i,e,o]}}},color:{type:x.UNSIGNED_BYTE,count:4,normalized:!0,packTessellation:({color:t})=>t},fontSize:{type:x.UNSIGNED_SHORT,count:1,packPrecisionFactor:4,packTessellation:({fontSize:t})=>e(t)},referenceSize:{type:x.UNSIGNED_BYTE,count:1,packPrecisionFactor:4,packTessellation:({fontSize:t},{referenceSize:o})=>e(o??t)},haloColor:{type:x.UNSIGNED_BYTE,count:4,normalized:!0,pack:({haloColor:t})=>p(t)},haloFontSize:{type:x.UNSIGNED_SHORT,count:1,packPrecisionFactor:4,pack:({haloFontSize:t})=>e(t)},clipAngle:{type:x.UNSIGNED_BYTE,count:1,packTessellation:({clipAngle:t})=>G(t||0)},referenceSymbol:{type:x.BYTE,count:4,packPrecisionFactor:1,packTessellation:(t,o)=>{if(!t.referenceBounds)return[0,0,0,0];const r=i(o.horizontalAlignment),n=s(o.verticalAlignment),{offsetX:a,offsetY:c,size:l}=t.referenceBounds;return[e(a),-e(c),e(l),r+1<<2|n+1]}}}};class E extends m{constructor(){super(...arguments),this.vertexSpec=L,this._textMeshParamsPropsInitialized=!1}ensurePacked(t,e,o){super.ensurePacked(t,e,o),this._textMeshParamsPropsInitialized&&!this._evaluator.hasDynamicProperties||(this._textMeshTransformProps=new g(this.evaluatedMeshParams),this._textMeshParamsPropsInitialized=!0)}_write(t,e,o){const r=this._getShaping();if(!r)return;const i=e.getDisplayId();if(null!=this.evaluatedMeshParams.placement)return this._writePlacedTextMarkers(t,e,r,o);if(o&&o.nextPath())return o.nextPoint(),this._writeGlyphs(t,i,o.x,o.y,r,0);if("esriGeometryPolygon"===e.geometryType){const o=e.readCentroidForDisplay();if(!o)return;const[s,n]=o.coords;return this._writeGlyphs(t,i,s,n,r,0)}if("esriGeometryMultipoint"===e.geometryType){const o=e.readGeometryForDisplay();return void o?.forEachVertex(((e,o)=>this._writeGlyphs(t,i,e,o,r,0)))}const s=e.readXForDisplay(),n=e.readYForDisplay();return this._writeGlyphs(t,i,s,n,r,0)}_writePlacedTextMarkers(t,i,s,n){const a=n??o.fromFeatureSetReaderCIM(i);if(!a)return;const c=-1,l=r.getPlacement(a,c,this.evaluatedMeshParams.placement,e(1),t.id,f());if(!l)return;const h=i.getDisplayId();let p=l.next();for(;null!=p;){const e=p.tx,o=-p.ty,r=-p.getAngle();this._writeGlyphs(t,h,e,o,s,r),p=l.next()}}_getShaping(){const o=this._textMeshTransformProps,r=this.evaluatedMeshParams;if(!r.glyphs?.glyphs.length)return null;const i=Math.round(e(o.fontSize)),s=e(o.offsetX),n=e(o.offsetY),h=t(e(r.lineWidth),32,512),p=a*t(r.lineHeightRatio,.25,4);return l(r.glyphs,{scale:i/c,angle:o.postAngle,xOffset:s,yOffset:n,horizontalAlignment:r.horizontalAlignment,verticalAlignment:r.verticalAlignment,maxLineWidth:h,lineHeight:p,decoration:r.decoration,borderLineSizePx:e(r.boxBorderLineSize),hasBackground:!!r.boxBackgroundColor,useCIMAngleBehavior:r.useCIMAngleBehavior})}_writeGlyphs(t,o,r,i,s,n,a){const c=this.evaluatedMeshParams,l=this._textMeshTransformProps,h=l.fontSize,f=e(l.offsetX),m=e(l.offsetY);0!==n&&s.setRotation(n);const d=s.bounds,u=r+d.x+f,g=i+d.y-m,x=2*(c.minPixelBuffer?c.minPixelBuffer/h:1),y=Math.max(d.width,d.height)*x;s.textBox&&(t.recordStart(this.instanceId,this.attributeLayout,s.glyphs[0].textureBinding),t.recordBounds(u,g,y,y),this._writeTextBox(t,o,r,i,s.textBox,a),t.recordEnd());for(const e of s.glyphs){t.recordStart(this.instanceId,this.attributeLayout,e.textureBinding),t.recordBounds(u,g,y,y);const{texcoords:s,offsets:n}=e;this._writeQuad(t,o,r,i,{texcoords:s,offsets:n,fontSize:h,color:p(c.color),isBackground:!1,referenceBounds:a}),t.recordEnd()}0!==n&&s.setRotation(-n)}_writeTextBox(t,e,o,r,i,s,n){const a=this.evaluatedMeshParams,{fontSize:c}=this._textMeshTransformProps,{boxBackgroundColor:l,boxBorderLineColor:h}=a,f={isBackground:!0,fontSize:c,referenceBounds:s,...n};l&&(this._writeQuad(t,e,o,r,{texcoords:S,offsets:i.main,color:p(l),...f}),h||(this._writeQuad(t,e,o,r,{texcoords:R,offsets:i.top,color:p(l),...f}),this._writeQuad(t,e,o,r,{texcoords:w,offsets:i.bot,color:p(l),...f}),this._writeQuad(t,e,o,r,{texcoords:M,offsets:i.left,color:p(l),...f}),this._writeQuad(t,e,o,r,{texcoords:z,offsets:i.right,color:p(l),...f}))),h&&(this._writeQuad(t,e,o,r,{texcoords:T,offsets:i.top,color:p(h),...f}),this._writeQuad(t,e,o,r,{texcoords:T,offsets:i.bot,color:p(h),...f}),this._writeQuad(t,e,o,r,{texcoords:B,offsets:i.left,color:p(h),...f}),this._writeQuad(t,e,o,r,{texcoords:B,offsets:i.right,color:p(h),...f}))}_writeQuad(t,e,o,r,i){const s=t.vertexCount();this._writeVertex(t,e,o,r,i),t.indexWrite(s+0),t.indexWrite(s+1),t.indexWrite(s+2),t.indexWrite(s+1),t.indexWrite(s+3),t.indexWrite(s+2)}}const G=t=>Math.round(t*(254/360));export{E as TextMeshWriter,L as TextVertexSpec,y as maxLabelZoom};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.30/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../../../chunks/tslib.es6.js";import t from"../../../../../Color.js";import i from"../../../../../core/Accessor.js";import{getContrast as s,multiplyOpacityToUnitRGBA as n,colorVectorEquals as a,colorVectorToColorAndOpacity as o}from"../../../../../core/colorUtils.js";import{destroyMaybe as r}from"../../../../../core/maybe.js";import{watch as l,initial as d}from"../../../../../core/reactiveUtils.js";import{property as h}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/has.js";import"../../../../../core/Logger.js";import"../../../../../core/RandomLCG.js";import{subclass as c}from"../../../../../core/accessorSupport/decorators/subclass.js";import{create as p}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromPoints as u}from"../../../../../geometry/support/lineSegment.js";import{MeasurementMode as g}from"../../../analysis/interfaces.js";import{ViewMode as m}from"../../../analysis/DirectLineMeasurement/interfaces.js";import{Manipulator3D as _}from"../../Manipulator3D.js";import{createManipulatorMaterial as y}from"../../manipulatorUtils.js";import{RenderObject as b}from"../../RenderObject.js";import{LaserlineVisualElement as v}from"../../visualElements/LaserlineVisualElement.js";import{createSphereGeometry as w}from"../../../webgl-engine/lib/GeometryUtil.js";var L;!function(e){e.Manipulators="manipulators",e.AnalysisViewDestroyed="analysis-view-destroyed",e.AnalysisView="analysis-view"}(L||(L={}));let P=class extends i{constructor(e){super(e),this.cursorPoint=null,this._visible=!1,this._laserLine=null,this.laserLineEnabled=!0,this._lastDraggedHandle=null}initialize(){this._laserLine=new v({view:this.view,attached:!0,isDecoration:!0}),this._updateVisibility(this._visible),this._connectToAnalysisView(),this.addHandles(l((()=>this._params),(({laserLineGlowColor:e,laserLineInnerColor:t,laserLineGlobalAlpha:i})=>{const s=this._laserLine,n=s.style;s.style={...n,innerColor:t,glowColor:e,globalAlpha:i}})))}destroy(){this._laserLine=r(this._laserLine)}get _params(){const{accentColor:e}=this.view.effectiveTheme;return{laserLineGlowColor:t.toUnitRGB(e),laserLineGlowWidth:8,laserLineGlowFalloff:8,laserLineInnerColor:t.toUnitRGB(s(e)),laserLineInnerWidth:.75,laserLineGlobalAlpha:.75*e.a,handleColor:n(e,.5),handleRadius:5}}get visible(){return this._visible}set visible(e){e?this.show():this.hide()}get testData(){const e=this._laserLine.testData,t=this.analysisViewData.testData;return{labels:t?.labels,stripeLength:t?.stripeLength,laserLineRenderer:{heightManifoldEnabled:null!=e&&e.heightManifoldEnabled,heightManifoldTarget:null!=e?e.heightManifoldTarget:null,pointDistanceEnabled:null!=e&&e.pointDistanceEnabled,pointDistanceOrigin:null!=e?e.pointDistanceOrigin:null,pointDistanceTarget:null!=e?e.pointDistanceTarget:null,lineVerticalPlaneEnabled:null!=e&&e.lineVerticalPlaneEnabled}}}get _cursorPosition(){const e=p(),t=this.cursorPoint;return t&&this.view.renderCoordsHelper.toRenderCoords(t,e),e}get _startPosition(){const e=p(),t=this.analysis.startPoint;return t&&this.view.renderCoordsHelper.toRenderCoords(t,e),e}get _endPosition(){const e=p(),t=this.analysis.endPoint;return t&&this.view.renderCoordsHelper.toRenderCoords(t,e),e}get _laserLineParams(){const e=this._focusPosition,{active:t,lineState:i}=this.toolState,s=this.analysisViewData,n=this.laserLineEnabled&&!!e&&"measured"!==i&&t;if(!n||!this.visible||null==s||s.destroyed)return{heightManifoldTarget:null,pointDistanceLine:null,lineVerticalPlaneSegment:null};const a=s.actualVisualizedMeasurement,o="local"!==this.view.viewingMode&&n&&!!this.analysis.startPoint&&"geodesic"===a,r=n&&s.viewMode===m.Triangle;return{heightManifoldTarget:"euclidean"===a?e:null,pointDistanceLine:o?this._pointDistanceLine:null,lineVerticalPlaneSegment:r?u(this._startPosition,this._endPosition):null}}get _focusPosition(){const{lineState:e}=this.toolState,t=this.analysisViewData,i=null!=t&&!t.destroyed&&t.measurementMode===g.Euclidean&&t.viewMode===m.Direct;switch(e){case"drawing":return i?this._startPosition:this.analysis.endPoint?this._endPosition:this._startPosition;case"editing":return i?"start"===this._lastDraggedHandle?this._endPosition:this._startPosition:"start"===this._lastDraggedHandle?this._startPosition:this._endPosition;default:return null!=this.cursorPoint?this._cursorPosition:null}}get _pointDistanceLine(){return{origin:"drawing"===this.toolState.lineState||"end"===this._lastDraggedHandle?this._startPosition:this._endPosition,target:this._focusPosition}}createManipulators(){const e=this._params,{view:t}=this,i=()=>{const i=y(e.handleColor),s=[new b(w(i,1,32,32))],n=new _({view:t,renderObjects:s});return n.available=!1,n.radius=e.handleRadius,[n,i]},[s,n]=i(),[r,d]=i(),h=new _({view:this.view});h.available=!1,h.interactive=!1,null!=this.analysis.startPoint&&(s.location=this.analysis.startPoint,s.available=!0),null!=this.analysis.endPoint&&(r.location=this.analysis.endPoint,r.available=!0);const c=()=>{let e=this._lastDraggedHandle;s.grabbing&&!r.grabbing&&(e="start"),r.grabbing&&!s.grabbing&&(e="end"),s.grabbing||r.grabbing||(e=null),this._lastDraggedHandle=e},p=s.events.on("grab-changed",c),u=r.events.on("grab-changed",c);return this.addHandles([p,u,l((()=>o(this._params.handleColor)),(e=>{n.setParameters({color:e}),d.setParameters({color:e})}),{equals:a})],L.Manipulators),{start:s,end:r,cursor:h}}show(){this.destroyed||this._visible||this._updateVisibility(!0)}hide(){!this.destroyed&&this._visible&&this._updateVisibility(!1)}_connectToAnalysisView(){this.removeHandles(L.AnalysisView),this.addHandles([l((()=>this.analysisViewData?.destroyed),(e=>{e&&this.removeHandles(L.AnalysisView)}),d),l((()=>["measured"===this.toolState.lineState,this.analysisViewData]),(([e,t])=>{null==t||t.destroyed||(t.allowVisualElementsOrientationChange=!e)}),d),l((()=>this._laserLineParams),(e=>{const t=this._laserLine;t.heightManifoldTarget=e.heightManifoldTarget,t.pointDistanceLine=e.pointDistanceLine,t.lineVerticalPlaneSegment=e.lineVerticalPlaneSegment}),d)],L.AnalysisView)}_updateVisibility(e){this.initialized&&(this._visible=e,e?this._laserLine.style={innerColor:this._params.laserLineInnerColor,innerWidth:this._params.laserLineInnerWidth,glowColor:this._params.laserLineGlowColor,glowWidth:this._params.laserLineGlowWidth,glowFalloff:this._params.laserLineGlowFalloff,globalAlpha:this._params.laserLineGlobalAlpha}:this.view.cursor=null,this._laserLine.visible=e)}};e([h({constructOnly:!0})],P.prototype,"view",void 0),e([h()],P.prototype,"_params",null),e([h({constructOnly:!0})],P.prototype,"analysis",void 0),e([h({constructOnly:!0})],P.prototype,"analysisViewData",void 0),e([h()],P.prototype,"cursorPoint",void 0),e([h()],P.prototype,"toolState",void 0),e([h()],P.prototype,"visible",null),e([h()],P.prototype,"testData",null),e([h()],P.prototype,"_visible",void 0),e([h()],P.prototype,"_laserLine",void 0),e([h({constructOnly:!0})],P.prototype,"laserLineEnabled",void 0),e([h()],P.prototype,"_cursorPosition",null),e([h()],P.prototype,"_startPosition",null),e([h()],P.prototype,"_endPosition",null),e([h()],P.prototype,"_lastDraggedHandle",void 0),e([h()],P.prototype,"_laserLineParams",null),e([h()],P.prototype,"_focusPosition",null),e([h()],P.prototype,"_pointDistanceLine",null),P=e([c("esri.views.3d.interactive.measurementTools.directLineMeasurement3D.DirectLineMeasurement3DView")],P);export{P as DirectLineMeasurement3DView};
5
+ import{_ as e}from"../../../../../chunks/tslib.es6.js";import t from"../../../../../Color.js";import i from"../../../../../core/Accessor.js";import{getContrast as s,multiplyOpacityToUnitRGBA as n,colorVectorEquals as a,colorVectorToColorAndOpacity as o}from"../../../../../core/colorUtils.js";import{destroyMaybe as r}from"../../../../../core/maybe.js";import{watch as l,initial as d}from"../../../../../core/reactiveUtils.js";import{property as h}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/has.js";import"../../../../../core/Logger.js";import"../../../../../core/RandomLCG.js";import{subclass as c}from"../../../../../core/accessorSupport/decorators/subclass.js";import{create as p}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromPoints as u}from"../../../../../geometry/support/lineSegment.js";import{MeasurementMode as g}from"../../../analysis/interfaces.js";import{ViewMode as m}from"../../../analysis/DirectLineMeasurement/interfaces.js";import{Manipulator3D as _}from"../../Manipulator3D.js";import{createManipulatorMaterial as y}from"../../manipulatorUtils.js";import{RenderObject as b}from"../../RenderObject.js";import{LaserlineVisualElement as v}from"../../visualElements/LaserlineVisualElement.js";import{createSphereGeometry as w}from"../../../webgl-engine/lib/GeometryUtil.js";var L;!function(e){e.Manipulators="manipulators",e.AnalysisViewDestroyed="analysis-view-destroyed",e.AnalysisView="analysis-view"}(L||(L={}));let P=class extends i{constructor(e){super(e),this.cursorPoint=null,this._visible=!1,this._laserLine=null,this.laserLineEnabled=!0,this._lastDraggedHandle=null}initialize(){this._laserLine=new v({view:this.view,attached:!0,isDecoration:!0}),this._updateVisibility(this._visible),this._connectToAnalysisView(),this.addHandles(l((()=>this._params),(({laserLineGlowColor:e,laserLineInnerColor:t,laserLineGlobalAlpha:i})=>{const s=this._laserLine,n=s.style;s.style={...n,innerColor:t,glowColor:e,globalAlpha:i}})))}destroy(){this._laserLine=r(this._laserLine)}get _params(){const{accentColor:e}=this.view.effectiveTheme;return{laserLineGlowColor:t.toUnitRGB(e),laserLineGlowWidth:8,laserLineGlowFalloff:8,laserLineInnerColor:t.toUnitRGB(s(e)),laserLineInnerWidth:.75,laserLineGlobalAlpha:.75*e.a,handleColor:n(e,.5),handleRadius:5}}get visible(){return this._visible}set visible(e){e?this.show():this.hide()}get testData(){const e=this._laserLine.testData,t=this.analysisViewData.testData;return{labels:t?.labels,stripeLength:t?.stripeLength,laserLineRenderer:{heightManifoldEnabled:null!=e&&e.heightManifoldEnabled,heightManifoldTarget:null!=e?e.heightManifoldTarget:null,pointDistanceEnabled:null!=e&&e.pointDistanceEnabled,pointDistanceOrigin:null!=e?e.pointDistanceOrigin:null,pointDistanceTarget:null!=e?e.pointDistanceTarget:null,lineVerticalPlaneEnabled:null!=e&&e.lineVerticalPlaneEnabled}}}get _cursorPosition(){const e=p(),t=this.cursorPoint;return t&&this.view.renderCoordsHelper.toRenderCoords(t,e),e}get _startPosition(){const e=p(),t=this.analysis.startPoint;return t&&this.view.renderCoordsHelper.toRenderCoords(t,e),e}get _endPosition(){const e=p(),t=this.analysis.endPoint;return t&&this.view.renderCoordsHelper.toRenderCoords(t,e),e}get _laserLineParams(){const e=this._focusPosition,{active:t,lineState:i}=this.toolState,s=this.analysisViewData,n=this.laserLineEnabled&&!!e&&"measured"!==i&&t;if(!n||!this.visible||null==s||s.destroyed)return{heightManifoldTarget:null,pointDistanceLine:null,lineVerticalPlaneSegment:null};const a=s.actualVisualizedMeasurement,o="local"!==this.view.viewingMode&&n&&!!this.analysis.startPoint&&"geodesic"===a,r=n&&s.viewMode===m.Triangle;return{heightManifoldTarget:"euclidean"===a?e:null,pointDistanceLine:o?this._pointDistanceLine:null,lineVerticalPlaneSegment:r?u(this._startPosition,this._endPosition):null}}get _focusPosition(){const{lineState:e}=this.toolState,t=this.analysisViewData,i=null!=t&&!t.destroyed&&t.measurementMode===g.Euclidean&&t.viewMode===m.Direct;switch(e){case"drawing":return i?this._startPosition:this.analysis.endPoint?this._endPosition:this._startPosition;case"editing":return i?"start"===this._lastDraggedHandle?this._endPosition:this._startPosition:"start"===this._lastDraggedHandle?this._startPosition:this._endPosition;default:return null!=this.cursorPoint?this._cursorPosition:null}}get _pointDistanceLine(){return{origin:"drawing"===this.toolState.lineState||"end"===this._lastDraggedHandle?this._startPosition:this._endPosition,target:this._focusPosition}}createManipulators(){const e=this._params,{view:t}=this,i=()=>{const i=y(e.handleColor),s=[new b(w(i,1,32,32))],n=new _({view:t,renderObjects:s});return n.available=!1,n.radius=e.handleRadius,[n,i]},[s,n]=i(),[r,d]=i(),h=new _({view:this.view,available:!1,interactive:!1});null!=this.analysis.startPoint&&(s.location=this.analysis.startPoint,s.available=!0),null!=this.analysis.endPoint&&(r.location=this.analysis.endPoint,r.available=!0);const c=()=>{let e=this._lastDraggedHandle;s.grabbing&&!r.grabbing&&(e="start"),r.grabbing&&!s.grabbing&&(e="end"),s.grabbing||r.grabbing||(e=null),this._lastDraggedHandle=e},p=s.events.on("grab-changed",c),u=r.events.on("grab-changed",c);return this.addHandles([p,u,l((()=>o(this._params.handleColor)),(e=>{n.setParameters({color:e}),d.setParameters({color:e})}),{equals:a})],L.Manipulators),{start:s,end:r,cursor:h}}show(){this.destroyed||this._visible||this._updateVisibility(!0)}hide(){!this.destroyed&&this._visible&&this._updateVisibility(!1)}_connectToAnalysisView(){this.removeHandles(L.AnalysisView),this.addHandles([l((()=>this.analysisViewData?.destroyed),(e=>{e&&this.removeHandles(L.AnalysisView)}),d),l((()=>["measured"===this.toolState.lineState,this.analysisViewData]),(([e,t])=>{null==t||t.destroyed||(t.allowVisualElementsOrientationChange=!e)}),d),l((()=>this._laserLineParams),(e=>{const t=this._laserLine;t.heightManifoldTarget=e.heightManifoldTarget,t.pointDistanceLine=e.pointDistanceLine,t.lineVerticalPlaneSegment=e.lineVerticalPlaneSegment}),d)],L.AnalysisView)}_updateVisibility(e){this.initialized&&(this._visible=e,e?this._laserLine.style={innerColor:this._params.laserLineInnerColor,innerWidth:this._params.laserLineInnerWidth,glowColor:this._params.laserLineGlowColor,glowWidth:this._params.laserLineGlowWidth,glowFalloff:this._params.laserLineGlowFalloff,globalAlpha:this._params.laserLineGlobalAlpha}:this.view.cursor=null,this._laserLine.visible=e)}};e([h({constructOnly:!0})],P.prototype,"view",void 0),e([h()],P.prototype,"_params",null),e([h({constructOnly:!0})],P.prototype,"analysis",void 0),e([h({constructOnly:!0})],P.prototype,"analysisViewData",void 0),e([h()],P.prototype,"cursorPoint",void 0),e([h()],P.prototype,"toolState",void 0),e([h()],P.prototype,"visible",null),e([h()],P.prototype,"testData",null),e([h()],P.prototype,"_visible",void 0),e([h()],P.prototype,"_laserLine",void 0),e([h({constructOnly:!0})],P.prototype,"laserLineEnabled",void 0),e([h()],P.prototype,"_cursorPosition",null),e([h()],P.prototype,"_startPosition",null),e([h()],P.prototype,"_endPosition",null),e([h()],P.prototype,"_lastDraggedHandle",void 0),e([h()],P.prototype,"_laserLineParams",null),e([h()],P.prototype,"_focusPosition",null),e([h()],P.prototype,"_pointDistanceLine",null),P=e([c("esri.views.3d.interactive.measurementTools.directLineMeasurement3D.DirectLineMeasurement3DView")],P);export{P as DirectLineMeasurement3DView};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.30/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../chunks/tslib.es6.js";import r from"../../../Graphic.js";import t from"../../../core/Error.js";import i from"../../../core/Logger.js";import{destroyMaybe as s}from"../../../core/maybe.js";import{throwIfAborted as l,throwIfAbortError as n}from"../../../core/promiseUtils.js";import{syncAndInitial as a,initial as o}from"../../../core/reactiveUtils.js";import{property as u}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/RandomLCG.js";import{subclass as d}from"../../../core/accessorSupport/decorators/subclass.js";import{WhereClause as p}from"../../../core/sql/WhereClause.js";import"../../../layers/buildingSublayers/BuildingComponentSublayer.js";import h from"../../../layers/support/FeatureFilter.js";import{fixFields as y,unpackFieldNames as c,populateMissingFields as f}from"../../../layers/support/fieldUtils.js";import m from"../../../rest/support/Query.js";import{BuildingSublayerView3DMixin as g}from"./BuildingSublayerView3D.js";import{I3SMeshView3D as F}from"./I3SMeshView3D.js";import{ForAllFeaturesMode as b}from"./II3SMeshView3D.js";import{applyFilterMode as _}from"./i3s/BuildingFilterUtil.js";import{createGetFeatureExtent as E}from"./i3s/I3SGeometryUtil.js";import{I3SMeshViewFilter as w}from"./i3s/I3SMeshViewFilter.js";import{I3SQueryEngine as x}from"./i3s/I3SQueryEngine.js";import{I3SQueryFeatureAdapter as S}from"./i3s/I3SQueryFeatureAdapter.js";import{I3SQueryFeatureStore as j}from"./i3s/I3SQueryFeatureStore.js";import{findFieldsCaseInsensitive as v,getIndexCrs as I}from"./i3s/I3SUtil.js";import{DefinitionExpressionSceneLayerView as Q}from"./support/DefinitionExpressionSceneLayerView.js";import{TemporalSceneLayerView as q}from"./support/TemporalSceneLayerView.js";import L from"../../layers/BuildingComponentSublayerView.js";import{hasPopupTemplate as R,getRequiredFields as V,getFetchPopupTemplate as U}from"../../layers/support/popupUtils.js";import{TaskPriority as A}from"../../support/Scheduler.js";let C=class extends(q(Q(F(g(L))))){constructor(){super(...arguments),this.type="building-component-sublayer-3d",this.layerView=null,this._elevationContext="scene",this._isIntegratedMesh=!1,this._supportsLabeling=!1,this.requiredFields=[],this.progressiveLoadFactor=1,this._queryEngine=null}get i3slayer(){return this.sublayer}get layerUid(){return this.sublayer.layer.uid}get sublayerUid(){return this.sublayer.uid}get layerId(){return this.sublayer.layer.id}get sublayerId(){return this.sublayer.id}get layerPopupEnabledAndHasTemplate(){return this.sublayer.popupEnabled&&R(this.sublayer,this.layerView?.view.popup?.defaultPopupTemplateEnabled)}initialize(){this._updatingHandles.add((()=>this.mergedFilter),(e=>{null!=e&&w.checkSupport(e)?null==this._i3sFilter?this._i3sFilter=new w({viewFilter:e,layerFieldsIndex:this.sublayer.fieldsIndex,loadAsyncModule:e=>this._loadAsyncModule(e),addSqlFilter:(e,r)=>this.addSqlFilter(e,r,this.logError),addTimeFilter:(e,r)=>this.addTimeFilter(e,r)}):this._i3sFilter.viewFilter=e:this._i3sFilter=s(this._i3sFilter)}),a),this._updatingHandles.add((()=>[this.sublayer.renderer,this.definitionExpressionFields,this.filterExpressionFields,this.timeFilterFields]),(()=>this._updateRequiredFields())),this._updatingHandles.add((()=>this.sublayer.renderer),(e=>this._rendererChange(e)),o);const e=()=>this._filterChange();this._updatingHandles.add((()=>this.parsedDefinitionExpression),e),this._updatingHandles.add((()=>this._i3sFilter?.sortedObjectIds),e),this._updatingHandles.add((()=>this._i3sFilter?.parsedWhereClause),e),this._updatingHandles.add((()=>this.getTimeFilterDependencies()),e),this._updatingHandles.add((()=>this.mergedFilter),e),this._updatingHandles.add((()=>[this._i3sFilter?.parsedGeometry,this.filter?.spatialRelationship]),(()=>this._geometryFilterChange())),this._updatingHandles.add((()=>this.parsedFilterExpressions),(()=>this._updateSymbologyOverride()),o),this.addResolvingPromise(this._updateRequiredFields())}get lodFactor(){return this.view.qualitySettings.sceneService.object.lodFactor}get parsedFilterExpressions(){return"Overview"!==this.sublayer.modelName&&this.layerView?this.layerView.filterExpressions.map((([e,r])=>{let t;try{t=p.create(e,this.sublayer.fieldsIndex)}catch(n){return i.getLogger(this).error("Failed to parse filterExpression: "+n),null}if(!t.isStandardized)return i.getLogger(this).error("filterExpression is using non standard function"),null;const s=[],l=t.fieldNames;return v(l,this.sublayer.fields,{missingFields:s}),s.length>0?(i.getLogger(this).error(`filterExpression references unknown fields: ${s.join(", ")}`),null):[t,r]})).filter((e=>null!=e)):[]}get filter(){return this._get("filter")}set filter(e){this._set("filter",w.checkSupport(e)?e:null)}isUpdating(){return super.isUpdating()||(this._i3sFilter?.updating??!1)}_updateSymbologyOverride(){const e=this.parsedFilterExpressions;e.length>0?this._setSymbologyOverride(((r,t)=>{for(const[s,l]of e)try{if(s.testFeature(r))return _(t,l)}catch(i){this.logError(i)}return _(t,null)}),this.filterExpressionFields):this._setSymbologyOverride(null,null)}get filterExpressionFields(){return y(this.sublayer.fieldsIndex,this.parsedFilterExpressions.reduce(((e,[r])=>e.concat(r.fieldNames)),new Array))}get timeFilterFields(){const{timeExtent:e}=this,{timeInfo:r,fieldsIndex:t}=this.sublayer;if(null==e||null==r)return[];const{startField:i,endField:s}=r;return y(t,[i,s])}get availableFields(){const e=this.sublayer,r=e.fieldsIndex;let t=this.requiredFields;if(e.outFields||e.layer.outFields){const i=[...e.outFields||[],...e.layer.outFields||[]];t=[...c(r,i),...t]}return y(r,t)}_createLayerGraphic(e){const t=new r(null,null,e);return t.layer=this.sublayer.layer,t.sourceLayer=this.sublayer,t}canResume(){return super.canResume()&&(!this._controller||this._controller.rootNodeVisible)}async fetchPopupFeaturesFromGraphics(e,r){const t=this._validateFetchPopupFeatures(r);if(t)throw t;if(0===e.length)return[];const s=[],a=[],o=null!=this.sublayer.associatedLayer?await this.sublayer.associatedLayer.load(r):this.sublayer,u=c(this.sublayer.fieldsIndex,await V(o,U(this.sublayer,r)));l(r);const d=new Set;for(const i of e)f(u,i,d)?a.push(i):s.push(i);return 0===a.length?s:(null!=this.sublayer.associatedLayer&&await this.sublayer.associatedLayer.load().catch((()=>i.getLogger(this).warn("Failed to load associated feature layer. Displaying popup attributes from cached attributes."))),this.whenGraphicAttributes(a,Array.from(d)).catch((e=>(n(e),a))).then((e=>s.concat(e))))}async _updateRequiredFields(){const e=y(this.sublayer.fieldsIndex,[...this.sublayer.renderer?await this.sublayer.renderer.getRequiredFields(this.sublayer.fieldsIndex):[],...this.definitionExpressionFields,...this.filterExpressionFields,...this.timeFilterFields]);this._set("requiredFields",e)}_validateFetchPopupFeatures(e){const{sublayer:r}=this,{popupEnabled:i}=r;return i?U(r,e)?void 0:new t("buildingscenelayerview3d:fetchPopupFeatures","Layer does not define a popup template",{sublayer:r}):new t("buildingscenelayerview3d:fetchPopupFeatures","Popups are disabled",{sublayer:r})}getFilters(){const e=super.getFilters();return this.addSqlFilter(e,this.parsedDefinitionExpression,this.logError),this._i3sFilter?.addFilters(e,this.view,this._controller.crsIndex,this._collection),e}createQuery(){const e={outFields:["*"],returnGeometry:!1,outSpatialReference:this.view.spatialReference};return null!=this.filter?this.filter.createQuery(e):new m(e)}queryExtent(e,r){return this._ensureQueryEngine().executeQueryForExtent(this._ensureQuery(e),r?.signal)}queryFeatureCount(e,r){return this._ensureQueryEngine().executeQueryForCount(this._ensureQuery(e),r?.signal)}queryFeatures(e,r){return this._ensureQueryEngine().executeQuery(this._ensureQuery(e),r?.signal).then((e=>{if(!e?.features)return e;const r=this.sublayer,t=r.layer;for(const i of e.features)i.layer=t,i.sourceLayer=r;return e}))}queryObjectIds(e,r){return this._ensureQueryEngine().executeQueryForIds(this._ensureQuery(e),r?.signal)}_ensureQueryEngine(){return null==this._queryEngine&&(this._queryEngine=this._createQueryEngine()),this._queryEngine}_createQueryEngine(){const e=E(this.view.spatialReference,this.view.renderSpatialReference,this._collection);return new x({layerView:this,priority:A.FEATURE_QUERY_ENGINE,spatialIndex:new j({featureAdapter:new S({objectIdField:this.sublayer.objectIdField,attributeStorageInfo:this.sublayer.attributeStorageInfo,getFeatureExtent:e}),forAllFeatures:(e,r)=>this._forAllFeatures(((r,t,i)=>e({id:r,index:t,meta:i})),r,b.QUERYABLE),getFeatureExtent:e,sourceSpatialReference:I(this.sublayer),viewSpatialReference:this.view.spatialReference})})}_ensureQuery(e){return this._addDefinitionExpressionToQuery(null==e?this.createQuery():m.from(e))}};e([u()],C.prototype,"i3slayer",null),e([u()],C.prototype,"layerView",void 0),e([u()],C.prototype,"lodFactor",null),e([u({readOnly:!0})],C.prototype,"parsedFilterExpressions",null),e([u({type:h})],C.prototype,"filter",null),e([u()],C.prototype,"_i3sFilter",void 0),e([u({type:[String],readOnly:!0})],C.prototype,"filterExpressionFields",null),e([u({type:[String],readOnly:!0})],C.prototype,"timeFilterFields",null),e([u({type:[String],readOnly:!0})],C.prototype,"requiredFields",void 0),e([u({type:[String],readOnly:!0})],C.prototype,"availableFields",null),C=e([d("esri.views.3d.layers.BuildingComponentSublayerView3D")],C);const O=C;export{O as default};
5
+ import{_ as e}from"../../../chunks/tslib.es6.js";import r from"../../../Graphic.js";import t from"../../../core/Error.js";import i from"../../../core/Logger.js";import{destroyMaybe as s}from"../../../core/maybe.js";import{throwIfAborted as l,throwIfAbortError as n}from"../../../core/promiseUtils.js";import{syncAndInitial as a,initial as o}from"../../../core/reactiveUtils.js";import{property as u}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/RandomLCG.js";import{subclass as d}from"../../../core/accessorSupport/decorators/subclass.js";import{WhereClause as p}from"../../../core/sql/WhereClause.js";import"../../../layers/buildingSublayers/BuildingComponentSublayer.js";import h from"../../../layers/support/FeatureFilter.js";import{fixFields as y,unpackFieldNames as c,populateMissingFields as f}from"../../../layers/support/fieldUtils.js";import m from"../../../rest/support/Query.js";import{BuildingSublayerView3DMixin as g}from"./BuildingSublayerView3D.js";import{I3SMeshView3D as F}from"./I3SMeshView3D.js";import{ForAllFeaturesMode as b}from"./II3SMeshView3D.js";import{applyFilterMode as _}from"./i3s/BuildingFilterUtil.js";import{createGetFeatureExtent as E}from"./i3s/I3SGeometryUtil.js";import{I3SMeshViewFilter as w}from"./i3s/I3SMeshViewFilter.js";import{I3SQueryEngine as x}from"./i3s/I3SQueryEngine.js";import{I3SQueryFeatureAdapter as S}from"./i3s/I3SQueryFeatureAdapter.js";import{I3SQueryFeatureStore as j}from"./i3s/I3SQueryFeatureStore.js";import{findFieldsCaseInsensitive as v,getIndexCrs as I}from"./i3s/I3SUtil.js";import{DefinitionExpressionSceneLayerView as Q}from"./support/DefinitionExpressionSceneLayerView.js";import{TemporalSceneLayerView as q}from"./support/TemporalSceneLayerView.js";import L from"../../layers/BuildingComponentSublayerView.js";import{hasPopupTemplate as R,getRequiredFields as V,getFetchPopupTemplate as U}from"../../layers/support/popupUtils.js";import{TaskPriority as A}from"../../support/Scheduler.js";let C=class extends(q(Q(F(g(L))))){constructor(){super(...arguments),this.type="building-component-sublayer-3d",this.layerView=null,this._elevationContext="scene",this._isIntegratedMesh=!1,this._supportsLabeling=!1,this.requiredFields=[],this.progressiveLoadFactor=1,this._queryEngine=null}get i3slayer(){return this.sublayer}get layerUid(){return this.sublayer.layer.uid}get sublayerUid(){return this.sublayer.uid}get layerId(){return this.sublayer.layer.id}get sublayerId(){return this.sublayer.id}get layerPopupEnabledAndHasTemplate(){return this.sublayer.popupEnabled&&R(this.sublayer,this.layerView?.view.popup?.defaultPopupTemplateEnabled)}initialize(){this._updatingHandles.add((()=>this.mergedFilter),(e=>{null!=e&&w.checkSupport(e)?null==this._i3sFilter?this._i3sFilter=new w({viewFilter:e,layerFieldsIndex:this.sublayer.fieldsIndex,loadAsyncModule:e=>this._loadAsyncModule(e),addSqlFilter:(e,r)=>this.addSqlFilter(e,r,this.logError),addTimeFilter:(e,r)=>this.addTimeFilter(e,r)}):this._i3sFilter.viewFilter=e:this._i3sFilter=s(this._i3sFilter)}),a),this._updatingHandles.add((()=>[this.sublayer.renderer,this.definitionExpressionFields,this.filterExpressionFields,this.timeFilterFields]),(()=>this._updateRequiredFields())),this._updatingHandles.add((()=>this.sublayer.renderer),(e=>this._rendererChange(e)),o);const e=()=>this._filterChange();this._updatingHandles.add((()=>this.parsedDefinitionExpression),e),this._updatingHandles.add((()=>this._i3sFilter?.sortedObjectIds),e),this._updatingHandles.add((()=>this._i3sFilter?.parsedWhereClause),e),this._updatingHandles.add((()=>this.getTimeFilterDependencies()),e),this._updatingHandles.add((()=>this.mergedFilter),e),this._updatingHandles.add((()=>[this._i3sFilter?.parsedGeometry,this.filter?.spatialRelationship]),(()=>this._geometryFilterChange())),this._updatingHandles.add((()=>this.parsedFilterExpressions),(()=>this._updateSymbologyOverride()),o),this.addResolvingPromise(this._updateRequiredFields())}get lodFactor(){return this.view.qualitySettings.sceneService.object.lodFactor}get parsedFilterExpressions(){return"Overview"!==this.sublayer.modelName&&this.layerView?this.layerView.filterExpressions.map((([e,r])=>{let t;try{t=p.create(e,this.sublayer.fieldsIndex)}catch(n){return i.getLogger(this).error("Failed to parse filterExpression: "+n),null}if(!t.isStandardized)return i.getLogger(this).error("filterExpression is using non standard function"),null;const s=[],l=t.fieldNames;return v(l,this.sublayer.fields,{missingFields:s}),s.length>0?(i.getLogger(this).error(`filterExpression references unknown fields: ${s.join(", ")}`),null):[t,r]})).filter((e=>null!=e)):[]}get filter(){return this._get("filter")}set filter(e){this._set("filter",w.checkSupport(e)?e:null)}isUpdating(){return super.isUpdating()||(this._i3sFilter?.updating??!1)}_updateSymbologyOverride(){const e=this.parsedFilterExpressions;e.length>0?this._setSymbologyOverride(((r,t)=>{for(const[s,l]of e)try{if(s.testFeature(r))return _(t,l)}catch(i){this.logError(i)}return _(t,null)}),this.filterExpressionFields):this._setSymbologyOverride(null,null)}get filterExpressionFields(){return y(this.sublayer.fieldsIndex,this.parsedFilterExpressions.reduce(((e,[r])=>e.concat(r.fieldNames)),new Array))}get timeFilterFields(){const{timeExtent:e}=this,{timeInfo:r,fieldsIndex:t}=this.sublayer;if(null==e||null==r)return[];const{startField:i,endField:s}=r;return y(t,[i,s])}get availableFields(){const e=this.sublayer,r=e.fieldsIndex;let t=this.requiredFields;if(e.outFields||e.layer.outFields){const i=[...e.outFields||[],...e.layer.outFields||[]];t=[...c(r,i),...t]}return y(r,t)}_createLayerGraphic(e){return new r({attributes:e,layer:this.sublayer.layer,sourceLayer:this.sublayer})}canResume(){return super.canResume()&&(!this._controller||this._controller.rootNodeVisible)}async fetchPopupFeaturesFromGraphics(e,r){const t=this._validateFetchPopupFeatures(r);if(t)throw t;if(0===e.length)return[];const s=[],a=[],o=null!=this.sublayer.associatedLayer?await this.sublayer.associatedLayer.load(r):this.sublayer,u=c(this.sublayer.fieldsIndex,await V(o,U(this.sublayer,r)));l(r);const d=new Set;for(const i of e)f(u,i,d)?a.push(i):s.push(i);return 0===a.length?s:(null!=this.sublayer.associatedLayer&&await this.sublayer.associatedLayer.load().catch((()=>i.getLogger(this).warn("Failed to load associated feature layer. Displaying popup attributes from cached attributes."))),this.whenGraphicAttributes(a,Array.from(d)).catch((e=>(n(e),a))).then((e=>s.concat(e))))}async _updateRequiredFields(){const e=y(this.sublayer.fieldsIndex,[...this.sublayer.renderer?await this.sublayer.renderer.getRequiredFields(this.sublayer.fieldsIndex):[],...this.definitionExpressionFields,...this.filterExpressionFields,...this.timeFilterFields]);this._set("requiredFields",e)}_validateFetchPopupFeatures(e){const{sublayer:r}=this,{popupEnabled:i}=r;return i?U(r,e)?void 0:new t("buildingscenelayerview3d:fetchPopupFeatures","Layer does not define a popup template",{sublayer:r}):new t("buildingscenelayerview3d:fetchPopupFeatures","Popups are disabled",{sublayer:r})}getFilters(){const e=super.getFilters();return this.addSqlFilter(e,this.parsedDefinitionExpression,this.logError),this._i3sFilter?.addFilters(e,this.view,this._controller.crsIndex,this._collection),e}createQuery(){const e={outFields:["*"],returnGeometry:!1,outSpatialReference:this.view.spatialReference};return null!=this.filter?this.filter.createQuery(e):new m(e)}queryExtent(e,r){return this._ensureQueryEngine().executeQueryForExtent(this._ensureQuery(e),r?.signal)}queryFeatureCount(e,r){return this._ensureQueryEngine().executeQueryForCount(this._ensureQuery(e),r?.signal)}queryFeatures(e,r){return this._ensureQueryEngine().executeQuery(this._ensureQuery(e),r?.signal).then((e=>{if(!e?.features)return e;const r=this.sublayer,t=r.layer;for(const i of e.features)i.layer=t,i.sourceLayer=r;return e}))}queryObjectIds(e,r){return this._ensureQueryEngine().executeQueryForIds(this._ensureQuery(e),r?.signal)}_ensureQueryEngine(){return null==this._queryEngine&&(this._queryEngine=this._createQueryEngine()),this._queryEngine}_createQueryEngine(){const e=E(this.view.spatialReference,this.view.renderSpatialReference,this._collection);return new x({layerView:this,priority:A.FEATURE_QUERY_ENGINE,spatialIndex:new j({featureAdapter:new S({objectIdField:this.sublayer.objectIdField,attributeStorageInfo:this.sublayer.attributeStorageInfo,getFeatureExtent:e}),forAllFeatures:(e,r)=>this._forAllFeatures(((r,t,i)=>e({id:r,index:t,meta:i})),r,b.QUERYABLE),getFeatureExtent:e,sourceSpatialReference:I(this.sublayer),viewSpatialReference:this.view.spatialReference})})}_ensureQuery(e){return this._addDefinitionExpressionToQuery(null==e?this.createQuery():m.from(e))}};e([u()],C.prototype,"i3slayer",null),e([u()],C.prototype,"layerView",void 0),e([u()],C.prototype,"lodFactor",null),e([u({readOnly:!0})],C.prototype,"parsedFilterExpressions",null),e([u({type:h})],C.prototype,"filter",null),e([u()],C.prototype,"_i3sFilter",void 0),e([u({type:[String],readOnly:!0})],C.prototype,"filterExpressionFields",null),e([u({type:[String],readOnly:!0})],C.prototype,"timeFilterFields",null),e([u({type:[String],readOnly:!0})],C.prototype,"requiredFields",void 0),e([u({type:[String],readOnly:!0})],C.prototype,"availableFields",null),C=e([d("esri.views.3d.layers.BuildingComponentSublayerView3D")],C);const O=C;export{O as default};