@arcgis/core 4.32.0-next.20241219 → 4.32.0-next.20241221

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 (185) hide show
  1. package/WebLinkChart.js +1 -1
  2. package/assets/esri/core/workers/RemoteClient.js +1 -1
  3. package/assets/esri/core/workers/chunks/{0da2aaca3f0b4fe910e3.js → 015285436ca965f94e17.js} +1 -1
  4. package/assets/esri/core/workers/chunks/127c82cdb229434883b6.js +1 -0
  5. package/assets/esri/core/workers/chunks/16530347bd78dc6c2fcd.js +1 -0
  6. package/assets/esri/core/workers/chunks/{5119811063bfc97fb725.js → 1a713cc601c6fcd97d2f.js} +1 -1
  7. package/assets/esri/core/workers/chunks/{48f6eb3b63fec1d3312d.js → 2d908c115ea18e813b95.js} +1 -1
  8. package/assets/esri/core/workers/chunks/{11052103efe3d53a784e.js → 31d9f0a37a5d0a1c450b.js} +1 -1
  9. package/assets/esri/core/workers/chunks/{e7c3199813070ff30a3d.js → 3bb94da29dac3367ecc6.js} +1 -1
  10. package/assets/esri/core/workers/chunks/3ed7c8138231de3a3b96.js +1 -0
  11. package/assets/esri/core/workers/chunks/{9cc9bac6e02ab241e852.js → 4746b7afa90ea3641e60.js} +1 -1
  12. package/assets/esri/core/workers/chunks/{ce33d2b5f22a5c566661.js → 4b5dbdcad438cb2dd4bf.js} +1 -1
  13. package/assets/esri/core/workers/chunks/5a0eb9dfe668cf290462.js +1 -0
  14. package/assets/esri/core/workers/chunks/{ee1ddf56549bb169509c.js → 6332da54159d72a6ce66.js} +1 -1
  15. package/assets/esri/core/workers/chunks/648d7d8fa19a2e772c89.js +1 -0
  16. package/assets/esri/core/workers/chunks/66b411119b8ffb99b9dc.js +1 -0
  17. package/assets/esri/core/workers/chunks/69efc716991a407c3d23.js +1 -0
  18. package/assets/esri/core/workers/chunks/88c68881cbdf4e911832.js +1 -0
  19. package/assets/esri/core/workers/chunks/8e60de347b209a753c73.js +1 -0
  20. package/assets/esri/core/workers/chunks/{fb43c44a7d6b61f31e75.js → 94432e04de01ee7adc0e.js} +1 -1
  21. package/assets/esri/core/workers/chunks/{80ac74da0b0e45e74beb.js → 9a498f2c007f4d78d4dd.js} +1 -1
  22. package/assets/esri/core/workers/chunks/{770d233254419b741616.js → 9ad7d095e614e7e8d7f5.js} +1 -1
  23. package/assets/esri/core/workers/chunks/9dd167db3f2e68b71cea.js +1 -0
  24. package/assets/esri/core/workers/chunks/{b15894bff153e0793ef4.js → 9f495ad57cdbfa90c5b8.js} +1 -1
  25. package/assets/esri/core/workers/chunks/{d7b76bc7bff34abc2253.js → a0b3d70a1b0360084593.js} +1 -1
  26. package/assets/esri/core/workers/chunks/a90611cdc86190799560.js +1 -0
  27. package/assets/esri/core/workers/chunks/{e213f4a1c95a33f80cdc.js → aedff36d3fec86abb9fb.js} +1 -1
  28. package/assets/esri/core/workers/chunks/{194013d377e7dd00845f.js → b611f46835edcd6eefcc.js} +1 -1
  29. package/assets/esri/core/workers/chunks/{eddab4dc706e75c6637f.js → bff74200a0df0950cf08.js} +1 -1
  30. package/assets/esri/core/workers/chunks/{8f2ffb6944c9028d3bea.js → c08cb75c3eef6c45f604.js} +1 -1
  31. package/assets/esri/core/workers/chunks/c1c216b0aebe86311fae.js +1 -0
  32. package/assets/esri/core/workers/chunks/{f2b195d04414417682d4.js → cbf57abb537e86c1dd7f.js} +1 -1
  33. package/assets/esri/core/workers/chunks/dce55e7f76adecc055c3.js +1 -0
  34. package/assets/esri/core/workers/chunks/f2cdb7be3fd65f65c30b.js +1 -0
  35. package/assets/esri/core/workers/chunks/f9af0473878d960a02f2.js +1 -0
  36. package/assets/esri/core/workers/chunks/fa1c68f2ffcdff7986b6.js +1 -0
  37. package/assets/esri/core/workers/chunks/{0f1a7aeec18db5323365.js → fdd8a5eb07466541f1f9.js} +1 -1
  38. package/assets/esri/themes/base/widgets/_FeatureTable.scss +3 -3
  39. package/assets/esri/themes/dark/main.css +1 -1
  40. package/assets/esri/themes/light/main.css +1 -1
  41. package/assets/esri/themes/light/view.css +1 -1
  42. package/chunks/OperatorProject.js +1 -1
  43. package/chunks/QuadraticBezier.js +1 -1
  44. package/form/elements/GroupElement.js +1 -1
  45. package/form/elements/UtilityNetworkAssociationsElement.d.ts +4 -0
  46. package/form/elements/{UtilityNetworkAssociationElement.js → UtilityNetworkAssociationsElement.js} +1 -1
  47. package/form/elements.js +1 -1
  48. package/form/support/formUtils.js +1 -1
  49. package/geometry/operators/affineTransformOperator.js +1 -1
  50. package/geometry/operators/alphaShapeOperator.js +1 -1
  51. package/geometry/operators/areaOperator.js +1 -1
  52. package/geometry/operators/autoCompleteOperator.js +1 -1
  53. package/geometry/operators/boundaryOperator.js +1 -1
  54. package/geometry/operators/bufferOperator.js +1 -1
  55. package/geometry/operators/centroidOperator.js +1 -1
  56. package/geometry/operators/clipOperator.js +1 -1
  57. package/geometry/operators/containsOperator.js +1 -1
  58. package/geometry/operators/convexHullOperator.js +1 -1
  59. package/geometry/operators/crossesOperator.js +1 -1
  60. package/geometry/operators/cutOperator.js +1 -1
  61. package/geometry/operators/densifyOperator.js +1 -1
  62. package/geometry/operators/differenceOperator.js +1 -1
  63. package/geometry/operators/disjointOperator.js +1 -1
  64. package/geometry/operators/distanceOperator.js +1 -1
  65. package/geometry/operators/equalsOperator.js +1 -1
  66. package/geometry/operators/extendOperator.js +1 -1
  67. package/geometry/operators/generalizeOperator.js +1 -1
  68. package/geometry/operators/geodesicBufferOperator.js +1 -1
  69. package/geometry/operators/geodesicProximityOperator.js +1 -1
  70. package/geometry/operators/geodeticAreaOperator.js +1 -1
  71. package/geometry/operators/geodeticDensifyOperator.js +1 -1
  72. package/geometry/operators/geodeticDistanceOperator.js +1 -1
  73. package/geometry/operators/geodeticLengthOperator.js +1 -1
  74. package/geometry/operators/graphicBufferOperator.js +1 -1
  75. package/geometry/operators/integrateOperator.js +1 -1
  76. package/geometry/operators/intersectionOperator.js +1 -1
  77. package/geometry/operators/intersectsOperator.js +1 -1
  78. package/geometry/operators/isNearOperator.js +1 -1
  79. package/geometry/operators/labelPointOperator.js +1 -1
  80. package/geometry/operators/lengthOperator.js +1 -1
  81. package/geometry/operators/linesToPolygonsOperator.js +1 -1
  82. package/geometry/operators/locateBetweenOperator.js +1 -1
  83. package/geometry/operators/minimumBoundingCircleOperator.js +1 -1
  84. package/geometry/operators/multiPartToSinglePartOperator.js +1 -1
  85. package/geometry/operators/offsetOperator.js +1 -1
  86. package/geometry/operators/overlapsOperator.js +1 -1
  87. package/geometry/operators/polygonOverlayOperator.js +1 -1
  88. package/geometry/operators/polygonSlicerOperator.js +1 -1
  89. package/geometry/operators/projectOperator.js +1 -1
  90. package/geometry/operators/proximityOperator.js +1 -1
  91. package/geometry/operators/relateOperator.js +1 -1
  92. package/geometry/operators/reshapeOperator.js +1 -1
  93. package/geometry/operators/simplifyOperator.js +1 -1
  94. package/geometry/operators/singlePartToMultiPartOperator.js +1 -1
  95. package/geometry/operators/symmetricDifferenceOperator.js +1 -1
  96. package/geometry/operators/touchesOperator.js +1 -1
  97. package/geometry/operators/unionOperator.js +1 -1
  98. package/geometry/operators/withinOperator.js +1 -1
  99. package/interfaces.d.ts +231 -71
  100. package/layers/LinkChartLayer.js +1 -1
  101. package/layers/graphics/OptimizedFeature.js +1 -1
  102. package/layers/graphics/sources/geojson/geojson.js +1 -1
  103. package/layers/knowledgeGraph/supportUtils.js +1 -1
  104. package/layers/support/Sublayer.js +1 -1
  105. package/layers/support/VideoElement.js +1 -1
  106. package/layers/support/domainUtils.js +1 -1
  107. package/layers/support/fieldUtils.js +1 -1
  108. package/linkChart/OrganicLayoutSettings.js +1 -1
  109. package/package.json +1 -1
  110. package/portal/schemas/definitions.js +1 -1
  111. package/rest/knowledgeGraphService.js +1 -1
  112. package/rest/query/operations/pbfOptimizedFeatureSet.js +1 -1
  113. package/rest/support/fileFormat.js +1 -1
  114. package/support/revision.js +1 -1
  115. package/views/2d/engine/webgl/mesh/factories/ResourceProxy.js +1 -1
  116. package/views/2d/input/MapViewInputManager.js +1 -1
  117. package/views/2d/input/handlers/KeyRotate.js +1 -1
  118. package/views/2d/layers/FeatureLayerView2D.js +1 -1
  119. package/views/2d/layers/features/FeatureContainer.js +1 -1
  120. package/views/2d/layers/features/FeaturePipelineWorker.js +1 -1
  121. package/views/2d/layers/features/Processor.js +1 -1
  122. package/views/2d/layers/features/processor/AProcessorStrategy.js +1 -1
  123. package/views/2d/layers/features/processor/BinningStrategy.js +1 -1
  124. package/views/2d/layers/features/processor/ClusterStrategy.js +1 -1
  125. package/views/2d/layers/features/processor/FeatureUpdateStrategy.js +1 -1
  126. package/views/2d/layers/features/sources/FeatureSource.js +1 -1
  127. package/views/2d/layers/features/sources/strategies/ALoadStrategy.js +1 -1
  128. package/views/2d/layers/features/sources/strategies/chunks/ASourceChunk.js +1 -1
  129. package/views/2d/layers/features/sources/strategies/chunks/Overrides.js +5 -0
  130. package/views/2d/layers/features/sources/strategies/chunks/SourceChunkStore.js +1 -1
  131. package/views/2d/layers/features/support/FeatureSetReader.js +1 -1
  132. package/views/2d/layers/features/support/FeatureSetReaderJSON.js +1 -1
  133. package/views/2d/layers/support/DebouncedFeatureOverride.js +5 -0
  134. package/views/2d/layers/support/FeatureCommandQueue.js +1 -1
  135. package/views/3d/input/SceneInputManager.js +1 -1
  136. package/views/3d/input/handlers/KeyboardNavigation.js +1 -1
  137. package/views/3d/terrain/TileTexture.js +1 -1
  138. package/views/3d/webgl-engine/collections/Component/Material/ComponentMaterial.js +1 -1
  139. package/views/3d/webgl-engine/collections/Component/RenderSubmitSystem.js +1 -1
  140. package/views/3d/webgl-engine/core/renderPasses/RenderPassManager.js +1 -1
  141. package/views/3d/webgl-engine/lib/TextureCompressionWorker.js +1 -1
  142. package/views/3d/webgl-engine/lib/depthRangeUtils.js +1 -1
  143. package/views/3d/webgl-engine/lib/lodRendering/LodRenderer.js +1 -1
  144. package/views/layers/FeatureLayerView.js +1 -1
  145. package/views/support/TextureCompressionHelper.js +1 -1
  146. package/views/webgl/Texture.js +1 -1
  147. package/webscene/Slide.js +1 -1
  148. package/webscene/SlideLegend.d.ts +4 -0
  149. package/webscene/SlideLegend.js +5 -0
  150. package/widgets/FeatureForm/FeatureFormViewModel.js +1 -1
  151. package/widgets/FeatureForm.js +1 -1
  152. package/widgets/FeatureTable/FieldColumn.js +1 -1
  153. package/widgets/Features/FeaturesViewModel.js +1 -1
  154. package/widgets/Features.js +1 -1
  155. package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
  156. package/widgets/OrientedImageryViewer/adapters/sketch/DigitizationAdapter.js +1 -1
  157. package/widgets/OrientedImageryViewer/components/ImageOverlays.js +1 -1
  158. package/widgets/OrientedImageryViewer/digitizationUtils.js +1 -1
  159. package/widgets/OrientedImageryViewer.js +1 -1
  160. package/widgets/Popup.js +1 -1
  161. package/widgets/Print/PrintViewModel.js +1 -1
  162. package/widgets/Print/TemplateOptions.js +1 -1
  163. package/widgets/Print.js +1 -1
  164. package/widgets/ShadowCast.js +1 -1
  165. package/widgets/support/forms/formUtils.js +1 -1
  166. package/assets/esri/core/workers/chunks/0e9bd990a8d0691fb9c8.js +0 -1
  167. package/assets/esri/core/workers/chunks/27933d6ffeebb5c13ab7.js +0 -1
  168. package/assets/esri/core/workers/chunks/3ef5002b21b1a5b97e11.js +0 -1
  169. package/assets/esri/core/workers/chunks/48266c87363e7dcaefb3.js +0 -1
  170. package/assets/esri/core/workers/chunks/5786b190ad3e2d933245.js +0 -1
  171. package/assets/esri/core/workers/chunks/668679baf519ada9ae28.js +0 -1
  172. package/assets/esri/core/workers/chunks/737f381f2cfeddb96d15.js +0 -1
  173. package/assets/esri/core/workers/chunks/84d26c6c805f5855ffd3.js +0 -1
  174. package/assets/esri/core/workers/chunks/8f2f2d497b875e2b4139.js +0 -1
  175. package/assets/esri/core/workers/chunks/a4c8b773283ea8f0e256.js +0 -1
  176. package/assets/esri/core/workers/chunks/a68068b3151a14c4a0ad.js +0 -1
  177. package/assets/esri/core/workers/chunks/ad99308fb9678cdce917.js +0 -1
  178. package/assets/esri/core/workers/chunks/cc427e8f1b17744b6ea4.js +0 -1
  179. package/assets/esri/core/workers/chunks/dd4bd96dfb7f9921b774.js +0 -1
  180. package/assets/esri/core/workers/chunks/e1a03231e24293e66418.js +0 -1
  181. package/assets/esri/core/workers/chunks/fce1158755f959730602.js +0 -1
  182. package/views/2d/layers/features/sources/strategies/chunks/OverrideChunk.js +0 -5
  183. package/views/3d/input/handlers/SingleKey.js +0 -5
  184. package/views/3d/input/handlers/SingleKeyResetHeading.js +0 -5
  185. package/views/3d/input/handlers/SingleKeyResetTilt.js +0 -5
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.32/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../chunks/tslib.es6.js";import"../geometry.js";import{serializationUtilsModuleWrapper as t}from"../applications/KnowledgeStudio/resourceSerializationUtils.js";import a from"../core/Collection.js";import i from"../core/Error.js";import o from"../core/Logger.js";import{getOrCreateMapValue as n}from"../core/MapUtils.js";import{MultiOriginJSONMixin as r}from"../core/MultiOriginJSONSupport.js";import{throwIfAborted as s,isAbortError as l,createAbortError as h}from"../core/promiseUtils.js";import{watch as d,sync as c}from"../core/reactiveUtils.js";import{property as p}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/RandomLCG.js";import{subclass as u}from"../core/accessorSupport/decorators/subclass.js";import{OriginId as y}from"../core/accessorSupport/PropertyOrigin.js";import g from"./Layer.js";import{convertFromGeometry as m}from"./graphics/featureConversionUtils.js";import{IdealEdgeLengthTypeOptions as f}from"./knowledgeGraph/IdealEdgeLengthTypeOptions.js";import{KnowledgeGraphLayerDataManager as L}from"./knowledgeGraph/KnowledgeGraphLayerDataManager.js";import b from"./knowledgeGraph/KnowledgeGraphSublayer.js";import{systemOidFieldName as w,systemOriginIdFieldName as M,systemDestinationIdFieldName as k,systemLayoutGeometryFieldName as C,systemAggregationCountFieldName as T,initializeLayersFromClientData as N}from"./knowledgeGraph/layerUtils.js";import D from"./knowledgeGraph/SessionMemoryStorage.js";import{convertLayoutSettingsInMemoryFormatToAPIFormat as v,convertLayoutTypeToWebSupportedFormat as x,getRelationshipEndNodeIds as S}from"./knowledgeGraph/supportUtils.js";import{BlendLayer as E}from"./mixins/BlendLayer.js";import{OperationalLayer as I}from"./mixins/OperationalLayer.js";import{ScaleRangeLayer as _}from"./mixins/ScaleRangeLayer.js";import{LCChronologicalLayout as A,LCSimpleLayout as j,LCSmartTreeLayout as R,LCRadialTreeLayout as G,LCHierarchicalLayout as P,LCCommunityLayout as F,LCForceDirectedLayout as O,NodeFlag as U,load as B,CallStatus as z,LinkType as W}from"../libs/linkchartlayout/LinkChartLayout.js";import{fetchKnowledgeGraph as Q}from"../rest/knowledgeGraphService.js";import $ from"../geometry/Extent.js";import H from"../geometry/Point.js";import K from"../geometry/Polyline.js";let q=class extends(I(E(_(r(g))))){constructor(e){if(super(e),this.dataPreloadedInLocalCache=!1,this.defaultLinkChartConfig=null,this.membershipModified=!0,this._currentLinkChartConfig={layoutMode:"radial-root-centric"},this._graphTypeLookup=new Map,this.dataManager=null,this.knowledgeGraph=null,this.layers=new(a.ofType(b)),this.entityLinkChartDiagramLookup=new Map,this.relationshipLinkChartDiagramLookup=new Map,this.linkChartExtent=new $({xmin:-1e-7,ymin:-1e-7,xmax:1e-7,ymax:1e-7}),this.memberEntityTypes=null,this.memberRelationshipTypes=null,this.operationalLayerType="LinkChartLayer",this.sublayerIdsCache=new Map,this.tables=new(a.ofType(b)),this.type="link-chart",this.chronologicalAuxiliaryGraphics=null,this._originalInclusionList=e?.inclusionModeDefinition,e?.dataPreloadedInLocalCache&&!e?.inclusionModeDefinition)throw new i("knowledge-graph:linkchart-layer-constructor","If creating a link chart composite layer and configured that data is already loaded in the cache, you must specify an inclusion list so the Composite Layer knows what records belong to it");this.addHandles(d((()=>this.layers.concat(this.tables)),((e,t)=>this._handleSublayersChange(e,t)),c))}normalizeCtorArgs(e){if(!e)return{};const{url:t,title:a,dataPreloadedInLocalCache:i,defaultLinkChartConfig:o}=e;return{url:t,title:a,dataPreloadedInLocalCache:i,defaultLinkChartConfig:o}}_initializeLayerProperties(e){if(!this.title&&this.url){const e=this.url.split("/");this.title=e[e.length-2]}const t=new Set;let a=[],n=[];if(e.inclusionModeDefinition&&(!e.inclusionModeDefinition.namedTypeDefinitions||e.inclusionModeDefinition.namedTypeDefinitions.size<1))throw new i("knowledge-graph:composite-layer-constructor","If an explicit inclusion definition is defined, at least one namedTypeDefinition must also be defined");e.inclusionModeDefinition?.generateAllSublayers?(a=e.knowledgeGraph.dataModel.entityTypes??[],n=e.knowledgeGraph.dataModel.relationshipTypes??[]):e.inclusionModeDefinition?.namedTypeDefinitions&&e.inclusionModeDefinition?.namedTypeDefinitions.size>0?e.inclusionModeDefinition?.namedTypeDefinitions.forEach(((i,r)=>{const s=this._graphTypeLookup.get(r);if(!s)return o.getLogger(this).warn(`A named type, ${r}, was in the inclusion list that wasn't in the data model and will be removed`),void e.inclusionModeDefinition?.namedTypeDefinitions.delete(r);"relationship"===s.type?t.has(r)||(t.add(r),n.push(s)):"entity"===s.type?t.has(r)||(t.add(r),a.push(s)):(o.getLogger(this).warn(`A named type, ${r}, was in the inclusion list that wasn't properly modeled and will be removed`),e.inclusionModeDefinition?.namedTypeDefinitions.delete(r))})):(a=e.knowledgeGraph.dataModel.entityTypes??[],n=e.knowledgeGraph.dataModel.relationshipTypes??[]);const r=new L({knowledgeGraph:e.knowledgeGraph,inclusionModeDefinition:e.inclusionModeDefinition});this.knowledgeGraph=e.knowledgeGraph,this.memberEntityTypes=a,this.memberRelationshipTypes=n,this.dataManager=r}load(e){const a=async()=>{const e=[],t=[];this.loadLayerAssumingLocalCache(),await N(this),this.dataManager.inclusionModeDefinition&&(this.dataManager.inclusionModeDefinition.generateAllSublayers=!1),this.dataManager.inclusionModeDefinition?.namedTypeDefinitions.forEach((e=>{e.useAllData=!1})),await this._initializeDiagram(),this.layers.forEach((a=>{t.push(a.refreshCachedQueryEngine()),e.push(new Promise((e=>{a.on("layerview-create",(()=>{e(null)}))})))})),this.tables.forEach((e=>{t.push(e.refreshCachedQueryEngine())})),await Promise.all(t)};return this.addResolvingPromise(new Promise((i=>{Q(this.url).then((async o=>{o.dataModel.entityTypes?.forEach((e=>{e.name&&this._graphTypeLookup.set(e.name,e)})),o.dataModel.relationshipTypes?.forEach((e=>{e.name&&this._graphTypeLookup.set(e.name,e)}));const r=this.parent?.linkChartProperties;if(r?.originIdOf("entitiesUrl")===y.LINK_CHART&&(this.membershipModified=!1,this._originalInclusionList=await t.fetchAndConvertSerializedLinkChart({entitiesUrl:this.parent.linkChartProperties.entitiesUrl,relationshipsUrl:this.parent.linkChartProperties.relationshipsUrl}),this._alignLayersDataModelAndInclusionDefinition(o.dataModel),this.defaultLinkChartConfig={layoutOptions:r?.layoutSettings?v(r.layoutSettings,void 0):void 0,layoutMode:x(r.layoutType)}),this._initializeLayerProperties({knowledgeGraph:o,inclusionModeDefinition:this._originalInclusionList}),this.dataManager.inclusionModeDefinition?.namedTypeDefinitions?.size||(this.dataManager.inclusionModeDefinition={generateAllSublayers:!1,namedTypeDefinitions:new Map},this.dataManager.knowledgeGraph.dataModel.entityTypes?.forEach((e=>{e.name&&this.dataManager.inclusionModeDefinition?.namedTypeDefinitions.set(e.name,{useAllData:!0})})),this.dataManager.knowledgeGraph.dataModel.relationshipTypes?.forEach((e=>{e.name&&this.dataManager.inclusionModeDefinition?.namedTypeDefinitions.set(e.name,{useAllData:!0})}))),this.dataPreloadedInLocalCache){const e=D.getInstance();for(const[t,a]of this.dataManager.inclusionModeDefinition?.namedTypeDefinitions??[])for(const i of a.members?.values()??[]){const a=e.readFromStoreById(`${t}__${i.id}`);if(a){n(this.dataManager.sublayerCaches,t,(()=>new Map)).set(i.id,a)}}await a()}else{const t="geographic-organic-standard"===this.defaultLinkChartConfig?.layoutMode;this.addResolvingPromise(this.dataManager.refreshCacheContent(void 0,!1,t,!0).then((async()=>{s(e),await a()})))}i(null)}))}))),Promise.resolve(this)}set inclusionModeDefinition(e){"loaded"!==this.loadStatus&&"failed"!==this.loadStatus?this._set("inclusionModeDefinition",e):o.getLogger(this).error("#inclusionModeDefinition","inclusionModeDefinition cannot be changed after the layer is loaded.")}async addRecords(e,t){let a=[];t?.cascadeAddRelationshipEndNodes&&this.dataManager.knowledgeGraph.dataModel&&(a=await S(e,this.dataManager.knowledgeGraph));const i=e.concat(a).filter((e=>!this.sublayerIdsCache.get(e.typeName)?.has(e.id)));i.length>0&&(this.membershipModified=!0),await this._handleNewRecords(i,t)}async removeRecords(e,{cascadeRemoveRelationships:t=!0,recalculateLayout:a=!1,overrideMembershipCheck:i=!1}={cascadeRemoveRelationships:!0,recalculateLayout:!1,overrideMembershipCheck:!1}){let o=[];for(const r of e)(i||!1===this.dataManager.inclusionModeDefinition?.namedTypeDefinitions?.get(r.typeName)?.useAllData&&this.dataManager.inclusionModeDefinition?.namedTypeDefinitions?.get(r.typeName)?.members?.has(r.id))&&o.push(r);if(t){const e=new Set,t=[];for(const a of o)if(this.dataManager.nodeConnectionsLookup.has(a.id))for(const t of this.dataManager.nodeConnectionsLookup.get(a.id))e.add(t);for(const a of e)if(this.dataManager.memberIdTypeLookup.has(a))for(const e of this.dataManager.memberIdTypeLookup.get(a))this.dataManager.relationshipTypeNames.has(e)&&t.push({id:a,typeName:e});o=o.concat(t)}this.dataManager.removeFromLayer(o);for(const r of o)this.sublayerIdsCache.get(r.typeName)?.delete(r.id),this.dataManager.relationshipTypeNames.has(r.typeName)?this.relationshipLinkChartDiagramLookup.delete(r.id):this.entityLinkChartDiagramLookup.delete(r.id);a&&await this._calculateLayoutWithSublayerTimeInfo(this._currentLinkChartConfig.layoutMode,this._currentLinkChartConfig.layoutOptions),o.length>0&&(this.membershipModified=!0);const n=[];return this.layers.forEach((e=>{n.push(e.refreshCachedQueryEngine())})),await Promise.all(n),this._refreshNamedTypes(),o}async expand(e,t){let a=[];try{const i=await this.dataManager.getConnectedRecordIds(e,t?.relationshipTypeNames,t);a=i.filter((e=>!this.sublayerIdsCache.get(e.typeName)?.has(e.id))),await this._handleNewRecords(i,t),i.length>0&&(this.membershipModified=!0),s(t?.signal)}catch(i){throw l(i)&&a.length>0&&this.removeRecords(a,{overrideMembershipCheck:!0}),i}return{records:a}}loadLayerAssumingLocalCache(){const e=[...this.memberRelationshipTypes,...this.memberEntityTypes];this.originIdOf("layers")===y.DEFAULTS?this._createSublayers(e,this.layers,(e=>!!e.geometryType)):this._updateSublayers(e,this.layers),this.originIdOf("tables")===y.DEFAULTS?this._createSublayers(e,this.tables,(e=>!e.geometryType)):this._updateSublayers(e,this.tables),this.dataManager.inclusionModeDefinition?.namedTypeDefinitions?.forEach(((e,t)=>{const a=n(this.sublayerIdsCache,t,(()=>new Set));e.members?.forEach((({id:e,linkChartLocation:i})=>{if(a.add(e),i){const a="coords"in i&&"lengths"in i?i:m(i);this.dataManager.relationshipTypeNames.has(t)?this.relationshipLinkChartDiagramLookup.set(e,a):this.entityLinkChartDiagramLookup.set(e,a)}}))}))}async calculateLinkChartLayout(e="radial-root-centric",t){const a=[],r=[],l=[];this.dataManager.sublayerCaches.forEach(((e,t)=>{this.dataManager.entityTypeNames.has(t)?e.forEach((e=>{a.push({typeName:t,feature:e})})):this.dataManager.relationshipTypeNames.has(t)&&e.forEach((e=>{r.push({typeName:t,feature:e})}))})),this.entityLinkChartDiagramLookup=new Map,this.relationshipLinkChartDiagramLookup=new Map;const d=new Map,c=new Map,p=new Map,u=new Map,y=new Uint8Array(a.length),g=new Float64Array(a.length),f=new Float64Array(a.length),L=new Float64Array(a.length),b=new Float64Array(a.length),N=new Uint32Array(r.length),D=new Uint32Array(r.length),v=new Float64Array(r.length),x=new Float64Array(r.length),S=[],E="organic-standard",I=new $({xmin:-1e-7,ymin:-1e-7,xmax:1e-7,ymax:1e-7});let _,Q="organic-standard",q=0,J=0;const V=A.apply;switch(Q="geographic-organic-standard"===e?E:e,Q){case"organic-standard":_=O.apply;break;case"organic-community":_=F.apply;break;case"hierarchical-bottom-to-top":_=P.apply;break;case"radial-root-centric":_=G.apply;break;case"tree-left-to-right":_=R.apply;break;default:_=j.apply}let X=!1;a.forEach((({typeName:a,feature:i})=>{if("chronological-mono-timeline"!==e&&"chronological-multi-timeline"!==e&&t?.lockedNodeLocations?.has(i.attributes[w])){"geographic-organic-standard"===e&&this.dataManager.geographicLookup.has(a)?y[q]=U.IsGeographic:y[q]=U.None;const o=t.lockedNodeLocations.get(i.attributes[w]);g[q]=o.x,f[q]=o.y}else if("geographic-organic-standard"===e&&this.dataManager.geographicLookup.has(a)){y[q]=U.IsGeographic;let e=null;const t=i.attributes[this.dataManager.geographicLookup.get(a).name],o=this.dataManager.geographicLookup.get(a)?.geometryType;switch(o){case"esriGeometryPoint":g[q]=t?.x,f[q]=t?.y;break;case"esriGeometryPolygon":e=t?.centroid,null!=e?.x&&null!=e?.y?(g[q]=e.x,f[q]=e.y):y[q]=U.IsMovable;break;case"esriGeometryPolyline":case"esriGeometryMultipoint":e=t?.extent?.center,null!=e?.x&&null!=e?.y?(g[q]=e.x,f[q]=e.y):y[q]=U.IsMovable;break;default:y[q]=U.IsMovable}(null==g[q]||null==f[q]||Number.isNaN(g[q])||Number.isNaN(f[q]))&&(y[q]=U.IsMovable,g[q]=0,f[q]=0)}else if("chronological-mono-timeline"===e||"chronological-multi-timeline"===e){!X&&t?.lockedNodeLocations?.has(i.attributes[w])&&(X=!0);const e=t?.timeInfoByTypeName?.get(a),o=e?.startField,n=o&&e?.startField?i.attributes[o]:null;L[q]=n?new Date(n).getTime():NaN;const r=e?.endField,s=r&&e?.endField?i.attributes[r]:null;b[q]=s?new Date(s).getTime():NaN,g[q]=0,f[q]=0,y[q]=U.IsMovable}else y[q]=U.IsMovable,g[q]=0,f[q]=0;u.set(i.attributes[w],q),S[q]={feature:i,typeName:a},q++})),X&&o.getLogger(this).warn("Locked node locations are not supported for chronological layout at this time. Requested node locations were ignored");let Y=!1;const Z=new Map;r.forEach((a=>{const i=a.feature.attributes[M],o=a.feature.attributes[k],n=u.get(i),r=u.get(o),s=t?.timeInfoByTypeName?.get(a.typeName),h=t?.timeInfoByTypeName?s?.startField:null,d=h?a.feature.attributes[h]:null,c=s?.endField,p=c?a.feature.attributes[c]:null;if(void 0!==n&&void 0!==r){let t=i+"-"+o;"chronological-mono-timeline"!==e&&"chronological-multi-timeline"!==e||(t=t+"-"+d+"-"+p);const s=Z.get(t),h=s?.has(a.typeName);h||(N[J]=n,D[J]=r,"chronological-mono-timeline"!==e&&"chronological-multi-timeline"!==e||(v[J]=d?new Date(d).getTime():NaN,x[J]=p?new Date(p).getTime():NaN),void 0===s?Z.set(t,new Map([[a.typeName,J]])):s.set(a.typeName,J),J++),l.push(a)}else Y=!0,this.relationshipLinkChartDiagramLookup.set(i,null)})),Y&&o.getLogger(this).warn("A relationship is a member of this layer that has either origin or destination entity nodes that are not members. The diagram geometry will be set to null");const ee=this._validateLayoutSettings(e,t),te=this._convertLayoutSettingsToCalculationSettings(ee);await B();let ae=z.Error,ie=null;if("chronological-mono-timeline"===e||"chronological-multi-timeline"===e){let a;({status:ae,links:ie,graphics:a}=V((()=>t?.signal?.aborted??!1),y,g,f,L,b,N.subarray(0,J),D.subarray(0,J),v.subarray(0,J),x.subarray(0,J),"chronological-multi-timeline"===e,t?.chronologicalLayoutSettings??{})),ae===z.Success&&(this.chronologicalAuxiliaryGraphics=a)}else({status:ae,links:ie}=_((()=>t?.signal?.aborted??!1),y,g,f,N.subarray(0,J),D.subarray(0,J),te.computationBudgetTime,te.idealEdgeLengthMultiplier,te.repulsionRadiusMultiplier));if(s(t?.signal),ae===z.Error)throw new i("knowledge-graph:layout-failed","Attempting to arrange the records in the specified layout failed");if(ae===z.Canceled)throw h();for(let i=0;i<S.length;i++){if(f[i]>84.9999?f[i]=84.9999:f[i]<-84.9999&&(f[i]=-84.9999),g[i]>179.9999?g[i]=179.9999:g[i]<-179.9999&&(g[i]=-179.9999),S[i].feature.attributes[C]=new H(g[i],f[i]),d.has(S[i].typeName)){const e=d.get(S[i].typeName);e?.set(S[i].feature.attributes[w],S[i].feature)}else{const e=new Map;e.set(S[i].feature.attributes[w],S[i].feature),d.set(S[i].typeName,e)}p.set(S[i].feature.attributes[w],S[i].feature);const e=m(S[i].feature.attributes[C]);this.entityLinkChartDiagramLookup.set(S[i].feature.attributes[w],S[i].feature.attributes[C]?e:null);const t=n(this.dataManager.inclusionModeDefinition.namedTypeDefinitions,S[i].typeName,(()=>({useAllData:!1,members:new Map})));n(t.members,S[i].feature.attributes[w],(()=>({id:S[i].feature.attributes[w],linkChartLocation:void 0}))).linkChartLocation=S[i].feature.attributes[C],S[i].feature.attributes[C].x<I.xmin&&(I.xmin=S[i].feature.attributes[C].x),S[i].feature.attributes[C].x>I.xmax&&(I.xmax=S[i].feature.attributes[C].x),S[i].feature.attributes[C].y<I.ymin&&(I.ymin=S[i].feature.attributes[C].y),S[i].feature.attributes[C].y>I.ymax&&(I.ymax=S[i].feature.attributes[C].y)}if(this.linkChartExtent.xmin=I.xmin,this.linkChartExtent.xmax=I.xmax,this.linkChartExtent.ymin=I.ymin,this.linkChartExtent.ymax=I.ymax,!ie)throw new i("knowledge-graph:layout-failed","Attempting to retrieve link geometry from diagram engine failed");const oe=new Map,ne=new Map,re=new Map,se=new Set;for(let i=0;i<l.length;i++){const a=[],r=l[i],s=r.feature.attributes[M],h=r.feature.attributes[k];let d=s+"-"+h;if("chronological-mono-timeline"===e||"chronological-multi-timeline"===e){const e=t?.timeInfoByTypeName?.get(r.typeName),a=t?.timeInfoByTypeName?e?.startField:null,i=a?r.feature.attributes[a]:null,o=e?.endField;d+="-"+i+"-"+(o?r.feature.attributes[o]:null)}const y=Z.get(d).get(r.typeName),g=0===y?0:ie?.vertexEndIndex[y-1];if(!se.has(y)){if(se.add(y),ie.types[y]===W.Recursive){const e=[ie.vertices[2*g],ie.vertices[2*g+1]],t=[ie.vertices[2*(g+1)],ie.vertices[2*(g+1)+1]],i=[.5*(e[0]+t[0]),.5*(e[1]+t[1])],o=[i[0]-e[0],i[1]-e[1]],n=[i[0]+o[1],i[1]-o[0]],r=[i[0]-o[1],i[1]+o[0]];a.push(e),a.push(n),a.push(t),a.push(r),a.push(e)}else{if(ie.types[y]!==W.Regular){o.getLogger(this).warn("A relationship generated an unsupported link geometry type. It will not be rendered");continue}for(let e=g;e<ie.vertexEndIndex[y];e++)a.push([ie.vertices[2*e],ie.vertices[2*e+1]])}if("chronological-mono-timeline"!==e&&"chronological-multi-timeline"!==e){const e=S[u.get(s)]?.feature.attributes[C],t=S[u.get(h)]?.feature.attributes[C];a[0][0]===e.x&&a[0][1]===e.y||(a[0]=[e.x,e.y]),a[a.length-1][0]===t.x&&a[a.length-1][1]===t.y||(a[a.length-1]=[t.x,t.y])}for(let e=1;e<a.length-1;e++)a[e][1]>85.5?a[e][1]=85.5:a[e][1]<-85.5&&(a[e][1]=-85.5),a[e][0]>179.9999?a[e][0]=179.9999:a[e][0]<-179.9999&&(a[e][0]=-179.9999);oe.has(d)?oe.get(d).push(a):oe.set(d,[a])}const f=oe.get(d);ne.has(d)||(ne.set(d,new Map),re.set(d,new Map));const L=ne.get(d),b=re.get(d);L.has(r.typeName)||(L.set(r.typeName,f.shift()),b.set(r.typeName,0));const T=L.get(r.typeName);b.set(r.typeName,b.get(r.typeName)+1);const N=new K({paths:[T]});if(r.feature.attributes[C]=N,c.has(r.typeName)){const e=c.get(r.typeName);e?.set(r.feature.attributes[w],r.feature)}else{const e=new Map;e.set(r.feature.attributes[w],r.feature),c.set(r.typeName,e)}p.set(r.feature.attributes[w],r.feature);const D=m(r.feature.attributes[C]);this.relationshipLinkChartDiagramLookup.set(r.feature.attributes[w],r.feature.attributes[C]?D:null);const v=n(this.dataManager.inclusionModeDefinition.namedTypeDefinitions,r.typeName,(()=>({useAllData:!1,members:new Map})));n(v.members,r.feature.attributes[w],(()=>({id:r.feature.attributes[w],linkChartLocation:void 0}))).linkChartLocation=r.feature.attributes[C]}for(const i of l)i.feature.attributes[T]=re.get(i.feature.attributes[M]+"-"+i.feature.attributes[k])?.get(i.typeName)??null;return this._currentLinkChartConfig={layoutMode:e,layoutOptions:ee},{nodes:d,links:c,idMap:p}}async applyNewLinkChartLayout(e="radial-root-centric",t){const a=[];await this._calculateLayoutWithSublayerTimeInfo(e,t),this.layers.forEach((e=>{a.push(e.refreshCachedQueryEngine())})),this.membershipModified=!0,await Promise.all(a),this._refreshNamedTypes()}getCurrentNodeLocations(){const e=new Map;for(const[t,a]of this.dataManager.inclusionModeDefinition?.namedTypeDefinitions.entries()??[])this.dataManager.relationshipTypeNames.has(t)||a?.members?.forEach((t=>{const a=t.linkChartLocation;let i;const o=t.id;a&&(i="x"in a?{x:a.x,y:a.y}:{x:a.coords[0],y:a.coords[1]},e.set(o,new H({x:i.x,y:i.y})))}));return e}async refreshLinkChartCache(e){await this.dataManager.refreshCacheContent(e);const t=[];this.layers.forEach((e=>{t.push(e.refreshCachedQueryEngine())})),await Promise.all(t),this._refreshNamedTypes()}async connectBetweenEntities(e,t){if(!e.length)return{records:[]};let a=[];try{let i=[];for(const e of this.dataManager.relationshipTypeNames){const t=this.sublayerIdsCache.get(e);t&&(i=i.concat(Array.from(t.keys())))}a=await this.dataManager.getRelationshipsBetweenNodes(e,i,t),await this._handleNewRecords(a,t),s(t)}catch(i){throw l(i)&&this.removeRecords(a),i}return{records:a}}async connectFromEntities(e,t){if(!e.length)return{records:[]};let a=[];try{let i=[];for(const e of this.dataManager.relationshipTypeNames){const t=this.sublayerIdsCache.get(e);t&&(i=i.concat(Array.from(t.keys())))}let o=[];for(const e of this.dataManager.entityTypeNames){const t=this.sublayerIdsCache.get(e);t&&(o=o.concat(Array.from(t)))}a=await this.dataManager.getRelationshipsFromNodes(e,o,i,t),await this._handleNewRecords(a,t),a.length>0&&(this.membershipModified=!0),s(t)}catch(i){throw l(i)&&this.removeRecords(a),i}return{records:a}}getCurrentLayout(){return this._currentLinkChartConfig.layoutMode}async _calculateLayoutWithSublayerTimeInfo(e="radial-root-centric",t){const a=new Map;this.layers.forEach((e=>{a.set(e.objectType.name,e.timeInfo)})),await this.calculateLinkChartLayout(e,{timeInfoByTypeName:a,...t})}async _handleNewRecords(e,t){const a=[];this.dataManager.addToLayer(e);for(const o of e)this.sublayerIdsCache.has(o.typeName)||(this.sublayerIdsCache.set(o.typeName,new Set),a.push(o.typeName)),this.sublayerIdsCache.get(o.typeName).add(o.id);for(const o of a){const e=this._graphTypeLookup.get(o);if(e){const t=this._createSublayer(e);"entity"===e.type?this.dataManager.entityTypeNames.add(o):this.dataManager.relationshipTypeNames.add(o),t.geometryType?this.layers.push(t):this.tables.push(t),this.dataManager.sublayerCaches.set(o,new Map)}}await N(this,a,t),await this.dataManager.refreshCacheContent(e.map((e=>e.id)),void 0,void 0,void 0,t);const i=Object.assign({},this._currentLinkChartConfig.layoutOptions);i.lockedNodeLocations=new Map;for(const[o,n]of this.entityLinkChartDiagramLookup.entries())n&&i.lockedNodeLocations.set(o,new H(n.coords[0],n.coords[1]));await this.applyNewLinkChartLayout(this._currentLinkChartConfig.layoutMode,i)}_createSublayers(e,t,a){e.forEach((e=>{const i=this._createSublayer(e);a(i)&&t.push(i),this._updateSublayerCaches(e)}))}_updateSublayers(e,t){t.forEach((t=>{t.parentCompositeLayer=this;const a=e.find((e=>e.type===t.graphType&&e.name===t.graphTypeName));a&&(t.objectType=a,t.read({title:a.name},{origin:"service"}),this._updateSublayerCaches(a))}))}_updateSublayerCaches(e){const t=this.dataManager.sublayerCaches;t.has(e.name)||t.set(e.name,new Map)}async _initializeDiagram(){this.defaultLinkChartConfig?this.defaultLinkChartConfig.doNotRecalculateLayout?(this.dataManager.inclusionModeDefinition?.namedTypeDefinitions?.forEach(((e,t)=>{e?.members?.forEach((e=>{const a=e.linkChartLocation;let i;const o=e.id;if(!a)return;i="x"in a?{x:a.x,y:a.y}:{x:a.coords[0],y:a.coords[1]};const n=m(i);this.dataManager.relationshipTypeNames.has(t)?this.relationshipLinkChartDiagramLookup.set(o,n):this.entityLinkChartDiagramLookup.set(o,n),this.linkChartExtent.xmin>i.x&&(this.linkChartExtent.xmin=i.x),this.linkChartExtent.xmax<i.x&&(this.linkChartExtent.xmax=i.x),this.linkChartExtent.ymin>i.y&&(this.linkChartExtent.ymin=i.y),this.linkChartExtent.ymax<i.y&&(this.linkChartExtent.ymax=i.y)}))})),this.memberRelationshipTypes.forEach((e=>{e.name&&this.dataManager.sublayerCaches.get(e.name)?.forEach((e=>{const t=this.relationshipLinkChartDiagramLookup.get(e.attributes[M]),a=this.relationshipLinkChartDiagramLookup.get(e.attributes[k]);if(t&&a){const i=m(new K({paths:[[[t.coords[0],t.coords[1]],[a.coords[0],a.coords[1]]]]}));this.relationshipLinkChartDiagramLookup.set(e.attributes[w],i)}else this.relationshipLinkChartDiagramLookup.set(e.attributes[w],null)}))}))):await this._calculateLayoutWithSublayerTimeInfo(this.defaultLinkChartConfig.layoutMode,{lockedNodeLocations:this.getCurrentNodeLocations(),...this.defaultLinkChartConfig.layoutOptions||{}}):await this._calculateLayoutWithSublayerTimeInfo("radial-root-centric",{lockedNodeLocations:this.getCurrentNodeLocations()})}_refreshNamedTypes(){for(const e of this.layers)e.emit("refresh",{dataChanged:!0});for(const e of this.tables)e.emit("refresh",{dataChanged:!0})}_validateLayoutSettings(e,t){const a=e=>"number"==typeof e&&!isNaN(e),i=e=>a(e)&&e>=1,n=e=>a(e)&&e>=1,r=e=>Object.values(f).includes(e),s=e=>a(e)&&e>=0,l={organicLayoutSettings:{},chronologicalLayoutSettings:{}};if(!new Set(["organic-standard","organic-community","geographic-organic-standard","chronological-multi-timeline","chronological-mono-timeline"]).has(e)||!t)return l;t.organicLayoutSettings??={};const{computationBudgetTime:h,repulsionRadiusMultiplier:d,idealEdgeLength:c,idealEdgeLengthType:p}=t.organicLayoutSettings;n(h)?l.organicLayoutSettings.computationBudgetTime=h:void 0!==h&&o.getLogger(this).warn("Invalid layout computationBudgetTime setting, will revert to default setting"),i(d)?l.organicLayoutSettings.repulsionRadiusMultiplier=d:void 0!==d&&o.getLogger(this).warn("Invalid layout repulsionRadiusMultiplier setting, will revert to default setting");if("geographic-organic-standard"===e&&(void 0!==c||void 0!==p)&&(r(p)?l.organicLayoutSettings.idealEdgeLengthType=p:void 0!==p&&o.getLogger(this).warn('Invalid layout idealEdgeLengthType setting, will revert to "multiplier" setting'),s(c)?l.organicLayoutSettings.idealEdgeLength=c:void 0!==c&&o.getLogger(this).warn("Invalid layout idealEdgeLength setting, will revert to default setting")),("chronological-multi-timeline"===e||"chronological-mono-timeline"===e)&&t.chronologicalLayoutSettings){const e=t.chronologicalLayoutSettings;e.durationLineWidth&&e.durationLineWidth<0&&o.getLogger(this).warn("Invalid layout durationLineWidth setting, will revert to default setting")}return l}_convertLayoutSettingsToCalculationSettings(e){e.organicLayoutSettings??={};let t=e.organicLayoutSettings.idealEdgeLength;return e.organicLayoutSettings.idealEdgeLengthType===f.ABSOLUTE&&(void 0===t?t=-1:t*=-1),{computationBudgetTime:e.organicLayoutSettings.computationBudgetTime,repulsionRadiusMultiplier:e.organicLayoutSettings.repulsionRadiusMultiplier,idealEdgeLengthMultiplier:t}}_createSublayer(e){return new b({objectType:e,parentCompositeLayer:this,graphType:e.type})}_handleSublayersChange(e,t){t&&(t.forEach((e=>{e.parent=null})),this.removeHandles("sublayers-owner")),e&&(e.forEach((e=>{e.parent=this})),this.addHandles([e.on("after-add",(({item:e})=>{e.parent=this})),e.on("after-remove",(({item:e})=>{e.parent=null}))],"sublayers-owner"))}_alignLayersDataModelAndInclusionDefinition(e){const t=new Set((e.entityTypes??[]).map((e=>e.name)).concat((e.relationshipTypes??[]).map((e=>e.name)))),i=new Set((e.entityTypes??[]).map((e=>e.name))),n=new Set((e.relationshipTypes??[]).map((e=>e.name)));if(this.layers){for(const e of this.layers)!e.graphType&&t.has(e.graphTypeName)&&(e.graphType=i.has(e.graphTypeName)?"entity":"relationship");this.layers=this.layers.filter((e=>t.has(e.graphTypeName)&&("entity"===e.graphType?i.has(e.graphTypeName):n.has(e.graphTypeName))))}else this.layers=new a;if(this.layers&&this._originalInclusionList){const e=new Set(this._originalInclusionList.namedTypeDefinitions.keys()),t=this.tables?.map((e=>e.graphTypeName))??[],a=this.layers.map((e=>e.graphTypeName)).concat(t);for(const o of a)e.has(o)||this._originalInclusionList.namedTypeDefinitions.set(o,{useAllData:!1,members:new Map});const i=[];for(const n of this._originalInclusionList.namedTypeDefinitions.keys())a.includes(n)||(o.getLogger(this).warn(`A named type, ${n}, was in the serialized feature collection but did not have a sublayer config in the item, so will be removed`),i.push(n));for(const o of i)this._originalInclusionList.namedTypeDefinitions.delete(o)}}};e([p()],q.prototype,"dataPreloadedInLocalCache",void 0),e([p()],q.prototype,"defaultLinkChartConfig",void 0),e([p()],q.prototype,"membershipModified",void 0),e([p()],q.prototype,"dataManager",void 0),e([p()],q.prototype,"inclusionModeDefinition",null),e([p()],q.prototype,"knowledgeGraph",void 0),e([p({type:a.ofType(b),json:{write:{ignoreOrigin:!0}}})],q.prototype,"layers",void 0),e([p()],q.prototype,"entityLinkChartDiagramLookup",void 0),e([p()],q.prototype,"relationshipLinkChartDiagramLookup",void 0),e([p()],q.prototype,"linkChartExtent",void 0),e([p()],q.prototype,"memberEntityTypes",void 0),e([p()],q.prototype,"memberRelationshipTypes",void 0),e([p({type:["LinkChartLayer"]})],q.prototype,"operationalLayerType",void 0),e([p()],q.prototype,"sublayerIdsCache",void 0),e([p({type:a.ofType(b),json:{write:{ignoreOrigin:!0}}})],q.prototype,"tables",void 0),e([p({json:{read:!1}})],q.prototype,"type",void 0),e([p({json:{read:!1}})],q.prototype,"chronologicalAuxiliaryGraphics",void 0),q=e([u("esri.layers.LinkChartLayer")],q);const J=q;export{J as default};
5
+ import{_ as e}from"../chunks/tslib.es6.js";import"../geometry.js";import{serializationUtilsModuleWrapper as t}from"../applications/KnowledgeStudio/resourceSerializationUtils.js";import a from"../core/Collection.js";import i from"../core/Error.js";import o from"../core/Logger.js";import{getOrCreateMapValue as n}from"../core/MapUtils.js";import{MultiOriginJSONMixin as r}from"../core/MultiOriginJSONSupport.js";import{throwIfAborted as s,isAbortError as l,createAbortError as h}from"../core/promiseUtils.js";import{watch as d,sync as c}from"../core/reactiveUtils.js";import{property as p}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/RandomLCG.js";import{subclass as u}from"../core/accessorSupport/decorators/subclass.js";import{OriginId as g}from"../core/accessorSupport/PropertyOrigin.js";import y from"./Layer.js";import{convertFromGeometry as m}from"./graphics/featureConversionUtils.js";import{IdealEdgeLengthTypeOptions as f}from"./knowledgeGraph/IdealEdgeLengthTypeOptions.js";import{KnowledgeGraphLayerDataManager as L}from"./knowledgeGraph/KnowledgeGraphLayerDataManager.js";import b from"./knowledgeGraph/KnowledgeGraphSublayer.js";import{systemOidFieldName as w,systemOriginIdFieldName as M,systemDestinationIdFieldName as k,systemLayoutGeometryFieldName as C,systemAggregationCountFieldName as T,initializeLayersFromClientData as N}from"./knowledgeGraph/layerUtils.js";import v from"./knowledgeGraph/SessionMemoryStorage.js";import{convertLayoutTypeToWebSupportedFormat as D,getRelationshipEndNodeIds as x}from"./knowledgeGraph/supportUtils.js";import{BlendLayer as S}from"./mixins/BlendLayer.js";import{OperationalLayer as E}from"./mixins/OperationalLayer.js";import{ScaleRangeLayer as I}from"./mixins/ScaleRangeLayer.js";import{LCChronologicalLayout as _,LCSimpleLayout as A,LCSmartTreeLayout as j,LCRadialTreeLayout as R,LCHierarchicalLayout as G,LCCommunityLayout as P,LCForceDirectedLayout as F,NodeFlag as U,load as B,CallStatus as O,LinkType as z}from"../libs/linkchartlayout/LinkChartLayout.js";import{fetchKnowledgeGraph as W}from"../rest/knowledgeGraphService.js";import Q from"../geometry/Extent.js";import $ from"../geometry/Point.js";import H from"../geometry/Polyline.js";let K=class extends(E(S(I(r(y))))){constructor(e){if(super(e),this.dataPreloadedInLocalCache=!1,this.defaultLinkChartConfig=null,this.membershipModified=!0,this._currentLinkChartConfig={layoutMode:"radial-root-centric"},this._graphTypeLookup=new Map,this.dataManager=null,this.knowledgeGraph=null,this.layers=new(a.ofType(b)),this.entityLinkChartDiagramLookup=new Map,this.relationshipLinkChartDiagramLookup=new Map,this.linkChartExtent=new Q({xmin:-1e-7,ymin:-1e-7,xmax:1e-7,ymax:1e-7}),this.memberEntityTypes=null,this.memberRelationshipTypes=null,this.operationalLayerType="LinkChartLayer",this.sublayerIdsCache=new Map,this.tables=new(a.ofType(b)),this.type="link-chart",this.chronologicalAuxiliaryGraphics=null,this._originalInclusionList=e?.inclusionModeDefinition,e?.dataPreloadedInLocalCache&&!e?.inclusionModeDefinition)throw new i("knowledge-graph:linkchart-layer-constructor","If creating a link chart composite layer and configured that data is already loaded in the cache, you must specify an inclusion list so the Composite Layer knows what records belong to it");this.addHandles(d((()=>this.layers.concat(this.tables)),((e,t)=>this._handleSublayersChange(e,t)),c))}normalizeCtorArgs(e){if(!e)return{};const{url:t,title:a,dataPreloadedInLocalCache:i,defaultLinkChartConfig:o}=e;return{url:t,title:a,dataPreloadedInLocalCache:i,defaultLinkChartConfig:o}}_initializeLayerProperties(e){if(!this.title&&this.url){const e=this.url.split("/");this.title=e[e.length-2]}const t=new Set;let a=[],n=[];if(e.inclusionModeDefinition&&(!e.inclusionModeDefinition.namedTypeDefinitions||e.inclusionModeDefinition.namedTypeDefinitions.size<1))throw new i("knowledge-graph:composite-layer-constructor","If an explicit inclusion definition is defined, at least one namedTypeDefinition must also be defined");e.inclusionModeDefinition?.generateAllSublayers?(a=e.knowledgeGraph.dataModel.entityTypes??[],n=e.knowledgeGraph.dataModel.relationshipTypes??[]):e.inclusionModeDefinition?.namedTypeDefinitions&&e.inclusionModeDefinition?.namedTypeDefinitions.size>0?e.inclusionModeDefinition?.namedTypeDefinitions.forEach(((i,r)=>{const s=this._graphTypeLookup.get(r);if(!s)return o.getLogger(this).warn(`A named type, ${r}, was in the inclusion list that wasn't in the data model and will be removed`),void e.inclusionModeDefinition?.namedTypeDefinitions.delete(r);"relationship"===s.type?t.has(r)||(t.add(r),n.push(s)):"entity"===s.type?t.has(r)||(t.add(r),a.push(s)):(o.getLogger(this).warn(`A named type, ${r}, was in the inclusion list that wasn't properly modeled and will be removed`),e.inclusionModeDefinition?.namedTypeDefinitions.delete(r))})):(a=e.knowledgeGraph.dataModel.entityTypes??[],n=e.knowledgeGraph.dataModel.relationshipTypes??[]);const r=new L({knowledgeGraph:e.knowledgeGraph,inclusionModeDefinition:e.inclusionModeDefinition});this.knowledgeGraph=e.knowledgeGraph,this.memberEntityTypes=a,this.memberRelationshipTypes=n,this.dataManager=r}load(e){const a=async()=>{const e=[],t=[];this.loadLayerAssumingLocalCache(),await N(this),this.dataManager.inclusionModeDefinition&&(this.dataManager.inclusionModeDefinition.generateAllSublayers=!1),this.dataManager.inclusionModeDefinition?.namedTypeDefinitions.forEach((e=>{e.useAllData=!1})),await this._initializeDiagram(),this.layers.forEach((a=>{t.push(a.refreshCachedQueryEngine()),e.push(new Promise((e=>{a.on("layerview-create",(()=>{e(null)}))})))})),this.tables.forEach((e=>{t.push(e.refreshCachedQueryEngine())})),await Promise.all(t)};return this.addResolvingPromise(new Promise((i=>{W(this.url).then((async o=>{o.dataModel.entityTypes?.forEach((e=>{e.name&&this._graphTypeLookup.set(e.name,e)})),o.dataModel.relationshipTypes?.forEach((e=>{e.name&&this._graphTypeLookup.set(e.name,e)}));const r=this.parent?.linkChartProperties;if(r?.originIdOf("entitiesUrl")===g.LINK_CHART&&(this.membershipModified=!1,this._originalInclusionList=await t.fetchAndConvertSerializedLinkChart({entitiesUrl:this.parent.linkChartProperties.entitiesUrl,relationshipsUrl:this.parent.linkChartProperties.relationshipsUrl}),this._alignLayersDataModelAndInclusionDefinition(o.dataModel),this.defaultLinkChartConfig={layoutSettings:r?.layoutSettings??void 0,layoutMode:D(r.layoutType)}),this._initializeLayerProperties({knowledgeGraph:o,inclusionModeDefinition:this._originalInclusionList}),this.dataManager.inclusionModeDefinition?.namedTypeDefinitions?.size||(this.dataManager.inclusionModeDefinition={generateAllSublayers:!1,namedTypeDefinitions:new Map},this.dataManager.knowledgeGraph.dataModel.entityTypes?.forEach((e=>{e.name&&this.dataManager.inclusionModeDefinition?.namedTypeDefinitions.set(e.name,{useAllData:!0})})),this.dataManager.knowledgeGraph.dataModel.relationshipTypes?.forEach((e=>{e.name&&this.dataManager.inclusionModeDefinition?.namedTypeDefinitions.set(e.name,{useAllData:!0})}))),this.dataPreloadedInLocalCache){const e=v.getInstance();for(const[t,a]of this.dataManager.inclusionModeDefinition?.namedTypeDefinitions??[])for(const i of a.members?.values()??[]){const a=e.readFromStoreById(`${t}__${i.id}`);if(a){n(this.dataManager.sublayerCaches,t,(()=>new Map)).set(i.id,a)}}await a()}else{const t="geographic-organic-standard"===this.defaultLinkChartConfig?.layoutMode;this.addResolvingPromise(this.dataManager.refreshCacheContent(void 0,!1,t,!0).then((async()=>{s(e),await a()})))}i(null)}))}))),Promise.resolve(this)}set inclusionModeDefinition(e){"loaded"!==this.loadStatus&&"failed"!==this.loadStatus?this._set("inclusionModeDefinition",e):o.getLogger(this).error("#inclusionModeDefinition","inclusionModeDefinition cannot be changed after the layer is loaded.")}async addRecords(e,t){let a=[];t?.cascadeAddRelationshipEndNodes&&this.dataManager.knowledgeGraph.dataModel&&(a=await x(e,this.dataManager.knowledgeGraph));const i=e.concat(a).filter((e=>!this.sublayerIdsCache.get(e.typeName)?.has(e.id)));i.length>0&&(this.membershipModified=!0),await this._handleNewRecords(i,t)}async removeRecords(e,{cascadeRemoveRelationships:t=!0,recalculateLayout:a=!1,overrideMembershipCheck:i=!1}={cascadeRemoveRelationships:!0,recalculateLayout:!1,overrideMembershipCheck:!1}){let o=[];for(const r of e)(i||!1===this.dataManager.inclusionModeDefinition?.namedTypeDefinitions?.get(r.typeName)?.useAllData&&this.dataManager.inclusionModeDefinition?.namedTypeDefinitions?.get(r.typeName)?.members?.has(r.id))&&o.push(r);if(t){const e=new Set,t=[];for(const a of o)if(this.dataManager.nodeConnectionsLookup.has(a.id))for(const t of this.dataManager.nodeConnectionsLookup.get(a.id))e.add(t);for(const a of e)if(this.dataManager.memberIdTypeLookup.has(a))for(const e of this.dataManager.memberIdTypeLookup.get(a))this.dataManager.relationshipTypeNames.has(e)&&t.push({id:a,typeName:e});o=o.concat(t)}this.dataManager.removeFromLayer(o);for(const r of o)this.sublayerIdsCache.get(r.typeName)?.delete(r.id),this.dataManager.relationshipTypeNames.has(r.typeName)?this.relationshipLinkChartDiagramLookup.delete(r.id):this.entityLinkChartDiagramLookup.delete(r.id);a&&await this._calculateLayoutWithSublayerTimeInfo(this._currentLinkChartConfig.layoutMode,{layoutSettings:this._currentLinkChartConfig.layoutSettings}),o.length>0&&(this.membershipModified=!0);const n=[];return this.layers.forEach((e=>{n.push(e.refreshCachedQueryEngine())})),await Promise.all(n),this._refreshNamedTypes(),o}async expand(e,t){let a=[];try{const i=await this.dataManager.getConnectedRecordIds(e,t?.relationshipTypeNames,t);a=i.filter((e=>!this.sublayerIdsCache.get(e.typeName)?.has(e.id))),await this._handleNewRecords(i,t),i.length>0&&(this.membershipModified=!0),s(t?.signal)}catch(i){throw l(i)&&a.length>0&&this.removeRecords(a,{overrideMembershipCheck:!0}),i}return{records:a}}loadLayerAssumingLocalCache(){const e=[...this.memberRelationshipTypes,...this.memberEntityTypes];this.originIdOf("layers")===g.DEFAULTS?this._createSublayers(e,this.layers,(e=>!!e.geometryType)):this._updateSublayers(e,this.layers),this.originIdOf("tables")===g.DEFAULTS?this._createSublayers(e,this.tables,(e=>!e.geometryType)):this._updateSublayers(e,this.tables),this.dataManager.inclusionModeDefinition?.namedTypeDefinitions?.forEach(((e,t)=>{const a=n(this.sublayerIdsCache,t,(()=>new Set));e.members?.forEach((({id:e,linkChartLocation:i})=>{if(a.add(e),i){const a="coords"in i&&"lengths"in i?i:m(i);this.dataManager.relationshipTypeNames.has(t)?this.relationshipLinkChartDiagramLookup.set(e,a):this.entityLinkChartDiagramLookup.set(e,a)}}))}))}async calculateLinkChartLayout(e="radial-root-centric",t){const a=[],r=[],l=[];this.dataManager.sublayerCaches.forEach(((e,t)=>{this.dataManager.entityTypeNames.has(t)?e.forEach((e=>{a.push({typeName:t,feature:e})})):this.dataManager.relationshipTypeNames.has(t)&&e.forEach((e=>{r.push({typeName:t,feature:e})}))})),this.entityLinkChartDiagramLookup=new Map,this.relationshipLinkChartDiagramLookup=new Map;const d=new Map,c=new Map,p=new Map,u=new Map,g=new Uint8Array(a.length),y=new Float64Array(a.length),f=new Float64Array(a.length),L=new Float64Array(a.length),b=new Float64Array(a.length),N=new Uint32Array(r.length),v=new Uint32Array(r.length),D=new Float64Array(r.length),x=new Float64Array(r.length),S=[],E="organic-standard",I=new Q({xmin:-1e-7,ymin:-1e-7,xmax:1e-7,ymax:1e-7});let W,K="organic-standard",q=0,J=0;const V=_.apply;switch(K="geographic-organic-standard"===e?E:e,K){case"organic-standard":W=F.apply;break;case"organic-community":W=P.apply;break;case"hierarchical-bottom-to-top":W=G.apply;break;case"radial-root-centric":W=R.apply;break;case"tree-left-to-right":W=j.apply;break;default:W=A.apply}let X=!1;a.forEach((({typeName:a,feature:i})=>{if("chronological-mono-timeline"!==e&&"chronological-multi-timeline"!==e&&t?.lockedNodeLocations?.has(i.attributes[w])){"geographic-organic-standard"===e&&this.dataManager.geographicLookup.has(a)?g[q]=U.IsGeographic:g[q]=U.None;const o=t.lockedNodeLocations.get(i.attributes[w]);y[q]=o.x,f[q]=o.y}else if("geographic-organic-standard"===e&&this.dataManager.geographicLookup.has(a)){g[q]=U.IsGeographic;let e=null;const t=i.attributes[this.dataManager.geographicLookup.get(a).name],o=this.dataManager.geographicLookup.get(a)?.geometryType;switch(o){case"esriGeometryPoint":y[q]=t?.x,f[q]=t?.y;break;case"esriGeometryPolygon":e=t?.centroid,null!=e?.x&&null!=e?.y?(y[q]=e.x,f[q]=e.y):g[q]=U.IsMovable;break;case"esriGeometryPolyline":case"esriGeometryMultipoint":e=t?.extent?.center,null!=e?.x&&null!=e?.y?(y[q]=e.x,f[q]=e.y):g[q]=U.IsMovable;break;default:g[q]=U.IsMovable}(null==y[q]||null==f[q]||Number.isNaN(y[q])||Number.isNaN(f[q]))&&(g[q]=U.IsMovable,y[q]=0,f[q]=0)}else if("chronological-mono-timeline"===e||"chronological-multi-timeline"===e){!X&&t?.lockedNodeLocations?.has(i.attributes[w])&&(X=!0);const e=t?.timeInfoByTypeName?.get(a),o=e?.startField,n=o&&e?.startField?i.attributes[o]:null;L[q]=n?new Date(n).getTime():NaN;const r=e?.endField,s=r&&e?.endField?i.attributes[r]:null;b[q]=s?new Date(s).getTime():NaN,y[q]=0,f[q]=0,g[q]=U.IsMovable}else g[q]=U.IsMovable,y[q]=0,f[q]=0;u.set(i.attributes[w],q),S[q]={feature:i,typeName:a},q++})),X&&o.getLogger(this).warn("Locked node locations are not supported for chronological layout at this time. Requested node locations were ignored");let Y=!1;const Z=new Map;r.forEach((a=>{const i=a.feature.attributes[M],o=a.feature.attributes[k],n=u.get(i),r=u.get(o),s=t?.timeInfoByTypeName?.get(a.typeName),h=t?.timeInfoByTypeName?s?.startField:null,d=h?a.feature.attributes[h]:null,c=s?.endField,p=c?a.feature.attributes[c]:null;if(void 0!==n&&void 0!==r){let t=i+"-"+o;"chronological-mono-timeline"!==e&&"chronological-multi-timeline"!==e||(t=t+"-"+d+"-"+p);const s=Z.get(t),h=s?.has(a.typeName);h||(N[J]=n,v[J]=r,"chronological-mono-timeline"!==e&&"chronological-multi-timeline"!==e||(D[J]=d?new Date(d).getTime():NaN,x[J]=p?new Date(p).getTime():NaN),void 0===s?Z.set(t,new Map([[a.typeName,J]])):s.set(a.typeName,J),J++),l.push(a)}else Y=!0,this.relationshipLinkChartDiagramLookup.set(i,null)})),Y&&o.getLogger(this).warn("A relationship is a member of this layer that has either origin or destination entity nodes that are not members. The diagram geometry will be set to null");const ee=this._validateLayoutSettings(e,t?.layoutSettings),te=this._convertLayoutSettingsToCalculationSettings(ee);await B();let ae=O.Error,ie=null;if("chronological-mono-timeline"===e||"chronological-multi-timeline"===e){let a;({status:ae,links:ie,graphics:a}=V((()=>t?.signal?.aborted??!1),g,y,f,L,b,N.subarray(0,J),v.subarray(0,J),D.subarray(0,J),x.subarray(0,J),"chronological-multi-timeline"===e,t?.layoutSettings?.chronologicalLayoutSettings??{})),ae===O.Success&&(this.chronologicalAuxiliaryGraphics=a)}else({status:ae,links:ie}=W((()=>t?.signal?.aborted??!1),g,y,f,N.subarray(0,J),v.subarray(0,J),te.computationBudgetTime,te.idealEdgeLengthMultiplier,te.repulsionRadiusMultiplier));if(s(t?.signal),ae===O.Error)throw new i("knowledge-graph:layout-failed","Attempting to arrange the records in the specified layout failed");if(ae===O.Canceled)throw h();for(let i=0;i<S.length;i++){if(f[i]>84.9999?f[i]=84.9999:f[i]<-84.9999&&(f[i]=-84.9999),y[i]>179.9999?y[i]=179.9999:y[i]<-179.9999&&(y[i]=-179.9999),S[i].feature.attributes[C]=new $(y[i],f[i]),d.has(S[i].typeName)){const e=d.get(S[i].typeName);e?.set(S[i].feature.attributes[w],S[i].feature)}else{const e=new Map;e.set(S[i].feature.attributes[w],S[i].feature),d.set(S[i].typeName,e)}p.set(S[i].feature.attributes[w],S[i].feature);const e=m(S[i].feature.attributes[C]);this.entityLinkChartDiagramLookup.set(S[i].feature.attributes[w],S[i].feature.attributes[C]?e:null);const t=n(this.dataManager.inclusionModeDefinition.namedTypeDefinitions,S[i].typeName,(()=>({useAllData:!1,members:new Map})));n(t.members,S[i].feature.attributes[w],(()=>({id:S[i].feature.attributes[w],linkChartLocation:void 0}))).linkChartLocation=S[i].feature.attributes[C],S[i].feature.attributes[C].x<I.xmin&&(I.xmin=S[i].feature.attributes[C].x),S[i].feature.attributes[C].x>I.xmax&&(I.xmax=S[i].feature.attributes[C].x),S[i].feature.attributes[C].y<I.ymin&&(I.ymin=S[i].feature.attributes[C].y),S[i].feature.attributes[C].y>I.ymax&&(I.ymax=S[i].feature.attributes[C].y)}if(this.linkChartExtent.xmin=I.xmin,this.linkChartExtent.xmax=I.xmax,this.linkChartExtent.ymin=I.ymin,this.linkChartExtent.ymax=I.ymax,!ie)throw new i("knowledge-graph:layout-failed","Attempting to retrieve link geometry from diagram engine failed");const oe=new Map,ne=new Map,re=new Map,se=new Set;for(let i=0;i<l.length;i++){const a=[],r=l[i],s=r.feature.attributes[M],h=r.feature.attributes[k];let d=s+"-"+h;if("chronological-mono-timeline"===e||"chronological-multi-timeline"===e){const e=t?.timeInfoByTypeName?.get(r.typeName),a=t?.timeInfoByTypeName?e?.startField:null,i=a?r.feature.attributes[a]:null,o=e?.endField;d+="-"+i+"-"+(o?r.feature.attributes[o]:null)}const g=Z.get(d).get(r.typeName),y=0===g?0:ie?.vertexEndIndex[g-1];if(!se.has(g)){if(se.add(g),ie.types[g]===z.Recursive){const e=[ie.vertices[2*y],ie.vertices[2*y+1]],t=[ie.vertices[2*(y+1)],ie.vertices[2*(y+1)+1]],i=[.5*(e[0]+t[0]),.5*(e[1]+t[1])],o=[i[0]-e[0],i[1]-e[1]],n=[i[0]+o[1],i[1]-o[0]],r=[i[0]-o[1],i[1]+o[0]];a.push(e),a.push(n),a.push(t),a.push(r),a.push(e)}else{if(ie.types[g]!==z.Regular){o.getLogger(this).warn("A relationship generated an unsupported link geometry type. It will not be rendered");continue}for(let e=y;e<ie.vertexEndIndex[g];e++)a.push([ie.vertices[2*e],ie.vertices[2*e+1]])}if("chronological-mono-timeline"!==e&&"chronological-multi-timeline"!==e){const e=S[u.get(s)]?.feature.attributes[C],t=S[u.get(h)]?.feature.attributes[C];a[0][0]===e.x&&a[0][1]===e.y||(a[0]=[e.x,e.y]),a[a.length-1][0]===t.x&&a[a.length-1][1]===t.y||(a[a.length-1]=[t.x,t.y])}for(let e=1;e<a.length-1;e++)a[e][1]>85.5?a[e][1]=85.5:a[e][1]<-85.5&&(a[e][1]=-85.5),a[e][0]>179.9999?a[e][0]=179.9999:a[e][0]<-179.9999&&(a[e][0]=-179.9999);oe.has(d)?oe.get(d).push(a):oe.set(d,[a])}const f=oe.get(d);ne.has(d)||(ne.set(d,new Map),re.set(d,new Map));const L=ne.get(d),b=re.get(d);L.has(r.typeName)||(L.set(r.typeName,f.shift()),b.set(r.typeName,0));const T=L.get(r.typeName);b.set(r.typeName,b.get(r.typeName)+1);const N=new H({paths:[T]});if(r.feature.attributes[C]=N,c.has(r.typeName)){const e=c.get(r.typeName);e?.set(r.feature.attributes[w],r.feature)}else{const e=new Map;e.set(r.feature.attributes[w],r.feature),c.set(r.typeName,e)}p.set(r.feature.attributes[w],r.feature);const v=m(r.feature.attributes[C]);this.relationshipLinkChartDiagramLookup.set(r.feature.attributes[w],r.feature.attributes[C]?v:null);const D=n(this.dataManager.inclusionModeDefinition.namedTypeDefinitions,r.typeName,(()=>({useAllData:!1,members:new Map})));n(D.members,r.feature.attributes[w],(()=>({id:r.feature.attributes[w],linkChartLocation:void 0}))).linkChartLocation=r.feature.attributes[C]}for(const i of l)i.feature.attributes[T]=re.get(i.feature.attributes[M]+"-"+i.feature.attributes[k])?.get(i.typeName)??null;return this._currentLinkChartConfig={layoutMode:e,layoutSettings:ee},{nodes:d,links:c,idMap:p}}async applyNewLinkChartLayout(e="radial-root-centric",t){const a=[];await this._calculateLayoutWithSublayerTimeInfo(e,t),this.layers.forEach((e=>{a.push(e.refreshCachedQueryEngine())})),this.membershipModified=!0,await Promise.all(a),this._refreshNamedTypes()}getCurrentNodeLocations(){const e=new Map;for(const[t,a]of this.dataManager.inclusionModeDefinition?.namedTypeDefinitions.entries()??[])this.dataManager.relationshipTypeNames.has(t)||a?.members?.forEach((t=>{const a=t.linkChartLocation;let i;const o=t.id;a&&(i="x"in a?{x:a.x,y:a.y}:{x:a.coords[0],y:a.coords[1]},e.set(o,new $({x:i.x,y:i.y})))}));return e}async refreshLinkChartCache(e){await this.dataManager.refreshCacheContent(e);const t=[];this.layers.forEach((e=>{t.push(e.refreshCachedQueryEngine())})),await Promise.all(t),this._refreshNamedTypes()}async connectBetweenEntities(e,t){if(!e.length)return{records:[]};let a=[];try{let i=[];for(const e of this.dataManager.relationshipTypeNames){const t=this.sublayerIdsCache.get(e);t&&(i=i.concat(Array.from(t.keys())))}a=await this.dataManager.getRelationshipsBetweenNodes(e,i,t),await this._handleNewRecords(a,t),s(t)}catch(i){throw l(i)&&this.removeRecords(a),i}return{records:a}}async connectFromEntities(e,t){if(!e.length)return{records:[]};let a=[];try{let i=[];for(const e of this.dataManager.relationshipTypeNames){const t=this.sublayerIdsCache.get(e);t&&(i=i.concat(Array.from(t.keys())))}let o=[];for(const e of this.dataManager.entityTypeNames){const t=this.sublayerIdsCache.get(e);t&&(o=o.concat(Array.from(t)))}a=await this.dataManager.getRelationshipsFromNodes(e,o,i,t),await this._handleNewRecords(a,t),a.length>0&&(this.membershipModified=!0),s(t)}catch(i){throw l(i)&&this.removeRecords(a),i}return{records:a}}getCurrentLayout(){return this._currentLinkChartConfig.layoutMode}async _calculateLayoutWithSublayerTimeInfo(e="radial-root-centric",t){const a=new Map;this.layers.forEach((e=>{a.set(e.objectType.name,e.timeInfo)})),await this.calculateLinkChartLayout(e,{timeInfoByTypeName:a,...t})}async _handleNewRecords(e,t){const a=[];this.dataManager.addToLayer(e);for(const o of e)this.sublayerIdsCache.has(o.typeName)||(this.sublayerIdsCache.set(o.typeName,new Set),a.push(o.typeName)),this.sublayerIdsCache.get(o.typeName).add(o.id);for(const o of a){const e=this._graphTypeLookup.get(o);if(e){const t=this._createSublayer(e);"entity"===e.type?this.dataManager.entityTypeNames.add(o):this.dataManager.relationshipTypeNames.add(o),t.geometryType?this.layers.push(t):this.tables.push(t),this.dataManager.sublayerCaches.set(o,new Map)}}await N(this,a,t),await this.dataManager.refreshCacheContent(e.map((e=>e.id)),void 0,void 0,void 0,t);const i=Object.assign({},this._currentLinkChartConfig.layoutSettings);i.lockedNodeLocations=new Map;for(const[o,n]of this.entityLinkChartDiagramLookup.entries())n&&i.lockedNodeLocations.set(o,new $(n.coords[0],n.coords[1]));await this.applyNewLinkChartLayout(this._currentLinkChartConfig.layoutMode,{layoutSettings:i})}_createSublayers(e,t,a){e.forEach((e=>{const i=this._createSublayer(e);a(i)&&t.push(i),this._updateSublayerCaches(e)}))}_updateSublayers(e,t){t.forEach((t=>{t.parentCompositeLayer=this;const a=e.find((e=>e.type===t.graphType&&e.name===t.graphTypeName));a&&(t.objectType=a,t.read({title:a.name},{origin:"service"}),this._updateSublayerCaches(a))}))}_updateSublayerCaches(e){const t=this.dataManager.sublayerCaches;t.has(e.name)||t.set(e.name,new Map)}async _initializeDiagram(){this.defaultLinkChartConfig?this.defaultLinkChartConfig.doNotRecalculateLayout?(this.dataManager.inclusionModeDefinition?.namedTypeDefinitions?.forEach(((e,t)=>{e?.members?.forEach((e=>{const a=e.linkChartLocation;let i;const o=e.id;if(!a)return;i="x"in a?{x:a.x,y:a.y}:{x:a.coords[0],y:a.coords[1]};const n=m(i);this.dataManager.relationshipTypeNames.has(t)?this.relationshipLinkChartDiagramLookup.set(o,n):this.entityLinkChartDiagramLookup.set(o,n),this.linkChartExtent.xmin>i.x&&(this.linkChartExtent.xmin=i.x),this.linkChartExtent.xmax<i.x&&(this.linkChartExtent.xmax=i.x),this.linkChartExtent.ymin>i.y&&(this.linkChartExtent.ymin=i.y),this.linkChartExtent.ymax<i.y&&(this.linkChartExtent.ymax=i.y)}))})),this.memberRelationshipTypes.forEach((e=>{e.name&&this.dataManager.sublayerCaches.get(e.name)?.forEach((e=>{const t=this.relationshipLinkChartDiagramLookup.get(e.attributes[M]),a=this.relationshipLinkChartDiagramLookup.get(e.attributes[k]);if(t&&a){const i=m(new H({paths:[[[t.coords[0],t.coords[1]],[a.coords[0],a.coords[1]]]]}));this.relationshipLinkChartDiagramLookup.set(e.attributes[w],i)}else this.relationshipLinkChartDiagramLookup.set(e.attributes[w],null)}))}))):await this._calculateLayoutWithSublayerTimeInfo(this.defaultLinkChartConfig.layoutMode,{lockedNodeLocations:this.getCurrentNodeLocations(),...this.defaultLinkChartConfig||{}}):await this._calculateLayoutWithSublayerTimeInfo("radial-root-centric",{lockedNodeLocations:this.getCurrentNodeLocations()})}_refreshNamedTypes(){for(const e of this.layers)e.emit("refresh",{dataChanged:!0});for(const e of this.tables)e.emit("refresh",{dataChanged:!0})}_validateLayoutSettings(e,t){const a=e=>"number"==typeof e&&!isNaN(e),i=e=>a(e)&&e>=1,n=e=>a(e)&&e>=1,r=e=>Object.values(f).includes(e),s=e=>a(e)&&e>=0,l={organicLayoutSettings:{},chronologicalLayoutSettings:{}};if(!new Set(["organic-standard","organic-community","geographic-organic-standard","chronological-multi-timeline","chronological-mono-timeline"]).has(e)||!t)return l;t.organicLayoutSettings??={};const{computationBudgetTime:h,repulsionRadiusMultiplier:d,absoluteIdealEdgeLength:c,multiplicativeIdealEdgeLength:p,idealEdgeLengthType:u}=t.organicLayoutSettings;n(h)?l.organicLayoutSettings.computationBudgetTime=h:void 0!==h&&o.getLogger(this).warn("Invalid layout computationBudgetTime setting, will revert to default setting"),i(d)?l.organicLayoutSettings.repulsionRadiusMultiplier=d:void 0!==d&&o.getLogger(this).warn("Invalid layout repulsionRadiusMultiplier setting, will revert to default setting");if("geographic-organic-standard"===e&&(void 0!==c||void 0!==p||void 0!==u)&&(r(u)?l.organicLayoutSettings.idealEdgeLengthType=u:void 0!==u&&o.getLogger(this).warn('Invalid layout idealEdgeLengthType setting, will revert to "multiplier" setting'),"absolute-value"===u&&s(c)?l.organicLayoutSettings.absoluteIdealEdgeLength=c:"absolute-value"===u&&void 0!==c?o.getLogger(this).warn("Invalid layout idealEdgeLength setting, will revert to default setting"):"multiplier"===u&&s(p)?l.organicLayoutSettings.multiplicativeIdealEdgeLength=p:"multiplier"===u&&void 0!==p&&o.getLogger(this).warn("Invalid layout idealEdgeLength setting, will revert to default setting")),("chronological-multi-timeline"===e||"chronological-mono-timeline"===e)&&t.chronologicalLayoutSettings){const e=t.chronologicalLayoutSettings;e.durationLineWidth&&e.durationLineWidth<0&&o.getLogger(this).warn("Invalid layout durationLineWidth setting, will revert to default setting")}return l}_convertLayoutSettingsToCalculationSettings(e){e.organicLayoutSettings??={};let t=e.organicLayoutSettings.idealEdgeLengthType===f.ABSOLUTE?e.organicLayoutSettings.absoluteIdealEdgeLength:e.organicLayoutSettings.multiplicativeIdealEdgeLength;return e.organicLayoutSettings.idealEdgeLengthType===f.ABSOLUTE&&(void 0===t?t=-1:t*=-1),{computationBudgetTime:e.organicLayoutSettings.computationBudgetTime??void 0,repulsionRadiusMultiplier:e.organicLayoutSettings.repulsionRadiusMultiplier??void 0,idealEdgeLengthMultiplier:t}}_createSublayer(e){return new b({objectType:e,parentCompositeLayer:this,graphType:e.type})}_handleSublayersChange(e,t){t&&(t.forEach((e=>{e.parent=null})),this.removeHandles("sublayers-owner")),e&&(e.forEach((e=>{e.parent=this})),this.addHandles([e.on("after-add",(({item:e})=>{e.parent=this})),e.on("after-remove",(({item:e})=>{e.parent=null}))],"sublayers-owner"))}_alignLayersDataModelAndInclusionDefinition(e){const t=new Set((e.entityTypes??[]).map((e=>e.name)).concat((e.relationshipTypes??[]).map((e=>e.name)))),i=new Set((e.entityTypes??[]).map((e=>e.name))),n=new Set((e.relationshipTypes??[]).map((e=>e.name)));if(this.layers){for(const e of this.layers)!e.graphType&&t.has(e.graphTypeName)&&(e.graphType=i.has(e.graphTypeName)?"entity":"relationship");this.layers=this.layers.filter((e=>t.has(e.graphTypeName)&&("entity"===e.graphType?i.has(e.graphTypeName):n.has(e.graphTypeName))))}else this.layers=new a;if(this.layers&&this._originalInclusionList){const e=new Set(this._originalInclusionList.namedTypeDefinitions.keys()),t=this.tables?.map((e=>e.graphTypeName))??[],a=this.layers.map((e=>e.graphTypeName)).concat(t);for(const o of a)e.has(o)||this._originalInclusionList.namedTypeDefinitions.set(o,{useAllData:!1,members:new Map});const i=[];for(const n of this._originalInclusionList.namedTypeDefinitions.keys())a.includes(n)||(o.getLogger(this).warn(`A named type, ${n}, was in the serialized feature collection but did not have a sublayer config in the item, so will be removed`),i.push(n));for(const o of i)this._originalInclusionList.namedTypeDefinitions.delete(o)}}};e([p()],K.prototype,"dataPreloadedInLocalCache",void 0),e([p()],K.prototype,"defaultLinkChartConfig",void 0),e([p()],K.prototype,"membershipModified",void 0),e([p()],K.prototype,"dataManager",void 0),e([p()],K.prototype,"inclusionModeDefinition",null),e([p()],K.prototype,"knowledgeGraph",void 0),e([p({type:a.ofType(b),json:{write:{ignoreOrigin:!0}}})],K.prototype,"layers",void 0),e([p()],K.prototype,"entityLinkChartDiagramLookup",void 0),e([p()],K.prototype,"relationshipLinkChartDiagramLookup",void 0),e([p()],K.prototype,"linkChartExtent",void 0),e([p()],K.prototype,"memberEntityTypes",void 0),e([p()],K.prototype,"memberRelationshipTypes",void 0),e([p({type:["LinkChartLayer"]})],K.prototype,"operationalLayerType",void 0),e([p()],K.prototype,"sublayerIdsCache",void 0),e([p({type:a.ofType(b),json:{write:{ignoreOrigin:!0}}})],K.prototype,"tables",void 0),e([p({json:{read:!1}})],K.prototype,"type",void 0),e([p({json:{read:!1}})],K.prototype,"chronologicalAuxiliaryGraphics",void 0),K=e([u("esri.layers.LinkChartLayer")],K);const q=K;export{q 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.32/esri/copyright.txt for details.
4
4
  */
5
- import{estimateAttributesMemory as t}from"../../core/memoryEstimations.js";import{getCentroidOptimizedGeometry as e}from"./centroid.js";import r from"./OptimizedGeometry.js";class s{constructor(t=null,e={},r,s){this.geometry=t,this.attributes=e,this.centroid=r,this.objectId=s,this.displayId=0}static fromJSON(t,e){const i=t.geometry?r.fromJSON(t.geometry):null,o=t.centroid?r.fromJSON(t.centroid):null,n=t.attributes[e];return new s(i,t.attributes,o,n)}weakClone(){const t=new s(this.geometry,this.attributes,this.centroid,this.objectId);return t.displayId=this.displayId,t}clone(){const t=this.geometry?.clone(),e=new s(t,{...this.attributes},this.centroid?.clone(),this.objectId);return e.displayId=this.displayId,e}ensureCentroid(t){return this.centroid??=e(new r,this.geometry,t.hasZ,t.hasM),this.centroid}get usedMemory(){return 128+t(this.attributes)+(this.geometry?.usedMemory??0)}}function i(t){return!!t.geometry?.coords?.length}class o extends s{}export{s as OptimizedFeature,o as OptimizedFeatureWithGeometry,i as hasGeometry};
5
+ import{estimateAttributesMemory as t}from"../../core/memoryEstimations.js";import{getCentroidOptimizedGeometry as e}from"./centroid.js";import r from"./OptimizedGeometry.js";class s{constructor(t=null,e={},r,s,o=0){this.geometry=t,this.attributes=e,this.centroid=r,this.objectId=s,this.displayId=o}static fromJSON(t){const e=t.geometry?r.fromJSON(t.geometry):null,o=t.centroid?r.fromJSON(t.centroid):null,i=t.objectId;return new s(e,t.attributes,o,i)}weakClone(){const t=new s(this.geometry,this.attributes,this.centroid,this.objectId);return t.displayId=this.displayId,t}clone(){const t=this.geometry?.clone(),e=new s(t,{...this.attributes},this.centroid?.clone(),this.objectId);return e.displayId=this.displayId,e}ensureCentroid(t){return this.centroid??=e(new r,this.geometry,t.hasZ,t.hasM),this.centroid}get usedMemory(){return 128+t(this.attributes)+(this.geometry?.usedMemory??0)}}function o(t){return!!t.geometry?.coords?.length}class i extends s{}export{s as OptimizedFeature,i as OptimizedFeatureWithGeometry,o as hasGeometry};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.32/esri/copyright.txt for details.
4
4
  */
5
- import{isISO8601Date as e}from"../../../../core/date.js";import t from"../../../../core/Error.js";import{isWGS84 as n}from"../../../../geometry/support/spatialReferenceUtils.js";import{OptimizedFeature as o}from"../../OptimizedFeature.js";import r from"../../OptimizedGeometry.js";import{normalizeFieldName as i,isNumericField as s}from"../../../support/fieldUtils.js";const c={LineString:"esriGeometryPolyline",MultiLineString:"esriGeometryPolyline",MultiPoint:"esriGeometryMultipoint",Point:"esriGeometryPoint",Polygon:"esriGeometryPolygon",MultiPolygon:"esriGeometryPolygon"};function u(e){return c[e]}function*l(e){switch(e.type){case"Feature":yield e;break;case"FeatureCollection":for(const t of e.features)t&&(yield t)}}function*f(e){if(e)switch(e.type){case"Point":yield e.coordinates;break;case"LineString":case"MultiPoint":yield*e.coordinates;break;case"MultiLineString":case"Polygon":for(const t of e.coordinates)yield*t;break;case"MultiPolygon":for(const t of e.coordinates)for(const e of t)yield*e}}function*p(e,t={}){const{geometryType:n,objectIdField:i}=t;for(const s of e){const{geometry:e,properties:c,id:l}=s;if(e&&u(e.type)!==n)continue;const f=c||{};let p;i&&(p=f[i],null==l||p||(f[i]=p=l));const a=new o(e?h(new r,e,t):null,f,null,p??void 0);yield a}}function a(e){for(const t of e)if(t.length>2)return!0;return!1}function y(e){return!g(e)}function d(e){return g(e)}function g(e){let t=0;for(let n=0;n<e.length;n++){const o=e[n],r=e[(n+1)%e.length];t+=o[0]*r[1]-r[0]*o[1]}return t<=0}function m(e){const t=e[0],n=e[e.length-1];return t[0]===n[0]&&t[1]===n[1]&&t[2]===n[2]||e.push(t),e}function h(e,t,n){switch(t.type){case"LineString":return w(e,t,n);case"MultiLineString":return P(e,t,n);case"MultiPoint":return j(e,t,n);case"MultiPolygon":return b(e,t,n);case"Point":return S(e,t,n);case"Polygon":return F(e,t,n)}}function w(e,t,n){return M(e,t.coordinates,n),e}function P(e,t,n){for(const o of t.coordinates)M(e,o,n);return e}function j(e,t,n){return M(e,t.coordinates,n),e}function b(e,t,n){for(const o of t.coordinates){G(e,o[0],n);for(let t=1;t<o.length;t++)k(e,o[t],n)}return e}function S(e,t,n){return O(e,t.coordinates,n),e}function F(e,t,n){const o=t.coordinates;G(e,o[0],n);for(let r=1;r<o.length;r++)k(e,o[r],n);return e}function G(e,t,n){const o=m(t);y(o)?T(e,o,n):M(e,o,n)}function k(e,t,n){const o=m(t);d(o)?T(e,o,n):M(e,o,n)}function M(e,t,n){for(const o of t)O(e,o,n);e.lengths.push(t.length)}function T(e,t,n){for(let o=t.length-1;o>=0;o--)O(e,t[o],n);e.lengths.push(t.length)}function O(e,t,n){const[o,r,i]=t;e.coords.push(o,r),n.hasZ&&e.coords.push(i||0)}function L(t){switch(typeof t){case"string":return e(t)?"esriFieldTypeDate":"esriFieldTypeString";case"number":return"esriFieldTypeDouble";default:return"unknown"}}function E(e,o=4326){if(!e)throw new t("geojson-layer:empty","GeoJSON data is empty");if("Feature"!==e.type&&"FeatureCollection"!==e.type)throw new t("geojson-layer:unsupported-geojson-object","missing or not supported GeoJSON object type",{data:e});const{crs:r}=e;if(!r)return;const i="string"==typeof r?r:"name"===r.type?r.properties.name:"EPSG"===r.type?r.properties.code:null,s=n({wkid:o})?new RegExp(".*(CRS84H?|4326)$","i"):new RegExp(`.*(${o})$`,"i");if(!i||!s.test(i))throw new t("geojson:unsupported-crs","unsupported GeoJSON 'crs' member",{crs:r})}function I(e,t={}){const n=[],o=new Set,r=new Set;let c,p=!1,y=null,d=!1,{geometryType:g=null}=t;for(const s of l(e)){const{geometry:e,properties:t,id:l}=s;if(!e||(g||(g=u(e.type)),u(e.type)===g)){if(!p){p=a(f(e))}if(d||(d=null!=l,d&&(c=typeof l,t&&(y=Object.keys(t).filter((e=>t[e]===l))))),t&&y&&d&&null!=l&&(y.length>1?y=y.filter((e=>t[e]===l)):1===y.length&&(y=t[y[0]]===l?y:[])),t)for(const e in t){if(o.has(e))continue;const s=L(t[e]);if("unknown"===s){r.add(e);continue}r.delete(e),o.add(e);const c=i(e);c&&n.push({name:c,alias:e,type:s})}}}const m=i(1===y?.length&&y[0]||null)??void 0;if(m)for(const i of n)if(i.name===m&&s(i)){i.type="esriFieldTypeOID";break}return{fields:n,geometryType:g,hasZ:p,objectIdFieldName:m,objectIdFieldType:c,unknownFields:Array.from(r)}}function N(e,t){return Array.from(p(l(e),t))}export{N as createOptimizedFeatures,u as getGeometryType,I as inferLayerProperties,E as validateGeoJSON};
5
+ import{isISO8601Date as e}from"../../../../core/date.js";import t from"../../../../core/Error.js";import{isWGS84 as n}from"../../../../geometry/support/spatialReferenceUtils.js";import{OptimizedFeature as o}from"../../OptimizedFeature.js";import r from"../../OptimizedGeometry.js";import{normalizeFieldName as i,isNumericField as s}from"../../../support/fieldUtils.js";const c={LineString:"esriGeometryPolyline",MultiLineString:"esriGeometryPolyline",MultiPoint:"esriGeometryMultipoint",Point:"esriGeometryPoint",Polygon:"esriGeometryPolygon",MultiPolygon:"esriGeometryPolygon"};function u(e){return c[e]}function*l(e){switch(e.type){case"Feature":yield e;break;case"FeatureCollection":for(const t of e.features)t&&(yield t)}}function*f(e){if(e)switch(e.type){case"Point":yield e.coordinates;break;case"LineString":case"MultiPoint":yield*e.coordinates;break;case"MultiLineString":case"Polygon":for(const t of e.coordinates)yield*t;break;case"MultiPolygon":for(const t of e.coordinates)for(const e of t)yield*e}}function*p(e,t={}){const{geometryType:n,objectIdField:i}=t;for(const s of e){const{geometry:e,properties:c,id:l}=s;if(e&&u(e.type)!==n)continue;const f=c||{};let p;i&&(p=f[i],null==l||p||(f[i]=p=l));const a=new o(e?h(new r,e,t):null,f,null,p);yield a}}function a(e){for(const t of e)if(t.length>2)return!0;return!1}function y(e){return!g(e)}function d(e){return g(e)}function g(e){let t=0;for(let n=0;n<e.length;n++){const o=e[n],r=e[(n+1)%e.length];t+=o[0]*r[1]-r[0]*o[1]}return t<=0}function m(e){const t=e[0],n=e[e.length-1];return t[0]===n[0]&&t[1]===n[1]&&t[2]===n[2]||e.push(t),e}function h(e,t,n){switch(t.type){case"LineString":return w(e,t,n);case"MultiLineString":return P(e,t,n);case"MultiPoint":return j(e,t,n);case"MultiPolygon":return b(e,t,n);case"Point":return S(e,t,n);case"Polygon":return F(e,t,n)}}function w(e,t,n){return M(e,t.coordinates,n),e}function P(e,t,n){for(const o of t.coordinates)M(e,o,n);return e}function j(e,t,n){return M(e,t.coordinates,n),e}function b(e,t,n){for(const o of t.coordinates){G(e,o[0],n);for(let t=1;t<o.length;t++)k(e,o[t],n)}return e}function S(e,t,n){return O(e,t.coordinates,n),e}function F(e,t,n){const o=t.coordinates;G(e,o[0],n);for(let r=1;r<o.length;r++)k(e,o[r],n);return e}function G(e,t,n){const o=m(t);y(o)?T(e,o,n):M(e,o,n)}function k(e,t,n){const o=m(t);d(o)?T(e,o,n):M(e,o,n)}function M(e,t,n){for(const o of t)O(e,o,n);e.lengths.push(t.length)}function T(e,t,n){for(let o=t.length-1;o>=0;o--)O(e,t[o],n);e.lengths.push(t.length)}function O(e,t,n){const[o,r,i]=t;e.coords.push(o,r),n.hasZ&&e.coords.push(i||0)}function L(t){switch(typeof t){case"string":return e(t)?"esriFieldTypeDate":"esriFieldTypeString";case"number":return"esriFieldTypeDouble";default:return"unknown"}}function E(e,o=4326){if(!e)throw new t("geojson-layer:empty","GeoJSON data is empty");if("Feature"!==e.type&&"FeatureCollection"!==e.type)throw new t("geojson-layer:unsupported-geojson-object","missing or not supported GeoJSON object type",{data:e});const{crs:r}=e;if(!r)return;const i="string"==typeof r?r:"name"===r.type?r.properties.name:"EPSG"===r.type?r.properties.code:null,s=n({wkid:o})?new RegExp(".*(CRS84H?|4326)$","i"):new RegExp(`.*(${o})$`,"i");if(!i||!s.test(i))throw new t("geojson:unsupported-crs","unsupported GeoJSON 'crs' member",{crs:r})}function I(e,t={}){const n=[],o=new Set,r=new Set;let c,p=!1,y=null,d=!1,{geometryType:g=null}=t;for(const s of l(e)){const{geometry:e,properties:t,id:l}=s;if(!e||(g||(g=u(e.type)),u(e.type)===g)){if(!p){p=a(f(e))}if(d||(d=null!=l,d&&(c=typeof l,t&&(y=Object.keys(t).filter((e=>t[e]===l))))),t&&y&&d&&null!=l&&(y.length>1?y=y.filter((e=>t[e]===l)):1===y.length&&(y=t[y[0]]===l?y:[])),t)for(const e in t){if(o.has(e))continue;const s=L(t[e]);if("unknown"===s){r.add(e);continue}r.delete(e),o.add(e);const c=i(e);c&&n.push({name:c,alias:e,type:s})}}}const m=i(1===y?.length&&y[0]||null)??void 0;if(m)for(const i of n)if(i.name===m&&s(i)){i.type="esriFieldTypeOID";break}return{fields:n,geometryType:g,hasZ:p,objectIdFieldName:m,objectIdFieldType:c,unknownFields:Array.from(r)}}function N(e,t){return Array.from(p(l(e),t))}export{N as createOptimizedFeatures,u as getGeometryType,I as inferLayerProperties,E as validateGeoJSON};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.32/esri/copyright.txt for details.
4
4
  */
5
- import"../../geometry.js";import e from"../../Graphic.js";import"../../symbols.js";import o from"../../core/Error.js";import t from"../GraphicsLayer.js";import{IdealEdgeLengthTypeOptions as n}from"./IdealEdgeLengthTypeOptions.js";import{systemOidFieldName as r}from"./layerUtils.js";import i from"./SessionMemoryStorage.js";import{Direction2D as a}from"../../libs/linkchartlayout/LinkChartLayout.js";import s from"../../linkChart/ChronologicalLayoutSettings.js";import{layoutMap as l}from"../../linkChart/enums.js";import c from"../../linkChart/LayoutSettings.js";import m from"../../linkChart/OrganicLayoutSettings.js";import{executeQueryStreaming as g}from"../../rest/knowledgeGraphService.js";import p from"../../rest/knowledgeGraph/GraphQueryStreaming.js";import y from"../../symbols/CIMSymbol.js";import u from"../../geometry/Polyline.js";import d from"../../symbols/SimpleFillSymbol.js";import h from"../../geometry/Polygon.js";import f from"../../symbols/TextSymbol.js";import L from"../../geometry/Point.js";function b(e,o){const t=new Map;if(o.dataModel?.relationshipTypes)for(const n of o.dataModel.relationshipTypes)n.name&&t.set(n.name,[]);for(const n of e)t.has(n.typeName)&&t.get(n.typeName)?.push(n.id);return t}async function S(e,o,t){const n=[],r=b(e,o),i={},a=[];for(const[m,g]of r){if(g.length<1)continue;const e=`${m}_ids`;i[e]=g,a.push(`MATCH (n)-[r:${m}]->(m) WHERE id(r) in $${e} RETURN id(n), labels(n)[0], id(m), labels(m)[0]`)}if(0===a.length)return[];const s=a.join(" UNION "),l=new p({openCypherQuery:s,bindParameters:i}),c=(await g(o,l,t?.requestOptions)).resultRowsStream.getReader();for(;;){const{done:e,value:o}=await c.read();if(e)break;for(const t of o)n.push({id:t[0],typeName:t[1]}),n.push({id:t[2],typeName:t[3]})}return n}async function w(e,o,t){const n=new Map,r=b(e,o),i={},a=[];for(const[m,g]of r){if(g.length<1)continue;const e=`${m}_ids`;i[e]=g,a.push(`MATCH (n)-[r:${m}]->(m) WHERE id(r) in $${e} RETURN id(r), id(n), id(m)`)}if(0===a.length)return n;const s=a.join(" UNION "),l=new p({openCypherQuery:s,bindParameters:i}),c=(await g(o,l,t?.requestOptions)).resultRowsStream.getReader();for(;;){const{done:e,value:o}=await c.read();if(e)break;for(const t of o)n.set(t[0],[t[1],t[2]])}return n}const E="ESRI__ChronologicalLayoutOverlay",M=()=>E,T=o=>{const n=[],r={type:"CIMGeometricEffectCut",beginCut:3,endCut:3};for(const t of o.chronologicalAuxiliaryGraphics?.lines??[]){const o={type:"CIMSolidStroke",enable:!0,width:t.width,color:[t.color.r,t.color.g,t.color.b,Math.round(t.color.a/100*255)],effects:t.dashPattern.length>0?[{type:"CIMGeometricEffectDashes",dashTemplate:t.dashPattern,lineDashEnding:"NoConstraint"},r]:[r]},i={type:"CIMVectorMarker",enable:!0,size:10,frame:{xmin:-5,ymin:-5,xmax:0,ymax:5},markerGraphics:[{type:"CIMMarkerGraphic",geometry:{rings:[[[-12,-3.47],[-12,3.6],[-2.06,-.03],[-12,-3.47]]]},symbol:{type:"CIMPolygonSymbol",symbolLayers:[{type:"CIMSolidFill",enable:!0,color:[t.color.r,t.color.g,t.color.b,Math.round(t.color.a/100*255)]}]}}],markerPlacement:{type:"CIMMarkerPlacementOnLine",angleToLine:!0,relativeTo:"LineEnd",offsetAlongLine:0}},a=new y({data:{type:"CIMSymbolReference",symbol:{type:"CIMLineSymbol",symbolLayers:t.arrowheadSizeAtEnd?[o,i]:[o]}}});for(const r of t.elements){const o=new u({paths:[[[r.origin.x,r.origin.y],[r.destination.x,r.destination.y]]]});n.push(new e({geometry:o,symbol:a}))}}for(const t of o.chronologicalAuxiliaryGraphics?.polygons??[]){const o=new d({color:[t.color.r,t.color.g,t.color.b,t.color.a/100],style:"solid",outline:null});for(const r of t.elements){const t=new h({rings:[r.points.map((e=>[e.x,e.y]))]});n.push(new e({geometry:t,symbol:o}))}}for(const t of o.chronologicalAuxiliaryGraphics?.texts??[]){let o="middle",r="center";switch(t.direction?.value){case a.left:r="right";break;case a.right:r="left";break;case a.bottom:o="bottom"}for(const i of t.elements){const a=new f({color:[t.color.r,t.color.g,t.color.b,t.color.a/100],text:i.str,font:{size:t.height,weight:"bold"},verticalAlignment:o,horizontalAlignment:r}),s=new L({x:i.anchor.x,y:i.anchor.y});n.push(new e({geometry:s,symbol:a}))}}return new t({graphics:n,listMode:"hide",title:E,id:E})},x=(e,o)=>{const t=new Map;for(const r of[...o.entityTypes??[],...o.relationshipTypes??[]])for(const e of r.properties??[])e.geometryType&&"esriGeometryNull"!==e.geometryType&&t.set(r.name,e.name??"");const n=i.getInstance();for(const i of e)n.writeToStore([i],r,t.get(i.typeName??"")??"")},C=e=>l.get(e)??"radial-root-centric",I=(e,o)=>{const t=e?.chronologicalLayoutSettings,r=e?.organicLayoutSettings;return{chronologicalLayoutSettings:null!==t?t:void 0,organicLayoutSettings:r?{idealEdgeLengthType:"absolute-value"===r.idealEdgeLengthType?n.ABSOLUTE:n.MULTIPLIER,repulsionRadiusMultiplier:r.autoRepulsionRadius?void 0:r.repulsionRadiusMultiplier,idealEdgeLength:null==r.idealEdgeLengthType?void 0:"absolute-value"===r.idealEdgeLengthType?r.absoluteIdealEdgeLength:r.multiplicativeIdealEdgeLength,computationBudgetTime:o}:void 0}},R=e=>{const o=Object.assign(new s,e?.chronologicalLayoutSettings),t=new m,r=new c;return e?.organicLayoutSettings&&(t.idealEdgeLengthType=e.organicLayoutSettings.idealEdgeLengthType===n.ABSOLUTE?"absolute-value":"multiplier",t.autoRepulsionRadius=null==e.organicLayoutSettings.repulsionRadiusMultiplier,t.repulsionRadiusMultiplier=e.organicLayoutSettings.repulsionRadiusMultiplier,t.multiplicativeIdealEdgeLength=e.organicLayoutSettings.idealEdgeLengthType===n.MULTIPLIER?e.organicLayoutSettings.idealEdgeLength??1:1,t.absoluteIdealEdgeLength=e.organicLayoutSettings.idealEdgeLengthType===n.ABSOLUTE?e.organicLayoutSettings.idealEdgeLength??1:1),r.chronologicalLayoutSettings=o,r.organicLayoutSettings=t,r};function j(e){if(!e.spatialReference.isWGS84)throw new o("knowledge-graph:layer-support-utils","The utilsExtentToInBoundsRings function only supports WGS84 spatial references.");return e.clone().normalize().map((e=>[[e.xmin,e.ymin],[e.xmin,e.ymax],[e.xmax,e.ymax],[e.xmax,e.ymin],[e.xmin,e.ymin]]))}export{R as convertLayoutSettingsAPIFormatToInMemoryFormat,I as convertLayoutSettingsInMemoryFormatToAPIFormat,C as convertLayoutTypeToWebSupportedFormat,T as getChronologicalOverlay,M as getDefaultChronologicalOverlayLayerId,S as getRelationshipEndNodeIds,w as getRelationshipEndNodeMap,x as loadRecordsIntoLocalCache,j as utilsExtentToInBoundsRings};
5
+ import"../../geometry.js";import o from"../../Graphic.js";import"../../symbols.js";import e from"../../core/Error.js";import r from"../GraphicsLayer.js";import{systemOidFieldName as t}from"./layerUtils.js";import n from"./SessionMemoryStorage.js";import{Direction2D as i}from"../../libs/linkchartlayout/LinkChartLayout.js";import{layoutMap as s}from"../../linkChart/enums.js";import{executeQueryStreaming as a}from"../../rest/knowledgeGraphService.js";import l from"../../rest/knowledgeGraph/GraphQueryStreaming.js";import m from"../../symbols/CIMSymbol.js";import c from"../../geometry/Polyline.js";import y from"../../symbols/SimpleFillSymbol.js";import p from"../../geometry/Polygon.js";import f from"../../symbols/TextSymbol.js";import h from"../../geometry/Point.js";function d(o,e){const r=new Map;if(e.dataModel?.relationshipTypes)for(const t of e.dataModel.relationshipTypes)t.name&&r.set(t.name,[]);for(const t of o)r.has(t.typeName)&&r.get(t.typeName)?.push(t.id);return r}async function g(o,e,r){const t=[],n=d(o,e),i={},s=[];for(const[a,l]of n){if(l.length<1)continue;const o=`${a}_ids`;i[o]=l,s.push(`MATCH (n)-[r:${a}]->(m) WHERE id(r) in $${o} RETURN id(n), labels(n)[0], id(m), labels(m)[0]`)}if(0===s.length)return[];const m=s.join(" UNION "),c=new l({openCypherQuery:m,bindParameters:i}),y=(await a(e,c,r?.requestOptions)).resultRowsStream.getReader();for(;;){const{done:o,value:e}=await y.read();if(o)break;for(const r of e)t.push({id:r[0],typeName:r[1]}),t.push({id:r[2],typeName:r[3]})}return t}async function u(o,e,r){const t=new Map,n=d(o,e),i={},s=[];for(const[a,l]of n){if(l.length<1)continue;const o=`${a}_ids`;i[o]=l,s.push(`MATCH (n)-[r:${a}]->(m) WHERE id(r) in $${o} RETURN id(r), id(n), id(m)`)}if(0===s.length)return t;const m=s.join(" UNION "),c=new l({openCypherQuery:m,bindParameters:i}),y=(await a(e,c,r?.requestOptions)).resultRowsStream.getReader();for(;;){const{done:o,value:e}=await y.read();if(o)break;for(const r of e)t.set(r[0],[r[1],r[2]])}return t}const b="ESRI__ChronologicalLayoutOverlay",w=()=>b,x=e=>{const t=[],n={type:"CIMGeometricEffectCut",beginCut:3,endCut:3};for(const r of e.chronologicalAuxiliaryGraphics?.lines??[]){const e={type:"CIMSolidStroke",enable:!0,width:r.width,color:[r.color.r,r.color.g,r.color.b,Math.round(r.color.a/100*255)],effects:r.dashPattern.length>0?[{type:"CIMGeometricEffectDashes",dashTemplate:r.dashPattern,lineDashEnding:"NoConstraint"},n]:[n]},i={type:"CIMVectorMarker",enable:!0,size:10,frame:{xmin:-5,ymin:-5,xmax:0,ymax:5},markerGraphics:[{type:"CIMMarkerGraphic",geometry:{rings:[[[-12,-3.47],[-12,3.6],[-2.06,-.03],[-12,-3.47]]]},symbol:{type:"CIMPolygonSymbol",symbolLayers:[{type:"CIMSolidFill",enable:!0,color:[r.color.r,r.color.g,r.color.b,Math.round(r.color.a/100*255)]}]}}],markerPlacement:{type:"CIMMarkerPlacementOnLine",angleToLine:!0,relativeTo:"LineEnd",offsetAlongLine:0}},s=new m({data:{type:"CIMSymbolReference",symbol:{type:"CIMLineSymbol",symbolLayers:r.arrowheadSizeAtEnd?[e,i]:[e]}}});for(const n of r.elements){const e=new c({paths:[[[n.origin.x,n.origin.y],[n.destination.x,n.destination.y]]]});t.push(new o({geometry:e,symbol:s}))}}for(const r of e.chronologicalAuxiliaryGraphics?.polygons??[]){const e=new y({color:[r.color.r,r.color.g,r.color.b,r.color.a/100],style:"solid",outline:null});for(const n of r.elements){const r=new p({rings:[n.points.map((o=>[o.x,o.y]))]});t.push(new o({geometry:r,symbol:e}))}}for(const r of e.chronologicalAuxiliaryGraphics?.texts??[]){let e="middle",n="center";switch(r.direction?.value){case i.left:n="right";break;case i.right:n="left";break;case i.bottom:e="bottom"}for(const i of r.elements){const s=new f({color:[r.color.r,r.color.g,r.color.b,r.color.a/100],text:i.str,font:{size:r.height,weight:"bold"},verticalAlignment:e,horizontalAlignment:n}),a=new h({x:i.anchor.x,y:i.anchor.y});t.push(new o({geometry:a,symbol:s}))}}return new r({graphics:t,listMode:"hide",title:b,id:b})},M=(o,e)=>{const r=new Map;for(const t of[...e.entityTypes??[],...e.relationshipTypes??[]])for(const o of t.properties??[])o.geometryType&&"esriGeometryNull"!==o.geometryType&&r.set(t.name,o.name??"");const i=n.getInstance();for(const n of o)i.writeToStore([n],t,r.get(n.typeName??"")??"")},C=o=>s.get(o)??"radial-root-centric";function S(o){if(!o.spatialReference.isWGS84)throw new e("knowledge-graph:layer-support-utils","The utilsExtentToInBoundsRings function only supports WGS84 spatial references.");return o.clone().normalize().map((o=>[[o.xmin,o.ymin],[o.xmin,o.ymax],[o.xmax,o.ymax],[o.xmax,o.ymin],[o.xmin,o.ymin]]))}export{C as convertLayoutTypeToWebSupportedFormat,x as getChronologicalOverlay,w as getDefaultChronologicalOverlayLayerId,g as getRelationshipEndNodeIds,u as getRelationshipEndNodeMap,M as loadRecordsIntoLocalCache,S as utilsExtentToInBoundsRings};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.32/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../chunks/tslib.es6.js";import"../../geometry.js";import r from"../../PopupTemplate.js";import"../../renderers/ClassBreaksRenderer.js";import"../../renderers/DictionaryRenderer.js";import"../../renderers/DotDensityRenderer.js";import"../../renderers/HeatmapRenderer.js";import"../../renderers/PieChartRenderer.js";import"../../renderers/Renderer.js";import"../../renderers/SimpleRenderer.js";import"../../renderers/UniqueValueRenderer.js";import"../../renderers/support/jsonUtils.js";import{rendererTypes as t,webSceneRendererTypes as i}from"../../renderers/support/types.js";import o from"../../request.js";import{isSymbol3D as s}from"../../symbols.js";import a from"../../core/Collection.js";import l from"../../core/Error.js";import has from"../../core/has.js";import n from"../../core/Identifiable.js";import{clone as p}from"../../core/lang.js";import y from"../../core/Loadable.js";import u from"../../core/Logger.js";import{MultiOriginJSONMixin as d}from"../../core/MultiOriginJSONSupport.js";import{sqlAnd as c}from"../../core/sql.js";import{objectToQuery as f}from"../../core/urlUtils.js";import{property as h}from"../../core/accessorSupport/decorators/property.js";import{cast as m}from"../../core/accessorSupport/decorators/cast.js";import{reader as b}from"../../core/accessorSupport/decorators/reader.js";import{subclass as g}from"../../core/accessorSupport/decorators/subclass.js";import{writer as S}from"../../core/accessorSupport/decorators/writer.js";import{ensureInteger as I,ensureType as w,Integer as v,ensureClass as j}from"../../core/accessorSupport/ensureType.js";import{OriginId as L,nameToId as F}from"../../core/accessorSupport/PropertyOrigin.js";import{getProperties as D}from"../../core/accessorSupport/utils.js";import x from"../graphics/sources/support/QueryTask.js";import{readOrderByInfos as O}from"../mixins/OrderedLayer.js";import{getFeatureType as E}from"./featureLayerUtils.js";import P from"./FeatureType.js";import q from"./Field.js";import T from"./FieldsIndex.js";import{fixRendererFields as R}from"./fieldUtils.js";import _ from"./LabelClass.js";import{validateLabelingInfo as A}from"./labelingInfo.js";import C from"./LayerFloorInfo.js";import M from"./OrderByInfo.js";import V from"./Relationship.js";import{getFeatureLayerCapabilities as k}from"./serviceCapabilitiesUtils.js";import{DataLayerSource as N}from"./source/DataLayerSource.js";import{MapLayerSource as U}from"./source/MapLayerSource.js";import{parseUrl as B}from"../../rest/utils.js";import Q from"../../rest/support/AttachmentQuery.js";import J from"../../rest/support/Query.js";import{createPopupTemplate as $}from"../../support/popupUtils.js";import K from"../../geometry/Extent.js";import G from"../../geometry/SpatialReference.js";import{featureGeometryTypeKebabDictionary as H}from"../../geometry/support/typeUtils.js";var z;function W(e){return"esriSMS"===e?.type}function X(e,r,t){const i=this.originIdOf(r)>=F(t.origin);return{ignoreOrigin:!0,allowNull:i,enabled:!!t&&("map-image"===t.layer?.type&&(t.writeSublayerStructure||i))}}function Y(e,r,t){return{enabled:!!t&&("tile"===t.layer?.type&&(t.origin&&this.originIdOf(r)>=F(t.origin)||this._isOverridden(r)))}}function Z(e,r,t){return{ignoreOrigin:!0,enabled:t&&t.writeSublayerStructure||!1}}function ee(e,r,t){return{ignoreOrigin:!0,enabled:!!t&&(t.writeSublayerStructure||this.originIdOf(r)>=F(t.origin))}}let re=0;const te=new Set(["layer","parent","loaded","loadStatus","loadError","loadWarnings"]);let ie=z=class extends(d(n.IdentifiableMixin(y))){constructor(e){super(e),this.capabilities=void 0,this.maxScaleRange={minScale:0,maxScale:0},this.fields=null,this.fullExtent=null,this.geometryType=null,this.globalIdField=null,this.isTable=!1,this.legendEnabled=!0,this.objectIdField=null,this.parent=null,this.popupEnabled=!0,this.popupTemplate=null,this.relationships=null,this.sourceJSON=null,this.spatialReference=null,this.title=null,this.typeIdField=null,this.type="sublayer",this.types=null,this._lastParsedUrl=null}async load(e){return this.addResolvingPromise((async()=>{const{layer:r,url:t}=this;if(!r&&!t)throw new l("sublayer:missing-layer","Sublayer can't be loaded without being part of a layer",{sublayer:this});const i=r?await r.fetchSublayerInfo(this,e):(await o(t,{responseType:"json",query:{f:"json"},...e})).data;i&&(this.sourceJSON=i,this.read({layerDefinition:i},{origin:"service",layer:r,url:B(t)}))})()),this}readCapabilities(e,r){r=r.layerDefinition||r;const{operations:{supportsQuery:t,supportsQueryAttachments:i},query:{supportsFormatPBF:o,supportsOrderBy:s,supportsPagination:a},data:{supportsAttachment:l},queryRelated:n}=k(r,this.url);return{exportMap:{supportsModification:!!r.canModifyLayer},operations:{supportsQuery:t,supportsQueryAttachments:i},data:{supportsAttachment:l},query:{supportsFormatPBF:o,supportsOrderBy:s,supportsPagination:a},queryRelated:n}}get defaultPopupTemplate(){return this.createPopupTemplate()}set definitionExpression(e){this._setAndNotifyLayer("definitionExpression",e)}get effectiveScaleRange(){const{minScale:e,maxScale:r}=this;return{minScale:e,maxScale:r}}readMaxScaleRange(e,r){return{minScale:(r=r.layerDefinition||r).minScale??0,maxScale:r.maxScale??0}}get fieldsIndex(){return new T(this.fields||[])}set floorInfo(e){this._setAndNotifyLayer("floorInfo",e)}readGlobalIdFieldFromService(e,r){if((r=r.layerDefinition||r).globalIdField)return r.globalIdField;if(r.fields)for(const t of r.fields)if("esriFieldTypeGlobalID"===t.type)return t.name}get id(){const e=this._get("id");return e??re++}set id(e){this._get("id")!==e&&(!1!==this.layer?.capabilities?.exportMap?.supportsDynamicLayers?this._set("id",e):this._logLockedError("id","capability not available 'layer.capabilities.exportMap.supportsDynamicLayers'"))}readIsTable(e,r){return"Table"===r.type}set labelingInfo(e){this._setAndNotifyLayer("labelingInfo",e)}writeLabelingInfo(e,r,t,i){e&&e.length&&(r.layerDefinition={drawingInfo:{labelingInfo:e.map((e=>e.write({},i)))}})}set labelsVisible(e){this._setAndNotifyLayer("labelsVisible",e)}set layer(e){this._set("layer",e),this.sublayers?.forEach((r=>r.layer=e))}set listMode(e){this._set("listMode",e)}set minScale(e){this._setAndNotifyLayer("minScale",e)}readMinScale(e,r){return r.minScale||r.layerDefinition?.minScale||0}set maxScale(e){this._setAndNotifyLayer("maxScale",e)}readMaxScale(e,r){return r.maxScale||r.layerDefinition?.maxScale||0}readObjectIdFieldFromService(e,r){if((r=r.layerDefinition||r).objectIdField)return r.objectIdField;const t=r.fields?.find((e=>"esriFieldTypeOID"===e.type));return t?.name}set opacity(e){this._setAndNotifyLayer("opacity",e)}readOpacity(e,r){const{layerDefinition:t}=r;return 1-.01*(t?.transparency??t?.drawingInfo?.transparency??0)}writeOpacity(e,r,t,i){r.layerDefinition={drawingInfo:{transparency:100-100*e}}}set orderBy(e){this._setAndNotifyLayer("orderBy",e)}writeParent(e,r){this.parent&&this.parent!==this.layer?r.parentLayerId=I(this.parent.id):r.parentLayerId=-1}get queryTask(){if(!this.layer)return null;const{capabilities:e,fieldsIndex:r,layer:t,url:i}=this,{spatialReference:o}=t,s="gdbVersion"in t?t.gdbVersion:void 0,a=has("featurelayer-pbf")&&e?.query.supportsFormatPBF;return new x({fieldsIndex:r,gdbVersion:s,pbfSupported:a,queryAttachmentsSupported:e?.operations?.supportsQueryAttachments??!1,sourceSpatialReference:o,url:i})}set renderer(e){if(R(e,this.fieldsIndex),e)for(const r of e.symbols)if(s(r)){u.getLogger(this).warn("Sublayer renderer should use 2D symbols");break}this._setAndNotifyLayer("renderer",e)}get source(){return this._get("source")||new U({mapLayerId:this.id})}set source(e){this._setAndNotifyLayer("source",e)}set sublayers(e){this._handleSublayersChange(e,this._get("sublayers")),this._set("sublayers",e)}castSublayers(e){return w(a.ofType(z),e)}writeSublayers(e,r,t){this.sublayers?.length&&(r[t]=this.sublayers.map((e=>e.id)).toArray().reverse())}readTitle(e,r){return r.layerDefinition?.name??r.name}readTypeIdField(e,r){let t=(r=r.layerDefinition||r).typeIdField;if(t&&r.fields){t=t.toLowerCase();const e=r.fields.find((e=>e.name.toLowerCase()===t));e&&(t=e.name)}return t}get url(){const e=this.layer?.parsedUrl??this._lastParsedUrl,r=this.source;if(!e)return null;if(this._lastParsedUrl=e,"map-layer"===r?.type)return`${e.path}/${r.mapLayerId}`;const t={layer:JSON.stringify({source:this.source})};return`${e.path}/dynamicLayer?${f(t)}`}set url(e){this._overrideIfSome("url",e)}set visible(e){this._setAndNotifyLayer("visible",e)}writeVisible(e,r,t,i){r[t]=this.getAtOrigin("defaultVisibility","service")||e}clone(){const{store:e}=D(this),r=new z;return D(r).store=e.clone(te),this.commitProperty("url"),r._lastParsedUrl=this._lastParsedUrl,r}createPopupTemplate(e){return $(this,e)}createQuery(){return new J({returnGeometry:!0,where:this.definitionExpression||"1=1"})}async createFeatureLayer(){if(this.hasOwnProperty("sublayers"))return null;const e=(await import("../FeatureLayer.js")).default,{layer:r,url:t}=this;let i;if(t&&this.originIdOf("url")>L.SERVICE)i=new e({url:t});else{if(!r?.parsedUrl)throw new l("createFeatureLayer:missing-information","Cannot create a FeatureLayer without a url or a parent layer");{const t=r.parsedUrl;i=new e({url:t.path}),t&&this.source&&("map-layer"===this.source.type?i.layerId=this.source.mapLayerId:i.dynamicDataSource=this.source)}}return null!=r?.refreshInterval&&(i.refreshInterval=r.refreshInterval),this.definitionExpression&&(i.definitionExpression=this.definitionExpression),this.floorInfo&&(i.floorInfo=p(this.floorInfo)),this.originIdOf("labelingInfo")>L.SERVICE&&(i.labelingInfo=p(this.labelingInfo)),this.originIdOf("labelsVisible")>L.DEFAULTS&&(i.labelsVisible=this.labelsVisible),this.originIdOf("legendEnabled")>L.DEFAULTS&&(i.legendEnabled=this.legendEnabled),this.originIdOf("visible")>L.DEFAULTS&&(i.visible=this.visible),this.originIdOf("minScale")>L.DEFAULTS&&(i.minScale=this.minScale),this.originIdOf("maxScale")>L.DEFAULTS&&(i.maxScale=this.maxScale),this.originIdOf("opacity")>L.DEFAULTS&&(i.opacity=this.opacity),this.originIdOf("popupTemplate")>L.DEFAULTS&&(i.popupTemplate=p(this.popupTemplate)),this.originIdOf("renderer")>L.SERVICE&&(i.renderer=p(this.renderer)),"data-layer"===this.source?.type&&(i.dynamicDataSource=this.source.clone()),this.originIdOf("title")>L.DEFAULTS&&(i.title=this.title),"map-image"===r?.type&&r.originIdOf("customParameters")>L.DEFAULTS&&(i.customParameters=r.customParameters),"tile"===r?.type&&r.originIdOf("customParameters")>L.DEFAULTS&&(i.customParameters=r.customParameters),i}getField(e){return this.fieldsIndex.get(e)}getFeatureType(e){return E(this.types,this.typeIdField,e)}getFieldDomain(e,r){const t=r?.feature,i=this.getFeatureType(t);if(i){const r=i.domains&&i.domains[e];if(r&&"inherited"!==r.type)return r}return this._getLayerDomain(e)}async queryAttachments(e,r){await this.load(),e=Q.from(e);const t=this.capabilities;if(!t?.data?.supportsAttachment)throw new l("queryAttachments:not-supported","this layer doesn't support attachments");const{attachmentTypes:i,objectIds:o,globalIds:s,num:a,size:n,start:p,where:y}=e;if(!t?.operations?.supportsQueryAttachments){if(i?.length>0||s?.length>0||n?.length>0||a||p||y)throw new l("queryAttachments:option-not-supported","when 'capabilities.operations.supportsQueryAttachments' is false, only objectIds is supported",e)}if(!(o?.length||s?.length||y))throw new l("queryAttachments:invalid-query","'objectIds', 'globalIds', or 'where' are required to perform attachment query",e);return this.queryTask.executeAttachmentQuery(e,r)}async queryFeatureCount(e=this.createQuery(),r){if(await this.load(),!this.capabilities.operations.supportsQuery)throw new l("queryFeatureCount:not-supported","this layer doesn't support queries.");if(!this.url)throw new l("queryFeatureCount:not-supported","this layer has no url.");const t=this.layer?.apiKey;return await this.queryTask.executeForCount(e,{...r,query:{...this.layer?.customParameters,token:t}})}async queryFeatures(e=this.createQuery(),r){if(await this.load(),!this.capabilities.operations.supportsQuery)throw new l("queryFeatures:not-supported","this layer doesn't support queries.");if(!this.url)throw new l("queryFeatures:not-supported","this layer has no url.");const t=await this.queryTask.execute(e,{...r,query:{...this.layer?.customParameters,token:this.layer?.apiKey}});if(t?.features)for(const i of t.features)i.sourceLayer=this;return t}async queryObjectIds(e=this.createQuery(),r){if(await this.load(),!this.capabilities.operations.supportsQuery)throw new l("queryObjectIds:not-supported","this layer doesn't support queries.");if(!this.url)throw new l("queryObjectIds:not-supported","this layer has no url.");const t=this.layer?.apiKey;return await this.queryTask.executeForIds(e,{...r,query:{...this.layer?.customParameters,token:t}})}async queryRelatedFeatures(e,r){if(await this.load(),!this.capabilities.operations.supportsQuery)throw new l("queryRelatedFeatures:not-supported","this layer doesn't support queries.");if(!this.url)throw new l("queryRelatedFeatures:not-supported","this layer has no url.");const t=this.layer?.apiKey;return await this.queryTask.executeRelationshipQuery(e,{...r,query:{...this.layer?.customParameters,token:t}})}async queryRelatedFeaturesCount(e,r){if(await this.load(),!this.capabilities.operations.supportsQuery)throw new l("queryRelatedFeaturesCount:not-supported","this layer doesn't support queries.");if(!this.capabilities.queryRelated.supportsCount)throw new l("queryRelatedFeaturesCount:not-supported","this layer doesn't support query related counts.");if(!this.url)throw new l("queryRelatedFeaturesCount:not-supported","this layer has no url.");const t=this.layer?.apiKey;return await this.queryTask.executeRelationshipQueryForCount(e,{...r,query:{...this.layer?.customParameters,token:t}})}toExportImageJSON(e){const r={id:this.id,source:this.source?.toJSON()||{mapLayerId:this.id,type:"mapLayer"}},t=c(e,this.definitionExpression);null!=t&&(r.definitionExpression=t);const i=["renderer","labelingInfo","opacity","labelsVisible"].reduce(((e,r)=>(e[r]=this.originIdOf(r),e)),{}),o=Object.keys(i).some((e=>i[e]>L.SERVICE));if(o){const e=r.drawingInfo={};if(i.renderer>L.SERVICE&&(e.renderer=this.renderer?this.renderer.toJSON():null),i.labelsVisible>L.SERVICE&&(e.showLabels=this.labelsVisible),this.labelsVisible&&i.labelingInfo>L.SERVICE)if(this.labelingInfo){!this.loaded&&this.labelingInfo?.some((e=>!e.labelPlacement))&&u.getLogger(this).warnOnce(`A Sublayer (title: ${this.title}, id: ${this.id}) has an undefined 'labelPlacement' and so labels cannot be displayed. Either define a valid 'labelPlacement' or call Sublayer.load() to use a default value based on geometry type.`,{sublayer:this});let r=this.labelingInfo;null!=this.geometryType&&(r=A(this.labelingInfo,H.toJSON(this.geometryType))),e.showLabels=!0,e.labelingInfo=r.filter((e=>e.labelPlacement)).map((e=>e.toJSON({origin:"service",layer:this.layer})))}else e.showLabels=!1;i.opacity>L.SERVICE&&(e.transparency=100-100*this.opacity),this._assignDefaultSymbolColors(e.renderer)}return(this.layer?.capabilities?.exportMap?.supportsSublayerOrderBy??!1)&&this.originIdOf("orderBy")>L.SERVICE&&(r.orderBy=this.orderBy?.map((e=>e.toJSON()))??null),r}_assignDefaultSymbolColors(e){this._forEachSimpleMarkerSymbols(e,(e=>{e.color||"esriSMSX"!==e.style&&"esriSMSCross"!==e.style||(e.outline?.color?e.color=e.outline.color:e.color=[0,0,0,0])}))}_forEachSimpleMarkerSymbols(e,r){if(e){const t=("uniqueValueInfos"in e?e.uniqueValueInfos:"classBreakInfos"in e?e.classBreakInfos:null)??[];for(const e of t)W(e.symbol)&&r(e.symbol);"symbol"in e&&W(e.symbol)&&r(e.symbol),"defaultSymbol"in e&&W(e.defaultSymbol)&&r(e.defaultSymbol)}}_setAndNotifyLayer(e,r){const t=this.layer,i=this._get(e);let o,s;switch(e){case"definitionExpression":case"floorInfo":o="supportsSublayerDefinitionExpression";break;case"minScale":case"maxScale":case"visible":o="supportsSublayerVisibility";break;case"labelingInfo":case"labelsVisible":case"opacity":case"renderer":case"source":o="supportsDynamicLayers",s="supportsModification";break;case"orderBy":o="supportsSublayerOrderBy",s="supportsModification"}const a=D(this).getDefaultOrigin();if("service"!==a){if(o&&!1===this.layer?.capabilities?.exportMap?.[o])return void this._logLockedError(e,`capability not available 'layer.capabilities.exportMap.${o}'`);if(s&&!1===this.capabilities?.exportMap[s])return void this._logLockedError(e,`capability not available 'capabilities.exportMap.${s}'`)}"source"!==e||"not-loaded"===this.loadStatus?(this._set(e,r),"service"!==a&&i!==r&&t&&t.emit&&t.emit("sublayer-update",{propertyName:e,target:this})):this._logLockedError(e,"'source' can't be changed after calling sublayer.load()")}_handleSublayersChange(e,r){r&&(r.forEach((e=>{e.parent=null,e.layer=null})),this.removeAllHandles()),e&&(e.forEach((e=>{e.parent=this,e.layer=this.layer})),this.addHandles([e.on("after-add",(({item:e})=>{e.parent=this,e.layer=this.layer})),e.on("after-remove",(({item:e})=>{e.parent=null,e.layer=null})),e.on("before-changes",(e=>{(this.layer?.capabilities?.exportMap?.supportsSublayersChanges??1)||(u.getLogger(this).error(new l("sublayer:sublayers-non-modifiable","Sublayer can't be added, moved, or removed from the layer's sublayers",{sublayer:this,layer:this.layer})),e.preventDefault())}))]))}_logLockedError(e,r){const{layer:t,declaredClass:i}=this;u.getLogger(i).error(new l("sublayer:locked",`Property '${String(e)}' can't be changed on Sublayer from the layer '${t?.id}'`,{reason:r,sublayer:this,layer:t}))}_getLayerDomain(e){return this.fieldsIndex.get(e)?.domain??null}};ie.test={isMapImageLayerOverridePolicy:e=>e===Z||e===X,isTileImageLayerOverridePolicy:e=>e===Y},e([h({readOnly:!0})],ie.prototype,"capabilities",void 0),e([b("service","capabilities",["layerDefinition.canModifyLayer","layerDefinition.capabilities"])],ie.prototype,"readCapabilities",null),e([h()],ie.prototype,"defaultPopupTemplate",null),e([h({type:String,value:null,json:{name:"layerDefinition.definitionExpression",write:{allowNull:!0,overridePolicy:X}}})],ie.prototype,"definitionExpression",null),e([h({readOnly:!0})],ie.prototype,"effectiveScaleRange",null),e([b("service","maxScaleRange",["minScale","maxScale"])],ie.prototype,"readMaxScaleRange",null),e([h({type:[q],json:{origins:{service:{read:{source:"layerDefinition.fields"}}}}})],ie.prototype,"fields",void 0),e([h({readOnly:!0})],ie.prototype,"fieldsIndex",null),e([h({type:C,value:null,json:{name:"layerDefinition.floorInfo",read:{source:"layerDefinition.floorInfo"},write:{target:"layerDefinition.floorInfo",overridePolicy:X},origins:{"web-scene":{read:!1,write:!1}}}})],ie.prototype,"floorInfo",null),e([h({type:K,json:{read:{source:"layerDefinition.extent"}}})],ie.prototype,"fullExtent",void 0),e([h({type:H.apiValues,json:{origins:{service:{name:"layerDefinition.geometryType",read:{reader:H.read}}}}})],ie.prototype,"geometryType",void 0),e([h({type:String})],ie.prototype,"globalIdField",void 0),e([b("service","globalIdField",["layerDefinition.globalIdField","layerDefinition.fields"])],ie.prototype,"readGlobalIdFieldFromService",null),e([h({type:v,json:{write:{ignoreOrigin:!0}}})],ie.prototype,"id",null),e([h({readOnly:!0})],ie.prototype,"isTable",void 0),e([b("service","isTable",["type"])],ie.prototype,"readIsTable",null),e([h({value:null,type:[_],json:{read:{source:"layerDefinition.drawingInfo.labelingInfo"},write:{target:"layerDefinition.drawingInfo.labelingInfo",overridePolicy:Z}}})],ie.prototype,"labelingInfo",null),e([S("labelingInfo")],ie.prototype,"writeLabelingInfo",null),e([h({type:Boolean,value:!0,json:{read:{source:"layerDefinition.drawingInfo.showLabels"},write:{target:"layerDefinition.drawingInfo.showLabels",overridePolicy:Z}}})],ie.prototype,"labelsVisible",null),e([h({value:null})],ie.prototype,"layer",null),e([h({type:String,json:{write:{overridePolicy:Y}}})],ie.prototype,"layerItemId",void 0),e([h({type:Boolean,value:!0,json:{origins:{service:{read:{enabled:!1}}},read:{source:"showLegend"},write:{target:"showLegend",overridePolicy:ee}}})],ie.prototype,"legendEnabled",void 0),e([h({type:["show","hide","hide-children"],value:"show",json:{read:!1,write:!1,origins:{"web-scene":{read:!0,write:!0}}}})],ie.prototype,"listMode",null),e([h({type:Number,value:0,json:{write:{overridePolicy:Z}}})],ie.prototype,"minScale",null),e([b("minScale",["minScale","layerDefinition.minScale"])],ie.prototype,"readMinScale",null),e([h({type:Number,value:0,json:{write:{overridePolicy:Z}}})],ie.prototype,"maxScale",null),e([b("maxScale",["maxScale","layerDefinition.maxScale"])],ie.prototype,"readMaxScale",null),e([h()],ie.prototype,"objectIdField",void 0),e([b("service","objectIdField",["layerDefinition.objectIdField","layerDefinition.fields"])],ie.prototype,"readObjectIdFieldFromService",null),e([h({type:Number,value:1,json:{write:{target:"layerDefinition.drawingInfo.transparency",overridePolicy:Z}}})],ie.prototype,"opacity",null),e([b("opacity",["layerDefinition.drawingInfo.transparency","layerDefinition.transparency"])],ie.prototype,"readOpacity",null),e([S("opacity")],ie.prototype,"writeOpacity",null),e([h({value:null,type:[M],json:{name:"layerDefinition.orderBy",read:{reader:O}}})],ie.prototype,"orderBy",null),e([h({json:{type:v,write:{target:"parentLayerId",writerEnsuresNonNull:!0,overridePolicy:Z}}})],ie.prototype,"parent",void 0),e([S("parent")],ie.prototype,"writeParent",null),e([h({type:Boolean,value:!0,json:{read:{source:"disablePopup",reader:(e,r)=>!r.disablePopup},write:{target:"disablePopup",overridePolicy:ee,writer(e,r,t){r[t]=!e}}}})],ie.prototype,"popupEnabled",void 0),e([h({type:r,json:{read:{source:"popupInfo"},write:{target:"popupInfo",overridePolicy:ee}}})],ie.prototype,"popupTemplate",void 0),e([h({readOnly:!0})],ie.prototype,"queryTask",null),e([h({type:[V],readOnly:!0,json:{origins:{service:{read:{source:"layerDefinition.relationships"}}}}})],ie.prototype,"relationships",void 0),e([h({types:t,value:null,json:{name:"layerDefinition.drawingInfo.renderer",write:{overridePolicy:Z},origins:{"web-scene":{types:i,name:"layerDefinition.drawingInfo.renderer",write:{overridePolicy:Z}}}}})],ie.prototype,"renderer",null),e([h({types:{key:"type",base:null,typeMap:{"data-layer":N,"map-layer":U}},cast(e){if(e){if("mapLayerId"in e)return j(U,e);if("dataSource"in e)return j(N,e)}return e},json:{name:"layerDefinition.source",write:{overridePolicy:Z}}})],ie.prototype,"source",null),e([h()],ie.prototype,"sourceJSON",void 0),e([h({type:G,json:{origins:{service:{read:{source:"layerDefinition.extent.spatialReference"}}}}})],ie.prototype,"spatialReference",void 0),e([h({value:null,json:{type:[v],write:{target:"subLayerIds",allowNull:!0,overridePolicy:Z}}})],ie.prototype,"sublayers",null),e([m("sublayers")],ie.prototype,"castSublayers",null),e([S("sublayers")],ie.prototype,"writeSublayers",null),e([h({type:String,json:{name:"name",write:{overridePolicy:ee}}})],ie.prototype,"title",void 0),e([b("service","title",["name","layerDefinition.name"])],ie.prototype,"readTitle",null),e([h({type:String})],ie.prototype,"typeIdField",void 0),e([h({json:{read:!1},readOnly:!0,value:"sublayer"})],ie.prototype,"type",void 0),e([b("typeIdField",["layerDefinition.typeIdField"])],ie.prototype,"readTypeIdField",null),e([h({type:[P],json:{origins:{service:{read:{source:"layerDefinition.types"}}}}})],ie.prototype,"types",void 0),e([h({type:String,json:{name:"layerUrl",write:{overridePolicy:Y}}})],ie.prototype,"url",null),e([h({type:Boolean,value:!0,json:{read:{source:"defaultVisibility"},write:{target:"defaultVisibility",overridePolicy:Z}}})],ie.prototype,"visible",null),e([S("visible")],ie.prototype,"writeVisible",null),ie=z=e([g("esri.layers.support.Sublayer")],ie);const oe=ie;export{oe as default};
5
+ import{_ as e}from"../../chunks/tslib.es6.js";import"../../geometry.js";import r from"../../PopupTemplate.js";import"../../renderers/ClassBreaksRenderer.js";import"../../renderers/DictionaryRenderer.js";import"../../renderers/DotDensityRenderer.js";import"../../renderers/HeatmapRenderer.js";import"../../renderers/PieChartRenderer.js";import"../../renderers/Renderer.js";import"../../renderers/SimpleRenderer.js";import"../../renderers/UniqueValueRenderer.js";import"../../renderers/support/jsonUtils.js";import{rendererTypes as t,webSceneRendererTypes as i}from"../../renderers/support/types.js";import o from"../../request.js";import{isSymbol3D as s}from"../../symbols.js";import a from"../../core/Collection.js";import l from"../../core/Error.js";import has from"../../core/has.js";import n from"../../core/Identifiable.js";import{clone as p}from"../../core/lang.js";import u from"../../core/Loadable.js";import y from"../../core/Logger.js";import{MultiOriginJSONMixin as d}from"../../core/MultiOriginJSONSupport.js";import{sqlAnd as c}from"../../core/sql.js";import{objectToQuery as f}from"../../core/urlUtils.js";import{property as h}from"../../core/accessorSupport/decorators/property.js";import{cast as m}from"../../core/accessorSupport/decorators/cast.js";import{reader as b}from"../../core/accessorSupport/decorators/reader.js";import{subclass as g}from"../../core/accessorSupport/decorators/subclass.js";import{writer as S}from"../../core/accessorSupport/decorators/writer.js";import{ensureInteger as I,ensureType as w,Integer as v,ensureClass as j}from"../../core/accessorSupport/ensureType.js";import{OriginId as L,nameToId as F}from"../../core/accessorSupport/PropertyOrigin.js";import{getProperties as D}from"../../core/accessorSupport/utils.js";import x from"../graphics/sources/support/QueryTask.js";import{readOrderByInfos as O}from"../mixins/OrderedLayer.js";import{getFeatureType as E}from"./featureLayerUtils.js";import P from"./FeatureType.js";import q from"./Field.js";import T from"./FieldsIndex.js";import{fixRendererFields as R}from"./fieldUtils.js";import _ from"./LabelClass.js";import{validateLabelingInfo as A}from"./labelingInfo.js";import C from"./LayerFloorInfo.js";import V from"./OrderByInfo.js";import M from"./Relationship.js";import{getFeatureLayerCapabilities as k}from"./serviceCapabilitiesUtils.js";import{DataLayerSource as N}from"./source/DataLayerSource.js";import{MapLayerSource as U}from"./source/MapLayerSource.js";import{parseUrl as B}from"../../rest/utils.js";import Q from"../../rest/support/AttachmentQuery.js";import J from"../../rest/support/Query.js";import{createPopupTemplate as $}from"../../support/popupUtils.js";import K from"../../geometry/Extent.js";import G from"../../geometry/SpatialReference.js";import{featureGeometryTypeKebabDictionary as H}from"../../geometry/support/typeUtils.js";var z;function W(e){return"esriSMS"===e?.type}function X(e,r,t){const i=this.originIdOf(r)>=F(t.origin);return{ignoreOrigin:!0,allowNull:i,enabled:!!t&&("map-image"===t.layer?.type&&(t.writeSublayerStructure||i))}}function Y(e,r,t){return{enabled:!!t&&("tile"===t.layer?.type&&(t.origin&&this.originIdOf(r)>=F(t.origin)||this._isOverridden(r)))}}function Z(e,r,t){return{ignoreOrigin:!0,enabled:t&&t.writeSublayerStructure||!1}}function ee(e,r,t){return{ignoreOrigin:!0,enabled:!!t?.writeSublayerStructure&&this.originIdOf(r)>L.SERVICE}}function re(e,r,t){return{ignoreOrigin:!0,enabled:!!t&&(t.writeSublayerStructure||this.originIdOf(r)>=F(t.origin))}}let te=0;const ie=new Set(["layer","parent","loaded","loadStatus","loadError","loadWarnings"]);let oe=z=class extends(d(n.IdentifiableMixin(u))){constructor(e){super(e),this.capabilities=void 0,this.maxScaleRange={minScale:0,maxScale:0},this.fields=null,this.fullExtent=null,this.geometryType=null,this.globalIdField=null,this.isTable=!1,this.legendEnabled=!0,this.objectIdField=null,this.parent=null,this.popupEnabled=!0,this.popupTemplate=null,this.relationships=null,this.sourceJSON=null,this.spatialReference=null,this.title=null,this.typeIdField=null,this.type="sublayer",this.types=null,this._lastParsedUrl=null}async load(e){return this.addResolvingPromise((async()=>{const{layer:r,url:t}=this;if(!r&&!t)throw new l("sublayer:missing-layer","Sublayer can't be loaded without being part of a layer",{sublayer:this});const i=r?await r.fetchSublayerInfo(this,e):(await o(t,{responseType:"json",query:{f:"json"},...e})).data;i&&(this.sourceJSON=i,this.read({layerDefinition:i},{origin:"service",layer:r,url:B(t)}))})()),this}readCapabilities(e,r){r=r.layerDefinition||r;const{operations:{supportsQuery:t,supportsQueryAttachments:i},query:{supportsFormatPBF:o,supportsOrderBy:s,supportsPagination:a},data:{supportsAttachment:l},queryRelated:n}=k(r,this.url);return{exportMap:{supportsModification:!!r.canModifyLayer},operations:{supportsQuery:t,supportsQueryAttachments:i},data:{supportsAttachment:l},query:{supportsFormatPBF:o,supportsOrderBy:s,supportsPagination:a},queryRelated:n}}get defaultPopupTemplate(){return this.createPopupTemplate()}set definitionExpression(e){this._setAndNotifyLayer("definitionExpression",e)}get effectiveScaleRange(){const{minScale:e,maxScale:r}=this;return{minScale:e,maxScale:r}}readMaxScaleRange(e,r){return{minScale:(r=r.layerDefinition||r).minScale??0,maxScale:r.maxScale??0}}get fieldsIndex(){return new T(this.fields||[])}set floorInfo(e){this._setAndNotifyLayer("floorInfo",e)}readGlobalIdFieldFromService(e,r){if((r=r.layerDefinition||r).globalIdField)return r.globalIdField;if(r.fields)for(const t of r.fields)if("esriFieldTypeGlobalID"===t.type)return t.name}get id(){const e=this._get("id");return e??te++}set id(e){this._get("id")!==e&&(!1!==this.layer?.capabilities?.exportMap?.supportsDynamicLayers?this._set("id",e):this._logLockedError("id","capability not available 'layer.capabilities.exportMap.supportsDynamicLayers'"))}readIsTable(e,r){return"Table"===r.type}set labelingInfo(e){this._setAndNotifyLayer("labelingInfo",e)}writeLabelingInfo(e,r,t,i){e&&e.length&&(r.layerDefinition={drawingInfo:{labelingInfo:e.map((e=>e.write({},i)))}})}set labelsVisible(e){this._setAndNotifyLayer("labelsVisible",e)}set layer(e){this._set("layer",e),this.sublayers?.forEach((r=>r.layer=e))}set listMode(e){this._set("listMode",e)}set minScale(e){this._setAndNotifyLayer("minScale",e)}readMinScale(e,r){return r.minScale||r.layerDefinition?.minScale||0}set maxScale(e){this._setAndNotifyLayer("maxScale",e)}readMaxScale(e,r){return r.maxScale||r.layerDefinition?.maxScale||0}readObjectIdFieldFromService(e,r){if((r=r.layerDefinition||r).objectIdField)return r.objectIdField;const t=r.fields?.find((e=>"esriFieldTypeOID"===e.type));return t?.name}set opacity(e){this._setAndNotifyLayer("opacity",e)}readOpacity(e,r){const{layerDefinition:t}=r;return 1-.01*(t?.transparency??t?.drawingInfo?.transparency??0)}writeOpacity(e,r,t,i){r.layerDefinition={drawingInfo:{transparency:100-100*e}}}set orderBy(e){this._setAndNotifyLayer("orderBy",e)}writeParent(e,r){this.parent&&this.parent!==this.layer?r.parentLayerId=I(this.parent.id):r.parentLayerId=-1}get queryTask(){if(!this.layer)return null;const{capabilities:e,fieldsIndex:r,layer:t,url:i}=this,{spatialReference:o}=t,s="gdbVersion"in t?t.gdbVersion:void 0,a=has("featurelayer-pbf")&&e?.query.supportsFormatPBF;return new x({fieldsIndex:r,gdbVersion:s,pbfSupported:a,queryAttachmentsSupported:e?.operations?.supportsQueryAttachments??!1,sourceSpatialReference:o,url:i})}set renderer(e){if(R(e,this.fieldsIndex),e)for(const r of e.symbols)if(s(r)){y.getLogger(this).warn("Sublayer renderer should use 2D symbols");break}this._setAndNotifyLayer("renderer",e)}get source(){return this._get("source")||new U({mapLayerId:this.id})}set source(e){this._setAndNotifyLayer("source",e)}set sublayers(e){this._handleSublayersChange(e,this._get("sublayers")),this._set("sublayers",e)}castSublayers(e){return w(a.ofType(z),e)}writeSublayers(e,r,t){this.sublayers?.length&&(r[t]=this.sublayers.map((e=>e.id)).toArray().reverse())}readTitle(e,r){return r.layerDefinition?.name??r.name}readTypeIdField(e,r){let t=(r=r.layerDefinition||r).typeIdField;if(t&&r.fields){t=t.toLowerCase();const e=r.fields.find((e=>e.name.toLowerCase()===t));e&&(t=e.name)}return t}get url(){const e=this.layer?.parsedUrl??this._lastParsedUrl,r=this.source;if(!e)return null;if(this._lastParsedUrl=e,"map-layer"===r?.type)return`${e.path}/${r.mapLayerId}`;const t={layer:JSON.stringify({source:this.source})};return`${e.path}/dynamicLayer?${f(t)}`}set url(e){this._overrideIfSome("url",e)}set visible(e){this._setAndNotifyLayer("visible",e)}writeVisible(e,r,t,i){r[t]=this.getAtOrigin("defaultVisibility","service")||e}clone(){const{store:e}=D(this),r=new z;return D(r).store=e.clone(ie),this.commitProperty("url"),r._lastParsedUrl=this._lastParsedUrl,r}createPopupTemplate(e){return $(this,e)}createQuery(){return new J({returnGeometry:!0,where:this.definitionExpression||"1=1"})}async createFeatureLayer(){if(this.hasOwnProperty("sublayers"))return null;const e=(await import("../FeatureLayer.js")).default,{layer:r,url:t}=this;let i;if(t&&this.originIdOf("url")>L.SERVICE)i=new e({url:t});else{if(!r?.parsedUrl)throw new l("createFeatureLayer:missing-information","Cannot create a FeatureLayer without a url or a parent layer");{const t=r.parsedUrl;i=new e({url:t.path}),t&&this.source&&("map-layer"===this.source.type?i.layerId=this.source.mapLayerId:i.dynamicDataSource=this.source)}}return null!=r?.refreshInterval&&(i.refreshInterval=r.refreshInterval),this.definitionExpression&&(i.definitionExpression=this.definitionExpression),this.floorInfo&&(i.floorInfo=p(this.floorInfo)),this.originIdOf("labelingInfo")>L.SERVICE&&(i.labelingInfo=p(this.labelingInfo)),this.originIdOf("labelsVisible")>L.DEFAULTS&&(i.labelsVisible=this.labelsVisible),this.originIdOf("legendEnabled")>L.DEFAULTS&&(i.legendEnabled=this.legendEnabled),this.originIdOf("visible")>L.DEFAULTS&&(i.visible=this.visible),this.originIdOf("minScale")>L.DEFAULTS&&(i.minScale=this.minScale),this.originIdOf("maxScale")>L.DEFAULTS&&(i.maxScale=this.maxScale),this.originIdOf("opacity")>L.DEFAULTS&&(i.opacity=this.opacity),this.originIdOf("popupTemplate")>L.DEFAULTS&&(i.popupTemplate=p(this.popupTemplate)),this.originIdOf("renderer")>L.SERVICE&&(i.renderer=p(this.renderer)),"data-layer"===this.source?.type&&(i.dynamicDataSource=this.source.clone()),this.originIdOf("title")>L.DEFAULTS&&(i.title=this.title),"map-image"===r?.type&&r.originIdOf("customParameters")>L.DEFAULTS&&(i.customParameters=r.customParameters),"tile"===r?.type&&r.originIdOf("customParameters")>L.DEFAULTS&&(i.customParameters=r.customParameters),i}getField(e){return this.fieldsIndex.get(e)}getFeatureType(e){return E(this.types,this.typeIdField,e)}getFieldDomain(e,r){const t=r?.feature,i=this.getFeatureType(t);if(i){const r=i.domains&&i.domains[e];if(r&&"inherited"!==r.type)return r}return this._getLayerDomain(e)}async queryAttachments(e,r){await this.load(),e=Q.from(e);const t=this.capabilities;if(!t?.data?.supportsAttachment)throw new l("queryAttachments:not-supported","this layer doesn't support attachments");const{attachmentTypes:i,objectIds:o,globalIds:s,num:a,size:n,start:p,where:u}=e;if(!t?.operations?.supportsQueryAttachments){if(i?.length>0||s?.length>0||n?.length>0||a||p||u)throw new l("queryAttachments:option-not-supported","when 'capabilities.operations.supportsQueryAttachments' is false, only objectIds is supported",e)}if(!(o?.length||s?.length||u))throw new l("queryAttachments:invalid-query","'objectIds', 'globalIds', or 'where' are required to perform attachment query",e);return this.queryTask.executeAttachmentQuery(e,r)}async queryFeatureCount(e=this.createQuery(),r){if(await this.load(),!this.capabilities.operations.supportsQuery)throw new l("queryFeatureCount:not-supported","this layer doesn't support queries.");if(!this.url)throw new l("queryFeatureCount:not-supported","this layer has no url.");const t=this.layer?.apiKey;return await this.queryTask.executeForCount(e,{...r,query:{...this.layer?.customParameters,token:t}})}async queryFeatures(e=this.createQuery(),r){if(await this.load(),!this.capabilities.operations.supportsQuery)throw new l("queryFeatures:not-supported","this layer doesn't support queries.");if(!this.url)throw new l("queryFeatures:not-supported","this layer has no url.");const t=await this.queryTask.execute(e,{...r,query:{...this.layer?.customParameters,token:this.layer?.apiKey}});if(t?.features)for(const i of t.features)i.sourceLayer=this;return t}async queryObjectIds(e=this.createQuery(),r){if(await this.load(),!this.capabilities.operations.supportsQuery)throw new l("queryObjectIds:not-supported","this layer doesn't support queries.");if(!this.url)throw new l("queryObjectIds:not-supported","this layer has no url.");const t=this.layer?.apiKey;return await this.queryTask.executeForIds(e,{...r,query:{...this.layer?.customParameters,token:t}})}async queryRelatedFeatures(e,r){if(await this.load(),!this.capabilities.operations.supportsQuery)throw new l("queryRelatedFeatures:not-supported","this layer doesn't support queries.");if(!this.url)throw new l("queryRelatedFeatures:not-supported","this layer has no url.");const t=this.layer?.apiKey;return await this.queryTask.executeRelationshipQuery(e,{...r,query:{...this.layer?.customParameters,token:t}})}async queryRelatedFeaturesCount(e,r){if(await this.load(),!this.capabilities.operations.supportsQuery)throw new l("queryRelatedFeaturesCount:not-supported","this layer doesn't support queries.");if(!this.capabilities.queryRelated.supportsCount)throw new l("queryRelatedFeaturesCount:not-supported","this layer doesn't support query related counts.");if(!this.url)throw new l("queryRelatedFeaturesCount:not-supported","this layer has no url.");const t=this.layer?.apiKey;return await this.queryTask.executeRelationshipQueryForCount(e,{...r,query:{...this.layer?.customParameters,token:t}})}toExportImageJSON(e){const r={id:this.id,source:this.source?.toJSON()||{mapLayerId:this.id,type:"mapLayer"}},t=c(e,this.definitionExpression);null!=t&&(r.definitionExpression=t);const i=["renderer","labelingInfo","opacity","labelsVisible"].reduce(((e,r)=>(e[r]=this.originIdOf(r),e)),{}),o=Object.keys(i).some((e=>i[e]>L.SERVICE));if(o){const e=r.drawingInfo={};if(i.renderer>L.SERVICE&&(e.renderer=this.renderer?this.renderer.toJSON():null),i.labelsVisible>L.SERVICE&&(e.showLabels=this.labelsVisible),this.labelsVisible&&i.labelingInfo>L.SERVICE)if(this.labelingInfo){!this.loaded&&this.labelingInfo?.some((e=>!e.labelPlacement))&&y.getLogger(this).warnOnce(`A Sublayer (title: ${this.title}, id: ${this.id}) has an undefined 'labelPlacement' and so labels cannot be displayed. Either define a valid 'labelPlacement' or call Sublayer.load() to use a default value based on geometry type.`,{sublayer:this});let r=this.labelingInfo;null!=this.geometryType&&(r=A(this.labelingInfo,H.toJSON(this.geometryType))),e.showLabels=!0,e.labelingInfo=r.filter((e=>e.labelPlacement)).map((e=>e.toJSON({origin:"service",layer:this.layer})))}else e.showLabels=!1;i.opacity>L.SERVICE&&(e.transparency=100-100*this.opacity),this._assignDefaultSymbolColors(e.renderer)}return(this.layer?.capabilities?.exportMap?.supportsSublayerOrderBy??!1)&&this.originIdOf("orderBy")>L.SERVICE&&(r.orderBy=this.orderBy?.map((e=>e.toJSON()))??null),r}_assignDefaultSymbolColors(e){this._forEachSimpleMarkerSymbols(e,(e=>{e.color||"esriSMSX"!==e.style&&"esriSMSCross"!==e.style||(e.outline?.color?e.color=e.outline.color:e.color=[0,0,0,0])}))}_forEachSimpleMarkerSymbols(e,r){if(e){const t=("uniqueValueInfos"in e?e.uniqueValueInfos:"classBreakInfos"in e?e.classBreakInfos:null)??[];for(const e of t)W(e.symbol)&&r(e.symbol);"symbol"in e&&W(e.symbol)&&r(e.symbol),"defaultSymbol"in e&&W(e.defaultSymbol)&&r(e.defaultSymbol)}}_setAndNotifyLayer(e,r){const t=this.layer,i=this._get(e);let o,s;switch(e){case"definitionExpression":case"floorInfo":o="supportsSublayerDefinitionExpression";break;case"minScale":case"maxScale":case"visible":o="supportsSublayerVisibility";break;case"labelingInfo":case"labelsVisible":case"opacity":case"renderer":case"source":o="supportsDynamicLayers",s="supportsModification";break;case"orderBy":o="supportsSublayerOrderBy",s="supportsModification"}const a=D(this).getDefaultOrigin();if("service"!==a){if(o&&!1===this.layer?.capabilities?.exportMap?.[o])return void this._logLockedError(e,`capability not available 'layer.capabilities.exportMap.${o}'`);if(s&&!1===this.capabilities?.exportMap[s])return void this._logLockedError(e,`capability not available 'capabilities.exportMap.${s}'`)}"source"!==e||"not-loaded"===this.loadStatus?(this._set(e,r),"service"!==a&&i!==r&&t&&t.emit&&t.emit("sublayer-update",{propertyName:e,target:this})):this._logLockedError(e,"'source' can't be changed after calling sublayer.load()")}_handleSublayersChange(e,r){r&&(r.forEach((e=>{e.parent=null,e.layer=null})),this.removeAllHandles()),e&&(e.forEach((e=>{e.parent=this,e.layer=this.layer})),this.addHandles([e.on("after-add",(({item:e})=>{e.parent=this,e.layer=this.layer})),e.on("after-remove",(({item:e})=>{e.parent=null,e.layer=null})),e.on("before-changes",(e=>{(this.layer?.capabilities?.exportMap?.supportsSublayersChanges??1)||(y.getLogger(this).error(new l("sublayer:sublayers-non-modifiable","Sublayer can't be added, moved, or removed from the layer's sublayers",{sublayer:this,layer:this.layer})),e.preventDefault())}))]))}_logLockedError(e,r){const{layer:t,declaredClass:i}=this;y.getLogger(i).error(new l("sublayer:locked",`Property '${String(e)}' can't be changed on Sublayer from the layer '${t?.id}'`,{reason:r,sublayer:this,layer:t}))}_getLayerDomain(e){return this.fieldsIndex.get(e)?.domain??null}};oe.test={isMapImageLayerOverridePolicy:e=>e===ee||e===Z||e===X,isTileImageLayerOverridePolicy:e=>e===Y},e([h({readOnly:!0})],oe.prototype,"capabilities",void 0),e([b("service","capabilities",["layerDefinition.canModifyLayer","layerDefinition.capabilities"])],oe.prototype,"readCapabilities",null),e([h()],oe.prototype,"defaultPopupTemplate",null),e([h({type:String,value:null,json:{name:"layerDefinition.definitionExpression",write:{allowNull:!0,overridePolicy:X}}})],oe.prototype,"definitionExpression",null),e([h({readOnly:!0})],oe.prototype,"effectiveScaleRange",null),e([b("service","maxScaleRange",["minScale","maxScale"])],oe.prototype,"readMaxScaleRange",null),e([h({type:[q],json:{origins:{service:{read:{source:"layerDefinition.fields"}}}}})],oe.prototype,"fields",void 0),e([h({readOnly:!0})],oe.prototype,"fieldsIndex",null),e([h({type:C,value:null,json:{name:"layerDefinition.floorInfo",read:{source:"layerDefinition.floorInfo"},write:{target:"layerDefinition.floorInfo",overridePolicy:X},origins:{"web-scene":{read:!1,write:!1}}}})],oe.prototype,"floorInfo",null),e([h({type:K,json:{read:{source:"layerDefinition.extent"}}})],oe.prototype,"fullExtent",void 0),e([h({type:H.apiValues,json:{origins:{service:{name:"layerDefinition.geometryType",read:{reader:H.read}}}}})],oe.prototype,"geometryType",void 0),e([h({type:String})],oe.prototype,"globalIdField",void 0),e([b("service","globalIdField",["layerDefinition.globalIdField","layerDefinition.fields"])],oe.prototype,"readGlobalIdFieldFromService",null),e([h({type:v,json:{write:{ignoreOrigin:!0}}})],oe.prototype,"id",null),e([h({readOnly:!0})],oe.prototype,"isTable",void 0),e([b("service","isTable",["type"])],oe.prototype,"readIsTable",null),e([h({value:null,type:[_],json:{read:{source:"layerDefinition.drawingInfo.labelingInfo"},write:{target:"layerDefinition.drawingInfo.labelingInfo",overridePolicy:ee}}})],oe.prototype,"labelingInfo",null),e([S("labelingInfo")],oe.prototype,"writeLabelingInfo",null),e([h({type:Boolean,value:!0,json:{read:{source:"layerDefinition.drawingInfo.showLabels"},write:{target:"layerDefinition.drawingInfo.showLabels",overridePolicy:Z}}})],oe.prototype,"labelsVisible",null),e([h({value:null})],oe.prototype,"layer",null),e([h({type:String,json:{write:{overridePolicy:Y}}})],oe.prototype,"layerItemId",void 0),e([h({type:Boolean,value:!0,json:{origins:{service:{read:{enabled:!1}}},read:{source:"showLegend"},write:{target:"showLegend",overridePolicy:re}}})],oe.prototype,"legendEnabled",void 0),e([h({type:["show","hide","hide-children"],value:"show",json:{read:!1,write:!1,origins:{"web-scene":{read:!0,write:!0}}}})],oe.prototype,"listMode",null),e([h({type:Number,value:0,json:{write:{overridePolicy:Z}}})],oe.prototype,"minScale",null),e([b("minScale",["minScale","layerDefinition.minScale"])],oe.prototype,"readMinScale",null),e([h({type:Number,value:0,json:{write:{overridePolicy:Z}}})],oe.prototype,"maxScale",null),e([b("maxScale",["maxScale","layerDefinition.maxScale"])],oe.prototype,"readMaxScale",null),e([h()],oe.prototype,"objectIdField",void 0),e([b("service","objectIdField",["layerDefinition.objectIdField","layerDefinition.fields"])],oe.prototype,"readObjectIdFieldFromService",null),e([h({type:Number,value:1,json:{write:{target:"layerDefinition.drawingInfo.transparency",overridePolicy:Z}}})],oe.prototype,"opacity",null),e([b("opacity",["layerDefinition.drawingInfo.transparency","layerDefinition.transparency"])],oe.prototype,"readOpacity",null),e([S("opacity")],oe.prototype,"writeOpacity",null),e([h({value:null,type:[V],json:{name:"layerDefinition.orderBy",read:{reader:O}}})],oe.prototype,"orderBy",null),e([h({json:{type:v,write:{target:"parentLayerId",writerEnsuresNonNull:!0,overridePolicy:Z}}})],oe.prototype,"parent",void 0),e([S("parent")],oe.prototype,"writeParent",null),e([h({type:Boolean,value:!0,json:{read:{source:"disablePopup",reader:(e,r)=>!r.disablePopup},write:{target:"disablePopup",overridePolicy:re,writer(e,r,t){r[t]=!e}}}})],oe.prototype,"popupEnabled",void 0),e([h({type:r,json:{read:{source:"popupInfo"},write:{target:"popupInfo",overridePolicy:re}}})],oe.prototype,"popupTemplate",void 0),e([h({readOnly:!0})],oe.prototype,"queryTask",null),e([h({type:[M],readOnly:!0,json:{origins:{service:{read:{source:"layerDefinition.relationships"}}}}})],oe.prototype,"relationships",void 0),e([h({types:t,value:null,json:{name:"layerDefinition.drawingInfo.renderer",write:{overridePolicy:ee},origins:{"web-scene":{types:i,name:"layerDefinition.drawingInfo.renderer",write:{overridePolicy:ee}}}}})],oe.prototype,"renderer",null),e([h({types:{key:"type",base:null,typeMap:{"data-layer":N,"map-layer":U}},cast(e){if(e){if("mapLayerId"in e)return j(U,e);if("dataSource"in e)return j(N,e)}return e},json:{name:"layerDefinition.source",write:{overridePolicy:Z}}})],oe.prototype,"source",null),e([h()],oe.prototype,"sourceJSON",void 0),e([h({type:G,json:{origins:{service:{read:{source:"layerDefinition.extent.spatialReference"}}}}})],oe.prototype,"spatialReference",void 0),e([h({value:null,json:{type:[v],write:{target:"subLayerIds",allowNull:!0,overridePolicy:Z}}})],oe.prototype,"sublayers",null),e([m("sublayers")],oe.prototype,"castSublayers",null),e([S("sublayers")],oe.prototype,"writeSublayers",null),e([h({type:String,json:{name:"name",write:{overridePolicy:re}}})],oe.prototype,"title",void 0),e([b("service","title",["name","layerDefinition.name"])],oe.prototype,"readTitle",null),e([h({type:String})],oe.prototype,"typeIdField",void 0),e([h({json:{read:!1},readOnly:!0,value:"sublayer"})],oe.prototype,"type",void 0),e([b("typeIdField",["layerDefinition.typeIdField"])],oe.prototype,"readTypeIdField",null),e([h({type:[P],json:{origins:{service:{read:{source:"layerDefinition.types"}}}}})],oe.prototype,"types",void 0),e([h({type:String,json:{name:"layerUrl",write:{overridePolicy:Y}}})],oe.prototype,"url",null),e([h({type:Boolean,value:!0,json:{read:{source:"defaultVisibility"},write:{target:"defaultVisibility",overridePolicy:Z}}})],oe.prototype,"visible",null),e([S("visible")],oe.prototype,"writeVisible",null),oe=z=e([g("esri.layers.support.Sublayer")],oe);const se=oe;export{se 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.32/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../request.js";import o from"../../core/Error.js";import{once as r}from"../../core/events.js";import s from"../../core/Logger.js";import{clamp as i}from"../../core/mathUtils.js";import{whenOnce as n}from"../../core/reactiveUtils.js";import{isAbsolute as l,makeAbsolute as a,getProxyRule as c,addProxy as d,isBlobProtocol as p,isDataProtocol as m}from"../../core/urlUtils.js";import{property as u}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/RandomLCG.js";import{subclass as h}from"../../core/accessorSupport/decorators/subclass.js";import{writer as v}from"../../core/accessorSupport/decorators/writer.js";import y from"./MediaElementBase.js";import{mediaElementUrlProperty as g,mediaTypeProperty as f}from"./mediaUtils.js";import j from"../video/VideoController.js";import{i as w}from"../../chunks/persistableUrlUtils.js";let b=class extends y{constructor(e){super(e),this.autoplay=!0,this.content=null,this.controller=new j,this.type="video"}load(){const e=this.video;return"string"==typeof e?this.addResolvingPromise(this._preProcessVideoUrl(e).then((async e=>{this.controller.playerUrl=e,await n((()=>this.controller.element)),this.controller.loop=!0,this.controller.muted=!0,this.controller.playsInline=!0,this.controller.crossOrigin="anonymous",await n((()=>"can-play"===this.controller.state)),await this.controller.play(),this.autoplay||this.controller.pause(),this._set("content",this.controller.element)}))):e instanceof HTMLVideoElement?this.addResolvingPromise(this._loadVideo(e).then((()=>{this._set("content",e)}))):this.addResolvingPromise(Promise.reject(new o("video-element:invalid-video-type","Invalid video type",{video:e}))),Promise.resolve(this)}get contentWidth(){return this.content?.videoWidth??0}get contentHeight(){return this.content?.videoHeight??0}get currentTime(){return this.controller.currentTime}set currentTime(e){const t=i(e,0,this.duration);this.controller.setCurrentTime(t)}get duration(){return this.controller.duration}set video(e){"not-loaded"===this.loadStatus?this._set("video",e):s.getLogger(this).error("#video","video cannot be changed after the element is loaded.")}writeVideo(e,t,r,s){if(!e)return void(s?.messages&&s.messages.push(new o("video-element:unsupported-video","video source is missing")));const i=V(e)?e:null;if(!i)return void(s?.messages&&s.messages.push(new o("video-element:unsupported-video","video source must be an absolute url")));!l(i)&&s?.blockedRelativeUrls&&s.blockedRelativeUrls.push(i);const n=a(i);!w(n)?t[r]=n:s?.messages&&s.messages.push(new o("video-element:unsupported-video","video source cannot be an item resource"))}async _preProcessVideoUrl(e){if(c(e))return d(e);try{return await t(e,{method:"head"}),e}catch{return d(e,!0)}}_loadVideo(e){return new Promise(((t,o)=>{const s=r(e,"canplay",(()=>{this.removeHandles("canplay"),this.autoplay?e.play().then(t,o):t()}));this.addHandles(s,"canplay"),"anonymous"!==e.crossOrigin&&(e.crossOrigin="anonymous",p(e.src)||(e.src=e.src))}))}};e([u()],b.prototype,"autoplay",void 0),e([u({readOnly:!0})],b.prototype,"content",void 0),e([u({readOnly:!0})],b.prototype,"contentWidth",null),e([u({readOnly:!0})],b.prototype,"contentHeight",null),e([u()],b.prototype,"controller",void 0),e([u({type:Number})],b.prototype,"currentTime",null),e([u({type:Number})],b.prototype,"duration",null),e([u(g)],b.prototype,"video",null),e([v("video")],b.prototype,"writeVideo",null),e([u(f)],b.prototype,"type",void 0),b=e([h("esri.layers.support.VideoElement")],b);const U=b;function V(e){return"string"==typeof e&&!m(e)&&!p(e)}export{U as default};
5
+ import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../request.js";import o from"../../core/Error.js";import{once as r}from"../../core/events.js";import s from"../../core/Logger.js";import{clamp as i}from"../../core/mathUtils.js";import{whenOnce as n}from"../../core/reactiveUtils.js";import{isAbsolute as l,makeAbsolute as a,getProxyRule as c,addProxy as d,isBlobProtocol as p,isDataProtocol as u}from"../../core/urlUtils.js";import{property as m}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/RandomLCG.js";import{subclass as h}from"../../core/accessorSupport/decorators/subclass.js";import{writer as v}from"../../core/accessorSupport/decorators/writer.js";import y from"./MediaElementBase.js";import{mediaElementUrlProperty as g,mediaTypeProperty as f}from"./mediaUtils.js";import{i as j}from"../../chunks/persistableUrlUtils.js";let w=class extends y{constructor(e){super(e),this.autoplay=!0,this.content=null,this.controller=null,this.type="video"}load(){const e=this.video;return"string"==typeof e?this.addResolvingPromise(Promise.all([this._preProcessVideoUrl(e),import("../video/VideoController.js")]).then((async([e,{default:t}])=>{this.controller=new t,this.controller.playerUrl=e,await n((()=>this.controller?.element)),this.controller.loop=!0,this.controller.muted=!0,this.controller.playsInline=!0,this.controller.crossOrigin="anonymous",await n((()=>"can-play"===this.controller?.state)),await this.controller.play(),this.autoplay||this.controller.pause(),this._set("content",this.controller.element)}))):e instanceof HTMLVideoElement?this.addResolvingPromise(this._loadVideo(e).then((()=>{this._set("content",e)}))):this.addResolvingPromise(Promise.reject(new o("video-element:invalid-video-type","Invalid video type",{video:e}))),Promise.resolve(this)}get contentWidth(){return this.content?.videoWidth??0}get contentHeight(){return this.content?.videoHeight??0}get currentTime(){return this.controller?.currentTime}set currentTime(e){if(!this.controller)return;const t=i(e,0,this.controller.duration);this.controller?.setCurrentTime(t)}get duration(){return this.controller?.duration}set video(e){"not-loaded"===this.loadStatus?this._set("video",e):s.getLogger(this).error("#video","video cannot be changed after the element is loaded.")}writeVideo(e,t,r,s){if(!e)return void(s?.messages&&s.messages.push(new o("video-element:unsupported-video","video source is missing")));const i=U(e)?e:null;if(!i)return void(s?.messages&&s.messages.push(new o("video-element:unsupported-video","video source must be an absolute url")));!l(i)&&s?.blockedRelativeUrls&&s.blockedRelativeUrls.push(i);const n=a(i);!j(n)?t[r]=n:s?.messages&&s.messages.push(new o("video-element:unsupported-video","video source cannot be an item resource"))}async _preProcessVideoUrl(e){if(c(e))return d(e);try{return await t(e,{method:"head"}),e}catch{return d(e,!0)}}_loadVideo(e){return new Promise(((t,o)=>{const s=r(e,"canplay",(()=>{this.removeHandles("canplay"),this.autoplay?e.play().then(t,o):t()}));this.addHandles(s,"canplay"),"anonymous"!==e.crossOrigin&&(e.crossOrigin="anonymous",p(e.src)||(e.src=e.src))}))}};e([m()],w.prototype,"autoplay",void 0),e([m({readOnly:!0})],w.prototype,"content",void 0),e([m({readOnly:!0})],w.prototype,"contentWidth",null),e([m({readOnly:!0})],w.prototype,"contentHeight",null),e([m()],w.prototype,"controller",void 0),e([m({type:Number})],w.prototype,"currentTime",null),e([m({type:Number})],w.prototype,"duration",null),e([m(g)],w.prototype,"video",null),e([v("video")],w.prototype,"writeVideo",null),e([m(f)],w.prototype,"type",void 0),w=e([h("esri.layers.support.VideoElement")],w);const b=w;function U(e){return"string"==typeof e&&!u(e)&&!p(e)}export{b 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.32/esri/copyright.txt for details.
4
4
  */
5
- import{dateOnlyToDateTime as e,timeOnlyToDateTime as n,timestampOffsetToDateTime as i}from"../../support/dateUtils.js";var l;!function(e){e.VALUE_OUT_OF_RANGE="domain-validation-error::value-out-of-range",e.INVALID_CODED_VALUE="domain-validation-error::invalid-coded-value"}(l||(l={}));const t=new Set(["integer","small-integer","big-integer","esriFieldTypeInteger","esriFieldTypeSmallInteger","esriFieldTypeBigInteger"]);function r(e){return null!=e&&t.has(e.type)}function a(e){return null!=e&&("date-only"===e.type||"esriFieldTypeDateOnly"===e.type)}function u(e){return null!=e&&("timestamp-offset"===e.type||"esriFieldTypeTimestampOffset"===e.type)}function o(e){return null!=e&&("time-only"===e.type||"esriFieldTypeTimeOnly"===e.type)}function s(e,n,i){const t=i??e?.domain;if(!t)return null;switch(t.type){case"range":{const{min:t,max:r}=m(e,i);if(null!=t&&+n<t||null!=r&&+n>r)return l.VALUE_OUT_OF_RANGE;break}case"coded-value":case"codedValue":if(null==t.codedValues||t.codedValues.every((e=>null==e||e.code!==n)))return l.INVALID_CODED_VALUE}return null}function m(e,n){const i=n??e?.domain;if(!i||"range"!==i.type)return;const l="range"in i?i.range[0]:i.minValue,t="range"in i?i.range[1]:i.maxValue,s=r(e);return a(e)||o(e)||u(e)?{...d(e,t,l),isInteger:s}:{min:null!=l&&"number"==typeof l?l:null,max:null!=t&&"number"==typeof t?t:null,rawMin:l,rawMax:t,isInteger:s}}function d(l,t,r){return a(l)?{min:e(r)?.toMillis(),max:e(t)?.toMillis(),rawMin:r,rawMax:t}:o(l)?{min:n(r)?.toMillis(),max:n(t)?.toMillis(),rawMin:r,rawMax:t}:u(l)?{min:i(r)?.toMillis(),max:i(t)?.toMillis(),rawMin:r,rawMax:t}:{max:null,min:null}}export{l as DomainValidationError,d as dateTimeFieldValuesToNumericRange,m as getDomainRange,s as validateDomainValue};
5
+ import{dateOnlyToDateTime as e,timeOnlyToDateTime as n,timestampOffsetToDateTime as i}from"../../support/dateUtils.js";var l;!function(e){e.VALUE_OUT_OF_RANGE="domain-validation-error::value-out-of-range",e.INVALID_CODED_VALUE="domain-validation-error::invalid-coded-value"}(l||(l={}));const t=new Set(["integer","small-integer","big-integer","esriFieldTypeInteger","esriFieldTypeSmallInteger","esriFieldTypeBigInteger"]);function r(e){return null!=e&&t.has(e.type)}function a(e){return null!=e&&("date-only"===e.type||"esriFieldTypeDateOnly"===e.type)}function u(e){return null!=e&&("timestamp-offset"===e.type||"esriFieldTypeTimestampOffset"===e.type)}function o(e){return null!=e&&("time-only"===e.type||"esriFieldTypeTimeOnly"===e.type)}function s(e,n,i){const t=i??e?.domain;if(!t)return null;switch(t.type){case"range":{const{min:i,max:r}=m(e,t);if(null!=i&&+n<i||null!=r&&+n>r)return l.VALUE_OUT_OF_RANGE;break}case"coded-value":case"codedValue":if(null==t.codedValues||t.codedValues.every((e=>null==e||e.code!==n)))return l.INVALID_CODED_VALUE}return null}function m(e,n){const i=n??e?.domain;if(!i||"range"!==i.type)return;const l="range"in i?i.range[0]:i.minValue,t="range"in i?i.range[1]:i.maxValue,s=r(e);return a(e)||o(e)||u(e)?{...d(e,t,l),isInteger:s}:{min:null!=l&&"number"==typeof l?l:null,max:null!=t&&"number"==typeof t?t:null,rawMin:l,rawMax:t,isInteger:s}}function d(l,t,r){return a(l)?{min:e(r)?.toMillis(),max:e(t)?.toMillis(),rawMin:r,rawMax:t}:o(l)?{min:n(r)?.toMillis(),max:n(t)?.toMillis(),rawMin:r,rawMax:t}:u(l)?{min:i(r)?.toMillis(),max:i(t)?.toMillis(),rawMin:r,rawMax:t}:{max:null,min:null}}export{l as DomainValidationError,d as dateTimeFieldValuesToNumericRange,m as getDomainRange,s as validateDomainValue};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.32/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../core/Error.js";import{getDeepValue as n,setDeepValue as i}from"../../core/object.js";import{union as t}from"../../core/SetUtils.js";import{parseWhereClause as r}from"../../core/sql.js";import{validateDomainValue as l,getDomainRange as o,DomainValidationError as s}from"./domainUtils.js";import{getFieldNameFromSimpleExpression as a}from"../../support/arcadeExpressionUtils.js";import{loadArcade as u}from"../../support/arcadeOnDemand.js";import{isStringOrNull as f,isString as c}from"../../support/guards.js";const d=/^([0-9_])/,m=/[^a-z0-9_\u0080-\uffff]+/gi;function p(e){if(null==e)return null;return e.trim().replaceAll(m,"_").replace(d,"F$1")||null}const y=["field","field2","field3","normalizationField","rotationInfo.field","proportionalSymbolInfo.field","proportionalSymbolInfo.normalizationField","colorInfo.field","colorInfo.normalizationField"],g=["field","normalizationField"];function F(e,n){if(null!=e&&null!=n)for(const i of Array.isArray(e)?e:[e])if(I(y,i,n),"visualVariables"in i&&i.visualVariables)for(const e of i.visualVariables)I(g,e,n)}function I(e,t,r){if(e)for(const l of e){const e=n(l,t),o=e&&"function"!=typeof e&&r.get(e);o&&i(l,o.name,t)}}function b(e,n){if(null!=e&&n?.fields?.length)if("startField"in e){const i=n.get(e.startField),t=n.get(e.endField);e.startField=i?.name??null,e.endField=t?.name??null}else{const i=n.get(e.startTimeField),t=n.get(e.endTimeField);e.startTimeField=i?.name??null,e.endTimeField=t?.name??null}}const w=new Set;function x(e,n){return e&&n?(w.clear(),T(w,e,n),Array.from(w).sort()):[]}function T(e,n,i){if(i)if(n?.fields?.length)if(i.includes("*"))for(const{name:t}of n.fields)e.add(t);else for(const t of i)h(e,n,t);else{if(i.includes("*"))return e.clear(),void e.add("*");for(const n of i)null!=n&&e.add(n)}}function h(e,n,i){if("string"==typeof i)if(n){const t=n.get(i);t&&e.add(t.name)}else e.add(i)}function E(e,n){return null==n||null==e?[]:n.includes("*")?(e.fields??[]).map((e=>e.name)):n}function _(e,n,i=1){if(!n||!e)return[];if(n.includes("*"))return["*"];const t=x(e,n);return t.length/e.fields.length>=i?["*"]:t}async function A(e,n,i){if(!i)return;let t;const r=a(i);if(r)t=[r];else{const{arcadeUtils:e}=await u();t=e.extractFieldNames(i,n?.fields?.map((e=>e.name)))}for(const l of t)h(e,n,l)}async function S(n,i,t){if(t&&"1=1"!==t){const l=await r(t,i);if(!l.isStandardized)throw new e("fieldUtils:collectFilterFields","Where clause is not standardized",{where:t});T(n,i,l.fieldNames)}}function N({displayField:e,fields:n}){return e||(n?.length?$(n,"name-or-title")||$(n,"unique-identifier")||$(n,"type-or-category")||v(n):null)}function v(e){for(const n of e){if(!n?.name)continue;const e=n.name.toLowerCase();if(e.includes("name")||e.includes("title"))return n.name}return null}function $(e,n){for(const i of e)if(i?.valueType&&i.valueType===n)return i.name;return null}async function L(e){if(!e)return[];const n=new Set;return await D(n,e),Array.from(n).sort()}async function D(e,n){if(!n)return;const i=n.elevationInfo?.featureExpressionInfo;return i?i.collectRequiredFields(e,n.fieldsIndex):void 0}function M(e,n,i){i.onStatisticExpression?A(e,n,i.onStatisticExpression.expression):e.add(i.onStatisticField)}async function O(e,n,i){if(!n||!i||!("fields"in i))return;const t=[],r=i.popupTemplate;t.push(V(e,n,r)),i.fields&&t.push(...i.fields.map((async i=>M(e,n.fieldsIndex,i)))),await Promise.all(t)}async function V(e,n,i){const t=[];i?.expressionInfos&&t.push(...i.expressionInfos.map((i=>A(e,n.fieldsIndex,i.expression))));const r=i?.content;if(Array.isArray(r))for(const l of r)"expression"===l.type&&l.expressionInfo&&t.push(A(e,n.fieldsIndex,l.expressionInfo.expression));await Promise.all(t)}async function j(e,n,i){n&&(n.timeInfo&&i?.timeExtent&&T(e,n.fieldsIndex,[n.timeInfo.startField,n.timeInfo.endField]),n.floorInfo&&T(e,n.fieldsIndex,[n.floorInfo.floorField]),null!=i?.where&&await S(e,n.fieldsIndex,i.where))}async function U(e,n,i){n&&i&&await Promise.all(i.map((i=>R(e,n,i))))}async function R(e,n,i){n&&i&&(i.valueExpression?await A(e,n.fieldsIndex,i.valueExpression):i.field&&h(e,n.fieldsIndex,i.field))}async function C(e){if(!e)return[];const n="timeInfo"in e&&e.timeInfo;return n?x(e.fieldsIndex,[e.trackIdField,n.startField,n.endField]):[]}function G(e){return e?x(e.fieldsIndex,B(e)):[]}function k(e){if(!e)return[];const n=e.geometryFieldsInfo;return n?x(e.fieldsIndex,[n.shapeAreaField,n.shapeLengthField]):[]}const X=new Set(["oid","global-id","guid"]),z=new Set(["oid","global-id"]),P=[/^fnode_$/i,/^tnode_$/i,/^lpoly_$/i,/^rpoly_$/i,/^poly_$/i,/^shape$/i,/^shape_$/i,/^subclass$/i,/^subclass_$/i,/^rings_ok$/i,/^rings_nok$/i,/perimeter/i,/objectid/i,/_i$/i];function q(e){const n=new Set;Y(e).forEach((e=>n.add(e))),k(e).forEach((e=>n.add(e.toLowerCase())));const i=e&&"infoFor3D"in e?e.infoFor3D:void 0;return i&&(Object.values(i.assetMapFieldRoles).forEach((e=>n.add(e.toLowerCase()))),Object.values(i.transformFieldRoles).forEach((e=>n.add(e.toLowerCase())))),Array.from(n)}function B(e){if(!e)return[];const n="editFieldsInfo"in e&&e.editFieldsInfo;if(!n)return[];const{creationDateField:i,creatorField:t,editDateField:r,editorField:l}=n;return[i,t,r,l].filter(Boolean)}function Y(e){return B(e).map((e=>e.toLowerCase()))}function J(e,n){return e.editable&&!X.has(e.type)&&!Y(n).includes(e.name?.toLowerCase()??"")}function W(e,n){const i=e.name?.toLowerCase()??"";return!(null!=n?.objectIdField&&i===n.objectIdField.toLowerCase()||null!=n?.globalIdField&&i===n.globalIdField.toLowerCase()||q(n).includes(i)||z.has(e.type)||P.some((e=>e.test(i))))}async function H(e){if(!e)return[];const n=new Set;return await K(n,e),Array.from(n).sort()}async function K(e,n){const{labelingInfo:i,fieldsIndex:t}=n;i?.length&&await Promise.all(i.map((n=>Q(e,t,n))))}async function Q(e,n,i){if(!i)return;const t=i.getLabelExpression(),r=i.where;if("arcade"===t.type)await A(e,n,t.expression);else{const i=t.expression.match(/{[^}]*}/g);i&&i.forEach((i=>{h(e,n,i.slice(1,-1))}))}await S(e,n,r)}function Z(e){const n=e.defaultValue;return void 0!==n&&le(e,n)?n:e.nullable?null:void 0}function ee(e){const n="string"==typeof e?{type:e}:e;return ge(n)?255:"esriFieldTypeDate"===n.type||"date"===n.type?8:void 0}function ne(e){return"number"==typeof e&&!isNaN(e)&&isFinite(e)}function ie(e){return null===e||ne(e)}function te(e){return null===e||Number.isInteger(e)}function re(){return!0}function le(e,n){let i;switch(e.type){case"date":case"integer":case"long":case"small-integer":case"big-integer":case"esriFieldTypeDate":case"esriFieldTypeInteger":case"esriFieldTypeLong":case"esriFieldTypeSmallInteger":case"esriFieldTypeBigInteger":i=e.nullable?te:Number.isInteger;break;case"double":case"single":case"esriFieldTypeSingle":case"esriFieldTypeDouble":i=e.nullable?ie:ne;break;case"string":case"esriFieldTypeString":i=e.nullable?f:c;break;default:i=re}return 1===arguments.length?i:i(n)}const oe=["integer","small-integer","big-integer"],se=["single","double"],ae=[...oe,...se],ue=["esriFieldTypeInteger","esriFieldTypeSmallInteger","esriFieldTypeBigInteger"],fe=["esriFieldTypeSingle","esriFieldTypeDouble"],ce=new Set([...oe,...ue]),de=new Set([...se,...fe]),me=t(ce,de);function pe(e){return null!=e&&ce.has(e.type)}function ye(e){return null!=e&&me.has(e.type)}function ge(e){return null!=e&&("string"===e.type||"esriFieldTypeString"===e.type)}function Fe(e){return null!=e&&("date"===e.type||"esriFieldTypeDate"===e.type)}function Ie(e){return null!=e&&("date-only"===e.type||"esriFieldTypeDateOnly"===e.type)}function be(e){return null!=e&&("timestamp-offset"===e.type||"esriFieldTypeTimestampOffset"===e.type)}function we(e){return null!=e&&("time-only"===e.type||"esriFieldTypeTimeOnly"===e.type)}function xe(e){return null!=e&&("oid"===e.type||"esriFieldTypeOID"===e.type)}function Te(e){return null!=e&&("global-id"===e.type||"esriFieldTypeGlobalID"===e.type)}function he(e,n){return null===Se(e,n)}var Ee,_e;function Ae(e){return null==e||"number"==typeof e&&isNaN(e)?null:e}function Se(e,n){return null==e||e.nullable&&null===n?null:ye(e)&&!Ne(e.type,Number(n))?Ee.OUT_OF_RANGE:le(e,n)?e.domain?l(e,n):null:_e.INVALID_TYPE}function Ne(e,n){const i="string"==typeof e?$e(e):e;if(!i)return!1;const t=i.min,r=i.max;return i.isInteger?Number.isInteger(n)&&n>=t&&n<=r:n>=t&&n<=r}function ve(e,n){const i=o(e,n);return i||(ye(e)?$e(e.type):void 0)}function $e(e){switch(e){case"esriFieldTypeSmallInteger":case"small-integer":return De;case"esriFieldTypeInteger":case"integer":return Me;case"esriFieldTypeBigInteger":case"big-integer":return Oe;case"esriFieldTypeSingle":case"single":return Ve;case"esriFieldTypeDouble":case"double":return je}}function Le(e){if(!ne(e))return null;if(Number.isInteger(e)){if(e>=De.min&&e<=De.max)return"esriFieldTypeSmallInteger";if(e>=Me.min&&e<=Me.max)return"esriFieldTypeInteger";if(e>=Oe.min&&e<=Oe.max)return"esriFieldTypeBigInteger"}return e>=Ve.min&&e<=Ve.max?"esriFieldTypeSingle":"esriFieldTypeDouble"}!function(e){e.OUT_OF_RANGE="numeric-range-validation-error::out-of-range"}(Ee||(Ee={})),function(e){e.INVALID_TYPE="type-validation-error::invalid-type"}(_e||(_e={}));const De={min:-32768,max:32767,isInteger:!0,rawMin:-32768,rawMax:32767},Me={min:-2147483648,max:2147483647,isInteger:!0,rawMin:-2147483648,rawMax:2147483647},Oe={min:-Number.MAX_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER,isInteger:!0,rawMin:-Number.MAX_SAFE_INTEGER,rawMax:Number.MAX_SAFE_INTEGER},Ve={min:-34e37,max:12e37,isInteger:!1,rawMin:-34e37,rawMax:12e37},je={min:-Number.MAX_VALUE,max:Number.MAX_VALUE,isInteger:!1,rawMin:-Number.MAX_VALUE,rawMax:Number.MAX_VALUE};function Ue(e,n,i){switch(e){case s.INVALID_CODED_VALUE:return`Value ${i} is not in the coded domain - field: ${n.name}, domain: ${JSON.stringify(n.domain)}`;case s.VALUE_OUT_OF_RANGE:return`Value ${i} is out of the range of valid values - field: ${n.name}, domain: ${JSON.stringify(n.domain)}`;case _e.INVALID_TYPE:return`Value ${i} is not a valid value for the field type - field: ${n.name}, type: ${n.type}, nullable: ${n.nullable}`;case Ee.OUT_OF_RANGE:{const{min:e,max:t}=$e(n.type);return`Value ${i} is out of range for the number type - field: ${n.name}, type: ${n.type}, value range is ${e} to ${t}`}}}function Re(e,n){return!Ce(e,n,null)}function Ce(e,n,i){if(!n?.attributes||!e){if(null!=i)for(const n of e??[])i.add(n);return!0}const t=new Set(Object.keys(n.attributes));let r=!1;for(const l of e)if(!t.has(l)){if(r=!0,null==i)break;i.add(l)}return r}async function Ge(e,n){const i=new Set;for(const t of n)await A(i,e.fieldsIndex,t);return Array.from(i).sort()}function ke(e){return!!e&&["raster.itempixelvalue","raster.servicepixelvalue"].some((n=>e.toLowerCase().startsWith(n)))}async function Xe(e,n){const i=new Set;return e?.collectRequiredFields&&await e.collectRequiredFields(i,n),Array.from(i).sort()}function ze(e){const n=e?.match(/{[^}]+}/g);return n?n.map((e=>e.slice(1,-1).split(":")[0].trim())):[]}export{Ee as NumericRangeValidationError,_e as TypeValidationError,Oe as bigIntegerRange,A as collectArcadeFieldNames,D as collectElevationFields,O as collectFeatureReductionFields,h as collectField,T as collectFields,j as collectFilterFields,K as collectLabelingFields,U as collectOrderByInfos,V as collectPopupTemplateFields,je as doubleRange,ze as extractSubstitutionTemplatesFromString,Re as featureHasFields,x as fixFields,F as fixRendererFields,b as fixTimeInfoFields,fe as floatJSONTypes,se as floatTypes,N as getDisplayFieldName,B as getEditTrackingFields,L as getElevationFields,Ge as getExpressionFields,G as getFeatureEditFields,k as getFeatureGeometryFields,ee as getFieldDefaultLength,Z as getFieldDefaultValue,ve as getFieldRange,H as getLabelingFields,q as getLowerCaseDefaultHiddenFields,Y as getLowerCaseEditTrackingFields,Le as getNumericTypeForValue,Xe as getRendererFields,C as getTimeFields,ue as integerJSONTypes,Me as integerRange,oe as integerTypes,Fe as isDateField,Ie as isDateOnlyField,J as isFieldEditable,W as isFieldVisibleByDefault,Te as isGlobalIDField,pe as isIntegerField,Ne as isNumberInRange,ye as isNumericField,xe as isObjectIDField,ke as isRasterPixelValueField,ge as isStringField,we as isTimeOnlyField,be as isTimestampOffsetField,he as isValidFieldValue,le as isValueMatchingFieldType,p as normalizeFieldName,ae as numericTypes,_ as packFields,Ce as populateMissingFields,y as rendererFields,Ae as sanitizeNullFieldValue,Ve as singleRange,De as smallIntegerRange,E as unpackFieldNames,Se as validateFieldValue,Ue as validationErrorToString,g as visualVariableFields};
5
+ import e from"../../core/Error.js";import{getDeepValue as n,setDeepValue as i}from"../../core/object.js";import{union as t}from"../../core/SetUtils.js";import{parseWhereClause as r}from"../../core/sql.js";import{getDomainRange as l,DomainValidationError as o}from"./domainUtils.js";import{getFieldNameFromSimpleExpression as s}from"../../support/arcadeExpressionUtils.js";import{loadArcade as a}from"../../support/arcadeOnDemand.js";import{isStringOrNull as u,isString as f}from"../../support/guards.js";const c=/^([0-9_])/,d=/[^a-z0-9_\u0080-\uffff]+/gi;function p(e){if(null==e)return null;return e.trim().replaceAll(d,"_").replace(c,"F$1")||null}const m=["field","field2","field3","normalizationField","rotationInfo.field","proportionalSymbolInfo.field","proportionalSymbolInfo.normalizationField","colorInfo.field","colorInfo.normalizationField"],y=["field","normalizationField"];function g(e,n){if(null!=e&&null!=n)for(const i of Array.isArray(e)?e:[e])if(F(m,i,n),"visualVariables"in i&&i.visualVariables)for(const e of i.visualVariables)F(y,e,n)}function F(e,t,r){if(e)for(const l of e){const e=n(l,t),o=e&&"function"!=typeof e&&r.get(e);o&&i(l,o.name,t)}}function I(e,n){if(null!=e&&n?.fields?.length)if("startField"in e){const i=n.get(e.startField),t=n.get(e.endField);e.startField=i?.name??null,e.endField=t?.name??null}else{const i=n.get(e.startTimeField),t=n.get(e.endTimeField);e.startTimeField=i?.name??null,e.endTimeField=t?.name??null}}const b=new Set;function w(e,n){return e&&n?(b.clear(),x(b,e,n),Array.from(b).sort()):[]}function x(e,n,i){if(i)if(n?.fields?.length)if(i.includes("*"))for(const{name:t}of n.fields)e.add(t);else for(const t of i)T(e,n,t);else{if(i.includes("*"))return e.clear(),void e.add("*");for(const n of i)null!=n&&e.add(n)}}function T(e,n,i){if("string"==typeof i)if(n){const t=n.get(i);t&&e.add(t.name)}else e.add(i)}function h(e,n){return null==n||null==e?[]:n.includes("*")?(e.fields??[]).map((e=>e.name)):n}function E(e,n,i=1){if(!n||!e)return[];if(n.includes("*"))return["*"];const t=w(e,n);return t.length/e.fields.length>=i?["*"]:t}async function _(e,n,i){if(!i)return;let t;const r=s(i);if(r)t=[r];else{const{arcadeUtils:e}=await a();t=e.extractFieldNames(i,n?.fields?.map((e=>e.name)))}for(const l of t)T(e,n,l)}async function A(n,i,t){if(t&&"1=1"!==t){const l=await r(t,i);if(!l.isStandardized)throw new e("fieldUtils:collectFilterFields","Where clause is not standardized",{where:t});x(n,i,l.fieldNames)}}function S({displayField:e,fields:n}){return e||(n?.length?v(n,"name-or-title")||v(n,"unique-identifier")||v(n,"type-or-category")||N(n):null)}function N(e){for(const n of e){if(!n?.name)continue;const e=n.name.toLowerCase();if(e.includes("name")||e.includes("title"))return n.name}return null}function v(e,n){for(const i of e)if(i?.valueType&&i.valueType===n)return i.name;return null}async function $(e){if(!e)return[];const n=new Set;return await L(n,e),Array.from(n).sort()}async function L(e,n){if(!n)return;const i=n.elevationInfo?.featureExpressionInfo;return i?i.collectRequiredFields(e,n.fieldsIndex):void 0}function D(e,n,i){i.onStatisticExpression?_(e,n,i.onStatisticExpression.expression):e.add(i.onStatisticField)}async function M(e,n,i){if(!n||!i||!("fields"in i))return;const t=[],r=i.popupTemplate;t.push(O(e,n,r)),i.fields&&t.push(...i.fields.map((async i=>D(e,n.fieldsIndex,i)))),await Promise.all(t)}async function O(e,n,i){const t=[];i?.expressionInfos&&t.push(...i.expressionInfos.map((i=>_(e,n.fieldsIndex,i.expression))));const r=i?.content;if(Array.isArray(r))for(const l of r)"expression"===l.type&&l.expressionInfo&&t.push(_(e,n.fieldsIndex,l.expressionInfo.expression));await Promise.all(t)}async function V(e,n,i){n&&(n.timeInfo&&i?.timeExtent&&x(e,n.fieldsIndex,[n.timeInfo.startField,n.timeInfo.endField]),n.floorInfo&&x(e,n.fieldsIndex,[n.floorInfo.floorField]),null!=i?.where&&await A(e,n.fieldsIndex,i.where))}async function j(e,n,i){n&&i&&await Promise.all(i.map((i=>U(e,n,i))))}async function U(e,n,i){n&&i&&(i.valueExpression?await _(e,n.fieldsIndex,i.valueExpression):i.field&&T(e,n.fieldsIndex,i.field))}async function R(e){if(!e)return[];const n="timeInfo"in e&&e.timeInfo;return n?w(e.fieldsIndex,[e.trackIdField,n.startField,n.endField]):[]}function C(e){return e?w(e.fieldsIndex,q(e)):[]}function G(e){if(!e)return[];const n=e.geometryFieldsInfo;return n?w(e.fieldsIndex,[n.shapeAreaField,n.shapeLengthField]):[]}const k=new Set(["oid","global-id","guid"]),X=new Set(["oid","global-id"]),z=[/^fnode_$/i,/^tnode_$/i,/^lpoly_$/i,/^rpoly_$/i,/^poly_$/i,/^shape$/i,/^shape_$/i,/^subclass$/i,/^subclass_$/i,/^rings_ok$/i,/^rings_nok$/i,/perimeter/i,/objectid/i,/_i$/i];function P(e){const n=new Set;B(e).forEach((e=>n.add(e))),G(e).forEach((e=>n.add(e.toLowerCase())));const i=e&&"infoFor3D"in e?e.infoFor3D:void 0;return i&&(Object.values(i.assetMapFieldRoles).forEach((e=>n.add(e.toLowerCase()))),Object.values(i.transformFieldRoles).forEach((e=>n.add(e.toLowerCase())))),Array.from(n)}function q(e){if(!e)return[];const n="editFieldsInfo"in e&&e.editFieldsInfo;if(!n)return[];const{creationDateField:i,creatorField:t,editDateField:r,editorField:l}=n;return[i,t,r,l].filter(Boolean)}function B(e){return q(e).map((e=>e.toLowerCase()))}function Y(e,n){return e.editable&&!k.has(e.type)&&!B(n).includes(e.name?.toLowerCase()??"")}function J(e,n){const i=e.name?.toLowerCase()??"";return!(null!=n?.objectIdField&&i===n.objectIdField.toLowerCase()||null!=n?.globalIdField&&i===n.globalIdField.toLowerCase()||P(n).includes(i)||X.has(e.type)||z.some((e=>e.test(i))))}async function W(e){if(!e)return[];const n=new Set;return await H(n,e),Array.from(n).sort()}async function H(e,n){const{labelingInfo:i,fieldsIndex:t}=n;i?.length&&await Promise.all(i.map((n=>K(e,t,n))))}async function K(e,n,i){if(!i)return;const t=i.getLabelExpression(),r=i.where;if("arcade"===t.type)await _(e,n,t.expression);else{const i=t.expression.match(/{[^}]*}/g);i&&i.forEach((i=>{T(e,n,i.slice(1,-1))}))}await A(e,n,r)}function Q(e){const n=e.defaultValue;return void 0!==n&&re(e,n)?n:e.nullable?null:void 0}function Z(e){const n="string"==typeof e?{type:e}:e;return ye(n)?255:"esriFieldTypeDate"===n.type||"date"===n.type?8:void 0}function ee(e){return"number"==typeof e&&!isNaN(e)&&isFinite(e)}function ne(e){return null===e||ee(e)}function ie(e){return null===e||Number.isInteger(e)}function te(){return!0}function re(e,n){let i;switch(e.type){case"date":case"integer":case"long":case"small-integer":case"big-integer":case"esriFieldTypeDate":case"esriFieldTypeInteger":case"esriFieldTypeLong":case"esriFieldTypeSmallInteger":case"esriFieldTypeBigInteger":i=e.nullable?ie:Number.isInteger;break;case"double":case"single":case"esriFieldTypeSingle":case"esriFieldTypeDouble":i=e.nullable?ne:ee;break;case"string":case"esriFieldTypeString":i=e.nullable?u:f;break;default:i=te}return 1===arguments.length?i:i(n)}const le=["integer","small-integer","big-integer"],oe=["single","double"],se=[...le,...oe],ae=["esriFieldTypeInteger","esriFieldTypeSmallInteger","esriFieldTypeBigInteger"],ue=["esriFieldTypeSingle","esriFieldTypeDouble"],fe=new Set([...le,...ae]),ce=new Set([...oe,...ue]),de=t(fe,ce);function pe(e){return null!=e&&fe.has(e.type)}function me(e){return null!=e&&de.has(e.type)}function ye(e){return null!=e&&("string"===e.type||"esriFieldTypeString"===e.type)}function ge(e){return null!=e&&("date"===e.type||"esriFieldTypeDate"===e.type)}function Fe(e){return null!=e&&("date-only"===e.type||"esriFieldTypeDateOnly"===e.type)}function Ie(e){return null!=e&&("timestamp-offset"===e.type||"esriFieldTypeTimestampOffset"===e.type)}function be(e){return null!=e&&("time-only"===e.type||"esriFieldTypeTimeOnly"===e.type)}function we(e){return null!=e&&("oid"===e.type||"esriFieldTypeOID"===e.type)}function xe(e){return null!=e&&("global-id"===e.type||"esriFieldTypeGlobalID"===e.type)}function Te(e,n){return null===Ae(e,n)}var he,Ee;function _e(e){return null==e||"number"==typeof e&&isNaN(e)?null:e}function Ae(e,n){return null==e||e.nullable&&null===n?null:re(e,n)?me(e)&&!Se(e.type,Number(n))?he.OUT_OF_RANGE:null:Ee.INVALID_TYPE}function Se(e,n){const i="string"==typeof e?ve(e):e;if(!i)return!1;const t=i.min,r=i.max;return i.isInteger?Number.isInteger(n)&&n>=t&&n<=r:n>=t&&n<=r}function Ne(e,n){const i=l(e,n);return i||(me(e)?ve(e.type):void 0)}function ve(e){switch(e){case"esriFieldTypeSmallInteger":case"small-integer":return Le;case"esriFieldTypeInteger":case"integer":return De;case"esriFieldTypeBigInteger":case"big-integer":return Me;case"esriFieldTypeSingle":case"single":return Oe;case"esriFieldTypeDouble":case"double":return Ve}}function $e(e){if(!ee(e))return null;if(Number.isInteger(e)){if(e>=Le.min&&e<=Le.max)return"esriFieldTypeSmallInteger";if(e>=De.min&&e<=De.max)return"esriFieldTypeInteger";if(e>=Me.min&&e<=Me.max)return"esriFieldTypeBigInteger"}return e>=Oe.min&&e<=Oe.max?"esriFieldTypeSingle":"esriFieldTypeDouble"}!function(e){e.OUT_OF_RANGE="numeric-range-validation-error::out-of-range"}(he||(he={})),function(e){e.INVALID_TYPE="type-validation-error::invalid-type"}(Ee||(Ee={}));const Le={min:-32768,max:32767,isInteger:!0,rawMin:-32768,rawMax:32767},De={min:-2147483648,max:2147483647,isInteger:!0,rawMin:-2147483648,rawMax:2147483647},Me={min:-Number.MAX_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER,isInteger:!0,rawMin:-Number.MAX_SAFE_INTEGER,rawMax:Number.MAX_SAFE_INTEGER},Oe={min:-34e37,max:12e37,isInteger:!1,rawMin:-34e37,rawMax:12e37},Ve={min:-Number.MAX_VALUE,max:Number.MAX_VALUE,isInteger:!1,rawMin:-Number.MAX_VALUE,rawMax:Number.MAX_VALUE};function je(e,n,i){switch(e){case o.INVALID_CODED_VALUE:return`Value ${i} is not in the coded domain - field: ${n.name}, domain: ${JSON.stringify(n.domain)}`;case o.VALUE_OUT_OF_RANGE:return`Value ${i} is out of the range of valid values - field: ${n.name}, domain: ${JSON.stringify(n.domain)}`;case Ee.INVALID_TYPE:return`Value ${i} is not a valid value for the field type - field: ${n.name}, type: ${n.type}, nullable: ${n.nullable}`;case he.OUT_OF_RANGE:{const{min:e,max:t}=ve(n.type);return`Value ${i} is out of range for the number type - field: ${n.name}, type: ${n.type}, value range is ${e} to ${t}`}}}function Ue(e,n){return!Re(e,n,null)}function Re(e,n,i){if(!n?.attributes||!e){if(null!=i)for(const n of e??[])i.add(n);return!0}const t=new Set(Object.keys(n.attributes));let r=!1;for(const l of e)if(!t.has(l)){if(r=!0,null==i)break;i.add(l)}return r}async function Ce(e,n){const i=new Set;for(const t of n)await _(i,e.fieldsIndex,t);return Array.from(i).sort()}function Ge(e){return!!e&&["raster.itempixelvalue","raster.servicepixelvalue"].some((n=>e.toLowerCase().startsWith(n)))}async function ke(e,n){const i=new Set;return e?.collectRequiredFields&&await e.collectRequiredFields(i,n),Array.from(i).sort()}function Xe(e){const n=e?.match(/{[^}]+}/g);return n?n.map((e=>e.slice(1,-1).split(":")[0].trim())):[]}export{he as NumericRangeValidationError,Ee as TypeValidationError,Me as bigIntegerRange,_ as collectArcadeFieldNames,L as collectElevationFields,M as collectFeatureReductionFields,T as collectField,x as collectFields,V as collectFilterFields,H as collectLabelingFields,j as collectOrderByInfos,O as collectPopupTemplateFields,Ve as doubleRange,Xe as extractSubstitutionTemplatesFromString,Ue as featureHasFields,w as fixFields,g as fixRendererFields,I as fixTimeInfoFields,ue as floatJSONTypes,oe as floatTypes,S as getDisplayFieldName,q as getEditTrackingFields,$ as getElevationFields,Ce as getExpressionFields,C as getFeatureEditFields,G as getFeatureGeometryFields,Z as getFieldDefaultLength,Q as getFieldDefaultValue,Ne as getFieldRange,W as getLabelingFields,P as getLowerCaseDefaultHiddenFields,B as getLowerCaseEditTrackingFields,$e as getNumericTypeForValue,ke as getRendererFields,R as getTimeFields,ae as integerJSONTypes,De as integerRange,le as integerTypes,ge as isDateField,Fe as isDateOnlyField,Y as isFieldEditable,J as isFieldVisibleByDefault,xe as isGlobalIDField,pe as isIntegerField,Se as isNumberInRange,me as isNumericField,we as isObjectIDField,Ge as isRasterPixelValueField,ye as isStringField,be as isTimeOnlyField,Ie as isTimestampOffsetField,Te as isValidFieldValue,re as isValueMatchingFieldType,p as normalizeFieldName,se as numericTypes,E as packFields,Re as populateMissingFields,m as rendererFields,_e as sanitizeNullFieldValue,Oe as singleRange,Le as smallIntegerRange,h as unpackFieldNames,Ae as validateFieldValue,je as validationErrorToString,y as visualVariableFields};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.32/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../chunks/tslib.es6.js";import o from"../core/Clonable.js";import t from"../core/JSONSupport.js";import{property as r}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/Logger.js";import"../core/RandomLCG.js";import{enumeration as i}from"../core/accessorSupport/decorators/enumeration.js";import{subclass as s}from"../core/accessorSupport/decorators/subclass.js";import{idealEdgeLengthTypeJsonMap as p}from"./enums.js";let a=class extends(o.ClonableMixin(t)){constructor(e){super(e),this.absoluteIdealEdgeLength=1,this.autoRepulsionRadius=!0,this.idealEdgeLengthType="multiplier",this.multiplicativeIdealEdgeLength=1,this.repulsionRadiusMultiplier=1}};e([r({type:Number,range:{min:0,max:360},json:{write:!0}})],a.prototype,"absoluteIdealEdgeLength",void 0),e([r({type:Boolean,json:{write:!0}})],a.prototype,"autoRepulsionRadius",void 0),e([i(p)],a.prototype,"idealEdgeLengthType",void 0),e([r({type:Number,range:{min:0,max:5},json:{write:!0}})],a.prototype,"multiplicativeIdealEdgeLength",void 0),e([r({type:Number,range:{min:1,max:99},json:{write:!0}})],a.prototype,"repulsionRadiusMultiplier",void 0),a=e([s("esri.linkChart.OrganicLayoutSettings")],a);const n=a;export{n as default};
5
+ import{_ as e}from"../chunks/tslib.es6.js";import o from"../core/Clonable.js";import t from"../core/JSONSupport.js";import{property as r}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/Logger.js";import"../core/RandomLCG.js";import{enumeration as i}from"../core/accessorSupport/decorators/enumeration.js";import{subclass as s}from"../core/accessorSupport/decorators/subclass.js";import{idealEdgeLengthTypeJsonMap as p}from"./enums.js";let a=class extends(o.ClonableMixin(t)){constructor(e){super(e),this.absoluteIdealEdgeLength=1,this.autoRepulsionRadius=!0,this.computationBudgetTime=1,this.idealEdgeLengthType="multiplier",this.multiplicativeIdealEdgeLength=1,this.repulsionRadiusMultiplier=1}};e([r({type:Number,range:{min:0,max:360},json:{write:!0}})],a.prototype,"absoluteIdealEdgeLength",void 0),e([r({type:Boolean,json:{write:!0}})],a.prototype,"autoRepulsionRadius",void 0),e([r({type:Number,json:{write:!1}})],a.prototype,"computationBudgetTime",void 0),e([i(p)],a.prototype,"idealEdgeLengthType",void 0),e([r({type:Number,range:{min:0,max:5},json:{write:!0}})],a.prototype,"multiplicativeIdealEdgeLength",void 0),e([r({type:Number,range:{min:1,max:99},json:{write:!0}})],a.prototype,"repulsionRadiusMultiplier",void 0),a=e([s("esri.linkChart.OrganicLayoutSettings")],a);const n=a;export{n as default};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arcgis/core",
3
- "version": "4.32.0-next.20241219",
3
+ "version": "4.32.0-next.20241221",
4
4
  "homepage": "https://js.arcgis.com",
5
5
  "description": "ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API",
6
6
  "keywords": [