@arcgis/core 4.28.0-next.20230911 → 4.28.0-next.20230913

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (136) hide show
  1. package/arcade/Feature.js +1 -1
  2. package/arcade/arcadeTimeUtils.js +1 -1
  3. package/arcade/executionError.js +1 -1
  4. package/arcade/featureSetUtils.js +1 -1
  5. package/arcade/featureset/actions/Adapted.js +1 -1
  6. package/arcade/featureset/actions/GroupBy.js +1 -1
  7. package/arcade/featureset/support/FeatureSet.js +1 -1
  8. package/arcade/featureset/support/errorsupport.js +1 -1
  9. package/arcade/functions/featuresetbase.js +1 -1
  10. package/arcade/functions/featuresetstats.js +1 -1
  11. package/arcade/functions/string.js +1 -1
  12. package/arcade.js +1 -1
  13. package/assets/esri/core/workers/RemoteClient.js +1 -1
  14. package/assets/esri/core/workers/chunks/0920312e3c7b63c2e253.js +1 -0
  15. package/assets/esri/core/workers/chunks/0cb007ab5db0a2a598ec.js +1 -0
  16. package/assets/esri/core/workers/chunks/0cc61f1b2c0473ded5c2.js +1 -0
  17. package/assets/esri/core/workers/chunks/0f804e3f888cb4998f46.js +1 -0
  18. package/assets/esri/core/workers/chunks/189dd81cf95bd8417ee3.js +1 -0
  19. package/assets/esri/core/workers/chunks/1a723bb4a341f645e5fe.js +1 -0
  20. package/assets/esri/core/workers/chunks/24c717492ea1b35310d8.js +1 -0
  21. package/assets/esri/core/workers/chunks/{3ce73dd4113dbc7d11de.js → 2eb58dc339b2bb03d9e3.js} +1 -1
  22. package/assets/esri/core/workers/chunks/{38c07a8574352a7f2f6d.js → 2ff0dbd5eb7ca57bb7fc.js} +1 -1
  23. package/assets/esri/core/workers/chunks/{768f3db2705fa9e57641.js → 49dfdc0463450491df9d.js} +1 -1
  24. package/assets/esri/core/workers/chunks/650a317b6dc245a7060f.js +1 -0
  25. package/assets/esri/core/workers/chunks/{56ed099745360888604e.js → 67f01c71280fa0759742.js} +1 -1
  26. package/assets/esri/core/workers/chunks/{f62842807744bdfaced7.js → 67fab13f56b340076763.js} +1 -1
  27. package/assets/esri/core/workers/chunks/6d94b358e8d1cf79bba3.js +1 -0
  28. package/assets/esri/core/workers/chunks/718607d7a3b33fc33b0a.js +1 -0
  29. package/assets/esri/core/workers/chunks/{4c63d6b9460aa6ae9843.js → 860417f4138f53d315ba.js} +2 -2
  30. package/assets/esri/core/workers/chunks/8aa7e994b74f66522c37.js +1 -0
  31. package/assets/esri/core/workers/chunks/9fa485b04b997b0a5509.js +1 -0
  32. package/assets/esri/core/workers/chunks/a047fcf3c7307a69b63c.js +1 -0
  33. package/assets/esri/core/workers/chunks/a753d9874801cd448946.js +1 -0
  34. package/assets/esri/core/workers/chunks/c51233ad51823cb98c35.js +1 -0
  35. package/assets/esri/core/workers/chunks/c61f20d91a5c432b07dc.js +1 -0
  36. package/assets/esri/core/workers/chunks/d3d11242e5af57ba77f4.js +1 -0
  37. package/assets/esri/core/workers/chunks/dbf343d1fb746f99bb6e.js +1 -0
  38. package/assets/esri/core/workers/chunks/{271ec1d1666bf6dc3dda.js → dc74b4ec85e8e3de5b27.js} +1 -1
  39. package/assets/esri/core/workers/chunks/e8a8791d765ab6c450dd.js +1 -0
  40. package/assets/esri/core/workers/chunks/{5fe7b5665710ec6d3046.js → eb0d1c5c96f735c162d3.js} +1 -1
  41. package/assets/esri/themes/base/widgets/_Sketch.scss +0 -5
  42. package/assets/esri/themes/base/widgets/_SketchTooltipControls.scss +0 -5
  43. package/assets/esri/themes/dark/main.css +1 -1
  44. package/assets/esri/themes/light/main.css +1 -1
  45. package/assets/esri/themes/light/view.css +1 -1
  46. package/chunks/HUDMaterial.glsl.js +38 -45
  47. package/chunks/languageUtils.js +1 -1
  48. package/core/promiseUtils.js +1 -1
  49. package/core/sql/AggregateFunctions.js +1 -1
  50. package/core/sql/DateOnly.js +1 -1
  51. package/core/sql/SqlTimestampOffset.js +1 -1
  52. package/core/sql/TimeOnly.js +1 -1
  53. package/core/sql/WhereClause.js +1 -1
  54. package/core/sql/WhereGrammar.js +1 -1
  55. package/core/sql/sqlCompareUtils.js +1 -1
  56. package/geometry/GeometryCursor.js +1 -1
  57. package/geometry/Mesh.js +1 -1
  58. package/geometry/support/labelPoint.js +1 -1
  59. package/geometry/support/meshUtils/bounds.js +1 -1
  60. package/geometry/support/meshUtils/georeference.js +1 -1
  61. package/interfaces.d.ts +190 -144
  62. package/layers/ImageryLayer.js +1 -1
  63. package/layers/SceneLayer.js +1 -1
  64. package/layers/graphics/controllers/FeatureTileController3D.js +1 -1
  65. package/layers/graphics/controllers/I3SOnDemandController.js +1 -1
  66. package/layers/graphics/sources/csv/csv.js +1 -1
  67. package/layers/support/FetchAssociatedFeatureLayer.js +1 -1
  68. package/layers/support/TilemapCache.js +1 -1
  69. package/layers/support/fieldUtils.js +1 -1
  70. package/layers/support/rasterDatasets/BaseRaster.js +1 -1
  71. package/layers/support/wmsUtils.js +1 -1
  72. package/layers/video/VideoController.js +1 -1
  73. package/package.json +3 -3
  74. package/smartMapping/heuristics/sizeRange.js +1 -1
  75. package/smartMapping/labels/bins.js +1 -1
  76. package/smartMapping/labels/clusters.js +1 -1
  77. package/smartMapping/labels/support/utils.js +1 -1
  78. package/smartMapping/popup/support/clusterUtils.js +1 -1
  79. package/smartMapping/support/clusterUtils.js +1 -1
  80. package/support/revision.js +1 -1
  81. package/views/2d/engine/webgl/DisplayId.js +1 -1
  82. package/views/2d/engine/webgl/Utils.js +1 -1
  83. package/views/3d/analysis/AreaMeasurement/support/AreaMeasurementVisualization.js +1 -1
  84. package/views/3d/analysis/AreaMeasurement/support/MeasurementData.js +1 -1
  85. package/views/3d/analysis/Dimension/DimensionVisualization.js +1 -1
  86. package/views/3d/analysis/Dimension/LengthDimensionSubTool.js +1 -1
  87. package/views/3d/analysis/Dimension/LengthDimensionVisualization.js +1 -1
  88. package/views/3d/analysis/Dimension/lengthDimensionManipulatorUtils.js +1 -1
  89. package/views/3d/analysis/Dimension/settings.js +1 -1
  90. package/views/3d/interactive/Manipulator3D.js +1 -1
  91. package/views/3d/interactive/editingTools/originGraphicVisualElementUtils.js +1 -1
  92. package/views/3d/interactive/editingTools/reshapeGraphic/ReshapeOperation.js +1 -1
  93. package/views/3d/interactive/measurementTools/areaMeasurement3D/AreaMeasurement3DTool.js +1 -1
  94. package/views/3d/layers/I3SMeshView3D.js +1 -1
  95. package/views/3d/layers/I3SMeshWorkerHandle.js +1 -1
  96. package/views/3d/layers/ImageryTileLayerView3D.js +1 -1
  97. package/views/3d/layers/SceneLayerWorker.js +1 -1
  98. package/views/3d/layers/i3s/I3SClientNodeLoader.js +1 -1
  99. package/views/3d/webgl-engine/core/FBOCache.js +1 -1
  100. package/views/3d/webgl-engine/lib/OffscreenRendering.js +1 -1
  101. package/views/3d/webgl-engine/materials/HUDMaterial.js +1 -1
  102. package/views/3d/webgl-engine/shaders/HUDMaterialTechniqueConfiguration.js +1 -1
  103. package/views/ToolViewManager.js +1 -1
  104. package/views/View.js +1 -1
  105. package/views/animation/easing.js +1 -1
  106. package/views/webgl/FramebufferObject.js +1 -1
  107. package/views/webgl/RenderingContext.js +1 -1
  108. package/views/webgl/enums.js +1 -1
  109. package/views/webgl/renderState.js +1 -1
  110. package/widgets/BasemapGallery/BasemapGalleryViewModel.js +1 -1
  111. package/widgets/Feature/FeatureMedia.js +1 -1
  112. package/widgets/FeatureForm.js +1 -1
  113. package/widgets/Features.js +1 -1
  114. package/widgets/Search/SearchViewModel.js +1 -1
  115. package/widgets/support/SketchTooltipControls/SketchTooltipControlsViewModel.js +1 -1
  116. package/widgets/support/SketchTooltipControls.js +1 -1
  117. package/widgets/support/SnappingControls.js +1 -1
  118. package/assets/esri/core/workers/chunks/055575ed2ab78be0bdb2.js +0 -1
  119. package/assets/esri/core/workers/chunks/0ee90a0b4d09a56c0d48.js +0 -1
  120. package/assets/esri/core/workers/chunks/15056f91d87f11b00bcc.js +0 -1
  121. package/assets/esri/core/workers/chunks/344e40934c98d6fe66ae.js +0 -1
  122. package/assets/esri/core/workers/chunks/558049fcac3a82a093fc.js +0 -1
  123. package/assets/esri/core/workers/chunks/5c41eb67d19b8710118a.js +0 -1
  124. package/assets/esri/core/workers/chunks/5d183ac1a8b68ba9c656.js +0 -1
  125. package/assets/esri/core/workers/chunks/610d4a5d2511fa81460e.js +0 -1
  126. package/assets/esri/core/workers/chunks/6755bb1f2a6575a8e082.js +0 -1
  127. package/assets/esri/core/workers/chunks/84173936b309712ba9b3.js +0 -1
  128. package/assets/esri/core/workers/chunks/877302d6e39a0d530aab.js +0 -1
  129. package/assets/esri/core/workers/chunks/a07dc782e69111e2eeaf.js +0 -1
  130. package/assets/esri/core/workers/chunks/b825019841247d173072.js +0 -1
  131. package/assets/esri/core/workers/chunks/bed1bc13b168fae46404.js +0 -1
  132. package/assets/esri/core/workers/chunks/c8dd21a332559c99815c.js +0 -1
  133. package/assets/esri/core/workers/chunks/ccc3564e76c0ec5c0228.js +0 -1
  134. package/assets/esri/core/workers/chunks/d0a81c7ec8a84eeadd31.js +0 -1
  135. package/assets/esri/core/workers/chunks/e7a852b319c1d89eddc5.js +0 -1
  136. package/assets/esri/core/workers/chunks/ebde11fdccb437954ce7.js +0 -1
@@ -2,7 +2,7 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import{s as e,j as o}from"./vec2.js";import{a as i}from"./vec2f64.js";import{Z as r}from"./vec4f64.js";import{ShaderOutput as l}from"../views/3d/webgl-engine/core/shaderLibrary/ShaderOutput.js";import{SliceDraw as t}from"../views/3d/webgl-engine/core/shaderLibrary/Slice.glsl.js";import{ObjectAndLayerIdColor as a}from"../views/3d/webgl-engine/core/shaderLibrary/attributes/ObjectAndLayerIdColor.glsl.js";import{AlignPixel as s}from"../views/3d/webgl-engine/core/shaderLibrary/hud/AlignPixel.glsl.js";import{HUD as n}from"../views/3d/webgl-engine/core/shaderLibrary/hud/HUD.glsl.js";import{HUDOcclusionPass as c}from"../views/3d/webgl-engine/core/shaderLibrary/hud/HUDOcclusionPass.glsl.js";import{OutputHighlight as d,occludedHighlightFlag as u,unoccludedHighlightFlag as p}from"../views/3d/webgl-engine/core/shaderLibrary/output/OutputHighlight.glsl.js";import{VisualVariables as g}from"../views/3d/webgl-engine/core/shaderLibrary/shading/VisualVariables.glsl.js";import{symbolAlphaCutoff as f,defaultMaskAlphaCutoff as v}from"../views/3d/webgl-engine/core/shaderLibrary/util/AlphaCutoff.js";import{ColorConversion as b}from"../views/3d/webgl-engine/core/shaderLibrary/util/ColorConversion.glsl.js";import{RgbaFloatEncoding as m}from"../views/3d/webgl-engine/core/shaderLibrary/util/RgbaFloatEncoding.glsl.js";import{ScreenSizePerspective as h,addScreenSizePerspective as w,addScreenSizePerspectiveAlignment as x}from"../views/3d/webgl-engine/core/shaderLibrary/util/ScreenSizePerspective.glsl.js";import{addPixelRatio as C}from"../views/3d/webgl-engine/core/shaderLibrary/util/View.glsl.js";import{Float2PassUniform as P}from"../views/3d/webgl-engine/core/shaderModules/Float2PassUniform.js";import{Float4PassUniform as S}from"../views/3d/webgl-engine/core/shaderModules/Float4PassUniform.js";import{FloatPassUniform as j}from"../views/3d/webgl-engine/core/shaderModules/FloatPassUniform.js";import{glsl as z}from"../views/3d/webgl-engine/core/shaderModules/interfaces.js";import{ShaderBuilder as y}from"../views/3d/webgl-engine/core/shaderModules/ShaderBuilder.js";import{Texture2DPassUniform as A}from"../views/3d/webgl-engine/core/shaderModules/Texture2DPassUniform.js";import{TransparencyPassType as O}from"../views/3d/webgl-engine/lib/TransparencyPassType.js";import{VertexAttribute as $}from"../views/3d/webgl-engine/lib/VertexAttribute.js";function F(o){const i=new y,F=o.signedDistanceFieldEnabled;if(i.include(n,o),i.include(t,o),o.occlusionPass)return i.include(c,o),i;const{vertex:B,fragment:T}=i;i.include(h),T.include(m),T.include(b),i.include(g,o),i.include(a,o),i.varyings.add("vcolor","vec4"),i.varyings.add("vtc","vec2"),i.varyings.add("vsize","vec2"),o.binaryHighlightOcclusionEnabled&&i.varyings.add("voccluded","float"),B.uniforms.add(new S("viewport",((e,o)=>o.camera.fullViewport)),new P("screenOffset",((o,i)=>e(H,2*o.screenOffset[0]*i.camera.pixelRatio,2*o.screenOffset[1]*i.camera.pixelRatio))),new P("anchorPosition",(e=>D(e))),new S("materialColor",(e=>e.color))),C(B),F&&(B.uniforms.add(new S("outlineColor",(e=>e.outlineColor))),T.uniforms.add(new S("outlineColor",(e=>L(e)?e.outlineColor:r)),new j("outlineSize",(e=>L(e)?e.outlineSize:0)))),o.hasScreenSizePerspective&&(w(B),x(B)),(o.debugDrawLabelBorder||o.binaryHighlightOcclusionEnabled)&&i.varyings.add("debugBorderCoords","vec4"),i.attributes.add($.UV0,"vec2"),i.attributes.add($.COLOR,"vec4"),i.attributes.add($.SIZE,"vec2"),i.attributes.add($.FEATUREATTRIBUTE,"vec4"),B.code.add(z`
5
+ import{s as e,j as o}from"./vec2.js";import{a as i}from"./vec2f64.js";import{Z as r}from"./vec4f64.js";import{ShaderOutput as l}from"../views/3d/webgl-engine/core/shaderLibrary/ShaderOutput.js";import{SliceDraw as t}from"../views/3d/webgl-engine/core/shaderLibrary/Slice.glsl.js";import{ObjectAndLayerIdColor as a}from"../views/3d/webgl-engine/core/shaderLibrary/attributes/ObjectAndLayerIdColor.glsl.js";import{AlignPixel as s}from"../views/3d/webgl-engine/core/shaderLibrary/hud/AlignPixel.glsl.js";import{HUD as n}from"../views/3d/webgl-engine/core/shaderLibrary/hud/HUD.glsl.js";import{HUDOcclusionPass as c}from"../views/3d/webgl-engine/core/shaderLibrary/hud/HUDOcclusionPass.glsl.js";import{occludedHighlightFlag as d,unoccludedHighlightFlag as u}from"../views/3d/webgl-engine/core/shaderLibrary/output/OutputHighlight.glsl.js";import{VisualVariables as p}from"../views/3d/webgl-engine/core/shaderLibrary/shading/VisualVariables.glsl.js";import{symbolAlphaCutoff as f,defaultMaskAlphaCutoff as g}from"../views/3d/webgl-engine/core/shaderLibrary/util/AlphaCutoff.js";import{ColorConversion as v}from"../views/3d/webgl-engine/core/shaderLibrary/util/ColorConversion.glsl.js";import{RgbaFloatEncoding as m}from"../views/3d/webgl-engine/core/shaderLibrary/util/RgbaFloatEncoding.glsl.js";import{ScreenSizePerspective as b,addScreenSizePerspective as h,addScreenSizePerspectiveAlignment as w}from"../views/3d/webgl-engine/core/shaderLibrary/util/ScreenSizePerspective.glsl.js";import{addPixelRatio as x}from"../views/3d/webgl-engine/core/shaderLibrary/util/View.glsl.js";import{Float2PassUniform as C}from"../views/3d/webgl-engine/core/shaderModules/Float2PassUniform.js";import{Float4PassUniform as P}from"../views/3d/webgl-engine/core/shaderModules/Float4PassUniform.js";import{FloatPassUniform as S}from"../views/3d/webgl-engine/core/shaderModules/FloatPassUniform.js";import{glsl as j}from"../views/3d/webgl-engine/core/shaderModules/interfaces.js";import{ShaderBuilder as z}from"../views/3d/webgl-engine/core/shaderModules/ShaderBuilder.js";import{Texture2DPassUniform as y}from"../views/3d/webgl-engine/core/shaderModules/Texture2DPassUniform.js";import{TransparencyPassType as A}from"../views/3d/webgl-engine/lib/TransparencyPassType.js";import{VertexAttribute as O}from"../views/3d/webgl-engine/lib/VertexAttribute.js";function $(o){const i=new z,$=o.signedDistanceFieldEnabled;if(i.include(n,o),i.include(t,o),o.occlusionPass)return i.include(c,o),i;const{vertex:D,fragment:T}=i;i.include(b),T.include(m),T.include(v),i.include(p,o),i.include(a,o),i.varyings.add("vcolor","vec4"),i.varyings.add("vtc","vec2"),i.varyings.add("vsize","vec2"),i.varyings.add("voccluded","float"),D.uniforms.add(new P("viewport",((e,o)=>o.camera.fullViewport)),new C("screenOffset",((o,i)=>e(B,2*o.screenOffset[0]*i.camera.pixelRatio,2*o.screenOffset[1]*i.camera.pixelRatio))),new C("anchorPosition",(e=>L(e))),new P("materialColor",(e=>e.color))),x(D),$&&(D.uniforms.add(new P("outlineColor",(e=>e.outlineColor))),T.uniforms.add(new P("outlineColor",(e=>F(e)?e.outlineColor:r)),new S("outlineSize",(e=>F(e)?e.outlineSize:0)))),o.hasScreenSizePerspective&&(h(D),w(D)),o.debugDrawLabelBorder&&i.varyings.add("debugBorderCoords","vec4"),i.attributes.add(O.UV0,"vec2"),i.attributes.add(O.COLOR,"vec4"),i.attributes.add(O.SIZE,"vec2"),i.attributes.add(O.FEATUREATTRIBUTE,"vec4"),D.code.add(j`
6
6
  void main(void) {
7
7
  ProjectHUDAux projectAux;
8
8
  vec4 posProj = projectPositionHUD(projectAux);
@@ -14,10 +14,10 @@ import{s as e,j as o}from"./vec2.js";import{a as i}from"./vec2f64.js";import{Z a
14
14
  return;
15
15
  }
16
16
  vec2 inputSize;
17
- ${o.hasScreenSizePerspective?z`
17
+ ${o.hasScreenSizePerspective?j`
18
18
  inputSize = screenSizePerspectiveScaleVec2(size, projectAux.absCosAngle, projectAux.distanceToCamera, screenSizePerspective);
19
19
  vec2 screenOffsetScaled = screenSizePerspectiveScaleVec2(screenOffset, projectAux.absCosAngle, projectAux.distanceToCamera, screenSizePerspectiveAlignment);
20
- `:z`
20
+ `:j`
21
21
  inputSize = size;
22
22
  vec2 screenOffsetScaled = screenOffset;`}
23
23
 
@@ -25,24 +25,22 @@ import{s as e,j as o}from"./vec2.js";import{a as i}from"./vec2f64.js";import{Z a
25
25
 
26
26
  vec2 combinedSize = inputSize * pixelRatio;
27
27
  vec4 quadOffset = vec4(0.0);
28
-
29
- ${o.occlusionTestEnabled||o.binaryHighlightOcclusionEnabled?"bool visible = testVisibilityHUD(posProj);":""}
30
-
31
- ${o.binaryHighlightOcclusionEnabled?"voccluded = visible ? 0.0 : 1.0;":""}
32
- `);const E=z`vec2 uv01 = floor(uv0);
28
+ bool visible = testVisibilityHUD(posProj);
29
+ voccluded = visible ? 0.0 : 1.0;
30
+ `);const H=j`vec2 uv01 = floor(uv0);
33
31
  vec2 uv = uv0 - uv01;
34
- quadOffset.xy = ((uv01 - anchorPosition) * 2.0 * combinedSize + screenOffsetScaled) / viewport.zw * posProj.w;`;o.pixelSnappingEnabled&&B.include(s);const U=o.pixelSnappingEnabled?F?z`posProj = alignToPixelOrigin(posProj, viewport.zw) + quadOffset;`:z`posProj += quadOffset;
32
+ quadOffset.xy = ((uv01 - anchorPosition) * 2.0 * combinedSize + screenOffsetScaled) / viewport.zw * posProj.w;`;o.pixelSnappingEnabled&&D.include(s);const U=o.pixelSnappingEnabled?$?j`posProj = alignToPixelOrigin(posProj, viewport.zw) + quadOffset;`:j`posProj += quadOffset;
35
33
  if (inputSize.x == size.x) {
36
34
  posProj = alignToPixelOrigin(posProj, viewport.zw);
37
- }`:z`posProj += quadOffset;`;B.code.add(z`
35
+ }`:j`posProj += quadOffset;`;D.code.add(j`
38
36
  ${o.occlusionTestEnabled?"if (visible) {":""}
39
- ${E}
37
+ ${H}
40
38
  ${o.vvColor?"vcolor = interpolateVVColor(featureAttribute.y) * materialColor;":"vcolor = color / 255.0 * materialColor;"}
41
39
 
42
- ${o.output===l.ObjectAndLayerIdColor?z`vcolor.a = 1.0;`:""}
40
+ ${o.output===l.ObjectAndLayerIdColor?j`vcolor.a = 1.0;`:""}
43
41
 
44
- bool alphaDiscard = vcolor.a < ${z.float(f)};
45
- ${F?`alphaDiscard = alphaDiscard && outlineColor.a < ${z.float(f)};`:""}
42
+ bool alphaDiscard = vcolor.a < ${j.float(f)};
43
+ ${$?`alphaDiscard = alphaDiscard && outlineColor.a < ${j.float(f)};`:""}
46
44
  if (alphaDiscard) {
47
45
  // "early discard" if both symbol color (= fill) and outline color (if applicable) are transparent
48
46
  gl_Position = vec4(1e38, 1e38, 1e38, 1.0);
@@ -56,14 +54,14 @@ posProj = alignToPixelOrigin(posProj, viewport.zw);
56
54
 
57
55
  ${o.debugDrawLabelBorder?"debugBorderCoords = vec4(uv01, 1.5 / combinedSize);":""}
58
56
  vsize = inputSize;
59
- ${o.occlusionTestEnabled?z`} else { vtc = vec2(0.0);
57
+ ${o.occlusionTestEnabled?j`} else { vtc = vec2(0.0);
60
58
  ${o.debugDrawLabelBorder?"debugBorderCoords = vec4(0.5, 0.5, 1.5 / combinedSize);}":"}"}`:""}
61
59
  }
62
- `),T.uniforms.add(new A("tex",(e=>e.texture)));const V=o.debugDrawLabelBorder?z`(isBorder > 0.0 ? 0.0 : ${z.float(v)})`:z.float(v),I=z`
63
- ${o.debugDrawLabelBorder?z`
60
+ `),T.uniforms.add(new y("tex",(e=>e.texture)));const V=o.debugDrawLabelBorder?j`(isBorder > 0.0 ? 0.0 : ${j.float(g)})`:j.float(g),E=j`
61
+ ${o.debugDrawLabelBorder?j`
64
62
  float isBorder = float(any(lessThan(debugBorderCoords.xy, debugBorderCoords.zw)) || any(greaterThan(debugBorderCoords.xy, 1.0 - debugBorderCoords.zw)));`:""}
65
63
 
66
- ${o.sampleSignedDistanceFieldTexelCenter?z`
64
+ ${o.sampleSignedDistanceFieldTexelCenter?j`
67
65
  // Attempt to sample texel centers to avoid that thin cross outlines
68
66
  // disappear with large symbol sizes.
69
67
  // see: https://devtopia.esri.com/WebGIS/arcgis-js-api/issues/7058#issuecomment-603041
@@ -73,11 +71,11 @@ posProj = alignToPixelOrigin(posProj, viewport.zw);
73
71
  // Calculate how much we have to add/subtract to/from each texel to reach the size of an onscreen pixel
74
72
  vec2 scaleFactor = (vsize - txSize) * texelSize;
75
73
  vec2 samplePos = vtc + (vec2(1.0, -1.0) * texelSize) * scaleFactor;
76
- `:z`
74
+ `:j`
77
75
  vec2 samplePos = vtc;
78
76
  `}
79
77
 
80
- ${F?z`
78
+ ${$?j`
81
79
  vec4 fillPixelColor = vcolor;
82
80
 
83
81
  // Get distance and map it into [-0.5, 0.5]
@@ -100,7 +98,7 @@ posProj = alignToPixelOrigin(posProj, viewport.zw);
100
98
 
101
99
  if (
102
100
  outlineAlphaFactor + fillAlphaFactor < ${V} ||
103
- fillPixelColor.a + outlinePixelColor.a < ${z.float(f)}
101
+ fillPixelColor.a + outlinePixelColor.a < ${j.float(f)}
104
102
  ) {
105
103
  discard;
106
104
  }
@@ -121,7 +119,7 @@ posProj = alignToPixelOrigin(posProj, viewport.zw);
121
119
 
122
120
  // visualize SDF:
123
121
  // fragColor = vec4(clamp(-dist/vsize.x*2.0, 0.0, 1.0), clamp(dist/vsize.x*2.0, 0.0, 1.0), 0.0, 1.0);
124
- `:z`
122
+ `:j`
125
123
  vec4 texColor = texture(tex, vtc, -0.5);
126
124
  if (texColor.a < ${V}) {
127
125
  discard;
@@ -130,30 +128,25 @@ posProj = alignToPixelOrigin(posProj, viewport.zw);
130
128
  `}
131
129
 
132
130
  // Draw debug border with transparency, so that original texels along border are still partially visible
133
- ${o.debugDrawLabelBorder?z`fragColor = mix(fragColor, vec4(1.0, 0.0, 1.0, 1.0), isBorder * 0.5);`:""}
134
- `;return o.output===l.Alpha&&T.code.add(z`
135
- void main() {
136
- ${I}
137
- fragColor = vec4(fragColor.a);
138
- }
139
- `),o.output===l.ObjectAndLayerIdColor&&T.code.add(z`
140
- void main() {
141
- ${I}
142
- outputObjectAndLayerIdColor();
143
- }
144
- `),o.output===l.Color&&T.code.add(z`
145
- void main() {
146
- ${I}
147
- ${o.transparencyPassType===O.FrontFace?"fragColor.rgb /= fragColor.a;":""}
148
- }
149
- `),o.output===l.Highlight&&(i.include(d,o),o.binaryHighlightOcclusionEnabled&&T.constants.add("occludedHighlightFlag","vec4",u).add("unoccludedHighlightFlag","vec4",p),T.code.add(z`
150
- void main() {
151
- ${I}
152
- ${o.binaryHighlightOcclusionEnabled?z`
131
+ ${o.debugDrawLabelBorder?j`fragColor = mix(fragColor, vec4(1.0, 0.0, 1.0, 1.0), isBorder * 0.5);`:""}
132
+ `;switch(o.output){case l.Color:T.code.add(j`
133
+ void main() {
134
+ ${E}
135
+ ${o.transparencyPassType===A.FrontFace?"fragColor.rgb /= fragColor.a;":""}
136
+ }`);break;case l.Alpha:T.code.add(j`
137
+ void main() {
138
+ ${E}
139
+ fragColor = vec4(fragColor.a);
140
+ }`);break;case l.ObjectAndLayerIdColor:T.code.add(j`
141
+ void main() {
142
+ ${E}
143
+ outputObjectAndLayerIdColor();
144
+ }`);break;case l.Highlight:T.constants.add("occludedHighlightFlag","vec4",d).add("unoccludedHighlightFlag","vec4",u),T.code.add(j`
145
+ void main() {
146
+ ${E}
153
147
  if (voccluded == 1.0) {
154
148
  fragColor = occludedHighlightFlag;
155
149
  } else {
156
150
  fragColor = unoccludedHighlightFlag;
157
- }`:"outputHighlight();"}
158
- }
159
- `)),i}function L(e){return e.outlineColor[3]>0&&e.outlineSize>0}function D(e,i=H){return e.textureIsSignedDistanceField?B(e.anchorPosition,e.distanceFieldBoundingBox,i):o(i,e.anchorPosition),i}function B(o,i,r){null!=i?e(r,o[0]*(i[2]-i[0])+i[0],o[1]*(i[3]-i[1])+i[1]):e(r,0,0)}const H=i(),T=Object.freeze(Object.defineProperty({__proto__:null,build:F,calculateAnchorPosForRendering:D},Symbol.toStringTag,{value:"Module"}));export{T as H,F as b,D as c};
151
+ }
152
+ }`)}return i}function F(e){return e.outlineColor[3]>0&&e.outlineSize>0}function L(e,i=B){return e.textureIsSignedDistanceField?D(e.anchorPosition,e.distanceFieldBoundingBox,i):o(i,e.anchorPosition),i}function D(o,i,r){null!=i?e(r,o[0]*(i[2]-i[0])+i[0],o[1]*(i[3]-i[1])+i[1]):e(r,0,0)}const B=i(),T=Object.freeze(Object.defineProperty({__proto__:null,build:$,calculateAnchorPosForRendering:L},Symbol.toStringTag,{value:"Module"}));export{T as H,$ as b,L as c};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import e from"../config.js";import{version as t}from"../kernel.js";import{ArcadeDate as n,createDateTimeZone as r}from"../arcade/ArcadeDate.js";import{ArcadeModule as i}from"../arcade/ArcadeModule.js";import{ArcadeExecutionError as a,ExecutionErrorCodes as o}from"../arcade/executionError.js";import{ArcadeFunction as u}from"../arcade/FunctionWrapper.js";import l from"../arcade/ImmutableArray.js";import s from"../arcade/ImmutablePathArray.js";import f from"../arcade/ImmutablePointArray.js";import{esriFieldToJson as c,layerGeometryEsriRestConstants as m}from"../arcade/featureset/support/shared.js";import{format as d,parse as y}from"../core/number.js";import{DateOnly as p}from"../core/sql/DateOnly.js";import{TimeOnly as g}from"../core/sql/TimeOnly.js";import h from"../geometry/Extent.js";import b from"../geometry/Geometry.js";import N from"../geometry/Multipoint.js";import S from"../geometry/Point.js";import x from"../geometry/Polygon.js";import D from"../geometry/Polyline.js";import{isClockwise as M}from"../geometry/support/coordsUtils.js";import{getLocale as T}from"../intl/locale.js";import{DateTime as j}from"luxon";class k{constructor(e){this.value=e}}class F{constructor(e){this.value=e}}const A=F,C=k,O={type:"VOID"},R={type:"BREAK"},I={type:"CONTINUE"};function Z(e,t,n){return""===t||null==t||t===n||t===n?e:e=e.split(t).join(n)}function w(e){return e instanceof u}function v(e){return e instanceof i}function _(e){return!!Y(e)||(!!G(e)||(!!$(e)||(!!Q(e)||(!!X(e)||(!!P(e)||(null===e||(e===O||"number"==typeof e)))))))}function J(e,t){return void 0===e?t:e}function L(e){return null==e?"":V(e)||W(e)?"Array":$(e)?"Date":X(e)?"Time":Q(e)?"DateOnly":Y(e)?"String":P(e)?"Boolean":G(e)?"Number":"esri.arcade.Attachment"===e?.declaredClass?"Attachment":"esri.arcade.Portal"===e?.declaredClass?"Portal":"esri.arcade.Dictionary"===e?.declaredClass?"Dictionary":e instanceof i?"Module":q(e)?"Feature":e instanceof S?"Point":e instanceof x?"Polygon":e instanceof D?"Polyline":e instanceof N?"Multipoint":e instanceof h?"Extent":w(e)?"Function":H(e)?"FeatureSet":B(e)?"FeatureSetCollection":e===O?"":"number"==typeof e&&isNaN(e)?"Number":"Unrecognized Type"}function Y(e){return"string"==typeof e||e instanceof String}function P(e){return"boolean"==typeof e}function G(e){return"number"==typeof e}function z(e){return"number"==typeof e&&isFinite(e)&&Math.floor(e)===e}function E(e){return e instanceof b}function V(e){return e instanceof Array}function q(e){return"esri.arcade.Feature"===e?.arcadeDeclaredClass}function H(e){return"esri.arcade.featureset.support.FeatureSet"===e?.declaredRootClass}function U(e){return"esri.arcade.Dictionary"===e?.declaredClass}function B(e){return"esri.arcade.featureSetCollection"===e?.declaredRootClass}function W(e){return e instanceof l}function $(e){return e instanceof n}function Q(e){return e instanceof p}function X(e){return e instanceof g}function K(e){return null!=e&&"object"==typeof e}function ee(e){return e instanceof Date}function te(e,t,n,r,i){if(e.length<t||e.length>n)throw new a(r,o.WrongNumberOfParameters,i)}function ne(e){return e<0?-Math.round(-e):Math.round(e)}function re(){let e=Date.now();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replaceAll(/[xy]/g,(t=>{const n=(e+16*Math.random())%16|0;return e=Math.floor(e/16),("x"===t?n:3&n|8).toString(16)}))}function ie(e,t){return isNaN(e)||null==t||""===t?e.toString():(t=Z(t,"‰",""),t=Z(t,"¤",""),d(e,{pattern:t}))}function ae(e,t){return null==t||""===t?e.toISOString(!0):e.toFormat(oe(t),{locale:T(),numberingSystem:"latn"})}function oe(e){e=e.replaceAll(/LTS|LT|LL?L?L?|l{1,4}/g,"[$&]");let t="";const n=/(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|N{1,5}|YYYYYY|YYYYY|YYYY|YY|y{2,4}|yo?|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g;for(const r of e.match(n)||[])switch(r){case"D":t+="d";break;case"DD":t+="dd";break;case"DDD":t+="o";break;case"d":t+="c";break;case"ddd":t+="ccc";break;case"dddd":t+="cccc";break;case"M":t+="L";break;case"MM":t+="LL";break;case"MMM":t+="LLL";break;case"MMMM":t+="LLLL";break;case"YY":t+="yy";break;case"Y":case"YYYY":t+="yyyy";break;case"Q":t+="q";break;case"Z":t+="ZZ";break;case"ZZ":t+="ZZZ";break;case"S":t+="'S'";break;case"SS":t+="'SS'";break;case"SSS":t+="u";break;case"A":case"a":t+="a";break;case"m":case"mm":case"h":case"hh":case"H":case"HH":case"s":case"ss":case"X":case"x":t+=r;break;default:r.length>=2&&"["===r.slice(0,1)&&"]"===r.slice(-1)?t+=`'${r.slice(1,-1)}'`:t+=`'${r}'`}return t}function ue(e,t,n){switch(n){case">":return e>t;case"<":return e<t;case">=":return e>=t;case"<=":return e<=t}return!1}function le(e,t,n){if(null===e){if(null===t||t===O)return ue(null,null,n);if(G(t))return ue(0,t,n);if(Y(t))return ue(0,ye(t),n);if(P(t))return ue(0,ye(t),n);if($(t))return ue(0,t.toNumber(),n);if(X(t))return ue(e,t.toNumber(),n);if(Q(t))return ue(e,t.toNumber(),n)}if(e===O){if(null===t||t===O)return ue(null,null,n);if(G(t))return ue(0,t,n);if(Y(t))return ue(0,ye(t),n);if(P(t))return ue(0,ye(t),n);if($(t))return ue(0,t.toNumber(),n);if(X(t))return ue(e,t.toNumber(),n);if(Q(t))return ue(e,t.toNumber(),n)}else if(G(e)){if(G(t))return ue(e,t,n);if(P(t))return ue(e,ye(t),n);if(null===t||t===O)return ue(e,0,n);if(Y(t))return ue(e,ye(t),n);if($(t))return ue(e,t.toNumber(),n);if(X(t))return ue(e,t.toNumber(),n);if(Q(t))return ue(e,t.toNumber(),n)}else if(Y(e)){if(Y(t))return ue(fe(e),fe(t),n);if($(t))return ue(ye(e),t.toNumber(),n);if(X(t))return ue(ye(e),t.toNumber(),n);if(Q(t))return ue(ye(e),t.toNumber(),n);if(G(t))return ue(ye(e),t,n);if(null===t||t===O)return ue(ye(e),0,n);if(P(t))return ue(ye(e),ye(t),n)}else if($(e)){if($(t))return ue(e.toNumber(),t.toNumber(),n);if(null===t||t===O)return ue(e.toNumber(),0,n);if(G(t))return ue(e.toNumber(),t,n);if(P(t))return ue(e.toNumber(),ye(t),n);if(Y(t))return ue(e.toNumber(),ye(t),n);if(X(t))return ue(e.toNumber(),t.toNumber(),n);if(Q(t))return ue(e.toNumber(),t.toNumber(),n)}else if(P(e)){if(P(t))return ue(e,t,n);if(G(t))return ue(ye(e),ye(t),n);if($(t))return ue(ye(e),t.toNumber(),n);if(X(t))return ue(ye(e),t.toNumber(),n);if(Q(t))return ue(ye(e),t.toNumber(),n);if(null===t||t===O)return ue(ye(e),0,n);if(Y(t))return ue(ye(e),ye(t),n)}else if(Q(e)){if($(t))return ue(e.toNumber(),t.toNumber(),n);if(null===t||t===O)return ue(e.toNumber(),0,n);if(G(t))return ue(e.toNumber(),t,n);if(P(t))return ue(e.toNumber(),ye(t),n);if(Y(t))return ue(e.toNumber(),ye(t),n);if(X(t))return ue(e.toNumber(),t.toNumber(),n);if(Q(t))return ue(e.toNumber(),t.toNumber(),n)}else if(X(e)){if($(t))return ue(e.toNumber(),t.toNumber(),n);if(null===t||t===O)return ue(e.toNumber(),0,n);if(G(t))return ue(e.toNumber(),t,n);if(P(t))return ue(e.toNumber(),ye(t),n);if(Y(t))return ue(e.toNumber(),ye(t),n);if(X(t))return ue(e.toNumber(),t.toNumber(),n);if(Q(t))return ue(e.toNumber(),t.toNumber(),n)}return!!se(e,t)&&("<="===n||">="===n)}function se(e,t){if(e===t)return!0;if(null===e&&t===O||null===t&&e===O)return!0;if($(e)&&$(t))return e.equals(t);if(X(e)&&X(t))return e.equals(t);if(Q(e)&&Q(t))return e.equals(t);if(e instanceof s)return e.equalityTest(t);if(e instanceof f)return e.equalityTest(t);if(e instanceof S&&t instanceof S){const n=e.cache._arcadeCacheId,r=t.cache._arcadeCacheId;if(null!=n)return n===r}if(K(e)&&K(t)){if(e._arcadeCacheId===t._arcadeCacheId&&void 0!==e._arcadeCacheId&&null!==e._arcadeCacheId)return!0;if(e._underlyingGraphic===t._underlyingGraphic&&void 0!==e._underlyingGraphic&&null!==e._underlyingGraphic)return!0}return!1}function fe(e,t){if(Y(e))return e;if(null===e)return"";if(G(e))return ie(e,t);if(P(e))return e.toString();if($(e))return ae(e,t);if(X(e))return e.toFormat(t);if(Q(e))return e.toFormat(t);if(e instanceof b)return JSON.stringify(e.toJSON());if(V(e)){const t=[];for(let n=0;n<e.length;n++)t[n]=de(e[n]);return"["+t.join(",")+"]"}if(e instanceof l){const t=[];for(let n=0;n<e.length();n++)t[n]=de(e.get(n));return"["+t.join(",")+"]"}return null!==e&&"object"==typeof e&&void 0!==e.castToText?e.castToText():w(e)?"object, Function":e===O?"":v(e)?"object, Module":""}function ce(e){const t=[];if(!V(e))return null;if(e instanceof l){for(let n=0;n<e.length();n++)t[n]=ye(e.get(n));return t}for(let n=0;n<e.length;n++)t[n]=ye(e[n]);return t}function me(e,t,n=!1){if(Y(e))return e;if(null===e)return"";if(G(e))return ie(e,t);if(P(e))return e.toString();if($(e))return ae(e,t);if(X(e))return e.toFormat(t);if(Q(e))return e.toFormat(t);if(e instanceof b)return e instanceof h?'{"xmin":'+e.xmin.toString()+',"ymin":'+e.ymin.toString()+","+(e.hasZ?'"zmin":'+e.zmin.toString()+",":"")+(e.hasM?'"mmin":'+e.mmin.toString()+",":"")+'"xmax":'+e.xmax.toString()+',"ymax":'+e.ymax.toString()+","+(e.hasZ?'"zmax":'+e.zmax.toString()+",":"")+(e.hasM?'"mmax":'+e.mmax.toString()+",":"")+'"spatialReference":'+Te(e.spatialReference)+"}":Te(e.toJSON(),((e,t)=>e.key===t.key?0:"spatialReference"===e.key?1:"spatialReference"===t.key||e.key<t.key?-1:e.key>t.key?1:0));if(V(e)){const t=[];for(let r=0;r<e.length;r++)t[r]=de(e[r],n);return"["+t.join(",")+"]"}if(e instanceof l){const t=[];for(let r=0;r<e.length();r++)t[r]=de(e.get(r),n);return"["+t.join(",")+"]"}return null!==e&&"object"==typeof e&&void 0!==e.castToText?e.castToText(n):w(e)?"object, Function":e===O?"":v(e)?"object, Module":""}function de(e,t=!1){if(null===e)return"null";if(P(e)||G(e)||Y(e))return JSON.stringify(e);if(e instanceof b)return me(e,null,t);if(e instanceof l)return me(e,null,t);if(e instanceof Array)return me(e,null,t);if($(e))return t?JSON.stringify(e.getTime()):JSON.stringify(ae(e,""));if(X(e))return JSON.stringify(e.toString());if(Q(e))return JSON.stringify(e.toString());if(null!==e&&"object"==typeof e){if(void 0!==e.castToText)return e.castToText(t)}else if(e===O)return"null";return"null"}function ye(e,t){return G(e)?e:null===e||""===e?0:$(e)||Q(e)||X(e)?NaN:P(e)?e?1:0:V(e)||""===e||void 0===e?NaN:void 0!==t&&Y(e)?(t=Z(t,"‰",""),t=Z(t,"¤",""),y(e,{pattern:t})):e===O?0:Number(e)}function pe(e,t){if($(e))return e;if(Y(e)){const r=ge(e,t);if(r)return n.dateTimeToArcadeDate(r)}return null}function ge(e,t){const n=/ (\d\d)/,i=r(t);let a=j.fromISO(e,{zone:i});return a.isValid||n.test(e)&&(e=e.replace(n,"T$1"),a=j.fromISO(e,{zone:t}),a.isValid)?a:null}function he(e){return P(e)?e:Y(e)?"true"===(e=e.toLowerCase()):!!G(e)&&(0!==e&&!isNaN(e))}function be(e,t){return null==e?null:(null!==e.spatialReference&&void 0!==e.spatialReference||(e.spatialReference=t),e)}function Ne(e){if(null===e)return null;if(e instanceof S)return"NaN"===e.x||null===e.x||isNaN(e.x)?null:e;if(e instanceof x){if(0===e.rings.length)return null;for(const t of e.rings)if(t.length>0)return e;return null}if(e instanceof D){if(0===e.paths.length)return null;for(const t of e.paths)if(t.length>0)return e;return null}return e instanceof N?0===e.points.length?null:e:e instanceof h?"NaN"===e.xmin||null===e.xmin||isNaN(e.xmin)?null:e:null}function Se(e,t){if(!e)return t;if(!e.domain)return t;let n=null,r=null;if("string"===e.field.type||"esriFieldTypeString"===e.field.type)n=fe(t);else{if(null==t)return null;if(""===t)return t;n=ye(t)}for(let i=0;i<e.domain.codedValues.length;i++){const t=e.domain.codedValues[i];t.code===n&&(r=t)}return null===r?fe(t):r.name}function xe(e,t){if(!e)return t;if(!e.domain)return t;let n=null;const r=fe(t);for(let i=0;i<e.domain.codedValues.length;i++){const t=e.domain.codedValues[i];t.name===r&&(n=t)}return null===n?t:n.code}function De(e,t,n=null,r=null){if(!t)return null;if(!t.fields)return null;let i,u,l=null;for(let a=0;a<t.fields.length;a++){const n=t.fields[a];n.name.toLowerCase()===e.toString().toLowerCase()&&(l=n)}if(null===l)throw new a(null,o.FieldNotFound,null,{key:e});if(null===r&&n&&t.typeIdField)r=n.hasField(t.typeIdField)?n.field(t.typeIdField):null;else if(t.typeIdField&&null!==r){let e=!1;for(const n of t.types||[])if(r===n.id){e=!0;break}if(!e)for(const n of t.types||[])if(r===n.name){r=n.id,e=!0;break}e||(r=null,n&&t.typeIdField&&(r=n.hasField(t.typeIdField)?n.field(t.typeIdField):null))}return null!=r&&t.types.some((e=>e.id===r&&(i=e.domains&&e.domains[l.name],i&&"inherited"===i.type&&(i=Me(l.name,t),u=!0),!0))),u||i||(i=Me(e,t)),{field:l,domain:i}}function Me(e,t){let n;return t.fields.some((t=>(t.name.toLowerCase()===e.toLowerCase()&&(n=t.domain),!!n))),n}function Te(e,t){t||(t={}),"function"==typeof t&&(t={cmp:t});const n="boolean"==typeof t.cycles&&t.cycles,r=t.cmp&&(i=t.cmp,function(e){return function(t,n){const r={key:t,value:e[t]},a={key:n,value:e[n]};return i(r,a)}});var i;const a=[];return function e(t){if(t&&t.toJSON&&"function"==typeof t.toJSON&&(t=t.toJSON()),void 0===t)return;if("number"==typeof t)return isFinite(t)?""+t:"null";if("object"!=typeof t)return JSON.stringify(t);let i,o;if(Array.isArray(t)){for(o="[",i=0;i<t.length;i++)i&&(o+=","),o+=e(t[i])||"null";return o+"]"}if(null===t)return"null";if(a.includes(t)){if(n)return JSON.stringify("__cycle__");throw new TypeError("Converting circular structure to JSON")}const u=a.push(t)-1,l=Object.keys(t).sort(r&&r(t));for(o="",i=0;i<l.length;i++){const n=l[i],r=e(t[n]);r&&(o&&(o+=","),o+=JSON.stringify(n)+":"+r)}return a.splice(u,1),"{"+o+"}"}(e)}function je(e){if(null===e)return null;const t=[];for(const n of e)n&&n.arcadeDeclaredClass&&"esri.arcade.Feature"===n.arcadeDeclaredClass?t.push(n.geometry()):t.push(n);return t}function ke(e,t){if(!(t instanceof S))throw new a(null,o.InvalidParameter,null);e.push(t.hasZ?t.hasM?[t.x,t.y,t.z,t.m]:[t.x,t.y,t.z]:[t.x,t.y])}function Fe(e,t){if(V(e)||W(e)){let n=!1,r=!1,i=[],u=t;if(V(e)){for(const t of e)ke(i,t);i.length>0&&(u=e[0].spatialReference,n=e[0].hasZ,r=e[0].hasM)}else if(e instanceof f)i=e._elements,i.length>0&&(n=e._hasZ,r=e._hasM,u=e.get(0).spatialReference);else{if(!W(e))throw new a(null,o.InvalidParameter,null);for(const t of e.toArray())ke(i,t);i.length>0&&(u=e.get(0).spatialReference,n=!0===e.get(0).hasZ,r=!0===e.get(0).hasM)}if(0===i.length)return null;return M(i)||(i=i.slice(0).reverse()),new x({rings:[i],spatialReference:u,hasZ:n,hasM:r})}return e}function Ae(e,t){if(V(e)||W(e)){let n=!1,r=!1,i=[],a=t;if(V(e)){for(const t of e)ke(i,t);i.length>0&&(a=e[0].spatialReference,n=!0===e[0].hasZ,r=!0===e[0].hasM)}else if(e instanceof f)i=e._elements,i.length>0&&(n=e._hasZ,r=e._hasM,a=e.get(0).spatialReference);else if(W(e)){for(const t of e.toArray())ke(i,t);i.length>0&&(a=e.get(0).spatialReference,n=!0===e.get(0).hasZ,r=!0===e.get(0).hasM)}return 0===i.length?null:new D({paths:[i],spatialReference:a,hasZ:n,hasM:r})}return e}function Ce(e,t){if(V(e)||W(e)){let n=!1,r=!1,i=[],a=t;if(V(e)){for(const t of e)ke(i,t);i.length>0&&(a=e[0].spatialReference,n=!0===e[0].hasZ,r=!0===e[0].hasM)}else if(e instanceof f)i=e._elements,i.length>0&&(n=e._hasZ,r=e._hasM,a=e.get(0).spatialReference);else if(W(e)){for(const t of e.toArray())ke(i,t);i.length>0&&(a=e.get(0).spatialReference,n=!0===e.get(0).hasZ,r=!0===e.get(0).hasM)}return 0===i.length?null:new N({points:i,spatialReference:a,hasZ:n,hasM:r})}return e}function Oe(e,t=!1){const n=[];if(null===e)return n;if(!0===V(e)){for(let r=0;r<e.length;r++){const i=fe(e[r]);""===i&&!0!==t||n.push(i)}return n}if(e instanceof l){for(let r=0;r<e.length();r++){const i=fe(e.get(r));""===i&&!0!==t||n.push(i)}return n}if(_(e)){const r=fe(e);return""===r&&!0!==t||n.push(r),n}return[]}let Re=0;function Ie(e){return Re++,Re%100==0?(Re=0,new Promise((t=>{setTimeout((()=>{t(e)}),0)}))):e}function Ze(e,t,n){switch(n){case"&":return e&t;case"|":return e|t;case"^":return e^t;case"<<":return e<<t;case">>":return e>>t;case">>>":return e>>>t}}function we(e,t=null){return null==e?null:P(e)||G(e)||Y(e)?e:e instanceof b?!0===t?.keepGeometryType?e:e.toJSON():e instanceof l?e.toArray().map((e=>we(e,t))):e instanceof Array?e.map((e=>we(e,t))):ee(e)?e:$(e)?e.toJSDate():X(e)?e.toString():Q(e)?e.toJSDate():null!==e&&"object"==typeof e&&void 0!==e.castAsJson?e.castAsJson(t):null}async function ve(e,t,n,r,i){const a=await _e(e,t,n);i[r]=a}async function _e(e,t=null,n=null){if(e instanceof l&&(e=e.toArray()),null==e)return null;if(_(e)||e instanceof b||ee(e)||$(e))return we(e,n);if(e instanceof Array){const r=[],i=[];for(const a of e)null===a||_(a)||a instanceof b||ee(a)||$(a)?i.push(we(a,n)):(i.push(null),r.push(ve(a,t,n,i.length-1,i)));return r.length>0&&await Promise.all(r),i}return null!==e&&"object"==typeof e&&void 0!==e.castAsJsonAsync?e.castAsJsonAsync(t,n):null}function Je(e){return Le(e)?e.parent:e}function Le(e){return e&&"declaredClass"in e&&"esri.layers.support.SubtypeSublayer"===e.declaredClass}function Ye(e){return e&&"declaredClass"in e&&"esri.layers.SubtypeGroupLayer"===e.declaredClass}function Pe(e,t,n){const r=Je(e.fullSchema());if(null===r)return null;if(!r.fields)return null;return De(t,r,e,n)}function Ge(e){const t=Je(e.fullSchema());return null===t?null:t.fields&&t.typeIdField?{subtypeField:t.typeIdField,subtypes:t.types?t.types.map((e=>({name:e.name,code:e.id}))):[]}:null}function ze(e,t,n,r){const i=Je(e.fullSchema());if(null===i)return null;if(!i.fields)return null;const a=De(t,i,e,r);if(void 0===n)try{n=e.field(t)}catch(o){return null}return Se(a,n)}function Ee(e,t,n,r){const i=Je(e.fullSchema());if(null===i)return null;if(!i.fields)return null;if(void 0===n){try{n=e.field(t)}catch(a){return null}return n}return xe(De(t,i,e,r),n)}function Ve(e){return e?.timeReference?.timeZone??"system"}function qe(e){const t=Je(e.fullSchema());if(null===t)return null;if(!t.fields)return null;const n=[];for(const r of t.fields)n.push(c(r));return{objectIdField:t.objectIdField,globalIdField:t.globalIdField??"",geometryType:void 0===m[t.geometryType]?"":m[t.geometryType],fields:n}}function He(r,i){return"system"===r&&(r=n.systemTimeZoneCanonicalName),{version:Ue,engineVersion:t,timeZone:r,spatialReference:i.toJSON(),application:e.applicationName??"",engine:"web",locale:T()}}const Ue="1.23",Be=Object.freeze(Object.defineProperty({__proto__:null,ImplicitResult:A,ImplicitResultE:F,ReturnResult:C,ReturnResultE:k,absRound:ne,arcadeVersion:Ue,autoCastArrayOfPointsToMultiPoint:Ce,autoCastArrayOfPointsToPolygon:Fe,autoCastArrayOfPointsToPolyline:Ae,autoCastFeatureToGeometry:je,binaryOperator:Ze,breakResult:R,castAsJson:we,castAsJsonAsync:_e,continueResult:I,defaultExecutingContext:He,defaultTimeZone:Ve,defaultUndefined:J,equalityTest:se,featureDomainCodeLookup:Ee,featureDomainValueLookup:ze,featureFullDomain:Pe,featureSchema:qe,featureSubtypes:Ge,fixNullGeometry:Ne,fixSpatialReference:be,formatDate:ae,formatNumber:ie,generateUUID:re,getDomain:De,getDomainCode:xe,getDomainValue:Se,getType:L,greaterThanLessThan:le,isArray:V,isBoolean:P,isDate:$,isDateOnly:Q,isDictionary:U,isFeature:q,isFeatureSet:H,isFeatureSetCollection:B,isFunctionParameter:w,isGeometry:E,isImmutableArray:W,isInteger:z,isJsDate:ee,isModule:v,isNumber:G,isObject:K,isSimpleType:_,isString:Y,isSubtypeGrouplayer:Ye,isSubtypeSublayer:Le,isTime:X,multiReplace:Z,pcCheck:te,stableStringify:Te,standardiseDateFormat:oe,tick:Ie,toBoolean:he,toDate:pe,toNumber:ye,toNumberArray:ce,toString:fe,toStringArray:Oe,toStringExplicit:me,voidOperation:O},Symbol.toStringTag,{value:"Module"}));export{Ye as $,be as A,le as B,se as C,Ze as D,te as E,je as F,Fe as G,J as H,A as I,Ae as J,Ce as K,Ve as L,z as M,L as N,oe as O,ne as P,Ne as Q,C as R,Z as S,re as T,qe as U,Ge as V,Pe as W,ze as X,Ee as Y,He as Z,ce as _,P as a,Le as a0,Ie as a1,Oe as a2,De as a3,Se as a4,xe as a5,k as a6,F as a7,v as a8,K as a9,ee as aa,ie as ab,ae as ac,Te as ad,Ue as ae,G as b,Y as c,we as d,_e as e,_ as f,ye as g,he as h,w as i,fe as j,$ as k,pe as l,Q as m,X as n,V as o,E as p,W as q,q as r,B as s,me as t,H as u,U as v,Be as w,O as x,R as y,I as z};
5
+ import e from"../config.js";import{version as t}from"../kernel.js";import{ArcadeDate as n,createDateTimeZone as r}from"../arcade/ArcadeDate.js";import{ArcadeModule as i}from"../arcade/ArcadeModule.js";import{ArcadeExecutionError as a,ExecutionErrorCodes as o}from"../arcade/executionError.js";import{ArcadeFunction as u}from"../arcade/FunctionWrapper.js";import l from"../arcade/ImmutableArray.js";import s from"../arcade/ImmutablePathArray.js";import f from"../arcade/ImmutablePointArray.js";import{esriFieldToJson as c,layerGeometryEsriRestConstants as m}from"../arcade/featureset/support/shared.js";import{format as d,parse as y}from"../core/number.js";import{DateOnly as p}from"../core/sql/DateOnly.js";import{TimeOnly as g}from"../core/sql/TimeOnly.js";import h from"../geometry/Extent.js";import b from"../geometry/Geometry.js";import N from"../geometry/Multipoint.js";import S from"../geometry/Point.js";import x from"../geometry/Polygon.js";import D from"../geometry/Polyline.js";import{isClockwise as T}from"../geometry/support/coordsUtils.js";import{getLocale as C}from"../intl/locale.js";import{DateTime as A}from"luxon";class M{constructor(e){this.value=e}}class j{constructor(e){this.value=e}}const k=j,F=M,w={type:"VOID"},O={type:"BREAK"},R={type:"CONTINUE"};function I(e,t,n){return""===t||null==t||t===n||t===n?e:e=e.split(t).join(n)}function Z(e){return e instanceof u}function v(e){return e instanceof i}function _(e){return!!Y(e)||(!!G(e)||(!!$(e)||(!!Q(e)||(!!X(e)||(!!P(e)||(null===e||(e===w||"number"==typeof e)))))))}function J(e,t){return void 0===e?t:e}function L(e){return null==e?"":V(e)||W(e)?"Array":$(e)?"Date":X(e)?"Time":Q(e)?"DateOnly":Y(e)?"String":P(e)?"Boolean":G(e)?"Number":"esri.arcade.Attachment"===e?.declaredClass?"Attachment":"esri.arcade.Portal"===e?.declaredClass?"Portal":"esri.arcade.Dictionary"===e?.declaredClass?"Dictionary":e instanceof i?"Module":q(e)?"Feature":e instanceof S?"Point":e instanceof x?"Polygon":e instanceof D?"Polyline":e instanceof N?"Multipoint":e instanceof h?"Extent":Z(e)?"Function":H(e)?"FeatureSet":B(e)?"FeatureSetCollection":e===w?"":"number"==typeof e&&isNaN(e)?"Number":"Unrecognized Type"}function Y(e){return"string"==typeof e||e instanceof String}function P(e){return"boolean"==typeof e}function G(e){return"number"==typeof e}function z(e){return"number"==typeof e&&isFinite(e)&&Math.floor(e)===e}function E(e){return e instanceof b}function V(e){return e instanceof Array}function q(e){return"esri.arcade.Feature"===e?.arcadeDeclaredClass}function H(e){return"esri.arcade.featureset.support.FeatureSet"===e?.declaredRootClass}function U(e){return"esri.arcade.Dictionary"===e?.declaredClass}function B(e){return"esri.arcade.featureSetCollection"===e?.declaredRootClass}function W(e){return e instanceof l}function $(e){return e instanceof n}function Q(e){return e instanceof p}function X(e){return e instanceof g}function K(e){return null!=e&&"object"==typeof e}function ee(e){return e instanceof Date}function te(e,t,n,r,i){if(e.length<t||e.length>n)throw new a(r,o.WrongNumberOfParameters,i)}function ne(e){return e<0?-Math.round(-e):Math.round(e)}function re(){let e=Date.now();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replaceAll(/[xy]/g,(t=>{const n=(e+16*Math.random())%16|0;return e=Math.floor(e/16),("x"===t?n:3&n|8).toString(16)}))}function ie(e,t){return isNaN(e)||null==t||""===t?e.toString():(t=I(t,"‰",""),t=I(t,"¤",""),d(e,{pattern:t}))}function ae(e,t){return null==t||""===t?e.toISOString(!0):e.toFormat(oe(t),{locale:C(),numberingSystem:"latn"})}function oe(e){e=e.replaceAll(/LTS|LT|LL?L?L?|l{1,4}/g,"[$&]");let t="";const n=/(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|N{1,5}|YYYYYY|YYYYY|YYYY|YY|y{2,4}|yo?|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g;for(const r of e.match(n)||[])switch(r){case"D":t+="d";break;case"DD":t+="dd";break;case"DDD":t+="o";break;case"d":t+="c";break;case"ddd":t+="ccc";break;case"dddd":t+="cccc";break;case"M":t+="L";break;case"MM":t+="LL";break;case"MMM":t+="LLL";break;case"MMMM":t+="LLLL";break;case"YY":t+="yy";break;case"Y":case"YYYY":t+="yyyy";break;case"Q":t+="q";break;case"Z":t+="ZZ";break;case"ZZ":t+="ZZZ";break;case"S":t+="'S'";break;case"SS":t+="'SS'";break;case"SSS":t+="u";break;case"A":case"a":t+="a";break;case"m":case"mm":case"h":case"hh":case"H":case"HH":case"s":case"ss":case"X":case"x":t+=r;break;default:r.length>=2&&"["===r.slice(0,1)&&"]"===r.slice(-1)?t+=`'${r.slice(1,-1)}'`:t+=`'${r}'`}return t}function ue(e,t,n){switch(n){case">":return e>t;case"<":return e<t;case">=":return e>=t;case"<=":return e<=t}return!1}function le(e,t,n){if(null===e){if(null===t||t===w)return ue(null,null,n);if(G(t))return ue(0,t,n);if(Y(t))return ue(0,ye(t),n);if(P(t))return ue(0,ye(t),n);if($(t))return ue(0,t.toNumber(),n);if(X(t))return ue(e,t.toNumber(),n);if(Q(t))return ue(e,t.toNumber(),n)}if(e===w){if(null===t||t===w)return ue(null,null,n);if(G(t))return ue(0,t,n);if(Y(t))return ue(0,ye(t),n);if(P(t))return ue(0,ye(t),n);if($(t))return ue(0,t.toNumber(),n);if(X(t))return ue(e,t.toNumber(),n);if(Q(t))return ue(e,t.toNumber(),n)}else if(G(e)){if(G(t))return ue(e,t,n);if(P(t))return ue(e,ye(t),n);if(null===t||t===w)return ue(e,0,n);if(Y(t))return ue(e,ye(t),n);if($(t))return ue(e,t.toNumber(),n);if(X(t))return ue(e,t.toNumber(),n);if(Q(t))return ue(e,t.toNumber(),n)}else if(Y(e)){if(Y(t))return ue(fe(e),fe(t),n);if($(t))return ue(ye(e),t.toNumber(),n);if(X(t))return ue(ye(e),t.toNumber(),n);if(Q(t))return ue(ye(e),t.toNumber(),n);if(G(t))return ue(ye(e),t,n);if(null===t||t===w)return ue(ye(e),0,n);if(P(t))return ue(ye(e),ye(t),n)}else if($(e)){if($(t))return ue(e.toNumber(),t.toNumber(),n);if(null===t||t===w)return ue(e.toNumber(),0,n);if(G(t))return ue(e.toNumber(),t,n);if(P(t))return ue(e.toNumber(),ye(t),n);if(Y(t))return ue(e.toNumber(),ye(t),n);if(X(t))throw new a(null,o.CannotCompareDateAndTime,null);if(Q(t))return ue(e.toNumber(),t.toNumber(),n)}else if(P(e)){if(P(t))return ue(e,t,n);if(G(t))return ue(ye(e),ye(t),n);if($(t))return ue(ye(e),t.toNumber(),n);if(X(t))return ue(ye(e),t.toNumber(),n);if(Q(t))return ue(ye(e),t.toNumber(),n);if(null===t||t===w)return ue(ye(e),0,n);if(Y(t))return ue(ye(e),ye(t),n)}else if(Q(e)){if($(t))return ue(e.toNumber(),t.toNumber(),n);if(null===t||t===w)return ue(e.toNumber(),0,n);if(G(t))return ue(e.toNumber(),t,n);if(P(t))return ue(e.toNumber(),ye(t),n);if(Y(t))return ue(e.toNumber(),ye(t),n);if(X(t))throw new a(null,o.CannotCompareDateAndTime,null);if(Q(t))return ue(e.toNumber(),t.toNumber(),n)}else if(X(e)){if($(t))throw new a(null,o.CannotCompareDateAndTime,null);if(null===t||t===w)return ue(e.toNumber(),0,n);if(G(t))return ue(e.toNumber(),t,n);if(P(t))return ue(e.toNumber(),ye(t),n);if(Y(t))return ue(e.toNumber(),ye(t),n);if(X(t))return ue(e.toNumber(),t.toNumber(),n);if(Q(t))throw new a(null,o.CannotCompareDateAndTime,null)}return!!se(e,t)&&("<="===n||">="===n)}function se(e,t){if(e===t)return!0;if(null===e&&t===w||null===t&&e===w)return!0;if($(e)&&$(t))return e.equals(t);if(X(e)&&X(t))return e.equals(t);if(Q(e)&&Q(t))return e.equals(t);if(e instanceof s)return e.equalityTest(t);if(e instanceof f)return e.equalityTest(t);if(e instanceof S&&t instanceof S){const n=e.cache._arcadeCacheId,r=t.cache._arcadeCacheId;if(null!=n)return n===r}if(K(e)&&K(t)){if(e._arcadeCacheId===t._arcadeCacheId&&void 0!==e._arcadeCacheId&&null!==e._arcadeCacheId)return!0;if(e._underlyingGraphic===t._underlyingGraphic&&void 0!==e._underlyingGraphic&&null!==e._underlyingGraphic)return!0}return!1}function fe(e,t){if(Y(e))return e;if(null===e)return"";if(G(e))return ie(e,t);if(P(e))return e.toString();if($(e))return ae(e,t);if(X(e))return e.toFormat(t);if(Q(e))return e.toFormat(t);if(e instanceof b)return JSON.stringify(e.toJSON());if(V(e)){const t=[];for(let n=0;n<e.length;n++)t[n]=de(e[n]);return"["+t.join(",")+"]"}if(e instanceof l){const t=[];for(let n=0;n<e.length();n++)t[n]=de(e.get(n));return"["+t.join(",")+"]"}return null!==e&&"object"==typeof e&&void 0!==e.castToText?e.castToText():Z(e)?"object, Function":e===w?"":v(e)?"object, Module":""}function ce(e){const t=[];if(!V(e))return null;if(e instanceof l){for(let n=0;n<e.length();n++)t[n]=ye(e.get(n));return t}for(let n=0;n<e.length;n++)t[n]=ye(e[n]);return t}function me(e,t,n=!1){if(Y(e))return e;if(null===e)return"";if(G(e))return ie(e,t);if(P(e))return e.toString();if($(e))return ae(e,t);if(X(e))return e.toFormat(t);if(Q(e))return e.toFormat(t);if(e instanceof b)return e instanceof h?'{"xmin":'+e.xmin.toString()+',"ymin":'+e.ymin.toString()+","+(e.hasZ?'"zmin":'+e.zmin.toString()+",":"")+(e.hasM?'"mmin":'+e.mmin.toString()+",":"")+'"xmax":'+e.xmax.toString()+',"ymax":'+e.ymax.toString()+","+(e.hasZ?'"zmax":'+e.zmax.toString()+",":"")+(e.hasM?'"mmax":'+e.mmax.toString()+",":"")+'"spatialReference":'+Ce(e.spatialReference)+"}":Ce(e.toJSON(),((e,t)=>e.key===t.key?0:"spatialReference"===e.key?1:"spatialReference"===t.key||e.key<t.key?-1:e.key>t.key?1:0));if(V(e)){const t=[];for(let r=0;r<e.length;r++)t[r]=de(e[r],n);return"["+t.join(",")+"]"}if(e instanceof l){const t=[];for(let r=0;r<e.length();r++)t[r]=de(e.get(r),n);return"["+t.join(",")+"]"}return null!==e&&"object"==typeof e&&void 0!==e.castToText?e.castToText(n):Z(e)?"object, Function":e===w?"":v(e)?"object, Module":""}function de(e,t=!1){if(null===e)return"null";if(P(e)||G(e)||Y(e))return JSON.stringify(e);if(e instanceof b)return me(e,null,t);if(e instanceof l)return me(e,null,t);if(e instanceof Array)return me(e,null,t);if($(e))return t?JSON.stringify(e.getTime()):JSON.stringify(ae(e,""));if(X(e))return JSON.stringify(e.toString());if(Q(e))return JSON.stringify(e.toString());if(null!==e&&"object"==typeof e){if(void 0!==e.castToText)return e.castToText(t)}else if(e===w)return"null";return"null"}function ye(e,t){return G(e)?e:null===e||""===e?0:$(e)||Q(e)||X(e)?NaN:P(e)?e?1:0:V(e)||""===e||void 0===e?NaN:void 0!==t&&Y(e)?(t=I(t,"‰",""),t=I(t,"¤",""),y(e,{pattern:t})):e===w?0:Number(e)}function pe(e,t){if($(e))return e;if(Y(e)){const r=ge(e,t);if(r)return n.dateTimeToArcadeDate(r)}return null}function ge(e,t){const n=/ (\d\d)/,i=r(t);let a=A.fromISO(e,{zone:i});return a.isValid||n.test(e)&&(e=e.replace(n,"T$1"),a=A.fromISO(e,{zone:t}),a.isValid)?a:null}function he(e){return P(e)?e:Y(e)?"true"===(e=e.toLowerCase()):!!G(e)&&(0!==e&&!isNaN(e))}function be(e,t){return null==e?null:(null!==e.spatialReference&&void 0!==e.spatialReference||(e.spatialReference=t),e)}function Ne(e){if(null===e)return null;if(e instanceof S)return"NaN"===e.x||null===e.x||isNaN(e.x)?null:e;if(e instanceof x){if(0===e.rings.length)return null;for(const t of e.rings)if(t.length>0)return e;return null}if(e instanceof D){if(0===e.paths.length)return null;for(const t of e.paths)if(t.length>0)return e;return null}return e instanceof N?0===e.points.length?null:e:e instanceof h?"NaN"===e.xmin||null===e.xmin||isNaN(e.xmin)?null:e:null}function Se(e,t){if(!e)return t;if(!e.domain)return t;let n=null,r=null;if("string"===e.field.type||"esriFieldTypeString"===e.field.type)n=fe(t);else{if(null==t)return null;if(""===t)return t;n=ye(t)}for(let i=0;i<e.domain.codedValues.length;i++){const t=e.domain.codedValues[i];t.code===n&&(r=t)}return null===r?fe(t):r.name}function xe(e,t){if(!e)return t;if(!e.domain)return t;let n=null;const r=fe(t);for(let i=0;i<e.domain.codedValues.length;i++){const t=e.domain.codedValues[i];t.name===r&&(n=t)}return null===n?t:n.code}function De(e,t,n=null,r=null){if(!t)return null;if(!t.fields)return null;let i,u,l=null;for(let a=0;a<t.fields.length;a++){const n=t.fields[a];n.name.toLowerCase()===e.toString().toLowerCase()&&(l=n)}if(null===l)throw new a(null,o.FieldNotFound,null,{key:e});if(null===r&&n&&t.typeIdField)r=n.hasField(t.typeIdField)?n.field(t.typeIdField):null;else if(t.typeIdField&&null!==r){let e=!1;for(const n of t.types||[])if(r===n.id){e=!0;break}if(!e)for(const n of t.types||[])if(r===n.name){r=n.id,e=!0;break}e||(r=null,n&&t.typeIdField&&(r=n.hasField(t.typeIdField)?n.field(t.typeIdField):null))}return null!=r&&t.types.some((e=>e.id===r&&(i=e.domains&&e.domains[l.name],i&&"inherited"===i.type&&(i=Te(l.name,t),u=!0),!0))),u||i||(i=Te(e,t)),{field:l,domain:i}}function Te(e,t){let n;return t.fields.some((t=>(t.name.toLowerCase()===e.toLowerCase()&&(n=t.domain),!!n))),n}function Ce(e,t){t||(t={}),"function"==typeof t&&(t={cmp:t});const n="boolean"==typeof t.cycles&&t.cycles,r=t.cmp&&(i=t.cmp,function(e){return function(t,n){const r={key:t,value:e[t]},a={key:n,value:e[n]};return i(r,a)}});var i;const a=[];return function e(t){if(t&&t.toJSON&&"function"==typeof t.toJSON&&(t=t.toJSON()),void 0===t)return;if("number"==typeof t)return isFinite(t)?""+t:"null";if("object"!=typeof t)return JSON.stringify(t);let i,o;if(Array.isArray(t)){for(o="[",i=0;i<t.length;i++)i&&(o+=","),o+=e(t[i])||"null";return o+"]"}if(null===t)return"null";if(a.includes(t)){if(n)return JSON.stringify("__cycle__");throw new TypeError("Converting circular structure to JSON")}const u=a.push(t)-1,l=Object.keys(t).sort(r&&r(t));for(o="",i=0;i<l.length;i++){const n=l[i],r=e(t[n]);r&&(o&&(o+=","),o+=JSON.stringify(n)+":"+r)}return a.splice(u,1),"{"+o+"}"}(e)}function Ae(e){if(null===e)return null;const t=[];for(const n of e)n&&n.arcadeDeclaredClass&&"esri.arcade.Feature"===n.arcadeDeclaredClass?t.push(n.geometry()):t.push(n);return t}function Me(e,t){if(!(t instanceof S))throw new a(null,o.InvalidParameter,null);e.push(t.hasZ?t.hasM?[t.x,t.y,t.z,t.m]:[t.x,t.y,t.z]:[t.x,t.y])}function je(e,t){if(V(e)||W(e)){let n=!1,r=!1,i=[],u=t;if(V(e)){for(const t of e)Me(i,t);i.length>0&&(u=e[0].spatialReference,n=e[0].hasZ,r=e[0].hasM)}else if(e instanceof f)i=e._elements,i.length>0&&(n=e._hasZ,r=e._hasM,u=e.get(0).spatialReference);else{if(!W(e))throw new a(null,o.InvalidParameter,null);for(const t of e.toArray())Me(i,t);i.length>0&&(u=e.get(0).spatialReference,n=!0===e.get(0).hasZ,r=!0===e.get(0).hasM)}if(0===i.length)return null;return T(i)||(i=i.slice(0).reverse()),new x({rings:[i],spatialReference:u,hasZ:n,hasM:r})}return e}function ke(e,t){if(V(e)||W(e)){let n=!1,r=!1,i=[],a=t;if(V(e)){for(const t of e)Me(i,t);i.length>0&&(a=e[0].spatialReference,n=!0===e[0].hasZ,r=!0===e[0].hasM)}else if(e instanceof f)i=e._elements,i.length>0&&(n=e._hasZ,r=e._hasM,a=e.get(0).spatialReference);else if(W(e)){for(const t of e.toArray())Me(i,t);i.length>0&&(a=e.get(0).spatialReference,n=!0===e.get(0).hasZ,r=!0===e.get(0).hasM)}return 0===i.length?null:new D({paths:[i],spatialReference:a,hasZ:n,hasM:r})}return e}function Fe(e,t){if(V(e)||W(e)){let n=!1,r=!1,i=[],a=t;if(V(e)){for(const t of e)Me(i,t);i.length>0&&(a=e[0].spatialReference,n=!0===e[0].hasZ,r=!0===e[0].hasM)}else if(e instanceof f)i=e._elements,i.length>0&&(n=e._hasZ,r=e._hasM,a=e.get(0).spatialReference);else if(W(e)){for(const t of e.toArray())Me(i,t);i.length>0&&(a=e.get(0).spatialReference,n=!0===e.get(0).hasZ,r=!0===e.get(0).hasM)}return 0===i.length?null:new N({points:i,spatialReference:a,hasZ:n,hasM:r})}return e}function we(e,t=!1){const n=[];if(null===e)return n;if(!0===V(e)){for(let r=0;r<e.length;r++){const i=fe(e[r]);""===i&&!0!==t||n.push(i)}return n}if(e instanceof l){for(let r=0;r<e.length();r++){const i=fe(e.get(r));""===i&&!0!==t||n.push(i)}return n}if(_(e)){const r=fe(e);return""===r&&!0!==t||n.push(r),n}return[]}let Oe=0;function Re(e){return Oe++,Oe%100==0?(Oe=0,new Promise((t=>{setTimeout((()=>{t(e)}),0)}))):e}function Ie(e,t,n){switch(n){case"&":return e&t;case"|":return e|t;case"^":return e^t;case"<<":return e<<t;case">>":return e>>t;case">>>":return e>>>t}}function Ze(e,t=null){return null==e?null:P(e)||G(e)||Y(e)?e:e instanceof b?!0===t?.keepGeometryType?e:e.toJSON():e instanceof l?e.toArray().map((e=>Ze(e,t))):e instanceof Array?e.map((e=>Ze(e,t))):ee(e)?e:$(e)?e.toJSDate():X(e)?e.toString():Q(e)?e.toJSDate():null!==e&&"object"==typeof e&&void 0!==e.castAsJson?e.castAsJson(t):null}async function ve(e,t,n,r,i){const a=await _e(e,t,n);i[r]=a}async function _e(e,t=null,n=null){if(e instanceof l&&(e=e.toArray()),null==e)return null;if(_(e)||e instanceof b||ee(e)||$(e))return Ze(e,n);if(e instanceof Array){const r=[],i=[];for(const a of e)null===a||_(a)||a instanceof b||ee(a)||$(a)?i.push(Ze(a,n)):(i.push(null),r.push(ve(a,t,n,i.length-1,i)));return r.length>0&&await Promise.all(r),i}return null!==e&&"object"==typeof e&&void 0!==e.castAsJsonAsync?e.castAsJsonAsync(t,n):null}function Je(e){return Le(e)?e.parent:e}function Le(e){return e&&"declaredClass"in e&&"esri.layers.support.SubtypeSublayer"===e.declaredClass}function Ye(e){return e&&"declaredClass"in e&&"esri.layers.SubtypeGroupLayer"===e.declaredClass}function Pe(e,t,n){const r=Je(e.fullSchema());if(null===r)return null;if(!r.fields)return null;return De(t,r,e,n)}function Ge(e){const t=Je(e.fullSchema());return null===t?null:t.fields&&t.typeIdField?{subtypeField:t.typeIdField,subtypes:t.types?t.types.map((e=>({name:e.name,code:e.id}))):[]}:null}function ze(e,t,n,r){const i=Je(e.fullSchema());if(null===i)return null;if(!i.fields)return null;const a=De(t,i,e,r);if(void 0===n)try{n=e.field(t)}catch(o){return null}return Se(a,n)}function Ee(e,t,n,r){const i=Je(e.fullSchema());if(null===i)return null;if(!i.fields)return null;if(void 0===n){try{n=e.field(t)}catch(a){return null}return n}return xe(De(t,i,e,r),n)}function Ve(e){return e?.timeReference?.timeZone??"system"}function qe(e){const t=Je(e.fullSchema());if(null===t)return null;if(!t.fields)return null;const n=[];for(const r of t.fields)n.push(c(r));return{objectIdField:t.objectIdField,globalIdField:t.globalIdField??"",geometryType:void 0===m[t.geometryType]?"":m[t.geometryType],fields:n}}function He(r,i){return"system"===r&&(r=n.systemTimeZoneCanonicalName),{version:Ue,engineVersion:t,timeZone:r,spatialReference:i.toJSON(),application:e.applicationName??"",engine:"web",locale:C()}}const Ue="1.23",Be=Object.freeze(Object.defineProperty({__proto__:null,ImplicitResult:k,ImplicitResultE:j,ReturnResult:F,ReturnResultE:M,absRound:ne,arcadeVersion:Ue,autoCastArrayOfPointsToMultiPoint:Fe,autoCastArrayOfPointsToPolygon:je,autoCastArrayOfPointsToPolyline:ke,autoCastFeatureToGeometry:Ae,binaryOperator:Ie,breakResult:O,castAsJson:Ze,castAsJsonAsync:_e,continueResult:R,defaultExecutingContext:He,defaultTimeZone:Ve,defaultUndefined:J,equalityTest:se,featureDomainCodeLookup:Ee,featureDomainValueLookup:ze,featureFullDomain:Pe,featureSchema:qe,featureSubtypes:Ge,fixNullGeometry:Ne,fixSpatialReference:be,formatDate:ae,formatNumber:ie,generateUUID:re,getDomain:De,getDomainCode:xe,getDomainValue:Se,getType:L,greaterThanLessThan:le,isArray:V,isBoolean:P,isDate:$,isDateOnly:Q,isDictionary:U,isFeature:q,isFeatureSet:H,isFeatureSetCollection:B,isFunctionParameter:Z,isGeometry:E,isImmutableArray:W,isInteger:z,isJsDate:ee,isModule:v,isNumber:G,isObject:K,isSimpleType:_,isString:Y,isSubtypeGrouplayer:Ye,isSubtypeSublayer:Le,isTime:X,multiReplace:I,pcCheck:te,stableStringify:Ce,standardiseDateFormat:oe,tick:Re,toBoolean:he,toDate:pe,toNumber:ye,toNumberArray:ce,toString:fe,toStringArray:we,toStringExplicit:me,voidOperation:w},Symbol.toStringTag,{value:"Module"}));export{Ye as $,be as A,le as B,se as C,Ie as D,te as E,Ae as F,je as G,J as H,k as I,ke as J,Fe as K,Ve as L,z as M,L as N,oe as O,ne as P,Ne as Q,F as R,I as S,re as T,qe as U,Ge as V,Pe as W,ze as X,Ee as Y,He as Z,ce as _,P as a,Le as a0,Re as a1,we as a2,De as a3,Se as a4,xe as a5,M as a6,j as a7,v as a8,K as a9,ee as aa,ie as ab,ae as ac,Ce as ad,Ue as ae,G as b,Y as c,Ze as d,_e as e,_ as f,ye as g,he as h,Z as i,fe as j,$ as k,pe as l,Q as m,X as n,V as o,E as p,W as q,q as r,B as s,me as t,H as u,U as v,Be as w,w as x,O as y,R as z};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import{clock as t}from"./clock.js";import e from"./Error.js";import{once as r}from"./events.js";import n from"./Logger.js";import{removeMaybe as o}from"./maybe.js";async function i(t,e){const r=t.slice(),n=await Promise.all(t.map(((t,r)=>e(t,r))));return r.filter(((t,e)=>n[e]))}function u(t="Aborted"){return new e("AbortError",t)}function s(t,e="Aborted"){if(c(t))throw u(e)}function l(t){return null!=t?"aborted"in t?t:t.signal:t}function c(t){const e=l(t);return null!=e&&e.aborted}function a(t){if(b(t))throw t}function f(t){if(!b(t))throw t}function m(t,e){const n=l(t);if(null!=n){if(!n.aborted)return r(n,"abort",(()=>e()));e()}}function w(t,e){const n=l(t);if(null!=n)return s(n),r(n,"abort",(()=>e(u())))}function h(t,e){return null==l(e)?t:new Promise(((r,n)=>{let i=m(e,(()=>n(u())));const s=()=>i=o(i);t.then(s,s),t.then(r,n)}))}function p(t,r,n){return Promise.race([t,A(r).then((()=>{throw new e("timeout",`Did not resolve within ${r} milliseconds (${n??"timeout"})`)}))])}function b(t){return"AbortError"===t?.name}async function d(t){try{return await t}catch(e){if(!b(e))throw e;return}}async function y(t,e=n.getLogger("esri")){try{return await t}catch(r){b(r)||e.error(r)}}async function v(t){if(!t)return;if("function"!=typeof t.forEach){const e=Object.keys(t),r=e.map((e=>t[e])),n=await v(r),o={};return e.map(((t,e)=>o[t]=n[e])),o}const e=t;return Promise.allSettled(e).then((t=>Array.from(e,((e,r)=>{const n=t[r];return"fulfilled"===n.status?{promise:e,value:n.value}:{promise:e,error:n.reason}}))))}async function j(t){return(await v(t)).filter((t=>!!t.value)).map((t=>t.value))}async function P(t){return(await Promise.allSettled(t)).filter((t=>"fulfilled"===t.status)).map((t=>t.value))}async function g(t){return(await Promise.allSettled(t)).filter((t=>"rejected"===t.status)).map((t=>t.reason))}function A(t,e=void 0,r){const n=new AbortController;return m(r,(()=>n.abort())),new Promise(((r,o)=>{let i=setTimeout((()=>{i=0,r(e)}),t);m(n,(()=>{i&&(clearTimeout(i),o(u()))}))}))}function T(t,r,n,o){const i=n&&"abort"in n?n:null;null!=o||i||(o=n);let u=setTimeout((()=>{u=0,i&&i.abort()}),r);const s=()=>o||new e("promiseUtils:timeout","The wrapped promise did not resolve within "+r+" ms");return t.then((t=>{if(0===u)throw s();return clearTimeout(u),t}),(t=>{throw clearTimeout(u),0===u?s():t}))}function E(t){return t&&"function"==typeof t.then}function S(t){return E(t)?t:Promise.resolve(t)}function k(t,e=-1){let r,n,o,i,s=null;const l=(...c)=>{if(r){n=c,i&&i.reject(u()),i=C();const t=i.promise;if(s){const t=s;s=null,t.abort()}return t}if(o=i||C(),i=null,e>0){const n=new AbortController;r=S(t(...c,n.signal));const o=r;A(e).then((()=>{r===o&&(i?n.abort():s=n)}))}else r=1,r=S(t(...c));const a=()=>{const t=n;n=o=r=s=null,null!=t&&l(...t)},f=r,m=o;return f.then(a,a),f.then(m.resolve,m.reject),m.promise};return l}function C(){let e,r;const n=new Promise(((t,n)=>{e=t,r=n})),o=t=>{e(t)};return o.resolve=t=>e(t),o.reject=t=>r(t),o.timeout=(e,r)=>t.setTimeout((()=>o.reject(r)),e),o.promise=n,o}function L(t,e){return t.then(e,e)}function $(t,e){e.then(t.resolve,t.reject)}async function x(t){await Promise.resolve(),s(t)}export{A as after,g as allSettledErrors,P as allSettledValues,L as always,u as createAbortError,C as createResolver,k as debounce,v as eachAlways,j as eachAlwaysValues,i as filter,d as ignoreAbortErrors,b as isAbortError,c as isAborted,E as isPromiseLike,y as logOnError,m as onAbort,w as onAbortOrThrow,$ as settleWithPromise,a as throwIfAbortError,s as throwIfAborted,f as throwIfNotAbortError,T as timeout,x as waitTick,S as when,h as whenOrAbort,p as whenOrTimeout};
5
+ import{clock as t}from"./clock.js";import e from"./Error.js";import{once as r}from"./events.js";import n from"./Logger.js";import{removeMaybe as o}from"./maybe.js";async function i(t,e){const r=t.slice(),n=await Promise.all(t.map(((t,r)=>e(t,r))));return r.filter(((t,e)=>n[e]))}function u(t="Aborted"){return new e("AbortError",t)}function s(t,e="Aborted"){if(c(t))throw u(e)}function l(t){return null!=t?"aborted"in t?t:t.signal:t}function c(t){const e=l(t);return null!=e&&e.aborted}function a(t){if(b(t))throw t}function f(t){if(!b(t))throw t}function m(t,e){const n=l(t);if(null!=n){if(!n.aborted)return r(n,"abort",(()=>e()));e()}}function w(t,e){const n=l(t);if(null!=n)return s(n),r(n,"abort",(()=>e(u())))}function h(t,e){return null==l(e)?t:new Promise(((r,n)=>{let i=m(e,(()=>n(u())));const s=()=>{i=o(i)};t.then(s,s),t.then(r,n)}))}function p(t,r,n){return Promise.race([t,A(r).then((()=>{throw new e("timeout",`Did not resolve within ${r} milliseconds (${n??"timeout"})`)}))])}function b(t){return"AbortError"===t?.name}async function d(t){try{return await t}catch(e){if(!b(e))throw e;return}}async function y(t,e=n.getLogger("esri")){try{return await t}catch(r){b(r)||e.error(r)}}async function v(t){if(!t)return;if("function"!=typeof t.forEach){const e=Object.keys(t),r=e.map((e=>t[e])),n=await v(r),o={};return e.map(((t,e)=>o[t]=n[e])),o}const e=t;return Promise.allSettled(e).then((t=>Array.from(e,((e,r)=>{const n=t[r];return"fulfilled"===n.status?{promise:e,value:n.value}:{promise:e,error:n.reason}}))))}async function j(t){return(await v(t)).filter((t=>!!t.value)).map((t=>t.value))}async function P(t){return(await Promise.allSettled(t)).filter((t=>"fulfilled"===t.status)).map((t=>t.value))}async function g(t){return(await Promise.allSettled(t)).filter((t=>"rejected"===t.status)).map((t=>t.reason))}function A(t,e=void 0,r){const n=new AbortController;return m(r,(()=>n.abort())),new Promise(((r,o)=>{let i=setTimeout((()=>{i=0,r(e)}),t);m(n,(()=>{i&&(clearTimeout(i),o(u()))}))}))}function T(t,r,n,o){const i=n&&"abort"in n?n:null;null!=o||i||(o=n);let u=setTimeout((()=>{u=0,i&&i.abort()}),r);const s=()=>o||new e("promiseUtils:timeout","The wrapped promise did not resolve within "+r+" ms");return t.then((t=>{if(0===u)throw s();return clearTimeout(u),t}),(t=>{throw clearTimeout(u),0===u?s():t}))}function E(t){return t&&"function"==typeof t.then}function S(t){return E(t)?t:Promise.resolve(t)}function k(t,e=-1){let r,n,o,i,s=null;const l=(...c)=>{if(r){n=c,i&&i.reject(u()),i=C();const t=i.promise;if(s){const t=s;s=null,t.abort()}return t}if(o=i||C(),i=null,e>0){const n=new AbortController;r=S(t(...c,n.signal));const o=r;A(e).then((()=>{r===o&&(i?n.abort():s=n)}))}else r=1,r=S(t(...c));const a=()=>{const t=n;n=o=r=s=null,null!=t&&l(...t)},f=r,m=o;return f.then(a,a),f.then(m.resolve,m.reject),m.promise};return l}function C(){let e,r;const n=new Promise(((t,n)=>{e=t,r=n})),o=t=>{e(t)};return o.resolve=t=>e(t),o.reject=t=>r(t),o.timeout=(e,r)=>t.setTimeout((()=>o.reject(r)),e),o.promise=n,o}function L(t,e){return t.then(e,e)}function $(t,e){e.then(t.resolve,t.reject)}async function x(t){await Promise.resolve(),s(t)}export{A as after,g as allSettledErrors,P as allSettledValues,L as always,u as createAbortError,C as createResolver,k as debounce,v as eachAlways,j as eachAlwaysValues,i as filter,d as ignoreAbortErrors,b as isAbortError,c as isAborted,E as isPromiseLike,y as logOnError,m as onAbort,w as onAbortOrThrow,$ as settleWithPromise,a as throwIfAbortError,s as throwIfAborted,f as throwIfNotAbortError,T as timeout,x as waitTick,S as when,h as whenOrAbort,p as whenOrTimeout};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import{SqlError as a,SqlErrorCodes as n}from"../../arcade/featureset/support/errorsupport.js";function t(t,l){const r=e[t.toLowerCase()];if(null==r)throw new a(n.FunctionNotRecognized);if(l.length<r.minParams||l.length>r.maxParams)throw new a(n.InvalidParameterCount,{name:t.toUpperCase()});return r.evaluate(l)}function l(a,n){const t=e[a.toLowerCase()];return null!=t&&n>=t.minParams&&n<=t.maxParams}const e={min:{minParams:1,maxParams:1,evaluate:a=>null==a[0]?null:Math.min.apply(Math,a[0])},max:{minParams:1,maxParams:1,evaluate:a=>null==a[0]?null:Math.max.apply(Math,a[0])},avg:{minParams:1,maxParams:1,evaluate:a=>null==a[0]?null:r(a[0])},sum:{minParams:1,maxParams:1,evaluate:a=>null==a[0]?null:m(a[0])},stddev:{minParams:1,maxParams:1,evaluate:a=>null==a[0]?null:Math.sqrt(u(a[0]))},count:{minParams:1,maxParams:1,evaluate:a=>null==a[0]?null:a[0].length},var:{minParams:1,maxParams:1,evaluate:a=>null==a[0]?null:u(a[0])}};function r(a){let n=0;for(let t=0;t<a.length;t++)n+=a[t];return n/a.length}function m(a){let n=0;for(let t=0;t<a.length;t++)n+=a[t];return n}function u(a){const n=r(a),t=a.length;let l=0;for(const e of a)l+=(e-n)**2;return t>1?l/(t-1):0}export{t as aggregateFunction,l as isAggregate};
5
+ import{SqlError as n,SqlErrorCodes as l}from"../../arcade/featureset/support/errorsupport.js";import{DateOnly as t}from"./DateOnly.js";import{SqlTimeStampOffset as a}from"./SqlTimestampOffset.js";import{TimeOnly as e}from"./TimeOnly.js";import{DateTime as r}from"luxon";function u(t,a){const e=m[t.toLowerCase()];if(null==e)throw new n(l.FunctionNotRecognized);if(a.length<e.minParams||a.length>e.maxParams)throw new n(l.InvalidParameterCount,{name:t.toUpperCase()});return e.evaluate(a)}function o(n,l){const t=m[n.toLowerCase()];return null!=t&&l>=t.minParams&&l<=t.maxParams}const m={min:{minParams:1,maxParams:1,evaluate:n=>f(n[0],"min")},max:{minParams:1,maxParams:1,evaluate:n=>f(n[0],"max")},avg:{minParams:1,maxParams:1,evaluate:n=>i(n[0])},sum:{minParams:1,maxParams:1,evaluate:n=>c(n[0])},stddev:{minParams:1,maxParams:1,evaluate:n=>g(n[0])},count:{minParams:1,maxParams:1,evaluate:n=>null==n[0]?null:n[0].length},var:{minParams:1,maxParams:1,evaluate:n=>P(n[0])}};function i(t){if(null===t)return null;let a=0,e=0;for(let r=0;r<t.length;r++){const u=t[r];if(null!==u){if(!s(u))throw new n(l.InvalidValueForAggregateFunction);e++,a+=u}}return 0===e?null:a/t.length}function s(n){return"number"==typeof n}function f(n,l){if(null===n)return null;let u=null,o=null;for(const m of n){let n=m;n=m instanceof t||m instanceof e?m.toNumber():m instanceof r?m.toMillis():m instanceof a?m.toMilliseconds():m,(null===u||"max"===l&&null!==o&&null!==n&&o<=n||"min"===l&&null!==o&&null!==n&&o>=n)&&(u=m,o=n)}return u}function c(t){if(null===t)return null;let a=0;for(let e=0;e<t.length;e++){const r=t[e];if(null!==r){if(!s(r))throw new n(l.InvalidValueForAggregateFunction);a+=r}}return a}function g(n){if(null===n)return null;const l=P(n);return null===l?null:Math.sqrt(l)}function P(t){if(null===t)return null;if(0===(t=t.filter((n=>null!==n))).length)return null;const a=i(t);if(null===a)return null;let e=0;for(const r of t){if(!s(r))throw new n(l.InvalidValueForAggregateFunction);e+=(a-r)**2}return e/(t.length-1)}export{u as aggregateFunction,o as isAggregate};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import{createDateTimeZone as t,ArcadeDate as e}from"../../arcade/ArcadeDate.js";import{getLocale as a}from"../../intl/locale.js";import{DateTime as r,FixedOffsetZone as s}from"luxon";function o(t){t=t.replaceAll(/LTS|LT|LL?L?L?|l{1,4}/g,"[$&]");let e="";const a=/(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|N{1,5}|YYYYYY|YYYYY|YYYY|YY|y{2,4}|yo?|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g;for(const r of t.match(a)||[])switch(r){case"D":e+="d";break;case"DD":e+="dd";break;case"DDD":e+="o";break;case"d":e+="c";break;case"ddd":e+="ccc";break;case"dddd":e+="cccc";break;case"M":e+="L";break;case"MM":e+="LL";break;case"MMM":e+="LLL";break;case"MMMM":e+="LLLL";break;case"YY":e+="yy";break;case"Y":case"YYYY":e+="yyyy";break;case"Q":e+="q";break;case"X":case"x":e+=r;break;default:r.length>=2&&"["===r.slice(0,1)&&"]"===r.slice(-1)?e+=`'${r.slice(1,-1)}'`:e+=`'${r}'`}return e}class n{constructor(t,e,a){this._year=t,this._month=e,this._day=a}get month(){return this._month}get monthJS(){return this._month-1}get year(){return this._year}get day(){return this._day}get isValid(){return this.toDateTime("unknown").isValid}equals(t){return t instanceof n&&t.day===this.day&&t.month===this.month&&t.year===this.year}clone(){return new n(this._year,this._month,this._day)}toDateTime(e){return r.fromObject({day:this.day,month:this.month,year:this.year},{zone:t(e)})}toDateTimeLuxon(t){return r.fromObject({day:this.day,month:this.month,year:this.year},{zone:t})}toString(){return`${this.year.toString().padStart(4,"0")}-${this.month.toString().padStart(2,"0")}-${this.day.toString().padStart(2,"0")}`}toFormat(t=null){if(null===t||""===t)return this.toString();if(!(t=o(t)))return"";const r=this.toDateTime("unknown");return e.dateTimeToArcadeDate(r).toFormat(t,{locale:a(),numberingSystem:"latn"})}toArcadeDate(){const t=this.toDateTime("unknown");return e.dateTimeToArcadeDate(t)}toNumber(){return this.toDateTime("unknown").toMillis()}toJSDate(){return this.toDateTime("unknown").toJSDate()}toStorageFormat(){return this.toFormat("yyyy-LL-dd")}toSQLValue(){return this.toFormat("yyyy-LL-dd")}toSQLWithKeyword(){return"date '"+this.toFormat("yyyy-LL-dd")+"'"}plus(t,e){switch(t){case"days":case"years":case"months":e=Math.trunc(e);break;case"hours":e=Math.trunc(e)/24,t="days";break;case"minutes":e=Math.trunc(e/1440),t="days";break;case"seconds":e=Math.trunc(e/86400),t="days";break;case"milliseconds":e=Math.trunc(e/864e5),t="days"}return n.fromDateTime(this.toUTCDateTime().plus({[t]:e}))}toUTCDateTime(){return r.utc(this.year,this.month,this.day,0,0,0,0)}difference(t,e){switch(e.toLowerCase()){case"days":case"day":case"d":return this.toUTCDateTime().diff(t.toUTCDateTime(),"days").days;case"months":case"month":return this.toUTCDateTime().diff(t.toUTCDateTime(),"months").months;case"minutes":case"minute":case"m":return"M"===e?this.toUTCDateTime().diff(t.toUTCDateTime(),"months").months:this.toUTCDateTime().diff(t.toUTCDateTime(),"minutes").minutes;case"seconds":case"second":case"s":return this.toUTCDateTime().diff(t.toUTCDateTime(),"seconds").seconds;case"milliseconds":case"millisecond":case"ms":default:return this.toUTCDateTime().diff(t.toUTCDateTime(),"milliseconds").milliseconds;case"hours":case"hour":case"h":return this.toUTCDateTime().diff(t.toUTCDateTime(),"hours").hours;case"years":case"year":case"y":return this.toUTCDateTime().diff(t.toUTCDateTime(),"years").years}}static fromMilliseconds(t){const e=r.fromMillis(t,{zone:s.utcInstance});return e.isValid?n.fromParts(e.year,e.month,e.day):null}static fromSeconds(t){const e=r.fromSeconds(t,{zone:s.utcInstance});return e.isValid?n.fromParts(e.year,e.month,e.day):null}static fromReader(t){if(!t)return null;const e=t.split("-");return 3!==e.length?null:new n(parseInt(e[0],10),parseInt(e[1],10),parseInt(e[2],10))}static fromParts(t,e,a){const r=new n(t,e,a);return!1===r.isValid?null:r}static fromDateJS(t){return n.fromParts(t.getFullYear(),t.getMonth()+1,t.getDay())}static fromDateTime(t){return n.fromParts(t.year,t.month,t.day)}static fromSqlTimeStampOffset(t){return this.fromDateTime(t.toDateTime())}static fromString(t,e=null){if(""===t)return null;if(null===t)return null;const a=[];if(e)(e=o(e))&&a.push(e);else if(null===e||""===e){const e=r.fromISO(t,{setZone:!0});return e.isValid?n.fromParts(e.year,e.month,e.day):null}for(const s of a){const a=r.fromFormat(t,e??s);if(a.isValid)return new n(a.year,a.month,a.day)}return null}static fromNow(t="system"){const e=r.fromJSDate(new Date).setZone(t);return new n(e.year,e.month,e.day)}}export{n as DateOnly,o as standardiseDateOnlyFormat};
5
+ import{createDateTimeZone as t,ArcadeDate as e}from"../../arcade/ArcadeDate.js";import{getLocale as a}from"../../intl/locale.js";import{DateTime as r,FixedOffsetZone as s}from"luxon";function o(t){t=t.replaceAll(/LTS|LT|LL?L?L?|l{1,4}/g,"[$&]");let e="";const a=/(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|N{1,5}|YYYYYY|YYYYY|YYYY|YY|y{2,4}|yo?|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g;for(const r of t.match(a)||[])switch(r){case"D":e+="d";break;case"DD":e+="dd";break;case"DDD":e+="o";break;case"d":e+="c";break;case"ddd":e+="ccc";break;case"dddd":e+="cccc";break;case"M":e+="L";break;case"MM":e+="LL";break;case"MMM":e+="LLL";break;case"MMMM":e+="LLLL";break;case"YY":e+="yy";break;case"Y":case"YYYY":e+="yyyy";break;case"Q":e+="q";break;case"X":case"x":e+=r;break;default:r.length>=2&&"["===r.slice(0,1)&&"]"===r.slice(-1)?e+=`'${r.slice(1,-1)}'`:e+=`'${r}'`}return e}class n{constructor(t,e,a){this._year=t,this._month=e,this._day=a,this.declaredRootClass="esri.core.sql.dateonly"}get month(){return this._month}get monthJS(){return this._month-1}get year(){return this._year}get day(){return this._day}get isValid(){return this.toDateTime("unknown").isValid}equals(t){return t instanceof n&&t.day===this.day&&t.month===this.month&&t.year===this.year}clone(){return new n(this._year,this._month,this._day)}toDateTime(e){return r.fromObject({day:this.day,month:this.month,year:this.year},{zone:t(e)})}toDateTimeLuxon(t){return r.fromObject({day:this.day,month:this.month,year:this.year},{zone:t})}toString(){return`${this.year.toString().padStart(4,"0")}-${this.month.toString().padStart(2,"0")}-${this.day.toString().padStart(2,"0")}`}toFormat(t=null){if(null===t||""===t)return this.toString();if(!(t=o(t)))return"";const r=this.toDateTime("unknown");return e.dateTimeToArcadeDate(r).toFormat(t,{locale:a(),numberingSystem:"latn"})}toArcadeDate(){const t=this.toDateTime("unknown");return e.dateTimeToArcadeDate(t)}toNumber(){return this.toDateTime("unknown").toMillis()}toJSDate(){return this.toDateTime("unknown").toJSDate()}toStorageFormat(){return this.toFormat("yyyy-LL-dd")}toSQLValue(){return this.toFormat("yyyy-LL-dd")}toSQLWithKeyword(){return"date '"+this.toFormat("yyyy-LL-dd")+"'"}plus(t,e){switch(t){case"days":case"years":case"months":e=Math.trunc(e);break;case"hours":e=Math.trunc(e)/24,t="days";break;case"minutes":e=Math.trunc(e/1440),t="days";break;case"seconds":e=Math.trunc(e/86400),t="days";break;case"milliseconds":e=Math.trunc(e/864e5),t="days"}return n.fromDateTime(this.toUTCDateTime().plus({[t]:e}))}toUTCDateTime(){return r.utc(this.year,this.month,this.day,0,0,0,0)}difference(t,e){switch(e.toLowerCase()){case"days":case"day":case"d":return this.toUTCDateTime().diff(t.toUTCDateTime(),"days").days;case"months":case"month":return this.toUTCDateTime().diff(t.toUTCDateTime(),"months").months;case"minutes":case"minute":case"m":return"M"===e?this.toUTCDateTime().diff(t.toUTCDateTime(),"months").months:this.toUTCDateTime().diff(t.toUTCDateTime(),"minutes").minutes;case"seconds":case"second":case"s":return this.toUTCDateTime().diff(t.toUTCDateTime(),"seconds").seconds;case"milliseconds":case"millisecond":case"ms":default:return this.toUTCDateTime().diff(t.toUTCDateTime(),"milliseconds").milliseconds;case"hours":case"hour":case"h":return this.toUTCDateTime().diff(t.toUTCDateTime(),"hours").hours;case"years":case"year":case"y":return this.toUTCDateTime().diff(t.toUTCDateTime(),"years").years}}static fromMilliseconds(t){const e=r.fromMillis(t,{zone:s.utcInstance});return e.isValid?n.fromParts(e.year,e.month,e.day):null}static fromSeconds(t){const e=r.fromSeconds(t,{zone:s.utcInstance});return e.isValid?n.fromParts(e.year,e.month,e.day):null}static fromReader(t){if(!t)return null;const e=t.split("-");return 3!==e.length?null:new n(parseInt(e[0],10),parseInt(e[1],10),parseInt(e[2],10))}static fromParts(t,e,a){const r=new n(t,e,a);return!1===r.isValid?null:r}static fromDateJS(t){return n.fromParts(t.getFullYear(),t.getMonth()+1,t.getDay())}static fromDateTime(t){return n.fromParts(t.year,t.month,t.day)}static fromSqlTimeStampOffset(t){return this.fromDateTime(t.toDateTime())}static fromString(t,e=null){if(""===t)return null;if(null===t)return null;const a=[];if(e)(e=o(e))&&a.push(e);else if(null===e||""===e){const e=r.fromISO(t,{setZone:!0});return e.isValid?n.fromParts(e.year,e.month,e.day):null}for(const s of a){const a=r.fromFormat(t,e??s);if(a.isValid)return new n(a.year,a.month,a.day)}return null}static fromNow(t="system"){const e=r.fromJSDate(new Date).setZone(t);return new n(e.year,e.month,e.day)}}export{n as DateOnly,o as standardiseDateOnlyFormat};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import{DateTime as t}from"luxon";function e(t){return Number.isNaN(t)||0===t?t:Math.trunc(t)}class r{constructor(t){this._timeStampOffset=t,this._date=null}toDateTime(){return this._date??=t.fromISO(this._timeStampOffset,{setZone:!0}),this._date}get isValid(){return this.toDateTime().isValid}get timezoneOffsetHour(){return e(this.toDateTime().offset/60)}get timezoneOffsetMinutes(){return e(this.toDateTime().offset%60)}toMilliseconds(){return this.toDateTime().toMillis()}get hour(){return this.toDateTime().hour}get minute(){return this.toDateTime().minute}get second(){return this.toDateTime().second}get day(){return this.toDateTime().day}get month(){return this.toDateTime().month}get year(){return this.toDateTime().year}static fromJSDate(e){return new r(t.fromJSDate(e).toISO({includeOffset:!0}))}static fromDateTime(t){return new r(t.toISO({includeOffset:!0}))}static fromParts(t,e,i=0,o=0,a=0,n=0,s=0,m=!1,u=0,S=0){const f=`${t.toString().padStart(4,"0")}-${e.toString().padStart(2,"0")}-${i.toString().padStart(2,"0")}`;let d="";n<10&&(d="0");let h=`${o.toString().padStart(2,"0")}:${a.toString().padStart(2,"0")}:${d+n.toString()}`;0!==s&&(h+="."+s.toString().padStart(3,"0"));const l=`${m?"-":"+"}${u.toString().padStart(2,"0")}:${S.toString().padStart(2,"0")}`;return new r(f+"T"+h+l)}toStorageFormat(){return this._timeStampOffset}toString(){return this._timeStampOffset}toSQLValue(){let t=this.toDateTime().toSQL({includeOffset:!0,includeOffsetSpace:!0});return t&&(t=t.replace(".000","")),t}toSQLWithKeyword(){return`timestamp '${this.toSQLValue()}'`}addMilliseconds(t){const e=this.toDateTime().plus(t);return r.fromDateTime(e)}}export{r as SqlTimeStampOffset};
5
+ import{DateTime as t}from"luxon";function e(t){return Number.isNaN(t)||0===t?t:Math.trunc(t)}class r{constructor(t){this._timeStampOffset=t,this._date=null}toDateTime(){return this._date??=t.fromISO(this._timeStampOffset,{setZone:!0}),this._date}get isValid(){return this.toDateTime().isValid}get timezoneOffsetHour(){return e(this.toDateTime().offset/60)}get timezoneOffsetMinutes(){return e(this.toDateTime().offset%60)}toMilliseconds(){return this.toDateTime().toMillis()}get hour(){return this.toDateTime().hour}get minute(){return this.toDateTime().minute}get second(){return this.toDateTime().second}get day(){return this.toDateTime().day}get month(){return this.toDateTime().month}get year(){return this.toDateTime().year}startOfDay(){return r.fromDateTime(this.toDateTime().startOf("day"))}static fromJSDate(e){return new r(t.fromJSDate(e).toISO({includeOffset:!0}))}static fromDateTime(t){return new r(t.toISO({includeOffset:!0}))}static fromParts(t,e,i=0,a=0,o=0,n=0,s=0,m=!1,u=0,f=0){const S=`${t.toString().padStart(4,"0")}-${e.toString().padStart(2,"0")}-${i.toString().padStart(2,"0")}`;let d="";n<10&&(d="0");let h=`${a.toString().padStart(2,"0")}:${o.toString().padStart(2,"0")}:${d+n.toString()}`;0!==s&&(h+="."+s.toString().padStart(3,"0"));const l=`${m?"-":"+"}${u.toString().padStart(2,"0")}:${f.toString().padStart(2,"0")}`;return new r(S+"T"+h+l)}toStorageFormat(){return this._timeStampOffset}toString(){return this._timeStampOffset}toSQLValue(){let t=this.toDateTime().toSQL({includeOffset:!0,includeOffsetSpace:!0});return t&&(t=t.replace(".000","")),t}toSQLWithKeyword(){return`timestamp '${this.toSQLValue()}'`}addMilliseconds(t){const e=this.toDateTime().plus(t);return r.fromDateTime(e)}}export{r as SqlTimeStampOffset};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import{isInteger as t}from"../../arcade/kernel.js";import{getLocale as s}from"../../intl/locale.js";import{DateTime as e}from"luxon";function i(t){if(!t)return"";const s=/(a|A|hh?|HH?|mm?|ss?|SSS|S|.)/g;let e="";for(const i of t.match(s)||[])switch(i){case"SSS":case"m":case"mm":case"h":case"hh":case"H":case"HH":case"s":case"ss":e+=i;break;case"A":case"a":e+="a";break;default:e+=`'${i}'`}return e}class n{constructor(t,s,e,i){this._hour=t,this._minute=s,this._second=e,this._millisecond=i}get hour(){return this._hour}get minute(){return this._minute}get second(){return this._second}get millisecond(){return this._millisecond}equals(t){return t instanceof n&&t.hour===this.hour&&t.minute===this.minute&&t.second===this.second&&t.millisecond===this.millisecond}clone(){return new n(this.hour,this.minute,this.second,this.millisecond)}isValid(){return t(this.hour)&&t(this.minute)&&t(this.second)&&t(this.millisecond)&&this.hour>=0&&this.hour<24&&this.minute>=0&&this.minute<60&&this.second>=0&&this.second<60&&this.millisecond>=0&&this.millisecond<1e3}toString(){return`${this.hour.toString().padStart(2,"0")}:${this.minute.toString().padStart(2,"0")}:${this.second.toString().padStart(2,"0")}`+(this.millisecond>0?"."+this.millisecond.toString().padStart(3,"0"):"")}toSQLValue(){return this.toString()}toSQLWithKeyword(){return`time '${this.hour.toString().padStart(2,"0")}:${this.minute.toString().padStart(2,"0")}:${this.second.toString().padStart(2,"0")}${this.millisecond>0?"."+this.millisecond.toString().padStart(3,"0"):""}'`}toStorageString(){return`${this.hour.toString().padStart(2,"0")}:${this.minute.toString().padStart(2,"0")}:${this.second.toString().padStart(2,"0")}`}toFormat(t=null){if(null===t||""===t)return this.toString();if(!(t=i(t)))return"";return e.local(1970,1,1,this._hour,this._minute,this._second,this._millisecond).toFormat(t,{locale:s(),numberingSystem:"latn"})}toNumber(){return this.millisecond+1e3*this.second+1e3*this.minute*60+60*this.hour*60*1e3}static fromParts(t,s,e,i){const r=new n(t,s,e,i);return r.isValid()?r:null}static fromReader(t){if(!t)return null;const s=t.split(":");return 3!==s.length?null:new n(parseInt(s[0],10),parseInt(s[1],10),parseInt(s[2],10),0)}static fromMilliseconds(t){if(t>864e5||t<0)return null;const s=Math.floor(t/1e3%60),e=Math.floor(t/6e4%60),i=Math.floor(t/36e5%24),r=Math.floor(t%1e3);return new n(i,e,s,r)}static fromDateJS(t){return new n(t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds())}static fromDateTime(t){return new n(t.hour,t.minute,t.second,t.millisecond)}static fromSqlTimeStampOffset(t){return this.fromDateTime(t.toDateTime())}static fromString(t,s=null){if(""===t)return null;if(null===t)return null;const r=[];s?(s=i(s))&&r.push(s):null!==s&&""!==s||(r.push("HH:mm:ss"),r.push("HH:mm:ss.SSS"),r.push("hh:mm:ss a"),r.push("hh:mm:ss.SSS a"),r.push("HH:mm"),r.push("hh:mm a"),r.push("H:mm"),r.push("h:mm a"),r.push("H:mm:ss"),r.push("h:mm:ss a"),r.push("H:mm:ss.SSS"),r.push("h:mm:ss.SSS a"));for(const i of r){const s=e.fromFormat(t,i);if(s.isValid)return new n(s.hour,s.minute,s.second,s.millisecond)}return null}plus(t,s){switch(t){case"days":case"years":case"months":return this.clone();case"hours":case"minutes":case"seconds":case"milliseconds":return n.fromDateTime(this.toUTCDateTime().plus({[t]:s}))}return null}toUTCDateTime(){return e.utc(1970,1,1,this.hour,this.minute,this.second,this.millisecond)}difference(t,s){switch(s.toLowerCase()){case"days":case"day":case"d":return this.toUTCDateTime().diff(t.toUTCDateTime(),"days").days;case"months":case"month":return this.toUTCDateTime().diff(t.toUTCDateTime(),"months").months;case"minutes":case"minute":case"m":return"M"===s?this.toUTCDateTime().diff(t.toUTCDateTime(),"months").months:this.toUTCDateTime().diff(t.toUTCDateTime(),"minutes").minutes;case"seconds":case"second":case"s":return this.toUTCDateTime().diff(t.toUTCDateTime(),"seconds").seconds;case"milliseconds":case"millisecond":case"ms":default:return this.toUTCDateTime().diff(t.toUTCDateTime(),"milliseconds").milliseconds;case"hours":case"hour":case"h":return this.toUTCDateTime().diff(t.toUTCDateTime(),"hours").hours;case"years":case"year":case"y":return this.toUTCDateTime().diff(t.toUTCDateTime(),"years").years}}}export{n as TimeOnly,i as standardiseTimeFormat};
5
+ import{isInteger as t}from"../../arcade/kernel.js";import{getLocale as s}from"../../intl/locale.js";import{DateTime as e}from"luxon";function i(t){if(!t)return"";const s=/(a|A|hh?|HH?|mm?|ss?|SSS|S|.)/g;let e="";for(const i of t.match(s)||[])switch(i){case"SSS":case"m":case"mm":case"h":case"hh":case"H":case"HH":case"s":case"ss":e+=i;break;case"A":case"a":e+="a";break;default:e+=`'${i}'`}return e}class n{constructor(t,s,e,i){this._hour=t,this._minute=s,this._second=e,this._millisecond=i,this.declaredRootClass="esri.core.sql.timeonly"}get hour(){return this._hour}get minute(){return this._minute}get second(){return this._second}get millisecond(){return this._millisecond}equals(t){return t instanceof n&&t.hour===this.hour&&t.minute===this.minute&&t.second===this.second&&t.millisecond===this.millisecond}clone(){return new n(this.hour,this.minute,this.second,this.millisecond)}isValid(){return t(this.hour)&&t(this.minute)&&t(this.second)&&t(this.millisecond)&&this.hour>=0&&this.hour<24&&this.minute>=0&&this.minute<60&&this.second>=0&&this.second<60&&this.millisecond>=0&&this.millisecond<1e3}toString(){return`${this.hour.toString().padStart(2,"0")}:${this.minute.toString().padStart(2,"0")}:${this.second.toString().padStart(2,"0")}`+(this.millisecond>0?"."+this.millisecond.toString().padStart(3,"0"):"")}toSQLValue(){return this.toString()}toSQLWithKeyword(){return`time '${this.hour.toString().padStart(2,"0")}:${this.minute.toString().padStart(2,"0")}:${this.second.toString().padStart(2,"0")}${this.millisecond>0?"."+this.millisecond.toString().padStart(3,"0"):""}'`}toStorageString(){return`${this.hour.toString().padStart(2,"0")}:${this.minute.toString().padStart(2,"0")}:${this.second.toString().padStart(2,"0")}`}toFormat(t=null){if(null===t||""===t)return this.toString();if(!(t=i(t)))return"";return e.local(1970,1,1,this._hour,this._minute,this._second,this._millisecond).toFormat(t,{locale:s(),numberingSystem:"latn"})}toNumber(){return this.millisecond+1e3*this.second+1e3*this.minute*60+60*this.hour*60*1e3}static fromParts(t,s,e,i){const r=new n(t,s,e,i);return r.isValid()?r:null}static fromReader(t){if(!t)return null;const s=t.split(":");return 3!==s.length?null:new n(parseInt(s[0],10),parseInt(s[1],10),parseInt(s[2],10),0)}static fromMilliseconds(t){if(t>864e5||t<0)return null;const s=Math.floor(t/1e3%60),e=Math.floor(t/6e4%60),i=Math.floor(t/36e5%24),r=Math.floor(t%1e3);return new n(i,e,s,r)}static fromDateJS(t){return new n(t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds())}static fromDateTime(t){return new n(t.hour,t.minute,t.second,t.millisecond)}static fromSqlTimeStampOffset(t){return this.fromDateTime(t.toDateTime())}static fromString(t,s=null){if(""===t)return null;if(null===t)return null;const r=[];s?(s=i(s))&&r.push(s):null!==s&&""!==s||(r.push("HH:mm:ss"),r.push("HH:mm:ss.SSS"),r.push("hh:mm:ss a"),r.push("hh:mm:ss.SSS a"),r.push("HH:mm"),r.push("hh:mm a"),r.push("H:mm"),r.push("h:mm a"),r.push("H:mm:ss"),r.push("h:mm:ss a"),r.push("H:mm:ss.SSS"),r.push("h:mm:ss.SSS a"));for(const i of r){const s=e.fromFormat(t,i);if(s.isValid)return new n(s.hour,s.minute,s.second,s.millisecond)}return null}plus(t,s){switch(t){case"days":case"years":case"months":return this.clone();case"hours":case"minutes":case"seconds":case"milliseconds":return n.fromDateTime(this.toUTCDateTime().plus({[t]:s}))}return null}toUTCDateTime(){return e.utc(1970,1,1,this.hour,this.minute,this.second,this.millisecond)}difference(t,s){switch(s.toLowerCase()){case"days":case"day":case"d":return this.toUTCDateTime().diff(t.toUTCDateTime(),"days").days;case"months":case"month":return this.toUTCDateTime().diff(t.toUTCDateTime(),"months").months;case"minutes":case"minute":case"m":return"M"===s?this.toUTCDateTime().diff(t.toUTCDateTime(),"months").months:this.toUTCDateTime().diff(t.toUTCDateTime(),"minutes").minutes;case"seconds":case"second":case"s":return this.toUTCDateTime().diff(t.toUTCDateTime(),"seconds").seconds;case"milliseconds":case"millisecond":case"ms":default:return this.toUTCDateTime().diff(t.toUTCDateTime(),"milliseconds").milliseconds;case"hours":case"hour":case"h":return this.toUTCDateTime().diff(t.toUTCDateTime(),"hours").hours;case"years":case"year":case"y":return this.toUTCDateTime().diff(t.toUTCDateTime(),"years").years}}}export{n as TimeOnly,i as standardiseTimeFormat};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import{ArcadeDate as e}from"../../arcade/ArcadeDate.js";import{SqlError as t,SqlErrorCodes as a}from"../../arcade/featureset/support/errorsupport.js";import has from"../has.js";import{isAggregate as r,aggregateFunction as s}from"./AggregateFunctions.js";import{DateOnly as i}from"./DateOnly.js";import{sqlCalculateFunction as n}from"./sqlArithmeticUtils.js";import{sqlCompare as o}from"./sqlCompareUtils.js";import{isDate as l,isDateTime as u,isTimestampOffset as c,isTimeOnly as p,isDateOnly as h,convertToExecutingTimeZone as m,parseTime as f,parseTimestamp as d,parseDate as v}from"./sqlDateParsingUtils.js";import{SqlInterval as N}from"./SqlInterval.js";import{SqlTimeStampOffset as g}from"./SqlTimestampOffset.js";import{isStandardized as y,evaluateFunction as T}from"./StandardizedFunctions.js";import{TimeOnly as S}from"./TimeOnly.js";import{WhereGrammar as _}from"./WhereGrammar.js";import{DateTime as J}from"luxon";const w=new Set(["current_timestamp","current_date","current_time"]);var O;!function(e){e[e.Date=1]="Date",e[e.DateOnly=2]="DateOnly",e[e.TimeOnly=3]="TimeOnly",e[e.TimeStampOffset=4]="TimeStampOffset"}(O||(O={}));class A{static makeBool(e){return R(e)}static featureValue(e,t,a,r,s){return L(e,t,a,r,s)}static equalsNull(e){return null===e}static applyLike(e,t,a){return j(e,t,a)}static ensureArray(e){return D(e)}static applyIn(e,t){return I(e,t)}static currentDate(e){return i.fromNow(e)}static makeSqlInterval(e,t,a){return N.createFromValueAndQualifer(e,t,a)}static convertInterval(e){return e instanceof N?e.valueInMilliseconds():e}static currentTimestamp(e){return m(new Date,e)}static compare(e,t,a,r){return o(t,a,e)}static calculate(e,t,a,r){return n(e,t,a,r)}static evaluateTime(e){return f(e)}static evaluateTimestamp(e,t,a){return d(e,t,a)}static evaluateDate(e,t){return v(e,t)}static evaluateFunction(e,t,a){return T(e,t,a)}static lookup(e,t){const a=t[e];return void 0===a?null:a}static between(e,t,a){return null==e||null==t[0]||null==t[1]?null:o(e,t[0],">=")&&o(e,t[1],"<=")}static notbetween(e,t,a){return null==e||null==t[0]||null==t[1]?null:o(e,t[0],"<")||o(e,t[1],">")}static ternaryNot(e){return Z(e)}static ternaryAnd(e,t){return F(e,t)}static ternaryOr(e,t){return b(e,t)}}class x{constructor(e,t,a={timeZone:"UTC"}){this.fieldsIndex=t,this._complextypefields={},this.parameters={},this.timeReferenceZone="UTC",this._hasDateFunctions=void 0,this.configureExpressionTimeZone(a),this.parseTree=_.parse(e);const{isStandardized:r,isAggregate:s,referencedFieldNames:i}=this._extractExpressionInfo(t);this._referencedFieldNames=i,this.isStandardized=r,this.isAggregate=s}configureExpressionTimeZone(e){this.timeReferenceZone=e.timeZone}static convertValueToStorageFormat(e,t=null){if(null===t)return l(e)?e.getTime():u(e)?e.toMillis():c(e)?e.toStorageFormat():p(e)?e.toStorageString():h(e)?e.toStorageFormat():e;switch(t){case"date":return l(e)?e.getTime():u(e)?e.toMillis():c(e)?e.toMilliseconds():h(e)?e.toNumber():e;case"date-only":return l(e)?i.fromDateJS(e).toString():c(e)?i.fromSqlTimeStampOffset(e).toString():u(e)?i.fromDateTime(e).toString():e;case"time-only":return l(e)?S.fromDateJS(e).toStorageString():u(e)?S.fromDateTime(e).toStorageString():c(e)?S.fromSqlTimeStampOffset(e).toStorageString():p(e)?e.toStorageString():e;case"timestamp-offset":if(l(e))return g.fromJSDate(e).toStorageFormat();if(u(e))return g.fromDateTime(e).toStorageFormat();if(c(e))return e.toStorageFormat()}return e}static create(e,t,a={timeZone:"UTC"}){return new x(e,t,a)}get fieldNames(){return this._referencedFieldNames}testSet(e,t=C){const a={};for(const r of this.fieldNames)a[r]=e.map((e=>t.getAttribute(e,r)));return!!this._evaluateNode(this.parseTree,{attributes:a},C)}calculateValue(e,t=C){const a=this._evaluateNode(this.parseTree,e,t);return a instanceof N?a.valueInMilliseconds()/864e5:a}calculateValueCompiled(e,t=C){return null!=this.parseTree._compiledVersion?this.parseTree._compiledVersion(e,this.parameters,t,this._complextypefields,this.timeReferenceZone):has("esri-csp-restrictions")?this.calculateValue(e,t):(this._compileMe(),this.parseTree._compiledVersion(e,this.parameters,t,this._complextypefields,this.timeReferenceZone))}testFeature(e,t=C){return!!this._evaluateNode(this.parseTree,e,t)}testFeatureCompiled(e,t=C){return null!=this.parseTree._compiledVersion?!!this.parseTree._compiledVersion(e,this.parameters,t,this._complextypefields,this.timeReferenceZone):has("esri-csp-restrictions")?this.testFeature(e,t):(this._compileMe(),!!this.parseTree._compiledVersion(e,this.parameters,t,this._complextypefields,this.timeReferenceZone))}get hasDateFunctions(){return null!=this._hasDateFunctions||(this._hasDateFunctions=!1,this._visitAll(this.parseTree,(e=>{"current-time"===e.type?this._hasDateFunctions=!0:"function"===e.type&&(this._hasDateFunctions=this._hasDateFunctions||w.has(e.name.toLowerCase()))}))),this._hasDateFunctions}getFunctions(){const e=new Set;return this._visitAll(this.parseTree,(t=>{"function"===t.type&&e.add(t.name.toLowerCase())})),Array.from(e)}getExpressions(){const e=new Map;return this._visitAll(this.parseTree,(t=>{if("function"===t.type){const a=t.name.toLowerCase(),r=t.args.value[0];if("column-reference"===r.type){const t=r.column,s=`${a}-${t}`;e.has(s)||e.set(s,{aggregateType:a,field:t})}}})),[...e.values()]}getVariables(){const e=new Set;return this._visitAll(this.parseTree,(t=>{"parameter"===t.type&&e.add(t.value.toLowerCase())})),Array.from(e)}_compileMe(){const e="return this.convertInterval("+this.evaluateNodeToJavaScript(this.parseTree)+")";this.parseTree._compiledVersion=new Function("feature","lookups","attributeAdapter","complextypefields","timeReferenceZone",e).bind(A)}_extractExpressionInfo(e){const t=[],a=new Set;let s=!0,i=!0;return this._visitAll(this.parseTree,(n=>{switch(n.type){case"column-reference":{const r=e?.get(n.column);let s,i;r?s=i=r.name??"":(i=n.column,s=i.toLowerCase()),r&&r.name&&("date"===r.type||"esriFieldTypeDate"===r.type)&&(this._complextypefields[r.name]=O.Date),!r?.name||"date-only"!==r.type&&"esriFieldTypeDateOnly"!==r.type||(this._complextypefields[r.name]=O.DateOnly),r&&r.name&&("time-only"===r.type||"esriFieldTypeTimeOnly"===r.type)&&(this._complextypefields[r.name]=O.TimeOnly),r&&r.name&&("timestamp-offset"===r.type||"esriFieldTypeTimestampOffset"===r.type)&&(this._complextypefields[r.name]=O.TimeStampOffset),a.has(s)||(a.add(s),t.push(i)),n.column=i;break}case"function":{const{name:e,args:t}=n,a=t.value.length;s&&(s=y(e,a)),i&&(i=r(e,a));break}}})),{referencedFieldNames:Array.from(t),isStandardized:s,isAggregate:i}}_visitAll(e,t){if(null!=e)switch(t(e),e.type){case"when-clause":this._visitAll(e.operand,t),this._visitAll(e.value,t);break;case"case-expression":for(const a of e.clauses)this._visitAll(a,t);"simple"===e.format&&this._visitAll(e.operand,t),null!==e.else&&this._visitAll(e.else,t);break;case"expression-list":for(const a of e.value)this._visitAll(a,t);break;case"unary-expression":this._visitAll(e.expr,t);break;case"binary-expression":this._visitAll(e.left,t),this._visitAll(e.right,t);break;case"function":this._visitAll(e.args,t)}}evaluateNodeToJavaScript(e){switch(e.type){case"interval":return"this.makeSqlInterval("+this.evaluateNodeToJavaScript(e.value)+", "+JSON.stringify(e.qualifier)+","+JSON.stringify(e.op)+")";case"case-expression":{let t="";if("simple"===e.format){const a=this.evaluateNodeToJavaScript(e.operand);t="( ";for(let r=0;r<e.clauses.length;r++)t+=" (this.compare('=',"+a+","+this.evaluateNodeToJavaScript(e.clauses[r].operand)+") ? ("+this.evaluateNodeToJavaScript(e.clauses[r].value)+") : ";null!==e.else?t+=this.evaluateNodeToJavaScript(e.else):t+="null",t+=" )"}else{t="( ";for(let a=0;a<e.clauses.length;a++)t+=" this.makeBool("+this.evaluateNodeToJavaScript(e.clauses[a].operand)+")===true ? ("+this.evaluateNodeToJavaScript(e.clauses[a].value)+") : ";null!==e.else?t+=this.evaluateNodeToJavaScript(e.else):t+="null",t+=" )"}return t}case"parameter":return"this.lookup("+JSON.stringify(e.value.toLowerCase())+",lookups)";case"expression-list":{let t="[";for(const a of e.value)"["!==t&&(t+=","),t+=this.evaluateNodeToJavaScript(a);return t+="]",t}case"unary-expression":return"this.ternaryNot("+this.evaluateNodeToJavaScript(e.expr)+")";case"binary-expression":switch(e.operator){case"AND":return"this.ternaryAnd("+this.evaluateNodeToJavaScript(e.left)+","+this.evaluateNodeToJavaScript(e.right)+" )";case"OR":return"this.ternaryOr("+this.evaluateNodeToJavaScript(e.left)+","+this.evaluateNodeToJavaScript(e.right)+" )";case"IS":if("null"!==e.right.type)throw new t(a.UnsupportedIsRhs);return"this.equalsNull("+this.evaluateNodeToJavaScript(e.left)+")";case"ISNOT":if("null"!==e.right.type)throw new t(a.UnsupportedIsRhs);return"(!(this.equalsNull("+this.evaluateNodeToJavaScript(e.left)+")))";case"IN":return"this.applyIn("+this.evaluateNodeToJavaScript(e.left)+",this.ensureArray("+this.evaluateNodeToJavaScript(e.right)+"))";case"NOT IN":return"this.ternaryNot(this.applyIn("+this.evaluateNodeToJavaScript(e.left)+",this.ensureArray("+this.evaluateNodeToJavaScript(e.right)+")))";case"BETWEEN":return"this.between("+this.evaluateNodeToJavaScript(e.left)+","+this.evaluateNodeToJavaScript(e.right)+", timeReferenceZone)";case"NOTBETWEEN":return"this.notbetween("+this.evaluateNodeToJavaScript(e.left)+","+this.evaluateNodeToJavaScript(e.right)+", timeReferenceZone)";case"LIKE":return"this.applyLike("+this.evaluateNodeToJavaScript(e.left)+","+this.evaluateNodeToJavaScript(e.right)+","+JSON.stringify(e.escape)+")";case"NOT LIKE":return"this.ternaryNot(this.applyLike("+this.evaluateNodeToJavaScript(e.left)+","+this.evaluateNodeToJavaScript(e.right)+","+JSON.stringify(e.escape)+"))";case"<>":case"<":case">":case">=":case"<=":case"=":return"this.compare("+JSON.stringify(e.operator)+","+this.evaluateNodeToJavaScript(e.left)+","+this.evaluateNodeToJavaScript(e.right)+", timeReferenceZone)";case"*":case"-":case"+":case"/":case"||":return"this.calculate("+JSON.stringify(e.operator)+","+this.evaluateNodeToJavaScript(e.left)+","+this.evaluateNodeToJavaScript(e.right)+", timeReferenceZone)"}throw new t(a.UnsupportedOperator,{operator:e.operator});case"null":case"boolean":case"string":case"number":return JSON.stringify(e.value);case"time":return"this.evaluateTime(JSON.stringify(node.value))";case"date":return"this.evaluateDate(JSON.stringify(node.value), timeReferenceZone)";case"timestamp":return"this.evaluateTimestamp(JSON.stringify(node.value), timeReferenceZone)";case"current-time":return"date"===e.mode?"this.currentDate(timeReferenceZone)":"this.currentTimestamp(timeReferenceZone)";case"column-reference":return"this.featureValue(feature,"+JSON.stringify(e.column)+",complextypefields,attributeAdapter, timeReferenceZone)";case"function":return"this.evaluateFunction("+JSON.stringify(e.name)+","+this.evaluateNodeToJavaScript(e.args)+", timeReferenceZone)"}throw new t(a.UnsupportedSyntax,{node:e.type})}_evaluateNode(r,u,c){let p;switch(r.type){case"interval":{const e=this._evaluateNode(r.value,u,c);return N.createFromValueAndQualifer(e,r.qualifier,r.op)}case"case-expression":if("simple"===r.format){const e=this._evaluateNode(r.operand,u,c);for(let t=0;t<r.clauses.length;t++)if(o(e,this._evaluateNode(r.clauses[t].operand,u,c),"=",this.timeReferenceZone))return this._evaluateNode(r.clauses[t].value,u,c);if(null!==r.else)return this._evaluateNode(r.else,u,c)}else{for(let e=0;e<r.clauses.length;e++)if(R(this._evaluateNode(r.clauses[e].operand,u,c)))return this._evaluateNode(r.clauses[e].value,u,c);if(null!==r.else)return this._evaluateNode(r.else,u,c)}return null;case"parameter":return p=this.parameters[r.value.toLowerCase()],l(p)?J.fromJSDate(p):p instanceof e?p.toDateTime():p;case"expression-list":{const e=[];for(const t of r.value)e.push(this._evaluateNode(t,u,c));return e}case"unary-expression":return Z(this._evaluateNode(r.expr,u,c));case"binary-expression":switch(r.operator){case"AND":return F(this._evaluateNode(r.left,u,c),this._evaluateNode(r.right,u,c));case"OR":return b(this._evaluateNode(r.left,u,c),this._evaluateNode(r.right,u,c));case"IS":if("null"!==r.right.type)throw new t(a.UnsupportedIsRhs);return null===this._evaluateNode(r.left,u,c);case"ISNOT":if("null"!==r.right.type)throw new t(a.UnsupportedIsRhs);return null!==this._evaluateNode(r.left,u,c);case"IN":{const e=D(this._evaluateNode(r.right,u,c));return I(this._evaluateNode(r.left,u,c),e)}case"NOT IN":{const e=D(this._evaluateNode(r.right,u,c));return Z(I(this._evaluateNode(r.left,u,c),e))}case"BETWEEN":{const e=this._evaluateNode(r.left,u,c),t=this._evaluateNode(r.right,u,c);return null==e||null==t[0]||null==t[1]?null:o(e,t[0],">=",this.timeReferenceZone)&&o(e,t[1],"<=",this.timeReferenceZone)}case"NOTBETWEEN":{const e=this._evaluateNode(r.left,u,c),t=this._evaluateNode(r.right,u,c);return null==e||null==t[0]||null==t[1]?null:o(e,t[0],"<",this.timeReferenceZone)||o(e,t[1],">",this.timeReferenceZone)}case"LIKE":return j(this._evaluateNode(r.left,u,c),this._evaluateNode(r.right,u,c),r.escape);case"NOT LIKE":return Z(j(this._evaluateNode(r.left,u,c),this._evaluateNode(r.right,u,c),r.escape));case"<>":case"<":case">":case">=":case"<=":case"=":return o(this._evaluateNode(r.left,u,c),this._evaluateNode(r.right,u,c),r.operator,this.timeReferenceZone);case"-":case"+":case"*":case"/":case"||":return n(r.operator,this._evaluateNode(r.left,u,c),this._evaluateNode(r.right,u,c),this.timeReferenceZone)}case"null":case"boolean":case"string":case"number":return r.value;case"date":return v(r.value,this.timeReferenceZone);case"timestamp":return d(r.value,this.timeReferenceZone);case"time":return f(r.value);case"current-time":return"date"===r.mode?i.fromNow(this.timeReferenceZone):m(new Date,this.timeReferenceZone);case"column-reference":return L(u,r.column,this._complextypefields,c,this.timeReferenceZone);case"data-type":return r.value;case"function":{const e=this._evaluateNode(r.args,u,c);return this.isAggregate?s(r.name,e):T(r.name,e,this.timeReferenceZone)}}throw new t(a.UnsupportedSyntax,{node:r.type})}}function R(e){return!0===e}function D(e){return Array.isArray(e)?e:[e]}function Z(e){return null!==e?!0!==e:null}function F(e,t){return null!=e&&null!=t?!0===e&&!0===t:!1!==e&&!1!==t&&null}function b(e,t){return null!=e&&null!=t?!0===e||!0===t:!0===e||!0===t||null}function I(e,t){if(null==e)return null;let a=!1;for(const r of t)if(null==r)a=null;else if(e===r){a=!0;break}return a}const E="-[]/{}()*+?.\\^$|";var k;function V(e,t){const a=t;let r="",s=k.Normal;for(let i=0;i<e.length;i++){const t=e.charAt(i);switch(s){case k.Normal:t===a?s=k.Escaped:E.includes(t)?r+="\\"+t:r+="%"===t?".*":"_"===t?".":t;break;case k.Escaped:E.includes(t)?r+="\\"+t:r+=t,s=k.Normal}}return new RegExp("^"+r+"$","m")}function j(e,t,a){if(null==e)return null;return V(t,a).test(e)}function q(e){return e&&"object"==typeof e.attributes}function L(e,t,a,r,s){const n=r.getAttribute(e,t);return null!=n&&a[t]===O.Date?m(new Date(n),s):null!=n&&a[t]===O.DateOnly?i.fromReader(n):null!=n&&a[t]===O.TimeOnly?S.fromReader(n):null!=n&&a[t]===O.TimeStampOffset?new g(n):n}!function(e){e[e.Normal=0]="Normal",e[e.Escaped=1]="Escaped"}(k||(k={}));const C={getAttribute:(e,t)=>(q(e)?e.attributes:e)[t]};export{x as WhereClause,C as defaultAttributeAdapter};
5
+ import{ArcadeDate as e}from"../../arcade/ArcadeDate.js";import{SqlError as t,SqlErrorCodes as a}from"../../arcade/featureset/support/errorsupport.js";import has from"../has.js";import{isAggregate as r,aggregateFunction as s}from"./AggregateFunctions.js";import{DateOnly as i}from"./DateOnly.js";import{sqlCalculateFunction as n}from"./sqlArithmeticUtils.js";import{sqlCompare as l}from"./sqlCompareUtils.js";import{isDate as o,isDateTime as u,isTimestampOffset as c,isTimeOnly as p,isDateOnly as h,convertToExecutingTimeZone as m,parseTime as f,parseTimestamp as d,parseDate as v}from"./sqlDateParsingUtils.js";import{SqlInterval as N}from"./SqlInterval.js";import{SqlTimeStampOffset as g}from"./SqlTimestampOffset.js";import{isStandardized as y,evaluateFunction as T}from"./StandardizedFunctions.js";import{TimeOnly as S}from"./TimeOnly.js";import{WhereGrammar as _}from"./WhereGrammar.js";import{DateTime as J}from"luxon";const w=new Set(["current_timestamp","current_date","current_time"]);var O;!function(e){e[e.Date=1]="Date",e[e.DateOnly=2]="DateOnly",e[e.TimeOnly=3]="TimeOnly",e[e.TimeStampOffset=4]="TimeStampOffset"}(O||(O={}));class A{static makeBool(e){return R(e)}static featureValue(e,t,a,r,s){return L(e,t,a,r,s)}static equalsNull(e){return null===e}static applyLike(e,t,a){return j(e,t,a)}static ensureArray(e){return D(e)}static applyIn(e,t){return I(e,t)}static currentDate(e){return i.fromNow(e)}static makeSqlInterval(e,t,a){return N.createFromValueAndQualifer(e,t,a)}static convertInterval(e){return e instanceof N?e.valueInMilliseconds():e}static currentTimestamp(e){return m(new Date,e)}static compare(e,t,a,r){return l(t,a,e)}static calculate(e,t,a,r){return n(e,t,a,r)}static evaluateTime(e){return f(e)}static evaluateTimestamp(e,t,a){return d(e,t,a)}static evaluateDate(e,t){return v(e,t)}static evaluateFunction(e,t,a){return T(e,t,a)}static lookup(e,t){const a=t[e];return void 0===a?null:a}static between(e,t,a){return null==e||null==t[0]||null==t[1]?null:l(e,t[0],">=")&&l(e,t[1],"<=")}static notbetween(e,t,a){return null==e||null==t[0]||null==t[1]?null:l(e,t[0],"<")||l(e,t[1],">")}static ternaryNot(e){return Z(e)}static ternaryAnd(e,t){return F(e,t)}static ternaryOr(e,t){return b(e,t)}}class x{constructor(e,t,a={timeZone:"UTC"}){this.fieldsIndex=t,this._complextypefields={},this.parameters={},this.timeReferenceZone="UTC",this._hasDateFunctions=void 0,this.configureExpressionTimeZone(a),this.parseTree=_.parse(e);const{isStandardized:r,isAggregate:s,referencedFieldNames:i}=this._extractExpressionInfo(t);this._referencedFieldNames=i,this.isStandardized=r,this.isAggregate=s}configureExpressionTimeZone(e){this.timeReferenceZone=e.timeZone}static convertValueToStorageFormat(e,t=null){if(null===t)return o(e)?e.getTime():u(e)?e.toMillis():c(e)?e.toStorageFormat():p(e)?e.toStorageString():h(e)?e.toStorageFormat():e;switch(t){case"date":return o(e)?e.getTime():u(e)?e.toMillis():c(e)?e.toMilliseconds():h(e)?e.toNumber():e;case"date-only":return o(e)?i.fromDateJS(e).toString():c(e)?i.fromSqlTimeStampOffset(e).toString():u(e)?i.fromDateTime(e).toString():e;case"time-only":return o(e)?S.fromDateJS(e).toStorageString():u(e)?S.fromDateTime(e).toStorageString():c(e)?S.fromSqlTimeStampOffset(e).toStorageString():p(e)?e.toStorageString():e;case"timestamp-offset":if(o(e))return g.fromJSDate(e).toStorageFormat();if(u(e))return g.fromDateTime(e).toStorageFormat();if(c(e))return e.toStorageFormat()}return e}static create(e,t,a={timeZone:"UTC"}){return new x(e,t,a)}get fieldNames(){return this._referencedFieldNames}testSet(e,t=C){return!!this._evaluateNode(this.parseTree,null,t,e)}calculateValue(e,t=C){const a=this._evaluateNode(this.parseTree,e,t,null);return a instanceof N?a.valueInMilliseconds()/864e5:a}calculateValueCompiled(e,t=C){return null!=this.parseTree._compiledVersion?this.parseTree._compiledVersion(e,this.parameters,t,this._complextypefields,this.timeReferenceZone):has("esri-csp-restrictions")?this.calculateValue(e,t):(this._compileMe(),this.parseTree._compiledVersion(e,this.parameters,t,this._complextypefields,this.timeReferenceZone))}testFeature(e,t=C){return!!this._evaluateNode(this.parseTree,e,t,null)}testFeatureCompiled(e,t=C){return null!=this.parseTree._compiledVersion?!!this.parseTree._compiledVersion(e,this.parameters,t,this._complextypefields,this.timeReferenceZone):has("esri-csp-restrictions")?this.testFeature(e,t):(this._compileMe(),!!this.parseTree._compiledVersion(e,this.parameters,t,this._complextypefields,this.timeReferenceZone))}get hasDateFunctions(){return null!=this._hasDateFunctions||(this._hasDateFunctions=!1,this._visitAll(this.parseTree,(e=>{"current-time"===e.type?this._hasDateFunctions=!0:"function"===e.type&&(this._hasDateFunctions=this._hasDateFunctions||w.has(e.name.toLowerCase()))}))),this._hasDateFunctions}getFunctions(){const e=new Set;return this._visitAll(this.parseTree,(t=>{"function"===t.type&&e.add(t.name.toLowerCase())})),Array.from(e)}getExpressions(){const e=new Map;return this._visitAll(this.parseTree,(t=>{if("function"===t.type){const a=t.name.toLowerCase(),r=t.args.value[0];if("column-reference"===r.type){const t=r.column,s=`${a}-${t}`;e.has(s)||e.set(s,{aggregateType:a,field:t})}}})),[...e.values()]}getVariables(){const e=new Set;return this._visitAll(this.parseTree,(t=>{"parameter"===t.type&&e.add(t.value.toLowerCase())})),Array.from(e)}_compileMe(){const e="return this.convertInterval("+this.evaluateNodeToJavaScript(this.parseTree)+")";this.parseTree._compiledVersion=new Function("feature","lookups","attributeAdapter","complextypefields","timeReferenceZone",e).bind(A)}_extractExpressionInfo(e){const t=[],a=new Set;let s=!0,i=!1;return this._visitAll(this.parseTree,(n=>{switch(n.type){case"column-reference":{const r=e?.get(n.column);let s,i;r?s=i=r.name??"":(i=n.column,s=i.toLowerCase()),r&&r.name&&("date"===r.type||"esriFieldTypeDate"===r.type)&&(this._complextypefields[r.name]=O.Date),!r?.name||"date-only"!==r.type&&"esriFieldTypeDateOnly"!==r.type||(this._complextypefields[r.name]=O.DateOnly),r&&r.name&&("time-only"===r.type||"esriFieldTypeTimeOnly"===r.type)&&(this._complextypefields[r.name]=O.TimeOnly),r&&r.name&&("timestamp-offset"===r.type||"esriFieldTypeTimestampOffset"===r.type)&&(this._complextypefields[r.name]=O.TimeStampOffset),a.has(s)||(a.add(s),t.push(i)),n.column=i;break}case"function":{const{name:e,args:t}=n,a=t.value.length;s&&(s=y(e,a)),!1===i&&(i=r(e,a));break}}})),{referencedFieldNames:Array.from(t),isStandardized:s,isAggregate:i}}_visitAll(e,t){if(null!=e)switch(t(e),e.type){case"when-clause":this._visitAll(e.operand,t),this._visitAll(e.value,t);break;case"case-expression":for(const a of e.clauses)this._visitAll(a,t);"simple"===e.format&&this._visitAll(e.operand,t),null!==e.else&&this._visitAll(e.else,t);break;case"expression-list":for(const a of e.value)this._visitAll(a,t);break;case"unary-expression":this._visitAll(e.expr,t);break;case"binary-expression":this._visitAll(e.left,t),this._visitAll(e.right,t);break;case"function":this._visitAll(e.args,t)}}evaluateNodeToJavaScript(e){switch(e.type){case"interval":return"this.makeSqlInterval("+this.evaluateNodeToJavaScript(e.value)+", "+JSON.stringify(e.qualifier)+","+JSON.stringify(e.op)+")";case"case-expression":{let t="";if("simple"===e.format){const a=this.evaluateNodeToJavaScript(e.operand);t="( ";for(let r=0;r<e.clauses.length;r++)t+=" (this.compare('=',"+a+","+this.evaluateNodeToJavaScript(e.clauses[r].operand)+") ? ("+this.evaluateNodeToJavaScript(e.clauses[r].value)+") : ";null!==e.else?t+=this.evaluateNodeToJavaScript(e.else):t+="null",t+=" )"}else{t="( ";for(let a=0;a<e.clauses.length;a++)t+=" this.makeBool("+this.evaluateNodeToJavaScript(e.clauses[a].operand)+")===true ? ("+this.evaluateNodeToJavaScript(e.clauses[a].value)+") : ";null!==e.else?t+=this.evaluateNodeToJavaScript(e.else):t+="null",t+=" )"}return t}case"parameter":return"this.lookup("+JSON.stringify(e.value.toLowerCase())+",lookups)";case"expression-list":{let t="[";for(const a of e.value)"["!==t&&(t+=","),t+=this.evaluateNodeToJavaScript(a);return t+="]",t}case"unary-expression":return"this.ternaryNot("+this.evaluateNodeToJavaScript(e.expr)+")";case"binary-expression":switch(e.operator){case"AND":return"this.ternaryAnd("+this.evaluateNodeToJavaScript(e.left)+","+this.evaluateNodeToJavaScript(e.right)+" )";case"OR":return"this.ternaryOr("+this.evaluateNodeToJavaScript(e.left)+","+this.evaluateNodeToJavaScript(e.right)+" )";case"IS":if("null"!==e.right.type)throw new t(a.UnsupportedIsRhs);return"this.equalsNull("+this.evaluateNodeToJavaScript(e.left)+")";case"ISNOT":if("null"!==e.right.type)throw new t(a.UnsupportedIsRhs);return"(!(this.equalsNull("+this.evaluateNodeToJavaScript(e.left)+")))";case"IN":return"this.applyIn("+this.evaluateNodeToJavaScript(e.left)+",this.ensureArray("+this.evaluateNodeToJavaScript(e.right)+"))";case"NOT IN":return"this.ternaryNot(this.applyIn("+this.evaluateNodeToJavaScript(e.left)+",this.ensureArray("+this.evaluateNodeToJavaScript(e.right)+")))";case"BETWEEN":return"this.between("+this.evaluateNodeToJavaScript(e.left)+","+this.evaluateNodeToJavaScript(e.right)+", timeReferenceZone)";case"NOTBETWEEN":return"this.notbetween("+this.evaluateNodeToJavaScript(e.left)+","+this.evaluateNodeToJavaScript(e.right)+", timeReferenceZone)";case"LIKE":return"this.applyLike("+this.evaluateNodeToJavaScript(e.left)+","+this.evaluateNodeToJavaScript(e.right)+","+JSON.stringify(e.escape)+")";case"NOT LIKE":return"this.ternaryNot(this.applyLike("+this.evaluateNodeToJavaScript(e.left)+","+this.evaluateNodeToJavaScript(e.right)+","+JSON.stringify(e.escape)+"))";case"<>":case"<":case">":case">=":case"<=":case"=":return"this.compare("+JSON.stringify(e.operator)+","+this.evaluateNodeToJavaScript(e.left)+","+this.evaluateNodeToJavaScript(e.right)+", timeReferenceZone)";case"*":case"-":case"+":case"/":case"||":return"this.calculate("+JSON.stringify(e.operator)+","+this.evaluateNodeToJavaScript(e.left)+","+this.evaluateNodeToJavaScript(e.right)+", timeReferenceZone)"}throw new t(a.UnsupportedOperator,{operator:e.operator});case"null":case"boolean":case"string":case"number":return JSON.stringify(e.value);case"time":return"this.evaluateTime(JSON.stringify(node.value))";case"date":return"this.evaluateDate(JSON.stringify(node.value), timeReferenceZone)";case"timestamp":return"this.evaluateTimestamp(JSON.stringify(node.value), timeReferenceZone)";case"current-time":return"date"===e.mode?"this.currentDate(timeReferenceZone)":"this.currentTimestamp(timeReferenceZone)";case"column-reference":return"this.featureValue(feature,"+JSON.stringify(e.column)+",complextypefields,attributeAdapter, timeReferenceZone)";case"function":return"this.evaluateFunction("+JSON.stringify(e.name)+","+this.evaluateNodeToJavaScript(e.args)+", timeReferenceZone)"}throw new t(a.UnsupportedSyntax,{node:e.type})}_evaluateNode(u,c,p,h){let g;switch(u.type){case"interval":{const e=this._evaluateNode(u.value,c,p,h);return N.createFromValueAndQualifer(e,u.qualifier,u.op)}case"case-expression":if("simple"===u.format){const e=this._evaluateNode(u.operand,c,p,h);for(let t=0;t<u.clauses.length;t++)if(l(e,this._evaluateNode(u.clauses[t].operand,c,p,h),"=",this.timeReferenceZone))return this._evaluateNode(u.clauses[t].value,c,p,h);if(null!==u.else)return this._evaluateNode(u.else,c,p,h)}else{for(let e=0;e<u.clauses.length;e++)if(R(this._evaluateNode(u.clauses[e].operand,c,p,h)))return this._evaluateNode(u.clauses[e].value,c,p,h);if(null!==u.else)return this._evaluateNode(u.else,c,p,h)}return null;case"parameter":return g=this.parameters[u.value.toLowerCase()],o(g)?J.fromJSDate(g):g instanceof e?g.toDateTime():g;case"expression-list":{const e=[];for(const t of u.value)e.push(this._evaluateNode(t,c,p,h));return e}case"unary-expression":return Z(this._evaluateNode(u.expr,c,p,h));case"binary-expression":switch(u.operator){case"AND":return F(this._evaluateNode(u.left,c,p,h),this._evaluateNode(u.right,c,p,h));case"OR":return b(this._evaluateNode(u.left,c,p,h),this._evaluateNode(u.right,c,p,h));case"IS":if("null"!==u.right.type)throw new t(a.UnsupportedIsRhs);return null===this._evaluateNode(u.left,c,p,h);case"ISNOT":if("null"!==u.right.type)throw new t(a.UnsupportedIsRhs);return null!==this._evaluateNode(u.left,c,p,h);case"IN":{const e=D(this._evaluateNode(u.right,c,p,h));return I(this._evaluateNode(u.left,c,p,h),e)}case"NOT IN":{const e=D(this._evaluateNode(u.right,c,p,h));return Z(I(this._evaluateNode(u.left,c,p,h),e))}case"BETWEEN":{const e=this._evaluateNode(u.left,c,p,h),t=this._evaluateNode(u.right,c,p,h);return null==e||null==t[0]||null==t[1]?null:l(e,t[0],">=",this.timeReferenceZone)&&l(e,t[1],"<=",this.timeReferenceZone)}case"NOTBETWEEN":{const e=this._evaluateNode(u.left,c,p,h),t=this._evaluateNode(u.right,c,p,h);return null==e||null==t[0]||null==t[1]?null:l(e,t[0],"<",this.timeReferenceZone)||l(e,t[1],">",this.timeReferenceZone)}case"LIKE":return j(this._evaluateNode(u.left,c,p,h),this._evaluateNode(u.right,c,p,h),u.escape);case"NOT LIKE":return Z(j(this._evaluateNode(u.left,c,p,h),this._evaluateNode(u.right,c,p,h),u.escape));case"<>":case"<":case">":case">=":case"<=":case"=":return l(this._evaluateNode(u.left,c,p,h),this._evaluateNode(u.right,c,p,h),u.operator,this.timeReferenceZone);case"-":case"+":case"*":case"/":case"||":return n(u.operator,this._evaluateNode(u.left,c,p,h),this._evaluateNode(u.right,c,p,h),this.timeReferenceZone)}case"null":case"boolean":case"string":case"number":return u.value;case"date":return v(u.value,this.timeReferenceZone);case"timestamp":return d(u.value,this.timeReferenceZone);case"time":return f(u.value);case"current-time":return"date"===u.mode?i.fromNow(this.timeReferenceZone):m(new Date,this.timeReferenceZone);case"column-reference":return L(c,u.column,this._complextypefields,p,this.timeReferenceZone);case"data-type":return u.value;case"function":{if(this.isAggregate&&r(u.name,u.args.value.length)){const e=[];for(const t of u.args?.value||[]){const a=[];for(const e of h||[])a.push(this._evaluateNode(t,e,p,null));e.push(a)}return s(u.name,e)}const e=this._evaluateNode(u.args,c,p,h);return T(u.name,e,this.timeReferenceZone)}}throw new t(a.UnsupportedSyntax,{node:u.type})}}function R(e){return!0===e}function D(e){return Array.isArray(e)?e:[e]}function Z(e){return null!==e?!0!==e:null}function F(e,t){return null!=e&&null!=t?!0===e&&!0===t:!1!==e&&!1!==t&&null}function b(e,t){return null!=e&&null!=t?!0===e||!0===t:!0===e||!0===t||null}function I(e,t){if(null==e)return null;let a=!1;for(const r of t)if(null==r)a=null;else if(e===r){a=!0;break}return a}const E="-[]/{}()*+?.\\^$|";var k;function V(e,t){const a=t;let r="",s=k.Normal;for(let i=0;i<e.length;i++){const t=e.charAt(i);switch(s){case k.Normal:t===a?s=k.Escaped:E.includes(t)?r+="\\"+t:r+="%"===t?".*":"_"===t?".":t;break;case k.Escaped:E.includes(t)?r+="\\"+t:r+=t,s=k.Normal}}return new RegExp("^"+r+"$","m")}function j(e,t,a){if(null==e)return null;return V(t,a).test(e)}function q(e){return e&&"object"==typeof e.attributes}function L(e,t,a,r,s){const n=r.getAttribute(e,t);return null!=n&&a[t]===O.Date?m(new Date(n),s):null!=n&&a[t]===O.DateOnly?i.fromReader(n):null!=n&&a[t]===O.TimeOnly?S.fromReader(n):null!=n&&a[t]===O.TimeStampOffset?new g(n):n}!function(e){e[e.Normal=0]="Normal",e[e.Escaped=1]="Escaped"}(k||(k={}));const C={getAttribute:(e,t)=>(q(e)?e.attributes:e)[t]};export{x as WhereClause,C as defaultAttributeAdapter};