@arcgis/core 5.2.0-next.138 → 5.2.0-next.139

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 (34) hide show
  1. package/arcade/featureset/actions/GroupBy.js +1 -1
  2. package/arcade/featureset/support/FeatureSet.js +1 -1
  3. package/arcade/featureset/support/shared.js +1 -1
  4. package/arcade/featureset/support/sqlUtils.js +1 -1
  5. package/arcade/featureset/support/stats.js +1 -1
  6. package/arcade/functions/featuresetstats.js +1 -1
  7. package/arcade/functions/fieldStats.js +1 -1
  8. package/arcgisGlobal.d.ts +1 -1
  9. package/assets/esri/core/workers/RemoteClient.js +1 -1
  10. package/assets/esri/core/workers/chunks/1380cec385426673f294.js +1 -0
  11. package/assets/esri/core/workers/chunks/2671035cc08027185737.js +1 -0
  12. package/assets/esri/core/workers/chunks/3f946c13ad97fbed867b.js +1 -0
  13. package/assets/esri/core/workers/chunks/8b1c17cc52d989924313.js +1 -0
  14. package/assets/esri/core/workers/chunks/acfa03c65ba3ca6c5685.js +1 -0
  15. package/assets/esri/libs/librust-parquet/pkg/parquet_bg.wasm +0 -0
  16. package/core/sql/AggregateFunctions.js +1 -1
  17. package/legend/ActiveLayerInfo.d.ts +2 -2
  18. package/legend/{LegendContent.d.ts → LegendModel.d.ts} +10 -10
  19. package/legend/{LegendContent.js → LegendModel.js} +1 -1
  20. package/legend/types.d.ts +4 -4
  21. package/package.json +2 -2
  22. package/popup/FeatureContent.d.ts +17 -8
  23. package/popup/FeatureContent.js +1 -1
  24. package/popup/FeatureContentCollection.d.ts +0 -1
  25. package/popup/FeatureContentCollection.js +1 -1
  26. package/symbols/cim/cimAnalyzer.js +1 -1
  27. package/symbols/cim/types.d.ts +493 -8
  28. package/widgets/Legend/LegendViewModel.d.ts +3 -3
  29. package/widgets/Legend/LegendViewModel.js +1 -1
  30. package/assets/esri/core/workers/chunks/37fc47373c1c8fcdfd1a.js +0 -1
  31. package/assets/esri/core/workers/chunks/537dbd3b870bbef7433e.js +0 -1
  32. package/assets/esri/core/workers/chunks/703411e4a18a6a36048a.js +0 -1
  33. package/assets/esri/core/workers/chunks/879b2f0ff1977bca9376.js +0 -1
  34. package/assets/esri/core/workers/chunks/b748faaa5ebdeba73103.js +0 -1
@@ -210,20 +210,157 @@ export interface CIMMultipartColorRamp extends CIMColorRamp {
210
210
  export type CIMColorRampUnion = CIMLinearContinuousColorRamp | CIMFixedColorRamp | CIMMultipartColorRamp;
211
211
 
212
212
  /**
213
- * Represents a callout for a point symbol.
213
+ * The base interface for callouts attached to point symbols or text symbols.
214
+ * The supported public callout types are listed in [CIMCalloutType](https://developers.arcgis.com/javascript/latest/references/core/symbols/cim/types/#CIMCalloutType).
214
215
  *
215
216
  * @since 5.0
216
217
  */
217
- export interface CIMCallout {}
218
+ export interface CIMCallout {
219
+ /**
220
+ * The callout type.
221
+ *
222
+ * @since 5.2
223
+ */
224
+ type: string;
225
+ /**
226
+ * The closest distance to the text, measured in points, that the anchor point can be for the callout to draw.
227
+ *
228
+ * @since 5.2
229
+ */
230
+ leaderTolerance?: number;
231
+ /**
232
+ * The distance, in points, between the anchor point and the beginning of the drawn leader.
233
+ *
234
+ * @since 5.2
235
+ */
236
+ leaderOffset?: number;
237
+ }
218
238
 
219
- /** @since 5.0 */
220
- export interface CIMLineCallout extends CIMCallout {}
239
+ /**
240
+ * Shared properties for callouts that can draw a leader line, which extends from the text to a point on your map.
241
+ *
242
+ * @since 5.0
243
+ */
244
+ export interface CIMLineCallout extends CIMCallout {
245
+ /**
246
+ * The line symbol used to draw the leader line.
247
+ *
248
+ * @since 5.2
249
+ */
250
+ leaderLineSymbol?: CIMLineSymbol | null;
251
+ /**
252
+ * The gap, measured in points, between the text symbol and the beginning of the leader line.
253
+ *
254
+ * @since 5.2
255
+ */
256
+ gap?: number | null;
257
+ /**
258
+ * The style of line to generate when a point leader is drawn. Leader lines are always drawn with their own geometry.
259
+ *
260
+ * @since 5.2
261
+ */
262
+ lineStyle?: LeaderLineStyle | null;
263
+ }
264
+
265
+ /**
266
+ * Represents the leader line style for callouts. Line leaders will always be drawn with their own geometry.
267
+ *
268
+ * Supported values:
269
+ * - `Base`: The line callout leader is a single line originating from the closest corner of the text box with the gap applied. If the callout has an accent bar it is connected to the closest point at the either top or bottom of the accent bar.
270
+ * - `MidPoint`: The line callout leader is a single line originating from the midpoint of the left or right side of the text box with the gap applied or from the midpoint of the accent bar if the callout has one.
271
+ * - `ThreePoint`: The line callout leader is a 3-point line originating from the midpoint of the left or right side of the text box with the gap applied or the midpoint of the accent bar if the callout has one.
272
+ * - `FourPoint`: The line callout leader is a 4-point line originating from the midpoint of the left or right side of the text box with the gap applied or the midpoint of the accent bar if the callout has one.
273
+ * - `Underline`: The line callout draws a line that connects to the closest of the four corners of the text with the gap applied. If the callout has an accent bar it is connected to the closest point at either the top or bottom of the accent bar. Additionally, either and underline or an "overline" is drawn along the closest side (bottom or top) of the text.
274
+ * - `CircularCW`: The line callout leader is curved (clockwise) from the anchor point to the closest corner of the text box with the gap applied. If the callout has an accent bar it is connected to the closest point at the either top or bottom of the accent bar.
275
+ * - `CircularCCW`: The line callout leader is curved (counter-clockwise) from the anchor point to the closest corner of the text box with the gap applied. If the callout has an accent bar it is connected to the closest point at the either top or bottom of the accent bar.
276
+ *
277
+ * @since 5.2
278
+ */
279
+ export type LeaderLineStyle = "Base" | "MidPoint" | "ThreePoint" | "FourPoint" | "Underline" | "CircularCW" | "CircularCCW";
221
280
 
222
281
  /**
223
- * Represents a background callout for a [CIMTextSymbol](https://developers.arcgis.com/javascript/latest/references/core/symbols/cim/types/#CIMTextSymbol).
282
+ * Represents a background callout for a point or text symbol, with an optional polygon background and leader line.
224
283
  *
225
284
  * @since 4.26
226
285
  * @see [CIMTextSymbol.callout](https://developers.arcgis.com/javascript/latest/references/core/symbols/cim/types/#CIMTextSymbol)
286
+ * @example
287
+ * ```json
288
+ * {
289
+ * "type": "CIMBackgroundCallout",
290
+ * "leaderTolerance": 0,
291
+ * "backgroundSymbol": {
292
+ * "type": "CIMPolygonSymbol",
293
+ * "symbolLayers": [
294
+ * {
295
+ * "type": "CIMSolidFill",
296
+ * "enable": true,
297
+ * "color": [
298
+ * 217,
299
+ * 240,
300
+ * 233,
301
+ * 255
302
+ * ]
303
+ * },
304
+ * {
305
+ * "type": "CIMSolidStroke",
306
+ * "enable": true,
307
+ * "color": [
308
+ * 0,
309
+ * 127,
310
+ * 120,
311
+ * 255
312
+ * ],
313
+ * "width": 1.5
314
+ * }
315
+ * ]
316
+ * },
317
+ * "margin": {
318
+ * "left": 7,
319
+ * "right": 7,
320
+ * "top": 7,
321
+ * "bottom": 7
322
+ * },
323
+ * "gap": 5,
324
+ * "lineStyle": "Base",
325
+ * "leaderLineSymbol": {
326
+ * "type": "CIMLineSymbol",
327
+ * "symbolLayers": [
328
+ * {
329
+ * "type": "CIMSolidStroke",
330
+ * "enable": true,
331
+ * "capStyle": "Round",
332
+ * "joinStyle": "Round",
333
+ * "color": [
334
+ * 211,
335
+ * 96,
336
+ * 71,
337
+ * 255
338
+ * ],
339
+ * "width": 1.5
340
+ * }
341
+ * ]
342
+ * },
343
+ * "accentBarSymbol": {
344
+ * "type": "CIMLineSymbol",
345
+ * "symbolLayers": [
346
+ * * {
347
+ * "type": "CIMSolidStroke",
348
+ * "enable": true,
349
+ * "capStyle": "Round",
350
+ * "joinStyle": "Round",
351
+ * "color": [
352
+ * 215,
353
+ * 113,
354
+ * 54,
355
+ * 255
356
+ * ],
357
+ * "width": 3
358
+ * }
359
+ * ]
360
+ * },
361
+ * "leaderOffset": 3
362
+ * }
363
+ * ```
227
364
  */
228
365
  export interface CIMBackgroundCallout extends CIMLineCallout {
229
366
  /**
@@ -233,14 +370,137 @@ export interface CIMBackgroundCallout extends CIMLineCallout {
233
370
  */
234
371
  type: "CIMBackgroundCallout";
235
372
  /**
236
- * The symbol used to draw the background.
237
- * > Currently, only CIMSolidStroke and CIMSolidFill symbol layers without geometric effects are supported within this symbol.
373
+ * The symbol used to draw the background. If `null`, the background will not draw.
238
374
  *
239
375
  * @since 5.0
240
376
  */
377
+ backgroundSymbol?: CIMPolygonSymbol | null;
378
+ /**
379
+ * The line symbol used to draw an accent bar. If `null`, the accent bar will not draw.
380
+ *
381
+ * @since 5.2
382
+ */
383
+ accentBarSymbol?: CIMLineSymbol | null;
384
+ /**
385
+ * The spacing, in points, between the text bounds and the callout background.
386
+ *
387
+ * @since 5.2
388
+ */
389
+ margin?: CIMTextMargin | null;
390
+ }
391
+
392
+ /**
393
+ * Represents a callout with a rectangular, rounded-rectangle, or oval body and a pointer to the symbol anchor.
394
+ *
395
+ * @since 5.2
396
+ * @see [CIMTextSymbol.callout](https://developers.arcgis.com/javascript/latest/references/core/symbols/cim/types/#CIMTextSymbol)
397
+ * @see [CIMPointSymbol.callout](https://developers.arcgis.com/javascript/latest/references/core/symbols/cim/types/#CIMPointSymbol)
398
+ * @example
399
+ * ```json
400
+ * {
401
+ * "type": "CIMBalloonCallout",
402
+ * "leaderTolerance": 0,
403
+ * "balloonStyle": "RoundedRectangle",
404
+ * "backgroundSymbol": {
405
+ * "type": "CIMPolygonSymbol",
406
+ * "symbolLayers": [
407
+ * {
408
+ * "type": "CIMSolidFill",
409
+ * "enable": true,
410
+ * "color": [
411
+ * 217,
412
+ * 240,
413
+ * 233,
414
+ * 255
415
+ * ]
416
+ * },
417
+ * {
418
+ * "type": "CIMSolidStroke",
419
+ * "enable": true,
420
+ * "color": [
421
+ * 0,
422
+ * 127,
423
+ * 120,
424
+ * 255
425
+ * ],
426
+ * "width": 1.5
427
+ * }
428
+ * ]
429
+ * },
430
+ * "margin": {
431
+ * "left": 7,
432
+ * "right": 7,
433
+ * "top": 7,
434
+ * "bottom": 7
435
+ * },
436
+ * "useFixedDartWidth": true,
437
+ * "fixedDartWidth": 12
438
+ * }
439
+ * ```
440
+ */
441
+ export interface CIMBalloonCallout extends CIMCallout {
442
+ /**
443
+ * The callout type.
444
+ *
445
+ * @since 5.2
446
+ */
447
+ type: "CIMBalloonCallout";
448
+ /**
449
+ * The style of the balloon callout: `Rectangle`, `RoundedRectangle`, or `Oval`.
450
+ *
451
+ * @since 5.2
452
+ */
453
+ balloonStyle: BalloonCalloutStyle;
454
+ /**
455
+ * The polygon symbol used to draw the background.
456
+ *
457
+ * @since 5.2
458
+ */
241
459
  backgroundSymbol: CIMPolygonSymbol;
460
+ /**
461
+ * Indicates whether the dart is drawn using
462
+ * [CIMBalloonCallout](https://developers.arcgis.com/javascript/latest/references/core/symbols/cim/types/#CIMBalloonCallout-dartSymbol).
463
+ *
464
+ * If `useDartSymbol` is `false`, the dart is drawn automatically based on the [CIMBalloonCallout](https://developers.arcgis.com/javascript/latest/references/core/symbols/cim/types/#CIMBalloonCallout-backgroundSymbol).
465
+ *
466
+ * @since 5.2
467
+ */
468
+ useDartSymbol?: boolean;
469
+ /**
470
+ * The symbol used to draw the dart when
471
+ * [CIMBalloonCallout](https://developers.arcgis.com/javascript/latest/references/core/symbols/cim/types/#CIMBalloonCallout-useDartSymbol) is `true`.
472
+ *
473
+ * @since 5.2
474
+ */
475
+ dartSymbol?: CIMPolygonSymbol | null;
476
+ /**
477
+ * The text margin defining the space around the text used to create the balloon.
478
+ *
479
+ * @since 5.2
480
+ */
481
+ margin?: CIMTextMargin | null;
482
+ /**
483
+ * Indicates whether the pointer base uses [CIMBalloonCallout](https://developers.arcgis.com/javascript/latest/references/core/symbols/cim/types/#CIMBalloonCallout-fixedDartWidth) when drawing the dart symbol. Otherwise, the dart width is determined automatically.
484
+ *
485
+ * @since 5.2
486
+ */
487
+ useFixedDartWidth?: boolean;
488
+ /**
489
+ * The width of the dart symbol in points when
490
+ * [CIMBalloonCallout](https://developers.arcgis.com/javascript/latest/references/core/symbols/cim/types/#CIMBalloonCallout-useFixedDartWidth) is `true`.
491
+ *
492
+ * @since 5.2
493
+ */
494
+ fixedDartWidth?: number;
242
495
  }
243
496
 
497
+ /**
498
+ * Represents the style of a balloon callout.
499
+ *
500
+ * @since 5.2
501
+ */
502
+ export type BalloonCalloutStyle = "Rectangle" | "RoundedRectangle" | "Oval";
503
+
244
504
  /** @since 5.0 */
245
505
  export type CIMGeometricEffects = CIMGeometricEffect[];
246
506
 
@@ -2600,6 +2860,12 @@ export interface CIMPointSymbol extends CIMMultiLayerSymbol {
2600
2860
  * @since 5.0
2601
2861
  */
2602
2862
  animations?: CIMSymbolAnimation[];
2863
+ /**
2864
+ * The callout drawn for the point symbol.
2865
+ *
2866
+ * @since 5.0
2867
+ */
2868
+ callout?: CIMCalloutType;
2603
2869
  /**
2604
2870
  * The size of the halo around the symbol. Use with the `haloSymbol` property to define the halo's appearance.
2605
2871
  *
@@ -2659,6 +2925,125 @@ export interface CIMPointSymbol extends CIMMultiLayerSymbol {
2659
2925
  angleAlignment?: CIMAngleAlignment;
2660
2926
  }
2661
2927
 
2928
+ /**
2929
+ * Represents a callout that places a point symbol as the background, with an optional leader line.
2930
+ *
2931
+ * @since 5.2
2932
+ * @see [CIMTextSymbol.callout](https://developers.arcgis.com/javascript/latest/references/core/symbols/cim/types/#CIMTextSymbol)
2933
+ * @see [CIMPointSymbol.callout](https://developers.arcgis.com/javascript/latest/references/core/symbols/cim/types/#CIMPointSymbol)
2934
+ * @example
2935
+ * ```json
2936
+ * {
2937
+ * "type": "CIMPointSymbolCallout",
2938
+ * "leaderTolerance": 0,
2939
+ * "pointSymbol": {
2940
+ * "type": "CIMPointSymbol",
2941
+ * "symbolLayers": [
2942
+ * {
2943
+ * "type": "CIMVectorMarker",
2944
+ * "enable": true,
2945
+ * "size": 16,
2946
+ * "frame": {
2947
+ * "xmin": -6,
2948
+ * "ymin": -6,
2949
+ * "xmax": 6,
2950
+ * "ymax": 6
2951
+ * },
2952
+ * "markerGraphics": [
2953
+ * {
2954
+ * "type": "CIMMarkerGraphic",
2955
+ * "geometry": {
2956
+ * "rings": [
2957
+ * [
2958
+ * [-5, -5],
2959
+ * [-5, 5],
2960
+ * [5, 5],
2961
+ * [5, -5],
2962
+ * [-5, -5]
2963
+ * ]
2964
+ * ]
2965
+ * },
2966
+ * "symbol": {
2967
+ * "type": "CIMPolygonSymbol",
2968
+ * "symbolLayers": [
2969
+ * {
2970
+ * "type": "CIMSolidFill",
2971
+ * "enable": true,
2972
+ * "color": [0, 127, 120, 255]
2973
+ * },
2974
+ * {
2975
+ * "type": "CIMSolidStroke",
2976
+ * "enable": true,
2977
+ * "color": [255, 255, 255, 255],
2978
+ * "width": 1.5
2979
+ * }
2980
+ * ]
2981
+ * }
2982
+ * }
2983
+ * ]
2984
+ * }
2985
+ * ]
2986
+ * },
2987
+ * "backgroundScale": "PropUniform",
2988
+ * "gap": 5,
2989
+ * "lineStyle": "Base",
2990
+ * "leaderLineSymbol": {
2991
+ * "type": "CIMLineSymbol",
2992
+ * "symbolLayers": [
2993
+ * {
2994
+ * "type": "CIMSolidStroke",
2995
+ * "enable": true,
2996
+ * "capStyle": "Round",
2997
+ * "joinStyle": "Round",
2998
+ * "color": [
2999
+ * 211,
3000
+ * 96,
3001
+ * 71,
3002
+ * 255
3003
+ * ],
3004
+ * "width": 1.5
3005
+ * }
3006
+ * ]
3007
+ * },
3008
+ * "leaderOffset": 3
3009
+ * }
3010
+ * ```
3011
+ */
3012
+ export interface CIMPointSymbolCallout extends CIMLineCallout {
3013
+ /**
3014
+ * The callout type.
3015
+ *
3016
+ * @since 5.2
3017
+ */
3018
+ type: "CIMPointSymbolCallout";
3019
+ /**
3020
+ * The symbol that will be drawn as the background behind the text.
3021
+ * The most common use case for this type of symbol is a highway shield.
3022
+ * When drawing a highway shield this property will be the shield itself without numbers.
3023
+ *
3024
+ * @since 5.2
3025
+ */
3026
+ pointSymbol: CIMPointSymbol;
3027
+ /**
3028
+ * Defines how the background is scaled to fit the dimensions of the symbol.
3029
+ *
3030
+ * @since 5.2
3031
+ */
3032
+ backgroundScale: PointSymbolCalloutScale;
3033
+ }
3034
+
3035
+ /**
3036
+ * Defines how the background point symbol is scaled to fit the dimensions of the text.
3037
+ *
3038
+ * Possible values:
3039
+ * - `None`: No scaling.
3040
+ * - `PropUniform`: Width and height scaling.
3041
+ * - `DifUniform`: Width-only scaling.
3042
+ *
3043
+ * @since 5.2
3044
+ */
3045
+ export type PointSymbolCalloutScale = "None" | "PropUniform" | "DifUniform";
3046
+
2662
3047
  /**
2663
3048
  * Represents a polygon symbol used to draw polygon features and graphics.
2664
3049
  *
@@ -2739,6 +3124,61 @@ export interface CIMPolygonSymbol extends CIMMultiLayerSymbol {
2739
3124
  type: "CIMPolygonSymbol";
2740
3125
  }
2741
3126
 
3127
+ /**
3128
+ * Represents a simple line callout for drawing basic leader lines.
3129
+ *
3130
+ * @since 5.2
3131
+ * @see [CIMTextSymbol.callout](https://developers.arcgis.com/javascript/latest/references/core/symbols/cim/types/#CIMTextSymbol)
3132
+ * @see [CIMPointSymbol.callout](https://developers.arcgis.com/javascript/latest/references/core/symbols/cim/types/#CIMPointSymbol)
3133
+ * @example
3134
+ * ```json
3135
+ * {
3136
+ * "type": "CIMSimpleLineCallout",
3137
+ * "leaderTolerance": 0,
3138
+ * "lineSymbol": {
3139
+ * "type": "CIMLineSymbol",
3140
+ * "symbolLayers": [
3141
+ * {
3142
+ * "type": "CIMSolidStroke",
3143
+ * "enable": true,
3144
+ * "capStyle": "Round",
3145
+ * "joinStyle": "Round",
3146
+ * "color": [
3147
+ * 211,
3148
+ * 96,
3149
+ * 71,
3150
+ * 255
3151
+ * ],
3152
+ * "width": 2
3153
+ * }
3154
+ * ]
3155
+ * },
3156
+ * "autoSnap": true
3157
+ * }
3158
+ * ```
3159
+ */
3160
+ export interface CIMSimpleLineCallout extends CIMCallout {
3161
+ /**
3162
+ * The callout type.
3163
+ *
3164
+ * @since 5.2
3165
+ */
3166
+ type: "CIMSimpleLineCallout";
3167
+ /**
3168
+ * The line symbol used to draw the leader lines.
3169
+ *
3170
+ * @since 5.2
3171
+ */
3172
+ lineSymbol: CIMLineSymbol;
3173
+ /**
3174
+ * Indicates whether to automatically snap the line leaders to the text.
3175
+ *
3176
+ * @default true
3177
+ * @since 5.2
3178
+ */
3179
+ autoSnap?: boolean;
3180
+ }
3181
+
2742
3182
  /**
2743
3183
  * Represents a solid fill which fills polygonal geometry with a single solid color.
2744
3184
  *
@@ -2814,11 +3254,46 @@ export interface CIMSolidStroke extends CIMStroke {
2814
3254
  animations?: CIMSymbolAnimationColor[];
2815
3255
  }
2816
3256
 
3257
+ /**
3258
+ * Defines the spacing around text inside a callout, in points.
3259
+ *
3260
+ * @since 5.2
3261
+ */
3262
+ export interface CIMTextMargin {
3263
+ /**
3264
+ * The spacing on the left side, in points.
3265
+ *
3266
+ * @since 5.2
3267
+ */
3268
+ left: number;
3269
+ /**
3270
+ * The spacing on the right side, in points.
3271
+ *
3272
+ * @since 5.2
3273
+ */
3274
+ right: number;
3275
+ /**
3276
+ * The spacing above the text, in points.
3277
+ *
3278
+ * @since 5.2
3279
+ */
3280
+ top: number;
3281
+ /**
3282
+ * The spacing below the text, in points.
3283
+ *
3284
+ * @since 5.2
3285
+ */
3286
+ bottom: number;
3287
+ }
3288
+
2817
3289
  /**
2818
3290
  * Represents a text symbol which is used to draw text graphics. Text symbols do not contain any symbol layers.
2819
3291
  *
2820
3292
  * The code snippet below shows an example of a `CIMTextSymbol` as a [marker graphic](https://developers.arcgis.com/javascript/latest/references/core/symbols/cim/types/#CIMMarkerGraphic) inside a [CIMVectorMarker](https://developers.arcgis.com/javascript/latest/references/core/symbols/cim/types/#CIMVectorMarker) symbol layer.
2821
3293
  *
3294
+ * For symbology, the CIMTextSymbol must be used within a CIMMarkerGraphic inside a CIMVectorMarker symbol layer.
3295
+ * For labeling, the CIMTextSymbol can be used directly within a labeling context.
3296
+ *
2822
3297
  * ![CIMTextSymbol](https://developers.arcgis.com/javascript/latest/assets/references/core/symbols/cim/CIMTextSymbol.avif)
2823
3298
  *
2824
3299
  * ```json
@@ -2883,7 +3358,7 @@ export interface CIMTextSymbol extends CIMSymbol {
2883
3358
  */
2884
3359
  angle?: number;
2885
3360
  /**
2886
- * The background of the text.
3361
+ * The callout drawn for this text symbol. Callouts are supported when the text symbol is embedded in a `CIMVectorMarker` marker graphic or used as a text label. Supported types are `CIMSimpleLineCallout`, `CIMBackgroundCallout`, `CIMBalloonCallout`, and `CIMPointSymbolCallout`.
2887
3362
  *
2888
3363
  * @since 5.0
2889
3364
  */
@@ -3052,6 +3527,16 @@ export interface CIMVectorMarker extends CIMMarker {
3052
3527
  respectFrame?: boolean;
3053
3528
  }
3054
3529
 
3530
+ /**
3531
+ * The supported CIM callout types.
3532
+ *
3533
+ * > [!WARNING]
3534
+ * > [Composite callouts](https://github.com/Esri/cim-spec/blob/main/docs/v3/CIMSymbols.md#cimcompositecallout) are not currently supported.
3535
+ *
3536
+ * @since 5.2
3537
+ */
3538
+ export type CIMCalloutType = CIMSimpleLineCallout | CIMPointSymbolCallout | CIMBackgroundCallout | CIMBalloonCallout;
3539
+
3055
3540
  /**
3056
3541
  * Represents a union type of all CIM symbol types.
3057
3542
  *
@@ -7,7 +7,7 @@ import type { LayerInfo } from "../types.js";
7
7
  import type { ActiveLayerInfoProperties } from "./support/ActiveLayerInfo.js";
8
8
  import type { ReadonlyArrayOrCollection } from "../../core/Collection.js";
9
9
 
10
- /** @deprecated since 5.2. Use [LegendContentProperties](https://developers.arcgis.com/javascript/latest/references/core/legend/LegendContent/#LegendContentProperties) instead. */
10
+ /** @deprecated since 5.2. Use [LegendModelProperties](https://developers.arcgis.com/javascript/latest/references/core/legend/LegendModel/#LegendModelProperties) instead. */
11
11
  export interface LegendViewModelProperties extends Partial<Pick<LegendViewModel, "basemapLegendVisible" | "hideLayersNotInCurrentView" | "layerInfos" | "respectLayerDefinitionExpression" | "respectLayerVisibility" | "view">> {
12
12
  /**
13
13
  * Collection of [ActiveLayerInfo](https://developers.arcgis.com/javascript/latest/references/core/widgets/Legend/support/ActiveLayerInfo/) objects used by the legend view to
@@ -20,7 +20,7 @@ export interface LegendViewModelProperties extends Partial<Pick<LegendViewModel,
20
20
  /**
21
21
  * Represents the allowed values for the [state](https://developers.arcgis.com/javascript/latest/references/core/widgets/Legend/LegendViewModel/#state) property.
22
22
  *
23
- * @deprecated since 5.2. Use [LegendContentState](https://developers.arcgis.com/javascript/latest/references/core/legend/types/#LegendContentState) instead.
23
+ * @deprecated since 5.2. Use [LegendModelState](https://developers.arcgis.com/javascript/latest/references/core/legend/types/#LegendModelState) instead.
24
24
  * @see [state](https://developers.arcgis.com/javascript/latest/references/core/widgets/Legend/LegendViewModel/#state)
25
25
  * @since 5.0
26
26
  */
@@ -32,7 +32,7 @@ export type LegendViewModelState = "ready" | "disabled";
32
32
  * of each layer in a map. This class may be used to create custom, interactive
33
33
  * Legends.
34
34
  *
35
- * @deprecated since 5.2. Use [LegendContent](https://developers.arcgis.com/javascript/latest/references/core/legend/LegendContent/) instead.
35
+ * @deprecated since 5.2. Use [LegendModel](https://developers.arcgis.com/javascript/latest/references/core/legend/LegendModel/) instead.
36
36
  * @since 4.11
37
37
  * @see [Legend](https://developers.arcgis.com/javascript/latest/references/core/widgets/Legend/) widget - _Deprecated since 4.34. Use the [Legend component](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-legend/) instead._
38
38
  * @see [Legend component](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-legend/)
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{onLocaleChange as t}from"../../intl.js";import n from"../../core/Accessor.js";import r from"../../core/Collection.js";import{deprecatedModule as i}from"../../core/deprecate.js";import a from"../../core/Logger.js";import{watch as o,initial as s,when as c}from"../../core/reactiveUtils.js";import{property as l,subclass as u}from"../../core/accessorSupport/decorators.js";import{get as d}from"../../core/accessorSupport/get.js";import{getEffectiveFeatureReduction as f}from"../../views/2d/layers/features/layerAdapters/featureReductionUtils.js";import p from"./support/ActiveLayerInfo.js";const m={state:`state`,view:`view`,allLayerViews:`all-layer-views`,legendProperties:`legend-properties`},h=r.ofType(p),g=new Set(`esri.layers.BuildingSceneLayer,esri.layers.CatalogLayer,esri.layers.CSVLayer,esri.layers.FeatureLayer,esri.layers.GeoJSONLayer,esri.layers.GeoRSSLayer,esri.layers.GroupLayer,esri.layers.HeatmapLayer,esri.layers.ImageryLayer,esri.layers.ImageryTileLayer,esri.layers.MapImageLayer,esri.layers.OGCFeatureLayer,esri.layers.OrientedImageryLayer,esri.layers.ParquetLayer,esri.layers.PointCloudLayer,esri.layers.StreamLayer,esri.layers.SceneLayer,esri.layers.SubtypeGroupLayer,esri.layers.TileLayer,esri.layers.VoxelLayer,esri.layers.WFSLayer,esri.layers.WMSLayer,esri.layers.WMTSLayer,esri.layers.WCSLayer,esri.layers.LinkChartLayer,esri.layers.catalog.CatalogFootprintLayer,esri.layers.catalog.CatalogDynamicGroupLayer,esri.layers.knowledgeGraph.KnowledgeGraphSublayer,esri.layers.KnowledgeGraphLayer`.split(`,`)),_=`view.basemapView.baseLayerViews`,v=`view.groundView.layerViews`,y=`view.basemapView.referenceLayerViews`,b=[_,v,`view.layerViews`,y];let x=class extends n{constructor(e){super(e),this._layerViewByLayerId={},this._layerInfosByLayerViewId={},this._activeLayerInfosByLayerViewId={},this._activeLayerInfosWithNoParent=new r,this._activeLayerInfosPromises=new WeakMap,this.activeLayerInfos=new h,this.basemapLegendVisible=!1,this.groundLegendVisible=!1,this.hideLayersNotInCurrentView=!1,this.keepCacheOnDestroy=!1,this.respectLayerDefinitionExpression=!1,this.respectLayerVisibility=!0,this.layerInfos=[],this.view=null,e?.suppressDeprecationWarning||i(a.getLogger(this),`esri.widgets.Legend.LegendViewModel`,{version:`5.2`,replacement:`Use the Legend component or the @arcgis/core/legend/LegendContent module instead.`,warnOnce:!0})}normalizeCtorArgs(e){let{suppressDeprecationWarning:t,...n}=e??{};return n}initialize(){this.addHandles(o(()=>this.view,()=>this._viewHandles(),s),m.view),this.addHandles(t(()=>this._refresh()))}destroy(){this._destroyViewActiveLayerInfos(),this.view=null}get loading(){return this.activeLayerInfos.some(e=>e.loading)}get state(){return this.view?.ready?`ready`:`disabled`}_viewHandles(){this.removeHandles(m.state),this.view&&this.addHandles(o(()=>this.state,()=>this._stateHandles(),s),m.state)}_stateHandles(){this._resetAll(),this.state===`ready`&&this._watchPropertiesAndAllLayerViews()}_resetAll(){this.removeHandles([m.allLayerViews,m.legendProperties]),this._destroyViewActiveLayerInfos(),this.activeLayerInfos.removeAll()}_destroyViewActiveLayerInfos(){Object.keys(this._activeLayerInfosByLayerViewId).forEach(this._destroyViewActiveLayerInfo,this)}_destroyViewActiveLayerInfo(e){this.removeHandles(e);let t=this._activeLayerInfosByLayerViewId[e];t&&this._activeLayerInfosPromises.delete(t),delete this._activeLayerInfosByLayerViewId[e],t?.parent?.children.remove(t)}_watchPropertiesAndAllLayerViews(){let{view:e}=this;if(!e)return;let{allLayerViews:t}=e;t.length&&this._refresh(),this.addHandles(t.on(`change`,e=>this._allLayerViewsChangeHandle(e)),m.allLayerViews),this.addHandles(o(()=>[this.basemapLegendVisible,this.groundLegendVisible,this.hideLayersNotInCurrentView,this.keepCacheOnDestroy,this.layerInfos,this.respectLayerDefinitionExpression,this.respectLayerVisibility],()=>this._refresh()),m.legendProperties)}_allLayerViewsChangeHandle(e){if(e.added.length&&this._generateActiveLayerInfosForLayerViews(e.added),e.moved.length){this._destroyViewActiveLayerInfos(),this._refresh();return}if(e.removed.length){for(let{uid:t}of e.removed)this._destroyViewActiveLayerInfo(t);this._refresh()}}_refresh(){this._layerInfosByLayerViewId={},this.activeLayerInfos.drain(e=>this._activeLayerInfosPromises.delete(e)),this._generateActiveLayerInfosForLayerViews(this._generateLayerViews())}_generateActiveLayerInfosForLayerViews(e){e.filter(this._filterBasemapLayerViews,this).filter(this._filterLayerViewsByLayerInfos,this).filter(this._isLayerViewSupported,this).forEach(this._generateActiveLayerInfo,this)}_filterBasemapLayerViews(e){if(!this.view?.basemapView)return!0;let{baseLayerViews:t,groundLayerViews:n,referenceLayerViews:r}=this.view.basemapView,i=t.some(t=>{let n=`layerViews`in t?t.layerViews:null;return n?n.includes(e):t===e}),a=!this.basemapLegendVisible&&(i||r?.includes(e)),o=!this.groundLegendVisible&&n?.includes(e);return!a&&!o}_sortActiveLayerInfos(e){let t=this.view;if(e.length<2||!t)return;let n=[];e.forEach(t=>{if(!t.parent){let r=t.layer.parent,i=r&&`uid`in r&&this._layerViewByLayerId[r.uid],a=i&&this._activeLayerInfosByLayerViewId[i.uid];a&&e.includes(a)&&(n.push(t),t.parent=a,a.children.add(t),this._sortActiveLayerInfos(a.children))}}),e.removeMany(n);let r={};t.allLayerViews.forEach((e,t)=>r[e.layer.uid]=t),e.sort((e,t)=>{let n=r[e.layer.uid]||0;return(r[t.layer.uid]||0)-n})}_generateLayerViews(){let e=[];return b.filter(this._filterLayerViews,this).map(e=>d(this,e)).filter(e=>e!=null).forEach(this._collectLayerViews(`layerViews`,e)),e}_filterLayerViews(e){let t=!this.basemapLegendVisible&&(e===_||e===y),n=!this.groundLegendVisible&&e===v;return!t&&!n}_collectLayerViews(e,t){let n=r=>(r&&r.forEach(r=>{t.push(r),n(r[e])}),t);return n}_filterLayerViewsByLayerInfos(e){let t=this.layerInfos;return t&&t.length?t.some(t=>this._hasLayerInfo(t,e)):!0}_hasLayerInfo(e,t){let n=this._isLayerUIDMatching(e.layer,t.layer.uid);return n&&(this._layerInfosByLayerViewId[t.uid]=e),n}_isLayerUIDMatching(e,t){return e&&(e.uid===t||this._hasLayerUID(e.layers,t))}_hasLayerUID(e,t){return e&&e.some(e=>this._isLayerUIDMatching(e,t))}_isLayerViewSupported(e){return g.has(e.layer.declaredClass)?(this._layerViewByLayerId[e.layer.uid]=e,!0):!1}_generateActiveLayerInfo(e){if(this._isLayerActive(e)){this._buildActiveLayerInfo(e);return}this.removeHandles(e.uid),this.addHandles(o(()=>[e.legendEnabled,e.layer?.legendEnabled],()=>this._layerActiveHandle(e)),e.uid)}_layerActiveHandle(e){this._isLayerActive(e)&&(this.removeHandles(e.uid),this._buildActiveLayerInfo(e))}_isLayerActive(e){return!this.respectLayerVisibility||e.legendEnabled&&e.layer?.legendEnabled}async _buildActiveLayerInfo(e){let t=e.layer,n=e.uid,r=this._layerInfosByLayerViewId[n],i=this._activeLayerInfosByLayerViewId[n];i||(i=new p({layer:t,layerView:e,view:this.view??void 0,keepCacheOnDestroy:this.keepCacheOnDestroy}),this._activeLayerInfosByLayerViewId[n]=i);let a=r?.title!==void 0&&r.layer.uid===t.uid;i.title=a?r.title:t.title,i.respectLayerDefinitionExpression=this.respectLayerDefinitionExpression,i.respectLayerVisibility=this.respectLayerVisibility,i.hideLayersNotInCurrentView=this.hideLayersNotInCurrentView,i.sublayerIds=r?.sublayerIds||[];let o=t.parent&&`uid`in t.parent?this._layerViewByLayerId[t.parent?.uid]:null;i.parent=this._activeLayerInfosByLayerViewId[o?.uid],this._addActiveLayerInfo(i),this._constructLegendElements(i),this._attachHandlesToActiveLayerInfo(i)}_attachHandlesToActiveLayerInfo(e){let{layer:t,layerView:n}=e,r=n.uid;this.removeHandles(r),this.addHandles([o(()=>t.title,t=>this._titleHandle(t,e)),o(()=>[t.opacity,`renderer`in t&&t.renderer,`pointSymbol`in t&&t.pointSymbol,`lineSymbol`in t&&t.lineSymbol,`polygonSymbol`in t&&t.polygonSymbol,`effect`in t&&t.effect,`featureReduction`in t&&f(t,n.view),this.view?.timeZone],()=>this._constructLegendElements(e)),o(()=>`filter`in n&&n.filter,()=>{f(n.layer,n.view)!=null&&this._constructLegendElements(e)}),c(()=>!!this.view?.stationary,()=>this._scaleHandle(e)),o(()=>e.loading,()=>this.notifyChange(`loading`),s)],r),this.respectLayerVisibility&&this.addHandles([o(()=>t.legendEnabled,t=>this._legendEnabledHandle(t,e)),o(()=>n.legendEnabled,t=>{this.view?.suspended||this._legendEnabledHandle(t,e)})],r),this.respectLayerDefinitionExpression&&`definitionExpression`in t&&this.addHandles(o(()=>t.definitionExpression,()=>this._constructLegendElements(e)),r)}_titleHandle(e,t){t.title=e,this._constructLegendElements(t)}_legendEnabledHandle(e,t){e?this._addActiveLayerInfo(t):this._removeActiveLayerInfo(t)}_scaleHandle(e){(e.isScaleDriven||e.hideLayersNotInCurrentView)&&this._constructLegendElements(e)}_addActiveLayerInfo(e){let{layerView:t,layer:n}=e;if(this._isLayerActive(t)&&!this.activeLayerInfos.includes(e)){let t=e.parent;if(t)t.children.includes(e)||t.children.push(e),this._sortActiveLayerInfos(t.children);else{let t=this.layerInfos?.some(e=>e.layer.uid===n.uid),r=n.parent;r&&`uid`in r&&this._layerViewByLayerId[r.uid]&&!t?this._activeLayerInfosWithNoParent.add(e):(this.activeLayerInfos.add(e),this._sortActiveLayerInfos(this.activeLayerInfos))}if(this._activeLayerInfosWithNoParent.length){let e=[];this._activeLayerInfosWithNoParent.forEach(t=>{let n=t.layer.parent,r=n&&`uid`in n?this._layerViewByLayerId[n?.uid]:null,i=this._activeLayerInfosByLayerViewId[r?.uid];i&&(e.push(t),t.parent=i)}),e.length&&(this._activeLayerInfosWithNoParent.removeMany(e),e.forEach(e=>this._addActiveLayerInfo(e)))}}}_removeActiveLayerInfo(e){let t=e.parent;t?t.children.remove(e):this.activeLayerInfos.remove(e)}async _getBuildLegendPromise(e){let{layer:t}=e;if(`featureCollections`in t&&t.featureCollections)return e.buildLegendElementsForFeatureCollections(t.featureCollections);if(`featureReduction`in t&&t.featureReduction&&`renderer`in t.featureReduction&&(t.featureReduction.type===`binning`||t.featureReduction.type===`cluster`)&&(!this.view||t.featureReduction.maxScale<=this.view.scale))return e.buildLegendElementsForFeatureReduction(t.featureReduction);if(`renderer`in t&&t.renderer&&!(`sublayers`in t))return e.buildLegendElementsForRenderer(t.renderer);if(`url`in t&&t.url&&t.type!==`catalog`&&t.type!==`knowledge-graph`)return e.buildLegendElementsForTools();let n=e.children.map(e=>this._constructLegendElements(e));return Promise.all(n).then(()=>{})}async _constructLegendElements(e){let t=this._activeLayerInfosPromises.get(e);t&&await t.catch(()=>{});let n=this._getBuildLegendPromise(e);this._activeLayerInfosPromises.set(e,n),n.finally(()=>{this._activeLayerInfosPromises.delete(e)})}};e([l({type:h})],x.prototype,`activeLayerInfos`,void 0),e([l()],x.prototype,`basemapLegendVisible`,void 0),e([l()],x.prototype,`groundLegendVisible`,void 0),e([l()],x.prototype,`hideLayersNotInCurrentView`,void 0),e([l()],x.prototype,`keepCacheOnDestroy`,void 0),e([l({readOnly:!0})],x.prototype,`loading`,null),e([l()],x.prototype,`respectLayerDefinitionExpression`,void 0),e([l()],x.prototype,`respectLayerVisibility`,void 0),e([l()],x.prototype,`layerInfos`,void 0),e([l({readOnly:!0})],x.prototype,`state`,null),e([l()],x.prototype,`view`,void 0),x=e([u(`esri.widgets.Legend.LegendViewModel`)],x);export{x as default};
2
+ import{__decorate as e}from"tslib";import{onLocaleChange as t}from"../../intl.js";import n from"../../core/Accessor.js";import r from"../../core/Collection.js";import{deprecatedModule as i}from"../../core/deprecate.js";import a from"../../core/Logger.js";import{watch as o,initial as s,when as c}from"../../core/reactiveUtils.js";import{property as l,subclass as u}from"../../core/accessorSupport/decorators.js";import{get as d}from"../../core/accessorSupport/get.js";import{getEffectiveFeatureReduction as f}from"../../views/2d/layers/features/layerAdapters/featureReductionUtils.js";import p from"./support/ActiveLayerInfo.js";const m={state:`state`,view:`view`,allLayerViews:`all-layer-views`,legendProperties:`legend-properties`},h=r.ofType(p),g=new Set(`esri.layers.BuildingSceneLayer,esri.layers.CatalogLayer,esri.layers.CSVLayer,esri.layers.FeatureLayer,esri.layers.GeoJSONLayer,esri.layers.GeoRSSLayer,esri.layers.GroupLayer,esri.layers.HeatmapLayer,esri.layers.ImageryLayer,esri.layers.ImageryTileLayer,esri.layers.MapImageLayer,esri.layers.OGCFeatureLayer,esri.layers.OrientedImageryLayer,esri.layers.ParquetLayer,esri.layers.PointCloudLayer,esri.layers.StreamLayer,esri.layers.SceneLayer,esri.layers.SubtypeGroupLayer,esri.layers.TileLayer,esri.layers.VoxelLayer,esri.layers.WFSLayer,esri.layers.WMSLayer,esri.layers.WMTSLayer,esri.layers.WCSLayer,esri.layers.LinkChartLayer,esri.layers.catalog.CatalogFootprintLayer,esri.layers.catalog.CatalogDynamicGroupLayer,esri.layers.knowledgeGraph.KnowledgeGraphSublayer,esri.layers.KnowledgeGraphLayer`.split(`,`)),_=`view.basemapView.baseLayerViews`,v=`view.groundView.layerViews`,y=`view.basemapView.referenceLayerViews`,b=[_,v,`view.layerViews`,y];let x=class extends n{constructor(e){super(e),this._layerViewByLayerId={},this._layerInfosByLayerViewId={},this._activeLayerInfosByLayerViewId={},this._activeLayerInfosWithNoParent=new r,this._activeLayerInfosPromises=new WeakMap,this.activeLayerInfos=new h,this.basemapLegendVisible=!1,this.groundLegendVisible=!1,this.hideLayersNotInCurrentView=!1,this.keepCacheOnDestroy=!1,this.respectLayerDefinitionExpression=!1,this.respectLayerVisibility=!0,this.layerInfos=[],this.view=null,e?.suppressDeprecationWarning||i(a.getLogger(this),`esri.widgets.Legend.LegendViewModel`,{version:`5.2`,replacement:`Use the Legend component or the @arcgis/core/legend/LegendModel module instead.`,warnOnce:!0})}normalizeCtorArgs(e){let{suppressDeprecationWarning:t,...n}=e??{};return n}initialize(){this.addHandles(o(()=>this.view,()=>this._viewHandles(),s),m.view),this.addHandles(t(()=>this._refresh()))}destroy(){this._destroyViewActiveLayerInfos(),this.view=null}get loading(){return this.activeLayerInfos.some(e=>e.loading)}get state(){return this.view?.ready?`ready`:`disabled`}_viewHandles(){this.removeHandles(m.state),this.view&&this.addHandles(o(()=>this.state,()=>this._stateHandles(),s),m.state)}_stateHandles(){this._resetAll(),this.state===`ready`&&this._watchPropertiesAndAllLayerViews()}_resetAll(){this.removeHandles([m.allLayerViews,m.legendProperties]),this._destroyViewActiveLayerInfos(),this.activeLayerInfos.removeAll()}_destroyViewActiveLayerInfos(){Object.keys(this._activeLayerInfosByLayerViewId).forEach(this._destroyViewActiveLayerInfo,this)}_destroyViewActiveLayerInfo(e){this.removeHandles(e);let t=this._activeLayerInfosByLayerViewId[e];t&&this._activeLayerInfosPromises.delete(t),delete this._activeLayerInfosByLayerViewId[e],t?.parent?.children.remove(t)}_watchPropertiesAndAllLayerViews(){let{view:e}=this;if(!e)return;let{allLayerViews:t}=e;t.length&&this._refresh(),this.addHandles(t.on(`change`,e=>this._allLayerViewsChangeHandle(e)),m.allLayerViews),this.addHandles(o(()=>[this.basemapLegendVisible,this.groundLegendVisible,this.hideLayersNotInCurrentView,this.keepCacheOnDestroy,this.layerInfos,this.respectLayerDefinitionExpression,this.respectLayerVisibility],()=>this._refresh()),m.legendProperties)}_allLayerViewsChangeHandle(e){if(e.added.length&&this._generateActiveLayerInfosForLayerViews(e.added),e.moved.length){this._destroyViewActiveLayerInfos(),this._refresh();return}if(e.removed.length){for(let{uid:t}of e.removed)this._destroyViewActiveLayerInfo(t);this._refresh()}}_refresh(){this._layerInfosByLayerViewId={},this.activeLayerInfos.drain(e=>this._activeLayerInfosPromises.delete(e)),this._generateActiveLayerInfosForLayerViews(this._generateLayerViews())}_generateActiveLayerInfosForLayerViews(e){e.filter(this._filterBasemapLayerViews,this).filter(this._filterLayerViewsByLayerInfos,this).filter(this._isLayerViewSupported,this).forEach(this._generateActiveLayerInfo,this)}_filterBasemapLayerViews(e){if(!this.view?.basemapView)return!0;let{baseLayerViews:t,groundLayerViews:n,referenceLayerViews:r}=this.view.basemapView,i=t.some(t=>{let n=`layerViews`in t?t.layerViews:null;return n?n.includes(e):t===e}),a=!this.basemapLegendVisible&&(i||r?.includes(e)),o=!this.groundLegendVisible&&n?.includes(e);return!a&&!o}_sortActiveLayerInfos(e){let t=this.view;if(e.length<2||!t)return;let n=[];e.forEach(t=>{if(!t.parent){let r=t.layer.parent,i=r&&`uid`in r&&this._layerViewByLayerId[r.uid],a=i&&this._activeLayerInfosByLayerViewId[i.uid];a&&e.includes(a)&&(n.push(t),t.parent=a,a.children.add(t),this._sortActiveLayerInfos(a.children))}}),e.removeMany(n);let r={};t.allLayerViews.forEach((e,t)=>r[e.layer.uid]=t),e.sort((e,t)=>{let n=r[e.layer.uid]||0;return(r[t.layer.uid]||0)-n})}_generateLayerViews(){let e=[];return b.filter(this._filterLayerViews,this).map(e=>d(this,e)).filter(e=>e!=null).forEach(this._collectLayerViews(`layerViews`,e)),e}_filterLayerViews(e){let t=!this.basemapLegendVisible&&(e===_||e===y),n=!this.groundLegendVisible&&e===v;return!t&&!n}_collectLayerViews(e,t){let n=r=>(r&&r.forEach(r=>{t.push(r),n(r[e])}),t);return n}_filterLayerViewsByLayerInfos(e){let t=this.layerInfos;return t&&t.length?t.some(t=>this._hasLayerInfo(t,e)):!0}_hasLayerInfo(e,t){let n=this._isLayerUIDMatching(e.layer,t.layer.uid);return n&&(this._layerInfosByLayerViewId[t.uid]=e),n}_isLayerUIDMatching(e,t){return e&&(e.uid===t||this._hasLayerUID(e.layers,t))}_hasLayerUID(e,t){return e&&e.some(e=>this._isLayerUIDMatching(e,t))}_isLayerViewSupported(e){return g.has(e.layer.declaredClass)?(this._layerViewByLayerId[e.layer.uid]=e,!0):!1}_generateActiveLayerInfo(e){if(this._isLayerActive(e)){this._buildActiveLayerInfo(e);return}this.removeHandles(e.uid),this.addHandles(o(()=>[e.legendEnabled,e.layer?.legendEnabled],()=>this._layerActiveHandle(e)),e.uid)}_layerActiveHandle(e){this._isLayerActive(e)&&(this.removeHandles(e.uid),this._buildActiveLayerInfo(e))}_isLayerActive(e){return!this.respectLayerVisibility||e.legendEnabled&&e.layer?.legendEnabled}async _buildActiveLayerInfo(e){let t=e.layer,n=e.uid,r=this._layerInfosByLayerViewId[n],i=this._activeLayerInfosByLayerViewId[n];i||(i=new p({layer:t,layerView:e,view:this.view??void 0,keepCacheOnDestroy:this.keepCacheOnDestroy}),this._activeLayerInfosByLayerViewId[n]=i);let a=r?.title!==void 0&&r.layer.uid===t.uid;i.title=a?r.title:t.title,i.respectLayerDefinitionExpression=this.respectLayerDefinitionExpression,i.respectLayerVisibility=this.respectLayerVisibility,i.hideLayersNotInCurrentView=this.hideLayersNotInCurrentView,i.sublayerIds=r?.sublayerIds||[];let o=t.parent&&`uid`in t.parent?this._layerViewByLayerId[t.parent?.uid]:null;i.parent=this._activeLayerInfosByLayerViewId[o?.uid],this._addActiveLayerInfo(i),this._constructLegendElements(i),this._attachHandlesToActiveLayerInfo(i)}_attachHandlesToActiveLayerInfo(e){let{layer:t,layerView:n}=e,r=n.uid;this.removeHandles(r),this.addHandles([o(()=>t.title,t=>this._titleHandle(t,e)),o(()=>[t.opacity,`renderer`in t&&t.renderer,`pointSymbol`in t&&t.pointSymbol,`lineSymbol`in t&&t.lineSymbol,`polygonSymbol`in t&&t.polygonSymbol,`effect`in t&&t.effect,`featureReduction`in t&&f(t,n.view),this.view?.timeZone],()=>this._constructLegendElements(e)),o(()=>`filter`in n&&n.filter,()=>{f(n.layer,n.view)!=null&&this._constructLegendElements(e)}),c(()=>!!this.view?.stationary,()=>this._scaleHandle(e)),o(()=>e.loading,()=>this.notifyChange(`loading`),s)],r),this.respectLayerVisibility&&this.addHandles([o(()=>t.legendEnabled,t=>this._legendEnabledHandle(t,e)),o(()=>n.legendEnabled,t=>{this.view?.suspended||this._legendEnabledHandle(t,e)})],r),this.respectLayerDefinitionExpression&&`definitionExpression`in t&&this.addHandles(o(()=>t.definitionExpression,()=>this._constructLegendElements(e)),r)}_titleHandle(e,t){t.title=e,this._constructLegendElements(t)}_legendEnabledHandle(e,t){e?this._addActiveLayerInfo(t):this._removeActiveLayerInfo(t)}_scaleHandle(e){(e.isScaleDriven||e.hideLayersNotInCurrentView)&&this._constructLegendElements(e)}_addActiveLayerInfo(e){let{layerView:t,layer:n}=e;if(this._isLayerActive(t)&&!this.activeLayerInfos.includes(e)){let t=e.parent;if(t)t.children.includes(e)||t.children.push(e),this._sortActiveLayerInfos(t.children);else{let t=this.layerInfos?.some(e=>e.layer.uid===n.uid),r=n.parent;r&&`uid`in r&&this._layerViewByLayerId[r.uid]&&!t?this._activeLayerInfosWithNoParent.add(e):(this.activeLayerInfos.add(e),this._sortActiveLayerInfos(this.activeLayerInfos))}if(this._activeLayerInfosWithNoParent.length){let e=[];this._activeLayerInfosWithNoParent.forEach(t=>{let n=t.layer.parent,r=n&&`uid`in n?this._layerViewByLayerId[n?.uid]:null,i=this._activeLayerInfosByLayerViewId[r?.uid];i&&(e.push(t),t.parent=i)}),e.length&&(this._activeLayerInfosWithNoParent.removeMany(e),e.forEach(e=>this._addActiveLayerInfo(e)))}}}_removeActiveLayerInfo(e){let t=e.parent;t?t.children.remove(e):this.activeLayerInfos.remove(e)}async _getBuildLegendPromise(e){let{layer:t}=e;if(`featureCollections`in t&&t.featureCollections)return e.buildLegendElementsForFeatureCollections(t.featureCollections);if(`featureReduction`in t&&t.featureReduction&&`renderer`in t.featureReduction&&(t.featureReduction.type===`binning`||t.featureReduction.type===`cluster`)&&(!this.view||t.featureReduction.maxScale<=this.view.scale))return e.buildLegendElementsForFeatureReduction(t.featureReduction);if(`renderer`in t&&t.renderer&&!(`sublayers`in t))return e.buildLegendElementsForRenderer(t.renderer);if(`url`in t&&t.url&&t.type!==`catalog`&&t.type!==`knowledge-graph`)return e.buildLegendElementsForTools();let n=e.children.map(e=>this._constructLegendElements(e));return Promise.all(n).then(()=>{})}async _constructLegendElements(e){let t=this._activeLayerInfosPromises.get(e);t&&await t.catch(()=>{});let n=this._getBuildLegendPromise(e);this._activeLayerInfosPromises.set(e,n),n.finally(()=>{this._activeLayerInfosPromises.delete(e)})}};e([l({type:h})],x.prototype,`activeLayerInfos`,void 0),e([l()],x.prototype,`basemapLegendVisible`,void 0),e([l()],x.prototype,`groundLegendVisible`,void 0),e([l()],x.prototype,`hideLayersNotInCurrentView`,void 0),e([l()],x.prototype,`keepCacheOnDestroy`,void 0),e([l({readOnly:!0})],x.prototype,`loading`,null),e([l()],x.prototype,`respectLayerDefinitionExpression`,void 0),e([l()],x.prototype,`respectLayerVisibility`,void 0),e([l()],x.prototype,`layerInfos`,void 0),e([l({readOnly:!0})],x.prototype,`state`,null),e([l()],x.prototype,`view`,void 0),x=e([u(`esri.widgets.Legend.LegendViewModel`)],x);export{x as default};