@arcgis/core 6.0.0-next.6 → 6.0.0-next.7
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.
- package/arcade/functions/knowledgegraph.js +1 -1
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/{f09c9d9a554c33a753b4.js → 02253bdffbd580af22d8.js} +1 -1
- package/assets/esri/core/workers/chunks/{83589144eeeb08f45557.js → 2aeb5cc32284dd3e4d22.js} +1 -1
- package/assets/esri/core/workers/chunks/3ffda5bf0b91700dc308.js +1 -0
- package/assets/esri/core/workers/chunks/{1317ecdfd0cfa683a493.js → 42323093827adffe56d3.js} +1 -1
- package/assets/esri/core/workers/chunks/{f46a0d7cf588ba1b4157.js → 518e8883b6ed613bf451.js} +1 -1
- package/assets/esri/core/workers/chunks/{67ac6b326bf80fc3d33d.js → 53be85d04cd2da4f391d.js} +1 -1
- package/assets/esri/core/workers/chunks/54778dec1598818d93cb.js +1 -0
- package/assets/esri/core/workers/chunks/{3ac9dcbb0571a2580236.js → 62c8c9ad09e0166207fd.js} +1 -1
- package/assets/esri/core/workers/chunks/6588725275c75fae0d9c.js +1 -0
- package/assets/esri/core/workers/chunks/6ebe73f69ae822053b70.js +1 -0
- package/assets/esri/core/workers/chunks/7038ead1fa1674416ab3.js +1 -0
- package/assets/esri/core/workers/chunks/70cc2d79653d66e85b58.js +1 -0
- package/assets/esri/core/workers/chunks/{8ba32d3a0df4a206ef1c.js → 7165d6f6a5078768bebb.js} +1 -1
- package/assets/esri/core/workers/chunks/{cbe6c0f32608cb504695.js → 776ae25a34352d3468bc.js} +1 -1
- package/assets/esri/core/workers/chunks/801e9e66edb4961461eb.js +1 -0
- package/assets/esri/core/workers/chunks/9ce91a909eccc4dfe388.js +1 -0
- package/assets/esri/core/workers/chunks/ad76f7ab2f3e6d5a5b3c.js +1 -0
- package/assets/esri/core/workers/chunks/{250d3be6d3849d71fed8.js → c29c474c4b1049352d3e.js} +1 -1
- package/assets/esri/core/workers/chunks/ddf0671976648f621269.js +1 -0
- package/assets/esri/core/workers/chunks/ecaac39dde7ec4213264.js +1 -0
- package/assets/esri/core/workers/chunks/fb444954be74c1962ced.js +1 -0
- package/assets/esri/core/workers/chunks/{fccbb902fe08448f91de.js → fd0a5c243f3426f2a0b5.js} +1 -1
- package/assets/esri/core/workers/chunks/fecaf0bc28aeea4d15db.js +1 -0
- package/assets/esri/themes/base/widgets/_FeatureFormUtilityNetworkAssociationSettings.scss +1 -1
- package/assets/esri/themes/base/widgets/_Features.scss +1 -1
- package/assets/esri/themes/base/widgets/_OrientedImageryViewer.scss +5 -9
- package/assets/esri/themes/base/widgets/_SelectionToolbar.scss +2 -4
- package/assets/esri/themes/base/widgets/_Tooltip.scss +1 -1
- package/assets/esri/themes/dark/main.css +1 -1
- package/assets/esri/themes/light/main.css +1 -1
- package/assets/esri/themes/light/view.css +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/messages.en.json +1 -1
- package/chunks/GlobalIllumination.glsl.js +4 -2
- package/chunks/GlobalIlluminationBlur.glsl.js +3 -5
- package/chunks/GlobalIlluminationUpscale.glsl.js +1 -1
- package/config.js +1 -1
- package/core/colorUtils.js +1 -1
- package/core/has.js +1 -1
- package/core/workers/workerFactory.js +1 -1
- package/geometry/projectionUtils.js +1 -1
- package/kernel.js +1 -1
- package/layers/graphics/data/FeatureStore.js +1 -1
- package/layers/graphics/data/QueryEngineResult.js +1 -1
- package/layers/graphics/data/geometryUtils.js +1 -1
- package/layers/graphics/data/projectionSupport.js +1 -1
- package/layers/knowledgeGraph/layerUtils.js +1 -1
- package/layers/knowledgeGraph/nodeMovementUtils.js +1 -1
- package/layers/raster/datasets/TIFFRaster.js +1 -1
- package/package.json +2 -2
- package/views/2d/layers/FeatureLikeLayerView2D.js +1 -1
- package/views/2d/layers/features/FeatureSourceEventLog.js +1 -1
- package/views/2d/layers/features/sources/strategies/AFeatureTileLoadStrategy.js +1 -1
- package/views/2d/layers/features/support/FeatureSetReader.js +1 -1
- package/views/2d/layers/features/support/FeatureSetReaderIndirect.js +1 -1
- package/views/2d/layers/features/support/FeatureSetReaderJSON.js +1 -1
- package/views/2d/layers/features/support/FeatureSetReaderPBF.js +1 -1
- package/views/2d/layers/features/support/FeatureSetReaderPBFHeader.js +1 -1
- package/views/3d/layers/support/ImageHighlightHelper3D.js +1 -1
- package/views/3d/support/elevationUpdateUtils.js +1 -1
- package/views/3d/terrain/TerrainRenderer.js +1 -1
- package/views/3d/webgl-engine/effects/globalIllumination/GlobalIlluminationColorQuantization.glsl.js +2 -2
- package/views/draw/Draw.d.ts +1 -1
- package/views/draw/support/InteractiveHandle.js +1 -1
- package/views/interactive/options/SnappingOptions.d.ts +1 -0
- package/views/interactive/options/TooltipOptions.d.ts +1 -0
- package/views/interactive/options/ViewOptions.d.ts +1 -0
- package/views/interactive/support/Units.d.ts +1 -0
- package/views/interactive/tooltip/components/DrawHeaderActions.js +1 -1
- package/views/interactive/tooltip/components/ElevationModeSelect.js +1 -1
- package/views/support/projectionUtils.js +1 -1
- package/widgets/BasemapLayerList.js +1 -1
- package/widgets/BatchAttributeForm.js +1 -1
- package/widgets/DirectionalPad.js +1 -1
- package/widgets/Editor/components/UpdateFeaturePanelContent.js +1 -1
- package/widgets/Expand.js +1 -1
- package/widgets/FeatureForm.js +1 -1
- package/widgets/FeatureTable/FieldColumn.js +1 -1
- package/widgets/FeatureTable.js +1 -1
- package/widgets/Features/FeaturesDrillIn.js +1 -1
- package/widgets/Features.js +1 -1
- package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
- package/widgets/OrientedImageryViewer/adapters/view/SceneViewAdapter.js +1 -1
- package/widgets/OrientedImageryViewer/components/SequentialNavigationUI.js +1 -1
- package/widgets/OrientedImageryViewer/components/SketchTools.js +1 -1
- package/widgets/PanoramicVideoViewer.js +1 -1
- package/widgets/Print.js +1 -1
- package/widgets/ScaleRangeSlider.js +1 -1
- package/widgets/Search/SearchResultRenderer.js +1 -1
- package/widgets/Sketch/SketchViewModel.d.ts +1 -1
- package/widgets/Sketch/support/ResponsiveToolbar/ResponsiveToolbar.js +1 -1
- package/widgets/Sketch.d.ts +1 -1
- package/widgets/Track/TrackViewModel.d.ts +1 -1
- package/widgets/UtilityNetworkAssociations.js +1 -1
- package/widgets/UtilityNetworkTrace/UtilityNetworkTraceFeature.js +1 -1
- package/widgets/UtilityNetworkTrace/UtilityNetworkTraceFeaturesDrillIn.js +1 -1
- package/widgets/UtilityNetworkTrace/types.d.ts +2 -2
- package/widgets/UtilityNetworkTrace.js +1 -1
- package/widgets/UtilityNetworkValidateTopology.js +1 -1
- package/widgets/ValuePicker.js +1 -1
- package/widgets/VideoPlayer/components/PlayerActionsGroup.js +1 -1
- package/widgets/VideoPlayer/components/PlayerControlsGroup.js +1 -1
- package/widgets/support/GridControls.js +1 -1
- package/widgets/support/PluginSettingsControls.js +1 -1
- package/widgets/support/SelectionToolbar.js +1 -1
- package/widgets/support/SnappingControls.js +1 -1
- package/widgets/support/componentsUtils.js +1 -1
- package/assets/esri/core/workers/chunks/02d4f91652a79d2b637e.js +0 -1
- package/assets/esri/core/workers/chunks/107b025dc5b09465a78f.js +0 -1
- package/assets/esri/core/workers/chunks/1f43e06dcfe56229bb0f.js +0 -1
- package/assets/esri/core/workers/chunks/2a570ce6b99dac6ee996.js +0 -1
- package/assets/esri/core/workers/chunks/3880d2c7fb14955d7f93.js +0 -1
- package/assets/esri/core/workers/chunks/56851011276de0b3e318.js +0 -1
- package/assets/esri/core/workers/chunks/5f3ab77a79c408423fde.js +0 -1
- package/assets/esri/core/workers/chunks/65654e481cce9ae40e54.js +0 -1
- package/assets/esri/core/workers/chunks/8b54589f173259c1ba55.js +0 -1
- package/assets/esri/core/workers/chunks/bff767ec5bb4c0d6b324.js +0 -1
- package/assets/esri/core/workers/chunks/c906f984b2b6e7578c06.js +0 -1
- package/assets/esri/core/workers/chunks/de02a6a1f4810f99e9bb.js +0 -1
- package/assets/esri/core/workers/chunks/e5943f3a4bbc12c06c4d.js +0 -1
- package/assets/esri/core/workers/chunks/f0aaa646b17ffdbdcefa.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"attachments":{"addFile":"Add file","attachmentNumberedLabel":"Attachment {index}","attach":"Attach","attachmentEditingDisabled":"Attachment editing is disabled.","attachmentLimitExceeded":"Attachment limit exceeded","attachmentLimitReached":"Attachment limit reached","attachmentMustBeShorterThan":"Attachment must be shorter than {maxDuration}","attachmentsMustBeShorterThan":"Attachments must be shorter than {maxDuration}","attachmentMustBeSmallerThan":"Attachment must be smaller than {maxSize}","attachmentsMustBeSmallerThan":"Attachments must be smaller than {maxSize}","durationInSecond":"{count} second","durationInSeconds":"{count} seconds","capture":"Capture","captureMethodNotSupported":"Capture method is not supported","captureUnsupportedAdd":"Capture is not supported on this device.","captureUnsupportedDetail":"Capture is not supported on this device.","chooseFile":"Choose file","count":"Count: {count}","deleted":"Deleted","download":"Download","dragAndDropFile":"Drag and drop file.","fileExceedsMaximumSize":"File exceeds the maximum size","fileName":"File name","fileSelected":"File selected","fileToBeReplaced":"File to be replaced","imageResizedToMeetRequirements":"Image has been resized to meet requirements","maximumAudioLength":"Max audio length: {maxDuration}","maximumFileSize":"Maximum file size: {maxSize}","maximumNumberOfFiles":"Maximum number of files: {count}","maximumVideoLength":"Max video length: {maxDuration}","maximize":"Maximize","maximumNumberReachedRemoveToContinue":"Maximum number reached. Remove attachments to continue.","maxAttachmentsShort":"Max: {count}","maxAttachments":"Maximum attachments: {count}","minimumNotMet":"Minimum attachment requirement not met","minimumNumberOfFiles":"Minimum number of files: {count}","minAttachmentsShort":"Min: {count}","minAttachments":"Minimum attachments: {count}","noAttachments":"No attachments","noPreviewAvailable":"No preview available","remove":"Remove","replace":"Replace","recordAudio":"Record audio","takePhoto":"Take photo","takeVideo":"Take video","searchAttachments":"Search attachments","replaceFile":"Replace file","selectFile":"Select file","size":"Size","type":"Type","unableToAddAttachment":"Unable to add attachment","unableToAddAttachments":"Unable to add attachments","unsupportedDevice":"Unsupported device","unsupportedDeviceCaptureMessage":"This device does not support the required capture method.","viewAll":"View all","youCanAddUpToOneAttachment":"You can add up to 1 attachment","youCanAddUpToAttachments":"You can add up to {count} attachments"},"addFeature":"Add feature","addRecord":"Add record","unsupportedDomainGroupTitle":"Unsupported values","differentValues":"Different values","differentValuesPlaceholder":"(Different values)","empty":"No value","noDynamicChoices":"No choices are available","noDynamicChoicesWithNoValue":"No other choices are available","otherOptionLabel":"Other","expressionEvaluationFailed":"Form failed to run calculations","failedToCalculateValues":"Failed to calculate values","footerButtons":{"add":"Add","delete":"Delete","discard":"Discard","done":"Done","replace":"Replace","reset":"Reset","update":"Update"},"footerNotices":{"deleteDisabledMinimumAttachments":"Delete disabled. This feature requires a minimum number of attachments."},"formFailedToLoad":"Form failed to load.","formFailedToLoadTooManyComplexFeatures":"This form uses functions that limit attribute editing to {num} features.","formFailedToLoadTooManyFeatures":"Select up to {num} features to edit attributes.","noVisibleFields":{"allElementsHidden":"The selected features have no fields to display","elementsHiddenInSome":"The selected features have shared fields that are not displayed because of visibility expressions","noElements":"The selected feature has no fields to display","noElementsInCommon":"The selected features have no shared fields"},"other":"Other","recommended":"Recommended","relatedRecords":{"noOriginKeyFeature":"A feature cannot be added to '{relatedLayerName}' until the '{originKeyField}' has been entered.","noOriginKeyRecord":"A record cannot be added to '{relatedLayerName}' until the '{originKeyField}' has been entered.","noRecordsFound":"No records were found.","noRelatedRecordsFound":"No related records were found.","relatedRecordsTitle":"Related records","untitledLayer":"Untitled layer"},"requiredFieldBatchMode":"This field is required for one or more features.","requiredFieldLabel":"{name} - required field","deselectAllLabel":"Deselect all","selectAllLabel":"Select all","showAll":"Show all","showAllOptions":"Show all options","titles":{"addAttachments":"Add attachments","attachments":"Attachments","editFeature":"Edit feature","editFeatures":"Edit features","editAttachment":"Edit attachment","replaceAttachment":"Replace attachment"},"totalCount":"Total: {count}","unsupported":"Unsupported","unsupportedContingentValues":"Editing attributes for multiple features is not available for layers with contingent values.","validationErrors":{"cannotBeNull":"Field is required.","invalidCodedValue":"Value should be one of the listed values.","invalidType":"Not a valid value","invalidBatchFormType":"One or more features contain invalid values. Check individual features.","featuresInError":"One or more features have errors. Check individual features.","featuresWithInvalidValues":"One or more features have invalid values","nonVisibleError_changeValues":"The selected feature has hidden fields with invalid values. Change the values so that fields are visible.","nonVisibleError_checkIndividualFeatures":"One or more features have hidden fields with invalid values. Check individual features and correct the issues.","outsideRange":"Value should be between {min} and {max}","outsideRangeMax":"Value should be less than or equal to {max}","outsideRangeMin":"Value should be greater than or equal to {min}","tooFewSelectedChoices":"
|
|
1
|
+
{"attachments":{"addFile":"Add file","attachmentNumberedLabel":"Attachment {index}","attach":"Attach","attachmentEditingDisabled":"Attachment editing is disabled.","attachmentLimitExceeded":"Attachment limit exceeded","attachmentLimitReached":"Attachment limit reached","attachmentMustBeShorterThan":"Attachment must be shorter than {maxDuration}","attachmentsMustBeShorterThan":"Attachments must be shorter than {maxDuration}","attachmentMustBeSmallerThan":"Attachment must be smaller than {maxSize}","attachmentsMustBeSmallerThan":"Attachments must be smaller than {maxSize}","durationInSecond":"{count} second","durationInSeconds":"{count} seconds","capture":"Capture","captureMethodNotSupported":"Capture method is not supported","captureUnsupportedAdd":"Capture is not supported on this device.","captureUnsupportedDetail":"Capture is not supported on this device.","chooseFile":"Choose file","count":"Count: {count}","deleted":"Deleted","download":"Download","dragAndDropFile":"Drag and drop file.","fileExceedsMaximumSize":"File exceeds the maximum size","fileName":"File name","fileSelected":"File selected","fileToBeReplaced":"File to be replaced","imageResizedToMeetRequirements":"Image has been resized to meet requirements","maximumAudioLength":"Max audio length: {maxDuration}","maximumFileSize":"Maximum file size: {maxSize}","maximumNumberOfFiles":"Maximum number of files: {count}","maximumVideoLength":"Max video length: {maxDuration}","maximize":"Maximize","maximumNumberReachedRemoveToContinue":"Maximum number reached. Remove attachments to continue.","maxAttachmentsShort":"Max: {count}","maxAttachments":"Maximum attachments: {count}","minimumNotMet":"Minimum attachment requirement not met","minimumNumberOfFiles":"Minimum number of files: {count}","minAttachmentsShort":"Min: {count}","minAttachments":"Minimum attachments: {count}","noAttachments":"No attachments","noPreviewAvailable":"No preview available","remove":"Remove","replace":"Replace","recordAudio":"Record audio","takePhoto":"Take photo","takeVideo":"Take video","searchAttachments":"Search attachments","replaceFile":"Replace file","selectFile":"Select file","size":"Size","type":"Type","unableToAddAttachment":"Unable to add attachment","unableToAddAttachments":"Unable to add attachments","unsupportedDevice":"Unsupported device","unsupportedDeviceCaptureMessage":"This device does not support the required capture method.","viewAll":"View all","youCanAddUpToOneAttachment":"You can add up to 1 attachment","youCanAddUpToAttachments":"You can add up to {count} attachments"},"addFeature":"Add feature","addRecord":"Add record","unsupportedDomainGroupTitle":"Unsupported values","differentValues":"Different values","differentValuesPlaceholder":"(Different values)","empty":"No value","noDynamicChoices":"No choices are available","noDynamicChoicesWithNoValue":"No other choices are available","otherOptionLabel":"Other","expressionEvaluationFailed":"Form failed to run calculations","failedToCalculateValues":"Failed to calculate values","footerButtons":{"add":"Add","delete":"Delete","discard":"Discard","done":"Done","replace":"Replace","reset":"Reset","update":"Update"},"footerNotices":{"deleteDisabledMinimumAttachments":"Delete disabled. This feature requires a minimum number of attachments."},"formFailedToLoad":"Form failed to load.","formFailedToLoadTooManyComplexFeatures":"This form uses functions that limit attribute editing to {num} features.","formFailedToLoadTooManyFeatures":"Select up to {num} features to edit attributes.","noVisibleFields":{"allElementsHidden":"The selected features have no fields to display","elementsHiddenInSome":"The selected features have shared fields that are not displayed because of visibility expressions","noElements":"The selected feature has no fields to display","noElementsInCommon":"The selected features have no shared fields"},"other":"Other","recommended":"Recommended","relatedRecords":{"noOriginKeyFeature":"A feature cannot be added to '{relatedLayerName}' until the '{originKeyField}' has been entered.","noOriginKeyRecord":"A record cannot be added to '{relatedLayerName}' until the '{originKeyField}' has been entered.","noRecordsFound":"No records were found.","noRelatedRecordsFound":"No related records were found.","relatedRecordsTitle":"Related records","untitledLayer":"Untitled layer"},"requiredFieldBatchMode":"This field is required for one or more features.","requiredFieldLabel":"{name} - required field","deselectAllLabel":"Deselect all","selectAllLabel":"Select all","showAll":"Show all","showAllOptions":"Show all options","titles":{"addAttachments":"Add attachments","attachments":"Attachments","editFeature":"Edit feature","editFeatures":"Edit features","editAttachment":"Edit attachment","replaceAttachment":"Replace attachment"},"totalCount":"Total: {count}","unsupported":"Unsupported","unsupportedContingentValues":"Editing attributes for multiple features is not available for layers with contingent values.","validationErrors":{"cannotBeNull":"Field is required.","invalidCodedValue":"Value should be one of the listed values.","invalidType":"Not a valid value","invalidBatchFormType":"One or more features contain invalid values. Check individual features.","featuresInError":"One or more features have errors. Check individual features.","featuresWithInvalidValues":"One or more features have invalid values","nonVisibleError_changeValues":"The selected feature has hidden fields with invalid values. Change the values so that fields are visible.","nonVisibleError_checkIndividualFeatures":"One or more features have hidden fields with invalid values. Check individual features and correct the issues.","outsideRange":"Value should be between {min} and {max}","outsideRangeMax":"Value should be less than or equal to {max}","outsideRangeMin":"Value should be greater than or equal to {min}","tooFewSelectedChoices":"Minimum selections required: {min}","tooManySelectedChoices":"Maximum selections allowed: {max}","tooShort":"This field requires a minimum of {min} characters","valuesIncompatible":"Value is incompatible with other selected values"},"valueExpressionError":"Failed to calculate value","viewAll":"View all","subtypes":{"changeWarning":"The subtype {newType} may have different default values from {originalType}. Keeping the current values may cause unexpected results.","changeWarningTitle":"Subtype changed","useDefaultValuesOption":"Use default values","keepCurrentValuesOption":"Keep current values","unsupportedDomainGroupTitle":"Unsupported","fieldOutOfSubtypeDomainWarning":"This field's value is out of range for its domain."}}
|
|
@@ -237,12 +237,14 @@ return value * 2.0 - 1.0;
|
|
|
237
237
|
fragGlobalIllumination.rgb = vec3(0.0);
|
|
238
238
|
`)}
|
|
239
239
|
|
|
240
|
-
// Tone-map accumulated
|
|
240
|
+
// Tone-map only the accumulated RGB lighting, not alpha (inverse occlusion).
|
|
241
241
|
fragGlobalIllumination.rgb = tonemapKhronosNeutral(fragGlobalIllumination.rgb);
|
|
242
|
-
fragGlobalIllumination.rgb = quantizeGlobalIlluminationColor(fragGlobalIllumination.rgb);
|
|
243
242
|
|
|
244
243
|
// Accumulate occlusion
|
|
245
244
|
fragGlobalIllumination.a = mix(lastFrameGlobalIllumination.a + accumulationDither, fragGlobalIllumination.a, occlusionBlendWeight);
|
|
246
245
|
|
|
246
|
+
// Quantize all channels after temporal blending and dithering for consistent RGBA8 storage.
|
|
247
|
+
fragGlobalIllumination = quantizeGlobalIlluminationColor(fragGlobalIllumination);
|
|
248
|
+
|
|
247
249
|
fragWeight = vec2(occlusionBlendWeight, colorBlendWeight * storedColorBlendWeightScale);
|
|
248
250
|
`),x}const M=Object.freeze(Object.defineProperty({__proto__:null,GlobalIlluminationPassParameters:A,build:j,defaultColorBleedWeight:0,defaultEmissionBoostFactor:x,defaultFactorDaylightDirectional:C,defaultRayMarchMaxReach:E,defaultRayMarchMaxReachEmissionWeight:1,defaultRayMarchMaxSteps:16,defaultRayMarchMinReach:T,defaultRayMarchMinReachEmissionWeight:1,defaultRayMarchWorldReach:25},Symbol.toStringTag,{value:`Module`}));export{A as G,M as a,k as b,j as c,E as d,S as e,x as f,C as g,O as h,T as i,D as j,w as k};
|
|
@@ -55,10 +55,7 @@ import{create as e}from"../core/libs/gl-matrix-2/factories/vec2f64.js";import{Sc
|
|
|
55
55
|
bool shouldReuseCenterOcclusion = isScaledGlobalIllumination && centerOcclusionBlendWeight <= ${c.float(g)};
|
|
56
56
|
bool shouldSkipLowQualityBlur = !hasEmission && shouldReuseCenterOcclusion;
|
|
57
57
|
if (shouldSkipLowQualityBlur) {
|
|
58
|
-
fragColor =
|
|
59
|
-
quantizeGlobalIlluminationColor(centerGlobalIllumination.rgb),
|
|
60
|
-
centerGlobalIllumination.a
|
|
61
|
-
);
|
|
58
|
+
fragColor = quantizeGlobalIlluminationColor(centerGlobalIllumination);
|
|
62
59
|
return;
|
|
63
60
|
}
|
|
64
61
|
|
|
@@ -100,5 +97,6 @@ import{create as e}from"../core/libs/gl-matrix-2/factories/vec2f64.js";import{Sc
|
|
|
100
97
|
float dither = ditherNoise(vec4(blurredEmission, occlusion)) - ${c.float(30517578125e-15)};
|
|
101
98
|
blurredEmission += isScaledGlobalIllumination ? ${c.float(.85)} * dither : dither;
|
|
102
99
|
|
|
103
|
-
|
|
100
|
+
// Quantize both filtered lighting and inverse occlusion before RGBA8 storage.
|
|
101
|
+
fragColor = quantizeGlobalIlluminationColor(vec4(blurredEmission, occlusion));
|
|
104
102
|
`),e}const v=new p;v.useFloatBlend=!1;const y=Object.freeze(Object.defineProperty({__proto__:null,GlobalIlluminationBlurDrawParameters:g,build:_},Symbol.toStringTag,{value:`Module`}));export{g as G,y as a,_ as b};
|
|
@@ -79,4 +79,4 @@ import{ScreenSpacePass as e}from"../views/3d/webgl-engine/core/shaderLibrary/Scr
|
|
|
79
79
|
) / jointBilateralWeightSum;
|
|
80
80
|
}
|
|
81
81
|
`),l.outputs.add(`fragColor`,`vec4`,0),l.outputs.add(`fragWeight`,`vec2`,1),f.main.add(a`sampleJointBilateralUpscale(uv, fragColor, fragWeight);
|
|
82
|
-
fragColor
|
|
82
|
+
fragColor = quantizeGlobalIlluminationColor(fragColor);`),l}const m=Object.freeze(Object.defineProperty({__proto__:null,GlobalIlluminationUpscaleDrawParameters:f,build:p},Symbol.toStringTag,{value:`Module`}));export{f as G,m as a,p as b};
|
package/config.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/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://cdn.jsdelivr.net/npm/@arcgis/core@6.0.0-next.
|
|
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://cdn.jsdelivr.net/npm/@arcgis/core@6.0.0-next.6/assets`,t.defaultAssetsPath=t.assetsPath);export{t as default};
|
package/core/colorUtils.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import e from"../Color.js";import{colorGamma as t,invColorGamma as n}from"../colorUtils.js";import{shuffle as r,getRandomNumberGenerator as i}from"./arrayUtils.js";import{clone as a}from"./lang.js";import{clamp as o}from"./mathUtils.js";import{equals as s}from"./libs/gl-matrix-2/math/vec4.js";import{fromValues as c}from"./libs/gl-matrix-2/factories/vec4f64.js";function l(e){return`r`in e&&`g`in e&&`b`in e}function u(e){return`h`in e&&`s`in e&&`v`in e}function d(e){return`l`in e&&`a`in e&&`b`in e}function f(e){return`l`in e&&`c`in e&&`h`in e}function p(e){return`x`in e&&`y`in e&&`z`in e}const m=[[.4124,.3576,.1805],[.2126,.7152,.0722],[.0193,.1192,.9505]],h=[[3.2406,-1.5372,-.4986],[-.9689,1.8758,.0415],[.0557,-.204,1.057]];function g(e,t){let n=[],r,i;if(e[0].length!==t.length)throw Error(`dimensions do not match`);let a=e.length,o=e[0].length,s=0;for(r=0;r<a;r++){for(s=0,i=0;i<o;i++)s+=e[r][i]*t[i];n.push(s)}return n}function _(e){let t=[e.r/255,e.g/255,e.b/255].map(e=>e<=.04045?e/12.92:((e+.055)/1.055)**2.4),n=g(m,t);return{x:n[0]*100,y:n[1]*100,z:n[2]*100}}function v(e){let t=g(h,[e.x/100,e.y/100,e.z/100]).map(e=>{let t=e<=.0031308?e*12.92:1.055*e**(1/2.4)-.055;return Math.min(1,Math.max(t,0))});return{r:Math.round(t[0]*255),g:Math.round(t[1]*255),b:Math.round(t[2]*255)}}function y(e){let t=[e.x/95.047,e.y/100,e.z/108.883].map(e=>e>(6/29)**3?e**(1/3):1/3*(29/6)**2*e+4/29);return{l:116*t[1]-16,a:500*(t[0]-t[1]),b:200*(t[1]-t[2])}}function b(e){let t=e.l,n=e.a,r=e.b,i=[(t+16)/116+n/500,(t+16)/116,(t+16)/116-r/200].map(e=>e>6/29?e**3:3*(6/29)**2*(e-4/29));return{x:i[0]*95.047,y:i[1]*100,z:i[2]*108.883}}function x(e){let t=e.l,n=e.a,r=e.b,i=Math.sqrt(n*n+r*r),a=Math.atan2(r,n);return a=a>0?a:a+2*Math.PI,{l:t,c:i,h:a}}function S(e){let t=e.l,n=e.c,r=e.h;return{l:t,a:n*Math.cos(r),b:n*Math.sin(r)}}function C(e){return y(_(e))}function w(e){return v(b(e))}function T(e){return x(y(_(e)))}function E(e){return v(b(S(e)))}function D(e){let{r:t,g:n,b:r}=e,i=Math.max(t,n,r),a=i-Math.min(t,n,r),o=i,s=a===0?0:i===t?(n-r)/a%6:i===n?(r-t)/a+2:(t-n)/a+4,c=a===0?0:a/o;return s<0&&(s+=6),s*=60,c*=100,o*=100/255,{h:s,s:c,v:o}}function O(e){let t=(e.h+360)%360/60,n=e.s/100,r=e.v/100*255,i=r*n,a=i*(1-Math.abs(t%2-1)),o;switch(Math.floor(t)){case 0:o={r:i,g:a,b:0};break;case 1:o={r:a,g:i,b:0};break;case 2:o={r:0,g:i,b:a};break;case 3:o={r:0,g:a,b:i};break;case 4:o={r:a,g:0,b:i};break;case 5:case 6:o={r:i,g:0,b:a};break;default:o={r:0,g:0,b:0}}return o.r=Math.round(o.r+r-i),o.g=Math.round(o.g+r-i),o.b=Math.round(o.b+r-i),o}function k(e){return l(e)?e:f(e)?E(e):d(e)?w(e):p(e)?v(e):u(e)?O(e):e}function A(e){return u(e)?e:D(k(e))}function j(e){return d(e)?e:C(k(e))}function M(e){return f(e)?e:T(k(e))}function N(e){return P(e).isBright?`light`:`dark`}function P(t){let{r:n,g:r,b:i,a}=t;return a<1&&(n=Math.round(a*n+(1-a)*255),r=Math.round(a*r+(1-a)*255),i=Math.round(a*i+(1-a)*255)),new e({r:n,g:r,b:i})}function F(e,t){let{r:n,g:r,b:i}=t?.ignoreAlpha?e:P(e);return .2126*n+.7152*r+.0722*i}function I(t,n=225){return F(t,{ignoreAlpha:!0})>n?new e([0,0,0,t.a]):new e([255,255,255,t.a])}function L(e,t){let n=j(e);n.l*=1-t;let r=k(n),i=e.clone();return i.setColor(r),i.a=e.a,i}function R(e,t){let n=e.clone();return n.a*=t,n}function z(e,t){let n=A(e);n.s*=t;let r=k(n),i=e.clone();return i.setColor(r),i.a=e.a,i}function B(e,t){return e===t||e!=null&&e.equals(t)}function V(e,t){return e===t||e!=null&&t!=null&&s(e,t)}function H(e){return c(e[0],e[1],e[2],e.length>3?e[3]:1)}function U(e){return e[0]??=0,e[1]??=0,e[2]??=0,e}function W(e){return e.length=4,U(e),e[3]??=1,o(e[3],0,1),e}function G(e,t){let n=e.toUnitRGBA();return n[3]*=t,n}function K(t,n,i={}){if(t.length===0||n<=0)return[];if(t=t.map(t=>typeof t==`string`?new e(t):t),t.length===1||n===1){let e=[],r=t[0];for(let t=0;t<n;t++)e.push(r.clone());return e}if(i.shuffle&&(t=r(a(t),i.seed)),t.length>=n){let e=[],r=(t.length-1)/(n-1);for(let i=0;i<n;i++){let n=Math.round(i*r);e.push(t[n].clone())}return e}return Z(t,n,i)}function q(t,n){let r=new e(t);if(!n?.strength||n.source!==`color`)return r;let[i,a,o]=r.toUnitRGB(),s=X(i,a,o),c=J(s.r+s.r*n.strength,s.g+s.g*n.strength,s.b+s.b*n.strength,r.a),l=J(
|
|
2
|
+
import e from"../Color.js";import{colorGamma as t,invColorGamma as n}from"../colorUtils.js";import{shuffle as r,getRandomNumberGenerator as i}from"./arrayUtils.js";import{clone as a}from"./lang.js";import{clamp as o}from"./mathUtils.js";import{equals as s}from"./libs/gl-matrix-2/math/vec4.js";import{fromValues as c}from"./libs/gl-matrix-2/factories/vec4f64.js";function l(e){return`r`in e&&`g`in e&&`b`in e}function u(e){return`h`in e&&`s`in e&&`v`in e}function d(e){return`l`in e&&`a`in e&&`b`in e}function f(e){return`l`in e&&`c`in e&&`h`in e}function p(e){return`x`in e&&`y`in e&&`z`in e}const m=[[.4124,.3576,.1805],[.2126,.7152,.0722],[.0193,.1192,.9505]],h=[[3.2406,-1.5372,-.4986],[-.9689,1.8758,.0415],[.0557,-.204,1.057]];function g(e,t){let n=[],r,i;if(e[0].length!==t.length)throw Error(`dimensions do not match`);let a=e.length,o=e[0].length,s=0;for(r=0;r<a;r++){for(s=0,i=0;i<o;i++)s+=e[r][i]*t[i];n.push(s)}return n}function _(e){let t=[e.r/255,e.g/255,e.b/255].map(e=>e<=.04045?e/12.92:((e+.055)/1.055)**2.4),n=g(m,t);return{x:n[0]*100,y:n[1]*100,z:n[2]*100}}function v(e){let t=g(h,[e.x/100,e.y/100,e.z/100]).map(e=>{let t=e<=.0031308?e*12.92:1.055*e**(1/2.4)-.055;return Math.min(1,Math.max(t,0))});return{r:Math.round(t[0]*255),g:Math.round(t[1]*255),b:Math.round(t[2]*255)}}function y(e){let t=[e.x/95.047,e.y/100,e.z/108.883].map(e=>e>(6/29)**3?e**(1/3):1/3*(29/6)**2*e+4/29);return{l:116*t[1]-16,a:500*(t[0]-t[1]),b:200*(t[1]-t[2])}}function b(e){let t=e.l,n=e.a,r=e.b,i=[(t+16)/116+n/500,(t+16)/116,(t+16)/116-r/200].map(e=>e>6/29?e**3:3*(6/29)**2*(e-4/29));return{x:i[0]*95.047,y:i[1]*100,z:i[2]*108.883}}function x(e){let t=e.l,n=e.a,r=e.b,i=Math.sqrt(n*n+r*r),a=Math.atan2(r,n);return a=a>0?a:a+2*Math.PI,{l:t,c:i,h:a}}function S(e){let t=e.l,n=e.c,r=e.h;return{l:t,a:n*Math.cos(r),b:n*Math.sin(r)}}function C(e){return y(_(e))}function w(e){return v(b(e))}function T(e){return x(y(_(e)))}function E(e){return v(b(S(e)))}function D(e){let{r:t,g:n,b:r}=e,i=Math.max(t,n,r),a=i-Math.min(t,n,r),o=i,s=a===0?0:i===t?(n-r)/a%6:i===n?(r-t)/a+2:(t-n)/a+4,c=a===0?0:a/o;return s<0&&(s+=6),s*=60,c*=100,o*=100/255,{h:s,s:c,v:o}}function O(e){let t=(e.h+360)%360/60,n=e.s/100,r=e.v/100*255,i=r*n,a=i*(1-Math.abs(t%2-1)),o;switch(Math.floor(t)){case 0:o={r:i,g:a,b:0};break;case 1:o={r:a,g:i,b:0};break;case 2:o={r:0,g:i,b:a};break;case 3:o={r:0,g:a,b:i};break;case 4:o={r:a,g:0,b:i};break;case 5:case 6:o={r:i,g:0,b:a};break;default:o={r:0,g:0,b:0}}return o.r=Math.round(o.r+r-i),o.g=Math.round(o.g+r-i),o.b=Math.round(o.b+r-i),o}function k(e){return l(e)?e:f(e)?E(e):d(e)?w(e):p(e)?v(e):u(e)?O(e):e}function A(e){return u(e)?e:D(k(e))}function j(e){return d(e)?e:C(k(e))}function M(e){return f(e)?e:T(k(e))}function N(e){return P(e).isBright?`light`:`dark`}function P(t){let{r:n,g:r,b:i,a}=t;return a<1&&(n=Math.round(a*n+(1-a)*255),r=Math.round(a*r+(1-a)*255),i=Math.round(a*i+(1-a)*255)),new e({r:n,g:r,b:i})}function F(e,t){let{r:n,g:r,b:i}=t?.ignoreAlpha?e:P(e);return .2126*n+.7152*r+.0722*i}function I(t,n=225){return F(t,{ignoreAlpha:!0})>n?new e([0,0,0,t.a]):new e([255,255,255,t.a])}function L(e,t){let n=j(e);n.l*=1-t;let r=k(n),i=e.clone();return i.setColor(r),i.a=e.a,i}function R(e,t){let n=e.clone();return n.a*=t,n}function z(e,t){let n=A(e);n.s*=t;let r=k(n),i=e.clone();return i.setColor(r),i.a=e.a,i}function B(e,t){return e===t||e!=null&&e.equals(t)}function V(e,t){return e===t||e!=null&&t!=null&&s(e,t)}function H(e){return c(e[0],e[1],e[2],e.length>3?e[3]:1)}function U(e){return e[0]??=0,e[1]??=0,e[2]??=0,e}function W(e){return e.length=4,U(e),e[3]??=1,o(e[3],0,1),e}function G(e,t){let n=e.toUnitRGBA();return n[3]*=t,n}function K(t,n,i={}){if(t.length===0||n<=0)return[];if(t=t.map(t=>typeof t==`string`?new e(t):t),t.length===1||n===1){let e=[],r=t[0];for(let t=0;t<n;t++)e.push(r.clone());return e}if(i.shuffle&&(t=r(a(t),i.seed)),t.length>=n){let e=[],r=(t.length-1)/(n-1);for(let i=0;i<n;i++){let n=Math.round(i*r);e.push(t[n].clone())}return e}return Z(t,n,i)}function q(t,n){let r=new e(t);if(!n?.strength||n.source!==`color`)return r;let[i,a,o]=r.toUnitRGB(),s=X(i,a,o),c=J(s.r+s.r*n.strength,s.g+s.g*n.strength,s.b+s.b*n.strength,r.a),l=J(s.r,s.g,s.b,r.a),[u,d,f]=c.toUnitRGB(),[p,m,h]=l.toUnitRGB(),g=Y(s.r+u-p,s.g+d-m,s.b+f-h);return new e([g.r*255,g.g*255,g.b*255,r.a])}function J(t,n,r,i){let a=.76,o=Math.max(t,Math.max(n,r));if(o<a)return new e([t*255,n*255,r*255,i]);let s=.24,c=1-s*s/(o+s-a),l=c/o,u=1-1/(.15*(o-c)+1),d=new e([t*l*255,n*l*255,r*l*255,i]),f=new e([c*255,c*255,c*255,i]);return e.blendColors(d,f,u)}function Y(e,t,r){return{r:e**n,g:t**n,b:r**n}}function X(e,n,r){return{r:e**t,g:n**t,b:r**t}}function Z(e,t,n={}){let i=[],a=e.length-1,o=Math.ceil((t-e.length)/a);outerLoop:for(let r=0;r<a;r++){let a=e[r],s=e[r+1];for(let r=1;r<=o;r++){let c=r/(o+1);if(i.push($(a,s,c,n)),i.length+e.length===t)break outerLoop}}return[...e.map(e=>e.clone()),...r(i,n.seed??1)]}const Q=(e,t)=>{let n=Math.floor(t()*10)-5;return Math.min(255,Math.max(0,e+n))};function $(t,n,r,a={}){let o=t.r,s=t.g,c=t.b,l=n.r,u=n.g,d=n.b,f=Math.round(o+(l-o)*r),p=Math.round(s+(u-s)*r),m=Math.round(c+(d-c)*r);if(!a.offset)return new e([f,p,m]);let h=i(a.seed);return new e([Q(f,h),Q(p,h),Q(m,h)])}export{B as colorEquals,V as colorVectorEquals,H as colorVectorToColorAndOpacity,K as createUniqueColors,L as darken,z as desaturate,F as getColorLuminance,N as getColorTheme,q as getColorWithEmissiveStrength,I as getContrast,l as isRGB,R as multiplyOpacity,G as multiplyOpacityToUnitRGBA,A as toHSV,j as toLAB,M as toLCH,k as toRGB,U as validateColor,W as validateColorAndOpacity};
|
package/core/has.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
const e=globalThis,t={...e.esriConfig?.has};function has(n){return typeof t[n]==`function`?t[n]=t[n](e):t[n]}has.add=(e,n,r,i)=>{(i||t[e]===void 0)&&(t[e]=n),r&&has(e)},has.cache=t,has.add(`big-integer-warning-enabled`,!0),has.add(`esri-deprecation-warnings`,!0),has.add(`esri-tests-disable-screenshots`,!1),has.add(`esri-tests-use-full-window`,!1),has.add(`esri-tests-post-to-influx`,!0),has.add(`esri-cim-animations-enable-status`,`enabled`),has.add(`esri-cim-animations-spotlight`,!1),has.add(`esri-cim-animations-freeze-time`,!1),(()=>{has.add(`host-webworker`,e.WorkerGlobalScope!==void 0&&self instanceof e.WorkerGlobalScope);let t=typeof window<`u`&&typeof location<`u`&&typeof document<`u`&&window.location===location&&window.document===document;if(has.add(`host-browser`,t),has.add(`host-node`,!!(typeof e.process==`object`&&e.process.versions?.node&&e.process.versions.v8)),has.add(`dom`,t),has(`host-browser`)){let e=navigator,t=e.userAgent,n=e.appVersion,r=parseFloat(n);if(has.add(`wp`,parseFloat(t.split(`Windows Phone`)[1])||void 0),has.add(`msapp`,parseFloat(t.split(`MSAppHost/`)[1])||void 0),has.add(`khtml`,n.includes(`Konqueror`)?r:void 0),has.add(`edge`,parseFloat(t.split(`Edge/`)[1])||void 0),has.add(`opr`,parseFloat(t.split(`OPR/`)[1])||void 0),has.add(`webkit`,!has(`wp`)&&!has(`edge`)&&parseFloat(t.split(`WebKit/`)[1])||void 0),has.add(`chrome`,!has(`edge`)&&!has(`opr`)&&parseFloat(t.split(`Chrome/`)[1])||void 0),has.add(`android`,!has(`wp`)&&parseFloat(t.split(`Android `)[1])||void 0),has.add(`safari`,n.includes(`Safari`)&&!has(`wp`)&&!has(`chrome`)&&!has(`android`)&&!has(`edge`)&&!has(`opr`)?parseFloat(n.split(`Version/`)[1]):void 0),has.add(`mac`,n.includes(`Macintosh`)),!has(`wp`)&&/(iPhone|iPod|iPad)/.test(t)){let e=RegExp.$1.replace(/P/,`p`),n=/OS ([\d_]+)/.test(t)?RegExp.$1:`1`,r=parseFloat(n.replace(/_/,`.`).replaceAll(`_`,``));has.add(e,r),has.add(`ios`,r)}has(`webkit`)||(t.includes(`Gecko`)&&!has(`wp`)&&!has(`khtml`)&&!has(`edge`)&&has.add(`mozilla`,r),has(`mozilla`)&&has.add(`ff`,parseFloat(t.split(`Firefox/`)[1]||t.split(`Minefield/`)[1])||void 0))}})(),(()=>{if(e.navigator){let e=navigator.userAgent,t=/Android|webOS|iPhone|iPad|iPod|BlackBerry|Opera Mini|IEMobile/i.test(e),n=/iPhone/i.test(e);t&&has.add(`esri-mobile`,t),n&&has.add(`esri-iPhone`,n),has.add(`esri-geolocation`,!!navigator.geolocation)}has.add(`esri-wasm`,`WebAssembly`in e),has.add(`esri-temporal`,`Temporal`in e),has.add(`esri-performance-mode-frames-between-render`,20),has.add(`esri-force-performance-mode`,!1),has.add(`esri-shared-array-buffer`,()=>{let t=`SharedArrayBuffer`in e,n=e.crossOriginIsolated===!1;return t&&!n}),has.add(`wasm-simd`,()=>WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,5,1,96,0,1,123,3,2,1,0,10,10,1,8,0,65,0,253,15,253,98,11]))),has.add(`esri-atomics`,`Atomics`in e),has.add(`esri-workers`,`Worker`in e),has.add(`web-feat:cache`,`caches`in e),has.add(`esri-workers-arraybuffer-transfer`,!has(`safari`)||Number(has(`safari`))>=12),has.add(`min-workers-pool-size`,2),has.add(`max-workers-pool-size`,has(`esri-mobile`)?3:8),has.add(`featurelayer-simplify-thresholds`,[.5,.5,.5,.5]),has.add(`featurelayer-simplify-payload-size-factors`,[1,1,4]),has.add(`featurelayer-animation-enabled`,!0),has.add(`featurelayer-hybrid-tile-enabled`,!0),has.add(`featurelayer-snapshot-enabled`,!0),has.add(`featurelayer-snapshot-initial-tolerance`,0),has.add(`featurelayer-snapshot-point-min-threshold`,8e4),has.add(`featurelayer-snapshot-point-max-threshold`,4e5),has.add(`featurelayer-snapshot-multipoint-min-threshold`,2e4),has.add(`featurelayer-snapshot-multipoint-max-threshold`,1e5),has.add(`featurelayer-snapshot-polygon-min-threshold`,2e3),has.add(`featurelayer-snapshot-polygon-max-threshold`,2e3),has.add(`featurelayer-snapshot-polyline-min-threshold`,2e3),has.add(`featurelayer-snapshot-polyline-max-threshold`,2e3),has.add(`featurelayer-snapshot-max-vertex-count`,25e4),has.add(`featurelayer-snapshot-non-hosted-exceedslimit-enabled`,!0),has.add(`featurelayer-snapshot-concurrency`,4),has.add(`featurelayer-snapshot-allow-editable`,!1),has.add(`featurelayer-snapshot-coverage`,.1),has.add(`featurelayer-pixel-buffering-enabled`,!0),has.add(`featurelayer-query-max-depth`,4),has.add(`featurelayer-query-max-page-size`,8e3),has.add(`featurelayer-query-pausing-enabled`,!1),has.add(`featurelayer-query-tile-concurrency`,4),has.add(`featurelayer-query-tile-max-features`,6e5),has.add(`featurelayer-advanced-symbols`,!1),has.add(`featurelayer-pbf`,!0),has.add(`featurelayer-pbf-statistics`,!1),has.add(`featurelayer-pbf-true-curves`,!0),has.add(`feature-layers-workers`,!0),has.add(`feature-polyline-generalization-factor`,1),has.add(`featurelayer-relative-time-queries-enabled`,!0),has.add(`featurelayer-relative-time-queries-bin-window-public`,1),has.add(`featurelayer-relative-time-queries-bin-window-private`,60),has.add(`parquetlayer-full-query-feature-count`,5e5),has.add(`parquetlayer-persistence-enabled`,!0),has.add(`parquetlayer-cache-enabled`,!0),has.add(`parquetlayer-legacy-field-overrides-enabled`,!1),has.add(`sketch-layer-enabled`,!1),has.add(`mapview-transitions-duration`,200),has.add(`mapview-essential-goto-duration`,200),has.add(`mapview-srswitch-adjust-rotation-scale-threshold`,24e6),has.add(`mapserver-pbf-version-support`,10.81),has.add(`mapservice-popup-identify-max-tolerance`,20),has.add(`request-queue-concurrency-global`,64),has.add(`request-queue-concurrency-hosted`,16),has.add(`request-queue-concurrency-non-hosted`,16),has.add(`curve-densification-coarse-segments`,128),has.add(`curve-densification-max-segments`,2e3),has.add(`curve-densification-min-segments`,3),has.add(`curve-densification-pixel-deviation`,.5),has.add(`view-readyState-waiting-delay`,1e3),has.add(`gradient-depth-bias`,.01),has.add(`gradient-depth-epsilon`,1e-8),has.add(`enable-feature:esri-compress-textures`,!0),has.add(`enable-feature:im-shading`,!0),has.add(`enable-feature:im-vertex-normals`,!0),!has(`host-webworker`)&&has(`host-browser`)&&(has.add(`esri-csp-restrictions`,()=>{try{Function()}catch{return!0}return!1}),has.add(`esri-url-encodes-apostrophe`,()=>{let e=window.document.createElement(`a`);return e.href=`?'`,e.href.includes(`?%27`)}))})();export{has as default};
|
|
2
|
+
const e=globalThis,t={...e.esriConfig?.has};function has(n){return typeof t[n]==`function`?t[n]=t[n](e):t[n]}has.add=(e,n,r,i)=>{(i||t[e]===void 0)&&(t[e]=n),r&&has(e)},has.cache=t,has.add(`big-integer-warning-enabled`,!0),has.add(`esri-deprecation-warnings`,!0),has.add(`esri-tests-disable-screenshots`,!1),has.add(`esri-tests-use-full-window`,!1),has.add(`esri-tests-post-to-influx`,!0),has.add(`esri-cim-animations-enable-status`,`enabled`),has.add(`esri-cim-animations-spotlight`,!1),has.add(`esri-cim-animations-freeze-time`,!1),(()=>{has.add(`host-webworker`,e.WorkerGlobalScope!==void 0&&self instanceof e.WorkerGlobalScope);let t=typeof window<`u`&&typeof location<`u`&&typeof document<`u`&&window.location===location&&window.document===document;if(has.add(`host-browser`,t),has.add(`host-node`,!!(typeof e.process==`object`&&e.process.versions?.node&&e.process.versions.v8)),has.add(`dom`,t),has(`host-browser`)){let e=navigator,t=e.userAgent,n=e.appVersion,r=parseFloat(n);if(has.add(`wp`,parseFloat(t.split(`Windows Phone`)[1])||void 0),has.add(`msapp`,parseFloat(t.split(`MSAppHost/`)[1])||void 0),has.add(`khtml`,n.includes(`Konqueror`)?r:void 0),has.add(`edge`,parseFloat(t.split(`Edge/`)[1])||void 0),has.add(`opr`,parseFloat(t.split(`OPR/`)[1])||void 0),has.add(`webkit`,!has(`wp`)&&!has(`edge`)&&parseFloat(t.split(`WebKit/`)[1])||void 0),has.add(`chrome`,!has(`edge`)&&!has(`opr`)&&parseFloat(t.split(`Chrome/`)[1])||void 0),has.add(`android`,!has(`wp`)&&parseFloat(t.split(`Android `)[1])||void 0),has.add(`safari`,n.includes(`Safari`)&&!has(`wp`)&&!has(`chrome`)&&!has(`android`)&&!has(`edge`)&&!has(`opr`)?parseFloat(n.split(`Version/`)[1]):void 0),has.add(`mac`,n.includes(`Macintosh`)),!has(`wp`)&&/(iPhone|iPod|iPad)/.test(t)){let e=RegExp.$1.replace(/P/,`p`),n=/OS ([\d_]+)/.test(t)?RegExp.$1:`1`,r=parseFloat(n.replace(/_/,`.`).replaceAll(`_`,``));has.add(e,r),has.add(`ios`,r)}has(`webkit`)||(t.includes(`Gecko`)&&!has(`wp`)&&!has(`khtml`)&&!has(`edge`)&&has.add(`mozilla`,r),has(`mozilla`)&&has.add(`ff`,parseFloat(t.split(`Firefox/`)[1]||t.split(`Minefield/`)[1])||void 0))}})(),(()=>{if(e.navigator){let e=navigator.userAgent,t=/Android|webOS|iPhone|iPad|iPod|BlackBerry|Opera Mini|IEMobile/i.test(e),n=/iPhone/i.test(e);t&&has.add(`esri-mobile`,t),n&&has.add(`esri-iPhone`,n),has.add(`esri-geolocation`,!!navigator.geolocation)}has.add(`esri-wasm`,`WebAssembly`in e),has.add(`esri-temporal`,`Temporal`in e),has.add(`esri-performance-mode-frames-between-render`,20),has.add(`esri-force-performance-mode`,!1),has.add(`esri-shared-array-buffer`,()=>{let t=`SharedArrayBuffer`in e,n=e.crossOriginIsolated===!1;return t&&!n}),has.add(`wasm-simd`,()=>WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,5,1,96,0,1,123,3,2,1,0,10,10,1,8,0,65,0,253,15,253,98,11]))),has.add(`esri-atomics`,`Atomics`in e),has.add(`esri-workers`,`Worker`in e),has.add(`web-feat:cache`,`caches`in e),has.add(`esri-workers-arraybuffer-transfer`,!has(`safari`)||Number(has(`safari`))>=12),has.add(`min-workers-pool-size`,2),has.add(`max-workers-pool-size`,has(`esri-mobile`)?3:8),has.add(`featurelayer-simplify-thresholds`,[.5,.5,.5,.5]),has.add(`featurelayer-simplify-payload-size-factors`,[1,1,4]),has.add(`featurelayer-animation-enabled`,!0),has.add(`featurelayer-hybrid-tile-enabled`,!0),has.add(`featurelayer-snapshot-enabled`,!0),has.add(`featurelayer-snapshot-initial-tolerance`,0),has.add(`featurelayer-snapshot-point-min-threshold`,8e4),has.add(`featurelayer-snapshot-point-max-threshold`,4e5),has.add(`featurelayer-snapshot-multipoint-min-threshold`,2e4),has.add(`featurelayer-snapshot-multipoint-max-threshold`,1e5),has.add(`featurelayer-snapshot-polygon-min-threshold`,2e3),has.add(`featurelayer-snapshot-polygon-max-threshold`,2e3),has.add(`featurelayer-snapshot-polyline-min-threshold`,2e3),has.add(`featurelayer-snapshot-polyline-max-threshold`,2e3),has.add(`featurelayer-snapshot-max-vertex-count`,25e4),has.add(`featurelayer-snapshot-non-hosted-exceedslimit-enabled`,!0),has.add(`featurelayer-snapshot-concurrency`,4),has.add(`featurelayer-snapshot-allow-editable`,!1),has.add(`featurelayer-snapshot-coverage`,.1),has.add(`featurelayer-pixel-buffering-enabled`,!0),has.add(`featurelayer-query-max-depth`,4),has.add(`featurelayer-query-max-page-size`,8e3),has.add(`featurelayer-query-pausing-enabled`,!1),has.add(`featurelayer-query-tile-concurrency`,4),has.add(`featurelayer-query-tile-max-features`,6e5),has.add(`featurelayer-snapping-density-sample-interval`,10),has.add(`featurelayer-snapping-density-max-vertices-per-feature`,16),has.add(`featurelayer-snapping-density-max-distance`,8),has.add(`featurelayer-advanced-symbols`,!1),has.add(`featurelayer-pbf`,!0),has.add(`featurelayer-pbf-statistics`,!1),has.add(`featurelayer-pbf-true-curves`,!0),has.add(`feature-layers-workers`,!0),has.add(`feature-polyline-generalization-factor`,1),has.add(`featurelayer-relative-time-queries-enabled`,!0),has.add(`featurelayer-relative-time-queries-bin-window-public`,1),has.add(`featurelayer-relative-time-queries-bin-window-private`,60),has.add(`parquetlayer-full-query-feature-count`,5e5),has.add(`parquetlayer-persistence-enabled`,!0),has.add(`parquetlayer-cache-enabled`,!0),has.add(`parquetlayer-legacy-field-overrides-enabled`,!1),has.add(`sketch-layer-enabled`,!1),has.add(`mapview-transitions-duration`,200),has.add(`mapview-essential-goto-duration`,200),has.add(`mapview-srswitch-adjust-rotation-scale-threshold`,24e6),has.add(`mapserver-pbf-version-support`,10.81),has.add(`mapservice-popup-identify-max-tolerance`,20),has.add(`request-queue-concurrency-global`,64),has.add(`request-queue-concurrency-hosted`,16),has.add(`request-queue-concurrency-non-hosted`,16),has.add(`curve-densification-coarse-segments`,128),has.add(`curve-densification-max-segments`,2e3),has.add(`curve-densification-min-segments`,3),has.add(`curve-densification-pixel-deviation`,.5),has.add(`view-readyState-waiting-delay`,1e3),has.add(`gradient-depth-bias`,.01),has.add(`gradient-depth-epsilon`,1e-8),has.add(`enable-feature:esri-compress-textures`,!0),has.add(`enable-feature:im-shading`,!0),has.add(`enable-feature:im-vertex-normals`,!0),!has(`host-webworker`)&&has(`host-browser`)&&(has.add(`esri-csp-restrictions`,()=>{try{Function()}catch{return!0}return!1}),has.add(`esri-url-encodes-apostrophe`,()=>{let e=window.document.createElement(`a`);return e.href=`?'`,e.href.includes(`?%27`)}))})();export{has as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{getAssetUrl as e}from"../../assets.js";import t from"../../config.js";import{getLocale as n}from"../../intl.js";import{fullVersion as r}from"../../kernel.js";import has from"../has.js";import i from"../Logger.js";import{makeAbsolute as a}from"../urlUtils.js";import{loaderConfig as o}from"./loaderConfig.js";import{receiveMessage as s,MessageType as c}from"./utils.js";import l from"./WorkerFallback.js";const u=()=>i.getLogger(`esri.core.workers.workerFactory`),{HANDSHAKE:d}=c;let f,p;const m=`Failed to create Worker. Fallback to execute module in main thread`;async function h(){if(!has(`esri-workers`))return g(new l);if(!f&&!p)try{let e='"use strict";let globalId=0;const outgoing=new Map,configuration={CONFIGURATION};self.esriConfig=configuration.esriConfig;const workerPath=self.esriConfig.workers.workerPath,HANDSHAKE=0,OPEN=1,OPENED=2,RESPONSE=3,INVOKE=4,ABORT=5;function createAbortError(){const e=new Error("Aborted");return e.name="AbortError",e}function receiveMessage(e){return e&&e.data?"string"==typeof e.data?JSON.parse(e.data):e.data:null}self.invokeStaticMessage=(e,o,r)=>{const t=r&&r.signal,n=globalId++;let s=null;return new Promise((r,i)=>{if(t){if(t.aborted)return i(createAbortError());s=()=>{outgoing.get(n)&&(outgoing.delete(n),self.postMessage({type:5,jobId:n}),i(createAbortError()))},t.addEventListener("abort",s)}outgoing.set(n,{resolve:r,reject:i}),self.postMessage({type:4,jobId:n,methodName:e,abortable:null!=t,data:o})}).finally(()=>{t&&t.removeEventListener("abort",s)})};let workerVersionChecked=!1;function checkWorkerVersion(e){if(!workerVersionChecked&&e.kernelInfo){workerVersionChecked=!0;const{fullVersion:o}=configuration.kernelInfo,{fullVersion:r,version:t}=e.kernelInfo;esriConfig.assetsPath!==esriConfig.defaultAssetsPath&&o!==r&&console.warn(`Version mismatch detected between ArcGIS Maps SDK for JavaScript modules and assets. For more information visit https://esriurl.com/using-local-assets.\\nModules version: ${o}\\nAssets version: ${r??t}\\nAssets path: ${esriConfig.assetsPath}`)}}function messageHandler(e){const o=receiveMessage(e);if(!o)return;const r=o.jobId;switch(o.type){case 1:let t;function n(e){const o=t.connect(e);self.postMessage({type:2,jobId:r,data:o},[o])}"function"==typeof define&&define.amd?require([workerPath],e=>{t=e.default||e,checkWorkerVersion(t),t.loadWorker(o.modulePath).then(e=>e||new Promise(e=>{require([o.modulePath],e)})).then(n)}):"System"in self&&"function"==typeof System.import?System.import(workerPath).then(e=>(t=e.default,checkWorkerVersion(t),t.loadWorker(o.modulePath))).then(e=>e||System.import(o.modulePath)).then(n):esriConfig.workers.useDynamicImport?import(workerPath).then(e=>{t=e.default||e,checkWorkerVersion(t),t.loadWorker(o.modulePath).then(e=>e||import(o.modulePath)).then(n)}):(self.RemoteClient||importScripts(workerPath),t=self.RemoteClient.default||self.RemoteClient,checkWorkerVersion(t),t.loadWorker(o.modulePath).then(n));break;case 3:if(outgoing.has(r)){const s=outgoing.get(r);outgoing.delete(r),o.error?s.reject(JSON.parse(o.error)):s.resolve(o.data)}}}self.dojoConfig=configuration.loaderConfig,esriConfig.workers.loaderUrl&&(self.importScripts(esriConfig.workers.loaderUrl),"function"==typeof require&&"function"==typeof require.config&&require.config(configuration.loaderConfig)),self.addEventListener("message",messageHandler),self.postMessage({type:0});'.split(`{CONFIGURATION}`).join(_());f=URL.createObjectURL(new Blob([e],{type:`text/javascript`}))}catch(e){p=e||{}}let e;if(!f)u().warn(m,p),e=new l;else try{e=new Worker(f,{name:`esri-worker-${v++}`})}catch{u().warn(m,p),e=new l}return g(e)}async function g(e){return new Promise(t=>{function n(i){let a=s(i);a&&a.type===d&&(e.removeEventListener(`message`,n),e.removeEventListener(`error`,r),t(e))}function r(t){t.preventDefault(),e.removeEventListener(`message`,n),e.removeEventListener(`error`,r),u().warn(`Failed to create Worker. Fallback to execute module in main thread`,t),e=new l,e.addEventListener(`message`,n),e.addEventListener(`error`,r)}e.addEventListener(`message`,n),e.addEventListener(`error`,r)})}function _(){let i;if(t.default!=null){let e={...t};delete e.default,i=JSON.parse(JSON.stringify(e))}else i=JSON.parse(JSON.stringify(t));i.assetsPath=a(i.assetsPath),i.defaultAssetsPath=i.defaultAssetsPath?a(i.defaultAssetsPath):void 0,i.request.interceptors=[],i.log.interceptors=[],i.locale=n(),i.has={"esri-csp-restrictions":has(`esri-csp-restrictions`),"esri-2d-debug":!1,"esri-2d-update-debug":has(`esri-2d-update-debug`),"esri-2d-annotation-dimension-debug":has(`esri-2d-annotation-dimension-debug`),"esri-2d-log-updating":!1,"esri-2d-complex-shaping":has(`esri-2d-complex-shaping`),"esri-2d-force-complex-shaping":has(`esri-2d-force-complex-shaping`),"esri-2d-stabilize-glyphs":has(`esri-2d-stabilize-glyphs`),"featurelayer-pbf":has(`featurelayer-pbf`),"featurelayer-simplify-thresholds":has(`featurelayer-simplify-thresholds`),"featurelayer-simplify-payload-size-factors":has(`featurelayer-simplify-payload-size-factors`),"featurelayer-simplify-mobile-factor":has(`featurelayer-simplify-mobile-factor`),"featurelayer-query-max-depth":has(`featurelayer-query-max-depth`),"featurelayer-query-max-page-size":has(`featurelayer-query-max-page-size`),"featurelayer-query-tile-max-features":has(`featurelayer-query-tile-max-features`),"featurelayer-query-tile-concurrency":has(`featurelayer-query-tile-concurrency`),"featurelayer-query-pausing-enabled":has(`featurelayer-query-pausing-enabled`),"featurelayer-snapshot-concurrency":has(`featurelayer-snapshot-concurrency`),"featurelayer-snapshot-enabled":has(`featurelayer-snapshot-enabled`),"featurelayer-pixel-buffering-enabled":has(`featurelayer-pixel-buffering-enabled`),"parquetlayer-full-query-feature-count":has(`parquetlayer-full-query-feature-count`),"parquetlayer-cache-enabled":has(`parquetlayer-cache-enabled`),"parquetlayer-legacy-field-overrides-enabled":has(`parquetlayer-legacy-field-overrides-enabled`),"esri-atomics":has(`esri-atomics`),"esri-shared-array-buffer":has(`esri-shared-array-buffer`),"esri-tiles-debug":has(`esri-tiles-debug`),"esri-workers-arraybuffer-transfer":has(`esri-workers-arraybuffer-transfer`),"feature-polyline-generalization-factor":has(`feature-polyline-generalization-factor`),"host-webworker":1},i.workers.loaderUrl&&(i.workers.loaderUrl=a(i.workers.loaderUrl)),i.workers.workerPath?i.workers.workerPath=a(i.workers.workerPath):i.workers.workerPath=a(e(`esri/core/workers/RemoteClient.js`)),i.workers.useDynamicImport=has(`esri-esbuild-build`);let s=t.workers.loaderConfig,c=o({baseUrl:s?.baseUrl,locale:n(),has:{"csp-restrictions":1,"dojo-test-sniff":0,"host-webworker":1,...s?.has},map:{...s?.map},paths:{...s?.paths},packages:s?.packages||[]});return JSON.stringify({esriConfig:i,loaderConfig:c,kernelInfo:{fullVersion:r}})}let v=0;export{h as createWorker};
|
|
2
|
+
import{getAssetUrl as e}from"../../assets.js";import t from"../../config.js";import{getLocale as n}from"../../intl.js";import{fullVersion as r}from"../../kernel.js";import has from"../has.js";import i from"../Logger.js";import{makeAbsolute as a}from"../urlUtils.js";import{loaderConfig as o}from"./loaderConfig.js";import{receiveMessage as s,MessageType as c}from"./utils.js";import l from"./WorkerFallback.js";const u=()=>i.getLogger(`esri.core.workers.workerFactory`),{HANDSHAKE:d}=c;let f,p;const m=`Failed to create Worker. Fallback to execute module in main thread`;async function h(){if(!has(`esri-workers`))return g(new l);if(!f&&!p)try{let e='"use strict";let globalId=0;const outgoing=new Map,configuration={CONFIGURATION};self.esriConfig=configuration.esriConfig;const workerPath=self.esriConfig.workers.workerPath,HANDSHAKE=0,OPEN=1,OPENED=2,RESPONSE=3,INVOKE=4,ABORT=5;function createAbortError(){const e=new Error("Aborted");return e.name="AbortError",e}function receiveMessage(e){return e&&e.data?"string"==typeof e.data?JSON.parse(e.data):e.data:null}self.invokeStaticMessage=(e,o,r)=>{const t=r&&r.signal,n=globalId++;let s=null;return new Promise((r,i)=>{if(t){if(t.aborted)return i(createAbortError());s=()=>{outgoing.get(n)&&(outgoing.delete(n),self.postMessage({type:5,jobId:n}),i(createAbortError()))},t.addEventListener("abort",s)}outgoing.set(n,{resolve:r,reject:i}),self.postMessage({type:4,jobId:n,methodName:e,abortable:null!=t,data:o})}).finally(()=>{t&&t.removeEventListener("abort",s)})};let workerVersionChecked=!1;function checkWorkerVersion(e){if(!workerVersionChecked&&e.kernelInfo){workerVersionChecked=!0;const{fullVersion:o}=configuration.kernelInfo,{fullVersion:r,version:t}=e.kernelInfo;esriConfig.assetsPath!==esriConfig.defaultAssetsPath&&o!==r&&console.warn(`Version mismatch detected between ArcGIS Maps SDK for JavaScript modules and assets. For more information visit https://esriurl.com/using-local-assets.\\nModules version: ${o}\\nAssets version: ${r??t}\\nAssets path: ${esriConfig.assetsPath}`)}}function messageHandler(e){const o=receiveMessage(e);if(!o)return;const r=o.jobId;switch(o.type){case 1:let t;function n(e){const o=t.connect(e);self.postMessage({type:2,jobId:r,data:o},[o])}"function"==typeof define&&define.amd?require([workerPath],e=>{t=e.default||e,checkWorkerVersion(t),t.loadWorker(o.modulePath).then(e=>e||new Promise(e=>{require([o.modulePath],e)})).then(n)}):"System"in self&&"function"==typeof System.import?System.import(workerPath).then(e=>(t=e.default,checkWorkerVersion(t),t.loadWorker(o.modulePath))).then(e=>e||System.import(o.modulePath)).then(n):esriConfig.workers.useDynamicImport?import(workerPath).then(e=>{t=e.default||e,checkWorkerVersion(t),t.loadWorker(o.modulePath).then(e=>e||import(o.modulePath)).then(n)}):(self.RemoteClient||importScripts(workerPath),t=self.RemoteClient.default||self.RemoteClient,checkWorkerVersion(t),t.loadWorker(o.modulePath).then(n));break;case 3:if(outgoing.has(r)){const s=outgoing.get(r);outgoing.delete(r),o.error?s.reject(JSON.parse(o.error)):s.resolve(o.data)}}}self.dojoConfig=configuration.loaderConfig,esriConfig.workers.loaderUrl&&(self.importScripts(esriConfig.workers.loaderUrl),"function"==typeof require&&"function"==typeof require.config&&require.config(configuration.loaderConfig)),self.addEventListener("message",messageHandler),self.postMessage({type:0});'.split(`{CONFIGURATION}`).join(_());f=URL.createObjectURL(new Blob([e],{type:`text/javascript`}))}catch(e){p=e||{}}let e;if(!f)u().warn(m,p),e=new l;else try{e=new Worker(f,{name:`esri-worker-${v++}`})}catch{u().warn(m,p),e=new l}return g(e)}async function g(e){return new Promise(t=>{function n(i){let a=s(i);a&&a.type===d&&(e.removeEventListener(`message`,n),e.removeEventListener(`error`,r),t(e))}function r(t){t.preventDefault(),e.removeEventListener(`message`,n),e.removeEventListener(`error`,r),u().warn(`Failed to create Worker. Fallback to execute module in main thread`,t),e=new l,e.addEventListener(`message`,n),e.addEventListener(`error`,r)}e.addEventListener(`message`,n),e.addEventListener(`error`,r)})}function _(){let i;if(t.default!=null){let e={...t};delete e.default,i=JSON.parse(JSON.stringify(e))}else i=JSON.parse(JSON.stringify(t));i.assetsPath=a(i.assetsPath),i.defaultAssetsPath=i.defaultAssetsPath?a(i.defaultAssetsPath):void 0,i.request.interceptors=[],i.log.interceptors=[],i.locale=n(),i.has={"esri-csp-restrictions":has(`esri-csp-restrictions`),"esri-2d-debug":!1,"esri-2d-update-debug":has(`esri-2d-update-debug`),"esri-2d-annotation-dimension-debug":has(`esri-2d-annotation-dimension-debug`),"esri-2d-log-updating":!1,"esri-2d-complex-shaping":has(`esri-2d-complex-shaping`),"esri-2d-force-complex-shaping":has(`esri-2d-force-complex-shaping`),"esri-2d-stabilize-glyphs":has(`esri-2d-stabilize-glyphs`),"featurelayer-pbf":has(`featurelayer-pbf`),"featurelayer-snapping-density-sample-interval":has(`featurelayer-snapping-density-sample-interval`),"featurelayer-snapping-density-max-vertices-per-feature":has(`featurelayer-snapping-density-max-vertices-per-feature`),"featurelayer-snapping-density-max-distance":has(`featurelayer-snapping-density-max-distance`),"featurelayer-simplify-thresholds":has(`featurelayer-simplify-thresholds`),"featurelayer-simplify-payload-size-factors":has(`featurelayer-simplify-payload-size-factors`),"featurelayer-simplify-mobile-factor":has(`featurelayer-simplify-mobile-factor`),"featurelayer-query-max-depth":has(`featurelayer-query-max-depth`),"featurelayer-query-max-page-size":has(`featurelayer-query-max-page-size`),"featurelayer-query-tile-max-features":has(`featurelayer-query-tile-max-features`),"featurelayer-query-tile-concurrency":has(`featurelayer-query-tile-concurrency`),"featurelayer-query-pausing-enabled":has(`featurelayer-query-pausing-enabled`),"featurelayer-snapshot-concurrency":has(`featurelayer-snapshot-concurrency`),"featurelayer-snapshot-enabled":has(`featurelayer-snapshot-enabled`),"featurelayer-pixel-buffering-enabled":has(`featurelayer-pixel-buffering-enabled`),"parquetlayer-full-query-feature-count":has(`parquetlayer-full-query-feature-count`),"parquetlayer-cache-enabled":has(`parquetlayer-cache-enabled`),"parquetlayer-legacy-field-overrides-enabled":has(`parquetlayer-legacy-field-overrides-enabled`),"esri-atomics":has(`esri-atomics`),"esri-shared-array-buffer":has(`esri-shared-array-buffer`),"esri-tiles-debug":has(`esri-tiles-debug`),"esri-workers-arraybuffer-transfer":has(`esri-workers-arraybuffer-transfer`),"feature-polyline-generalization-factor":has(`feature-polyline-generalization-factor`),"host-webworker":1},i.workers.loaderUrl&&(i.workers.loaderUrl=a(i.workers.loaderUrl)),i.workers.workerPath?i.workers.workerPath=a(i.workers.workerPath):i.workers.workerPath=a(e(`esri/core/workers/RemoteClient.js`)),i.workers.useDynamicImport=has(`esri-esbuild-build`);let s=t.workers.loaderConfig,c=o({baseUrl:s?.baseUrl,locale:n(),has:{"csp-restrictions":1,"dojo-test-sniff":0,"host-webworker":1,...s?.has},map:{...s?.map},paths:{...s?.paths},packages:s?.packages||[]});return JSON.stringify({esriConfig:i,loaderConfig:c,kernelInfo:{fullVersion:r}})}let v=0;export{h as createWorker};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import e from"../core/Error.js";import{throwIfAborted as t,waitTick as n}from"../core/promiseUtils.js";import{trackAccess as r}from"../core/accessorSupport/tracking.js";import{SimpleObservable as i}from"../core/accessorSupport/tracking/SimpleObservable.js";import{create as a}from"../core/libs/gl-matrix-2/factories/vec3f64.js";import{assertNotMeshes as o,assertNotMesh as s}from"./asserts.js";import{isSphericalECEF as c,isSphericalPCPF as l}from"./ellipsoidUtils.js";import u from"./Extent.js";import d from"./Geometry.js";import f from"./Multipoint.js";import p from"./Point.js";import ee from"./Polygon.js";import
|
|
2
|
+
import e from"../core/Error.js";import{throwIfAborted as t,waitTick as n}from"../core/promiseUtils.js";import{trackAccess as r}from"../core/accessorSupport/tracking.js";import{SimpleObservable as i}from"../core/accessorSupport/tracking/SimpleObservable.js";import{create as a}from"../core/libs/gl-matrix-2/factories/vec3f64.js";import{assertNotMeshes as o,assertNotMesh as s}from"./asserts.js";import{isSphericalECEF as c,isSphericalPCPF as l}from"./ellipsoidUtils.js";import u from"./Extent.js";import d from"./Geometry.js";import f from"./Multipoint.js";import p from"./Point.js";import ee from"./Polygon.js";import te from"./Polyline.js";import m from"./SpatialReference.js";import{WGS84ECEFSpatialReference as h}from"./spatialReferenceEllipsoidUtils.js";import g from"./operators/support/GeographicTransformation.js";import{projectBuffer as _}from"./projection/projectBuffer.js";import{projectionUtilsState as v}from"./projection/projectionUtilsState.js";import{getProjector as ne}from"./projection/projectors.js";import{projectXYZToVector as y}from"./projection/projectXYZToVector.js";import{isPoint as b,isExtent as x,isPolygon as re,isPolyline as ie,isMultipoint as ae}from"./support/jsonTypeUtils.js";import{fromJSON as S}from"./support/jsonUtils.js";import{equals as C,isValid as w,isWGS84 as T,isWebMercator as E,isCGCS2000 as D}from"./support/spatialReferenceUtils.js";import{isEllipticArc as O,isCircularArc as k,isBezierCurve as A,getEndpoint as j}from"./support/curves/curveUtils.js";const M=new i;function N(){let{projectOperator:e,jsonProjectOperator:t,geographicTransformationUtils:n}=v;return!!(e?.projectIsLoaded()&&t?.projectIsLoaded()&&n?.isLoaded())}function P(){return N()?!0:(r(M),F(),!1)}function oe(e,t){return!e||!t||U(e,t)||P()}function se(e,t){return!U(e,t)&&!N()}async function F(e){v.loadPromise??(v.loadPromise=Promise.all([import(`./operators/projectOperator.js`).then(e=>(v.projectOperator=e,e.projectLoad())),import(`./operators/json/projectOperator.js`).then(e=>(v.jsonProjectOperator=e,e.projectLoad())),import(`./operators/support/geographicTransformationUtils.js`).then(e=>(v.geographicTransformationUtils=e,e.load()))])),await v.loadPromise,t(e),M.notify()}function I(e,t,n){return Array.isArray(e)?e.length===0?[]:(o(e),L(e,e[0].spatialReference,t,n)):(s(e),L([e],e.spatialReference,t,n)[0])}function L(e,t,n,r){if(t==null||n==null)return e.map(e=>S(e));if(U(t,n,r))return e.map(e=>W(e,t,n));if(r?.geographicTransformation==null&&c(t))return L(e.map(e=>W(e,t,m.WGS84)),m.WGS84,n,{zConversionDisabled:r?.zConversionDisabled});if(r?.geographicTransformation==null&&c(n))return L(e,t,m.WGS84).map(e=>W(e,m.WGS84,n));if(!N())throw new B;let{geographicTransformationUtils:i,defaultTransformations:a}=v;if(!r?.geographicTransformation){if(r?.extendedParams)r={...r,geographicTransformation:i.getTransformation(t,n,r.areaOfInterestExtent)||new g};else if(!r?.areaOfInterestExtent){let e=ce(t,n),o=a[e];o||(o=i.getTransformation(t,n)||new g,a[e]=o),r={geographicTransformation:o,zConversionDisabled:r?.zConversionDisabled}}}return e[0].spatialReference||(e[0].spatialReference=t),e[0]instanceof d?v.projectOperator.projectExecuteMany(e,n,r):v.jsonProjectOperator.projectExecuteMany(e,n,r)}function ce(e,t){return[e.wkid?.toString()??`-1`,e.wkt?.toString()??``,e.wkt2?.toString()??``,t.wkid?.toString()??`-1`,t.wkt?.toString()??``,t.wkt2?.toString()??``].join()}function le(e,t,n){try{return I(e,t,n)}catch{return null}}function R(e,t){let n=z([e],t);return n.pending==null?n.geometries==null?{pending:null,geometry:null}:{pending:null,geometry:n.geometries[0]}:{pending:n.pending,geometry:null}}function z(e,t,n){if(!N()){for(let n of e)if(n!=null&&!C(n.spatialReference,t)&&w(n.spatialReference)&&w(t)&&!U(n.spatialReference,t))return r(M),{pending:F(),geometries:null}}return{pending:null,geometries:e.map(e=>e==null?null:C(e.spatialReference,t)?S(e):!w(e.spatialReference)||!w(t)?null:I(e,t,n))}}class B extends e{constructor(){super(`projection:not-loaded`,`projection engine not fully loaded yet, please call load()`)}}const V={get loadPromise(){return v.loadPromise}};async function H(e,n,r){if(t(r),!e)return e;let i=z(Array.isArray(e)?e:[e],n,r);if(i.pending)return await i.pending,t(r),H(e,n,r);let a=i.geometries??[];return Array.isArray(e)?a:a[0]}function U(e,t,n){return n?.areaOfInterestExtent||n?.extendedParams||n?.geographicTransformation?!1:C(e,t)?!0:w(e)&&w(t)&&!!ne(e,t)}function ue(e,t){if(C(e,t))return!0;if(!w(e)||!w(t))return!1;let n=T(e)||E(e)||D(e),r=T(t)||E(t)||D(t);return n&&r}async function de(e,t,r,i){if(N())return n(i);if(Array.isArray(e)){for(let{source:t,dest:n,options:r}of e)if(t&&n&&!U(t,n,r))return F(i)}else if(e&&t&&!U(e,t,r))return F(i);return n(i)}function W(e,t,n){return e?b(e)?G(e,t,new p,n,0):x(e)?Y(e,t,new u,n,0):re(e)?J(e,t,new ee,n,0):ie(e)?q(e,t,new te,n,0):ae(e)?K(e,t,new f,n,0):null:null}function fe(e,t,n=t.spatialReference,r=0){return n!=null&&e.spatialReference!=null&&G(e,e.spatialReference,t,n,r)!=null}function G(e,t,n,r,i){$[0]=e.x,$[1]=e.y;let a=e.z;return $[2]=a===void 0?i:a,_($,t,0,$,r,0)?(n.x=$[0],n.y=$[1],n.spatialReference=r,a===void 0&&!l(r)?(n.z=void 0,n.hasZ=!1):(n.z=$[2],n.hasZ=!0),e.m===void 0?(n.m=void 0,n.hasM=!1):(n.m=e.m,n.hasM=!0),n):null}function pe(e,t,n=t.spatialReference,r=0){return e.spatialReference!=null&&n!=null&&K(e,e.spatialReference,t,n,r)!=null}function K(e,t,n,r,i){let{points:a,hasZ:o,hasM:s}=e,c=[],l=a.length,u=[];for(let e of a)u.push(e[0],e[1],o?e[2]:i);if(!_(u,t,0,u,r,0,l))return null;let d=Q(o,r);for(let e=0;e<l;++e){let t=e*3,n=u[t],r=u[t+1];d&&s?c.push([n,r,u[t+2],a[e][3]]):d?c.push([n,r,u[t+2]]):s?c.push([n,r,a[e][2]]):c.push([n,r])}return n.points=c,n.spatialReference=r,n.hasZ=o,n.hasM=s,n}function me(e,t,n=t.spatialReference,r=0){return e.spatialReference!=null&&n!=null&&q(e,e.spatialReference,t,n,r)!=null}function q(e,t,n,r,i){let{curvePaths:a,paths:o,hasZ:s,hasM:c}=e;if(!(a?Z(a,s??!1,c??!1,t,n.curvePaths=[],r,i):X(o,s??!1,c??!1,t,n.paths,r,i)))return null;let l=Q(s,r);return n.spatialReference=r,n.hasZ=l,n.hasM=c,n}function he(e,t,n=t.spatialReference,r=0){return e.spatialReference!=null&&n!=null&&J(e,e.spatialReference,t,n,r)!=null}function J(e,t,n,r,i){let{curveRings:a,rings:o,hasZ:s,hasM:c}=e;return(a?Z(a,s??!1,c??!1,t,n.curveRings=[],r,i):X(o,s??!1,c??!1,t,n.rings,r,i))?(n.spatialReference=r,n.hasZ=Q(s,r),n.hasM=c,n):null}function ge(e,t,n=t.spatialReference,r=0){return e.spatialReference!=null&&n!=null&&Y(e,e.spatialReference,t,n,r)!=null}function Y(e,t,n,r,i){let{xmin:a,ymin:o,xmax:s,ymax:c,hasZ:l,hasM:u}=e,d=l?e.zmin:i;if(!y(a,o,d,t,$,r))return null;let f=Q(l,r);n.xmin=$[0],n.ymin=$[1],f&&(n.zmin=$[2]);let p=l?e.zmax:i;return y(s,c,p,t,$,r)?(n.xmax=$[0],n.ymax=$[1],f&&(n.zmax=$[2]),u&&(n.mmin=e.mmin,n.mmax=e.mmax),n.spatialReference=r,n):null}function X(e,t,n,r,i,a,o=0){let s=[];for(let n of e)for(let e of n)s.push(e[0],e[1],t?e[2]:o);if(!_(s,r,0,s,a,0))return!1;let c=0;i.length=0;let l=t?3:2,u=Q(t,a);for(let t of e){let e=[];for(let r of t){let t=s.slice(c,c+=3);u||t.pop(),n&&t.push(r[l]),e.push(t)}i.push(e)}return!0}function Z(e,t,n,r,i,a,o=0){let s=[];for(let n of e)for(let e of n){if(O(e))return!1;if(k(e)){let[n,r]=e.c;s.push(n[0],n[1],t?n[2]:o,r[0],r[1],o);continue}if(A(e)){let[n,r,i]=e.b;s.push(n[0],n[1],t?n[2]:o,r[0],r[1],o,i[0],i[1],o);continue}let n=e;s.push(n[0],n[1],t?n[2]:o)}if(!_(s,r,0,s,a,0))return!1;let c=0;i.length=0;let l=t?3:2,u=Q(t,a);for(let t of e){let e=[];for(let r of t){let t=s.slice(c,c+=3);if(u||t.pop(),n&&t.push(j(r)[l]),O(r))return!1;if(k(r)){let n=s[c++],r=s[c++];++c,e.push({c:[t,[n,r]]})}else if(A(r)){let n=s[c++],r=s[c++];++c;let i=s[c++],a=s[c++];++c,e.push({b:[t,[n,r],[i,a]]})}else e.push(t)}i.push(e)}return!0}function Q(e,t){return e||l(t)||C(t,h)}const $=a();export{U as canProjectWithoutEngine,de as initializeProjection,ue as isEqualBaseGCS,N as isLoaded,P as isLoadedOrLoad,oe as isLoadedOrLoadFor,F as load,I as project,H as projectAsync,ge as projectExtent,L as projectMany,pe as projectMultipoint,R as projectOrLoad,z as projectOrLoadMany,fe as projectPoint,he as projectPolygon,me as projectPolyline,W as projectWithoutEngine,se as requiresLoad,V as test,le as tryProject};
|
package/kernel.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import has from"./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=`6.0.0-next.
|
|
2
|
+
import has from"./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=`6.0.0-next.6`;let r;function i(e){r=e}function a(t){let n=r?.findCredential(t);return n?.token?e(t,`token`,n.token):t}has(`host-webworker`)||globalThis.$arcgis||Object.defineProperty(globalThis,"$arcgis",{configurable:!1,enumerable:!0,writable:!1,value:{}}),has(`host-webworker`);export{a as addTokenParameter,n as fullVersion,r as id,i as setId,t as version};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{isSome as e}from"../../../core/arrayUtils.js";import t from"../../../core/Error.js";import{EventEmitter as n}from"../../../core/Evented.js";import r from"../../../core/Logger.js";import{fromRect as i,create as a}from"../../../geometry/support/aaBoundingBox.js";import{create as o}from"../../../geometry/support/aaBoundingRect.js";import{getBoundsOptimizedGeometry as s}from"../featureConversionUtils.js";import{BoundsStore as c}from"./BoundsStore.js";import{
|
|
2
|
+
import{isSome as e}from"../../../core/arrayUtils.js";import t from"../../../core/Error.js";import{EventEmitter as n}from"../../../core/Evented.js";import r from"../../../core/Logger.js";import{fromRect as i,create as a}from"../../../geometry/support/aaBoundingBox.js";import{create as o}from"../../../geometry/support/aaBoundingRect.js";import{getBoundsOptimizedGeometry as s}from"../featureConversionUtils.js";import{BoundsStore as c}from"./BoundsStore.js";import{optimizedFeatureQueryEngineAdapter as l}from"./optimizedFeatureQueryEngineAdapter.js";const u=a();class d{constructor(e){this.geometryInfo=e,this._boundsStore=new c,this._featuresById=new Map,this._usedMemory=0,this.events=new n,this.featureAdapter=l}get usedMemory(){return this._usedMemory}get geometryType(){return this.geometryInfo.geometryType}get hasM(){return this.geometryInfo.hasM}get hasZ(){return this.geometryInfo.hasZ}get numFeatures(){return this._featuresById.size}get fullBounds(){return this._boundsStore.fullBounds}get storeStatistics(){let e=0;return this._featuresById.forEach(t=>{t.geometry!=null&&t.geometry.coords&&(e+=t.geometry.coords.length)}),{featureCount:this._featuresById.size,vertexCount:e/(this.hasZ?this.hasM?4:3:this.hasM?3:2)}}getFullExtent(e){if(this.fullBounds==null)return null;let[t,n,r,i]=this.fullBounds;return{xmin:t,ymin:n,xmax:r,ymax:i,spatialReference:e}}add(e){this._add(e),this._emitChanged()}addMany(e){for(let t of e)this._add(t);this._emitChanged()}upsertMany(t){let n=t.map(e=>this._upsert(e));return this._emitChanged(),n.filter(e)}clear(){this._featuresById.clear(),this._boundsStore.clear(),this._emitChanged(),this._usedMemory=0}removeById(e){let t=this._featuresById.get(e);return t?(this._remove(t),this._emitChanged(),t):null}removeManyById(e){this._boundsStore.invalidateIndex();for(let t of e){let e=this._featuresById.get(t);e&&this._remove(e)}this._emitChanged()}forEachBounds(e,t){for(let n of e){let e=this._boundsStore.get(n.objectId);e&&t(i(u,e))}}getFeature(e){return this._featuresById.get(e)}has(e){return this._featuresById.has(e)}forEach(e){this._featuresById.forEach(t=>e(t))}forEachInBounds(e,t){this._boundsStore.forEachInBounds(e,e=>{t(this._featuresById.get(e))})}_emitChanged(){this.events.emit(`changed`,void 0)}_add(e){if(!e)return;let n=e.objectId;if(n==null){r.getLogger(`esri.layers.graphics.data.FeatureStore`).error(new t(`featurestore:invalid-feature`,`feature id is missing`,{feature:e}));return}let i=this._featuresById.get(n),a;i?(e.displayId=i.displayId,a=this._boundsStore.get(n),this._boundsStore.delete(n),this._usedMemory-=this.estimateFeatureUsedMemory?.(i)??0):this.onFeatureAdd!=null&&this.onFeatureAdd(e),e.geometry?.coords?.length?(a=s(a??o(),e.geometry),a!=null&&this._boundsStore.set(n,a),this._featuresById.set(n,e),this._usedMemory+=this.estimateFeatureUsedMemory?.(e)??0):(this._boundsStore.set(n,null),this._featuresById.set(n,e))}_upsert(e){let n=e?.objectId;if(n==null)return r.getLogger(`esri.layers.graphics.data.FeatureStore`).error(new t(`featurestore:invalid-feature`,`feature id is missing`,{feature:e})),null;let i=this._featuresById.get(n);if(!i)return this._add(e),e;this._usedMemory-=this.estimateFeatureUsedMemory?.(i)??0;let{geometry:a,attributes:c}=e;for(let e in c)i.attributes[e]=c[e];return a&&(i.geometry=a,this._boundsStore.set(n,s(o(),a)??null)),this._usedMemory+=this.estimateFeatureUsedMemory?.(i)??0,i}_remove(e){this.onFeatureRemove!=null&&this.onFeatureRemove(e);let t=e.objectId;return this._boundsStore.delete(t),this._featuresById.delete(t),this._usedMemory-=this.estimateFeatureUsedMemory?.(e)??0,e}}export{d as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{insertSortedStableTopN as e}from"../../../core/arrayUtils.js";import{importLazily as t}from"../../../core/importUtils.js";import{clone as n}from"../../../core/lang.js";import r from"../../../geometry/SpatialReference.js";import{polygonCentroid as i,extentCentroid as a}from"../../../geometry/support/centroid.js";import{getPolygonExtent as o,getGeometryExtent as s,expandExtent as c}from"../../../geometry/support/extentUtils.js";import{toQuantizationTransform as l}from"../../../geometry/support/quantizationUtils.js";import{isValid as u,equals as d}from"../../../geometry/support/spatialReferenceUtils.js";import{closestPointOnCurve as f}from"../../../geometry/support/curves/closestPointOnCurve.js";import{getEndpoint as p,isCoordinate as m,cloneCurve as h}from"../../../geometry/support/curves/curveUtils.js";import g from"./AttributesBuilder.js";import{cleanFromGeometryEngine as _,getGeometry as v,transformCentroid as y}from"./geometryUtils.js";import{project as b}from"./projectionSupport.js";import{getDateInNumber as x}from"./queryUtils.js";import{SnappingCandidateEdge as S,SnappingCandidateVertex as C}from"./SnappingCandidate.js";import{isDateField as w,isDateOnlyField as T,isTimestampOffsetField as E,isStringField as D,isTimeOnlyField as O}from"../../support/fieldUtils.js";import k from"../../../rest/support/AutoIntervalBinParameters.js";import A from"../../../rest/support/DateBinParameters.js";import{unitsDict as j}from"../../../rest/support/DateBinUtils.js";import M from"../../../rest/support/FixedBoundariesBinParameters.js";import N from"../../../rest/support/FixedIntervalBinParameters.js";import{calculateStringStatistics as P,calculateStatistics as F,processSummaryStatisticsResult as I,calculateUniqueValuesCount as L,createUVResult as R,calculateClassBreaks as z,resolveCBResult as B,calculateHistogram as V,calculatePercentile as H,binIndex as U,getBinParams as W,isNullCountSupported as G,getAttributeComparator as K}from"../../../statistics/utils.js";import{utc as q}from"../../../time/constants.js";import{DateTime as J}from"luxon";const Y=t(()=>import(`../../../geometry/operators/json/convexHullOperator.js`));class X{constructor(e,t,n){this.items=e,this.query=t,this.geometryType=n.geometryType,this.hasZ=!!t.returnZ&&n.hasZ,this.hasM=!!t.returnM&&n.hasM,this.fieldsIndex=n.fieldsIndex,this.spatialReference=n.spatialReference,this.featureAdapter=n.featureAdapter,this.featureIdInfo=n.featureIdInfo}get size(){return this.items.length}createQueryResponseForCount(){let e=new g(this.query,this.featureAdapter,this.fieldsIndex);if(!this.query.outStatistics)return e.countDistinctValues(this.items);let{groupByFieldsForStatistics:t,having:n,outStatistics:r}=this.query;if(!t?.length)return 1;let i=new Map,a=new Map,o=new Set;for(let s of r){let{statisticType:r}=s,c=r===`exceedslimit`?void 0:s.onStatisticField;if(!a.has(c)){let n=[];for(let r of t){let t=this._getAttributeValues(e,r,this.items,i);n.push(t)}a.set(c,this._calculateUniqueValues(n,this.items,e.returnDistinctValues))}let l=a.get(c);for(let t in l){let{data:r,items:i}=l[t],a=r.join(`,`);(!n||e.validateItems(i,n))&&o.add(a)}}return o.size}async createQueryResponse(){let e;if(e=this.query.outStatistics?this.query.outStatistics.some(e=>e.statisticType===`exceedslimit`)?this._createExceedsLimitQueryResponse():await this._createStatisticsQueryResponse(this.query,this.items):this._createFeatureQueryResponse(this.query),this.query.returnQueryGeometry){let t=this.query.geometry;u(this.query.outSR)&&!d(t.spatialReference,this.query.outSR)?e.queryGeometry=_({spatialReference:this.query.outSR,...b(t,t.spatialReference,this.query.outSR)}):e.queryGeometry=_({spatialReference:this.query.outSR,...t})}return e}createSnappingResponse(e,t,n){let r=this.featureAdapter,{point:i}=e,a=typeof e.distance==`number`?e.distance:e.distance.x,o=typeof e.distance==`number`?e.distance:e.distance.y;function s(e,t){let n=(e-i.x)/a,r=(t-i.y)/o;return n*n+r*r}let c={candidates:[]},l=this.geometryType===`esriGeometryPolygon`,u=this.geometryType===`esriGeometryPolyline`||this.geometryType===`esriGeometryPoint`,d=this._getPointCreator(t,this.spatialReference,n),g=new Q(null,0),_=new Q(null,0),v={x:0,y:0,z:0};for(let e of this.items){let t=r.getObjectId(e),n=r.getGeometryWithCurves?.(e);if(n!=null){b(n,t);continue}let i=r.getGeometry(e);i!=null&&y(i,t)}return c.candidates.sort((e,t)=>e.distance-t.distance),c;function y(t,n){let{coords:r,stride:a}=t,o=t.isPoint?te:t.lengths;if(g.coords=r,_.coords=r,e.returnEdge){let e=0;for(let t=0;t<o.length;t++){let r=o[t],u=e;for(let t=0;t<r;t++,e+=a){if(!l&&t===r-1||(g.coordsIndex=e,_.coordsIndex=t===r-1?u:e+a,!ee(v,i,g,_)))continue;let o=s(v.x,v.y);o<=1&&c.candidates.push(new S(n,d(v),Math.sqrt(o),d(g),d(_)))}}}if(e.vertexMode===`all`){let e=0;for(let t=0;t<o.length;t++){let r=o[t],i=e,u=_;u.coordsIndex=i;for(let t=0;t<r;t++,e+=a){if(g.coordsIndex=e,l&&t===r-1&&g.x===u.x&&g.y===u.y)continue;let i=s(g.x,g.y);i<=1&&c.candidates.push(new C(n,d(g),Math.sqrt(i)))}}}else if(u&&e.vertexMode===`ends`){let e=0,t=[];for(let n=0;n<o.length;n++){t.push(e);let r=o[n];e+=r*a,r>1&&t.push(e-a)}for(let e of t){g.coordsIndex=e;let t=s(g.x,g.y);t<=1&&c.candidates.push(new C(n,d(g),Math.sqrt(t)))}}}function b(t,n){let{candidates:r}=c,a={x:0,y:0,z:0};if(e.returnEdge){let e=[i.x,i.y],o=new Q(e,0),c=new Q(e,0);for(let{segments:i}of t.parts)for(let{start:t,curve:l}of i){let{curvePoint:i}=f(t,l,e),u=s(...i);if(u>1)continue;[a.x,a.y]=i,o.coords=t,c.coords=p(l);let g=m(l)?null:h(l);r.push(new S(n,d(a),Math.sqrt(u),d(o),d(c),!1,g))}}function o(e){a.x=t.vertexXY[e*2],a.y=t.vertexXY[e*2+1];let i=s(a.x,a.y);i>1||(a.z=t.vertexZ?.[e]??0,r.push(new C(n,d(a),Math.sqrt(i))))}if(e.vertexMode===`all`){let{vertexCount:e}=t;for(let t=0;t<e;++t)o(t)}else if(e.vertexMode===`ends`)switch(t.type){case`point`:o(0);break;case`polyline`:for(let e=0;e<t.partCount;++e){let n=t.partOffsets[e],r=t.partOffsets[e+1]-1;o(n),r!==n&&o(r)}}}}_getPointCreator(e,t,n){let r=n!=null&&!d(t,n)?e=>b(e,t,n):e=>e,{hasZ:i}=this;return i&&e?({x:e,y:t,z:n})=>r({x:e,y:t,z:n}):({x:e,y:t})=>r({x:e,y:t,z:0})}async createSummaryStatisticsResponse(e){let{field:t,valueExpression:n,normalizationField:r,normalizationType:i,normalizationTotal:a,minValue:o,maxValue:s,scale:c,timeZone:l,outStatisticTypes:u}=e,d=this.fieldsIndex.get(t),f=w(d)||T(d)||E(d),p=await this._getDataValues({field:t,valueExpression:n,normalizationField:r,normalizationType:i,normalizationTotal:a,scale:c,timeZone:l},this.items),m=G({normalizationType:i,normalizationField:r,minValue:o,maxValue:s}),h={value:.5,fieldType:d?.type},g=D(d)?P({values:p,supportsNullCount:m,percentileParams:h,outStatisticTypes:u}):F({values:p,minValue:o,maxValue:s,useSampleStdDev:!i,supportsNullCount:m,percentileParams:h,outStatisticTypes:u});return I(g,u,f)}async createUniqueValuesResponse(e){let{field:t,valueExpression:n,domains:r,returnAllCodedValues:i,scale:a,timeZone:o}=e,s=await this._getDataValues({field:t,field2:e.field2,field3:e.field3,fieldDelimiter:e.fieldDelimiter,valueExpression:n,scale:a,timeZone:o},this.items,!1),c=L(s);return R(c,r,i,e.fieldDelimiter)}async createClassBreaksResponse(e){let{field:t,valueExpression:n,normalizationField:r,normalizationType:i,normalizationTotal:a,classificationMethod:o,standardDeviationInterval:s,minValue:c,maxValue:l,numClasses:u,scale:d,timeZone:f}=e,p=await this._getDataValues({field:t,valueExpression:n,normalizationField:r,normalizationType:i,normalizationTotal:a,scale:d,timeZone:f},this.items),m=z(p,{field:t,normalizationField:r,normalizationType:i,normalizationTotal:a,classificationMethod:o,standardDeviationInterval:s,minValue:c,maxValue:l,numClasses:u});return B(m,o)}async createHistogramResponse(e){let{field:t,valueExpression:n,normalizationField:r,normalizationType:i,normalizationTotal:a,classificationMethod:o,standardDeviationInterval:s,minValue:c,maxValue:l,numBins:u,scale:d,timeZone:f}=e,p=await this._getDataValues({field:t,valueExpression:n,normalizationField:r,normalizationType:i,normalizationTotal:a,scale:d,timeZone:f},this.items);return V(p,{field:t,normalizationField:r,normalizationType:i,normalizationTotal:a,classificationMethod:o,standardDeviationInterval:s,minValue:c,maxValue:l,numBins:u})}_sortFeatures(e,t,n){if(e.length>1&&t?.length)for(let r of t.slice().reverse()){let{compare:t,fieldOrExpression:i,fieldInfo:a}=$(r,this.fieldsIndex);e.sort((e,r)=>t(n(e,i,a),n(r,i,a)))}}_topNFeatures(t,n,r,i){if(t.length>1&&n?.length){let a=n.map(e=>{let{compare:t,fieldOrExpression:n,fieldInfo:r}=$(e,this.fieldsIndex);return(e,a)=>t(i(e,n,r),i(a,n,r))}).reduceRight((e,t)=>(n,r)=>{let i=t(n,r);return i!==0&&!Number.isNaN(i)?i:e(n,r)}),o=[];for(let n of t)e(o,n,r,a);return o}return t.slice(0,r)}_createFeatureQueryResponse(e){let{items:t,geometryType:n,hasM:r,hasZ:i,featureIdInfo:a,spatialReference:o}=this,{outFields:s,outSR:c,quantizationParameters:u,resultRecordCount:d,resultOffset:f,returnZ:p,returnM:m}=e,h=d!=null&&t.length>(f||0)+d,g=s&&(s.includes(`*`)?[...this.fieldsIndex.fields]:s.map(e=>this.fieldsIndex.get(e)));return{exceededTransferLimit:h,features:this._createFeatures(e,t),fields:g,geometryType:n,hasM:r&&m,hasZ:i&&p,objectIdFieldName:a.type===`object-id`?a.fieldName:null,spatialReference:_(c||o),transform:u&&l(u)||null}}_createFeatures(e,t){let n=new g(e,this.featureAdapter,this.fieldsIndex),{hasM:r,hasZ:i}=this,{orderByFields:a,quantizationParameters:o,returnGeometry:s,returnCentroid:c,maxAllowableOffset:u,resultOffset:d,resultRecordCount:f,returnZ:p=!1,returnM:m=!1}=e,h=i&&p,_=r&&m,b,x=d||0,S=f==null?null:x+f;S!=null&&S<=5e3&&S<t.length?b=this._topNFeatures(t,a,S,(e,t,r)=>n.getFieldValue(e,t,r)):(b=[...t],this._sortFeatures(b,a,(e,t,r)=>n.getFieldValue(e,t,r))),(x>0||S!=null)&&(b=b.slice(x,S??void 0));let C=[],w=0;if(!this.geometryType||!s&&!c)for(let e of b){let t=n.getAttributes(e);t&&(C[w++]=this._addFeatureJSONMetadata(e,{attributes:t}))}else{let e=l(o)??void 0,t=this.geometryType===`esriGeometryPolygon`||this.geometryType===`esriGeometryPolyline`;if(s&&!c)for(let r of b){let i=this.featureAdapter.getGeometry(r),a=this._addFeatureJSONMetadata(r,{attributes:n.getAttributes(r),geometry:v(this.geometryType,i,u,e,h,_)});t&&i&&!a.geometry&&(a.centroid=y(this,this.featureAdapter.getCentroid(r,this),e)),C[w++]=a}else if(!s&&c)for(let t of b)C[w++]=this._addFeatureJSONMetadata(t,{attributes:n.getAttributes(t),centroid:y(this,this.featureAdapter.getCentroid(t,this),e)});else for(let t of b)C[w++]=this._addFeatureJSONMetadata(t,{attributes:n.getAttributes(t),centroid:y(this,this.featureAdapter.getCentroid(t,this),e),geometry:v(this.geometryType,this.featureAdapter.getGeometry(t),u,e,h,_)})}return C}_addFeatureJSONMetadata(e,t){let n=this.featureAdapter.getMetadata?.(e);return n!==void 0&&(t.metadata=n),t}_createExceedsLimitQueryResponse(){let e=!1,t=1/0,n=1/0,r=1/0;for(let e of this.query.outStatistics??[])if(e.statisticType===`exceedslimit`){t=e.maxPointCount==null?1/0:e.maxPointCount,n=e.maxRecordCount==null?1/0:e.maxRecordCount,r=e.maxVertexCount==null?1/0:e.maxVertexCount;break}return e=this.geometryType===`esriGeometryPoint`?this.items.length>t:this.items.length>n||this.items.reduce((e,t)=>e+(this.featureAdapter.getGeometry(t)?.size??0),0)>r,{fields:[{name:`exceedslimit`,type:`esriFieldTypeInteger`,alias:`exceedslimit`,sqlType:`sqlTypeInteger`,domain:null,defaultValue:null}],features:[{attributes:{exceedslimit:Number(e)}}]}}async _createStatisticsQueryResponse(e,t,n={attributes:{}}){let r=[],i=new Map,a=new Map,o=new Map,s=new Map,c=new g(e,this.featureAdapter,this.fieldsIndex),l=e.outStatistics,{groupByFieldsForStatistics:u,having:d,orderByFields:f,resultRecordCount:p}=e,m=u?.length,h=!!m,_=h?u[0]:null,v=h&&!this.fieldsIndex.get(_);for(let f of l??[]){let{outStatisticFieldName:l,statisticType:p}=f,g=f,y=p===`exceedslimit`?void 0:f.onStatisticField,b=p===`percentile_disc`||p===`percentile_cont`,x=p===`EnvelopeAggregate`||p===`CentroidAggregate`||p===`ConvexHullAggregate`,S=h&&m===1&&(y===_||v)&&p===`count`;if(h){if(!o.has(y)){let e=[];for(let n of u){let r=this._getAttributeValues(c,n,t,i);e.push(r)}o.set(y,this._calculateUniqueValues(e,t,!x&&c.returnDistinctValues))}let n=o.get(y);if(!n)continue;let r=Object.keys(n);for(let a of r){let{count:r,data:o,items:f,itemPositions:p}=n[a],m=o.join(`,`);if(!d||c.validateItems(f,d)){let n=s.get(m)||{attributes:{}};if(e.returnAggIds&&(n.aggregateIds=f.map(e=>this.featureAdapter.getObjectId(e)).filter(e=>e!=null)),x){n.aggregateGeometries||={};let{aggregateGeometries:e,outStatisticFieldName:t}=await this._getAggregateGeometry(g,f);n.aggregateGeometries[t]=e}else{let e=null;if(S)e=r;else{let n=this._getAttributeValues(c,y,t,i),r=p.map(e=>n[e]);e=b&&`statisticParameters`in g?this._getPercentileValue(g,r):this._getStatisticValue(g,r,null,c.returnDistinctValues)}n.attributes[l]=e}let a=0;u.forEach((e,t)=>n.attributes[this.fieldsIndex.get(e)?e:`EXPR_${++a}`]=o[t]),s.set(m,n)}}}else if(x){n.aggregateGeometries||={};let{aggregateGeometries:e,outStatisticFieldName:r}=await this._getAggregateGeometry(g,t);n.aggregateGeometries[r]=e}else{let e=this._getAttributeValues(c,y,t,i);n.attributes[l]=b&&`statisticParameters`in g?this._getPercentileValue(g,e):this._getStatisticValue(g,e,a,c.returnDistinctValues)}let C=(p===`min`||p===`max`)&&(D(this.fieldsIndex.get(y))||this._isAnyDateField(y))?this.fieldsIndex.get(y)?.type:null;r.push({name:l,alias:l,type:C||`esriFieldTypeDouble`})}let y=h?Array.from(s.values()):[n];return this._sortFeatures(y,f,(e,t)=>e.attributes[t]),p&&(y.length=Math.min(p,y.length)),{fields:r,features:y}}_isAnyDateField(e){let t=this.fieldsIndex.get(e);return w(t)||T(t)||E(t)||O(t)}async _getAggregateGeometry(e,t){let{statisticType:n,outStatisticFieldName:r}=e,{featureAdapter:s,spatialReference:c,geometryType:l}=this,u=t.map(e=>v(l,s.getGeometry(e))),d={aggregateGeometries:null,outStatisticFieldName:null},{convexHullExecuteMany:f}=await Y.getImportPromise(),[p]=f(u,{merge:!0});if(p&&p.rings[0].length<=3&&(p=null),n===`EnvelopeAggregate`)d.aggregateGeometries={...p?o(p):Z(u),spatialReference:c},d.outStatisticFieldName=r||`extent`;else if(n===`CentroidAggregate`){let[e,t]=p?i(p):a(Z(u));d.aggregateGeometries={x:e,y:t,spatialReference:c},d.outStatisticFieldName=r||`centroid`}else n===`ConvexHullAggregate`&&(d.aggregateGeometries=p&&{...p,spatialReference:c},d.outStatisticFieldName=r||`convexHull`);return d}_getStatisticValue(e,t,n,r){let{onStatisticField:i,statisticType:a}=e,o=null;return o=n?.has(i)?n.get(i):D(this.fieldsIndex.get(i))||this._isAnyDateField(i)?P({values:t,returnDistinct:r}):F({values:r?[...new Set(t)]:t,minValue:null,maxValue:null,useSampleStdDev:!0}),n&&n.set(i,o),o[a===`var`?`variance`:a]}_getPercentileValue(e,t){let{onStatisticField:n,statisticParameters:r,statisticType:i}=e,{value:a,orderBy:o}=r,s={value:a,orderBy:o,fieldType:this.fieldsIndex.get(n)?.type,isDiscrete:i===`percentile_disc`};return H(t,s)}_getAttributeValues(e,t,n,r){if(r.has(t))return r.get(t);let i=this.fieldsIndex.get(t),a=n.map(n=>e.getFieldValue(n,t,i));return r.set(t,a),a}_calculateUniqueValues(e,t,n){let r={},i=t.length;for(let a=0;a<i;a++){let i=t[a],o=[];for(let t of e)o.push(t[a]);let s=o.join(`,`);r[s]==null?r[s]={count:1,data:o,items:[i],itemPositions:[a]}:(n||r[s].count++,r[s].items.push(i),r[s].itemPositions.push(a))}return r}async _getDataValues(e,t,i=!0){let a=new g(this.query,this.featureAdapter,this.fieldsIndex),{valueExpression:o,scale:s,timeZone:c}=e,l=r.fromJSON(this.query.outSR||this.spatialReference);return o?a.getExpressionValues(t,o,{viewingMode:`map`,scale:s,spatialReference:l},{geometryType:this.geometryType,hasZ:this.hasZ,hasM:this.hasM},c):a.getDataValues(t,n(e),i)}_calculateHistogramBins(e,t,n){if(t.min==null&&t.max==null)return[];let r=t.intervals,i=t.min??0,a=t.max??0,o=r.map(([e,t])=>({minValue:e,maxValue:t,count:0,items:[]}));for(let t=0;t<e.length;t++){let s=e[t],c=n[t];if(s!=null&&s>=i&&s<=a){let e=U(r,s);e>-1&&(o[e].count++,o[e].items.push(c))}}return o}async createQueryBinsResponse(e){let t=e.bin?.splitBy;if(!t)return this._createBinsResponse(e);let{value:n,outAlias:r,valueType:i}=t,a=[],o=[{name:r??n,alias:r??n,type:i??`esriFieldTypeString`},{name:`bin`,alias:`bin`,type:`esriFieldTypeInteger`}],s=new g(e,this.featureAdapter,this.fieldsIndex),c=new Map,l=[...this.items];this._sortFeatures(l,[n],(e,t,n)=>s.getFieldValue(e,t,n));let u=this._getAttributeValues(s,n,l,c),d=this._calculateUniqueValues([u],l,s.returnDistinctValues);for(let t in d){let{items:i}=d[t],s=await this._createBinsResponse(e,i);if(a.push(...s.features.map(e=>({...e,attributes:{...e.attributes,[r??n]:t}}))),s.fields)for(let e of s.fields)o.some(t=>t.name===e.name)||o.push(e)}return{fields:o,features:a}}async _createBinsResponse(e,t){let n=e.bin;switch(t??=this.items,n.type){case`autoIntervalBin`:return this._createAutoIntervalBinsResponse(k.fromJSON(n),e,t);case`dateBin`:return this._createDateBinsResponse(A.fromJSON(n),e,t);case`fixedBoundariesBin`:return this._createFixedBoundariesBinsResponse(M.fromJSON(n),e,t);case`fixedIntervalBin`:return this._createFixedIntervalBinsResponse(N.fromJSON(n),e,t)}}async _createAutoIntervalBinsResponse(e,t,n){let{field:r,normalizationField:i,numBins:a,normalizationType:o,normalizationTotal:s,start:c,end:l}=e,u=await this._getDataValues({field:e.field||e.expression,normalizationField:e.normalizationField,normalizationType:e.normalizationType,normalizationTotal:e.normalizationTotal,timeZone:t.outTimeReference?.ianaTimeZone},n),d=W(u,{field:r,normalizationField:i,normalizationType:o,normalizationTotal:s,numBins:a,minValue:x(o?e.normalizationMinValue:c,!1),maxValue:x(o?e.normalizationMaxValue:l,!1)}),f=this._calculateHistogramBins(u,d,n);return this._createFeaturesFromHistogramBins(f,t)}async _createDateBinsResponse(e,t,n){let{field:r,interval:i,start:a,end:o,snapToData:s,returnFullIntervalBin:c,offset:l,firstDayOfWeek:u}=e,d=i.unit,f=await this._getDataValues({field:r||e.expression,timeZone:t.outTimeReference?.ianaTimeZone},n),p=O(this.fieldsIndex.get(r)),m=j.toJSON(d),h=f.filter(Boolean).sort((e,t)=>e-t),g=a==null?h[0]:x(a,p),_=o==null?h[h.length-1]:x(o,p),v=[];if(g!=null&&_!=null){let e={zone:t.outTimeReference?.ianaTimeZone??q},n={[l?.unit?j.toJSON(l.unit):`milliseconds`]:l?.value||0},r=J.fromMillis(g,e).minus(n),a=J.fromMillis(_,e).minus(n),o=typeof u==`number`&&u>=1&&u<=7?u:7,d=(e,t)=>{let n=(e.weekday-t+7)%7;return e.minus({days:n}).startOf(`day`)},f=(e,t)=>d(e,t).plus({days:7});if(s===`last`){let e=m===`week`?f(a,o):a;for(;e>r;){let t=e.minus({[m]:i.value});if(t<r){v.unshift([c?t.plus(n).toMillis():r.plus(n).toMillis(),e.plus(n).toMillis()]);break}v.unshift([t.plus(n).toMillis(),e.plus(n).toMillis()]),e=t}}else{let e=s===`first`?r:m===`week`?d(r,o):r.startOf(m);for(;e<=a;){let t=e.plus({[m]:i.value});if(t>a){v.push([e.plus(n).toMillis(),c?t.plus(n).toMillis():a.plus(n).toMillis()]);break}v.push([e.plus(n).toMillis(),t.plus(n).toMillis()]),e=t}}}let y=this._calculateHistogramBins(f,{intervals:v,min:g,max:_},n);return this._createFeaturesFromHistogramBins(y,t)}async _createFixedBoundariesBinsResponse(e,t,n){let{field:r}=e,i=await this._getDataValues({field:r||e.expression,timeZone:t.outTimeReference?.ianaTimeZone},n),a=O(this.fieldsIndex.get(r)),o=e.boundaries.map(e=>x(e,a)).sort((e,t)=>e-t),s=[];for(let e=0;e<o.length-1;e++)s.push([o[e],o[e+1]]);let c={intervals:s,min:o.at(0),max:o.at(-1)},l=this._calculateHistogramBins(i,c,n);return this._createFeaturesFromHistogramBins(l,t)}async _createFixedIntervalBinsResponse(e,t,n){let{field:r,interval:i,normalizationType:a,start:o,end:s}=e,c=await this._getDataValues({field:r||e.expression,normalizationField:e.normalizationField,normalizationType:a,normalizationTotal:e.normalizationTotal,timeZone:t.outTimeReference?.ianaTimeZone},n),l=O(this.fieldsIndex.get(r)),u=W(c,{field:r,classificationMethod:`defined-interval`,definedInterval:i,minValue:x(a?e.normalizationMinValue:o,l),maxValue:x(a?e.normalizationMaxValue:s,l)},!0),d=this._calculateHistogramBins(c,u,n);return this._createFeaturesFromHistogramBins(d,t)}async _createFeaturesFromHistogramBins(e,t){let{upperBoundaryAlias:n,lowerBoundaryAlias:r}=t,i=r||`lowerBoundary`,a=n||`upperBoundary`,o=[],s=[{name:i,alias:i,type:`esriFieldTypeDouble`},{name:a,alias:a,type:`esriFieldTypeDouble`}],c=t.bin?.stackBy?.value,l=t.bin?.stackBy?.outAlias;c&&s.push({name:`bin`,alias:`bin`,type:`esriFieldTypeInteger`},{name:l??c,alias:l??c,type:`esriFieldTypeString`});let u=0,d=t.bin.type===`dateBin`,f=t.outTimeReference?.ianaTimeZone;for(let n of e){let{minValue:e,maxValue:r,items:p}=n,m={attributes:{}};m.attributes[i]=d&&f&&e!=null?J.fromMillis(e,{zone:f}).toISO():e,t.bin.hideUpperBound||(m.attributes[a]=d&&f&&r!=null?J.fromMillis(r,{zone:f}).toISO():r),t.returnAggIds&&(m.aggregateIds=p.map(e=>this.featureAdapter.getObjectId(e)).filter(e=>e!=null));let h;if(c?(h=await this._createStatisticsQueryResponse({...t,groupByFieldsForStatistics:[c],orderByFields:[c]},p),m.attributes.bin=++u,t.bin.jsonStyle===`flat`?o.push(...h.features.map(({attributes:{EXPR_1:e,...t},...n})=>({...n,attributes:l??e?{...t,[l??e]:e,...m.attributes}:{...t,...m.attributes}}))):(m.stackedAttributes=h.features.map(({attributes:{EXPR_1:e,...t}})=>l??e?{...t,[l??e]:e}:t),o.push(m))):(t.bin?.splitBy&&(m.attributes.bin=++u),h=await this._createStatisticsQueryResponse(t,p,m),o.push(m)),h.fields)for(let e of h.fields)s.some(t=>t.name===e.name)||s.push(e)}return t.binOrder===`desc`&&o.reverse(),{fields:s,features:o}}}function Z(e){let t=s(e[0]);for(let n of e.slice(1))c(t,s(n));return t}function ee(e,t,n,r){let i=r.x-n.x,a=r.y-n.y,o=t.x-n.x,s=t.y-n.y,c=i*i+a*a;if(c===0)return!1;let l=o*i+s*a,u=Math.min(1,Math.max(0,l/c));return e.x=n.x+i*u,e.y=n.y+a*u,!0}class Q{constructor(e,t){this.coords=e,this.coordsIndex=t}get x(){return this.coords[this.coordsIndex]}get y(){return this.coords[this.coordsIndex+1]}get z(){return this.coords[this.coordsIndex+2]}}const te=[1];function $(e,t){let n=e.split(` `),r=n[0],i=t.get(r),a=n[1]?n[1].toLowerCase()===`desc`:!1;return{compare:K(i?.type,a,`case-insensitive`),fieldOrExpression:r,fieldInfo:i}}export{X as QueryEngineResult};
|
|
2
|
+
import{insertSortedStableTopN as e}from"../../../core/arrayUtils.js";import{importLazily as t}from"../../../core/importUtils.js";import{clone as n}from"../../../core/lang.js";import r from"../../../geometry/SpatialReference.js";import{polygonCentroid as i,extentCentroid as a}from"../../../geometry/support/centroid.js";import{getPolygonExtent as o,getGeometryExtent as s,expandExtent as c}from"../../../geometry/support/extentUtils.js";import{toQuantizationTransform as l}from"../../../geometry/support/quantizationUtils.js";import{isValid as u,equals as d}from"../../../geometry/support/spatialReferenceUtils.js";import{closestPointOnCurve as f}from"../../../geometry/support/curves/closestPointOnCurve.js";import{getEndpoint as p,isCoordinate as m,cloneCurve as h}from"../../../geometry/support/curves/curveUtils.js";import g from"./AttributesBuilder.js";import{getGeometry as _,transformCentroid as v}from"./geometryUtils.js";import{project as y}from"./projectionSupport.js";import{getDateInNumber as b}from"./queryUtils.js";import{SnappingCandidateEdge as x,SnappingCandidateVertex as S}from"./SnappingCandidate.js";import{isDateField as C,isDateOnlyField as w,isTimestampOffsetField as T,isStringField as E,isTimeOnlyField as D}from"../../support/fieldUtils.js";import O from"../../../rest/support/AutoIntervalBinParameters.js";import k from"../../../rest/support/DateBinParameters.js";import{unitsDict as A}from"../../../rest/support/DateBinUtils.js";import j from"../../../rest/support/FixedBoundariesBinParameters.js";import M from"../../../rest/support/FixedIntervalBinParameters.js";import{calculateStringStatistics as N,calculateStatistics as P,processSummaryStatisticsResult as F,calculateUniqueValuesCount as I,createUVResult as L,calculateClassBreaks as R,resolveCBResult as z,calculateHistogram as B,calculatePercentile as V,binIndex as H,getBinParams as U,isNullCountSupported as W,getAttributeComparator as G}from"../../../statistics/utils.js";import{utc as K}from"../../../time/constants.js";import{DateTime as q}from"luxon";const J=t(()=>import(`../../../geometry/operators/json/convexHullOperator.js`));class Y{constructor(e,t,n){this.items=e,this.query=t,this.geometryType=n.geometryType,this.hasZ=!!t.returnZ&&n.hasZ,this.hasM=!!t.returnM&&n.hasM,this.fieldsIndex=n.fieldsIndex,this.spatialReference=n.spatialReference,this.featureAdapter=n.featureAdapter,this.featureIdInfo=n.featureIdInfo}get size(){return this.items.length}createQueryResponseForCount(){let e=new g(this.query,this.featureAdapter,this.fieldsIndex);if(!this.query.outStatistics)return e.countDistinctValues(this.items);let{groupByFieldsForStatistics:t,having:n,outStatistics:r}=this.query;if(!t?.length)return 1;let i=new Map,a=new Map,o=new Set;for(let s of r){let{statisticType:r}=s,c=r===`exceedslimit`?void 0:s.onStatisticField;if(!a.has(c)){let n=[];for(let r of t){let t=this._getAttributeValues(e,r,this.items,i);n.push(t)}a.set(c,this._calculateUniqueValues(n,this.items,e.returnDistinctValues))}let l=a.get(c);for(let t in l){let{data:r,items:i}=l[t],a=r.join(`,`);(!n||e.validateItems(i,n))&&o.add(a)}}return o.size}async createQueryResponse(){let e;if(e=this.query.outStatistics?this.query.outStatistics.some(e=>e.statisticType===`exceedslimit`)?this._createExceedsLimitQueryResponse():await this._createStatisticsQueryResponse(this.query,this.items):this._createFeatureQueryResponse(this.query),this.query.returnQueryGeometry){let t=this.query.geometry;e.queryGeometry={spatialReference:this.query.outSR,...u(this.query.outSR)&&!d(t.spatialReference,this.query.outSR)?y(t,t.spatialReference,this.query.outSR):t}}return e}createSnappingResponse(e,t,n){let r=this.featureAdapter,{point:i}=e,a=typeof e.distance==`number`?e.distance:e.distance.x,o=typeof e.distance==`number`?e.distance:e.distance.y;function s(e,t){let n=(e-i.x)/a,r=(t-i.y)/o;return n*n+r*r}let c={candidates:[]},l=this.geometryType===`esriGeometryPolygon`,u=this.geometryType===`esriGeometryPolyline`||this.geometryType===`esriGeometryPoint`,d=this._getPointCreator(t,this.spatialReference,n),g=new Q(null,0),_=new Q(null,0),v={x:0,y:0,z:0};for(let e of this.items){let t=r.getObjectId(e),n=r.getGeometryWithCurves?.(e);if(n!=null){b(n,t);continue}let i=r.getGeometry(e);i!=null&&y(i,t)}return c.candidates.sort((e,t)=>e.distance-t.distance),c;function y(t,n){let{coords:r,stride:a}=t,o=t.isPoint?ee:t.lengths;if(g.coords=r,_.coords=r,e.returnEdge){let e=0;for(let t=0;t<o.length;t++){let r=o[t],u=e;for(let t=0;t<r;t++,e+=a){if(!l&&t===r-1||(g.coordsIndex=e,_.coordsIndex=t===r-1?u:e+a,!Z(v,i,g,_)))continue;let o=s(v.x,v.y);o<=1&&c.candidates.push(new x(n,d(v),Math.sqrt(o),d(g),d(_)))}}}if(e.vertexMode===`all`){let e=0;for(let t=0;t<o.length;t++){let r=o[t],i=e,u=_;u.coordsIndex=i;for(let t=0;t<r;t++,e+=a){if(g.coordsIndex=e,l&&t===r-1&&g.x===u.x&&g.y===u.y)continue;let i=s(g.x,g.y);i<=1&&c.candidates.push(new S(n,d(g),Math.sqrt(i)))}}}else if(u&&e.vertexMode===`ends`){let e=0,t=[];for(let n=0;n<o.length;n++){t.push(e);let r=o[n];e+=r*a,r>1&&t.push(e-a)}for(let e of t){g.coordsIndex=e;let t=s(g.x,g.y);t<=1&&c.candidates.push(new S(n,d(g),Math.sqrt(t)))}}}function b(t,n){let{candidates:r}=c,a={x:0,y:0,z:0};if(e.returnEdge){let e=[i.x,i.y],o=new Q(e,0),c=new Q(e,0);for(let{segments:i}of t.parts)for(let{start:t,curve:l}of i){let{curvePoint:i}=f(t,l,e),u=s(...i);if(u>1)continue;[a.x,a.y]=i,o.coords=t,c.coords=p(l);let g=m(l)?null:h(l);r.push(new x(n,d(a),Math.sqrt(u),d(o),d(c),!1,g))}}function o(e){a.x=t.vertexXY[e*2],a.y=t.vertexXY[e*2+1];let i=s(a.x,a.y);i>1||(a.z=t.vertexZ?.[e]??0,r.push(new S(n,d(a),Math.sqrt(i))))}if(e.vertexMode===`all`){let{vertexCount:e}=t;for(let t=0;t<e;++t)o(t)}else if(e.vertexMode===`ends`)switch(t.type){case`point`:o(0);break;case`polyline`:for(let e=0;e<t.partCount;++e){let n=t.partOffsets[e],r=t.partOffsets[e+1]-1;o(n),r!==n&&o(r)}}}}_getPointCreator(e,t,n){let r=n!=null&&!d(t,n)?e=>y(e,t,n):e=>e,{hasZ:i}=this;return i&&e?({x:e,y:t,z:n})=>r({x:e,y:t,z:n}):({x:e,y:t})=>r({x:e,y:t,z:0})}async createSummaryStatisticsResponse(e){let{field:t,valueExpression:n,normalizationField:r,normalizationType:i,normalizationTotal:a,minValue:o,maxValue:s,scale:c,timeZone:l,outStatisticTypes:u}=e,d=this.fieldsIndex.get(t),f=C(d)||w(d)||T(d),p=await this._getDataValues({field:t,valueExpression:n,normalizationField:r,normalizationType:i,normalizationTotal:a,scale:c,timeZone:l},this.items),m=W({normalizationType:i,normalizationField:r,minValue:o,maxValue:s}),h={value:.5,fieldType:d?.type},g=E(d)?N({values:p,supportsNullCount:m,percentileParams:h,outStatisticTypes:u}):P({values:p,minValue:o,maxValue:s,useSampleStdDev:!i,supportsNullCount:m,percentileParams:h,outStatisticTypes:u});return F(g,u,f)}async createUniqueValuesResponse(e){let{field:t,valueExpression:n,domains:r,returnAllCodedValues:i,scale:a,timeZone:o}=e,s=await this._getDataValues({field:t,field2:e.field2,field3:e.field3,fieldDelimiter:e.fieldDelimiter,valueExpression:n,scale:a,timeZone:o},this.items,!1),c=I(s);return L(c,r,i,e.fieldDelimiter)}async createClassBreaksResponse(e){let{field:t,valueExpression:n,normalizationField:r,normalizationType:i,normalizationTotal:a,classificationMethod:o,standardDeviationInterval:s,minValue:c,maxValue:l,numClasses:u,scale:d,timeZone:f}=e,p=await this._getDataValues({field:t,valueExpression:n,normalizationField:r,normalizationType:i,normalizationTotal:a,scale:d,timeZone:f},this.items),m=R(p,{field:t,normalizationField:r,normalizationType:i,normalizationTotal:a,classificationMethod:o,standardDeviationInterval:s,minValue:c,maxValue:l,numClasses:u});return z(m,o)}async createHistogramResponse(e){let{field:t,valueExpression:n,normalizationField:r,normalizationType:i,normalizationTotal:a,classificationMethod:o,standardDeviationInterval:s,minValue:c,maxValue:l,numBins:u,scale:d,timeZone:f}=e,p=await this._getDataValues({field:t,valueExpression:n,normalizationField:r,normalizationType:i,normalizationTotal:a,scale:d,timeZone:f},this.items);return B(p,{field:t,normalizationField:r,normalizationType:i,normalizationTotal:a,classificationMethod:o,standardDeviationInterval:s,minValue:c,maxValue:l,numBins:u})}_sortFeatures(e,t,n){if(e.length>1&&t?.length)for(let r of t.slice().reverse()){let{compare:t,fieldOrExpression:i,fieldInfo:a}=$(r,this.fieldsIndex);e.sort((e,r)=>t(n(e,i,a),n(r,i,a)))}}_topNFeatures(t,n,r,i){if(t.length>1&&n?.length){let a=n.map(e=>{let{compare:t,fieldOrExpression:n,fieldInfo:r}=$(e,this.fieldsIndex);return(e,a)=>t(i(e,n,r),i(a,n,r))}).reduceRight((e,t)=>(n,r)=>{let i=t(n,r);return i!==0&&!Number.isNaN(i)?i:e(n,r)}),o=[];for(let n of t)e(o,n,r,a);return o}return t.slice(0,r)}_createFeatureQueryResponse(e){let{items:t,geometryType:n,hasM:r,hasZ:i,featureIdInfo:a,spatialReference:o}=this,{outFields:s,outSR:c,quantizationParameters:u,resultRecordCount:d,resultOffset:f,returnZ:p,returnM:m}=e,h=d!=null&&t.length>(f||0)+d,g=s&&(s.includes(`*`)?[...this.fieldsIndex.fields]:s.map(e=>this.fieldsIndex.get(e)));return{exceededTransferLimit:h,features:this._createFeatures(e,t),fields:g,geometryType:n,hasM:r&&m,hasZ:i&&p,objectIdFieldName:a.type===`object-id`?a.fieldName:null,spatialReference:c||o,transform:u&&l(u)||null}}_createFeatures(e,t){let n=new g(e,this.featureAdapter,this.fieldsIndex),{hasM:r,hasZ:i}=this,{orderByFields:a,quantizationParameters:o,returnGeometry:s,returnCentroid:c,maxAllowableOffset:u,resultOffset:d,resultRecordCount:f,returnZ:p=!1,returnM:m=!1}=e,h=i&&p,y=r&&m,b,x=d||0,S=f==null?null:x+f;S!=null&&S<=5e3&&S<t.length?b=this._topNFeatures(t,a,S,(e,t,r)=>n.getFieldValue(e,t,r)):(b=[...t],this._sortFeatures(b,a,(e,t,r)=>n.getFieldValue(e,t,r))),(x>0||S!=null)&&(b=b.slice(x,S??void 0));let C=[],w=0;if(!this.geometryType||!s&&!c)for(let e of b){let t=n.getAttributes(e);t&&(C[w++]=this._addFeatureJSONMetadata(e,{attributes:t}))}else{let e=l(o)??void 0,t=this.geometryType===`esriGeometryPolygon`||this.geometryType===`esriGeometryPolyline`;if(s&&!c)for(let r of b){let i=this.featureAdapter.getGeometry(r),a=this._addFeatureJSONMetadata(r,{attributes:n.getAttributes(r),geometry:_(this.geometryType,i,u,e,h,y)});t&&i&&!a.geometry&&(a.centroid=v(this,this.featureAdapter.getCentroid(r,this),e)),C[w++]=a}else if(!s&&c)for(let t of b)C[w++]=this._addFeatureJSONMetadata(t,{attributes:n.getAttributes(t),centroid:v(this,this.featureAdapter.getCentroid(t,this),e)});else for(let t of b)C[w++]=this._addFeatureJSONMetadata(t,{attributes:n.getAttributes(t),centroid:v(this,this.featureAdapter.getCentroid(t,this),e),geometry:_(this.geometryType,this.featureAdapter.getGeometry(t),u,e,h,y)})}return C}_addFeatureJSONMetadata(e,t){let n=this.featureAdapter.getMetadata?.(e);return n!==void 0&&(t.metadata=n),t}_createExceedsLimitQueryResponse(){let e=!1,t=1/0,n=1/0,r=1/0;for(let e of this.query.outStatistics??[])if(e.statisticType===`exceedslimit`){t=e.maxPointCount==null?1/0:e.maxPointCount,n=e.maxRecordCount==null?1/0:e.maxRecordCount,r=e.maxVertexCount==null?1/0:e.maxVertexCount;break}return e=this.geometryType===`esriGeometryPoint`?this.items.length>t:this.items.length>n||this.items.reduce((e,t)=>e+(this.featureAdapter.getGeometry(t)?.size??0),0)>r,{fields:[{name:`exceedslimit`,type:`esriFieldTypeInteger`,alias:`exceedslimit`,sqlType:`sqlTypeInteger`,domain:null,defaultValue:null}],features:[{attributes:{exceedslimit:Number(e)}}]}}async _createStatisticsQueryResponse(e,t,n={attributes:{}}){let r=[],i=new Map,a=new Map,o=new Map,s=new Map,c=new g(e,this.featureAdapter,this.fieldsIndex),l=e.outStatistics,{groupByFieldsForStatistics:u,having:d,orderByFields:f,resultRecordCount:p}=e,m=u?.length,h=!!m,_=h?u[0]:null,v=h&&!this.fieldsIndex.get(_);for(let f of l??[]){let{outStatisticFieldName:l,statisticType:p}=f,g=f,y=p===`exceedslimit`?void 0:f.onStatisticField,b=p===`percentile_disc`||p===`percentile_cont`,x=p===`EnvelopeAggregate`||p===`CentroidAggregate`||p===`ConvexHullAggregate`,S=h&&m===1&&(y===_||v)&&p===`count`;if(h){if(!o.has(y)){let e=[];for(let n of u){let r=this._getAttributeValues(c,n,t,i);e.push(r)}o.set(y,this._calculateUniqueValues(e,t,!x&&c.returnDistinctValues))}let n=o.get(y);if(!n)continue;let r=Object.keys(n);for(let a of r){let{count:r,data:o,items:f,itemPositions:p}=n[a],m=o.join(`,`);if(!d||c.validateItems(f,d)){let n=s.get(m)||{attributes:{}};if(e.returnAggIds&&(n.aggregateIds=f.map(e=>this.featureAdapter.getObjectId(e)).filter(e=>e!=null)),x){n.aggregateGeometries||={};let{aggregateGeometries:e,outStatisticFieldName:t}=await this._getAggregateGeometry(g,f);n.aggregateGeometries[t]=e}else{let e=null;if(S)e=r;else{let n=this._getAttributeValues(c,y,t,i),r=p.map(e=>n[e]);e=b&&`statisticParameters`in g?this._getPercentileValue(g,r):this._getStatisticValue(g,r,null,c.returnDistinctValues)}n.attributes[l]=e}let a=0;u.forEach((e,t)=>n.attributes[this.fieldsIndex.get(e)?e:`EXPR_${++a}`]=o[t]),s.set(m,n)}}}else if(x){n.aggregateGeometries||={};let{aggregateGeometries:e,outStatisticFieldName:r}=await this._getAggregateGeometry(g,t);n.aggregateGeometries[r]=e}else{let e=this._getAttributeValues(c,y,t,i);n.attributes[l]=b&&`statisticParameters`in g?this._getPercentileValue(g,e):this._getStatisticValue(g,e,a,c.returnDistinctValues)}let C=(p===`min`||p===`max`)&&(E(this.fieldsIndex.get(y))||this._isAnyDateField(y))?this.fieldsIndex.get(y)?.type:null;r.push({name:l,alias:l,type:C||`esriFieldTypeDouble`})}let y=h?Array.from(s.values()):[n];return this._sortFeatures(y,f,(e,t)=>e.attributes[t]),p&&(y.length=Math.min(p,y.length)),{fields:r,features:y}}_isAnyDateField(e){let t=this.fieldsIndex.get(e);return C(t)||w(t)||T(t)||D(t)}async _getAggregateGeometry(e,t){let{statisticType:n,outStatisticFieldName:r}=e,{featureAdapter:s,spatialReference:c,geometryType:l}=this,u=t.map(e=>_(l,s.getGeometry(e))),d={aggregateGeometries:null,outStatisticFieldName:null},{convexHullExecuteMany:f}=await J.getImportPromise(),[p]=f(u,{merge:!0});if(p&&p.rings[0].length<=3&&(p=null),n===`EnvelopeAggregate`)d.aggregateGeometries={...p?o(p):X(u),spatialReference:c},d.outStatisticFieldName=r||`extent`;else if(n===`CentroidAggregate`){let[e,t]=p?i(p):a(X(u));d.aggregateGeometries={x:e,y:t,spatialReference:c},d.outStatisticFieldName=r||`centroid`}else n===`ConvexHullAggregate`&&(d.aggregateGeometries=p&&{...p,spatialReference:c},d.outStatisticFieldName=r||`convexHull`);return d}_getStatisticValue(e,t,n,r){let{onStatisticField:i,statisticType:a}=e,o=null;return o=n?.has(i)?n.get(i):E(this.fieldsIndex.get(i))||this._isAnyDateField(i)?N({values:t,returnDistinct:r}):P({values:r?[...new Set(t)]:t,minValue:null,maxValue:null,useSampleStdDev:!0}),n&&n.set(i,o),o[a===`var`?`variance`:a]}_getPercentileValue(e,t){let{onStatisticField:n,statisticParameters:r,statisticType:i}=e,{value:a,orderBy:o}=r,s={value:a,orderBy:o,fieldType:this.fieldsIndex.get(n)?.type,isDiscrete:i===`percentile_disc`};return V(t,s)}_getAttributeValues(e,t,n,r){if(r.has(t))return r.get(t);let i=this.fieldsIndex.get(t),a=n.map(n=>e.getFieldValue(n,t,i));return r.set(t,a),a}_calculateUniqueValues(e,t,n){let r={},i=t.length;for(let a=0;a<i;a++){let i=t[a],o=[];for(let t of e)o.push(t[a]);let s=o.join(`,`);r[s]==null?r[s]={count:1,data:o,items:[i],itemPositions:[a]}:(n||r[s].count++,r[s].items.push(i),r[s].itemPositions.push(a))}return r}async _getDataValues(e,t,i=!0){let a=new g(this.query,this.featureAdapter,this.fieldsIndex),{valueExpression:o,scale:s,timeZone:c}=e,l=r.fromJSON(this.query.outSR||this.spatialReference);return o?a.getExpressionValues(t,o,{viewingMode:`map`,scale:s,spatialReference:l},{geometryType:this.geometryType,hasZ:this.hasZ,hasM:this.hasM},c):a.getDataValues(t,n(e),i)}_calculateHistogramBins(e,t,n){if(t.min==null&&t.max==null)return[];let r=t.intervals,i=t.min??0,a=t.max??0,o=r.map(([e,t])=>({minValue:e,maxValue:t,count:0,items:[]}));for(let t=0;t<e.length;t++){let s=e[t],c=n[t];if(s!=null&&s>=i&&s<=a){let e=H(r,s);e>-1&&(o[e].count++,o[e].items.push(c))}}return o}async createQueryBinsResponse(e){let t=e.bin?.splitBy;if(!t)return this._createBinsResponse(e);let{value:n,outAlias:r,valueType:i}=t,a=[],o=[{name:r??n,alias:r??n,type:i??`esriFieldTypeString`},{name:`bin`,alias:`bin`,type:`esriFieldTypeInteger`}],s=new g(e,this.featureAdapter,this.fieldsIndex),c=new Map,l=[...this.items];this._sortFeatures(l,[n],(e,t,n)=>s.getFieldValue(e,t,n));let u=this._getAttributeValues(s,n,l,c),d=this._calculateUniqueValues([u],l,s.returnDistinctValues);for(let t in d){let{items:i}=d[t],s=await this._createBinsResponse(e,i);if(a.push(...s.features.map(e=>({...e,attributes:{...e.attributes,[r??n]:t}}))),s.fields)for(let e of s.fields)o.some(t=>t.name===e.name)||o.push(e)}return{fields:o,features:a}}async _createBinsResponse(e,t){let n=e.bin;switch(t??=this.items,n.type){case`autoIntervalBin`:return this._createAutoIntervalBinsResponse(O.fromJSON(n),e,t);case`dateBin`:return this._createDateBinsResponse(k.fromJSON(n),e,t);case`fixedBoundariesBin`:return this._createFixedBoundariesBinsResponse(j.fromJSON(n),e,t);case`fixedIntervalBin`:return this._createFixedIntervalBinsResponse(M.fromJSON(n),e,t)}}async _createAutoIntervalBinsResponse(e,t,n){let{field:r,normalizationField:i,numBins:a,normalizationType:o,normalizationTotal:s,start:c,end:l}=e,u=await this._getDataValues({field:e.field||e.expression,normalizationField:e.normalizationField,normalizationType:e.normalizationType,normalizationTotal:e.normalizationTotal,timeZone:t.outTimeReference?.ianaTimeZone},n),d=U(u,{field:r,normalizationField:i,normalizationType:o,normalizationTotal:s,numBins:a,minValue:b(o?e.normalizationMinValue:c,!1),maxValue:b(o?e.normalizationMaxValue:l,!1)}),f=this._calculateHistogramBins(u,d,n);return this._createFeaturesFromHistogramBins(f,t)}async _createDateBinsResponse(e,t,n){let{field:r,interval:i,start:a,end:o,snapToData:s,returnFullIntervalBin:c,offset:l,firstDayOfWeek:u}=e,d=i.unit,f=await this._getDataValues({field:r||e.expression,timeZone:t.outTimeReference?.ianaTimeZone},n),p=D(this.fieldsIndex.get(r)),m=A.toJSON(d),h=f.filter(Boolean).sort((e,t)=>e-t),g=a==null?h[0]:b(a,p),_=o==null?h[h.length-1]:b(o,p),v=[];if(g!=null&&_!=null){let e={zone:t.outTimeReference?.ianaTimeZone??K},n={[l?.unit?A.toJSON(l.unit):`milliseconds`]:l?.value||0},r=q.fromMillis(g,e).minus(n),a=q.fromMillis(_,e).minus(n),o=typeof u==`number`&&u>=1&&u<=7?u:7,d=(e,t)=>{let n=(e.weekday-t+7)%7;return e.minus({days:n}).startOf(`day`)},f=(e,t)=>d(e,t).plus({days:7});if(s===`last`){let e=m===`week`?f(a,o):a;for(;e>r;){let t=e.minus({[m]:i.value});if(t<r){v.unshift([c?t.plus(n).toMillis():r.plus(n).toMillis(),e.plus(n).toMillis()]);break}v.unshift([t.plus(n).toMillis(),e.plus(n).toMillis()]),e=t}}else{let e=s===`first`?r:m===`week`?d(r,o):r.startOf(m);for(;e<=a;){let t=e.plus({[m]:i.value});if(t>a){v.push([e.plus(n).toMillis(),c?t.plus(n).toMillis():a.plus(n).toMillis()]);break}v.push([e.plus(n).toMillis(),t.plus(n).toMillis()]),e=t}}}let y=this._calculateHistogramBins(f,{intervals:v,min:g,max:_},n);return this._createFeaturesFromHistogramBins(y,t)}async _createFixedBoundariesBinsResponse(e,t,n){let{field:r}=e,i=await this._getDataValues({field:r||e.expression,timeZone:t.outTimeReference?.ianaTimeZone},n),a=D(this.fieldsIndex.get(r)),o=e.boundaries.map(e=>b(e,a)).sort((e,t)=>e-t),s=[];for(let e=0;e<o.length-1;e++)s.push([o[e],o[e+1]]);let c={intervals:s,min:o.at(0),max:o.at(-1)},l=this._calculateHistogramBins(i,c,n);return this._createFeaturesFromHistogramBins(l,t)}async _createFixedIntervalBinsResponse(e,t,n){let{field:r,interval:i,normalizationType:a,start:o,end:s}=e,c=await this._getDataValues({field:r||e.expression,normalizationField:e.normalizationField,normalizationType:a,normalizationTotal:e.normalizationTotal,timeZone:t.outTimeReference?.ianaTimeZone},n),l=D(this.fieldsIndex.get(r)),u=U(c,{field:r,classificationMethod:`defined-interval`,definedInterval:i,minValue:b(a?e.normalizationMinValue:o,l),maxValue:b(a?e.normalizationMaxValue:s,l)},!0),d=this._calculateHistogramBins(c,u,n);return this._createFeaturesFromHistogramBins(d,t)}async _createFeaturesFromHistogramBins(e,t){let{upperBoundaryAlias:n,lowerBoundaryAlias:r}=t,i=r||`lowerBoundary`,a=n||`upperBoundary`,o=[],s=[{name:i,alias:i,type:`esriFieldTypeDouble`},{name:a,alias:a,type:`esriFieldTypeDouble`}],c=t.bin?.stackBy?.value,l=t.bin?.stackBy?.outAlias;c&&s.push({name:`bin`,alias:`bin`,type:`esriFieldTypeInteger`},{name:l??c,alias:l??c,type:`esriFieldTypeString`});let u=0,d=t.bin.type===`dateBin`,f=t.outTimeReference?.ianaTimeZone;for(let n of e){let{minValue:e,maxValue:r,items:p}=n,m={attributes:{}};m.attributes[i]=d&&f&&e!=null?q.fromMillis(e,{zone:f}).toISO():e,t.bin.hideUpperBound||(m.attributes[a]=d&&f&&r!=null?q.fromMillis(r,{zone:f}).toISO():r),t.returnAggIds&&(m.aggregateIds=p.map(e=>this.featureAdapter.getObjectId(e)).filter(e=>e!=null));let h;if(c?(h=await this._createStatisticsQueryResponse({...t,groupByFieldsForStatistics:[c],orderByFields:[c]},p),m.attributes.bin=++u,t.bin.jsonStyle===`flat`?o.push(...h.features.map(({attributes:{EXPR_1:e,...t},...n})=>({...n,attributes:l??e?{...t,[l??e]:e,...m.attributes}:{...t,...m.attributes}}))):(m.stackedAttributes=h.features.map(({attributes:{EXPR_1:e,...t}})=>l??e?{...t,[l??e]:e}:t),o.push(m))):(t.bin?.splitBy&&(m.attributes.bin=++u),h=await this._createStatisticsQueryResponse(t,p,m),o.push(m)),h.fields)for(let e of h.fields)s.some(t=>t.name===e.name)||s.push(e)}return t.binOrder===`desc`&&o.reverse(),{fields:s,features:o}}}function X(e){let t=s(e[0]);for(let n of e.slice(1))c(t,s(n));return t}function Z(e,t,n,r){let i=r.x-n.x,a=r.y-n.y,o=t.x-n.x,s=t.y-n.y,c=i*i+a*a;if(c===0)return!1;let l=o*i+s*a,u=Math.min(1,Math.max(0,l/c));return e.x=n.x+i*u,e.y=n.y+a*u,!0}class Q{constructor(e,t){this.coords=e,this.coordsIndex=t}get x(){return this.coords[this.coordsIndex]}get y(){return this.coords[this.coordsIndex+1]}get z(){return this.coords[this.coordsIndex+2]}}const ee=[1];function $(e,t){let n=e.split(` `),r=n[0],i=t.get(r),a=n[1]?n[1].toLowerCase()===`desc`:!1;return{compare:G(i?.type,a,`case-insensitive`),fieldOrExpression:r,fieldInfo:i}}export{Y as QueryEngineResult};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{generalizeOptimizedGeometry as e,quantizeOptimizedGeometry as t,convertToGeometry as n,convertToPoint as r}from"../featureConversionUtils.js";function i(e,n,i,a=e.hasZ,o=e.hasM){if(n==null)return null;let s=e.hasZ&&a,c=e.hasM&&o;if(i){let e=t(n,`esriGeometryPoint`,i,a,o);return r(e,s,c)}return r(n,s,c)}function a(r,i,a,o,s,c){if(i==null)return null;let l=`coords`in i?i:i.geometry;if(l==null)return null;let{hasZ:u,hasM:d}=l,f=u&&(s??=u),p=d&&(c??=d);if(a){let i=e(l,r,a,s,c);return o&&(i=t(i,r,o)),n(i,r,f,p)}if(o){let e=t(l,r,o,s,c);return n(e,r,f,p)}return n(l,r,f,p)}
|
|
2
|
+
import{generalizeOptimizedGeometry as e,quantizeOptimizedGeometry as t,convertToGeometry as n,convertToPoint as r}from"../featureConversionUtils.js";function i(e,n,i,a=e.hasZ,o=e.hasM){if(n==null)return null;let s=e.hasZ&&a,c=e.hasM&&o;if(i){let e=t(n,`esriGeometryPoint`,i,a,o);return r(e,s,c)}return r(n,s,c)}function a(r,i,a,o,s,c){if(i==null)return null;let l=`coords`in i?i:i.geometry;if(l==null)return null;let{hasZ:u,hasM:d}=l,f=u&&(s??=u),p=d&&(c??=d);if(a){let i=e(l,r,a,s,c);return o&&(i=t(i,r,o)),n(i,r,f,p)}if(o){let e=t(l,r,o,s,c);return n(e,r,f,p)}return n(l,r,f,p)}export{a as getGeometry,i as transformCentroid};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{isSome as e}from"../../../core/arrayUtils.js";import{initializeProjection as t,projectMany as n}from"../../../geometry/projectionUtils.js";import{isPoint as r,isExtent as i,isPolygon as a,isPolyline as o,isMultipoint as s}from"../../../geometry/support/jsonTypeUtils.js";import{isValid as c,equals as l,isWebMercator as u}from"../../../geometry/support/spatialReferenceUtils.js";import{canProject as d,lngLatToXY as f,xyToLngLat as p}from"../../../geometry/support/webMercatorUtils.js";const m=[0,0];function h(e,t){let n=u(e)?f:p;if(r(t)){let e={x:0,y:0};return[e.x,e.y]=n(t.x,t.y,m),t.z!=null&&(e.z=t.z),t.m!=null&&(e.m=t.m),e}if(i(t)){let e={xmin:0,ymin:0,xmax:0,ymax:0};return[e.xmin,e.ymin]=n(t.xmin,t.ymin,m),[e.xmax,e.ymax]=n(t.xmax,t.ymax,m),t.hasZ&&(e.zmin=t.zmin,e.zmax=t.zmax,e.hasZ=!0),t.hasM&&(e.mmin=t.mmin,e.mmax=t.mmax,e.hasM=!0),e}if(a(t))return{rings:g(t.rings,n),hasM:t.hasM,hasZ:t.hasZ};if(o(t))return{paths:g(t.paths,n),hasM:t.hasM,hasZ:t.hasZ};if(s(t))return{points:_(t.points,n),hasM:t.hasM,hasZ:t.hasZ};throw Error()}function g(e,t){let n=[];for(let r of e)n.push(_(r,t));return n}function _(e,t){let n=[];for(let r of e){let e=t(r[0],r[1],[0,0]);n.push(e),r.length>2&&e.push(r[2]),r.length>3&&e.push(r[3])}return n}async function v(n,r){if(!n||!r)return;let i=Array.isArray(n)?n.map(e=>e.geometry==null?null:e.geometry.spatialReference).filter(e):[n];await t(i.map(e=>({source:e,dest:r})))}function y(e,t,r,i){if(!e)return null;if(r||(r=t,t=e.spatialReference),!c(t)||!c(r)||l(t,r))return e;if(d(t,r)){let t=h(r,e);return t.spatialReference=r,t}
|
|
2
|
+
import{isSome as e}from"../../../core/arrayUtils.js";import{initializeProjection as t,projectMany as n}from"../../../geometry/projectionUtils.js";import{isPoint as r,isExtent as i,isPolygon as a,isPolyline as o,isMultipoint as s}from"../../../geometry/support/jsonTypeUtils.js";import{isValid as c,equals as l,isWebMercator as u}from"../../../geometry/support/spatialReferenceUtils.js";import{canProject as d,lngLatToXY as f,xyToLngLat as p}from"../../../geometry/support/webMercatorUtils.js";const m=[0,0];function h(e,t){let n=u(e)?f:p;if(r(t)){let e={x:0,y:0};return[e.x,e.y]=n(t.x,t.y,m),t.z!=null&&(e.z=t.z),t.m!=null&&(e.m=t.m),e}if(i(t)){let e={xmin:0,ymin:0,xmax:0,ymax:0};return[e.xmin,e.ymin]=n(t.xmin,t.ymin,m),[e.xmax,e.ymax]=n(t.xmax,t.ymax,m),t.hasZ&&(e.zmin=t.zmin,e.zmax=t.zmax,e.hasZ=!0),t.hasM&&(e.mmin=t.mmin,e.mmax=t.mmax,e.hasM=!0),e}if(a(t))return{rings:g(t.rings,n),hasM:t.hasM,hasZ:t.hasZ};if(o(t))return{paths:g(t.paths,n),hasM:t.hasM,hasZ:t.hasZ};if(s(t))return{points:_(t.points,n),hasM:t.hasM,hasZ:t.hasZ};throw Error()}function g(e,t){let n=[];for(let r of e)n.push(_(r,t));return n}function _(e,t){let n=[];for(let r of e){let e=t(r[0],r[1],[0,0]);n.push(e),r.length>2&&e.push(r[2]),r.length>3&&e.push(r[3])}return n}async function v(n,r){if(!n||!r)return;let i=Array.isArray(n)?n.map(e=>e.geometry==null?null:e.geometry.spatialReference).filter(e):[n];await t(i.map(e=>({source:e,dest:r})))}function y(e,t,r,i){if(!e)return null;if(r||(r=t,t=e.spatialReference),!c(t)||!c(r)||l(t,r))return e;if(d(t,r)){let t=h(r,e);return t.spatialReference=r,t}let[a]=n([e],t,r,i);return a}class b{constructor(){this._jobs=[],this._timer=null,this._process=this._process.bind(this)}async push(e,t,n,r){if(!e?.length||!t||!n||l(t,n))return e;let i={geometries:e,inSpatialReference:t,outSpatialReference:n,options:r,resolve:Promise.withResolvers()};return this._jobs.push(i),this._timer??=setTimeout(this._process,10),i.resolve.promise}_process(){this._timer=null;let e=this._jobs.shift();if(!e)return;let{geometries:t,inSpatialReference:r,outSpatialReference:i,resolve:a,options:o}=e,s=t.filter(e=>e!=null),c;c=d(r,i)&&o?.extendedParams==null?s.map(e=>h(i,e)):n(s,r,i,o);let l=0,u=t.map(e=>e==null?null:c[l++]);a.resolve(u),this._jobs.length>0&&(this._timer=setTimeout(this._process,10))}}const x=new b;function S(e,t,n,r){return x.push(e,t,n,r)}export{v as checkProjectionSupport,y as project,S as projectMany};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import e from"../../Color.js";import t from"../../config.js";import{id as n}from"../../kernel.js";import r from"../../core/Error.js";import{getOrCreateMapValue as i}from"../../core/MapUtils.js";import{throwIfAbortError as a}from"../../core/promiseUtils.js";import o from"../../form/FormTemplate.js";import s from"../../form/elements/FieldElement.js";import{initializeProjection as c,project as l}from"../../geometry/projectionUtils.js";import u from"../../geometry/SpatialReference.js";import{normalizeCentralMeridian as d}from"../../geometry/support/normalizeUtils.js";import{queryBinsCapabilities as f,queryCapabilities as p}from"../graphics/data/QueryEngineCapabilities.js";import{systemOidFieldName as m}from"./constants.js";import h from"../support/FeatureTemplate.js";import g from"../support/LabelClass.js";import _ from"../support/LabelExpressionInfo.js";import{isKnowledgeGraphSublayer as v,getOwningPortalUrl as y}from"../support/layerUtils.js";import b from"../../portal/PortalItem.js";import{getUserPrivileges as x}from"../../portal/support/portalItemUtils.js";import{executeQueryStreaming as S,fetchClientDataAtKeys as C}from"../../rest/knowledgeGraphService.js";import w from"../../rest/knowledgeGraph/Entity.js";import T from"../../rest/knowledgeGraph/GraphApplyEdits.js";import E from"../../rest/knowledgeGraph/Relationship.js";import{isGraphic as D}from"../../support/graphicInstanceUtils.js";import O from"../../symbols/CIMSymbol.js";import k from"../../symbols/TextSymbol.js";const A={initializeLayersFromClientData:async(e,t,n)=>{if(t||=[...e.layers,...e.tables].map(e=>e.graphTypeName),t?.length===0)return;let r=new Map;for(let n of t)r.set(n,j(e,n));let i=await C(e.dataManager.knowledgeGraph,Array.from(r.values()),{requestOptions:{signal:n?.signal}});for(let t of[...e.layers,...e.tables]){let n=t.objectType.name;if(n==null)continue;let r=i.get(j(e,n));if(r){let e=JSON.parse(r);typeof e==`object`&&e&&!e.hasOwnProperty(`showLabels`)&&(e.showLabels=!1),t.read(e,{origin:`service`})}}},getInclusionDefinitionFromCypherResults:async(e,t,n)=>{let r=Q(e.dataModel),i=(await S(e,t,n)).resultRowsStream.getReader();for(;;){let{done:e,value:t}=await i.read();if(e)break;for(let e of t)for(let t of e)$(t,r)}return r},getInclusionDefinitionFromIdTypePairs:(e,t)=>{let n=Q(e.dataModel);for(let{id:e,typeName:i}of t){let t=n.namedTypeDefinitions.get(i);if(!t)throw new r(`WebLinkChart:data-model-desync`,`The provided id-type pairs contained a named type not reflected in the provided knowledge graph data model.`);t.members?.set(e,{id:e})}return n},getUserKGSPrivileges:async(e,r,i)=>{let a=!0,o=!1,s=!1;if(!t.userPrivilegesApplied)return{edit:a,fullEdit:o,updateItem:s};let c=await y(r,i);if(!c||!n?.getCredential(`${c}/sharing`,{...i,prompt:!1}))return{edit:a,fullEdit:o,updateItem:s};let l=new b({id:e,portal:{url:c}});return await l.load(i),{features:{edit:a,fullEdit:o},content:{updateItem:s}}=x(l),{edit:a,fullEdit:o,updateItem:s}}},j=(e,t)=>e.type===`knowledge-graph`?`${t}/Map`:`${t}/LinkChart/LinkChartSubLayer`;async function M(e,t,n){return A.initializeLayersFromClientData(e,t,n)}async function N(e,t,n){return A.getInclusionDefinitionFromCypherResults(e,t,n)}function P(e,t){return A.getInclusionDefinitionFromIdTypePairs(e,t)}const F=`#4a0932.#b31515.#18382e.#a64f1b.#102432.#8c213f.#ed9310.#2c6954.#144d59.#ffc730.#75351e.#454f4b.#78b1c2.#191921.#8f8f82.#9be0c0.#dbb658.#87b051.#11495c.#c43541.#9c5596.#44498b.#ad9d63.#86afb3.#5c98ca.#b0bfa2.#73241f.#b86b53.#d9d78c.#3e756d.#f260a1.#a0d17d.#c27c30.#eb82eb.#ffdf3c.#ffb259.#ab52b3.#3cccb4.#0095ba.#d92b30`.split(`.`),I=`#8f8f82`;function L(t){return t<0||t>=F.length?new e(I):new e(F[t])}function R(e){let t=e.toArray();return new O({data:{type:`CIMSymbolReference`,symbol:{type:`CIMLineSymbol`,symbolLayers:[{type:`CIMSolidStroke`,enable:!0,style:`solid`,width:.75,color:t},{type:`CIMVectorMarker`,enable:!0,size:6,markerPlacement:{type:`CIMMarkerPlacementOnLine`,angleToLine:!0,relativeTo:`LineMiddle`},frame:{xmin:-10,ymin:-5,xmax:0,ymax:5},markerGraphics:[{type:`CIMMarkerGraphic`,geometry:{rings:[[[-12,-3.47],[-12,3.6],[1.96,-.03],[-12,-3.47]]]},symbol:{type:`CIMPolygonSymbol`,symbolLayers:[{type:`CIMSolidFill`,enable:!0,color:t}]}}]}]}}})}function z(e){let t=`ESRI__ID`,n=4;for(let r of e)if(r.name){if(r.name.toLowerCase()===`name`){t=r.name;break}r.name.toLowerCase().includes(`name`)?(t=r.name,n=2):r.fieldType===`esriFieldTypeString`&&n>3&&(t=r.name,n=3)}return t}function B(e,t,n){let r={color:[80,80,80],haloColor:[255,255,255],haloSize:.7,font:{size:10,weight:`normal`}},i=new g({labelExpressionInfo:new _({expression:n===`ESRI__ID`?`${t}`:`$feature.${n}`}),labelPlacement:`above-center`,symbol:new k(r)}),a=new g({labelExpressionInfo:new _({expression:`'${t}' + IIf($feature.ESRI__AggregationCount>1, ' (' + $feature.ESRI__AggregationCount + ')', '')`}),labelPlacement:`center-along`,labelPosition:`parallel`,repeatLabel:!1,symbol:new k({...r,yoffset:`12px`})});return e===`entity`?[i]:[a]}function V(e,t,n){let r={color:[255,255,255],haloColor:[0,0,0],haloSize:.7,font:{size:10,weight:`bold`}},i=n===`ESRI__ID`?`${e}`:`$feature.${n}`;return t===`point`?[new g({labelExpressionInfo:new _({expression:i}),labelPlacement:`above-center`,symbol:new k(r)})]:t===`polyline`?[new g({labelExpressionInfo:new _({expression:i}),labelPlacement:`center-along`,repeatLabel:!0,symbol:new k(r)})]:t===`polygon`?[new g({labelExpressionInfo:new _({expression:i}),labelPlacement:`always-horizontal`,symbol:new k(r)})]:null}async function H(e,t,n){return A.getUserKGSPrivileges(e,t,n).catch(e=>(a(e),{edit:!0,fullEdit:!1,updateItem:!1}))}const U={capabilities:[],allowGeometryUpdates:!1,serviceCapabilities:{geometryCapabilities:{supportsZValues:!1,supportsMValues:!1}}};function W(e){let{capabilities:t,allowGeometryUpdates:n,serviceCapabilities:{geometryCapabilities:{supportsZValues:r,supportsMValues:i}}}=e?.serviceDefinition||U,a=e?.dataModel.arcgisManaged?t:t.filter(e=>e===`Query`),o=new Set(a);return{analytics:{supportsCacheHint:!1},attachment:null,data:{isVersioned:!1,isBranchVersioned:!1,supportedCurveTypes:[],supportsAttachment:!1,supportsM:i,supportsTrueCurve:!1,supportsZ:r},metadata:{supportsAdvancedFieldProperties:!1},operations:{supportsCalculate:!1,supportsTruncate:!1,supportsValidateSql:!1,supportsAdd:o.has(`Create`),supportsDelete:o.has(`Delete`),supportsEditing:o.has(`Editing`),supportsChangeTracking:!1,supportsQuery:o.has(`Query`),supportsQueryBins:!1,supportsQueryPivot:!1,supportsQueryAnalytics:!1,supportsQueryAttachments:!1,supportsQueryTopFeatures:!1,supportsResizeAttachments:!1,supportsSync:!1,supportsUpdate:o.has(`Update`),supportsExceedsLimitStatistics:!1,supportsAsyncConvert3D:!1},query:p,queryRelated:{supportsCount:!1,supportsOrderBy:!1,supportsPagination:!1,supportsCacheHint:!1},queryTopFeatures:{supportsCacheHint:!1},queryAttributeBins:f,editing:{supportsGeometryUpdate:!!e?.dataModel.arcgisManaged&&n,supportsGlobalId:!1,supportsReturnServiceEditsInSourceSpatialReference:!1,supportsRollbackOnFailure:!1,supportsTrueCurveUpdate:!1,supportsTrueCurveUpdateByTrueCurveClientsOnly:!0,supportsUpdateWithoutM:!1,supportsUploadWithItemId:!1,supportsDeleteByAnonymous:!1,supportsDeleteByOthers:o.has(`Delete`),supportsUpdateByAnonymous:!1,supportsUpdateByOthers:o.has(`Update`),supportsAsyncApplyEdits:!1,zDefault:void 0}}}async function G(e,t,n){let r=new T,a=t.graphTypeName,o=t.graphType,s=n.type===`knowledge-graph`?t.geometryFieldName:null,f=!!t.fieldsIndex.get(s)?.editable,p=e=>{let n={...e};for(let e of t.fields)e.editable||delete n[e.name];for(let t of Object.keys(e))t.includes(`ESRI__`)&&delete n[t];return n},h=async e=>{await c(e.spatialReference,u.WGS84);let t=l(e,u.WGS84);return t.type===`point`?t.normalize():(await d(t))[0]};for(let t of e.addFeatures??[]){let e=p(t.attributes);v(t.sourceLayer)&&t.sourceLayer.graphTypeName===a&&(o===`entity`?(r.entityAdds||=[],s&&t.geometry&&(e[s]=await h(t.geometry)),r.entityAdds.push(new w({properties:e,typeName:a}))):(r.relationshipAdds||=[],r.relationshipAdds.push(new E({properties:e,typeName:a}))))}for(let t of e.updateFeatures??[]){let e=t.attributes[m],n=p(t.attributes);v(t.sourceLayer)&&t.sourceLayer.graphTypeName===a&&(o===`entity`?(r.entityUpdates||=[],s&&f&&t.geometry&&(n[s]=await h(t.geometry)),r.entityUpdates.push(new w({id:e,properties:n,typeName:a}))):(r.relationshipUpdates||=[],r.relationshipUpdates.push(new E({id:e,properties:n,typeName:a}))))}let g=new Map;for(let t of e.deleteFeatures??[])if(D(t)){let e=t,n=i(g,e.sourceLayer.graphTypeName,()=>({typeName:e.sourceLayer.graphTypeName,ids:[]}));e.sourceLayer.graphTypeName===a&&n.ids.push(e.attributes[m])}else t.objectId&&typeof t.objectId==`string`&&i(g,a,()=>({typeName:a,ids:[]})).ids.push(t.objectId);for(let e of g.values())e.ids.length>0&&(o===`entity`?(r.entityDeletes||=[],r.entityDeletes.push({typeName:e.typeName,ids:e.ids})):(r.relationshipDeletes||=[],r.relationshipDeletes.push({typeName:e.typeName,ids:e.ids})));return r}function K(e,t){let n={addFeatureResults:[],updateFeatureResults:[],deleteFeatureResults:[],addAttachmentResults:[],updateAttachmentResults:[],deleteAttachmentResults:[]};for(let r of e.editResults)if(r.typeName===t){for(let e of r.adds)n.addFeatureResults.push({objectId:e.id,globalId:e.id});for(let e of r.updates)n.updateFeatureResults.push({objectId:e.id,globalId:e.id});for(let e of r.deletes)n.deleteFeatureResults.push({objectId:e.id,globalId:e.id})}return n}function q(e){if(!e.objectType)return null;let t=[];for(let n of e.fields)!n.name.includes(`ESRI__`)&&n.editable&&n.type!==`geometry`&&t.push(new s({fieldName:n.name}));return new o({elements:t})}function J(e){if(!e.objectType)return null;let t=null;switch(e.geometryType){case`point`:case`multipoint`:t=`point`;break;case`polyline`:t=`line`;break;case`polygon`:t=`polygon`;break;default:t=null}return[new h({name:e.graphTypeName,drawingTool:t,prototype:{}})]}function Y(e){return!e||typeof e!=`object`||Array.isArray(e)?!1:`id`in e&&`typeName`in e}function X(e){return!e||typeof e!=`object`||Array.isArray(e)?!1:e&&`path`in e&&Array.isArray(e.path)}function Z(e){return!e||typeof e!=`object`||Array.isArray(e)||`id`in e?!1:`properties`in e&&typeof e.properties==`object`}function Q(e){let t={namedTypeDefinitions:new Map,generateAllSublayers:!1},{entityTypes:n,relationshipTypes:r}=e,i=[...n,...r];for(let e of i)t.namedTypeDefinitions.set(e.name,{useAllData:!1,members:new Map});return t}function $(e,t){if(e&&typeof e==`object`){if(Y(e)){let n=t.namedTypeDefinitions.get(e.typeName);if(!n)throw new r(`WebLinkChart:data-model-desync`,`The query result contained a named type not reflected in the provided knowledge graph data model.`);n.members.set(e.id,{id:e.id})}else if(X(e))for(let n of e.path)$(n,t);else if(Array.isArray(e))for(let n of e)$(n,t);else if(Z(e))for(let n of Object.values(e.properties??{}))$(n,t)}}const ee=e=>{let t=``,n=e.split(`/`),r=n.lastIndexOf(`KnowledgeGraphServer`);return r>0&&(t=n[r-1]),t};export{K as convertGraphEditsResultToFeatureEdits,G as convertLayerEditsToGraphEdits,W as createCapabilitiesFromKnowledgeGraph,J as createDefaultKGSLFeatureTemplates,q as createDefaultKGSLFormTemplate,$ as extractGraphNamedObjectsFromQueryValueRecursive,I as fallbackKGSublayerSymbolHexColor,R as getDefaultLCRelationshipSublayerSymbol,z as getDisplayLabelProperty,Q as getEmptyInclusionListFromDataModel,N as getInclusionDefinitionFromCypherResults,P as getInclusionDefinitionFromIdTypePairs,L as getKGSublayerSymbolColor,B as getLinkChartDefaultLabelingInfo,V as getMapDefaultLabelingInfo,ee as getTitleFromServerUrl,H as getUserKGSPrivileges,M as initializeLayersFromClientData,Y as isGraphNamedObject,Z as isGraphObject,X as isPathObject,A as layerUtils};
|
|
2
|
+
import e from"../../Color.js";import t from"../../config.js";import{id as n}from"../../kernel.js";import r from"../../core/Error.js";import{getOrCreateMapValue as i}from"../../core/MapUtils.js";import{throwIfAbortError as a}from"../../core/promiseUtils.js";import o from"../../form/FormTemplate.js";import s from"../../form/elements/FieldElement.js";import{assertNotMesh as c}from"../../geometry/asserts.js";import{initializeProjection as l,project as u}from"../../geometry/projectionUtils.js";import d from"../../geometry/SpatialReference.js";import{normalizeCentralMeridian as f}from"../../geometry/support/normalizeUtils.js";import{queryBinsCapabilities as p,queryCapabilities as m}from"../graphics/data/QueryEngineCapabilities.js";import{systemOidFieldName as h}from"./constants.js";import g from"../support/FeatureTemplate.js";import _ from"../support/LabelClass.js";import v from"../support/LabelExpressionInfo.js";import{isKnowledgeGraphSublayer as y,getOwningPortalUrl as ee}from"../support/layerUtils.js";import b from"../../portal/PortalItem.js";import{getUserPrivileges as x}from"../../portal/support/portalItemUtils.js";import{executeQueryStreaming as S,fetchClientDataAtKeys as C}from"../../rest/knowledgeGraphService.js";import w from"../../rest/knowledgeGraph/Entity.js";import T from"../../rest/knowledgeGraph/GraphApplyEdits.js";import E from"../../rest/knowledgeGraph/Relationship.js";import{isGraphic as D}from"../../support/graphicInstanceUtils.js";import O from"../../symbols/CIMSymbol.js";import k from"../../symbols/TextSymbol.js";const A={initializeLayersFromClientData:async(e,t,n)=>{if(t||=[...e.layers,...e.tables].map(e=>e.graphTypeName),t?.length===0)return;let r=new Map;for(let n of t)r.set(n,j(e,n));let i=await C(e.dataManager.knowledgeGraph,Array.from(r.values()),{requestOptions:{signal:n?.signal}});for(let t of[...e.layers,...e.tables]){let n=t.objectType.name;if(n==null)continue;let r=i.get(j(e,n));if(r){let e=JSON.parse(r);typeof e==`object`&&e&&!e.hasOwnProperty(`showLabels`)&&(e.showLabels=!1),t.read(e,{origin:`service`})}}},getInclusionDefinitionFromCypherResults:async(e,t,n)=>{let r=Q(e.dataModel),i=(await S(e,t,n)).resultRowsStream.getReader();for(;;){let{done:e,value:t}=await i.read();if(e)break;for(let e of t)for(let t of e)$(t,r)}return r},getInclusionDefinitionFromIdTypePairs:(e,t)=>{let n=Q(e.dataModel);for(let{id:e,typeName:i}of t){let t=n.namedTypeDefinitions.get(i);if(!t)throw new r(`WebLinkChart:data-model-desync`,`The provided id-type pairs contained a named type not reflected in the provided knowledge graph data model.`);t.members?.set(e,{id:e})}return n},getUserKGSPrivileges:async(e,r,i)=>{let a=!0,o=!1,s=!1;if(!t.userPrivilegesApplied)return{edit:a,fullEdit:o,updateItem:s};let c=await ee(r,i);if(!c||!n?.getCredential(`${c}/sharing`,{...i,prompt:!1}))return{edit:a,fullEdit:o,updateItem:s};let l=new b({id:e,portal:{url:c}});return await l.load(i),{features:{edit:a,fullEdit:o},content:{updateItem:s}}=x(l),{edit:a,fullEdit:o,updateItem:s}}},j=(e,t)=>e.type===`knowledge-graph`?`${t}/Map`:`${t}/LinkChart/LinkChartSubLayer`;async function M(e,t,n){return A.initializeLayersFromClientData(e,t,n)}async function N(e,t,n){return A.getInclusionDefinitionFromCypherResults(e,t,n)}function P(e,t){return A.getInclusionDefinitionFromIdTypePairs(e,t)}const F=`#4a0932.#b31515.#18382e.#a64f1b.#102432.#8c213f.#ed9310.#2c6954.#144d59.#ffc730.#75351e.#454f4b.#78b1c2.#191921.#8f8f82.#9be0c0.#dbb658.#87b051.#11495c.#c43541.#9c5596.#44498b.#ad9d63.#86afb3.#5c98ca.#b0bfa2.#73241f.#b86b53.#d9d78c.#3e756d.#f260a1.#a0d17d.#c27c30.#eb82eb.#ffdf3c.#ffb259.#ab52b3.#3cccb4.#0095ba.#d92b30`.split(`.`),I=`#8f8f82`;function L(t){return t<0||t>=F.length?new e(I):new e(F[t])}function R(e){let t=e.toArray();return new O({data:{type:`CIMSymbolReference`,symbol:{type:`CIMLineSymbol`,symbolLayers:[{type:`CIMSolidStroke`,enable:!0,style:`solid`,width:.75,color:t},{type:`CIMVectorMarker`,enable:!0,size:6,markerPlacement:{type:`CIMMarkerPlacementOnLine`,angleToLine:!0,relativeTo:`LineMiddle`},frame:{xmin:-10,ymin:-5,xmax:0,ymax:5},markerGraphics:[{type:`CIMMarkerGraphic`,geometry:{rings:[[[-12,-3.47],[-12,3.6],[1.96,-.03],[-12,-3.47]]]},symbol:{type:`CIMPolygonSymbol`,symbolLayers:[{type:`CIMSolidFill`,enable:!0,color:t}]}}]}]}}})}function z(e){let t=`ESRI__ID`,n=4;for(let r of e)if(r.name){if(r.name.toLowerCase()===`name`){t=r.name;break}r.name.toLowerCase().includes(`name`)?(t=r.name,n=2):r.fieldType===`esriFieldTypeString`&&n>3&&(t=r.name,n=3)}return t}function B(e,t,n){let r={color:[80,80,80],haloColor:[255,255,255],haloSize:.7,font:{size:10,weight:`normal`}},i=new _({labelExpressionInfo:new v({expression:n===`ESRI__ID`?`${t}`:`$feature.${n}`}),labelPlacement:`above-center`,symbol:new k(r)}),a=new _({labelExpressionInfo:new v({expression:`'${t}' + IIf($feature.ESRI__AggregationCount>1, ' (' + $feature.ESRI__AggregationCount + ')', '')`}),labelPlacement:`center-along`,labelPosition:`parallel`,repeatLabel:!1,symbol:new k({...r,yoffset:`12px`})});return e===`entity`?[i]:[a]}function V(e,t,n){let r={color:[255,255,255],haloColor:[0,0,0],haloSize:.7,font:{size:10,weight:`bold`}},i=n===`ESRI__ID`?`${e}`:`$feature.${n}`;return t===`point`?[new _({labelExpressionInfo:new v({expression:i}),labelPlacement:`above-center`,symbol:new k(r)})]:t===`polyline`?[new _({labelExpressionInfo:new v({expression:i}),labelPlacement:`center-along`,repeatLabel:!0,symbol:new k(r)})]:t===`polygon`?[new _({labelExpressionInfo:new v({expression:i}),labelPlacement:`always-horizontal`,symbol:new k(r)})]:null}async function H(e,t,n){return A.getUserKGSPrivileges(e,t,n).catch(e=>(a(e),{edit:!0,fullEdit:!1,updateItem:!1}))}const U={capabilities:[],allowGeometryUpdates:!1,serviceCapabilities:{geometryCapabilities:{supportsZValues:!1,supportsMValues:!1}}};function W(e){let{capabilities:t,allowGeometryUpdates:n,serviceCapabilities:{geometryCapabilities:{supportsZValues:r,supportsMValues:i}}}=e?.serviceDefinition||U,a=e?.dataModel.arcgisManaged?t:t.filter(e=>e===`Query`),o=new Set(a);return{analytics:{supportsCacheHint:!1},attachment:null,data:{isVersioned:!1,isBranchVersioned:!1,supportedCurveTypes:[],supportsAttachment:!1,supportsM:i,supportsTrueCurve:!1,supportsZ:r},metadata:{supportsAdvancedFieldProperties:!1},operations:{supportsCalculate:!1,supportsTruncate:!1,supportsValidateSql:!1,supportsAdd:o.has(`Create`),supportsDelete:o.has(`Delete`),supportsEditing:o.has(`Editing`),supportsChangeTracking:!1,supportsQuery:o.has(`Query`),supportsQueryBins:!1,supportsQueryPivot:!1,supportsQueryAnalytics:!1,supportsQueryAttachments:!1,supportsQueryTopFeatures:!1,supportsResizeAttachments:!1,supportsSync:!1,supportsUpdate:o.has(`Update`),supportsExceedsLimitStatistics:!1,supportsAsyncConvert3D:!1},query:m,queryRelated:{supportsCount:!1,supportsOrderBy:!1,supportsPagination:!1,supportsCacheHint:!1},queryTopFeatures:{supportsCacheHint:!1},queryAttributeBins:p,editing:{supportsGeometryUpdate:!!e?.dataModel.arcgisManaged&&n,supportsGlobalId:!1,supportsReturnServiceEditsInSourceSpatialReference:!1,supportsRollbackOnFailure:!1,supportsTrueCurveUpdate:!1,supportsTrueCurveUpdateByTrueCurveClientsOnly:!0,supportsUpdateWithoutM:!1,supportsUploadWithItemId:!1,supportsDeleteByAnonymous:!1,supportsDeleteByOthers:o.has(`Delete`),supportsUpdateByAnonymous:!1,supportsUpdateByOthers:o.has(`Update`),supportsAsyncApplyEdits:!1,zDefault:void 0}}}async function G(e,t,n){let r=new T,a=t.graphTypeName,o=t.graphType,s=n.type===`knowledge-graph`?t.geometryFieldName:null,p=!!t.fieldsIndex.get(s)?.editable,m=e=>{let n={...e};for(let e of t.fields)e.editable||delete n[e.name];for(let t of Object.keys(e))t.includes(`ESRI__`)&&delete n[t];return n},g=async e=>{await l(e.spatialReference,d.WGS84);let t=u(e,d.WGS84);if(t.type===`point`)return t.normalize();let[n]=await f(t);return n};for(let t of e.addFeatures??[]){let e=m(t.attributes);y(t.sourceLayer)&&t.sourceLayer.graphTypeName===a&&(o===`entity`?(r.entityAdds||=[],s&&t.geometry&&(c(t.geometry),e[s]=await g(t.geometry)),r.entityAdds.push(new w({properties:e,typeName:a}))):(r.relationshipAdds||=[],r.relationshipAdds.push(new E({properties:e,typeName:a}))))}for(let t of e.updateFeatures??[]){let e=t.attributes[h],n=m(t.attributes);y(t.sourceLayer)&&t.sourceLayer.graphTypeName===a&&(o===`entity`?(r.entityUpdates||=[],s&&p&&t.geometry&&(c(t.geometry),n[s]=await g(t.geometry)),r.entityUpdates.push(new w({id:e,properties:n,typeName:a}))):(r.relationshipUpdates||=[],r.relationshipUpdates.push(new E({id:e,properties:n,typeName:a}))))}let _=new Map;for(let t of e.deleteFeatures??[])if(D(t)){let e=t,n=i(_,e.sourceLayer.graphTypeName,()=>({typeName:e.sourceLayer.graphTypeName,ids:[]}));e.sourceLayer.graphTypeName===a&&n.ids.push(e.attributes[h])}else t.objectId&&typeof t.objectId==`string`&&i(_,a,()=>({typeName:a,ids:[]})).ids.push(t.objectId);for(let e of _.values())e.ids.length>0&&(o===`entity`?(r.entityDeletes||=[],r.entityDeletes.push({typeName:e.typeName,ids:e.ids})):(r.relationshipDeletes||=[],r.relationshipDeletes.push({typeName:e.typeName,ids:e.ids})));return r}function K(e,t){let n={addFeatureResults:[],updateFeatureResults:[],deleteFeatureResults:[],addAttachmentResults:[],updateAttachmentResults:[],deleteAttachmentResults:[]};for(let r of e.editResults)if(r.typeName===t){for(let e of r.adds)n.addFeatureResults.push({objectId:e.id,globalId:e.id});for(let e of r.updates)n.updateFeatureResults.push({objectId:e.id,globalId:e.id});for(let e of r.deletes)n.deleteFeatureResults.push({objectId:e.id,globalId:e.id})}return n}function q(e){if(!e.objectType)return null;let t=[];for(let n of e.fields)!n.name.includes(`ESRI__`)&&n.editable&&n.type!==`geometry`&&t.push(new s({fieldName:n.name}));return new o({elements:t})}function J(e){if(!e.objectType)return null;let t=null;switch(e.geometryType){case`point`:case`multipoint`:t=`point`;break;case`polyline`:t=`line`;break;case`polygon`:t=`polygon`;break;default:t=null}return[new g({name:e.graphTypeName,drawingTool:t,prototype:{}})]}function Y(e){return!e||typeof e!=`object`||Array.isArray(e)?!1:`id`in e&&`typeName`in e}function X(e){return!e||typeof e!=`object`||Array.isArray(e)?!1:e&&`path`in e&&Array.isArray(e.path)}function Z(e){return!e||typeof e!=`object`||Array.isArray(e)||`id`in e?!1:`properties`in e&&typeof e.properties==`object`}function Q(e){let t={namedTypeDefinitions:new Map,generateAllSublayers:!1},{entityTypes:n,relationshipTypes:r}=e,i=[...n,...r];for(let e of i)t.namedTypeDefinitions.set(e.name,{useAllData:!1,members:new Map});return t}function $(e,t){if(e&&typeof e==`object`){if(Y(e)){let n=t.namedTypeDefinitions.get(e.typeName);if(!n)throw new r(`WebLinkChart:data-model-desync`,`The query result contained a named type not reflected in the provided knowledge graph data model.`);n.members.set(e.id,{id:e.id})}else if(X(e))for(let n of e.path)$(n,t);else if(Array.isArray(e))for(let n of e)$(n,t);else if(Z(e))for(let n of Object.values(e.properties??{}))$(n,t)}}const te=e=>{let t=``,n=e.split(`/`),r=n.lastIndexOf(`KnowledgeGraphServer`);return r>0&&(t=n[r-1]),t};export{K as convertGraphEditsResultToFeatureEdits,G as convertLayerEditsToGraphEdits,W as createCapabilitiesFromKnowledgeGraph,J as createDefaultKGSLFeatureTemplates,q as createDefaultKGSLFormTemplate,$ as extractGraphNamedObjectsFromQueryValueRecursive,I as fallbackKGSublayerSymbolHexColor,R as getDefaultLCRelationshipSublayerSymbol,z as getDisplayLabelProperty,Q as getEmptyInclusionListFromDataModel,N as getInclusionDefinitionFromCypherResults,P as getInclusionDefinitionFromIdTypePairs,L as getKGSublayerSymbolColor,B as getLinkChartDefaultLabelingInfo,V as getMapDefaultLabelingInfo,te as getTitleFromServerUrl,H as getUserKGSPrivileges,M as initializeLayersFromClientData,Y as isGraphNamedObject,Z as isGraphObject,X as isPathObject,A as layerUtils};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import e from"../../core/Error.js";import{makeHandle as t}from"../../core/handleUtils.js";import{getOrCreateMapValue as n}from"../../core/MapUtils.js";import{floatEqualRelative as r}from"../../core/mathUtils.js";import i from"../../geometry/Point.js";import
|
|
2
|
+
import e from"../../core/Error.js";import{makeHandle as t}from"../../core/handleUtils.js";import{getOrCreateMapValue as n}from"../../core/MapUtils.js";import{floatEqualRelative as r}from"../../core/mathUtils.js";import{assertNotMesh as i}from"../../geometry/asserts.js";import a from"../../geometry/Point.js";import o from"../../geometry/Polyline.js";import{initializeProjection as s,project as c}from"../../geometry/projectionUtils.js";import l from"../../geometry/SpatialReference.js";import u from"../GraphicsLayer.js";import{convertToGeometry as d}from"../graphics/featureConversionUtils.js";import{kgRestServices as f}from"../../rest/knowledgeGraphService.js";import p from"../../rest/knowledgeGraph/GraphQueryStreaming.js";import m from"../../rest/knowledgeGraph/KnowledgeGraph.js";import h from"../../views/draw/support/Reshape.js";const g={newReshapeWrapper:async({getFeatureReshapeProvider:e,targetGraphic:t,reshapeGraphicsLayer:n,view:r,snappingManager:i})=>new h({connectedReshapeProviders:[{getFeatureReshapeProvider:e,getVertexReshapeProvider(){throw Error(`Link Charts do not support vertex (polyline) reshape at this time`)}}],enableMidpoints:!1,graphic:t,layer:n,view:r,snappingManager:i})},_=async({targetEntityId:n,targetEntityType:i,view:o,snappingManager:f})=>{await s(l.WGS84,o.spatialReference);let p=o.map?.activeLinkChartLayer?.layers.find(e=>e.objectType.name===i);if(!p)throw new e(`LinkChartView:target-layer-not-found`,`No layer found for target entity type ${i}`);let m=p.createQuery();m.objectIds=[n];let h=await p.queryFeatures(m);if(h.features.length===0)throw new e(`LinkChartView:no-matching-feature-found`,`No feature found with ID ${n} in layer ${p.title}`);let _=h.features[0].clone(),b=_.attributes.ESRI__ID;if(!_.sourceLayer)throw new e(`LinkChartView:no-source-layer`,`The target graphic does not have a source layer: ${b}`);let S=new u({listMode:`hide`,internal:!0});_.geometry=c(new a(d(_.attributes.ESRI__LayoutGeometry,`esriGeometryPoint`,!1,!1)),o.spatialReference),o.map.add(S),S.add(_);let C=_.sourceLayer,w=C.parent,T=new Map([[b,[]]]),E=new Map,D=new Map,O=await v(n,p,o),k=new Map;for(let e of w.layers)k.set(e.objectType.name,e);let A=new Map;for(let[e,t]of w.sublayerIdsCache)w.dataManager.relationshipTypeNames.has(e)&&A.set(e,Array.from(t));let j=await y(b,C.objectType.name,w.knowledgeGraph,A),M=w.entityLinkChartDiagramLookup.get(b);for(let e of j){let t=E.get(e.id);if(t||(t=w.relationshipLinkChartDiagramLookup.get(e.id),E.set(e.id,t??null)),t){let n=k.get(e.typeName);n&&r(t.coords[0],M.coords[0])&&r(t.coords[1],M.coords[1])?T.get(b)?.push({objectId:e.id,pathIndex:0,vertexIndex:0,associatedSublayer:n}):n&&r(t.coords.at(-2),M.coords[0])&&r(t.coords.at(-1),M.coords[1])&&T.get(b)?.push({objectId:e.id,pathIndex:0,vertexIndex:t.coords.length/2-1,associatedSublayer:n})}}let N=await g.newReshapeWrapper({getFeatureReshapeProvider:e=>new x(e,D,T,o),targetGraphic:_,reshapeGraphicsLayer:S,view:o,snappingManager:f});N.on(`move-stop`,e=>{o.emit(`node-movement-stop`,e)});let P=t(()=>{O.remove(),S.removeAll(),o.map.remove(S),S.destroy(),D.clear(),E.clear(),N.destroy()});return{currentReshapeGraphic:N.graphic,localEdits:D,originalRelationshipGeometries:E,teardownHandle:P}},v=async(e,t,n)=>{let r=await n.whenLayerView(t);return r.setVisibility(e,!1),{remove:()=>r.setVisibility(e,!0)}},y=async(e,t,n,r,i)=>{let a={sourceId:e},o=[],s=[];for(let[e,n]of r){let r=`${e}_ids`;a[r]=n,s.push(`Match (n:${t}) WHERE id(n) = $sourceId WITH n MATCH (n)-[r:${e}]-() WHERE ID(r) IN $${r} RETURN {id: ID(r), typeName: type(r)} as result`)}let c=s.join(` UNION `),l=(await f.executeQueryStreaming(new m(JSON.parse(JSON.stringify(n))),new p({openCypherQuery:c,bindParameters:a}),i)).resultRowsStream.getReader();for(;;){let{done:e,value:t}=await l.read();if(e)break;t.forEach(e=>{o.push(e[0].properties)})}return o};class b{constructor(e,t){this.modifiedFeatures=new Map,this.updating=!1,this._totalDx=0,this._totalDy=0,this._localEditsCache=e,this._view=t}async initializeModifiedFeatures(e){let t=new Map;for(let e of this._view.map?.activeLinkChartLayer?.layers??[]){let n=e;t.set(n.objectType.name,n)}let r=new Map;for(let t of e){let i=this._localEditsCache.get(t.objectId);i?this.initializeModifiedFeature(i,e):n(r,t.associatedSublayer.objectType.name,()=>[]).push(t.objectId)}for(let[n,i]of r){let r=t.get(n),a=r.createQuery();a.outFields=[`ESRI__ID`],a.objectIds=i,r.queryFeatures(a).then(t=>{for(let n of t.features)this.initializeModifiedFeature(this.makeModifiedFeature(n,r),e)})}}makeModifiedFeature(e,t){let n=e.attributes.ESRI__ID,r={graphic:e,layer:t,originalGraphic:e.clone(),uniqueId:n};return this._localEditsCache.set(n,r),r}initializeModifiedFeature(e,t){let n=t.filter(({objectId:t})=>t===e.uniqueId);this.modifiedFeatures.set(e,n),i(e.graphic.geometry);let r=e.graphic.geometry?c(e.graphic.geometry,this._view.spatialReference):void 0,a=e.graphic.sourceLayer,s=a.parent;if(!r&&a.graphType===`relationship`){let t=s.relationshipLinkChartDiagramLookup.get(e.uniqueId);r=c(new o(d(t,`esriGeometryPolyline`,!1,!1)),this._view.spatialReference)}let u=r.clone();for(let{pathIndex:e,vertexIndex:t}of n)u=this.getTranslatedGeometry(r,e,t,this._totalDx,this._totalDy);e.graphic.geometry=c(u,l.WGS84),s.relationshipLinkChartDiagramLookup.get(e.uniqueId)&&(s.relationshipLinkChartDiagramLookup.set(e.uniqueId,null),a.refreshCachedQueryEngine().then(()=>{a.emit(`refresh`,{dataChanged:!0})}))}translate(e,t){this._totalDx+=e,this._totalDy+=t;let n=new Set;for(let[r,a]of this.modifiedFeatures){i(r.graphic.geometry);let s=r.graphic.geometry?c(r.graphic.geometry,this._view.spatialReference):void 0,u=r.graphic.sourceLayer,f=u.parent;if(u&&!r.graphic.geometry&&u.graphType===`relationship`){let e=f.relationshipLinkChartDiagramLookup.get(r.uniqueId);s=c(new o(d(e,`esriGeometryPolyline`,!1,!1)),this._view.spatialReference)}for(let i of a){if(!s)continue;let a=this.getTranslatedGeometry(s,i.pathIndex,i.vertexIndex,e,t);r.graphic.geometry=c(a,l.WGS84),f.relationshipLinkChartDiagramLookup.get(r.uniqueId)&&(f.relationshipLinkChartDiagramLookup.set(r.uniqueId,null),n.add(u))}}for(let e of n)e.refreshCachedQueryEngine().then(()=>{e.emit(`refresh`,{dataChanged:!0})});return Array.from(this.modifiedFeatures.keys())}getTranslatedGeometry(e,t,n,r,i){let a=e.clone(),o=e.paths.slice();return o.at(t)?.at(n)==null||(o[t][n][0]+=r??0,o[t][n][1]+=i??0,a.paths=o),a}}class x extends b{constructor(e,t,n,r){super(t,r),this._connectedVerticesLookup=n;let i=[];for(let t of e){let e=this.getConnectedVerticesForFeature(t);for(let t of e)i.push(t)}this.initializeModifiedFeatures(i)}getConnectedVerticesForFeature(e){return this._connectedVerticesLookup.get(e.graphic.attributes.ESRI__ID)??[]}}export{x as ConnectedFeatureReshapeProvider,_ as startNodeMovement,g as wrapperObject};
|