@arcgis/core 4.31.0-next.20240521 → 4.31.0-next.20240523

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 (127) hide show
  1. package/WebMap.js +1 -1
  2. package/assets/components/assets/icon/developerCredentials16.json +1 -0
  3. package/assets/components/assets/icon/developerCredentials24.json +1 -0
  4. package/assets/components/assets/icon/developerCredentials32.json +1 -0
  5. package/assets/esri/core/workers/RemoteClient.js +1 -1
  6. package/assets/esri/core/workers/chunks/{d7722531be4892293cb1.js → 00c49f6c84444e69f3a1.js} +1 -1
  7. package/assets/esri/core/workers/chunks/01927419855947110cc1.js.LICENSE.txt +1 -1
  8. package/assets/esri/core/workers/chunks/{df26d7d07fed1f124fc2.js → 0903b492782dca69eb48.js} +1 -1
  9. package/assets/esri/core/workers/chunks/158c05b16372d8ed33ea.js.LICENSE.txt +1 -1
  10. package/assets/esri/core/workers/chunks/190913c221964292333b.js.LICENSE.txt +1 -1
  11. package/assets/esri/core/workers/chunks/{2529a4b1e135223833f0.js → 2635ab64e75d4ec700a8.js} +1 -1
  12. package/assets/esri/core/workers/chunks/{f965644347007e3d68e2.js → 27dc94db9ed42b237ecb.js} +1 -1
  13. package/assets/esri/core/workers/chunks/36d620a9c051e451e6b3.js +1 -0
  14. package/assets/esri/core/workers/chunks/{0ae3ea7a73f3b5083968.js → 3a01cf7e3355f3c78378.js} +1 -1
  15. package/assets/esri/core/workers/chunks/4268373bf374b2a6252a.js.LICENSE.txt +1 -1
  16. package/assets/esri/core/workers/chunks/43e1c935452b489e422e.js +1 -0
  17. package/assets/esri/core/workers/chunks/{15212a82e283d6df2873.js → 4ae885f257660545ceeb.js} +1 -1
  18. package/assets/esri/core/workers/chunks/{4ea2ced4b5ea1c8a1cee.js → 4ba866a10711b6a8158f.js} +1 -1
  19. package/assets/esri/core/workers/chunks/50ee28a1944bde74a7c1.js +1 -0
  20. package/assets/esri/core/workers/chunks/59b193d42e8abf9d4088.js.LICENSE.txt +1 -1
  21. package/assets/esri/core/workers/chunks/{eafbe663f7a61d3222c5.js → 5efe1300a39ab9c7bbab.js} +1 -1
  22. package/assets/esri/core/workers/chunks/{eac4ec8c410eaf9e621c.js → 606f8b907166190a8b65.js} +2 -2
  23. package/assets/esri/core/workers/chunks/{eac4ec8c410eaf9e621c.js.LICENSE.txt → 606f8b907166190a8b65.js.LICENSE.txt} +1 -1
  24. package/assets/esri/core/workers/chunks/{5349b0de83ae4be8afe2.js → 6c1ded9acf5c8be493ea.js} +1 -1
  25. package/assets/esri/core/workers/chunks/{46225ebc10a4398170b5.js → 712ba8ad69b1aab6f508.js} +1 -1
  26. package/assets/esri/core/workers/chunks/{7d210c2a5a135da2c37d.js → 7c68dc664c0b4cf2a46b.js} +1 -1
  27. package/assets/esri/core/workers/chunks/88c7d84a1fde246ca71f.js +1 -0
  28. package/assets/esri/core/workers/chunks/948867b3c17f6c0e753a.js +1 -0
  29. package/assets/esri/core/workers/chunks/9b04a666726b5d2ff3c5.js.LICENSE.txt +1 -1
  30. package/assets/esri/core/workers/chunks/9c75837b7e75f0f38dc0.js.LICENSE.txt +1 -1
  31. package/assets/esri/core/workers/chunks/{9a217c5c55ce6fb1d3cd.js → a111eb0ae78a9f5be981.js} +1 -1
  32. package/assets/esri/core/workers/chunks/a6b138f330625d98f856.js +1 -0
  33. package/assets/esri/core/workers/chunks/{e4a0fd9e0f8887009b92.js → a8a19e5a7ae4ec16480a.js} +1 -1
  34. package/assets/esri/core/workers/chunks/{fcf0016d56df8a69f6c1.js → aa198e898b46c6e89d0b.js} +1 -1
  35. package/assets/esri/core/workers/chunks/{04faa3bf4ef5a6f0ccb4.js → b3de9bc3e75476b0a7e9.js} +1 -1
  36. package/assets/esri/core/workers/chunks/b61e458ef5021adba1cb.js +1 -0
  37. package/assets/esri/core/workers/chunks/{bd0545bb100b3393fd85.js → bbec62f8792520993909.js} +1 -1
  38. package/assets/esri/core/workers/chunks/bf6e75cc75d3bdfb70cb.js +1 -0
  39. package/assets/esri/core/workers/chunks/{5acac4616c53a95cc48f.js → c0c8e1a709648e1305c6.js} +1 -1
  40. package/assets/esri/core/workers/chunks/{4f3a87586e334c52d0bf.js → caffbaa8b0a67d117f34.js} +1 -1
  41. package/assets/esri/core/workers/chunks/{7b4ed96554722be59ae2.js → d8140b5316e80d734155.js} +1 -1
  42. package/assets/esri/core/workers/chunks/dde183c6bb1710ff16df.js.LICENSE.txt +1 -1
  43. package/assets/esri/core/workers/chunks/e3711bc5b100b64cac3a.js +1 -0
  44. package/assets/esri/core/workers/chunks/{2d5d66cee7c3ec992bcd.js → e93e59f6907fa4c1081c.js} +1 -1
  45. package/assets/esri/images/portal/knowledgegraphlayer16.png +0 -0
  46. package/assets/esri/themes/base/widgets/_FeatureTable.scss +15 -1
  47. package/assets/esri/themes/base/widgets/_Grid.scss +4 -1
  48. package/assets/esri/themes/dark/main.css +1 -1
  49. package/assets/esri/themes/light/main.css +1 -1
  50. package/assets/esri/themes/light/view.css +1 -1
  51. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable.json +1 -1
  52. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_en.json +1 -1
  53. package/chunks/LineSeries.js +1 -1
  54. package/chunks/Theme.js +1 -1
  55. package/chunks/Tooltip.js +1 -1
  56. package/chunks/chartUtilsAm5.js +1 -1
  57. package/core/sql/WhereClause.js +1 -1
  58. package/core/workers/InvokeHandler.js +1 -1
  59. package/core/workers/RemoteClient.js +1 -1
  60. package/interfaces.d.ts +568 -48
  61. package/layers/ImageryTileLayer.js +1 -1
  62. package/layers/LinkChartLayer.js +1 -1
  63. package/layers/knowledgeGraph/KnowledgeGraphLayerDataManager.js +1 -1
  64. package/layers/mixins/OperationalLayer.js +1 -1
  65. package/layers/support/editableLayers.js +1 -1
  66. package/package.json +2 -2
  67. package/portal/PortalItem.js +1 -1
  68. package/rest/knowledgeGraph/wasmInterface/updateToWasmEncodedFactories.js +1 -1
  69. package/rest/print.js +1 -1
  70. package/rest/support/printTaskUtils.js +1 -1
  71. package/smartMapping/renderers/support/referenceSizeUtils.js +1 -1
  72. package/smartMapping/support/adapters/support/layerUtils.js +1 -1
  73. package/support/revision.js +1 -1
  74. package/symbols/cim/effects/EffectControlMeasureLine.js +1 -1
  75. package/views/2d/GoToManager.js +1 -1
  76. package/views/2d/engine/webgl/shaderGraph/techniques/labels/LabelMeshWriter.js +1 -1
  77. package/views/2d/engine/webgl/shaderGraph/techniques/mesh/utils.js +1 -1
  78. package/views/2d/layers/FeatureLayerView2D.js +1 -1
  79. package/views/2d/layers/features/FeaturePipelineWorker.js +1 -1
  80. package/views/2d/layers/features/PipelineConnectionHandlers.js +1 -1
  81. package/views/2d/layers/features/Processor.js +1 -1
  82. package/views/2d/layers/features/sources/FeatureSource.js +1 -1
  83. package/views/2d/layers/features/sources/FeatureSourceQueryInfo.js +1 -1
  84. package/views/2d/layers/features/sources/strategies/AFetchLoadStrategy.js +1 -1
  85. package/views/2d/layers/support/FeatureCommandQueue.js +1 -1
  86. package/views/3d/environment/SceneViewEnvironmentManager.js +1 -1
  87. package/views/3d/interactive/editingTools/ManipulatedObject3DGraphic.js +1 -1
  88. package/views/3d/interactive/editingTools/move/MoveTool3D.js +1 -1
  89. package/views/3d/interactive/editingTools/reshape/reshapeTooltipUtils.js +1 -1
  90. package/views/3d/interactive/editingTools/tooltipUtils3D.js +1 -1
  91. package/views/3d/interactive/editingTools/transform/ScaleRotateMeshAdapter.js +1 -1
  92. package/views/3d/interactive/editingTools/transform/ScaleRotateTransform.js +1 -1
  93. package/views/3d/interactive/editingTools/transform/TransformTool3D.js +1 -1
  94. package/views/3d/interactive/editingTools/undoRecords.js +5 -0
  95. package/views/SceneView.js +1 -1
  96. package/views/interactive/tooltip/tooltipCommonUtils.js +1 -1
  97. package/views/layers/ImageryTileLayerView.js +1 -1
  98. package/webdoc/support/SlideThumbnail.js +1 -1
  99. package/widgets/Bookmarks/BookmarksUserState.js +1 -1
  100. package/widgets/Bookmarks.js +1 -1
  101. package/widgets/CatalogLayerList/CatalogLayerListViewModel.d.ts +4 -0
  102. package/widgets/CatalogLayerList.d.ts +4 -0
  103. package/widgets/CatalogLayerList.js +1 -1
  104. package/widgets/DirectionalPad/DirectionalPadViewModel.js +1 -1
  105. package/widgets/Expand.js +1 -1
  106. package/widgets/FeatureForm/support/textManipulationUtils.js +1 -1
  107. package/widgets/FeatureTable/VisibleElements.js +1 -1
  108. package/widgets/FeatureTable/support/FeatureStore.js +1 -1
  109. package/widgets/FeatureTable.js +1 -1
  110. package/widgets/Features/FeaturesViewModel.js +1 -1
  111. package/widgets/LayerList/ListItemPanel.js +1 -1
  112. package/widgets/LayerList/support/layerListUtils.js +1 -1
  113. package/widgets/Sketch/SketchViewModel.js +1 -1
  114. package/widgets/UtilityNetworkAssociations/UtilityNetworkAssociationsViewModel.js +1 -1
  115. package/widgets/VideoPlayer/components/SettingsButton.js +1 -1
  116. package/assets/esri/core/workers/chunks/0753c636c2801f067235.js +0 -1
  117. package/assets/esri/core/workers/chunks/50936725c9bd23b780ef.js +0 -1
  118. package/assets/esri/core/workers/chunks/5c8c5290b9fcb5a4468f.js +0 -1
  119. package/assets/esri/core/workers/chunks/7745209175eb744aee5c.js +0 -1
  120. package/assets/esri/core/workers/chunks/80b1b1e8f3f7b9d2ad20.js +0 -1
  121. package/assets/esri/core/workers/chunks/aa020d495f464eff0134.js +0 -1
  122. package/assets/esri/core/workers/chunks/bf2af659da8e33d3c8bf.js +0 -1
  123. package/assets/esri/core/workers/chunks/cbb3a56e4072cdf25a9d.js +0 -1
  124. package/assets/esri/core/workers/chunks/fb48e8e42379fdf8a094.js +0 -1
  125. package/views/3d/interactive/editingTools/transform/undoRecords.js +0 -5
  126. package/views/3d/support/MapCoordsHelper.js +0 -5
  127. package/widgets/Bookmarks/bookmarkUtils.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.31/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../chunks/tslib.es6.js";import t from"../PopupTemplate.js";import{ClonableMixin as r}from"../core/Clonable.js";import s from"../core/Error.js";import i from"../core/Logger.js";import{MultiOriginJSONMixin as o}from"../core/MultiOriginJSONSupport.js";import{debounce as a,throwIfAbortError as n}from"../core/promiseUtils.js";import{watch as l}from"../core/reactiveUtils.js";import{property as p}from"../core/accessorSupport/decorators/property.js";import{ensureClass as c,Integer as m}from"../core/accessorSupport/ensureType.js";import"../core/RandomLCG.js";import"../core/has.js";import{enumeration as u}from"../core/accessorSupport/decorators/enumeration.js";import{subclass as h}from"../core/accessorSupport/decorators/subclass.js";import d from"./Layer.js";import{ArcGISService as y}from"./mixins/ArcGISService.js";import{BlendLayer as f}from"./mixins/BlendLayer.js";import{CustomParametersMixin as g}from"./mixins/CustomParametersMixin.js";import{ImageryTileMixin as v}from"./mixins/ImageryTileMixin.js";import{OperationalLayer as w}from"./mixins/OperationalLayer.js";import{PortalLayer as R}from"./mixins/PortalLayer.js";import{RefreshableLayer as S}from"./mixins/RefreshableLayer.js";import{ScaleRangeLayer as j}from"./mixins/ScaleRangeLayer.js";import{TemporalLayer as F}from"./mixins/TemporalLayer.js";import{legendEnabled as b}from"./support/commonProperties.js";import _ from"./support/Field.js";import{interpolationKebab as O}from"./support/rasterEnums.js";import P from"./support/RasterFunction.js";import x from"./support/rasterDatasets/FunctionRaster.js";import I from"./support/rasterDatasets/RasterFactory.js";import{getPrimaryRasterUrls as T,create as L}from"./support/rasterFunctions/rasterFunctionHelper.js";import{createPopupTemplate as N}from"../support/popupUtils.js";import{SaveOperationType as J}from"../webdoc/interfaces.js";let C=class extends(f(j(w(R(g(v(F(y(S(o(r(d)))))))))))){constructor(...e){super(...e),this._primaryRasters=[],this.bandIds=null,this.interpolation=null,this.legendEnabled=!0,this.isReference=null,this.listMode="show",this.sourceJSON=null,this.version=null,this.type="imagery-tile",this.operationalLayerType="ArcGISTiledImageServiceLayer",this.popupEnabled=!0,this.popupTemplate=null,this.fields=null,this.source=void 0,this._debouncedSaveOperations=a((async(e,t,r)=>{const{save:s,saveAs:i}=await import("./save/imageryUtils.js");switch(e){case J.SAVE:return s(this,t);case J.SAVE_AS:return i(this,r,t)}}))}normalizeCtorArgs(e,t){return"string"==typeof e?{url:e,...t}:e}load(e){const t=null!=e?e.signal:null;return this.addResolvingPromise(this.loadFromPortal({supportedTypes:["Image Service"]},e).catch(n).then((()=>this._openRaster(t)))),Promise.resolve(this)}get defaultPopupTemplate(){return this.createPopupTemplate()}get rasterFields(){const e=[new _({name:"Raster.ServicePixelValue",alias:"Pixel Value",domain:null,editable:!1,length:50,type:"string"}),new _({name:"Raster.ServicePixelValue.Raw",alias:"Raw Pixel Value",domain:null,editable:!1,length:50,type:"string"})],{serviceRasterInfo:t}=this,r=t?.attributeTable,s=null!=r?r.fields:null,i="Raster.";if(s){const t=s.filter((e=>"oid"!==e.type&&"value"!==e.name.toLowerCase())).map((e=>{const t=e.clone();return t.name=i+e.name,t}));e.push(...t)}const o=t?.dataType,a=t?.multidimensionalInfo;if(("vector-magdir"===o||"vector-uv"===o)&&null!=a){const t=a.variables[0].unit?.trim(),r="Magnitude"+(t?` (${t})`:"");e.push(new _({name:"Raster.Magnitude",alias:r,domain:null,editable:!1,type:"double"})),e.push(new _({name:"Raster.Direction",alias:"Direction (°)",domain:null,editable:!1,type:"double"}))}return e}createPopupTemplate(e){const{rasterFields:t}=this,r=new Set(t.map((({name:e})=>e)).filter((e=>"raster.servicepixelvalue.raw"!==e.toLowerCase())));return N({fields:t,title:this.title},{...e,visibleFieldNames:r})}async generateRasterInfo(e,t){if(e=c(P,e),await this.load(),!e||"none"===e.functionName?.toLowerCase())return this.serviceRasterInfo;try{const{rasterInfo:r}=await this._openFunctionRaster(e,t);return r}catch(r){if(r instanceof s)throw r;throw new s("imagery-tile-layer","the given raster function is not supported")}}async save(e){return this._debouncedSaveOperations(J.SAVE,e)}async saveAs(e,t){return this._debouncedSaveOperations(J.SAVE_AS,t,e)}write(e,t){const r=this._primaryRasters[0]??this.raster;if(this.loaded?"RasterTileServer"===r.datasetFormat&&("Raster"===r.tileType||"Map"===r.tileType):this.url&&/\/ImageServer(\/|\/?$)/i.test(this.url))return super.write(e,t);if(t?.messages){const e=`${t.origin}/${t.layerContainerType||"operational-layers"}`;t.messages.push(new s("layer:unsupported",`Layers (${this.title}, ${this.id}) of type '${this.declaredClass}' are not supported in the context of '${e}'`,{layer:this}))}return null}async _openRaster(e){let t=!1;if(this.raster)await this._openFromRaster(this.raster,e),t="Function"===this.raster.datasetFormat;else{const{url:t,rasterFunction:r,source:i}=this;if(!t&&!i)throw new s("imagery-tile-layer:open","missing url or source parameter");i?await this._openFromSource(i,e):r?await this._openFromUrlWithRasterFunction(t,r,e):await this._openFromUrl(t,e)}const r=this.raster.rasterInfo;if(!r)throw new s("imagery-tile-layer:load","cannot load resources on "+this.url);if(this._set("serviceRasterInfo",t?r:this._primaryRasters[0].rasterInfo),this._set("spatialReference",r.spatialReference),this.sourceJSON=this.sourceJSON||this.raster.sourceJSON,null!=this.sourceJSON){const e="Map"===this.raster.tileType&&null!=this.sourceJSON.minLOD&&null!=this.sourceJSON.maxLOD?this.sourceJSON:{...this.sourceJSON,minScale:0,maxScale:0};this.read(e,{origin:"service"})}else this.read({tileInfo:this.serviceRasterInfo?.storageInfo.tileInfo.toJSON()},{origin:"service"});this.title||(this.title=this.raster.datasetName),"Map"===this.raster.tileType&&(this.popupEnabled=!1),this._configDefaultSettings(),this.addHandles(l((()=>this.customParameters),(e=>{this.raster&&(this.raster.ioConfig.customFetchParameters=e)})))}async _openFromRaster(e,t){e.rasterInfo||await e.open({signal:t}),this._primaryRasters="Function"===e.datasetFormat?e.primaryRasters.rasters:[e],this.url||(this.url=this._primaryRasters[0].url)}async _openFromUrlWithRasterFunction(e,t,r){const i=[e];t&&T(t.toJSON(),i);const o=await Promise.all(i.map((e=>I.open({url:e,sourceJSON:this.sourceJSON,ioConfig:{sampling:"closest",...this.ioConfig,customFetchParameters:this.customParameters},signal:r})))),a=o.findIndex((e=>null==e));if(a>-1)throw new s("imagery-tile-layer:open",`cannot open raster: ${i[a]}`);return this._primaryRasters=o,this._initializeWithFunctionRaster(t)}async _openFromUrl(e,t){const r=await I.open({url:e,sourceJSON:this.sourceJSON,ioConfig:{sampling:"closest",...this.ioConfig,customFetchParameters:this.customParameters},signal:t});if(null==r)throw new s("imagery-tile-layer:open",`cannot open raster: ${e}`);this._primaryRasters=[r],this.raster=r}async _openFromSource(e,t){const r="the tiled imagery data source is not supported",i="coverage"===e.type?.toLowerCase()?"CovJSON":e.extent&&e.pixelBlock?"MEMORY":null;if(!i)throw new s("imagery-tile-layer:open",r);"MEMORY"===i&&(e={extent:e.extent,pixelBlocks:[e.pixelBlock]});const o=await I.open({url:"",source:e,datasetFormat:i,ioConfig:{sampling:"closest",...this.ioConfig,customFetchParameters:this.customParameters},signal:t});if(null==o)throw new s("imagery-tile-layer:open",r);this._primaryRasters=[o],this.rasterFunction?await this._initializeWithFunctionRaster(this.rasterFunction):this.raster=o}async _openFunctionRaster(e,t){const r={raster:this._primaryRasters[0]};this._primaryRasters.length>1&&this._primaryRasters.forEach((e=>r[e.url]=e));const s=L(e.functionDefinition?.toJSON()??e.toJSON(),r),i=new x({rasterFunction:s});return await i.open(t),i}async _initializeWithFunctionRaster(e,t){try{this.raster=await this._openFunctionRaster(e,t)}catch(r){r instanceof s&&i.getLogger(this).error("imagery-tile-layer:open",r.message),i.getLogger(this).warn("imagery-tile-layer:open","the raster function cannot be applied and is removed"),this._set("rasterFunction",null),this.raster=this._primaryRasters[0]}}};e([p({clonable:!1})],C.prototype,"_primaryRasters",void 0),e([p({type:[m],json:{write:{overridePolicy(){return{enabled:!this.loaded||"Raster"===this.raster.tileType||"0,1,2"!==this.bandIds?.join(",")}}}}})],C.prototype,"bandIds",void 0),e([p({json:{write:{overridePolicy(){return{enabled:!this.loaded||"Raster"===this.raster.tileType||"bilinear"!==this.interpolation}}}}}),u(O)],C.prototype,"interpolation",void 0),e([p(b)],C.prototype,"legendEnabled",void 0),e([p({type:Boolean,json:{read:!1,write:{enabled:!0,overridePolicy:()=>({enabled:!1})}}})],C.prototype,"isReference",void 0),e([p({type:["show","hide"]})],C.prototype,"listMode",void 0),e([p({json:{read:!0,write:!0}})],C.prototype,"blendMode",void 0),e([p()],C.prototype,"sourceJSON",void 0),e([p({readOnly:!0,json:{origins:{service:{read:{source:"currentVersion"}}}}})],C.prototype,"version",void 0),e([p({readOnly:!0,json:{read:!1}})],C.prototype,"type",void 0),e([p({type:["ArcGISTiledImageServiceLayer"]})],C.prototype,"operationalLayerType",void 0),e([p({type:Boolean,value:!0,json:{read:{source:"disablePopup",reader:(e,t)=>!t.disablePopup},write:{target:"disablePopup",overridePolicy(){return{enabled:!this.loaded||"Raster"===this.raster.tileType}},writer(e,t,r){t[r]=!e}}}})],C.prototype,"popupEnabled",void 0),e([p({type:t,json:{read:{source:"popupInfo"},write:{target:"popupInfo",overridePolicy(){return{enabled:!this.loaded||"Raster"===this.raster.tileType}}}}})],C.prototype,"popupTemplate",void 0),e([p({readOnly:!0})],C.prototype,"defaultPopupTemplate",null),e([p({readOnly:!0,type:[_]})],C.prototype,"fields",void 0),e([p({readOnly:!0,type:[_]})],C.prototype,"rasterFields",null),e([p({constructOnly:!0})],C.prototype,"source",void 0),C=e([h("esri.layers.ImageryTileLayer")],C);const M=C;export{M as default};
5
+ import{_ as e}from"../chunks/tslib.es6.js";import t from"../PopupTemplate.js";import{ClonableMixin as r}from"../core/Clonable.js";import s from"../core/Error.js";import i from"../core/Logger.js";import{MultiOriginJSONMixin as o}from"../core/MultiOriginJSONSupport.js";import{debounce as a,throwIfAbortError as n}from"../core/promiseUtils.js";import{watch as l}from"../core/reactiveUtils.js";import{property as p}from"../core/accessorSupport/decorators/property.js";import{ensureClass as c,Integer as m}from"../core/accessorSupport/ensureType.js";import"../core/RandomLCG.js";import"../core/has.js";import{enumeration as u}from"../core/accessorSupport/decorators/enumeration.js";import{subclass as h}from"../core/accessorSupport/decorators/subclass.js";import d from"./Layer.js";import{ArcGISService as y}from"./mixins/ArcGISService.js";import{BlendLayer as f}from"./mixins/BlendLayer.js";import{CustomParametersMixin as g}from"./mixins/CustomParametersMixin.js";import{ImageryTileMixin as v}from"./mixins/ImageryTileMixin.js";import{OperationalLayer as w}from"./mixins/OperationalLayer.js";import{PortalLayer as R}from"./mixins/PortalLayer.js";import{RefreshableLayer as S}from"./mixins/RefreshableLayer.js";import{ScaleRangeLayer as j}from"./mixins/ScaleRangeLayer.js";import{TemporalLayer as F}from"./mixins/TemporalLayer.js";import{legendEnabled as b}from"./support/commonProperties.js";import _ from"./support/Field.js";import{interpolationKebab as O}from"./support/rasterEnums.js";import P from"./support/RasterFunction.js";import I from"./support/rasterDatasets/FunctionRaster.js";import x from"./support/rasterDatasets/RasterFactory.js";import{getPrimaryRasterUrls as T,create as L}from"./support/rasterFunctions/rasterFunctionHelper.js";import{createPopupTemplate as N}from"../support/popupUtils.js";import{SaveOperationType as J}from"../webdoc/interfaces.js";let C=class extends(f(j(w(R(g(v(F(y(S(o(r(d)))))))))))){constructor(...e){super(...e),this._primaryRasters=[],this.bandIds=null,this.interpolation=null,this.legendEnabled=!0,this.isReference=null,this.listMode="show",this.sourceJSON=null,this.version=null,this.type="imagery-tile",this.operationalLayerType="ArcGISTiledImageServiceLayer",this.popupEnabled=!0,this.popupTemplate=null,this.fields=null,this.source=void 0,this._debouncedSaveOperations=a((async(e,t,r)=>{const{save:s,saveAs:i}=await import("./save/imageryUtils.js");switch(e){case J.SAVE:return s(this,t);case J.SAVE_AS:return i(this,r,t)}}))}normalizeCtorArgs(e,t){return"string"==typeof e?{url:e,...t}:e}load(e){const t=null!=e?e.signal:null;return this.addResolvingPromise(this.loadFromPortal({supportedTypes:["Image Service"]},e).catch(n).then((()=>this._openRaster(t)))),Promise.resolve(this)}get defaultPopupTemplate(){return this.createPopupTemplate()}get rasterFields(){const e=[new _({name:"Raster.ServicePixelValue",alias:"Pixel Value",domain:null,editable:!1,length:50,type:"string"}),new _({name:"Raster.ServicePixelValue.Raw",alias:"Raw Pixel Value",domain:null,editable:!1,length:50,type:"string"})],t=this.raster?.rasterInfo??this.serviceRasterInfo,r=t?.attributeTable,s=null!=r?r.fields:null,i="Raster.";if(s){const t=s.filter((e=>"oid"!==e.type&&"value"!==e.name.toLowerCase())).map((e=>{const t=e.clone();return t.name=i+e.name,t}));e.push(...t)}const o=t?.dataType,a=t?.multidimensionalInfo;if(("vector-magdir"===o||"vector-uv"===o)&&null!=a){const t=a.variables[0].unit?.trim(),r="Magnitude"+(t?` (${t})`:"");e.push(new _({name:"Raster.Magnitude",alias:r,domain:null,editable:!1,type:"double"})),e.push(new _({name:"Raster.Direction",alias:"Direction (°)",domain:null,editable:!1,type:"double"}))}return e}createPopupTemplate(e){const{rasterFields:t}=this,r=new Set(t.map((({name:e})=>e)).filter((e=>"raster.servicepixelvalue.raw"!==e.toLowerCase())));return N({fields:t,title:this.title},{...e,visibleFieldNames:r})}async generateRasterInfo(e,t){if(e=c(P,e),await this.load(),!e||"none"===e.functionName?.toLowerCase())return this.serviceRasterInfo;try{const{rasterInfo:r}=await this._openFunctionRaster(e,t);return r}catch(r){if(r instanceof s)throw r;throw new s("imagery-tile-layer","the given raster function is not supported")}}async save(e){return this._debouncedSaveOperations(J.SAVE,e)}async saveAs(e,t){return this._debouncedSaveOperations(J.SAVE_AS,t,e)}write(e,t){const r=this._primaryRasters[0]??this.raster;if(this.loaded?"RasterTileServer"===r.datasetFormat&&("Raster"===r.tileType||"Map"===r.tileType):this.url&&/\/ImageServer(\/|\/?$)/i.test(this.url))return super.write(e,t);if(t?.messages){const e=`${t.origin}/${t.layerContainerType||"operational-layers"}`;t.messages.push(new s("layer:unsupported",`Layers (${this.title}, ${this.id}) of type '${this.declaredClass}' are not supported in the context of '${e}'`,{layer:this}))}return null}async _openRaster(e){let t=!1;if(this.raster)await this._openFromRaster(this.raster,e),t="Function"===this.raster.datasetFormat;else{const{url:t,rasterFunction:r,source:i}=this;if(!t&&!i)throw new s("imagery-tile-layer:open","missing url or source parameter");i?await this._openFromSource(i,e):r?await this._openFromUrlWithRasterFunction(t,r,e):await this._openFromUrl(t,e)}const r=this.raster.rasterInfo;if(!r)throw new s("imagery-tile-layer:load","cannot load resources on "+this.url);if(this._set("serviceRasterInfo",t?r:this._primaryRasters[0].rasterInfo),this._set("spatialReference",r.spatialReference),this.sourceJSON=this.sourceJSON||this.raster.sourceJSON,null!=this.sourceJSON){const e="Map"===this.raster.tileType&&null!=this.sourceJSON.minLOD&&null!=this.sourceJSON.maxLOD?this.sourceJSON:{...this.sourceJSON,minScale:0,maxScale:0};this.read(e,{origin:"service"})}else this.read({tileInfo:this.serviceRasterInfo?.storageInfo.tileInfo.toJSON()},{origin:"service"});this.title||(this.title=this.raster.datasetName),"Map"===this.raster.tileType&&(this.popupEnabled=!1),this._configDefaultSettings(),this.addHandles(l((()=>this.customParameters),(e=>{this.raster&&(this.raster.ioConfig.customFetchParameters=e)})))}async _openFromRaster(e,t){e.rasterInfo||await e.open({signal:t}),this._primaryRasters="Function"===e.datasetFormat?e.primaryRasters.rasters:[e],this.url||(this.url=this._primaryRasters[0].url)}async _openFromUrlWithRasterFunction(e,t,r){const i=[e];t&&T(t.toJSON(),i);const o=await Promise.all(i.map((e=>x.open({url:e,sourceJSON:this.sourceJSON,ioConfig:{sampling:"closest",...this.ioConfig,customFetchParameters:this.customParameters},signal:r})))),a=o.findIndex((e=>null==e));if(a>-1)throw new s("imagery-tile-layer:open",`cannot open raster: ${i[a]}`);return this._primaryRasters=o,this._initializeWithFunctionRaster(t)}async _openFromUrl(e,t){const r=await x.open({url:e,sourceJSON:this.sourceJSON,ioConfig:{sampling:"closest",...this.ioConfig,customFetchParameters:this.customParameters},signal:t});if(null==r)throw new s("imagery-tile-layer:open",`cannot open raster: ${e}`);this._primaryRasters=[r],this.raster=r}async _openFromSource(e,t){const r="the tiled imagery data source is not supported",i="coverage"===e.type?.toLowerCase()?"CovJSON":e.extent&&e.pixelBlock?"MEMORY":null;if(!i)throw new s("imagery-tile-layer:open",r);"MEMORY"===i&&(e={extent:e.extent,pixelBlocks:[e.pixelBlock]});const o=await x.open({url:"",source:e,datasetFormat:i,ioConfig:{sampling:"closest",...this.ioConfig,customFetchParameters:this.customParameters},signal:t});if(null==o)throw new s("imagery-tile-layer:open",r);this._primaryRasters=[o],this.rasterFunction?await this._initializeWithFunctionRaster(this.rasterFunction):this.raster=o}async _openFunctionRaster(e,t){const r={raster:this._primaryRasters[0]};this._primaryRasters.length>1&&this._primaryRasters.forEach((e=>r[e.url]=e));const s=L(e.functionDefinition?.toJSON()??e.toJSON(),r),i=new I({rasterFunction:s});return await i.open(t),i}async _initializeWithFunctionRaster(e,t){try{this.raster=await this._openFunctionRaster(e,t)}catch(r){r instanceof s&&i.getLogger(this).error("imagery-tile-layer:open",r.message),i.getLogger(this).warn("imagery-tile-layer:open","the raster function cannot be applied and is removed"),this._set("rasterFunction",null),this.raster=this._primaryRasters[0]}}};e([p({clonable:!1})],C.prototype,"_primaryRasters",void 0),e([p({type:[m],json:{write:{overridePolicy(){return{enabled:!this.loaded||"Raster"===this.raster.tileType||"0,1,2"!==this.bandIds?.join(",")}}}}})],C.prototype,"bandIds",void 0),e([p({json:{write:{overridePolicy(){return{enabled:!this.loaded||"Raster"===this.raster.tileType||"bilinear"!==this.interpolation}}}}}),u(O)],C.prototype,"interpolation",void 0),e([p(b)],C.prototype,"legendEnabled",void 0),e([p({type:Boolean,json:{read:!1,write:{enabled:!0,overridePolicy:()=>({enabled:!1})}}})],C.prototype,"isReference",void 0),e([p({type:["show","hide"]})],C.prototype,"listMode",void 0),e([p({json:{read:!0,write:!0}})],C.prototype,"blendMode",void 0),e([p()],C.prototype,"sourceJSON",void 0),e([p({readOnly:!0,json:{origins:{service:{read:{source:"currentVersion"}}}}})],C.prototype,"version",void 0),e([p({readOnly:!0,json:{read:!1}})],C.prototype,"type",void 0),e([p({type:["ArcGISTiledImageServiceLayer"]})],C.prototype,"operationalLayerType",void 0),e([p({type:Boolean,value:!0,json:{read:{source:"disablePopup",reader:(e,t)=>!t.disablePopup},write:{target:"disablePopup",overridePolicy(){return{enabled:!this.loaded||"Raster"===this.raster.tileType}},writer(e,t,r){t[r]=!e}}}})],C.prototype,"popupEnabled",void 0),e([p({type:t,json:{read:{source:"popupInfo"},write:{target:"popupInfo",overridePolicy(){return{enabled:!this.loaded||"Raster"===this.raster.tileType}}}}})],C.prototype,"popupTemplate",void 0),e([p({readOnly:!0})],C.prototype,"defaultPopupTemplate",null),e([p({readOnly:!0,type:[_]})],C.prototype,"fields",void 0),e([p({readOnly:!0,type:[_]})],C.prototype,"rasterFields",null),e([p({constructOnly:!0})],C.prototype,"source",void 0),C=e([h("esri.layers.ImageryTileLayer")],C);const M=C;export{M 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.31/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../chunks/tslib.es6.js";import"../geometry.js";import t from"../core/Collection.js";import a from"../core/Error.js";import i from"../core/Logger.js";import{getOrCreateMapValue as n}from"../core/MapUtils.js";import{throwIfAborted as s}from"../core/promiseUtils.js";import{property as o}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/RandomLCG.js";import{subclass as r}from"../core/accessorSupport/decorators/subclass.js";import h from"./Layer.js";import{convertFromGeometry as l}from"./graphics/featureConversionUtils.js";import d from"./graphics/OptimizedGeometry.js";import{IdealEdgeLengthTypeOptions as p}from"./knowledgeGraph/IdealEdgeLengthTypeOptions.js";import{KnowledgeGraphLayerDataManager as u,mockOidFieldName as c,mockOriginIdFieldName as y,mockDestinationIdFieldName as g,mockLayoutGeometryFieldName as m,mockAggregationCountFieldName as f}from"./knowledgeGraph/KnowledgeGraphLayerDataManager.js";import L from"./knowledgeGraph/KnowledgeGraphSublayer.js";import{getRelationshipEndNodeIds as C}from"./knowledgeGraph/supportUtils.js";import{BlendLayer as k}from"./mixins/BlendLayer.js";import{ScaleRangeLayer as M}from"./mixins/ScaleRangeLayer.js";import{LCSimpleLayout as w,LCSmartTreeLayout as b,LCRadialTreeLayout as E,LCHierarchicalLayout as D,LCCommunityLayout as T,LCForceDirectedLayout as x,NodeFlag as N,load as v,LinkType as R}from"../libs/linkchartlayout/LinkChartLayout.js";import{fetchKnowledgeGraph as I}from"../rest/knowledgeGraphService.js";import A from"../geometry/Extent.js";import G from"../geometry/Point.js";import _ from"../geometry/Polyline.js";let j=class extends(k(M(h))){constructor(e){if(super(e),this.dataPreloadedInLocalCache=!1,this.defaultLinkChartConfig=null,this._currentLinkChartConfig={layoutMode:"RADIAL_TREE"},this._graphTypeLookup=new Map,this.dataManager=null,this.knowledgeGraph=null,this.layers=new t,this.entityLinkChartDiagramLookup=new Map,this.relationshipLinkChartDiagramLookup=new Map,this.linkChartExtent=new A({xmin:-1e-7,ymin:-1e-7,xmax:1e-7,ymax:1e-7}),this.memberEntityTypes=null,this.memberRelationshipTypes=null,this.sublayerIdsCache=new Map,this.tables=new t,this.type="link-chart",this._originalInclusionList=e.inclusionModeDefinition,e.dataPreloadedInLocalCache&&!e.inclusionModeDefinition)throw new a("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")}normalizeCtorArgs(e){return{url:e.url,title:e.title,dataPreloadedInLocalCache:e.dataPreloadedInLocalCache,defaultLinkChartConfig:e.defaultLinkChartConfig}}_initializeLayerProperties(e){if(!this.title&&this.url){const e=this.url.split("/");this.title=e[e.length-2]}const t=new Set;let n=[],s=[];if(e.inclusionModeDefinition&&(!e.inclusionModeDefinition.namedTypeDefinitions||e.inclusionModeDefinition.namedTypeDefinitions.size<1))throw new a("knowledge-graph:composite-layer-constructor","If an explicit inclusion definition is defined, at least one namedTypeDefinition must also be defined");e.knowledgeGraph.dataModel.entityTypes?.forEach((e=>{e.name&&this._graphTypeLookup.set(e.name,e)})),e.knowledgeGraph.dataModel.relationshipTypes?.forEach((e=>{e.name&&this._graphTypeLookup.set(e.name,e)})),e.inclusionModeDefinition?.generateAllSublayers?(n=e.knowledgeGraph.dataModel.entityTypes??[],s=e.knowledgeGraph.dataModel.relationshipTypes??[]):e.inclusionModeDefinition?.namedTypeDefinitions&&e.inclusionModeDefinition?.namedTypeDefinitions.size>0?e.inclusionModeDefinition?.namedTypeDefinitions.forEach(((a,o)=>{const r=this._graphTypeLookup.get(o);if(!r)return i.getLogger(this).warn(`A named type, ${o}, was in the inclusion list that wasn't in the data model and will be removed`),void e.inclusionModeDefinition?.namedTypeDefinitions.delete(o);"relationship"===r.type?t.has(o)||(t.add(o),s.push(r)):"entity"===r.type?t.has(o)||(t.add(o),n.push(r)):(i.getLogger(this).warn(`A named type, ${o}, was in the inclusion list that wasn't properly modeled and will be removed`),e.inclusionModeDefinition?.namedTypeDefinitions.delete(o))})):(n=e.knowledgeGraph.dataModel.entityTypes??[],s=e.knowledgeGraph.dataModel.relationshipTypes??[]);const o=new u({knowledgeGraph:e.knowledgeGraph,inclusionModeDefinition:e.inclusionModeDefinition});this.knowledgeGraph=e.knowledgeGraph,this.memberEntityTypes=n,this.memberRelationshipTypes=s,this.dataManager=o}load(e){return this.addResolvingPromise(new Promise((t=>{I(this.url).then((a=>{if(this._initializeLayerProperties({knowledgeGraph:a,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)this.loadLayerAssumingLocalCache(),this.dataManager.inclusionModeDefinition&&(this.dataManager.inclusionModeDefinition.generateAllSublayers=!1),this.dataManager.inclusionModeDefinition?.namedTypeDefinitions.forEach((e=>{e.useAllData=!1,e.members?.forEach((e=>{let t;t=e.linkChartLocation instanceof d?e.linkChartLocation:e.linkChartLocation?l(e.linkChartLocation):null,t&&2===t.coords.length&&0===t.lengths.length?this.entityLinkChartDiagramLookup.set(e.id,t):this.relationshipLinkChartDiagramLookup.set(e.id,t)})),this.addResolvingPromise(this._initializeDiagram().then((async()=>{this.layers.forEach((async e=>{await e.refreshCachedQueryEngine()})),this.tables.forEach((async e=>{await e.refreshCachedQueryEngine()}))})))}));else{const t="GEOGRAPHIC"===this.defaultLinkChartConfig?.layoutMode;this.addResolvingPromise(this.dataManager.refreshCacheContent(void 0,!1,t,!0).then((async()=>{s(e);const t=[],a=[];this.loadLayerAssumingLocalCache(),this.dataManager.inclusionModeDefinition&&(this.dataManager.inclusionModeDefinition.generateAllSublayers=!1,this.dataManager.inclusionModeDefinition.namedTypeDefinitions.forEach((e=>{e.useAllData=!1}))),await this._initializeDiagram(),this.layers.forEach((e=>{a.push(e.refreshCachedQueryEngine()),t.push(new Promise((t=>{e.on("layerview-create",(()=>{t(null)}))})))})),this.tables.forEach((e=>{a.push(e.refreshCachedQueryEngine())})),await Promise.all(a)})))}t(null)}))}))),Promise.resolve(this)}async addRecords(e,t){let a=[];t?.cascadeAddRelationshipEndNodes&&this.dataManager.knowledgeGraph.dataModel&&(a=await C(e,this.dataManager.knowledgeGraph));const i=e.concat(a).filter((e=>!this.sublayerIdsCache.get(e.typeName)?.has(e.id)));await this._handleNewRecords(i)}async removeRecords(e,{cascadeRemoveRelationships:t=!0,recalculateLayout:a=!1}={cascadeRemoveRelationships:!0,recalculateLayout:!1}){let i=[];for(const s of e)!1===this.dataManager.inclusionModeDefinition?.namedTypeDefinitions?.get(s.typeName)?.useAllData&&this.dataManager.inclusionModeDefinition?.namedTypeDefinitions?.get(s.typeName)?.members?.has(s.id)&&i.push(s);if(t){const e=new Set,t=[];for(const a of i)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});i=i.concat(t)}this.dataManager.removeFromLayer(i);for(const s of i)this.sublayerIdsCache.get(s.typeName)?.delete(s.id),this.dataManager.relationshipTypeNames.has(s.typeName)?this.relationshipLinkChartDiagramLookup.delete(s.id):this.entityLinkChartDiagramLookup.delete(s.id);a&&await this.calculateLinkChartLayout(this._currentLinkChartConfig.layoutMode,this._currentLinkChartConfig.layoutOptions);const n=[];return this.layers.forEach((e=>{n.push(e.refreshCachedQueryEngine())})),await Promise.all(n),this._refreshNamedTypes(),i}async expand(e,t){const a=await this.dataManager.getConnectedRecordIds(e,t),i=a.filter((e=>!this.sublayerIdsCache.get(e.typeName)?.has(e.id)));return await this._handleNewRecords(a),{records:i}}loadLayerAssumingLocalCache(){this.memberRelationshipTypes.forEach((e=>{const t=new L({objectType:e,parentCompositeLayer:this,graphType:"relationship",title:e.name});t.geometryType?this.layers.push(t):this.tables.push(t),this.dataManager.sublayerCaches.has(e.name)||this.dataManager.sublayerCaches.set(e.name,new Map)})),this.memberEntityTypes.forEach((e=>{const t=new L({objectType:e,parentCompositeLayer:this,graphType:"entity",title:e.name});t.geometryType?this.layers.push(t):this.tables.push(t),this.dataManager.sublayerCaches.has(e.name)||this.dataManager.sublayerCaches.set(e.name,new Map)})),this.dataManager.inclusionModeDefinition?.namedTypeDefinitions&&this.dataManager.inclusionModeDefinition?.namedTypeDefinitions.forEach(((e,t)=>{const a=n(this.sublayerIdsCache,t,(()=>new Set));e.members?.forEach((e=>{if(a.add(e.id),e.linkChartLocation)if(e.linkChartLocation instanceof d)this.dataManager.relationshipTypeNames.has(t)?this.relationshipLinkChartDiagramLookup.set(e.id,e.linkChartLocation):this.entityLinkChartDiagramLookup.set(e.id,e.linkChartLocation);else{const a=l(e.linkChartLocation);this.dataManager.relationshipTypeNames.has(t)?this.relationshipLinkChartDiagramLookup.set(e.id,e.linkChartLocation?a:null):this.entityLinkChartDiagramLookup.set(e.id,e.linkChartLocation?a:null)}}))}))}async calculateLinkChartLayout(e="RADIAL_TREE",t){const n=[],s=[],o=[];this.dataManager.sublayerCaches.forEach(((e,t)=>{this.dataManager.entityTypeNames.has(t)?e.forEach((e=>{n.push({typeName:t,feature:e})})):this.dataManager.relationshipTypeNames.has(t)&&e.forEach((e=>{s.push({typeName:t,feature:e})}))})),this.entityLinkChartDiagramLookup=new Map,this.relationshipLinkChartDiagramLookup=new Map;const r=new Map,h=new Map,d=new Map,p=new Map,u=new Uint8Array(n.length),L=new Float64Array(n.length),C=new Float64Array(n.length),k=new Uint32Array(s.length),M=new Uint32Array(s.length),I=[],j="FORCE_DIRECTED",P=new A({xmin:-1e-7,ymin:-1e-7,xmax:1e-7,ymax:1e-7});let S,O="FORCE_DIRECTED",z=0,U=0;switch(O="GEOGRAPHIC"===e?j:e,O){case"FORCE_DIRECTED":S=x.apply;break;case"COMMUNITY":S=T.apply;break;case"HIERARCHICAL":S=D.apply;break;case"RADIAL_TREE":S=E.apply;break;case"SMART_TREE":S=b.apply;break;default:S=w.apply}n.forEach((({typeName:a,feature:i})=>{if(t?.lockedNodeLocations?.has(i.attributes[c])){"GEOGRAPHIC"===e&&this.dataManager.geographicLookup.has(a)?u[z]=N.IsGeographic:u[z]=N.None;const n=t.lockedNodeLocations.get(i.attributes[c]);L[z]=n.x,C[z]=n.y}else if("GEOGRAPHIC"===e&&this.dataManager.geographicLookup.has(a)){u[z]=N.IsGeographic;let e=null;const t=i.attributes[this.dataManager.geographicLookup.get(a).name],n=this.dataManager.geographicLookup.get(a)?.geometryType;switch(n){case"esriGeometryPoint":L[z]=t?.x,C[z]=t?.y;break;case"esriGeometryPolygon":e=t?.centroid,null!=e?.x&&null!=e?.y?(L[z]=e.x,C[z]=e.y):u[z]=N.IsMovable;break;case"esriGeometryPolyline":case"esriGeometryMultipoint":e=t?.extent?.center,null!=e?.x&&null!=e?.y?(L[z]=e.x,C[z]=e.y):u[z]=N.IsMovable;break;default:u[z]=N.IsMovable}(null==L[z]||null==C[z]||Number.isNaN(L[z])||Number.isNaN(C[z]))&&(u[z]=N.IsMovable,L[z]=0,C[z]=0)}else u[z]=N.IsMovable,L[z]=0,C[z]=0;p.set(i.attributes[c],z),I[z]={feature:i,typeName:a},z++}));let H=!1;const B=new Map;s.forEach((e=>{const t=e.feature.attributes[y],a=e.feature.attributes[g],i=p.get(t),n=p.get(a);if(void 0!==i&&void 0!==n){const s=t+"-"+a,r=B.get(s),h=r?.has(e.typeName);h||(k[U]=i,M[U]=n,void 0===r?B.set(s,new Map([[e.typeName,U]])):r.set(e.typeName,U),U++),o.push(e)}else H=!0,this.relationshipLinkChartDiagramLookup.set(t,null)})),H&&i.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 F=this._validateLayoutSettings(e,t),Q=this._convertLayoutSettingsToCalculationSettings(F);await v();const{success:K,links:Y}=S(u,L,C,k.subarray(0,U),M.subarray(0,U),Q.computationBudgetTime,Q.idealEdgeLengthMultiplier,Q.repulsionRadiusMultiplier);if(!K)throw new a("knowledge-graph:layout-failed","Attempting to arrange the records in the specified layout failed");for(let a=0;a<I.length;a++){if(C[a]>84.9999?C[a]=84.9999:C[a]<-84.9999&&(C[a]=-84.9999),L[a]>179.9999?L[a]=179.9999:L[a]<-179.9999&&(L[a]=-179.9999),I[a].feature.attributes[m]=new G(L[a],C[a]),r.has(I[a].typeName)){const e=r.get(I[a].typeName);e?.set(I[a].feature.attributes[c],I[a].feature)}else{const e=new Map;e.set(I[a].feature.attributes[c],I[a].feature),r.set(I[a].typeName,e)}d.set(I[a].feature.attributes[c],I[a].feature);const e=l(I[a].feature.attributes[m]);this.entityLinkChartDiagramLookup.set(I[a].feature.attributes[c],I[a].feature.attributes[m]?e:null),I[a].feature.attributes[m].x<P.xmin&&(P.xmin=I[a].feature.attributes[m].x),I[a].feature.attributes[m].x>P.xmax&&(P.xmax=I[a].feature.attributes[m].x),I[a].feature.attributes[m].y<P.ymin&&(P.ymin=I[a].feature.attributes[m].y),I[a].feature.attributes[m].y>P.ymax&&(P.ymax=I[a].feature.attributes[m].y)}if(this.linkChartExtent.xmin=P.xmin,this.linkChartExtent.xmax=P.xmax,this.linkChartExtent.ymin=P.ymin,this.linkChartExtent.ymax=P.ymax,!Y)throw new a("knowledge-graph:layout-failed","Attempting to retrieve link geometry from diagram engine failed");const $=new Map,W=new Map,q=new Map,J=new Set;for(let a=0;a<o.length;a++){const e=[],t=o[a],n=t.feature.attributes[y],s=t.feature.attributes[g],r=n+"-"+s,u=B.get(r).get(t.typeName),f=0===u?0:Y?.vertexEndIndex[u-1];if(!J.has(u)){if(J.add(u),Y.types[u]===R.Recursive){const t=[Y.vertices[2*f],Y.vertices[2*f+1]],a=[Y.vertices[2*(f+1)],Y.vertices[2*(f+1)+1]],i=[.5*(t[0]+a[0]),.5*(t[1]+a[1])],n=[i[0]-t[0],i[1]-t[1]],s=[i[0]+n[1],i[1]-n[0]],o=[i[0]-n[1],i[1]+n[0]];e.push(t),e.push(s),e.push(a),e.push(o),e.push(t)}else{if(Y.types[u]!==R.Regular){i.getLogger(this).warn("A relationship generated an unsupported link geometry type. It will not be rendered");continue}for(let t=f;t<Y.vertexEndIndex[u];t++)e.push([Y.vertices[2*t],Y.vertices[2*t+1]])}const t=I[p.get(n)]?.feature.attributes[m],a=I[p.get(s)]?.feature.attributes[m];e[0][0]===t.x&&e[0][1]===t.y||(e[0]=[t.x,t.y]),e[e.length-1][0]===a.x&&e[e.length-1][1]===a.y||(e[e.length-1]=[a.x,a.y]);for(let i=1;i<e.length-1;i++)e[i][1]>85.5?e[i][1]=85.5:e[i][1]<-85.5&&(e[i][1]=-85.5),e[i][0]>179.9999?e[i][0]=179.9999:e[i][0]<-179.9999&&(e[i][0]=-179.9999);$.has(r)?$.get(r).push(e):$.set(r,[e])}const L=$.get(r);W.has(r)||(W.set(r,new Map),q.set(r,new Map));const C=W.get(r),k=q.get(r);C.has(t.typeName)||(C.set(t.typeName,L.shift()),k.set(t.typeName,0));const M=C.get(t.typeName);k.set(t.typeName,k.get(t.typeName)+1);const w=new _({paths:M});if(t.feature.attributes[m]=w,h.has(t.typeName)){const e=h.get(t.typeName);e?.set(t.feature.attributes[c],t.feature)}else{const e=new Map;e.set(t.feature.attributes[c],t.feature),h.set(t.typeName,e)}d.set(t.feature.attributes[c],t.feature);const b=l(t.feature.attributes[m]);this.relationshipLinkChartDiagramLookup.set(t.feature.attributes[c],t.feature.attributes[m]?b:null)}for(const a of o)a.feature.attributes[f]=q.get(a.feature.attributes[y]+"-"+a.feature.attributes[g])?.get(a.typeName)??null;return this._currentLinkChartConfig={layoutMode:e,layoutOptions:F},{nodes:r,links:h,idMap:d}}async applyNewLinkChartLayout(e="RADIAL_TREE",t){const a=[];await this.calculateLinkChartLayout(e,t),this.layers.forEach((e=>{a.push(e.refreshCachedQueryEngine())})),await Promise.all(a),this._refreshNamedTypes()}getCurrentNodeLocations(){const e=new Map;return this.dataManager.inclusionModeDefinition?.namedTypeDefinitions?.forEach((t=>{t?.members?.forEach((t=>{const a=t.linkChartLocation;let i;const n=t.id;a&&(i="x"in a?{x:a.x,y:a.y}:{x:a.coords[0],y:a.coords[1]},e.set(n,new G({x:i.x,y:i.y})))}))})),e}async synchronizeInclusionListWithCache(){return new Promise((e=>{this.dataManager.inclusionModeDefinition?.namedTypeDefinitions.forEach(((e,t)=>{if(e.useAllData=!1,e.members&&e.members.size>0){if(!this.dataManager.sublayerCaches.get(t))return;const a=new Set(Array.from(this.dataManager.sublayerCaches.get(t).keys()));Array.from(e.members.keys()).filter((e=>!a.has(e))).forEach((t=>{e.members?.delete(t)}))}})),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 connectEntities(e){let t=[];for(const i of this.dataManager.relationshipTypeNames){const e=this.sublayerIdsCache.get(i);e&&(t=t.concat(Array.from(e.keys())))}const a=await this.dataManager.getAttachedRelationships(e,t);return await this._handleNewRecords(a),{records:a}}async _handleNewRecords(e){const t=[];this.dataManager.addToLayer(e);for(const i of e)this.sublayerIdsCache.has(i.typeName)||(this.sublayerIdsCache.set(i.typeName,new Set),t.push(i.typeName)),this.sublayerIdsCache.get(i.typeName).add(i.id);for(const i of t){const e=this._graphTypeLookup.get(i);if(e){const t=new L({objectType:e,parentCompositeLayer:this,graphType:e.type,title:i});"entity"===e.type?this.dataManager.entityTypeNames.add(i):this.dataManager.relationshipTypeNames.add(i),t.geometryType?this.layers.push(t):this.tables.push(t),this.dataManager.sublayerCaches.set(i,new Map)}}await this.dataManager.refreshCacheContent(e.map((e=>e.id)));const a=Object.assign({},this._currentLinkChartConfig.layoutOptions);a.lockedNodeLocations=this.getCurrentNodeLocations(),await this.applyNewLinkChartLayout(this._currentLinkChartConfig.layoutMode,a)}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 n=e.id;if(!a)return;i="x"in a?{x:a.x,y:a.y}:{x:a.coords[0],y:a.coords[1]};const s=l(i);this.dataManager.relationshipTypeNames.has(t)?this.relationshipLinkChartDiagramLookup.set(n,s):this.entityLinkChartDiagramLookup.set(n,s),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[y]),a=this.relationshipLinkChartDiagramLookup.get(e.attributes[g]);if(t&&a){const i=l(new _({paths:[[t.coords[0],t.coords[1]],[a.coords[0],a.coords[1]]]}));this.relationshipLinkChartDiagramLookup.set(e.attributes[c],i)}else this.relationshipLinkChartDiagramLookup.set(e.attributes[c],null)}))}))):await this.calculateLinkChartLayout(this.defaultLinkChartConfig.layoutMode,{lockedNodeLocations:this.getCurrentNodeLocations(),...this.defaultLinkChartConfig.layoutOptions||{}}):await this.calculateLinkChartLayout("RADIAL_TREE",{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),n=e=>a(e)&&e>=1,s=e=>a(e)&&e>=1,o=e=>Object.values(p).includes(e),r=e=>a(e)&&e>=0,h=new Set(["FORCE_DIRECTED","COMMUNITY","GEOGRAPHIC"]),l={};if(!h.has(e)||!t)return!h.has(e)&&t&&i.getLogger(this).warn("Layout mode options were given for a layout mode that does not utilize them, settings will be ignored"),l;const{computationBudgetTime:d,repulsionRadiusMultiplier:u,idealEdgeLength:c,idealEdgeLengthType:y}=t;s(d)?l.computationBudgetTime=d:void 0!==d&&i.getLogger(this).warn("Invalid layout computationBudgetTime setting, will revert to default setting"),n(u)?l.repulsionRadiusMultiplier=u:void 0!==u&&i.getLogger(this).warn("Invalid layout repulsionRadiusMultiplier setting, will revert to default setting");const g=void 0!==c||void 0!==y;return"GEOGRAPHIC"!==e&&g?i.getLogger(this).warn("Ideal edge length settings were specified for an incompatible layout mode, and will be ignored"):"GEOGRAPHIC"===e&&g&&(o(y)?l.idealEdgeLengthType=y:void 0!==y&&i.getLogger(this).warn('Invalid layout idealEdgeLengthType setting, will revert to "multiplier" setting'),r(c)?l.idealEdgeLength=c:void 0!==c&&i.getLogger(this).warn("Invalid layout idealEdgeLength setting, will revert to default setting")),l}_convertLayoutSettingsToCalculationSettings(e){let t=e.idealEdgeLength;return e.idealEdgeLengthType===p.ABSOLUTE&&(void 0===t?t=-1:t*=-1),{computationBudgetTime:e.computationBudgetTime,repulsionRadiusMultiplier:e.repulsionRadiusMultiplier,idealEdgeLengthMultiplier:t}}};e([o()],j.prototype,"dataPreloadedInLocalCache",void 0),e([o()],j.prototype,"defaultLinkChartConfig",void 0),e([o()],j.prototype,"dataManager",void 0),e([o()],j.prototype,"knowledgeGraph",void 0),e([o()],j.prototype,"layers",void 0),e([o()],j.prototype,"entityLinkChartDiagramLookup",void 0),e([o()],j.prototype,"relationshipLinkChartDiagramLookup",void 0),e([o()],j.prototype,"linkChartExtent",void 0),e([o()],j.prototype,"memberEntityTypes",void 0),e([o()],j.prototype,"memberRelationshipTypes",void 0),e([o()],j.prototype,"sublayerIdsCache",void 0),e([o()],j.prototype,"tables",void 0),e([o({json:{read:!1}})],j.prototype,"type",void 0),j=e([r("esri.layers.LinkChartLayer")],j);const P=j;export{P as default};
5
+ import{_ as e}from"../chunks/tslib.es6.js";import"../geometry.js";import t from"../core/Collection.js";import a from"../core/Error.js";import i from"../core/Logger.js";import{getOrCreateMapValue as n}from"../core/MapUtils.js";import{throwIfAborted as s}from"../core/promiseUtils.js";import{property as o}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/RandomLCG.js";import{subclass as r}from"../core/accessorSupport/decorators/subclass.js";import h from"./Layer.js";import{convertFromGeometry as l}from"./graphics/featureConversionUtils.js";import d from"./graphics/OptimizedGeometry.js";import{IdealEdgeLengthTypeOptions as p}from"./knowledgeGraph/IdealEdgeLengthTypeOptions.js";import{KnowledgeGraphLayerDataManager as c,mockOidFieldName as u,mockOriginIdFieldName as y,mockDestinationIdFieldName as g,mockLayoutGeometryFieldName as m,mockAggregationCountFieldName as f}from"./knowledgeGraph/KnowledgeGraphLayerDataManager.js";import L from"./knowledgeGraph/KnowledgeGraphSublayer.js";import{getRelationshipEndNodeIds as C}from"./knowledgeGraph/supportUtils.js";import{BlendLayer as k}from"./mixins/BlendLayer.js";import{ScaleRangeLayer as w}from"./mixins/ScaleRangeLayer.js";import{LCSimpleLayout as M,LCSmartTreeLayout as b,LCRadialTreeLayout as E,LCHierarchicalLayout as T,LCCommunityLayout as D,LCForceDirectedLayout as x,NodeFlag as N,load as v,LinkType as R}from"../libs/linkchartlayout/LinkChartLayout.js";import{fetchKnowledgeGraph as I}from"../rest/knowledgeGraphService.js";import A from"../geometry/Extent.js";import G from"../geometry/Point.js";import _ from"../geometry/Polyline.js";let j=class extends(k(w(h))){constructor(e){if(super(e),this.dataPreloadedInLocalCache=!1,this.defaultLinkChartConfig=null,this._currentLinkChartConfig={layoutMode:"RADIAL_TREE"},this._graphTypeLookup=new Map,this.dataManager=null,this.knowledgeGraph=null,this.layers=new t,this.entityLinkChartDiagramLookup=new Map,this.relationshipLinkChartDiagramLookup=new Map,this.linkChartExtent=new A({xmin:-1e-7,ymin:-1e-7,xmax:1e-7,ymax:1e-7}),this.memberEntityTypes=null,this.memberRelationshipTypes=null,this.sublayerIdsCache=new Map,this.tables=new t,this.type="link-chart",this._originalInclusionList=e.inclusionModeDefinition,e.dataPreloadedInLocalCache&&!e.inclusionModeDefinition)throw new a("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")}normalizeCtorArgs(e){return{url:e.url,title:e.title,dataPreloadedInLocalCache:e.dataPreloadedInLocalCache,defaultLinkChartConfig:e.defaultLinkChartConfig}}_initializeLayerProperties(e){if(!this.title&&this.url){const e=this.url.split("/");this.title=e[e.length-2]}const t=new Set;let n=[],s=[];if(e.inclusionModeDefinition&&(!e.inclusionModeDefinition.namedTypeDefinitions||e.inclusionModeDefinition.namedTypeDefinitions.size<1))throw new a("knowledge-graph:composite-layer-constructor","If an explicit inclusion definition is defined, at least one namedTypeDefinition must also be defined");e.knowledgeGraph.dataModel.entityTypes?.forEach((e=>{e.name&&this._graphTypeLookup.set(e.name,e)})),e.knowledgeGraph.dataModel.relationshipTypes?.forEach((e=>{e.name&&this._graphTypeLookup.set(e.name,e)})),e.inclusionModeDefinition?.generateAllSublayers?(n=e.knowledgeGraph.dataModel.entityTypes??[],s=e.knowledgeGraph.dataModel.relationshipTypes??[]):e.inclusionModeDefinition?.namedTypeDefinitions&&e.inclusionModeDefinition?.namedTypeDefinitions.size>0?e.inclusionModeDefinition?.namedTypeDefinitions.forEach(((a,o)=>{const r=this._graphTypeLookup.get(o);if(!r)return i.getLogger(this).warn(`A named type, ${o}, was in the inclusion list that wasn't in the data model and will be removed`),void e.inclusionModeDefinition?.namedTypeDefinitions.delete(o);"relationship"===r.type?t.has(o)||(t.add(o),s.push(r)):"entity"===r.type?t.has(o)||(t.add(o),n.push(r)):(i.getLogger(this).warn(`A named type, ${o}, was in the inclusion list that wasn't properly modeled and will be removed`),e.inclusionModeDefinition?.namedTypeDefinitions.delete(o))})):(n=e.knowledgeGraph.dataModel.entityTypes??[],s=e.knowledgeGraph.dataModel.relationshipTypes??[]);const o=new c({knowledgeGraph:e.knowledgeGraph,inclusionModeDefinition:e.inclusionModeDefinition});this.knowledgeGraph=e.knowledgeGraph,this.memberEntityTypes=n,this.memberRelationshipTypes=s,this.dataManager=o}load(e){return this.addResolvingPromise(new Promise((t=>{I(this.url).then((a=>{if(this._initializeLayerProperties({knowledgeGraph:a,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)this.loadLayerAssumingLocalCache(),this.dataManager.inclusionModeDefinition&&(this.dataManager.inclusionModeDefinition.generateAllSublayers=!1),this.dataManager.inclusionModeDefinition?.namedTypeDefinitions.forEach((e=>{e.useAllData=!1,e.members?.forEach((e=>{let t;t=e.linkChartLocation instanceof d?e.linkChartLocation:e.linkChartLocation?l(e.linkChartLocation):null,t&&2===t.coords.length&&0===t.lengths.length?this.entityLinkChartDiagramLookup.set(e.id,t):this.relationshipLinkChartDiagramLookup.set(e.id,t)})),this.addResolvingPromise(this._initializeDiagram().then((async()=>{this.layers.forEach((async e=>{await e.refreshCachedQueryEngine()})),this.tables.forEach((async e=>{await e.refreshCachedQueryEngine()}))})))}));else{const t="GEOGRAPHIC"===this.defaultLinkChartConfig?.layoutMode;this.addResolvingPromise(this.dataManager.refreshCacheContent(void 0,!1,t,!0).then((async()=>{s(e);const t=[],a=[];this.loadLayerAssumingLocalCache(),this.dataManager.inclusionModeDefinition&&(this.dataManager.inclusionModeDefinition.generateAllSublayers=!1,this.dataManager.inclusionModeDefinition.namedTypeDefinitions.forEach((e=>{e.useAllData=!1}))),await this._initializeDiagram(),this.layers.forEach((e=>{a.push(e.refreshCachedQueryEngine()),t.push(new Promise((t=>{e.on("layerview-create",(()=>{t(null)}))})))})),this.tables.forEach((e=>{a.push(e.refreshCachedQueryEngine())})),await Promise.all(a)})))}t(null)}))}))),Promise.resolve(this)}async addRecords(e,t){let a=[];t?.cascadeAddRelationshipEndNodes&&this.dataManager.knowledgeGraph.dataModel&&(a=await C(e,this.dataManager.knowledgeGraph));const i=e.concat(a).filter((e=>!this.sublayerIdsCache.get(e.typeName)?.has(e.id)));await this._handleNewRecords(i)}async removeRecords(e,{cascadeRemoveRelationships:t=!0,recalculateLayout:a=!1}={cascadeRemoveRelationships:!0,recalculateLayout:!1}){let i=[];for(const s of e)!1===this.dataManager.inclusionModeDefinition?.namedTypeDefinitions?.get(s.typeName)?.useAllData&&this.dataManager.inclusionModeDefinition?.namedTypeDefinitions?.get(s.typeName)?.members?.has(s.id)&&i.push(s);if(t){const e=new Set,t=[];for(const a of i)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});i=i.concat(t)}this.dataManager.removeFromLayer(i);for(const s of i)this.sublayerIdsCache.get(s.typeName)?.delete(s.id),this.dataManager.relationshipTypeNames.has(s.typeName)?this.relationshipLinkChartDiagramLookup.delete(s.id):this.entityLinkChartDiagramLookup.delete(s.id);a&&await this.calculateLinkChartLayout(this._currentLinkChartConfig.layoutMode,this._currentLinkChartConfig.layoutOptions);const n=[];return this.layers.forEach((e=>{n.push(e.refreshCachedQueryEngine())})),await Promise.all(n),this._refreshNamedTypes(),i}async expand(e,t){const a=await this.dataManager.getConnectedRecordIds(e,t),i=a.filter((e=>!this.sublayerIdsCache.get(e.typeName)?.has(e.id)));return await this._handleNewRecords(a),{records:i}}loadLayerAssumingLocalCache(){this.memberRelationshipTypes.forEach((e=>{const t=new L({objectType:e,parentCompositeLayer:this,graphType:"relationship",title:e.name});t.geometryType?this.layers.push(t):this.tables.push(t),this.dataManager.sublayerCaches.has(e.name)||this.dataManager.sublayerCaches.set(e.name,new Map)})),this.memberEntityTypes.forEach((e=>{const t=new L({objectType:e,parentCompositeLayer:this,graphType:"entity",title:e.name});t.geometryType?this.layers.push(t):this.tables.push(t),this.dataManager.sublayerCaches.has(e.name)||this.dataManager.sublayerCaches.set(e.name,new Map)})),this.dataManager.inclusionModeDefinition?.namedTypeDefinitions&&this.dataManager.inclusionModeDefinition?.namedTypeDefinitions.forEach(((e,t)=>{const a=n(this.sublayerIdsCache,t,(()=>new Set));e.members?.forEach((e=>{if(a.add(e.id),e.linkChartLocation)if(e.linkChartLocation instanceof d)this.dataManager.relationshipTypeNames.has(t)?this.relationshipLinkChartDiagramLookup.set(e.id,e.linkChartLocation):this.entityLinkChartDiagramLookup.set(e.id,e.linkChartLocation);else{const a=l(e.linkChartLocation);this.dataManager.relationshipTypeNames.has(t)?this.relationshipLinkChartDiagramLookup.set(e.id,e.linkChartLocation?a:null):this.entityLinkChartDiagramLookup.set(e.id,e.linkChartLocation?a:null)}}))}))}async calculateLinkChartLayout(e="RADIAL_TREE",t){const n=[],s=[],o=[];this.dataManager.sublayerCaches.forEach(((e,t)=>{this.dataManager.entityTypeNames.has(t)?e.forEach((e=>{n.push({typeName:t,feature:e})})):this.dataManager.relationshipTypeNames.has(t)&&e.forEach((e=>{s.push({typeName:t,feature:e})}))})),this.entityLinkChartDiagramLookup=new Map,this.relationshipLinkChartDiagramLookup=new Map;const r=new Map,h=new Map,d=new Map,p=new Map,c=new Uint8Array(n.length),L=new Float64Array(n.length),C=new Float64Array(n.length),k=new Uint32Array(s.length),w=new Uint32Array(s.length),I=[],j="FORCE_DIRECTED",P=new A({xmin:-1e-7,ymin:-1e-7,xmax:1e-7,ymax:1e-7});let S,O="FORCE_DIRECTED",z=0,B=0;switch(O="GEOGRAPHIC"===e?j:e,O){case"FORCE_DIRECTED":S=x.apply;break;case"COMMUNITY":S=D.apply;break;case"HIERARCHICAL":S=T.apply;break;case"RADIAL_TREE":S=E.apply;break;case"SMART_TREE":S=b.apply;break;default:S=M.apply}n.forEach((({typeName:a,feature:i})=>{if(t?.lockedNodeLocations?.has(i.attributes[u])){"GEOGRAPHIC"===e&&this.dataManager.geographicLookup.has(a)?c[z]=N.IsGeographic:c[z]=N.None;const n=t.lockedNodeLocations.get(i.attributes[u]);L[z]=n.x,C[z]=n.y}else if("GEOGRAPHIC"===e&&this.dataManager.geographicLookup.has(a)){c[z]=N.IsGeographic;let e=null;const t=i.attributes[this.dataManager.geographicLookup.get(a).name],n=this.dataManager.geographicLookup.get(a)?.geometryType;switch(n){case"esriGeometryPoint":L[z]=t?.x,C[z]=t?.y;break;case"esriGeometryPolygon":e=t?.centroid,null!=e?.x&&null!=e?.y?(L[z]=e.x,C[z]=e.y):c[z]=N.IsMovable;break;case"esriGeometryPolyline":case"esriGeometryMultipoint":e=t?.extent?.center,null!=e?.x&&null!=e?.y?(L[z]=e.x,C[z]=e.y):c[z]=N.IsMovable;break;default:c[z]=N.IsMovable}(null==L[z]||null==C[z]||Number.isNaN(L[z])||Number.isNaN(C[z]))&&(c[z]=N.IsMovable,L[z]=0,C[z]=0)}else c[z]=N.IsMovable,L[z]=0,C[z]=0;p.set(i.attributes[u],z),I[z]={feature:i,typeName:a},z++}));let U=!1;const F=new Map;s.forEach((e=>{const t=e.feature.attributes[y],a=e.feature.attributes[g],i=p.get(t),n=p.get(a);if(void 0!==i&&void 0!==n){const s=t+"-"+a,r=F.get(s),h=r?.has(e.typeName);h||(k[B]=i,w[B]=n,void 0===r?F.set(s,new Map([[e.typeName,B]])):r.set(e.typeName,B),B++),o.push(e)}else U=!0,this.relationshipLinkChartDiagramLookup.set(t,null)})),U&&i.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 H=this._validateLayoutSettings(e,t),Q=this._convertLayoutSettingsToCalculationSettings(H);await v();const{success:K,links:Y}=S(c,L,C,k.subarray(0,B),w.subarray(0,B),Q.computationBudgetTime,Q.idealEdgeLengthMultiplier,Q.repulsionRadiusMultiplier);if(!K)throw new a("knowledge-graph:layout-failed","Attempting to arrange the records in the specified layout failed");for(let a=0;a<I.length;a++){if(C[a]>84.9999?C[a]=84.9999:C[a]<-84.9999&&(C[a]=-84.9999),L[a]>179.9999?L[a]=179.9999:L[a]<-179.9999&&(L[a]=-179.9999),I[a].feature.attributes[m]=new G(L[a],C[a]),r.has(I[a].typeName)){const e=r.get(I[a].typeName);e?.set(I[a].feature.attributes[u],I[a].feature)}else{const e=new Map;e.set(I[a].feature.attributes[u],I[a].feature),r.set(I[a].typeName,e)}d.set(I[a].feature.attributes[u],I[a].feature);const e=l(I[a].feature.attributes[m]);this.entityLinkChartDiagramLookup.set(I[a].feature.attributes[u],I[a].feature.attributes[m]?e:null),I[a].feature.attributes[m].x<P.xmin&&(P.xmin=I[a].feature.attributes[m].x),I[a].feature.attributes[m].x>P.xmax&&(P.xmax=I[a].feature.attributes[m].x),I[a].feature.attributes[m].y<P.ymin&&(P.ymin=I[a].feature.attributes[m].y),I[a].feature.attributes[m].y>P.ymax&&(P.ymax=I[a].feature.attributes[m].y)}if(this.linkChartExtent.xmin=P.xmin,this.linkChartExtent.xmax=P.xmax,this.linkChartExtent.ymin=P.ymin,this.linkChartExtent.ymax=P.ymax,!Y)throw new a("knowledge-graph:layout-failed","Attempting to retrieve link geometry from diagram engine failed");const $=new Map,W=new Map,q=new Map,J=new Set;for(let a=0;a<o.length;a++){const e=[],t=o[a],n=t.feature.attributes[y],s=t.feature.attributes[g],r=n+"-"+s,c=F.get(r).get(t.typeName),f=0===c?0:Y?.vertexEndIndex[c-1];if(!J.has(c)){if(J.add(c),Y.types[c]===R.Recursive){const t=[Y.vertices[2*f],Y.vertices[2*f+1]],a=[Y.vertices[2*(f+1)],Y.vertices[2*(f+1)+1]],i=[.5*(t[0]+a[0]),.5*(t[1]+a[1])],n=[i[0]-t[0],i[1]-t[1]],s=[i[0]+n[1],i[1]-n[0]],o=[i[0]-n[1],i[1]+n[0]];e.push(t),e.push(s),e.push(a),e.push(o),e.push(t)}else{if(Y.types[c]!==R.Regular){i.getLogger(this).warn("A relationship generated an unsupported link geometry type. It will not be rendered");continue}for(let t=f;t<Y.vertexEndIndex[c];t++)e.push([Y.vertices[2*t],Y.vertices[2*t+1]])}const t=I[p.get(n)]?.feature.attributes[m],a=I[p.get(s)]?.feature.attributes[m];e[0][0]===t.x&&e[0][1]===t.y||(e[0]=[t.x,t.y]),e[e.length-1][0]===a.x&&e[e.length-1][1]===a.y||(e[e.length-1]=[a.x,a.y]);for(let i=1;i<e.length-1;i++)e[i][1]>85.5?e[i][1]=85.5:e[i][1]<-85.5&&(e[i][1]=-85.5),e[i][0]>179.9999?e[i][0]=179.9999:e[i][0]<-179.9999&&(e[i][0]=-179.9999);$.has(r)?$.get(r).push(e):$.set(r,[e])}const L=$.get(r);W.has(r)||(W.set(r,new Map),q.set(r,new Map));const C=W.get(r),k=q.get(r);C.has(t.typeName)||(C.set(t.typeName,L.shift()),k.set(t.typeName,0));const w=C.get(t.typeName);k.set(t.typeName,k.get(t.typeName)+1);const M=new _({paths:w});if(t.feature.attributes[m]=M,h.has(t.typeName)){const e=h.get(t.typeName);e?.set(t.feature.attributes[u],t.feature)}else{const e=new Map;e.set(t.feature.attributes[u],t.feature),h.set(t.typeName,e)}d.set(t.feature.attributes[u],t.feature);const b=l(t.feature.attributes[m]);this.relationshipLinkChartDiagramLookup.set(t.feature.attributes[u],t.feature.attributes[m]?b:null)}for(const a of o)a.feature.attributes[f]=q.get(a.feature.attributes[y]+"-"+a.feature.attributes[g])?.get(a.typeName)??null;return this._currentLinkChartConfig={layoutMode:e,layoutOptions:H},{nodes:r,links:h,idMap:d}}async applyNewLinkChartLayout(e="RADIAL_TREE",t){const a=[];await this.calculateLinkChartLayout(e,t),this.layers.forEach((e=>{a.push(e.refreshCachedQueryEngine())})),await Promise.all(a),this._refreshNamedTypes()}getCurrentNodeLocations(){const e=new Map;return this.dataManager.inclusionModeDefinition?.namedTypeDefinitions?.forEach((t=>{t?.members?.forEach((t=>{const a=t.linkChartLocation;let i;const n=t.id;a&&(i="x"in a?{x:a.x,y:a.y}:{x:a.coords[0],y:a.coords[1]},e.set(n,new G({x:i.x,y:i.y})))}))})),e}async synchronizeInclusionListWithCache(){return new Promise((e=>{this.dataManager.inclusionModeDefinition?.namedTypeDefinitions.forEach(((e,t)=>{if(e.useAllData=!1,e.members&&e.members.size>0){if(!this.dataManager.sublayerCaches.get(t))return;const a=new Set(Array.from(this.dataManager.sublayerCaches.get(t).keys()));Array.from(e.members.keys()).filter((e=>!a.has(e))).forEach((t=>{e.members?.delete(t)}))}})),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){let t=[];for(const i of this.dataManager.relationshipTypeNames){const e=this.sublayerIdsCache.get(i);e&&(t=t.concat(Array.from(e.keys())))}const a=await this.dataManager.getRelationshipsBetweenNodes(e,t);return await this._handleNewRecords(a),{records:a}}async connectFromEntities(e){let t=[];for(const n of this.dataManager.relationshipTypeNames){const e=this.sublayerIdsCache.get(n);e&&(t=t.concat(Array.from(e.keys())))}let a=[];for(const n of this.dataManager.entityTypeNames){const e=this.sublayerIdsCache.get(n);e&&(a=a.concat(Array.from(e)))}const i=await this.dataManager.getRelationshipsFromNodes(e,a,t);return await this._handleNewRecords(i),{records:i}}async _handleNewRecords(e){const t=[];this.dataManager.addToLayer(e);for(const i of e)this.sublayerIdsCache.has(i.typeName)||(this.sublayerIdsCache.set(i.typeName,new Set),t.push(i.typeName)),this.sublayerIdsCache.get(i.typeName).add(i.id);for(const i of t){const e=this._graphTypeLookup.get(i);if(e){const t=new L({objectType:e,parentCompositeLayer:this,graphType:e.type,title:i});"entity"===e.type?this.dataManager.entityTypeNames.add(i):this.dataManager.relationshipTypeNames.add(i),t.geometryType?this.layers.push(t):this.tables.push(t),this.dataManager.sublayerCaches.set(i,new Map)}}await this.dataManager.refreshCacheContent(e.map((e=>e.id)));const a=Object.assign({},this._currentLinkChartConfig.layoutOptions);a.lockedNodeLocations=new Map;for(const[i,n]of this.entityLinkChartDiagramLookup.entries())n&&a.lockedNodeLocations.set(i,new G(n.coords[0],n.coords[1]));console.log("Applying new layout with locked locations: ",a.lockedNodeLocations),await this.applyNewLinkChartLayout(this._currentLinkChartConfig.layoutMode,a)}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 n=e.id;if(!a)return;i="x"in a?{x:a.x,y:a.y}:{x:a.coords[0],y:a.coords[1]};const s=l(i);this.dataManager.relationshipTypeNames.has(t)?this.relationshipLinkChartDiagramLookup.set(n,s):this.entityLinkChartDiagramLookup.set(n,s),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[y]),a=this.relationshipLinkChartDiagramLookup.get(e.attributes[g]);if(t&&a){const i=l(new _({paths:[[t.coords[0],t.coords[1]],[a.coords[0],a.coords[1]]]}));this.relationshipLinkChartDiagramLookup.set(e.attributes[u],i)}else this.relationshipLinkChartDiagramLookup.set(e.attributes[u],null)}))}))):await this.calculateLinkChartLayout(this.defaultLinkChartConfig.layoutMode,{lockedNodeLocations:this.getCurrentNodeLocations(),...this.defaultLinkChartConfig.layoutOptions||{}}):await this.calculateLinkChartLayout("RADIAL_TREE",{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),n=e=>a(e)&&e>=1,s=e=>a(e)&&e>=1,o=e=>Object.values(p).includes(e),r=e=>a(e)&&e>=0,h=new Set(["FORCE_DIRECTED","COMMUNITY","GEOGRAPHIC"]),l={};if(!h.has(e)||!t)return!h.has(e)&&t&&i.getLogger(this).warn("Layout mode options were given for a layout mode that does not utilize them, settings will be ignored"),l;const{computationBudgetTime:d,repulsionRadiusMultiplier:c,idealEdgeLength:u,idealEdgeLengthType:y}=t;s(d)?l.computationBudgetTime=d:void 0!==d&&i.getLogger(this).warn("Invalid layout computationBudgetTime setting, will revert to default setting"),n(c)?l.repulsionRadiusMultiplier=c:void 0!==c&&i.getLogger(this).warn("Invalid layout repulsionRadiusMultiplier setting, will revert to default setting");const g=void 0!==u||void 0!==y;return"GEOGRAPHIC"!==e&&g?i.getLogger(this).warn("Ideal edge length settings were specified for an incompatible layout mode, and will be ignored"):"GEOGRAPHIC"===e&&g&&(o(y)?l.idealEdgeLengthType=y:void 0!==y&&i.getLogger(this).warn('Invalid layout idealEdgeLengthType setting, will revert to "multiplier" setting'),r(u)?l.idealEdgeLength=u:void 0!==u&&i.getLogger(this).warn("Invalid layout idealEdgeLength setting, will revert to default setting")),l}_convertLayoutSettingsToCalculationSettings(e){let t=e.idealEdgeLength;return e.idealEdgeLengthType===p.ABSOLUTE&&(void 0===t?t=-1:t*=-1),{computationBudgetTime:e.computationBudgetTime,repulsionRadiusMultiplier:e.repulsionRadiusMultiplier,idealEdgeLengthMultiplier:t}}};e([o()],j.prototype,"dataPreloadedInLocalCache",void 0),e([o()],j.prototype,"defaultLinkChartConfig",void 0),e([o()],j.prototype,"dataManager",void 0),e([o()],j.prototype,"knowledgeGraph",void 0),e([o()],j.prototype,"layers",void 0),e([o()],j.prototype,"entityLinkChartDiagramLookup",void 0),e([o()],j.prototype,"relationshipLinkChartDiagramLookup",void 0),e([o()],j.prototype,"linkChartExtent",void 0),e([o()],j.prototype,"memberEntityTypes",void 0),e([o()],j.prototype,"memberRelationshipTypes",void 0),e([o()],j.prototype,"sublayerIdsCache",void 0),e([o()],j.prototype,"tables",void 0),e([o({json:{read:!1}})],j.prototype,"type",void 0),j=e([r("esri.layers.LinkChartLayer")],j);const P=j;export{P as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.31/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../chunks/tslib.es6.js";import"../../geometry.js";import t from"../../core/Accessor.js";import i from"../../core/Error.js";import n from"../../core/Logger.js";import{getOrCreateMapValue as o}from"../../core/MapUtils.js";import{parseWhereClause as s}from"../../core/sql.js";import{property as r}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/RandomLCG.js";import{subclass as a}from"../../core/accessorSupport/decorators/subclass.js";import p from"../../geometry/Polygon.js";import{initializeProjection as d,project as m}from"../../geometry/projection.js";import{wgs84 as l}from"../../geometry/support/spatialReferenceUtils.js";import h from"./SessionMemoryStorage.js";import{extentToInBoundsRings as c}from"./supportUtils.js";import{executeQueryStreaming as y}from"../../rest/knowledgeGraphService.js";import u from"../../rest/knowledgeGraph/GraphQueryStreaming.js";import f from"../../rest/support/Query.js";import g from"../../geometry/Extent.js";const w="ESRI__ID",b="ESRI__ORIGIN_ID",T="ESRI__DESTINATION_ID",D="ESRI__LAYOUT_GEOMETRY",I="ESRI__AGGREGATION_COUNT";let M=class extends t{constructor(e){super(e),this._processingCacheUpdatesLookup=new Map,this.knowledgeGraph=null,this.inclusionModeDefinition={generateAllSublayers:!0,namedTypeDefinitions:new Map},this.entityTypeNames=new Set,this.relationshipTypeNames=new Set,this.geographicLookup=new Map,this.sublayerCaches=new Map,this.nodeConnectionsLookup=new Map,this.relationshipConnectionsLookup=new Map,this.memberIdTypeLookup=new Map;const t=new Map;e.knowledgeGraph.dataModel.entityTypes?.forEach((i=>{i.name&&(t.set(i.name,"entity"),this._processingCacheUpdatesLookup.set(i.name,[]),e.inclusionModeDefinition&&!e.inclusionModeDefinition?.generateAllSublayers||this.entityTypeNames.add(i.name),i.properties?.forEach((e=>{e.geometryType&&"esriGeometryNull"!==e.geometryType&&this.geographicLookup.set(i.name,{name:e.name??"",geometryType:e.geometryType})})))})),e.knowledgeGraph.dataModel.relationshipTypes?.forEach((i=>{i.name&&(t.set(i.name,"relationship"),this._processingCacheUpdatesLookup.set(i.name,[]),e.inclusionModeDefinition&&!e.inclusionModeDefinition?.generateAllSublayers||this.relationshipTypeNames.add(i.name),i.properties?.forEach((e=>{e.geometryType&&"esriGeometryNull"!==e.geometryType&&this.geographicLookup.set(i.name,{name:e.name??"",geometryType:e.geometryType})})))})),e.inclusionModeDefinition?.namedTypeDefinitions.forEach(((i,s)=>{if("entity"===t.get(s))this.entityTypeNames.add(s);else{if("relationship"!==t.get(s))return n.getLogger(this).warn(`A named type, ${s}, was in the inclusion list that wasn't in the data model and will be removed`),void e.inclusionModeDefinition?.namedTypeDefinitions.delete(s);this.relationshipTypeNames.add(s)}const r=new Map;i.members?.forEach((e=>{o(this.memberIdTypeLookup,e.id,(()=>new Set)).add(s);const t=this.getById(e.id);t&&r.set(e.id,t)})),this.sublayerCaches.set(s,r)}))}addToLayer(e){e.forEach((({typeName:e,id:t})=>{if(!this.inclusionModeDefinition)throw new i("knowledge-graph:layer-data-manager","You cannot add to a layer's exclusion list if it was not created with an exclusion list originally");if(this.inclusionModeDefinition.namedTypeDefinitions.has(e)){if(this.inclusionModeDefinition.namedTypeDefinitions.has(e)){const i=this.inclusionModeDefinition.namedTypeDefinitions.get(e);i.members||(i.members=new Map),i.members.set(t,{id:t}),o(this.memberIdTypeLookup,t,(()=>new Set)).add(e)}}else{const i=new Map;i.set(t,{id:t}),this.inclusionModeDefinition.namedTypeDefinitions.set(e,{useAllData:!1,members:i}),o(this.memberIdTypeLookup,t,(()=>new Set)).add(e)}}))}getById(e){return h.getInstance().readFromStoreById(e)}async getData(e,t,i){if(t.objectType.name&&this.inclusionModeDefinition?.namedTypeDefinitions&&this.inclusionModeDefinition.namedTypeDefinitions.size>0&&!this.inclusionModeDefinition.namedTypeDefinitions.has(t.objectType.name))return[];let n;if(n=e||new f({where:"1=1",outFields:["*"]}),"link-chart"===t.parentCompositeLayer.type){const e=t.parentCompositeLayer,i=this._processingCacheUpdatesLookup.get(t.objectType.name??""),o=n.outFields;o&&1===o.length&&o[0]===w&&"1=1"===n.where||await Promise.all(i??[]);const s=this.sublayerCaches.has(t.objectType.name??"")?Array.from(this.sublayerCaches.get(t.objectType.name)?.values()):[],r=[];return s.forEach((i=>{this.relationshipTypeNames.has(t.objectType.name)?i.geometry=e.relationshipLinkChartDiagramLookup.get(i.attributes[t.objectIdField]):i.geometry=e.entityLinkChartDiagramLookup.get(i.attributes[t.objectIdField]),i.attributes[D]=i.geometry,r.push(i)})),r}return this.retrieveDataFromService(n,t,i)}async getConnectedRecordIds(e,t){const i=[];let o="";const s=[],r=new Map;if(e.forEach((e=>{if(this.memberIdTypeLookup.has(e))for(const t of this.memberIdTypeLookup.get(e)){if(!this.entityTypeNames.has(t))return;r.has(t)?r.get(t)?.push(e):r.set(t,[e])}})),t&&0!==t?.length){for(const e of t)o=o+e+"|";o=o.slice(0,-1)}return r.forEach(((e,r)=>{let a;a=t&&0!==t?.length?`MATCH (n:${r})-[r:${o}]-(m) WHERE id(n) IN $ids RETURN id(r), type(r), id(m), labels(m)[0]`:`MATCH (n:${r})-[r]-(m) WHERE id(n) IN $ids RETURN id(r), type(r), id(m), labels(m)[0]`;const p=new Promise((t=>{(async()=>{const t=(await y(this.knowledgeGraph,new u({openCypherQuery:a,bindParameters:{ids:e}}))).resultRowsStream.getReader();try{for(;;){const{done:e,value:n}=await t.read();if(e)break;for(let t=0;t<n.length;t++){const e=n[t];i.push({id:e[0],typeName:e[1]}),i.push({id:e[2],typeName:e[3]})}}}catch(o){if("AbortError"!==o.name)throw o;n.getLogger(this).info("Request aborted as expected")}})().then((()=>{t()}))}));s.push(p)})),this.refreshCacheContent(),await Promise.all(s),i}async getAttachedRelationships(e,t){const i=[],o="MATCH (n)-[r]->(m) WHERE id(n) IN $nodeIds AND id(m) in $nodeIds AND NOT id(r) IN $relationshipExclusionIds return id(r), type(r)",s=(await y(this.knowledgeGraph,new u({openCypherQuery:o,bindParameters:{nodeIds:e,relationshipExclusionIds:t}}))).resultRowsStream.getReader();try{for(;;){const{done:e,value:t}=await s.read();if(e)break;for(let n=0;n<t.length;n++){const e=t[n];i.push({id:e[0],typeName:e[1]})}}}catch(r){if("AbortError"!==r.name)throw r;n.getLogger(this).info("Request aborted as expected")}return i}async refreshCacheContent(e,t,n,s=!0){const r=h.getInstance(),a=[],p=new Map,d=new Map;this.knowledgeGraph.dataModel.entityTypes?.forEach((e=>{e.name&&d.set(e.name,e)})),this.knowledgeGraph.dataModel.relationshipTypes?.forEach((e=>{e.name&&d.set(e.name,e)})),e||this.inclusionModeDefinition?e?e.forEach((e=>{if(this.memberIdTypeLookup.has(e))for(const t of this.memberIdTypeLookup.get(e))p.has(t)?p.get(t)?.push(e):p.set(t,[e])})):this.inclusionModeDefinition?.namedTypeDefinitions?.forEach(((e,t)=>{e.useAllData?p.set(t,null):e.members&&e.members.forEach((e=>{p.has(t)&&null!==p.get(t)?p.get(t)?.push(e.id):p.set(t,[e.id])}))})):(this.knowledgeGraph.dataModel.entityTypes?.forEach((e=>{e.name&&p.set(e.name,null)})),this.knowledgeGraph.dataModel.entityTypes?.forEach((e=>{e.name&&p.set(e.name,null)})));for(const[m,l]of p){const e=new Promise((e=>{const a=async()=>{const e=new Set,a=[];let p,h="",c=!1;if(t||d.get(m)?.properties?.forEach((t=>{t.name&&e.add(t.name)})),n&&this.geographicLookup.has(m)){const t=this.geographicLookup.get(m)?.name;t&&e.add(t)}if(this.entityTypeNames.has(m))h=`MATCH (n:${m}) ${l?"WHERE id(n) IN $ids ":""}return ID(n)`,e.forEach((e=>{h+=`, n.${e}`,a.push(e)}));else{if(!this.relationshipTypeNames.has(m))throw new i("knowledge-graph:layer-data-manager",`The graph type of ${m} could not be determined. Was this type set in the KG data model and inclusion definition?`);c=!0,h=`MATCH ()-[n:${m}]->() ${l?"WHERE id(n) IN $ids ":""}return ID(n), id(startNode(n)), id(endNode(n))`,e.forEach((e=>{h+=`, n.${e}`,a.push(e)}))}p=new u(l?{openCypherQuery:h,bindParameters:{ids:l}}:{openCypherQuery:h});const f=(await y(this.knowledgeGraph,p)).resultRowsStream.getReader();for(;;){const{done:e,value:t}=await f.read();if(e)break;const i=[];for(let s=0;s<t.length;s++){const e=t[s];let n=0,r=0;const p={properties:{}};for(p.id=e[n],n++,r++,c&&(p.originId=e[n],n++,r++,p.destinationId=e[n],n++,r++,o(this.nodeConnectionsLookup,p.originId,(()=>new Set)).add(p.id),o(this.nodeConnectionsLookup,p.destinationId,(()=>new Set)).add(p.id),o(this.relationshipConnectionsLookup,p.id,(()=>[p.originId,p.destinationId])));n<e.length;n++)p.properties[a[n-r]]=e[n];i.push(p)}const n=r.writeToStore(i,w,this.geographicLookup.get(m)?.name);this.sublayerCaches.has(m)||this.sublayerCaches.set(m,new Map),s&&!this.inclusionModeDefinition?.namedTypeDefinitions.has(m)&&this.inclusionModeDefinition?.namedTypeDefinitions.set(m,{useAllData:!1,members:new Map}),s&&!this.inclusionModeDefinition?.namedTypeDefinitions.get(m).members&&(this.inclusionModeDefinition.namedTypeDefinitions.get(m).members=new Map);const p=this.sublayerCaches.get(m);n.forEach((e=>{p?.set(e.attributes[w],e),s&&!this.inclusionModeDefinition?.namedTypeDefinitions.get(m).members.has(e.attributes[w])&&(this.inclusionModeDefinition?.namedTypeDefinitions.get(m).members.set(e.attributes[w],{id:e.attributes[w]}),o(this.memberIdTypeLookup,e.attributes[w],(()=>new Set)).add(m))}))}};a().then((()=>{e(null)}))}));a.push(e),this._processingCacheUpdatesLookup.get(m)?.push(e)}await Promise.all(a)}removeFromLayer(e){const t=new Set,i=new Set(e.map((e=>e.id)));for(const n of e)t.add(n.typeName),1===this.memberIdTypeLookup.get(n.id)?.size?this.memberIdTypeLookup.delete(n.id):this.memberIdTypeLookup.get(n.id)?.delete(n.typeName),this.inclusionModeDefinition?.namedTypeDefinitions.forEach(((e,t)=>{t===n.typeName&&e.members?.has(n.id)&&e.members.delete(n.id)}));t.forEach((e=>{this.sublayerCaches.get(e)?.forEach(((t,n)=>{i.has(n)&&this.sublayerCaches.get(e)?.delete(n)}))}))}async retrieveDataFromService(e,t,n){const o=h.getInstance(),r=new Set,a=[];let f,b="",T=[];const D="relationship"===t.graphType,I=this.inclusionModeDefinition?.namedTypeDefinitions?.get(t.objectType.name)?.useAllData,M=t.parentCompositeLayer.sublayerIdsCache.get(t.objectType.name);let E=!I&&M?Array.from(M).sort():null;if(this.inclusionModeDefinition?.namedTypeDefinitions?.get(t.objectType.name)?.useAllData)this.inclusionModeDefinition?.namedTypeDefinitions?.get(t.objectType.name)?.useAllData&&null!=e.objectIds&&(E=e.objectIds);else if(null!=e.objectIds&&E&&E.length>0){const t=e.objectIds;e.objectIds=E.filter((e=>t.includes(e)))}else if(null!=e.objectIds)E=e.objectIds;else{if(this.inclusionModeDefinition?.namedTypeDefinitions.has(t.objectType.name)&&(!this.inclusionModeDefinition.namedTypeDefinitions.get(t.objectType.name)?.members||this.inclusionModeDefinition.namedTypeDefinitions.get(t.objectType.name)?.members?.size<1))return e.objectIds=[],[];e.objectIds=E}if(null!=e.outFields){const i=e.outFields;i.includes("*")?t.fields.forEach((e=>{r.add(e.name)})):i.forEach((e=>{e!==w&&e!==t.geometryFieldName&&r.add(e)}))}if(null!=e.geometry){const n=e.geometry;let o;const h=t.parentCompositeLayer.dataManager.knowledgeGraph.serviceDefinition,y=h?.spatialReference,w=h?.serviceCapabilities?.geometryCapabilities;let T=w?.geometryMaxBoundingRectangleSizeX,I=w?.geometryMaxBoundingRectangleSizeY;if(n?.extent?.spatialReference&&!n.spatialReference?.isWGS84?(await d(n.extent.spatialReference,l),o=m(n.extent,l)):o=n.extent,T&&I&&y){if(4326!==y.wkid){const e=new g({spatialReference:y,xmax:T,ymax:I}),t=m(e,l);T=t.xmax,I=t.ymax}if(o.xmax-o.xmin>T)throw new i("knowledge-graph:layer-data-manager",`Extent x bounds should be within ${T}° latitude, limit exceeded`);if(o.ymax-o.ymin>I)throw new i("knowledge-graph:layer-data-manager",`Extent y bounds should be within ${I}° longitude, limit exceeded`)}if(null!=e.where&&"1=1"!==e.where){const i=await s(e.where.toUpperCase(),t.fieldsIndex);t.fields.forEach((e=>{i.fieldNames.includes(e.name)&&r.add(e.name)}))}b=D?`Match ()-[n:${t.objectType.name}]->() WHERE esri.graph.ST_Intersects($param_filter_geom, n.${t.geometryFieldName}) return ID(n), id(startNode(r)), id(endNode(r))`:`Match (n:${t.objectType.name}) WHERE esri.graph.ST_Intersects($param_filter_geom, n.${t.geometryFieldName}) return ID(n)`,t.geometryFieldName&&r.add(t.geometryFieldName),r.forEach((e=>{b+=`, n.${e}`,a.push(e)})),f=new u({openCypherQuery:b,bindParameters:{param_filter_geom:new p({rings:c(o)})}})}else{let i="";if(null!=e.where&&"1=1"!==e.where){const n=await s(e.where,t.fieldsIndex);t.fields.forEach((e=>{n.fieldNames.includes(e.name)&&r.add(e.name)}));const o=new Set(["column-reference","string","number","binary-expression"]),a=new Set(["=","<","<=","<>",">",">=","AND","OR","LIKE"]);let p=!1;const d=e=>{if("column-reference"===e.type)return`n.${e.column}`;if("string"===e.type)return`'${e.value}'`;if("number"===e.type)return`${e.value}`;if("binary-expression"===e.type&&o.has(e.left.type)&&o.has(e.right.type)&&a.has(e.operator))return`${d(e.left)} ${e.operator} ${d(e.right)}`;if("binary-expression"===e.type&&"LIKE"===e.operator){let t="";if("function"===e.left.type&&"column-reference"===e.left.args.value[0].type)t+=`lower(n.${e.left.args.value[0].column})`;else{if("column-reference"!==e.left.type)return p=!0,"";t+=`lower(n.${e.left.column})`}if(t+=" CONTAINS (","string"!==e.right.type)return p=!0,"";{let i=e.right.value;"%"===i.charAt(0)&&(i=i.slice(1)),"%"===i.charAt(i.length-1)&&(i=i.slice(0,-1)),t+=`'${i.toLowerCase()}')`}return t}return p=!0,""};i=d(n.parseTree),p&&(i="")}let n="";n=D?`Match ()-[n:${t.objectType.name}]->()`:`Match (n:${t.objectType.name})`;let o=!1;E&&(o=!0,n+=" WHERE ID(n) IN $ids"),i&&(n+=o?" AND":" WHERE",n+=` ${i}`),n+=" return ID(n)",D&&(n+=", id(startNode(n)), id(endNode(n))"),e.returnGeometry&&t.geometryFieldName&&r.add(t.geometryFieldName),r.forEach((e=>{n+=`, n.${e}`,a.push(e)})),f=new u(E?{openCypherQuery:n,bindParameters:{ids:E}}:{openCypherQuery:n})}const k=(await y(t.parentCompositeLayer.dataManager.knowledgeGraph,f,n)).resultRowsStream.getReader();for(;;){const{done:e,value:i}=await k.read();if(e)break;const n=[];for(let t=0;t<i.length;t++){const e=i[t];let o=0,s=0;const r={properties:{}};for(r.id=e[o],o++,s++,D&&(r.originId=e[o],o++,s++,r.destinationId=e[o],o++,s++);o<e.length;o++)r.properties[a[o-s]]=e[o];n.push(r)}T=T.concat(o.writeToStore(n,w,t.parentCompositeLayer.dataManager.geographicLookup.get(t.objectType.name)?.name))}return T}};e([r()],M.prototype,"knowledgeGraph",void 0),e([r()],M.prototype,"inclusionModeDefinition",void 0),e([r()],M.prototype,"entityTypeNames",void 0),e([r()],M.prototype,"relationshipTypeNames",void 0),e([r()],M.prototype,"geographicLookup",void 0),e([r()],M.prototype,"sublayerCaches",void 0),e([r()],M.prototype,"nodeConnectionsLookup",void 0),e([r()],M.prototype,"relationshipConnectionsLookup",void 0),e([r()],M.prototype,"memberIdTypeLookup",void 0),M=e([a("esri.layers.knowledgeGraph.KnowledgeGraphLayerDataManager")],M);export{M as KnowledgeGraphLayerDataManager,I as mockAggregationCountFieldName,T as mockDestinationIdFieldName,D as mockLayoutGeometryFieldName,w as mockOidFieldName,b as mockOriginIdFieldName};
5
+ import{_ as e}from"../../chunks/tslib.es6.js";import"../../geometry.js";import t from"../../core/Accessor.js";import i from"../../core/Error.js";import n from"../../core/Logger.js";import{getOrCreateMapValue as o}from"../../core/MapUtils.js";import{parseWhereClause as s}from"../../core/sql.js";import{property as r}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/RandomLCG.js";import{subclass as a}from"../../core/accessorSupport/decorators/subclass.js";import d from"../../geometry/Polygon.js";import{initializeProjection as p,project as l}from"../../geometry/projection.js";import{wgs84 as m}from"../../geometry/support/spatialReferenceUtils.js";import h from"./SessionMemoryStorage.js";import{extentToInBoundsRings as c}from"./supportUtils.js";import{executeQueryStreaming as y}from"../../rest/knowledgeGraphService.js";import u from"../../rest/knowledgeGraph/GraphQueryStreaming.js";import f from"../../rest/support/Query.js";import g from"../../geometry/Extent.js";const w="ESRI__ID",b="ESRI__ORIGIN_ID",T="ESRI__DESTINATION_ID",I="ESRI__LAYOUT_GEOMETRY",D="ESRI__AGGREGATION_COUNT";let E=class extends t{constructor(e){super(e),this._processingCacheUpdatesLookup=new Map,this.knowledgeGraph=null,this.inclusionModeDefinition={generateAllSublayers:!0,namedTypeDefinitions:new Map},this.entityTypeNames=new Set,this.relationshipTypeNames=new Set,this.geographicLookup=new Map,this.sublayerCaches=new Map,this.nodeConnectionsLookup=new Map,this.relationshipConnectionsLookup=new Map,this.memberIdTypeLookup=new Map;const t=new Map;e.knowledgeGraph.dataModel.entityTypes?.forEach((i=>{i.name&&(t.set(i.name,"entity"),this._processingCacheUpdatesLookup.set(i.name,[]),e.inclusionModeDefinition&&!e.inclusionModeDefinition?.generateAllSublayers||this.entityTypeNames.add(i.name),i.properties?.forEach((e=>{e.geometryType&&"esriGeometryNull"!==e.geometryType&&this.geographicLookup.set(i.name,{name:e.name??"",geometryType:e.geometryType})})))})),e.knowledgeGraph.dataModel.relationshipTypes?.forEach((i=>{i.name&&(t.set(i.name,"relationship"),this._processingCacheUpdatesLookup.set(i.name,[]),e.inclusionModeDefinition&&!e.inclusionModeDefinition?.generateAllSublayers||this.relationshipTypeNames.add(i.name),i.properties?.forEach((e=>{e.geometryType&&"esriGeometryNull"!==e.geometryType&&this.geographicLookup.set(i.name,{name:e.name??"",geometryType:e.geometryType})})))})),e.inclusionModeDefinition?.namedTypeDefinitions.forEach(((i,s)=>{if("entity"===t.get(s))this.entityTypeNames.add(s);else{if("relationship"!==t.get(s))return n.getLogger(this).warn(`A named type, ${s}, was in the inclusion list that wasn't in the data model and will be removed`),void e.inclusionModeDefinition?.namedTypeDefinitions.delete(s);this.relationshipTypeNames.add(s)}const r=new Map;i.members?.forEach((e=>{o(this.memberIdTypeLookup,e.id,(()=>new Set)).add(s);const t=this.getById(e.id);t&&r.set(e.id,t)})),this.sublayerCaches.set(s,r)}))}addToLayer(e){e.forEach((({typeName:e,id:t})=>{if(!this.inclusionModeDefinition)throw new i("knowledge-graph:layer-data-manager","You cannot add to a layer's exclusion list if it was not created with an exclusion list originally");if(this.inclusionModeDefinition.namedTypeDefinitions.has(e)){if(this.inclusionModeDefinition.namedTypeDefinitions.has(e)){const i=this.inclusionModeDefinition.namedTypeDefinitions.get(e);i.members||(i.members=new Map),i.members.set(t,{id:t}),o(this.memberIdTypeLookup,t,(()=>new Set)).add(e)}}else{const i=new Map;i.set(t,{id:t}),this.inclusionModeDefinition.namedTypeDefinitions.set(e,{useAllData:!1,members:i}),o(this.memberIdTypeLookup,t,(()=>new Set)).add(e)}}))}getById(e){return h.getInstance().readFromStoreById(e)}async getData(e,t,i){if(t.objectType.name&&this.inclusionModeDefinition?.namedTypeDefinitions&&this.inclusionModeDefinition.namedTypeDefinitions.size>0&&!this.inclusionModeDefinition.namedTypeDefinitions.has(t.objectType.name))return[];let n;if(n=e||new f({where:"1=1",outFields:["*"]}),"link-chart"===t.parentCompositeLayer.type){const e=t.parentCompositeLayer,i=this._processingCacheUpdatesLookup.get(t.objectType.name??""),o=n.outFields;o&&1===o.length&&o[0]===w&&"1=1"===n.where||await Promise.all(i??[]);const s=this.sublayerCaches.has(t.objectType.name??"")?Array.from(this.sublayerCaches.get(t.objectType.name)?.values()):[],r=[];return s.forEach((i=>{this.relationshipTypeNames.has(t.objectType.name)?i.geometry=e.relationshipLinkChartDiagramLookup.get(i.attributes[t.objectIdField]):i.geometry=e.entityLinkChartDiagramLookup.get(i.attributes[t.objectIdField]),i.attributes[I]=i.geometry,r.push(i)})),r}return this.retrieveDataFromService(n,t,i)}async getConnectedRecordIds(e,t){const i=[];let o="";const s=[],r=new Map;if(e.forEach((e=>{if(this.memberIdTypeLookup.has(e))for(const t of this.memberIdTypeLookup.get(e)){if(!this.entityTypeNames.has(t))return;r.has(t)?r.get(t)?.push(e):r.set(t,[e])}})),t&&0!==t?.length){for(const e of t)o=o+e+"|";o=o.slice(0,-1)}return r.forEach(((e,r)=>{let a;a=t&&0!==t?.length?`MATCH (n:${r})-[r:${o}]-(m) WHERE id(n) IN $ids RETURN id(r), type(r), id(m), labels(m)[0]`:`MATCH (n:${r})-[r]-(m) WHERE id(n) IN $ids RETURN id(r), type(r), id(m), labels(m)[0]`;const d=new Promise((t=>{(async()=>{const t=(await y(this.knowledgeGraph,new u({openCypherQuery:a,bindParameters:{ids:e}}))).resultRowsStream.getReader();try{for(;;){const{done:e,value:n}=await t.read();if(e)break;for(let t=0;t<n.length;t++){const e=n[t];i.push({id:e[0],typeName:e[1]}),i.push({id:e[2],typeName:e[3]})}}}catch(o){if("AbortError"!==o.name)throw o;n.getLogger(this).info("Request aborted as expected")}})().then((()=>{t()}))}));s.push(d)})),this.refreshCacheContent(),await Promise.all(s),i}async getRelationshipsBetweenNodes(e,t){const i=[],o="MATCH (n)-[r]->(m) WHERE id(n) IN $nodeIds AND id(m) in $nodeIds AND NOT id(r) IN $relationshipExclusionIds return id(r), type(r)",s=(await y(this.knowledgeGraph,new u({openCypherQuery:o,bindParameters:{nodeIds:e,relationshipExclusionIds:t}}))).resultRowsStream.getReader();try{for(;;){const{done:e,value:t}=await s.read();if(e)break;for(let n=0;n<t.length;n++){const e=t[n];i.push({id:e[0],typeName:e[1]})}}}catch(r){if("AbortError"!==r.name)throw r;n.getLogger(this).info("Request aborted as expected")}return i}async getRelationshipsFromNodes(e,t,i){const o=[],s="MATCH (n)-[r]-(m) WHERE id(n) IN $targetEntityIds AND id(m) in $possibleConnectionEntityIds AND NOT id(r) IN $relationshipExclusionIds return id(r), type(r)",r=(await y(this.knowledgeGraph,new u({openCypherQuery:s,bindParameters:{targetEntityIds:e,possibleConnectionEntityIds:t,relationshipExclusionIds:i}}))).resultRowsStream.getReader();try{for(;;){const{done:e,value:t}=await r.read();if(e)break;for(let i=0;i<t.length;i++){const e=t[i];o.push({id:e[0],typeName:e[1]})}}}catch(a){if("AbortError"!==a.name)throw a;n.getLogger(this).info("Request aborted as expected")}return o}async refreshCacheContent(e,t,n,s=!0){const r=h.getInstance(),a=[],d=new Map,p=new Map;this.knowledgeGraph.dataModel.entityTypes?.forEach((e=>{e.name&&p.set(e.name,e)})),this.knowledgeGraph.dataModel.relationshipTypes?.forEach((e=>{e.name&&p.set(e.name,e)})),e||this.inclusionModeDefinition?e?e.forEach((e=>{if(this.memberIdTypeLookup.has(e))for(const t of this.memberIdTypeLookup.get(e))d.has(t)?d.get(t)?.push(e):d.set(t,[e])})):this.inclusionModeDefinition?.namedTypeDefinitions?.forEach(((e,t)=>{e.useAllData?d.set(t,null):e.members&&e.members.forEach((e=>{d.has(t)&&null!==d.get(t)?d.get(t)?.push(e.id):d.set(t,[e.id])}))})):(this.knowledgeGraph.dataModel.entityTypes?.forEach((e=>{e.name&&d.set(e.name,null)})),this.knowledgeGraph.dataModel.entityTypes?.forEach((e=>{e.name&&d.set(e.name,null)})));for(const[l,m]of d){const e=new Promise((e=>{const a=async()=>{const e=new Set,a=[];let d,h="",c=!1;if(t||p.get(l)?.properties?.forEach((t=>{t.name&&e.add(t.name)})),n&&this.geographicLookup.has(l)){const t=this.geographicLookup.get(l)?.name;t&&e.add(t)}if(this.entityTypeNames.has(l))h=`MATCH (n:${l}) ${m?"WHERE id(n) IN $ids ":""}return ID(n)`,e.forEach((e=>{h+=`, n.${e}`,a.push(e)}));else{if(!this.relationshipTypeNames.has(l))throw new i("knowledge-graph:layer-data-manager",`The graph type of ${l} could not be determined. Was this type set in the KG data model and inclusion definition?`);c=!0,h=`MATCH ()-[n:${l}]->() ${m?"WHERE id(n) IN $ids ":""}return ID(n), id(startNode(n)), id(endNode(n))`,e.forEach((e=>{h+=`, n.${e}`,a.push(e)}))}d=new u(m?{openCypherQuery:h,bindParameters:{ids:m}}:{openCypherQuery:h});const f=(await y(this.knowledgeGraph,d)).resultRowsStream.getReader();for(;;){const{done:e,value:t}=await f.read();if(e)break;const i=[];for(let s=0;s<t.length;s++){const e=t[s];let n=0,r=0;const d={properties:{}};for(d.id=e[n],n++,r++,c&&(d.originId=e[n],n++,r++,d.destinationId=e[n],n++,r++,o(this.nodeConnectionsLookup,d.originId,(()=>new Set)).add(d.id),o(this.nodeConnectionsLookup,d.destinationId,(()=>new Set)).add(d.id),o(this.relationshipConnectionsLookup,d.id,(()=>[d.originId,d.destinationId])));n<e.length;n++)d.properties[a[n-r]]=e[n];i.push(d)}const n=r.writeToStore(i,w,this.geographicLookup.get(l)?.name);this.sublayerCaches.has(l)||this.sublayerCaches.set(l,new Map),s&&!this.inclusionModeDefinition?.namedTypeDefinitions.has(l)&&this.inclusionModeDefinition?.namedTypeDefinitions.set(l,{useAllData:!1,members:new Map}),s&&!this.inclusionModeDefinition?.namedTypeDefinitions.get(l).members&&(this.inclusionModeDefinition.namedTypeDefinitions.get(l).members=new Map);const d=this.sublayerCaches.get(l);n.forEach((e=>{d?.set(e.attributes[w],e),s&&!this.inclusionModeDefinition?.namedTypeDefinitions.get(l).members.has(e.attributes[w])&&(this.inclusionModeDefinition?.namedTypeDefinitions.get(l).members.set(e.attributes[w],{id:e.attributes[w]}),o(this.memberIdTypeLookup,e.attributes[w],(()=>new Set)).add(l))}))}};a().then((()=>{e(null)}))}));a.push(e),this._processingCacheUpdatesLookup.get(l)?.push(e)}await Promise.all(a)}removeFromLayer(e){const t=new Set,i=new Set(e.map((e=>e.id)));for(const n of e)t.add(n.typeName),1===this.memberIdTypeLookup.get(n.id)?.size?this.memberIdTypeLookup.delete(n.id):this.memberIdTypeLookup.get(n.id)?.delete(n.typeName),this.inclusionModeDefinition?.namedTypeDefinitions.forEach(((e,t)=>{t===n.typeName&&e.members?.has(n.id)&&e.members.delete(n.id)}));t.forEach((e=>{this.sublayerCaches.get(e)?.forEach(((t,n)=>{i.has(n)&&this.sublayerCaches.get(e)?.delete(n)}))}))}async retrieveDataFromService(e,t,n){const o=h.getInstance(),r=new Set,a=[];let f,b="",T=[];const I="relationship"===t.graphType,D=this.inclusionModeDefinition?.namedTypeDefinitions?.get(t.objectType.name)?.useAllData,E=t.parentCompositeLayer.sublayerIdsCache.get(t.objectType.name);let M=!D&&E?Array.from(E).sort():null;if(this.inclusionModeDefinition?.namedTypeDefinitions?.get(t.objectType.name)?.useAllData)this.inclusionModeDefinition?.namedTypeDefinitions?.get(t.objectType.name)?.useAllData&&null!=e.objectIds&&(M=e.objectIds);else if(null!=e.objectIds&&M&&M.length>0){const t=e.objectIds;e.objectIds=M.filter((e=>t.includes(e)))}else if(null!=e.objectIds)M=e.objectIds;else{if(this.inclusionModeDefinition?.namedTypeDefinitions.has(t.objectType.name)&&(!this.inclusionModeDefinition.namedTypeDefinitions.get(t.objectType.name)?.members||this.inclusionModeDefinition.namedTypeDefinitions.get(t.objectType.name)?.members?.size<1))return e.objectIds=[],[];e.objectIds=M}if(null!=e.outFields){const i=e.outFields;i.includes("*")?t.fields.forEach((e=>{r.add(e.name)})):i.forEach((e=>{e!==w&&e!==t.geometryFieldName&&r.add(e)}))}if(null!=e.geometry){const n=e.geometry;let o;const h=t.parentCompositeLayer.dataManager.knowledgeGraph.serviceDefinition,y=h?.spatialReference,w=h?.serviceCapabilities?.geometryCapabilities;let T=w?.geometryMaxBoundingRectangleSizeX,D=w?.geometryMaxBoundingRectangleSizeY;if(n?.extent?.spatialReference&&!n.spatialReference?.isWGS84?(await p(n.extent.spatialReference,m),o=l(n.extent,m)):o=n.extent,T&&D&&y){if(4326!==y.wkid){const e=new g({spatialReference:y,xmax:T,ymax:D}),t=l(e,m);T=t.xmax,D=t.ymax}if(o.xmax-o.xmin>T)throw new i("knowledge-graph:layer-data-manager",`Extent x bounds should be within ${T}° latitude, limit exceeded`);if(o.ymax-o.ymin>D)throw new i("knowledge-graph:layer-data-manager",`Extent y bounds should be within ${D}° longitude, limit exceeded`)}if(null!=e.where&&"1=1"!==e.where){const i=await s(e.where.toUpperCase(),t.fieldsIndex);t.fields.forEach((e=>{i.fieldNames.includes(e.name)&&r.add(e.name)}))}b=I?`Match ()-[n:${t.objectType.name}]->() WHERE esri.graph.ST_Intersects($param_filter_geom, n.${t.geometryFieldName}) return ID(n), id(startNode(r)), id(endNode(r))`:`Match (n:${t.objectType.name}) WHERE esri.graph.ST_Intersects($param_filter_geom, n.${t.geometryFieldName}) return ID(n)`,t.geometryFieldName&&r.add(t.geometryFieldName),r.forEach((e=>{b+=`, n.${e}`,a.push(e)})),f=new u({openCypherQuery:b,bindParameters:{param_filter_geom:new d({rings:c(o)})}})}else{let i="";if(null!=e.where&&"1=1"!==e.where){const n=await s(e.where,t.fieldsIndex);t.fields.forEach((e=>{n.fieldNames.includes(e.name)&&r.add(e.name)}));const o=new Set(["column-reference","string","number","binary-expression"]),a=new Set(["=","<","<=","<>",">",">=","AND","OR","LIKE"]);let d=!1;const p=e=>{if("column-reference"===e.type)return`n.${e.column}`;if("string"===e.type)return`'${e.value}'`;if("number"===e.type)return`${e.value}`;if("binary-expression"===e.type&&o.has(e.left.type)&&o.has(e.right.type)&&a.has(e.operator))return`${p(e.left)} ${e.operator} ${p(e.right)}`;if("binary-expression"===e.type&&"LIKE"===e.operator){let t="";if("function"===e.left.type&&"column-reference"===e.left.args.value[0].type)t+=`lower(n.${e.left.args.value[0].column})`;else{if("column-reference"!==e.left.type)return d=!0,"";t+=`lower(n.${e.left.column})`}if(t+=" CONTAINS (","string"!==e.right.type)return d=!0,"";{let i=e.right.value;"%"===i.charAt(0)&&(i=i.slice(1)),"%"===i.charAt(i.length-1)&&(i=i.slice(0,-1)),t+=`'${i.toLowerCase()}')`}return t}return d=!0,""};i=p(n.parseTree),d&&(i="")}let n="";n=I?`Match ()-[n:${t.objectType.name}]->()`:`Match (n:${t.objectType.name})`;let o=!1;M&&(o=!0,n+=" WHERE ID(n) IN $ids"),i&&(n+=o?" AND":" WHERE",n+=` ${i}`),n+=" return ID(n)",I&&(n+=", id(startNode(n)), id(endNode(n))"),e.returnGeometry&&t.geometryFieldName&&r.add(t.geometryFieldName),r.forEach((e=>{n+=`, n.${e}`,a.push(e)})),f=new u(M?{openCypherQuery:n,bindParameters:{ids:M}}:{openCypherQuery:n})}const k=(await y(t.parentCompositeLayer.dataManager.knowledgeGraph,f,n)).resultRowsStream.getReader();for(;;){const{done:e,value:i}=await k.read();if(e)break;const n=[];for(let t=0;t<i.length;t++){const e=i[t];let o=0,s=0;const r={properties:{}};for(r.id=e[o],o++,s++,I&&(r.originId=e[o],o++,s++,r.destinationId=e[o],o++,s++);o<e.length;o++)r.properties[a[o-s]]=e[o];n.push(r)}T=T.concat(o.writeToStore(n,w,t.parentCompositeLayer.dataManager.geographicLookup.get(t.objectType.name)?.name))}return T}};e([r()],E.prototype,"knowledgeGraph",void 0),e([r()],E.prototype,"inclusionModeDefinition",void 0),e([r()],E.prototype,"entityTypeNames",void 0),e([r()],E.prototype,"relationshipTypeNames",void 0),e([r()],E.prototype,"geographicLookup",void 0),e([r()],E.prototype,"sublayerCaches",void 0),e([r()],E.prototype,"nodeConnectionsLookup",void 0),e([r()],E.prototype,"relationshipConnectionsLookup",void 0),e([r()],E.prototype,"memberIdTypeLookup",void 0),E=e([a("esri.layers.knowledgeGraph.KnowledgeGraphLayerDataManager")],E);export{E as KnowledgeGraphLayerDataManager,D as mockAggregationCountFieldName,T as mockDestinationIdFieldName,I as mockLayoutGeometryFieldName,w as mockOidFieldName,b as mockOriginIdFieldName};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.31/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../chunks/tslib.es6.js";import r from"../../TimeExtent.js";import t from"../../core/Error.js";import{isBlobProtocol as i}from"../../core/urlUtils.js";import{property as o}from"../../core/accessorSupport/decorators/property.js";import{Integer as s,Null as n}from"../../core/accessorSupport/ensureType.js";import"../../core/RandomLCG.js";import"../../core/has.js";import{reader as a}from"../../core/accessorSupport/decorators/reader.js";import{subclass as p}from"../../core/accessorSupport/decorators/subclass.js";import{writer as l}from"../../core/accessorSupport/decorators/writer.js";import{excludeTables as y}from"../../core/accessorSupport/layerContainerType.js";import{readLoadable as m}from"../../core/accessorSupport/read.js";import{willPropertyWrite as c}from"../../core/accessorSupport/write.js";import{supportedTypes as d}from"./operationalLayers.js";import{listMode as u,opacity as w}from"../support/commonProperties.js";const b=b=>{let T=class extends b{constructor(){super(...arguments),this.persistenceEnabled=!0,this.title=null}readId(e,r,t){return"Group Layer"===t?.portalItem?.type?void 0:e}writeListMode(e,r,t,i){(i&&"ground"===i.layerContainerType||e&&c(this,t,{},i))&&(r[t]=e)}writeOperationalLayerType(e,r,t,i){e&&"tables"!==i?.layerContainerType&&(r.layerType=e)}writeTitle(e,r){r.title=e??"Layer"}readTimeExtent(e){return e?r.fromArray(e):null}writeTimeExtent(e,r,i,o){e&&"tables"!==o.layerContainerType&&(e.isEmpty?o?.messages&&o.messages.push(new t("layer:invalid-visibilityTimeExtent","visibilityTimeExtent cannot be empty")):r[i]=e.toArray())}read(e,r){r&&(r.layer=this),m(this,e,(r=>super.read(e,r)),r)}write(e,r){if(!this.persistenceEnabled)return null;if(r?.origin){const e=`${r.origin}/${r.layerContainerType||"operational-layers"}`,i=d[e];let o=!!i?.[this.operationalLayerType];if("ArcGISTiledElevationServiceLayer"===this.operationalLayerType&&"web-scene/operational-layers"===e&&(o=!1),"ArcGISDimensionLayer"===this.operationalLayerType&&"web-map/operational-layers"===e&&(o=!1),!o)return r.messages?.push(new t("layer:unsupported",`Layers (${this.title}, ${this.id}) of type '${this.declaredClass}' are not supported in the context of '${e}'`,{layer:this})),null}const o=super.write(e,{...r,layer:this}),s=!!r&&!!r.messages&&!!r.messages.filter((e=>e instanceof t&&"web-document-write:property-required"===e.name)).length;return i(o?.url)?(r?.messages?.push(new t("layer:invalid-url",`Layer (${this.title}, ${this.id}) of type '${this.declaredClass}' using a Blob URL cannot be written to web scenes and web maps`,{layer:this})),null):!this.url&&s?null:o}beforeSave(){}};return e([o({type:String,json:{write:{ignoreOrigin:!0},origins:{"web-scene":{write:{isRequired:!0,ignoreOrigin:!0}},"portal-item":{write:!1}}}})],T.prototype,"id",void 0),e([a("id",["id"])],T.prototype,"readId",null),e([o(u)],T.prototype,"listMode",void 0),e([l("listMode")],T.prototype,"writeListMode",null),e([o({type:String,readOnly:!0,json:{read:!1,write:{target:"layerType",ignoreOrigin:!0},origins:{"portal-item":{write:!1},"web-scene":{name:"layerType",read:!1,write:{enabled:!0,ignoreOrigin:!0,layerContainerTypes:y}}}}})],T.prototype,"operationalLayerType",void 0),e([l("operationalLayerType")],T.prototype,"writeOperationalLayerType",null),e([o(w)],T.prototype,"opacity",void 0),e([o({type:Boolean,readOnly:!1})],T.prototype,"persistenceEnabled",void 0),e([o({type:String,json:{write:{ignoreOrigin:!0,writerEnsuresNonNull:!0},origins:{"web-scene":{write:{isRequired:!0,ignoreOrigin:!0,writerEnsuresNonNull:!0}},"portal-item":{write:!1}}},value:"Layer"})],T.prototype,"title",void 0),e([l("title"),l(["web-scene"],"title")],T.prototype,"writeTitle",null),e([o({type:r,json:{origins:{"web-scene":{write:{layerContainerTypes:y}}}}})],T.prototype,"visibilityTimeExtent",void 0),e([a("visibilityTimeExtent")],T.prototype,"readTimeExtent",null),e([l(["portal-item","web-map","web-scene"],"visibilityTimeExtent",{visibilityTimeExtent:{type:[[s,n]]}})],T.prototype,"writeTimeExtent",null),e([o({type:Boolean,json:{origins:{"web-scene":{name:"visibility",write:{enabled:!0,layerContainerTypes:y}}},name:"visibility",write:!0}})],T.prototype,"visible",void 0),T=e([p("esri.layers.mixins.OperationalLayer")],T),T};function T(e){return"operationalLayerType"in e}export{b as OperationalLayer,T as isOperationalLayer};
5
+ import{_ as e}from"../../chunks/tslib.es6.js";import r from"../../TimeExtent.js";import t from"../../core/Error.js";import{isBlobProtocol as i}from"../../core/urlUtils.js";import{property as o}from"../../core/accessorSupport/decorators/property.js";import{Integer as s,Null as n}from"../../core/accessorSupport/ensureType.js";import"../../core/RandomLCG.js";import"../../core/has.js";import{reader as a}from"../../core/accessorSupport/decorators/reader.js";import{subclass as p}from"../../core/accessorSupport/decorators/subclass.js";import{writer as l}from"../../core/accessorSupport/decorators/writer.js";import{excludeTables as y}from"../../core/accessorSupport/layerContainerType.js";import{readLoadable as m}from"../../core/accessorSupport/read.js";import{willPropertyWrite as c}from"../../core/accessorSupport/write.js";import{supportedTypes as d}from"./operationalLayers.js";import{listMode as u,opacity as w}from"../support/commonProperties.js";const b=b=>{let T=class extends b{constructor(){super(...arguments),this.persistenceEnabled=!0,this.title=null}readId(e,r,t){return"Group Layer"===t?.portalItem?.type?void 0:e}writeListMode(e,r,t,i){(i&&"ground"===i.layerContainerType||e&&c(this,t,{},i))&&(r[t]=e)}writeOperationalLayerType(e,r,t,i){e&&"tables"!==i?.layerContainerType&&(r.layerType=e)}writeTitle(e,r){r.title=e??"Layer"}readTimeExtent(e){return e?r.fromArray(e):null}writeTimeExtent(e,r,i,o){e&&"tables"!==o.layerContainerType&&(e.isEmpty?o?.messages&&o.messages.push(new t("layer:invalid-visibilityTimeExtent","visibilityTimeExtent cannot be empty")):r[i]=e.toArray())}read(e,r){r&&(r.layer=this),m(this,e,(r=>super.read(e,r)),r)}write(e,r){if(!this.persistenceEnabled&&!r?.ignorePersistenceEnabled)return null;if(r?.origin){const e=`${r.origin}/${r.layerContainerType||"operational-layers"}`,i=d[e];let o=!!i?.[this.operationalLayerType];if("ArcGISTiledElevationServiceLayer"===this.operationalLayerType&&"web-scene/operational-layers"===e&&(o=!1),"ArcGISDimensionLayer"===this.operationalLayerType&&"web-map/operational-layers"===e&&(o=!1),!o)return r.messages?.push(new t("layer:unsupported",`Layers (${this.title}, ${this.id}) of type '${this.declaredClass}' are not supported in the context of '${e}'`,{layer:this})),null}const o=super.write(e,{...r,layer:this}),s=!!r&&!!r.messages&&!!r.messages.filter((e=>e instanceof t&&"web-document-write:property-required"===e.name)).length;return i(o?.url)?(r?.messages?.push(new t("layer:invalid-url",`Layer (${this.title}, ${this.id}) of type '${this.declaredClass}' using a Blob URL cannot be written to web scenes and web maps`,{layer:this})),null):!this.url&&s?null:o}beforeSave(){}};return e([o({type:String,json:{write:{ignoreOrigin:!0},origins:{"web-scene":{write:{isRequired:!0,ignoreOrigin:!0}},"portal-item":{write:!1}}}})],T.prototype,"id",void 0),e([a("id",["id"])],T.prototype,"readId",null),e([o(u)],T.prototype,"listMode",void 0),e([l("listMode")],T.prototype,"writeListMode",null),e([o({type:String,readOnly:!0,json:{read:!1,write:{target:"layerType",ignoreOrigin:!0},origins:{"portal-item":{write:!1},"web-scene":{name:"layerType",read:!1,write:{enabled:!0,ignoreOrigin:!0,layerContainerTypes:y}}}}})],T.prototype,"operationalLayerType",void 0),e([l("operationalLayerType")],T.prototype,"writeOperationalLayerType",null),e([o(w)],T.prototype,"opacity",void 0),e([o({type:Boolean,readOnly:!1})],T.prototype,"persistenceEnabled",void 0),e([o({type:String,json:{write:{ignoreOrigin:!0,writerEnsuresNonNull:!0},origins:{"web-scene":{write:{isRequired:!0,ignoreOrigin:!0,writerEnsuresNonNull:!0}},"portal-item":{write:!1}}},value:"Layer"})],T.prototype,"title",void 0),e([l("title"),l(["web-scene"],"title")],T.prototype,"writeTitle",null),e([o({type:r,json:{origins:{"web-scene":{write:{layerContainerTypes:y}}}}})],T.prototype,"visibilityTimeExtent",void 0),e([a("visibilityTimeExtent")],T.prototype,"readTimeExtent",null),e([l(["portal-item","web-map","web-scene"],"visibilityTimeExtent",{visibilityTimeExtent:{type:[[s,n]]}})],T.prototype,"writeTimeExtent",null),e([o({type:Boolean,json:{origins:{"web-scene":{name:"visibility",write:{enabled:!0,layerContainerTypes:y}}},name:"visibility",write:!0}})],T.prototype,"visible",void 0),T=e([p("esri.layers.mixins.OperationalLayer")],T),T};function T(e){return"operationalLayerType"in e}export{b as OperationalLayer,T as isOperationalLayer};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.31/esri/copyright.txt for details.
4
4
  */
5
- import{getEffectiveLayerCapabilities as t,getEffectiveEditingEnabled as e}from"./layerUtils.js";function i(i){return!(!(i&&"object"==typeof i&&"loaded"in i&&i.loaded&&t(i)?.operations?.supportsEditing&&"type"in i)||"editingEnabled"in i&&!e(i))}export{i as isEditableLayer};
5
+ import{isLayerFromCatalog as t}from"../catalog/catalogUtils.js";import{getEffectiveLayerCapabilities as o,getEffectiveEditingEnabled as i}from"./layerUtils.js";function n(t){return"object"==typeof t&&null!=t&&"loaded"in t&&!0===t.loaded&&"type"in t}function e(e){return!(!n(e)||!o(e)?.operations?.supportsEditing||"editingEnabled"in e&&!i(e)||t(e))}export{e as isEditableLayer};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arcgis/core",
3
- "version": "4.31.0-next.20240521",
3
+ "version": "4.31.0-next.20240523",
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": [
@@ -27,7 +27,7 @@
27
27
  "dependencies": {
28
28
  "@esri/arcgis-html-sanitizer": "~4.0.0",
29
29
  "@esri/calcite-colors": "~6.1.0",
30
- "@esri/calcite-components": "^2.8.1",
30
+ "@esri/calcite-components": "^2.8.3",
31
31
  "@vaadin/grid": "~24.3.13",
32
32
  "@zip.js/zip.js": "~2.7.44",
33
33
  "luxon": "~3.4.4",
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.31/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../chunks/tslib.es6.js";import{getAssetUrl as t}from"../assets.js";import i from"../core/Error.js";import{JSONSupportMixin as r}from"../core/JSONSupport.js";import{clone as o,fixJson as s}from"../core/lang.js";import a from"../core/Loadable.js";import{isDataProtocol as n,makeAbsolute as l}from"../core/urlUtils.js";import{property as p}from"../core/accessorSupport/decorators/property.js";import{ensureClass as c}from"../core/accessorSupport/ensureType.js";import{reader as d}from"../core/accessorSupport/decorators/reader.js";import{subclass as u}from"../core/accessorSupport/decorators/subclass.js";import m from"../geometry/Extent.js";import h from"./Portal.js";import g from"./PortalItemResource.js";import y from"./PortalRating.js";import{a as v}from"../chunks/persistableUrlUtils.js";var w;const f=new Set(["3DTiles Service","CSV","Feature Collection","Feature Service","Feed","GeoJson","Group Layer","Image Service","KML","Map Service","Media Layer","Scene Service","Stream Service","Vector Tile Service","WFS","WMS","WMTS"]),b=new Set(["KML","GeoJson","CSV"]);let k=w=class extends(r(a)){static from(e){return c(w,e)}constructor(e){super(e),this.access=null,this.accessInformation=null,this.apiKey=null,this.applicationProxies=null,this.avgRating=null,this.categories=null,this.created=null,this.culture=null,this.description=null,this.extent=null,this.groupCategories=null,this.id=null,this.isOrgItem=!1,this.itemControl=null,this.licenseInfo=null,this.modified=null,this.name=null,this.numComments=null,this.numRatings=null,this.numViews=null,this.owner=null,this.ownerFolder=null,this.portal=null,this.screenshots=null,this.size=null,this.snippet=null,this.sourceJSON=null,this.sourceUrl=null,this.spatialReference=null,this.tags=null,this.title=null,this.type=null,this.typeKeywords=null,this.url=null}destroy(){this.portal=null}get displayName(){const e=this.type,t=this.typeKeywords||[];let i=e;return"Feature Service"===e||"Feature Collection"===e?i=t.includes("Table")?"Table":t.includes("Route Layer")?"Route Layer":t.includes("Markup")?"Markup":"Feature Layer":"Image Service"===e?i=t.includes("Elevation 3D Layer")?"Elevation Layer":t.includes("Tiled Imagery")?"Tiled Imagery Layer":"Imagery Layer":"Scene Service"===e?i="Scene Layer":"Video Service"===e?i="Video Layer":"Scene Package"===e?i="Scene Layer Package":"Stream Service"===e?i="Feature Layer":"Geoprocessing Service"===e?i=t.includes("Web Tool")?"Tool":"Geoprocessing Service":"Geoenrichment Service"===e?i="GeoEnrichment Service":"Geocoding Service"===e?i="Locator":"Microsoft Powerpoint"===e?i="Microsoft PowerPoint":"GeoJson"===e?i="GeoJSON":"Globe Service"===e?i="Globe Layer":"Vector Tile Service"===e?i="Tile Layer":"netCDF"===e?i="NetCDF":"Map Service"===e?i=t.includes("Spatiotemporal")||!t.includes("Hosted Service")&&!t.includes("Tiled")||t.includes("Relational")?"Map Image Layer":"Tile Layer":e?.toLowerCase().includes("add in")?i=e.replaceAll(/(add in)/gi,"Add-In"):"datastore catalog service"===e?i="Big Data File Share":"Compact Tile Package"===e?i="Tile Package (tpkx)":"Raster function template"===e?i="Raster Function Template":"OGCFeatureServer"===e?i="OGC Feature Layer":"web mapping application"===e&&t.includes("configurableApp")?i="Instant App":"Insights Page"===e?i="Insights Report":"Excalibur Imagery Project"===e?i="Excalibur Project":"3DTiles Service"===e?i="3D tiles layer":"3DTiles Package"===e&&(i="3D tiles package"),i}readExtent(e){return e&&e.length?new m(e[0][0],e[0][1],e[1][0],e[1][1]):null}get iconUrl(){const e=this.type?.toLowerCase()||"",i=this.typeKeywords||[],r="esri/images/portal/",o="16";let s,a=!1,n=!1,l=!1,p=!1,c=!1,d=!1,u=!1,m=!1;return e.indexOf("service")>0||"feature collection"===e||"kml"===e||"wms"===e||"wmts"===e||"wfs"===e?(a=i.includes("Hosted Service"),"feature service"===e||"feature collection"===e||"kml"===e||"wfs"===e?(n=i.includes("Table"),l=i.includes("Route Layer"),p=i.includes("Markup"),c=i.includes("Spatiotemporal"),d=i.includes("UtilityNetwork"),s=c&&n?"spatiotemporaltable":n?"table":l?"routelayer":p?"markup":c?"spatiotemporal":d?"utilitynetwork":a?"featureshosted":"features"):"map service"===e||"wms"===e||"wmts"===e?(c=i.includes("Spatiotemporal"),u=i.includes("Relational"),s=c||u?"mapimages":a||i.includes("Tiled")||"wmts"===e?"maptiles":"mapimages"):s="scene service"===e?i.includes("Line")?"sceneweblayerline":i.includes("3DObject")?"sceneweblayermultipatch":i.includes("Point")?"sceneweblayerpoint":i.includes("IntegratedMesh")?"sceneweblayermesh":i.includes("PointCloud")?"sceneweblayerpointcloud":i.includes("Polygon")?"sceneweblayerpolygon":i.includes("Building")?"sceneweblayerbuilding":i.includes("Voxel")?"sceneweblayervoxel":"sceneweblayer":"image service"===e?i.includes("Elevation 3D Layer")?"elevationlayer":i.includes("Tiled Imagery")?"tiledimagerylayer":"imagery":"stream service"===e?"streamlayer":"vector tile service"===e?"vectortile":"datastore catalog service"===e?"datastorecollection":"geocoding service"===e?"geocodeservice":"video service"===e?i.includes("Live Stream")?"livestreamvideolayer":"videolayer":"geoprocessing service"===e?i.includes("Web Tool")?"tool":"layers":"geodata service"===e?"geodataservice":"3dtiles service"===e?i.includes("3DObject")?"3dobjecttileslayer":i.includes("IntegratedMesh")?"integratedmeshtileslayer":"3dtileslayer":"layers"):"web map"===e||"cityengine web scene"===e?s="maps":"web scene"===e?s=i.includes("ViewingMode-Local")?"webscenelocal":"websceneglobal":"web mapping application"===e&&i.includes("configurableApp")?s="instantapps":"web mapping application"===e||"mobile application"===e||"application"===e||"operation view"===e||"desktop application"===e?s="apps":"map document"===e||"map package"===e||"published map"===e||"scene document"===e||"globe document"===e||"basemap package"===e||"mobile basemap package"===e||"mobile map package"===e||"project package"===e||"project template"===e||"pro map"===e||"layout"===e||"layer"===e&&i.includes("ArcGIS Pro")||"explorer map"===e&&i.indexOf("Explorer Document")?s="mapsgray":"service definition"===e||"shapefile"===e||"cad drawing"===e||"geojson"===e||"netcdf"===e||"administrative report"===e?s="datafiles":"360 vr experience"===e?s="360vr":"explorer add in"===e||"desktop add in"===e||"windows viewer add in"===e||"windows viewer configuration"===e?s="appsgray":"arcgis pro add in"===e||"arcgis pro configuration"===e?s="addindesktop":"pdf"===e?s="pdf":"microsoft word"===e?s="word":"microsoft excel"===e?s="excel":"microsoft powerpoint"===e?s="ppt":"rule package"===e||"file geodatabase"===e||"sqlite geodatabase"===e||"csv collection"===e||"kml collection"===e||"windows mobile package"===e||"map template"===e||"desktop application template"===e||"gml"===e||"arcpad package"===e||"code sample"===e||"document link"===e||"earth configuration"===e||"operations dashboard add in"===e||"rules package"===e||"workflow manager package"===e||"explorer map"===e&&i.includes("Explorer Mapping Application")||i.includes("Document")?s="datafilesgray":"network analysis service"===e||"geoprocessing service"===e||"geodata service"===e||"geometry service"===e||"geoprocessing package"===e||"locator package"===e||"geoprocessing sample"===e||"workflow manager service"===e?s="toolsgray":"layer"===e||"layer package"===e||"explorer layer"===e?s="layersgray":"analysis model"===e?s="analysismodel":"scene package"===e?s="scenepackage":"3dtiles package"===e?s="3dtileslayerpackage":"3dtiles service"===e?s="3dtileslayer":"mobile scene package"===e?s="mobilescenepackage":"tile package"===e||"compact tile package"===e?s="tilepackage":"task file"===e?s="taskfile":"report template"===e?s="report-template":"statistical data collection"===e?s="statisticaldatacollection":"insights workbook"===e?s="workbook":"insights model"===e?s="insightsmodel":"insights page"===e?s="insightspage":"insights theme"===e?s="insightstheme":"hub initiative"===e?s="hubinitiative":"hub page"===e?s="hubpage":"hub site application"===e?s="hubsite":"hub event"===e?s="hubevent":"hub project"===e?s="hubproject":"relational database connection"===e?s="relationaldatabaseconnection":"big data file share"===e?s="datastorecollection":"image collection"===e?s="imagecollection":"desktop style"===e?s="desktopstyle":"style"===e?s=i.includes("Dictionary")?"dictionarystyle":"style":"dashboard"===e?s="dashboard":"raster function template"===e?s="rasterprocessingtemplate":"vector tile package"===e?s="vectortilepackage":"ortho mapping project"===e?s="orthomappingproject":"ortho mapping template"===e?s="orthomappingtemplate":"solution"===e?s="solutions":"geopackage"===e?s="geopackage":"deep learning package"===e?s="deeplearningpackage":"real time analytic"===e?s="realtimeanalytics":"big data analytic"===e?s="bigdataanalytics":"feed"===e?s="feed":"excalibur imagery project"===e?s="excaliburimageryproject":"notebook"===e?s="notebook":"storymap"===e?s="storymap":"survey123 add in"===e?s="survey123addin":"mission"===e?s="mission":"mission report"===e?s="missionreport":"mission template"===e?s="missiontemplate":"quickcapture project"===e?s="quickcaptureproject":"pro report"===e?s="proreport":"pro report template"===e?s="proreporttemplate":"urban model"===e?s="urbanmodel":"web experience"===e?s="experiencebuilder":"web experience template"===e?s="webexperiencetemplate":"experience builder widget"===e?s="experiencebuilderwidget":"experience builder widget package"===e?s="experiencebuilderwidgetpackage":"workflow"===e?s="workflow":"kernel gateway connection"===e?s="kernelgatewayconnection":"insights script"===e?s="insightsscript":"hub initiative template"===e?s="hubinitiativetemplate":"storymap theme"===e?s="storymaptheme":"knowledge graph"===e?s="knowledgegraph":"knowledge studio project"===e?s="knowledgestudio":"native application"===e?s="nativeapp":"native application installer"===e?s="nativeappinstaller":"web link chart"===e?s="linkchart":"knowledge graph web investigation"===e?s="investigation":"ogcfeatureserver"===e?s="features":"pro project"===e?s="proproject":"insights workbook package"===e?s="insightsworkbookpackage":"apache parquet"===e?s="apacheparquet":"notebook code snippet library"===e?s="notebookcodesnippets":"suitability model"===e?s="suitabilitymodel":"esri classifier definition"===e?s="classifierdefinition":"esri classification schema"===e?s="classificationschema":"insights data engineering workbook"===e?s="dataengineeringworkbook":"insights data engineering model"===e?s="dataengineeringmodel":"deep learning studio project"===e?s="deeplearningproject":"discussion"===e?s="discussion":"allsource project"===e?s="allsourceproject":"api key"===e?s="apikey":"data pipeline"===e?s="datapipelines":"group layer"===e?(m=i.includes("Map"),s=m?"layergroup2d":"layergroup"):s="media layer"===e?"onlinemedialayer":"form"===e?i.includes("Survey123")?"survey":"datafilesgray":"csv"===e?"csv":"image"===e?"image":"maps",s?t(r+s+o+".png"):null}get isLayer(){return null!=this.type&&f.has(this.type)}get itemCdnUrl(){return v(this.itemUrl)}get itemPageUrl(){const e=this.portal?.itemPageUrl;return e&&this.id?`${e}?id=${this.id}`:null}get itemUrl(){const e=this.portal?.restUrl;return e&&this.id?`${e}/content/items/${this.id}`:null}get thumbnailUrl(){const e=this.itemUrl,t=this.thumbnail;return e&&t?this.portal?.normalizeUrl(`${e}/info/${t}?f=json`)??null:null}get userItemUrl(){const e=this.portal?.restUrl;if(!e)return null;const t=this.owner||this.portal?.user?.username;if(!t)return null;return`${e}/content/users/${this.ownerFolder?`${t}/${this.ownerFolder}`:t}/items/${this.id}`}load(e){const t=this.portal??(this.portal=h.getDefault()),i=t.load(e).then((()=>this.sourceJSON?this.sourceJSON:this.id&&this.itemUrl?t.request(this.itemUrl,{signal:null!=e?e.signal:null,query:{token:this.apiKey}}):{})).then((e=>{this.sourceJSON=e,this.read(e)}));return this.addResolvingPromise(i),Promise.resolve(this)}async addRating(e){const t={method:"post",query:{}};return e instanceof y&&(e=e.rating),null==e||isNaN(e)||"number"!=typeof e||(t.query.rating=e),this.portal?(await this.portal.request(this.itemUrl+"/addRating",t),new y({rating:e,created:new Date})):null}clone(){const e={access:this.access,accessInformation:this.accessInformation,applicationProxies:o(this.applicationProxies),avgRating:this.avgRating,categories:o(this.categories),created:o(this.created),culture:this.culture,description:this.description,extent:o(this.extent),groupCategories:o(this.groupCategories),id:this.id,itemControl:this.itemControl,licenseInfo:this.licenseInfo,modified:o(this.modified),name:this.name,numComments:this.numComments,numRatings:this.numRatings,numViews:this.numViews,owner:this.owner,ownerFolder:this.ownerFolder,portal:this.portal,screenshots:o(this.screenshots),size:this.size,snippet:this.snippet,sourceUrl:this.sourceUrl,spatialReference:this.spatialReference,tags:o(this.tags),thumbnail:this.thumbnail,title:this.title,type:this.type,typeKeywords:o(this.typeKeywords),url:this.url};this.loaded&&(e.loadStatus="loaded");const t=new w({sourceJSON:this.sourceJSON}).set(e);return t._set("isOrgItem",this.isOrgItem),t}createPostQuery(){const e=this.toJSON();for(const i of["tags","typeKeywords","categories"])e[i]=e[i]?.join(", ");const{extent:t}=e;return t&&(e.extent=JSON.stringify(t)),e}async deleteRating(){await this.portal.request(this.itemUrl+"/deleteRating",{method:"post"})}fetchData(e="json",t){return this.portal.request(this.itemUrl+"/data",{responseType:e,...t,query:{token:this.apiKey}})}async fetchRating(e){const t=await this.portal.request(this.itemUrl+"/rating",{query:{token:this.apiKey},...e});return null!=t.rating?(t.created=new Date(t.created),new y(t)):null}fetchRelatedItems(e,t){return this.portal.requestToTypedArray(this.itemUrl+"/relatedItems",{query:{...e,token:this.apiKey},...t},w)}getThumbnailUrl(e){let t=this.thumbnailUrl;return t&&e&&(t+=`&w=${e}`),t}reload(){return this.portal.request(this.itemUrl??"",{cacheBust:!0,query:{token:this.apiKey}}).then((e=>(this.sourceJSON=e,this.read(e),this)))}update(e){return this.id?this.load().then((()=>this.portal.signIn())).then((()=>{const t=e?.data,i={method:"post"};i.query=this.createPostQuery();for(const e in i.query)null===i.query[e]&&(i.query[e]="");return i.query.clearEmptyFields=!0,null!=t&&("string"==typeof t?i.query.text=t:"object"==typeof t&&(i.query.text=JSON.stringify(t))),this.portal.request(`${this.userItemUrl}/update`,i).then((()=>this.reload()))})):Promise.reject(new i("portal:item-does-not-exist","The item does not exist yet and cannot be updated"))}async copy(e){if(!this.id)throw new i("portal:item-does-not-exist","The item does not exist yet");await this.load();const{portal:t,itemUrl:r}=this;await t.signIn();const{copyResources:o,folder:s,tags:a,title:n}=e||{},l={method:"post",query:{copyPrivateResources:"all"===o,folder:"string"==typeof s?s:s?.id,includeResources:!!o,tags:a?.join(","),title:n}},{itemId:p}=await t.request(`${r}/copy`,l);return new w({id:p,portal:t})}updateThumbnail(e){return this.id?this.load().then((()=>this.portal.signIn())).then((()=>{const t=e.thumbnail,i=e.filename,r={method:"post"};if("string"==typeof t)n(t)?r.query={data:t}:r.query={url:l(t)},null!=i&&(r.query.filename=i);else{const e=new FormData;null!=i?e.append("file",t,i):e.append("file",t),r.body=e}return this.portal.request(`${this.userItemUrl}/updateThumbnail`,r).then((()=>this.reload()))})):Promise.reject(new i("portal:item-does-not-exist","The item does not exist yet and cannot be updated"))}async fetchResources(e={},t){const{fetchResources:i}=await import("./support/resourceUtils.js");return i(this,e,t)}async addResource(e,t,i){const{addOrUpdateResources:r}=await import("./support/resourceUtils.js");return e.portalItem=this,await r(this,[{resource:e,content:t,compress:i?.compress,access:i?.access}],"add",i),e}async removeResource(e,t){const{removeResource:r}=await import("./support/resourceUtils.js");if(e.portalItem&&e.portalItem.itemUrl!==this.itemUrl)throw new i("removeresource:portal-item-mismatch","The portal item associated with the provided resource does not match the item");return r(this,e,t)}async removeAllResources(e){const{removeAllResources:t}=await import("./support/resourceUtils.js");return t(this,e)}resourceFromPath(e){return new g({portalItem:this,path:e})}toJSON(){const e=this.extent,t={accessInformation:this.accessInformation,categories:o(this.categories),created:this.created?.getTime(),description:this.description,extent:e&&[[e.xmin,e.ymin],[e.xmax,e.ymax]],id:this.id,isOrgItem:this.isOrgItem,licenseInfo:this.licenseInfo,modified:this.modified?.getTime(),name:this.name,owner:this.owner,ownerFolder:this.ownerFolder,snippet:this.snippet,sourceUrl:this.sourceUrl,spatialReference:this.spatialReference,tags:o(this.tags),thumbnail:this.thumbnail,title:this.title,type:this.type,typeKeywords:o(this.typeKeywords),url:this.url};return s(t)}static fromJSON(e){if(!e)return null;if(e.declaredClass)throw new Error("JSON object is already hydrated");return new w({sourceJSON:e})}_getPostQuery(){const e=this.toJSON();for(const t in e)"tags"===t&&null!==e[t]&&(e[t]=e[t].join(", ")),"typeKeywords"===t&&null!==e[t]&&(e[t]=e[t].join(", ")),"extent"===t&&e[t]&&(e[t]=JSON.stringify(e[t]));return e}};e([p({type:["private","shared","org","public"]})],k.prototype,"access",void 0),e([p()],k.prototype,"accessInformation",void 0),e([p({type:String})],k.prototype,"apiKey",void 0),e([p({json:{read:{source:"appProxies"}}})],k.prototype,"applicationProxies",void 0),e([p()],k.prototype,"avgRating",void 0),e([p()],k.prototype,"categories",void 0),e([p({type:Date})],k.prototype,"created",void 0),e([p()],k.prototype,"culture",void 0),e([p()],k.prototype,"description",void 0),e([p({readOnly:!0})],k.prototype,"displayName",null),e([p({type:m})],k.prototype,"extent",void 0),e([d("extent")],k.prototype,"readExtent",null),e([p()],k.prototype,"groupCategories",void 0),e([p({readOnly:!0})],k.prototype,"iconUrl",null),e([p()],k.prototype,"id",void 0),e([p({readOnly:!0})],k.prototype,"isLayer",null),e([p({type:Boolean,readOnly:!0})],k.prototype,"isOrgItem",void 0),e([p()],k.prototype,"itemControl",void 0),e([p({readOnly:!0})],k.prototype,"itemPageUrl",null),e([p({readOnly:!0})],k.prototype,"itemUrl",null),e([p()],k.prototype,"licenseInfo",void 0),e([p({type:Date})],k.prototype,"modified",void 0),e([p()],k.prototype,"name",void 0),e([p()],k.prototype,"numComments",void 0),e([p()],k.prototype,"numRatings",void 0),e([p()],k.prototype,"numViews",void 0),e([p()],k.prototype,"owner",void 0),e([p()],k.prototype,"ownerFolder",void 0),e([p({type:h})],k.prototype,"portal",void 0),e([p()],k.prototype,"screenshots",void 0),e([p()],k.prototype,"size",void 0),e([p()],k.prototype,"snippet",void 0),e([p()],k.prototype,"sourceJSON",void 0),e([p({type:String})],k.prototype,"sourceUrl",void 0),e([p({type:String})],k.prototype,"spatialReference",void 0),e([p()],k.prototype,"tags",void 0),e([p()],k.prototype,"thumbnail",void 0),e([p({readOnly:!0})],k.prototype,"thumbnailUrl",null),e([p()],k.prototype,"title",void 0),e([p()],k.prototype,"type",void 0),e([p()],k.prototype,"typeKeywords",void 0),e([p({type:String,json:{read(e,t){if(b.has(t.type)){const t=this.portal?.restUrl;e||=t&&this.id?`${t}/content/items/${this.id}/data`:null}return e}}})],k.prototype,"url",void 0),e([p({readOnly:!0})],k.prototype,"userItemUrl",null),k=w=e([u("esri.portal.PortalItem")],k);const S=k;export{S as default};
5
+ import{_ as e}from"../chunks/tslib.es6.js";import{getAssetUrl as t}from"../assets.js";import i from"../core/Error.js";import{JSONSupportMixin as r}from"../core/JSONSupport.js";import{clone as o,fixJson as s}from"../core/lang.js";import a from"../core/Loadable.js";import{isDataProtocol as n,makeAbsolute as l}from"../core/urlUtils.js";import{property as p}from"../core/accessorSupport/decorators/property.js";import{ensureClass as c}from"../core/accessorSupport/ensureType.js";import{reader as d}from"../core/accessorSupport/decorators/reader.js";import{subclass as u}from"../core/accessorSupport/decorators/subclass.js";import m from"../geometry/Extent.js";import h from"./Portal.js";import g from"./PortalItemResource.js";import y from"./PortalRating.js";import{a as w}from"../chunks/persistableUrlUtils.js";var v;const f=new Set(["3DTiles Service","CSV","Feature Collection","Feature Service","Feed","GeoJson","Group Layer","Image Service","KML","Map Service","Media Layer","Scene Service","Stream Service","Vector Tile Service","WFS","WMS","WMTS"]),b=new Set(["KML","GeoJson","CSV"]);let k=v=class extends(r(a)){static from(e){return c(v,e)}constructor(e){super(e),this.access=null,this.accessInformation=null,this.apiKey=null,this.applicationProxies=null,this.avgRating=null,this.categories=null,this.created=null,this.culture=null,this.description=null,this.extent=null,this.groupCategories=null,this.id=null,this.isOrgItem=!1,this.itemControl=null,this.licenseInfo=null,this.modified=null,this.name=null,this.numComments=null,this.numRatings=null,this.numViews=null,this.owner=null,this.ownerFolder=null,this.portal=null,this.screenshots=null,this.size=null,this.snippet=null,this.sourceJSON=null,this.sourceUrl=null,this.spatialReference=null,this.tags=null,this.title=null,this.type=null,this.typeKeywords=null,this.url=null}destroy(){this.portal=null}get displayName(){const e=this.type,t=this.typeKeywords||[];let i=e;return"Feature Service"===e||"Feature Collection"===e?i=t.includes("Table")?"Table":t.includes("Route Layer")?"Route Layer":t.includes("Markup")?"Markup":"Feature Layer":"Image Service"===e?i=t.includes("Elevation 3D Layer")?"Elevation Layer":t.includes("Tiled Imagery")?"Tiled Imagery Layer":"Imagery Layer":"Scene Service"===e?i="Scene Layer":"Video Service"===e?i="Video Layer":"Scene Package"===e?i="Scene Layer Package":"Stream Service"===e?i="Feature Layer":"Geoprocessing Service"===e?i=t.includes("Web Tool")?"Tool":"Geoprocessing Service":"Geoenrichment Service"===e?i="GeoEnrichment Service":"Geocoding Service"===e?i="Locator":"Microsoft Powerpoint"===e?i="Microsoft PowerPoint":"GeoJson"===e?i="GeoJSON":"Globe Service"===e?i="Globe Layer":"Vector Tile Service"===e?i="Tile Layer":"netCDF"===e?i="NetCDF":"Map Service"===e?i=t.includes("Spatiotemporal")||!t.includes("Hosted Service")&&!t.includes("Tiled")||t.includes("Relational")?"Map Image Layer":"Tile Layer":e?.toLowerCase().includes("add in")?i=e.replaceAll(/(add in)/gi,"Add-In"):"datastore catalog service"===e?i="Big Data File Share":"Compact Tile Package"===e?i="Tile Package (tpkx)":"Raster function template"===e?i="Raster Function Template":"OGCFeatureServer"===e?i="OGC Feature Layer":"web mapping application"===e&&t.includes("configurableApp")?i="Instant App":"Insights Page"===e?i="Insights Report":"Excalibur Imagery Project"===e?i="Excalibur Project":"3DTiles Service"===e?i="3D tiles layer":"3DTiles Package"===e&&(i="3D tiles package"),i}readExtent(e){return e&&e.length?new m(e[0][0],e[0][1],e[1][0],e[1][1]):null}get iconUrl(){const e=this.type?.toLowerCase()||"",i=this.typeKeywords||[],r="esri/images/portal/",o="16";let s,a=!1,n=!1,l=!1,p=!1,c=!1,d=!1,u=!1,m=!1;return e.indexOf("service")>0||"feature collection"===e||"kml"===e||"wms"===e||"wmts"===e||"wfs"===e?(a=i.includes("Hosted Service"),"feature service"===e||"feature collection"===e||"kml"===e||"wfs"===e?(n=i.includes("Table"),l=i.includes("Route Layer"),p=i.includes("Markup"),c=i.includes("Spatiotemporal"),d=i.includes("UtilityNetwork"),s=c&&n?"spatiotemporaltable":n?"table":l?"routelayer":p?"markup":c?"spatiotemporal":d?"utilitynetwork":a?"featureshosted":"features"):"map service"===e||"wms"===e||"wmts"===e?(c=i.includes("Spatiotemporal"),u=i.includes("Relational"),s=c||u?"mapimages":a||i.includes("Tiled")||"wmts"===e?"maptiles":"mapimages"):s="scene service"===e?i.includes("Line")?"sceneweblayerline":i.includes("3DObject")?"sceneweblayermultipatch":i.includes("Point")?"sceneweblayerpoint":i.includes("IntegratedMesh")?"sceneweblayermesh":i.includes("PointCloud")?"sceneweblayerpointcloud":i.includes("Polygon")?"sceneweblayerpolygon":i.includes("Building")?"sceneweblayerbuilding":i.includes("Voxel")?"sceneweblayervoxel":"sceneweblayer":"image service"===e?i.includes("Elevation 3D Layer")?"elevationlayer":i.includes("Tiled Imagery")?"tiledimagerylayer":"imagery":"stream service"===e?"streamlayer":"vector tile service"===e?"vectortile":"datastore catalog service"===e?"datastorecollection":"geocoding service"===e?"geocodeservice":"video service"===e?i.includes("Live Stream")?"livestreamvideolayer":"videolayer":"geoprocessing service"===e?i.includes("Web Tool")?"tool":"layers":"geodata service"===e?"geodataservice":"3dtiles service"===e?i.includes("3DObject")?"3dobjecttileslayer":i.includes("IntegratedMesh")?"integratedmeshtileslayer":"3dtileslayer":"layers"):"web map"===e||"cityengine web scene"===e?s="maps":"web scene"===e?s=i.includes("ViewingMode-Local")?"webscenelocal":"websceneglobal":"web mapping application"===e&&i.includes("configurableApp")?s="instantapps":"web mapping application"===e||"mobile application"===e||"application"===e||"operation view"===e||"desktop application"===e?s="apps":"map document"===e||"map package"===e||"published map"===e||"scene document"===e||"globe document"===e||"basemap package"===e||"mobile basemap package"===e||"mobile map package"===e||"project package"===e||"project template"===e||"pro map"===e||"layout"===e||"layer"===e&&i.includes("ArcGIS Pro")||"explorer map"===e&&i.indexOf("Explorer Document")?s="mapsgray":"service definition"===e||"shapefile"===e||"cad drawing"===e||"geojson"===e||"netcdf"===e||"administrative report"===e?s="datafiles":"360 vr experience"===e?s="360vr":"explorer add in"===e||"desktop add in"===e||"windows viewer add in"===e||"windows viewer configuration"===e?s="appsgray":"arcgis pro add in"===e||"arcgis pro configuration"===e?s="addindesktop":"pdf"===e?s="pdf":"microsoft word"===e?s="word":"microsoft excel"===e?s="excel":"microsoft powerpoint"===e?s="ppt":"rule package"===e||"file geodatabase"===e||"sqlite geodatabase"===e||"csv collection"===e||"kml collection"===e||"windows mobile package"===e||"map template"===e||"desktop application template"===e||"gml"===e||"arcpad package"===e||"code sample"===e||"document link"===e||"earth configuration"===e||"operations dashboard add in"===e||"rules package"===e||"workflow manager package"===e||"explorer map"===e&&i.includes("Explorer Mapping Application")||i.includes("Document")?s="datafilesgray":"network analysis service"===e||"geoprocessing service"===e||"geodata service"===e||"geometry service"===e||"geoprocessing package"===e||"locator package"===e||"geoprocessing sample"===e||"workflow manager service"===e?s="toolsgray":"layer"===e||"layer package"===e||"explorer layer"===e?s="layersgray":"analysis model"===e?s="analysismodel":"scene package"===e?s="scenepackage":"3dtiles package"===e?s="3dtileslayerpackage":"3dtiles service"===e?s="3dtileslayer":"mobile scene package"===e?s="mobilescenepackage":"tile package"===e||"compact tile package"===e?s="tilepackage":"task file"===e?s="taskfile":"report template"===e?s="report-template":"statistical data collection"===e?s="statisticaldatacollection":"insights workbook"===e?s="workbook":"insights model"===e?s="insightsmodel":"insights page"===e?s="insightspage":"insights theme"===e?s="insightstheme":"hub initiative"===e?s="hubinitiative":"hub page"===e?s="hubpage":"hub site application"===e?s="hubsite":"hub event"===e?s="hubevent":"hub project"===e?s="hubproject":"relational database connection"===e?s="relationaldatabaseconnection":"big data file share"===e?s="datastorecollection":"image collection"===e?s="imagecollection":"desktop style"===e?s="desktopstyle":"style"===e?s=i.includes("Dictionary")?"dictionarystyle":"style":"dashboard"===e?s="dashboard":"raster function template"===e?s="rasterprocessingtemplate":"vector tile package"===e?s="vectortilepackage":"ortho mapping project"===e?s="orthomappingproject":"ortho mapping template"===e?s="orthomappingtemplate":"solution"===e?s="solutions":"geopackage"===e?s="geopackage":"deep learning package"===e?s="deeplearningpackage":"real time analytic"===e?s="realtimeanalytics":"big data analytic"===e?s="bigdataanalytics":"feed"===e?s="feed":"excalibur imagery project"===e?s="excaliburimageryproject":"notebook"===e?s="notebook":"storymap"===e?s="storymap":"survey123 add in"===e?s="survey123addin":"mission"===e?s="mission":"mission report"===e?s="missionreport":"mission template"===e?s="missiontemplate":"quickcapture project"===e?s="quickcaptureproject":"pro report"===e?s="proreport":"pro report template"===e?s="proreporttemplate":"urban model"===e?s="urbanmodel":"web experience"===e?s="experiencebuilder":"web experience template"===e?s="webexperiencetemplate":"experience builder widget"===e?s="experiencebuilderwidget":"experience builder widget package"===e?s="experiencebuilderwidgetpackage":"workflow"===e?s="workflow":"kernel gateway connection"===e?s="kernelgatewayconnection":"insights script"===e?s="insightsscript":"hub initiative template"===e?s="hubinitiativetemplate":"storymap theme"===e?s="storymaptheme":"knowledge graph"===e?s="knowledgegraph":"knowledge graph layer"===e?s="knowledgegraphlayer":"knowledge studio project"===e?s="knowledgestudio":"native application"===e?s="nativeapp":"native application installer"===e?s="nativeappinstaller":"web link chart"===e?s="linkchart":"knowledge graph web investigation"===e?s="investigation":"ogcfeatureserver"===e?s="features":"pro project"===e?s="proproject":"insights workbook package"===e?s="insightsworkbookpackage":"apache parquet"===e?s="apacheparquet":"notebook code snippet library"===e?s="notebookcodesnippets":"suitability model"===e?s="suitabilitymodel":"esri classifier definition"===e?s="classifierdefinition":"esri classification schema"===e?s="classificationschema":"insights data engineering workbook"===e?s="dataengineeringworkbook":"insights data engineering model"===e?s="dataengineeringmodel":"deep learning studio project"===e?s="deeplearningproject":"discussion"===e?s="discussion":"allsource project"===e?s="allsourceproject":"api key"===e?s="apikey":"data pipeline"===e?s="datapipelines":"group layer"===e?(m=i.includes("Map"),s=m?"layergroup2d":"layergroup"):s="media layer"===e?"onlinemedialayer":"form"===e?i.includes("Survey123")?"survey":"datafilesgray":"csv"===e?"csv":"image"===e?"image":"maps",s?t(r+s+o+".png"):null}get isLayer(){return null!=this.type&&f.has(this.type)}get itemCdnUrl(){return w(this.itemUrl)}get itemPageUrl(){const e=this.portal?.itemPageUrl;return e&&this.id?`${e}?id=${this.id}`:null}get itemUrl(){const e=this.portal?.restUrl;return e&&this.id?`${e}/content/items/${this.id}`:null}get thumbnailUrl(){const e=this.itemUrl,t=this.thumbnail;return e&&t?this.portal?.normalizeUrl(`${e}/info/${t}?f=json`)??null:null}get userItemUrl(){const e=this.portal?.restUrl;if(!e)return null;const t=this.owner||this.portal?.user?.username;if(!t)return null;return`${e}/content/users/${this.ownerFolder?`${t}/${this.ownerFolder}`:t}/items/${this.id}`}load(e){const t=this.portal??(this.portal=h.getDefault()),i=t.load(e).then((()=>this.sourceJSON?this.sourceJSON:this.id&&this.itemUrl?t.request(this.itemUrl,{signal:null!=e?e.signal:null,query:{token:this.apiKey}}):{})).then((e=>{this.sourceJSON=e,this.read(e)}));return this.addResolvingPromise(i),Promise.resolve(this)}async addRating(e){const t={method:"post",query:{}};return e instanceof y&&(e=e.rating),null==e||isNaN(e)||"number"!=typeof e||(t.query.rating=e),this.portal?(await this.portal.request(this.itemUrl+"/addRating",t),new y({rating:e,created:new Date})):null}clone(){const e={access:this.access,accessInformation:this.accessInformation,applicationProxies:o(this.applicationProxies),avgRating:this.avgRating,categories:o(this.categories),created:o(this.created),culture:this.culture,description:this.description,extent:o(this.extent),groupCategories:o(this.groupCategories),id:this.id,itemControl:this.itemControl,licenseInfo:this.licenseInfo,modified:o(this.modified),name:this.name,numComments:this.numComments,numRatings:this.numRatings,numViews:this.numViews,owner:this.owner,ownerFolder:this.ownerFolder,portal:this.portal,screenshots:o(this.screenshots),size:this.size,snippet:this.snippet,sourceUrl:this.sourceUrl,spatialReference:this.spatialReference,tags:o(this.tags),thumbnail:this.thumbnail,title:this.title,type:this.type,typeKeywords:o(this.typeKeywords),url:this.url};this.loaded&&(e.loadStatus="loaded");const t=new v({sourceJSON:this.sourceJSON}).set(e);return t._set("isOrgItem",this.isOrgItem),t}createPostQuery(){const e=this.toJSON();for(const i of["tags","typeKeywords","categories"])e[i]=e[i]?.join(", ");const{extent:t}=e;return t&&(e.extent=JSON.stringify(t)),e}async deleteRating(){await this.portal.request(this.itemUrl+"/deleteRating",{method:"post"})}fetchData(e="json",t){return this.portal.request(this.itemUrl+"/data",{responseType:e,...t,query:{token:this.apiKey}})}async fetchRating(e){const t=await this.portal.request(this.itemUrl+"/rating",{query:{token:this.apiKey},...e});return null!=t.rating?(t.created=new Date(t.created),new y(t)):null}fetchRelatedItems(e,t){return this.portal.requestToTypedArray(this.itemUrl+"/relatedItems",{query:{...e,token:this.apiKey},...t},v)}getThumbnailUrl(e){let t=this.thumbnailUrl;return t&&e&&(t+=`&w=${e}`),t}reload(){return this.portal.request(this.itemUrl??"",{cacheBust:!0,query:{token:this.apiKey}}).then((e=>(this.sourceJSON=e,this.read(e),this)))}update(e){return this.id?this.load().then((()=>this.portal.signIn())).then((()=>{const t=e?.data,i={method:"post"};i.query=this.createPostQuery();for(const e in i.query)null===i.query[e]&&(i.query[e]="");return i.query.clearEmptyFields=!0,null!=t&&("string"==typeof t?i.query.text=t:"object"==typeof t&&(i.query.text=JSON.stringify(t))),this.portal.request(`${this.userItemUrl}/update`,i).then((()=>this.reload()))})):Promise.reject(new i("portal:item-does-not-exist","The item does not exist yet and cannot be updated"))}async copy(e){if(!this.id)throw new i("portal:item-does-not-exist","The item does not exist yet");await this.load();const{portal:t,itemUrl:r}=this;await t.signIn();const{copyResources:o,folder:s,tags:a,title:n}=e||{},l={method:"post",query:{copyPrivateResources:"all"===o,folder:"string"==typeof s?s:s?.id,includeResources:!!o,tags:a?.join(","),title:n}},{itemId:p}=await t.request(`${r}/copy`,l);return new v({id:p,portal:t})}updateThumbnail(e){return this.id?this.load().then((()=>this.portal.signIn())).then((()=>{const t=e.thumbnail,i=e.filename,r={method:"post"};if("string"==typeof t)n(t)?r.query={data:t}:r.query={url:l(t)},null!=i&&(r.query.filename=i);else{const e=new FormData;null!=i?e.append("file",t,i):e.append("file",t),r.body=e}return this.portal.request(`${this.userItemUrl}/updateThumbnail`,r).then((()=>this.reload()))})):Promise.reject(new i("portal:item-does-not-exist","The item does not exist yet and cannot be updated"))}async fetchResources(e={},t){const{fetchResources:i}=await import("./support/resourceUtils.js");return i(this,e,t)}async addResource(e,t,i){const{addOrUpdateResources:r}=await import("./support/resourceUtils.js");return e.portalItem=this,await r(this,[{resource:e,content:t,compress:i?.compress,access:i?.access}],"add",i),e}async removeResource(e,t){const{removeResource:r}=await import("./support/resourceUtils.js");if(e.portalItem&&e.portalItem.itemUrl!==this.itemUrl)throw new i("removeresource:portal-item-mismatch","The portal item associated with the provided resource does not match the item");return r(this,e,t)}async removeAllResources(e){const{removeAllResources:t}=await import("./support/resourceUtils.js");return t(this,e)}resourceFromPath(e){return new g({portalItem:this,path:e})}toJSON(){const e=this.extent,t={accessInformation:this.accessInformation,categories:o(this.categories),created:this.created?.getTime(),description:this.description,extent:e&&[[e.xmin,e.ymin],[e.xmax,e.ymax]],id:this.id,isOrgItem:this.isOrgItem,licenseInfo:this.licenseInfo,modified:this.modified?.getTime(),name:this.name,owner:this.owner,ownerFolder:this.ownerFolder,snippet:this.snippet,sourceUrl:this.sourceUrl,spatialReference:this.spatialReference,tags:o(this.tags),thumbnail:this.thumbnail,title:this.title,type:this.type,typeKeywords:o(this.typeKeywords),url:this.url};return s(t)}static fromJSON(e){if(!e)return null;if(e.declaredClass)throw new Error("JSON object is already hydrated");return new v({sourceJSON:e})}_getPostQuery(){const e=this.toJSON();for(const t in e)"tags"===t&&null!==e[t]&&(e[t]=e[t].join(", ")),"typeKeywords"===t&&null!==e[t]&&(e[t]=e[t].join(", ")),"extent"===t&&e[t]&&(e[t]=JSON.stringify(e[t]));return e}};e([p({type:["private","shared","org","public"]})],k.prototype,"access",void 0),e([p()],k.prototype,"accessInformation",void 0),e([p({type:String})],k.prototype,"apiKey",void 0),e([p({json:{read:{source:"appProxies"}}})],k.prototype,"applicationProxies",void 0),e([p()],k.prototype,"avgRating",void 0),e([p()],k.prototype,"categories",void 0),e([p({type:Date})],k.prototype,"created",void 0),e([p()],k.prototype,"culture",void 0),e([p()],k.prototype,"description",void 0),e([p({readOnly:!0})],k.prototype,"displayName",null),e([p({type:m})],k.prototype,"extent",void 0),e([d("extent")],k.prototype,"readExtent",null),e([p()],k.prototype,"groupCategories",void 0),e([p({readOnly:!0})],k.prototype,"iconUrl",null),e([p()],k.prototype,"id",void 0),e([p({readOnly:!0})],k.prototype,"isLayer",null),e([p({type:Boolean,readOnly:!0})],k.prototype,"isOrgItem",void 0),e([p()],k.prototype,"itemControl",void 0),e([p({readOnly:!0})],k.prototype,"itemPageUrl",null),e([p({readOnly:!0})],k.prototype,"itemUrl",null),e([p()],k.prototype,"licenseInfo",void 0),e([p({type:Date})],k.prototype,"modified",void 0),e([p()],k.prototype,"name",void 0),e([p()],k.prototype,"numComments",void 0),e([p()],k.prototype,"numRatings",void 0),e([p()],k.prototype,"numViews",void 0),e([p()],k.prototype,"owner",void 0),e([p()],k.prototype,"ownerFolder",void 0),e([p({type:h})],k.prototype,"portal",void 0),e([p()],k.prototype,"screenshots",void 0),e([p()],k.prototype,"size",void 0),e([p()],k.prototype,"snippet",void 0),e([p()],k.prototype,"sourceJSON",void 0),e([p({type:String})],k.prototype,"sourceUrl",void 0),e([p({type:String})],k.prototype,"spatialReference",void 0),e([p()],k.prototype,"tags",void 0),e([p()],k.prototype,"thumbnail",void 0),e([p({readOnly:!0})],k.prototype,"thumbnailUrl",null),e([p()],k.prototype,"title",void 0),e([p()],k.prototype,"type",void 0),e([p()],k.prototype,"typeKeywords",void 0),e([p({type:String,json:{read(e,t){if(b.has(t.type)){const t=this.portal?.restUrl;e||=t&&this.id?`${t}/content/items/${this.id}/data`:null}return e}}})],k.prototype,"url",void 0),e([p({readOnly:!0})],k.prototype,"userItemUrl",null),k=v=e([u("esri.portal.PortalItem")],k);const S=k;export{S 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.31/esri/copyright.txt for details.
4
4
  */
5
- import"../../../geometry.js";import e from"../../../core/Error.js";import t from"../Entity.js";import o from"../Relationship.js";import{geometryToWasm as i}from"./queryToWasmEncodedFactories.js";import n from"../../../geometry/Geometry.js";function r(i,n){if(!i.typeName)throw new e("knowledge-graph:no-type-name","You must indicate the entity/relationship named object type to apply edits");if(i instanceof t){const e=new n.EntityValue;e.deleteLater(),e.type_name=i.typeName;for(const[t,o]of Object.entries(i.properties))e.set_key_value(t,a(o,n));return i.id&&e.set_id(i.id),e}if(i instanceof o){const e=new n.RelationshipValue;e.deleteLater(),e.type_name=i.typeName;for(const[t,o]of Object.entries(i.properties))e.set_key_value(t,a(o,n));return i.id&&e.set_id(i.id),i.originId&&i.destinationId&&e.set_related_entity_ids(i.originId,i.destinationId),e}throw new e("knowledge-graph:applyEdits-encoding-failure","Could not determine the type of a named graph object passed to the encoder")}function s(e){return{xy_resolution:e.xyResolution,x_false_origin:e.xFalseOrigin,y_false_origin:e.yFalseOrigin,z_resolution:e.zResolution,z_false_origin:e.zFalseOrigin,m_resolution:e.mResolution,m_false_origin:e.mFalseOrigin}}function a(e,t){return null==e?"":"object"!=typeof e||e instanceof Date?e:e instanceof n?i(e,t):""}export{s as inputQuantizationParametersToWasmFormat,r as namedObjectToWasm};
5
+ import"../../../geometry.js";import e from"../../../core/Error.js";import t from"../Entity.js";import o from"../Relationship.js";import{geometryToWasm as i}from"./queryToWasmEncodedFactories.js";import n from"../../../geometry/Geometry.js";function r(i,n){if(!i.typeName)throw new e("knowledge-graph:no-type-name","You must indicate the entity/relationship named object type to apply edits");if(i instanceof t){const e=new n.EntityValue;e.deleteLater(),e.type_name=i.typeName;for(const[t,o]of Object.entries(i.properties))e.set_key_value(t,a(o,n));return i.id&&e.set_id(i.id),e}if(i instanceof o){const e=new n.RelationshipValue;e.deleteLater(),e.type_name=i.typeName;for(const[t,o]of Object.entries(i.properties))e.set_key_value(t,a(o,n));return i.id&&e.set_id(i.id),i.originId&&i.destinationId&&e.set_related_entity_ids(i.originId,i.destinationId),e}throw new e("knowledge-graph:applyEdits-encoding-failure","Could not determine the type of a named graph object passed to the encoder")}function s(e){return{xy_resolution:e.xyResolution,x_false_origin:e.xFalseOrigin,y_false_origin:e.yFalseOrigin,z_resolution:e.zResolution,z_false_origin:e.zFalseOrigin,m_resolution:e.mResolution,m_false_origin:e.mFalseOrigin}}function a(e,t){return null==e?null:"object"!=typeof e||e instanceof Date?e:e instanceof n?i(e,t):null}export{s as inputQuantizationParametersToWasmFormat,r as namedObjectToWasm};
package/rest/print.js CHANGED
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.31/esri/copyright.txt for details.
4
4
  */
5
- import{id as e}from"../kernel.js";import t from"../request.js";import{JSONMap as i}from"../core/jsonMap.js";import{createScreenPoint as a,pt2px as r,px2pt as n}from"../core/screenUtils.js";import{normalize as o,dataComponents as s}from"../core/urlUtils.js";import l from"../geometry/Polygon.js";import{collectLabelingFields as c}from"../layers/support/fieldUtils.js";import{getFloorFilterClause as u}from"../layers/support/floorFilterUtils.js";import{getSizeRangeAtScale as y}from"../renderers/visualVariables/support/visualVariableUtils.js";import{asValidOptions as p,getToken as f}from"./utils.js";import{execute as d}from"./geoprocessor/execute.js";import{submitJob as m}from"./geoprocessor/submitJob.js";import{toJSON as g}from"./support/fileFormat.js";import{toJSON as h}from"./support/layoutTemplate.js";import{getVisibleLayerViews as b,isScreenshotRequired as w,isBingMapsLayer as S,isCSVLayer as x,isBlendLayer as I,getSelectionSymbol as v,getContextBoundingBox as D,createPolygonLayer as L,createPolylineLayer as T,createPointLayer as O,createMultipointLayer as E}from"./support/printTaskUtils.js";import M from"./support/PrintTemplate.js";import{toJSON as P}from"./support/reportTemplate.js";const F={Feet:"ft",Kilometers:"km",Meters:"m",Miles:"mi"},V=new i({esriFeet:"Feet",esriKilometers:"Kilometers",esriMeters:"Meters",esriMiles:"Miles"}),N=new i({esriExecutionTypeSynchronous:"sync",esriExecutionTypeAsynchronous:"async"}),U=new Map;async function J(e,t,i){const a=await R(e,i),r=await A(t,a);if("sync"===await j(e,i)){const{results:t}=await d(e,r,void 0,i);return t?.[0]?.value}const n=await m(e,r,void 0,i);await n.waitForJobCompletion({interval:t.updateDelay});const{value:o}=await n.fetchResultData("Output_File",null,i);return o}async function R(e,i){const a=C(e),r=U.get(a)??{gpServerUrl:a,legendLayerNameMap:{},legendLayers:[]};return r.gpMetadata??=(await t(a,p({f:"json"},i))).data,r.cimVersion=r.gpMetadata.cimVersion,U.set(a,r),r}async function j(e,t){return fe(await R(e,t))}async function k(e,t){return(await R(e,t)).gpMetadata.tasks}async function A(t,i){i=i||{is11xService:!1,legendLayerNameMap:{},legendLayers:[]};const a=t.template||new M;null==a.showLabels&&(a.showLabels=!0);const r=a.exportOptions;let n;const o=h(a.layout);if(r){if(n={dpi:r.dpi},"map_only"===o.toLowerCase()||""===o){const e=r.width,t=r.height;n.outputSize=null!=e&&null!=t?[e,t]:void 0}}const s=a.layoutOptions;let l;if(s){let e,t;"Miles"===s.scalebarUnit||"Kilometers"===s.scalebarUnit?(e="Kilometers",t="Miles"):"Meters"!==s.scalebarUnit&&"Feet"!==s.scalebarUnit||(e="Meters",t="Feet"),l={titleText:s.titleText,authorText:s.authorText,copyrightText:s.copyrightText,customTextElements:s.customTextElements,elementOverrides:s.elementOverrides,scaleBarOptions:{metricUnit:V.toJSON(e),metricLabel:e?F[e]:void 0,nonMetricUnit:V.toJSON(t),nonMetricLabel:t?F[t]:void 0}}}let c=null;s?.legendLayers&&(c=s.legendLayers.map((e=>{const t=e.layerId;i.legendLayerNameMap[t]=e.title;const a={id:t};return e.subLayerIds&&(a.subLayerIds=e.subLayerIds),a})));const u=await _(t,a,i);if(u.operationalLayers){const e=new RegExp("[\\u4E00-\\u9FFF\\u0E00-\\u0E7F\\u0900-\\u097F\\u3040-\\u309F\\u30A0-\\u30FF\\u31F0-\\u31FF]"),t=/[\u0600-\u06FF]/,i=i=>{const a=i.text,r=i.font,n=r?.family?.toLowerCase();a&&r&&("arial"===n||"arial unicode ms"===n)&&(r.family=e.test(a)?"Arial Unicode MS":"Arial","normal"!==r.style&&t.test(a)&&(r.family="Arial Unicode MS"))};for(const a of u.operationalLayers)if(a.featureCollection?.layers)for(const e of a.featureCollection.layers){if(e.layerDefinition?.drawingInfo?.renderer?.symbol){const t=e.layerDefinition.drawingInfo.renderer;"esriTS"===t.symbol.type&&i(t.symbol)}if(e.featureSet?.features)for(const t of e.featureSet.features)t.symbol&&"esriTS"===t.symbol.type&&i(t.symbol)}}t.outSpatialReference&&(u.mapOptions.spatialReference=t.outSpatialReference.toJSON()),Object.assign(u,{exportOptions:n,layoutOptions:l||{}}),Object.assign(u.layoutOptions,{legendOptions:{operationalLayers:null!=c?c:i.legendLayers.slice()}}),i.legendLayers.length=0,U.set(i.gpServerUrl,i);const y={Web_Map_as_JSON:JSON.stringify(u),Format:g(a.format),Layout_Template:o,Layout_Item_ID:void 0,Report_Template:P(a.report),Report_Item_ID:void 0};if(a.layoutItem){delete y.Layout_Template;const t=a.layoutItem;await t.load(),"public"!==t.access&&e&&await e.getCredential(i.gpServerUrl),y.Layout_Item_ID=JSON.stringify({id:t.id})}if(a.reportItem){delete y.Report_Template;const t=a.reportItem;await t.load(),"public"!==t.access&&e&&await e.getCredential(i.gpServerUrl),y.Report_Item_ID=JSON.stringify({id:t.id})}return t.extraParameters&&Object.assign(y,t.extraParameters),y}async function _(e,t,i){const a=e.view;let r=a.spatialReference;const n={operationalLayers:await z(a,t,i)};t.includeTables&&(n.tables=await ae(a));let o=e.extent||i.ssExtent||a.extent;if(r?.isWrappable&&(o=o.clone()._normalize(!0),r=o.spatialReference),n.mapOptions={extent:o&&o.toJSON(),spatialReference:r&&r.toJSON(),showAttribution:t.attributionVisible},i.ssExtent=null,a.background&&(n.background=a.background.toJSON()),a.rotation&&(n.mapOptions.rotation=-a.rotation),t.scalePreserved&&(n.mapOptions.scale=t.outScale||a.scale),null!=a.timeExtent){const e=null!=a.timeExtent.start?a.timeExtent.start.getTime():null,t=null!=a.timeExtent.end?a.timeExtent.end.getTime():null;n.mapOptions.time=[e,t]}return t.reportOptions&&(n.reportOptions=t.reportOptions),n}function C(e){let t=e;const i=t.lastIndexOf("/GPServer/");return i>0&&(t=t.slice(0,i+9)),t}async function z(e,t,i){const a=[],r={layerView:null,printTemplate:t,view:e};let n=0;t.scalePreserved&&(n=t.outScale||e.scale);const o=b(e,n);for(const s of o){const e=s.layer;if(!e.loaded||"group"===e?.type)continue;let t;r.layerView=s,t=w(s)?await te(e,r,i):S(e)?$(e):x(e)?await q(e,r,i):"feature"===e?.type?await W(e,r,i):"geojson"===e?.type?await B(e,r,i):"graphics"===e?.type?await H(e,r,i):"imagery"===e?.type?G(e,i):"imagery-tile"===e?.type?await Q(e,r,i):"kml"===e?.type?await X(e,r,i):"map-image"===e?.type?Y(e,r,i):"map-notes"===e?.type?await Z(r,i):"open-street-map"===e?.type?ee():"stream"===e?.type?await ie(e,r,i):"tile"===e?.type?re(e,i):"vector-tile"===e?.type?await ne(e,r,i):"web-tile"===e?.type?oe(e):"wms"===e?.type?se(e,i):"wmts"===e?.type?le(e):await te(e,r,i),t&&(Array.isArray(t)?a.push(...t):(t.id=e.id,t.title=i.legendLayerNameMap[e.id]||e.title,t.opacity=s.fullOpacity,t.minScale=e.minScale||0,t.maxScale=e.maxScale||0,I(e)&&e.blendMode&&"normal"!==e.blendMode&&(t.blendMode=e.blendMode),a.push(t)))}if(n)for(const s of a)s.minScale=0,s.maxScale=0;if(e.graphics?.length){const r=await K(null,e.graphics,t,i);r&&a.push(r)}return a}function $(e){return{culture:e.culture,key:e.key,type:"BingMaps"+("aerial"===e.style?"Aerial":"hybrid"===e.style?"Hybrid":"Road")}}async function q(e,t,i){e.legendEnabled&&i.legendLayers.push({id:e.id});const a=t.layerView,r=t.printTemplate;let n;if(a.filter||e.portalItem&&"public"!==e.portalItem.access){return K(e,await pe(a),r,i)}return n={type:"CSV"},e.write(n,{origin:"web-map"}),delete n.popupInfo,delete n.layerType,n.showLabels=r.showLabels&&e.labelsVisible,n}async function K(e,t,i,a){let r;const n=L(),o=T(),s=O(),u=E(),y=O();if(y.layerDefinition.name="textLayer",delete y.layerDefinition.drawingInfo,e){if("esri.layers.FeatureLayer"===e.declaredClass||"esri.layers.StreamLayer"===e.declaredClass?n.layerDefinition.name=o.layerDefinition.name=s.layerDefinition.name=u.layerDefinition.name=a.legendLayerNameMap[e.id]||e.get("arcgisProps.title")||e.title:"esri.layers.GraphicsLayer"===e.declaredClass&&(t=e.graphics.items),e.renderer){const t=e.renderer.toJSON(),i=n.layerDefinition.drawingInfo;i&&(i.renderer=t);const a=o.layerDefinition.drawingInfo;a&&(a.renderer=t);const r=s.layerDefinition.drawingInfo;r&&(r.renderer=t);const l=u.layerDefinition.drawingInfo;l&&(l.renderer=t)}if(i.showLabels&&e.labelsVisible&&"function"==typeof e.write){const t=e.write({},{origin:"web-map"}),i=t.layerDefinition?.drawingInfo?.labelingInfo;if(i){r=!0;const e=n.layerDefinition.drawingInfo;e&&(e.labelingInfo=i);const t=o.layerDefinition.drawingInfo;t&&(t.labelingInfo=i);const a=s.layerDefinition.drawingInfo;a&&(a.labelingInfo=i);const l=u.layerDefinition.drawingInfo;l&&(l.labelingInfo=i)}}}let p;e?.renderer||r||(delete n.layerDefinition.drawingInfo,delete o.layerDefinition.drawingInfo,delete s.layerDefinition.drawingInfo,delete u.layerDefinition.drawingInfo);const f=e?.fieldsIndex,d=e?.renderer;if(f){const t=new Set;r&&await c(t,e),d&&"function"==typeof d.collectRequiredFields&&await d.collectRequiredFields(t,f),p=Array.from(t);const i=f.fields.map((e=>e.toJSON()));n.layerDefinition.fields=i,o.layerDefinition.fields=i,s.layerDefinition.fields=i,u.layerDefinition.fields=i}const m=t?.length;let g;for(let c=0;c<m;c++){const e=t[c]||t.at(c);if(!1!==e.visible&&e.geometry){if(g=e.toJSON(),g.hasOwnProperty("popupTemplate")&&delete g.popupTemplate,g.geometry?.z&&delete g.geometry.z,g.symbol&&(g.symbol.angle||delete g.symbol.angle,de(g.symbol)?g.symbol=await ue(g.symbol,a):g.symbol.text&&delete g.attributes),(!i||!i.forceFeatureAttributes)&&p?.length){const e={};for(const t of p)g.attributes?.hasOwnProperty(t)&&(e[t]=g.attributes[t]);g.attributes=e}"polygon"===e.geometry.type?n.featureSet.features.push(g):"polyline"===e.geometry.type?o.featureSet.features.push(g):"point"===e.geometry.type?g.symbol?.text?y.featureSet.features.push(g):s.featureSet.features.push(g):"multipoint"===e.geometry.type?u.featureSet.features.push(g):"extent"===e.geometry.type&&(g.geometry=l.fromExtent(e.geometry).toJSON(),n.featureSet.features.push(g))}}const h=[n,o,u,s,y].filter((e=>e.featureSet.features.length>0));for(const l of h){const e=l.featureSet.features.every((e=>e.symbol));if(e&&(!i||!i.forceFeatureAttributes))for(const t of l.featureSet.features)delete t.attributes;e&&delete l.layerDefinition.drawingInfo,l.layerDefinition.drawingInfo?.renderer&&await ye(l.layerDefinition.drawingInfo.renderer,a)}return h.length?{featureCollection:{layers:h},showLabels:r}:null}async function W(e,t,i){let a;const r=e.renderer,n=parseFloat(i.cimVersion);if("binning"===e.featureReduction?.type||"cluster"===e.featureReduction?.type&&n<2.9||"pie-chart"===r?.type||"dot-density"===r?.type&&n<2.6)return te(e,t,i);e.legendEnabled&&i.legendLayers.push({id:e.id});const o=t.layerView,{printTemplate:s,view:l}=t,c="feature-layer"!==e.source?.type&&"ogc-feature"!==e.source?.type;if(o.filter||c||!r||"field"in r&&null!=r.field&&!e.getField(r.field)){const t=await pe(o);a=await K(e,t,s,i)}else{if(a={id:(p=e.write()).id,title:p.title,url:p.url,layerType:p.layerType,customParameters:p.customParameters,layerDefinition:p.layerDefinition,charts:s.includeCharts?p.charts:void 0},a.showLabels=s.showLabels&&e.labelsVisible,ce(a,e),a.layerDefinition?.drawingInfo?.renderer&&(delete a.layerDefinition.minScale,delete a.layerDefinition.maxScale,await ye(a.layerDefinition.drawingInfo.renderer,i),"visualVariables"in r&&r.visualVariables&&r.visualVariables[0])){const e=r.visualVariables[0];if("size"===e.type&&e.maxSize&&"number"!=typeof e.maxSize&&e.minSize&&"number"!=typeof e.minSize){const t=y(e,l.scale);a.layerDefinition.drawingInfo.renderer.visualVariables[0].minSize=t.minSize,a.layerDefinition.drawingInfo.renderer.visualVariables[0].maxSize=t.maxSize}}const t=u(o);if(t&&(a.layerDefinition||(a.layerDefinition={}),a.layerDefinition.definitionExpression=a.layerDefinition.definitionExpression?`(${a.layerDefinition.definitionExpression}) AND (${t})`:t),o.hasHighlight?.()&&"getHighlightIds"in o){const t=o;a.selectionObjectIds=t.getHighlightIds(),a.selectionSymbol=v(e.geometryType,t.highlightOptions??l.highlightOptions)}}var p;return a}async function B(e,t,i){if("binning"===e.featureReduction?.type||"cluster"===e.featureReduction?.type)return te(e,t,i);e.legendEnabled&&i.legendLayers.push({id:e.id});return K(e,await pe(t.layerView),t.printTemplate,i)}async function H(e,{printTemplate:t},i){return K(e,null,t,i)}function G(e,t){e.legendEnabled&&t.legendLayers.push({id:e.id});const i={layerType:(a=e.write()).layerType,customParameters:a.customParameters};var a;return i.bandIds=e.bandIds,i.compressionQuality=e.compressionQuality,i.format=e.format,i.interpolation=e.interpolation,(e.mosaicRule||e.definitionExpression)&&(i.mosaicRule=e.exportImageServiceParameters.mosaicRule.toJSON()),e.rasterFunction&&(i.renderingRule=e.rasterFunction.toJSON()),e.renderer&&(i.layerDefinition??={},i.layerDefinition.drawingInfo??={},i.layerDefinition.drawingInfo.renderer=e.renderer.toJSON()),ce(i,e),i}async function Q(e,t,i){if("flow"===e.renderer?.type)return te(e,t,i);e.legendEnabled&&i.legendLayers.push({id:e.id});const a={bandIds:(r=e.write()||{}).bandIds,customParameters:r.customParameters,interpolation:r.interpolation,layerDefinition:r.layerDefinition};var r;return a.layerType="ArcGISImageServiceLayer",ce(a,e),a}async function X(e,t,i){const a=t.printTemplate;if(!e.portalItem||"public"===e.portalItem.access){const t={type:"kml"};return e.write(t,{origin:"web-map"}),delete t.layerType,t.url=o(e.url),t}const r=[],n=t.layerView;n.allVisibleMapImages.forEach(((t,i)=>{const a={id:`${e.id}_image${i}`,type:"image",title:e.id,minScale:e.minScale||0,maxScale:e.maxScale||0,opacity:n.fullOpacity,extent:t.extent};"data:image/png;base64,"===t.href.substr(0,22)?a.imageData=t.href.substr(22):a.url=t.href,r.push(a)}));const s=[...n.allVisiblePoints.items,...n.allVisiblePolylines.items,...n.allVisiblePolygons.items],l={id:e.id,...await K(null,s,a,i)};return r.push(l),r}function Y(e,{view:t},i){let a;const r={id:e.id,subLayerIds:[]};let n=[];const o=t.scale,s=e=>{const t=0===o,i=0===e.minScale||o<=e.minScale,a=0===e.maxScale||o>=e.maxScale;if(e.visible&&(t||i&&a))if(e.sublayers)e.sublayers.forEach(s);else{const t=e.toExportImageJSON(),i={id:e.id,name:e.title,layerDefinition:{drawingInfo:t.drawingInfo,definitionExpression:t.definitionExpression,source:t.source}};n.unshift(i),r.subLayerIds.push(e.id)}};var l;return e.sublayers&&e.sublayers.forEach(s),n.length&&(n=n.map((({id:e,name:t,layerDefinition:i})=>({id:e,name:t,layerDefinition:i}))),a={layerType:(l=e.write()).layerType,customParameters:l.customParameters},a.layers=n,a.visibleLayers=e.capabilities?.exportMap?.supportsDynamicLayers?void 0:r.subLayerIds,ce(a,e),e.legendEnabled&&i.legendLayers.push(r)),a}async function Z({layerView:e,printTemplate:t},i){const a=[],r=e.layer;if(null!=r.featureCollections)for(const n of r.featureCollections){const e=await K(n,n.source,t,i);e&&a.push(...e.featureCollection.layers)}else if(null!=r.sublayers)for(const n of r.sublayers){const e=await K(null,n.graphics,t,i);e&&a.push(...e.featureCollection.layers)}return{featureCollection:{layers:a}}}function ee(){return{type:"OpenStreetMap"}}async function te(e,{printTemplate:t,view:i},r){const n={type:"image"},o={format:"png",ignoreBackground:!0,ignorePadding:!0,layers:[e]};0!==i.rotation&&(o.rotation=0);const l=r.ssExtent||i.state.extent.clone();let c=96,u=!0,y=!0;if(t.exportOptions){const e=t.exportOptions;null!=e.dpi&&e.dpi>0&&(c=e.dpi),null!=e.width&&e.width>0&&(u=e.width%2==i.width%2),null!=e.height&&e.height>0&&(y=e.height%2==i.height%2)}if("map-only"===t.layout&&t.scalePreserved&&(!t.outScale||t.outScale===i.scale)&&96===c&&(!u||!y)&&i.state.extent.equals(i.extent)&&(o.area={x:0,y:0,width:i.width,height:i.height},u||(o.area.width-=1),y||(o.area.height-=1),!r.ssExtent)){const e=i.toMap(a(o.area.width,o.area.height));l.ymin=e.y,l.xmax=e.x,r.ssExtent=l}n.extent=l.clone()._normalize(!0).toJSON();const p=await i.takeScreenshot(o);return n.imageData=s(p.dataUrl)?.data,n}async function ie(e,{layerView:t,printTemplate:i},a){e.legendEnabled&&a.legendLayers.push({id:e.id});return K(e,await pe(t),i,a)}async function ae(e){const t=[],i=[];for(const r of e.map.allTables)"feature"!==r.type||r.loaded||i.push(r.load());i.length&&await Promise.allSettled(i);for(const r of e.map.allTables)if("feature"===r.type&&r.loaded&&r.isTable&&"feature-layer"===r.source?.type){const e={id:(a=r.write()).id,title:a.title,customParameters:a.customParameters,layerDefinition:{definitionExpression:a.layerDefinition?.definitionExpression},url:a.url};ce(e,r),t.push(e)}var a;return t.length?t:void 0}function re(e,t){e.legendEnabled&&t.legendLayers.push({id:e.id});const i={layerType:(a=e.write()).layerType,customParameters:a.customParameters};var a;return ce(i,e),i}async function ne(e,t,i){if(e.serviceUrl&&e.styleUrl){const t=f(e.styleUrl,e.apiKey),a=f(e.serviceUrl,e.apiKey);if(!t&&!a||"2.1.0"!==i.cimVersion){const i={type:"VectorTileLayer"};return i.styleUrl=o(e.styleUrl),i.token=t,a!==t&&(i.additionalTokens=[{url:e.serviceUrl,token:a}]),i}}return te(e,t,i)}function oe(e){const t=e.urlTemplate?.replace(/\${/g,"{"),i={type:"WebTiledLayer",urlTemplate:t,credits:e.copyright};return e.subDomains&&e.subDomains.length>0&&(i.subDomains=e.subDomains),i}function se(e,t){let i;const a=[],r=e=>{e.visible&&(e.sublayers?e.sublayers.forEach(r):e.name&&a.unshift(e.name))};return e.sublayers&&e.sublayers.forEach(r),a.length&&(e.legendEnabled&&t.legendLayers.push({id:e.id,subLayerIds:a}),i={type:"wms",customLayerParameters:e.customLayerParameters,customParameters:e.customParameters,transparentBackground:e.imageTransparency,visibleLayers:a,url:o(e.url),version:e.version}),i}function le(e){const t=e.activeLayer;return{type:"wmts",customLayerParameters:e.customLayerParameters,customParameters:e.customParameters,format:t.imageFormat,layer:t.id,style:t.styleId,tileMatrixSet:t.tileMatrixSetId,url:o(e.url)}}function ce(e,t){t.url&&(e.url=o(e.url||t.url),e.token=f(e.url,t.apiKey))}async function ue(e,i){i.canvas||(i.canvas=document.createElement("canvas"));const a=1024;i.canvas.width=a,i.canvas.height=a;const o=i.canvas.getContext("2d");let s,l;if(e.path){const t=new Path2D(e.path);t.closePath(),o.fillStyle=Array.isArray(e.color)?`rgba(${e.color[0]},${e.color[1]},${e.color[2]},${e.color[3]/255})`:"rgb(0,0,0)",o.fill(t);const i=D(o);if(!i)return null;o.clearRect(0,0,a,a);const n=r(e.size)/Math.max(i.width,i.height);o.scale(n,n);const c=a/n,u=c/2-i.width/2-i.x,y=c/2-i.height/2-i.y;if(o.translate(u,y),Array.isArray(e.color)&&o.fill(t),e.outline?.width&&Array.isArray(e.outline.color)){const a=e.outline;o.lineWidth=r(a.width)/n,o.lineJoin="round",o.strokeStyle=`rgba(${a.color[0]},${a.color[1]},${a.color[2]},${a.color[3]/255})`,o.stroke(t),i.width+=o.lineWidth,i.height+=o.lineWidth}i.width*=n,i.height*=n;const p=o.getImageData(a/2-i.width/2,a/2-i.height/2,Math.ceil(i.width),Math.ceil(i.height));s=p.width,l=p.height,o.canvas.width=s,o.canvas.height=l,o.putImageData(p,0,0)}else{const i="image/svg+xml"===e.contentType?"data:image/svg+xml;base64,"+e.imageData:e.url,a=(await t(i,{responseType:"image"})).data;s=r(e.width),l=r(e.height),o.canvas.width=s,o.canvas.height=l,o.drawImage(a,0,0,o.canvas.width,o.canvas.height)}return{type:"esriPMS",imageData:o.canvas.toDataURL("image/png").substr(22),angle:e.angle,contentType:"image/png",height:n(l),width:n(s),xoffset:e.xoffset,yoffset:e.yoffset}}async function ye(e,t){const i=e.type;if("simple"===i&&de(e.symbol))e.symbol=await ue(e.symbol,t);else if("uniqueValue"===i||"classBreaks"===i){de(e.defaultSymbol)&&(e.defaultSymbol=await ue(e.defaultSymbol,t));const a=e["uniqueValue"===i?"uniqueValueInfos":"classBreakInfos"];if(a)for(const e of a)de(e.symbol)&&(e.symbol=await ue(e.symbol,t))}}async function pe(e){return e.queryFeatures(e.createQuery()).then((e=>e.features))}function fe(e){return e.gpMetadata?.executionType?N.fromJSON(e.gpMetadata.executionType):"sync"}function de(e){return e&&(e.path||"image/svg+xml"===e.contentType||e.url?.endsWith(".svg"))}export{J as execute,A as getGpPrintParams,C as getGpServerUrl,j as getMode,k as getTasks,U as printCacheMap};
5
+ import{id as e}from"../kernel.js";import t from"../request.js";import{JSONMap as a}from"../core/jsonMap.js";import{createScreenPoint as i,pt2px as r,px2pt as n}from"../core/screenUtils.js";import{normalize as o,dataComponents as s}from"../core/urlUtils.js";import l from"../geometry/Polygon.js";import{collectLabelingFields as c}from"../layers/support/fieldUtils.js";import{getFloorFilterClause as u}from"../layers/support/floorFilterUtils.js";import{getSizeRangeAtScale as y}from"../renderers/visualVariables/support/visualVariableUtils.js";import{asValidOptions as p,getToken as f}from"./utils.js";import{execute as m}from"./geoprocessor/execute.js";import{submitJob as d}from"./geoprocessor/submitJob.js";import{toJSON as g}from"./support/fileFormat.js";import{toJSON as h}from"./support/layoutTemplate.js";import{getVisibleLayerViews as b,isScreenshotRequired as w,isBingMapsLayer as S,isCSVLayer as x,isBlendLayer as I,getSelectionSymbol as v,getContextBoundingBox as D,createPolygonLayer as L,createPolylineLayer as T,createPointLayer as O,createMultipointLayer as E}from"./support/printTaskUtils.js";import P from"./support/PrintTemplate.js";import{toJSON as M}from"./support/reportTemplate.js";const F={Feet:"ft",Kilometers:"km",Meters:"m",Miles:"mi"},V=new a({esriFeet:"Feet",esriKilometers:"Kilometers",esriMeters:"Meters",esriMiles:"Miles"}),N=new a({esriExecutionTypeSynchronous:"sync",esriExecutionTypeAsynchronous:"async"}),U=new Map;async function J(e,t,a){const i=await R(e,a),r=await A(t,i);if("sync"===await j(e,a)){const{results:t}=await m(e,r,void 0,a);return t?.[0]?.value}const n=await d(e,r,void 0,a);await n.waitForJobCompletion({interval:t.updateDelay});const{value:o}=await n.fetchResultData("Output_File",null,a);return o}async function R(e,a){const i=C(e),r=U.get(i)??{gpServerUrl:i,legendLayerNameMap:{},legendLayers:[]};return r.gpMetadata??=(await t(i,p({f:"json"},a))).data,r.cimVersion=r.gpMetadata.cimVersion,U.set(i,r),r}async function j(e,t){return de(await R(e,t))}async function k(e,t){return(await R(e,t)).gpMetadata.tasks}async function A(t,a){a=a||{is11xService:!1,legendLayerNameMap:{},legendLayers:[]};const i=t.template||new P;null==i.showLabels&&(i.showLabels=!0);const r=i.exportOptions;let n;const o=h(i.layout);if(r){if(n={dpi:r.dpi},"map_only"===o.toLowerCase()||""===o){const e=r.width,t=r.height;n.outputSize=null!=e&&null!=t?[e,t]:void 0}}const s=i.layoutOptions;let l;if(s){let e,t;"Miles"===s.scalebarUnit||"Kilometers"===s.scalebarUnit?(e="Kilometers",t="Miles"):"Meters"!==s.scalebarUnit&&"Feet"!==s.scalebarUnit||(e="Meters",t="Feet"),l={titleText:s.titleText,authorText:s.authorText,copyrightText:s.copyrightText,customTextElements:s.customTextElements,elementOverrides:s.elementOverrides,scaleBarOptions:{metricUnit:V.toJSON(e),metricLabel:e?F[e]:void 0,nonMetricUnit:V.toJSON(t),nonMetricLabel:t?F[t]:void 0}}}let c=null;s?.legendLayers&&(c=s.legendLayers.map((e=>{const t=e.layerId;a.legendLayerNameMap[t]=e.title;const i={id:t};return e.subLayerIds&&(i.subLayerIds=e.subLayerIds),i})));const u=await _(t,i,a);if(u.operationalLayers){const e=new RegExp("[\\u4E00-\\u9FFF\\u0E00-\\u0E7F\\u0900-\\u097F\\u3040-\\u309F\\u30A0-\\u30FF\\u31F0-\\u31FF]"),t=/[\u0600-\u06FF]/,a=a=>{const i=a.text,r=a.font,n=r?.family?.toLowerCase();i&&r&&("arial"===n||"arial unicode ms"===n)&&(r.family=e.test(i)?"Arial Unicode MS":"Arial","normal"!==r.style&&t.test(i)&&(r.family="Arial Unicode MS"))};for(const i of u.operationalLayers)if(i.featureCollection?.layers)for(const e of i.featureCollection.layers){if(e.layerDefinition?.drawingInfo?.renderer?.symbol){const t=e.layerDefinition.drawingInfo.renderer;"esriTS"===t.symbol.type&&a(t.symbol)}if(e.featureSet?.features)for(const t of e.featureSet.features)t.symbol&&"esriTS"===t.symbol.type&&a(t.symbol)}}t.outSpatialReference&&(u.mapOptions.spatialReference=t.outSpatialReference.toJSON()),Object.assign(u,{exportOptions:n,layoutOptions:l||{}}),Object.assign(u.layoutOptions,{legendOptions:{operationalLayers:null!=c?c:a.legendLayers.slice()}}),a.legendLayers.length=0,U.set(a.gpServerUrl,a);const y={Web_Map_as_JSON:JSON.stringify(u),Format:g(i.format),Layout_Template:o,Layout_Item_ID:void 0,Report_Template:M(i.report),Report_Item_ID:void 0};if(i.layoutItem){delete y.Layout_Template;const t=i.layoutItem;await t.load(),"public"!==t.access&&e&&await e.getCredential(a.gpServerUrl),y.Layout_Item_ID=JSON.stringify({id:t.id})}if(i.reportItem){delete y.Report_Template;const t=i.reportItem;await t.load(),"public"!==t.access&&e&&await e.getCredential(a.gpServerUrl),y.Report_Item_ID=JSON.stringify({id:t.id})}return t.extraParameters&&Object.assign(y,t.extraParameters),y}async function _(e,t,a){const i=e.view;let r=i.spatialReference;const n={operationalLayers:await z(i,t,a)};t.includeTables&&(n.tables=await re(i));let o=e.extent||a.ssExtent||i.extent;if(r?.isWrappable&&(o=o.clone()._normalize(!0),r=o.spatialReference),n.mapOptions={extent:o&&o.toJSON(),spatialReference:r&&r.toJSON(),showAttribution:t.attributionVisible},a.ssExtent=null,i.background&&(n.background=i.background.toJSON()),i.rotation&&(n.mapOptions.rotation=-i.rotation),t.scalePreserved&&(n.mapOptions.scale=t.outScale||i.scale),null!=i.timeExtent){const e=null!=i.timeExtent.start?i.timeExtent.start.getTime():null,t=null!=i.timeExtent.end?i.timeExtent.end.getTime():null;n.mapOptions.time=[e,t]}return t.reportOptions&&(n.reportOptions=t.reportOptions),n}function C(e){let t=e;const a=t.lastIndexOf("/GPServer/");return a>0&&(t=t.slice(0,a+9)),t}async function z(e,t,a){const i=[],r={layerView:null,printTemplate:t,view:e};let n=0;t.scalePreserved&&(n=t.outScale||e.scale);const o=b(e,n);for(const s of o){const e=s.layer;if(!e.loaded||"layers"in e)continue;let t;r.layerView=s,t=w(s)?await ae(e,r,a):S(e)?$(e):x(e)?await K(e,r,a):"catalog-footprint"===e?.type?await q(e,r,a):"feature"===e?.type?await B(e,r,a):"geojson"===e?.type?await G(e,r,a):"graphics"===e?.type?await H(e,r,a):"imagery"===e?.type?Q(e,a):"imagery-tile"===e?.type?await X(e,r,a):"kml"===e?.type?await Y(e,r,a):"map-image"===e?.type?Z(e,r,a):"map-notes"===e?.type?await ee(r,a):"open-street-map"===e?.type?te():"stream"===e?.type?await ie(e,r,a):"tile"===e?.type?ne(e,a):"vector-tile"===e?.type?await oe(e,r,a):"web-tile"===e?.type?se(e):"wms"===e?.type?le(e,a):"wmts"===e?.type?ce(e):await ae(e,r,a),t&&(Array.isArray(t)?i.push(...t):(t.id=e.id,t.title=a.legendLayerNameMap[e.id]||e.title,t.opacity=s.fullOpacity,t.minScale=e.minScale||0,t.maxScale=e.maxScale||0,I(e)&&e.blendMode&&"normal"!==e.blendMode&&(t.blendMode=e.blendMode),i.push(t)))}if(n)for(const s of i)s.minScale=0,s.maxScale=0;if(e.graphics?.length){const r=await W(null,e.graphics,t,a);r&&i.push(r)}return i}function $(e){return{culture:e.culture,key:e.key,type:"BingMaps"+("aerial"===e.style?"Aerial":"hybrid"===e.style?"Hybrid":"Road")}}async function q(e,{layerView:t,printTemplate:a},i){if(parseFloat(i.cimVersion)<3.1){return W(e,await fe(t),a,i)}const r=e.parent,n={id:(o=me(r,"web-map")).id,url:o.url,layerType:o.layerType,customParameters:o.customParameters,dynamicGroupLayer:{visibility:!1},footprintLayer:o.footprintLayer,layerDefinition:o.layerDefinition};var o;return ue(n,r),n}async function K(e,t,a){e.legendEnabled&&a.legendLayers.push({id:e.id});const i=t.layerView,r=t.printTemplate;if(!(i.filter||e.portalItem&&"public"!==e.portalItem.access)){const t=me(e,"web-map");return t.type="CSV",delete t.popupInfo,delete t.layerType,t.showLabels=r.showLabels&&e.labelsVisible,t}return W(e,await fe(i),r,a)}async function W(e,t,a,i){let r;const n=L(),o=T(),s=O(),u=E(),y=O();if(y.layerDefinition.name="textLayer",delete y.layerDefinition.drawingInfo,e){if("esri.layers.FeatureLayer"===e.declaredClass||"esri.layers.StreamLayer"===e.declaredClass?n.layerDefinition.name=o.layerDefinition.name=s.layerDefinition.name=u.layerDefinition.name=i.legendLayerNameMap[e.id]||e.get("arcgisProps.title")||e.title:"esri.layers.GraphicsLayer"===e.declaredClass&&(t=e.graphics.items),e.renderer){const t=e.renderer.toJSON(),a=n.layerDefinition.drawingInfo;a&&(a.renderer=t);const i=o.layerDefinition.drawingInfo;i&&(i.renderer=t);const r=s.layerDefinition.drawingInfo;r&&(r.renderer=t);const l=u.layerDefinition.drawingInfo;l&&(l.renderer=t)}if(a.showLabels&&e.labelsVisible&&"function"==typeof e.write){const t=me(e,"web-map"),a=t.layerDefinition?.drawingInfo?.labelingInfo;if(a){r=!0;const e=n.layerDefinition.drawingInfo;e&&(e.labelingInfo=a);const t=o.layerDefinition.drawingInfo;t&&(t.labelingInfo=a);const i=s.layerDefinition.drawingInfo;i&&(i.labelingInfo=a);const l=u.layerDefinition.drawingInfo;l&&(l.labelingInfo=a)}}}let p;e?.renderer||r||(delete n.layerDefinition.drawingInfo,delete o.layerDefinition.drawingInfo,delete s.layerDefinition.drawingInfo,delete u.layerDefinition.drawingInfo);const f=e?.fieldsIndex,m=e?.renderer;if(f){const t=new Set;r&&await c(t,e),m&&"function"==typeof m.collectRequiredFields&&await m.collectRequiredFields(t,f),p=Array.from(t);const a=f.fields.map((e=>e.toJSON()));n.layerDefinition.fields=a,o.layerDefinition.fields=a,s.layerDefinition.fields=a,u.layerDefinition.fields=a}const d=t?.length;let g;for(let c=0;c<d;c++){const e=t[c]||t.at(c);if(!1!==e.visible&&e.geometry){if(g=e.toJSON(),g.hasOwnProperty("popupTemplate")&&delete g.popupTemplate,g.geometry?.z&&delete g.geometry.z,g.symbol&&(g.symbol.angle||delete g.symbol.angle,ge(g.symbol)?g.symbol=await ye(g.symbol,i):g.symbol.text&&delete g.attributes),(!a||!a.forceFeatureAttributes)&&p?.length){const e={};for(const t of p)g.attributes?.hasOwnProperty(t)&&(e[t]=g.attributes[t]);g.attributes=e}"polygon"===e.geometry.type?n.featureSet.features.push(g):"polyline"===e.geometry.type?o.featureSet.features.push(g):"point"===e.geometry.type?g.symbol?.text?y.featureSet.features.push(g):s.featureSet.features.push(g):"multipoint"===e.geometry.type?u.featureSet.features.push(g):"extent"===e.geometry.type&&(g.geometry=l.fromExtent(e.geometry).toJSON(),n.featureSet.features.push(g))}}const h=[n,o,u,s,y].filter((e=>e.featureSet.features.length>0));for(const l of h){const e=l.featureSet.features.every((e=>e.symbol));if(e&&(!a||!a.forceFeatureAttributes))for(const t of l.featureSet.features)delete t.attributes;e&&delete l.layerDefinition.drawingInfo,l.layerDefinition.drawingInfo?.renderer&&await pe(l.layerDefinition.drawingInfo.renderer,i)}return h.length?{featureCollection:{layers:h},showLabels:r}:null}async function B(e,t,a){let i;const r=e.renderer,n=parseFloat(a.cimVersion);if("binning"===e.featureReduction?.type||"cluster"===e.featureReduction?.type&&n<2.9||"pie-chart"===r?.type||"dot-density"===r?.type&&n<2.6)return ae(e,t,a);e.legendEnabled&&a.legendLayers.push({id:e.id});const o=t.layerView,{printTemplate:s,view:l}=t,c="feature-layer"!==e.source?.type&&"ogc-feature"!==e.source?.type;if(o.filter||c||!r||"field"in r&&null!=r.field&&!e.getField(r.field)){const t=await fe(o);i=await W(e,t,s,a)}else{if(i={id:(p=me(e)).id,title:p.title,url:p.url,layerType:p.layerType,customParameters:p.customParameters,layerDefinition:p.layerDefinition,charts:s.includeCharts?p.charts:void 0},i.showLabels=s.showLabels&&e.labelsVisible,ue(i,e),i.layerDefinition?.drawingInfo?.renderer&&(delete i.layerDefinition.minScale,delete i.layerDefinition.maxScale,await pe(i.layerDefinition.drawingInfo.renderer,a),"visualVariables"in r&&r.visualVariables&&r.visualVariables[0])){const e=r.visualVariables[0];if("size"===e.type&&e.maxSize&&"number"!=typeof e.maxSize&&e.minSize&&"number"!=typeof e.minSize){const t=y(e,l.scale);i.layerDefinition.drawingInfo.renderer.visualVariables[0].minSize=t.minSize,i.layerDefinition.drawingInfo.renderer.visualVariables[0].maxSize=t.maxSize}}const t=u(o);if(t&&(i.layerDefinition||(i.layerDefinition={}),i.layerDefinition.definitionExpression=i.layerDefinition.definitionExpression?`(${i.layerDefinition.definitionExpression}) AND (${t})`:t),o.hasHighlight?.()&&"getHighlightIds"in o){const t=o;i.selectionObjectIds=t.getHighlightIds(),i.selectionSymbol=v(e.geometryType,t.highlightOptions??l.highlightOptions)}}var p;return i}async function G(e,t,a){if("binning"===e.featureReduction?.type||"cluster"===e.featureReduction?.type)return ae(e,t,a);e.legendEnabled&&a.legendLayers.push({id:e.id});return W(e,await fe(t.layerView),t.printTemplate,a)}async function H(e,{printTemplate:t},a){return W(e,null,t,a)}function Q(e,t){e.legendEnabled&&t.legendLayers.push({id:e.id});const a={layerType:(i=me(e)).layerType,customParameters:i.customParameters};var i;return a.bandIds=e.bandIds,a.compressionQuality=e.compressionQuality,a.format=e.format,a.interpolation=e.interpolation,(e.mosaicRule||e.definitionExpression)&&(a.mosaicRule=e.exportImageServiceParameters.mosaicRule.toJSON()),e.rasterFunction&&(a.renderingRule=e.rasterFunction.toJSON()),e.renderer&&(a.layerDefinition??={},a.layerDefinition.drawingInfo??={},a.layerDefinition.drawingInfo.renderer=e.renderer.toJSON()),ue(a,e),a}async function X(e,t,a){if("flow"===e.renderer?.type)return ae(e,t,a);e.legendEnabled&&a.legendLayers.push({id:e.id});const i={bandIds:(r=me(e)).bandIds,customParameters:r.customParameters,interpolation:r.interpolation,layerDefinition:r.layerDefinition};var r;return i.layerType="ArcGISImageServiceLayer",ue(i,e),i}async function Y(e,t,a){const i=t.printTemplate;if(!e.portalItem||"public"===e.portalItem.access){const t=me(e,"web-map");return t.type="kml",delete t.layerType,t.url=o(e.url),t}const r=[],n=t.layerView;n.allVisibleMapImages.forEach(((t,a)=>{const i={id:`${e.id}_image${a}`,type:"image",title:e.id,minScale:e.minScale||0,maxScale:e.maxScale||0,opacity:n.fullOpacity,extent:t.extent};"data:image/png;base64,"===t.href.substr(0,22)?i.imageData=t.href.substr(22):i.url=t.href,r.push(i)}));const s=[...n.allVisiblePoints.items,...n.allVisiblePolylines.items,...n.allVisiblePolygons.items],l={id:e.id,...await W(null,s,i,a)};return r.push(l),r}function Z(e,{view:t},a){let i;const r={id:e.id,subLayerIds:[]};let n=[];const o=t.scale,s=e=>{const t=0===o,a=0===e.minScale||o<=e.minScale,i=0===e.maxScale||o>=e.maxScale;if(e.visible&&(t||a&&i))if(e.sublayers)e.sublayers.forEach(s);else{const t=e.toExportImageJSON(),a={id:e.id,name:e.title,layerDefinition:{drawingInfo:t.drawingInfo,definitionExpression:t.definitionExpression,source:t.source}};n.unshift(a),r.subLayerIds.push(e.id)}};var l;return e.sublayers&&e.sublayers.forEach(s),n.length&&(n=n.map((({id:e,name:t,layerDefinition:a})=>({id:e,name:t,layerDefinition:a}))),i={layerType:(l=me(e)).layerType,customParameters:l.customParameters},i.layers=n,i.visibleLayers=e.capabilities?.exportMap?.supportsDynamicLayers?void 0:r.subLayerIds,ue(i,e),e.legendEnabled&&a.legendLayers.push(r)),i}async function ee({layerView:e,printTemplate:t},a){const i=[],r=e.layer;if(null!=r.featureCollections)for(const n of r.featureCollections){const e=await W(n,n.source,t,a);e&&i.push(...e.featureCollection.layers)}else if(null!=r.sublayers)for(const n of r.sublayers){const e=await W(null,n.graphics,t,a);e&&i.push(...e.featureCollection.layers)}return{featureCollection:{layers:i}}}function te(){return{type:"OpenStreetMap"}}async function ae(e,{printTemplate:t,view:a},r){const n={type:"image"},o={format:"png",ignoreBackground:!0,ignorePadding:!0,layers:[e]};0!==a.rotation&&(o.rotation=0);const l=r.ssExtent||a.state.extent.clone();let c=96,u=!0,y=!0;if(t.exportOptions){const e=t.exportOptions;null!=e.dpi&&e.dpi>0&&(c=e.dpi),null!=e.width&&e.width>0&&(u=e.width%2==a.width%2),null!=e.height&&e.height>0&&(y=e.height%2==a.height%2)}if("map-only"===t.layout&&t.scalePreserved&&(!t.outScale||t.outScale===a.scale)&&96===c&&(!u||!y)&&a.state.extent.equals(a.extent)&&(o.area={x:0,y:0,width:a.width,height:a.height},u||(o.area.width-=1),y||(o.area.height-=1),!r.ssExtent)){const e=a.toMap(i(o.area.width,o.area.height));l.ymin=e.y,l.xmax=e.x,r.ssExtent=l}n.extent=l.clone()._normalize(!0).toJSON();const p=await a.takeScreenshot(o);return n.imageData=s(p.dataUrl)?.data,n}async function ie(e,{layerView:t,printTemplate:a},i){e.legendEnabled&&i.legendLayers.push({id:e.id});return W(e,await fe(t),a,i)}async function re(e){const t=[],a=[];for(const r of e.map.allTables)"feature"!==r.type||r.loaded||a.push(r.load());a.length&&await Promise.allSettled(a);for(const r of e.map.allTables)if("feature"===r.type&&r.loaded&&r.isTable&&"feature-layer"===r.source?.type){const e={id:(i=me(r)).id,title:i.title,customParameters:i.customParameters,layerDefinition:{definitionExpression:i.layerDefinition?.definitionExpression},url:i.url};ue(e,r),t.push(e)}var i;return t.length?t:void 0}function ne(e,t){e.legendEnabled&&t.legendLayers.push({id:e.id});const a={layerType:(i=me(e)).layerType,customParameters:i.customParameters};var i;return ue(a,e),a}async function oe(e,t,a){if(e.serviceUrl&&e.styleUrl){const t=f(e.styleUrl,e.apiKey),i=f(e.serviceUrl,e.apiKey);if(!t&&!i||"2.1.0"!==a.cimVersion){const a={type:"VectorTileLayer"};return a.styleUrl=o(e.styleUrl),a.token=t,i!==t&&(a.additionalTokens=[{url:e.serviceUrl,token:i}]),a}}return ae(e,t,a)}function se(e){const t=e.urlTemplate?.replace(/\${/g,"{"),a={type:"WebTiledLayer",urlTemplate:t,credits:e.copyright};return e.subDomains&&e.subDomains.length>0&&(a.subDomains=e.subDomains),a}function le(e,t){let a;const i=[],r=e=>{e.visible&&(e.sublayers?e.sublayers.forEach(r):e.name&&i.unshift(e.name))};return e.sublayers&&e.sublayers.forEach(r),i.length&&(e.legendEnabled&&t.legendLayers.push({id:e.id,subLayerIds:i}),a={type:"wms",customLayerParameters:e.customLayerParameters,customParameters:e.customParameters,transparentBackground:e.imageTransparency,visibleLayers:i,url:o(e.url),version:e.version}),a}function ce(e){const t=e.activeLayer;return{type:"wmts",customLayerParameters:e.customLayerParameters,customParameters:e.customParameters,format:t.imageFormat,layer:t.id,style:t.styleId,tileMatrixSet:t.tileMatrixSetId,url:o(e.url)}}function ue(e,t){t.url&&(e.url=o(e.url||t.url),e.token=f(e.url,t.apiKey))}async function ye(e,a){a.canvas||(a.canvas=document.createElement("canvas"));const i=1024;a.canvas.width=i,a.canvas.height=i;const o=a.canvas.getContext("2d");let s,l;if(e.path){const t=new Path2D(e.path);t.closePath(),o.fillStyle=Array.isArray(e.color)?`rgba(${e.color[0]},${e.color[1]},${e.color[2]},${e.color[3]/255})`:"rgb(0,0,0)",o.fill(t);const a=D(o);if(!a)return null;o.clearRect(0,0,i,i);const n=r(e.size)/Math.max(a.width,a.height);o.scale(n,n);const c=i/n,u=c/2-a.width/2-a.x,y=c/2-a.height/2-a.y;if(o.translate(u,y),Array.isArray(e.color)&&o.fill(t),e.outline?.width&&Array.isArray(e.outline.color)){const i=e.outline;o.lineWidth=r(i.width)/n,o.lineJoin="round",o.strokeStyle=`rgba(${i.color[0]},${i.color[1]},${i.color[2]},${i.color[3]/255})`,o.stroke(t),a.width+=o.lineWidth,a.height+=o.lineWidth}a.width*=n,a.height*=n;const p=o.getImageData(i/2-a.width/2,i/2-a.height/2,Math.ceil(a.width),Math.ceil(a.height));s=p.width,l=p.height,o.canvas.width=s,o.canvas.height=l,o.putImageData(p,0,0)}else{const a="image/svg+xml"===e.contentType?"data:image/svg+xml;base64,"+e.imageData:e.url,i=(await t(a,{responseType:"image"})).data;s=r(e.width),l=r(e.height),o.canvas.width=s,o.canvas.height=l,o.drawImage(i,0,0,o.canvas.width,o.canvas.height)}return{type:"esriPMS",imageData:o.canvas.toDataURL("image/png").substr(22),angle:e.angle,contentType:"image/png",height:n(l),width:n(s),xoffset:e.xoffset,yoffset:e.yoffset}}async function pe(e,t){const a=e.type;if("simple"===a&&ge(e.symbol))e.symbol=await ye(e.symbol,t);else if("uniqueValue"===a||"classBreaks"===a){ge(e.defaultSymbol)&&(e.defaultSymbol=await ye(e.defaultSymbol,t));const i=e["uniqueValue"===a?"uniqueValueInfos":"classBreakInfos"];if(i)for(const e of i)ge(e.symbol)&&(e.symbol=await ye(e.symbol,t))}}async function fe(e){return e.queryFeatures(e.createQuery()).then((e=>e.features))}function me(e,t){return e.write({},{ignorePersistenceEnabled:!0,origin:t})??{}}function de(e){return e.gpMetadata?.executionType?N.fromJSON(e.gpMetadata.executionType):"sync"}function ge(e){return e&&(e.path||"image/svg+xml"===e.contentType||e.url?.endsWith(".svg"))}export{J as execute,A as getGpPrintParams,C as getGpServerUrl,j as getMode,k as getTasks,U as printCacheMap};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.31/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../Color.js";import r from"../../symbols/SimpleFillSymbol.js";import n from"../../symbols/SimpleLineSymbol.js";import t from"../../symbols/SimpleMarkerSymbol.js";import{isInEffectiveScaleRange as o}from"../../views/support/layerViewUtils.js";function i(){return{layerDefinition:{name:"multipointLayer",geometryType:"esriGeometryMultipoint",drawingInfo:{renderer:null}},featureSet:{geometryType:"esriGeometryMultipoint",features:[]}}}function l(){return{layerDefinition:{name:"polygonLayer",geometryType:"esriGeometryPolygon",drawingInfo:{renderer:null}},featureSet:{geometryType:"esriGeometryPolygon",features:[]}}}function f(){return{layerDefinition:{name:"pointLayer",geometryType:"esriGeometryPoint",drawingInfo:{renderer:null}},featureSet:{geometryType:"esriGeometryPoint",features:[]}}}function a(){return{layerDefinition:{name:"polylineLayer",geometryType:"esriGeometryPolyline",drawingInfo:{renderer:null}},featureSet:{geometryType:"esriGeometryPolyline",features:[]}}}function y(e,r=15){const n=e.canvas.width,t=e.canvas.height,o=e.getImageData(0,0,n,t).data;let i,l,f,a,y,s;e:for(l=t;l--;)for(i=n;i--;)if(o[4*(n*l+i)+3]>r){s=l;break e}if(!s)return null;e:for(i=n;i--;)for(l=s+1;l--;)if(o[4*(n*l+i)+3]>r){y=i;break e}e:for(i=0;i<=y;++i)for(l=s+1;l--;)if(o[4*(n*l+i)+3]>r){f=i;break e}e:for(l=0;l<=s;++l)for(i=f;i<=y;++i)if(o[4*(n*l+i)+3]>r){a=l;break e}return{x:f,y:a,width:y-f,height:s-a}}function s(o,i){const l=i.color?.clone()??new e([0,255,255]),f=i.haloColor?.clone()??l.clone();switch(o){case"envelope":case"polygon":return l.a*=i.fillOpacity??.25,new r({color:l,outline:new n({color:f}),style:"solid"});case"polyline":return new n({color:f});default:return f.a=1,new t({color:f,outline:null})}}function u(e,r){const n=e.allLayerViews.items;if(r===e.scale)return n.filter((e=>!e.suspended));const t=new Array;for(const i of n)d(i.parent)&&!t.includes(i.parent)||i.visible&&i.visibleAtCurrentTimeExtent&&o(i.layer.effectiveScaleRange,r)&&t.push(i);return t}function m(e){return"bing-maps"===e?.type}function c(e){return e&&"blendMode"in e&&"effect"in e}function p(e){return"csv"===e?.type}function d(e){return"esri.views.2d.layers.GroupLayerView2D"===e?.declaredClass}function g(e){const r=e.layer;if(c(r)){const n=r.blendMode;if((!n||"normal"===n)&&(r.effect||"featureEffect"in e&&e.featureEffect))return!0}return!1}export{i as createMultipointLayer,f as createPointLayer,l as createPolygonLayer,a as createPolylineLayer,y as getContextBoundingBox,s as getSelectionSymbol,u as getVisibleLayerViews,m as isBingMapsLayer,c as isBlendLayer,p as isCSVLayer,g as isScreenshotRequired};
5
+ import e from"../../Color.js";import r from"../../symbols/SimpleFillSymbol.js";import n from"../../symbols/SimpleLineSymbol.js";import t from"../../symbols/SimpleMarkerSymbol.js";import{isInEffectiveScaleRange as o}from"../../views/support/layerViewUtils.js";function i(){return{layerDefinition:{name:"multipointLayer",geometryType:"esriGeometryMultipoint",drawingInfo:{renderer:null}},featureSet:{geometryType:"esriGeometryMultipoint",features:[]}}}function l(){return{layerDefinition:{name:"polygonLayer",geometryType:"esriGeometryPolygon",drawingInfo:{renderer:null}},featureSet:{geometryType:"esriGeometryPolygon",features:[]}}}function f(){return{layerDefinition:{name:"pointLayer",geometryType:"esriGeometryPoint",drawingInfo:{renderer:null}},featureSet:{geometryType:"esriGeometryPoint",features:[]}}}function a(){return{layerDefinition:{name:"polylineLayer",geometryType:"esriGeometryPolyline",drawingInfo:{renderer:null}},featureSet:{geometryType:"esriGeometryPolyline",features:[]}}}function y(e,r=15){const n=e.canvas.width,t=e.canvas.height,o=e.getImageData(0,0,n,t).data;let i,l,f,a,y,u;e:for(l=t;l--;)for(i=n;i--;)if(o[4*(n*l+i)+3]>r){u=l;break e}if(!u)return null;e:for(i=n;i--;)for(l=u+1;l--;)if(o[4*(n*l+i)+3]>r){y=i;break e}e:for(i=0;i<=y;++i)for(l=u+1;l--;)if(o[4*(n*l+i)+3]>r){f=i;break e}e:for(l=0;l<=u;++l)for(i=f;i<=y;++i)if(o[4*(n*l+i)+3]>r){a=l;break e}return{x:f,y:a,width:y-f,height:u-a}}function u(o,i){const l=i.color?.clone()??new e([0,255,255]),f=i.haloColor?.clone()??l.clone();switch(o){case"envelope":case"polygon":return l.a*=i.fillOpacity??.25,new r({color:l,outline:new n({color:f}),style:"solid"});case"polyline":return new n({color:f});default:return f.a=1,new t({color:f,outline:null})}}function s(e,r){const n=e.allLayerViews.items;if(r===e.scale)return n.filter((e=>!e.suspended));const t=new Array;for(const i of n){const e=i.parent;e&&e!==i.view&&(g(e)||d(e))&&!t.includes(e)||i.visible&&i.visibleAtCurrentTimeExtent&&o(i.layer.effectiveScaleRange,r)&&t.push(i)}return t}function c(e){return"bing-maps"===e?.type}function m(e){return e&&"blendMode"in e&&"effect"in e}function p(e){return"csv"===e?.type}function g(e){return"catalog"===e.layer.type}function d(e){return"group"===e.layer.type}function w(e){const r=e.layer;if(m(r)){const n=r.blendMode;if((!n||"normal"===n)&&(r.effect||"featureEffect"in e&&e.featureEffect))return!0}return!1}export{i as createMultipointLayer,f as createPointLayer,l as createPolygonLayer,a as createPolylineLayer,y as getContextBoundingBox,u as getSelectionSymbol,s as getVisibleLayerViews,c as isBingMapsLayer,m as isBlendLayer,p as isCSVLayer,w as isScreenshotRequired};