@arcgis/core 5.0.0-next.70 → 5.0.0-next.71

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 (498) hide show
  1. package/analysis/Dimension/types.d.ts +5 -1
  2. package/analysis/DistanceMeasurementAnalysis.d.ts +22 -3
  3. package/analysis/ElevationProfile/types.d.ts +10 -2
  4. package/analysis/ShadowCast/DiscreteOptions.d.ts +4 -0
  5. package/analysis/ShadowCast/MinDurationOptions.d.ts +7 -0
  6. package/analysis/ShadowCast/TotalDurationOptions.d.ts +4 -0
  7. package/analysis/ShadowCastAnalysis.d.ts +51 -8
  8. package/analysis/Slice/types.d.ts +5 -1
  9. package/analysis/VolumeMeasurement/types.d.ts +5 -1
  10. package/analysis/VolumeMeasurement/volumeMeasurementConfiguration.js +1 -1
  11. package/analysis/types.d.ts +39 -7
  12. package/applications/Components/QuantityFormatter.js +1 -1
  13. package/applications/Components/imageryUtils.d.ts +2 -2
  14. package/applications/Components/testUtils.d.ts +2 -0
  15. package/applications/KnowledgeStudio/dataModelVisualization.d.ts +1 -0
  16. package/applications/KnowledgeStudio/generalSdkInternalAccess.d.ts +59 -13
  17. package/applications/KnowledgeStudio/generalSharedKgUtils.d.ts +1 -1
  18. package/applications/PortalApp/layerUtils.d.ts +1 -0
  19. package/applications/Urban/LineImagePattern3D.d.ts +2 -0
  20. package/applications/Urban/imagePatternUtils.d.ts +4 -0
  21. package/arcade.d.ts +20 -11
  22. package/assets/esri/core/workers/RemoteClient.js +1 -1
  23. package/assets/esri/core/workers/chunks/1b284a6f32effe28aafc.js +1 -0
  24. package/assets/esri/core/workers/chunks/1bd5b421152fb0f46aa5.js +37 -0
  25. package/assets/esri/core/workers/chunks/{2e2c47f8a80ee9234350.js → 1d8fc0239c907ff5d1e8.js} +1 -1
  26. package/assets/esri/core/workers/chunks/{244006d4b0547d574401.js → 25abbe1663e18e677dc2.js} +143 -140
  27. package/assets/esri/core/workers/chunks/{c448540065690cac0744.js → 6087d5dc40bb62ec48c8.js} +1 -1
  28. package/assets/esri/core/workers/chunks/{866477acdf03b8a40bc9.js → bd1d159dce4094694c93.js} +1 -1
  29. package/assets/esri/core/workers/chunks/{401ce5cb98fa14c1a725.js → d8a7004c399d539aed09.js} +1 -1
  30. package/assets/esri/core/workers/chunks/{8d6641d0f7c93f83c414.js → db9c7182847e8f96ffe3.js} +1 -1
  31. package/assets/esri/core/workers/chunks/{6c9dac4a869742cc2718.js → e246b256347a281c13fd.js} +1 -1
  32. package/assets/esri/core/workers/chunks/{a10c6dd3bb8b3602de68.js → ee175fd4ec706f7878c0.js} +1 -1
  33. package/assets/esri/core/workers/chunks/f65b27fc0bc2f242aac7.js +1 -0
  34. package/assets/esri/core/workers/chunks/{5dd5be91038df8902dc4.js → f7dfbf24859f4ac2421b.js} +1 -1
  35. package/config.js +1 -1
  36. package/core/Version.d.ts +11 -2
  37. package/core/accessorSupport/types.d.ts +35 -5
  38. package/core/quantityFormatUtils.js +1 -1
  39. package/core/sql/types.d.ts +226 -31
  40. package/core/types.d.ts +24 -4
  41. package/editing/sharedTemplates/types.d.ts +1 -0
  42. package/editing/types.d.ts +2 -0
  43. package/effects/types.d.ts +1 -0
  44. package/form/ExpressionInfo.d.ts +1 -1
  45. package/form/FormTemplate.d.ts +4 -4
  46. package/form/elements/GroupElement.d.ts +1 -1
  47. package/form/elements/RelationshipElement.d.ts +3 -3
  48. package/form/elements/inputs/attachments/AttachmentInput.d.ts +2 -1
  49. package/form/elements/inputs/attachments/AudioInput.d.ts +1 -0
  50. package/form/elements/inputs/attachments/DocumentInput.d.ts +1 -0
  51. package/form/elements/inputs/attachments/ImageInput.d.ts +1 -0
  52. package/form/elements/inputs/attachments/Input.d.ts +5 -1
  53. package/form/elements/inputs/attachments/SignatureInput.d.ts +1 -0
  54. package/form/elements/inputs/attachments/VideoInput.d.ts +1 -0
  55. package/form/elements/inputs/attachments/types.d.ts +12 -3
  56. package/form/elements/inputs.d.ts +2 -2
  57. package/form/types.d.ts +3 -0
  58. package/geometry/geometryEngineTypes.d.ts +49 -9
  59. package/geometry/operators/types.d.ts +29 -4
  60. package/geometry/support/MeshVertexAttributes.d.ts +21 -2
  61. package/geometry/support/meshUtils/types.d.ts +126 -18
  62. package/geometry/types.d.ts +37 -6
  63. package/ground/NavigationConstraint.d.ts +3 -0
  64. package/identity/IdentityManagerBase.d.ts +153 -27
  65. package/interfaces.d.ts +27 -27
  66. package/intl/date.d.ts +5 -0
  67. package/intl/locale.d.ts +1 -0
  68. package/intl/messages.d.ts +12 -2
  69. package/intl/number.d.ts +5 -0
  70. package/intl/substitute.d.ts +28 -5
  71. package/intl/t9n.d.ts +13 -2
  72. package/kernel.js +1 -1
  73. package/layers/GaussianSplatLayer.d.ts +87 -6
  74. package/layers/ImageryTileLayer.d.ts +8 -8
  75. package/layers/LinkChartLayer.d.ts +1 -1
  76. package/layers/buildingSublayers/utils.d.ts +1 -0
  77. package/layers/effects/types.d.ts +12 -2
  78. package/layers/graphics/editingSupport.d.ts +202 -38
  79. package/layers/graphics/sources/ParquetSource.d.ts +23 -4
  80. package/layers/knowledgeGraph/IdTypePair.d.ts +15 -3
  81. package/layers/knowledgeGraph/KnowledgeGraphLayerDataManager.d.ts +61 -9
  82. package/layers/knowledgeGraph/LayoutMode.d.ts +1 -0
  83. package/layers/knowledgeGraph/dataModelVisualizationUtils.d.ts +6 -0
  84. package/layers/media/types.d.ts +25 -4
  85. package/layers/mixins/ArcGISImageService.d.ts +8 -9
  86. package/layers/mixins/ArcGISMapService.d.ts +5 -1
  87. package/layers/mixins/EditBusLayer.d.ts +3 -5
  88. package/layers/mixins/ImageryTileMixin.d.ts +2 -4
  89. package/layers/mixins/RasterJobHandlerMixin.js +1 -1
  90. package/layers/mixins/ScaleRange.d.ts +11 -2
  91. package/layers/mixins/properties/ILayerWithGetFeatureTitle.d.ts +11 -2
  92. package/layers/mixins/properties/ILayerWithGetField.d.ts +6 -1
  93. package/layers/ogc/ogcFeatureUtils.d.ts +2 -0
  94. package/layers/ogc/types.d.ts +55 -10
  95. package/layers/ogc/wcsUtils.d.ts +1 -0
  96. package/layers/ogc/wfsUtils.d.ts +8 -17
  97. package/layers/orientedImagery/core/ElevationSourceDefinitions.d.ts +6 -1
  98. package/layers/orientedImagery/transformations/types.d.ts +117 -21
  99. package/layers/orientedImagery/types.d.ts +37 -6
  100. package/layers/pointCloudFilters/typeUtils.d.ts +1 -0
  101. package/layers/raster/datasets/TIFFRaster.js +1 -1
  102. package/layers/raster/datasets/pixelReader.d.ts +2 -0
  103. package/layers/raster/datasets/types.d.ts +1 -0
  104. package/layers/raster/datasets/wcsCapabilitiesParser.d.ts +86 -17
  105. package/layers/raster/datasets/wcsCoverageParser.d.ts +601 -115
  106. package/layers/raster/formats/ImageCanvasDecoder.js +1 -1
  107. package/layers/raster/formats/JpgPlus.js +1 -1
  108. package/layers/raster/formats/RasterCodec.js +1 -1
  109. package/layers/raster/formats/Raw.js +1 -1
  110. package/layers/raster/formats/TiffDecoder.js +1 -1
  111. package/layers/raster/functions/changeDetectionUtils.d.ts +1 -0
  112. package/layers/raster/functions/creators/createAppearenceFunctions.d.ts +82 -15
  113. package/layers/raster/functions/creators/createBandIndexFunctions.d.ts +380 -70
  114. package/layers/raster/functions/creators/createChangeFunctions.d.ts +11 -2
  115. package/layers/raster/functions/creators/createConversionFunctions.d.ts +18 -3
  116. package/layers/raster/functions/creators/createDataManagementFunctions.d.ts +179 -35
  117. package/layers/raster/functions/creators/createLocalFunctions.d.ts +47 -9
  118. package/layers/raster/functions/creators/createMultiRasterAnalysisFunctions.d.ts +47 -9
  119. package/layers/raster/functions/creators/createStatisticsFunctions.d.ts +42 -8
  120. package/layers/raster/functions/creators/createSurfaceFunctions.d.ts +72 -11
  121. package/layers/raster/functions/focalStatUtils.d.ts +1 -0
  122. package/layers/raster/functions/rasterProjectionHelper.js +1 -1
  123. package/layers/raster/functions/types.d.ts +29 -5
  124. package/layers/raster/types.d.ts +498 -6
  125. package/layers/support/BuildingFilterBlock.d.ts +19 -3
  126. package/layers/support/BuildingFilterMode.d.ts +1 -0
  127. package/layers/support/BuildingFilterModeSolid.d.ts +7 -1
  128. package/layers/support/BuildingFilterModeWireFrame.d.ts +17 -3
  129. package/layers/support/BuildingFilterModeXRay.d.ts +7 -1
  130. package/layers/support/CodedValue.d.ts +16 -3
  131. package/layers/support/ControlPoint.d.ts +17 -3
  132. package/layers/support/EditFieldsInfo.d.ts +21 -4
  133. package/layers/support/EditingCapabilities.d.ts +36 -7
  134. package/layers/support/ElevationTileData.d.ts +25 -5
  135. package/layers/support/FieldFormat.d.ts +1 -0
  136. package/layers/support/GeoreferenceBase.d.ts +1 -0
  137. package/layers/support/KMLMapImage.d.ts +13 -2
  138. package/layers/support/LabelExpressionInfo.d.ts +9 -1
  139. package/layers/support/MosaicRule.d.ts +41 -1
  140. package/layers/support/ParquetGeometryEncodingLocation.d.ts +13 -2
  141. package/layers/support/ParquetGeometryEncodingWkb.d.ts +7 -0
  142. package/layers/support/PixelBlock.d.ts +9 -4
  143. package/layers/support/PurgeOptions.d.ts +15 -2
  144. package/layers/support/RasterInfo.d.ts +1 -2
  145. package/layers/support/RasterJobHandler.js +1 -1
  146. package/layers/support/RasterWorker.js +1 -1
  147. package/layers/support/SpriteSource.d.ts +28 -6
  148. package/layers/support/rasterFunctionConstants.d.ts +39 -0
  149. package/layers/support/types.d.ts +420 -225
  150. package/layers/types.d.ts +771 -196
  151. package/layers/video/types.d.ts +72 -14
  152. package/layers/voxel/VoxelColorStop.d.ts +17 -3
  153. package/layers/voxel/VoxelFormat.d.ts +15 -2
  154. package/layers/voxel/VoxelIsosurface.d.ts +17 -2
  155. package/layers/voxel/VoxelOpacityStop.d.ts +8 -1
  156. package/layers/voxel/VoxelRangeFilter.d.ts +12 -2
  157. package/layers/voxel/VoxelUniqueValue.d.ts +19 -3
  158. package/layers/wms/types.d.ts +104 -19
  159. package/layers/wmts/types.d.ts +1 -0
  160. package/linkChart/ChronologicalLayoutSettings.d.ts +1 -1
  161. package/linkChart/OrganicLayoutSettings.d.ts +1 -1
  162. package/linkChart/types.d.ts +2 -0
  163. package/networks/UtilityNetworkTraceAnalysis.d.ts +61 -10
  164. package/networks/support/jsonTypes.d.ts +373 -71
  165. package/networks/support/typeUtils.d.ts +10 -0
  166. package/networks/support/utils.d.ts +30 -6
  167. package/package.json +1 -1
  168. package/popup/content/types.d.ts +1 -0
  169. package/popup/types.d.ts +33 -5
  170. package/portal/jsonTypes.d.ts +231 -39
  171. package/portal/support/resourceUtils.d.ts +49 -9
  172. package/portal/types.d.ts +98 -14
  173. package/renderers/FlowRenderer.js +1 -1
  174. package/renderers/RasterStretchRenderer.d.ts +1 -1
  175. package/renderers/support/AuthoringInfoClassBreakInfo.d.ts +4 -0
  176. package/renderers/support/AuthoringInfoFieldInfo.d.ts +15 -2
  177. package/renderers/support/DotDensityLegendOptions.d.ts +4 -0
  178. package/renderers/support/HeatmapLegendOptions.d.ts +8 -0
  179. package/renderers/support/OthersCategory.d.ts +6 -0
  180. package/renderers/support/RendererLegendOptions.d.ts +14 -2
  181. package/renderers/support/pointCloud/ColorClassBreakInfo.d.ts +13 -1
  182. package/renderers/support/pointCloud/ColorModulation.d.ts +6 -0
  183. package/renderers/support/pointCloud/ColorUniqueValueInfo.d.ts +19 -3
  184. package/renderers/support/pointCloud/PointSizeAlgorithm.d.ts +1 -0
  185. package/renderers/support/pointCloud/PointSizeFixedSizeAlgorithm.d.ts +14 -2
  186. package/renderers/support/pointCloud/PointSizeSplatAlgorithm.d.ts +9 -1
  187. package/renderers/support/pointCloud/types.d.ts +7 -1
  188. package/renderers/support/raster/types.d.ts +22 -2
  189. package/renderers/support/types.d.ts +29 -2
  190. package/renderers/types.d.ts +47 -4
  191. package/renderers/visualVariables/support/SizeVariableLegendOptions.d.ts +4 -0
  192. package/renderers/visualVariables/support/VisualVariableLegendOptions.d.ts +9 -1
  193. package/request/types.d.ts +152 -24
  194. package/rest/featureService/types.d.ts +423 -77
  195. package/rest/geometryService/types.d.ts +23 -1
  196. package/rest/imageService.d.ts +5 -5
  197. package/rest/knowledgeGraph/DataModel.d.ts +2 -2
  198. package/rest/knowledgeGraph/GraphAnyValue.d.ts +1 -0
  199. package/rest/knowledgeGraph/GraphDataModelSingletonOperationResult.d.ts +12 -2
  200. package/rest/knowledgeGraph/GraphDeleteNamedTypeResult.d.ts +1 -1
  201. package/rest/knowledgeGraph/GraphDeletePropertyResult.d.ts +1 -1
  202. package/rest/knowledgeGraph/GraphQuery.d.ts +1 -1
  203. package/rest/knowledgeGraph/GraphSearch.d.ts +3 -3
  204. package/rest/knowledgeGraph/GraphSearchStreaming.d.ts +3 -3
  205. package/rest/knowledgeGraph/SearchIndex.d.ts +1 -1
  206. package/rest/knowledgeGraph/toolService/findPaths/CIMFilteredFindPathsPathFilter.d.ts +3 -3
  207. package/rest/knowledgeGraph/toolService/findPaths/CIMFilteredFindPathsResultJSON.d.ts +151 -29
  208. package/rest/knowledgeGraph/toolService/findPaths/CIMKGTraversalDirection.d.ts +1 -1
  209. package/rest/knowledgeGraph/wasmInterface/KnowledgeWasmInterface.d.ts +1 -0
  210. package/rest/knowledgeGraph/wasmInterface/WasmDataModelWrapperInterfaces.d.ts +9 -0
  211. package/rest/knowledgeGraphService.d.ts +4 -4
  212. package/rest/lastMileDelivery/types.d.ts +5 -0
  213. package/rest/layerSources/DynamicDataLayer.d.ts +12 -0
  214. package/rest/layerSources/DynamicMapLayer.d.ts +14 -2
  215. package/rest/layerSources/JoinTableDataSource.d.ts +21 -2
  216. package/rest/layerSources/QueryTableDataSource.d.ts +32 -5
  217. package/rest/layerSources/RasterDataSource.d.ts +17 -3
  218. package/rest/layerSources/TableDataSource.d.ts +22 -4
  219. package/rest/networks/circuits/support/ExportCircuitsParameters.d.ts +8 -1
  220. package/rest/networks/circuits/support/QueryCircuitsParameters.d.ts +18 -3
  221. package/rest/networks/support/QueryNamedTraceConfigurationsParameters.d.ts +22 -4
  222. package/rest/query/support/AttachmentInfo.d.ts +1 -1
  223. package/rest/support/AddressToLocationsParameters.d.ts +39 -3
  224. package/rest/support/AddressesToLocationsParameters.d.ts +14 -0
  225. package/rest/support/BaseImageMeasureResultValue.d.ts +21 -4
  226. package/rest/support/DirectionsString.d.ts +16 -3
  227. package/rest/support/ImageMeasureResultAngleValue.d.ts +12 -2
  228. package/rest/support/ImageMeasureResultAreaValue.d.ts +12 -2
  229. package/rest/support/ImageMeasureResultLengthValue.d.ts +12 -2
  230. package/rest/support/LocateSetting.d.ts +12 -2
  231. package/rest/support/LocateSettingBase.d.ts +14 -2
  232. package/rest/support/LocateSettingSource.d.ts +12 -2
  233. package/rest/support/LocateSettings.d.ts +22 -4
  234. package/rest/support/LocateSettingsOverrides.d.ts +42 -8
  235. package/rest/support/LocationToAddressParameters.d.ts +7 -0
  236. package/rest/support/NetworkAttribute.d.ts +11 -2
  237. package/rest/support/NetworkServiceDescription.d.ts +20 -4
  238. package/rest/support/QuantizationParameters.d.ts +9 -0
  239. package/rest/support/SuggestLocationsParameters.d.ts +10 -0
  240. package/rest/support/SuggestionCandidate.d.ts +14 -2
  241. package/rest/support/types.d.ts +53 -3
  242. package/rest/types.d.ts +50 -5
  243. package/rest/versionManagement/gdbVersion/support/AlterVersionParameters.d.ts +22 -4
  244. package/rest/versionManagement/gdbVersion/support/PostResult.d.ts +6 -1
  245. package/rest/versionManagement/gdbVersion/support/ReconcileParameters.d.ts +10 -1
  246. package/rest/versionManagement/gdbVersion/support/ReconcileResult.d.ts +8 -1
  247. package/rest/versionManagement/support/CreateVersionParameters.d.ts +13 -2
  248. package/rest/versionManagement/support/GetVersionInfosParameters.d.ts +8 -1
  249. package/smartMapping/heuristics/types.d.ts +50 -6
  250. package/smartMapping/popup/types.d.ts +29 -5
  251. package/smartMapping/raster/renderers/types.d.ts +12 -1
  252. package/smartMapping/raster/support/adapters/types.d.ts +1 -0
  253. package/smartMapping/renderers/color.d.ts +9 -3
  254. package/smartMapping/renderers/dotDensity.d.ts +3 -1
  255. package/smartMapping/renderers/heatmap.d.ts +3 -1
  256. package/smartMapping/renderers/location.d.ts +3 -1
  257. package/smartMapping/renderers/opacity.d.ts +3 -1
  258. package/smartMapping/renderers/pieChart.d.ts +3 -1
  259. package/smartMapping/renderers/predominance.d.ts +3 -1
  260. package/smartMapping/renderers/relationship.d.ts +3 -1
  261. package/smartMapping/renderers/size.d.ts +23 -7
  262. package/smartMapping/renderers/support/rendererUtils.d.ts +3 -1
  263. package/smartMapping/renderers/type.d.ts +3 -1
  264. package/smartMapping/renderers/univariateColorSize.d.ts +3 -1
  265. package/smartMapping/statistics/types.d.ts +16 -4
  266. package/smartMapping/symbology/type.d.ts +5 -1
  267. package/smartMapping/symbology/types.d.ts +1303 -241
  268. package/smartMapping/types.d.ts +5 -0
  269. package/statistics/types.d.ts +13 -2
  270. package/support/revision.js +1 -1
  271. package/symbols/callouts/LineCallout3DBorder.d.ts +4 -0
  272. package/symbols/cim/types.d.ts +764 -111
  273. package/symbols/patterns/LinePattern3D.d.ts +1 -0
  274. package/symbols/patterns/Pattern3D.d.ts +1 -0
  275. package/symbols/support/IconSymbol3DLayerResource.d.ts +7 -0
  276. package/symbols/support/ObjectSymbol3DLayerResource.d.ts +7 -0
  277. package/symbols/support/OccludedVisibility.d.ts +3 -0
  278. package/symbols/support/Symbol3DAnchorPosition2D.d.ts +4 -0
  279. package/symbols/support/Symbol3DAnchorPosition3D.d.ts +5 -0
  280. package/symbols/support/Symbol3DFillMaterial.d.ts +4 -0
  281. package/symbols/support/Symbol3DHalo.d.ts +10 -0
  282. package/symbols/support/Symbol3DIconOutline.d.ts +10 -0
  283. package/symbols/support/Symbol3DMaterial.d.ts +6 -0
  284. package/symbols/support/Symbol3DOutline.d.ts +21 -2
  285. package/symbols/support/Symbol3DTextBackground.d.ts +12 -2
  286. package/symbols/support/symbolUtils.d.ts +5 -1
  287. package/symbols/support/types.d.ts +4 -0
  288. package/symbols/types.d.ts +67 -7
  289. package/tables/AttributeTableTemplate.d.ts +2 -2
  290. package/tables/elements/AttributeTableAttachmentElement.d.ts +1 -1
  291. package/tables/elements/AttributeTableElement.d.ts +2 -2
  292. package/tables/elements/AttributeTableFieldElement.d.ts +1 -1
  293. package/tables/elements/AttributeTableGroupElement.d.ts +1 -1
  294. package/tables/elements/AttributeTableRelationshipElement.d.ts +1 -1
  295. package/tables/support/FieldOrder.d.ts +16 -3
  296. package/tables/support/tablesUtils.d.ts +1 -0
  297. package/time/types.d.ts +4 -0
  298. package/versionManagement/VersionManagementService.d.ts +3 -6
  299. package/versionManagement/VersionManager.d.ts +126 -23
  300. package/versionManagement/VersioningState.d.ts +1 -1
  301. package/versionManagement/support/jsonTypes.d.ts +152 -30
  302. package/versionManagement/support/type.d.ts +2 -0
  303. package/versionManagement/versionAdapters/types.d.ts +25 -5
  304. package/views/2d/MapViewConstraints.d.ts +37 -5
  305. package/views/2d/analysis/AnalysisView2D.d.ts +5 -1
  306. package/views/2d/analysis/AreaMeasurementAnalysisView2D.d.ts +28 -4
  307. package/views/2d/analysis/DistanceMeasurementAnalysisView2D.d.ts +28 -4
  308. package/views/2d/analysis/types.d.ts +5 -1
  309. package/views/2d/engine/flow/BrushFlow.js +1 -1
  310. package/views/2d/engine/flow/FlowDisplayObject.js +1 -1
  311. package/views/2d/engine/flow/FlowStrategy.js +1 -1
  312. package/views/2d/engine/flow/FlowView2D.js +1 -1
  313. package/views/2d/engine/flow/ProcessingTimeEstimate.js +5 -0
  314. package/views/2d/engine/flow/animatedValues.js +5 -0
  315. package/views/2d/engine/flow/dataUtils.js +1 -1
  316. package/views/2d/engine/flow/flowPathsIO.js +5 -0
  317. package/views/2d/engine/flow/styles/AFlowResources.js +5 -0
  318. package/views/2d/engine/flow/styles/Imagery.js +1 -1
  319. package/views/2d/engine/flow/styles/Particles.js +1 -1
  320. package/views/2d/engine/flow/styles/Stack.js +1 -1
  321. package/views/2d/engine/flow/styles/Streamlines.js +1 -1
  322. package/views/2d/engine/flow/utils.js +1 -1
  323. package/views/2d/engine/vectorTiles/shaders/sources/shaderRepository.js +1 -1
  324. package/views/2d/engine/webgl/shaders/sources/shaderRepository.js +1 -1
  325. package/views/2d/layers/support/MediaLayerInteractionOptions.d.ts +1 -0
  326. package/views/2d/layers/types.d.ts +1 -0
  327. package/views/2d/types.d.ts +93 -6
  328. package/views/3d/analysis/AnalysisView3D.d.ts +5 -1
  329. package/views/3d/analysis/DirectLineMeasurement/types.d.ts +24 -4
  330. package/views/3d/analysis/LineOfSight/types.d.ts +1 -0
  331. package/views/3d/analysis/ShadowCastAnalysisView3D.d.ts +19 -3
  332. package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementCutFillVisualization.js +1 -1
  333. package/views/3d/analysis/VolumeMeasurement/types.d.ts +5 -1
  334. package/views/3d/analysis/types.d.ts +25 -3
  335. package/views/3d/constraints/AltitudeConstraint.d.ts +5 -0
  336. package/views/3d/constraints/ClipDistanceConstraint.d.ts +13 -2
  337. package/views/3d/constraints/Constraints.d.ts +26 -4
  338. package/views/3d/constraints/TiltConstraint.d.ts +5 -0
  339. package/views/3d/environment/SceneViewEnvironment.d.ts +9 -0
  340. package/views/3d/environment/types.d.ts +3 -0
  341. package/views/3d/layers/ImageryLayerView3D.js +1 -1
  342. package/views/3d/layers/support/MediaLayerInteractionOptions.d.ts +15 -2
  343. package/views/3d/layers/support/MediaLayerInteractionReshapeOptions.d.ts +3 -0
  344. package/views/3d/types.d.ts +52 -0
  345. package/views/3d/webgl/ManagedColorAttachment.d.ts +2 -0
  346. package/views/3d/webgl/ManagedDepthAttachment.d.ts +2 -0
  347. package/views/3d/webgl/ManagedFBO.d.ts +4 -0
  348. package/views/3d/webgl/ManagedFBOAttachment.d.ts +1 -0
  349. package/views/3d/webgl/ManagedFBOResource.d.ts +5 -0
  350. package/views/3d/webgl/types.d.ts +32 -6
  351. package/views/3d/webgl-engine/core/shaderLibrary/shading/EvaluateSceneLighting.glsl.js +20 -22
  352. package/views/3d/webgl-engine/core/shaderLibrary/shading/Gamma.glsl.js +9 -5
  353. package/views/3d/webgl-engine/core/shaderLibrary/terrain/TerrainTexture.glsl.js +8 -6
  354. package/views/3d/webgl-engine/shaders/OutputColorHighlightOLID.glsl.js +9 -8
  355. package/views/MapViewOrSceneView.d.ts +1 -0
  356. package/views/SceneView.d.ts +59 -0
  357. package/views/SceneView.js +1 -1
  358. package/views/View.d.ts +2 -2
  359. package/views/View2D.d.ts +37 -0
  360. package/views/View2D.js +1 -1
  361. package/views/Viewport2DMixin.d.ts +9 -6
  362. package/views/analysis/AnalysisView.d.ts +2 -0
  363. package/views/analysis/AreaMeasurement/types.d.ts +18 -3
  364. package/views/analysis/DistanceMeasurement/types.d.ts +13 -2
  365. package/views/analysis/types.d.ts +7 -1
  366. package/views/animation/easing.js +1 -1
  367. package/views/animation/types.d.ts +3 -4
  368. package/views/draw/CursorUpdateEvent.d.ts +24 -4
  369. package/views/draw/DrawAction.d.ts +4 -6
  370. package/views/draw/DrawCompleteEvent.d.ts +18 -3
  371. package/views/draw/VertexAddEvent.d.ts +19 -3
  372. package/views/draw/VertexRemoveEvent.d.ts +19 -3
  373. package/views/draw/types.d.ts +4 -0
  374. package/views/input/types.d.ts +371 -57
  375. package/views/interactive/sketch/SketchTooltipVisibleElements.d.ts +19 -1
  376. package/views/interactive/sketch/Units.d.ts +5 -0
  377. package/views/interactive/tooltip/types.d.ts +2 -0
  378. package/views/layers/HighlightLayerViewMixin.d.ts +59 -1
  379. package/views/layers/HighlightLayerViewMixin.js +1 -1
  380. package/views/layers/ImageryLayerViewMixin.d.ts +60 -2
  381. package/views/layers/ImageryTileLayerViewMixin.d.ts +2 -0
  382. package/views/layers/LayerView.d.ts +6 -0
  383. package/views/layers/MediaLayerViewMixin.d.ts +8 -1
  384. package/views/layers/types.d.ts +3 -0
  385. package/views/navigation/types.d.ts +6 -1
  386. package/views/support/AttributionItem.d.ts +10 -2
  387. package/views/types.d.ts +306 -53
  388. package/views/ui/types.d.ts +42 -6
  389. package/webdoc/Widgets.d.ts +26 -5
  390. package/webdoc/geotriggersInfo/support/typeUtils.d.ts +3 -0
  391. package/webdoc/support/SlideThumbnail.d.ts +4 -0
  392. package/webdoc/support/types.d.ts +11 -2
  393. package/webdoc/support/webdocSaveUtils.d.ts +6 -0
  394. package/webdoc/widgets/FloorFilter.d.ts +25 -4
  395. package/webmap/Version.d.ts +1 -0
  396. package/webscene/Version.d.ts +1 -0
  397. package/webscene/support/Description.d.ts +3 -0
  398. package/webscene/support/SlideEnvironment.d.ts +6 -0
  399. package/webscene/support/SlideGround.d.ts +7 -1
  400. package/webscene/support/SlideVisibleLayer.d.ts +5 -0
  401. package/webscene/support/Title.d.ts +3 -0
  402. package/widgets/Attachments/types.d.ts +32 -6
  403. package/widgets/BasemapGallery/types.d.ts +3 -0
  404. package/widgets/BasemapLayerList/BasemapLayerListVisibleElements.d.ts +14 -0
  405. package/widgets/BasemapLayerList/types.d.ts +1 -0
  406. package/widgets/BatchAttributeForm/VisibleElements.d.ts +7 -1
  407. package/widgets/BatchAttributeForm/inputs/SingleFeatureInput.d.ts +2 -0
  408. package/widgets/BatchAttributeForm/inputs/TextElementInput.d.ts +14 -2
  409. package/widgets/BatchAttributeForm/inputs/types.d.ts +2 -0
  410. package/widgets/BatchAttributeForm/types.d.ts +75 -14
  411. package/widgets/BatchAttributeForm.d.ts +2 -2
  412. package/widgets/Bookmarks/BookmarksVisibleElements.d.ts +30 -9
  413. package/widgets/Bookmarks/types.d.ts +32 -10
  414. package/widgets/CatalogLayerList/CatalogLayerListVisibleElements.d.ts +11 -0
  415. package/widgets/CatalogLayerList/types.d.ts +1 -0
  416. package/widgets/Daylight/VisibleElements.d.ts +11 -1
  417. package/widgets/Daylight/types.d.ts +8 -2
  418. package/widgets/DirectionalPad/VisibleElements.d.ts +6 -0
  419. package/widgets/DirectionalPad/types.d.ts +13 -2
  420. package/widgets/Directions/DirectionsVisibleElements.d.ts +8 -0
  421. package/widgets/Editor/CreateFeaturesWorkflowData.d.ts +3 -3
  422. package/widgets/Editor/EditorViewModel.d.ts +2 -3
  423. package/widgets/Editor/Edits.d.ts +1 -2
  424. package/widgets/Editor/SplitFeatureWorkflow.d.ts +2 -2
  425. package/widgets/Editor/VisibleElements.d.ts +46 -13
  426. package/widgets/Editor/support/EditorEditingCapabilities.d.ts +46 -9
  427. package/widgets/Editor/types.d.ts +149 -24
  428. package/widgets/ElevationProfile/ElevationProfileVisibleElements.d.ts +13 -1
  429. package/widgets/ElevationProfile/types.d.ts +87 -14
  430. package/widgets/Expand.d.ts +2 -2
  431. package/widgets/Feature/types.d.ts +105 -18
  432. package/widgets/FeatureForm/GroupInput.d.ts +1 -1
  433. package/widgets/FeatureForm/RelationshipInput.d.ts +1 -1
  434. package/widgets/FeatureForm/TextElementInput.d.ts +3 -5
  435. package/widgets/FeatureForm/UtilityNetworkAssociationInput.d.ts +1 -1
  436. package/widgets/FeatureForm/VisibleElements.d.ts +7 -1
  437. package/widgets/FeatureForm/types.d.ts +3 -0
  438. package/widgets/FeatureForm.d.ts +1 -1
  439. package/widgets/FeatureTable/ColumnMenuVisibleElements.d.ts +4 -0
  440. package/widgets/FeatureTable/FeatureTableViewModel.d.ts +14 -4
  441. package/widgets/FeatureTable/Grid/Column.d.ts +1 -1
  442. package/widgets/FeatureTable/Grid/GridViewModel.d.ts +2 -0
  443. package/widgets/FeatureTable/Grid/types.d.ts +137 -24
  444. package/widgets/FeatureTable/TableMenuVisibleElements.d.ts +10 -0
  445. package/widgets/FeatureTable/VisibleElements.d.ts +16 -2
  446. package/widgets/FeatureTable/support/ColumnTemplateBase.d.ts +1 -1
  447. package/widgets/FeatureTable/support/types.d.ts +155 -27
  448. package/widgets/FeatureTable.d.ts +3 -3
  449. package/widgets/FeatureTemplates/VisibleElements.d.ts +4 -0
  450. package/widgets/FeatureTemplates/types.d.ts +17 -2
  451. package/widgets/Features/FeaturesVisibleElements.d.ts +12 -0
  452. package/widgets/FloorFilter/FloorFilterViewModel.js +1 -1
  453. package/widgets/Histogram/types.d.ts +14 -2
  454. package/widgets/HistogramRangeSlider/types.d.ts +1 -0
  455. package/widgets/LayerList/LayerListVisibleElements.d.ts +10 -0
  456. package/widgets/LayerList/types.d.ts +8 -0
  457. package/widgets/Legend/styles/card/CardView.d.ts +13 -2
  458. package/widgets/Legend/styles/classic/ClassicView.d.ts +11 -2
  459. package/widgets/Measurement/types.d.ts +3 -0
  460. package/widgets/OrientedImageryViewer/types.d.ts +15 -3
  461. package/widgets/Popup/PopupVisibleElements.d.ts +11 -0
  462. package/widgets/Popup/types.d.ts +64 -7
  463. package/widgets/Print/FileLink.d.ts +36 -6
  464. package/widgets/Print/types.d.ts +77 -13
  465. package/widgets/ScaleRangeSlider/types.d.ts +4 -0
  466. package/widgets/ScaleRangeSlider.d.ts +5 -1
  467. package/widgets/ShadowCast/ShadowCastVisibleElements.d.ts +15 -1
  468. package/widgets/ShadowCast/types.d.ts +8 -2
  469. package/widgets/Sketch/CreateToolVisibilityMap.d.ts +19 -4
  470. package/widgets/Sketch/SelectionToolVisibilityMap.d.ts +4 -0
  471. package/widgets/Sketch/VisibleElements.d.ts +38 -6
  472. package/widgets/Sketch/types.d.ts +364 -60
  473. package/widgets/Slider/types.d.ts +249 -46
  474. package/widgets/Swipe/types.d.ts +6 -0
  475. package/widgets/TableList/TableListVisibleElements.d.ts +11 -0
  476. package/widgets/TableList/types.d.ts +5 -0
  477. package/widgets/TimeSlider/types.d.ts +45 -7
  478. package/widgets/Track/types.d.ts +4 -1
  479. package/widgets/UtilityNetworkAssociations/VisibleElements.d.ts +23 -4
  480. package/widgets/UtilityNetworkAssociations/VisibleElementsSettingsPane.d.ts +7 -0
  481. package/widgets/UtilityNetworkTrace/types.d.ts +26 -5
  482. package/widgets/ValuePicker/ValuePickerBaseComponent.d.ts +2 -0
  483. package/widgets/ValuePicker/ValuePickerSliderVisibleElements.d.ts +7 -1
  484. package/widgets/ValuePicker/ValuePickerVisibleElements.d.ts +9 -1
  485. package/widgets/ValuePicker/types.d.ts +8 -0
  486. package/widgets/Weather/VisibleElements.d.ts +6 -1
  487. package/widgets/Weather/types.d.ts +1 -0
  488. package/widgets/smartMapping/types.d.ts +63 -6
  489. package/widgets/support/GridControls/VisibleElements.d.ts +11 -0
  490. package/widgets/support/GridControls/types.d.ts +1 -0
  491. package/widgets/support/SnappingControls/VisibleElements.d.ts +26 -4
  492. package/widgets/support/forms/types.d.ts +2 -0
  493. package/widgets/support/types.d.ts +19 -3
  494. package/widgets/types.d.ts +549 -89
  495. package/assets/esri/core/workers/chunks/329b10897c6965948b84.js +0 -1
  496. package/assets/esri/core/workers/chunks/35593a9790818b689455.js +0 -1
  497. package/assets/esri/core/workers/chunks/98d68b145226e7527c84.js +0 -33
  498. package/views/2d/engine/flow/FlowDisplayData.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/5.0/esri/copyright.txt for details.
4
4
  */
5
- import t from"../../../core/Error.js";import{isAborted as e,createAbortError as a}from"../../../core/promiseUtils.js";import{Z as n}from"../../../chunks/Zlib.js";class i{constructor(t){this._canvas=null,this._ctx=null,t&&(this._canvas=t.canvas,this._ctx=t.ctx||t.canvas&&t.canvas.getContext("2d"))}decode(n,s,r){if(!n||n.byteLength<10)throw new t("imagecanvasdecoder: decode","required a valid encoded data as input.");let{width:c=0,height:h=0,format:o}=s;const{applyJpegMask:l}=s;if(l&&(!c||!h))throw new t("imagecanvasdecoder: decode","image width and height are needed to apply jpeg mask directly to canvas");return new Promise((t,d)=>{let g=null;"jpg"===o&&l&&(g=i._getMask(n,{width:c,height:h}));const w=new Blob([new Uint8Array(n)],{type:"image/"+o=="jpg"?"jpeg":o}),v=URL.createObjectURL(w),m=new Image;let _;m.src=v,m.onload=()=>{if(URL.revokeObjectURL(v),e(r))return void d(a());c=m.width,h=m.height,this._canvas&&this._ctx?(this._canvas.width===c&&this._canvas.height===h||(this._canvas.width=c,this._canvas.height=h),this._ctx.clearRect(0,0,c,h)):(this._canvas=document.createElement("canvas"),this._canvas.width=c,this._canvas.height=h,this._ctx=this._canvas.getContext("2d")),this._ctx.drawImage(m,0,0);const n=this._ctx.getImageData(0,0,c,h);let i;if(_=n.data,s.renderOnCanvas){if(g)for(i=0;i<g.length;i++)g[i]?_[4*i+3]=255:_[4*i+3]=0;return this._ctx.putImageData(n,0,0),void t(null)}const o=c*h,l=new Uint8Array(o),w=new Uint8Array(o),p=new Uint8Array(o);if(g)for(i=0;i<o;i++)l[i]=_[4*i],w[i]=_[4*i+1],p[i]=_[4*i+2];else for(g=new Uint8Array(o),i=0;i<o;i++)l[i]=_[4*i],w[i]=_[4*i+1],p[i]=_[4*i+2],g[i]=_[4*i+3];t({width:c,height:h,pixels:[l,w,p],mask:g,pixelType:"u8"})},m.onerror=()=>{URL.revokeObjectURL(v),d("cannot load image")}})}static _getMask(t,e){let a=null;try{const i=new Uint8Array(t),s=Math.ceil(i.length/2);let r=0;const c=i.length-2;for(r=s;r<c&&(255!==i[r]||217!==i[r+1]);r++);if(r+=2,r<i.length-1){const t=new n(i.subarray(r)).getBytes();a=new Uint8Array(e.width*e.height);let s=0;for(let e=0;e<t.length;e++)for(let n=7;n>=0;n--)a[s++]=t[e]>>n&1}}catch(i){}return a}}export{i as default};
5
+ import t from"../../../core/Error.js";import{isAborted as e,createAbortError as a}from"../../../core/promiseUtils.js";import{Z as n}from"../../../chunks/Zlib.js";class i{constructor(t){this._canvas=null,this._ctx=null,t&&(this._canvas=t.canvas,this._ctx=t.ctx||t.canvas&&t.canvas.getContext("2d"))}decode(n,s,r){if(!n||n.byteLength<10)throw new t("imagecanvasdecoder: decode","required a valid encoded data as input.");let{width:c=0,height:h=0,format:o}=s;const{applyJpegMask:l}=s;if(l&&(!c||!h))throw new t("imagecanvasdecoder: decode","image width and height are needed to apply jpeg mask directly to canvas");return new Promise((t,d)=>{let g=null;"jpg"===o&&l&&(g=i._getMask(n,{width:c,height:h}));const w=new Blob([new Uint8Array(n)],{type:"image/"+o=="jpg"?"jpeg":o}),v=URL.createObjectURL(w),m=new Image;m.src=v,m.onload=()=>{if(URL.revokeObjectURL(v),e(r))return void d(a());c=m.width,h=m.height,this._canvas&&this._ctx?(this._canvas.width===c&&this._canvas.height===h||(this._canvas.width=c,this._canvas.height=h),this._ctx.clearRect(0,0,c,h)):(this._canvas=document.createElement("canvas"),this._canvas.width=c,this._canvas.height=h,this._ctx=this._canvas.getContext("2d")),this._ctx.drawImage(m,0,0);const n=this._ctx.getImageData(0,0,c,h),i=n.data;if(s.renderOnCanvas){if(g)for(let t=0;t<g.length;t++)g[t]?i[4*t+3]=255:i[4*t+3]=0;return this._ctx.putImageData(n,0,0),void t(null)}const o=c*h,l=new Uint8Array(o),w=new Uint8Array(o),_=new Uint8Array(o);if(g)for(let t=0;t<o;t++)l[t]=i[4*t],w[t]=i[4*t+1],_[t]=i[4*t+2];else{g=new Uint8Array(o);for(let t=0;t<o;t++)l[t]=i[4*t],w[t]=i[4*t+1],_[t]=i[4*t+2],g[t]=i[4*t+3]}t({width:c,height:h,pixels:[l,w,_],mask:g,pixelType:"u8"})},m.onerror=()=>{URL.revokeObjectURL(v),d("cannot load image")}})}static _getMask(t,e){let a=null;try{const i=new Uint8Array(t),s=Math.ceil(i.length/2);let r=0;const c=i.length-2;for(r=s;r<c&&(255!==i[r]||217!==i[r+1]);r++);if(r+=2,r<i.length-1){const t=new n(i.subarray(r)).getBytes();a=new Uint8Array(e.width*e.height);let s=0;for(let e=0;e<t.length;e++)for(let n=7;n>=0;n--)a[s++]=t[e]>>n&1}}catch(i){}return a}}export{i 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/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{J as t}from"../../../chunks/Jpg.js";import{Z as e}from"../../../chunks/Zlib.js";class r{static decode(r,n=!1){const s=new Uint8Array(r),o=new t;o.parse(s);const{width:a,height:i,numComponents:f,eof:h}=o,l=o.getData(a,i,!0),c=a*i;let u,g=null,p=0,w=0,m=0;if(!n&&h<s.length-1)try{const t=new e(s.subarray(h)).getBytes();g=new Uint8Array(c);let r=0;for(p=0;p<t.length;p++)for(m=7;m>=0;m--)g[r++]=t[p]>>m&1}catch{}if(1===f&&l.length===a*i){const t=new Uint8Array(l.buffer);u=[t,t,t]}else{for(u=[],p=0;p<3;p++)u.push(new Uint8Array(c));for(m=0,w=0;w<c;w++)for(p=0;p<3;p++)u[p][w]=l[m++]}return{width:a,height:i,pixels:u,mask:g}}}export{r as default};
5
+ import{J as t}from"../../../chunks/Jpg.js";import{Z as e}from"../../../chunks/Zlib.js";class r{static decode(r,n=!1){const s=new Uint8Array(r),l=new t;l.parse(s);const{width:o,height:a,numComponents:i,eof:f}=l,h=l.getData(o,a,!0),c=o*a;let u,g=null;if(!n&&f<s.length-1)try{const t=new e(s.subarray(f)).getBytes();g=new Uint8Array(c);let r=0;for(let e=0;e<t.length;e++)for(let n=7;n>=0;n--)g[r++]=t[e]>>n&1}catch{}if(1===i&&h.length===o*a){const t=new Uint8Array(h.buffer);u=[t,t,t]}else{u=[];for(let e=0;e<3;e++)u.push(new Uint8Array(c));let t=0;for(let e=0;e<c;e++)for(let r=0;r<3;r++)u[r][e]=h[t++]}return{width:o,height:a,pixels:u,mask:g}}}export{r 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/5.0/esri/copyright.txt for details.
4
4
  */
5
- import t from"../../../core/Error.js";import{assertIsSome as e}from"../../../core/maybe.js";import a from"./ImageCanvasDecoder.js";import i from"./JpgPlus.js";import{load as s,decode as r}from"./Lerc.js";import{decode as n}from"./Lzw.js";import{convertNoDataToMask as o}from"./pixelRangeUtils.js";import{Z as h}from"../../../chunks/Zlib.js";import{load as c,decode as l}from"./Qb3.js";import p from"./Raw.js";import{decodeTileOrStrip as d,decode as u}from"./TiffDecoder.js";import{isPlatformLittleEndian as f}from"./utils.js";import m from"../../support/PixelBlock.js";import g from"../../support/SimpleBandStatistics.js";var w=function(t){var e,a,i,s,r,n;function o(t){var e,a,i,s,r,n,o,h,c,l,p,d,u;for(this.data=t,this.pos=8,this.palette=[],this.imgData=[],this.transparency={},this.animation=null,this.text={},r=null;;){switch(e=this.readUInt32(),h=function(){var t,e;for(e=[],t=0;t<4;++t)e.push(String.fromCharCode(this.data[this.pos++]));return e}.call(this).join(""),h){case"IHDR":this.width=this.readUInt32(),this.height=this.readUInt32(),this.bits=this.data[this.pos++],this.colorType=this.data[this.pos++],this.compressionMethod=this.data[this.pos++],this.filterMethod=this.data[this.pos++],this.interlaceMethod=this.data[this.pos++];break;case"acTL":this.animation={numFrames:this.readUInt32(),numPlays:this.readUInt32()||1/0,frames:[]};break;case"PLTE":this.palette=this.read(e);break;case"fcTL":r&&this.animation.frames.push(r),this.pos+=4,r={width:this.readUInt32(),height:this.readUInt32(),xOffset:this.readUInt32(),yOffset:this.readUInt32()},s=this.readUInt16(),i=this.readUInt16()||100,r.delay=1e3*s/i,r.disposeOp=this.data[this.pos++],r.blendOp=this.data[this.pos++],r.data=[];break;case"IDAT":case"fdAT":for("fdAT"===h&&(this.pos+=4,e-=4),t=(null!=r?r.data:void 0)||this.imgData,p=0;0<=e?p<e:p>e;0<=e?++p:--p)t.push(this.data[this.pos++]);break;case"tRNS":switch(this.transparency={},this.colorType){case 3:if(this.transparency.indexed=this.read(e),(c=255-this.transparency.indexed.length)>0)for(d=0;0<=c?d<c:d>c;0<=c?++d:--d)this.transparency.indexed.push(255);break;case 0:this.transparency.grayscale=this.read(e)[0];break;case 2:this.transparency.rgb=this.read(e)}break;case"tEXt":n=(l=this.read(e)).indexOf(0),o=String.fromCharCode.apply(String,l.slice(0,n)),this.text[o]=String.fromCharCode.apply(String,l.slice(n+1));break;case"IEND":return r&&this.animation.frames.push(r),this.colors=function(){switch(this.colorType){case 0:case 3:case 4:return 1;case 2:case 6:return 3}}.call(this),this.hasAlphaChannel=4===(u=this.colorType)||6===u,a=this.colors+(this.hasAlphaChannel?1:0),this.pixelBitlength=this.bits*a,this.colorSpace=function(){switch(this.colors){case 1:return"DeviceGray";case 3:return"DeviceRGB"}}.call(this),void(this.imgData=new Uint8Array(this.imgData));default:this.pos+=e}if(this.pos+=4,this.pos>this.data.length)throw new Error("Incomplete or corrupt PNG file")}}return o.load=function(t,e,a){var i;return"function"==typeof e&&(a=e),(i=new XMLHttpRequest).open("GET",t,!0),i.responseType="arraybuffer",i.onload=function(){var t;return t=new o(new Uint8Array(i.response||i.mozResponseArrayBuffer)),"function"==typeof(null!=e?e.getContext:void 0)&&t.render(e),"function"==typeof a?a(t):void 0},i.send(null)},a=1,i=2,e=0,o.prototype.read=function(t){var e,a;for(a=[],e=0;0<=t?e<t:e>t;0<=t?++e:--e)a.push(this.data[this.pos++]);return a},o.prototype.readUInt32=function(){return this.data[this.pos++]<<24|this.data[this.pos++]<<16|this.data[this.pos++]<<8|this.data[this.pos++]},o.prototype.readUInt16=function(){return this.data[this.pos++]<<8|this.data[this.pos++]},o.prototype.decodePixels=function(t){var e,a,i,s,r,n,o,c,l,p,d,u,f,m,g,w,y,b,x,k,T,C,I;if(null==t&&(t=this.imgData),0===t.length)return new Uint8Array(0);for(t=(t=new h(t)).getBytes(),w=(u=this.pixelBitlength/8)*this.width,f=new Uint8Array(w*this.height),n=t.length,g=0,m=0,a=0;m<n;){switch(t[m++]){case 0:for(s=x=0;x<w;s=x+=1)f[a++]=t[m++];break;case 1:for(s=k=0;k<w;s=k+=1)e=t[m++],r=s<u?0:f[a-u],f[a++]=(e+r)%256;break;case 2:for(s=T=0;T<w;s=T+=1)e=t[m++],i=(s-s%u)/u,y=g&&f[(g-1)*w+i*u+s%u],f[a++]=(y+e)%256;break;case 3:for(s=C=0;C<w;s=C+=1)e=t[m++],i=(s-s%u)/u,r=s<u?0:f[a-u],y=g&&f[(g-1)*w+i*u+s%u],f[a++]=(e+Math.floor((r+y)/2))%256;break;case 4:for(s=I=0;I<w;s=I+=1)e=t[m++],i=(s-s%u)/u,r=s<u?0:f[a-u],0===g?y=b=0:(y=f[(g-1)*w+i*u+s%u],b=i&&f[(g-1)*w+(i-1)*u+s%u]),o=r+y-b,c=Math.abs(o-r),p=Math.abs(o-y),d=Math.abs(o-b),l=c<=p&&c<=d?r:p<=d?y:b,f[a++]=(e+l)%256;break;default:throw new Error("Invalid filter algorithm: "+t[m-1])}g++}return f},o.prototype.decodePalette=function(){var t,e,a,i,s,r,n,o,h;for(a=this.palette,r=this.transparency.indexed||[],s=new Uint8Array((r.length||0)+a.length),i=0,a.length,t=0,e=n=0,o=a.length;n<o;e=n+=3)s[i++]=a[e],s[i++]=a[e+1],s[i++]=a[e+2],s[i++]=null!=(h=r[t++])?h:255;return s},o.prototype.copyToImageData=function(t,e){var a,i,s,r,n,o,h,c,l,p,d;if(i=this.colors,l=null,a=this.hasAlphaChannel,this.palette.length&&(l=null!=(d=this._decodedPalette)?d:this._decodedPalette=this.decodePalette(),i=4,a=!0),c=(s=t.data||t).length,n=l||e,r=o=0,1===i)for(;r<c;)h=l?4*e[r/4]:o,p=n[h++],s[r++]=p,s[r++]=p,s[r++]=p,s[r++]=a?n[h++]:this.transparency.grayscale&&this.transparency.grayscale===p?0:255,o=h;else for(;r<c;)h=l?4*e[r/4]:o,s[r++]=n[h++],s[r++]=n[h++],s[r++]=n[h++],s[r++]=a?n[h++]:this.transparency.rgb&&this.transparency.rgb[1]===n[h-3]&&this.transparency.rgb[3]===n[h-2]&&this.transparency.rgb[5]===n[h-1]?0:255,o=h},o.prototype.decode=function(){var t;return t=new Uint8Array(this.width*this.height*4),this.copyToImageData(t,this.decodePixels()),t},r=t.document&&t.document.createElement("canvas"),n=r&&r.getContext("2d"),s=function(t){var e;return n.width=t.width,n.height=t.height,n.clearRect(0,0,t.width,t.height),n.putImageData(t,0,0),(e=new Image).src=r.toDataURL(),e},o.prototype.decodeFrames=function(t){var e,a,i,r,n,o,h,c;if(this.animation){for(c=[],a=n=0,o=(h=this.animation.frames).length;n<o;a=++n)e=h[a],i=t.createImageData(e.width,e.height),r=this.decodePixels(new Uint8Array(e.data)),this.copyToImageData(i,r),e.imageData=i,c.push(e.image=s(i));return c}},o.prototype.renderFrame=function(t,s){var r,n,o;return r=(n=this.animation.frames)[s],o=n[s-1],0===s&&t.clearRect(0,0,this.width,this.height),(null!=o?o.disposeOp:void 0)===a?t.clearRect(o.xOffset,o.yOffset,o.width,o.height):(null!=o?o.disposeOp:void 0)===i&&t.putImageData(o.imageData,o.xOffset,o.yOffset),r.blendOp===e&&t.clearRect(r.xOffset,r.yOffset,r.width,r.height),t.drawImage(r.image,r.xOffset,r.yOffset)},o.prototype.animate=function(t){var e,a,i,s,r,n,o=this;return a=0,n=this.animation,s=n.numFrames,i=n.frames,r=n.numPlays,(e=function(){var n,h;if(n=a++%s,h=i[n],o.renderFrame(t,n),s>1&&a/s<r)return o.animation._timeout=setTimeout(e,h.delay)})()},o.prototype.stopAnimation=function(){var t;return clearTimeout(null!=(t=this.animation)?t._timeout:void 0)},o.prototype.render=function(t){var e,a;return t._png&&t._png.stopAnimation(),t._png=this,t.width=this.width,t.height=this.height,e=t.getContext("2d"),this.animation?(this.decodeFrames(e),this.animate(e)):(a=e.createImageData(this.width,this.height),this.copyToImageData(a,this.decodePixels()),e.putImageData(a,0,0))},o}(self);const y=new Set(["jpg","png","bmp","gif"]);async function b(e,a){if(!f)throw new t("rasterCoded:decode","lerc decoder is not supported on big endian platform");await s();const{offset:i}=a,{width:n,height:o,pixelType:h,statistics:c,depthCount:l,noDataValues:p,bandMasks:d,pixels:u,mask:w}=r(e,{inputOffset:i,returnInterleaved:a.returnInterleaved}),y=new m({width:n,height:o,pixelType:h.toLowerCase(),pixels:u,mask:w,statistics:c.map(({minValue:t,maxValue:e})=>new g(t,e)),bandMasks:d,depthCount:l,noDataValues:p});return c?.length||y.updateStatistics(),y}async function x(e,a){await c();const i=l(e);if(!i)throw new t("rasterCodec:decode","failed to decode the input data.");const{width:s,height:r,pixels:n}=i,o=new m({width:s,height:r,pixelType:"u16",pixels:n});return o.updateStatistics(),o}async function k(t,a){const i=await u(t,{...a,noDataValue:a.tiffNoDataValue,matchAllNoData:a.matchAllNoData});e(i);const s=new m({width:i.width,height:i.height,pixels:i.pixels,pixelType:i.pixelType.toLowerCase(),mask:i.mask,bandMasks:i.bandMasks,statistics:null});return s.updateStatistics(),s}async function T(t,e){const a=await d(t,e.customOptions),i=new m({width:a.width,height:a.height,pixels:a.pixels,pixelType:a.pixelType.toLowerCase(),mask:a.mask,statistics:null});return i.updateStatistics(),i}function C(t,e){const a=e.pixelType||"u8",i=m.getPixelArrayConstructor(a),s="u8"===a?t:new i(t.buffer),r=[],n=e.planes||1;if(1===n)r.push(s);else for(let h=0;h<n;h++){const a=(e.width||1)*(e.height||t.length),o=new i(a);for(let t=0;t<a;t++)o[t]=s[t*n+h];r.push(o)}const o=new m({width:e.width||1,height:e.height||t.length,pixels:r,pixelType:a,statistics:null});return o.updateStatistics(),o}function I(t,e){return C(new h(new Uint8Array(t)).getBytes(),e)}function A(t,e){return C(n(t,e.offset,e.eof,!e.isInputBigEndian),e)}function v(t,e,a){const{pixelTypeCtor:i}=P(e.pixelType),s=(0,p.decode)(t,{width:e.width,height:e.height,pixelType:i,format:a}),r=new m({width:e.width,height:e.height,pixels:s.pixels,pixelType:e.pixelType,mask:s.mask,statistics:null});return r.updateStatistics(),r}function D(t,e){const a=i.decode(t,e.hasNoZlibMask??void 0),s=new m({width:a.width,height:a.height,pixels:a.pixels,pixelType:"u8",mask:a.mask,statistics:null});return s.updateStatistics(),s}function U(t,e){const a=new Uint8Array(t),i=new w(a),{width:s,height:r}=e,n=s*r,o=i.decode();let h,c=0,l=0;const p=new Uint8Array(n);for(c=0;c<n;c++)p[c]=o[4*c+3];const d=new m({width:s,height:r,pixels:[],pixelType:"u8",mask:p,statistics:[]});for(c=0;c<3;c++){for(h=new Uint8Array(n),l=0;l<n;l++)h[l]=o[4*l+c];d.addData({pixels:h})}return d.updateStatistics(),d}async function S(t,e,i,s){const r=new a,n={applyJpegMask:!1,format:e,...i},o=await r.decode(t,n,s),h=new m(o);return h.updateStatistics(),h}function j(e){if(null==e)throw new t("rasterCodec:decode","parameter encodeddata is required.");const a=new Uint8Array(e,0,10);let i="";return 255===a[0]&&216===a[1]?i="jpg":137===a[0]&&80===a[1]&&78===a[2]&&71===a[3]?i="png":67===a[0]&&110===a[1]&&116===a[2]&&90===a[3]&&73===a[4]&&109===a[5]&&97===a[6]&&103===a[7]&&101===a[8]&&32===a[9]?i="lerc":76===a[0]&&101===a[1]&&114===a[2]&&99===a[3]&&50===a[4]&&32===a[5]?i="lerc2":73===a[0]&&73===a[1]&&42===a[2]&&0===a[3]||77===a[0]&&77===a[1]&&0===a[2]&&42===a[3]||73===a[0]&&73===a[1]&&43===a[2]&&0===a[3]||77===a[0]&&77===a[1]&&0===a[2]&&43===a[3]?i="tiff":71===a[0]&&73===a[1]&&70===a[2]?i="gif":66===a[0]&&77===a[1]?i="bmp":81===a[0]&&66===a[1]&&51===a[2]?i="qb3":String.fromCharCode.apply(null,a).toLowerCase().includes("error")&&(i="error"),i}function O(e){let a=null;switch(e){case"lerc":case"lerc2":a=b;break;case"jpg":a=D;break;case"png":a=U;break;case"bsq":case"bip":a=(t,a)=>v(t,a,e);break;case"tiff":a=k;break;case"deflate":a=I;break;case"lzw":a=A;break;case"qb3":a=x;break;case"error":a=()=>{throw new t("rasterCodec:decode","input data contains error")};break;default:a=()=>{throw new t("rasterCodec:decode","unsupported raster format")}}return a}function P(t){let e=null,a=null;switch(t?t.toLowerCase():"f32"){case"u1":case"u2":case"u4":case"u8":a=255,e=Uint8Array;break;case"u16":a=a||65535,e=Uint16Array;break;case"u32":a=a||2**32-1,e=Uint32Array;break;case"s8":a=a||-128,e=Int8Array;break;case"s16":a=a||-32768,e=Int16Array;break;case"s32":a=a||0-2**31,e=Int32Array;break;default:e=Float32Array}return{pixelTypeCtor:e,noDataValue:a}}function M(t,e=1){if(!t)return;const{pixels:a,width:i,height:s,mask:r}=t;if(!a||0===a.length)return;const n=a.length,o=i-1,h=s-1,c=[];let l,p,d,u,f,g,w=null;const y=m.getPixelArrayConstructor(t.pixelType);if(0===e){for(l=0;l<n;l++){for(f=a[l],g=new y(o*h),p=0;p<h;p++)for(u=p*i,d=0;d<o;d++)g[p*o+d]=f[u+d];c.push(g)}if(null!=r)for(w=new Uint8Array(o*h),p=0;p<h;p++)for(u=p*i,d=0;d<o;d++)w[p*o+d]=r[u+d]}else{for(l=0;l<n;l++){for(f=a[l],g=new y(o*h),p=0;p<h;p++)for(u=p*i,d=0;d<o;d++)g[p*o+d]=(f[u+d]+f[u+d+1]+f[u+i+d]+f[u+i+d+1])/4;c.push(g)}if(r)for(w=new Uint8Array(o*h),p=0;p<h;p++)for(u=p*i,d=0;d<o;d++)w[p*o+d]=Math.min.apply(null,[r[u+d],r[u+d+1],r[u+i+d],r[u+i+d+1]])}t.width=o,t.height=h,t.mask=w,t.pixels=c}function L(t){let e=j(t);return"lerc2"===e?e="lerc":"error"===e&&(e=""),e}async function R(e,a={},i){if(null==e)throw new t("rasterCodec:decode","missing encodeddata parameter.");let s=a.format?.toLowerCase();if(!("bsq"!==s&&"bip"!==s||null!=a.width&&null!=a.height))throw new t("rasterCodec:decode","requires width and height in options parameter.");if("tiff"===s&&a.customOptions)return T(e,a);if((!s||"bsq"!==s&&"bip"!==s&&"deflate"!==s&&"lzw"!==s)&&(s=j(e)),a.useCanvas&&y.has(s))return S(e,s,a,i);const r=O(s);let n;a.isPoint&&(null!=(a={...a}).width&&a.width++,null!=a.height&&a.height++);const{offsets:h}=a;if(h&&h.length>1){const t=h.map((t,i)=>r(e.slice(t,h[i+1]),a)),i=await Promise.all(t);n=i[0],n.pixels=i.map(t=>t.pixels[0]);const s=i.map(t=>t.mask);i.some(t=>null!=t)&&(s.forEach((t,e)=>{null==t&&(s[e]=new Uint8Array(n.width*n.height).fill(255))}),n.bandMasks=s,n.mask=m.combineBandMasks(s)),n.updateStatistics()}else n=await r(e,{...a,offset:h?.[0]??a.offset});return"jpg"!==s&&null!=a.noDataValue&&1===n.depthCount&&o(n,a.noDataValue,{customFloatTolerance:a.tolerance}),a.isPoint&&M(n),n}export{R as decode,L as getFormat};
5
+ import t from"../../../core/Error.js";import{assertIsSome as e}from"../../../core/maybe.js";import a from"./ImageCanvasDecoder.js";import i from"./JpgPlus.js";import{load as s,decode as r}from"./Lerc.js";import{decode as n}from"./Lzw.js";import{convertNoDataToMask as o}from"./pixelRangeUtils.js";import{Z as h}from"../../../chunks/Zlib.js";import{load as c,decode as l}from"./Qb3.js";import p from"./Raw.js";import{decodeTileOrStrip as d,decode as u}from"./TiffDecoder.js";import{isPlatformLittleEndian as f}from"./utils.js";import m from"../../support/PixelBlock.js";import w from"../../support/SimpleBandStatistics.js";var g=function(t){var e,a,i,s,r,n;function o(t){var e,a,i,s,r,n,o,h,c,l,p,d,u;for(this.data=t,this.pos=8,this.palette=[],this.imgData=[],this.transparency={},this.animation=null,this.text={},r=null;;){switch(e=this.readUInt32(),h=function(){var t,e;for(e=[],t=0;t<4;++t)e.push(String.fromCharCode(this.data[this.pos++]));return e}.call(this).join(""),h){case"IHDR":this.width=this.readUInt32(),this.height=this.readUInt32(),this.bits=this.data[this.pos++],this.colorType=this.data[this.pos++],this.compressionMethod=this.data[this.pos++],this.filterMethod=this.data[this.pos++],this.interlaceMethod=this.data[this.pos++];break;case"acTL":this.animation={numFrames:this.readUInt32(),numPlays:this.readUInt32()||1/0,frames:[]};break;case"PLTE":this.palette=this.read(e);break;case"fcTL":r&&this.animation.frames.push(r),this.pos+=4,r={width:this.readUInt32(),height:this.readUInt32(),xOffset:this.readUInt32(),yOffset:this.readUInt32()},s=this.readUInt16(),i=this.readUInt16()||100,r.delay=1e3*s/i,r.disposeOp=this.data[this.pos++],r.blendOp=this.data[this.pos++],r.data=[];break;case"IDAT":case"fdAT":for("fdAT"===h&&(this.pos+=4,e-=4),t=(null!=r?r.data:void 0)||this.imgData,p=0;0<=e?p<e:p>e;0<=e?++p:--p)t.push(this.data[this.pos++]);break;case"tRNS":switch(this.transparency={},this.colorType){case 3:if(this.transparency.indexed=this.read(e),(c=255-this.transparency.indexed.length)>0)for(d=0;0<=c?d<c:d>c;0<=c?++d:--d)this.transparency.indexed.push(255);break;case 0:this.transparency.grayscale=this.read(e)[0];break;case 2:this.transparency.rgb=this.read(e)}break;case"tEXt":n=(l=this.read(e)).indexOf(0),o=String.fromCharCode.apply(String,l.slice(0,n)),this.text[o]=String.fromCharCode.apply(String,l.slice(n+1));break;case"IEND":return r&&this.animation.frames.push(r),this.colors=function(){switch(this.colorType){case 0:case 3:case 4:return 1;case 2:case 6:return 3}}.call(this),this.hasAlphaChannel=4===(u=this.colorType)||6===u,a=this.colors+(this.hasAlphaChannel?1:0),this.pixelBitlength=this.bits*a,this.colorSpace=function(){switch(this.colors){case 1:return"DeviceGray";case 3:return"DeviceRGB"}}.call(this),void(this.imgData=new Uint8Array(this.imgData));default:this.pos+=e}if(this.pos+=4,this.pos>this.data.length)throw new Error("Incomplete or corrupt PNG file")}}return o.load=function(t,e,a){var i;return"function"==typeof e&&(a=e),(i=new XMLHttpRequest).open("GET",t,!0),i.responseType="arraybuffer",i.onload=function(){var t;return t=new o(new Uint8Array(i.response||i.mozResponseArrayBuffer)),"function"==typeof(null!=e?e.getContext:void 0)&&t.render(e),"function"==typeof a?a(t):void 0},i.send(null)},a=1,i=2,e=0,o.prototype.read=function(t){var e,a;for(a=[],e=0;0<=t?e<t:e>t;0<=t?++e:--e)a.push(this.data[this.pos++]);return a},o.prototype.readUInt32=function(){return this.data[this.pos++]<<24|this.data[this.pos++]<<16|this.data[this.pos++]<<8|this.data[this.pos++]},o.prototype.readUInt16=function(){return this.data[this.pos++]<<8|this.data[this.pos++]},o.prototype.decodePixels=function(t){var e,a,i,s,r,n,o,c,l,p,d,u,f,m,w,g,y,b,x,k,T,C,I;if(null==t&&(t=this.imgData),0===t.length)return new Uint8Array(0);for(t=(t=new h(t)).getBytes(),g=(u=this.pixelBitlength/8)*this.width,f=new Uint8Array(g*this.height),n=t.length,w=0,m=0,a=0;m<n;){switch(t[m++]){case 0:for(s=x=0;x<g;s=x+=1)f[a++]=t[m++];break;case 1:for(s=k=0;k<g;s=k+=1)e=t[m++],r=s<u?0:f[a-u],f[a++]=(e+r)%256;break;case 2:for(s=T=0;T<g;s=T+=1)e=t[m++],i=(s-s%u)/u,y=w&&f[(w-1)*g+i*u+s%u],f[a++]=(y+e)%256;break;case 3:for(s=C=0;C<g;s=C+=1)e=t[m++],i=(s-s%u)/u,r=s<u?0:f[a-u],y=w&&f[(w-1)*g+i*u+s%u],f[a++]=(e+Math.floor((r+y)/2))%256;break;case 4:for(s=I=0;I<g;s=I+=1)e=t[m++],i=(s-s%u)/u,r=s<u?0:f[a-u],0===w?y=b=0:(y=f[(w-1)*g+i*u+s%u],b=i&&f[(w-1)*g+(i-1)*u+s%u]),o=r+y-b,c=Math.abs(o-r),p=Math.abs(o-y),d=Math.abs(o-b),l=c<=p&&c<=d?r:p<=d?y:b,f[a++]=(e+l)%256;break;default:throw new Error("Invalid filter algorithm: "+t[m-1])}w++}return f},o.prototype.decodePalette=function(){var t,e,a,i,s,r,n,o,h;for(a=this.palette,r=this.transparency.indexed||[],s=new Uint8Array((r.length||0)+a.length),i=0,a.length,t=0,e=n=0,o=a.length;n<o;e=n+=3)s[i++]=a[e],s[i++]=a[e+1],s[i++]=a[e+2],s[i++]=null!=(h=r[t++])?h:255;return s},o.prototype.copyToImageData=function(t,e){var a,i,s,r,n,o,h,c,l,p,d;if(i=this.colors,l=null,a=this.hasAlphaChannel,this.palette.length&&(l=null!=(d=this._decodedPalette)?d:this._decodedPalette=this.decodePalette(),i=4,a=!0),c=(s=t.data||t).length,n=l||e,r=o=0,1===i)for(;r<c;)h=l?4*e[r/4]:o,p=n[h++],s[r++]=p,s[r++]=p,s[r++]=p,s[r++]=a?n[h++]:this.transparency.grayscale&&this.transparency.grayscale===p?0:255,o=h;else for(;r<c;)h=l?4*e[r/4]:o,s[r++]=n[h++],s[r++]=n[h++],s[r++]=n[h++],s[r++]=a?n[h++]:this.transparency.rgb&&this.transparency.rgb[1]===n[h-3]&&this.transparency.rgb[3]===n[h-2]&&this.transparency.rgb[5]===n[h-1]?0:255,o=h},o.prototype.decode=function(){var t;return t=new Uint8Array(this.width*this.height*4),this.copyToImageData(t,this.decodePixels()),t},r=t.document&&t.document.createElement("canvas"),n=r&&r.getContext("2d"),s=function(t){var e;return n.width=t.width,n.height=t.height,n.clearRect(0,0,t.width,t.height),n.putImageData(t,0,0),(e=new Image).src=r.toDataURL(),e},o.prototype.decodeFrames=function(t){var e,a,i,r,n,o,h,c;if(this.animation){for(c=[],a=n=0,o=(h=this.animation.frames).length;n<o;a=++n)e=h[a],i=t.createImageData(e.width,e.height),r=this.decodePixels(new Uint8Array(e.data)),this.copyToImageData(i,r),e.imageData=i,c.push(e.image=s(i));return c}},o.prototype.renderFrame=function(t,s){var r,n,o;return r=(n=this.animation.frames)[s],o=n[s-1],0===s&&t.clearRect(0,0,this.width,this.height),(null!=o?o.disposeOp:void 0)===a?t.clearRect(o.xOffset,o.yOffset,o.width,o.height):(null!=o?o.disposeOp:void 0)===i&&t.putImageData(o.imageData,o.xOffset,o.yOffset),r.blendOp===e&&t.clearRect(r.xOffset,r.yOffset,r.width,r.height),t.drawImage(r.image,r.xOffset,r.yOffset)},o.prototype.animate=function(t){var e,a,i,s,r,n,o=this;return a=0,n=this.animation,s=n.numFrames,i=n.frames,r=n.numPlays,(e=function(){var n,h;if(n=a++%s,h=i[n],o.renderFrame(t,n),s>1&&a/s<r)return o.animation._timeout=setTimeout(e,h.delay)})()},o.prototype.stopAnimation=function(){var t;return clearTimeout(null!=(t=this.animation)?t._timeout:void 0)},o.prototype.render=function(t){var e,a;return t._png&&t._png.stopAnimation(),t._png=this,t.width=this.width,t.height=this.height,e=t.getContext("2d"),this.animation?(this.decodeFrames(e),this.animate(e)):(a=e.createImageData(this.width,this.height),this.copyToImageData(a,this.decodePixels()),e.putImageData(a,0,0))},o}(self);const y=new Set(["jpg","png","bmp","gif"]);async function b(e,a){if(!f)throw new t("rasterCoded:decode","lerc decoder is not supported on big endian platform");await s();const{offset:i}=a,{width:n,height:o,pixelType:h,statistics:c,depthCount:l,noDataValues:p,bandMasks:d,pixels:u,mask:g}=r(e,{inputOffset:i,returnInterleaved:a.returnInterleaved}),y=new m({width:n,height:o,pixelType:h.toLowerCase(),pixels:u,mask:g,statistics:c.map(({minValue:t,maxValue:e})=>new w(t,e)),bandMasks:d,depthCount:l,noDataValues:p});return c?.length||y.updateStatistics(),y}async function x(e,a){await c();const i=l(e);if(!i)throw new t("rasterCodec:decode","failed to decode the input data.");const{width:s,height:r,pixels:n}=i,o=new m({width:s,height:r,pixelType:"u16",pixels:n});return o.updateStatistics(),o}async function k(t,a){const i=await u(t,{...a,noDataValue:a.tiffNoDataValue,matchAllNoData:a.matchAllNoData});e(i);const s=new m({width:i.width,height:i.height,pixels:i.pixels,pixelType:i.pixelType.toLowerCase(),mask:i.mask,bandMasks:i.bandMasks,statistics:null});return s.updateStatistics(),s}async function T(t,e){const a=await d(t,e.customOptions),i=new m({width:a.width,height:a.height,pixels:a.pixels,pixelType:a.pixelType.toLowerCase(),mask:a.mask,statistics:null});return i.updateStatistics(),i}function C(t,e){const a=e.pixelType||"u8",i=m.getPixelArrayConstructor(a),s="u8"===a?t:new i(t.buffer),r=[],n=e.planes||1;if(1===n)r.push(s);else for(let h=0;h<n;h++){const a=(e.width||1)*(e.height||t.length),o=new i(a);for(let t=0;t<a;t++)o[t]=s[t*n+h];r.push(o)}const o=new m({width:e.width||1,height:e.height||t.length,pixels:r,pixelType:a,statistics:null});return o.updateStatistics(),o}function I(t,e){return C(new h(new Uint8Array(t)).getBytes(),e)}function A(t,e){return C(n(t,e.offset,e.eof,!e.isInputBigEndian),e)}function v(t,e,a){const{pixelTypeCtor:i}=P(e.pixelType),s=(0,p.decode)(t,{width:e.width,height:e.height,pixelType:i,format:a}),r=new m({width:e.width,height:e.height,pixels:s.pixels,pixelType:e.pixelType,mask:s.mask,statistics:null});return r.updateStatistics(),r}function D(t,e){const a=i.decode(t,e.hasNoZlibMask??void 0),s=new m({width:a.width,height:a.height,pixels:a.pixels,pixelType:"u8",mask:a.mask,statistics:null});return s.updateStatistics(),s}function U(t,e){const a=new Uint8Array(t),i=new g(a),{width:s,height:r}=e,n=s*r,o=i.decode();let h,c=0,l=0;const p=new Uint8Array(n);for(c=0;c<n;c++)p[c]=o[4*c+3];const d=new m({width:s,height:r,pixels:[],pixelType:"u8",mask:p,statistics:[]});for(c=0;c<3;c++){for(h=new Uint8Array(n),l=0;l<n;l++)h[l]=o[4*l+c];d.addData({pixels:h})}return d.updateStatistics(),d}async function S(t,e,i,s){const r=new a,n={applyJpegMask:!1,format:e,...i},o=await r.decode(t,n,s),h=new m(o);return h.updateStatistics(),h}function j(e){if(null==e)throw new t("rasterCodec:decode","parameter encodeddata is required.");const a=new Uint8Array(e,0,10);let i="";return 255===a[0]&&216===a[1]?i="jpg":137===a[0]&&80===a[1]&&78===a[2]&&71===a[3]?i="png":67===a[0]&&110===a[1]&&116===a[2]&&90===a[3]&&73===a[4]&&109===a[5]&&97===a[6]&&103===a[7]&&101===a[8]&&32===a[9]?i="lerc":76===a[0]&&101===a[1]&&114===a[2]&&99===a[3]&&50===a[4]&&32===a[5]?i="lerc2":73===a[0]&&73===a[1]&&42===a[2]&&0===a[3]||77===a[0]&&77===a[1]&&0===a[2]&&42===a[3]||73===a[0]&&73===a[1]&&43===a[2]&&0===a[3]||77===a[0]&&77===a[1]&&0===a[2]&&43===a[3]?i="tiff":71===a[0]&&73===a[1]&&70===a[2]?i="gif":66===a[0]&&77===a[1]?i="bmp":81===a[0]&&66===a[1]&&51===a[2]?i="qb3":String.fromCharCode.apply(null,a).toLowerCase().includes("error")&&(i="error"),i}function O(e){let a=null;switch(e){case"lerc":case"lerc2":a=b;break;case"jpg":a=D;break;case"png":a=U;break;case"bsq":case"bip":a=(t,a)=>v(t,a,e);break;case"tiff":a=k;break;case"deflate":a=I;break;case"lzw":a=A;break;case"qb3":a=x;break;case"error":a=()=>{throw new t("rasterCodec:decode","input data contains error")};break;default:a=()=>{throw new t("rasterCodec:decode","unsupported raster format")}}return a}function P(t){let e=null,a=null;switch(t?t.toLowerCase():"f32"){case"u1":case"u2":case"u4":case"u8":a=255,e=Uint8Array;break;case"u16":a=a||65535,e=Uint16Array;break;case"u32":a=a||2**32-1,e=Uint32Array;break;case"s8":a=a||-128,e=Int8Array;break;case"s16":a=a||-32768,e=Int16Array;break;case"s32":a=a||0-2**31,e=Int32Array;break;default:e=Float32Array}return{pixelTypeCtor:e,noDataValue:a}}function M(t,e=1){if(!t)return;const{pixels:a,width:i,height:s,mask:r}=t;if(!a||0===a.length)return;const n=i-1,o=s-1,h=[];let c=null;const l=m.getPixelArrayConstructor(t.pixelType);if(0===e){for(const t of a){const e=new l(n*o);for(let a=0;a<o;a++){const s=a*i;for(let i=0;i<n;i++)e[a*n+i]=t[s+i]}h.push(e)}if(null!=r){c=new Uint8Array(n*o);for(let t=0;t<o;t++){const e=t*i;for(let a=0;a<n;a++)c[t*n+a]=r[e+a]}}}else{for(const t of a){const e=new l(n*o);for(let a=0;a<o;a++){const s=a*i;for(let r=0;r<n;r++)e[a*n+r]=(t[s+r]+t[s+r+1]+t[s+i+r]+t[s+i+r+1])/4}h.push(e)}if(r){c=new Uint8Array(n*o);for(let t=0;t<o;t++){const e=t*i;for(let a=0;a<n;a++)c[t*n+a]=Math.min.apply(null,[r[e+a],r[e+a+1],r[e+i+a],r[e+i+a+1]])}}}t.width=n,t.height=o,t.mask=c,t.pixels=h}function L(t){let e=j(t);return"lerc2"===e?e="lerc":"error"===e&&(e=""),e}async function R(e,a={},i){if(null==e)throw new t("rasterCodec:decode","missing encodeddata parameter.");let s=a.format?.toLowerCase();if(!("bsq"!==s&&"bip"!==s||null!=a.width&&null!=a.height))throw new t("rasterCodec:decode","requires width and height in options parameter.");if("tiff"===s&&a.customOptions)return T(e,a);if((!s||"bsq"!==s&&"bip"!==s&&"deflate"!==s&&"lzw"!==s)&&(s=j(e)),a.useCanvas&&y.has(s))return S(e,s,a,i);const r=O(s);let n;a.isPoint&&(null!=(a={...a}).width&&a.width++,null!=a.height&&a.height++);const{offsets:h}=a;if(h&&h.length>1){const t=h.map((t,i)=>r(e.slice(t,h[i+1]),a)),i=await Promise.all(t);n=i[0],n.pixels=i.map(t=>t.pixels[0]);const s=i.map(t=>t.mask);i.some(t=>null!=t)&&(s.forEach((t,e)=>{null==t&&(s[e]=new Uint8Array(n.width*n.height).fill(255))}),n.bandMasks=s,n.mask=m.combineBandMasks(s)),n.updateStatistics()}else n=await r(e,{...a,offset:h?.[0]??a.offset});return"jpg"!==s&&null!=a.noDataValue&&1===n.depthCount&&o(n,a.noDataValue,{customFloatTolerance:a.tolerance}),a.isPoint&&M(n),n}export{R as decode,L as getFormat};
@@ -2,4 +2,4 @@
2
2
  All material copyright Esri, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- const e=(e,r)=>{const a=r.width*r.height,n=r.pixelType;return Math.floor(e.byteLength/(a*t(n)))},t=e=>{let t=1;switch(e){case Uint8Array:case Int8Array:t=1;break;case Uint16Array:case Int16Array:t=2;break;case Uint32Array:case Int32Array:case Float32Array:t=4;break;case Float64Array:t=8}return t},r=(e,t)=>{if(8*e.byteLength<t)return null;const r=new Uint8Array(e,0,Math.ceil(t/8)),a=new Uint8Array(t);let n=0,s=0,l=0,i=0;for(l=0;l<r.length-1;l++)for(s=r[l],i=7;i>=0;i--)a[n++]=s>>i&1;for(i=7;n<t-1;)s=r[r.length-1],a[n++]=s>>i&1,i--;return a};class a{static decode(a,n){const s=n.pixelType,l=[],i=n.width*n.height,h=e(a,n),{bandIds:c,format:y}=n,o=c?.length||e(a,n),b=a.byteLength-a.byteLength%(i*t(s)),f=new s(a,0,i*h);let u,g,A,p,d=null;if("bip"===y)for(u=0;u<o;u++){for(A=new s(i),p=c?c[u]:u,g=0;g<i;g++)A[g]=f[g*h+p];l.push(A)}else if("bsq"===y)for(u=0;u<o;u++)p=c?c[u]:u,l.push(f.subarray(p*i,(p+1)*i));return b<a.byteLength-1&&(d=r(a.slice(b),i)),{pixels:l,mask:d}}}export{a as default};
5
+ const e=(e,r)=>{const a=r.width*r.height,n=r.pixelType;return Math.floor(e.byteLength/(a*t(n)))},t=e=>{let t=1;switch(e){case Uint8Array:case Int8Array:t=1;break;case Uint16Array:case Int16Array:t=2;break;case Uint32Array:case Int32Array:case Float32Array:t=4;break;case Float64Array:t=8}return t},r=(e,t)=>{if(8*e.byteLength<t)return null;const r=new Uint8Array(e,0,Math.ceil(t/8)),a=new Uint8Array(t);let n=0,s=0;for(let c=0;c<r.length-1;c++){s=r[c];for(let e=7;e>=0;e--)a[n++]=s>>e&1}let l=7;for(;n<t-1;)s=r[r.length-1],a[n++]=s>>l&1,l--;return a};class a{static decode(a,n){const s=n.pixelType,l=[],c=n.width*n.height,i=e(a,n),{bandIds:h,format:o}=n,y=h?.length||e(a,n),b=a.byteLength-a.byteLength%(c*t(s)),f=new s(a,0,c*i);if("bip"===o)for(let e=0;e<y;e++){const t=new s(c),r=h?h[e]:e;for(let e=0;e<c;e++)t[e]=f[e*i+r];l.push(t)}else if("bsq"===o)for(let e=0;e<y;e++){const t=h?h[e]:e;l.push(f.subarray(t*c,(t+1)*c))}let u=null;return b<a.byteLength-1&&(u=r(a.slice(b),c)),{pixels:l,mask:u}}}export{a 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/5.0/esri/copyright.txt for details.
4
4
  */
5
- import"../../../core/has.js";import{bytesToUTF8 as e}from"../datasets/byteStreamUtils.js";import{J as t}from"../../../chunks/Jpg.js";import{load as n,decode as a}from"./Lerc.js";import{decode as i}from"./Lzw.js";import{convertNoDataToMask as r}from"./pixelRangeUtils.js";import{tiffTags as s,ifdTags as l,getTagName as o,geoKeys as f}from"./tiffTag.js";import{isPlatformLittleEndian as u}from"./utils.js";import{Z as c}from"../../../chunks/Zlib.js";const h=[0,1,1,2,4,8,1,1,2,4,8,4,8,-1,-1,-1,8,8,8],g=4294967296,E=new Set([1,5,6,7,8,34712,34887]);function I(e,t){let n="unknown";return 3===e?n=64===t?"f64":"f32":1===e?1===t?n="u1":2===t?n="u2":4===t?n="u4":t<=8?n="u8":t<=16?n="u16":t<=32&&(n="u32"):2===e&&(t<=8?n="s8":t<=16?n="s16":t<=32&&(n="s32")),n}function T(e){let t=null;switch(e?e.toLowerCase():"f32"){case"u1":case"u2":case"u4":case"u8":t=Uint8Array;break;case"u16":t=Uint16Array;break;case"u32":t=Uint32Array;break;case"s8":t=Int8Array;break;case"s16":t=Int16Array;break;case"s32":t=Int32Array;break;case"f64":t=Float64Array;break;default:t=Float32Array}return t}function w(e,t){return{x:t[0]*e.x+t[1]*e.y+t[2],y:t[3]*e.x+t[4]*e.y+t[5]}}function p(e,t){return e.get(t)?.values}function d(e,t){return e.get(t)?.values}function m(e,t){return e.get(t)?.values?.[0]}function y(e,t){return e.get(t)?.values?.[0]}function A(e,t,n,a=0,i=s,r=4){const l=8===r,f=l?B(new DataView(e,n,8),0,t):new DataView(e,n,2).getUint16(0,t),u=4+2*r,c=l?8:2,h=c+f*u;if(n+h>e.byteLength)return{success:!1,ifd:null,nextIFD:null,requiredBufferSize:h};const g=8===r?8:4,E=n+h+g<=e.byteLength?W(new DataView(e,n+h,g),0,t,8===r):null,I=n+c,T=new Map;let w,p,d,m,y,A=0,S=0;for(let s=0;s<f;s++){p=new DataView(e,I+u*s,u),d=p.getUint16(0,t),y=p.getUint16(2,t),m=o(d,i);const n=[];2===r?(A=p.getUint16(4,t),S=p.getUint16(6,t)):4===r?(A=p.getUint32(4,t),S=p.getUint32(8,t)):8===r&&(A=W(p,4,t,!0),S=W(p,12,t,!0),n.push(p.getUint32(12,t)),n.push(p.getUint32(16,t))),w={id:d,type:y,valueCount:A,valueOffset:S,valueOffsets:n,values:null},N(e,t,w,a,!1,r),T.set(m,w)}return{success:!0,ifd:T,nextIFD:E,requiredBufferSize:h}}const S=(e,t)=>a(e,{inputOffset:t}).pixels[0];function M(e,t){if(t%8==0)return e;const n=t>16?32:t>8?16:8;n>8&&(e=b(e,32===n?4:2));const a=32===n?Uint32Array:16===n?Uint16Array:Uint8Array,i=new a(e),r=Math.floor(8*e.byteLength/t+1e-6),s=new a(r),l=(1<<t)-1;let o=0,f=0,u=0;for(let c=0;c<r;c++)if(0===f&&(u=i[o++],f=n),f>=t)s[c]=u>>>f-t&l,f-=t;else{const e=t-f;let a=(u&l)<<e&l;u=i[o++],f=n-e,a+=u>>>f,s[c]=a}return s.buffer}function P(e,n,a){const i=new t;i.parse(e),i.colorTransform=6===a?-1:0;const r=i.getData(i.width,i.height,1!==n&&4!==n);return new Uint8Array(r.buffer)}function O(e){const t=new c(e).getBytes(),n=new ArrayBuffer(t.length),a=new Uint8Array(n);return a.set(t),a}function b(e,t){const n=new Uint8Array(e),a=new Uint8Array(n.length);if(2===t)for(let i=0;i<n.length;i+=2)a[i]=n[i+1],a[i+1]=n[i];else if(4===t)for(let i=0;i<n.length;i+=4)a[i]=n[i+3],a[i+1]=n[i+2],a[i+2]=n[i+1],a[i+3]=n[i];else for(let i=0;i<n.length;i+=8)a[i]=n[i+7],a[i+1]=n[i+6],a[i+2]=n[i+5],a[i+3]=n[i+4],a[i+4]=n[i+3],a[i+5]=n[i+2],a[i+6]=n[i+1],a[i+7]=n[i];return a.buffer}async function x(e,t,a,r,s){const l=u===t,o=y(a,"BITSPERSAMPLE"),f=y(a,"SAMPLESPERPIXEL")??1,c=y(a,"PHOTOMETRICINTERPRETATION"),h=y(a,"SAMPLEFORMAT")??1,g=I(h,o),E=y(a,"COMPRESSION")??1,w=T(g);let p,d,m;if(34887===E)return await n(),S(e,r);if(1===E)p=e.slice(r,r+s),d=new Uint8Array(p);else if(8===E||32946===E)d=new Uint8Array(e,r,s),d=O(d),p=d.buffer;else if(6===E)d=new Uint8Array(e,r,s),d=P(d,f,c),p=d.buffer;else if(7===E){const t=a.get("JPEGTABLES").values,n=t.length-2;d=new Uint8Array(n+s-2);for(let e=0;e<n;e++)d[e]=t[e];const i=new Uint8Array(e,r+2,s-2);for(let e=0;e<i.length;e++)d[n+e]=i[e];d=P(d,f,c),p=d.buffer}else{if(5!==E)throw new Error("tiff-decode: unsupport compression "+E);d=i(e,r,s,t),p=d.buffer}if(p=M(p,o),l||o<=8)m=new w(p);else{const e=o>32?8:o>16?4:2;m=new w(b(d.buffer,e))}const A=y(a,"PREDICTOR")??1,x=y(a,"TILEWIDTH"),L=y(a,"TILELENGTH");if(A>1&&(5===E||8===E||32946===E)&&x&&L){const e=C(a),t=new w(m.length);t.set(m),m=j(t,L,x,3===h&&3===A,e?1:f)}return m}async function L(e,t,n){const a=d(n,"TILEOFFSETS");if(void 0===a)return null;const i=d(n,"TILEBYTECOUNTS"),{width:r,height:s,pixelType:l,tileWidth:o,tileHeight:f}=k([n]),u=C(n,t),c=y(n,"SAMPLESPERPIXEL")||t.planes,h=r*s,g=y(n,"BITSPERSAMPLE"),E=34887===(y(n,"COMPRESSION")??1),I=T(l),w=[];for(let T=0;T<c;T++)w.push(new I(h));let p,m,A,S,M,P,O,b,L,R,D,U,N;const G=Math.ceil(r/o),v=new Uint8Array(h).fill(255);let F=!1;if(g%8==0)if(E&&u&&c>1){const l=Math.round(a.length/c);for(p=0;p<l;p++){P=Math.floor(p/G)*f,O=p%G*o,b=P*r+O;for(let l=0;l<c;l++){const u=p*c+l;for(0===i[u]?(A=null,F=!0):A=await x(e,t.littleEndian,n,a[u],i[u]),R=0,L=b,U=Math.min(o,r-O),D=Math.min(f,s-P),N=w[l],S=0;S<D;S++)for(L=b+S*r,R=S*o,M=0;M<U;M++,L++,R++)A?N[L]=A[R]:v[L]=0}}}else for(p=0;p<a.length;p++)for(P=Math.floor(p/G)*f,O=p%G*o,b=P*r+O,0===i[p]?(A=null,F=!0):A=await x(e,t.littleEndian,n,a[p],i[p]),R=0,L=b,U=Math.min(o,r-O),D=Math.min(f,s-P),m=0;m<c;m++)if(N=w[m],u||E)for(S=0;S<D;S++)for(L=b+S*r,R=o*f*m+S*o,M=0;M<U;M++,L++,R++)A?N[L]=A[R]:v[L]=0;else for(S=0;S<D;S++)for(L=b+S*r,R=S*o*c+m,M=0;M<U;M++,L++,R+=c)A?N[L]=A[R]:v[L]=0;return{width:r,height:s,pixelType:l,pixels:w,mask:F?v:void 0}}const R=(e,t,n)=>{const a=u===t.littleEndian,r=d(n,"STRIPOFFSETS");if(void 0===r)return null;const{width:s,height:l,pixelType:o}=k([n]),f=y(n,"SAMPLESPERPIXEL")||t.planes,c=y(n,"PHOTOMETRICINTERPRETATION"),h=s*l,g=y(n,"BITSPERSAMPLE"),E=T(o),I=new E(h*f),w=d(n,"STRIPBYTECOUNTS"),p=y(n,"ROWSPERSTRIP"),m=y(n,"COMPRESSION")??1;let A,S,b,x,L,R,D,U,N;if(g%8==0)for(A=0;A<r.length;A++){if(L=A*(p*s)*f,"u8"===o||"s8"===o||a)8===m||32946===m?(D=new Uint8Array(e,r[A],w[A]),D=O(D),R=D.buffer):6===m?(D=new Uint8Array(e,r[A],w[A]),D=P(D,f,c),R=D.buffer):5===m?(D=i(e,r[A],w[A],t.littleEndian),R=D.buffer):R=e.slice(r[A],r[A]+w[A]),R=M(R,g),x=new E(R);else{switch(6===m||8===m||32946===m?(D=new Uint8Array(e,r[A],w[A]),U=O(D),R=U.buffer):(R=new ArrayBuffer(w[A]),D=new Uint8Array(e,r[A],w[A]),U=new Uint8Array(R)),o){case"u16":case"s16":for(b=0;b<D.length;b+=2)U[b]=D[b+1],U[b+1]=D[b];break;case"u32":case"s32":case"f32":for(b=0;b<D.length;b+=4)U[b]=D[b+3],U[b+1]=D[b+2],U[b+2]=D[b+1],U[b+3]=D[b]}R=M(R,g),x=new E(R)}I.set(x,L)}const C=[];if(1===f)C.push(I);else for(A=0;A<f;A++){for(N=new E(h),S=0;S<h;S++)N[S]=I[S*f+A];C.push(N)}return{width:s,height:l,pixelType:o,pixels:C}},D=(e,t,n)=>{if(!(e&&e.length>0&&t&&n))return null;let a,i,r;const s=e[0].length,l=e.length,o=new Uint8Array(s);for(let f=0;f<l;f++)if(a=e[f],i=t[f],r=n[f],0===f)for(let e=0;e<s;e++)o[e]=a[e]<i||a[e]>r?0:1;else for(let e=0;e<s;e++)o[e]&&(o[e]=a[e]<i||a[e]>r?0:1);return o},U=e=>{if(!e)return null;const t=e.match(/<Item(.*?)Item>/gi);if(!t||0===t.length)return null;const n=new Map;let a,i,r,s,l;for(let w=0;w<t.length;w++)a=t[w],i=a.slice(6,a.indexOf(">")),s=a.indexOf("sample="),s>-1&&(l=a.slice(s+8,a.indexOf('"',s+8))),s=a.indexOf("name="),s>-1&&(i=a.slice(s+6,a.indexOf('"',s+6))),i&&(r=a.slice(a.indexOf(">")+1,a.indexOf("</Item>")).trim(),null!=l?n.has(i)?n.get(i)[l]=r:n.set(i,[r]):n.set(i,r)),l=null;const o=n.get("STATISTICS_MINIMUM"),f=n.get("STATISTICS_MAXIMUM"),u=n.get("STATISTICS_MEAN"),c=n.get("STATISTICS_STDDEV");let h=null;if(o&&f){h=[];for(let e=0;e<o.length;e++)h.push({min:parseFloat(o[e]),max:parseFloat(f[e]),avg:u&&parseFloat(u[e]),stddev:c&&parseFloat(c[e])})}const g=n.get("BandName"),E=n.get("WavelengthMin"),I=n.get("WavelengthMax");let T=null;if(g){T=[];for(let e=0;e<g.length;e++)T.push({BandName:g[e],WavelengthMin:E&&parseFloat(E[e]),WavelengthMax:I&&parseFloat(I[e])})}return{statistics:h,bandProperties:T,dataType:n.get("DataType"),rawMetadata:n}};function N(e,t,n,a=0,i=!1,r=4){if(n.values)return!0;const s=n.type,l=n.valueCount;let o=n.valueOffset,f=[];const u=h[s],c=8*u,E=l*u,I=l*h[s]*8;let T,w;const p=8===r?64:32,d=n.valueOffsets;if(I>p){if(E>(i?e.byteLength:e?e.byteLength-o+a:0))return n.offlineOffsetSize=[o,E],n.values=null,!1}if(I<=p){if(!t)if(p<=32)o>>>=32-I;else{const e=d?.length?d[0]:o>>>0,t=d?.length?d[1]:Math.round((o-e)/g);I<=32?(o=e>>>32-I,d[0]=o):(o=e*2**(32-I)+(t>>>32-I),d[0]=e,d[1]=t>>>32-I)}if(1===l&&c===p)f=[o];else if(64===p){const e=d?.length?d[0]:o>>>0,t=d?.length?d[1]:Math.round((o-e)/g);let n=e,a=32;for(w=1;w<=l;w++){const e=32-c*w%32;if(a<c){const i=n<<e>>>32-a,r=t<<32-a>>>32-a;n=t,f.push(i+r*2**(c-a)),a-=32-(c-a)}else f.push(n<<e>>>32-c),a-=c;0===a&&(a=32,n=t)}}else for(w=1;w<=l;w++){const e=32-c*w;f.push(o<<e>>>32-c)}}else{o-=a,i&&(o=0);for(let n=o;n<o+E;n+=u){switch(s){case 1:case 2:case 7:T=new DataView(e,n,1).getUint8(0);break;case 3:T=new DataView(e,n,2).getUint16(0,t);break;case 4:case 13:T=new DataView(e,n,4).getUint32(0,t);break;case 5:T=new DataView(e,n,4).getUint32(0,t)/new DataView(e,n+4,4).getUint32(0,t);break;case 6:T=new DataView(e,n,1).getInt8(0);break;case 8:T=new DataView(e,n,2).getInt16(0,t);break;case 9:T=new DataView(e,n,4).getInt32(0,t);break;case 10:T=new DataView(e,n,4).getInt32(0,t)/new DataView(e,n+4,4).getInt32(0,t);break;case 11:T=new DataView(e,n,4).getFloat32(0,t);break;case 12:T=new DataView(e,n,8).getFloat64(0,t);break;case 16:case 18:T=B(new DataView(e,n,8),0,t);break;case 17:T=V(new DataView(e,n,8),0,t);break;default:T=null}f.push(T)}}if(2===s){let e="";const t=f;for(f=[],w=0;w<t.length;w++)0===t[w]&&""!==e?(f.push(e),e=""):e+=String.fromCharCode(t[w]);""===e&&0!==f.length||f.push(e)}return n.values=f,!0}function k(e){const t=e[0],n=y(t,"TILEWIDTH"),a=y(t,"TILELENGTH"),i=y(t,"IMAGEWIDTH"),r=y(t,"IMAGELENGTH"),s=y(t,"BITSPERSAMPLE"),l=y(t,"SAMPLESPERPIXEL"),o=y(t,"SAMPLEFORMAT")??1,f=I(o,s),u=C(t),c=p(t,"GDAL_NODATA");let h=null;c?.length&&(h=c.map(e=>parseFloat(e)),h.some(e=>isNaN(e))&&(h=null));const g=y(t,"COMPRESSION")??1;let T;switch(g){case 1:T="NONE";break;case 2:case 3:case 4:case 32771:T="CCITT";break;case 5:T="LZW";break;case 6:case 7:T="JPEG";break;case 32773:T="PACKBITS";break;case 8:case 32946:T="DEFLATE";break;case 34712:T="JPEG2000";break;case 34887:T="LERC";break;default:T=String(g)}let A=!0,S="";E.has(g)||(A=!1,S+="unsupported tag compression "+g),o>3&&(A=!1,S+="unsupported tag sampleFormat "+o),s>32&&64!==s&&(A=!1,S+="unsupported tag bitsPerSample "+s);const M=m(t,"GEOASCIIPARAMS");let P;if(M){const e=M.split("|").find(e=>e.includes("ESRI PE String = ")),t=e?e.replace("ESRI PE String = ",""):"";P=t.startsWith("COMPD_CS")||t.startsWith("PROJCS")||t.startsWith("GEOGCS")?{wkid:null,wkt:t}:null}const O=d(t,"GEOTIEPOINTS"),b=d(t,"GEOPIXELSCALE"),x=d(t,"GEOTRANSMATRIX"),L=t.has("GEOKEYDIRECTORY")?t.get("GEOKEYDIRECTORY").data:null;let R,D,N=!1,k=!1;if(L){N=2===y(L,"GTRasterTypeGeoKey");const e=y(L,"GTModelTypeGeoKey");if(2===e){const e=y(L,"GeographicTypeGeoKey");e>=1024&&e<=32766&&(P={wkid:e}),P||32767!==e||(k=!0,P={wkid:4326})}else if(1===e){const e=y(L,"ProjectedCSTypeGeoKey");e>=1024&&e<=32766&&(P={wkid:e})}}if(b&&O&&O.length>=6?(R=[b[0],0,O[3]-O[0]*b[0],0,-Math.abs(b[1]),O[4]-O[1]*b[1]],N&&(R[2]-=.5*R[0]+.5*R[1],R[5]-=.5*R[3]+.5*R[4])):x&&16===x.length&&(R=N?[x[0],x[1],x[3]-.5*x[0],x[4],x[5],x[7]-.5*x[5]]:[x[0],x[1],x[3],x[4],x[5],x[7]]),R){const e=[{x:0,y:r},{x:0,y:0},{x:i,y:r},{x:i,y:0}];let t,n=Number.POSITIVE_INFINITY,a=Number.POSITIVE_INFINITY,s=Number.NEGATIVE_INFINITY,l=Number.NEGATIVE_INFINITY;for(let i=0;i<e.length;i++)t=w(e[i],R),n=t.x>n?n:t.x,s=t.x<s?s:t.x,a=t.y>a?a:t.y,l=t.y<l?l:t.y;D={xmin:n,xmax:s,ymin:a,ymax:l,spatialReference:P}}else D={xmin:-.5,ymin:.5-r,xmax:i-.5,ymax:.5,spatialReference:P};k&&(D.xmax-D.xmin>400||Math.max(Math.abs(D.xmin),Math.abs(D.xmax))>361)&&(P=null,D.spatialReference=null);const F=G(e);let B,V,W,H,Y;if(F.length>0){W=Math.round(Math.log(i/y(F[0],"IMAGEWIDTH"))/Math.LN2);const e=F[F.length-1];H=F.length,B=y(e,"TILEWIDTH"),V=y(e,"TILELENGTH")}B=null!=H&&H>0?B||n:null,V=null!=H&&H>0?V||a:null,n&&(Y=[{maxCol:Math.ceil(i/n)-1,maxRow:Math.ceil(r/a)-1,minRow:0,minCol:0}],F.forEach(e=>{Y.push({maxCol:Math.ceil(y(e,"IMAGEWIDTH")/y(e,"TILEWIDTH"))-1,maxRow:Math.ceil(y(e,"IMAGELENGTH")/y(e,"TILELENGTH"))-1,minRow:0,minCol:0})}));const j=m(e[0],"GDAL_METADATA"),X=U(j);S+=" "+_({width:i,height:r,tileWidth:n,tileHeight:a,planes:l,ifds:e});const K=v(e).length===F.length+1,J=F?.length?F.map(e=>({x:i/y(e,"IMAGEWIDTH"),y:r/y(e,"IMAGELENGTH")})):void 0;return{width:i,height:r,tileWidth:n,tileHeight:a,planes:l,isBSQ:u,pixelType:f,compression:T,noData:h,hasMaskBand:K,isSupported:A,pyramidResolutions:J,message:S,extent:D,isPseudoGeographic:k,affine:b?null:R,firstPyramidLevel:W,maximumPyramidLevel:H,pyramidBlockWidth:B,pyramidBlockHeight:V,tileBoundary:Y,metadata:X}}function C(e,t){const n=p(e,"PLANARCONFIGURATION");return n?2===n[0]:!!t&&t.isBSQ}function G(e){return e.filter(e=>1===y(e,"NEWSUBFILETYPE"))}function v(e){return e.filter(e=>{const t=!(4&~(y(e,"NEWSUBFILETYPE")??0)),n=4===y(e,"PHOTOMETRICINTERPRETATION");return t&&n})}function F(e){const{littleEndian:t,isBigTiff:n,firstIFDPos:a}=H(e);let i=a;const r=[];do{const a=Y(e,t,i,0,s,n?8:4);if(!a.success)break;r.push(a.ifd),i=a.nextIFD}while(i>0);return{...k(r),littleEndian:t,isBigTiff:n,ifds:r,pyramidIFDs:G(r),maskIFDs:v(r)}}function B(e,t,n){const a=e.getUint32(t,n),i=e.getUint32(t+4,n);return n?i*g+a:a*g+i}function V(e,t,n){let a=n?e.getInt32(t,n):e.getUint32(t,n),i=n?e.getUint32(t+4,n):e.getInt32(t+4,n);const r=(n?a:i)>=0?1:-1;n?a*=r:i*=r;return r*(n?i*g+a:a*g+i)}function W(e,t,n,a){return a?B(e,t,n):e.getUint32(t,n)}function H(e){const t=new DataView(e,0,16),n=t.getUint16(0,!1);let a=null;if(18761===n)a=!0;else{if(19789!==n)throw new Error("unexpected endianess byte");a=!1}const i=t.getUint16(2,a);if(42!==i&&43!==i)throw new Error("unexpected tiff identifier");let r=4;const s=43===i;if(s){const e=t.getUint16(r,a);if(r+=2,8!==e)throw new Error("unsupported bigtiff version");if(0!==t.getUint16(r,a))throw new Error("unsupported bigtiff version");r+=2}return{littleEndian:a,isBigTiff:s,firstIFDPos:W(t,r,a,s)}}function Y(t,n,a,i=0,r=s,o=4){const u=A(t,n,a,i,r,o);let c;const h=u.ifd;if(h){if(l.forEach((e,a)=>{h.has(a)&&(c=h.get(a),c.data=A(t,n,c.valueOffset-i,i,e).ifd)}),h.has("GEOKEYDIRECTORY")){c=h.get("GEOKEYDIRECTORY");const e=c.values;if(e&&e.length>4){const a=e[0]+"."+e[1]+"."+e[2];c.data=A(t,n,c.valueOffset+6-i,i,f,2).ifd,c.data&&c.data.set("GEOTIFFVersion",{id:0,type:2,valueCount:1,valueOffset:null,values:[a]})}}if(h.has("XMP")){c=h.get("XMP");const t=c.values;"number"==typeof t[0]&&7===c.type&&(c.values=[e(new Uint8Array(t))])}}return u}function _(e){const{width:t,height:n,tileHeight:a,tileWidth:i}=e,r=e.planes,s=i?i*a:t*n,l=y(e.ifds[0],"BITSPERSAMPLE");let o="";return s*r>2**30/(l>8?l/8:1)&&(o=i?"tiled tiff exceeding 1 gigabits per tile is not supported":"scanline tiff exceeding 1 gigabits is not supported"),o}function j(e,t,n,a,i){const r=a?4:1,s=n*r*i;a&&(e=new Uint8Array(e.buffer));for(let f=0;f<t;f++){const t=f*s;for(let n=i;n<s;n++)e[t+n]+=e[t+n-i]}if(!a)return e;const l=new Uint8Array(e.length),o=n*i;for(let f=0;f<t;f++){const t=f*s;for(let n=0;n<o;n++)for(let a=0;a<r;a++)l[t+n*r+a]=e[t+n+(r-a-1)*o]}return new Float32Array(l.buffer)}async function X(e,t){const{headerInfo:n,ifd:a,offsets:i,sizes:s}=t,l=[];for(let r=0;r<i.length;r++){s[r];const t=await x(e,n.littleEndian,a,i[r],s[r]||e.byteLength);l.push(t)}const o=C(a,n),f=y(a,"BITSPERSAMPLE"),u=I(y(a,"SAMPLEFORMAT")??1,f),c=y(a,"SAMPLESPERPIXEL")||n.planes,h=T(u),g=y(a,"TILEWIDTH"),E=y(a,"TILELENGTH"),w=y(a,"COMPRESSION")??1,p=g*E;let d;const m=[];let A=l[0];const S=34887===w;for(let r=0;r<c;r++){if(d=new h(p),l.length===c)A=l[r],A.length===p&&(d=A);else if(A.length)if(o||S)d=A.length===p?A:A.slice(p*r,p*(r+1));else for(let e=0;e<p;e++)d[e]=A[e*c+r];m.push(d)}const M=n.noData?n.noData[0]:t.noDataValue,P=n.metadata?n.metadata.statistics:null,O=P?P.map(e=>e.min):null,b=P?P.map(e=>e.max):null,L={pixelType:u,width:g,height:E,pixels:m,noDataValue:M};return null!=M?r(L,M,{matchAllNoData:t?.matchAllNoData}):O&&b&&t.applyMinMaxConstraint&&(L.mask=D(m,O,b)),L}async function K(e,t={}){const n=t.pyramidLevel||0,a=t.headerInfo||F(e),{ifds:i,noData:s}=a;if(0===i.length)throw new Error("no valid image file directory");const l=_(a);if(l)throw l;let o=null;const f=-1===n?i[i.length-1]:i[n],u=s??t.noDataValue;if(o=a.tileWidth?await L(e,a,f):R(e,a,f),!o)return o;if(null!=u){r(o,u,{matchAllNoData:null==s&&t?.matchAllNoData})}return o}export{K as decode,X as decodeTileOrStrip,k as getImageInfo,v as getMaskIFDs,G as getPyramidIFDs,C as isBSQConfig,N as parseFieldValues,F as parseHeader,Y as parseIFD,H as parseSignature,M as unpackBits};
5
+ import"../../../core/has.js";import{bytesToUTF8 as e}from"../datasets/byteStreamUtils.js";import{J as t}from"../../../chunks/Jpg.js";import{load as n,decode as a}from"./Lerc.js";import{decode as i}from"./Lzw.js";import{convertNoDataToMask as r}from"./pixelRangeUtils.js";import{tiffTags as s,ifdTags as l,getTagName as o,geoKeys as f}from"./tiffTag.js";import{isPlatformLittleEndian as u}from"./utils.js";import{Z as c}from"../../../chunks/Zlib.js";const h=[0,1,1,2,4,8,1,1,2,4,8,4,8,-1,-1,-1,8,8,8],g=4294967296,E=new Set([1,5,6,7,8,34712,34887]);function I(e,t){let n="unknown";return 3===e?n=64===t?"f64":"f32":1===e?1===t?n="u1":2===t?n="u2":4===t?n="u4":t<=8?n="u8":t<=16?n="u16":t<=32&&(n="u32"):2===e&&(t<=8?n="s8":t<=16?n="s16":t<=32&&(n="s32")),n}function T(e){let t=null;switch(e?e.toLowerCase():"f32"){case"u1":case"u2":case"u4":case"u8":t=Uint8Array;break;case"u16":t=Uint16Array;break;case"u32":t=Uint32Array;break;case"s8":t=Int8Array;break;case"s16":t=Int16Array;break;case"s32":t=Int32Array;break;case"f64":t=Float64Array;break;default:t=Float32Array}return t}function w(e,t){return{x:t[0]*e.x+t[1]*e.y+t[2],y:t[3]*e.x+t[4]*e.y+t[5]}}function p(e,t){return e.get(t)?.values}function d(e,t){return e.get(t)?.values}function m(e,t){return e.get(t)?.values?.[0]}function y(e,t){return e.get(t)?.values?.[0]}function A(e,t,n,a=0,i=s,r=4){const l=8===r,f=l?B(new DataView(e,n,8),0,t):new DataView(e,n,2).getUint16(0,t),u=4+2*r,c=l?8:2,h=c+f*u;if(n+h>e.byteLength)return{success:!1,ifd:null,nextIFD:null,requiredBufferSize:h};const g=8===r?8:4,E=n+h+g<=e.byteLength?W(new DataView(e,n+h,g),0,t,8===r):null,I=n+c,T=new Map;let w,p,d,m,y,A=0,S=0;for(let s=0;s<f;s++){p=new DataView(e,I+u*s,u),d=p.getUint16(0,t),y=p.getUint16(2,t),m=o(d,i);const n=[];2===r?(A=p.getUint16(4,t),S=p.getUint16(6,t)):4===r?(A=p.getUint32(4,t),S=p.getUint32(8,t)):8===r&&(A=W(p,4,t,!0),S=W(p,12,t,!0),n.push(p.getUint32(12,t)),n.push(p.getUint32(16,t))),w={id:d,type:y,valueCount:A,valueOffset:S,valueOffsets:n,values:null},N(e,t,w,a,!1,r),T.set(m,w)}return{success:!0,ifd:T,nextIFD:E,requiredBufferSize:h}}const S=(e,t)=>a(e,{inputOffset:t}).pixels[0];function M(e,t){if(t%8==0)return e;const n=t>16?32:t>8?16:8;n>8&&(e=b(e,32===n?4:2));const a=32===n?Uint32Array:16===n?Uint16Array:Uint8Array,i=new a(e),r=Math.floor(8*e.byteLength/t+1e-6),s=new a(r),l=(1<<t)-1;let o=0,f=0,u=0;for(let c=0;c<r;c++)if(0===f&&(u=i[o++],f=n),f>=t)s[c]=u>>>f-t&l,f-=t;else{const e=t-f;let a=(u&l)<<e&l;u=i[o++],f=n-e,a+=u>>>f,s[c]=a}return s.buffer}function P(e,n,a){const i=new t;i.parse(e),i.colorTransform=6===a?-1:0;const r=i.getData(i.width,i.height,1!==n&&4!==n);return new Uint8Array(r.buffer)}function O(e){const t=new c(e).getBytes(),n=new ArrayBuffer(t.length),a=new Uint8Array(n);return a.set(t),a}function b(e,t){const n=new Uint8Array(e),a=new Uint8Array(n.length);if(2===t)for(let i=0;i<n.length;i+=2)a[i]=n[i+1],a[i+1]=n[i];else if(4===t)for(let i=0;i<n.length;i+=4)a[i]=n[i+3],a[i+1]=n[i+2],a[i+2]=n[i+1],a[i+3]=n[i];else for(let i=0;i<n.length;i+=8)a[i]=n[i+7],a[i+1]=n[i+6],a[i+2]=n[i+5],a[i+3]=n[i+4],a[i+4]=n[i+3],a[i+5]=n[i+2],a[i+6]=n[i+1],a[i+7]=n[i];return a.buffer}async function x(e,t,a,r,s){const l=u===t,o=y(a,"BITSPERSAMPLE"),f=y(a,"SAMPLESPERPIXEL")??1,c=y(a,"PHOTOMETRICINTERPRETATION"),h=y(a,"SAMPLEFORMAT")??1,g=I(h,o),E=y(a,"COMPRESSION")??1,w=T(g);let p,d,m;if(34887===E)return await n(),S(e,r);if(1===E)p=e.slice(r,r+s),d=new Uint8Array(p);else if(8===E||32946===E)d=new Uint8Array(e,r,s),d=O(d),p=d.buffer;else if(6===E)d=new Uint8Array(e,r,s),d=P(d,f,c),p=d.buffer;else if(7===E){const t=a.get("JPEGTABLES").values,n=t.length-2;d=new Uint8Array(n+s-2);for(let e=0;e<n;e++)d[e]=t[e];const i=new Uint8Array(e,r+2,s-2);for(let e=0;e<i.length;e++)d[n+e]=i[e];d=P(d,f,c),p=d.buffer}else{if(5!==E)throw new Error("tiff-decode: unsupport compression "+E);d=i(e,r,s,t),p=d.buffer}if(p=M(p,o),l||o<=8)m=new w(p);else{const e=o>32?8:o>16?4:2;m=new w(b(d.buffer,e))}const A=y(a,"PREDICTOR")??1,x=y(a,"TILEWIDTH"),L=y(a,"TILELENGTH");if(A>1&&(5===E||8===E||32946===E)&&x&&L){const e=C(a),t=new w(m.length);t.set(m),m=j(t,L,x,3===h&&3===A,e?1:f)}return m}async function L(e,t,n){const a=d(n,"TILEOFFSETS");if(void 0===a)return null;const i=d(n,"TILEBYTECOUNTS"),{width:r,height:s,pixelType:l,tileWidth:o,tileHeight:f}=k([n]),u=C(n,t),c=y(n,"SAMPLESPERPIXEL")||t.planes,h=r*s,g=y(n,"BITSPERSAMPLE"),E=34887===(y(n,"COMPRESSION")??1),I=T(l),w=[];for(let T=0;T<c;T++)w.push(new I(h));const p=Math.ceil(r/o),m=new Uint8Array(h).fill(255);let A=null,S=!1;if(g%8==0)if(E&&u&&c>1){const l=Math.round(a.length/c);for(let u=0;u<l;u++){const l=Math.floor(u/p)*f,h=u%p*o,g=l*r+h;for(let E=0;E<c;E++){const I=u*c+E;0===i[I]?(A=null,S=!0):A=await x(e,t.littleEndian,n,a[I],i[I]);const T=Math.min(o,r-h),p=Math.min(f,s-l),d=w[E];for(let e=0;e<p;e++){let t=g+e*r,n=e*o;for(let e=0;e<T;e++,t++,n++)A?d[t]=A[n]:m[t]=0}}}}else for(let T=0;T<a.length;T++){const l=Math.floor(T/p)*f,h=T%p*o,g=l*r+h;0===i[T]?(A=null,S=!0):A=await x(e,t.littleEndian,n,a[T],i[T]);const I=Math.min(o,r-h),d=Math.min(f,s-l);for(let e=0;e<c;e++){const t=w[e];if(u||E)for(let n=0;n<d;n++){let a=g+n*r,i=o*f*e+n*o;for(let e=0;e<I;e++,a++,i++)A?t[a]=A[i]:m[a]=0}else for(let n=0;n<d;n++){let a=g+n*r,i=n*o*c+e;for(let e=0;e<I;e++,a++,i+=c)A?t[a]=A[i]:m[a]=0}}}return{width:r,height:s,pixelType:l,pixels:w,mask:S?m:void 0}}const R=(e,t,n)=>{const a=u===t.littleEndian,r=d(n,"STRIPOFFSETS");if(void 0===r)return null;const{width:s,height:l,pixelType:o}=k([n]),f=y(n,"SAMPLESPERPIXEL")||t.planes,c=y(n,"PHOTOMETRICINTERPRETATION"),h=s*l,g=y(n,"BITSPERSAMPLE"),E=T(o),I=new E(h*f),w=d(n,"STRIPBYTECOUNTS"),p=y(n,"ROWSPERSTRIP"),m=y(n,"COMPRESSION")??1;let A,S,b,x;if(g%8==0)for(let u=0;u<r.length;u++){const n=u*(p*s)*f;if("u8"===o||"s8"===o||a)8===m||32946===m?(b=new Uint8Array(e,r[u],w[u]),b=O(b),S=b.buffer):6===m?(b=new Uint8Array(e,r[u],w[u]),b=P(b,f,c),S=b.buffer):5===m?(b=i(e,r[u],w[u],t.littleEndian),S=b.buffer):S=e.slice(r[u],r[u]+w[u]),S=M(S,g),A=new E(S);else{switch(6===m||8===m||32946===m?(b=new Uint8Array(e,r[u],w[u]),x=O(b),S=x.buffer):(S=new ArrayBuffer(w[u]),b=new Uint8Array(e,r[u],w[u]),x=new Uint8Array(S)),o){case"u16":case"s16":for(let e=0;e<b.length;e+=2)x[e]=b[e+1],x[e+1]=b[e];break;case"u32":case"s32":case"f32":for(let e=0;e<b.length;e+=4)x[e]=b[e+3],x[e+1]=b[e+2],x[e+2]=b[e+1],x[e+3]=b[e]}S=M(S,g),A=new E(S)}I.set(A,n)}const L=[];if(1===f)L.push(I);else for(let i=0;i<f;i++){const e=new E(h);for(let t=0;t<h;t++)e[t]=I[t*f+i];L.push(e)}return{width:s,height:l,pixelType:o,pixels:L}},D=(e,t,n)=>{if(!(e&&e.length>0&&t&&n))return null;let a,i,r;const s=e[0].length,l=e.length,o=new Uint8Array(s);for(let f=0;f<l;f++)if(a=e[f],i=t[f],r=n[f],0===f)for(let e=0;e<s;e++)o[e]=a[e]<i||a[e]>r?0:1;else for(let e=0;e<s;e++)o[e]&&(o[e]=a[e]<i||a[e]>r?0:1);return o},U=e=>{if(!e)return null;const t=e.match(/<Item(.*?)Item>/gi);if(!t||0===t.length)return null;const n=new Map;let a,i,r,s,l;for(let w=0;w<t.length;w++)a=t[w],i=a.slice(6,a.indexOf(">")),s=a.indexOf("sample="),s>-1&&(l=a.slice(s+8,a.indexOf('"',s+8))),s=a.indexOf("name="),s>-1&&(i=a.slice(s+6,a.indexOf('"',s+6))),i&&(r=a.slice(a.indexOf(">")+1,a.indexOf("</Item>")).trim(),null!=l?n.has(i)?n.get(i)[l]=r:n.set(i,[r]):n.set(i,r)),l=null;const o=n.get("STATISTICS_MINIMUM"),f=n.get("STATISTICS_MAXIMUM"),u=n.get("STATISTICS_MEAN"),c=n.get("STATISTICS_STDDEV");let h=null;if(o&&f){h=[];for(let e=0;e<o.length;e++)h.push({min:parseFloat(o[e]),max:parseFloat(f[e]),avg:u&&parseFloat(u[e]),stddev:c&&parseFloat(c[e])})}const g=n.get("BandName"),E=n.get("WavelengthMin"),I=n.get("WavelengthMax");let T=null;if(g){T=[];for(let e=0;e<g.length;e++)T.push({BandName:g[e],WavelengthMin:E&&parseFloat(E[e]),WavelengthMax:I&&parseFloat(I[e])})}return{statistics:h,bandProperties:T,dataType:n.get("DataType"),rawMetadata:n}};function N(e,t,n,a=0,i=!1,r=4){if(n.values)return!0;const s=n.type,l=n.valueCount;let o=n.valueOffset,f=[];const u=h[s],c=8*u,E=l*u,I=l*h[s]*8;let T,w;const p=8===r?64:32,d=n.valueOffsets;if(I>p){if(E>(i?e.byteLength:e?e.byteLength-o+a:0))return n.offlineOffsetSize=[o,E],n.values=null,!1}if(I<=p){if(!t)if(p<=32)o>>>=32-I;else{const e=d?.length?d[0]:o>>>0,t=d?.length?d[1]:Math.round((o-e)/g);I<=32?(o=e>>>32-I,d[0]=o):(o=e*2**(32-I)+(t>>>32-I),d[0]=e,d[1]=t>>>32-I)}if(1===l&&c===p)f=[o];else if(64===p){const e=d?.length?d[0]:o>>>0,t=d?.length?d[1]:Math.round((o-e)/g);let n=e,a=32;for(w=1;w<=l;w++){const e=32-c*w%32;if(a<c){const i=n<<e>>>32-a,r=t<<32-a>>>32-a;n=t,f.push(i+r*2**(c-a)),a-=32-(c-a)}else f.push(n<<e>>>32-c),a-=c;0===a&&(a=32,n=t)}}else for(w=1;w<=l;w++){const e=32-c*w;f.push(o<<e>>>32-c)}}else{o-=a,i&&(o=0);for(let n=o;n<o+E;n+=u){switch(s){case 1:case 2:case 7:T=new DataView(e,n,1).getUint8(0);break;case 3:T=new DataView(e,n,2).getUint16(0,t);break;case 4:case 13:T=new DataView(e,n,4).getUint32(0,t);break;case 5:T=new DataView(e,n,4).getUint32(0,t)/new DataView(e,n+4,4).getUint32(0,t);break;case 6:T=new DataView(e,n,1).getInt8(0);break;case 8:T=new DataView(e,n,2).getInt16(0,t);break;case 9:T=new DataView(e,n,4).getInt32(0,t);break;case 10:T=new DataView(e,n,4).getInt32(0,t)/new DataView(e,n+4,4).getInt32(0,t);break;case 11:T=new DataView(e,n,4).getFloat32(0,t);break;case 12:T=new DataView(e,n,8).getFloat64(0,t);break;case 16:case 18:T=B(new DataView(e,n,8),0,t);break;case 17:T=V(new DataView(e,n,8),0,t);break;default:T=null}f.push(T)}}if(2===s){let e="";const t=f;for(f=[],w=0;w<t.length;w++)0===t[w]&&""!==e?(f.push(e),e=""):e+=String.fromCharCode(t[w]);""===e&&0!==f.length||f.push(e)}return n.values=f,!0}function k(e){const t=e[0],n=y(t,"TILEWIDTH"),a=y(t,"TILELENGTH"),i=y(t,"IMAGEWIDTH"),r=y(t,"IMAGELENGTH"),s=y(t,"BITSPERSAMPLE"),l=y(t,"SAMPLESPERPIXEL"),o=y(t,"SAMPLEFORMAT")??1,f=I(o,s),u=C(t),c=p(t,"GDAL_NODATA");let h=null;c?.length&&(h=c.map(e=>parseFloat(e)),h.some(e=>isNaN(e))&&(h=null));const g=y(t,"COMPRESSION")??1;let T;switch(g){case 1:T="NONE";break;case 2:case 3:case 4:case 32771:T="CCITT";break;case 5:T="LZW";break;case 6:case 7:T="JPEG";break;case 32773:T="PACKBITS";break;case 8:case 32946:T="DEFLATE";break;case 34712:T="JPEG2000";break;case 34887:T="LERC";break;default:T=String(g)}let A=!0,S="";E.has(g)||(A=!1,S+="unsupported tag compression "+g),o>3&&(A=!1,S+="unsupported tag sampleFormat "+o),s>32&&64!==s&&(A=!1,S+="unsupported tag bitsPerSample "+s);const M=m(t,"GEOASCIIPARAMS");let P;if(M){const e=M.split("|").find(e=>e.includes("ESRI PE String = ")),t=e?e.replace("ESRI PE String = ",""):"";P=t.startsWith("COMPD_CS")||t.startsWith("PROJCS")||t.startsWith("GEOGCS")?{wkid:null,wkt:t}:null}const O=d(t,"GEOTIEPOINTS"),b=d(t,"GEOPIXELSCALE"),x=d(t,"GEOTRANSMATRIX"),L=t.has("GEOKEYDIRECTORY")?t.get("GEOKEYDIRECTORY").data:null;let R,D,N=!1,k=!1;if(L){N=2===y(L,"GTRasterTypeGeoKey");const e=y(L,"GTModelTypeGeoKey");if(2===e){const e=y(L,"GeographicTypeGeoKey");e>=1024&&e<=32766&&(P={wkid:e}),P||32767!==e||(k=!0,P={wkid:4326})}else if(1===e){const e=y(L,"ProjectedCSTypeGeoKey");e>=1024&&e<=32766&&(P={wkid:e})}}if(b&&O&&O.length>=6?(R=[b[0],0,O[3]-O[0]*b[0],0,-Math.abs(b[1]),O[4]-O[1]*b[1]],N&&(R[2]-=.5*R[0]+.5*R[1],R[5]-=.5*R[3]+.5*R[4])):x&&16===x.length&&(R=N?[x[0],x[1],x[3]-.5*x[0],x[4],x[5],x[7]-.5*x[5]]:[x[0],x[1],x[3],x[4],x[5],x[7]]),R){const e=[{x:0,y:r},{x:0,y:0},{x:i,y:r},{x:i,y:0}];let t,n=Number.POSITIVE_INFINITY,a=Number.POSITIVE_INFINITY,s=Number.NEGATIVE_INFINITY,l=Number.NEGATIVE_INFINITY;for(let i=0;i<e.length;i++)t=w(e[i],R),n=t.x>n?n:t.x,s=t.x<s?s:t.x,a=t.y>a?a:t.y,l=t.y<l?l:t.y;D={xmin:n,xmax:s,ymin:a,ymax:l,spatialReference:P}}else D={xmin:-.5,ymin:.5-r,xmax:i-.5,ymax:.5,spatialReference:P};k&&(D.xmax-D.xmin>400||Math.max(Math.abs(D.xmin),Math.abs(D.xmax))>361)&&(P=null,D.spatialReference=null);const F=G(e);let B,V,W,H,Y;if(F.length>0){W=Math.round(Math.log(i/y(F[0],"IMAGEWIDTH"))/Math.LN2);const e=F[F.length-1];H=F.length,B=y(e,"TILEWIDTH"),V=y(e,"TILELENGTH")}B=null!=H&&H>0?B||n:null,V=null!=H&&H>0?V||a:null,n&&(Y=[{maxCol:Math.ceil(i/n)-1,maxRow:Math.ceil(r/a)-1,minRow:0,minCol:0}],F.forEach(e=>{Y.push({maxCol:Math.ceil(y(e,"IMAGEWIDTH")/y(e,"TILEWIDTH"))-1,maxRow:Math.ceil(y(e,"IMAGELENGTH")/y(e,"TILELENGTH"))-1,minRow:0,minCol:0})}));const j=m(e[0],"GDAL_METADATA"),X=U(j);S+=" "+_({width:i,height:r,tileWidth:n,tileHeight:a,planes:l,ifds:e});const K=v(e).length===F.length+1,J=F?.length?F.map(e=>({x:i/y(e,"IMAGEWIDTH"),y:r/y(e,"IMAGELENGTH")})):void 0;return{width:i,height:r,tileWidth:n,tileHeight:a,planes:l,isBSQ:u,pixelType:f,compression:T,noData:h,hasMaskBand:K,isSupported:A,pyramidResolutions:J,message:S,extent:D,isPseudoGeographic:k,affine:b?null:R,firstPyramidLevel:W,maximumPyramidLevel:H,pyramidBlockWidth:B,pyramidBlockHeight:V,tileBoundary:Y,metadata:X}}function C(e,t){const n=p(e,"PLANARCONFIGURATION");return n?2===n[0]:!!t&&t.isBSQ}function G(e){return e.filter(e=>1===y(e,"NEWSUBFILETYPE"))}function v(e){return e.filter(e=>{const t=!(4&~(y(e,"NEWSUBFILETYPE")??0)),n=4===y(e,"PHOTOMETRICINTERPRETATION");return t&&n})}function F(e){const{littleEndian:t,isBigTiff:n,firstIFDPos:a}=H(e);let i=a;const r=[];do{const a=Y(e,t,i,0,s,n?8:4);if(!a.success)break;r.push(a.ifd),i=a.nextIFD}while(i>0);return{...k(r),littleEndian:t,isBigTiff:n,ifds:r,pyramidIFDs:G(r),maskIFDs:v(r)}}function B(e,t,n){const a=e.getUint32(t,n),i=e.getUint32(t+4,n);return n?i*g+a:a*g+i}function V(e,t,n){let a=n?e.getInt32(t,n):e.getUint32(t,n),i=n?e.getUint32(t+4,n):e.getInt32(t+4,n);const r=(n?a:i)>=0?1:-1;n?a*=r:i*=r;return r*(n?i*g+a:a*g+i)}function W(e,t,n,a){return a?B(e,t,n):e.getUint32(t,n)}function H(e){const t=new DataView(e,0,16),n=t.getUint16(0,!1);let a=null;if(18761===n)a=!0;else{if(19789!==n)throw new Error("unexpected endianess byte");a=!1}const i=t.getUint16(2,a);if(42!==i&&43!==i)throw new Error("unexpected tiff identifier");let r=4;const s=43===i;if(s){const e=t.getUint16(r,a);if(r+=2,8!==e)throw new Error("unsupported bigtiff version");if(0!==t.getUint16(r,a))throw new Error("unsupported bigtiff version");r+=2}return{littleEndian:a,isBigTiff:s,firstIFDPos:W(t,r,a,s)}}function Y(t,n,a,i=0,r=s,o=4){const u=A(t,n,a,i,r,o);let c;const h=u.ifd;if(h){if(l.forEach((e,a)=>{h.has(a)&&(c=h.get(a),c.data=A(t,n,c.valueOffset-i,i,e).ifd)}),h.has("GEOKEYDIRECTORY")){c=h.get("GEOKEYDIRECTORY");const e=c.values;if(e&&e.length>4){const a=e[0]+"."+e[1]+"."+e[2];c.data=A(t,n,c.valueOffset+6-i,i,f,2).ifd,c.data&&c.data.set("GEOTIFFVersion",{id:0,type:2,valueCount:1,valueOffset:null,values:[a]})}}if(h.has("XMP")){c=h.get("XMP");const t=c.values;"number"==typeof t[0]&&7===c.type&&(c.values=[e(new Uint8Array(t))])}}return u}function _(e){const{width:t,height:n,tileHeight:a,tileWidth:i}=e,r=e.planes,s=i?i*a:t*n,l=y(e.ifds[0],"BITSPERSAMPLE");let o="";return s*r>2**30/(l>8?l/8:1)&&(o=i?"tiled tiff exceeding 1 gigabits per tile is not supported":"scanline tiff exceeding 1 gigabits is not supported"),o}function j(e,t,n,a,i){const r=a?4:1,s=n*r*i;a&&(e=new Uint8Array(e.buffer));for(let f=0;f<t;f++){const t=f*s;for(let n=i;n<s;n++)e[t+n]+=e[t+n-i]}if(!a)return e;const l=new Uint8Array(e.length),o=n*i;for(let f=0;f<t;f++){const t=f*s;for(let n=0;n<o;n++)for(let a=0;a<r;a++)l[t+n*r+a]=e[t+n+(r-a-1)*o]}return new Float32Array(l.buffer)}async function X(e,t){const{headerInfo:n,ifd:a,offsets:i,sizes:s}=t,l=[];for(let r=0;r<i.length;r++){s[r];const t=await x(e,n.littleEndian,a,i[r],s[r]||e.byteLength);l.push(t)}const o=C(a,n),f=y(a,"BITSPERSAMPLE"),u=I(y(a,"SAMPLEFORMAT")??1,f),c=y(a,"SAMPLESPERPIXEL")||n.planes,h=T(u),g=y(a,"TILEWIDTH"),E=y(a,"TILELENGTH"),w=y(a,"COMPRESSION")??1,p=g*E;let d;const m=[];let A=l[0];const S=34887===w;for(let r=0;r<c;r++){if(d=new h(p),l.length===c)A=l[r],A.length===p&&(d=A);else if(A.length)if(o||S)d=A.length===p?A:A.slice(p*r,p*(r+1));else for(let e=0;e<p;e++)d[e]=A[e*c+r];m.push(d)}const M=n.noData?n.noData[0]:t.noDataValue,P=n.metadata?n.metadata.statistics:null,O=P?P.map(e=>e.min):null,b=P?P.map(e=>e.max):null,L={pixelType:u,width:g,height:E,pixels:m,noDataValue:M};return null!=M?r(L,M,{matchAllNoData:t?.matchAllNoData}):O&&b&&t.applyMinMaxConstraint&&(L.mask=D(m,O,b)),L}async function K(e,t={}){const n=t.pyramidLevel||0,a=t.headerInfo||F(e),{ifds:i,noData:s}=a;if(0===i.length)throw new Error("no valid image file directory");const l=_(a);if(l)throw l;let o=null;const f=-1===n?i[i.length-1]:i[n],u=s??t.noDataValue;if(o=a.tileWidth?await L(e,a,f):R(e,a,f),!o)return o;if(null!=u){r(o,u,{matchAllNoData:null==s&&t?.matchAllNoData})}return o}export{K as decode,X as decodeTileOrStrip,k as getImageInfo,v as getMaskIFDs,G as getPyramidIFDs,C as isBSQConfig,N as parseFieldValues,F as parseHeader,Y as parseIFD,H as parseSignature,M as unpackBits};
@@ -1,2 +1,3 @@
1
1
 
2
+ /** @since 5.0 */
2
3
  export type KeepMethod = "all" | "changed" | "unchanged";
@@ -1,23 +1,44 @@
1
+ import type { RasterBandStatistics } from "../../types.js";
1
2
  import type { BaseRasterFunctionParameters } from "../types.js";
2
- import type { RasterBandStatistics } from "../../../support/types.js";
3
3
 
4
+ /** @since 5.0 */
4
5
  export type KebabConvolutionTypes = "user-defined" | "line-detection-horizontal" | "line-detection-vertical" | "line-detection-left-diagonal" | "line-detection-right-diagonal" | "gradient-north" | "gradient-west" | "gradient-east" | "gradient-south" | "gradient-north-east" | "gradient-north-west" | "smooth-arithmetic-mean" | "smoothing3x3" | "smoothing5x5" | "sharpening3x3" | "sharpening5x5" | "laplacian3x3" | "laplacian5x5" | "sobel-horizontal" | "sobel-vertical" | "sharpen" | "sharpen2" | "point-spread" | "none";
5
6
 
6
7
  /** @since 4.28 */
7
8
  export interface ConvolutionFunctionParameters extends BaseRasterFunctionParameters {
8
- /** The convolution type. */
9
+ /**
10
+ * The convolution type.
11
+ *
12
+ * @since 5.0
13
+ */
9
14
  convolutionType: Exclude<KebabConvolutionTypes, "user-defined">;
10
15
  }
11
16
 
12
17
  /** @since 4.28 */
13
18
  export interface ConvolutionFunctionCustomParameters extends BaseRasterFunctionParameters {
14
- /** The number of columns, only needed for user-defined kernel */
19
+ /**
20
+ * The number of columns, only needed for user-defined kernel
21
+ *
22
+ * @since 5.0
23
+ */
15
24
  cols: number;
16
- /** The convolution type must be "user-defined". */
25
+ /**
26
+ * The convolution type must be "user-defined".
27
+ *
28
+ * @since 5.0
29
+ */
17
30
  convolutionType?: "user-defined";
18
- /** The kernel size of rows x columns arranged in row-major order. */
31
+ /**
32
+ * The kernel size of rows x columns arranged in row-major order.
33
+ *
34
+ * @since 5.0
35
+ */
19
36
  kernel: number[];
20
- /** The number of rows, only needed for user-defined kernel. */
37
+ /**
38
+ * The number of rows, only needed for user-defined kernel.
39
+ *
40
+ * @since 5.0
41
+ */
21
42
  rows: number;
22
43
  }
23
44
 
@@ -25,46 +46,92 @@ export interface ConvolutionFunctionCustomParameters extends BaseRasterFunctionP
25
46
  * ***********************************************
26
47
  *
27
48
  * contrastBrightness
49
+ *
50
+ * @since 5.0
28
51
  */
29
52
  export interface ContrastBrightnessParameters extends BaseRasterFunctionParameters {
30
- /** Brightness offset from -100 to 100. */
53
+ /**
54
+ * Brightness offset from -100 to 100.
55
+ *
56
+ * @since 5.0
57
+ */
31
58
  brightnessOffset: number;
32
- /** Contrast offset from -100 to 100. */
59
+ /**
60
+ * Contrast offset from -100 to 100.
61
+ *
62
+ * @since 5.0
63
+ */
33
64
  contrastOffset: number;
34
65
  }
35
66
 
67
+ /** @since 5.0 */
36
68
  export interface BaseStretchParameters extends BaseRasterFunctionParameters {
37
- /** When true, perform dynamic range adjustment (not supported on client side) */
69
+ /**
70
+ * When true, perform dynamic range adjustment (not supported on client side)
71
+ *
72
+ * @since 5.0
73
+ */
38
74
  dynamicRangeAdjustment?: boolean;
39
- /** The gamma values used for each band, needed when useGamma is true. */
75
+ /**
76
+ * The gamma values used for each band, needed when useGamma is true.
77
+ *
78
+ * @since 5.0
79
+ */
40
80
  gamma?: number[];
41
- /** The maximum output value. Default is 255. */
81
+ /**
82
+ * The maximum output value. Default is 255.
83
+ *
84
+ * @since 5.0
85
+ */
42
86
  outputMax?: number;
43
- /** The minimum output value. Default is 0. */
87
+ /**
88
+ * The minimum output value. Default is 0.
89
+ *
90
+ * @since 5.0
91
+ */
44
92
  outputMin?: number;
45
- /** When true, gamma stretch is applied. */
93
+ /**
94
+ * When true, gamma stretch is applied.
95
+ *
96
+ * @since 5.0
97
+ */
46
98
  useGamma?: boolean;
47
99
  }
48
100
 
101
+ /** @since 5.0 */
49
102
  export interface MinMaxStretchParameters extends BaseStretchParameters {
50
103
  /**
51
104
  * The avg and stddev in each band's statistics
52
105
  * is used along with numberOfStandardDeviations to calculate the cut off pixels values beling stretched. Default is the input data source's statistics.
106
+ *
107
+ * @since 5.0
53
108
  */
54
109
  statistics?: RasterBandStatistics[];
55
110
  }
56
111
 
112
+ /** @since 5.0 */
57
113
  export interface StddevStretchParameters extends MinMaxStretchParameters {
58
114
  /**
59
115
  * Values with in the given number of standard deviations are stretched to
60
116
  * [outputMin, outputMax], those fall outside are clamped.
117
+ *
118
+ * @since 5.0
61
119
  */
62
120
  numberOfStandardDeviations?: number;
63
121
  }
64
122
 
123
+ /** @since 5.0 */
65
124
  export interface PercentClipStretchParameters extends BaseStretchParameters {
66
- /** Percentage of the highest pixel values to be excluded. */
125
+ /**
126
+ * Percentage of the highest pixel values to be excluded.
127
+ *
128
+ * @since 5.0
129
+ */
67
130
  maxPercent?: number;
68
- /** Percentage of the lowest pixel values to be excluded. */
131
+ /**
132
+ * Percentage of the lowest pixel values to be excluded.
133
+ *
134
+ * @since 5.0
135
+ */
69
136
  minPercent?: number;
70
137
  }