@arcgis/core 4.27.0-rc.2 → 4.27.0-rc.4

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 (192) hide show
  1. package/assets/esri/core/workers/RemoteClient.js +1 -1
  2. package/assets/esri/core/workers/chunks/{a8565d1c676f3bfbcebb.js → 002fe1ec63ea33e6972d.js} +1 -1
  3. package/assets/esri/core/workers/chunks/09e677ca7532a281d262.js +1 -0
  4. package/assets/esri/core/workers/chunks/0f7ddb063ee0664f2fca.js +1 -0
  5. package/assets/esri/core/workers/chunks/17ab08f60764244b2cf8.js +1 -0
  6. package/assets/esri/core/workers/chunks/1aa8dd317ecd3c41e0ea.js +1 -0
  7. package/assets/esri/core/workers/chunks/28c67c98039503b62e6e.js +1 -0
  8. package/assets/esri/core/workers/chunks/{2446e336b1f7256d4fde.js → 2c587ed66e2586cccb8d.js} +1 -1
  9. package/assets/esri/core/workers/chunks/3767b9e7660873b018c2.js +1 -0
  10. package/assets/esri/core/workers/chunks/{00c7b9fb375c9a934158.js → 38c6452dc9cf18e8bca8.js} +1 -1
  11. package/assets/esri/core/workers/chunks/39ae4b9b766f674bc6f2.js +1 -0
  12. package/assets/esri/core/workers/chunks/45629ff775e77234b227.js +1 -0
  13. package/assets/esri/core/workers/chunks/{16db0bc87d87a7313dc4.js → 4806df402845c717c842.js} +1 -1
  14. package/assets/esri/core/workers/chunks/4884432d80e9af947449.js +1 -0
  15. package/assets/esri/core/workers/chunks/4a4f14a3d8da270059c4.js +1 -0
  16. package/assets/esri/core/workers/chunks/588cd91d08cec5207be1.js +1 -0
  17. package/assets/esri/core/workers/chunks/{83e3d104886b48f00397.js → 633c00c02a81397fc8df.js} +1 -1
  18. package/assets/esri/core/workers/chunks/{efb96aefe979a0f5c632.js → 640e8ac3498be30c6614.js} +1 -1
  19. package/assets/esri/core/workers/chunks/642c5a93c0a454bdd115.js +1 -0
  20. package/assets/esri/core/workers/chunks/{14145959a3dab1437818.js → 6627f1bc9ee6b620e3aa.js} +1 -1
  21. package/assets/esri/core/workers/chunks/{33901eb1574e46abd9af.js → 6c213768715c52625855.js} +1 -1
  22. package/assets/esri/core/workers/chunks/{5e6471dd2a08e66b47d0.js → 6e4940fe3bba014c921b.js} +57 -58
  23. package/assets/esri/core/workers/chunks/{170bdbdb4e21bf91a17f.js → 6eaa7a51efde2dd4a5a4.js} +1 -1
  24. package/assets/esri/core/workers/chunks/{0407bf97ad621c89a734.js → 6f724f75f85dc3989d60.js} +1 -1
  25. package/assets/esri/core/workers/chunks/{2bdc63395c7466ce1641.js → 7053c2f5a958d4c8629b.js} +1 -1
  26. package/assets/esri/core/workers/chunks/{4c35c663528f710e8c78.js → 79cb672c85ea29e8484a.js} +1 -1
  27. package/assets/esri/core/workers/chunks/82939ead43848a13f765.js +1 -0
  28. package/assets/esri/core/workers/chunks/8b05fb365336cc42fecc.js +1 -0
  29. package/assets/esri/core/workers/chunks/8b6b963230df56850580.js +1 -0
  30. package/assets/esri/core/workers/chunks/8eec6da5e862cc33ea2b.js +1 -0
  31. package/assets/esri/core/workers/chunks/90d8f297d9cb359e071d.js +1 -0
  32. package/assets/esri/core/workers/chunks/91785144901dfe56c5e2.js +1 -0
  33. package/assets/esri/core/workers/chunks/{471f6eba213412b82840.js → 927417abea79c955b216.js} +1 -1
  34. package/assets/esri/core/workers/chunks/9472184ef1432fc55d6b.js +1 -0
  35. package/assets/esri/core/workers/chunks/{adaa9d4239f4e905d011.js → 9d4bd73dd50400e9d328.js} +1 -1
  36. package/assets/esri/core/workers/chunks/a324cc07d486061d0d8e.js +1 -0
  37. package/assets/esri/core/workers/chunks/a40130579791293cefa2.js +1 -0
  38. package/assets/esri/core/workers/chunks/{3e239bfad611985e50fb.js → a49718c74053314ed741.js} +1 -1
  39. package/assets/esri/core/workers/chunks/a80a6267d88246ede5d3.js +1 -0
  40. package/assets/esri/core/workers/chunks/ad2891985e0fe45aa8d2.js +1 -0
  41. package/assets/esri/core/workers/chunks/afcba35eea836aea98ca.js +1 -0
  42. package/assets/esri/core/workers/chunks/b3d2e397ea74ebef4423.js +1 -0
  43. package/assets/esri/core/workers/chunks/b5fb9da45cc9dee286f8.js +1 -0
  44. package/assets/esri/core/workers/chunks/{f505ebd4bd3bfb6c790d.js → b6a55fdfe16795ebf02c.js} +1 -1
  45. package/assets/esri/core/workers/chunks/b846d4215210aac9f6ef.js +1 -0
  46. package/assets/esri/core/workers/chunks/c7dc821db8c14fec24a7.js +1 -0
  47. package/assets/esri/core/workers/chunks/c9df9a0a4a45f9a53ce9.js +1 -0
  48. package/assets/esri/core/workers/chunks/{45a4041881e6235d73a2.js → d0a9711f48dfa5fee68a.js} +1 -1
  49. package/assets/esri/core/workers/chunks/{1f69fb9687de9ebfcf90.js → d4ba894a2583f3930a4f.js} +1 -1
  50. package/assets/esri/core/workers/chunks/d5dfd3d693d5e393a542.js +1 -0
  51. package/assets/esri/core/workers/chunks/{74fd2059ddda9083cbcc.js → dc6c97a43d642eeaf477.js} +1 -1
  52. package/assets/esri/core/workers/chunks/e23ec4f867c4735eec20.js +1 -0
  53. package/assets/esri/core/workers/chunks/ea16230a0edfc9f756bd.js +1 -0
  54. package/assets/esri/core/workers/chunks/{2154d395f405be3cd3ba.js → eca0c3d57b3a1e3a14ee.js} +1 -1
  55. package/assets/esri/core/workers/chunks/ef900614353505afb210.js +1 -0
  56. package/assets/esri/core/workers/chunks/f36697f6aac782007d1a.js +1 -0
  57. package/assets/esri/core/workers/chunks/f52054f27619a98b7bb7.js +1 -0
  58. package/assets/esri/core/workers/chunks/fb7fe307a583b6a22218.js +1 -0
  59. package/assets/esri/core/workers/chunks/fbd3c78ee8e2219a6c7a.js +1 -0
  60. package/assets/esri/images/portal/livestreamvideolayer16.png +0 -0
  61. package/assets/esri/images/portal/{mediaservice16.png → videolayer16.png} +0 -0
  62. package/assets/esri/themes/base/_View.scss +2 -5
  63. package/assets/esri/themes/base/widgets/_Feature.scss +12 -4
  64. package/assets/esri/themes/base/widgets/_FeatureForm.scss +19 -2
  65. package/assets/esri/themes/dark/main.css +1 -1
  66. package/assets/esri/themes/light/main.css +1 -1
  67. package/assets/esri/themes/light/view.css +1 -1
  68. package/chunks/DefaultMaterial.glsl.js +42 -42
  69. package/chunks/Terrain.glsl.js +7 -7
  70. package/copyright.txt +1 -1
  71. package/geometry/Mesh.js +1 -1
  72. package/geometry/support/DoubleArray.js +1 -1
  73. package/geometry/support/meshUtils/bounds.js +1 -1
  74. package/geometry/support/meshUtils/georeference.js +1 -1
  75. package/interfaces.d.ts +87 -3
  76. package/kernel.js +1 -1
  77. package/layers/OrientedImageryLayer.js +1 -1
  78. package/layers/SceneLayer.js +1 -1
  79. package/layers/VideoLayer.js +1 -1
  80. package/layers/graphics/controllers/I3SOnDemandController.js +1 -1
  81. package/layers/graphics/editingSupport.js +1 -1
  82. package/layers/graphics/sources/FeatureLayerSource.js +1 -1
  83. package/layers/graphics/sources/OGCFeatureSource.js +1 -1
  84. package/layers/graphics/sources/support/clientSideDefaults.js +1 -1
  85. package/layers/graphics/sources/support/uploadAssets.js +1 -1
  86. package/layers/mixins/ArcGISImageService.js +1 -1
  87. package/layers/mixins/ImageryTileMixin.js +1 -1
  88. package/layers/orientedImagery/core/ExposurePoint.js +1 -1
  89. package/layers/orientedImagery/core/bestImageUtils.js +1 -1
  90. package/layers/orientedImagery/core/coverageUtils.js +1 -1
  91. package/layers/orientedImagery/transformations/groundToImageUtils.js +1 -1
  92. package/layers/orientedImagery/transformations/imageToGroundUtils.js +1 -1
  93. package/layers/support/SubtypeSublayer.js +1 -1
  94. package/layers/support/capabilities.js +1 -1
  95. package/layers/support/editableLayers.js +1 -1
  96. package/layers/support/layerUtils.js +1 -1
  97. package/layers/support/serviceCapabilitiesUtils.js +1 -1
  98. package/layers/video/VideoCameraSensorModel.js +5 -0
  99. package/layers/video/VideoController.js +1 -1
  100. package/layers/video/videoUtils.js +1 -1
  101. package/package.json +1 -1
  102. package/portal/PortalItem.js +1 -1
  103. package/renderers/support/colorRampUtils.js +1 -1
  104. package/request.js +1 -1
  105. package/rest/support/meshFeatureSet.js +1 -1
  106. package/smartMapping/labels/bins.js +5 -0
  107. package/smartMapping/labels/clusters.js +1 -1
  108. package/smartMapping/labels/support/utils.js +5 -0
  109. package/smartMapping/support/binningUtils.js +1 -1
  110. package/support/requestUtils.js +1 -1
  111. package/support/revision.js +1 -1
  112. package/views/2d/layers/features/schemaUtils.js +1 -1
  113. package/views/3d/interactive/editingTools/draw/DrawGraphicTool3D.js +1 -1
  114. package/views/3d/layers/I3SMeshView3D.js +1 -1
  115. package/views/3d/layers/I3SMeshViewLabeler.js +1 -1
  116. package/views/3d/layers/I3SMeshWorkerHandle.js +1 -1
  117. package/views/3d/layers/SceneLayerWorker.js +1 -1
  118. package/views/3d/layers/graphics/Graphics3DMeshFillSymbolLayer.js +1 -1
  119. package/views/3d/layers/i3s/I3SClientMaterialUtil.js +5 -0
  120. package/views/3d/layers/i3s/I3SClientNodeLoader.js +1 -1
  121. package/views/3d/layers/i3s/I3SGeometryUtil.js +1 -1
  122. package/views/3d/layers/i3s/I3SOverrides.js +1 -1
  123. package/views/3d/terrain/TerrainRenderer.js +1 -1
  124. package/views/3d/webgl-engine/core/shaderLibrary/default/DefaultMaterialAuxiliaryPasses.glsl.js +19 -20
  125. package/views/3d/webgl-engine/core/shaderLibrary/shading/ReadShadowMap.glsl.js +2 -2
  126. package/views/3d/webgl-engine/core/shaderLibrary/terrain/TerrainTexture.glsl.js +9 -9
  127. package/views/3d/webgl-engine/lib/ShadowMap.js +1 -1
  128. package/views/3d/webgl-engine/shaders/DefaultMaterial.glsl.js +1 -1
  129. package/views/DOMContainer.js +1 -1
  130. package/views/PopupView.js +1 -1
  131. package/views/ui/DefaultUI.js +1 -1
  132. package/views/ui/UI.js +1 -1
  133. package/webmap/initialViewPropertiesUtils.js +1 -1
  134. package/widgets/Editor/CreateFeaturesWorkflow.js +1 -1
  135. package/widgets/Editor/CreateWorkflow.js +1 -1
  136. package/widgets/Editor/EditorViewModel.js +1 -1
  137. package/widgets/Editor/UpdateFeatureWorkflow.js +1 -1
  138. package/widgets/Editor/UpdateWorkflow.js +1 -1
  139. package/widgets/Editor/UpdateWorkflowData.js +1 -1
  140. package/widgets/Editor/workflowUtils.js +1 -1
  141. package/widgets/Feature/support/featureUtils.js +1 -1
  142. package/widgets/FeatureForm/FeatureFormViewModel.js +1 -1
  143. package/widgets/FeatureForm/FormExpressionsManager.js +1 -1
  144. package/widgets/FeatureForm/RelationshipInput.js +1 -1
  145. package/widgets/FeatureForm/css.js +1 -1
  146. package/widgets/FeatureForm.js +1 -1
  147. package/widgets/FeatureTemplates/FeatureTemplatesViewModel.js +1 -1
  148. package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
  149. package/widgets/OrientedImageryViewer.js +1 -1
  150. package/widgets/Popup.js +1 -1
  151. package/widgets/UtilityNetworkValidateTopology/UtilityNetworkValidateTopologyViewModel.d.ts +4 -0
  152. package/widgets/UtilityNetworkValidateTopology/UtilityNetworkValidateTopologyViewModel.js +1 -1
  153. package/widgets/UtilityNetworkValidateTopology.d.ts +4 -0
  154. package/widgets/support/geolocationUtils.js +1 -1
  155. package/assets/esri/core/workers/chunks/0610691a0c0d9fbbd6d2.js +0 -1
  156. package/assets/esri/core/workers/chunks/0618fb0058f39ecd363f.js +0 -1
  157. package/assets/esri/core/workers/chunks/0fcb8d408696075338e2.js +0 -1
  158. package/assets/esri/core/workers/chunks/16e459b16bdd6e1a821b.js +0 -1
  159. package/assets/esri/core/workers/chunks/1b8074269800b384ecf6.js +0 -1
  160. package/assets/esri/core/workers/chunks/2b55295590b4a0503749.js +0 -1
  161. package/assets/esri/core/workers/chunks/3ba2fcb9110230f8790c.js +0 -1
  162. package/assets/esri/core/workers/chunks/5576858f56314afcb4d5.js +0 -1
  163. package/assets/esri/core/workers/chunks/5706edf45402dff279a6.js +0 -1
  164. package/assets/esri/core/workers/chunks/624521961fe1f2c4f2c5.js +0 -1
  165. package/assets/esri/core/workers/chunks/659b7bad7281c0e2aed3.js +0 -1
  166. package/assets/esri/core/workers/chunks/6cd248d065f6d1616294.js +0 -1
  167. package/assets/esri/core/workers/chunks/6f510f28526c73ab453c.js +0 -1
  168. package/assets/esri/core/workers/chunks/7479dc0c790337af7597.js +0 -1
  169. package/assets/esri/core/workers/chunks/9326120c750799eb2d28.js +0 -1
  170. package/assets/esri/core/workers/chunks/99e0cec47e3ef72c1de4.js +0 -1
  171. package/assets/esri/core/workers/chunks/9c0e1e87790424f42d7e.js +0 -1
  172. package/assets/esri/core/workers/chunks/9e66af3b1c70cf25fb32.js +0 -1
  173. package/assets/esri/core/workers/chunks/a1c31bb8c12831539328.js +0 -1
  174. package/assets/esri/core/workers/chunks/a7fd2a95fde197c06828.js +0 -1
  175. package/assets/esri/core/workers/chunks/b0cda39b53ecd6c44cd0.js +0 -1
  176. package/assets/esri/core/workers/chunks/b8e6c64792a512df4c4d.js +0 -1
  177. package/assets/esri/core/workers/chunks/c08e03165043df67c11b.js +0 -1
  178. package/assets/esri/core/workers/chunks/c26148d4bfab3b3dfab2.js +0 -1
  179. package/assets/esri/core/workers/chunks/c96db6b7ce47bd343fdb.js +0 -1
  180. package/assets/esri/core/workers/chunks/d6b6bb8aecc85d2a3f6b.js +0 -1
  181. package/assets/esri/core/workers/chunks/d95ca50ca7af4c222036.js +0 -1
  182. package/assets/esri/core/workers/chunks/da57eba2fe25495ea217.js +0 -1
  183. package/assets/esri/core/workers/chunks/ee5ee03dd2c7dc940272.js +0 -1
  184. package/assets/esri/core/workers/chunks/eeaf8010e38b65a101ac.js +0 -1
  185. package/assets/esri/core/workers/chunks/f235392c56063fbf89c6.js +0 -1
  186. package/assets/esri/core/workers/chunks/f720967ba8c5486a26a2.js +0 -1
  187. package/assets/esri/core/workers/chunks/fdd0d3616c97e408b104.js +0 -1
  188. package/layers/orientedImagery/core/Affixes.js +0 -5
  189. package/layers/orientedImagery/core/CameraProperties.js +0 -5
  190. package/layers/orientedImagery/core/ImageProperties.js +0 -5
  191. package/layers/orientedImagery/core/ImageryTypes.js +0 -5
  192. package/layers/orientedImagery/core/imageryUtils.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.27/esri/copyright.txt for details.
4
4
  */
5
- import e from"../support/VideoTimeExtent.js";function n(n){const{duration:t,end:o,start:r,timezone:u="UTC"}=n||{};return"number"!=typeof t?null:new e({duration:t||null,end:"number"==typeof o?new Date(o):null,start:"number"==typeof r?new Date(r):null,timezone:u})}export{n as readVideoTimeExtent};
5
+ import e from"../support/VideoTimeExtent.js";const t={UASDatalinkLocalSet:1e4,PrecisionTimeStamp:10002,MissionId:10003,PlatformTailNumber:10004,PlatformHeadingAngle:10005,PlatformPitchAngle:10006,PlatformRollAngle:10007,PlatformTrueAirspeed:10008,PlatformIndicatedAirspeed:10009,PlatformDesignation:10010,ImageSourceSensor:10011,ImageCoordinateSystem:10012,SensorLatitude:10013,SensorLongitude:10014,SensorTrueAltitude:10015,SensorHorizontalFOV:10016,SensorVerticalFOV:10017,SensorAzimuthAngle:10018,SensorElevationAngle:10019,SensorRollAngle:10020,PlatformSlantRange:10021,TargetWidth:10022,FrameCenterLatitude:10023,FrameCenterLongitude:10024,FrameCenterElevation:10025,OffsetCorner1Latitude:10026,OffsetCorner1Longitude:10027,OffsetCorner2Latitude:10028,OffsetCorner2Longitude:10029,OffsetCorner3Latitude:10030,OffsetCorner3Longitude:10031,OffsetCorner4Latitude:10032,OffsetCorner4Longitude:10033,TargetLocationLatitude:10040,TargetLocationLongitude:10041,TargetLocationElevation:10042,TargetTrackGateWidth:10043,TargetTrackGateHeight:10044,TargetErrorEstimateHorizontal:10045,TargetErrorEstimateLateral:10046,GenericFlagData:10047,PlatformGroundSpeed:10056,PlatformGroundRange:10057,PlatformRemainingFuel:10058,PlatformCallSign:10059,SensorFOVName:10063,PlatformMagneticHeading:10064,LDSVersionNumber:10065,AlternatePlatformName:10070,EventStartTimeUTC:10072,VMTIDataSet:10074,SensorEllipsoidHeight:10075,OperationalMode:10077,CornerLatitudePoint1:10082,CornerLongitudePoint1:10083,CornerLatitudePoint2:10084,CornerLongitudePoint2:10085,CornerLatitudePoint3:10086,CornerLongitudePoint3:10087,CornerLatitudePoint4:10088,CornerLongitudePoint4:10089,SARMotionImageryMetadata:10095,SecurityClassification:20001,SecurityClassifyingAuthority:20002,SecurityClassifyingCountry:20003,SecuritySCI:20004,SecurityCaveats:20005,SecurityReleaseInstructions:20006,SecurityLDSVersion:20022,EsriVideoWidth:90001,EsriVideoHeight:90002,ModelFrameCenterLatitude:90050,ModelFrameCenterLongitude:90051,CornerLatitudePt1:90052,CornerLongitudePt1:90053,CornerLatitudePt2:90054,CornerLongitudePt2:90055,CornerLatitudePt3:90056,CornerLongitudePt3:90057,CornerLatitudePt4:90058,CornerLongitudePt4:90059,FrameOutline:90060,SensorPosition:90061};function r(e){const{screenX:t,screenY:r,videoFrameHeight:n,videoFrameWidth:o,videoPlayerHeight:i,videoPlayerWidth:a}=e;return{x:o/a*t,y:n/i*-r}}function n(t){const{duration:r,end:n,start:o,timezone:i="UTC"}=t||{};return"number"!=typeof r?null:new e({duration:r||null,end:"number"==typeof n?new Date(n):null,start:"number"==typeof o?new Date(o):null,timezone:i})}export{t as VideoMetadataEntryId,r as convertScreenXYToVideoXY,n as readVideoTimeExtent};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arcgis/core",
3
- "version": "4.27.0-rc.2",
3
+ "version": "4.27.0-rc.4",
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": [
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.27/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../chunks/tslib.es6.js";import{getAssetUrl as t}from"../assets.js";import{id as i}from"../kernel.js";import r from"../core/Error.js";import{JSONSupportMixin as o}from"../core/JSONSupport.js";import{clone as s,fixJson as a}from"../core/lang.js";import n from"../core/Loadable.js";import{unwrapOrThrow as l}from"../core/maybe.js";import{isDataProtocol as p,makeAbsolute as c}from"../core/urlUtils.js";import{property as d}from"../core/accessorSupport/decorators/property.js";import{ensureClass as u}from"../core/accessorSupport/ensureType.js";import{reader as m}from"../core/accessorSupport/decorators/reader.js";import{subclass as h}from"../core/accessorSupport/decorators/subclass.js";import g from"../geometry/Extent.js";import y from"./Portal.js";import w from"./PortalItemResource.js";import v from"./PortalRating.js";var f;const b=new Set(["Map Service","Feature Service","Feature Collection","Scene Service","Image Service","Stream Service","Vector Tile Service","GeoJson","CSV","KML","WFS","WMTS","WMS","Feed"]),k=new Set(["KML","GeoJson","CSV"]);let S=f=class extends(o(n)){static from(e){return u(f,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":"Geocoding Service"===e?i="Locator":"Geoenrichment Service"===e?i="GeoEnrichment Service":"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&&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)":"OGCFeatureServer"===e?i="OGC Feature Layer":"web mapping application"===e&&t.includes("configurableApp")?i="Instant App":"Insights Page"===e&&(i="Insights Report"),i}readExtent(e){return e&&e.length?new g(e[0][0],e[0][1],e[1][0],e[1][1]):null}get iconUrl(){const e=this.type&&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;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":a?"featureshosted":d?"utilitynetwork":"features"):s="map service"===e||"wms"===e||"wmts"===e?a||i.includes("Tiled")||"wmts"===e?"maptiles":"mapimages":"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":"video service"===e?"mediaservice":"vector tile service"===e?"vectortile":"datastore catalog service"===e?"datastorecollection":"geocoding service"===e?"geocodeservice":"geoprocessing service"===e?i.includes("Web Tool")?"tool":"layers":"geodata service"===e?"geodataservice":"layers"):s="web map"===e||"cityengine web scene"===e?"maps":"web scene"===e?i.includes("ViewingMode-Local")?"webscenelocal":"websceneglobal":"web mapping application"===e&&i.includes("configurableApp")?"instantapps":"web mapping application"===e||"mobile application"===e||"application"===e||"operation view"===e||"desktop application"===e?"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")?"mapsgray":"service definition"===e||"csv"===e||"shapefile"===e||"cad drawing"===e||"geojson"===e||"netcdf"===e||"administrative report"===e?"datafiles":"explorer add in"===e||"desktop add in"===e||"windows viewer add in"===e||"windows viewer configuration"===e?"appsgray":"360 vr experience"===e?"360vr":"arcgis pro add in"===e||"arcgis pro configuration"===e?"addindesktop":"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||"form"===e||"document link"===e||"earth configuration"===e||"operations dashboard add in"===e||"rules package"===e||"image"===e||"workflow manager package"===e||"explorer map"===e&&i.includes("Explorer Mapping Application")||i.includes("Document")?"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?"toolsgray":"layer"===e||"layer package"===e||"explorer layer"===e?"layersgray":"scene package"===e?"scenepackage":"mobile scene package"===e?"mobilescenepackage":"tile package"===e||"compact tile package"===e?"tilepackage":"task file"===e?"taskfile":"report template"===e?"report-template":"statistical data collection"===e?"statisticaldatacollection":"insights workbook"===e?"workbook":"insights model"===e?"insightsmodel":"insights page"===e?"insightspage":"insights theme"===e?"insightstheme":"hub initiative"===e?"hubinitiative":"hubpage"===e?"hubpage":"hub event"===e?"hubevent":"hub site application"===e?"hubsite":"hub project"===e?"hubproject":"relational database connection"===e?"relationaldatabaseconnection":"big data file share"===e?"datastorecollection":"image collection"===e?"imagecollection":"style"===e?"style":"desktop style"===e?"desktopstyle":"dashboard"===e?"dashboard":"raster function template"===e?"rasterprocessingtemplate":"vector tile package"===e?"vectortilepackage":"ortho mapping project"===e?"orthomappingproject":"ortho mapping template"===e?"orthomappingtemplate":"solution"===e?"solutions":"geopackage"===e?"geopackage":"deep learning package"===e?"deeplearningpackage":"real time analytic"===e?"realtimeanalytics":"big data analytic"===e?"bigdataanalytics":"feed"===e?"feed":"excalibur imagery project"===e?"excaliburimageryproject":"notebook"===e?"notebook":"storymap"===e?"storymap":"survey123 add in"===e?"survey123addin":"mission"===e?"mission":"mission report"===e?"missionreport":"quickcapture project"===e?"quickcaptureproject":"pro report"===e?"proreport":"pro report template"===e?"proreporttemplate":"urban model"===e?"urbanmodel":"web experience"===e?"experiencebuilder":"web experience template"===e?"webexperiencetemplate":"experience builder widget"===e?"experiencebuilderwidget":"experience builder widget package"===e?"experiencebuilderwidgetpackage":"workflow"===e?"workflow":"insights script"===e?"insightsscript":"kernel gateway connection"===e?"kernelgatewayconnection":"hub initiative template"===e?"hubinitiativetemplate":"storymap theme"===e?"storymaptheme":"knowledge graph"===e?"knowledgegraph":"native application"===e?"nativeapp":"native application installer"===e?"nativeappinstaller":"link chart"===e?"linkchart":"investigation"===e?"investigation":"ogcfeatureserver"===e?"features":"pro project"===e?"proproject":"insights workbook package"===e?"insightsworkbookpackage":"apache parquet"===e?"apacheparquet":"notebook code snippets"===e||"notebook code snippet library"===e?"notebookcodesnippets":"suitability model"===e?"suitabilitymodel":"esri classifier definition"===e?"classifierdefinition":"esri classification schema"===e?"classificationschema":"insights data engineering workbook"===e?"dataengineeringworkbook":"insights data engineering model"===e?"dataengineeringmodel":"deep learning studio project"===e?"deeplearningproject":"discussion"===e?"discussion":"allsource project"===e?"allsourceproject":"api key"===e?"apikey":"data pipeline"===e?"datapipelines":"maps",s?t(r+s+o+".png"):null}get isLayer(){return null!=this.type&&b.has(this.type)}get itemCdnUrl(){let e=this.itemUrl;return e&&i&&!i.findCredential(e)&&(e=i._normalizeAGOLorgDomain(e),e=e.replace(/^https?:\/\/www\.arcgis\.com/,"https://cdn.arcgis.com"),e=e.replace(/^https?:\/\/devext\.arcgis\.com/,"https://cdndev.arcgis.com"),e=e.replace(/^https?:\/\/qaext\.arcgis\.com/,"https://cdnqa.arcgis.com")),e}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.get("portal.restUrl");if(!e)return null;const t=this.owner||this.get("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=y.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 v&&(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 v({rating:e,created:new Date})):null}clone(){const e={access:this.access,accessInformation:this.accessInformation,applicationProxies:s(this.applicationProxies),avgRating:this.avgRating,categories:s(this.categories),created:s(this.created),culture:this.culture,description:this.description,extent:s(this.extent),groupCategories:s(this.groupCategories),id:this.id,itemControl:this.itemControl,licenseInfo:this.licenseInfo,modified:s(this.modified),name:this.name,numComments:this.numComments,numRatings:this.numRatings,numViews:this.numViews,owner:this.owner,ownerFolder:this.ownerFolder,portal:this.portal,screenshots:s(this.screenshots),size:this.size,snippet:this.snippet,sourceUrl:this.sourceUrl,spatialReference:this.spatialReference,tags:s(this.tags),thumbnail:this.thumbnail,title:this.title,type:this.type,typeKeywords:s(this.typeKeywords),url:this.url};this.loaded&&(e.loadStatus="loaded");const t=new f({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 l(this.portal).request(this.itemUrl+"/deleteRating",{method:"post"})}fetchData(e="json",t){return l(this.portal).request(this.itemUrl+"/data",{responseType:e,...t,query:{token:this.apiKey}})}async fetchRating(e){const t=await l(this.portal).request(this.itemUrl+"/rating",{query:{token:this.apiKey},...e});return null!=t.rating?(t.created=new Date(t.created),new v(t)):null}fetchRelatedItems(e,t){return l(this.portal).requestToTypedArray(this.itemUrl+"/relatedItems",{query:{...e,token:this.apiKey},...t},f)}getThumbnailUrl(e){let t=this.thumbnailUrl;return t&&e&&(t+=`&w=${e}`),t}reload(){return l(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((()=>l(this.portal).signIn())).then((()=>{const t=e&&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 r("portal:item-does-not-exist","The item does not exist yet and cannot be updated"))}async copy(e){if(!this.id)throw new r("portal:item-does-not-exist","The item does not exist yet");await this.load();const{portal:t,itemUrl:i}=this;await l(t).signIn();const{copyResources:o,folder:s,tags:a,title:n}=e||{},p={method:"post",query:{copyPrivateResources:"all"===o,folder:"string"==typeof s?s:s?.id,includeResources:!!o,tags:a?.join(","),title:n}},{itemId:c}=await t.request(`${i}/copy`,p);return new f({id:c,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)p(t)?r.query={data:t}:r.query={url:c(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 r("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{addOrUpdateResource:r}=await import("./support/resourceUtils.js");return e.portalItem=this,r(e,"add",t,i)}async removeResource(e,t){const{removeResource:i}=await import("./support/resourceUtils.js");if(e.portalItem&&e.portalItem.itemUrl!==this.itemUrl)throw new r("removeresource:portal-item-mismatch","The portal item associated with the provided resource does not match the item");return i(this,e,t)}async removeAllResources(e){const{removeAllResources:t}=await import("./support/resourceUtils.js");return t(this,e)}resourceFromPath(e){return new w({portalItem:this,path:e})}toJSON(){const e=this.extent,t={accessInformation:this.accessInformation,categories:s(this.categories),created:this.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&&this.modified.getTime(),name:this.name,owner:this.owner,ownerFolder:this.ownerFolder,snippet:this.snippet,sourceUrl:this.sourceUrl,spatialReference:this.spatialReference,tags:s(this.tags),thumbnail:this.thumbnail,title:this.title,type:this.type,typeKeywords:s(this.typeKeywords),url:this.url};return a(t)}static fromJSON(e){if(!e)return null;if(e.declaredClass)throw new Error("JSON object is already hydrated");return new f({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([d({type:["private","shared","org","public"]})],S.prototype,"access",void 0),e([d()],S.prototype,"accessInformation",void 0),e([d({type:String})],S.prototype,"apiKey",void 0),e([d({json:{read:{source:"appProxies"}}})],S.prototype,"applicationProxies",void 0),e([d()],S.prototype,"avgRating",void 0),e([d()],S.prototype,"categories",void 0),e([d({type:Date})],S.prototype,"created",void 0),e([d()],S.prototype,"culture",void 0),e([d()],S.prototype,"description",void 0),e([d({readOnly:!0})],S.prototype,"displayName",null),e([d({type:g})],S.prototype,"extent",void 0),e([m("extent")],S.prototype,"readExtent",null),e([d()],S.prototype,"groupCategories",void 0),e([d({readOnly:!0})],S.prototype,"iconUrl",null),e([d()],S.prototype,"id",void 0),e([d({readOnly:!0})],S.prototype,"isLayer",null),e([d({type:Boolean,readOnly:!0})],S.prototype,"isOrgItem",void 0),e([d()],S.prototype,"itemControl",void 0),e([d({readOnly:!0})],S.prototype,"itemPageUrl",null),e([d({readOnly:!0})],S.prototype,"itemUrl",null),e([d()],S.prototype,"licenseInfo",void 0),e([d({type:Date})],S.prototype,"modified",void 0),e([d()],S.prototype,"name",void 0),e([d()],S.prototype,"numComments",void 0),e([d()],S.prototype,"numRatings",void 0),e([d()],S.prototype,"numViews",void 0),e([d()],S.prototype,"owner",void 0),e([d()],S.prototype,"ownerFolder",void 0),e([d({type:y})],S.prototype,"portal",void 0),e([d()],S.prototype,"screenshots",void 0),e([d()],S.prototype,"size",void 0),e([d()],S.prototype,"snippet",void 0),e([d()],S.prototype,"sourceJSON",void 0),e([d({type:String})],S.prototype,"sourceUrl",void 0),e([d({type:String})],S.prototype,"spatialReference",void 0),e([d()],S.prototype,"tags",void 0),e([d()],S.prototype,"thumbnail",void 0),e([d({readOnly:!0})],S.prototype,"thumbnailUrl",null),e([d()],S.prototype,"title",void 0),e([d()],S.prototype,"type",void 0),e([d()],S.prototype,"typeKeywords",void 0),e([d({type:String,json:{read(e,t){if(k.has(t.type)){const t=this.portal?.restUrl;e||=t&&this.id?`${t}/content/items/${this.id}/data`:null}return e}}})],S.prototype,"url",void 0),e([d({readOnly:!0})],S.prototype,"userItemUrl",null),S=f=e([h("esri.portal.PortalItem")],S);const x=S;export{x as default};
5
+ import{_ as e}from"../chunks/tslib.es6.js";import{getAssetUrl as t}from"../assets.js";import{id as i}from"../kernel.js";import r from"../core/Error.js";import{JSONSupportMixin as o}from"../core/JSONSupport.js";import{clone as s,fixJson as a}from"../core/lang.js";import n from"../core/Loadable.js";import{unwrapOrThrow as l}from"../core/maybe.js";import{isDataProtocol as p,makeAbsolute as c}from"../core/urlUtils.js";import{property as d}from"../core/accessorSupport/decorators/property.js";import{ensureClass as u}from"../core/accessorSupport/ensureType.js";import{reader as m}from"../core/accessorSupport/decorators/reader.js";import{subclass as h}from"../core/accessorSupport/decorators/subclass.js";import g from"../geometry/Extent.js";import y from"./Portal.js";import v from"./PortalItemResource.js";import w from"./PortalRating.js";var f;const b=new Set(["Map Service","Feature Service","Feature Collection","Scene Service","Image Service","Stream Service","Vector Tile Service","GeoJson","CSV","KML","WFS","WMTS","WMS","Feed"]),k=new Set(["KML","GeoJson","CSV"]);let S=f=class extends(o(n)){static from(e){return u(f,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":"Geocoding Service"===e?i="Locator":"Geoenrichment Service"===e?i="GeoEnrichment Service":"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&&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)":"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"),i}readExtent(e){return e&&e.length?new g(e[0][0],e[0][1],e[1][0],e[1][1]):null}get iconUrl(){const e=this.type&&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;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":a?"featureshosted":d?"utilitynetwork":"features"):s="map service"===e||"wms"===e||"wmts"===e?a||i.includes("Tiled")||"wmts"===e?"maptiles":"mapimages":"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":"video service"===e?i.includes("Live Stream")?"livestreamvideolayer":"videolayer":"vector tile service"===e?"vectortile":"datastore catalog service"===e?"datastorecollection":"geocoding service"===e?"geocodeservice":"geoprocessing service"===e?i.includes("Web Tool")?"tool":"layers":"geodata service"===e?"geodataservice":"layers"):s="web map"===e||"cityengine web scene"===e?"maps":"web scene"===e?i.includes("ViewingMode-Local")?"webscenelocal":"websceneglobal":"web mapping application"===e&&i.includes("configurableApp")?"instantapps":"web mapping application"===e||"mobile application"===e||"application"===e||"operation view"===e||"desktop application"===e?"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")?"mapsgray":"service definition"===e||"csv"===e||"shapefile"===e||"cad drawing"===e||"geojson"===e||"netcdf"===e||"administrative report"===e?"datafiles":"explorer add in"===e||"desktop add in"===e||"windows viewer add in"===e||"windows viewer configuration"===e?"appsgray":"360 vr experience"===e?"360vr":"arcgis pro add in"===e||"arcgis pro configuration"===e?"addindesktop":"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||"form"===e||"document link"===e||"earth configuration"===e||"operations dashboard add in"===e||"rules package"===e||"image"===e||"workflow manager package"===e||"explorer map"===e&&i.includes("Explorer Mapping Application")||i.includes("Document")?"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?"toolsgray":"layer"===e||"layer package"===e||"explorer layer"===e?"layersgray":"scene package"===e?"scenepackage":"mobile scene package"===e?"mobilescenepackage":"tile package"===e||"compact tile package"===e?"tilepackage":"task file"===e?"taskfile":"report template"===e?"report-template":"statistical data collection"===e?"statisticaldatacollection":"insights workbook"===e?"workbook":"insights model"===e?"insightsmodel":"insights page"===e?"insightspage":"insights theme"===e?"insightstheme":"hub initiative"===e?"hubinitiative":"hubpage"===e?"hubpage":"hub event"===e?"hubevent":"hub site application"===e?"hubsite":"hub project"===e?"hubproject":"relational database connection"===e?"relationaldatabaseconnection":"big data file share"===e?"datastorecollection":"image collection"===e?"imagecollection":"style"===e?"style":"desktop style"===e?"desktopstyle":"dashboard"===e?"dashboard":"raster function template"===e?"rasterprocessingtemplate":"vector tile package"===e?"vectortilepackage":"ortho mapping project"===e?"orthomappingproject":"ortho mapping template"===e?"orthomappingtemplate":"solution"===e?"solutions":"geopackage"===e?"geopackage":"deep learning package"===e?"deeplearningpackage":"real time analytic"===e?"realtimeanalytics":"big data analytic"===e?"bigdataanalytics":"feed"===e?"feed":"excalibur imagery project"===e?"excaliburimageryproject":"notebook"===e?"notebook":"storymap"===e?"storymap":"survey123 add in"===e?"survey123addin":"mission"===e?"mission":"mission report"===e?"missionreport":"quickcapture project"===e?"quickcaptureproject":"pro report"===e?"proreport":"pro report template"===e?"proreporttemplate":"urban model"===e?"urbanmodel":"web experience"===e?"experiencebuilder":"web experience template"===e?"webexperiencetemplate":"experience builder widget"===e?"experiencebuilderwidget":"experience builder widget package"===e?"experiencebuilderwidgetpackage":"workflow"===e?"workflow":"insights script"===e?"insightsscript":"kernel gateway connection"===e?"kernelgatewayconnection":"hub initiative template"===e?"hubinitiativetemplate":"storymap theme"===e?"storymaptheme":"knowledge graph"===e?"knowledgegraph":"native application"===e?"nativeapp":"native application installer"===e?"nativeappinstaller":"link chart"===e?"linkchart":"investigation"===e?"investigation":"ogcfeatureserver"===e?"features":"pro project"===e?"proproject":"insights workbook package"===e?"insightsworkbookpackage":"apache parquet"===e?"apacheparquet":"notebook code snippets"===e||"notebook code snippet library"===e?"notebookcodesnippets":"suitability model"===e?"suitabilitymodel":"esri classifier definition"===e?"classifierdefinition":"esri classification schema"===e?"classificationschema":"insights data engineering workbook"===e?"dataengineeringworkbook":"insights data engineering model"===e?"dataengineeringmodel":"deep learning studio project"===e?"deeplearningproject":"discussion"===e?"discussion":"allsource project"===e?"allsourceproject":"api key"===e?"apikey":"data pipeline"===e?"datapipelines":"maps",s?t(r+s+o+".png"):null}get isLayer(){return null!=this.type&&b.has(this.type)}get itemCdnUrl(){let e=this.itemUrl;return e&&i&&!i.findCredential(e)&&(e=i._normalizeAGOLorgDomain(e),e=e.replace(/^https?:\/\/www\.arcgis\.com/,"https://cdn.arcgis.com"),e=e.replace(/^https?:\/\/devext\.arcgis\.com/,"https://cdndev.arcgis.com"),e=e.replace(/^https?:\/\/qaext\.arcgis\.com/,"https://cdnqa.arcgis.com")),e}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.get("portal.restUrl");if(!e)return null;const t=this.owner||this.get("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=y.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 w&&(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 w({rating:e,created:new Date})):null}clone(){const e={access:this.access,accessInformation:this.accessInformation,applicationProxies:s(this.applicationProxies),avgRating:this.avgRating,categories:s(this.categories),created:s(this.created),culture:this.culture,description:this.description,extent:s(this.extent),groupCategories:s(this.groupCategories),id:this.id,itemControl:this.itemControl,licenseInfo:this.licenseInfo,modified:s(this.modified),name:this.name,numComments:this.numComments,numRatings:this.numRatings,numViews:this.numViews,owner:this.owner,ownerFolder:this.ownerFolder,portal:this.portal,screenshots:s(this.screenshots),size:this.size,snippet:this.snippet,sourceUrl:this.sourceUrl,spatialReference:this.spatialReference,tags:s(this.tags),thumbnail:this.thumbnail,title:this.title,type:this.type,typeKeywords:s(this.typeKeywords),url:this.url};this.loaded&&(e.loadStatus="loaded");const t=new f({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 l(this.portal).request(this.itemUrl+"/deleteRating",{method:"post"})}fetchData(e="json",t){return l(this.portal).request(this.itemUrl+"/data",{responseType:e,...t,query:{token:this.apiKey}})}async fetchRating(e){const t=await l(this.portal).request(this.itemUrl+"/rating",{query:{token:this.apiKey},...e});return null!=t.rating?(t.created=new Date(t.created),new w(t)):null}fetchRelatedItems(e,t){return l(this.portal).requestToTypedArray(this.itemUrl+"/relatedItems",{query:{...e,token:this.apiKey},...t},f)}getThumbnailUrl(e){let t=this.thumbnailUrl;return t&&e&&(t+=`&w=${e}`),t}reload(){return l(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((()=>l(this.portal).signIn())).then((()=>{const t=e&&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 r("portal:item-does-not-exist","The item does not exist yet and cannot be updated"))}async copy(e){if(!this.id)throw new r("portal:item-does-not-exist","The item does not exist yet");await this.load();const{portal:t,itemUrl:i}=this;await l(t).signIn();const{copyResources:o,folder:s,tags:a,title:n}=e||{},p={method:"post",query:{copyPrivateResources:"all"===o,folder:"string"==typeof s?s:s?.id,includeResources:!!o,tags:a?.join(","),title:n}},{itemId:c}=await t.request(`${i}/copy`,p);return new f({id:c,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)p(t)?r.query={data:t}:r.query={url:c(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 r("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{addOrUpdateResource:r}=await import("./support/resourceUtils.js");return e.portalItem=this,r(e,"add",t,i)}async removeResource(e,t){const{removeResource:i}=await import("./support/resourceUtils.js");if(e.portalItem&&e.portalItem.itemUrl!==this.itemUrl)throw new r("removeresource:portal-item-mismatch","The portal item associated with the provided resource does not match the item");return i(this,e,t)}async removeAllResources(e){const{removeAllResources:t}=await import("./support/resourceUtils.js");return t(this,e)}resourceFromPath(e){return new v({portalItem:this,path:e})}toJSON(){const e=this.extent,t={accessInformation:this.accessInformation,categories:s(this.categories),created:this.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&&this.modified.getTime(),name:this.name,owner:this.owner,ownerFolder:this.ownerFolder,snippet:this.snippet,sourceUrl:this.sourceUrl,spatialReference:this.spatialReference,tags:s(this.tags),thumbnail:this.thumbnail,title:this.title,type:this.type,typeKeywords:s(this.typeKeywords),url:this.url};return a(t)}static fromJSON(e){if(!e)return null;if(e.declaredClass)throw new Error("JSON object is already hydrated");return new f({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([d({type:["private","shared","org","public"]})],S.prototype,"access",void 0),e([d()],S.prototype,"accessInformation",void 0),e([d({type:String})],S.prototype,"apiKey",void 0),e([d({json:{read:{source:"appProxies"}}})],S.prototype,"applicationProxies",void 0),e([d()],S.prototype,"avgRating",void 0),e([d()],S.prototype,"categories",void 0),e([d({type:Date})],S.prototype,"created",void 0),e([d()],S.prototype,"culture",void 0),e([d()],S.prototype,"description",void 0),e([d({readOnly:!0})],S.prototype,"displayName",null),e([d({type:g})],S.prototype,"extent",void 0),e([m("extent")],S.prototype,"readExtent",null),e([d()],S.prototype,"groupCategories",void 0),e([d({readOnly:!0})],S.prototype,"iconUrl",null),e([d()],S.prototype,"id",void 0),e([d({readOnly:!0})],S.prototype,"isLayer",null),e([d({type:Boolean,readOnly:!0})],S.prototype,"isOrgItem",void 0),e([d()],S.prototype,"itemControl",void 0),e([d({readOnly:!0})],S.prototype,"itemPageUrl",null),e([d({readOnly:!0})],S.prototype,"itemUrl",null),e([d()],S.prototype,"licenseInfo",void 0),e([d({type:Date})],S.prototype,"modified",void 0),e([d()],S.prototype,"name",void 0),e([d()],S.prototype,"numComments",void 0),e([d()],S.prototype,"numRatings",void 0),e([d()],S.prototype,"numViews",void 0),e([d()],S.prototype,"owner",void 0),e([d()],S.prototype,"ownerFolder",void 0),e([d({type:y})],S.prototype,"portal",void 0),e([d()],S.prototype,"screenshots",void 0),e([d()],S.prototype,"size",void 0),e([d()],S.prototype,"snippet",void 0),e([d()],S.prototype,"sourceJSON",void 0),e([d({type:String})],S.prototype,"sourceUrl",void 0),e([d({type:String})],S.prototype,"spatialReference",void 0),e([d()],S.prototype,"tags",void 0),e([d()],S.prototype,"thumbnail",void 0),e([d({readOnly:!0})],S.prototype,"thumbnailUrl",null),e([d()],S.prototype,"title",void 0),e([d()],S.prototype,"type",void 0),e([d()],S.prototype,"typeKeywords",void 0),e([d({type:String,json:{read(e,t){if(k.has(t.type)){const t=this.portal?.restUrl;e||=t&&this.id?`${t}/content/items/${this.id}/data`:null}return e}}})],S.prototype,"url",void 0),e([d({readOnly:!0})],S.prototype,"userItemUrl",null),S=f=e([h("esri.portal.PortalItem")],S);const x=S;export{x 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.27/esri/copyright.txt for details.
4
4
  */
5
- import o from"../../Color.js";import{toLAB as r,toHSV as t,toLCH as l,toRGB as e}from"../../core/colorUtils.js";import{JSONMap as i}from"../../core/jsonMap.js";const n=["random","ndvi","ndvi2","ndvi3","elevation","gray","hillshade"],C=[{id:"aspect",type:"multipart",colorRamps:[{fromColor:[190,190,190],toColor:[255,45,8]},{fromColor:[255,45,8],toColor:[255,181,61]},{fromColor:[255,181,61],toColor:[255,254,52]},{fromColor:[255,254,52],toColor:[0,251,50]},{fromColor:[0,251,50],toColor:[255,254,52]},{fromColor:[0,253,255],toColor:[0,181,255]},{fromColor:[0,181,255],toColor:[26,35,253]},{fromColor:[26,35,253],toColor:[255,57,251]},{fromColor:[255,57,251],toColor:[255,45,8]}]},{id:"black-to-white",fromColor:[0,0,0],toColor:[255,255,255]},{id:"blue-bright",fromColor:[204,204,255],toColor:[0,0,224]},{id:"blue-light-to-dark",fromColor:[211,229,232],toColor:[46,100,140]},{id:"blue-green-bright",fromColor:[203,245,234],toColor:[48,207,146]},{id:"blue-green-light-to-dark",fromColor:[216,242,237],toColor:[21,79,74]},{id:"brown-light-to-dark",fromColor:[240,236,170],toColor:[102,72,48]},{id:"brown-to-blue-green-diverging-right",type:"multipart",colorRamps:[{fromColor:[156,85,31],toColor:[255,255,191]},{fromColor:[255,255,191],toColor:[33,130,145]}]},{id:"brown-to-blue-green-diverging-dark",type:"multipart",colorRamps:[{fromColor:[110,70,45],toColor:[204,204,102]},{fromColor:[204,204,102],toColor:[48,100,102]}]},{id:"coefficient-bias",fromColor:[214,214,255],toColor:[0,57,148]},{id:"cold-to-hot-diverging",type:"multipart",colorRamps:[{fromColor:[69,117,181],toColor:[255,255,191]},{fromColor:[255,255,191],toColor:[214,47,39]}]},{id:"condition-number",type:"multipart",colorRamps:[{fromColor:[0,97,0],toColor:[255,255,0]},{fromColor:[255,255,0],toColor:[255,34,0]}]},{id:"cyan-to-purple",type:"multipart",colorRamps:[{fromColor:[0,245,245],toColor:[0,0,245]},{fromColor:[0,0,245],toColor:[245,0,245]}]},{id:"cyan-light-to-blue-dark",type:"multipart",colorRamps:[{fromColor:[182,237,240],toColor:[31,131,224]},{fromColor:[31,131,224],toColor:[9,9,145]}]},{id:"distance",fromColor:[255,200,0],toColor:[0,0,255]},{id:"elevation1",type:"multipart",colorRamps:[{fromColor:[175,240,233],toColor:[255,255,179]},{fromColor:[255,255,179],toColor:[0,128,64]},{fromColor:[0,128,64],toColor:[252,186,3]},{fromColor:[252,186,3],toColor:[128,0,0]},{fromColor:[120,0,0],toColor:[105,48,13]},{fromColor:[105,48,13],toColor:[171,171,171]},{fromColor:[171,171,171],toColor:[255,252,255]}]},{id:"elevation2",type:"multipart",colorRamps:[{fromColor:[118,219,211],toColor:[255,255,199]},{fromColor:[255,255,199],toColor:[255,255,128]},{fromColor:[255,255,128],toColor:[217,194,121]},{fromColor:[217,194,121],toColor:[135,96,38]},{fromColor:[135,96,38],toColor:[150,150,181]},{fromColor:[150,150,181],toColor:[181,150,181]},{fromColor:[181,150,181],toColor:[255,252,255]}]},{id:"errors",fromColor:[255,235,214],toColor:[196,10,10]},{id:"gray-light-to-dark",fromColor:[219,219,219],toColor:[69,69,69]},{id:"green-bright",fromColor:[204,255,204],toColor:[14,204,14]},{id:"green-light-to-dark",fromColor:[220,245,233],toColor:[34,102,51]},{id:"green-to-blue",type:"multipart",colorRamps:[{fromColor:[32,204,16],toColor:[0,242,242]},{fromColor:[0,242,242],toColor:[2,33,227]}]},{id:"orange-bright",fromColor:[255,235,204],toColor:[240,118,5]},{id:"orange-light-to-dark",fromColor:[250,233,212],toColor:[171,65,36]},{id:"partial-spectrum",type:"multipart",colorRamps:[{fromColor:[242,241,162],toColor:[255,255,0]},{fromColor:[255,255,0],toColor:[255,0,0]},{fromColor:[252,3,69],toColor:[176,7,237]},{fromColor:[176,7,237],toColor:[2,29,173]}]},{id:"partial-spectrum-1-diverging",type:"multipart",colorRamps:[{fromColor:[135,38,38],toColor:[240,149,12]},{fromColor:[240,149,12],toColor:[255,255,191]},{fromColor:[255,255,191],toColor:[74,80,181]},{fromColor:[74,80,181],toColor:[39,32,122]}]},{id:"partial-spectrum-2-diverging",type:"multipart",colorRamps:[{fromColor:[115,77,42],toColor:[201,137,52]},{fromColor:[201,137,52],toColor:[255,255,191]},{fromColor:[255,255,191],toColor:[91,63,176]},{fromColor:[91,63,176],toColor:[81,13,97]}]},{id:"pink-to-yellow-green-diverging-bright",type:"multipart",colorRamps:[{fromColor:[158,30,113],toColor:[255,255,191]},{fromColor:[255,255,191],toColor:[99,110,45]}]},{id:"pink-to-yellow-green-diverging-dark",type:"multipart",colorRamps:[{fromColor:[97,47,73],toColor:[204,204,102]},{fromColor:[204,204,102],toColor:[22,59,15]}]},{id:"precipitation",type:"multipart",colorRamps:[{fromColor:[194,82,60],toColor:[237,161,19]},{fromColor:[237,161,19],toColor:[255,255,0]},{fromColor:[255,255,0],toColor:[0,219,0]},{fromColor:[0,219,0],toColor:[32,153,143]},{fromColor:[32,153,143],toColor:[11,44,122]}]},{id:"prediction",type:"multipart",colorRamps:[{fromColor:[40,146,199],toColor:[250,250,100]},{fromColor:[250,250,100],toColor:[232,16,20]}]},{id:"purple-bright",fromColor:[255,204,255],toColor:[199,0,199]},{id:"purple-to-green-diverging-bright",type:"multipart",colorRamps:[{fromColor:[77,32,150],toColor:[255,255,191]},{fromColor:[255,255,191],toColor:[20,122,11]}]},{id:"purple-to-green-diverging-dark",type:"multipart",colorRamps:[{fromColor:[67,14,89],toColor:[204,204,102]},{fromColor:[204,204,102],toColor:[24,79,15]}]},{id:"purple-blue-bright",fromColor:[223,184,230],toColor:[112,12,242]},{id:"purple-blue-light-to-dark",fromColor:[229,213,242],toColor:[93,44,112]},{id:"purple-red-bright",fromColor:[255,204,225],toColor:[199,0,99]},{id:"purple-red-light-to-dark",fromColor:[250,215,246],toColor:[143,17,57]},{id:"red-bright",fromColor:[255,204,204],toColor:[219,0,0]},{id:"red-light-to-dark",fromColor:[255,224,224],toColor:[143,10,10]},{id:"red-to-blue-diverging-bright",type:"multipart",colorRamps:[{fromColor:[196,69,57],toColor:[255,255,191]},{fromColor:[255,255,191],toColor:[48,95,207]}]},{id:"red-to-blue-diverging-dark",type:"multipart",colorRamps:[{fromColor:[107,13,13],toColor:[204,204,102]},{fromColor:[204,204,102],toColor:[13,53,97]}]},{id:"red-to-green",type:"multipart",colorRamps:[{fromColor:[245,0,0],toColor:[245,245,0]},{fromColor:[245,245,0],toColor:[0,245,0]}]},{id:"red-to-green-diverging-bright",type:"multipart",colorRamps:[{fromColor:[186,20,20],toColor:[255,255,191]},{fromColor:[255,255,191],toColor:[54,145,33]}]},{id:"red-to-green-diverging-dark",type:"multipart",colorRamps:[{fromColor:[97,21,13],toColor:[204,204,102]},{fromColor:[204,204,102],toColor:[16,69,16]}]},{id:"slope",type:"multipart",colorRamps:[{fromColor:[56,168,0],toColor:[255,255,0]},{fromColor:[255,255,0],toColor:[255,0,0]}]},{id:"spectrum-full-bright",type:"multipart",colorRamps:[{fromColor:[255,0,0],toColor:[255,255,0]},{fromColor:[255,255,0],toColor:[0,255,255]},{fromColor:[0,255,255],toColor:[0,0,255]}]},{id:"spectrum-full-dark",type:"multipart",colorRamps:[{fromColor:[153,0,0],toColor:[153,153,0]},{fromColor:[153,153,0],toColor:[0,153,153]},{fromColor:[0,153,153],toColor:[0,0,153]}]},{id:"spectrum-full-light",type:"multipart",colorRamps:[{fromColor:[255,153,153],toColor:[255,255,153]},{fromColor:[255,255,153],toColor:[153,255,255]},{fromColor:[153,255,255],toColor:[153,153,255]}]},{id:"surface",type:"multipart",colorRamps:[{fromColor:[112,153,89],toColor:[242,238,162]},{fromColor:[242,238,162],toColor:[242,206,133]},{fromColor:[242,206,133],toColor:[194,140,124]},{fromColor:[194,140,124],toColor:[255,242,255]}]},{id:"temperature",type:"multipart",colorRamps:[{fromColor:[255,252,255],toColor:[255,0,255]},{fromColor:[255,0,255],toColor:[0,0,255]},{fromColor:[0,0,255],toColor:[0,255,255]},{fromColor:[0,255,255],toColor:[0,255,0]},{fromColor:[0,255,0],toColor:[255,255,0]},{fromColor:[255,255,0],toColor:[255,128,0]},{fromColor:[255,128,0],toColor:[128,0,0]}]},{id:"white-to-black",fromColor:[255,255,255],toColor:[0,0,0]},{id:"yellow-to-dark-red",type:"multipart",colorRamps:[{fromColor:[255,255,128],toColor:[242,167,46]},{fromColor:[242,167,46],toColor:[107,0,0]}]},{id:"yellow-to-green-to-dark-blue",type:"multipart",colorRamps:[{fromColor:[255,255,128],toColor:[56,224,9]},{fromColor:[56,224,9],toColor:[26,147,171]},{fromColor:[26,147,171],toColor:[12,16,120]}]},{id:"yellow-to-red",fromColor:[245,245,0],toColor:[255,0,0]},{id:"yellow-green-bright",fromColor:[236,252,204],toColor:[157,204,16]},{id:"yellow-green-light-to-dark",fromColor:[215,240,175],toColor:[96,107,45]}],a=new i({Aspect:"aspect","Black to White":"black-to-white","Blue Bright":"blue-bright","Blue Light to Dark":"blue-light-to-dark","Blue-Green Bright":"blue-green-bright","Blue-Green Light to Dark":"blue-green-light-to-dark","Brown Light to Dark":"brown-light-to-dark","Brown to Blue Green Diverging, Bright":"brown-to-blue-green-diverging-right","Brown to Blue Green Diverging, Dark":"brown-to-blue-green-diverging-dark","Coefficient Bias":"coefficient-bias","Cold to Hot Diverging":"cold-to-hot-diverging","Condition Number":"condition-number","Cyan to Purple":"cyan-to-purple","Cyan-Light to Blue-Dark":"cyan-light-to-blue-dark",Distance:"distance","Elevation #1":"elevation1","Elevation #2":"elevation2",Errors:"errors","Gray Light to Dark":"gray-light-to-dark","Green Bright":"green-bright","Green Light to Dark":"green-light-to-dark","Green to Blue":"green-to-blue","Orange Bright":"orange-bright","Orange Light to Dark":"orange-light-to-dark","Partial Spectrum":"partial-spectrum","Partial Spectrum 1 Diverging":"partial-spectrum-1-diverging","Partial Spectrum 2 Diverging":"partial-spectrum-2-diverging","Pink to YellowGreen Diverging, Bright":"pink-to-yellow-green-diverging-bright","Pink to YellowGreen Diverging, Dark":"pink-to-yellow-green-diverging-dark",Precipitation:"precipitation",Prediction:"prediction","Purple Bright":"purple-bright","Purple to Green Diverging, Bright":"purple-to-green-diverging-bright","Purple to Green Diverging, Dark":"purple-to-green-diverging-dark","Purple-Blue Bright":"purple-blue-bright","Purple-Blue Light to Dark":"purple-blue-light-to-dark","Purple-Red Bright":"purple-red-bright","Purple-Red Light to Dark":"purple-red-light-to-dark","Red Bright":"red-bright","Red Light to Dark":"red-light-to-dark","Red to Blue Diverging, Bright":"red-to-blue-diverging-bright","Red to Blue Diverging, Dark":"red-to-blue-diverging-dark","Red to Green":"red-to-green","Red to Green Diverging, Bright":"red-to-green-diverging-bright","Red to Green Diverging, Dark":"red-to-green-diverging-dark",Slope:"slope","Spectrum-Full Bright":"spectrum-full-bright","Spectrum-Full Dark":"spectrum-full-dark","Spectrum-Full Light":"spectrum-full-light",Surface:"surface",Temperature:"temperature","White to Black":"white-to-black","Yellow to Dark Red":"yellow-to-dark-red","Yellow to Green to Dark Blue":"yellow-to-green-to-dark-blue","Yellow to Red":"yellow-to-red","Yellow-Green Bright":"yellow-green-bright","Yellow-Green Light to Dark":"yellow-green-light-to-dark"});function m(o,r){if(!o||!r||o.length!==r.length)return!1;for(let t=0;t<o.length;t++)if(o[t]>r[t]+2||o[t]<r[t]-2)return!1;return!0}function g(r,t){if(!r)return;const l=t??C;let e=null;return"algorithmic"===r.type?l.some((o=>{if(m(r.fromColor.toRgb(),o.fromColor)&&m(r.toColor.toRgb(),o.toColor))return e=o.id,!0})):"multipart"===r.type&&l.some((t=>{const l=r.colorRamps,i=t.colorRamps;if(l&&i&&l.length===i.length&&!i.some(((r,t)=>{if(!m(l[t].fromColor.toRgb(),new o(r.fromColor).toRgb())||!m(l[t].toColor.toRgb(),new o(r.toColor).toRgb()))return!0}))){if(e)return!0;e=t.id}})),e}function p(o){const r="string"==typeof o?o:g(o);return r?a.toJSON(r):null}function u(o,r="esriCIELabAlgorithm"){const t=C.find((({id:r})=>r===o));return t?t.colorRamps?{type:"multipart",colorRamps:t.colorRamps.map((o=>({type:"algorithmic",algorithm:r,fromColor:[...o.fromColor],toColor:[...o.toColor]})))}:{type:"algorithmic",algorithm:r,fromColor:[...t.fromColor],toColor:[...t.toColor]}:null}function f(o){const r=(o=o||{}).numColors||256,t=o.distanceOffset||0,l=null!=o.isCustomInterval?o.isCustomInterval:null!==o.distanceInterval&&o.distanceInterval!==1/(r-1),e=o.distanceInterval||1/(r-1);return{...o,numColors:r,distanceOffset:t,interpolateAlpha:!!o.interpolateAlpha,distanceInterval:e,isCustomInterval:l,weights:o.weights}}function s(o,r,t){const{numColors:l,distanceOffset:e,distanceInterval:i,isCustomInterval:n}=t,C=0===o.s,a=0===r.s;let m=o.h,g=r.h;C&&!a?m=g:a&&!C&&(r={...r,h:m},g=m);let p,u=Math.abs(g-m);const f=360;u<f/2?p=(g-m)*i:(u=f-u,p=m>g?u*i:-u*i);const s=(r.s-o.s)*i,d=(r.v-o.v)*i;let{s:c,v:h}=o,b=m;if(e){const o=e/i;b=(b+o*p+f)%f,c+=o*s,h+=o*d}const v=[];for(let k=0;k<l-1;k++)v.push({h:b,s:c,v:h}),b=(b+p+f)%f,c+=s,h+=d;return v.push(n?{h:b,s:c,v:h}:r),v}function d(o,r,t){const{numColors:l,distanceOffset:e,distanceInterval:i,isCustomInterval:n}=t;let{l:C,a,b:m}=o;const g=(r.l-C)*i,p=(r.a-a)*i,u=(r.b-m)*i,f=[];if(e){const o=e/i;C+=o*g,a+=o*p,m+=o*u}for(let s=0;s<l-1;s++)f.push({l:C,a,b:m}),C+=g,a+=p,m+=u;return f.push(n?{l:C,a,b:m}:r),f}function c(o,r,t){const{numColors:l,distanceOffset:e,distanceInterval:i,isCustomInterval:n}=t,C=o.h,a=r.h,m=2*Math.PI;let g;if(C<=a){const o=a-C,r=a-C-m;g=Math.abs(r)<Math.abs(o)?r:o}else{const o=a+m-C,r=a-C;g=Math.abs(r)<Math.abs(o)?r:o}const p=g*i,u=(r.l-o.l)*i,f=(r.c-o.c)*i;let{l:s,c:d,h:c}=o;if(e){const o=e/i;s+=o*u,d+=o*f,c=(c+o*p+m)%m}const h=[];for(let b=0;b<l-1;b++)h.push({l:s,c:d,h:c}),s+=u,d+=f,c=(c+p+m)%m;return h.push(n?{l:s,c:d,h:c}:r),h}function h(o,i){let{fromColor:n,toColor:C}=o;n=[...n],C=[...C],3===n.length&&(n=n.concat([255])),3===C.length&&(C=C.concat([255]));const a=o.algorithm||"esriCIELabAlgorithm",m=f(i),{numColors:g,distanceOffset:p,isCustomInterval:u,interpolateAlpha:h}=m;if(1===g&&0===p)return[n];if(2===g&&0===p&&!u)return[n,C];const b={r:n[0],g:n[1],b:n[2]},v={r:C[0],g:C[1],b:C[2]},k="esriCIELabAlgorithm"===a?d(r(b),r(v),m):"esriHSVAlgorithm"===a?s(t(b),t(v),m):c(l(b),l(v),m),y=[],R=n[3]??255,w=((C[3]??255)-R)/(g-1);for(let r=0;r<g;r++){const{r:o,g:t,b:l}=e(k[r]),i=h?Math.round(R+w*r):255;y.push([o,t,l,i])}return y}function b(o,r){const{numColors:t,interpolateAlpha:l}=f(r);let e=r?.weights;const{colorRamps:i}=o;if(e){const o=e.reduce(((o,r)=>o+r));e=e.map((r=>r/o))}else{e=[];for(let o=0;o<i.length;o++)e[o]=1/i.length}const n=[];let C=0,a=0;const m=1/(t-1);let g=!1;for(let u=0;u<i.length;u++){let o=g?0:C*m-a,r=u===i.length-1?t-1-C:(e[u]-o)/m;if(g=Math.ceil(r)===r,r=Math.ceil(r),0===r)continue;o/=e[u];const p=h(i[u],{numColors:r,interpolateAlpha:l,distanceOffset:o,distanceInterval:m/e[u]});C+=p.length,n.push(...p),a+=e[u]}const p=[...i[i.length-1].toColor];return 3===p.length&&p.push(255),n.push(p),n}function v(o,r){const t="toJSON"in o?o.toJSON():o;return"multipart"===t.type?b(t,r):h(t,r)}function k(o,r){const t=v(o,r),l=r?.interpolateAlpha;return t.forEach(((o,r)=>{o.unshift(r),l||o.pop()})),t}function y(o){const r=t(o);return{type:"HsvColor",Hue:r.h,Saturation:r.s,Value:r.v,AlphaValue:255}}function R(o){const r=o.toJSON();return{Algorithm:r?.Algorithm||"esriHSVAlgorithm",type:"AlgorithmicColorRamp",FromColor:y(o.fromColor),ToColor:y(o.toColor)}}function w(o){const r=p(o);if(!r)return null;if("algorithmic"===o.type)return{...R(o),Name:r};if(o.colorRamps){const t=o.colorRamps.map(R);return{type:"MultiPartColorRamp",NumColorRamps:t.length,ArrayOfColorRamp:t,Name:r}}return null}function B(o){const r=o.reverse().map((o=>{const r=o.toString(16);return r.length<2?"0"+r:r}));return 4294967295&Number.parseInt(r.join(""),16)}export{C as PREDEFINED_JSON_COLOR_RAMPS,a as colorRampDict,k as convertColorRampToColormap,v as convertColorRampToColors,B as convertRGBATo32Bit,g as getColorRampId,u as getColorRampJSON,p as getColorRampName,w as getRFxArgColorRampValue,n as rasterColormapNames};
5
+ import o from"../../Color.js";import{toLAB as r,toHSV as t,toLCH as l,toRGB as e}from"../../core/colorUtils.js";import{JSONMap as i}from"../../core/jsonMap.js";const n=["random","ndvi","ndvi2","ndvi3","elevation","gray","hillshade"],C=[{id:"aspect",type:"multipart",colorRamps:[{fromColor:[190,190,190],toColor:[255,45,8]},{fromColor:[255,45,8],toColor:[255,181,61]},{fromColor:[255,181,61],toColor:[255,254,52]},{fromColor:[255,254,52],toColor:[0,251,50]},{fromColor:[0,251,50],toColor:[255,254,52]},{fromColor:[0,253,255],toColor:[0,181,255]},{fromColor:[0,181,255],toColor:[26,35,253]},{fromColor:[26,35,253],toColor:[255,57,251]},{fromColor:[255,57,251],toColor:[255,45,8]}]},{id:"black-to-white",fromColor:[0,0,0],toColor:[255,255,255]},{id:"blue-bright",fromColor:[204,204,255],toColor:[0,0,224]},{id:"blue-light-to-dark",fromColor:[211,229,232],toColor:[46,100,140]},{id:"blue-green-bright",fromColor:[203,245,234],toColor:[48,207,146]},{id:"blue-green-light-to-dark",fromColor:[216,242,237],toColor:[21,79,74]},{id:"brown-light-to-dark",fromColor:[240,236,170],toColor:[102,72,48]},{id:"brown-to-blue-green-diverging-right",type:"multipart",colorRamps:[{fromColor:[156,85,31],toColor:[255,255,191]},{fromColor:[255,255,191],toColor:[33,130,145]}]},{id:"brown-to-blue-green-diverging-dark",type:"multipart",colorRamps:[{fromColor:[110,70,45],toColor:[204,204,102]},{fromColor:[204,204,102],toColor:[48,100,102]}]},{id:"coefficient-bias",fromColor:[214,214,255],toColor:[0,57,148]},{id:"cold-to-hot-diverging",type:"multipart",colorRamps:[{fromColor:[69,117,181],toColor:[255,255,191]},{fromColor:[255,255,191],toColor:[214,47,39]}]},{id:"condition-number",type:"multipart",colorRamps:[{fromColor:[0,97,0],toColor:[255,255,0]},{fromColor:[255,255,0],toColor:[255,34,0]}]},{id:"cyan-to-purple",type:"multipart",colorRamps:[{fromColor:[0,245,245],toColor:[0,0,245]},{fromColor:[0,0,245],toColor:[245,0,245]}]},{id:"cyan-light-to-blue-dark",type:"multipart",colorRamps:[{fromColor:[182,237,240],toColor:[31,131,224]},{fromColor:[31,131,224],toColor:[9,9,145]}]},{id:"distance",fromColor:[255,200,0],toColor:[0,0,255]},{id:"elevation1",type:"multipart",colorRamps:[{fromColor:[175,240,233],toColor:[255,255,179]},{fromColor:[255,255,179],toColor:[0,128,64]},{fromColor:[0,128,64],toColor:[252,186,3]},{fromColor:[252,186,3],toColor:[128,0,0]},{fromColor:[120,0,0],toColor:[105,48,13]},{fromColor:[105,48,13],toColor:[171,171,171]},{fromColor:[171,171,171],toColor:[255,252,255]}]},{id:"elevation2",type:"multipart",colorRamps:[{fromColor:[118,219,211],toColor:[255,255,199]},{fromColor:[255,255,199],toColor:[255,255,128]},{fromColor:[255,255,128],toColor:[217,194,121]},{fromColor:[217,194,121],toColor:[135,96,38]},{fromColor:[135,96,38],toColor:[150,150,181]},{fromColor:[150,150,181],toColor:[181,150,181]},{fromColor:[181,150,181],toColor:[255,252,255]}]},{id:"errors",fromColor:[255,235,214],toColor:[196,10,10]},{id:"gray-light-to-dark",fromColor:[219,219,219],toColor:[69,69,69]},{id:"green-bright",fromColor:[204,255,204],toColor:[14,204,14]},{id:"green-light-to-dark",fromColor:[220,245,233],toColor:[34,102,51]},{id:"green-to-blue",type:"multipart",colorRamps:[{fromColor:[32,204,16],toColor:[0,242,242]},{fromColor:[0,242,242],toColor:[2,33,227]}]},{id:"orange-bright",fromColor:[255,235,204],toColor:[240,118,5]},{id:"orange-light-to-dark",fromColor:[250,233,212],toColor:[171,65,36]},{id:"partial-spectrum",type:"multipart",colorRamps:[{fromColor:[242,241,162],toColor:[255,255,0]},{fromColor:[255,255,0],toColor:[255,0,0]},{fromColor:[252,3,69],toColor:[176,7,237]},{fromColor:[176,7,237],toColor:[2,29,173]}]},{id:"partial-spectrum-1-diverging",type:"multipart",colorRamps:[{fromColor:[135,38,38],toColor:[240,149,12]},{fromColor:[240,149,12],toColor:[255,255,191]},{fromColor:[255,255,191],toColor:[74,80,181]},{fromColor:[74,80,181],toColor:[39,32,122]}]},{id:"partial-spectrum-2-diverging",type:"multipart",colorRamps:[{fromColor:[115,77,42],toColor:[201,137,52]},{fromColor:[201,137,52],toColor:[255,255,191]},{fromColor:[255,255,191],toColor:[91,63,176]},{fromColor:[91,63,176],toColor:[81,13,97]}]},{id:"pink-to-yellow-green-diverging-bright",type:"multipart",colorRamps:[{fromColor:[158,30,113],toColor:[255,255,191]},{fromColor:[255,255,191],toColor:[99,110,45]}]},{id:"pink-to-yellow-green-diverging-dark",type:"multipart",colorRamps:[{fromColor:[97,47,73],toColor:[204,204,102]},{fromColor:[204,204,102],toColor:[22,59,15]}]},{id:"precipitation",type:"multipart",colorRamps:[{fromColor:[194,82,60],toColor:[237,161,19]},{fromColor:[237,161,19],toColor:[255,255,0]},{fromColor:[255,255,0],toColor:[0,219,0]},{fromColor:[0,219,0],toColor:[32,153,143]},{fromColor:[32,153,143],toColor:[11,44,122]}]},{id:"prediction",type:"multipart",colorRamps:[{fromColor:[40,146,199],toColor:[250,250,100]},{fromColor:[250,250,100],toColor:[232,16,20]}]},{id:"purple-bright",fromColor:[255,204,255],toColor:[199,0,199]},{id:"purple-to-green-diverging-bright",type:"multipart",colorRamps:[{fromColor:[77,32,150],toColor:[255,255,191]},{fromColor:[255,255,191],toColor:[20,122,11]}]},{id:"purple-to-green-diverging-dark",type:"multipart",colorRamps:[{fromColor:[67,14,89],toColor:[204,204,102]},{fromColor:[204,204,102],toColor:[24,79,15]}]},{id:"purple-blue-bright",fromColor:[223,184,230],toColor:[112,12,242]},{id:"purple-blue-light-to-dark",fromColor:[229,213,242],toColor:[93,44,112]},{id:"purple-red-bright",fromColor:[255,204,225],toColor:[199,0,99]},{id:"purple-red-light-to-dark",fromColor:[250,215,246],toColor:[143,17,57]},{id:"red-bright",fromColor:[255,204,204],toColor:[219,0,0]},{id:"red-light-to-dark",fromColor:[255,224,224],toColor:[143,10,10]},{id:"red-to-blue-diverging-bright",type:"multipart",colorRamps:[{fromColor:[196,69,57],toColor:[255,255,191]},{fromColor:[255,255,191],toColor:[48,95,207]}]},{id:"red-to-blue-diverging-dark",type:"multipart",colorRamps:[{fromColor:[107,13,13],toColor:[204,204,102]},{fromColor:[204,204,102],toColor:[13,53,97]}]},{id:"red-to-green",type:"multipart",colorRamps:[{fromColor:[245,0,0],toColor:[245,245,0]},{fromColor:[245,245,0],toColor:[0,245,0]}]},{id:"red-to-green-diverging-bright",type:"multipart",colorRamps:[{fromColor:[186,20,20],toColor:[255,255,191]},{fromColor:[255,255,191],toColor:[54,145,33]}]},{id:"red-to-green-diverging-dark",type:"multipart",colorRamps:[{fromColor:[97,21,13],toColor:[204,204,102]},{fromColor:[204,204,102],toColor:[16,69,16]}]},{id:"slope",type:"multipart",colorRamps:[{fromColor:[56,168,0],toColor:[255,255,0]},{fromColor:[255,255,0],toColor:[255,0,0]}]},{id:"spectrum-full-bright",type:"multipart",colorRamps:[{fromColor:[255,0,0],toColor:[255,255,0]},{fromColor:[255,255,0],toColor:[0,255,255]},{fromColor:[0,255,255],toColor:[0,0,255]}]},{id:"spectrum-full-dark",type:"multipart",colorRamps:[{fromColor:[153,0,0],toColor:[153,153,0]},{fromColor:[153,153,0],toColor:[0,153,153]},{fromColor:[0,153,153],toColor:[0,0,153]}]},{id:"spectrum-full-light",type:"multipart",colorRamps:[{fromColor:[255,153,153],toColor:[255,255,153]},{fromColor:[255,255,153],toColor:[153,255,255]},{fromColor:[153,255,255],toColor:[153,153,255]}]},{id:"surface",type:"multipart",colorRamps:[{fromColor:[112,153,89],toColor:[242,238,162]},{fromColor:[242,238,162],toColor:[242,206,133]},{fromColor:[242,206,133],toColor:[194,140,124]},{fromColor:[194,140,124],toColor:[255,242,255]}]},{id:"temperature",type:"multipart",colorRamps:[{fromColor:[255,252,255],toColor:[255,0,255]},{fromColor:[255,0,255],toColor:[0,0,255]},{fromColor:[0,0,255],toColor:[0,255,255]},{fromColor:[0,255,255],toColor:[0,255,0]},{fromColor:[0,255,0],toColor:[255,255,0]},{fromColor:[255,255,0],toColor:[255,128,0]},{fromColor:[255,128,0],toColor:[128,0,0]}]},{id:"white-to-black",fromColor:[255,255,255],toColor:[0,0,0]},{id:"yellow-to-dark-red",type:"multipart",colorRamps:[{fromColor:[255,255,128],toColor:[242,167,46]},{fromColor:[242,167,46],toColor:[107,0,0]}]},{id:"yellow-to-green-to-dark-blue",type:"multipart",colorRamps:[{fromColor:[255,255,128],toColor:[56,224,9]},{fromColor:[56,224,9],toColor:[26,147,171]},{fromColor:[26,147,171],toColor:[12,16,120]}]},{id:"yellow-to-red",fromColor:[245,245,0],toColor:[255,0,0]},{id:"yellow-green-bright",fromColor:[236,252,204],toColor:[157,204,16]},{id:"yellow-green-light-to-dark",fromColor:[215,240,175],toColor:[96,107,45]}],a=new i({Aspect:"aspect","Black to White":"black-to-white","Blue Bright":"blue-bright","Blue Light to Dark":"blue-light-to-dark","Blue-Green Bright":"blue-green-bright","Blue-Green Light to Dark":"blue-green-light-to-dark","Brown Light to Dark":"brown-light-to-dark","Brown to Blue Green Diverging, Bright":"brown-to-blue-green-diverging-right","Brown to Blue Green Diverging, Dark":"brown-to-blue-green-diverging-dark","Coefficient Bias":"coefficient-bias","Cold to Hot Diverging":"cold-to-hot-diverging","Condition Number":"condition-number","Cyan to Purple":"cyan-to-purple","Cyan-Light to Blue-Dark":"cyan-light-to-blue-dark",Distance:"distance","Elevation #1":"elevation1","Elevation #2":"elevation2",Errors:"errors","Gray Light to Dark":"gray-light-to-dark","Green Bright":"green-bright","Green Light to Dark":"green-light-to-dark","Green to Blue":"green-to-blue","Orange Bright":"orange-bright","Orange Light to Dark":"orange-light-to-dark","Partial Spectrum":"partial-spectrum","Partial Spectrum 1 Diverging":"partial-spectrum-1-diverging","Partial Spectrum 2 Diverging":"partial-spectrum-2-diverging","Pink to YellowGreen Diverging, Bright":"pink-to-yellow-green-diverging-bright","Pink to YellowGreen Diverging, Dark":"pink-to-yellow-green-diverging-dark",Precipitation:"precipitation",Prediction:"prediction","Purple Bright":"purple-bright","Purple to Green Diverging, Bright":"purple-to-green-diverging-bright","Purple to Green Diverging, Dark":"purple-to-green-diverging-dark","Purple-Blue Bright":"purple-blue-bright","Purple-Blue Light to Dark":"purple-blue-light-to-dark","Purple-Red Bright":"purple-red-bright","Purple-Red Light to Dark":"purple-red-light-to-dark","Red Bright":"red-bright","Red Light to Dark":"red-light-to-dark","Red to Blue Diverging, Bright":"red-to-blue-diverging-bright","Red to Blue Diverging, Dark":"red-to-blue-diverging-dark","Red to Green":"red-to-green","Red to Green Diverging, Bright":"red-to-green-diverging-bright","Red to Green Diverging, Dark":"red-to-green-diverging-dark",Slope:"slope","Spectrum-Full Bright":"spectrum-full-bright","Spectrum-Full Dark":"spectrum-full-dark","Spectrum-Full Light":"spectrum-full-light",Surface:"surface",Temperature:"temperature","White to Black":"white-to-black","Yellow to Dark Red":"yellow-to-dark-red","Yellow to Green to Dark Blue":"yellow-to-green-to-dark-blue","Yellow to Red":"yellow-to-red","Yellow-Green Bright":"yellow-green-bright","Yellow-Green Light to Dark":"yellow-green-light-to-dark"});function m(o,r){if(!o||!r||o.length!==r.length)return!1;for(let t=0;t<o.length;t++)if(o[t]>r[t]+2||o[t]<r[t]-2)return!1;return!0}function g(o){const r=o.clone();return r.fromColor=o.toColor,r.toColor=o.fromColor,r.algorithm=o.algorithm,r}function p(o){if("multipart"===o.type){const r=o.clone();return r.colorRamps?.length?(r.colorRamps=r.colorRamps.reverse().map((o=>g(o))),r):r}return g(o)}function u(r,t){if(!r)return;const l=t??C;let e=null;return"algorithmic"===r.type?l.some((o=>{if(m(r.fromColor.toRgb(),o.fromColor)&&m(r.toColor.toRgb(),o.toColor))return e=o.id,!0})):"multipart"===r.type&&l.some((t=>{const l=r.colorRamps,i=t.colorRamps;if(l&&i&&l.length===i.length&&!i.some(((r,t)=>{if(!m(l[t].fromColor.toRgb(),new o(r.fromColor).toRgb())||!m(l[t].toColor.toRgb(),new o(r.toColor).toRgb()))return!0}))){if(e)return!0;e=t.id}})),e}function f(o,r){if(!o)return;let t=u(o,r);return null==t&&(t=u(o=p(o),r)),t}function s(o){const r="string"==typeof o?o:f(o);return r?a.toJSON(r):null}function c(o,r="esriCIELabAlgorithm"){const t=C.find((({id:r})=>r===o));return t?t.colorRamps?{type:"multipart",colorRamps:t.colorRamps.map((o=>({type:"algorithmic",algorithm:r,fromColor:[...o.fromColor],toColor:[...o.toColor]})))}:{type:"algorithmic",algorithm:r,fromColor:[...t.fromColor],toColor:[...t.toColor]}:null}function d(o){const r=(o=o||{}).numColors||256,t=o.distanceOffset||0,l=null!=o.isCustomInterval?o.isCustomInterval:null!==o.distanceInterval&&o.distanceInterval!==1/(r-1),e=o.distanceInterval||1/(r-1);return{...o,numColors:r,distanceOffset:t,interpolateAlpha:!!o.interpolateAlpha,distanceInterval:e,isCustomInterval:l,weights:o.weights}}function h(o,r,t){const{numColors:l,distanceOffset:e,distanceInterval:i,isCustomInterval:n}=t,C=0===o.s,a=0===r.s;let m=o.h,g=r.h;C&&!a?m=g:a&&!C&&(r={...r,h:m},g=m);let p,u=Math.abs(g-m);const f=360;u<f/2?p=(g-m)*i:(u=f-u,p=m>g?u*i:-u*i);const s=(r.s-o.s)*i,c=(r.v-o.v)*i;let{s:d,v:h}=o,b=m;if(e){const o=e/i;b=(b+o*p+f)%f,d+=o*s,h+=o*c}const v=[];for(let k=0;k<l-1;k++)v.push({h:b,s:d,v:h}),b=(b+p+f)%f,d+=s,h+=c;return v.push(n?{h:b,s:d,v:h}:r),v}function b(o,r,t){const{numColors:l,distanceOffset:e,distanceInterval:i,isCustomInterval:n}=t;let{l:C,a,b:m}=o;const g=(r.l-C)*i,p=(r.a-a)*i,u=(r.b-m)*i,f=[];if(e){const o=e/i;C+=o*g,a+=o*p,m+=o*u}for(let s=0;s<l-1;s++)f.push({l:C,a,b:m}),C+=g,a+=p,m+=u;return f.push(n?{l:C,a,b:m}:r),f}function v(o,r,t){const{numColors:l,distanceOffset:e,distanceInterval:i,isCustomInterval:n}=t,C=o.h,a=r.h,m=2*Math.PI;let g;if(C<=a){const o=a-C,r=a-C-m;g=Math.abs(r)<Math.abs(o)?r:o}else{const o=a+m-C,r=a-C;g=Math.abs(r)<Math.abs(o)?r:o}const p=g*i,u=(r.l-o.l)*i,f=(r.c-o.c)*i;let{l:s,c,h:d}=o;if(e){const o=e/i;s+=o*u,c+=o*f,d=(d+o*p+m)%m}const h=[];for(let b=0;b<l-1;b++)h.push({l:s,c,h:d}),s+=u,c+=f,d=(d+p+m)%m;return h.push(n?{l:s,c,h:d}:r),h}function k(o,i){let{fromColor:n,toColor:C}=o;n=[...n],C=[...C],3===n.length&&(n=n.concat([255])),3===C.length&&(C=C.concat([255]));const a=o.algorithm||"esriCIELabAlgorithm",m=d(i),{numColors:g,distanceOffset:p,isCustomInterval:u,interpolateAlpha:f}=m;if(1===g&&0===p)return[n];if(2===g&&0===p&&!u)return[n,C];const s={r:n[0],g:n[1],b:n[2]},c={r:C[0],g:C[1],b:C[2]},k="esriCIELabAlgorithm"===a?b(r(s),r(c),m):"esriHSVAlgorithm"===a?h(t(s),t(c),m):v(l(s),l(c),m),y=[],R=n[3]??255,w=((C[3]??255)-R)/(g-1);for(let r=0;r<g;r++){const{r:o,g:t,b:l}=e(k[r]),i=f?Math.round(R+w*r):255;y.push([o,t,l,i])}return y}function y(o,r){const{numColors:t,interpolateAlpha:l}=d(r);let e=r?.weights;const{colorRamps:i}=o;if(e){const o=e.reduce(((o,r)=>o+r));e=e.map((r=>r/o))}else{e=[];for(let o=0;o<i.length;o++)e[o]=1/i.length}const n=[];let C=0,a=0;const m=1/(t-1);let g=!1;for(let u=0;u<i.length;u++){let o=g?0:C*m-a,r=u===i.length-1?t-1-C:(e[u]-o)/m;if(g=Math.ceil(r)===r,r=Math.ceil(r),0===r)continue;o/=e[u];const p=k(i[u],{numColors:r,interpolateAlpha:l,distanceOffset:o,distanceInterval:m/e[u]});C+=p.length,n.push(...p),a+=e[u]}const p=[...i[i.length-1].toColor];return 3===p.length&&p.push(255),n.push(p),n}function R(o,r){const t="toJSON"in o?o.toJSON():o;return"multipart"===t.type?y(t,r):k(t,r)}function w(o,r){const t=R(o,r),l=r?.interpolateAlpha;return t.forEach(((o,r)=>{o.unshift(r),l||o.pop()})),t}function B(o){const r=t(o);return{type:"HsvColor",Hue:r.h,Saturation:r.s,Value:r.v,AlphaValue:255}}function D(o){const r=o.toJSON();return{Algorithm:r?.Algorithm||"esriHSVAlgorithm",type:"AlgorithmicColorRamp",FromColor:B(o.fromColor),ToColor:B(o.toColor)}}function I(o){const r=s(o);if(!r)return null;if("algorithmic"===o.type)return{...D(o),Name:r};if(o.colorRamps){const t=o.colorRamps.map(D);return{type:"MultiPartColorRamp",NumColorRamps:t.length,ArrayOfColorRamp:t,Name:r}}return null}function G(o){const r=o.reverse().map((o=>{const r=o.toString(16);return r.length<2?"0"+r:r}));return 4294967295&Number.parseInt(r.join(""),16)}export{C as PREDEFINED_JSON_COLOR_RAMPS,a as colorRampDict,w as convertColorRampToColormap,R as convertColorRampToColors,G as convertRGBATo32Bit,f as getColorRampId,c as getColorRampJSON,s as getColorRampName,I as getRFxArgColorRampValue,n as rasterColormapNames};
package/request.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.27/esri/copyright.txt for details.
4
4
  */
5
- import e from"./config.js";import{id as t}from"./kernel.js";import r from"./core/Error.js";import has from"./core/has.js";import{clone as s}from"./core/lang.js";import{onAbort as o,isAbortError as a,createAbortError as n,isAborted as i}from"./core/promiseUtils.js";import{queryToObject as l,isDataProtocol as u,isBlobProtocol as c,normalize as d,getInterceptor as p,isTrustedServer as h,getOrigin as m,toHTTPS as f,addQueryParameter as y,objectToQuery as w,getProxyRule as g,getProxyUrl as b,addQueryParameters as q,hasSameOrigin as T,getAppUrl as k,addProxyRule as S}from"./core/urlUtils.js";import{isSecureProxyService as O}from"./portal/support/urlUtils.js";import{supportsApiKey as C}from"./support/apiKeyUtils.js";import{registerNoCorsDomains as v,isNoCorsRequestRequired as x,sendNoCorsRequest as E,loadImageAsync as L}from"./support/requestUtils.js";async function U(e,t){e instanceof URL&&(e=e.toString()),t?.query instanceof URLSearchParams&&(t.query=l(t.query.toString().replaceAll("+"," ")));const r=u(e),s=c(e);s||r||(e=d(e));const a={url:e,requestOptions:{...t}};let n=p(e);if(n){const e=await G(n,a);if(null!=e)return{data:e,getHeader:I,httpStatus:200,requestOptions:a.requestOptions,url:a.url};n.after||n.error||(n=null)}if(e=a.url,"image"===(t=a.requestOptions).responseType&&(has("host-webworker")||has("host-node")))throw N("request:invalid-parameters",new Error("responseType 'image' is not supported in Web Workers or Node environment"),a);if("head"===t.method){if(t.body)throw N("request:invalid-parameters",new Error("body parameter cannot be set when method is 'head'"),a);if(r||s)throw N("request:invalid-parameters",new Error("data and blob URLs are not supported for method 'head'"),a)}if(await B(),j)return j.execute(e,t);const i=new AbortController;o(t,(()=>i.abort()));const h={controller:i,credential:void 0,credentialToken:void 0,fetchOptions:void 0,hasToken:!1,interceptor:n,params:a,redoRequest:!1,useIdentity:P.useIdentity,useProxy:!1,useSSL:!1,withCredentials:!1},m=await Q(h);return n?.after?.(m),m}let j;const P=e.request,D="FormData"in globalThis,_=[499,498,403,401],A=["COM_0056","COM_0057","SB_0008"],F=[/\/arcgis\/tokens/i,/\/sharing(\/rest)?\/generatetoken/i,/\/rest\/info/i],I=()=>null,R=Symbol();function M(e){const t=m(e);t&&!U._corsServers.includes(t)&&U._corsServers.push(t)}function H(e){const t=m(e);return!t||t.endsWith(".arcgis.com")||U._corsServers.includes(t)||h(t)}function N(e,t,o,i){let l="Error";const u={url:o.url,requestOptions:o.requestOptions,getHeader:I,ssl:!1};if(t instanceof r)return t.details?(t.details=s(t.details),t.details.url=o.url,t.details.requestOptions=o.requestOptions):t.details=u,t;if(t){const e=i&&(e=>i.headers.get(e)),r=i?.status,s=t.message;s&&(l=s),e&&(u.getHeader=e),u.httpStatus=(null!=t.httpCode?t.httpCode:t.code)||r||0,u.subCode=t.subcode,u.messageCode=t.messageCode,"string"==typeof t.details?u.messages=[t.details]:u.messages=t.details,u.raw=R in t?t[R]:t}return a(t)?n():new r(e,l,u)}async function B(){has("host-webworker")?j||(j=await import("./core/workers/request.js")):U._abortableFetch||(U._abortableFetch=globalThis.fetch.bind(globalThis))}async function $(){t||await import("./identity/IdentityManager.js")}async function z(r){const s=r.params.url,o=r.params.requestOptions,a=r.controller.signal,n=o.body;let l=null,u=null;if(D&&"HTMLFormElement"in globalThis&&(n instanceof FormData?l=n:n instanceof HTMLFormElement&&(l=new FormData(n))),"string"==typeof n&&(u=n),r.fetchOptions={cache:o.cacheBust&&!("polyfill"in U._abortableFetch)?"no-cache":"default",credentials:"same-origin",headers:o.headers||{},method:"head"===o.method?"HEAD":"GET",mode:"cors",priority:P.priority,redirect:"follow",signal:a},(l||u)&&(r.fetchOptions.body=l||u),"anonymous"===o.authMode&&(r.useIdentity=!1),r.hasToken=!!(/token=/i.test(s)||o.query?.token||l?.get("token")),!r.hasToken&&e.apiKey&&C(s)&&(o.query||(o.query={}),o.query.token=e.apiKey,r.hasToken=!0),r.useIdentity&&!r.hasToken&&!r.credentialToken&&!K(s)&&!i(a)){let e;"immediate"===o.authMode?(await $(),e=await t.getCredential(s,{signal:a}),r.credential=e):"no-prompt"===o.authMode?(await $(),e=await t.getCredential(s,{prompt:!1,signal:a}).catch((()=>{})),r.credential=e):t&&(e=t.findCredential(s)),e&&(r.credentialToken=e.token,r.useSSL=!!e.ssl)}}function K(e){return F.some((t=>t.test(e)))}async function W(e){let r=e.params.url;const s=e.params.requestOptions,o=e.fetchOptions??{},a=c(r)||u(r),i=s.responseType||"json",l=a?0:null!=s.timeout?s.timeout:P.timeout;let d=!1;if(!a){e.useSSL&&(r=f(r)),s.cacheBust&&"default"===o.cache&&(r=y(r,"request.preventCache",Date.now()));let a={...s.query};e.credentialToken&&(a.token=e.credentialToken);let n=w(a);has("esri-url-encodes-apostrophe")&&(n=n.replaceAll("'","%27"));const i=r.length+1+n.length;let l;d="delete"===s.method||"post"===s.method||"put"===s.method||!!s.body||i>P.maxUrlLength;const u=s.useProxy||!!g(r);if(u){const e=b(r);l=e.path,!d&&l.length+1+i>P.maxUrlLength&&(d=!0),e.query&&(a={...e.query,...a})}if("HEAD"===o.method&&(d||u)){if(d){if(i>P.maxUrlLength)throw N("request:invalid-parameters",new Error("URL exceeds maximum length"),e.params);throw N("request:invalid-parameters",new Error("cannot use POST request when method is 'head'"),e.params)}if(u)throw N("request:invalid-parameters",new Error("cannot use proxy when method is 'head'"),e.params)}if(d?(o.method="delete"===s.method?"DELETE":"put"===s.method?"PUT":"POST",s.body?r=q(r,a):(o.body=w(a),o.headers||(o.headers={}),o.headers["Content-Type"]="application/x-www-form-urlencoded")):r=q(r,a),u&&(e.useProxy=!0,r=`${l}?${r}`),a.token&&D&&o.body instanceof FormData&&!O(r)&&o.body.set("token",a.token),s.hasOwnProperty("withCredentials"))e.withCredentials=s.withCredentials;else if(!T(r,k()))if(h(r))e.withCredentials=!0;else if(t){const s=t.findServerInfo(r);s?.webTierAuth&&(e.withCredentials=!0)}e.withCredentials&&(o.credentials="include",x(r)&&await E(d?q(r,a):r))}let p,C,v=0,L=!1;l>0&&(v=setTimeout((()=>{L=!0,e.controller.abort()}),l));try{if("native-request-init"===s.responseType)C=o,C.url=r;else if("image"!==s.responseType||"default"!==o.cache||"GET"!==o.method||d||J(s.headers)||!a&&!e.useProxy&&P.proxyUrl&&!H(r)){if(p=await U._abortableFetch(r,o),e.useProxy||M(r),"native"===s.responseType)C=p;else if("HEAD"!==o.method)if(p.ok){switch(i){case"array-buffer":C=await p.arrayBuffer();break;case"blob":case"image":C=await p.blob();break;default:C=await p.text()}if(v&&(clearTimeout(v),v=0),"json"===i||"xml"===i||"document"===i)if(C)switch(i){case"json":C=JSON.parse(C);break;case"xml":C=X(C,"application/xml");break;case"document":C=X(C,"text/html")}else C=null;if(C){if("array-buffer"===i||"blob"===i){const e=p.headers.get("Content-Type");if(e&&/application\/json|text\/plain/i.test(e)&&C["blob"===i?"size":"byteLength"]<=750)try{const e=await new Response(C).json();e.error&&(C=e)}catch{}}"image"===i&&C instanceof Blob&&(C=await Y(URL.createObjectURL(C),e,!0))}}else{C=await p.text();try{C=JSON.parse(C)}catch{}}}else C=await Y(r,e)}catch(j){if("AbortError"===j.name){if(L)throw new Error("Timeout exceeded");throw n("Request canceled")}if(!(!p&&j instanceof TypeError&&P.proxyUrl)||s.body||"delete"===s.method||"head"===s.method||"post"===s.method||"put"===s.method||e.useProxy||H(r))throw j;e.redoRequest=!0,S({proxyUrl:P.proxyUrl,urlPrefix:m(r)??""})}finally{v&&clearTimeout(v)}return[p,C]}async function G(e,t){if(null!=e.responseData)return e.responseData;if(e.headers&&(t.requestOptions.headers={...t.requestOptions.headers,...e.headers}),e.query&&(t.requestOptions.query={...t.requestOptions.query,...e.query}),e.before){let o,a;try{a=await e.before(t)}catch(s){o=N("request:interceptor",s,t)}if((a instanceof Error||a instanceof r)&&(o=N("request:interceptor",a,t)),o)throw e.error&&e.error(o),o;return a}}function J(e){if(e)for(const t of Object.getOwnPropertyNames(e))if(e[t])return!0;return!1}function X(e,t){let r;try{r=(new DOMParser).parseFromString(e,t)}catch{}if(!r||r.getElementsByTagName("parsererror").length)throw new SyntaxError("XML Parse error");return r}async function Q(e){let r,s;await z(e);try{do{[r,s]=await W(e)}while(!await V(e,r,s))}catch(n){const t=N("request:server",n,e.params,r);throw t.details.ssl=e.useSSL,e.interceptor?.error&&e.interceptor.error(t),t}const o=e.params.url;if(s&&/\/sharing\/rest\/(accounts|portals)\/self/i.test(o)){if(!e.hasToken&&!e.credentialToken&&s.user?.username&&!h(o)){const e=m(o,!0);e&&P.trustedServers.push(e)}Array.isArray(s.authorizedCrossOriginNoCorsDomains)&&v(s.authorizedCrossOriginNoCorsDomains)}const a=e.credential;if(a&&t){const e=t.findServerInfo(a.server);let r=e?.owningSystemUrl;if(r){r=r.replace(/\/?$/,"/sharing");const e=t.findCredential(r,a.userId);e&&-1===t._getIdenticalSvcIdx(r,e)&&e.resources.unshift(r)}}return{data:s,getHeader:r?e=>r?.headers.get(e):I,httpStatus:r?.status??200,requestOptions:e.params.requestOptions,ssl:e.useSSL,url:e.params.url}}async function V(e,r,s){if(e.redoRequest)return e.redoRequest=!1,!1;const o=e.params.requestOptions;if(!r||"native"===o.responseType||"native-request-init"===o.responseType)return!0;let a,n;if(s&&(s.error?a=s.error:"error"===s.status&&Array.isArray(s.messages)&&(a={...s},a[R]=s,a.details=s.messages)),!a&&!r.ok)throw a=new Error(`Unable to load ${r.url} status: ${r.status}`),a[R]=s,a;let i,l=null;a&&(n=Number(a.code),l=a.hasOwnProperty("subcode")?Number(a.subcode):null,i=a.messageCode,i=i?.toUpperCase());const u=o.authMode;if(403===n&&(4===l||a.message?.toLowerCase().includes("ssl")&&!a.message.toLowerCase().includes("permission"))){if(!e.useSSL)return e.useSSL=!0,!1}else if(!e.hasToken&&e.useIdentity&&("no-prompt"!==u||498===n)&&void 0!==n&&_.includes(n)&&!K(e.params.url)&&(403!==n||i&&!A.includes(i)&&(null==l||2===l&&e.credentialToken))){await $();try{const r=await t.getCredential(e.params.url,{error:N("request:server",a,e.params),prompt:"no-prompt"!==u,signal:e.controller.signal,token:e.credentialToken});return e.credential=r,e.credentialToken=r.token,e.useSSL=e.useSSL||r.ssl,!1}catch(c){if("no-prompt"===u)return e.credential=void 0,e.credentialToken=void 0,!1;a=c}}if(a)throw a;return!0}function Y(e,t,r=!1){const s=t.controller.signal,o=new Image;return t.withCredentials?o.crossOrigin="use-credentials":o.crossOrigin="anonymous",o.alt="",o.fetchPriority=P.priority,o.src=e,L(o,e,r,s)}U._abortableFetch=null,U._corsServers=["https://server.arcgisonline.com","https://services.arcgisonline.com"];export{U as default};
5
+ import e from"./config.js";import{id as t}from"./kernel.js";import r from"./core/Error.js";import has from"./core/has.js";import{clone as s}from"./core/lang.js";import{onAbort as o,isAbortError as a,createAbortError as n,isAborted as i}from"./core/promiseUtils.js";import{queryToObject as l,isDataProtocol as u,isBlobProtocol as c,normalize as d,getInterceptor as p,isTrustedServer as h,getOrigin as m,toHTTPS as f,addQueryParameter as y,objectToQuery as w,getProxyRule as g,getProxyUrl as b,addQueryParameters as q,hasSameOrigin as T,getAppUrl as k,addProxyRule as S}from"./core/urlUtils.js";import{isSecureProxyService as O}from"./portal/support/urlUtils.js";import{supportsApiKey as C}from"./support/apiKeyUtils.js";import{registerNoCorsDomains as v,isNoCorsRequestRequired as x,sendNoCorsRequest as L,createTimeoutError as E,loadImageAsync as U}from"./support/requestUtils.js";async function j(e,t){e instanceof URL&&(e=e.toString()),t?.query instanceof URLSearchParams&&(t.query=l(t.query.toString().replaceAll("+"," ")));const r=u(e),s=c(e);s||r||(e=d(e));const a={url:e,requestOptions:{...t}};let n=p(e);if(n){const e=await J(n,a);if(null!=e)return{data:e,getHeader:R,httpStatus:200,requestOptions:a.requestOptions,url:a.url};n.after||n.error||(n=null)}if(e=a.url,"image"===(t=a.requestOptions).responseType&&(has("host-webworker")||has("host-node")))throw B("request:invalid-parameters",new Error("responseType 'image' is not supported in Web Workers or Node environment"),a);if("head"===t.method){if(t.body)throw B("request:invalid-parameters",new Error("body parameter cannot be set when method is 'head'"),a);if(r||s)throw B("request:invalid-parameters",new Error("data and blob URLs are not supported for method 'head'"),a)}if(await $(),P)return P.execute(e,t);const i=new AbortController;o(t,(()=>i.abort()));const h={controller:i,credential:void 0,credentialToken:void 0,fetchOptions:void 0,hasToken:!1,interceptor:n,params:a,redoRequest:!1,useIdentity:D.useIdentity,useProxy:!1,useSSL:!1,withCredentials:!1},m=await V(h);return n?.after?.(m),m}let P;const D=e.request,_="FormData"in globalThis,A=[499,498,403,401],F=["COM_0056","COM_0057","SB_0008"],I=[/\/arcgis\/tokens/i,/\/sharing(\/rest)?\/generatetoken/i,/\/rest\/info/i],R=()=>null,M=Symbol();function H(e){const t=m(e);t&&!j._corsServers.includes(t)&&j._corsServers.push(t)}function N(e){const t=m(e);return!t||t.endsWith(".arcgis.com")||j._corsServers.includes(t)||h(t)}function B(e,t,o,i){let l="Error";const u={url:o.url,requestOptions:o.requestOptions,getHeader:R,ssl:!1};if(t instanceof r)return t.details?(t.details=s(t.details),t.details.url=o.url,t.details.requestOptions=o.requestOptions):t.details=u,t;if(t){const e=i&&(e=>i.headers.get(e)),r=i?.status,s=t.message;s&&(l=s),e&&(u.getHeader=e),u.httpStatus=(null!=t.httpCode?t.httpCode:t.code)||r||0,u.subCode=t.subcode,u.messageCode=t.messageCode,"string"==typeof t.details?u.messages=[t.details]:u.messages=t.details,u.raw=M in t?t[M]:t}return a(t)?n():new r(e,l,u)}async function $(){has("host-webworker")?P||(P=await import("./core/workers/request.js")):j._abortableFetch||(j._abortableFetch=globalThis.fetch.bind(globalThis))}async function z(){t||await import("./identity/IdentityManager.js")}async function K(r){const s=r.params.url,o=r.params.requestOptions,a=r.controller.signal,n=o.body;let l=null,u=null;if(_&&"HTMLFormElement"in globalThis&&(n instanceof FormData?l=n:n instanceof HTMLFormElement&&(l=new FormData(n))),"string"==typeof n&&(u=n),r.fetchOptions={cache:o.cacheBust&&!("polyfill"in j._abortableFetch)?"no-cache":"default",credentials:"same-origin",headers:o.headers||{},method:"head"===o.method?"HEAD":"GET",mode:"cors",priority:D.priority,redirect:"follow",signal:a},(l||u)&&(r.fetchOptions.body=l||u),"anonymous"===o.authMode&&(r.useIdentity=!1),r.hasToken=!!(/token=/i.test(s)||o.query?.token||l?.get("token")),!r.hasToken&&e.apiKey&&C(s)&&(o.query||(o.query={}),o.query.token=e.apiKey,r.hasToken=!0),r.useIdentity&&!r.hasToken&&!r.credentialToken&&!W(s)&&!i(a)){let e;"immediate"===o.authMode?(await z(),e=await t.getCredential(s,{signal:a}),r.credential=e):"no-prompt"===o.authMode?(await z(),e=await t.getCredential(s,{prompt:!1,signal:a}).catch((()=>{})),r.credential=e):t&&(e=t.findCredential(s)),e&&(r.credentialToken=e.token,r.useSSL=!!e.ssl)}}function W(e){return I.some((t=>t.test(e)))}async function G(e){let r=e.params.url;const s=e.params.requestOptions,o=e.fetchOptions??{},a=c(r)||u(r),i=s.responseType||"json",l=a?0:null!=s.timeout?s.timeout:D.timeout;let d=!1;if(!a){e.useSSL&&(r=f(r)),s.cacheBust&&"default"===o.cache&&(r=y(r,"request.preventCache",Date.now()));let a={...s.query};e.credentialToken&&(a.token=e.credentialToken);let n=w(a);has("esri-url-encodes-apostrophe")&&(n=n.replaceAll("'","%27"));const i=r.length+1+n.length;let l;d="delete"===s.method||"post"===s.method||"put"===s.method||!!s.body||i>D.maxUrlLength;const u=s.useProxy||!!g(r);if(u){const e=b(r);l=e.path,!d&&l.length+1+i>D.maxUrlLength&&(d=!0),e.query&&(a={...e.query,...a})}if("HEAD"===o.method&&(d||u)){if(d){if(i>D.maxUrlLength)throw B("request:invalid-parameters",new Error("URL exceeds maximum length"),e.params);throw B("request:invalid-parameters",new Error("cannot use POST request when method is 'head'"),e.params)}if(u)throw B("request:invalid-parameters",new Error("cannot use proxy when method is 'head'"),e.params)}if(d?(o.method="delete"===s.method?"DELETE":"put"===s.method?"PUT":"POST",s.body?r=q(r,a):(o.body=w(a),o.headers||(o.headers={}),o.headers["Content-Type"]="application/x-www-form-urlencoded")):r=q(r,a),u&&(e.useProxy=!0,r=`${l}?${r}`),a.token&&_&&o.body instanceof FormData&&!O(r)&&o.body.set("token",a.token),s.hasOwnProperty("withCredentials"))e.withCredentials=s.withCredentials;else if(!T(r,k()))if(h(r))e.withCredentials=!0;else if(t){const s=t.findServerInfo(r);s?.webTierAuth&&(e.withCredentials=!0)}e.withCredentials&&(o.credentials="include",x(r)&&await L(d?q(r,a):r))}let p,C,v=0,U=!1;l>0&&(v=setTimeout((()=>{U=!0,e.controller.abort()}),l));try{if("native-request-init"===s.responseType)C=o,C.url=r;else if("image"!==s.responseType||"default"!==o.cache||"GET"!==o.method||d||X(s.headers)||!a&&!e.useProxy&&D.proxyUrl&&!N(r)){if(p=await j._abortableFetch(r,o),e.useProxy||H(r),"native"===s.responseType)C=p;else if("HEAD"!==o.method)if(p.ok){switch(i){case"array-buffer":C=await p.arrayBuffer();break;case"blob":case"image":C=await p.blob();break;default:C=await p.text()}if(v&&(clearTimeout(v),v=0),"json"===i||"xml"===i||"document"===i)if(C)switch(i){case"json":C=JSON.parse(C);break;case"xml":C=Q(C,"application/xml");break;case"document":C=Q(C,"text/html")}else C=null;if(C){if("array-buffer"===i||"blob"===i){const e=p.headers.get("Content-Type");if(e&&/application\/json|text\/plain/i.test(e)&&C["blob"===i?"size":"byteLength"]<=750)try{const e=await new Response(C).json();e.error&&(C=e)}catch{}}"image"===i&&C instanceof Blob&&(C=await Z(URL.createObjectURL(C),e,!0))}}else{C=await p.text();try{C=JSON.parse(C)}catch{}}}else C=await Z(r,e)}catch(P){if("AbortError"===P.name){if(U)throw E();throw n("Request canceled")}if(!(!p&&P instanceof TypeError&&D.proxyUrl)||s.body||"delete"===s.method||"head"===s.method||"post"===s.method||"put"===s.method||e.useProxy||N(r))throw P;e.redoRequest=!0,S({proxyUrl:D.proxyUrl,urlPrefix:m(r)??""})}finally{v&&clearTimeout(v)}return[p,C]}async function J(e,t){if(null!=e.responseData)return e.responseData;if(e.headers&&(t.requestOptions.headers={...t.requestOptions.headers,...e.headers}),e.query&&(t.requestOptions.query={...t.requestOptions.query,...e.query}),e.before){let o,a;try{a=await e.before(t)}catch(s){o=B("request:interceptor",s,t)}if((a instanceof Error||a instanceof r)&&(o=B("request:interceptor",a,t)),o)throw e.error&&e.error(o),o;return a}}function X(e){if(e)for(const t of Object.getOwnPropertyNames(e))if(e[t])return!0;return!1}function Q(e,t){let r;try{r=(new DOMParser).parseFromString(e,t)}catch{}if(!r||r.getElementsByTagName("parsererror").length)throw new SyntaxError("XML Parse error");return r}async function V(e){let r,s;await K(e);try{do{[r,s]=await G(e)}while(!await Y(e,r,s))}catch(n){const t=B("request:server",n,e.params,r);throw t.details.ssl=e.useSSL,e.interceptor?.error&&e.interceptor.error(t),t}const o=e.params.url;if(s&&/\/sharing\/rest\/(accounts|portals)\/self/i.test(o)){if(!e.hasToken&&!e.credentialToken&&s.user?.username&&!h(o)){const e=m(o,!0);e&&D.trustedServers.push(e)}Array.isArray(s.authorizedCrossOriginNoCorsDomains)&&v(s.authorizedCrossOriginNoCorsDomains)}const a=e.credential;if(a&&t){const e=t.findServerInfo(a.server);let r=e?.owningSystemUrl;if(r){r=r.replace(/\/?$/,"/sharing");const e=t.findCredential(r,a.userId);e&&-1===t._getIdenticalSvcIdx(r,e)&&e.resources.unshift(r)}}return{data:s,getHeader:r?e=>r?.headers.get(e):R,httpStatus:r?.status??200,requestOptions:e.params.requestOptions,ssl:e.useSSL,url:e.params.url}}async function Y(e,r,s){if(e.redoRequest)return e.redoRequest=!1,!1;const o=e.params.requestOptions;if(!r||"native"===o.responseType||"native-request-init"===o.responseType)return!0;let a,n;if(s&&(s.error?a=s.error:"error"===s.status&&Array.isArray(s.messages)&&(a={...s},a[M]=s,a.details=s.messages)),!a&&!r.ok)throw a=new Error(`Unable to load ${r.url} status: ${r.status}`),a[M]=s,a;let i,l=null;a&&(n=Number(a.code),l=a.hasOwnProperty("subcode")?Number(a.subcode):null,i=a.messageCode,i=i?.toUpperCase());const u=o.authMode;if(403===n&&(4===l||a.message?.toLowerCase().includes("ssl")&&!a.message.toLowerCase().includes("permission"))){if(!e.useSSL)return e.useSSL=!0,!1}else if(!e.hasToken&&e.useIdentity&&("no-prompt"!==u||498===n)&&void 0!==n&&A.includes(n)&&!W(e.params.url)&&(403!==n||i&&!F.includes(i)&&(null==l||2===l&&e.credentialToken))){await z();try{const r=await t.getCredential(e.params.url,{error:B("request:server",a,e.params),prompt:"no-prompt"!==u,signal:e.controller.signal,token:e.credentialToken});return e.credential=r,e.credentialToken=r.token,e.useSSL=e.useSSL||r.ssl,!1}catch(c){if("no-prompt"===u)return e.credential=void 0,e.credentialToken=void 0,!1;a=c}}if(a)throw a;return!0}function Z(e,t,r=!1){const s=t.controller.signal,o=new Image;return t.withCredentials?o.crossOrigin="use-credentials":o.crossOrigin="anonymous",o.alt="",o.fetchPriority=D.priority,o.src=e,U(o,e,r,s)}j._abortableFetch=null,j._corsServers=["https://server.arcgisonline.com","https://services.arcgisonline.com"];export{j as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.27/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../Graphic.js";import t from"../../core/Logger.js";import{getOrCreateMapValue as r}from"../../core/MapUtils.js";import{f as o}from"../../chunks/vec3f64.js";import n from"../../geometry/Extent.js";import s from"../../geometry/Mesh.js";import i from"../../geometry/Point.js";import a from"../../geometry/SpatialReference.js";import u from"../../geometry/support/MeshGeoreferencedRelativeVertexSpace.js";import c from"../../geometry/support/MeshLocalVertexSpace.js";import f from"../../geometry/support/MeshTransform.js";import{ServiceAssetPart as p,ServiceAsset as m}from"../../geometry/support/meshUtils/External.js";import{getFormatIdMimeType as l}from"../../layers/support/infoFor3D.js";import g from"./FeatureSet.js";function y(t,r,o){const n=o.features;o.features=[],delete o.geometryType;const s=g.fromJSON(o);if(s.geometryType="mesh",!o.assetMaps)return s;const i=M(r,o.assetMaps),u=t.sourceSpatialReference??a.WGS84,c=o.globalIdFieldName,{outFields:f}=t,p=null!=f&&f.length>0?E(f.includes("*")?null:new Set(f)):()=>({});for(const a of n){const t=h(a,c,u,r,i);null!=t&&s.features.push(new e({geometry:t,attributes:p(a)}))}return s}function E(e){return({attributes:t})=>{if(!t)return{};if(!e)return t;for(const r in t)e.has(r)||delete t[r];return t}}function h(e,t,r,o,i){const a=e.attributes[t],f=i.get(a);if(null==f||!e.geometry)return null;const{originPoint:p,originVector:m}=S(e,r,o),l=n.fromJSON(e.geometry);l.spatialReference=r;const g=j(e.attributes,o),y=f.projectVertices?new u({origin:m}):new c({origin:m}),E=T(f);return E?s.createWithExternalSource(p,E,{extent:l,transform:g,vertexSpace:y}):s.createIncomplete(p,{extent:l,transform:g,vertexSpace:y})}function S({attributes:e},t,{transformFieldRoles:r}){const n=e[r.originX],s=e[r.originY],a=e[r.originZ];return{originPoint:new i({x:n,y:s,z:a,spatialReference:t}),originVector:o(n,s,a)}}function j(e,{transformFieldRoles:t}){return new f({translation:[e[t.translationX],-e[t.translationZ],e[t.translationY]],rotationAxis:[e[t.rotationX],e[t.rotationZ],e[t.rotationY]],rotationAngle:e[t.rotationDeg],scale:[e[t.scaleX],e[t.scaleY],e[t.scaleZ]]})}var d;function M(e,o){const n=new Map;for(const s of o){const o=s.parentGlobalId;if(null==o)continue;const i=s.assetName,a=s.assetType,u=s.assetHash,c=s.assetURL,f=s.conversionStatus,p=s.seqNo,m=l(a,e.supportedFormats);if(!m){t.getLogger("esri.rest.support.meshFeatureSet").error("mesh-feature-set:unknown-format",`Service returned an asset of type ${a}, but it does not list it as a supported type`);continue}const g=r(n,o,(()=>({projectVertices:D(s.flags).projectVertices,files:new Map})));r(g.files,i,(()=>({name:i,type:a,mimeType:m,status:w(f),parts:[]}))).parts[p]={hash:u,url:c}}return n}function T(e){const t=Array.from(e.files.values()),r=new Array;for(const o of t){if(o.status!==d.COMPLETED)return null;const e=new Array;for(const t of o.parts){if(!t)return null;e.push(new p(t.url,t.hash))}r.push(new m(o.name,o.mimeType,e))}return r}function w(e){switch(e){case"COMPLETED":case"SUBMITTED":return d.COMPLETED;case"INPROGRESS":return d.PENDING;default:return d.FAILED}}function D(e){return{projectVertices:e.includes("PROJECT_VERTICES")}}!function(e){e[e.FAILED=0]="FAILED",e[e.PENDING=1]="PENDING",e[e.COMPLETED=2]="COMPLETED"}(d||(d={}));export{M as assetMapFromAssetMapsJSON,h as extractMesh,y as meshFeatureSetFromJSON};
5
+ import e from"../../Graphic.js";import t from"../../core/Logger.js";import{getOrCreateMapValue as r}from"../../core/MapUtils.js";import{f as o}from"../../chunks/vec3f64.js";import n from"../../geometry/Extent.js";import s from"../../geometry/Mesh.js";import i from"../../geometry/Point.js";import a from"../../geometry/SpatialReference.js";import u from"../../geometry/support/MeshGeoreferencedRelativeVertexSpace.js";import c from"../../geometry/support/MeshLocalVertexSpace.js";import f from"../../geometry/support/MeshTransform.js";import{ServiceAssetPart as m,ServiceAsset as p}from"../../geometry/support/meshUtils/External.js";import{getFormatIdMimeType as l}from"../../layers/support/infoFor3D.js";import g from"./FeatureSet.js";const h=()=>t.getLogger("esri.rest.support.meshFeatureSet");function y(t,r,o){const n=o.features;o.features=[],delete o.geometryType;const s=g.fromJSON(o);if(s.geometryType="mesh",!o.assetMaps)return s;const i=M(r,o.assetMaps),u=t.sourceSpatialReference??a.WGS84,c=o.globalIdFieldName,{outFields:f}=t,m=null!=f&&f.length>0?E(f.includes("*")?null:new Set(f)):()=>({});for(const a of n){const t=S(a,c,u,r,i);null!=t&&s.features.push(new e({geometry:t,attributes:m(a)}))}return s}function E(e){return({attributes:t})=>{if(!t)return{};if(!e)return t;for(const r in t)e.has(r)||delete t[r];return t}}function S(e,t,r,o,i){const a=e.attributes[t],f=i.get(a);if(null==f)return h().error("mesh-feature-set:asset-not-found","Service returned a feature which was not found in the asset map",e),null;if(!e.geometry)return h().error("mesh-feature-set:no-geometry","Service returned a feature without geometry",e),null;const{originPoint:m,originVector:p}=d(e,r,o),l=n.fromJSON(e.geometry);l.spatialReference=r;const g=j(e.attributes,o),y=f.projectVertices?new u({origin:p}):new c({origin:p}),E=T(f);return E?s.createWithExternalSource(m,E,{extent:l,transform:g,vertexSpace:y}):s.createIncomplete(m,{extent:l,transform:g,vertexSpace:y})}function d({attributes:e},t,{transformFieldRoles:r}){const n=e[r.originX],s=e[r.originY],a=e[r.originZ];return{originPoint:new i({x:n,y:s,z:a,spatialReference:t}),originVector:o(n,s,a)}}function j(e,{transformFieldRoles:t}){return new f({translation:[e[t.translationX],-e[t.translationZ],e[t.translationY]],rotationAxis:[e[t.rotationX],e[t.rotationZ],e[t.rotationY]],rotationAngle:e[t.rotationDeg],scale:[e[t.scaleX],e[t.scaleY],e[t.scaleZ]]})}var w;function M(e,t){const o=new Map;for(const n of t){const t=n.parentGlobalId;if(null==t)continue;const s=n.assetName,i=n.assetType,a=n.assetHash,u=n.assetURL,c=n.conversionStatus,f=n.seqNo,m=l(i,e.supportedFormats);if(!m){h().error("mesh-feature-set:unknown-format",`Service returned an asset of type ${i}, but it does not list it as a supported type`);continue}const p=r(o,t,(()=>({projectVertices:P(n.flags).projectVertices,files:new Map})));r(p.files,s,(()=>({name:s,type:i,mimeType:m,status:D(c),parts:[]}))).parts[f]={hash:a,url:u}}return o}function T(e){const t=Array.from(e.files.values()),r=new Array;for(const o of t){if(o.status!==w.COMPLETED)return null;const e=new Array;for(const t of o.parts){if(!t)return null;e.push(new m(t.url,t.hash))}r.push(new p(o.name,o.mimeType,e))}return r}function D(e){switch(e){case"COMPLETED":case"SUBMITTED":return w.COMPLETED;case"INPROGRESS":return w.PENDING;default:return w.FAILED}}function P(e){return{projectVertices:e.includes("PROJECT_VERTICES")}}!function(e){e[e.FAILED=0]="FAILED",e[e.PENDING=1]="PENDING",e[e.COMPLETED=2]="COMPLETED"}(w||(w={}));export{M as assetMapFromAssetMapsJSON,S as extractMesh,y as meshFeatureSetFromJSON};
@@ -0,0 +1,5 @@
1
+ /*
2
+ All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
+ See https://js.arcgis.com/4.27/esri/copyright.txt for details.
4
+ */
5
+ import"../../intl.js";import e from"../../core/Error.js";import{createLabelExpressionForAggregateField as r,createLabelClass as n}from"./support/utils.js";import{aggregateCountField as t}from"../support/binningUtils.js";import{fetchMessageBundle as i}from"../../intl/messages.js";async function o(r){const{layer:n,renderer:t}=r;if(await n.load(),"binning"!==n.featureReduction?.type)throw new e("bins-label-schemes:invalid-parameters","featureReduction type of the layer is not valid");const i=t||n.featureReduction.renderer;if(!i)throw new e("bins-label-schemes:invalid-parameters","'renderer' is not valid");return{layer:n,renderer:i}}function s(e,r){const n=r.featureReduction;if("fields"in n)for(const t of n.fields)if(t.name.toLowerCase()===e.toLowerCase())return t;return null}async function a(e,t,i,o){const a=s(e,t);if(!a)return null;const l=r(t,i,a,o);return{name:`binning-${e}`,labelingInfo:[n(l,!0)],fieldName:e}}function l(e){let r=[];const n=e.featureReduction;return"fields"in n&&(r=n.fields.map((e=>e.name))),r}async function f(e){const[{renderer:r,layer:n},s]=await Promise.all([o(e),i("esri/smartMapping/t9n/smartMapping")]),f=await a(t,n),c=[],u=l(n).filter((e=>e.toLowerCase()!==t.toLowerCase()));for(const t of u){const e=await a(t,n,r,s.clusters.predominantNoneValue);e&&c.push(e)}return{primaryScheme:f,secondarySchemes:c}}export{f as getLabelSchemes};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.27/esri/copyright.txt for details.
4
4
  */
5
- import"../../symbols.js";import e from"../../core/Error.js";import{fetchMessageBundle as n}from"../../intl/messages.js";import t from"../../layers/support/LabelClass.js";import r from"../../layers/support/LabelExpressionInfo.js";import s from"../heuristics/clusterMinSize.js";import{getStatisticInfos as o,getClusterField as a,clusterCountField as i,getClusterFieldHash as l,getPredominantTypeExpression as u}from"../support/clusterUtils.js";import{isClusterCompatibleRenderer as c}from"../../views/2d/layers/support/clusterUtils.js";import m from"../../symbols/TextSymbol.js";async function f(n){const{layer:t,renderer:r,view:s}=n;await Promise.all([t.load(),s.when()]);const o=r||t.renderer;if(!c(o))throw new e("clusters-label-schemes:invalid-parameters","'renderer' is not valid");return{layer:t,renderer:o,view:s}}function p(e,n,t){const r="unique-value"===e.type?e.uniqueValueInfos??[]:[];return u(r,n,t)}function v(e){return`\n $feature["${e}"];\n var value = $feature["${e}"];\n var num = Count(Text(Round(value)));\n var label = When(\n num < 4, Text(value, "#.#"),\n num == 4, Text(value / Pow(10, 3), "#.0k"),\n num <= 6, Text(value / Pow(10, 3), "#k"),\n num == 7, Text(value / Pow(10, 6), "#.0m"),\n num > 7, Text(value / Pow(10, 6), "#m"),\n Text(value, "#,###")\n );\n return label;\n `}function w(e){const n=new m({haloColor:"#373837",haloSize:"1px",color:"#f0f0f0",font:{family:"Noto Sans",size:"12px",weight:"bold"}});return new t({symbol:n,deconflictionStrategy:"none",labelPlacement:"center-center",labelExpressionInfo:new r({expression:e})})}async function y(e){const{renderer:n,view:t,statInfo:r}=e,o=r?.statisticType,u=r?a(r.attributeInfo,o):i,c=w("type"===o?p(n,u,e.noneValueLabel):v(u));return{name:r?`clusters-${o}-${l(u,o)}`:"clusters-count",labelingInfo:[c],clusterMinSize:await s(c.symbol,t),fieldName:u}}function b(e){const n=new Map;for(const t of e)"size"===t.attributeInfo.vvType?n.set(t.statisticHash,t):n.has(t.statisticHash)||n.set(t.statisticHash,t);return[...n.values()]}async function d(e){const[{renderer:t,layer:r,view:s},a]=await Promise.all([f(e),n("esri/smartMapping/t9n/smartMapping")]);if(!t)return null;let i=null;const l=[],u=b(o(r,t,!1));for(const n of u){const e=await y({renderer:t,view:s,statInfo:n,noneValueLabel:a.clusters.predominantNoneValue});"size"===n.attributeInfo.vvType?i=e:l.push(e)}const c=await y({renderer:t,view:s});return i?l.unshift(c):i=c,{primaryScheme:i,secondarySchemes:l}}export{d as getLabelSchemes};
5
+ import e from"../../core/Error.js";import{fetchMessageBundle as t}from"../../intl/messages.js";import r from"../heuristics/clusterMinSize.js";import{createNumericLabelExpression as s,createLabelClass as n}from"./support/utils.js";import{getStatisticInfos as i,getClusterField as a,clusterCountField as o,getClusterFieldHash as l,getPredominantTypeExpression as u}from"../support/clusterUtils.js";import{isClusterCompatibleRenderer as c}from"../../views/2d/layers/support/clusterUtils.js";async function p(t){const{layer:r,renderer:s,view:n}=t;await Promise.all([r.load(),n.when()]);const i=s||r.renderer;if(!c(i))throw new e("clusters-label-schemes:invalid-parameters","'renderer' is not valid");return{layer:r,renderer:i,view:n}}function f(e,t,r){const s="unique-value"===e.type?e.uniqueValueInfos??[]:[];return u(s,t,r)}async function m(e){const{renderer:t,view:i,statInfo:u}=e,c=u?.statisticType,p=u?a(u.attributeInfo,c):o,m="type"===c?f(t,p,e.noneValueLabel):s(p),w=n(m);return{name:u?`clusters-${c}-${l(p,c)}`:"clusters-count",labelingInfo:[w],clusterMinSize:await r(w.symbol,i),fieldName:p}}function w(e){const t=new Map;for(const r of e)"size"===r.attributeInfo.vvType?t.set(r.statisticHash,r):t.has(r.statisticHash)||t.set(r.statisticHash,r);return[...t.values()]}async function d(e){const[{renderer:r,layer:s,view:n},a]=await Promise.all([p(e),t("esri/smartMapping/t9n/smartMapping")]);if(!r)return null;let o=null;const l=[],u=w(i(s,r,!1));for(const t of u){const e=await m({renderer:r,view:n,statInfo:t,noneValueLabel:a.clusters.predominantNoneValue});"size"===t.attributeInfo.vvType?o=e:l.push(e)}const c=await m({renderer:r,view:n});return o?l.unshift(c):o=c,{primaryScheme:o,secondarySchemes:l}}export{d as getLabelSchemes};
@@ -0,0 +1,5 @@
1
+ /*
2
+ All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
+ See https://js.arcgis.com/4.27/esri/copyright.txt for details.
4
+ */
5
+ import"../../../symbols.js";import e from"../../../layers/support/LabelClass.js";import n from"../../../layers/support/LabelExpressionInfo.js";import o from"../../../renderers/support/UniqueValueInfo.js";import{getPredominantTypeExpression as t}from"../../support/clusterUtils.js";import l from"../../../symbols/TextSymbol.js";function r(e){return`\n $feature["${e}"];\n var value = $feature["${e}"];\n var num = Count(Text(Round(value)));\n var label = When(\n num < 4, Text(value, "#.#"),\n num == 4, Text(value / Pow(10, 3), "#.0k"),\n num <= 6, Text(value / Pow(10, 3), "#k"),\n num == 7, Text(value / Pow(10, 6), "#.0m"),\n num > 7, Text(value / Pow(10, 6), "#m"),\n Text(value, "#,###")\n );\n return label;\n `}function a(e,n,l,a){const u=l.name;if("mode"===l.statisticType){const r="getFieldDomain"in e?e.getFieldDomain(l.onStatisticField):null;let s=null;return"coded-value"===r?.type?s=r.codedValues.map((e=>new o({value:e.code,label:e.name}))):"unique-value"===n?.type&&"string"==typeof n.field&&n.field.toLowerCase()===u.toLowerCase()&&(s=(n.uniqueValueInfos??[]).map((e=>e.clone()))),s?t(s,u,a):`Text($feature["${u}"])`}return r(u)}function u(o,t=!1){const r=new l({haloColor:"#373837",haloSize:"1px",color:"#f0f0f0",font:{family:"Noto Sans",size:"12px",weight:"bold"}});return new e({symbol:r,deconflictionStrategy:"none",labelPlacement:t?"always-horizontal":"center-center",labelExpressionInfo:new n({expression:o})})}export{u as createLabelClass,a as createLabelExpressionForAggregateField,r as createNumericLabelExpression};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.27/esri/copyright.txt for details.
4
4
  */
5
- import r from"../../core/Error.js";function i(i,e){if(!i.view)throw new r(`${e}:missing-parameters`,"'view' parameter is required for binning");if(i.sqlExpression)throw new r(`${e}:invalid-parameters`,"'sqlExpression' parameter is not supported for binning");if("3d"===i.view.type)throw new r(`${e}:invalid-parameters`,"3d view is not supported for binning")}export{i as verifyBinningParams};
5
+ import r from"../../core/Error.js";const e="aggregateCount";function i(e,i){if(!e.view)throw new r(`${i}:missing-parameters`,"'view' parameter is required for binning");if(e.sqlExpression)throw new r(`${i}:invalid-parameters`,"'sqlExpression' parameter is not supported for binning");if("3d"===e.view.type)throw new r(`${i}:invalid-parameters`,"3d view is not supported for binning")}export{e as aggregateCountField,i as verifyBinningParams};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.27/esri/copyright.txt for details.
4
4
  */
5
- import r from"../config.js";import has from"../core/has.js";import{isAborted as e}from"../core/promiseUtils.js";import{getOrigin as o,hasSameOrigin as t,getAppUrl as n,urlToObject as s}from"../core/urlUtils.js";function i(r,o,t=!1,n){return new Promise(((s,i)=>{if(e(n))return void i(c());let a=()=>{m(),i(new Error(`Unable to load ${o}`))},u=()=>{const e=r;m(),s(e)},l=()=>{if(!r)return;const e=r;m(),e.src="",i(c())};const m=()=>{has("esri-image-decode")||(r.removeEventListener("error",a),r.removeEventListener("load",u)),a=null,u=null,r=null,null!=n&&n.removeEventListener("abort",l),l=null,t&&URL.revokeObjectURL(o)};null!=n&&n.addEventListener("abort",l),has("esri-image-decode")?r.decode().then(u,a):(r.addEventListener("error",a),r.addEventListener("load",u))}))}function c(){try{return new DOMException("Aborted","AbortError")}catch{const r=new Error;return r.name="AbortError",r}}function a(e){r.request.crossOriginNoCorsDomains||(r.request.crossOriginNoCorsDomains={});const t=r.request.crossOriginNoCorsDomains;for(let r of e)r=r.toLowerCase(),/^https?:\/\//.test(r)?t[o(r)??""]=0:(t[o("http://"+r)??""]=0,t[o("https://"+r)??""]=0)}function u(e){const s=r.request.crossOriginNoCorsDomains;if(s){let r=o(e);if(r)return r=r.toLowerCase(),!t(r,n())&&s[r]<Date.now()-36e5}return!1}async function l(e){const t=r.request.crossOriginNoCorsDomains,n=o(e);t&&n&&(t[n.toLowerCase()]=Date.now());const i=s(e);e=i.path,"json"===i.query?.f&&(e+="?f=json");try{await fetch(e,{mode:"no-cors",credentials:"include"})}catch{}}export{u as isNoCorsRequestRequired,i as loadImageAsync,a as registerNoCorsDomains,l as sendNoCorsRequest};
5
+ import e from"../config.js";import has from"../core/has.js";import{isAborted as r}from"../core/promiseUtils.js";import{getOrigin as o,hasSameOrigin as t,getAppUrl as n,urlToObject as s}from"../core/urlUtils.js";function i(e,o,t=!1,n){return new Promise(((s,i)=>{if(r(n))return void i(c());let a=()=>{l(),i(new Error(`Unable to load ${o}`))},u=()=>{const r=e;l(),s(r)},m=()=>{if(!e)return;const r=e;l(),r.src="",i(c())};const l=()=>{has("esri-image-decode")||(e.removeEventListener("error",a),e.removeEventListener("load",u)),a=null,u=null,e=null,null!=n&&n.removeEventListener("abort",m),m=null,t&&URL.revokeObjectURL(o)};null!=n&&n.addEventListener("abort",m),has("esri-image-decode")?e.decode().then(u,a):(e.addEventListener("error",a),e.addEventListener("load",u))}))}function c(){try{return new DOMException("Aborted","AbortError")}catch{const e=new Error;return e.name="AbortError",e}}const a="Timeout exceeded";function u(){return new Error(a)}function m(e){return"object"==typeof e&&!!e&&"message"in e&&e.message===a}function l(r){e.request.crossOriginNoCorsDomains||(e.request.crossOriginNoCorsDomains={});const t=e.request.crossOriginNoCorsDomains;for(let e of r)e=e.toLowerCase(),/^https?:\/\//.test(e)?t[o(e)??""]=0:(t[o("http://"+e)??""]=0,t[o("https://"+e)??""]=0)}function d(r){const s=e.request.crossOriginNoCorsDomains;if(s){let e=o(r);if(e)return e=e.toLowerCase(),!t(e,n())&&s[e]<Date.now()-36e5}return!1}async function f(r){const t=e.request.crossOriginNoCorsDomains,n=o(r);t&&n&&(t[n.toLowerCase()]=Date.now());const i=s(r);r=i.path,"json"===i.query?.f&&(r+="?f=json");try{await fetch(r,{mode:"no-cors",credentials:"include"})}catch{}}export{u as createTimeoutError,d as isNoCorsRequestRequired,m as isTimeoutError,i as loadImageAsync,l as registerNoCorsDomains,f as sendNoCorsRequest};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.27/esri/copyright.txt for details.
4
4
  */
5
- const d="20230602",b="b746839026244a4bbd04222d89c103d654a48fd5";export{d as buildDate,b as commitHash};
5
+ const e="20230607",c="516d3b5b1c4ece63868d7224e7ac05335f2b8de0";export{e as buildDate,c as commitHash};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.27/esri/copyright.txt for details.
4
4
  */
5
- import{isSome as e}from"../../../../core/arrayUtils.js";import t from"../../../../core/Error.js";import has from"../../../../core/has.js";import r from"../../../../core/Logger.js";import{pt2px as i}from"../../../../core/screenUtils.js";import{sqlAnd as n}from"../../../../core/sql.js";import{diff as s}from"../../../../core/accessorSupport/diffUtils.js";import{validateLabelingInfo as l}from"../../../../layers/support/labelingInfo.js";import{WGLSymbologyType as o}from"../../engine/webgl/enums.js";import{getVVType as a}from"../../engine/webgl/Utils.js";import{getTechniqueFromRenderer as u}from"../../engine/webgl/techniques/utils.js";import{getVVFlags as d}from"../../engine/webgl/util/vvFlagUtils.js";import{createSymbolSchema as f}from"./createSymbolSchema.js";import{getPtMaxVVSize as p}from"./support/pixelBuffering.js";import{getSupportedHeatmapRenderer as c,simplifyVisualVariables as y}from"./support/rendererUtils.js";import{injectDynamicLevelDependentSizeVisualVariable as m,createClusterRenderer as g}from"../support/clusterUtils.js";import{toJSONGeometryType as b}from"../support/util.js";const x=r.getLogger("esri.views.2d.layers.features.schemaUtils"),h="ValidationError";function v(e){return e}function T(e,t){let r=0,i=0,n=o.DEFAULT;if(null!=e){if(i=p(e,t),"visualVariables"in e&&(r=d(e.visualVariables||[]),"dot-density"===e.type&&(n=o.DOT_DENSITY)),"heatmap"===e.type&&(n=o.HEATMAP),"dictionary"===e.type)return{maxVVSize:i,vvFlags:r,symbologyType:o.DEFAULT};if("pie-chart"===e.type)return{maxVVSize:i,vvFlags:r,symbologyType:o.PIE_CHART};if(n!==o.DOT_DENSITY&&n!==o.HEATMAP){const t=e.getSymbols();"backgroundFillSymbol"in e&&e.backgroundFillSymbol&&t.push(e.backgroundFillSymbol);let r=!0,i=!0;for(const e of t)if("cim"===e.type&&(i=!1),"simple-fill"===e.type||"picture-fill"===e.type){const t=e.outline,n=t&&"none"!==t.style&&"solid"!==t.style,s="simple-fill"===e.type&&"none"!==e.style&&"solid"!==e.style;n&&(r=!1),("picture-fill"===e.type||s||n)&&(i=!1)}r?n=i?o.OUTLINE_FILL_SIMPLE:o.OUTLINE_FILL:i&&(n=o.SIMPLE)}}return{vvFlags:r,maxVVSize:i,symbologyType:n}}let S=null;function E(e){if(has("esri-2d-update-debug")){const t=w(e,!0);console.debug("Created new schema",t),console.debug("Schema diff",s(S,t)),S=t}return w(e)}function w(e,t=!1){try{const r=R(e,t),i=D(e),s={};r.map((t=>F(s,e,t)));const l=null!=e.subtypeCode?`${e.subtypeField} = ${e.subtypeCode}`:null,o=n(e.definitionExpression,l);return{source:{definitionExpression:o,fields:e.fields.map((e=>e.toJSON())),gdbVersion:e.gdbVersion,historicMoment:e.historicMoment?.getTime(),outFields:e.availableFields,pixelBuffer:e.pixelBuffer,spatialReference:e.spatialReference.toJSON(),timeExtent:e.timeExtent?.toJSON(),customParameters:e.customParameters},attributes:{fields:{},indexCount:0},processors:r,tileRenderer:i,targets:s}}catch(r){if(r.fieldName===h)return x.error(r),null;throw r}}function F(e,r,i){switch(i.target){case"feature":return void O(e,V(r),i);case"aggregate":{if(!("featureReduction"in r))return;const n=r.featureReduction;switch(n?.type){case"selection":throw new t(h,"Mapview does not support `selection` reduction type",n);case"binning":return O(e,V(r),i),void N(e,n,r.fields.map((e=>e.toJSON())),i);case"cluster":return O(e,V(r),i),void L(e,n,r.fields.map((e=>e.toJSON())),i)}}}}function I(e,t){for(const r in t){const i=t[r];if(i.target!==e.name)continue;const n=e.attributes[r];if(n?.context){const e=n.context;e.mesh=e.mesh||i.context?.mesh,e.storage=e.storage||i.context?.storage}else e.attributes[r]=i}return e}function V(e){return[e.filter?.toJSON()??null,e.featureEffect?.filter?.toJSON()??null]}function O(e,t,r){return e.feature||(e.feature={name:"feature",input:"source",filters:t,attributes:{}}),I(e.feature,r.attributes.fields),e}function z(e,r){const{onStatisticExpression:i,onStatisticField:n,statisticType:s}=e;switch(s){case"min":case"max":case"avg":case"avg_angle":case"sum":case"count":return"esriFieldTypeDouble";case"mode":{if(i){const{returnType:r}=i;return r?"string"===r?"esriFieldTypeString":"esriFieldTypeDouble":(x.error(new t(h,"Unable to infer type of aggregateField with onStatisticExpression. ReturnType is not defined",e)),"esriFieldTypeString")}const s=r.find((e=>e.name===n));return s?s.type:(x.error(new t(h,"Unable to infer type of aggregateField with onStatisticExpression. ReturnType is not defined",e)),"esriFieldTypeString")}}}function N(e,t,r,i){return e.aggregate||(e.aggregate={name:"aggregate",type:"bin",filters:null,input:"feature",params:{fixedBinLevel:t.fixedBinLevel,fields:(t.fields??[]).map((e=>({...e.toJSON(),type:z(e,r)})))},attributes:{}}),I(e.aggregate,i.attributes.fields),e}function L(e,t,r,n){const s=n.aggregateFields??[],l=new Set;for(const i of s)l.add(i.name);for(const i of t?.fields??[])l.has(i.name)||s.push(i);return e.aggregate||(e.aggregate={name:"aggregate",type:"cluster",input:"feature",filters:null,attributes:{},params:{clusterRadius:i(t.clusterRadius/2),clusterPixelBuffer:64*Math.ceil(i(t.clusterMaxSize)/64),fields:s.map((e=>({...e.toJSON(),type:z(e,r)})))}}),I(e.aggregate,n.attributes.fields),e}function M(e,t){return t.field?j(e,{...t,type:"field",field:t.field}):t.valueExpression?j(e,{...t,type:"expression",valueExpression:t.valueExpression}):{field:void 0,fieldIndex:void 0}}function j(e,t){switch(t.type){case"expression":{const r=v(t.valueExpression);if(!e.fields[r]){const i=e.indexCount++;e.fields[r]={...t,name:r,fieldIndex:i}}return{fieldIndex:e.fields[r].fieldIndex}}case"label-expression":{const r=v(JSON.stringify(t.label));if(!e.fields[r]){const i=e.indexCount++;e.fields[r]={...t,name:r,fieldIndex:i}}return{fieldIndex:e.fields[r].fieldIndex}}case"field":{const r=t.field;return"aggregate"===t.target&&e.fields[r]||(e.fields[r]={...t,name:r}),{field:r}}case"statistic":return e.fields[t.name]={...t},{field:t.name}}}function R(e,t=!1){const r=new Array;let i=0;return r.push(A(e,i++,t)),r}function U(e,t,r,i,n,s=!1){const l=j(e,{type:"label-expression",target:r,context:{mesh:!0},resultType:"string",label:{labelExpression:t.labelExpression,labelExpressionInfo:t.labelExpressionInfo?{expression:t.labelExpressionInfo.expression}:null,symbol:!!t.symbol,where:t.where}}),{fieldIndex:o}=l;return{...f(t,n,s),fieldIndex:o,target:r,index:i}}function B(e,r,i){const n="featureReduction"in r&&r.featureReduction;if(!n)return{fields:[],labels:[],matcher:void 0,rendererOverride:void 0};const s="aggregate",o=[];let a=null,u=b(r.geometryType),d=[],p=null;if(n)switch(n.type){case"selection":return x.error(new t(h,"Mapview does not support `selection` reduction type",n)),{fields:[],labels:[],matcher:void 0,rendererOverride:void 0};case"cluster":case"binning":if(o.push(...n.fields??[]),"cluster"===n.type?u="esriGeometryPoint":"binning"===n.type&&(u="esriGeometryPolygon"),n.renderer&&!n.renderer.authoringInfo?.isAutoGenerated){if("cluster"===n.type){const{renderer:e}=m(n.renderer,n,null);p=e}else p=n.renderer;const t=T(n.renderer,n);a=_(e,s,n.renderer,t,i),d=n&&n.labelsVisible&&n.labelingInfo||[]}else if("cluster"===n.type){if(p=g(o,r.renderer,n,null,!0),n.symbol){const e=T(p,n);a={type:"simple",symbol:f(n.symbol,e,i),symbologyType:e.symbologyType}}d=n&&n.labelsVisible&&n.labelingInfo||[]}}k(e,o);return{labels:l(d,"binning"===n.type?"esriGeometryPolygon":u),matcher:a,fields:o,rendererOverride:p}}function A(e,r,i=!1){const n={indexCount:0,fields:{}},s="featureReduction"in e?e.featureReduction??void 0:void 0,a=s?"aggregate":"feature";if("sublayers"in e){const r={type:"subtype",subtypeField:e.subtypeField,renderers:{},symbologyType:o.DEFAULT},s={type:"subtype",mapping:{},target:"feature",subtypeField:e.subtypeField},l={type:"subtype",classes:{}},u={type:"symbol",target:"feature",aggregateFields:[],attributes:n,storage:s,mesh:{matcher:r,aggregateMatcher:null,labels:l,sortKey:null}},f=new Set;let p=0;for(const{renderer:c,subtypeCode:y,labelingInfo:m,labelsVisible:g}of e.sublayers){let e=0;"visualVariables"in c&&c.visualVariables&&(c.visualVariables.some((e=>"rotation"!==e.type))&&x.warnOnce("SubtypeGroupLayer currently only supports rotation visualVariables. All other visualVariable types will be ignored."),e=d(c.visualVariables.filter((e=>"size"!==e.type))));const u={symbologyType:o.DEFAULT,vvFlags:e,maxVVSize:0},b=_(n,a,c,u,i),v=C(n,a,c),T=g&&m;if("dictionary"===b.type)throw new t(h,"Dictionary renderer is not supported in subtype layers");if("subtype"===b.type)throw new t(h,"Nested subtype renderers is not supported");if(null!=v&&"subtype"===v.type)throw new t(h,"Nested subtype storage is not supported");if(null!=v&&null!=v.attributeMapping)throw new t(h,"Non-visual-variable attributes are not supported in subtype layers");if("heatmap"===b.type)throw new t(h,"Heatmaps are not supported in subtype layers");if("pie-chart"===b.type)throw new t(h,"Pie-charts are not supported in subtype layers");if(f.has(y))throw new t(h,"Subtype codes for sublayers must be unique");f.add(y),r.renderers[y]=b,s.mapping[y]=v,T&&(l.classes[y]=T.map((e=>U(n,e,"feature",p++,u,i))))}return u}if("heatmap"===e.renderer?.type&&"raster"===c()){const{radius:t,fieldOffset:r,field:i}=e.renderer;return{type:"heatmap",aggregateFields:[],attributes:n,target:a,storage:null,mesh:{radius:t,fieldOffset:r,field:M(n,{target:a,field:i,resultType:"numeric"}).field}}}const u=B(n,e,i),f=b(e.geometryType),p=u.rendererOverride??e.renderer,y=T(p,s),m=_(n,a,p,y,i),g=C(n,a,p),v=P(n,e.orderBy,e.renderer,s),S=e.labelsVisible&&e.labelingInfo||[],E=l(S,f);let w=0;const F=[...E.map((e=>U(n,e,"feature",w++,y,i))),...u.labels.map((e=>U(n,e,"aggregate",w++,y,i)))];return{type:"symbol",target:a,attributes:n,aggregateFields:u.fields,storage:g,mesh:{matcher:m,labels:{type:"simple",classes:F},aggregateMatcher:u.matcher,sortKey:v}}}function D(e){return"heatmap"===e.renderer?.type&&"raster"===c()?{type:"heatmap"}:{type:"symbol"}}function P(e,r,i,n){if(null!=n)return null;if(null!=r&&r.length){r.length>1&&x.warn(`Layer rendering currently only supports ordering by 1 orderByInfo, but found ${r.length}. All but the first will be discarded`);const i=r[0],n="ascending"===i.order?"asc":"desc";if(i.field)return{field:i.field,order:n};if(i.valueExpression){return{fieldIndex:j(e,{type:"expression",target:"feature",valueExpression:i.valueExpression,resultType:"numeric"}).fieldIndex,order:n}}return x.error(new t(h,"Expected to find a field or valueExpression for OrderByInfo",i)),null}if(null!=i&&"unique-value"===i.type&&i.orderByClassesEnabled){return{byRenderer:!0,order:"asc"}}return null}function k(e,t){const r={mesh:!0,storage:!0};for(const i of t){const{name:t,onStatisticField:n,onStatisticExpression:s,statisticType:l}=i;let o,a;const u="numeric",d="feature";if(s){a=j(e,{type:"expression",target:d,valueExpression:s.expression,resultType:u}).fieldIndex}else{o=j(e,{type:"field",target:d,field:n,resultType:u}).field}j(e,{type:"statistic",target:"aggregate",name:t,context:r,inField:o,inFieldIndex:a,statisticType:l})}}function C(e,t,r){let i;switch(r.type){case"simple":case"class-breaks":case"unique-value":case"dictionary":i={visualVariables:!0,attributes:null};break;default:i=u(r).getStorageSpec(r)}return J(e,t,i,r)}function J(e,t,r,i){if(null==r)return null;const{visualVariables:n,attributes:s}=r;let l=null;n&&"visualVariables"in i&&(l=q(e,t,i.visualVariables));const o=null!=l?4:0;let a=null;return null!=s&&(a=s.map(((r,i)=>{const{field:n,fieldIndex:s}=M(e,{valueExpression:r.valueExpression,field:r.field,resultType:"numeric",target:t});return{binding:i+o,field:n,fieldIndex:s}}))),{type:"simple",target:t,attributeMapping:a,vvMapping:l}}function q(t,r,i){if(!i||!i.length)return[];const n={storage:!0},s="numeric";return y(i).map((e=>{const i=a(e.type),{field:l,fieldIndex:o}=M(t,{target:r,valueExpression:e.valueExpression,field:e.field,context:n,resultType:s});switch(e.type){case"size":return"$view.scale"===e.valueExpression?null:{type:"size",binding:i,field:l,fieldIndex:o,normalizationField:M(t,{target:r,field:e.normalizationField,context:n,resultType:s}).field,valueRepresentation:e.valueRepresentation??null};case"color":return{type:"color",binding:i,field:l,fieldIndex:o,normalizationField:M(t,{target:r,field:e.normalizationField,context:n,resultType:s}).field};case"opacity":return{type:"opacity",binding:i,field:l,fieldIndex:o,normalizationField:M(t,{target:r,field:e.normalizationField,context:n,resultType:s}).field};case"rotation":return{type:"rotation",binding:i,field:l,fieldIndex:o}}})).filter(e)}function _(e,t,r,i,n=!1){const s=e??{indexCount:0,fields:{}};switch(r.type){case"simple":case"dot-density":return G(s,r,i,n);case"class-breaks":return $(s,t,r,i,n);case"unique-value":return K(s,t,r,i,n);case"dictionary":return Y(s,r,i,n);case"heatmap":return Q(s,r,i,n);case"pie-chart":return H(s,r,i,n)}}function G(e,t,r,i=!1){const n=t.getSymbols(),s=n.length?n[0]:null;return{type:"simple",symbol:f(s,r,i),symbologyType:r.symbologyType}}function H(e,t,r,i=!1){const n=t.getSymbols(),s=n[0],l=n.length>1?n[1]:null;return{type:"pie-chart",markerSymbol:f(s,r,i),fillSymbol:f(l,r,i),symbologyType:r.symbologyType}}function $(e,t,r,i,n=!1){const s={mesh:!0,use:"renderer.field"},l=r.backgroundFillSymbol,{field:o,fieldIndex:a}=M(e,{target:t,field:r.field,valueExpression:r.valueExpression,resultType:"numeric",context:s}),u=r.normalizationType,d="log"===u?"esriNormalizeByLog":"percent-of-total"===u?"esriNormalizeByPercentOfTotal":"field"===u?"esriNormalizeByField":null,p=r.classBreakInfos.map((e=>({symbol:f(e.symbol,i,n),min:e.minValue,max:e.maxValue}))).sort(((e,t)=>e.min-t.min));return{type:"interval",attributes:e.fields,field:o,fieldIndex:a,backgroundFillSymbol:f(l,i,n),defaultSymbol:f(r.defaultSymbol,i,n),intervals:p,normalizationField:r.normalizationField,normalizationTotal:r.normalizationTotal,normalizationType:d,isMaxInclusive:r.isMaxInclusive,symbologyType:i.symbologyType}}function K(e,r,i,n,s=!1){const l=[],o=i.backgroundFillSymbol,a={target:r,context:{mesh:!0},resultType:"string"};if(i.field&&"string"!=typeof i.field)throw new t(h,"Expected renderer.field to be a string",i);const{field:u,fieldIndex:d}=M(e,{...a,field:i.field,valueExpression:i.valueExpression});for(const t of i.uniqueValueInfos??[])l.push({value:""+t.value,symbol:f(t.symbol,n,s)});return{type:"map",attributes:e.fields,field:u,fieldIndex:d,field2:M(e,{...a,field:i.field2}).field,field3:M(e,{...a,field:i.field3}).field,fieldDelimiter:i.fieldDelimiter??void 0,backgroundFillSymbol:f(o,n),defaultSymbol:f(i.defaultSymbol,n),map:l,symbologyType:n.symbologyType}}function Y(e,t,r,i=!1){return{type:"dictionary",config:t.config,fieldMap:t.fieldMap,scaleExpression:t.scaleExpression,url:t.url,symbolOptions:r,symbologyType:r.symbologyType}}function Q(e,t,r,i=!1){const n=t.getSymbols(),s=n.length?n[0]:null;return{type:"heatmap",symbol:f(s,r,i),symbologyType:r.symbologyType}}export{k as addAggregateFields,_ as createMatcherSchema,M as createRendererAttributeSchema,E as createSchema,f as createSymbolSchema,T as createSymbolSchemaOptions};
5
+ import{isSome as e}from"../../../../core/arrayUtils.js";import t from"../../../../core/Error.js";import has from"../../../../core/has.js";import r from"../../../../core/Logger.js";import{pt2px as i}from"../../../../core/screenUtils.js";import{sqlAnd as n}from"../../../../core/sql.js";import{diff as s}from"../../../../core/accessorSupport/diffUtils.js";import{validateLabelingInfo as l}from"../../../../layers/support/labelingInfo.js";import{WGLSymbologyType as o}from"../../engine/webgl/enums.js";import{getVVType as a}from"../../engine/webgl/Utils.js";import{getTechniqueFromRenderer as u}from"../../engine/webgl/techniques/utils.js";import{getVVFlags as d}from"../../engine/webgl/util/vvFlagUtils.js";import{createSymbolSchema as f}from"./createSymbolSchema.js";import{getPtMaxVVSize as p}from"./support/pixelBuffering.js";import{getSupportedHeatmapRenderer as c,simplifyVisualVariables as y}from"./support/rendererUtils.js";import{injectDynamicLevelDependentSizeVisualVariable as m,createClusterRenderer as g}from"../support/clusterUtils.js";import{toJSONGeometryType as b}from"../support/util.js";const x=r.getLogger("esri.views.2d.layers.features.schemaUtils"),h="ValidationError";function v(e){return e}function T(e,t){let r=0,i=0,n=o.DEFAULT;if(null!=e){if(i=p(e,t),"visualVariables"in e&&(r=d(e.visualVariables||[]),"dot-density"===e.type&&(n=o.DOT_DENSITY)),"heatmap"===e.type&&(n=o.HEATMAP),"dictionary"===e.type)return{maxVVSize:i,vvFlags:r,symbologyType:o.DEFAULT};if("pie-chart"===e.type)return{maxVVSize:i,vvFlags:r,symbologyType:o.PIE_CHART};if(n!==o.DOT_DENSITY&&n!==o.HEATMAP){const t=e.getSymbols();"backgroundFillSymbol"in e&&e.backgroundFillSymbol&&t.push(e.backgroundFillSymbol);let r=!0,i=!0;for(const e of t)if("cim"!==e.type&&"web-style"!==e.type||(i=!1),"simple-fill"===e.type||"picture-fill"===e.type){const t=e.outline,n=t&&"none"!==t.style&&"solid"!==t.style,s="simple-fill"===e.type&&"none"!==e.style&&"solid"!==e.style;n&&(r=!1),("picture-fill"===e.type||s||n)&&(i=!1)}r?n=i?o.OUTLINE_FILL_SIMPLE:o.OUTLINE_FILL:i&&(n=o.SIMPLE)}}return{vvFlags:r,maxVVSize:i,symbologyType:n}}let S=null;function w(e){if(has("esri-2d-update-debug")){const t=E(e,!0);console.debug("Created new schema",t),console.debug("Schema diff",s(S,t)),S=t}return E(e)}function E(e,t=!1){try{const r=R(e,t),i=D(e),s={};r.map((t=>F(s,e,t)));const l=null!=e.subtypeCode?`${e.subtypeField} = ${e.subtypeCode}`:null,o=n(e.definitionExpression,l);return{source:{definitionExpression:o,fields:e.fields.map((e=>e.toJSON())),gdbVersion:e.gdbVersion,historicMoment:e.historicMoment?.getTime(),outFields:e.availableFields,pixelBuffer:e.pixelBuffer,spatialReference:e.spatialReference.toJSON(),timeExtent:e.timeExtent?.toJSON(),customParameters:e.customParameters},attributes:{fields:{},indexCount:0},processors:r,tileRenderer:i,targets:s}}catch(r){if(r.fieldName===h)return x.error(r),null;throw r}}function F(e,r,i){switch(i.target){case"feature":return void O(e,V(r),i);case"aggregate":{if(!("featureReduction"in r))return;const n=r.featureReduction;switch(n?.type){case"selection":throw new t(h,"Mapview does not support `selection` reduction type",n);case"binning":return O(e,V(r),i),void N(e,n,r.fields.map((e=>e.toJSON())),i);case"cluster":return O(e,V(r),i),void L(e,n,r.fields.map((e=>e.toJSON())),i)}}}}function I(e,t){for(const r in t){const i=t[r];if(i.target!==e.name)continue;const n=e.attributes[r];if(n?.context){const e=n.context;e.mesh=e.mesh||i.context?.mesh,e.storage=e.storage||i.context?.storage}else e.attributes[r]=i}return e}function V(e){return[e.filter?.toJSON()??null,e.featureEffect?.filter?.toJSON()??null]}function O(e,t,r){return e.feature||(e.feature={name:"feature",input:"source",filters:t,attributes:{}}),I(e.feature,r.attributes.fields),e}function z(e,r){const{onStatisticExpression:i,onStatisticField:n,statisticType:s}=e;switch(s){case"min":case"max":case"avg":case"avg_angle":case"sum":case"count":return"esriFieldTypeDouble";case"mode":{if(i){const{returnType:r}=i;return r?"string"===r?"esriFieldTypeString":"esriFieldTypeDouble":(x.error(new t(h,"Unable to infer type of aggregateField with onStatisticExpression. ReturnType is not defined",e)),"esriFieldTypeString")}const s=r.find((e=>e.name===n));return s?s.type:(x.error(new t(h,"Unable to infer type of aggregateField with onStatisticExpression. ReturnType is not defined",e)),"esriFieldTypeString")}}}function N(e,t,r,i){return e.aggregate||(e.aggregate={name:"aggregate",type:"bin",filters:null,input:"feature",params:{fixedBinLevel:t.fixedBinLevel,fields:(t.fields??[]).map((e=>({...e.toJSON(),type:z(e,r)})))},attributes:{}}),I(e.aggregate,i.attributes.fields),e}function L(e,t,r,n){const s=n.aggregateFields??[],l=new Set;for(const i of s)l.add(i.name);for(const i of t?.fields??[])l.has(i.name)||s.push(i);return e.aggregate||(e.aggregate={name:"aggregate",type:"cluster",input:"feature",filters:null,attributes:{},params:{clusterRadius:i(t.clusterRadius/2),clusterPixelBuffer:64*Math.ceil(i(t.clusterMaxSize)/64),fields:s.map((e=>({...e.toJSON(),type:z(e,r)})))}}),I(e.aggregate,n.attributes.fields),e}function M(e,t){return t.field?j(e,{...t,type:"field",field:t.field}):t.valueExpression?j(e,{...t,type:"expression",valueExpression:t.valueExpression}):{field:void 0,fieldIndex:void 0}}function j(e,t){switch(t.type){case"expression":{const r=v(t.valueExpression);if(!e.fields[r]){const i=e.indexCount++;e.fields[r]={...t,name:r,fieldIndex:i}}return{fieldIndex:e.fields[r].fieldIndex}}case"label-expression":{const r=v(JSON.stringify(t.label));if(!e.fields[r]){const i=e.indexCount++;e.fields[r]={...t,name:r,fieldIndex:i}}return{fieldIndex:e.fields[r].fieldIndex}}case"field":{const r=t.field;return"aggregate"===t.target&&e.fields[r]||(e.fields[r]={...t,name:r}),{field:r}}case"statistic":return e.fields[t.name]={...t},{field:t.name}}}function R(e,t=!1){const r=new Array;let i=0;return r.push(A(e,i++,t)),r}function U(e,t,r,i,n,s=!1){const l=j(e,{type:"label-expression",target:r,context:{mesh:!0},resultType:"string",label:{labelExpression:t.labelExpression,labelExpressionInfo:t.labelExpressionInfo?{expression:t.labelExpressionInfo.expression}:null,symbol:!!t.symbol,where:t.where}}),{fieldIndex:o}=l;return{...f(t,n,s),fieldIndex:o,target:r,index:i}}function B(e,r,i){const n="featureReduction"in r&&r.featureReduction;if(!n)return{fields:[],labels:[],matcher:void 0,rendererOverride:void 0};const s="aggregate",o=[];let a=null,u=b(r.geometryType),d=[],p=null;if(n)switch(n.type){case"selection":return x.error(new t(h,"Mapview does not support `selection` reduction type",n)),{fields:[],labels:[],matcher:void 0,rendererOverride:void 0};case"cluster":case"binning":if(o.push(...n.fields??[]),"cluster"===n.type?u="esriGeometryPoint":"binning"===n.type&&(u="esriGeometryPolygon"),n.renderer&&!n.renderer.authoringInfo?.isAutoGenerated){if("cluster"===n.type){const{renderer:e}=m(n.renderer,n,null);p=e}else p=n.renderer;const t=T(n.renderer,n);a=_(e,s,n.renderer,t,i),d=n&&n.labelsVisible&&n.labelingInfo||[]}else if("cluster"===n.type){if(p=g(o,r.renderer,n,null,!0),n.symbol){const e=T(p,n);a={type:"simple",symbol:f(n.symbol,e,i),symbologyType:e.symbologyType}}d=n&&n.labelsVisible&&n.labelingInfo||[]}}k(e,o);return{labels:l(d,"binning"===n.type?"esriGeometryPolygon":u),matcher:a,fields:o,rendererOverride:p}}function A(e,r,i=!1){const n={indexCount:0,fields:{}},s="featureReduction"in e?e.featureReduction??void 0:void 0,a=s?"aggregate":"feature";if("sublayers"in e){const r={type:"subtype",subtypeField:e.subtypeField,renderers:{},symbologyType:o.DEFAULT},s={type:"subtype",mapping:{},target:"feature",subtypeField:e.subtypeField},l={type:"subtype",classes:{}},u={type:"symbol",target:"feature",aggregateFields:[],attributes:n,storage:s,mesh:{matcher:r,aggregateMatcher:null,labels:l,sortKey:null}},f=new Set;let p=0;for(const{renderer:c,subtypeCode:y,labelingInfo:m,labelsVisible:g}of e.sublayers){let e=0;"visualVariables"in c&&c.visualVariables&&(c.visualVariables.some((e=>"rotation"!==e.type))&&x.warnOnce("SubtypeGroupLayer currently only supports rotation visualVariables. All other visualVariable types will be ignored."),e=d(c.visualVariables.filter((e=>"size"!==e.type))));const u={symbologyType:o.DEFAULT,vvFlags:e,maxVVSize:0},b=_(n,a,c,u,i),v=C(n,a,c),T=g&&m;if("dictionary"===b.type)throw new t(h,"Dictionary renderer is not supported in subtype layers");if("subtype"===b.type)throw new t(h,"Nested subtype renderers is not supported");if(null!=v&&"subtype"===v.type)throw new t(h,"Nested subtype storage is not supported");if(null!=v&&null!=v.attributeMapping)throw new t(h,"Non-visual-variable attributes are not supported in subtype layers");if("heatmap"===b.type)throw new t(h,"Heatmaps are not supported in subtype layers");if("pie-chart"===b.type)throw new t(h,"Pie-charts are not supported in subtype layers");if(f.has(y))throw new t(h,"Subtype codes for sublayers must be unique");f.add(y),r.renderers[y]=b,s.mapping[y]=v,T&&(l.classes[y]=T.map((e=>U(n,e,"feature",p++,u,i))))}return u}if("heatmap"===e.renderer?.type&&"raster"===c()){const{radius:t,fieldOffset:r,field:i}=e.renderer;return{type:"heatmap",aggregateFields:[],attributes:n,target:a,storage:null,mesh:{radius:t,fieldOffset:r,field:M(n,{target:a,field:i,resultType:"numeric"}).field}}}const u=B(n,e,i),f=b(e.geometryType),p=u.rendererOverride??e.renderer,y=T(p,s),m=_(n,a,p,y,i),g=C(n,a,p),v=P(n,e.orderBy,e.renderer,s),S=e.labelsVisible&&e.labelingInfo||[],w=l(S,f);let E=0;const F=[...w.map((e=>U(n,e,"feature",E++,y,i))),...u.labels.map((e=>U(n,e,"aggregate",E++,y,i)))];return{type:"symbol",target:a,attributes:n,aggregateFields:u.fields,storage:g,mesh:{matcher:m,labels:{type:"simple",classes:F},aggregateMatcher:u.matcher,sortKey:v}}}function D(e){return"heatmap"===e.renderer?.type&&"raster"===c()?{type:"heatmap"}:{type:"symbol"}}function P(e,r,i,n){if(null!=n)return null;if(null!=r&&r.length){r.length>1&&x.warn(`Layer rendering currently only supports ordering by 1 orderByInfo, but found ${r.length}. All but the first will be discarded`);const i=r[0],n="ascending"===i.order?"asc":"desc";if(i.field)return{field:i.field,order:n};if(i.valueExpression){return{fieldIndex:j(e,{type:"expression",target:"feature",valueExpression:i.valueExpression,resultType:"numeric"}).fieldIndex,order:n}}return x.error(new t(h,"Expected to find a field or valueExpression for OrderByInfo",i)),null}if(null!=i&&"unique-value"===i.type&&i.orderByClassesEnabled){return{byRenderer:!0,order:"asc"}}return null}function k(e,t){const r={mesh:!0,storage:!0};for(const i of t){const{name:t,onStatisticField:n,onStatisticExpression:s,statisticType:l}=i;let o,a;const u="numeric",d="feature";if(s){a=j(e,{type:"expression",target:d,valueExpression:s.expression,resultType:u}).fieldIndex}else{o=j(e,{type:"field",target:d,field:n,resultType:u}).field}j(e,{type:"statistic",target:"aggregate",name:t,context:r,inField:o,inFieldIndex:a,statisticType:l})}}function C(e,t,r){let i;switch(r.type){case"simple":case"class-breaks":case"unique-value":case"dictionary":i={visualVariables:!0,attributes:null};break;default:i=u(r).getStorageSpec(r)}return J(e,t,i,r)}function J(e,t,r,i){if(null==r)return null;const{visualVariables:n,attributes:s}=r;let l=null;n&&"visualVariables"in i&&(l=q(e,t,i.visualVariables));const o=null!=l?4:0;let a=null;return null!=s&&(a=s.map(((r,i)=>{const{field:n,fieldIndex:s}=M(e,{valueExpression:r.valueExpression,field:r.field,resultType:"numeric",target:t});return{binding:i+o,field:n,fieldIndex:s}}))),{type:"simple",target:t,attributeMapping:a,vvMapping:l}}function q(t,r,i){if(!i||!i.length)return[];const n={storage:!0},s="numeric";return y(i).map((e=>{const i=a(e.type),{field:l,fieldIndex:o}=M(t,{target:r,valueExpression:e.valueExpression,field:e.field,context:n,resultType:s});switch(e.type){case"size":return"$view.scale"===e.valueExpression?null:{type:"size",binding:i,field:l,fieldIndex:o,normalizationField:M(t,{target:r,field:e.normalizationField,context:n,resultType:s}).field,valueRepresentation:e.valueRepresentation??null};case"color":return{type:"color",binding:i,field:l,fieldIndex:o,normalizationField:M(t,{target:r,field:e.normalizationField,context:n,resultType:s}).field};case"opacity":return{type:"opacity",binding:i,field:l,fieldIndex:o,normalizationField:M(t,{target:r,field:e.normalizationField,context:n,resultType:s}).field};case"rotation":return{type:"rotation",binding:i,field:l,fieldIndex:o}}})).filter(e)}function _(e,t,r,i,n=!1){const s=e??{indexCount:0,fields:{}};switch(r.type){case"simple":case"dot-density":return G(s,r,i,n);case"class-breaks":return $(s,t,r,i,n);case"unique-value":return K(s,t,r,i,n);case"dictionary":return Y(s,r,i,n);case"heatmap":return Q(s,r,i,n);case"pie-chart":return H(s,r,i,n)}}function G(e,t,r,i=!1){const n=t.getSymbols(),s=n.length?n[0]:null;return{type:"simple",symbol:f(s,r,i),symbologyType:r.symbologyType}}function H(e,t,r,i=!1){const n=t.getSymbols(),s=n[0],l=n.length>1?n[1]:null;return{type:"pie-chart",markerSymbol:f(s,r,i),fillSymbol:f(l,r,i),symbologyType:r.symbologyType}}function $(e,t,r,i,n=!1){const s={mesh:!0,use:"renderer.field"},l=r.backgroundFillSymbol,{field:o,fieldIndex:a}=M(e,{target:t,field:r.field,valueExpression:r.valueExpression,resultType:"numeric",context:s}),u=r.normalizationType,d="log"===u?"esriNormalizeByLog":"percent-of-total"===u?"esriNormalizeByPercentOfTotal":"field"===u?"esriNormalizeByField":null,p=r.classBreakInfos.map((e=>({symbol:f(e.symbol,i,n),min:e.minValue,max:e.maxValue}))).sort(((e,t)=>e.min-t.min));return{type:"interval",attributes:e.fields,field:o,fieldIndex:a,backgroundFillSymbol:f(l,i,n),defaultSymbol:f(r.defaultSymbol,i,n),intervals:p,normalizationField:r.normalizationField,normalizationTotal:r.normalizationTotal,normalizationType:d,isMaxInclusive:r.isMaxInclusive,symbologyType:i.symbologyType}}function K(e,r,i,n,s=!1){const l=[],o=i.backgroundFillSymbol,a={target:r,context:{mesh:!0},resultType:"string"};if(i.field&&"string"!=typeof i.field)throw new t(h,"Expected renderer.field to be a string",i);const{field:u,fieldIndex:d}=M(e,{...a,field:i.field,valueExpression:i.valueExpression});for(const t of i.uniqueValueInfos??[])l.push({value:""+t.value,symbol:f(t.symbol,n,s)});return{type:"map",attributes:e.fields,field:u,fieldIndex:d,field2:M(e,{...a,field:i.field2}).field,field3:M(e,{...a,field:i.field3}).field,fieldDelimiter:i.fieldDelimiter??void 0,backgroundFillSymbol:f(o,n),defaultSymbol:f(i.defaultSymbol,n),map:l,symbologyType:n.symbologyType}}function Y(e,t,r,i=!1){return{type:"dictionary",config:t.config,fieldMap:t.fieldMap,scaleExpression:t.scaleExpression,url:t.url,symbolOptions:r,symbologyType:r.symbologyType}}function Q(e,t,r,i=!1){const n=t.getSymbols(),s=n.length?n[0]:null;return{type:"heatmap",symbol:f(s,r,i),symbologyType:r.symbologyType}}export{k as addAggregateFields,_ as createMatcherSchema,M as createRendererAttributeSchema,w as createSchema,f as createSymbolSchema,T as createSymbolSchemaOptions};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.27/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../../../chunks/tslib.es6.js";import{handlesGroup as t,makeHandle as i}from"../../../../../core/handleUtils.js";import{destroyMaybe as r}from"../../../../../core/maybe.js";import{watch as s,when as n,syncAndInitial as a}from"../../../../../core/reactiveUtils.js";import{property as o}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/accessorSupport/ensureType.js";import"../../../../../core/arrayUtils.js";import"../../../../../core/has.js";import{subclass as l}from"../../../../../core/accessorSupport/decorators/subclass.js";import{s as c}from"../../../../../chunks/vec3.js";import{c as p}from"../../../../../chunks/vec3f64.js";import{getEffectiveElevationInfo as m,getEffectiveElevationMode as h}from"../../../../../support/elevationInfoUtils.js";import u from"../../../../../symbols/support/ElevationInfo.js";import{SegmentLabels3D as d}from"../../SegmentLabels3D.js";import{SnappingVisualizer3D as v}from"../../SnappingVisualizer3D.js";import{meshTransformFastUpdateHandles as f}from"../meshFastUpdateUtils.js";import{getSettings as V}from"../settings.js";import{ExtendedLineVisualElement as y}from"../../visualElements/ExtendedLineVisualElement.js";import{OutlineVisualElement as E}from"../../visualElements/OutlineVisualElement.js";import{VerticesVisualElement as w}from"../../visualElements/VerticesVisualElement.js";import{evaluateElevationAlignmentAtPoint as _}from"../../../layers/graphics/elevationAlignmentUtils.js";import{ElevationContext as g}from"../../../layers/graphics/ElevationContext.js";import{GraphicState as j}from"../../../layers/graphics/GraphicState.js";import{RenderOccludedFlag as G}from"../../../webgl-engine/lib/Material.js";import{DrawGraphicTool as S,geometryTypeToDrawOperationGeometryType as I}from"../../../../draw/DrawGraphicTool.js";import{DrawOperation as L}from"../../../../draw/DrawOperation.js";import{SceneDrawSurface as O,ElevationDrawSurface as x}from"../../../../draw/drawSurfaces.js";import{unitRGBAFromColor as D}from"../../../../support/colorUtils.js";let T=class extends S{constructor(e){super(e),this._activeVertexVisualElement=null,this._createGraphicState=null,this._outlineVisualElement=null,this._verticesVisualElement=null,this._verticalLineVisualElement=null,this.geometryType=null,this.type="draw-3d"}initialize(){const{mode:e,offset:t}=this.elevationInfo;this.internalGraphicsLayer.elevationInfo=new u({mode:e,offset:t})}normalizeCtorArgs(e){if(!e.elevationInfo){const t=e.hasZ??!0;return{...e,elevationInfo:m(t)}}return e}initializeGraphic(e){const{drawOperation:r,view:o}=this,l=this._createGraphicState=new j({graphic:e});r.loading=!0;const c=i((()=>r.loading=!1));let p;const m=()=>p&&cancelAnimationFrame(p),h=()=>{m(),p=requestAnimationFrame((()=>c.remove()))};return t([o.maskOccludee(e),o.trackGraphicState(l),s((()=>({element:this._outlineVisualElement,isDraped:l.isDraped})),(({element:e,isDraped:t})=>{e&&(e.isDraped=t)}),a),i(m),n((()=>l.displaying),h,{...a,once:!0}),c,...f(l)])}makeDrawOperation(){const{geometryType:e}=this,t="circle"!==e&&"rectangle"!==e;return new L({view:this.view,manipulators:this.manipulators,geometryType:I(e),drawingMode:this.mode,hasZ:this.hasZ,defaultZ:this.defaultZ,snapToSceneEnabled:this.snapToScene,drawSurface:new O(this.view,this.elevationInfo,[this.internalGraphicsLayer]),elevationDrawSurface:new x(this.elevationInfo,this.defaultZ,this.view,this.internalGraphicsLayer),hasM:!1,elevationInfo:this.elevationInfo,snappingManager:this.snappingManager,snappingVisualizer:new v,segmentLabels:t?new d:null,labelOptions:this.labelOptions,tooltipOptions:this.tooltipOptions,isDraped:this._createGraphicState?this._createGraphicState.isDraped:"on-the-ground"===h(this.hasZ,this.elevationInfo),loading:!0})}onActiveVertexChanged(e){const{view:t}=this,s=V(t);if(this._activeVertexVisualElement)return this._activeVertexVisualElement.vertices=[e],this._updateVerticalLineVisualElement(e),null;const n=s.manipulators,a=n.vertex;this._activeVertexVisualElement=new w({view:t,spatialReference:t.spatialReference,vertices:[e],elevationInfo:this.internalGraphicsLayer.elevationInfo,color:D(a.color),size:a.size,outlineColor:D(a.outlineColor),outlineSize:a.outlineSize,renderOccluded:a.renderOccluded,attached:!1}),this._activeVertexVisualElement.color=D(n.selected.color),this._activeVertexVisualElement.attached=!0;const o=s.visualElements.zVerticalLine;return this._verticalLineVisualElement=new y({view:t,extensionType:o.extensionType,innerWidth:1,attached:!1,writeDepthEnabled:!1,renderOccluded:G.OccludeAndTransparent}),o.apply(this._verticalLineVisualElement),i((()=>{this._activeVertexVisualElement=r(this._activeVertexVisualElement),this._verticalLineVisualElement=r(this._verticalLineVisualElement)}))}_updateVerticalLineVisualElement(e){const t=this._verticalLineVisualElement;if(!t)return;const{renderCoordsHelper:i,elevationProvider:r}=this.view;c(b,e[0],e[1],e[2]),z.setFromElevationInfo(this.elevationInfo),b[2]=_(b,r,z,i);i.toRenderCoords(b,this.view.spatialReference,b)?(t.setStartEndFromWorldDownAtLocation(b),t.attached=!0):t.attached=!1}onOutlineChanged(e){if(this._outlineVisualElement)return this._outlineVisualElement.geometry=e,null;const t=this.internalGraphicsLayer.elevationInfo,{view:s}=this,n=V(s);return this._outlineVisualElement=new E({view:s,geometry:e,elevationInfo:t,isDraped:this._createGraphicState?this._createGraphicState.isDraped:"on-the-ground"===h(this.hasZ,t),attached:!1}),n.visualElements.lineGraphics.outline.apply(this._outlineVisualElement),n.visualElements.lineGraphics.shadowStyle.apply(this._outlineVisualElement),this._outlineVisualElement.attached=!0,this._outlineVisualElement.laserlineEnabled=!0,i((()=>{this._outlineVisualElement=r(this._outlineVisualElement)}))}onRegularVerticesChanged(e){if(this._verticesVisualElement)return this._verticesVisualElement.vertices=e,null;const{view:t}=this,s=V(t).manipulators.vertex;return this._verticesVisualElement=new w({view:t,spatialReference:t.spatialReference,vertices:e,elevationInfo:this.internalGraphicsLayer.elevationInfo,color:D(s.color),size:s.size,outlineColor:D(s.outlineColor),outlineSize:s.outlineSize,renderOccluded:s.renderOccluded,attached:!1}),this._verticesVisualElement.attached=!0,i((()=>{this._verticesVisualElement=r(this._verticesVisualElement)}))}_updateGraphicGeometry(e,t){if("mesh"===this.geometryType&&"point"===t?.type){const i=this.geometryToPlace;return i&&i.centerAt(t),void(i&&e.geometry===i?i.vertexSpace.isGeoreferenced?e.notifyGeometryChanged():e.notifyMeshTransformChanged():e.geometry=i)}super._updateGraphicGeometry(e,t)}};e([o({constructOnly:!0})],T.prototype,"elevationInfo",void 0),e([o({constructOnly:!0})],T.prototype,"geometryType",void 0),e([o()],T.prototype,"type",void 0),e([o({constructOnly:!0})],T.prototype,"view",void 0),T=e([l("esri.views.3d.interactive.editingTools.draw.DrawGraphicTool3D")],T);const z=new g,b=p();export{T as DrawGraphicTool3D};
5
+ import{_ as e}from"../../../../../chunks/tslib.es6.js";import{handlesGroup as t,makeHandle as i}from"../../../../../core/handleUtils.js";import{destroyMaybe as r}from"../../../../../core/maybe.js";import{watch as s,when as n,syncAndInitial as a}from"../../../../../core/reactiveUtils.js";import{property as o}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/accessorSupport/ensureType.js";import"../../../../../core/arrayUtils.js";import"../../../../../core/has.js";import{subclass as l}from"../../../../../core/accessorSupport/decorators/subclass.js";import{s as c}from"../../../../../chunks/vec3.js";import{c as p}from"../../../../../chunks/vec3f64.js";import{getEffectiveElevationInfo as h,getEffectiveElevationMode as m}from"../../../../../support/elevationInfoUtils.js";import u from"../../../../../symbols/support/ElevationInfo.js";import{SegmentLabels3D as d}from"../../SegmentLabels3D.js";import{SnappingVisualizer3D as v}from"../../SnappingVisualizer3D.js";import{meshTransformFastUpdateHandles as f}from"../meshFastUpdateUtils.js";import{getSettings as V}from"../settings.js";import{ExtendedLineVisualElement as y}from"../../visualElements/ExtendedLineVisualElement.js";import{OutlineVisualElement as E}from"../../visualElements/OutlineVisualElement.js";import{VerticesVisualElement as w}from"../../visualElements/VerticesVisualElement.js";import{evaluateElevationAlignmentAtPoint as g}from"../../../layers/graphics/elevationAlignmentUtils.js";import{ElevationContext as _}from"../../../layers/graphics/ElevationContext.js";import{GraphicState as j}from"../../../layers/graphics/GraphicState.js";import{RenderOccludedFlag as G}from"../../../webgl-engine/lib/Material.js";import{DrawGraphicTool as S,geometryTypeToDrawOperationGeometryType as I}from"../../../../draw/DrawGraphicTool.js";import{DrawOperation as L}from"../../../../draw/DrawOperation.js";import{SceneDrawSurface as O,ElevationDrawSurface as x}from"../../../../draw/drawSurfaces.js";import{unitRGBAFromColor as D}from"../../../../support/colorUtils.js";let T=class extends S{constructor(e){super(e),this._activeVertexVisualElement=null,this._createGraphicState=null,this._outlineVisualElement=null,this._verticesVisualElement=null,this._verticalLineVisualElement=null,this.geometryType=null,this.type="draw-3d"}initialize(){const{mode:e,offset:t}=this.elevationInfo;this.internalGraphicsLayer.elevationInfo=new u({mode:e,offset:t})}normalizeCtorArgs(e){if(!e.elevationInfo){const t=e.hasZ??!0;return{...e,elevationInfo:h(t)}}return e}initializeGraphic(e){const{view:i}=this,r=this._createGraphicState=new j({graphic:e});return t([i.maskOccludee(e),i.trackGraphicState(r),s((()=>({element:this._outlineVisualElement,isDraped:r.isDraped})),(({element:e,isDraped:t})=>{e&&(e.isDraped=t)}),a),this._setupLoadingIndicator(r),...f(r)])}makeDrawOperation(){const{geometryType:e}=this,t="circle"!==e&&"rectangle"!==e;return new L({view:this.view,manipulators:this.manipulators,geometryType:I(e),drawingMode:this.mode,hasZ:this.hasZ,defaultZ:this.defaultZ,snapToSceneEnabled:this.snapToScene,drawSurface:new O(this.view,this.elevationInfo,[this.internalGraphicsLayer]),elevationDrawSurface:new x(this.elevationInfo,this.defaultZ,this.view,this.internalGraphicsLayer),hasM:!1,elevationInfo:this.elevationInfo,snappingManager:this.snappingManager,snappingVisualizer:new v,segmentLabels:t?new d:null,labelOptions:this.labelOptions,tooltipOptions:this.tooltipOptions,isDraped:this._createGraphicState?this._createGraphicState.isDraped:"on-the-ground"===m(this.hasZ,this.elevationInfo)})}onActiveVertexChanged(e){const{view:t}=this,s=V(t);if(this._activeVertexVisualElement)return this._activeVertexVisualElement.vertices=[e],this._updateVerticalLineVisualElement(e),null;const n=s.manipulators,a=n.vertex;this._activeVertexVisualElement=new w({view:t,spatialReference:t.spatialReference,vertices:[e],elevationInfo:this.internalGraphicsLayer.elevationInfo,color:D(a.color),size:a.size,outlineColor:D(a.outlineColor),outlineSize:a.outlineSize,renderOccluded:a.renderOccluded,attached:!1}),this._activeVertexVisualElement.color=D(n.selected.color),this._activeVertexVisualElement.attached=!0;const o=s.visualElements.zVerticalLine;return this._verticalLineVisualElement=new y({view:t,extensionType:o.extensionType,innerWidth:1,attached:!1,writeDepthEnabled:!1,renderOccluded:G.OccludeAndTransparent}),o.apply(this._verticalLineVisualElement),i((()=>{this._activeVertexVisualElement=r(this._activeVertexVisualElement),this._verticalLineVisualElement=r(this._verticalLineVisualElement)}))}_updateVerticalLineVisualElement(e){const t=this._verticalLineVisualElement;if(!t)return;const{renderCoordsHelper:i,elevationProvider:r}=this.view;c(b,e[0],e[1],e[2]),z.setFromElevationInfo(this.elevationInfo),b[2]=g(b,r,z,i);i.toRenderCoords(b,this.view.spatialReference,b)?(t.setStartEndFromWorldDownAtLocation(b),t.attached=!0):t.attached=!1}onOutlineChanged(e){if(this._outlineVisualElement)return this._outlineVisualElement.geometry=e,null;const t=this.internalGraphicsLayer.elevationInfo,{view:s}=this,n=V(s);return this._outlineVisualElement=new E({view:s,geometry:e,elevationInfo:t,isDraped:this._createGraphicState?this._createGraphicState.isDraped:"on-the-ground"===m(this.hasZ,t),attached:!1}),n.visualElements.lineGraphics.outline.apply(this._outlineVisualElement),n.visualElements.lineGraphics.shadowStyle.apply(this._outlineVisualElement),this._outlineVisualElement.attached=!0,this._outlineVisualElement.laserlineEnabled=!0,i((()=>{this._outlineVisualElement=r(this._outlineVisualElement)}))}onRegularVerticesChanged(e){if(this._verticesVisualElement)return this._verticesVisualElement.vertices=e,null;const{view:t}=this,s=V(t).manipulators.vertex;return this._verticesVisualElement=new w({view:t,spatialReference:t.spatialReference,vertices:e,elevationInfo:this.internalGraphicsLayer.elevationInfo,color:D(s.color),size:s.size,outlineColor:D(s.outlineColor),outlineSize:s.outlineSize,renderOccluded:s.renderOccluded,attached:!1}),this._verticesVisualElement.attached=!0,i((()=>{this._verticesVisualElement=r(this._verticesVisualElement)}))}_updateGraphicGeometry(e,t){if("mesh"===this.geometryType&&"point"===t?.type){const i=this.geometryToPlace;return i&&i.centerAt(t),void(i&&e.geometry===i?i.vertexSpace.isGeoreferenced?e.notifyGeometryChanged():e.notifyMeshTransformChanged():e.geometry=i)}super._updateGraphicGeometry(e,t)}_setupLoadingIndicator(e){const{drawOperation:r}=this;if(!this.geometryToPlace)return r.loading=!1,null;r.loading=!0;const s=i((()=>{r.loading=!1}));let o;const l=()=>o&&cancelAnimationFrame(o);return t([n((()=>e.displaying),(()=>{l(),o=requestAnimationFrame((()=>s.remove()))}),{...a,once:!0}),i(l),s])}};e([o({constructOnly:!0})],T.prototype,"elevationInfo",void 0),e([o({constructOnly:!0})],T.prototype,"geometryType",void 0),e([o()],T.prototype,"type",void 0),e([o({constructOnly:!0})],T.prototype,"view",void 0),T=e([l("esri.views.3d.interactive.editingTools.draw.DrawGraphicTool3D")],T);const z=new _,b=p();export{T as DrawGraphicTool3D};