@arcgis/core 5.2.2 → 5.2.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (73) hide show
  1. package/Basemap.d.ts +2 -2
  2. package/assets/esri/core/workers/RemoteClient.js +1 -1
  3. package/assets/esri/core/workers/chunks/{f88cbf9b1d1d7400c060.js → 20ee2f36f0fd0ae01e15.js} +1 -1
  4. package/assets/esri/core/workers/chunks/{f7ec3b7f2eccd9c4c2e5.js → 26261b21d1edf476ea49.js} +1 -1
  5. package/assets/esri/core/workers/chunks/{7d2be06dfbd92c8b9484.js → 596891426621c403bdef.js} +1 -1
  6. package/assets/esri/core/workers/chunks/{aa4f12fcb9f4ed3dba18.js → e3f8f1dba7b3a473ed00.js} +1 -1
  7. package/assets/esri/core/workers/chunks/{150e7a7bd5df25693da7.js → f0676c2963718bee2486.js} +1 -1
  8. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.ar.json +1 -1
  9. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.bg.json +1 -1
  10. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.bs.json +1 -1
  11. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.ca.json +1 -1
  12. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.cs.json +1 -1
  13. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.da.json +1 -1
  14. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.de.json +1 -1
  15. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.el.json +1 -1
  16. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.es.json +1 -1
  17. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.et.json +1 -1
  18. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.fi.json +1 -1
  19. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.fr.json +1 -1
  20. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.he.json +1 -1
  21. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.hr.json +1 -1
  22. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.hu.json +1 -1
  23. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.id.json +1 -1
  24. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.it.json +1 -1
  25. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.ja.json +1 -1
  26. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.ko.json +1 -1
  27. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.lt.json +1 -1
  28. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.lv.json +1 -1
  29. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.nl.json +1 -1
  30. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.no.json +1 -1
  31. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.pl.json +1 -1
  32. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.pt-BR.json +1 -1
  33. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.pt-PT.json +1 -1
  34. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.ro.json +1 -1
  35. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.ru.json +1 -1
  36. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.sk.json +1 -1
  37. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.sl.json +1 -1
  38. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.sr.json +1 -1
  39. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.sv.json +1 -1
  40. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.th.json +1 -1
  41. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.tr.json +1 -1
  42. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.uk.json +1 -1
  43. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.vi.json +1 -1
  44. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.zh-CN.json +1 -1
  45. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.zh-HK.json +1 -1
  46. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.zh-TW.json +1 -1
  47. package/config.d.ts +3 -3
  48. package/config.js +1 -1
  49. package/identity/Credential.d.ts +1 -1
  50. package/identity/IdentityManager.d.ts +1 -1
  51. package/identity/OAuthInfo.d.ts +1 -1
  52. package/identity/ServerInfo.d.ts +1 -1
  53. package/kernel.js +1 -1
  54. package/layers/VectorTileLayer.d.ts +2 -2
  55. package/layers/graphics/sources/support/ParquetSourceWorker.js +1 -1
  56. package/layers/mixins/APIKeyMixin.d.ts +1 -1
  57. package/layers/ogc/types.d.ts +1 -1
  58. package/layers/raster/functions/rasterProjectionHelper.js +1 -1
  59. package/legend/ActiveLayerInfo.d.ts +5 -1
  60. package/legend/ActiveLayerInfo.js +1 -1
  61. package/package.json +2 -2
  62. package/support/timeUtils.js +1 -1
  63. package/views/2d/engine/webgl/FeatureDisplayList.js +1 -1
  64. package/views/2d/engine/webgl/GlyphWorker.js +1 -1
  65. package/views/2d/layers/LayerView2D.js +1 -1
  66. package/views/3d/analysis/LineOfSight/placementUtils.js +1 -1
  67. package/views/3d/analysis/Viewshed/placementUtils.js +1 -1
  68. package/views/draw/DrawTool.js +1 -1
  69. package/widgets/Directions.d.ts +1 -1
  70. package/widgets/FeatureTable/Grid/Grid.js +1 -1
  71. package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
  72. package/widgets/OrientedImageryViewer.js +1 -1
  73. package/widgets/ScaleRangeSlider/types.d.ts +3 -3
@@ -1 +1 @@
1
- {"attachments":{"addFile":"新增檔案","attachmentNumberedLabel":"附件 {index}","attach":"附加","attachmentEditingDisabled":"已停用附件編輯。","attachmentLimitExceeded":"已超過附件限制","attachmentLimitReached":"已達到附件限制","attachmentMustBeShorterThan":"附件長度必須短於 {maxDuration}","attachmentsMustBeShorterThan":"附件長度必須短於 {maxDuration}","attachmentMustBeSmallerThan":"附件大小必須小於 {maxSize}","attachmentsMustBeSmallerThan":"附件大小必須小於 {maxSize}","durationInSecond":"{count} 秒","durationInSeconds":"{count} 秒","capture":"擷取","captureMethodNotSupported":"不支援的擷取方法","captureUnsupportedAdd":"此裝置不支援擷取。","captureUnsupportedDetail":"此裝置不支援擷取。","chooseFile":"選擇檔案","count":"計數: {count}","deleted":"已刪除","download":"下載","dragAndDropFile":"拖放檔案。","fileExceedsMaximumSize":"檔案超過大小上限","fileName":"檔案名稱","fileSelected":"選擇的檔案","fileToBeReplaced":"要取代的檔案","imageResizedToMeetRequirements":"圖像大小已調整為符合需求","maximumAudioLength":"音訊長度上限: {maxDuration}","maximumFileSize":"檔案大小上限: {maxSize}","maximumNumberOfFiles":"檔案數上限: {count}","maximumVideoLength":"視訊長度上限: {maxDuration}","maximize":"最大化","maximumNumberReachedRemoveToContinue":"已達到最大數量。 移除附件以繼續。","maxAttachmentsShort":"最大值: {count}","maxAttachments":"附件數上限: {count}","minimumNotMet":"未滿足最低附件需求","minimumNumberOfFiles":"檔案數下限: {count}","minAttachmentsShort":"最小值: {count}","minAttachments":"附件數下限: {count}","noAttachments":"無附件","noPreviewAvailable":"無法預覽","remove":"移除","replace":"取代","recordAudio":"錄音","takePhoto":"拍照","takeVideo":"錄影","searchAttachments":"搜尋附件","replaceFile":"取代檔案","selectFile":"選擇檔案","size":"大小","type":"類型","unableToAddAttachment":"無法新增附件","unableToAddAttachments":"無法新增附件","unsupportedDevice":"不支援的裝置","unsupportedDeviceCaptureMessage":"此裝置不支援必要的擷取方法。","viewAll":"檢視所有","youCanAddUpToOneAttachment":"最多可新增 1 個附件","youCanAddUpToAttachments":"最多可新增 {count} 個附件"},"addFeature":"新增圖徵","addRecord":"新增記錄","unsupportedDomainGroupTitle":"不支援的值","differentValues":"不同值","differentValuesPlaceholder":"(不同值)","empty":"沒有值","noDynamicChoices":"無可用選項","noDynamicChoicesWithNoValue":"無其他可用選項","otherOptionLabel":"其他","expressionEvaluationFailed":"表格無法執行計算","failedToCalculateValues":"無法計算值","footerButtons":{"add":"新增","delete":"刪除","discard":"放棄","done":"完成","replace":"取代","reset":"重設","update":"更新"},"footerNotices":{"deleteDisabledMinimumAttachments":"已停用刪除。 此功能需要的附件數下限。"},"formFailedToLoad":"無法載入表格。","formFailedToLoadTooManyComplexFeatures":"此表格使用將屬性編輯限制為 {num} 個圖徵的功能。","formFailedToLoadTooManyFeatures":"選擇最多 {num} 個圖徵以編輯屬性。","noVisibleFields":{"allElementsHidden":"所選圖徵沒有要顯示的欄位","elementsHiddenInSome":"所選圖徵具有分享的欄位,由於可見性表達式而未顯示","noElements":"所選圖徵沒有要顯示的欄位","noElementsInCommon":"所選圖徵沒有分享的欄位"},"other":"其他","recommended":"建議","relatedRecords":{"noOriginKeyFeature":"輸入 '{originKeyField}' 後才能將圖徵新增至 '{relatedLayerName}'。","noOriginKeyRecord":"輸入 '{originKeyField}' 後才能將記錄新增至 '{relatedLayerName}'。","noRecordsFound":"找不到記錄。","noRelatedRecordsFound":"找不到相關記錄。","relatedRecordsTitle":"相關記錄","untitledLayer":"未命名的圖層"},"requiredFieldBatchMode":"此欄位對於一或多個圖徵是必要的。","requiredFieldLabel":"{name} - 必要欄位","deselectAllLabel":"取消全選","selectAllLabel":"全選","showAll":"顯示全部","showAllOptions":"顯示所有選項","titles":{"addAttachments":"新增附件","attachments":"附件","editFeature":"編輯圖徵","editFeatures":"編輯圖徵","editAttachment":"編輯附件","replaceAttachment":"取代附件"},"totalCount":"總計: {count}","unsupported":"不支援","unsupportedContingentValues":"對於具有意外值的圖層,無法編輯多個圖徵的屬性。","validationErrors":{"cannotBeNull":"欄位為必填項。","invalidCodedValue":"值必須是其中一個列出值。","invalidType":"非有效值","invalidBatchFormType":"一或多個圖徵包含無效值。 檢查個別圖徵。","featuresInError":"一或多個圖徵發生錯誤。 檢查個別圖徵。","featuresWithInvalidValues":"一或多個圖徵具有無效值","nonVisibleError_changeValues":"所選圖徵具有包含無效值的隱藏欄位。 變更值以使欄位可見。","nonVisibleError_checkIndividualFeatures":"一或多個圖徵具有包含無效值的隱藏欄位。 檢查個別圖徵並更正問題。","outsideRange":"值應該介於 {min} 到 {max}","outsideRangeMax":"值必須小於或等於 {max}","outsideRangeMin":"值必須大於或等於 {min}","tooFewSelectedChoices":"Minimum selections required: {min}","tooManySelectedChoices":"Maximum selections allowed: {max}","tooShort":"此欄位至少需要 {min} 個字元","valuesIncompatible":"值與其他選定值不相容"},"valueExpressionError":"無法計算值。","viewAll":"檢視所有","subtypes":{"changeWarning":"子類型 {newType} 可能具有與 {originalType} 不同的預設值。 保留目前值可能會導致非預期的結果。","changeWarningTitle":"子類型已變更","useDefaultValuesOption":"使用預設值","keepCurrentValuesOption":"保留目前值","unsupportedDomainGroupTitle":"不支援","fieldOutOfSubtypeDomainWarning":"此欄位的值超出其網域的範圍。"}}
1
+ {"attachments":{"addFile":"新增檔案","attachmentNumberedLabel":"附件 {index}","attach":"附加","attachmentEditingDisabled":"已停用附件編輯。","attachmentLimitExceeded":"已超過附件限制","attachmentLimitReached":"已達到附件限制","attachmentMustBeShorterThan":"附件長度必須短於 {maxDuration}","attachmentsMustBeShorterThan":"附件長度必須短於 {maxDuration}","attachmentMustBeSmallerThan":"附件大小必須小於 {maxSize}","attachmentsMustBeSmallerThan":"附件大小必須小於 {maxSize}","durationInSecond":"{count} 秒","durationInSeconds":"{count} 秒","capture":"擷取","captureMethodNotSupported":"不支援的擷取方法","captureUnsupportedAdd":"此裝置不支援擷取。","captureUnsupportedDetail":"此裝置不支援擷取。","chooseFile":"選擇檔案","count":"計數: {count}","deleted":"已刪除","download":"下載","dragAndDropFile":"拖放檔案。","fileExceedsMaximumSize":"檔案超過大小上限","fileName":"檔案名稱","fileSelected":"選擇的檔案","fileToBeReplaced":"要取代的檔案","imageResizedToMeetRequirements":"圖像大小已調整為符合需求","maximumAudioLength":"音訊長度上限: {maxDuration}","maximumFileSize":"檔案大小上限: {maxSize}","maximumNumberOfFiles":"檔案數上限: {count}","maximumVideoLength":"視訊長度上限: {maxDuration}","maximize":"最大化","maximumNumberReachedRemoveToContinue":"已達到最大數量。 移除附件以繼續。","maxAttachmentsShort":"最大值: {count}","maxAttachments":"附件數上限: {count}","minimumNotMet":"未滿足最低附件需求","minimumNumberOfFiles":"檔案數下限: {count}","minAttachmentsShort":"最小值: {count}","minAttachments":"附件數下限: {count}","noAttachments":"無附件","noPreviewAvailable":"無法預覽","remove":"移除","replace":"取代","recordAudio":"錄音","takePhoto":"拍照","takeVideo":"錄影","searchAttachments":"搜尋附件","replaceFile":"取代檔案","selectFile":"選擇檔案","size":"大小","type":"類型","unableToAddAttachment":"無法新增附件","unableToAddAttachments":"無法新增附件","unsupportedDevice":"不支援的裝置","unsupportedDeviceCaptureMessage":"此裝置不支援必要的擷取方法。","viewAll":"檢視所有","youCanAddUpToOneAttachment":"最多可新增 1 個附件","youCanAddUpToAttachments":"最多可新增 {count} 個附件"},"addFeature":"新增圖徵","addRecord":"新增記錄","unsupportedDomainGroupTitle":"不支援的值","differentValues":"不同值","differentValuesPlaceholder":"(不同值)","empty":"沒有值","noDynamicChoices":"無可用選項","noDynamicChoicesWithNoValue":"無其他可用選項","otherOptionLabel":"其他","expressionEvaluationFailed":"表格無法執行計算","failedToCalculateValues":"無法計算值","footerButtons":{"add":"新增","delete":"刪除","discard":"放棄","done":"完成","replace":"取代","reset":"重設","update":"更新"},"footerNotices":{"deleteDisabledMinimumAttachments":"已停用刪除。 此功能需要的附件數下限。"},"formFailedToLoad":"無法載入表格。","formFailedToLoadTooManyComplexFeatures":"此表格使用將屬性編輯限制為 {num} 個圖徵的功能。","formFailedToLoadTooManyFeatures":"選擇最多 {num} 個圖徵以編輯屬性。","noVisibleFields":{"allElementsHidden":"所選圖徵沒有要顯示的欄位","elementsHiddenInSome":"所選圖徵具有分享的欄位,由於可見性表達式而未顯示","noElements":"所選圖徵沒有要顯示的欄位","noElementsInCommon":"所選圖徵沒有分享的欄位"},"other":"其他","recommended":"建議","relatedRecords":{"noOriginKeyFeature":"輸入 '{originKeyField}' 後才能將圖徵新增至 '{relatedLayerName}'。","noOriginKeyRecord":"輸入 '{originKeyField}' 後才能將記錄新增至 '{relatedLayerName}'。","noRecordsFound":"找不到記錄。","noRelatedRecordsFound":"找不到相關記錄。","relatedRecordsTitle":"相關記錄","untitledLayer":"未命名的圖層"},"requiredFieldBatchMode":"此欄位對於一或多個圖徵是必要的。","requiredFieldLabel":"{name} - 必要欄位","deselectAllLabel":"取消全選","selectAllLabel":"全選","showAll":"顯示全部","showAllOptions":"顯示所有選項","titles":{"addAttachments":"新增附件","attachments":"附件","editFeature":"編輯圖徵","editFeatures":"編輯圖徵","editAttachment":"編輯附件","replaceAttachment":"取代附件"},"totalCount":"總計: {count}","unsupported":"不支援","unsupportedContingentValues":"對於具有意外值的圖層,無法編輯多個圖徵的屬性。","validationErrors":{"cannotBeNull":"欄位為必填項。","invalidCodedValue":"值必須是其中一個列出值。","invalidType":"非有效值","invalidBatchFormType":"一或多個圖徵包含無效值。 檢查個別圖徵。","featuresInError":"一或多個圖徵發生錯誤。 檢查個別圖徵。","featuresWithInvalidValues":"一或多個圖徵具有無效值","nonVisibleError_changeValues":"所選圖徵具有包含無效值的隱藏欄位。 變更值以使欄位可見。","nonVisibleError_checkIndividualFeatures":"一或多個圖徵具有包含無效值的隱藏欄位。 檢查個別圖徵並更正問題。","outsideRange":"值應該介於 {min} 到 {max}","outsideRangeMax":"值必須小於或等於 {max}","outsideRangeMin":"值必須大於或等於 {min}","tooFewSelectedChoices":"所需的選擇數量下限: {min}","tooManySelectedChoices":"允許的選擇數量上限: {max}","tooShort":"此欄位至少需要 {min} 個字元","valuesIncompatible":"值與其他選定值不相容"},"valueExpressionError":"無法計算值。","viewAll":"檢視所有","subtypes":{"changeWarning":"子類型 {newType} 可能具有與 {originalType} 不同的預設值。 保留目前值可能會導致非預期的結果。","changeWarningTitle":"子類型已變更","useDefaultValuesOption":"使用預設值","keepCurrentValuesOption":"保留目前值","unsupportedDomainGroupTitle":"不支援","fieldOutOfSubtypeDomainWarning":"此欄位的值超出其網域的範圍。"}}
package/config.d.ts CHANGED
@@ -45,7 +45,7 @@ export interface Config {
45
45
  *
46
46
  * @since 4.18
47
47
  * @see [API keys](https://developers.arcgis.com/documentation/mapping-apis-and-services/security/api-keys/)
48
- * @see [API key guide](https://developers.arcgis.com/javascript/latest/secure-resources/#api-keys)
48
+ * @see [Authentication and access tokens](https://developers.arcgis.com/javascript/latest/authentication/access-tokens/#api-keys)
49
49
  * @see [API key authentication tutorials](https://developers.arcgis.com/documentation/security-and-authentication/api-key-authentication/tutorials/)
50
50
  * @see [Display a map tutorial - get an API key](https://developers.arcgis.com/javascript/latest/display-a-map/#get-an-access-token)
51
51
  */
@@ -54,7 +54,7 @@ export interface Config {
54
54
  * An object that contains global API keys for various services and scopes.
55
55
  * This object can be used to configure API keys to access the [basemap style service](https://developers.arcgis.com/javascript/latest/references/core/support/BasemapStyle/) and/or secure ArcGIS Enterprise services/items.
56
56
  * Alternatively, a fine-grained API key can be set on a specific class, which will override this global API key.
57
- * See the [API keys guide page](https://developers.arcgis.com/javascript/latest/secure-resources/#api-keys) for more information.
57
+ * See the [Authentication and access tokens guide page](https://developers.arcgis.com/javascript/latest/authentication/access-tokens/#api-keys) for more information.
58
58
  *
59
59
  * > [!WARNING]
60
60
  * >
@@ -64,7 +64,7 @@ export interface Config {
64
64
  *
65
65
  * @since 4.33
66
66
  * @see [API keys](https://developers.arcgis.com/documentation/mapping-apis-and-services/security/api-keys/)
67
- * @see [API key guide](https://developers.arcgis.com/javascript/latest/secure-resources/#api-keys)
67
+ * @see [Authentication and access tokens](https://developers.arcgis.com/javascript/latest/authentication/access-tokens/#api-keys)
68
68
  * @see [API key authentication tutorials](https://developers.arcgis.com/documentation/security-and-authentication/api-key-authentication/tutorials/)
69
69
  * @see [BasemapStyle](https://developers.arcgis.com/javascript/latest/references/core/support/BasemapStyle/)
70
70
  * @example
package/config.js CHANGED
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import"./core/has.js";import{deepMerge as e}from"./core/object.js";const t={apiKey:void 0,apiKeys:{scopes:[]},applicationName:``,applicationUrl:globalThis.location?.href,assetsPath:``,fontsUrl:`https://static.arcgis.com/fonts`,geometryServiceUrl:`https://utility.arcgisonline.com/arcgis/rest/services/Geometry/GeometryServer`,geoRSSServiceUrl:`https://utility.arcgis.com/sharing/rss`,kmlServiceUrl:`https://utility.arcgis.com/sharing/kml`,userPrivilegesApplied:!0,portalUrl:`https://www.arcgis.com`,respectPrefersReducedMotion:!0,routeServiceUrl:`https://route-api.arcgis.com/arcgis/rest/services/World/Route/NAServer/Route_World`,workers:{loaderConfig:{has:{},paths:{},map:{},packages:[]}},request:{crossOriginNoCorsDomains:null,httpsDomains:[`arcgis.com`,`arcgisonline.com`,`esrikr.com`,`premiumservices.blackbridge.com`,`esripremium.accuweather.com`,`gbm.digitalglobe.com`,`firstlook.digitalglobe.com`,`msi.digitalglobe.com`],interceptors:[],internalInterceptors:[],maxUrlLength:2e3,priority:`high`,proxyRules:[],proxyUrl:null,timeout:62e3,trustedServers:[],useIdentity:!0},log:{interceptors:[],level:null}};globalThis.esriConfig&&(e(t,globalThis.esriConfig,!0),delete t.has),!t.assetsPath&&(t.assetsPath=`https://js.arcgis.com/5.2.2/@arcgis/core/assets`,t.defaultAssetsPath=t.assetsPath);export{t as default};
2
+ import"./core/has.js";import{deepMerge as e}from"./core/object.js";const t={apiKey:void 0,apiKeys:{scopes:[]},applicationName:``,applicationUrl:globalThis.location?.href,assetsPath:``,fontsUrl:`https://static.arcgis.com/fonts`,geometryServiceUrl:`https://utility.arcgisonline.com/arcgis/rest/services/Geometry/GeometryServer`,geoRSSServiceUrl:`https://utility.arcgis.com/sharing/rss`,kmlServiceUrl:`https://utility.arcgis.com/sharing/kml`,userPrivilegesApplied:!0,portalUrl:`https://www.arcgis.com`,respectPrefersReducedMotion:!0,routeServiceUrl:`https://route-api.arcgis.com/arcgis/rest/services/World/Route/NAServer/Route_World`,workers:{loaderConfig:{has:{},paths:{},map:{},packages:[]}},request:{crossOriginNoCorsDomains:null,httpsDomains:[`arcgis.com`,`arcgisonline.com`,`esrikr.com`,`premiumservices.blackbridge.com`,`esripremium.accuweather.com`,`gbm.digitalglobe.com`,`firstlook.digitalglobe.com`,`msi.digitalglobe.com`],interceptors:[],internalInterceptors:[],maxUrlLength:2e3,priority:`high`,proxyRules:[],proxyUrl:null,timeout:62e3,trustedServers:[],useIdentity:!0},log:{interceptors:[],level:null}};globalThis.esriConfig&&(e(t,globalThis.esriConfig,!0),delete t.has),!t.assetsPath&&(t.assetsPath=`https://js.arcgis.com/5.2.4/@arcgis/core/assets`,t.defaultAssetsPath=t.assetsPath);export{t as default};
@@ -20,7 +20,7 @@ export interface CredentialEvents {
20
20
  *
21
21
  * @since 4.0
22
22
  * @see [Access ArcGIS Online items using OAuth 2.0](https://developers.arcgis.com/javascript/latest/sample-code/identity-oauth-basic/)
23
- * @see [Access Secure Services](https://developers.arcgis.com/javascript/latest/secure-resources/)
23
+ * @see [Authentication and access tokens](https://developers.arcgis.com/javascript/latest/authentication/access-tokens/)
24
24
  * @see [Authentication and OAuth 2](https://developers.arcgis.com/authentication/)
25
25
  * @see [Guide topic - Proxy pages](https://developers.arcgis.com/javascript/latest/proxies/)
26
26
  * @see [ArcGIS Organization portals](https://developers.arcgis.com/javascript/latest/arcgis-organization-portals/)
@@ -18,7 +18,7 @@
18
18
  * > The IdentityManager module is slightly different than other modules in the API. Instead of returning a class constructor, it returns a singleton instance that has already been created by this module.
19
19
  *
20
20
  * @since 4.0
21
- * @see [Access Secure Services](https://developers.arcgis.com/javascript/latest/guide/secure-resources/)
21
+ * @see [Authentication and access tokens](https://developers.arcgis.com/javascript/latest/authentication/access-tokens/)
22
22
  * @see [Authentication and OAuth 2](https://developers.arcgis.com/authentication/)
23
23
  * @see [Guide topic - Proxy pages](https://developers.arcgis.com/javascript/latest/proxies/)
24
24
  * @see [ArcGIS Organization portals](https://developers.arcgis.com/javascript/latest/arcgis-organization-portals/)
@@ -14,7 +14,7 @@ export interface OAuthInfoProperties extends Partial<Pick<OAuthInfo, "appId" | "
14
14
  *
15
15
  * @since 4.0
16
16
  * @see [Sample - Access ArcGIS Online items using OAuth 2.0](https://developers.arcgis.com/javascript/latest/sample-code/identity-oauth-basic/)
17
- * @see [Authentication and secure resources](https://developers.arcgis.com/javascript/latest/secure-resources/)
17
+ * @see [Authentication and access tokens](https://developers.arcgis.com/javascript/latest/authentication/access-tokens/)
18
18
  * @see [Authentication and OAuth 2](https://developers.arcgis.com/authentication/)
19
19
  * @see [Proxy pages with the API](https://developers.arcgis.com/javascript/latest/proxies/)
20
20
  * @see [ArcGIS portals](https://developers.arcgis.com/javascript/latest/arcgis-organization-portals/)
@@ -7,7 +7,7 @@ export interface ServerInfoProperties extends Partial<Pick<ServerInfo, "adminTok
7
7
  *
8
8
  * @since 4.0
9
9
  * @see [IdentityManager](https://developers.arcgis.com/javascript/latest/references/core/identity/IdentityManager/)
10
- * @see [Access Secure Services](https://developers.arcgis.com/javascript/latest/secure-resources/)
10
+ * @see [Authentication and access tokens](https://developers.arcgis.com/javascript/latest/authentication/access-tokens/)
11
11
  * @see [Authentication and OAuth 2](https://developers.arcgis.com/authentication/)
12
12
  * @see [Guide topic - Proxy pages](https://developers.arcgis.com/javascript/latest/proxies/)
13
13
  * @see [Guide topic - CORS](https://developers.arcgis.com/javascript/latest/cors/)
package/kernel.js CHANGED
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import"./core/has.js";import{addQueryParameter as e}from"./core/urlUtils.js";Symbol.dispose??=Symbol(`Symbol.dispose`),Symbol.asyncDispose??=Symbol(`Symbol.asyncDispose`);const t=`5.2`;let n=`5.2`;n=`5.2.2`;let r;function i(e){r=e}function a(t){let n=r?.findCredential(t);return n?.token?e(t,`token`,n.token):t}globalThis.$arcgis||Object.defineProperty(globalThis,"$arcgis",{configurable:!1,enumerable:!0,writable:!1,value:{}});export{a as addTokenParameter,n as fullVersion,r as id,i as setId,t as version};
2
+ import"./core/has.js";import{addQueryParameter as e}from"./core/urlUtils.js";Symbol.dispose??=Symbol(`Symbol.dispose`),Symbol.asyncDispose??=Symbol(`Symbol.asyncDispose`);const t=`5.2`;let n=`5.2`;n=`5.2.4`;let r;function i(e){r=e}function a(t){let n=r?.findCredential(t);return n?.token?e(t,`token`,n.token):t}globalThis.$arcgis||Object.defineProperty(globalThis,"$arcgis",{configurable:!1,enumerable:!0,writable:!1,value:{}});export{a as addTokenParameter,n as fullVersion,r as id,i as setId,t as version};
@@ -34,7 +34,7 @@ export interface VectorTileLayerProperties extends LayerProperties, APIKeyMixinP
34
34
  * apiKey: "YOUR_API_KEY"
35
35
  * });
36
36
  * @see [Item access privileges](https://developers.arcgis.com/documentation/security-and-authentication/api-key-authentication/api-key-credentials/#item-access-privileges)
37
- * @see [API key guide](https://developers.arcgis.com/javascript/latest/secure-resources/#api-keys)
37
+ * @see [Authentication and access tokens](https://developers.arcgis.com/javascript/latest/authentication/access-tokens/#api-keys)
38
38
  * @example
39
39
  * // set the api key to access a protected service
40
40
  * const layer = new FeatureLayer({
@@ -427,7 +427,7 @@ export default class VectorTileLayer extends VectorTileLayerSuperclass {
427
427
  * apiKey: "YOUR_API_KEY"
428
428
  * });
429
429
  * @see [Item access privileges](https://developers.arcgis.com/documentation/security-and-authentication/api-key-authentication/api-key-credentials/#item-access-privileges)
430
- * @see [API key guide](https://developers.arcgis.com/javascript/latest/secure-resources/#api-keys)
430
+ * @see [Authentication and access tokens](https://developers.arcgis.com/javascript/latest/authentication/access-tokens/#api-keys)
431
431
  * @example
432
432
  * // set the api key to access a protected service
433
433
  * const layer = new FeatureLayer({
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__addDisposableResource as e,__disposeResources as t}from"tslib";import{toConst as n}from"../../../../core/compilerUtils.js";import r from"../../../../core/Error.js";import i from"../../../../core/Handles.js";import has from"../../../../core/has.js";import a from"../../../../core/Logger.js";import{onAbortOrThrow as o,throwIfAborted as s}from"../../../../core/promiseUtils.js";import{QueueProcessor as c}from"../../../../core/QueueProcessor.js";import{parseWhereClause as l}from"../../../../core/sql.js";import{getMetersPerUnitForSR as u}from"../../../../core/units.js";import d from"../../../../geometry/SpatialReference.js";import{set as f,create as p,expandWithAABB as m,expandWithRect as ee,negativeInfinity as h}from"../../../../geometry/support/aaBoundingBox.js";import{copy as te,create as g,expandWithRect as ne,negativeInfinity as re}from"../../../../geometry/support/aaBoundingRect.js";import{isWebMercator as _,isWGS84 as v}from"../../../../geometry/support/spatialReferenceUtils.js";import{normalizeColumnPath as y,readParquetFileAttribute as b}from"../../../parquet.js";import{convertToGeometry as x}from"../../featureConversionUtils.js";import{getFieldNamesFromStatistics as S}from"../../data/attributeSupport.js";import{getQueryResultExtent as C,getQueryBoundingRects as w,QueryEngine as T}from"../../data/QueryEngine.js";import{queryCapabilities as ie}from"../../data/QueryEngineCapabilities.js";import{QueryEngineResult as E}from"../../data/QueryEngineResult.js";import{normalizeQueryLike as D}from"../../data/queryUtils.js";import{createFileProvider as O}from"../parquet/createFileProvider.js";import{readFieldStatistic as k}from"../parquet/ParquetFileStatistics.js";import{createDrawingInfo as ae}from"./clientSideDefaults.js";import{getParquetFileId as oe,getParquetRowId as se,getParquetObjectId as ce}from"./parquetIdUtils.js";import A from"../../../support/Field.js";import j from"../../../support/FieldsIndex.js";import{isNumericField as M}from"../../../support/fieldUtils.js";import{fromParquetGeometryEncodingJSON as N}from"../../../support/parquetEncodingUtils.js";import{completeParquetLayerInfo as P,fromParquetJSONGeometryType as F,toParquetJSONGeometryType as I}from"../../../support/parquetUtils.js";import{loadParquetModule as L}from"../../../../libs/librust-parquet/loadParquetModule.js";import{utc as R}from"../../../../time/constants.js";import{FeatureStoreQueryAdapter as z}from"../../../../views/2d/layers/features/FeatureStoreQueryAdapter.js";import{FeatureSnapshotSourceChunk as B}from"../../../../views/2d/layers/features/sources/strategies/chunks/FeatureSnapshotSourceChunk.js";import{FeatureSourceChunkStore as V}from"../../../../views/2d/layers/features/sources/strategies/chunks/SourceChunkStore.js";import{FeatureMetadata as H}from"../../../../views/2d/layers/features/support/FeatureMetadata.js";import{FeatureSetReaderParquet as U}from"../../../../views/2d/layers/features/support/FeatureSetReaderParquet.js";const W=new z,G=`__OBJECTID`,K=8e3;class le{constructor(e,t){this._files=e,this._createFileStream=t,this._fileIndex=0,this._streamIndex=0,this._streams=[],this._pending=new Set,this._resolvedCount=0}async next(e){for(await this._fill(e);this._pending.size>0;){s(e),await this._fill(e);let t=await ue(this._pending);if(this._pending.delete(t.read),this._resolvedCount++,t.chunk!=null)return t.chunk}return null}async _fill(e){for(this._removeDone();this._pending.size<8;){let t=this._getOrCreateNextStream(e);if(t==null)return;this._pending.add(t.read(e))}}_getOrCreateNextStream(e){let t=this._resolvedCount>=8?8:2;if(this._fileIndex<this._files.length&&this._streams.length<t){let t=this._files[this._fileIndex++],n=new de(t.id,this._createFileStream(t,e));return this._streams.push(n),n}return this._getNextStream()}_getNextStream(){let e=this._streams.length;for(let t=0;t<e;t++){let n=(this._streamIndex+t)%e,r=this._streams[n];if(r.canRead)return this._streamIndex=(n+1)%e,r}return null}_removeDone(){let e=this._streamIndex;for(let t=this._streams.length-1;t>=0;t--)this._streams[t].done&&(this._streams.splice(t,1),t<e&&e--);this._streamIndex=this._streams.length>0?e%this._streams.length:0}}function ue(e){return Promise.race(Array.from(e,async e=>({read:e,chunk:await e})))}class de{constructor(e,t){this._fileId=e,this._stream=t,this._readCount=0,this._reachedEnd=!1}get canRead(){return!this._reachedEnd}get done(){return this._reachedEnd&&this._readCount===0}async read(e){this._readCount++;try{let t=await(await this._stream).next(e);return t==null?(this._reachedEnd=!0,null):{fileId:this._fileId,chunk:t}}finally{this._readCount--}}}class fe{constructor(){this._hasZ=!1,this._hasM=!1,this._queue=new c({concurrency:4,process:(e,t)=>this._executeQuery(e,t)}),this._streams=new Map,this._streamIdCounter=0,this._indexMap={},this._handles=new i}async load(e){let t=e.spatialReference?d.fromJSON(e.spatialReference):void 0;if(t&&!t.isWGS84&&!t.isWebMercator)throw new r(`parquet:unsupported-projection`,`Only WGS84 and Web Mercator are supported`);this._customParameters=e.customParameters,this._loadParameters=e,await this._updateProvider(O(e.provider,null,()=>this._customParameters));let n=await this._provider.getMetadata(),i=await P(n,{fields:e.fields?.map(e=>A.fromJSON(e)),geometryEncoding:e.geometryEncoding?N(e.geometryEncoding):null,geometryType:e.geometryType?F(e.geometryType):null,displayOptimization:e.displayOptimization,spatialReference:t});if(this._hasZ=!!n?.hasZ,this._hasM=!!n?.hasM,!i.fields)throw new r(`parquet:unsupported`,`Fields must be defined`);let o;if(i.spatialReference&&i.geometryType){if(!i.spatialReference)throw new r(`parquet:unsupported`,`SpatialReference must be defined`);if(!i.spatialReference.isGeographic&&!i.spatialReference.isWebMercator)throw new r(`parquet:unsupported-projection`,`Only WGS84 and Web Mercator are supported`);i.spatialReference.isGeographic&&!i.spatialReference.isWGS84&&(a.getLogger(`parquet:unsupported-projection`).warn(`Found a geographic projection that is not WGS84. Handling as WGS84.`,{spatialReference:i.spatialReference}),i.spatialReference=d.WGS84),o={geometry:i.geometryEncoding?{geometryType:I(i.geometryType),spatialReference:i.spatialReference.toJSON(),encoding:i.geometryEncoding.toJSON()}:null,displayOptimization:i.displayOptimization}}this.setCustomParameters(e.customParameters),this._displayOptimization=i.displayOptimization,await this._provider.updateGeometryInfo(o),this._capabilities=$(await this._getFileStatistics(),this._hasZ,this._hasM);let s=await this._provider.getFiles();if(!s.length)return{layerDefinition:{},capabilities:$(null,this._hasZ,this._hasM)};let c=await s[0].file;i.file=c;let{fields:l}=i;if(l==null)throw new r(`parquet-layer:missing-metadata`,`Unable to create parquet source: cannot infer fields`,l);l.push(new A({name:G,type:`oid`,alias:G}));for(let e of l){let t=c.getColumnId(e.name);t!=null&&(this._indexMap[e.name]=t)}let u=j.fromLayerJSON({fields:l.map(e=>e.toJSON()),dateFieldsTimeReference:{timeZoneIANA:`UTC`}});this._fieldsIndex=u;let f=I(i.geometryType??`point`);return this._metadata=H.createFeature({fieldsIndex:u.toJSON(),geometryType:f,hasZ:this._hasZ,hasM:this._hasM,featureIdInfo:{type:`object-id`,fieldName:G},subtypes:null,subtypeField:null,types:null,typeIdField:null,globalIdField:null,spatialReference:i.spatialReference,outSpatialReference:null,attributeSpatialReference:null,timeInfo:null,timeReferenceUnknownClient:null,dateFieldsTimeZone:R}),this._queryEngineParams={fieldsIndex:this._metadata.fieldsIndex,geometryType:f,featureIdInfo:{type:`object-id`,fieldName:G},hasM:this._hasM,hasZ:this._hasZ,spatialReference:i.spatialReference?.toJSON()??{wkid:4326},aggregateAdapter:null,timeInfo:null,definitionExpression:null},this._fullExtent=n?.extent?n.extent:await this._tryDeriveParquetFullExtent(i),{capabilities:this._capabilities,layerDefinition:{fields:i.fields?.map(e=>e.toJSON()),drawingInfo:ae(f),extent:this._fullExtent??void 0,geometryType:f,hasZ:this._hasZ,hasM:this._hasM,geometryEncoding:i.geometryEncoding?.toJSON(),displayOptimization:i.displayOptimization}}}destroy(){this._provider.destroy(),this._queue.destroy();for(let{handle:e}of this._streams.values())e.remove();this._streams.clear(),this._indexMap={},this._handles.removeAll()}async reload(e){this.destroy(),await this.load(e)}set remoteClient(e){this._source=e.createInvokeProxy(``)}setCustomParameters(e){this._customParameters=e}getIndexMap(){return this._indexMap}async updateFileProvider(e){this._loadParameters={...this._loadParameters,provider:e};let t=O(e,this._provider.getGeometryInfo(),()=>this._customParameters);await this._updateProvider(t)}async getDiagnosticsSnapshot(){let e=await this._provider.getFiles();return{files:await Promise.all(e.map(e=>e.getDiagnosticsSnapshot()))}}async getColumnIndex(e){return(await this._getFileInfoById(e.fileId)).getColumnIndex(e.rowGroupIndex,e.columnIndex)}async getOffsetIndex(e){return(await this._getFileInfoById(e.fileId)).getOffsetIndex(e.rowGroupIndex,e.columnIndex)}async queryFeatures(e,t){let n=await D(e,null,this._queryEngineParams.spatialReference);return this._validateQuery(n),we(n)||(n.resultRecordCount=n.resultRecordCount?Math.min(n.resultRecordCount,K):K,n.resultOffset=n.resultOffset??0),n.outStatistics?this._queryStatistics(n,t):(n.returnDistinctValues&&(n.returnGeometry=void 0),(await this._enqueueQuery(n,t)).createQueryResponse())}async queryFeatureCount(e,t){let n=await D(e,null,this._queryEngineParams.spatialReference);return this._validateQuery(n),!q(n)&&!n.returnDistinctValues&&!n.groupByFieldsForStatistics?.length&&!n.outStatistics?.length?this._getFeatureCount():(n.returnDistinctValues||(n.outFields=void 0),n.returnGeometry=void 0,(await this._enqueueQuery(n,t)).createQueryResponseForCount())}async queryObjectIds(e,t){let n=await D(e,null,this._queryEngineParams.spatialReference);return this._validateQuery(n),q(n)?(n.resultRecordCount=n.resultRecordCount?Math.min(n.resultRecordCount,8e3):8e3,n.resultOffset=n.resultOffset??0,n.returnGeometry=void 0,n.outFields=void 0,n.returnDistinctValues=void 0,(await this._enqueueQuery(n,t)).items.map(e=>e.getObjectId())):Array.from({length:await this._getFeatureCount()},(e,t)=>t)}async queryAttributeBins(e,t={}){throw new r(`parquet:unsupported`,`queryAttributeBins not supported.`)}async queryExtent(e,t){let r=await D(e,null,this._queryEngineParams.spatialReference);if(this._validateQuery(r),this._fullExtent&&!q(r))return{count:await this._getFeatureCount(),extent:this._fullExtent};let i=n(this._metadata.spatialReference);r.returnGeometry=!0,r.outFields=void 0;let a=f(p(),h),o=p(),s=await this._enqueueQuery(r,t),c=0;for(let e of s.items)e.getBounds(o)&&(m(a,o),c+=1);let l=C(a,i,r.outSR?n(r.outSR):i.toJSON(),i,!1);return{count:c,extent:l}}async queryStream(e,t){if(!t.signal)throw Error(`InternalError: AbortSignal must be passed`);let n=await this._getCandidateFiles(e),r=new le(n,async(t,n)=>{let r=await t.file,i=await this._createParquetDisplayQuery(r,t.id,e);return r.executeQuery(i,K,n)}),i=this._streamIdCounter++,a=o(t.signal,e=>{let t=this._streams.get(i);t!=null&&(t.handle.remove(),this._streams.delete(i))});return this._streams.set(i,{stream:r,handle:a}),i}async getStreamNext(e,t){if(!t.signal)throw Error(`InternalError: AbortSignal must be passed`);let n=this._streams.get(e);if(!n)return{result:null};let r=await n.stream.next(t.signal);if(r==null)return n.handle.remove(),this._streams.delete(e),{result:null};let i=r.chunk.serialize().buffer,a={fileId:r.fileId,buffer:i};return i instanceof ArrayBuffer?{result:a,transferList:[i]}:{result:a}}async getStreamNextFeatures(e,t){let{result:n}=await this.getStreamNext(e,t);if(n==null)return null;let r=(await L()).ParquetChunk.deserialize(new Uint8Array(n.buffer)),i=new U(this._metadata,this._indexMap,r,n.fileId),a=[];for(;i.next();){let e=x(i.readGeometryWorldSpace(),i.geometryType,i.hasZ,i.hasM),t=i.readAttributes();a.push({attributes:t,geometry:e})}return{features:a}}async createPatch(e,t,n,r,i){if(!i.signal)throw Error(`InternalError: AbortSignal must be passed`);return(await(await(await this._getFileInfoById(e)).file).createChunkPatch(t,n,r,i.signal)).serialize().buffer}async _updateProvider(e){let t=this._provider;this._handles.removeAll(),this._provider=e,this._handles.add([e.events.on(`rangeRead`,e=>{this._source.onRangeRead(e)}),e.events.on(`sourceChanged`,async()=>{await this.reload(this._loadParameters),await this._source.onSourceChange()})]),await t?.destroy()}async _getCandidateFiles(e){let t=await this._provider.getFiles(),n=await this._getSpatialFilePruning(e);if(n==null)return t;let r=t.filter(e=>this._mayIncludeFileForSpatialPruning(e,n));return n.type===`xz`?Ce(r,n):r}async _queryStatistics(e,t){let n=await D({...e},null,this._queryEngineParams.spatialReference);if(n.returnGeometry=void 0,ve(n,this._fieldsIndex)){let e=await this._getStatisticsFromFiles(n);if(e)return e}return(await this._enqueueQuery(n,t)).createQueryResponse()}async _getStatisticsFromFiles(e){let t=await this._provider.getFiles(),n={},r=[];for(let i of e.outStatistics??[]){let e=xe(i,t);if(!e.available)return null;n[i.outStatisticFieldName]=e.value,r.push(be(i,this._fieldsIndex))}return{fields:r,features:[{attributes:n}]}}async _getSpatialFilePruning(e){if(e.type!==`tile`&&(e.type!==`arcade`||e.extent==null))return null;let t=this._displayOptimization?.index;if(t==null)return null;let n=e.outSpatialReference.wkid;if(t.wkid==null||n==null)return null;let r=t.wkid,i=await L();switch(t.type){case`xz`:return{type:`xz`,fieldName:y(t.code),intersects:(a,o)=>i.queryIntersectsXZStatistics(t.fullExtent,e.extent,n,r,t.maxLevel,a,o)};case`z`:return{type:`xy`,xFieldName:y(t.xColumn),yFieldName:y(t.yColumn),intersects:(t,a,o,s)=>i.queryIntersectsXYStatistics(e.extent,n,r,t,a,o,s)}}}_mayIncludeFileForSpatialPruning(e,t){switch(t.type){case`xz`:{let n=Z(e,t);return n?.type===`null-only`?!1:n?.type!==`bounds`||t.intersects(n.minValue,n.maxValue)}case`xy`:{let n=e.statistics.statistics.get(t.xFieldName),r=e.statistics.statistics.get(t.yFieldName);return n?.type===`null-only`||r?.type===`null-only`?!1:n?.type!==`bounds`||r?.type!==`bounds`||t.intersects(n.minValue,n.maxValue,r.minValue,r.maxValue)}}}async _tryDeriveParquetFullExtent(n){if(!n.spatialReference)return null;if(this._fullExtent==null&&n.geometryEncoding?.type===`location`){let r=await this._provider.getFiles(),{xField:i,yField:a}=n.geometryEncoding,o=f(p(),h),s=!1;for(let n of r){let r=await n.file;for(let n of r.rowGroups()){let r={stack:[],error:void 0,hasError:!1};try{let t=e(r,n.columnDescriptorForAttribute(i),!1),c=e(r,n.columnDescriptorForAttribute(a),!1),l=k(t),u=k(c);if(l?.type===`bounds`&&u?.type===`bounds`){let e=[l.minValue,u.minValue,l.maxValue,u.maxValue];ee(o,e),s=!0}n.free()}catch(e){r.error=e,r.hasError=!0}finally{t(r)}}}return s?{xmin:o[0],ymin:o[1],xmax:o[3],ymax:o[4],spatialReference:n.spatialReference?.toJSON()}:null}return null}async _getFileInfoById(e){let t=await this._provider.getFiles();for(let n of t)if(n.id===e)return n;throw Error(`InternalError: File ${e} does not exist`)}async _getFileStatistics(){return{featureCount:await this._getFeatureCount(),byteLength:await this._getByteLength()}}async _getFile(e){return(await this._getFileInfoById(e)).file}async _createParquetQuery(e,t,n,r,i){let a=(await L()).Query.new();n!=null&&a.setPreFilterStart(n),r!=null&&a.setPreFilterCount(r),i!=null&&a.setPostFilterCount(i);let o=await this._getRequiredFields(e);a.setOutFields(o),(e.geometry||e.returnGeometry)&&a.setReturnGeometry(!0),a.setReturnZ(!!e.returnZ),a.setReturnM(!!e.returnM);let s=this._tryGetGeneralizedGeometryResolution(e);s!=null&&a.setSourceResolution(s);let c=e.geometry?.spatialReference??this._queryEngineParams.spatialReference,l=c.wkid;if(e.geometry&&(_(c)||v(c))){let t=te(g(),re);for(let n of w(e.geometry))ne(t,n);a.setOutSpatialReference(l),a.setExtent({xmin:t[0],ymin:t[1],xmax:t[2],ymax:t[3]})}if(e.where){let{id:n,file:r}=t;await this._setWhereClause(a,await r,n,e.where)}return a}async _createParquetDisplayQuery(e,t,n){let r=(await L()).Query.new();if(n.type===`tile`){r.setExtent(n.extent),r.setQuantizationTransform(n.transform);let e=this._sourceResolution(n.resolution,n.outSpatialReference);e!=null&&r.setSourceResolution(e)}else n.type===`arcade`&&n.extent!=null&&r.setExtent(n.extent);return r.setOutFields(n.outFields.filter(e=>this._indexMap[e]!=null)),r.setOutSpatialReference(n.outSpatialReference.wkid),r.setReturnGeometry(n.returnGeometry),r.setReturnZ(n.returnZ),r.setReturnM(n.returnM),n.where&&await this._setWhereClause(r,e,t,n.where),r}async _getFeatureCount(){return(await this._provider.getFiles()).map(e=>e.statistics.rowCount).reduce((e,t)=>e+t,0)}async _getByteLength(){return(await this._provider.getFiles()).map(e=>e.statistics.byteSize).reduce((e,t)=>e+t,0)}_validateQuery(e){if(!this._capabilities.query.supportsStatistics&&e.outStatistics)throw new r(`parquet:unsupported`,`Statistics queries are not supported`,{query:e});if(!this._capabilities.query.supportsOrderBy&&e.orderByFields?.length)throw new r(`parquet:unsupported`,`Queries using orderBy are not supported`,{query:e});if(!this._capabilities.query.supportsDistinct&&e.returnDistinctValues)throw new r(`parquet:unsupported`,`Queries using returnDistinctValues are not supported`,{query:e})}async _setWhereClause(e,t,n,i){let a=this._indexMap,o=this._fieldsIndex,s={getAttribute(e,r){let i=a[r];if(i==null){if(o.get(r)?.name===`__OBJECTID`){let t=e.row+e.rowGroupStart;return ce(n,t)}return null}let s=o.get(r);return b(t,e.rowGroup,e.row,i,s.type)}},c=await l(i,this._fieldsIndex);if(!c.isStandardized)throw new r(`sql-parse-error`,`expression is not standardized`);let u=(e,t,n)=>c.testFeatureCompiled({rowGroup:e,row:t,rowGroupStart:n},s,null),d=c.fieldNames.map(e=>o.get(e)).filter(e=>e&&this._indexMap[e?.name]!=null);e.setWhere(i),e.setWhereEvaluator(u),e.setWhereFields(d.map(e=>e.name))}async*_streamFeatures(e,t,n,r,i){let a=await this._provider.getFiles(),o=0;for(let s of a){let a=o,c=o+s.statistics.rowCount;if(o+=s.statistics.rowCount,t!=null&&t>=c)continue;let l=t==null?null:Math.max(t-a,0),u=n;if(n!=null){let e=t??0,r=e+n;u=Math.max(Math.min(r,c)-Math.max(e,a),0)}if(u===0)continue;let d=await this._createParquetQuery(e,s,l,u,r),f=await(await s.file).executeQuery(d,K),p=async()=>{let e=await f.next(i);if(!e)return null;let t=new U(this._metadata,this._indexMap,e,s.id);return X([new B(t,null,0,!1)],this._queryEngineParams)},m=await p();for(;m!=null;)yield m,m=await p()}}async _queryFeaturesWithQueryEnginePagination(e,t){let n=[],r=this._streamFeatures(e,null,null,null,t),i=await r.next();for(;!i.done;){let a=await i.value.executeQueryForOpaqueFeatures({...e,where:void 0},t);for(let e of a)n.push(e);i=await r.next()}return n}async _queryFeaturesWithUpfrontPagination(e,t){let n=e.resultOffset??0,r=e.resultRecordCount??K,i,a,o;ge(e)?_e(e)||(o=n+r):(n&&=(i=n,0),a=e.resultRecordCount);let s=[],c=this._streamFeatures(e,i,a,o,t),l=await c.next();for(;!l.done&&r>0;){let i=await l.value.executeQueryForOpaqueFeatures({...e,where:void 0},t);for(let e of i){if(n>0){n--;continue}if(s.push(e),--r<=0)return s}l=await c.next()}return s}_enqueueQuery(e,t){return this._queue.push(e,t)}async _executeQuery(e,t){if(e.objectIds?.length){let n=new Map;for(let t of e.objectIds){let e=oe(t),r=se(t),i=n.get(e);i||(i=[],n.set(e,i)),i.push(r)}let r=[];for(let[i,a]of n.entries()){let n=await this._executeFileIdQuery(e,i,a,t);for(let e of n)r.push(e)}return new E(r,e,{fieldsIndex:this._fieldsIndex,geometryType:this._metadata.geometryType,spatialReference:this._queryEngineParams.spatialReference,hasM:this._hasM,hasZ:this._hasZ,featureAdapter:W,featureIdInfo:this._queryEngineParams.featureIdInfo})}if(e.where===`1=1`&&(e.where=null),e.resultOffset??=0,e.resultRecordCount??=await this._getFeatureCount(),e.resultRecordCount>2e7&&!(this._displayOptimization&&e.geometry))throw new r(`parquet:cannot-execute-query`,`Unable to execute query, dataset is too large.`);let n=!!e.orderByFields?.length||!!e.outStatistics?.length||!!e.returnDistinctValues,i=n?await this._queryFeaturesWithQueryEnginePagination(e,t):await this._queryFeaturesWithUpfrontPagination(e,t);return n||(e.resultOffset=0),new E(i,e,{fieldsIndex:this._fieldsIndex,geometryType:this._metadata.geometryType,spatialReference:this._queryEngineParams.spatialReference,hasM:this._hasM,hasZ:this._hasZ,featureAdapter:W,featureIdInfo:this._queryEngineParams.featureIdInfo})}async _executeFileIdQuery(e,t,n,r){let i=new Set(await this._getRequiredFields(e));if(e.where){let t=await l(e.where,this._fieldsIndex);for(let e of t.fieldNames){let t=this._fieldsIndex.get(e);t&&this._indexMap[t.name]!=null&&i.add(t.name)}}let a=(await L()).Query.new();a.setOutFields(Array.from(i)),a.setReturnGeometry(!!e.returnGeometry),a.setReturnZ(!!e.returnZ),a.setReturnM(!!e.returnM),a.setIds(new Uint32Array(n));let o=await(await this._getFile(t)).executeQuery(a,K,r),s=await o.next(r),c=0,u=[];for(;s!=null;){let e=new U(this._metadata,this._indexMap,s,t),n=new B(e,null,c++,!1);u.push(n),s=await o.next(r)}return X(u,this._queryEngineParams).executeQueryForOpaqueFeatures(e,r)}async _getRequiredFields(e){let t=new Set;if(e.outStatistics)for(let n of S(this._fieldsIndex,e.outStatistics,e.groupByFieldsForStatistics))t.add(n);else if(e.outFields)for(let n of e.outFields)t.add(n);return(t.has(`*`)?this._fieldsIndex.fields.map(e=>e.name):Array.from(t)).filter(e=>this._indexMap[e]!=null)}_tryGetGeneralizedGeometryResolution(e){if(!this._displayOptimization)return null;let t=e.outSR??this._queryEngineParams.spatialReference;if(!_(t)&&!v(t))return null;let n=e.quantizationParameters?.tolerance??e.maxAllowableOffset;return n?this._sourceResolution(n,t):null}_sourceResolution(e,t){let n=this._queryEngineParams.spatialReference,r=u(t)/u(n)*e;return!Number.isFinite(r)||r<=0?null:r}}function pe(e){switch(e){case`fullText`:case`having`:case`timeExtent`:case`historicMoment`:case`aggregateIds`:case`uniqueIds`:case`gdbVersion`:case`objectIds`:case`where`:case`geometry`:case`resultOffset`:case`resultRecordCount`:return!0;default:return!1}}function me(e){switch(e){case`fullText`:case`having`:case`timeExtent`:case`historicMoment`:case`aggregateIds`:case`uniqueIds`:case`gdbVersion`:case`objectIds`:case`where`:case`geometry`:return!0;default:return!1}}function he(e){switch(e){case`fullText`:case`having`:case`timeExtent`:return!0;case`historicMoment`:case`aggregateIds`:case`uniqueIds`:case`gdbVersion`:return!1;case`objectIds`:case`where`:case`resultOffset`:case`geometry`:case`resultRecordCount`:return!1}return!1}function q(e){for(let t in e){let n=t;if(pe(n)&&e[n]!==null)return!0}return!1}function ge(e){for(let t in e){let n=t;if(me(n)&&e[n]!==null)return!0}return!1}function _e(e){for(let t in e){let n=t;if(he(n)&&e[n]!==null)return!0}return!1}function ve(e,t){return!!e.outStatistics?.length&&!q(e)&&!e.groupByFieldsForStatistics?.length&&!e.orderByFields?.length&&!e.returnDistinctValues&&!e.returnAggIds&&e.outStatistics.every(e=>ye(e,t))}function ye(e,t){switch(e.statisticType){case`count`:return e.onStatisticField===`1`||t.get(e.onStatisticField)!=null;case`min`:case`max`:{let n=t.get(e.onStatisticField);return n!=null&&M(n)}default:return!1}}function be(e,t){let n=e.statisticType===`exceedslimit`?null:t.get(e.onStatisticField),r=(e.statisticType===`min`||e.statisticType===`max`)&&n?.type===`esriFieldTypeDate`?n.type:`esriFieldTypeDouble`;return{name:e.outStatisticFieldName,alias:e.outStatisticFieldName,type:r}}function xe(e,t){switch(e.statisticType){case`count`:return J(e,t);case`min`:return Y(e,t,Math.min);case`max`:return Y(e,t,Math.max);default:return{available:!1,value:null}}}function J(e,t){if(e.statisticType!==`count`)return{available:!1,value:null};if(e.onStatisticField===`1`)return{available:!0,value:t.reduce((e,t)=>e+t.statistics.rowCount,0)};let n=0;for(let r of t){let t=r.statistics.statistics.get(e.onStatisticField);if(t==null||t.nullCount==null)return{available:!1,value:null};n+=r.statistics.rowCount-t.nullCount}return{available:!0,value:n}}function Y(e,t,n){if(e.statisticType!==`min`&&e.statisticType!==`max`)return{available:!1,value:null};let r=null,i=e.statisticType===`min`?`minValue`:`maxValue`;for(let a of t){let t=a.statistics.statistics.get(e.onStatisticField);if(t==null)return{available:!1,value:null};switch(t.type){case`null-only`:continue;case`unknown`:return{available:!1,value:null};case`bounds`:{let e=Se(t[i]);if(e==null)return{available:!1,value:null};r=r==null?e:n(r,e);break}}}return{available:!0,value:r}}function Se(e){return typeof e==`number`&&Number.isFinite(e)?e:null}function X(e,t){let n=new V;for(let t of e)n.insert(t);return new T({...t,featureStore:n})}function Z(e,t){return e.statistics.statistics.get(t.fieldName)??null}function Ce(e,t){return e.slice().sort((e,n)=>{let r=Q(e,t),i=Q(n,t);return r===i?0:r<i?-1:1})}function Q(e,t){let n=Z(e,t);return n?.type===`bounds`?n.maxValue-n.minValue:1/0}function $(e,t,n){let r=e?.featureCount,i=!1;return r!=null&&r<has(`parquetlayer-full-query-feature-count`)&&(i=!0),{analytics:{supportsCacheHint:!1},attachment:null,data:{isVersioned:!1,isBranchVersioned:!1,supportedCurveTypes:[],supportsAttachment:!1,supportsM:n,supportsTrueCurve:!1,supportsZ:t},metadata:{supportsAdvancedFieldProperties:!1},operations:{supportsCalculate:!1,supportsTruncate:!1,supportsValidateSql:!1,supportsAdd:!1,supportsDelete:!1,supportsEditing:!1,supportsChangeTracking:!1,supportsQuery:!0,supportsQueryBins:!1,supportsQueryPivot:!1,supportsQueryAnalytics:!1,supportsQueryAttachments:!1,supportsQueryTopFeatures:!1,supportsResizeAttachments:!1,supportsSync:!1,supportsUpdate:!1,supportsExceedsLimitStatistics:!1,supportsAsyncConvert3D:!1},query:{...ie,maxRecordCount:K,supportsOrderBy:i,supportsDistinct:!0,supportsStatistics:!0,supportsSpatialAggregationStatistics:!1,supportedSpatialAggregationStatistics:{envelope:!1,centroid:!1,convexHull:!1}},queryAttributeBins:{supportsDate:!1,supportsFixedInterval:!1,supportsAutoInterval:!1,supportsFixedBoundaries:!1,supportsStackBy:!1,supportsSplitBy:!1,supportsSnapToData:!1,supportsReturnFullIntervalBin:!1,supportsFirstDayOfWeek:!1,supportsNormalization:!1},queryRelated:{supportsCount:!1,supportsOrderBy:!1,supportsPagination:!1,supportsCacheHint:!1},queryTopFeatures:{supportsCacheHint:!1},editing:{supportsDeleteByAnonymous:!1,supportsDeleteByOthers:!1,supportsGeometryUpdate:!1,supportsGlobalId:!1,supportsTrueCurveUpdate:!1,supportsTrueCurveUpdateByTrueCurveClientsOnly:!0,supportsReturnServiceEditsInSourceSpatialReference:!1,supportsRollbackOnFailure:!1,supportsUpdateByAnonymous:!1,supportsUpdateByOthers:!1,supportsUploadWithItemId:!1,supportsUpdateWithoutM:!1,supportsAsyncApplyEdits:!1,zDefault:void 0}}}function we(e){return!!e.objectIds?.length||!!e.outStatistics||!!e.orderByFields?.length||!!e.returnDistinctValues}export{fe as default};
2
+ import{__addDisposableResource as e,__disposeResources as t}from"tslib";import n from"../../../../core/Error.js";import r from"../../../../core/Handles.js";import has from"../../../../core/has.js";import i from"../../../../core/Logger.js";import{onAbortOrThrow as a,throwIfAborted as o}from"../../../../core/promiseUtils.js";import{QueueProcessor as s}from"../../../../core/QueueProcessor.js";import{parseWhereClause as c}from"../../../../core/sql.js";import{getMetersPerUnitForSR as l}from"../../../../core/units.js";import{initializeProjection as u}from"../../../../geometry/projectionUtils.js";import d from"../../../../geometry/SpatialReference.js";import{set as f,create as p,expandWithAABB as m,expandWithRect as h,negativeInfinity as g}from"../../../../geometry/support/aaBoundingBox.js";import{copy as _,create as v,expandWithRect as ee,negativeInfinity as te}from"../../../../geometry/support/aaBoundingRect.js";import{isWebMercator as y,isWGS84 as b}from"../../../../geometry/support/spatialReferenceUtils.js";import{normalizeColumnPath as x,readParquetFileAttribute as ne}from"../../../parquet.js";import{convertToGeometry as S}from"../../featureConversionUtils.js";import{getFieldNamesFromStatistics as re}from"../../data/attributeSupport.js";import{project as ie}from"../../data/projectionSupport.js";import{getQueryResultExtent as ae,getQueryBoundingRects as C,QueryEngine as w}from"../../data/QueryEngine.js";import{queryCapabilities as T}from"../../data/QueryEngineCapabilities.js";import{QueryEngineResult as E}from"../../data/QueryEngineResult.js";import{normalizeQueryLike as D}from"../../data/queryUtils.js";import{createFileProvider as O}from"../parquet/createFileProvider.js";import{readFieldStatistic as k}from"../parquet/ParquetFileStatistics.js";import{createDrawingInfo as oe}from"./clientSideDefaults.js";import{getParquetFileId as se,getParquetRowId as ce,getParquetObjectId as A}from"./parquetIdUtils.js";import j from"../../../support/Field.js";import M from"../../../support/FieldsIndex.js";import{isNumericField as N}from"../../../support/fieldUtils.js";import{fromParquetGeometryEncodingJSON as P}from"../../../support/parquetEncodingUtils.js";import{completeParquetLayerInfo as F,fromParquetJSONGeometryType as I,toParquetJSONGeometryType as L}from"../../../support/parquetUtils.js";import{loadParquetModule as R}from"../../../../libs/librust-parquet/loadParquetModule.js";import{utc as z}from"../../../../time/constants.js";import{FeatureStoreQueryAdapter as B}from"../../../../views/2d/layers/features/FeatureStoreQueryAdapter.js";import{FeatureSnapshotSourceChunk as V}from"../../../../views/2d/layers/features/sources/strategies/chunks/FeatureSnapshotSourceChunk.js";import{FeatureSourceChunkStore as H}from"../../../../views/2d/layers/features/sources/strategies/chunks/SourceChunkStore.js";import{FeatureMetadata as U}from"../../../../views/2d/layers/features/support/FeatureMetadata.js";import{FeatureSetReaderParquet as W}from"../../../../views/2d/layers/features/support/FeatureSetReaderParquet.js";const G=new B,K=`__OBJECTID`,q=8e3;class le{constructor(e,t){this._files=e,this._createFileStream=t,this._fileIndex=0,this._streamIndex=0,this._streams=[],this._pending=new Set,this._resolvedCount=0}async next(e){for(await this._fill(e);this._pending.size>0;){o(e),await this._fill(e);let t=await ue(this._pending);if(this._pending.delete(t.read),this._resolvedCount++,t.chunk!=null)return t.chunk}return null}async _fill(e){for(this._removeDone();this._pending.size<8;){let t=this._getOrCreateNextStream(e);if(t==null)return;this._pending.add(t.read(e))}}_getOrCreateNextStream(e){let t=this._resolvedCount>=8?8:2;if(this._fileIndex<this._files.length&&this._streams.length<t){let t=this._files[this._fileIndex++],n=new de(t.id,this._createFileStream(t,e));return this._streams.push(n),n}return this._getNextStream()}_getNextStream(){let e=this._streams.length;for(let t=0;t<e;t++){let n=(this._streamIndex+t)%e,r=this._streams[n];if(r.canRead)return this._streamIndex=(n+1)%e,r}return null}_removeDone(){let e=this._streamIndex;for(let t=this._streams.length-1;t>=0;t--)this._streams[t].done&&(this._streams.splice(t,1),t<e&&e--);this._streamIndex=this._streams.length>0?e%this._streams.length:0}}function ue(e){return Promise.race(Array.from(e,async e=>({read:e,chunk:await e})))}class de{constructor(e,t){this._fileId=e,this._stream=t,this._readCount=0,this._reachedEnd=!1}get canRead(){return!this._reachedEnd}get done(){return this._reachedEnd&&this._readCount===0}async read(e){this._readCount++;try{let t=await(await this._stream).next(e);return t==null?(this._reachedEnd=!0,null):{fileId:this._fileId,chunk:t}}finally{this._readCount--}}}class fe{constructor(){this._hasZ=!1,this._hasM=!1,this._queue=new s({concurrency:4,process:(e,t)=>this._executeQuery(e,t)}),this._streams=new Map,this._streamIdCounter=0,this._indexMap={},this._handles=new r}async load(e){let t=e.spatialReference?d.fromJSON(e.spatialReference):void 0;if(t&&!t.isWGS84&&!t.isWebMercator)throw new n(`parquet:unsupported-projection`,`Only WGS84 and Web Mercator are supported`);this._customParameters=e.customParameters,this._loadParameters=e,await this._updateProvider(O(e.provider,null,()=>this._customParameters));let r=await this._provider.getMetadata(),a=await F(r,{fields:e.fields?.map(e=>j.fromJSON(e)),geometryEncoding:e.geometryEncoding?P(e.geometryEncoding):null,geometryType:e.geometryType?I(e.geometryType):null,displayOptimization:e.displayOptimization,spatialReference:t});if(this._hasZ=!!r?.hasZ,this._hasM=!!r?.hasM,!a.fields)throw new n(`parquet:unsupported`,`Fields must be defined`);let o;if(a.spatialReference&&a.geometryType){if(!a.spatialReference)throw new n(`parquet:unsupported`,`SpatialReference must be defined`);if(!a.spatialReference.isGeographic&&!a.spatialReference.isWebMercator)throw new n(`parquet:unsupported-projection`,`Only WGS84 and Web Mercator are supported`);a.spatialReference.isGeographic&&!a.spatialReference.isWGS84&&(i.getLogger(`parquet:unsupported-projection`).warn(`Found a geographic projection that is not WGS84. Handling as WGS84.`,{spatialReference:a.spatialReference}),a.spatialReference=d.WGS84),o={geometry:a.geometryEncoding?{geometryType:L(a.geometryType),spatialReference:a.spatialReference.toJSON(),encoding:a.geometryEncoding.toJSON()}:null,displayOptimization:a.displayOptimization}}this.setCustomParameters(e.customParameters),this._displayOptimization=a.displayOptimization,await this._provider.updateGeometryInfo(o),this._capabilities=$(await this._getFileStatistics(),this._hasZ,this._hasM);let s=await this._provider.getFiles();if(!s.length)return{layerDefinition:{},capabilities:$(null,this._hasZ,this._hasM)};let c=await s[0].file;a.file=c;let{fields:l}=a;if(l==null)throw new n(`parquet-layer:missing-metadata`,`Unable to create parquet source: cannot infer fields`,l);l.push(new j({name:K,type:`oid`,alias:K}));for(let e of l){let t=c.getColumnId(e.name);t!=null&&(this._indexMap[e.name]=t)}let u=M.fromLayerJSON({fields:l.map(e=>e.toJSON()),dateFieldsTimeReference:{timeZoneIANA:`UTC`}});this._fieldsIndex=u;let f=L(a.geometryType??`point`);return this._metadata=U.createFeature({fieldsIndex:u.toJSON(),geometryType:f,hasZ:this._hasZ,hasM:this._hasM,featureIdInfo:{type:`object-id`,fieldName:K},subtypes:null,subtypeField:null,types:null,typeIdField:null,globalIdField:null,spatialReference:a.spatialReference,outSpatialReference:null,attributeSpatialReference:null,timeInfo:null,timeReferenceUnknownClient:null,dateFieldsTimeZone:z}),this._queryEngineParams={fieldsIndex:this._metadata.fieldsIndex,geometryType:f,featureIdInfo:{type:`object-id`,fieldName:K},hasM:this._hasM,hasZ:this._hasZ,spatialReference:a.spatialReference?.toJSON()??{wkid:4326},aggregateAdapter:null,timeInfo:null,definitionExpression:null},this._fullExtent=r?.extent?r.extent:await this._tryDeriveParquetFullExtent(a),{capabilities:this._capabilities,layerDefinition:{fields:a.fields?.map(e=>e.toJSON()),drawingInfo:oe(f),extent:this._fullExtent??void 0,geometryType:f,hasZ:this._hasZ,hasM:this._hasM,geometryEncoding:a.geometryEncoding?.toJSON(),displayOptimization:a.displayOptimization}}}destroy(){this._provider.destroy(),this._queue.destroy();for(let{handle:e}of this._streams.values())e.remove();this._streams.clear(),this._indexMap={},this._handles.removeAll()}async reload(e){this.destroy(),await this.load(e)}set remoteClient(e){this._source=e.createInvokeProxy(``)}setCustomParameters(e){this._customParameters=e}getIndexMap(){return this._indexMap}async updateFileProvider(e){this._loadParameters={...this._loadParameters,provider:e};let t=O(e,this._provider.getGeometryInfo(),()=>this._customParameters);await this._updateProvider(t)}async getDiagnosticsSnapshot(){let e=await this._provider.getFiles();return{files:await Promise.all(e.map(e=>e.getDiagnosticsSnapshot()))}}async getColumnIndex(e){return(await this._getFileInfoById(e.fileId)).getColumnIndex(e.rowGroupIndex,e.columnIndex)}async getOffsetIndex(e){return(await this._getFileInfoById(e.fileId)).getOffsetIndex(e.rowGroupIndex,e.columnIndex)}async queryFeatures(e,t){let n=await D(e,null,this._queryEngineParams.spatialReference);return this._validateQuery(n),Te(n)||(n.resultRecordCount=n.resultRecordCount?Math.min(n.resultRecordCount,q):q,n.resultOffset=n.resultOffset??0),n.outStatistics?this._queryStatistics(n,t):(n.returnDistinctValues&&(n.returnGeometry=void 0),(await this._enqueueQuery(n,t)).createQueryResponse())}async queryFeatureCount(e,t){let n=await D(e,null,this._queryEngineParams.spatialReference);return this._validateQuery(n),!J(n)&&!n.returnDistinctValues&&!n.groupByFieldsForStatistics?.length&&!n.outStatistics?.length?this._getFeatureCount():(n.returnDistinctValues||(n.outFields=void 0),n.returnGeometry=void 0,(await this._enqueueQuery(n,t)).createQueryResponseForCount())}async queryObjectIds(e,t){let n=await D(e,null,this._queryEngineParams.spatialReference);return this._validateQuery(n),J(n)?(n.resultRecordCount=n.resultRecordCount?Math.min(n.resultRecordCount,8e3):8e3,n.resultOffset=n.resultOffset??0,n.returnGeometry=void 0,n.outFields=void 0,n.returnDistinctValues=void 0,(await this._enqueueQuery(n,t)).items.map(e=>e.getObjectId())):Array.from({length:await this._getFeatureCount()},(e,t)=>t)}async queryAttributeBins(e,t={}){throw new n(`parquet:unsupported`,`queryAttributeBins not supported.`)}async queryExtent(e,t){let n=await D(e,null,this._queryEngineParams.spatialReference);this._validateQuery(n);let r=n.outSR??this._queryEngineParams.spatialReference;if(this._fullExtent&&!J(n)){let e=this._fullExtent;return await u(e.spatialReference,n.outSR),{count:await this._getFeatureCount(),extent:n.outSR?ie(e,n.outSR):e}}n.returnGeometry=!0,n.outFields=void 0;let i=f(p(),g),a=p(),o=await this._enqueueQuery(n,t),s=0;for(let e of o.items)e.getBounds(a)&&(m(i,a),s+=1);let c=ae(i,r,r,r,!1);return{count:s,extent:c}}async queryStream(e,t){if(!t.signal)throw Error(`InternalError: AbortSignal must be passed`);let n=await this._getCandidateFiles(e),r=new le(n,async(t,n)=>{let r=await t.file,i=await this._createParquetDisplayQuery(r,t.id,e);return r.executeQuery(i,q,n)}),i=this._streamIdCounter++,o=a(t.signal,e=>{let t=this._streams.get(i);t!=null&&(t.handle.remove(),this._streams.delete(i))});return this._streams.set(i,{stream:r,handle:o}),i}async getStreamNext(e,t){if(!t.signal)throw Error(`InternalError: AbortSignal must be passed`);let n=this._streams.get(e);if(!n)return{result:null};let r=await n.stream.next(t.signal);if(r==null)return n.handle.remove(),this._streams.delete(e),{result:null};let i=r.chunk.serialize().buffer,a={fileId:r.fileId,buffer:i};return i instanceof ArrayBuffer?{result:a,transferList:[i]}:{result:a}}async getStreamNextFeatures(e,t){let{result:n}=await this.getStreamNext(e,t);if(n==null)return null;let r=(await R()).ParquetChunk.deserialize(new Uint8Array(n.buffer)),i=new W(this._metadata,this._indexMap,r,n.fileId),a=[];for(;i.next();){let e=S(i.readGeometryWorldSpace(),i.geometryType,i.hasZ,i.hasM),t=i.readAttributes();a.push({attributes:t,geometry:e})}return{features:a}}async createPatch(e,t,n,r,i){if(!i.signal)throw Error(`InternalError: AbortSignal must be passed`);return(await(await(await this._getFileInfoById(e)).file).createChunkPatch(t,n,r,i.signal)).serialize().buffer}async _updateProvider(e){let t=this._provider;this._handles.removeAll(),this._provider=e,this._handles.add([e.events.on(`rangeRead`,e=>{this._source.onRangeRead(e)}),e.events.on(`sourceChanged`,async()=>{await this.reload(this._loadParameters),await this._source.onSourceChange()})]),await t?.destroy()}async _getCandidateFiles(e){let t=await this._provider.getFiles(),n=await this._getSpatialFilePruning(e);if(n==null)return t;let r=t.filter(e=>this._mayIncludeFileForSpatialPruning(e,n));return n.type===`xz`?we(r,n):r}async _queryStatistics(e,t){let n=await D({...e},null,this._queryEngineParams.spatialReference);if(n.returnGeometry=void 0,ve(n,this._fieldsIndex)){let e=await this._getStatisticsFromFiles(n);if(e)return e}return(await this._enqueueQuery(n,t)).createQueryResponse()}async _getStatisticsFromFiles(e){let t=await this._provider.getFiles(),n={},r=[];for(let i of e.outStatistics??[]){let e=xe(i,t);if(!e.available)return null;n[i.outStatisticFieldName]=e.value,r.push(be(i,this._fieldsIndex))}return{fields:r,features:[{attributes:n}]}}async _getSpatialFilePruning(e){if(e.type!==`tile`&&(e.type!==`arcade`||e.extent==null))return null;let t=this._displayOptimization?.index;if(t==null)return null;let n=e.outSpatialReference.wkid;if(t.wkid==null||n==null)return null;let r=t.wkid,i=await R();switch(t.type){case`xz`:return{type:`xz`,fieldName:x(t.code),intersects:(a,o)=>i.queryIntersectsXZStatistics(t.fullExtent,e.extent,n,r,t.maxLevel,a,o)};case`z`:return{type:`xy`,xFieldName:x(t.xColumn),yFieldName:x(t.yColumn),intersects:(t,a,o,s)=>i.queryIntersectsXYStatistics(e.extent,n,r,t,a,o,s)}}}_mayIncludeFileForSpatialPruning(e,t){switch(t.type){case`xz`:{let n=Z(e,t);return n?.type===`null-only`?!1:n?.type!==`bounds`||t.intersects(n.minValue,n.maxValue)}case`xy`:{let n=e.statistics.statistics.get(t.xFieldName),r=e.statistics.statistics.get(t.yFieldName);return n?.type===`null-only`||r?.type===`null-only`?!1:n?.type!==`bounds`||r?.type!==`bounds`||t.intersects(n.minValue,n.maxValue,r.minValue,r.maxValue)}}}async _tryDeriveParquetFullExtent(n){if(!n.spatialReference)return null;if(this._fullExtent==null&&n.geometryEncoding?.type===`location`){let r=await this._provider.getFiles(),{xField:i,yField:a}=n.geometryEncoding,o=f(p(),g),s=!1;for(let n of r){let r=await n.file;for(let n of r.rowGroups()){let r={stack:[],error:void 0,hasError:!1};try{let t=e(r,n.columnDescriptorForAttribute(i),!1),c=e(r,n.columnDescriptorForAttribute(a),!1),l=k(t),u=k(c);if(l?.type===`bounds`&&u?.type===`bounds`){let e=[l.minValue,u.minValue,l.maxValue,u.maxValue];h(o,e),s=!0}n.free()}catch(e){r.error=e,r.hasError=!0}finally{t(r)}}}return s?{xmin:o[0],ymin:o[1],xmax:o[3],ymax:o[4],spatialReference:n.spatialReference?.toJSON()}:null}return null}async _getFileInfoById(e){let t=await this._provider.getFiles();for(let n of t)if(n.id===e)return n;throw Error(`InternalError: File ${e} does not exist`)}async _getFileStatistics(){return{featureCount:await this._getFeatureCount(),byteLength:await this._getByteLength()}}async _getFile(e){return(await this._getFileInfoById(e)).file}async _createParquetQuery(e,t,n,r,i){let a=(await R()).Query.new();n!=null&&a.setPreFilterStart(n),r!=null&&a.setPreFilterCount(r),i!=null&&a.setPostFilterCount(i);let o=await this._getRequiredFields(e);a.setOutFields(o),(e.geometry||e.returnGeometry)&&a.setReturnGeometry(!0),a.setReturnZ(!!e.returnZ),a.setReturnM(!!e.returnM);let s=this._tryGetGeneralizedGeometryResolution(e);s!=null&&a.setSourceResolution(s);let c=e.geometry?.spatialReference??this._queryEngineParams.spatialReference,l=c.wkid;if(e.geometry&&(y(c)||b(c))){let t=_(v(),te);for(let n of C(e.geometry))ee(t,n);a.setOutSpatialReference(l),a.setExtent({xmin:t[0],ymin:t[1],xmax:t[2],ymax:t[3]})}if(e.where){let{id:n,file:r}=t;await this._setWhereClause(a,await r,n,e.where)}return a}async _createParquetDisplayQuery(e,t,n){let r=(await R()).Query.new();if(n.type===`tile`){r.setExtent(n.extent),r.setQuantizationTransform(n.transform);let e=this._sourceResolution(n.resolution,n.outSpatialReference);e!=null&&r.setSourceResolution(e)}else n.type===`arcade`&&n.extent!=null&&r.setExtent(n.extent);return r.setOutFields(n.outFields.filter(e=>this._indexMap[e]!=null)),r.setOutSpatialReference(n.outSpatialReference.wkid),r.setReturnGeometry(n.returnGeometry),r.setReturnZ(n.returnZ),r.setReturnM(n.returnM),n.where&&await this._setWhereClause(r,e,t,n.where),r}async _getFeatureCount(){return(await this._provider.getFiles()).map(e=>e.statistics.rowCount).reduce((e,t)=>e+t,0)}async _getByteLength(){return(await this._provider.getFiles()).map(e=>e.statistics.byteSize).reduce((e,t)=>e+t,0)}_validateQuery(e){if(!this._capabilities.query.supportsStatistics&&e.outStatistics)throw new n(`parquet:unsupported`,`Statistics queries are not supported`,{query:e});if(!this._capabilities.query.supportsOrderBy&&e.orderByFields?.length)throw new n(`parquet:unsupported`,`Queries using orderBy are not supported`,{query:e});if(!this._capabilities.query.supportsDistinct&&e.returnDistinctValues)throw new n(`parquet:unsupported`,`Queries using returnDistinctValues are not supported`,{query:e})}async _setWhereClause(e,t,r,i){let a=this._indexMap,o=this._fieldsIndex,s={getAttribute(e,n){let i=a[n];if(i==null){if(o.get(n)?.name===`__OBJECTID`){let t=e.row+e.rowGroupStart;return A(r,t)}return null}let s=o.get(n);return ne(t,e.rowGroup,e.row,i,s.type)}},l=await c(i,this._fieldsIndex);if(!l.isStandardized)throw new n(`sql-parse-error`,`expression is not standardized`);let u=(e,t,n)=>l.testFeatureCompiled({rowGroup:e,row:t,rowGroupStart:n},s,null),d=l.fieldNames.map(e=>o.get(e)).filter(e=>e&&this._indexMap[e?.name]!=null);e.setWhere(i),e.setWhereEvaluator(u),e.setWhereFields(d.map(e=>e.name))}async*_streamFeatures(e,t,n,r,i){let a=await this._provider.getFiles(),o=0;for(let s of a){let a=o,c=o+s.statistics.rowCount;if(o+=s.statistics.rowCount,t!=null&&t>=c)continue;let l=t==null?null:Math.max(t-a,0),u=n;if(n!=null){let e=t??0,r=e+n;u=Math.max(Math.min(r,c)-Math.max(e,a),0)}if(u===0)continue;let d=await this._createParquetQuery(e,s,l,u,r),f=await(await s.file).executeQuery(d,q),p=async()=>{let e=await f.next(i);if(!e)return null;let t=new W(this._metadata,this._indexMap,e,s.id);return X([new V(t,null,0,!1)],this._queryEngineParams)},m=await p();for(;m!=null;)yield m,m=await p()}}async _queryFeaturesWithQueryEnginePagination(e,t){let n=[],r=this._streamFeatures(e,null,null,null,t),i=await r.next();for(;!i.done;){let a=await i.value.executeQueryForOpaqueFeatures({...e,where:void 0},t);for(let e of a)n.push(e);i=await r.next()}return n}async _queryFeaturesWithUpfrontPagination(e,t){let n=e.resultOffset??0,r=e.resultRecordCount??q,i,a,o;ge(e)?_e(e)||(o=n+r):(n&&=(i=n,0),a=e.resultRecordCount);let s=[],c=this._streamFeatures(e,i,a,o,t),l=await c.next();for(;!l.done&&r>0;){let i=await l.value.executeQueryForOpaqueFeatures({...e,where:void 0},t);for(let e of i){if(n>0){n--;continue}if(s.push(e),--r<=0)return s}l=await c.next()}return s}_enqueueQuery(e,t){return this._queue.push(e,t)}async _executeQuery(e,t){if(e.objectIds?.length){let n=new Map;for(let t of e.objectIds){let e=se(t),r=ce(t),i=n.get(e);i||(i=[],n.set(e,i)),i.push(r)}let r=[];for(let[i,a]of n.entries()){let n=await this._executeFileIdQuery(e,i,a,t);for(let e of n)r.push(e)}return new E(r,e,{fieldsIndex:this._fieldsIndex,geometryType:this._metadata.geometryType,spatialReference:this._queryEngineParams.spatialReference,hasM:this._hasM,hasZ:this._hasZ,featureAdapter:G,featureIdInfo:this._queryEngineParams.featureIdInfo})}if(e.where===`1=1`&&(e.where=null),e.resultOffset??=0,e.resultRecordCount??=await this._getFeatureCount(),e.resultRecordCount>2e7&&!(this._displayOptimization&&e.geometry))throw new n(`parquet:cannot-execute-query`,`Unable to execute query, dataset is too large.`);let r=!!e.orderByFields?.length||!!e.outStatistics?.length||!!e.returnDistinctValues,i=r?await this._queryFeaturesWithQueryEnginePagination(e,t):await this._queryFeaturesWithUpfrontPagination(e,t);return r||(e.resultOffset=0),new E(i,e,{fieldsIndex:this._fieldsIndex,geometryType:this._metadata.geometryType,spatialReference:this._queryEngineParams.spatialReference,hasM:this._hasM,hasZ:this._hasZ,featureAdapter:G,featureIdInfo:this._queryEngineParams.featureIdInfo})}async _executeFileIdQuery(e,t,n,r){let i=new Set(await this._getRequiredFields(e));if(e.where){let t=await c(e.where,this._fieldsIndex);for(let e of t.fieldNames){let t=this._fieldsIndex.get(e);t&&this._indexMap[t.name]!=null&&i.add(t.name)}}let a=(await R()).Query.new();a.setOutFields(Array.from(i)),a.setReturnGeometry(!!e.returnGeometry),a.setReturnZ(!!e.returnZ),a.setReturnM(!!e.returnM),a.setIds(new Uint32Array(n));let o=await(await this._getFile(t)).executeQuery(a,q,r),s=await o.next(r),l=0,u=[];for(;s!=null;){let e=new W(this._metadata,this._indexMap,s,t),n=new V(e,null,l++,!1);u.push(n),s=await o.next(r)}return X(u,this._queryEngineParams).executeQueryForOpaqueFeatures(e,r)}async _getRequiredFields(e){let t=new Set;if(e.outStatistics)for(let n of re(this._fieldsIndex,e.outStatistics,e.groupByFieldsForStatistics))t.add(n);else if(e.outFields)for(let n of e.outFields)t.add(n);return(t.has(`*`)?this._fieldsIndex.fields.map(e=>e.name):Array.from(t)).filter(e=>this._indexMap[e]!=null)}_tryGetGeneralizedGeometryResolution(e){if(!this._displayOptimization)return null;let t=e.outSR??this._queryEngineParams.spatialReference;if(!y(t)&&!b(t))return null;let n=e.quantizationParameters?.tolerance??e.maxAllowableOffset;return n?this._sourceResolution(n,t):null}_sourceResolution(e,t){let n=this._queryEngineParams.spatialReference,r=l(t)/l(n)*e;return!Number.isFinite(r)||r<=0?null:r}}function pe(e){switch(e){case`fullText`:case`having`:case`timeExtent`:case`historicMoment`:case`aggregateIds`:case`uniqueIds`:case`gdbVersion`:case`objectIds`:case`where`:case`geometry`:case`resultOffset`:case`resultRecordCount`:return!0;default:return!1}}function me(e){switch(e){case`fullText`:case`having`:case`timeExtent`:case`historicMoment`:case`aggregateIds`:case`uniqueIds`:case`gdbVersion`:case`objectIds`:case`where`:case`geometry`:return!0;default:return!1}}function he(e){switch(e){case`fullText`:case`having`:case`timeExtent`:return!0;case`historicMoment`:case`aggregateIds`:case`uniqueIds`:case`gdbVersion`:return!1;case`objectIds`:case`where`:case`resultOffset`:case`geometry`:case`resultRecordCount`:return!1}return!1}function J(e){for(let t in e){let n=t;if(pe(n)&&e[n]!==null)return!0}return!1}function ge(e){for(let t in e){let n=t;if(me(n)&&e[n]!==null)return!0}return!1}function _e(e){for(let t in e){let n=t;if(he(n)&&e[n]!==null)return!0}return!1}function ve(e,t){return!!e.outStatistics?.length&&!J(e)&&!e.groupByFieldsForStatistics?.length&&!e.orderByFields?.length&&!e.returnDistinctValues&&!e.returnAggIds&&e.outStatistics.every(e=>ye(e,t))}function ye(e,t){switch(e.statisticType){case`count`:return e.onStatisticField===`1`||t.get(e.onStatisticField)!=null;case`min`:case`max`:{let n=t.get(e.onStatisticField);return n!=null&&N(n)}default:return!1}}function be(e,t){let n=e.statisticType===`exceedslimit`?null:t.get(e.onStatisticField),r=(e.statisticType===`min`||e.statisticType===`max`)&&n?.type===`esriFieldTypeDate`?n.type:`esriFieldTypeDouble`;return{name:e.outStatisticFieldName,alias:e.outStatisticFieldName,type:r}}function xe(e,t){switch(e.statisticType){case`count`:return Se(e,t);case`min`:return Y(e,t,Math.min);case`max`:return Y(e,t,Math.max);default:return{available:!1,value:null}}}function Se(e,t){if(e.statisticType!==`count`)return{available:!1,value:null};if(e.onStatisticField===`1`)return{available:!0,value:t.reduce((e,t)=>e+t.statistics.rowCount,0)};let n=0;for(let r of t){let t=r.statistics.statistics.get(e.onStatisticField);if(t==null||t.nullCount==null)return{available:!1,value:null};n+=r.statistics.rowCount-t.nullCount}return{available:!0,value:n}}function Y(e,t,n){if(e.statisticType!==`min`&&e.statisticType!==`max`)return{available:!1,value:null};let r=null,i=e.statisticType===`min`?`minValue`:`maxValue`;for(let a of t){let t=a.statistics.statistics.get(e.onStatisticField);if(t==null)return{available:!1,value:null};switch(t.type){case`null-only`:continue;case`unknown`:return{available:!1,value:null};case`bounds`:{let e=Ce(t[i]);if(e==null)return{available:!1,value:null};r=r==null?e:n(r,e);break}}}return{available:!0,value:r}}function Ce(e){return typeof e==`number`&&Number.isFinite(e)?e:null}function X(e,t){let n=new H;for(let t of e)n.insert(t);return new w({...t,featureStore:n})}function Z(e,t){return e.statistics.statistics.get(t.fieldName)??null}function we(e,t){return e.slice().sort((e,n)=>{let r=Q(e,t),i=Q(n,t);return r===i?0:r<i?-1:1})}function Q(e,t){let n=Z(e,t);return n?.type===`bounds`?n.maxValue-n.minValue:1/0}function $(e,t,n){let r=e?.featureCount,i=!1;return r!=null&&r<has(`parquetlayer-full-query-feature-count`)&&(i=!0),{analytics:{supportsCacheHint:!1},attachment:null,data:{isVersioned:!1,isBranchVersioned:!1,supportedCurveTypes:[],supportsAttachment:!1,supportsM:n,supportsTrueCurve:!1,supportsZ:t},metadata:{supportsAdvancedFieldProperties:!1},operations:{supportsCalculate:!1,supportsTruncate:!1,supportsValidateSql:!1,supportsAdd:!1,supportsDelete:!1,supportsEditing:!1,supportsChangeTracking:!1,supportsQuery:!0,supportsQueryBins:!1,supportsQueryPivot:!1,supportsQueryAnalytics:!1,supportsQueryAttachments:!1,supportsQueryTopFeatures:!1,supportsResizeAttachments:!1,supportsSync:!1,supportsUpdate:!1,supportsExceedsLimitStatistics:!1,supportsAsyncConvert3D:!1},query:{...T,maxRecordCount:q,supportsOrderBy:i,supportsDistinct:!0,supportsStatistics:!0,supportsSpatialAggregationStatistics:!1,supportedSpatialAggregationStatistics:{envelope:!1,centroid:!1,convexHull:!1}},queryAttributeBins:{supportsDate:!1,supportsFixedInterval:!1,supportsAutoInterval:!1,supportsFixedBoundaries:!1,supportsStackBy:!1,supportsSplitBy:!1,supportsSnapToData:!1,supportsReturnFullIntervalBin:!1,supportsFirstDayOfWeek:!1,supportsNormalization:!1},queryRelated:{supportsCount:!1,supportsOrderBy:!1,supportsPagination:!1,supportsCacheHint:!1},queryTopFeatures:{supportsCacheHint:!1},editing:{supportsDeleteByAnonymous:!1,supportsDeleteByOthers:!1,supportsGeometryUpdate:!1,supportsGlobalId:!1,supportsTrueCurveUpdate:!1,supportsTrueCurveUpdateByTrueCurveClientsOnly:!0,supportsReturnServiceEditsInSourceSpatialReference:!1,supportsRollbackOnFailure:!1,supportsUpdateByAnonymous:!1,supportsUpdateByOthers:!1,supportsUploadWithItemId:!1,supportsUpdateWithoutM:!1,supportsAsyncApplyEdits:!1,zDefault:void 0}}}function Te(e){return!!e.objectIds?.length||!!e.outStatistics||!!e.orderByFields?.length||!!e.returnDistinctValues}export{fe as default};
@@ -18,7 +18,7 @@ export abstract class APIKeyMixin {
18
18
  *
19
19
  * @since 4.20
20
20
  * @see [Item access privileges](https://developers.arcgis.com/documentation/security-and-authentication/api-key-authentication/api-key-credentials/#item-access-privileges)
21
- * @see [API key guide](https://developers.arcgis.com/javascript/latest/secure-resources/#api-keys)
21
+ * @see [Authentication and access tokens](https://developers.arcgis.com/javascript/latest/authentication/access-tokens/#api-keys)
22
22
  * @example
23
23
  * // set the api key to access a protected service
24
24
  * const layer = new FeatureLayer({
@@ -87,7 +87,7 @@ export interface QueryParameters {
87
87
  *
88
88
  * @since 5.0
89
89
  * @see [Item access privileges](https://developers.arcgis.com/documentation/security-and-authentication/api-key-authentication/api-key-credentials/#item-access-privileges)
90
- * @see [API key guide](https://developers.arcgis.com/javascript/latest/secure-resources/#api-keys)
90
+ * @see [Authentication and access tokens](https://developers.arcgis.com/javascript/latest/authentication/access-tokens/#api-keys)
91
91
  * @example
92
92
  * // set the api key to access a protected service
93
93
  * const layer = new FeatureLayer({
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{isSome as e}from"../../../core/arrayUtils.js";import t from"../../../core/Error.js";import{getMetersPerUnitForSR as n}from"../../../core/units.js";import r from"../../../geometry/Extent.js";import{P as i,a,b as o,c as s,d as c}from"../../../chunks/pe.js";import l from"../../../geometry/Point.js";import u from"../../../geometry/Polygon.js";import{projectWithoutEngine as d}from"../../../geometry/projectionUtils.js";import f from"../../../geometry/SpatialReference.js";import{getInfo as p}from"../../../geometry/support/spatialReferenceUtils.js";function m(){if(!S)throw new t(`rasterprojectionhelper-project`,`projection operator is not loaded`)}const h=(e,t,n,r=0)=>{if(n[0]===1)return[0,0];let i=1,a=-1,o=1,s=-1;for(let t=0;t<e.length;t+=2)isNaN(e[t])||(i=i>e[t]?e[t]:i,a=a>e[t]?a:e[t],o=o>e[t+1]?e[t+1]:o,s=s>e[t+1]?s:e[t+1]);let{cols:c,rows:l}=t,u=(a-i)/c/n[0],d=(s-o)/l/n[1],f=r*2,p=0,m=!1,h=[0,0];for(let t=0;t<c-3;t++){for(let n=0;n<l-3;n++){let r=t*l*2+n*2,i=(e[r]+e[r+4]+e[r+l*4]+e[r+l*4+4])/4,a=(e[r+1]+e[r+5]+e[r+l*4+1]+e[r+l*4+5])/4,o=Math.abs((i-e[r+l*2+2])/u),s=Math.abs((a-e[r+l*2+3])/d);if(o+s>p&&(p=o+s,h=[o,s]),f&&p>f){m=!0;break}}if(m)break}return h},g={3395:20037508.342789244,3410:17334193.943686873,3857:20037508.342788905,3975:17367530.445161372,4087:20037508.342789244,4088:20015108.787169147,6933:17367530.445161372,32662:20037508.342789244,53001:20015086.79602057,53002:10007543.39801029,53003:20015086.79602057,53004:20015086.79602057,53016:14152803.599503474,53017:17333573.624304302,53034:20015086.79602057,53079:20015114.352186374,53080:20015114.352186374,54001:20037508.342789244,54002:10018754.171394624,54003:20037508.342789244,54004:20037508.342789244,54016:14168658.027268292,54017:17367530.44516137,54034:20037508.342789244,54079:20037508.342789244,54080:20037508.342789244,54100:20037508.342789244,54101:20037508.342789244},_=32,v=4,y=4,b=new Map,x=new Map;let S=!1,C,w,T;async function E(){return C||(C=Promise.withResolvers(),w=await import(`../../../geometry/operators/projectOperator.js`),T=await import(`../../../geometry/operators/support/geographicTransformationUtils.js`),w.projectIsLoaded()||await w.projectLoad(),T.isLoaded()||await T.load(),S=!0,C.resolve()),C.promise}function D(e,t,n){if(m(),n){let n=w.projectExecute(e,t);return T.getTransformation(t,e.spatialReference,n)}return T.getTransformation(e.spatialReference,t,e)}function O(e,t,n,i){let a=e.spatialReference;if(!a||!t||a.equals(t))return e;m();let o=n.center,s=new r({xmin:o.x-e.x/2,xmax:o.x+e.x/2,ymin:o.y-e.y/2,ymax:o.y+e.y/2,spatialReference:a}),c=w.projectExecute(s,t,{geographicTransformation:i}),l=W(t);return c==null||l!=null&&c.width>=l?k(e,a,t):{x:c.width,y:c.height}}function k(e,t,r){let i=n(t)/n(r);return{x:e.x*i,y:e.y*i}}function A(e,r,i){let{spatialReference:a}=i;if(!a||!r||a.equals(r))return e;if(a.isGeographic&&r.isGeographic)return k(e,a,r);if(m(),!S)throw new t(`raster-projection-helper:project-dataset-resolution`,`geometry engine is not loaded`);let{x:o,y:s}=e,c=n(a),l=(o+s)/2*c,d=1;l>30&&(d=30/l,o*=d,s*=d);let f=o*256/2,p=s*256/2,{x:h,y:g}=i.center,_=[];for(let e=0;e<=256;e++)_.push([h-f,g-p+e*s]);for(let e=1;e<=256;e++)_.push([h-f+e*o,g+p]);for(let e=1;e<=256;e++)_.push([h+f,g+p-e*s]);for(let e=1;e<256;e++)_.push([h+f-e*o,g-p]);_.push(_[0]);let v=new u({rings:[_],spatialReference:a}),y=w.projectExecute(v,r);if(!y)return k(e,a,r);let b=y.extent,x=W(r);if(b==null||x!=null&&b.width>=x)return k(e,a,r);let C=$(y.rings),T=o*s*256*256,E=Math.sqrt(C/T)/d,D={x:b.width/d/256,y:b.height/d/256},O={x:o*E,y:s*E},A=D.x*D.y;return Math.abs(A-O.x*O.y)/A<.1?D:O}function j(e,t){return(typeof e==`number`?e:(e.x+e.y)/2)*n(t)*96*39.37}function M(e,t){let{pixelSize:n,extent:r}=e;return j(A(n,t,r),t)}function N(e,t=.01){return n(e)?t/n(e):0}function P(e,t,n,r=!0){let i=e.spatialReference;if(i.equals(t))return e;m();let a=w.projectExecute(e,t,{geographicTransformation:n});return!r||!a||F([e],[a],i,t),a}function F(e,t,n,r){let i=G(n,!0),a=G(r,!0),o=N(n,500),s=N(r,500);if(o&&i!=null&&a!=null)for(let n=0;n<e.length;n++){let r=t[n];if(!r)continue;let{x:c}=e[n],{x:l}=r;l>=a[1]-s&&Math.abs(c-i[0])<o?r.x-=a[1]-a[0]:l<=a[0]+s&&Math.abs(c-i[1])<o&&(r.x+=a[1]-a[0])}}function I(e){let{inSR:t,outSR:n,preferPE:r}=e;if(t.equals(n)){let{points:t}=B(e,null);return t}return t.isWebMercator&&n.isWGS84||t.isWGS84&&n.isWebMercator?te(e):r&&(t.isGeographic||R(t)!=null)?ee(e):L(e)}function L(e){let{points:t}=B(e,null),{inSR:n,outSR:r,datumTransformation:i}=e,a=t.map(e=>new l(e[0],e[1],n)),o=w.projectExecuteMany(a,r,{geographicTransformation:i});return i&&F(a,o,n,r),o.map(e=>e?[e.x,e.y]:[NaN,NaN])}function ee(e){let{inSR:t,outSR:n,datumTransformation:r}=e,{points:o,mask:l}=B(e,R(t));if(!t.isGeographic){let e=t.wkid?i.coordsys(t.wkid):i.fromString(t.isGeographic?a.PE_TYPE_GEOGCS:a.PE_TYPE_PROJCS,t.wkt2||t.wkt);s.projToGeog(e,o.length,o)}if(r!=null&&r.steps.length){let e,t=179.9955;if(n.isGeographic&&(e=o.map(([e])=>e>t?1:e<-179.9955?-1:0)),r.steps.forEach(e=>{let t=e.wkid?i.geogtran(e.wkid):i.fromString(a.PE_TYPE_GEOGTRAN,e.wkt);c.geogToGeog(t,o.length,o,null,e.isInverse?a.PE_TRANSFORM_2_TO_1:a.PE_TRANSFORM_1_TO_2)}),e)for(let n=0;n<o.length;n++){let r=e[n],i=o[n][0],a=i>t?1:i<-179.9955?-1:0;r&&a&&r!==a&&(o[n][0]=r>0?i+360:i-360)}}if(!n.isGeographic){let e=R(n,!0);ne(o,e!=null&&e.isEnvelope?[e.bbox[1],e.bbox[3]]:[-90,90]);let t=n.wkid?i.coordsys(n.wkid):i.fromString(n.isGeographic?a.PE_TYPE_GEOGCS:a.PE_TYPE_PROJCS,n.wkt2||n.wkt);s.geogToProj(t,o.length,o)}let u=o;if(l&&o.length!==l.length){u=[];for(let e=0,t=0;e<l.length;e++)l[e]?u.push(o[t++]):u.push([NaN,NaN])}return u}function te(e){let{cols:t,rows:n,xres:r,yres:i,usePixelCenter:a,inSR:o,outSR:s}=e,{xmin:c,ymax:u}=e;a&&(c+=r/2,u-=i/2);let f=[],p=[],m=Math.max(t,n);for(let e=0;e<m;e++){let a=c+r*Math.min(t,e),m=u-i*Math.min(n,e),h=d(new l({x:a,y:m,spatialReference:o}),o,s);e<=t&&f.push(h.x),e<=n&&p.push(h.y)}let h=[];for(let e=0;e<t;e++)for(let t=0;t<n;t++)h.push([f[e],p[t]]);return h}function R(e,t=!1){let n=e.wkid||e.wkt2||e.wkt;if(!n||e.isGeographic)return null;if(n=String(n),b.has(n)){let e=b.get(n);return t?e?.gcs:e?.pcs}let r=e.wkid?i.coordsys(e.wkid):i.fromString(e.isGeographic?a.PE_TYPE_GEOGCS:a.PE_TYPE_PROJCS,e.wkt2||e.wkt),o=z(r,N(e,1e-4)),s=z(r,0,!0);return b.set(n,{pcs:o,gcs:s}),t?s:o}function z(e,t=0,n=!1){let r=o.generate(e),i=n?e.horizonGcsGenerate():e.horizonPcsGenerate();if(!r||!i?.length)return null;let a=!1,s=i.find(e=>e.getInclusive()===1&&e.getKind()===1);if(!s){if(s=i.find(e=>e.getInclusive()===1&&e.getKind()===0),!s)return null;a=!0}let c=n?0:+(r.getNorthPoleLocation()===2)|(r.getSouthPoleLocation()===2?2:0),l=r.isPannableRectangle(),u=s.getCoord();if(a)return{isEnvelope:a,isPannable:l,vertices:u,coef:null,bbox:[u[0][0]-t,u[0][1]-t,u[1][0]+t,u[1][1]+t],poleLocation:c};let d=0,f=[],[p,m]=u[0],[h,g]=u[0];for(let e=0,t=u.length;e<t;e++){d++,d===t&&(d=0);let[n,r]=u[e],[i,a]=u[d];if(a===r)f.push([n,i,r,a,2]);else{let e=(i-n)/(a-r||1e-4),t=n-e*r;r<a?f.push([e,t,r,a,0]):f.push([e,t,a,r,1])}p=p<n?p:n,m=m<r?m:r,h=h>n?h:n,g=g>r?g:r}return{isEnvelope:!1,isPannable:l,vertices:u,coef:f,bbox:[p,m,h,g],poleLocation:c}}function B(e,t){let n=[],{cols:r,rows:i,xres:a,yres:o,usePixelCenter:s}=e,{xmin:c,ymax:l}=e;if(s&&(c+=a/2,l-=o/2),t==null){for(let e=0;e<r;e++)for(let t=0;t<i;t++)n.push([c+a*e,l-o*t]);return{points:n}}let u=new Uint8Array(r*i);if(t.isEnvelope){let{isPannable:e,bbox:[s,d,f,p]}=t;for(let t=0,m=0;t<r;t++){let r=c+a*t,h=e||r>=s&&r<=f;for(let e=0;e<i;e++,m++){let t=l-o*e;h&&t>=d&&t<=p&&(n.push([r,t]),u[m]=1)}}return{points:n,mask:u}}let d=t.coef,f=[];for(let e=0;e<i;e++){let t=l-o*e,n=[],r=[];for(let e=0;e<d.length;e++){let[i,a,o,s,c]=d[e];if(t===o&&o===s)n.push(i),n.push(a),r.push(2),r.push(2);else if(t>=o&&t<=s){let e=i*t+a;n.push(e),r.push(c)}}let i=n;if(n.length>2){let e=r[0]===2?0:r[0],t=n[0];i=[];for(let a=1;a<r.length;a++)(r[a]!==2||a===r.length-1)&&(r[a]!==e&&(i.push(e===0?Math.min(t,n[a-1]):Math.max(t,n[a-1])),e=r[a],t=n[a]),a===r.length-1&&i.push(r[a]===0?Math.min(t,n[a]):Math.max(t,n[a])));i.sort((e,t)=>e-t)}else n[0]>n[1]&&(i=[n[1],n[0]]);f.push(i)}for(let e=0,t=0;e<r;e++){let r=c+a*e;for(let e=0;e<i;e++,t++){let i=l-o*e,a=f[e];if(a.length===2)r>=a[0]&&r<=a[1]&&(n.push([r,i]),u[t]=1);else if(a.length>2){let e=!1;for(let t=0;t<a.length;t+=2)if(r>=a[t]&&r<=a[t+1]){e=!0;break}e&&(n.push([r,i]),u[t]=1)}}}return{points:n,mask:u}}function ne(e,t){let[n,r]=t;for(let t=0;t<e.length;t++){let i=e[t][1];(i<n||i>r)&&(e[t]=[NaN,NaN])}}function V(e,t){let n=W(e[0].spatialReference);if(e.length<2||n==null||(t??=N(e[0].spatialReference),e=e.filter(e=>e.width>t),e.length===1))return e[0];let{xmin:i,xmax:a,ymin:o,ymax:s}=e[0];for(let t=1;t<e.length;t++){let r=e[t];a=r.xmax+n*t,o=Math.min(o,r.ymin),s=Math.max(s,r.ymax)}return new r({xmin:i,xmax:a,ymin:o,ymax:s,spatialReference:e[0].spatialReference})}function H(t,n,i=null,a=!0){let o=t.spatialReference;if(o.equals(n)||!n)return t;let s=q(t),c=W(o,!0),l=W(n);if(s===0||c==null||l==null){let e=U(t,n,i,a);if(e&&c==null&&l!=null&&Math.abs(e.width-l)<N(n)&&w.projectIsLoaded()){let r=R(o);if(r!=null&&r.poleLocation===0&&t.width<(r.bbox[2]-r.bbox[0])/2)return ie(t,n)||e}return e}let u=t.clone().normalize();if(u.length===1&&t.xmax<c&&t.xmax-c/2>N(o)){let{xmin:e,xmax:n}=t;for(let i=0;i<=s;i++){let a=i===0?e:-c/2,l=i===s?n-c*i:c/2;u[i]=new r({xmin:a,xmax:l,ymin:t.ymin,ymax:t.ymax,spatialReference:o})}}let d=u.map(e=>U(e,n,i,a)).filter(e);return d.length===0?null:V(d)}function re(e,t,n){if(e.type===`extent`){let{xmin:t,ymin:n,xmax:r,ymax:i,spatialReference:a}=e;e=new u({rings:[[[t,i],[r,i],[r,n],[t,n],[t,i]]],spatialReference:a})}return e.spatialReference.equals(t)?e:(m(),w.projectExecute(e,t,{geographicTransformation:n}))}function ie(e,t){let n=W(t);if(n==null)return null;let{xmin:i,ymin:a,xmax:o,ymax:s}=e,c=e.spatialReference,l=new u({spatialReference:c,rings:[[[i,a],[o,a],[o,s],[i,s],[i,a]]]}),d=w.projectExecute(l,t);if(d.rings.length!==2||!d.rings[0].length||!d.rings[1].length)return null;let{rings:f}=d,p=N(c),m=new r({spatialReference:t});for(let e=0;e<2;e++){i=o=f[e][0][0],a=s=f[e][0][1];for(let t=0;t<f[e].length;t++)i=i>f[e][t][0]?f[e][t][0]:i,o=o<f[e][t][0]?f[e][t][0]:o,a=a>f[e][t][1]?f[e][t][1]:a,s=s<f[e][t][1]?f[e][t][1]:s;if(e===0)m.ymin=a,m.ymax=s,m.xmin=i,m.xmax=o;else if(m.ymin=Math.min(m.ymin,a),m.ymax=Math.max(m.ymax,s),Math.abs(o-n/2)<p)m.xmin=i,m.xmax+=n;else if(Math.abs(i+n/2)<p)m.xmax=o+n;else return null}return m}function U(e,t,n,r=!0,i=!0){let a=e.spatialReference;if(a.equals(t)||!t)return e;m();let o=w.projectExecute(e,t,{geographicTransformation:n});if(i&&t.isWebMercator&&o&&(o.ymax=Math.min(20037508.342787,o.ymax),o.ymin=Math.max(-20037508.342787,o.ymin),o.ymin>=o.ymax))return null;if(!r||!o)return o;let s=G(a,!0),c=G(t,!0);if(s==null||c==null)return o;let u=N(a,.001),d=N(a,500),f=N(t,.001);if(Math.abs(o.xmin-c[0])<f&&Math.abs(o.xmax-c[1])<f){let r=Math.abs(e.xmin-s[0]),i=Math.abs(s[1]-e.xmax);if(r<u&&i>d){o.xmin=c[0];let r=[];r.push(new l(e.xmax,e.ymin,a)),r.push(new l(e.xmax,(e.ymin+e.ymax)/2,a)),r.push(new l(e.xmax,e.ymax,a));let i=r.map(e=>P(e,t,n)).filter(e=>!isNaN(e?.x)).map(e=>e.x);o.xmax=Math.max.apply(null,i)}if(i<u&&r>d){o.xmax=c[1];let r=[];r.push(new l(e.xmin,e.ymin,a)),r.push(new l(e.xmin,(e.ymin+e.ymax)/2,a)),r.push(new l(e.xmin,e.ymax,a));let i=r.map(e=>P(e,t,n)).filter(e=>!isNaN(e?.x)).map(e=>e.x);o.xmin=Math.min.apply(null,i)}}else{let e=N(t,.001);Math.abs(o.xmin-c[0])<e&&(o.xmin=c[0]),Math.abs(o.xmax-c[1])<e&&(o.xmax=c[1])}return o}function W(e,t=!1){if(!e)return null;let n=t?20037508.342787:20037508.342788905;return e.isWebMercator?n*2:e.wkid&&e.isGeographic?360:g[e.wkid]*2||null}function G(e,t=!1){if(e.isGeographic)return[-180,180];let n=W(e,t);return n?[-n/2,n/2]:null}function K(e,t,n,r){let i=(e-t)/n;return i-Math.floor(i)===0?r&&--i:i=Math.floor(i),i}function q(e,t=!1){let n=W(e.spatialReference);if(n==null)return 0;let r=n/2,i=t?0:-r,a=N(e.spatialReference),o=!t&&Math.abs(e.xmax-n/2)<a?n/2:e.xmax,s=!t&&Math.abs(e.xmin+n/2)<a?-n/2:e.xmin;return K(o,i,n,!0)-K(s,i,n,!1)}function ae(e){let t=e.storageInfo.origin.x,n=W(e.spatialReference,!0);if(n==null)return{originX:t,halfWorldWidth:null,pyramidsInfo:null};let r=n/2,{nativePixelSize:i,storageInfo:a,extent:o}=e,{maximumPyramidLevel:s,blockWidth:c,pyramidScalingFactor:l}=a,u=i.x,d=[],f=e.transform!=null&&e.transform.type===`gcs-shift`,p=Math.max(0,t+(f?0:r));for(let e=0;e<=s;e++){let e=(o.xmax-t)/u/c,r=e-Math.floor(e)===0?e:Math.ceil(e),i=Math.round(p/u),a=Math.round(n/u)-i,s=Math.ceil(a/c),f=Math.floor(i/c),m=i%c,h=(c-a%c)%c;d.push({resolutionX:u,blockWidth:c,datasetColumnCount:r,worldColumnCountFromOrigin:s,leftMargin:m,rightPadding:h,originColumnOffset:f}),u*=l}return{originX:t,halfWorldWidth:r,pyramidsInfo:d,hasGCSSShiftTransform:f}}function oe(e){if(!e||e.isGeographic)return e;let t=String(e.wkid||e.wkt2||e.wkt),n;return x.has(t)?n=x.get(t):(n=(e.wkid?i.coordsys(e.wkid):i.fromString(a.PE_TYPE_PROJCS,e.wkt2||e.wkt)).getGeogcs().getCode(),x.set(t,n)),new f({wkid:n})}function se(e){let t=e.isAdaptive&&e.spacing==null,n=e.spacing||[32,32],r=J(e),i={cols:r.size[0]+1,rows:r.size[1]+1},a=r.outofBoundPointCount>0&&r.outofBoundPointCount<r.offsets.length/2,o=r.outofBoundPointCount===r.offsets.length/2||t&&a?[0,0]:h(r.offsets,i,n,4),s=(o[0]+o[1])/2,c=e.projectedExtent.spatialReference,l=e.srcBufferExtent.spatialReference;if(t&&(a||s>4)&&(c.isGeographic||R(c),n=[4,4],r=J({...e,spacing:n}),i={cols:r.size[0]+1,rows:r.size[1]+1},o=h(r.offsets,i,n,4)),r.error=o,n[0]>1&&(r.coefficients=Y(r.offsets,i,a)),e.includeGCSGrid&&!c.isGeographic&&!c.isWebMercator){if(l.isGeographic)r.gcsGrid={offsets:r.offsets,coefficients:r.coefficients,spacing:n};else{let t=R(c);if(t!=null&&!t.isEnvelope){let t=oe(c),o=H(e.projectedExtent,t),{offsets:s}=J({...e,srcBufferExtent:o,spacing:n}),l=Y(s,i,a);r.gcsGrid={offsets:s,coefficients:l,spacing:n}}}}return r}function J(e){let{projectedExtent:t,srcBufferExtent:n,pixelSize:r,datumTransformation:i,rasterTransform:a}=e,o=t.spatialReference,s=n.spatialReference;m();let{xmin:c,ymin:u,xmax:d,ymax:f}=t,p=W(s),h=p!=null&&(e.hasWrapAround||a?.type===`gcs-shift`),g=e.spacing||[32,32],_=g[0]*r.x,v=g[1]*r.y,y=g[0]===1,b=Math.ceil((d-c)/_-.1/g[0])+ +!y,x=Math.ceil((f-u)/v-.1/g[1])+ +!y,S=I({cols:b,rows:x,xmin:c,ymax:f,xres:_,yres:v,inSR:o,outSR:s,datumTransformation:i,preferPE:g[0]<=4,usePixelCenter:y}),C=[],w,T=0,E=y?-1:NaN,{xmin:D,xmax:O,ymax:k,width:A,height:j}=n,M=N(s,500),P=p!=null&&D>0&&O>p/2,F=R(o),L=F!=null&&F.poleLocation>0;for(let e=0;e<b;e++){let t=[];for(let n=0;n<x;n++){let r=S[e*x+n];if(h&&r[0]>O&&r[0]>p/2-M?r[0]-=p:h&&e===0&&r[0]<0&&P&&!a&&(r[0]+=p),!r||isNaN(r[0])||isNaN(r[1])){C.push(E),C.push(E),t.push(null),T++;continue}if(a){let e=a.inverseTransform(new l({x:r[0],y:r[1],spatialReference:s}));r=[e.x,e.y]}t.push(r),e>0&&h&&w[n]&&r[0]<w[n][0]&&(r[0]+=p,L&&r[0]>O&&r[0]>p&&(r[0]-=p)),C.push((r[0]-D)/A),C.push((k-r[1])/j)}w=t}return{offsets:C,error:null,coefficients:null,outofBoundPointCount:T,spacing:g,size:y?[b,x]:[b-1,x-1]}}function Y(e,t,n){let{cols:r,rows:i}=t,a=new Float32Array((r-1)*(i-1)*2*6),o=new Float32Array([-0,-1,1,-1,1,-0,1,-0,-0]),s=new Float32Array([-1,1,0,0,-1,1,1,0,0]);for(let t=0;t<r-1;t++){for(let n=0;n<i-1;n++){let c=t*i*2+n*2,l=e[c],u=e[c+1],d=e[c+2],f=e[c+3];c+=i*2;let p=e[c],m=e[c+1],h=e[c+2],g=e[c+3],_=0,v=(n*(r-1)+t)*12;for(let e=0;e<3;e++)a[v++]=o[_++]*l+o[_++]*d+o[_++]*h;_=0;for(let e=0;e<3;e++)a[v++]=o[_++]*u+o[_++]*f+o[_++]*g;_=0;for(let e=0;e<3;e++)a[v++]=s[_++]*l+s[_++]*p+s[_++]*h;_=0;for(let e=0;e<3;e++)a[v++]=s[_++]*u+s[_++]*m+s[_++]*g}if(n)for(let e=0;e<a.length;e++)isNaN(a[e])&&(a[e]=-1)}return a}function X(e,t){let n=e.clone().normalize();return n.length===1?n[0]:V(n,t)}function ce(e){let{spatialReference:t}=e,n=p(t);if(!n)return e;let[i,a]=n.valid,o=a-i,s=0;if(e.xmin<i){let t=i-e.xmin;s=Math.ceil(t/o)}else if(e.xmin>a){let t=e.xmin-a;s=-Math.ceil(t/o)}return new r({spatialReference:e.spatialReference,xmin:e.xmin+s*o,ymin:e.ymin,xmax:e.xmax+s*o,ymax:e.ymax})}function le(e,t,r){let{storageInfo:i,pixelSize:a}=t,o=0,s=!1,{pyramidResolutions:c}=i,u=i.tileInfo.format?.toLowerCase()===`mixed`?Math.max(1,Math.min(3,i.tileInfo.dpi/96)):1,d=(e.x+e.y)/2/u;if(c!=null&&c.length){let e=c[c.length-1],i=(e.x+e.y)/2,u=(a.x+a.y)/2;if(d<=u)o=0;else if(d>=i)o=c.length,s=d/i>8;else{let e=u,t;for(let n=1;n<=c.length;n++){if(t=(c[n-1].x+c[n-1].y)/2,d<=t){d===t?o=n:r===`down`?(o=n-1,s=d/e>8):o=r===`up`||d-e>t-d||d/e>2?n:n-1;break}e=t}}let f=o===0?a:c[o-1];return s&&Math.min(f.x,f.y)*n(t.spatialReference)>19567&&(s=!1),{pyramidLevel:o,pyramidResolution:new l({x:f.x,y:f.y,spatialReference:t.spatialReference}),excessiveReading:s}}let f=Math.log(e.x/a.x)/Math.LN2,p=Math.log(e.y/a.y)/Math.LN2,m=t.storageInfo.maximumPyramidLevel||0;o=r===`down`?Math.floor(Math.min(f,p)):r===`up`?Math.ceil(Math.max(f,p)):Math.round((f+p)/2),o<0?o=0:o>m&&(s=o>m+3,o=m);let h=2**o,g=new l({x:h*t.nativePixelSize.x,y:h*t.nativePixelSize.y,spatialReference:t.spatialReference});return{pyramidLevel:o,pyramidResolution:g,excessiveReading:s}}function Z(e,t,n=!1){let{pixelSize:r,extent:i}=e,a=D(i,t,!1),o=H(X(i,(r.x+r.y)/16),t,a);return!o||n||q(o)===0?o:U(i,t,a)}function ue(e,t,n){let r=n?.tileSize??512,i=n?.alignGlobalDatasetWithAGOL??!0,a=!!n?.limitToSrcResolution,{extent:o,pixelSize:s}=e,c=A(s,t,o);if(c==null)return{projectedPixelSize:null,scales:null,srcResolutions:null,isCustomTilingScheme:!1};let l=(c.x+c.y)/2,u=j(l,t),d=256/r,f=t.isGeographic?295828763.7958547*d:591657527.591555*d,p=(t.isGeographic?.703125:156543.03392800014)*d,m=e.dataType===`vector-magdir`||e.dataType===`vector-uv`,h=Z(e,t,!0),g=Math.min(Math.ceil(Math.log(Math.min(e.width,e.height)/32)/Math.LN2),Math.ceil(Math.log(f/2/u)/Math.LN2));if(!m&&h&&i&&(t.isGeographic||t.isWebMercator)){let n=W(t);if(m=q(h)>0||n!=null&&h.width>n/4,!m&&n!=null){let t=-1;if(g<3)t=2**g*l*r;else if(e.storageInfo){let{maximumPyramidLevel:n=0,pyramidScalingFactor:i=2}=e.storageInfo;t=i**n*l*r}let i=Math.ceil(n/t);m=i===1||i===2&&n/2-h.xmax<t}}let _=u,v,y=1.001,b=Math.min(2,Math.max(1.414,e.storageInfo?.pyramidScalingFactor||2));if(m){_=f;let n=Q(e,t);v={x:n.x*p,y:n.y*p}}else{v={x:s.x,y:s.y};let e=0;for(;_<y/2*f&&e<g;)e++,_*=b,v.x*=b,v.y*=b;Math.max(_,f)/Math.min(_,f)<=y&&(_=f)}let x=[_],S=[{x:v.x,y:v.y}],C=Math.min(70.5310735,u)/y;for(;_>=C;)_/=b,v.x/=b,v.y/=b,x.push(_),S.push({x:v.x,y:v.y});if(a){let e=s.x*.001,t=S.findIndex(t=>t.x>=s.x-e&&t.x<=s.x+e);t>-1?(S.length=t+1,x.length=t+1):(t=S.findIndex(t=>t.x<=s.x+e),t>0&&(S.length=t,x.length=t))}return{projectedPixelSize:c,scales:x,srcResolutions:S,isCustomTilingScheme:!m}}function Q(e,t){if(t.isWGS84||t.isWebMercator){let n=t.isGeographic?1341104507446289e-21:.29858214164761665,r=t.isGeographic?4326:3857,i=Z(e,new f({wkid:r}),!0),a=A({x:n,y:n},e.spatialReference,i);return{x:a.x/n,y:a.y/n}}let n=A(e.pixelSize,t,e.extent),r=(n.x+n.y)/2;return{x:e.pixelSize.x/r,y:e.pixelSize.y/r}}function de(e,t){let{spatialReference:n,lods:r}=t,{x:i,y:a}=Q(e,n);return r.map(({resolution:e})=>({x:e*i,y:e*a}))}function $(e){let t=0;for(let n of e){let e=n.length,r=n[0][0]*(n[1][1]-n[e-2][1]);for(let t=1;t<e-1;t++)r+=n[t][0]*(n[t+1][1]-n[t-1][1]);t+=r/2}return Math.abs(t)}export{$ as calculateArea2D,ue as computeProjectedScales,Q as computeSrcResolutionRatio,de as computeSrcResolutions,_ as defaultGridSpacing,y as defaultProjectionToleranceInPixels,D as getDefaultDatumTransformationForDataset,I as getProjectedGridPoints,se as getProjectionOffsetGrid,ae as getRasterDatasetAlignmentInfo,M as getSourceScale,W as getWorldWidth,q as getWorldWrapCount,E as load,v as minimumGridSpacing,Z as projectDatasetExtent,A as projectDatasetResolution,H as projectExtent,P as projectPoint,re as projectPolygon,O as projectResolution,ce as shiftExtent,X as snapExtent,le as snapPyramid};
2
+ import{isSome as e}from"../../../core/arrayUtils.js";import t from"../../../core/Error.js";import{getMetersPerUnitForSR as n}from"../../../core/units.js";import r from"../../../geometry/Extent.js";import{P as i,a,b as o,c as s,d as c}from"../../../chunks/pe.js";import l from"../../../geometry/Point.js";import u from"../../../geometry/Polygon.js";import{projectWithoutEngine as d}from"../../../geometry/projectionUtils.js";import f from"../../../geometry/SpatialReference.js";import{getInfo as p}from"../../../geometry/support/spatialReferenceUtils.js";function m(){if(!S)throw new t(`rasterprojectionhelper-project`,`projection operator is not loaded`)}const h=(e,t,n,r=0)=>{if(n[0]===1)return[0,0];let i=1,a=-1,o=1,s=-1;for(let t=0;t<e.length;t+=2)isNaN(e[t])||(i=i>e[t]?e[t]:i,a=a>e[t]?a:e[t],o=o>e[t+1]?e[t+1]:o,s=s>e[t+1]?s:e[t+1]);let{cols:c,rows:l}=t,u=(a-i)/c/n[0],d=(s-o)/l/n[1],f=r*2,p=0,m=!1,h=[0,0];for(let t=0;t<c-3;t++){for(let n=0;n<l-3;n++){let r=t*l*2+n*2,i=(e[r]+e[r+4]+e[r+l*4]+e[r+l*4+4])/4,a=(e[r+1]+e[r+5]+e[r+l*4+1]+e[r+l*4+5])/4,o=Math.abs((i-e[r+l*2+2])/u),s=Math.abs((a-e[r+l*2+3])/d);if(o+s>p&&(p=o+s,h=[o,s]),f&&p>f){m=!0;break}}if(m)break}return h},g={3395:20037508.342789244,3410:17334193.943686873,3857:20037508.342788905,3975:17367530.445161372,4087:20037508.342789244,4088:20015108.787169147,6933:17367530.445161372,32662:20037508.342789244,53001:20015086.79602057,53002:10007543.39801029,53003:20015086.79602057,53004:20015086.79602057,53016:14152803.599503474,53017:17333573.624304302,53034:20015086.79602057,53079:20015114.352186374,53080:20015114.352186374,54001:20037508.342789244,54002:10018754.171394624,54003:20037508.342789244,54004:20037508.342789244,54016:14168658.027268292,54017:17367530.44516137,54034:20037508.342789244,54079:20037508.342789244,54080:20037508.342789244,54100:20037508.342789244,54101:20037508.342789244},_=32,v=4,y=4,b=new Map,x=new Map;let S=!1,C,w,T;async function E(){return C||(C=Promise.withResolvers(),w=await import(`../../../geometry/operators/projectOperator.js`),T=await import(`../../../geometry/operators/support/geographicTransformationUtils.js`),w.projectIsLoaded()||await w.projectLoad(),T.isLoaded()||await T.load(),S=!0,C.resolve()),C.promise}function D(e,t,n){if(m(),n){let n=w.projectExecute(e,t);return T.getTransformation(t,e.spatialReference,n)}return T.getTransformation(e.spatialReference,t,e)}function O(e,t,n,i){let a=e.spatialReference;if(!a||!t||a.equals(t))return e;m();let o=n.center,s=new r({xmin:o.x-e.x/2,xmax:o.x+e.x/2,ymin:o.y-e.y/2,ymax:o.y+e.y/2,spatialReference:a}),c=w.projectExecute(s,t,{geographicTransformation:i}),l=q(t);return c==null||l!=null&&c.width>=l?k(e,a,t):{x:c.width,y:c.height}}function k(e,t,r){let i=n(t)/n(r);return{x:e.x*i,y:e.y*i}}function A(e,r,i){let{spatialReference:a}=i;if(!a||!r||a.equals(r))return e;if(a.isGeographic&&r.isGeographic)return k(e,a,r);if(m(),!S)throw new t(`raster-projection-helper:project-dataset-resolution`,`geometry engine is not loaded`);let{x:o,y:s}=e,c=n(a),l=(o+s)/2*c,d=1;l>30&&(d=30/l,o*=d,s*=d);let f=o*256/2,p=s*256/2,{x:h,y:g}=i.center,_=[];for(let e=0;e<=256;e++)_.push([h-f,g-p+e*s]);for(let e=1;e<=256;e++)_.push([h-f+e*o,g+p]);for(let e=1;e<=256;e++)_.push([h+f,g+p-e*s]);for(let e=1;e<256;e++)_.push([h+f-e*o,g-p]);_.push(_[0]);let v=new u({rings:[_],spatialReference:a}),y=w.projectExecute(v,r);if(!y)return k(e,a,r);let b=y.extent,x=q(r);if(b==null||x!=null&&b.width>=x)return k(e,a,r);let C=de(y.rings),T=o*s*256*256,E=Math.sqrt(C/T)/d,D={x:b.width/d/256,y:b.height/d/256},O={x:o*E,y:s*E},A=D.x*D.y;return Math.abs(A-O.x*O.y)/A<.1?D:O}function j(e,t){return(typeof e==`number`?e:(e.x+e.y)/2)*n(t)*96*39.37}function M(e,t){let{pixelSize:n,extent:r}=e;return j(A(n,t,r),t)}function N(e,t=.01){return n(e)?t/n(e):0}function P(e,t,n,r=!0){let i=e.spatialReference;if(i.equals(t))return e;m();let a=w.projectExecute(e,t,{geographicTransformation:n});return!r||!a||F([e],[a],i,t),a}function F(e,t,n,r){let i=J(n,!0),a=J(r,!0),o=N(n,500),s=N(r,500);if(o&&i!=null&&a!=null)for(let n=0;n<e.length;n++){let r=t[n];if(!r)continue;let{x:c}=e[n],{x:l}=r;l>=a[1]-s&&Math.abs(c-i[0])<o?r.x-=a[1]-a[0]:l<=a[0]+s&&Math.abs(c-i[1])<o&&(r.x+=a[1]-a[0])}}function I(e){let{inSR:t,outSR:n,preferPE:r}=e;if(t.equals(n)){let{points:t}=H(e,null);return t}return t.isWebMercator&&n.isWGS84||t.isWGS84&&n.isWebMercator?z(e):r&&(t.isGeographic||B(t)!=null)?R(e):L(e)}function L(e){let{points:t}=H(e,null),{inSR:n,outSR:r,datumTransformation:i}=e,a=t.map(e=>new l(e[0],e[1],n)),o=w.projectExecuteMany(a,r,{geographicTransformation:i});return i&&F(a,o,n,r),o.map(e=>e?[e.x,e.y]:[NaN,NaN])}function R(e){let{inSR:t,outSR:n,datumTransformation:r}=e,{points:o,mask:l}=H(e,B(t));if(!t.isGeographic){let e=t.wkid?i.coordsys(t.wkid):i.fromString(t.isGeographic?a.PE_TYPE_GEOGCS:a.PE_TYPE_PROJCS,t.wkt2||t.wkt);s.projToGeog(e,o.length,o)}if(r!=null&&r.steps.length){let e,t=179.9955;if(n.isGeographic&&(e=o.map(([e])=>e>t?1:e<-179.9955?-1:0)),r.steps.forEach(e=>{let t=e.wkid?i.geogtran(e.wkid):i.fromString(a.PE_TYPE_GEOGTRAN,e.wkt);c.geogToGeog(t,o.length,o,null,e.isInverse?a.PE_TRANSFORM_2_TO_1:a.PE_TRANSFORM_1_TO_2)}),e)for(let n=0;n<o.length;n++){let r=e[n],i=o[n][0],a=i>t?1:i<-179.9955?-1:0;r&&a&&r!==a&&(o[n][0]=r>0?i+360:i-360)}}if(!n.isGeographic){let e=B(n,!0);U(o,e!=null&&e.isEnvelope?[e.bbox[1],e.bbox[3]]:[-90,90]);let t=n.wkid?i.coordsys(n.wkid):i.fromString(n.isGeographic?a.PE_TYPE_GEOGCS:a.PE_TYPE_PROJCS,n.wkt2||n.wkt);s.geogToProj(t,o.length,o)}let u=o;if(l&&o.length!==l.length){u=[];for(let e=0,t=0;e<l.length;e++)l[e]?u.push(o[t++]):u.push([NaN,NaN])}return u}function z(e){let{cols:t,rows:n,xres:r,yres:i,usePixelCenter:a,inSR:o,outSR:s}=e,{xmin:c,ymax:u}=e;a&&(c+=r/2,u-=i/2);let f=[],p=[],m=Math.max(t,n);for(let e=0;e<m;e++){let a=c+r*Math.min(t,e),m=u-i*Math.min(n,e),h=d(new l({x:a,y:m,spatialReference:o}),o,s);e<=t&&f.push(h.x),e<=n&&p.push(h.y)}let h=[];for(let e=0;e<t;e++)for(let t=0;t<n;t++)h.push([f[e],p[t]]);return h}function B(e,t=!1){let n=e.wkid||e.wkt2||e.wkt;if(!n||e.isGeographic)return null;if(n=String(n),b.has(n)){let e=b.get(n);return t?e?.gcs:e?.pcs}let r=e.wkid?i.coordsys(e.wkid):i.fromString(e.isGeographic?a.PE_TYPE_GEOGCS:a.PE_TYPE_PROJCS,e.wkt2||e.wkt),o=V(r,N(e,1e-4)),s=V(r,0,!0);return b.set(n,{pcs:o,gcs:s}),t?s:o}function V(e,t=0,n=!1){let r=o.generate(e),i=n?e.horizonGcsGenerate():e.horizonPcsGenerate();if(!r||!i?.length)return null;let a=!1,s=i.find(e=>e.getInclusive()===1&&e.getKind()===1);if(!s){if(s=i.find(e=>e.getInclusive()===1&&e.getKind()===0),!s)return null;a=!0}let c=n?0:+(r.getNorthPoleLocation()===2)|(r.getSouthPoleLocation()===2?2:0),l=r.isPannableRectangle(),u=s.getCoord();if(a)return{isEnvelope:a,isPannable:l,vertices:u,coef:null,bbox:[u[0][0]-t,u[0][1]-t,u[1][0]+t,u[1][1]+t],poleLocation:c};let d=0,f=[],[p,m]=u[0],[h,g]=u[0];for(let e=0,t=u.length;e<t;e++){d++,d===t&&(d=0);let[n,r]=u[e],[i,a]=u[d];if(a===r)f.push([n,i,r,a,2]);else{let e=(i-n)/(a-r||1e-4),t=n-e*r;r<a?f.push([e,t,r,a,0]):f.push([e,t,a,r,1])}p=p<n?p:n,m=m<r?m:r,h=h>n?h:n,g=g>r?g:r}return{isEnvelope:!1,isPannable:l,vertices:u,coef:f,bbox:[p,m,h,g],poleLocation:c}}function H(e,t){let n=[],{cols:r,rows:i,xres:a,yres:o,usePixelCenter:s}=e,{xmin:c,ymax:l}=e;if(s&&(c+=a/2,l-=o/2),t==null){for(let e=0;e<r;e++)for(let t=0;t<i;t++)n.push([c+a*e,l-o*t]);return{points:n}}let u=new Uint8Array(r*i);if(t.isEnvelope){let{isPannable:e,bbox:[s,d,f,p]}=t;for(let t=0,m=0;t<r;t++){let r=c+a*t,h=e||r>=s&&r<=f;for(let e=0;e<i;e++,m++){let t=l-o*e;h&&t>=d&&t<=p&&(n.push([r,t]),u[m]=1)}}return{points:n,mask:u}}let d=t.coef,f=[];for(let e=0;e<i;e++){let t=l-o*e,n=[],r=[];for(let e=0;e<d.length;e++){let[i,a,o,s,c]=d[e];if(t===o&&o===s)n.push(i),n.push(a),r.push(2),r.push(2);else if(t>=o&&t<=s){let e=i*t+a;n.push(e),r.push(c)}}let i=n;if(n.length>2){let e=r[0]===2?0:r[0],t=n[0];i=[];for(let a=1;a<r.length;a++)(r[a]!==2||a===r.length-1)&&(r[a]!==e&&(i.push(e===0?Math.min(t,n[a-1]):Math.max(t,n[a-1])),e=r[a],t=n[a]),a===r.length-1&&i.push(r[a]===0?Math.min(t,n[a]):Math.max(t,n[a])));i.sort((e,t)=>e-t)}else n[0]>n[1]&&(i=[n[1],n[0]]);f.push(i)}for(let e=0,t=0;e<r;e++){let r=c+a*e;for(let e=0;e<i;e++,t++){let i=l-o*e,a=f[e];if(a.length===2)r>=a[0]&&r<=a[1]&&(n.push([r,i]),u[t]=1);else if(a.length>2){let e=!1;for(let t=0;t<a.length;t+=2)if(r>=a[t]&&r<=a[t+1]){e=!0;break}e&&(n.push([r,i]),u[t]=1)}}}return{points:n,mask:u}}function U(e,t){let[n,r]=t;for(let t=0;t<e.length;t++){let i=e[t][1];(i<n||i>r)&&(e[t]=[NaN,NaN])}}function W(e,t){let n=q(e[0].spatialReference);if(e.length<2||n==null||(t??=N(e[0].spatialReference),e=e.filter(e=>e.width>t),e.length===1))return e[0];let{xmin:i,xmax:a,ymin:o,ymax:s}=e[0];for(let t=1;t<e.length;t++){let r=e[t];a=r.xmax+n*t,o=Math.min(o,r.ymin),s=Math.max(s,r.ymax)}return new r({xmin:i,xmax:a,ymin:o,ymax:s,spatialReference:e[0].spatialReference})}function G(t,n,i=null,a=!0){let o=t.spatialReference;if(o.equals(n)||!n)return t;let s=X(t),c=q(o,!0),l=q(n);if(s===0||c==null||l==null){let e=K(t,n,i,a);if(e&&c==null&&l!=null&&Math.abs(e.width-l)<N(n)&&w.projectIsLoaded()){let r=B(o);if(r!=null&&r.poleLocation===0&&t.width<(r.bbox[2]-r.bbox[0])/2)return te(t,n)||e}return e}let u=t.clone().normalize();if(u.length===1&&t.xmax<c&&t.xmax-c/2>N(o)){let{xmin:e,xmax:n}=t;for(let i=0;i<=s;i++){let a=i===0?e:-c/2,l=i===s?n-c*i:c/2;u[i]=new r({xmin:a,xmax:l,ymin:t.ymin,ymax:t.ymax,spatialReference:o})}}let d=u.map(e=>K(e,n,i,a)).filter(e);return d.length===0?null:W(d)}function ee(e,t,n){if(e.type===`extent`){let{xmin:t,ymin:n,xmax:r,ymax:i,spatialReference:a}=e;e=new u({rings:[[[t,i],[r,i],[r,n],[t,n],[t,i]]],spatialReference:a})}return e.spatialReference.equals(t)?e:(m(),w.projectExecute(e,t,{geographicTransformation:n}))}function te(e,t){let n=q(t);if(n==null)return null;let{xmin:i,ymin:a,xmax:o,ymax:s}=e,c=e.spatialReference,l=new u({spatialReference:c,rings:[[[i,a],[o,a],[o,s],[i,s],[i,a]]]}),d=w.projectExecute(l,t);if(d.rings.length!==2||!d.rings[0].length||!d.rings[1].length)return null;let{rings:f}=d,p=N(c),m=new r({spatialReference:t});for(let e=0;e<2;e++){i=o=f[e][0][0],a=s=f[e][0][1];for(let t=0;t<f[e].length;t++)i=i>f[e][t][0]?f[e][t][0]:i,o=o<f[e][t][0]?f[e][t][0]:o,a=a>f[e][t][1]?f[e][t][1]:a,s=s<f[e][t][1]?f[e][t][1]:s;if(e===0)m.ymin=a,m.ymax=s,m.xmin=i,m.xmax=o;else if(m.ymin=Math.min(m.ymin,a),m.ymax=Math.max(m.ymax,s),Math.abs(o-n/2)<p)m.xmin=i,m.xmax+=n;else if(Math.abs(i+n/2)<p)m.xmax=o+n;else return null}return m}function K(e,t,n,r=!0,i=!0){let a=e.spatialReference;if(a.equals(t)||!t)return e;m();let o=w.projectExecute(e,t,{geographicTransformation:n});if(i&&t.isWebMercator&&o&&(o.ymax=Math.min(20037508.342787,o.ymax),o.ymin=Math.max(-20037508.342787,o.ymin),o.ymin>=o.ymax))return null;if(!r||!o)return o;let s=J(a,!0),c=J(t,!0);if(s==null||c==null)return o;let u=N(a,.001),d=N(a,500),f=N(t,.001);if(Math.abs(o.xmin-c[0])<f&&Math.abs(o.xmax-c[1])<f){let r=Math.abs(e.xmin-s[0]),i=Math.abs(s[1]-e.xmax);if(r<u&&i>d){o.xmin=c[0];let r=[];r.push(new l(e.xmax,e.ymin,a)),r.push(new l(e.xmax,(e.ymin+e.ymax)/2,a)),r.push(new l(e.xmax,e.ymax,a));let i=r.map(e=>P(e,t,n)).filter(e=>!isNaN(e?.x)).map(e=>e.x);o.xmax=Math.max.apply(null,i)}if(i<u&&r>d){o.xmax=c[1];let r=[];r.push(new l(e.xmin,e.ymin,a)),r.push(new l(e.xmin,(e.ymin+e.ymax)/2,a)),r.push(new l(e.xmin,e.ymax,a));let i=r.map(e=>P(e,t,n)).filter(e=>!isNaN(e?.x)).map(e=>e.x);o.xmin=Math.min.apply(null,i)}}else{let e=N(t,.001);Math.abs(o.xmin-c[0])<e&&(o.xmin=c[0]),Math.abs(o.xmax-c[1])<e&&(o.xmax=c[1])}return o}function q(e,t=!1){if(!e)return null;let n=t?20037508.342787:20037508.342788905;return e.isWebMercator?n*2:e.wkid&&e.isGeographic?360:g[e.wkid]*2||null}function J(e,t=!1){if(e.isGeographic)return[-180,180];let n=q(e,t);return n?[-n/2,n/2]:null}function Y(e,t,n,r){let i=(e-t)/n;return i-Math.floor(i)===0?r&&--i:i=Math.floor(i),i}function X(e,t=!1){let n=q(e.spatialReference);if(n==null)return 0;let r=n/2,i=t?0:-r,a=N(e.spatialReference),o=!t&&Math.abs(e.xmax-n/2)<a?n/2:e.xmax,s=!t&&Math.abs(e.xmin+n/2)<a?-n/2:e.xmin;return Y(o,i,n,!0)-Y(s,i,n,!1)}function ne(e){let t=e.storageInfo.origin.x,n=q(e.spatialReference,!0);if(n==null)return{originX:t,halfWorldWidth:null,pyramidsInfo:null};let r=n/2,{nativePixelSize:i,storageInfo:a,extent:o}=e,{maximumPyramidLevel:s,blockWidth:c,pyramidScalingFactor:l}=a,u=i.x,d=[],f=e.transform!=null&&e.transform.type===`gcs-shift`,p=Math.max(0,t+(f?0:r));for(let e=0;e<=s;e++){let e=(o.xmax-t)/u/c,r=e-Math.floor(e)===0?e:Math.ceil(e),i=Math.round(p/u),a=Math.round(n/u)-i,s=Math.ceil(a/c),f=Math.floor(i/c),m=i%c,h=(c-a%c)%c;d.push({resolutionX:u,blockWidth:c,datasetColumnCount:r,worldColumnCountFromOrigin:s,leftMargin:m,rightPadding:h,originColumnOffset:f}),u*=l}return{originX:t,halfWorldWidth:r,pyramidsInfo:d,hasGCSSShiftTransform:f}}function re(e){if(!e||e.isGeographic)return e;let t=String(e.wkid||e.wkt2||e.wkt),n;return x.has(t)?n=x.get(t):(n=(e.wkid?i.coordsys(e.wkid):i.fromString(a.PE_TYPE_PROJCS,e.wkt2||e.wkt)).getGeogcs().getCode(),x.set(t,n)),new f({wkid:n})}function ie(e){let t=e.isAdaptive&&e.spacing==null,n=e.spacing||[32,32],r=Z(e),i={cols:r.size[0]+1,rows:r.size[1]+1},a=r.outofBoundPointCount>0&&r.outofBoundPointCount<r.offsets.length/2,o=r.outofBoundPointCount===r.offsets.length/2||t&&a?[0,0]:h(r.offsets,i,n,4),s=(o[0]+o[1])/2,c=e.projectedExtent.spatialReference,l=e.srcBufferExtent.spatialReference;if(t&&(a||s>4)&&(c.isGeographic||B(c),n=[4,4],r=Z({...e,spacing:n}),i={cols:r.size[0]+1,rows:r.size[1]+1},o=h(r.offsets,i,n,4)),r.error=o,n[0]>1&&(r.coefficients=ae(r.offsets,i,a)),e.includeGCSGrid&&!c.isGeographic&&!c.isWebMercator){if(l.isGeographic)r.gcsGrid={offsets:r.offsets,coefficients:r.coefficients,spacing:n};else{let t=B(c);if(t!=null&&!t.isEnvelope){let t=re(c),o=G(e.projectedExtent,t),{offsets:s}=Z({...e,srcBufferExtent:o,spacing:n}),l=ae(s,i,a);r.gcsGrid={offsets:s,coefficients:l,spacing:n}}}}return r}function Z(e){let{projectedExtent:t,srcBufferExtent:n,pixelSize:r,datumTransformation:i,rasterTransform:a}=e,o=t.spatialReference,s=n.spatialReference;m();let{xmin:c,ymin:u,xmax:d,ymax:f}=t,p=q(s),h=p!=null&&(e.hasWrapAround||a?.type===`gcs-shift`),g=e.spacing||[32,32],_=g[0]*r.x,v=g[1]*r.y,y=g[0]===1,b=Math.ceil((d-c)/_-.1/g[0])+ +!y,x=Math.ceil((f-u)/v-.1/g[1])+ +!y,S=I({cols:b,rows:x,xmin:c,ymax:f,xres:_,yres:v,inSR:o,outSR:s,datumTransformation:i,preferPE:g[0]<=4,usePixelCenter:y}),C=[],w,T=0,E=1/0,D=-1/0,O=y?-1:NaN,{xmin:k,xmax:A,ymax:j,width:M,height:P}=n,F=N(s,500),L=p!=null&&k>0&&A>p/2,R=B(o),z=R!=null&&R.poleLocation>0;for(let e=0;e<b;e++){let t=[];for(let n=0;n<x;n++){let r=S[e*x+n];if(h&&(r[0]>A&&r[0]>p/2-F?r[0]-=p:e===0&&r[0]<-F&&L&&!a&&(r[0]+=p)),!r||isNaN(r[0])||isNaN(r[1])){C.push(O),C.push(O),t.push(null),T++;continue}if(a){let e=a.inverseTransform(new l({x:r[0],y:r[1],spatialReference:s}));r=[e.x,e.y]}t.push(r),e>0&&h&&w[n]&&r[0]<w[n][0]&&(r[0]+=p,z&&r[0]>A&&r[0]>p&&(r[0]-=p));let i=(r[0]-k)/M;Number.isFinite(i)&&(E=Math.min(E,i),D=Math.max(D,i)),C.push(i),C.push((j-r[1])/P)}w=t}let V=!a||a.type===`gcs-shift`,H=E<0||D>1,U=Math.max(0,Math.min(1,D)-Math.max(0,E));if(h&&V&&H&&U<.5){let e=p/M,t=(d-c)/r.x,n=U===0?0:(D-E)/t*.99,i=0;for(let t of[-e,e]){let e=E+t,r=D+t,a=Math.max(0,Math.min(1,r)-Math.max(0,e));a-U>n&&(U=a,i=t)}if(i!==0)for(let e=0;e<C.length;e+=2)y&&C[e]===O&&C[e+1]===O||(C[e]+=i)}return{offsets:C,error:null,coefficients:null,outofBoundPointCount:T,spacing:g,size:y?[b,x]:[b-1,x-1]}}function ae(e,t,n){let{cols:r,rows:i}=t,a=new Float32Array((r-1)*(i-1)*2*6),o=new Float32Array([-0,-1,1,-1,1,-0,1,-0,-0]),s=new Float32Array([-1,1,0,0,-1,1,1,0,0]);for(let t=0;t<r-1;t++){for(let n=0;n<i-1;n++){let c=t*i*2+n*2,l=e[c],u=e[c+1],d=e[c+2],f=e[c+3];c+=i*2;let p=e[c],m=e[c+1],h=e[c+2],g=e[c+3],_=0,v=(n*(r-1)+t)*12;for(let e=0;e<3;e++)a[v++]=o[_++]*l+o[_++]*d+o[_++]*h;_=0;for(let e=0;e<3;e++)a[v++]=o[_++]*u+o[_++]*f+o[_++]*g;_=0;for(let e=0;e<3;e++)a[v++]=s[_++]*l+s[_++]*p+s[_++]*h;_=0;for(let e=0;e<3;e++)a[v++]=s[_++]*u+s[_++]*m+s[_++]*g}if(n)for(let e=0;e<a.length;e++)isNaN(a[e])&&(a[e]=-1)}return a}function oe(e,t){let n=e.clone().normalize();return n.length===1?n[0]:W(n,t)}function se(e){let{spatialReference:t}=e,n=p(t);if(!n)return e;let[i,a]=n.valid,o=a-i,s=0;if(e.xmin<i){let t=i-e.xmin;s=Math.ceil(t/o)}else if(e.xmin>a){let t=e.xmin-a;s=-Math.ceil(t/o)}return new r({spatialReference:e.spatialReference,xmin:e.xmin+s*o,ymin:e.ymin,xmax:e.xmax+s*o,ymax:e.ymax})}function ce(e,t,r){let{storageInfo:i,pixelSize:a}=t,o=0,s=!1,{pyramidResolutions:c}=i,u=i.tileInfo.format?.toLowerCase()===`mixed`?Math.max(1,Math.min(3,i.tileInfo.dpi/96)):1,d=(e.x+e.y)/2/u;if(c!=null&&c.length){let e=c[c.length-1],i=(e.x+e.y)/2,u=(a.x+a.y)/2;if(d<=u)o=0;else if(d>=i)o=c.length,s=d/i>8;else{let e=u,t;for(let n=1;n<=c.length;n++){if(t=(c[n-1].x+c[n-1].y)/2,d<=t){d===t?o=n:r===`down`?(o=n-1,s=d/e>8):o=r===`up`||d-e>t-d||d/e>2?n:n-1;break}e=t}}let f=o===0?a:c[o-1];return s&&Math.min(f.x,f.y)*n(t.spatialReference)>19567&&(s=!1),{pyramidLevel:o,pyramidResolution:new l({x:f.x,y:f.y,spatialReference:t.spatialReference}),excessiveReading:s}}let f=Math.log(e.x/a.x)/Math.LN2,p=Math.log(e.y/a.y)/Math.LN2,m=t.storageInfo.maximumPyramidLevel||0;o=r===`down`?Math.floor(Math.min(f,p)):r===`up`?Math.ceil(Math.max(f,p)):Math.round((f+p)/2),o<0?o=0:o>m&&(s=o>m+3,o=m);let h=2**o,g=new l({x:h*t.nativePixelSize.x,y:h*t.nativePixelSize.y,spatialReference:t.spatialReference});return{pyramidLevel:o,pyramidResolution:g,excessiveReading:s}}function Q(e,t,n=!1){let{pixelSize:r,extent:i}=e,a=D(i,t,!1),o=G(oe(i,(r.x+r.y)/16),t,a);return!o||n||X(o)===0?o:K(i,t,a)}function le(e,t,n){let r=n?.tileSize??512,i=n?.alignGlobalDatasetWithAGOL??!0,a=!!n?.limitToSrcResolution,{extent:o,pixelSize:s}=e,c=A(s,t,o);if(c==null)return{projectedPixelSize:null,scales:null,srcResolutions:null,isCustomTilingScheme:!1};let l=(c.x+c.y)/2,u=j(l,t),d=256/r,f=t.isGeographic?295828763.7958547*d:591657527.591555*d,p=(t.isGeographic?.703125:156543.03392800014)*d,m=e.dataType===`vector-magdir`||e.dataType===`vector-uv`,h=Q(e,t,!0),g=Math.min(Math.ceil(Math.log(Math.min(e.width,e.height)/32)/Math.LN2),Math.ceil(Math.log(f/2/u)/Math.LN2));if(!m&&h&&i&&(t.isGeographic||t.isWebMercator)){let n=q(t);if(m=X(h)>0||n!=null&&h.width>n/4,!m&&n!=null){let t=-1;if(g<3)t=2**g*l*r;else if(e.storageInfo){let{maximumPyramidLevel:n=0,pyramidScalingFactor:i=2}=e.storageInfo;t=i**n*l*r}let i=Math.ceil(n/t);m=i===1||i===2&&n/2-h.xmax<t}}let _=u,v,y=1.001,b=Math.min(2,Math.max(1.414,e.storageInfo?.pyramidScalingFactor||2));if(m){_=f;let n=$(e,t);v={x:n.x*p,y:n.y*p}}else{v={x:s.x,y:s.y};let e=0;for(;_<y/2*f&&e<g;)e++,_*=b,v.x*=b,v.y*=b;Math.max(_,f)/Math.min(_,f)<=y&&(_=f)}let x=[_],S=[{x:v.x,y:v.y}],C=Math.min(70.5310735,u)/y;for(;_>=C;)_/=b,v.x/=b,v.y/=b,x.push(_),S.push({x:v.x,y:v.y});if(a){let e=s.x*.001,t=S.findIndex(t=>t.x>=s.x-e&&t.x<=s.x+e);t>-1?(S.length=t+1,x.length=t+1):(t=S.findIndex(t=>t.x<=s.x+e),t>0&&(S.length=t,x.length=t))}return{projectedPixelSize:c,scales:x,srcResolutions:S,isCustomTilingScheme:!m}}function $(e,t){if(t.isWGS84||t.isWebMercator){let n=t.isGeographic?1341104507446289e-21:.29858214164761665,r=t.isGeographic?4326:3857,i=Q(e,new f({wkid:r}),!0),a=A({x:n,y:n},e.spatialReference,i);return{x:a.x/n,y:a.y/n}}let n=A(e.pixelSize,t,e.extent),r=(n.x+n.y)/2;return{x:e.pixelSize.x/r,y:e.pixelSize.y/r}}function ue(e,t){let{spatialReference:n,lods:r}=t,{x:i,y:a}=$(e,n);return r.map(({resolution:e})=>({x:e*i,y:e*a}))}function de(e){let t=0;for(let n of e){let e=n.length,r=n[0][0]*(n[1][1]-n[e-2][1]);for(let t=1;t<e-1;t++)r+=n[t][0]*(n[t+1][1]-n[t-1][1]);t+=r/2}return Math.abs(t)}export{de as calculateArea2D,le as computeProjectedScales,$ as computeSrcResolutionRatio,ue as computeSrcResolutions,_ as defaultGridSpacing,y as defaultProjectionToleranceInPixels,D as getDefaultDatumTransformationForDataset,I as getProjectedGridPoints,ie as getProjectionOffsetGrid,ne as getRasterDatasetAlignmentInfo,M as getSourceScale,q as getWorldWidth,X as getWorldWrapCount,E as load,v as minimumGridSpacing,Q as projectDatasetExtent,A as projectDatasetResolution,G as projectExtent,P as projectPoint,ee as projectPolygon,O as projectResolution,se as shiftExtent,oe as snapExtent,ce as snapPyramid};
@@ -105,7 +105,11 @@ export default class ActiveLayerInfo extends Accessor {
105
105
  * @see [hideLayersNotInCurrentView](https://developers.arcgis.com/javascript/latest/references/core/legend/ActiveLayerInfo/#hideLayersNotInCurrentView)
106
106
  */
107
107
  accessor respectLayerVisibility: boolean;
108
- /** The scale of the view instance in which the Legend is rendered. */
108
+ /**
109
+ * The scale of the view instance in which the Legend is rendered.
110
+ *
111
+ * @default 0
112
+ */
109
113
  get scale(): number;
110
114
  /**
111
115
  * Only applies if the [layer](https://developers.arcgis.com/javascript/latest/references/core/legend/ActiveLayerInfo/#layer) is a [MapImageLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/MapImageLayer/). An array of