@feltmaps/js-sdk 1.7.0-next.0 → 1.7.0-next.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/client.d.cts CHANGED
@@ -1,5 +1,5 @@
1
- import { z as zInfer, U as UiControlsOptions, V as ViewportCenterZoom, F as FeltController } from './controller-CmThLnnL.cjs';
2
- export { au as AggregationConfig, av as AggregationMethod, C as CircleElementCreate, a as CircleElementRead, b as CircleElementUpdate, b6 as CircleToolSettings, b7 as ConfigurableToolType, K as CreateLayersFromGeoJsonParams, O as DataOnlyLayer, E as Element, c as ElementChangeCallbackParams, d as ElementCreate, e as ElementGroup, f as ElementGroupChangeCallbackParams, aK as ElementGroupNode, aL as ElementNode, g as ElementUpdate, B as ElementsController, aM as EntityNode, aN as FeatureNode, aO as FeatureSelection, aS as FeltBoundary, Q as FeltTiledVectorSource, aT as FeltZoom, an as FilterExpression, ao as FilterLogicGate, ap as FilterTernary, aq as Filters, R as GeoJsonDataVectorSource, aU as GeoJsonFeature, S as GeoJsonFileVectorSource, aV as GeoJsonGeometry, aW as GeoJsonProperties, W as GeoJsonUrlVectorSource, ar as GeometryFilter, G as GetElementGroupsConstraint, h as GetElementsConstraint, aw as GetLayerCalculationParams, ax as GetLayerCategoriesGroup, ay as GetLayerCategoriesParams, X as GetLayerGroupsConstraint, az as GetLayerHistogramBin, aA as GetLayerHistogramParams, aB as GetLayerPrecomputedCalculationParams, Y as GetLayersConstraint, Z as GetRenderedFeaturesConstraint, aC as GridConfig, aD as GridType, H as HighlighterElementCreate, i as HighlighterElementRead, j as HighlighterElementUpdate, b8 as HighlighterToolSettings, I as ImageElementCreate, k as ImageElementRead, l as ImageElementUpdate, b9 as InputToolSettings, J as InteractionsController, aX as LatLng, _ as Layer, as as LayerBoundaries, $ as LayerChangeCallbackParams, a0 as LayerCommon, ad as LayerFeature, at as LayerFilters, a1 as LayerGroup, a2 as LayerGroupChangeCallbackParams, aP as LayerGroupNode, aQ as LayerNode, a3 as LayerProcessingStatus, af as LayerSchema, ag as LayerSchemaAttribute, ah as LayerSchemaBooleanAttribute, ai as LayerSchemaCommonAttribute, aj as LayerSchemaDateAttribute, ak as LayerSchemaDateTimeAttribute, al as LayerSchemaNumericAttribute, am as LayerSchemaTextAttribute, aH as LayersController, a4 as LegendItem, a5 as LegendItemChangeCallbackParams, a6 as LegendItemIdentifier, a7 as LegendItemsConstraint, aY as LineStringGeometry, ba as LineToolSettings, L as LinkElementRead, aZ as LngLatTuple, aI as MapDetails, D as MapInteractionEvent, M as MarkerElementCreate, m as MarkerElementRead, n as MarkerElementUpdate, bb as MarkerToolSettings, aJ as MiscController, aE as MultiAggregationConfig, a_ as MultiLineStringGeometry, a$ as MultiPointGeometry, b0 as MultiPolygonGeometry, N as NoteElementCreate, o as NoteElementRead, p as NoteElementUpdate, bc as NoteToolSettings, bn as OnMapInteractionsOptions, P as PathElementCreate, q as PathElementRead, r as PathElementUpdate, bd as PinToolSettings, s as PlaceElementCreate, t as PlaceElementRead, u as PlaceElementUpdate, be as PlaceFrame, bf as PlaceSymbol, b1 as PointGeometry, v as PolygonElementCreate, w as PolygonElementRead, x as PolygonElementUpdate, b2 as PolygonGeometry, bg as PolygonToolSettings, aF as PrecomputedAggregationMethod, a8 as RasterBand, a9 as RasterLayer, aa as RasterLayerSource, ae as RasterValue, bh as RouteToolSettings, aR as SelectionController, bp as SetViewportCenterZoomParams, b3 as SetVisibilityRequest, b4 as SortConfig, b5 as SortDirection, T as TextElementCreate, y as TextElementRead, A as TextElementUpdate, bi as TextToolSettings, bj as ToolSettingsChangeEvent, bk as ToolSettingsMap, bl as ToolType, bm as ToolsController, bo as UiController, ab as UpdateLayerParams, aG as ValueConfiguration, ac as VectorLayer, bq as ViewportConstraints, bt as ViewportController, br as ViewportFitBoundsParams, bs as ViewportState } from './controller-CmThLnnL.cjs';
1
+ import { z as zInfer, U as UiControlsOptions, V as ViewportCenterZoom, F as FeltController } from './controller-o3EwSJvB.cjs';
2
+ export { au as AggregatedGridConfig, av as AggregationConfig, aw as AggregationMethod, C as CircleElementCreate, a as CircleElementRead, b as CircleElementUpdate, b8 as CircleToolSettings, b9 as ConfigurableToolType, ax as CountGridConfig, K as CreateLayersFromGeoJsonParams, O as DataOnlyLayer, E as Element, c as ElementChangeCallbackParams, d as ElementCreate, e as ElementGroup, f as ElementGroupChangeCallbackParams, aM as ElementGroupNode, aN as ElementNode, g as ElementUpdate, B as ElementsController, aO as EntityNode, aP as FeatureNode, aQ as FeatureSelection, aU as FeltBoundary, Q as FeltTiledVectorSource, aV as FeltZoom, an as FilterExpression, ao as FilterLogicGate, ap as FilterTernary, aq as Filters, R as GeoJsonDataVectorSource, aW as GeoJsonFeature, S as GeoJsonFileVectorSource, aX as GeoJsonGeometry, aY as GeoJsonProperties, W as GeoJsonUrlVectorSource, ar as GeometryFilter, G as GetElementGroupsConstraint, h as GetElementsConstraint, ay as GetLayerCalculationParams, az as GetLayerCategoriesGroup, aA as GetLayerCategoriesParams, X as GetLayerGroupsConstraint, aB as GetLayerHistogramBin, aC as GetLayerHistogramParams, aD as GetLayerPrecomputedCalculationParams, Y as GetLayersConstraint, Z as GetRenderedFeaturesConstraint, aE as GridConfig, aF as GridType, H as HighlighterElementCreate, i as HighlighterElementRead, j as HighlighterElementUpdate, ba as HighlighterToolSettings, I as ImageElementCreate, k as ImageElementRead, l as ImageElementUpdate, bb as InputToolSettings, J as InteractionsController, aZ as LatLng, _ as Layer, as as LayerBoundaries, $ as LayerChangeCallbackParams, a0 as LayerCommon, ad as LayerFeature, at as LayerFilters, a1 as LayerGroup, a2 as LayerGroupChangeCallbackParams, aR as LayerGroupNode, aS as LayerNode, a3 as LayerProcessingStatus, af as LayerSchema, ag as LayerSchemaAttribute, ah as LayerSchemaBooleanAttribute, ai as LayerSchemaCommonAttribute, aj as LayerSchemaDateAttribute, ak as LayerSchemaDateTimeAttribute, al as LayerSchemaNumericAttribute, am as LayerSchemaTextAttribute, aJ as LayersController, a4 as LegendItem, a5 as LegendItemChangeCallbackParams, a6 as LegendItemIdentifier, a7 as LegendItemsConstraint, a_ as LineStringGeometry, bc as LineToolSettings, L as LinkElementRead, a$ as LngLatTuple, aK as MapDetails, D as MapInteractionEvent, M as MarkerElementCreate, m as MarkerElementRead, n as MarkerElementUpdate, bd as MarkerToolSettings, aL as MiscController, aG as MultiAggregationConfig, b0 as MultiLineStringGeometry, b1 as MultiPointGeometry, b2 as MultiPolygonGeometry, N as NoteElementCreate, o as NoteElementRead, p as NoteElementUpdate, be as NoteToolSettings, bp as OnMapInteractionsOptions, P as PathElementCreate, q as PathElementRead, r as PathElementUpdate, bf as PinToolSettings, s as PlaceElementCreate, t as PlaceElementRead, u as PlaceElementUpdate, bg as PlaceFrame, bh as PlaceSymbol, b3 as PointGeometry, v as PolygonElementCreate, w as PolygonElementRead, x as PolygonElementUpdate, b4 as PolygonGeometry, bi as PolygonToolSettings, aH as PrecomputedAggregationMethod, a8 as RasterBand, a9 as RasterLayer, aa as RasterLayerSource, ae as RasterValue, bj as RouteToolSettings, aT as SelectionController, br as SetViewportCenterZoomParams, b5 as SetVisibilityRequest, b6 as SortConfig, b7 as SortDirection, T as TextElementCreate, y as TextElementRead, A as TextElementUpdate, bk as TextToolSettings, bl as ToolSettingsChangeEvent, bm as ToolSettingsMap, bn as ToolType, bo as ToolsController, bq as UiController, ab as UpdateLayerParams, aI as ValueConfiguration, ac as VectorLayer, bs as ViewportConstraints, bv as ViewportController, bt as ViewportFitBoundsParams, bu as ViewportState } from './controller-o3EwSJvB.cjs';
3
3
  import { z } from 'zod';
4
4
 
5
5
  /**
package/dist/client.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { z as zInfer, U as UiControlsOptions, V as ViewportCenterZoom, F as FeltController } from './controller-CmThLnnL.js';
2
- export { au as AggregationConfig, av as AggregationMethod, C as CircleElementCreate, a as CircleElementRead, b as CircleElementUpdate, b6 as CircleToolSettings, b7 as ConfigurableToolType, K as CreateLayersFromGeoJsonParams, O as DataOnlyLayer, E as Element, c as ElementChangeCallbackParams, d as ElementCreate, e as ElementGroup, f as ElementGroupChangeCallbackParams, aK as ElementGroupNode, aL as ElementNode, g as ElementUpdate, B as ElementsController, aM as EntityNode, aN as FeatureNode, aO as FeatureSelection, aS as FeltBoundary, Q as FeltTiledVectorSource, aT as FeltZoom, an as FilterExpression, ao as FilterLogicGate, ap as FilterTernary, aq as Filters, R as GeoJsonDataVectorSource, aU as GeoJsonFeature, S as GeoJsonFileVectorSource, aV as GeoJsonGeometry, aW as GeoJsonProperties, W as GeoJsonUrlVectorSource, ar as GeometryFilter, G as GetElementGroupsConstraint, h as GetElementsConstraint, aw as GetLayerCalculationParams, ax as GetLayerCategoriesGroup, ay as GetLayerCategoriesParams, X as GetLayerGroupsConstraint, az as GetLayerHistogramBin, aA as GetLayerHistogramParams, aB as GetLayerPrecomputedCalculationParams, Y as GetLayersConstraint, Z as GetRenderedFeaturesConstraint, aC as GridConfig, aD as GridType, H as HighlighterElementCreate, i as HighlighterElementRead, j as HighlighterElementUpdate, b8 as HighlighterToolSettings, I as ImageElementCreate, k as ImageElementRead, l as ImageElementUpdate, b9 as InputToolSettings, J as InteractionsController, aX as LatLng, _ as Layer, as as LayerBoundaries, $ as LayerChangeCallbackParams, a0 as LayerCommon, ad as LayerFeature, at as LayerFilters, a1 as LayerGroup, a2 as LayerGroupChangeCallbackParams, aP as LayerGroupNode, aQ as LayerNode, a3 as LayerProcessingStatus, af as LayerSchema, ag as LayerSchemaAttribute, ah as LayerSchemaBooleanAttribute, ai as LayerSchemaCommonAttribute, aj as LayerSchemaDateAttribute, ak as LayerSchemaDateTimeAttribute, al as LayerSchemaNumericAttribute, am as LayerSchemaTextAttribute, aH as LayersController, a4 as LegendItem, a5 as LegendItemChangeCallbackParams, a6 as LegendItemIdentifier, a7 as LegendItemsConstraint, aY as LineStringGeometry, ba as LineToolSettings, L as LinkElementRead, aZ as LngLatTuple, aI as MapDetails, D as MapInteractionEvent, M as MarkerElementCreate, m as MarkerElementRead, n as MarkerElementUpdate, bb as MarkerToolSettings, aJ as MiscController, aE as MultiAggregationConfig, a_ as MultiLineStringGeometry, a$ as MultiPointGeometry, b0 as MultiPolygonGeometry, N as NoteElementCreate, o as NoteElementRead, p as NoteElementUpdate, bc as NoteToolSettings, bn as OnMapInteractionsOptions, P as PathElementCreate, q as PathElementRead, r as PathElementUpdate, bd as PinToolSettings, s as PlaceElementCreate, t as PlaceElementRead, u as PlaceElementUpdate, be as PlaceFrame, bf as PlaceSymbol, b1 as PointGeometry, v as PolygonElementCreate, w as PolygonElementRead, x as PolygonElementUpdate, b2 as PolygonGeometry, bg as PolygonToolSettings, aF as PrecomputedAggregationMethod, a8 as RasterBand, a9 as RasterLayer, aa as RasterLayerSource, ae as RasterValue, bh as RouteToolSettings, aR as SelectionController, bp as SetViewportCenterZoomParams, b3 as SetVisibilityRequest, b4 as SortConfig, b5 as SortDirection, T as TextElementCreate, y as TextElementRead, A as TextElementUpdate, bi as TextToolSettings, bj as ToolSettingsChangeEvent, bk as ToolSettingsMap, bl as ToolType, bm as ToolsController, bo as UiController, ab as UpdateLayerParams, aG as ValueConfiguration, ac as VectorLayer, bq as ViewportConstraints, bt as ViewportController, br as ViewportFitBoundsParams, bs as ViewportState } from './controller-CmThLnnL.js';
1
+ import { z as zInfer, U as UiControlsOptions, V as ViewportCenterZoom, F as FeltController } from './controller-o3EwSJvB.js';
2
+ export { au as AggregatedGridConfig, av as AggregationConfig, aw as AggregationMethod, C as CircleElementCreate, a as CircleElementRead, b as CircleElementUpdate, b8 as CircleToolSettings, b9 as ConfigurableToolType, ax as CountGridConfig, K as CreateLayersFromGeoJsonParams, O as DataOnlyLayer, E as Element, c as ElementChangeCallbackParams, d as ElementCreate, e as ElementGroup, f as ElementGroupChangeCallbackParams, aM as ElementGroupNode, aN as ElementNode, g as ElementUpdate, B as ElementsController, aO as EntityNode, aP as FeatureNode, aQ as FeatureSelection, aU as FeltBoundary, Q as FeltTiledVectorSource, aV as FeltZoom, an as FilterExpression, ao as FilterLogicGate, ap as FilterTernary, aq as Filters, R as GeoJsonDataVectorSource, aW as GeoJsonFeature, S as GeoJsonFileVectorSource, aX as GeoJsonGeometry, aY as GeoJsonProperties, W as GeoJsonUrlVectorSource, ar as GeometryFilter, G as GetElementGroupsConstraint, h as GetElementsConstraint, ay as GetLayerCalculationParams, az as GetLayerCategoriesGroup, aA as GetLayerCategoriesParams, X as GetLayerGroupsConstraint, aB as GetLayerHistogramBin, aC as GetLayerHistogramParams, aD as GetLayerPrecomputedCalculationParams, Y as GetLayersConstraint, Z as GetRenderedFeaturesConstraint, aE as GridConfig, aF as GridType, H as HighlighterElementCreate, i as HighlighterElementRead, j as HighlighterElementUpdate, ba as HighlighterToolSettings, I as ImageElementCreate, k as ImageElementRead, l as ImageElementUpdate, bb as InputToolSettings, J as InteractionsController, aZ as LatLng, _ as Layer, as as LayerBoundaries, $ as LayerChangeCallbackParams, a0 as LayerCommon, ad as LayerFeature, at as LayerFilters, a1 as LayerGroup, a2 as LayerGroupChangeCallbackParams, aR as LayerGroupNode, aS as LayerNode, a3 as LayerProcessingStatus, af as LayerSchema, ag as LayerSchemaAttribute, ah as LayerSchemaBooleanAttribute, ai as LayerSchemaCommonAttribute, aj as LayerSchemaDateAttribute, ak as LayerSchemaDateTimeAttribute, al as LayerSchemaNumericAttribute, am as LayerSchemaTextAttribute, aJ as LayersController, a4 as LegendItem, a5 as LegendItemChangeCallbackParams, a6 as LegendItemIdentifier, a7 as LegendItemsConstraint, a_ as LineStringGeometry, bc as LineToolSettings, L as LinkElementRead, a$ as LngLatTuple, aK as MapDetails, D as MapInteractionEvent, M as MarkerElementCreate, m as MarkerElementRead, n as MarkerElementUpdate, bd as MarkerToolSettings, aL as MiscController, aG as MultiAggregationConfig, b0 as MultiLineStringGeometry, b1 as MultiPointGeometry, b2 as MultiPolygonGeometry, N as NoteElementCreate, o as NoteElementRead, p as NoteElementUpdate, be as NoteToolSettings, bp as OnMapInteractionsOptions, P as PathElementCreate, q as PathElementRead, r as PathElementUpdate, bf as PinToolSettings, s as PlaceElementCreate, t as PlaceElementRead, u as PlaceElementUpdate, bg as PlaceFrame, bh as PlaceSymbol, b3 as PointGeometry, v as PolygonElementCreate, w as PolygonElementRead, x as PolygonElementUpdate, b4 as PolygonGeometry, bi as PolygonToolSettings, aH as PrecomputedAggregationMethod, a8 as RasterBand, a9 as RasterLayer, aa as RasterLayerSource, ae as RasterValue, bj as RouteToolSettings, aT as SelectionController, br as SetViewportCenterZoomParams, b5 as SetVisibilityRequest, b6 as SortConfig, b7 as SortDirection, T as TextElementCreate, y as TextElementRead, A as TextElementUpdate, bk as TextToolSettings, bl as ToolSettingsChangeEvent, bm as ToolSettingsMap, bn as ToolType, bo as ToolsController, bq as UiController, ab as UpdateLayerParams, aI as ValueConfiguration, ac as VectorLayer, bs as ViewportConstraints, bv as ViewportController, bt as ViewportFitBoundsParams, bu as ViewportState } from './controller-o3EwSJvB.js';
3
3
  import { z } from 'zod';
4
4
 
5
5
  /**
@@ -6476,54 +6476,98 @@ interface GetLayerCalculationParams<T extends AggregationMethod | "count"> exten
6476
6476
  aggregation: MultiAggregationConfig<T>;
6477
6477
  }
6478
6478
  declare const GridTypeSchema: z.ZodEnum<["h3"]>;
6479
+ /**
6480
+ * The type of grid to use for precomputed aggregate values.
6481
+ *
6482
+ * @group Stats
6483
+ */
6479
6484
  type GridType = z.infer<typeof GridTypeSchema>;
6480
- declare const GridConfigSchema: z.ZodObject<{
6481
- /**
6482
- * The type of grid to use for the precomputed calculation.
6483
- */
6485
+ declare const CountGridConfigSchema: z.ZodObject<{
6484
6486
  type: z.ZodEnum<["h3"]>;
6485
6487
  /**
6486
6488
  * The resolution of the grid to use for the precomputed calculation.
6487
6489
  */
6488
6490
  resolution: z.ZodNumber;
6489
- /**
6490
- * The method to use for the precomputed calculation.
6491
- */
6492
- method: z.ZodEnum<["avg", "max", "min", "sum", "count"]>;
6493
- /**
6494
- * The attribute to use for the precomputed calculation. This can be omitted if the aggregation method is "count".
6495
- * Must be a numeric attribute otherwise.
6496
- */
6497
- attribute: z.ZodOptional<z.ZodString>;
6491
+ method: z.ZodEnum<["count"]>;
6498
6492
  }, "strip", z.ZodTypeAny, {
6499
6493
  type: "h3";
6500
- method: "avg" | "max" | "min" | "sum" | "count";
6494
+ method: "count";
6501
6495
  resolution: number;
6502
- attribute?: string | undefined;
6503
6496
  }, {
6504
6497
  type: "h3";
6505
- method: "avg" | "max" | "min" | "sum" | "count";
6498
+ method: "count";
6506
6499
  resolution: number;
6507
- attribute?: string | undefined;
6508
6500
  }>;
6509
- interface GridConfig extends z.infer<typeof GridConfigSchema> {
6501
+ /**
6502
+ * The grid configuration for a count-based precomputed aggregate value. Compared to the
6503
+ * {@link AggregatedGridConfig}, the `attribute` property is not required, because the count
6504
+ * is the same regardless of the attribute.
6505
+ *
6506
+ * Used inside {@link GetLayerPrecomputedCalculationParams}.
6507
+ *
6508
+ * @group Stats
6509
+ */
6510
+ interface CountGridConfig extends zInfer<typeof CountGridConfigSchema> {
6510
6511
  /**
6511
6512
  * The type of grid to use for the precomputed calculation.
6512
6513
  */
6513
6514
  type: GridType;
6515
+ /**
6516
+ * The method to use for the precomputed calculation, which in this case is always "count".
6517
+ */
6518
+ method: Extract<PrecomputedAggregationMethod, "count">;
6519
+ }
6520
+ declare const AggregatedGridConfigSchema: z.ZodObject<{
6521
+ type: z.ZodEnum<["h3"]>;
6514
6522
  /**
6515
6523
  * The resolution of the grid to use for the precomputed calculation.
6516
6524
  */
6525
+ resolution: z.ZodNumber;
6526
+ method: z.ZodEnum<["avg", "max", "min", "sum"]>;
6527
+ /**
6528
+ * The attribute to use for the precomputed calculation.
6529
+ *
6530
+ * This must be a numeric attribute;
6531
+ */
6532
+ attribute: z.ZodString;
6533
+ }, "strip", z.ZodTypeAny, {
6534
+ type: "h3";
6535
+ attribute: string;
6536
+ method: "avg" | "max" | "min" | "sum";
6537
+ resolution: number;
6538
+ }, {
6539
+ type: "h3";
6540
+ attribute: string;
6541
+ method: "avg" | "max" | "min" | "sum";
6517
6542
  resolution: number;
6543
+ }>;
6544
+ /**
6545
+ * The grid configuration for an aggregated precomputed aggregate value. This requires
6546
+ * an `attribute` property, because the numeric aggregation requires it.
6547
+ *
6548
+ * If you just want to count the features in each grid cell, use the {@link CountGridConfig}
6549
+ * instead, where you are not required to specify an `attribute`.
6550
+ *
6551
+ * Used inside {@link GetLayerPrecomputedCalculationParams}.
6552
+ *
6553
+ * @group Stats
6554
+ */
6555
+ interface AggregatedGridConfig extends zInfer<typeof AggregatedGridConfigSchema> {
6518
6556
  /**
6519
- * The method to use for the precomputed calculation.
6557
+ * The type of grid to use for the precomputed calculation.
6520
6558
  */
6521
- method: PrecomputedAggregationMethod;
6559
+ type: GridType;
6522
6560
  /**
6523
- * The attribute to use for the precomputed calculation.
6561
+ * The method to use for the precomputed calculation.
6524
6562
  */
6525
- attribute: string | undefined;
6563
+ method: Exclude<PrecomputedAggregationMethod, "count">;
6526
6564
  }
6565
+ /**
6566
+ * Describes the type of grid to use for precomputed aggregate values.
6567
+ *
6568
+ * @group Stats
6569
+ */
6570
+ type GridConfig = CountGridConfig | AggregatedGridConfig;
6527
6571
  declare const GetLayerPrecomputedCalculationParamsSchema: z.ZodObject<{
6528
6572
  /**
6529
6573
  * The ID of the layer to calculate an aggregate value for.
@@ -6552,42 +6596,56 @@ declare const GetLayerPrecomputedCalculationParamsSchema: z.ZodObject<{
6552
6596
  /**
6553
6597
  * The type of grid to use for the precomputed calculation.
6554
6598
  */
6555
- gridConfig: z.ZodObject<{
6556
- /**
6557
- * The type of grid to use for the precomputed calculation.
6558
- */
6599
+ gridConfig: z.ZodUnion<[z.ZodObject<{
6559
6600
  type: z.ZodEnum<["h3"]>;
6560
6601
  /**
6561
6602
  * The resolution of the grid to use for the precomputed calculation.
6562
6603
  */
6563
6604
  resolution: z.ZodNumber;
6605
+ method: z.ZodEnum<["count"]>;
6606
+ }, "strip", z.ZodTypeAny, {
6607
+ type: "h3";
6608
+ method: "count";
6609
+ resolution: number;
6610
+ }, {
6611
+ type: "h3";
6612
+ method: "count";
6613
+ resolution: number;
6614
+ }>, z.ZodObject<{
6615
+ type: z.ZodEnum<["h3"]>;
6564
6616
  /**
6565
- * The method to use for the precomputed calculation.
6617
+ * The resolution of the grid to use for the precomputed calculation.
6566
6618
  */
6567
- method: z.ZodEnum<["avg", "max", "min", "sum", "count"]>;
6619
+ resolution: z.ZodNumber;
6620
+ method: z.ZodEnum<["avg", "max", "min", "sum"]>;
6568
6621
  /**
6569
- * The attribute to use for the precomputed calculation. This can be omitted if the aggregation method is "count".
6570
- * Must be a numeric attribute otherwise.
6622
+ * The attribute to use for the precomputed calculation.
6623
+ *
6624
+ * This must be a numeric attribute;
6571
6625
  */
6572
- attribute: z.ZodOptional<z.ZodString>;
6626
+ attribute: z.ZodString;
6573
6627
  }, "strip", z.ZodTypeAny, {
6574
6628
  type: "h3";
6575
- method: "avg" | "max" | "min" | "sum" | "count";
6629
+ attribute: string;
6630
+ method: "avg" | "max" | "min" | "sum";
6576
6631
  resolution: number;
6577
- attribute?: string | undefined;
6578
6632
  }, {
6579
6633
  type: "h3";
6580
- method: "avg" | "max" | "min" | "sum" | "count";
6634
+ attribute: string;
6635
+ method: "avg" | "max" | "min" | "sum";
6581
6636
  resolution: number;
6582
- attribute?: string | undefined;
6583
- }>;
6637
+ }>]>;
6584
6638
  }, "strip", z.ZodTypeAny, {
6585
6639
  layerId: string;
6586
6640
  gridConfig: {
6587
6641
  type: "h3";
6588
- method: "avg" | "max" | "min" | "sum" | "count";
6642
+ method: "count";
6643
+ resolution: number;
6644
+ } | {
6645
+ type: "h3";
6646
+ attribute: string;
6647
+ method: "avg" | "max" | "min" | "sum";
6589
6648
  resolution: number;
6590
- attribute?: string | undefined;
6591
6649
  };
6592
6650
  boundary?: [number, number, number, number] | [number, number][] | {
6593
6651
  type: "Polygon";
@@ -6601,9 +6659,13 @@ declare const GetLayerPrecomputedCalculationParamsSchema: z.ZodObject<{
6601
6659
  layerId: string;
6602
6660
  gridConfig: {
6603
6661
  type: "h3";
6604
- method: "avg" | "max" | "min" | "sum" | "count";
6662
+ method: "count";
6663
+ resolution: number;
6664
+ } | {
6665
+ type: "h3";
6666
+ attribute: string;
6667
+ method: "avg" | "max" | "min" | "sum";
6605
6668
  resolution: number;
6606
- attribute?: string | undefined;
6607
6669
  };
6608
6670
  boundary?: [number, number, number, number] | [number, number][] | {
6609
6671
  type: "Polygon";
@@ -8705,4 +8767,4 @@ interface FeltController extends ViewportController, UiController, LayersControl
8705
8767
  iframe: HTMLIFrameElement | null;
8706
8768
  }
8707
8769
 
8708
- export type { LayerChangeCallbackParams as $, TextElementUpdate as A, ElementsController as B, CircleElementCreate as C, MapInteractionEvent as D, Element as E, FeltController as F, GetElementGroupsConstraint as G, HighlighterElementCreate as H, ImageElementCreate as I, InteractionsController as J, CreateLayersFromGeoJsonParams as K, LinkElementRead as L, MarkerElementCreate as M, NoteElementCreate as N, DataOnlyLayer as O, PathElementCreate as P, FeltTiledVectorSource as Q, GeoJsonDataVectorSource as R, GeoJsonFileVectorSource as S, TextElementCreate as T, UiControlsOptions as U, ViewportCenterZoom as V, GeoJsonUrlVectorSource as W, GetLayerGroupsConstraint as X, GetLayersConstraint as Y, GetRenderedFeaturesConstraint as Z, Layer as _, CircleElementRead as a, MultiPointGeometry as a$, LayerCommon as a0, LayerGroup as a1, LayerGroupChangeCallbackParams as a2, LayerProcessingStatus as a3, LegendItem as a4, LegendItemChangeCallbackParams as a5, LegendItemIdentifier as a6, LegendItemsConstraint as a7, RasterBand as a8, RasterLayer as a9, GetLayerHistogramParams as aA, GetLayerPrecomputedCalculationParams as aB, GridConfig as aC, GridType as aD, MultiAggregationConfig as aE, PrecomputedAggregationMethod as aF, ValueConfiguration as aG, LayersController as aH, MapDetails as aI, MiscController as aJ, ElementGroupNode as aK, ElementNode as aL, EntityNode as aM, FeatureNode as aN, FeatureSelection as aO, LayerGroupNode as aP, LayerNode as aQ, SelectionController as aR, FeltBoundary as aS, FeltZoom as aT, GeoJsonFeature as aU, GeoJsonGeometry as aV, GeoJsonProperties as aW, LatLng as aX, LineStringGeometry as aY, LngLatTuple as aZ, MultiLineStringGeometry as a_, RasterLayerSource as aa, UpdateLayerParams as ab, VectorLayer as ac, LayerFeature as ad, RasterValue as ae, LayerSchema as af, LayerSchemaAttribute as ag, LayerSchemaBooleanAttribute as ah, LayerSchemaCommonAttribute as ai, LayerSchemaDateAttribute as aj, LayerSchemaDateTimeAttribute as ak, LayerSchemaNumericAttribute as al, LayerSchemaTextAttribute as am, FilterExpression as an, FilterLogicGate as ao, FilterTernary as ap, Filters as aq, GeometryFilter as ar, LayerBoundaries as as, LayerFilters as at, AggregationConfig as au, AggregationMethod as av, GetLayerCalculationParams as aw, GetLayerCategoriesGroup as ax, GetLayerCategoriesParams as ay, GetLayerHistogramBin as az, CircleElementUpdate as b, MultiPolygonGeometry as b0, PointGeometry as b1, PolygonGeometry as b2, SetVisibilityRequest as b3, SortConfig as b4, SortDirection as b5, CircleToolSettings as b6, ConfigurableToolType as b7, HighlighterToolSettings as b8, InputToolSettings as b9, LineToolSettings as ba, MarkerToolSettings as bb, NoteToolSettings as bc, PinToolSettings as bd, PlaceFrame as be, PlaceSymbol as bf, PolygonToolSettings as bg, RouteToolSettings as bh, TextToolSettings as bi, ToolSettingsChangeEvent as bj, ToolSettingsMap as bk, ToolType as bl, ToolsController as bm, UiOnMapInteractionsOptions as bn, UiController as bo, SetViewportCenterZoomParams as bp, ViewportConstraints as bq, ViewportFitBoundsParams as br, ViewportState as bs, ViewportController as bt, UnwrapPromise as bu, UnionToIntersection as bv, PromiseOrNot as bw, ElementChangeCallbackParams as c, ElementCreate as d, ElementGroup as e, ElementGroupChangeCallbackParams as f, ElementUpdate as g, GetElementsConstraint as h, HighlighterElementRead as i, HighlighterElementUpdate as j, ImageElementRead as k, ImageElementUpdate as l, MarkerElementRead as m, MarkerElementUpdate as n, NoteElementRead as o, NoteElementUpdate as p, PathElementRead as q, PathElementUpdate as r, PlaceElementCreate as s, PlaceElementRead as t, PlaceElementUpdate as u, PolygonElementCreate as v, PolygonElementRead as w, PolygonElementUpdate as x, TextElementRead as y, zInfer as z };
8770
+ export type { LayerChangeCallbackParams as $, TextElementUpdate as A, ElementsController as B, CircleElementCreate as C, MapInteractionEvent as D, Element as E, FeltController as F, GetElementGroupsConstraint as G, HighlighterElementCreate as H, ImageElementCreate as I, InteractionsController as J, CreateLayersFromGeoJsonParams as K, LinkElementRead as L, MarkerElementCreate as M, NoteElementCreate as N, DataOnlyLayer as O, PathElementCreate as P, FeltTiledVectorSource as Q, GeoJsonDataVectorSource as R, GeoJsonFileVectorSource as S, TextElementCreate as T, UiControlsOptions as U, ViewportCenterZoom as V, GeoJsonUrlVectorSource as W, GetLayerGroupsConstraint as X, GetLayersConstraint as Y, GetRenderedFeaturesConstraint as Z, Layer as _, CircleElementRead as a, LngLatTuple as a$, LayerCommon as a0, LayerGroup as a1, LayerGroupChangeCallbackParams as a2, LayerProcessingStatus as a3, LegendItem as a4, LegendItemChangeCallbackParams as a5, LegendItemIdentifier as a6, LegendItemsConstraint as a7, RasterBand as a8, RasterLayer as a9, GetLayerCategoriesParams as aA, GetLayerHistogramBin as aB, GetLayerHistogramParams as aC, GetLayerPrecomputedCalculationParams as aD, GridConfig as aE, GridType as aF, MultiAggregationConfig as aG, PrecomputedAggregationMethod as aH, ValueConfiguration as aI, LayersController as aJ, MapDetails as aK, MiscController as aL, ElementGroupNode as aM, ElementNode as aN, EntityNode as aO, FeatureNode as aP, FeatureSelection as aQ, LayerGroupNode as aR, LayerNode as aS, SelectionController as aT, FeltBoundary as aU, FeltZoom as aV, GeoJsonFeature as aW, GeoJsonGeometry as aX, GeoJsonProperties as aY, LatLng as aZ, LineStringGeometry as a_, RasterLayerSource as aa, UpdateLayerParams as ab, VectorLayer as ac, LayerFeature as ad, RasterValue as ae, LayerSchema as af, LayerSchemaAttribute as ag, LayerSchemaBooleanAttribute as ah, LayerSchemaCommonAttribute as ai, LayerSchemaDateAttribute as aj, LayerSchemaDateTimeAttribute as ak, LayerSchemaNumericAttribute as al, LayerSchemaTextAttribute as am, FilterExpression as an, FilterLogicGate as ao, FilterTernary as ap, Filters as aq, GeometryFilter as ar, LayerBoundaries as as, LayerFilters as at, AggregatedGridConfig as au, AggregationConfig as av, AggregationMethod as aw, CountGridConfig as ax, GetLayerCalculationParams as ay, GetLayerCategoriesGroup as az, CircleElementUpdate as b, MultiLineStringGeometry as b0, MultiPointGeometry as b1, MultiPolygonGeometry as b2, PointGeometry as b3, PolygonGeometry as b4, SetVisibilityRequest as b5, SortConfig as b6, SortDirection as b7, CircleToolSettings as b8, ConfigurableToolType as b9, HighlighterToolSettings as ba, InputToolSettings as bb, LineToolSettings as bc, MarkerToolSettings as bd, NoteToolSettings as be, PinToolSettings as bf, PlaceFrame as bg, PlaceSymbol as bh, PolygonToolSettings as bi, RouteToolSettings as bj, TextToolSettings as bk, ToolSettingsChangeEvent as bl, ToolSettingsMap as bm, ToolType as bn, ToolsController as bo, UiOnMapInteractionsOptions as bp, UiController as bq, SetViewportCenterZoomParams as br, ViewportConstraints as bs, ViewportFitBoundsParams as bt, ViewportState as bu, ViewportController as bv, UnwrapPromise as bw, UnionToIntersection as bx, PromiseOrNot as by, ElementChangeCallbackParams as c, ElementCreate as d, ElementGroup as e, ElementGroupChangeCallbackParams as f, ElementUpdate as g, GetElementsConstraint as h, HighlighterElementRead as i, HighlighterElementUpdate as j, ImageElementRead as k, ImageElementUpdate as l, MarkerElementRead as m, MarkerElementUpdate as n, NoteElementRead as o, NoteElementUpdate as p, PathElementRead as q, PathElementUpdate as r, PlaceElementCreate as s, PlaceElementRead as t, PlaceElementUpdate as u, PolygonElementCreate as v, PolygonElementRead as w, PolygonElementUpdate as x, TextElementRead as y, zInfer as z };
@@ -6476,54 +6476,98 @@ interface GetLayerCalculationParams<T extends AggregationMethod | "count"> exten
6476
6476
  aggregation: MultiAggregationConfig<T>;
6477
6477
  }
6478
6478
  declare const GridTypeSchema: z.ZodEnum<["h3"]>;
6479
+ /**
6480
+ * The type of grid to use for precomputed aggregate values.
6481
+ *
6482
+ * @group Stats
6483
+ */
6479
6484
  type GridType = z.infer<typeof GridTypeSchema>;
6480
- declare const GridConfigSchema: z.ZodObject<{
6481
- /**
6482
- * The type of grid to use for the precomputed calculation.
6483
- */
6485
+ declare const CountGridConfigSchema: z.ZodObject<{
6484
6486
  type: z.ZodEnum<["h3"]>;
6485
6487
  /**
6486
6488
  * The resolution of the grid to use for the precomputed calculation.
6487
6489
  */
6488
6490
  resolution: z.ZodNumber;
6489
- /**
6490
- * The method to use for the precomputed calculation.
6491
- */
6492
- method: z.ZodEnum<["avg", "max", "min", "sum", "count"]>;
6493
- /**
6494
- * The attribute to use for the precomputed calculation. This can be omitted if the aggregation method is "count".
6495
- * Must be a numeric attribute otherwise.
6496
- */
6497
- attribute: z.ZodOptional<z.ZodString>;
6491
+ method: z.ZodEnum<["count"]>;
6498
6492
  }, "strip", z.ZodTypeAny, {
6499
6493
  type: "h3";
6500
- method: "avg" | "max" | "min" | "sum" | "count";
6494
+ method: "count";
6501
6495
  resolution: number;
6502
- attribute?: string | undefined;
6503
6496
  }, {
6504
6497
  type: "h3";
6505
- method: "avg" | "max" | "min" | "sum" | "count";
6498
+ method: "count";
6506
6499
  resolution: number;
6507
- attribute?: string | undefined;
6508
6500
  }>;
6509
- interface GridConfig extends z.infer<typeof GridConfigSchema> {
6501
+ /**
6502
+ * The grid configuration for a count-based precomputed aggregate value. Compared to the
6503
+ * {@link AggregatedGridConfig}, the `attribute` property is not required, because the count
6504
+ * is the same regardless of the attribute.
6505
+ *
6506
+ * Used inside {@link GetLayerPrecomputedCalculationParams}.
6507
+ *
6508
+ * @group Stats
6509
+ */
6510
+ interface CountGridConfig extends zInfer<typeof CountGridConfigSchema> {
6510
6511
  /**
6511
6512
  * The type of grid to use for the precomputed calculation.
6512
6513
  */
6513
6514
  type: GridType;
6515
+ /**
6516
+ * The method to use for the precomputed calculation, which in this case is always "count".
6517
+ */
6518
+ method: Extract<PrecomputedAggregationMethod, "count">;
6519
+ }
6520
+ declare const AggregatedGridConfigSchema: z.ZodObject<{
6521
+ type: z.ZodEnum<["h3"]>;
6514
6522
  /**
6515
6523
  * The resolution of the grid to use for the precomputed calculation.
6516
6524
  */
6525
+ resolution: z.ZodNumber;
6526
+ method: z.ZodEnum<["avg", "max", "min", "sum"]>;
6527
+ /**
6528
+ * The attribute to use for the precomputed calculation.
6529
+ *
6530
+ * This must be a numeric attribute;
6531
+ */
6532
+ attribute: z.ZodString;
6533
+ }, "strip", z.ZodTypeAny, {
6534
+ type: "h3";
6535
+ attribute: string;
6536
+ method: "avg" | "max" | "min" | "sum";
6537
+ resolution: number;
6538
+ }, {
6539
+ type: "h3";
6540
+ attribute: string;
6541
+ method: "avg" | "max" | "min" | "sum";
6517
6542
  resolution: number;
6543
+ }>;
6544
+ /**
6545
+ * The grid configuration for an aggregated precomputed aggregate value. This requires
6546
+ * an `attribute` property, because the numeric aggregation requires it.
6547
+ *
6548
+ * If you just want to count the features in each grid cell, use the {@link CountGridConfig}
6549
+ * instead, where you are not required to specify an `attribute`.
6550
+ *
6551
+ * Used inside {@link GetLayerPrecomputedCalculationParams}.
6552
+ *
6553
+ * @group Stats
6554
+ */
6555
+ interface AggregatedGridConfig extends zInfer<typeof AggregatedGridConfigSchema> {
6518
6556
  /**
6519
- * The method to use for the precomputed calculation.
6557
+ * The type of grid to use for the precomputed calculation.
6520
6558
  */
6521
- method: PrecomputedAggregationMethod;
6559
+ type: GridType;
6522
6560
  /**
6523
- * The attribute to use for the precomputed calculation.
6561
+ * The method to use for the precomputed calculation.
6524
6562
  */
6525
- attribute: string | undefined;
6563
+ method: Exclude<PrecomputedAggregationMethod, "count">;
6526
6564
  }
6565
+ /**
6566
+ * Describes the type of grid to use for precomputed aggregate values.
6567
+ *
6568
+ * @group Stats
6569
+ */
6570
+ type GridConfig = CountGridConfig | AggregatedGridConfig;
6527
6571
  declare const GetLayerPrecomputedCalculationParamsSchema: z.ZodObject<{
6528
6572
  /**
6529
6573
  * The ID of the layer to calculate an aggregate value for.
@@ -6552,42 +6596,56 @@ declare const GetLayerPrecomputedCalculationParamsSchema: z.ZodObject<{
6552
6596
  /**
6553
6597
  * The type of grid to use for the precomputed calculation.
6554
6598
  */
6555
- gridConfig: z.ZodObject<{
6556
- /**
6557
- * The type of grid to use for the precomputed calculation.
6558
- */
6599
+ gridConfig: z.ZodUnion<[z.ZodObject<{
6559
6600
  type: z.ZodEnum<["h3"]>;
6560
6601
  /**
6561
6602
  * The resolution of the grid to use for the precomputed calculation.
6562
6603
  */
6563
6604
  resolution: z.ZodNumber;
6605
+ method: z.ZodEnum<["count"]>;
6606
+ }, "strip", z.ZodTypeAny, {
6607
+ type: "h3";
6608
+ method: "count";
6609
+ resolution: number;
6610
+ }, {
6611
+ type: "h3";
6612
+ method: "count";
6613
+ resolution: number;
6614
+ }>, z.ZodObject<{
6615
+ type: z.ZodEnum<["h3"]>;
6564
6616
  /**
6565
- * The method to use for the precomputed calculation.
6617
+ * The resolution of the grid to use for the precomputed calculation.
6566
6618
  */
6567
- method: z.ZodEnum<["avg", "max", "min", "sum", "count"]>;
6619
+ resolution: z.ZodNumber;
6620
+ method: z.ZodEnum<["avg", "max", "min", "sum"]>;
6568
6621
  /**
6569
- * The attribute to use for the precomputed calculation. This can be omitted if the aggregation method is "count".
6570
- * Must be a numeric attribute otherwise.
6622
+ * The attribute to use for the precomputed calculation.
6623
+ *
6624
+ * This must be a numeric attribute;
6571
6625
  */
6572
- attribute: z.ZodOptional<z.ZodString>;
6626
+ attribute: z.ZodString;
6573
6627
  }, "strip", z.ZodTypeAny, {
6574
6628
  type: "h3";
6575
- method: "avg" | "max" | "min" | "sum" | "count";
6629
+ attribute: string;
6630
+ method: "avg" | "max" | "min" | "sum";
6576
6631
  resolution: number;
6577
- attribute?: string | undefined;
6578
6632
  }, {
6579
6633
  type: "h3";
6580
- method: "avg" | "max" | "min" | "sum" | "count";
6634
+ attribute: string;
6635
+ method: "avg" | "max" | "min" | "sum";
6581
6636
  resolution: number;
6582
- attribute?: string | undefined;
6583
- }>;
6637
+ }>]>;
6584
6638
  }, "strip", z.ZodTypeAny, {
6585
6639
  layerId: string;
6586
6640
  gridConfig: {
6587
6641
  type: "h3";
6588
- method: "avg" | "max" | "min" | "sum" | "count";
6642
+ method: "count";
6643
+ resolution: number;
6644
+ } | {
6645
+ type: "h3";
6646
+ attribute: string;
6647
+ method: "avg" | "max" | "min" | "sum";
6589
6648
  resolution: number;
6590
- attribute?: string | undefined;
6591
6649
  };
6592
6650
  boundary?: [number, number, number, number] | [number, number][] | {
6593
6651
  type: "Polygon";
@@ -6601,9 +6659,13 @@ declare const GetLayerPrecomputedCalculationParamsSchema: z.ZodObject<{
6601
6659
  layerId: string;
6602
6660
  gridConfig: {
6603
6661
  type: "h3";
6604
- method: "avg" | "max" | "min" | "sum" | "count";
6662
+ method: "count";
6663
+ resolution: number;
6664
+ } | {
6665
+ type: "h3";
6666
+ attribute: string;
6667
+ method: "avg" | "max" | "min" | "sum";
6605
6668
  resolution: number;
6606
- attribute?: string | undefined;
6607
6669
  };
6608
6670
  boundary?: [number, number, number, number] | [number, number][] | {
6609
6671
  type: "Polygon";
@@ -8705,4 +8767,4 @@ interface FeltController extends ViewportController, UiController, LayersControl
8705
8767
  iframe: HTMLIFrameElement | null;
8706
8768
  }
8707
8769
 
8708
- export type { LayerChangeCallbackParams as $, TextElementUpdate as A, ElementsController as B, CircleElementCreate as C, MapInteractionEvent as D, Element as E, FeltController as F, GetElementGroupsConstraint as G, HighlighterElementCreate as H, ImageElementCreate as I, InteractionsController as J, CreateLayersFromGeoJsonParams as K, LinkElementRead as L, MarkerElementCreate as M, NoteElementCreate as N, DataOnlyLayer as O, PathElementCreate as P, FeltTiledVectorSource as Q, GeoJsonDataVectorSource as R, GeoJsonFileVectorSource as S, TextElementCreate as T, UiControlsOptions as U, ViewportCenterZoom as V, GeoJsonUrlVectorSource as W, GetLayerGroupsConstraint as X, GetLayersConstraint as Y, GetRenderedFeaturesConstraint as Z, Layer as _, CircleElementRead as a, MultiPointGeometry as a$, LayerCommon as a0, LayerGroup as a1, LayerGroupChangeCallbackParams as a2, LayerProcessingStatus as a3, LegendItem as a4, LegendItemChangeCallbackParams as a5, LegendItemIdentifier as a6, LegendItemsConstraint as a7, RasterBand as a8, RasterLayer as a9, GetLayerHistogramParams as aA, GetLayerPrecomputedCalculationParams as aB, GridConfig as aC, GridType as aD, MultiAggregationConfig as aE, PrecomputedAggregationMethod as aF, ValueConfiguration as aG, LayersController as aH, MapDetails as aI, MiscController as aJ, ElementGroupNode as aK, ElementNode as aL, EntityNode as aM, FeatureNode as aN, FeatureSelection as aO, LayerGroupNode as aP, LayerNode as aQ, SelectionController as aR, FeltBoundary as aS, FeltZoom as aT, GeoJsonFeature as aU, GeoJsonGeometry as aV, GeoJsonProperties as aW, LatLng as aX, LineStringGeometry as aY, LngLatTuple as aZ, MultiLineStringGeometry as a_, RasterLayerSource as aa, UpdateLayerParams as ab, VectorLayer as ac, LayerFeature as ad, RasterValue as ae, LayerSchema as af, LayerSchemaAttribute as ag, LayerSchemaBooleanAttribute as ah, LayerSchemaCommonAttribute as ai, LayerSchemaDateAttribute as aj, LayerSchemaDateTimeAttribute as ak, LayerSchemaNumericAttribute as al, LayerSchemaTextAttribute as am, FilterExpression as an, FilterLogicGate as ao, FilterTernary as ap, Filters as aq, GeometryFilter as ar, LayerBoundaries as as, LayerFilters as at, AggregationConfig as au, AggregationMethod as av, GetLayerCalculationParams as aw, GetLayerCategoriesGroup as ax, GetLayerCategoriesParams as ay, GetLayerHistogramBin as az, CircleElementUpdate as b, MultiPolygonGeometry as b0, PointGeometry as b1, PolygonGeometry as b2, SetVisibilityRequest as b3, SortConfig as b4, SortDirection as b5, CircleToolSettings as b6, ConfigurableToolType as b7, HighlighterToolSettings as b8, InputToolSettings as b9, LineToolSettings as ba, MarkerToolSettings as bb, NoteToolSettings as bc, PinToolSettings as bd, PlaceFrame as be, PlaceSymbol as bf, PolygonToolSettings as bg, RouteToolSettings as bh, TextToolSettings as bi, ToolSettingsChangeEvent as bj, ToolSettingsMap as bk, ToolType as bl, ToolsController as bm, UiOnMapInteractionsOptions as bn, UiController as bo, SetViewportCenterZoomParams as bp, ViewportConstraints as bq, ViewportFitBoundsParams as br, ViewportState as bs, ViewportController as bt, UnwrapPromise as bu, UnionToIntersection as bv, PromiseOrNot as bw, ElementChangeCallbackParams as c, ElementCreate as d, ElementGroup as e, ElementGroupChangeCallbackParams as f, ElementUpdate as g, GetElementsConstraint as h, HighlighterElementRead as i, HighlighterElementUpdate as j, ImageElementRead as k, ImageElementUpdate as l, MarkerElementRead as m, MarkerElementUpdate as n, NoteElementRead as o, NoteElementUpdate as p, PathElementRead as q, PathElementUpdate as r, PlaceElementCreate as s, PlaceElementRead as t, PlaceElementUpdate as u, PolygonElementCreate as v, PolygonElementRead as w, PolygonElementUpdate as x, TextElementRead as y, zInfer as z };
8770
+ export type { LayerChangeCallbackParams as $, TextElementUpdate as A, ElementsController as B, CircleElementCreate as C, MapInteractionEvent as D, Element as E, FeltController as F, GetElementGroupsConstraint as G, HighlighterElementCreate as H, ImageElementCreate as I, InteractionsController as J, CreateLayersFromGeoJsonParams as K, LinkElementRead as L, MarkerElementCreate as M, NoteElementCreate as N, DataOnlyLayer as O, PathElementCreate as P, FeltTiledVectorSource as Q, GeoJsonDataVectorSource as R, GeoJsonFileVectorSource as S, TextElementCreate as T, UiControlsOptions as U, ViewportCenterZoom as V, GeoJsonUrlVectorSource as W, GetLayerGroupsConstraint as X, GetLayersConstraint as Y, GetRenderedFeaturesConstraint as Z, Layer as _, CircleElementRead as a, LngLatTuple as a$, LayerCommon as a0, LayerGroup as a1, LayerGroupChangeCallbackParams as a2, LayerProcessingStatus as a3, LegendItem as a4, LegendItemChangeCallbackParams as a5, LegendItemIdentifier as a6, LegendItemsConstraint as a7, RasterBand as a8, RasterLayer as a9, GetLayerCategoriesParams as aA, GetLayerHistogramBin as aB, GetLayerHistogramParams as aC, GetLayerPrecomputedCalculationParams as aD, GridConfig as aE, GridType as aF, MultiAggregationConfig as aG, PrecomputedAggregationMethod as aH, ValueConfiguration as aI, LayersController as aJ, MapDetails as aK, MiscController as aL, ElementGroupNode as aM, ElementNode as aN, EntityNode as aO, FeatureNode as aP, FeatureSelection as aQ, LayerGroupNode as aR, LayerNode as aS, SelectionController as aT, FeltBoundary as aU, FeltZoom as aV, GeoJsonFeature as aW, GeoJsonGeometry as aX, GeoJsonProperties as aY, LatLng as aZ, LineStringGeometry as a_, RasterLayerSource as aa, UpdateLayerParams as ab, VectorLayer as ac, LayerFeature as ad, RasterValue as ae, LayerSchema as af, LayerSchemaAttribute as ag, LayerSchemaBooleanAttribute as ah, LayerSchemaCommonAttribute as ai, LayerSchemaDateAttribute as aj, LayerSchemaDateTimeAttribute as ak, LayerSchemaNumericAttribute as al, LayerSchemaTextAttribute as am, FilterExpression as an, FilterLogicGate as ao, FilterTernary as ap, Filters as aq, GeometryFilter as ar, LayerBoundaries as as, LayerFilters as at, AggregatedGridConfig as au, AggregationConfig as av, AggregationMethod as aw, CountGridConfig as ax, GetLayerCalculationParams as ay, GetLayerCategoriesGroup as az, CircleElementUpdate as b, MultiLineStringGeometry as b0, MultiPointGeometry as b1, MultiPolygonGeometry as b2, PointGeometry as b3, PolygonGeometry as b4, SetVisibilityRequest as b5, SortConfig as b6, SortDirection as b7, CircleToolSettings as b8, ConfigurableToolType as b9, HighlighterToolSettings as ba, InputToolSettings as bb, LineToolSettings as bc, MarkerToolSettings as bd, NoteToolSettings as be, PinToolSettings as bf, PlaceFrame as bg, PlaceSymbol as bh, PolygonToolSettings as bi, RouteToolSettings as bj, TextToolSettings as bk, ToolSettingsChangeEvent as bl, ToolSettingsMap as bm, ToolType as bn, ToolsController as bo, UiOnMapInteractionsOptions as bp, UiController as bq, SetViewportCenterZoomParams as br, ViewportConstraints as bs, ViewportFitBoundsParams as bt, ViewportState as bu, ViewportController as bv, UnwrapPromise as bw, UnionToIntersection as bx, PromiseOrNot as by, ElementChangeCallbackParams as c, ElementCreate as d, ElementGroup as e, ElementGroupChangeCallbackParams as f, ElementUpdate as g, GetElementsConstraint as h, HighlighterElementRead as i, HighlighterElementUpdate as j, ImageElementRead as k, ImageElementUpdate as l, MarkerElementRead as m, MarkerElementUpdate as n, NoteElementRead as o, NoteElementUpdate as p, PathElementRead as q, PathElementUpdate as r, PlaceElementCreate as s, PlaceElementRead as t, PlaceElementUpdate as u, PolygonElementCreate as v, PolygonElementRead as w, PolygonElementUpdate as x, TextElementRead as y, zInfer as z };
package/dist/handler.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";var oe=Object.defineProperty;var pt=Object.getOwnPropertyDescriptor;var ct=Object.getOwnPropertyNames;var mt=Object.prototype.hasOwnProperty;var gt=(n,l)=>{for(var P in l)oe(n,P,{get:l[P],enumerable:!0})},yt=(n,l,P,z)=>{if(l&&typeof l=="object"||typeof l=="function")for(let I of ct(l))!mt.call(n,I)&&I!==P&&oe(n,I,{get:()=>l[I],enumerable:!(z=pt(l,I))||z.enumerable});return n};var dt=n=>yt(oe({},"__esModule",{value:!0}),n);var Cr={};gt(Cr,{createMessageHandler:()=>hr});module.exports=dt(Cr);var g=require("zod");var d=require("zod");var S=require("zod");function t(n,l){return S.z.strictObject({type:S.z.literal(n),params:l})}function h(n,l){return S.z.strictObject({eventName:S.z.literal(n),id:S.z.string(),options:l})}function p(n){return S.z.strictObject({eventName:S.z.literal(n),id:S.z.string()})}var s=require("zod"),H=s.z.number(),J=s.z.number(),Z=s.z.object({latitude:J,longitude:H}),T=s.z.tuple([H,J]),w=s.z.object({type:s.z.literal("Polygon"),coordinates:s.z.array(s.z.array(T).min(4).refine(n=>n[0][0]===n[n.length-1][0]&&n[0][1]===n[n.length-1][1],"The last point of each ring must be identical to the first"))}),q=s.z.object({type:s.z.literal("MultiPolygon"),coordinates:s.z.array(w.shape.coordinates)}),ut=s.z.object({type:s.z.literal("LineString"),coordinates:s.z.array(T).min(2)}),U=s.z.object({type:s.z.literal("MultiLineString"),coordinates:s.z.array(ut.shape.coordinates)}),fe=s.z.number().min(1).max(23),x=s.z.tuple([H,J,H,J]),E=s.z.object({show:s.z.array(s.z.string()).optional(),hide:s.z.array(s.z.string()).optional()}),ht=s.z.enum(["asc","desc"]),W=s.z.object({attribute:s.z.string(),direction:ht});var e=require("zod");var f=e.z.object({id:e.z.string(),groupId:e.z.string().nullable(),color:e.z.string(),name:e.z.string().nullable(),description:e.z.string().nullable(),attributes:e.z.record(e.z.string(),e.z.unknown()),interaction:e.z.enum(["default","locked"]).optional()}),$=e.z.object({imageUrl:e.z.string().nullable()}),ae=e.z.object({strokeOpacity:e.z.number(),strokeWidth:e.z.number(),strokeStyle:e.z.enum(["solid","dashed","dotted"])}),ft=e.z.enum(["meter","kilometer","foot","mile"]),_=f.extend($.shape).extend({type:e.z.literal("Place"),coordinates:T,symbol:e.z.string(),frame:e.z.enum(["frame-circle","frame-square"]).nullable(),hideLabel:e.z.boolean()}),O=f.extend($.shape).extend(ae.shape).extend({type:e.z.literal("Path"),coordinates:U.shape.coordinates,distanceMarker:e.z.boolean(),routingMode:e.z.enum(["driving","cycling","walking","flying"]).nullable(),endCaps:e.z.boolean()}),v=f.extend($.shape).extend(ae.shape).extend({type:e.z.literal("Polygon"),coordinates:w.shape.coordinates,fillOpacity:e.z.number().min(0).max(1),areaMarker:e.z.boolean()}),Q=f.extend($.shape).extend(ae.shape).extend({type:e.z.literal("Circle"),center:T,radius:e.z.number(),radiusMarker:e.z.boolean(),radiusDisplayAngle:e.z.number(),radiusDisplayUnit:ft.nullable(),fillOpacity:e.z.number().min(0).max(1)}),j=f.extend({type:e.z.literal("Marker"),coordinates:U.shape.coordinates,opacity:e.z.number().min(0).max(1),size:e.z.number().min(0).max(100),zoom:e.z.number().min(0).max(23)}),R=f.extend({type:e.z.literal("Highlighter"),coordinates:q.shape.coordinates,renderHoles:e.z.boolean(),opacity:e.z.number().min(0).max(1)}),Se=e.z.object({position:T,rotation:e.z.number(),scale:e.z.number(),zoom:e.z.number().min(0).max(23),text:e.z.string(),align:e.z.enum(["left","center","right"]),style:e.z.enum(["italic","light","regular","caps"]),name:e.z.string()}),re=f.extend(Se.shape).extend({type:e.z.literal("Text")}),ne=f.extend(Se.shape).extend({type:e.z.literal("Note"),widthScale:e.z.number().min(0)}),N=f.extend({type:e.z.literal("Image"),coordinates:U.shape.coordinates,imageUrl:e.z.string(),opacity:e.z.number().min(0).max(1)}).omit({color:!0}),St=f.extend({type:e.z.literal("Link"),coordinates:U.shape.coordinates,url:e.z.string()}),F={type:!0,coordinates:!0},L={id:!0},ie=_.partial().extend(_.pick(F).shape).omit(L),K=O.partial().extend(O.pick(F).shape).omit(L),se=v.partial().extend(v.pick(F).shape).omit(L),le=Q.partial().extend(Q.pick({type:!0,center:!0,radius:!0}).shape).omit(L),pe=j.partial().extend(j.pick(F).shape).omit(L),ce=R.partial().extend(R.pick(F).shape).omit(L),me=re.partial().omit({...L,name:!0,type:!0}).extend({type:e.z.literal("Text"),text:e.z.string()}),ge=ne.partial().omit({...L,name:!0,type:!0}).extend({type:e.z.literal("Note"),text:e.z.string()}),xt=N.partial().extend(N.pick({...F,imageUrl:!0}).shape).omit(L),xe=e.z.discriminatedUnion("type",[ie,K,se,le,pe,ce,xt,me,ge]);var zr=O.omit({coordinates:!0}),Fr=v.omit({coordinates:!0});var kr=j.omit({coordinates:!0}),Vr=R.omit({coordinates:!0});var wr=N.omit({coordinates:!0}),Ur=St.omit({coordinates:!0}),b={type:!0,id:!0},Lt=_.partial().extend(_.pick(b).shape),bt=O.partial().extend(O.pick(b).shape),Mt=v.partial().extend(v.pick(b).shape),Ct=Q.partial().extend(Q.pick(b).shape),Gt=j.partial().extend(j.pick(b).shape),It=R.partial().extend(R.pick(b).shape),Tt=re.partial().extend(re.pick(b).shape).omit({name:!0}),Pt=ne.partial().extend(ne.pick(b).shape).omit({name:!0}),Et=N.partial().extend(N.pick(b).shape),Le=e.z.discriminatedUnion("type",[Lt,bt,Mt,Ct,Gt,It,Tt,Pt,Et]),be=e.z.object({ids:e.z.array(e.z.string()).optional()}),Me=e.z.object({ids:e.z.array(e.z.string()).optional()});var zt=t("getElement",d.z.string()),Ft=t("getElementGeometry",d.z.string()),kt=t("getElements",be.optional()),Vt=t("getElementGroup",d.z.string()),wt=t("getElementGroups",Me.optional()),Ut=t("setElementGroupVisibility",E),Ot=h("onElementChange",d.z.object({id:d.z.string()})),vt=p("onElementCreate"),jt=p("onElementCreateEnd"),Rt=h("onElementDelete",d.z.object({id:d.z.string()})),Nt=h("onElementGroupChange",d.z.object({id:d.z.string()})),At=t("createElement",xe),Bt=t("updateElement",Le),Dt=t("deleteElement",d.z.string()),Ce={methods:[zt,Ft,kt,Vt,wt,Ut,At,Bt,Dt],listeners:[Ot,vt,jt,Rt,Nt]};var Ht=p("onPointerClick"),Jt=p("onPointerMove"),Ge={methods:null,listeners:[Ht,Jt]};var a=require("zod");var i=require("zod");var Zt=i.z.enum(["in","ni"]),qt=i.z.enum(["lt","gt","le","ge","eq","ne","cn","nc","is","isnt"]),Hr=i.z.enum(["and","or"]),Ie=i.z.union([i.z.number(),i.z.string(),i.z.boolean(),i.z.null()]),Te=i.z.string().or(i.z.null()),Wt=i.z.tuple([Te,Zt,i.z.array(Ie).or(i.z.null())]),_t=i.z.tuple([Te,qt,Ie]),ye=i.z.union([Wt,_t]),de=i.z.tuple([i.z.lazy(()=>i.z.union([de,ye,i.z.null(),i.z.boolean()])),i.z.enum(["and","or"]),i.z.lazy(()=>i.z.union([de,ye,i.z.null(),i.z.boolean()]))]),M=i.z.union([de,ye,i.z.null(),i.z.boolean()]),C=i.z.union([x,w,q,i.z.array(T)]);var r=require("zod");var Pe=r.z.enum(["avg","max","min","sum","median"]),Qt=r.z.enum(["avg","max","min","sum","count"]),$t=r.z.object({method:Pe,attribute:r.z.string()}),Kt=r.z.object({methods:r.z.array(r.z.union([Pe,r.z.literal("count")])),attribute:r.z.string().optional()}),Ee=r.z.object({boundary:C.optional(),filters:M.optional(),aggregation:$t.optional()}),ze=r.z.object({layerId:r.z.string(),attribute:r.z.string(),limit:r.z.number().optional(),boundary:C.optional(),filters:M.optional(),values:Ee.optional()}),qr=r.z.object({key:r.z.union([r.z.number(),r.z.string(),r.z.boolean()]),value:r.z.number().nullable()}),Xt=r.z.object({type:r.z.literal("equal-intervals"),count:r.z.number()}),Yt=r.z.object({type:r.z.literal("time-interval"),interval:r.z.enum(["hour","day","week","month","year"])}),Fe=r.z.object({layerId:r.z.string(),attribute:r.z.string(),steps:r.z.union([Xt,Yt,r.z.array(r.z.number())]),boundary:C.optional(),filters:M.optional(),values:Ee.optional()}),Wr=r.z.object({min:r.z.number(),max:r.z.number(),value:r.z.number()}),ke=r.z.object({layerId:r.z.string(),boundary:C.optional(),filters:M.optional(),aggregation:Kt}),eo=r.z.enum(["h3"]),to=r.z.object({type:eo,resolution:r.z.number(),method:Qt,attribute:r.z.string().optional()}),Ve=r.z.object({layerId:r.z.string(),boundary:C.optional(),filters:M.optional(),gridConfig:to});var o=require("zod");var $r=o.z.enum(["processing","completed","failed","incomplete"]),we=o.z.object({type:o.z.literal("geoJsonUrl"),url:o.z.string().url(),refreshInterval:o.z.number().min(250).max(5*60*1e3).nullable().optional()}),Ue=o.z.object({type:o.z.literal("geoJsonData"),data:o.z.object({}).passthrough().or(o.z.instanceof(ArrayBuffer))}),Oe=o.z.object({type:o.z.literal("geoJsonFile"),file:o.z.instanceof(File)}),ve=o.z.object({id:o.z.string(),style:o.z.object({}).passthrough().optional(),shownInLegend:o.z.boolean().optional(),name:o.z.string().optional(),caption:o.z.string().optional(),description:o.z.string().optional(),bounds:x.optional(),source:o.z.union([we,Ue,Oe]).optional()}),je=o.z.object({ids:o.z.array(o.z.string()).optional()}),Re=o.z.object({ids:o.z.array(o.z.string()).optional()}),k=o.z.object({id:o.z.string(),layerId:o.z.string()}),Ne=o.z.object({ids:k.array().optional(),layerIds:o.z.string().array().optional()}),Ae=o.z.object({layerIds:o.z.array(o.z.string()).optional(),areaQuery:o.z.union([o.z.object({coordinates:Z}),o.z.object({boundary:x})]).optional()}),oo=o.z.object({Point:o.z.object({}).passthrough().optional(),Line:o.z.object({}).passthrough().optional(),Polygon:o.z.object({}).passthrough().optional()}),Be=o.z.object({source:o.z.union([we,Ue,Oe]),name:o.z.string(),bounds:x.optional(),caption:o.z.string().optional(),description:o.z.string().optional(),geometryStyles:oo.optional()});var ro=t("getLayer",a.z.string()),no=t("getLayers",je.optional()),ao=t("setLayerVisibility",E),io=h("onLayerChange",a.z.object({id:a.z.string()})),so=t("setLayerStyle",a.z.object({id:a.z.string(),style:a.z.object({}).passthrough()})),lo=t("setLayerLegendVisibility",E),po=t("createLayersFromGeoJson",Be),co=t("updateLayer",ve),mo=t("deleteLayer",a.z.string()),go=t("getLayerGroup",a.z.string()),yo=t("getLayerGroups",Re.optional()),uo=t("setLayerGroupVisibility",E),ho=t("setLayerGroupLegendVisibility",E),fo=h("onLayerGroupChange",a.z.object({id:a.z.string()})),So=t("getLegendItem",k),xo=t("getLegendItems",Ne.optional()),Lo=h("onLegendItemChange",k),bo=t("setLegendItemVisibility",a.z.object({show:k.array().optional(),hide:k.array().optional()})),Mo=t("getLayerFilters",a.z.string()),Co=t("setLayerFilters",a.z.object({layerId:a.z.string(),filters:M,note:a.z.string().optional()})),Go=h("onLayerFiltersChange",a.z.object({layerId:a.z.string()})),Io=t("getLayerBoundaries",a.z.string()),To=t("setLayerBoundary",a.z.object({layerIds:a.z.array(a.z.string()),boundary:C.nullable()})),Po=h("onLayerBoundariesChange",a.z.object({layerId:a.z.string()})),Eo=t("getRenderedFeatures",Ae.optional()),zo=t("getFeature",a.z.object({id:a.z.string().or(a.z.number()),layerId:a.z.string()})),Fo=t("getFeatures",a.z.object({layerId:a.z.string(),filters:M.optional(),sorting:W.optional(),boundary:C.optional(),search:a.z.string().optional(),pagination:a.z.string().optional().nullish()})),ko=t("getGeoJsonFeature",a.z.object({id:a.z.string().or(a.z.number()),layerId:a.z.string()})),Vo=t("getCategoryData",ze),wo=t("getHistogramData",Fe),Uo=t("getAggregates",ke),Oo=t("getPrecomputedAggregates",Ve),vo=t("getLayerSchema",a.z.string()),De={methods:[ro,no,ao,so,lo,po,mo,co,go,yo,uo,ho,So,xo,bo,Mo,Co,Io,To,Eo,zo,Fo,ko,Vo,wo,Uo,Oo,vo],listeners:[io,fo,Lo,Go,Po]};var He=require("zod");var jo=t("getMapDetails",He.z.undefined()),Je={methods:[jo],listeners:[]};var A=require("zod");var G=require("zod"),Ze=G.z.object({id:G.z.string().or(G.z.number()),layerId:G.z.string(),showPopup:G.z.boolean().optional(),fitViewport:G.z.boolean().or(G.z.object({maxZoom:G.z.number()})).optional()});var Ro=t("getSelection",A.z.undefined()),No=p("onSelectionChange"),Ao=t("selectFeature",Ze),Bo=t("clearSelection",A.z.object({features:A.z.boolean().optional(),elements:A.z.boolean().optional()}).optional()),qe={methods:[Ro,Ao,Bo],listeners:[No]};var Ke=require("zod");var c=require("zod");var We=["circle","highlighter","line","marker","note","pin","polygon","route","text"],Do=[...We,"link"],_e=c.z.enum(Do),Qe=c.z.enum(We),Ho=ie.pick({color:!0,symbol:!0,frame:!0}).extend({afterCreation:c.z.enum(["enter name","add another","select"])}).required(),Jo=K.pick({color:!0,strokeOpacity:!0,strokeWidth:!0,strokeStyle:!0,distanceMarker:!0}).required(),Zo=K.pick({color:!0,routingMode:!0,strokeOpacity:!0,strokeWidth:!0,strokeStyle:!0,distanceMarker:!0,endCaps:!0}).required(),qo=se.pick({color:!0,fillOpacity:!0,strokeOpacity:!0,strokeWidth:!0,strokeStyle:!0,areaMarker:!0}).required(),Wo=le.pick({color:!0,fillOpacity:!0,strokeOpacity:!0,strokeWidth:!0,strokeStyle:!0,radiusMarker:!0}).required(),_o=pe.pick({color:!0,opacity:!0,size:!0}).required(),Qo=ce.pick({color:!0,opacity:!0,renderHoles:!0}).extend({size:c.z.number().min(0).max(200)}).required(),$o=me.pick({color:!0,align:!0,style:!0}).required(),Ko=ge.pick({color:!0,align:!0,style:!0}).required(),$e=c.z.discriminatedUnion("tool",[Ho.partial().extend({tool:c.z.literal("pin")}),Jo.partial().extend({tool:c.z.literal("line")}),Zo.partial().extend({tool:c.z.literal("route")}),qo.partial().extend({tool:c.z.literal("polygon")}),Wo.partial().extend({tool:c.z.literal("circle")}),_o.partial().extend({tool:c.z.literal("marker")}),Qo.partial().extend({tool:c.z.literal("highlighter")}),$o.partial().extend({tool:c.z.literal("text")}),Ko.partial().extend({tool:c.z.literal("note")})]);var Xo=t("setTool",_e.nullable()),Yo=t("getTool",Ke.z.undefined()),er=p("onToolChange"),tr=t("setToolSettings",$e),or=t("getToolSettings",Qe),rr=p("onToolSettingsChange"),Xe={methods:[Xo,Yo,tr,or],listeners:[er,rr]};var X=require("zod");var m=require("zod"),Ye=m.z.object({showLegend:m.z.boolean().optional(),cooperativeGestures:m.z.boolean().optional(),fullScreenButton:m.z.boolean().optional(),geolocation:m.z.boolean().optional(),zoomControls:m.z.boolean().optional(),scaleBar:m.z.boolean().optional()}),et=m.z.object({featureSelectPanel:m.z.boolean().optional(),featureHoverPanel:m.z.boolean().optional(),elementSelectPanel:m.z.boolean().optional(),linkClickOpen:m.z.boolean().optional(),imageLightboxOpen:m.z.boolean().optional()});var nr=t("updateUiControls",Ye),ar=t("setOnMapInteractionsUi",et),ir=t("showLayerDataTable",X.z.object({layerId:X.z.string(),sorting:W.optional()}).optional()),sr=t("hideLayerDataTable",X.z.undefined()),tt={methods:[nr,ar,ir,sr],listeners:null};var ue=require("zod");var B=require("zod");var Y=B.z.object({center:Z,zoom:fe}),ot=B.z.object({center:Y.shape.center.optional(),zoom:Y.shape.zoom.optional()}),rt=B.z.object({minZoom:Y.shape.zoom.nullish(),maxZoom:Y.shape.zoom.nullish(),bounds:x.nullish()}).nullable(),nt=B.z.object({bounds:x});var lr=t("getViewport",ue.z.undefined()),pr=t("setViewport",ot),cr=t("getViewportConstraints",ue.z.undefined()),mr=t("setViewportConstraints",rt),gr=t("fitViewportToBounds",nt),yr=p("onViewportMove"),dr=p("onViewportMoveEnd"),ur=p("onMapIdle"),at={methods:[pr,lr,cr,mr,gr],listeners:[yr,dr,ur]};var he=[tt,at,De,Ce,qe,Ge,Xe,Je];function hr(n,l,P){let z=new Map;async function I(u){if(!br.safeParse(u.data).success){P?.onUnknownMessage?.(u.data);return}let D=lt.safeParse(u.data);if(!D.success){P?.onInvalidMessage?.(u.data,D.error),u.ports[0]?.postMessage(it(D.error.message));return}let{data:y}=D;if(y.type==="felt.ready")u.ports[0]?.postMessage(!0);else if(y.type==="felt.addListener"){if(y.event.eventName==="")throw new Error("felt.addListener eventName cannot be empty");let V="options"in y.event?{options:"options"in y.event?y.event.options:void 0,handler:te=>{u.ports[0]?.postMessage(te)}}:{handler:te=>{u.ports[0]?.postMessage(te)}},ee=l.listeners[y.event.eventName](V);z.set(y.event.id,ee)}else if(y.type==="felt.removeListener")z.get(y.id)?.(),z.delete(y.id);else try{let V=l.methods[y.type],ee=await V(y.params);u.ports[0]?.postMessage(ee)}catch(V){u.ports[0]?.postMessage(it(V))}}return n.addEventListener("message",I),()=>{n.removeEventListener("message",I)}}var st={methods:he.map(n=>n.methods??[]).flat(),listeners:he.map(n=>n.listeners??[]).flat()},fr=g.z.discriminatedUnion("eventName",[g.z.strictObject({eventName:g.z.literal("")}),...st.listeners]),Sr=g.z.strictObject({type:g.z.literal("felt.addListener"),event:fr}),xr=g.z.strictObject({type:g.z.literal("felt.removeListener"),id:g.z.string()}),Lr=g.z.strictObject({type:g.z.literal("felt.ready")}),lt=g.z.discriminatedUnion("type",[Lr,Sr,xr,...st.methods]),br=g.z.object({type:g.z.enum(lt.options.map(n=>n.shape.type.value))});function it(n){return{__error__:Mr(n)}}function Mr(n){return n instanceof Error?n.message:typeof n=="object"&&n!==null&&"message"in n?String(n.message):typeof n=="string"?n:"Unknown error"}0&&(module.exports={createMessageHandler});
1
+ "use strict";var oe=Object.defineProperty;var mt=Object.getOwnPropertyDescriptor;var gt=Object.getOwnPropertyNames;var yt=Object.prototype.hasOwnProperty;var dt=(n,l)=>{for(var P in l)oe(n,P,{get:l[P],enumerable:!0})},ut=(n,l,P,z)=>{if(l&&typeof l=="object"||typeof l=="function")for(let I of gt(l))!yt.call(n,I)&&I!==P&&oe(n,I,{get:()=>l[I],enumerable:!(z=mt(l,I))||z.enumerable});return n};var ht=n=>ut(oe({},"__esModule",{value:!0}),n);var Ir={};dt(Ir,{createMessageHandler:()=>Sr});module.exports=ht(Ir);var g=require("zod");var d=require("zod");var S=require("zod");function t(n,l){return S.z.strictObject({type:S.z.literal(n),params:l})}function h(n,l){return S.z.strictObject({eventName:S.z.literal(n),id:S.z.string(),options:l})}function p(n){return S.z.strictObject({eventName:S.z.literal(n),id:S.z.string()})}var s=require("zod"),H=s.z.number(),J=s.z.number(),Z=s.z.object({latitude:J,longitude:H}),T=s.z.tuple([H,J]),w=s.z.object({type:s.z.literal("Polygon"),coordinates:s.z.array(s.z.array(T).min(4).refine(n=>n[0][0]===n[n.length-1][0]&&n[0][1]===n[n.length-1][1],"The last point of each ring must be identical to the first"))}),q=s.z.object({type:s.z.literal("MultiPolygon"),coordinates:s.z.array(w.shape.coordinates)}),ft=s.z.object({type:s.z.literal("LineString"),coordinates:s.z.array(T).min(2)}),U=s.z.object({type:s.z.literal("MultiLineString"),coordinates:s.z.array(ft.shape.coordinates)}),fe=s.z.number().min(1).max(23),x=s.z.tuple([H,J,H,J]),E=s.z.object({show:s.z.array(s.z.string()).optional(),hide:s.z.array(s.z.string()).optional()}),St=s.z.enum(["asc","desc"]),W=s.z.object({attribute:s.z.string(),direction:St});var e=require("zod");var f=e.z.object({id:e.z.string(),groupId:e.z.string().nullable(),color:e.z.string(),name:e.z.string().nullable(),description:e.z.string().nullable(),attributes:e.z.record(e.z.string(),e.z.unknown()),interaction:e.z.enum(["default","locked"]).optional()}),$=e.z.object({imageUrl:e.z.string().nullable()}),ae=e.z.object({strokeOpacity:e.z.number(),strokeWidth:e.z.number(),strokeStyle:e.z.enum(["solid","dashed","dotted"])}),xt=e.z.enum(["meter","kilometer","foot","mile"]),_=f.extend($.shape).extend({type:e.z.literal("Place"),coordinates:T,symbol:e.z.string(),frame:e.z.enum(["frame-circle","frame-square"]).nullable(),hideLabel:e.z.boolean()}),O=f.extend($.shape).extend(ae.shape).extend({type:e.z.literal("Path"),coordinates:U.shape.coordinates,distanceMarker:e.z.boolean(),routingMode:e.z.enum(["driving","cycling","walking","flying"]).nullable(),endCaps:e.z.boolean()}),j=f.extend($.shape).extend(ae.shape).extend({type:e.z.literal("Polygon"),coordinates:w.shape.coordinates,fillOpacity:e.z.number().min(0).max(1),areaMarker:e.z.boolean()}),Q=f.extend($.shape).extend(ae.shape).extend({type:e.z.literal("Circle"),center:T,radius:e.z.number(),radiusMarker:e.z.boolean(),radiusDisplayAngle:e.z.number(),radiusDisplayUnit:xt.nullable(),fillOpacity:e.z.number().min(0).max(1)}),v=f.extend({type:e.z.literal("Marker"),coordinates:U.shape.coordinates,opacity:e.z.number().min(0).max(1),size:e.z.number().min(0).max(100),zoom:e.z.number().min(0).max(23)}),R=f.extend({type:e.z.literal("Highlighter"),coordinates:q.shape.coordinates,renderHoles:e.z.boolean(),opacity:e.z.number().min(0).max(1)}),Se=e.z.object({position:T,rotation:e.z.number(),scale:e.z.number(),zoom:e.z.number().min(0).max(23),text:e.z.string(),align:e.z.enum(["left","center","right"]),style:e.z.enum(["italic","light","regular","caps"]),name:e.z.string()}),re=f.extend(Se.shape).extend({type:e.z.literal("Text")}),ne=f.extend(Se.shape).extend({type:e.z.literal("Note"),widthScale:e.z.number().min(0)}),N=f.extend({type:e.z.literal("Image"),coordinates:U.shape.coordinates,imageUrl:e.z.string(),opacity:e.z.number().min(0).max(1)}).omit({color:!0}),Lt=f.extend({type:e.z.literal("Link"),coordinates:U.shape.coordinates,url:e.z.string()}),F={type:!0,coordinates:!0},L={id:!0},ie=_.partial().extend(_.pick(F).shape).omit(L),K=O.partial().extend(O.pick(F).shape).omit(L),se=j.partial().extend(j.pick(F).shape).omit(L),le=Q.partial().extend(Q.pick({type:!0,center:!0,radius:!0}).shape).omit(L),pe=v.partial().extend(v.pick(F).shape).omit(L),ce=R.partial().extend(R.pick(F).shape).omit(L),me=re.partial().omit({...L,name:!0,type:!0}).extend({type:e.z.literal("Text"),text:e.z.string()}),ge=ne.partial().omit({...L,name:!0,type:!0}).extend({type:e.z.literal("Note"),text:e.z.string()}),bt=N.partial().extend(N.pick({...F,imageUrl:!0}).shape).omit(L),xe=e.z.discriminatedUnion("type",[ie,K,se,le,pe,ce,bt,me,ge]);var kr=O.omit({coordinates:!0}),Vr=j.omit({coordinates:!0});var wr=v.omit({coordinates:!0}),Ur=R.omit({coordinates:!0});var Or=N.omit({coordinates:!0}),jr=Lt.omit({coordinates:!0}),b={type:!0,id:!0},Mt=_.partial().extend(_.pick(b).shape),Ct=O.partial().extend(O.pick(b).shape),Gt=j.partial().extend(j.pick(b).shape),It=Q.partial().extend(Q.pick(b).shape),Tt=v.partial().extend(v.pick(b).shape),Pt=R.partial().extend(R.pick(b).shape),Et=re.partial().extend(re.pick(b).shape).omit({name:!0}),zt=ne.partial().extend(ne.pick(b).shape).omit({name:!0}),Ft=N.partial().extend(N.pick(b).shape),Le=e.z.discriminatedUnion("type",[Mt,Ct,Gt,It,Tt,Pt,Et,zt,Ft]),be=e.z.object({ids:e.z.array(e.z.string()).optional()}),Me=e.z.object({ids:e.z.array(e.z.string()).optional()});var kt=t("getElement",d.z.string()),Vt=t("getElementGeometry",d.z.string()),wt=t("getElements",be.optional()),Ut=t("getElementGroup",d.z.string()),Ot=t("getElementGroups",Me.optional()),jt=t("setElementGroupVisibility",E),vt=h("onElementChange",d.z.object({id:d.z.string()})),Rt=p("onElementCreate"),Nt=p("onElementCreateEnd"),At=h("onElementDelete",d.z.object({id:d.z.string()})),Bt=h("onElementGroupChange",d.z.object({id:d.z.string()})),Dt=t("createElement",xe),Ht=t("updateElement",Le),Jt=t("deleteElement",d.z.string()),Ce={methods:[kt,Vt,wt,Ut,Ot,jt,Dt,Ht,Jt],listeners:[vt,Rt,Nt,At,Bt]};var Zt=p("onPointerClick"),qt=p("onPointerMove"),Ge={methods:null,listeners:[Zt,qt]};var a=require("zod");var i=require("zod");var Wt=i.z.enum(["in","ni"]),_t=i.z.enum(["lt","gt","le","ge","eq","ne","cn","nc","is","isnt"]),Zr=i.z.enum(["and","or"]),Ie=i.z.union([i.z.number(),i.z.string(),i.z.boolean(),i.z.null()]),Te=i.z.string().or(i.z.null()),Qt=i.z.tuple([Te,Wt,i.z.array(Ie).or(i.z.null())]),$t=i.z.tuple([Te,_t,Ie]),ye=i.z.union([Qt,$t]),de=i.z.tuple([i.z.lazy(()=>i.z.union([de,ye,i.z.null(),i.z.boolean()])),i.z.enum(["and","or"]),i.z.lazy(()=>i.z.union([de,ye,i.z.null(),i.z.boolean()]))]),M=i.z.union([de,ye,i.z.null(),i.z.boolean()]),C=i.z.union([x,w,q,i.z.array(T)]);var o=require("zod");var Pe=o.z.enum(["avg","max","min","sum","median"]),Ee=o.z.enum(["avg","max","min","sum","count"]),Kt=o.z.object({method:Pe,attribute:o.z.string()}),Xt=o.z.object({methods:o.z.array(o.z.union([Pe,o.z.literal("count")])),attribute:o.z.string().optional()}),ze=o.z.object({boundary:C.optional(),filters:M.optional(),aggregation:Kt.optional()}),Fe=o.z.object({layerId:o.z.string(),attribute:o.z.string(),limit:o.z.number().optional(),boundary:C.optional(),filters:M.optional(),values:ze.optional()}),_r=o.z.object({key:o.z.union([o.z.number(),o.z.string(),o.z.boolean()]),value:o.z.number().nullable()}),Yt=o.z.object({type:o.z.literal("equal-intervals"),count:o.z.number()}),eo=o.z.object({type:o.z.literal("time-interval"),interval:o.z.enum(["hour","day","week","month","year"])}),ke=o.z.object({layerId:o.z.string(),attribute:o.z.string(),steps:o.z.union([Yt,eo,o.z.array(o.z.number())]),boundary:C.optional(),filters:M.optional(),values:ze.optional()}),Qr=o.z.object({min:o.z.number(),max:o.z.number(),value:o.z.number()}),Ve=o.z.object({layerId:o.z.string(),boundary:C.optional(),filters:M.optional(),aggregation:Xt}),we=o.z.enum(["h3"]),to=o.z.object({type:we,resolution:o.z.number(),method:Ee.extract(["count"])}),oo=o.z.object({type:we,resolution:o.z.number(),method:Ee.exclude(["count"]),attribute:o.z.string()}),ro=o.z.union([to,oo]),Ue=o.z.object({layerId:o.z.string(),boundary:C.optional(),filters:M.optional(),gridConfig:ro});var r=require("zod");var Xr=r.z.enum(["processing","completed","failed","incomplete"]),Oe=r.z.object({type:r.z.literal("geoJsonUrl"),url:r.z.string().url(),refreshInterval:r.z.number().min(250).max(5*60*1e3).nullable().optional()}),je=r.z.object({type:r.z.literal("geoJsonData"),data:r.z.object({}).passthrough().or(r.z.instanceof(ArrayBuffer))}),ve=r.z.object({type:r.z.literal("geoJsonFile"),file:r.z.instanceof(File)}),Re=r.z.object({id:r.z.string(),style:r.z.object({}).passthrough().optional(),shownInLegend:r.z.boolean().optional(),name:r.z.string().optional(),caption:r.z.string().optional(),description:r.z.string().optional(),bounds:x.optional(),source:r.z.union([Oe,je,ve]).optional()}),Ne=r.z.object({ids:r.z.array(r.z.string()).optional()}),Ae=r.z.object({ids:r.z.array(r.z.string()).optional()}),k=r.z.object({id:r.z.string(),layerId:r.z.string()}),Be=r.z.object({ids:k.array().optional(),layerIds:r.z.string().array().optional()}),De=r.z.object({layerIds:r.z.array(r.z.string()).optional(),areaQuery:r.z.union([r.z.object({coordinates:Z}),r.z.object({boundary:x})]).optional()}),no=r.z.object({Point:r.z.object({}).passthrough().optional(),Line:r.z.object({}).passthrough().optional(),Polygon:r.z.object({}).passthrough().optional()}),He=r.z.object({source:r.z.union([Oe,je,ve]),name:r.z.string(),bounds:x.optional(),caption:r.z.string().optional(),description:r.z.string().optional(),geometryStyles:no.optional()});var ao=t("getLayer",a.z.string()),io=t("getLayers",Ne.optional()),so=t("setLayerVisibility",E),lo=h("onLayerChange",a.z.object({id:a.z.string()})),po=t("setLayerStyle",a.z.object({id:a.z.string(),style:a.z.object({}).passthrough()})),co=t("setLayerLegendVisibility",E),mo=t("createLayersFromGeoJson",He),go=t("updateLayer",Re),yo=t("deleteLayer",a.z.string()),uo=t("getLayerGroup",a.z.string()),ho=t("getLayerGroups",Ae.optional()),fo=t("setLayerGroupVisibility",E),So=t("setLayerGroupLegendVisibility",E),xo=h("onLayerGroupChange",a.z.object({id:a.z.string()})),Lo=t("getLegendItem",k),bo=t("getLegendItems",Be.optional()),Mo=h("onLegendItemChange",k),Co=t("setLegendItemVisibility",a.z.object({show:k.array().optional(),hide:k.array().optional()})),Go=t("getLayerFilters",a.z.string()),Io=t("setLayerFilters",a.z.object({layerId:a.z.string(),filters:M,note:a.z.string().optional()})),To=h("onLayerFiltersChange",a.z.object({layerId:a.z.string()})),Po=t("getLayerBoundaries",a.z.string()),Eo=t("setLayerBoundary",a.z.object({layerIds:a.z.array(a.z.string()),boundary:C.nullable()})),zo=h("onLayerBoundariesChange",a.z.object({layerId:a.z.string()})),Fo=t("getRenderedFeatures",De.optional()),ko=t("getFeature",a.z.object({id:a.z.string().or(a.z.number()),layerId:a.z.string()})),Vo=t("getFeatures",a.z.object({layerId:a.z.string(),filters:M.optional(),sorting:W.optional(),boundary:C.optional(),search:a.z.string().optional(),pagination:a.z.string().optional().nullish()})),wo=t("getGeoJsonFeature",a.z.object({id:a.z.string().or(a.z.number()),layerId:a.z.string()})),Uo=t("getCategoryData",Fe),Oo=t("getHistogramData",ke),jo=t("getAggregates",Ve),vo=t("getPrecomputedAggregates",Ue),Ro=t("getLayerSchema",a.z.string()),Je={methods:[ao,io,so,po,co,mo,yo,go,uo,ho,fo,So,Lo,bo,Co,Go,Io,Po,Eo,Fo,ko,Vo,wo,Uo,Oo,jo,vo,Ro],listeners:[lo,xo,Mo,To,zo]};var Ze=require("zod");var No=t("getMapDetails",Ze.z.undefined()),qe={methods:[No],listeners:[]};var A=require("zod");var G=require("zod"),We=G.z.object({id:G.z.string().or(G.z.number()),layerId:G.z.string(),showPopup:G.z.boolean().optional(),fitViewport:G.z.boolean().or(G.z.object({maxZoom:G.z.number()})).optional()});var Ao=t("getSelection",A.z.undefined()),Bo=p("onSelectionChange"),Do=t("selectFeature",We),Ho=t("clearSelection",A.z.object({features:A.z.boolean().optional(),elements:A.z.boolean().optional()}).optional()),_e={methods:[Ao,Do,Ho],listeners:[Bo]};var Ye=require("zod");var c=require("zod");var Qe=["circle","highlighter","line","marker","note","pin","polygon","route","text"],Jo=[...Qe,"link"],$e=c.z.enum(Jo),Ke=c.z.enum(Qe),Zo=ie.pick({color:!0,symbol:!0,frame:!0}).extend({afterCreation:c.z.enum(["enter name","add another","select"])}).required(),qo=K.pick({color:!0,strokeOpacity:!0,strokeWidth:!0,strokeStyle:!0,distanceMarker:!0}).required(),Wo=K.pick({color:!0,routingMode:!0,strokeOpacity:!0,strokeWidth:!0,strokeStyle:!0,distanceMarker:!0,endCaps:!0}).required(),_o=se.pick({color:!0,fillOpacity:!0,strokeOpacity:!0,strokeWidth:!0,strokeStyle:!0,areaMarker:!0}).required(),Qo=le.pick({color:!0,fillOpacity:!0,strokeOpacity:!0,strokeWidth:!0,strokeStyle:!0,radiusMarker:!0}).required(),$o=pe.pick({color:!0,opacity:!0,size:!0}).required(),Ko=ce.pick({color:!0,opacity:!0,renderHoles:!0}).extend({size:c.z.number().min(0).max(200)}).required(),Xo=me.pick({color:!0,align:!0,style:!0}).required(),Yo=ge.pick({color:!0,align:!0,style:!0}).required(),Xe=c.z.discriminatedUnion("tool",[Zo.partial().extend({tool:c.z.literal("pin")}),qo.partial().extend({tool:c.z.literal("line")}),Wo.partial().extend({tool:c.z.literal("route")}),_o.partial().extend({tool:c.z.literal("polygon")}),Qo.partial().extend({tool:c.z.literal("circle")}),$o.partial().extend({tool:c.z.literal("marker")}),Ko.partial().extend({tool:c.z.literal("highlighter")}),Xo.partial().extend({tool:c.z.literal("text")}),Yo.partial().extend({tool:c.z.literal("note")})]);var er=t("setTool",$e.nullable()),tr=t("getTool",Ye.z.undefined()),or=p("onToolChange"),rr=t("setToolSettings",Xe),nr=t("getToolSettings",Ke),ar=p("onToolSettingsChange"),et={methods:[er,tr,rr,nr],listeners:[or,ar]};var X=require("zod");var m=require("zod"),tt=m.z.object({showLegend:m.z.boolean().optional(),cooperativeGestures:m.z.boolean().optional(),fullScreenButton:m.z.boolean().optional(),geolocation:m.z.boolean().optional(),zoomControls:m.z.boolean().optional(),scaleBar:m.z.boolean().optional()}),ot=m.z.object({featureSelectPanel:m.z.boolean().optional(),featureHoverPanel:m.z.boolean().optional(),elementSelectPanel:m.z.boolean().optional(),linkClickOpen:m.z.boolean().optional(),imageLightboxOpen:m.z.boolean().optional()});var ir=t("updateUiControls",tt),sr=t("setOnMapInteractionsUi",ot),lr=t("showLayerDataTable",X.z.object({layerId:X.z.string(),sorting:W.optional()}).optional()),pr=t("hideLayerDataTable",X.z.undefined()),rt={methods:[ir,sr,lr,pr],listeners:null};var ue=require("zod");var B=require("zod");var Y=B.z.object({center:Z,zoom:fe}),nt=B.z.object({center:Y.shape.center.optional(),zoom:Y.shape.zoom.optional()}),at=B.z.object({minZoom:Y.shape.zoom.nullish(),maxZoom:Y.shape.zoom.nullish(),bounds:x.nullish()}).nullable(),it=B.z.object({bounds:x});var cr=t("getViewport",ue.z.undefined()),mr=t("setViewport",nt),gr=t("getViewportConstraints",ue.z.undefined()),yr=t("setViewportConstraints",at),dr=t("fitViewportToBounds",it),ur=p("onViewportMove"),hr=p("onViewportMoveEnd"),fr=p("onMapIdle"),st={methods:[mr,cr,gr,yr,dr],listeners:[ur,hr,fr]};var he=[rt,st,Je,Ce,_e,Ge,et,qe];function Sr(n,l,P){let z=new Map;async function I(u){if(!Cr.safeParse(u.data).success){P?.onUnknownMessage?.(u.data);return}let D=ct.safeParse(u.data);if(!D.success){P?.onInvalidMessage?.(u.data,D.error),u.ports[0]?.postMessage(lt(D.error.message));return}let{data:y}=D;if(y.type==="felt.ready")u.ports[0]?.postMessage(!0);else if(y.type==="felt.addListener"){if(y.event.eventName==="")throw new Error("felt.addListener eventName cannot be empty");let V="options"in y.event?{options:"options"in y.event?y.event.options:void 0,handler:te=>{u.ports[0]?.postMessage(te)}}:{handler:te=>{u.ports[0]?.postMessage(te)}},ee=l.listeners[y.event.eventName](V);z.set(y.event.id,ee)}else if(y.type==="felt.removeListener")z.get(y.id)?.(),z.delete(y.id);else try{let V=l.methods[y.type],ee=await V(y.params);u.ports[0]?.postMessage(ee)}catch(V){u.ports[0]?.postMessage(lt(V))}}return n.addEventListener("message",I),()=>{n.removeEventListener("message",I)}}var pt={methods:he.map(n=>n.methods??[]).flat(),listeners:he.map(n=>n.listeners??[]).flat()},xr=g.z.discriminatedUnion("eventName",[g.z.strictObject({eventName:g.z.literal("")}),...pt.listeners]),Lr=g.z.strictObject({type:g.z.literal("felt.addListener"),event:xr}),br=g.z.strictObject({type:g.z.literal("felt.removeListener"),id:g.z.string()}),Mr=g.z.strictObject({type:g.z.literal("felt.ready")}),ct=g.z.discriminatedUnion("type",[Mr,Lr,br,...pt.methods]),Cr=g.z.object({type:g.z.enum(ct.options.map(n=>n.shape.type.value))});function lt(n){return{__error__:Gr(n)}}function Gr(n){return n instanceof Error?n.message:typeof n=="object"&&n!==null&&"message"in n?String(n.message):typeof n=="string"?n:"Unknown error"}0&&(module.exports={createMessageHandler});
@@ -1,5 +1,5 @@
1
1
  import { z, ZodError } from 'zod';
2
- import { bu as UnwrapPromise, F as FeltController, z as zInfer, c as ElementChangeCallbackParams, f as ElementGroupChangeCallbackParams, E as Element, D as MapInteractionEvent, $ as LayerChangeCallbackParams, a2 as LayerGroupChangeCallbackParams, a5 as LegendItemChangeCallbackParams, at as LayerFilters, as as LayerBoundaries, ap as FilterTernary, aM as EntityNode, bl as ToolType, bj as ToolSettingsChangeEvent, bs as ViewportState, bv as UnionToIntersection, bw as PromiseOrNot } from './controller-CmThLnnL.cjs';
2
+ import { bw as UnwrapPromise, F as FeltController, z as zInfer, c as ElementChangeCallbackParams, f as ElementGroupChangeCallbackParams, E as Element, D as MapInteractionEvent, $ as LayerChangeCallbackParams, a2 as LayerGroupChangeCallbackParams, a5 as LegendItemChangeCallbackParams, at as LayerFilters, as as LayerBoundaries, ap as FilterTernary, aO as EntityNode, bn as ToolType, bl as ToolSettingsChangeEvent, bu as ViewportState, bx as UnionToIntersection, by as PromiseOrNot } from './controller-o3EwSJvB.cjs';
3
3
 
4
4
  type FeltControllerFunctions = Omit<FeltController, "iframe">;
5
5
  type Method<TRequest extends {
@@ -3459,29 +3459,45 @@ declare const GetLayerPrecomputedCalculationMessage: z.ZodObject<{
3459
3459
  coordinates: [number, number][][][];
3460
3460
  }>, z.ZodArray<z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>, "many">]>>;
3461
3461
  filters: z.ZodOptional<z.ZodUnion<[z.ZodType<FilterTernary, z.ZodTypeDef, FilterTernary>, z.ZodUnion<[z.ZodTuple<[z.ZodUnion<[z.ZodString, z.ZodNull]>, z.ZodEnum<["in", "ni"]>, z.ZodUnion<[z.ZodArray<z.ZodUnion<[z.ZodNumber, z.ZodString, z.ZodBoolean, z.ZodNull]>, "many">, z.ZodNull]>], null>, z.ZodTuple<[z.ZodUnion<[z.ZodString, z.ZodNull]>, z.ZodEnum<["lt", "gt", "le", "ge", "eq", "ne", "cn", "nc", "is", "isnt"]>, z.ZodUnion<[z.ZodNumber, z.ZodString, z.ZodBoolean, z.ZodNull]>], null>]>, z.ZodNull, z.ZodBoolean]>>;
3462
- gridConfig: z.ZodObject<{
3462
+ gridConfig: z.ZodUnion<[z.ZodObject<{
3463
3463
  type: z.ZodEnum<["h3"]>;
3464
3464
  resolution: z.ZodNumber;
3465
- method: z.ZodEnum<["avg", "max", "min", "sum", "count"]>;
3466
- attribute: z.ZodOptional<z.ZodString>;
3465
+ method: z.ZodEnum<["count"]>;
3467
3466
  }, "strip", z.ZodTypeAny, {
3468
3467
  type: "h3";
3469
- method: "avg" | "max" | "min" | "sum" | "count";
3468
+ method: "count";
3470
3469
  resolution: number;
3471
- attribute?: string | undefined;
3472
3470
  }, {
3473
3471
  type: "h3";
3474
- method: "avg" | "max" | "min" | "sum" | "count";
3472
+ method: "count";
3475
3473
  resolution: number;
3476
- attribute?: string | undefined;
3477
- }>;
3474
+ }>, z.ZodObject<{
3475
+ type: z.ZodEnum<["h3"]>;
3476
+ resolution: z.ZodNumber;
3477
+ method: z.ZodEnum<["avg", "max", "min", "sum"]>;
3478
+ attribute: z.ZodString;
3479
+ }, "strip", z.ZodTypeAny, {
3480
+ type: "h3";
3481
+ attribute: string;
3482
+ method: "avg" | "max" | "min" | "sum";
3483
+ resolution: number;
3484
+ }, {
3485
+ type: "h3";
3486
+ attribute: string;
3487
+ method: "avg" | "max" | "min" | "sum";
3488
+ resolution: number;
3489
+ }>]>;
3478
3490
  }, "strip", z.ZodTypeAny, {
3479
3491
  layerId: string;
3480
3492
  gridConfig: {
3481
3493
  type: "h3";
3482
- method: "avg" | "max" | "min" | "sum" | "count";
3494
+ method: "count";
3495
+ resolution: number;
3496
+ } | {
3497
+ type: "h3";
3498
+ attribute: string;
3499
+ method: "avg" | "max" | "min" | "sum";
3483
3500
  resolution: number;
3484
- attribute?: string | undefined;
3485
3501
  };
3486
3502
  boundary?: [number, number, number, number] | [number, number][] | {
3487
3503
  type: "Polygon";
@@ -3495,9 +3511,13 @@ declare const GetLayerPrecomputedCalculationMessage: z.ZodObject<{
3495
3511
  layerId: string;
3496
3512
  gridConfig: {
3497
3513
  type: "h3";
3498
- method: "avg" | "max" | "min" | "sum" | "count";
3514
+ method: "count";
3515
+ resolution: number;
3516
+ } | {
3517
+ type: "h3";
3518
+ attribute: string;
3519
+ method: "avg" | "max" | "min" | "sum";
3499
3520
  resolution: number;
3500
- attribute?: string | undefined;
3501
3521
  };
3502
3522
  boundary?: [number, number, number, number] | [number, number][] | {
3503
3523
  type: "Polygon";
@@ -3513,9 +3533,13 @@ declare const GetLayerPrecomputedCalculationMessage: z.ZodObject<{
3513
3533
  layerId: string;
3514
3534
  gridConfig: {
3515
3535
  type: "h3";
3516
- method: "avg" | "max" | "min" | "sum" | "count";
3536
+ method: "count";
3537
+ resolution: number;
3538
+ } | {
3539
+ type: "h3";
3540
+ attribute: string;
3541
+ method: "avg" | "max" | "min" | "sum";
3517
3542
  resolution: number;
3518
- attribute?: string | undefined;
3519
3543
  };
3520
3544
  boundary?: [number, number, number, number] | [number, number][] | {
3521
3545
  type: "Polygon";
@@ -3532,9 +3556,13 @@ declare const GetLayerPrecomputedCalculationMessage: z.ZodObject<{
3532
3556
  layerId: string;
3533
3557
  gridConfig: {
3534
3558
  type: "h3";
3535
- method: "avg" | "max" | "min" | "sum" | "count";
3559
+ method: "count";
3560
+ resolution: number;
3561
+ } | {
3562
+ type: "h3";
3563
+ attribute: string;
3564
+ method: "avg" | "max" | "min" | "sum";
3536
3565
  resolution: number;
3537
- attribute?: string | undefined;
3538
3566
  };
3539
3567
  boundary?: [number, number, number, number] | [number, number][] | {
3540
3568
  type: "Polygon";
package/dist/handler.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { z, ZodError } from 'zod';
2
- import { bu as UnwrapPromise, F as FeltController, z as zInfer, c as ElementChangeCallbackParams, f as ElementGroupChangeCallbackParams, E as Element, D as MapInteractionEvent, $ as LayerChangeCallbackParams, a2 as LayerGroupChangeCallbackParams, a5 as LegendItemChangeCallbackParams, at as LayerFilters, as as LayerBoundaries, ap as FilterTernary, aM as EntityNode, bl as ToolType, bj as ToolSettingsChangeEvent, bs as ViewportState, bv as UnionToIntersection, bw as PromiseOrNot } from './controller-CmThLnnL.js';
2
+ import { bw as UnwrapPromise, F as FeltController, z as zInfer, c as ElementChangeCallbackParams, f as ElementGroupChangeCallbackParams, E as Element, D as MapInteractionEvent, $ as LayerChangeCallbackParams, a2 as LayerGroupChangeCallbackParams, a5 as LegendItemChangeCallbackParams, at as LayerFilters, as as LayerBoundaries, ap as FilterTernary, aO as EntityNode, bn as ToolType, bl as ToolSettingsChangeEvent, bu as ViewportState, bx as UnionToIntersection, by as PromiseOrNot } from './controller-o3EwSJvB.js';
3
3
 
4
4
  type FeltControllerFunctions = Omit<FeltController, "iframe">;
5
5
  type Method<TRequest extends {
@@ -3459,29 +3459,45 @@ declare const GetLayerPrecomputedCalculationMessage: z.ZodObject<{
3459
3459
  coordinates: [number, number][][][];
3460
3460
  }>, z.ZodArray<z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>, "many">]>>;
3461
3461
  filters: z.ZodOptional<z.ZodUnion<[z.ZodType<FilterTernary, z.ZodTypeDef, FilterTernary>, z.ZodUnion<[z.ZodTuple<[z.ZodUnion<[z.ZodString, z.ZodNull]>, z.ZodEnum<["in", "ni"]>, z.ZodUnion<[z.ZodArray<z.ZodUnion<[z.ZodNumber, z.ZodString, z.ZodBoolean, z.ZodNull]>, "many">, z.ZodNull]>], null>, z.ZodTuple<[z.ZodUnion<[z.ZodString, z.ZodNull]>, z.ZodEnum<["lt", "gt", "le", "ge", "eq", "ne", "cn", "nc", "is", "isnt"]>, z.ZodUnion<[z.ZodNumber, z.ZodString, z.ZodBoolean, z.ZodNull]>], null>]>, z.ZodNull, z.ZodBoolean]>>;
3462
- gridConfig: z.ZodObject<{
3462
+ gridConfig: z.ZodUnion<[z.ZodObject<{
3463
3463
  type: z.ZodEnum<["h3"]>;
3464
3464
  resolution: z.ZodNumber;
3465
- method: z.ZodEnum<["avg", "max", "min", "sum", "count"]>;
3466
- attribute: z.ZodOptional<z.ZodString>;
3465
+ method: z.ZodEnum<["count"]>;
3467
3466
  }, "strip", z.ZodTypeAny, {
3468
3467
  type: "h3";
3469
- method: "avg" | "max" | "min" | "sum" | "count";
3468
+ method: "count";
3470
3469
  resolution: number;
3471
- attribute?: string | undefined;
3472
3470
  }, {
3473
3471
  type: "h3";
3474
- method: "avg" | "max" | "min" | "sum" | "count";
3472
+ method: "count";
3475
3473
  resolution: number;
3476
- attribute?: string | undefined;
3477
- }>;
3474
+ }>, z.ZodObject<{
3475
+ type: z.ZodEnum<["h3"]>;
3476
+ resolution: z.ZodNumber;
3477
+ method: z.ZodEnum<["avg", "max", "min", "sum"]>;
3478
+ attribute: z.ZodString;
3479
+ }, "strip", z.ZodTypeAny, {
3480
+ type: "h3";
3481
+ attribute: string;
3482
+ method: "avg" | "max" | "min" | "sum";
3483
+ resolution: number;
3484
+ }, {
3485
+ type: "h3";
3486
+ attribute: string;
3487
+ method: "avg" | "max" | "min" | "sum";
3488
+ resolution: number;
3489
+ }>]>;
3478
3490
  }, "strip", z.ZodTypeAny, {
3479
3491
  layerId: string;
3480
3492
  gridConfig: {
3481
3493
  type: "h3";
3482
- method: "avg" | "max" | "min" | "sum" | "count";
3494
+ method: "count";
3495
+ resolution: number;
3496
+ } | {
3497
+ type: "h3";
3498
+ attribute: string;
3499
+ method: "avg" | "max" | "min" | "sum";
3483
3500
  resolution: number;
3484
- attribute?: string | undefined;
3485
3501
  };
3486
3502
  boundary?: [number, number, number, number] | [number, number][] | {
3487
3503
  type: "Polygon";
@@ -3495,9 +3511,13 @@ declare const GetLayerPrecomputedCalculationMessage: z.ZodObject<{
3495
3511
  layerId: string;
3496
3512
  gridConfig: {
3497
3513
  type: "h3";
3498
- method: "avg" | "max" | "min" | "sum" | "count";
3514
+ method: "count";
3515
+ resolution: number;
3516
+ } | {
3517
+ type: "h3";
3518
+ attribute: string;
3519
+ method: "avg" | "max" | "min" | "sum";
3499
3520
  resolution: number;
3500
- attribute?: string | undefined;
3501
3521
  };
3502
3522
  boundary?: [number, number, number, number] | [number, number][] | {
3503
3523
  type: "Polygon";
@@ -3513,9 +3533,13 @@ declare const GetLayerPrecomputedCalculationMessage: z.ZodObject<{
3513
3533
  layerId: string;
3514
3534
  gridConfig: {
3515
3535
  type: "h3";
3516
- method: "avg" | "max" | "min" | "sum" | "count";
3536
+ method: "count";
3537
+ resolution: number;
3538
+ } | {
3539
+ type: "h3";
3540
+ attribute: string;
3541
+ method: "avg" | "max" | "min" | "sum";
3517
3542
  resolution: number;
3518
- attribute?: string | undefined;
3519
3543
  };
3520
3544
  boundary?: [number, number, number, number] | [number, number][] | {
3521
3545
  type: "Polygon";
@@ -3532,9 +3556,13 @@ declare const GetLayerPrecomputedCalculationMessage: z.ZodObject<{
3532
3556
  layerId: string;
3533
3557
  gridConfig: {
3534
3558
  type: "h3";
3535
- method: "avg" | "max" | "min" | "sum" | "count";
3559
+ method: "count";
3560
+ resolution: number;
3561
+ } | {
3562
+ type: "h3";
3563
+ attribute: string;
3564
+ method: "avg" | "max" | "min" | "sum";
3536
3565
  resolution: number;
3537
- attribute?: string | undefined;
3538
3566
  };
3539
3567
  boundary?: [number, number, number, number] | [number, number][] | {
3540
3568
  type: "Polygon";
package/dist/handler.js CHANGED
@@ -1 +1 @@
1
- import{z as g}from"zod";import{z as h}from"zod";import{z as M}from"zod";function t(a,T){return M.strictObject({type:M.literal(a),params:T})}function d(a,T){return M.strictObject({eventName:M.literal(a),id:M.string(),options:T})}function l(a){return M.strictObject({eventName:M.literal(a),id:M.string()})}import{z as s}from"zod";var R=s.number(),N=s.number(),A=s.object({latitude:N,longitude:R}),C=s.tuple([R,N]),F=s.object({type:s.literal("Polygon"),coordinates:s.array(s.array(C).min(4).refine(a=>a[0][0]===a[a.length-1][0]&&a[0][1]===a[a.length-1][1],"The last point of each ring must be identical to the first"))}),B=s.object({type:s.literal("MultiPolygon"),coordinates:s.array(F.shape.coordinates)}),it=s.object({type:s.literal("LineString"),coordinates:s.array(C).min(2)}),k=s.object({type:s.literal("MultiLineString"),coordinates:s.array(it.shape.coordinates)}),ue=s.number().min(1).max(23),f=s.tuple([R,N,R,N]),I=s.object({show:s.array(s.string()).optional(),hide:s.array(s.string()).optional()}),st=s.enum(["asc","desc"]),D=s.object({attribute:s.string(),direction:st});import{z as e}from"zod";var u=e.object({id:e.string(),groupId:e.string().nullable(),color:e.string(),name:e.string().nullable(),description:e.string().nullable(),attributes:e.record(e.string(),e.unknown()),interaction:e.enum(["default","locked"]).optional()}),Z=e.object({imageUrl:e.string().nullable()}),te=e.object({strokeOpacity:e.number(),strokeWidth:e.number(),strokeStyle:e.enum(["solid","dashed","dotted"])}),lt=e.enum(["meter","kilometer","foot","mile"]),H=u.extend(Z.shape).extend({type:e.literal("Place"),coordinates:C,symbol:e.string(),frame:e.enum(["frame-circle","frame-square"]).nullable(),hideLabel:e.boolean()}),V=u.extend(Z.shape).extend(te.shape).extend({type:e.literal("Path"),coordinates:k.shape.coordinates,distanceMarker:e.boolean(),routingMode:e.enum(["driving","cycling","walking","flying"]).nullable(),endCaps:e.boolean()}),w=u.extend(Z.shape).extend(te.shape).extend({type:e.literal("Polygon"),coordinates:F.shape.coordinates,fillOpacity:e.number().min(0).max(1),areaMarker:e.boolean()}),J=u.extend(Z.shape).extend(te.shape).extend({type:e.literal("Circle"),center:C,radius:e.number(),radiusMarker:e.boolean(),radiusDisplayAngle:e.number(),radiusDisplayUnit:lt.nullable(),fillOpacity:e.number().min(0).max(1)}),U=u.extend({type:e.literal("Marker"),coordinates:k.shape.coordinates,opacity:e.number().min(0).max(1),size:e.number().min(0).max(100),zoom:e.number().min(0).max(23)}),O=u.extend({type:e.literal("Highlighter"),coordinates:B.shape.coordinates,renderHoles:e.boolean(),opacity:e.number().min(0).max(1)}),he=e.object({position:C,rotation:e.number(),scale:e.number(),zoom:e.number().min(0).max(23),text:e.string(),align:e.enum(["left","center","right"]),style:e.enum(["italic","light","regular","caps"]),name:e.string()}),Y=u.extend(he.shape).extend({type:e.literal("Text")}),ee=u.extend(he.shape).extend({type:e.literal("Note"),widthScale:e.number().min(0)}),v=u.extend({type:e.literal("Image"),coordinates:k.shape.coordinates,imageUrl:e.string(),opacity:e.number().min(0).max(1)}).omit({color:!0}),pt=u.extend({type:e.literal("Link"),coordinates:k.shape.coordinates,url:e.string()}),P={type:!0,coordinates:!0},S={id:!0},oe=H.partial().extend(H.pick(P).shape).omit(S),q=V.partial().extend(V.pick(P).shape).omit(S),re=w.partial().extend(w.pick(P).shape).omit(S),ne=J.partial().extend(J.pick({type:!0,center:!0,radius:!0}).shape).omit(S),ae=U.partial().extend(U.pick(P).shape).omit(S),ie=O.partial().extend(O.pick(P).shape).omit(S),se=Y.partial().omit({...S,name:!0,type:!0}).extend({type:e.literal("Text"),text:e.string()}),le=ee.partial().omit({...S,name:!0,type:!0}).extend({type:e.literal("Note"),text:e.string()}),ct=v.partial().extend(v.pick({...P,imageUrl:!0}).shape).omit(S),fe=e.discriminatedUnion("type",[oe,q,re,ne,ae,ie,ct,se,le]);var Mr=V.omit({coordinates:!0}),Cr=w.omit({coordinates:!0});var Gr=U.omit({coordinates:!0}),Ir=O.omit({coordinates:!0});var Tr=v.omit({coordinates:!0}),Pr=pt.omit({coordinates:!0}),x={type:!0,id:!0},mt=H.partial().extend(H.pick(x).shape),gt=V.partial().extend(V.pick(x).shape),yt=w.partial().extend(w.pick(x).shape),dt=J.partial().extend(J.pick(x).shape),ut=U.partial().extend(U.pick(x).shape),ht=O.partial().extend(O.pick(x).shape),ft=Y.partial().extend(Y.pick(x).shape).omit({name:!0}),St=ee.partial().extend(ee.pick(x).shape).omit({name:!0}),xt=v.partial().extend(v.pick(x).shape),Se=e.discriminatedUnion("type",[mt,gt,yt,dt,ut,ht,ft,St,xt]),xe=e.object({ids:e.array(e.string()).optional()}),Le=e.object({ids:e.array(e.string()).optional()});var Lt=t("getElement",h.string()),bt=t("getElementGeometry",h.string()),Mt=t("getElements",xe.optional()),Ct=t("getElementGroup",h.string()),Gt=t("getElementGroups",Le.optional()),It=t("setElementGroupVisibility",I),Tt=d("onElementChange",h.object({id:h.string()})),Pt=l("onElementCreate"),Et=l("onElementCreateEnd"),zt=d("onElementDelete",h.object({id:h.string()})),Ft=d("onElementGroupChange",h.object({id:h.string()})),kt=t("createElement",fe),Vt=t("updateElement",Se),wt=t("deleteElement",h.string()),be={methods:[Lt,bt,Mt,Ct,Gt,It,kt,Vt,wt],listeners:[Tt,Pt,Et,zt,Ft]};var Ut=l("onPointerClick"),Ot=l("onPointerMove"),Me={methods:null,listeners:[Ut,Ot]};import{z as n}from"zod";import{z as i}from"zod";var vt=i.enum(["in","ni"]),jt=i.enum(["lt","gt","le","ge","eq","ne","cn","nc","is","isnt"]),Rr=i.enum(["and","or"]),Ce=i.union([i.number(),i.string(),i.boolean(),i.null()]),Ge=i.string().or(i.null()),Rt=i.tuple([Ge,vt,i.array(Ce).or(i.null())]),Nt=i.tuple([Ge,jt,Ce]),pe=i.union([Rt,Nt]),ce=i.tuple([i.lazy(()=>i.union([ce,pe,i.null(),i.boolean()])),i.enum(["and","or"]),i.lazy(()=>i.union([ce,pe,i.null(),i.boolean()]))]),L=i.union([ce,pe,i.null(),i.boolean()]),b=i.union([f,F,B,i.array(C)]);import{z as r}from"zod";var Ie=r.enum(["avg","max","min","sum","median"]),At=r.enum(["avg","max","min","sum","count"]),Bt=r.object({method:Ie,attribute:r.string()}),Dt=r.object({methods:r.array(r.union([Ie,r.literal("count")])),attribute:r.string().optional()}),Te=r.object({boundary:b.optional(),filters:L.optional(),aggregation:Bt.optional()}),Pe=r.object({layerId:r.string(),attribute:r.string(),limit:r.number().optional(),boundary:b.optional(),filters:L.optional(),values:Te.optional()}),Dr=r.object({key:r.union([r.number(),r.string(),r.boolean()]),value:r.number().nullable()}),Ht=r.object({type:r.literal("equal-intervals"),count:r.number()}),Jt=r.object({type:r.literal("time-interval"),interval:r.enum(["hour","day","week","month","year"])}),Ee=r.object({layerId:r.string(),attribute:r.string(),steps:r.union([Ht,Jt,r.array(r.number())]),boundary:b.optional(),filters:L.optional(),values:Te.optional()}),Hr=r.object({min:r.number(),max:r.number(),value:r.number()}),ze=r.object({layerId:r.string(),boundary:b.optional(),filters:L.optional(),aggregation:Dt}),Zt=r.enum(["h3"]),qt=r.object({type:Zt,resolution:r.number(),method:At,attribute:r.string().optional()}),Fe=r.object({layerId:r.string(),boundary:b.optional(),filters:L.optional(),gridConfig:qt});import{z as o}from"zod";var Wr=o.enum(["processing","completed","failed","incomplete"]),ke=o.object({type:o.literal("geoJsonUrl"),url:o.string().url(),refreshInterval:o.number().min(250).max(5*60*1e3).nullable().optional()}),Ve=o.object({type:o.literal("geoJsonData"),data:o.object({}).passthrough().or(o.instanceof(ArrayBuffer))}),we=o.object({type:o.literal("geoJsonFile"),file:o.instanceof(File)}),Ue=o.object({id:o.string(),style:o.object({}).passthrough().optional(),shownInLegend:o.boolean().optional(),name:o.string().optional(),caption:o.string().optional(),description:o.string().optional(),bounds:f.optional(),source:o.union([ke,Ve,we]).optional()}),Oe=o.object({ids:o.array(o.string()).optional()}),ve=o.object({ids:o.array(o.string()).optional()}),E=o.object({id:o.string(),layerId:o.string()}),je=o.object({ids:E.array().optional(),layerIds:o.string().array().optional()}),Re=o.object({layerIds:o.array(o.string()).optional(),areaQuery:o.union([o.object({coordinates:A}),o.object({boundary:f})]).optional()}),Wt=o.object({Point:o.object({}).passthrough().optional(),Line:o.object({}).passthrough().optional(),Polygon:o.object({}).passthrough().optional()}),Ne=o.object({source:o.union([ke,Ve,we]),name:o.string(),bounds:f.optional(),caption:o.string().optional(),description:o.string().optional(),geometryStyles:Wt.optional()});var _t=t("getLayer",n.string()),Qt=t("getLayers",Oe.optional()),$t=t("setLayerVisibility",I),Kt=d("onLayerChange",n.object({id:n.string()})),Xt=t("setLayerStyle",n.object({id:n.string(),style:n.object({}).passthrough()})),Yt=t("setLayerLegendVisibility",I),eo=t("createLayersFromGeoJson",Ne),to=t("updateLayer",Ue),oo=t("deleteLayer",n.string()),ro=t("getLayerGroup",n.string()),no=t("getLayerGroups",ve.optional()),ao=t("setLayerGroupVisibility",I),io=t("setLayerGroupLegendVisibility",I),so=d("onLayerGroupChange",n.object({id:n.string()})),lo=t("getLegendItem",E),po=t("getLegendItems",je.optional()),co=d("onLegendItemChange",E),mo=t("setLegendItemVisibility",n.object({show:E.array().optional(),hide:E.array().optional()})),go=t("getLayerFilters",n.string()),yo=t("setLayerFilters",n.object({layerId:n.string(),filters:L,note:n.string().optional()})),uo=d("onLayerFiltersChange",n.object({layerId:n.string()})),ho=t("getLayerBoundaries",n.string()),fo=t("setLayerBoundary",n.object({layerIds:n.array(n.string()),boundary:b.nullable()})),So=d("onLayerBoundariesChange",n.object({layerId:n.string()})),xo=t("getRenderedFeatures",Re.optional()),Lo=t("getFeature",n.object({id:n.string().or(n.number()),layerId:n.string()})),bo=t("getFeatures",n.object({layerId:n.string(),filters:L.optional(),sorting:D.optional(),boundary:b.optional(),search:n.string().optional(),pagination:n.string().optional().nullish()})),Mo=t("getGeoJsonFeature",n.object({id:n.string().or(n.number()),layerId:n.string()})),Co=t("getCategoryData",Pe),Go=t("getHistogramData",Ee),Io=t("getAggregates",ze),To=t("getPrecomputedAggregates",Fe),Po=t("getLayerSchema",n.string()),Ae={methods:[_t,Qt,$t,Xt,Yt,eo,oo,to,ro,no,ao,io,lo,po,mo,go,yo,ho,fo,xo,Lo,bo,Mo,Co,Go,Io,To,Po],listeners:[Kt,so,co,uo,So]};import{z as Eo}from"zod";var zo=t("getMapDetails",Eo.undefined()),Be={methods:[zo],listeners:[]};import{z as W}from"zod";import{z as G}from"zod";var De=G.object({id:G.string().or(G.number()),layerId:G.string(),showPopup:G.boolean().optional(),fitViewport:G.boolean().or(G.object({maxZoom:G.number()})).optional()});var Fo=t("getSelection",W.undefined()),ko=l("onSelectionChange"),Vo=t("selectFeature",De),wo=t("clearSelection",W.object({features:W.boolean().optional(),elements:W.boolean().optional()}).optional()),He={methods:[Fo,Vo,wo],listeners:[ko]};import{z as Jo}from"zod";import{z as p}from"zod";var Je=["circle","highlighter","line","marker","note","pin","polygon","route","text"],Uo=[...Je,"link"],Ze=p.enum(Uo),qe=p.enum(Je),Oo=oe.pick({color:!0,symbol:!0,frame:!0}).extend({afterCreation:p.enum(["enter name","add another","select"])}).required(),vo=q.pick({color:!0,strokeOpacity:!0,strokeWidth:!0,strokeStyle:!0,distanceMarker:!0}).required(),jo=q.pick({color:!0,routingMode:!0,strokeOpacity:!0,strokeWidth:!0,strokeStyle:!0,distanceMarker:!0,endCaps:!0}).required(),Ro=re.pick({color:!0,fillOpacity:!0,strokeOpacity:!0,strokeWidth:!0,strokeStyle:!0,areaMarker:!0}).required(),No=ne.pick({color:!0,fillOpacity:!0,strokeOpacity:!0,strokeWidth:!0,strokeStyle:!0,radiusMarker:!0}).required(),Ao=ae.pick({color:!0,opacity:!0,size:!0}).required(),Bo=ie.pick({color:!0,opacity:!0,renderHoles:!0}).extend({size:p.number().min(0).max(200)}).required(),Do=se.pick({color:!0,align:!0,style:!0}).required(),Ho=le.pick({color:!0,align:!0,style:!0}).required(),We=p.discriminatedUnion("tool",[Oo.partial().extend({tool:p.literal("pin")}),vo.partial().extend({tool:p.literal("line")}),jo.partial().extend({tool:p.literal("route")}),Ro.partial().extend({tool:p.literal("polygon")}),No.partial().extend({tool:p.literal("circle")}),Ao.partial().extend({tool:p.literal("marker")}),Bo.partial().extend({tool:p.literal("highlighter")}),Do.partial().extend({tool:p.literal("text")}),Ho.partial().extend({tool:p.literal("note")})]);var Zo=t("setTool",Ze.nullable()),qo=t("getTool",Jo.undefined()),Wo=l("onToolChange"),_o=t("setToolSettings",We),Qo=t("getToolSettings",qe),$o=l("onToolSettingsChange"),_e={methods:[Zo,qo,_o,Qo],listeners:[Wo,$o]};import{z as me}from"zod";import{z as m}from"zod";var Qe=m.object({showLegend:m.boolean().optional(),cooperativeGestures:m.boolean().optional(),fullScreenButton:m.boolean().optional(),geolocation:m.boolean().optional(),zoomControls:m.boolean().optional(),scaleBar:m.boolean().optional()}),$e=m.object({featureSelectPanel:m.boolean().optional(),featureHoverPanel:m.boolean().optional(),elementSelectPanel:m.boolean().optional(),linkClickOpen:m.boolean().optional(),imageLightboxOpen:m.boolean().optional()});var Ko=t("updateUiControls",Qe),Xo=t("setOnMapInteractionsUi",$e),Yo=t("showLayerDataTable",me.object({layerId:me.string(),sorting:D.optional()}).optional()),er=t("hideLayerDataTable",me.undefined()),Ke={methods:[Ko,Xo,Yo,er],listeners:null};import{z as tt}from"zod";import{z as Q}from"zod";var _=Q.object({center:A,zoom:ue}),Xe=Q.object({center:_.shape.center.optional(),zoom:_.shape.zoom.optional()}),Ye=Q.object({minZoom:_.shape.zoom.nullish(),maxZoom:_.shape.zoom.nullish(),bounds:f.nullish()}).nullable(),et=Q.object({bounds:f});var tr=t("getViewport",tt.undefined()),or=t("setViewport",Xe),rr=t("getViewportConstraints",tt.undefined()),nr=t("setViewportConstraints",Ye),ar=t("fitViewportToBounds",et),ir=l("onViewportMove"),sr=l("onViewportMoveEnd"),lr=l("onMapIdle"),ot={methods:[or,tr,rr,nr,ar],listeners:[ir,sr,lr]};var ge=[Ke,ot,Ae,be,He,Me,_e,Be];function Zn(a,T,ye){let $=new Map;async function de(y){if(!yr.safeParse(y.data).success){ye?.onUnknownMessage?.(y.data);return}let j=at.safeParse(y.data);if(!j.success){ye?.onInvalidMessage?.(y.data,j.error),y.ports[0]?.postMessage(rt(j.error.message));return}let{data:c}=j;if(c.type==="felt.ready")y.ports[0]?.postMessage(!0);else if(c.type==="felt.addListener"){if(c.event.eventName==="")throw new Error("felt.addListener eventName cannot be empty");let z="options"in c.event?{options:"options"in c.event?c.event.options:void 0,handler:X=>{y.ports[0]?.postMessage(X)}}:{handler:X=>{y.ports[0]?.postMessage(X)}},K=T.listeners[c.event.eventName](z);$.set(c.event.id,K)}else if(c.type==="felt.removeListener")$.get(c.id)?.(),$.delete(c.id);else try{let z=T.methods[c.type],K=await z(c.params);y.ports[0]?.postMessage(K)}catch(z){y.ports[0]?.postMessage(rt(z))}}return a.addEventListener("message",de),()=>{a.removeEventListener("message",de)}}var nt={methods:ge.map(a=>a.methods??[]).flat(),listeners:ge.map(a=>a.listeners??[]).flat()},pr=g.discriminatedUnion("eventName",[g.strictObject({eventName:g.literal("")}),...nt.listeners]),cr=g.strictObject({type:g.literal("felt.addListener"),event:pr}),mr=g.strictObject({type:g.literal("felt.removeListener"),id:g.string()}),gr=g.strictObject({type:g.literal("felt.ready")}),at=g.discriminatedUnion("type",[gr,cr,mr,...nt.methods]),yr=g.object({type:g.enum(at.options.map(a=>a.shape.type.value))});function rt(a){return{__error__:dr(a)}}function dr(a){return a instanceof Error?a.message:typeof a=="object"&&a!==null&&"message"in a?String(a.message):typeof a=="string"?a:"Unknown error"}export{Zn as createMessageHandler};
1
+ import{z as g}from"zod";import{z as h}from"zod";import{z as M}from"zod";function t(a,T){return M.strictObject({type:M.literal(a),params:T})}function d(a,T){return M.strictObject({eventName:M.literal(a),id:M.string(),options:T})}function l(a){return M.strictObject({eventName:M.literal(a),id:M.string()})}import{z as s}from"zod";var R=s.number(),N=s.number(),A=s.object({latitude:N,longitude:R}),C=s.tuple([R,N]),F=s.object({type:s.literal("Polygon"),coordinates:s.array(s.array(C).min(4).refine(a=>a[0][0]===a[a.length-1][0]&&a[0][1]===a[a.length-1][1],"The last point of each ring must be identical to the first"))}),B=s.object({type:s.literal("MultiPolygon"),coordinates:s.array(F.shape.coordinates)}),lt=s.object({type:s.literal("LineString"),coordinates:s.array(C).min(2)}),k=s.object({type:s.literal("MultiLineString"),coordinates:s.array(lt.shape.coordinates)}),ue=s.number().min(1).max(23),f=s.tuple([R,N,R,N]),I=s.object({show:s.array(s.string()).optional(),hide:s.array(s.string()).optional()}),pt=s.enum(["asc","desc"]),D=s.object({attribute:s.string(),direction:pt});import{z as e}from"zod";var u=e.object({id:e.string(),groupId:e.string().nullable(),color:e.string(),name:e.string().nullable(),description:e.string().nullable(),attributes:e.record(e.string(),e.unknown()),interaction:e.enum(["default","locked"]).optional()}),Z=e.object({imageUrl:e.string().nullable()}),te=e.object({strokeOpacity:e.number(),strokeWidth:e.number(),strokeStyle:e.enum(["solid","dashed","dotted"])}),ct=e.enum(["meter","kilometer","foot","mile"]),H=u.extend(Z.shape).extend({type:e.literal("Place"),coordinates:C,symbol:e.string(),frame:e.enum(["frame-circle","frame-square"]).nullable(),hideLabel:e.boolean()}),V=u.extend(Z.shape).extend(te.shape).extend({type:e.literal("Path"),coordinates:k.shape.coordinates,distanceMarker:e.boolean(),routingMode:e.enum(["driving","cycling","walking","flying"]).nullable(),endCaps:e.boolean()}),w=u.extend(Z.shape).extend(te.shape).extend({type:e.literal("Polygon"),coordinates:F.shape.coordinates,fillOpacity:e.number().min(0).max(1),areaMarker:e.boolean()}),J=u.extend(Z.shape).extend(te.shape).extend({type:e.literal("Circle"),center:C,radius:e.number(),radiusMarker:e.boolean(),radiusDisplayAngle:e.number(),radiusDisplayUnit:ct.nullable(),fillOpacity:e.number().min(0).max(1)}),U=u.extend({type:e.literal("Marker"),coordinates:k.shape.coordinates,opacity:e.number().min(0).max(1),size:e.number().min(0).max(100),zoom:e.number().min(0).max(23)}),O=u.extend({type:e.literal("Highlighter"),coordinates:B.shape.coordinates,renderHoles:e.boolean(),opacity:e.number().min(0).max(1)}),he=e.object({position:C,rotation:e.number(),scale:e.number(),zoom:e.number().min(0).max(23),text:e.string(),align:e.enum(["left","center","right"]),style:e.enum(["italic","light","regular","caps"]),name:e.string()}),Y=u.extend(he.shape).extend({type:e.literal("Text")}),ee=u.extend(he.shape).extend({type:e.literal("Note"),widthScale:e.number().min(0)}),j=u.extend({type:e.literal("Image"),coordinates:k.shape.coordinates,imageUrl:e.string(),opacity:e.number().min(0).max(1)}).omit({color:!0}),mt=u.extend({type:e.literal("Link"),coordinates:k.shape.coordinates,url:e.string()}),P={type:!0,coordinates:!0},S={id:!0},oe=H.partial().extend(H.pick(P).shape).omit(S),q=V.partial().extend(V.pick(P).shape).omit(S),re=w.partial().extend(w.pick(P).shape).omit(S),ne=J.partial().extend(J.pick({type:!0,center:!0,radius:!0}).shape).omit(S),ae=U.partial().extend(U.pick(P).shape).omit(S),ie=O.partial().extend(O.pick(P).shape).omit(S),se=Y.partial().omit({...S,name:!0,type:!0}).extend({type:e.literal("Text"),text:e.string()}),le=ee.partial().omit({...S,name:!0,type:!0}).extend({type:e.literal("Note"),text:e.string()}),gt=j.partial().extend(j.pick({...P,imageUrl:!0}).shape).omit(S),fe=e.discriminatedUnion("type",[oe,q,re,ne,ae,ie,gt,se,le]);var Gr=V.omit({coordinates:!0}),Ir=w.omit({coordinates:!0});var Tr=U.omit({coordinates:!0}),Pr=O.omit({coordinates:!0});var Er=j.omit({coordinates:!0}),zr=mt.omit({coordinates:!0}),x={type:!0,id:!0},yt=H.partial().extend(H.pick(x).shape),dt=V.partial().extend(V.pick(x).shape),ut=w.partial().extend(w.pick(x).shape),ht=J.partial().extend(J.pick(x).shape),ft=U.partial().extend(U.pick(x).shape),St=O.partial().extend(O.pick(x).shape),xt=Y.partial().extend(Y.pick(x).shape).omit({name:!0}),Lt=ee.partial().extend(ee.pick(x).shape).omit({name:!0}),bt=j.partial().extend(j.pick(x).shape),Se=e.discriminatedUnion("type",[yt,dt,ut,ht,ft,St,xt,Lt,bt]),xe=e.object({ids:e.array(e.string()).optional()}),Le=e.object({ids:e.array(e.string()).optional()});var Mt=t("getElement",h.string()),Ct=t("getElementGeometry",h.string()),Gt=t("getElements",xe.optional()),It=t("getElementGroup",h.string()),Tt=t("getElementGroups",Le.optional()),Pt=t("setElementGroupVisibility",I),Et=d("onElementChange",h.object({id:h.string()})),zt=l("onElementCreate"),Ft=l("onElementCreateEnd"),kt=d("onElementDelete",h.object({id:h.string()})),Vt=d("onElementGroupChange",h.object({id:h.string()})),wt=t("createElement",fe),Ut=t("updateElement",Se),Ot=t("deleteElement",h.string()),be={methods:[Mt,Ct,Gt,It,Tt,Pt,wt,Ut,Ot],listeners:[Et,zt,Ft,kt,Vt]};var jt=l("onPointerClick"),vt=l("onPointerMove"),Me={methods:null,listeners:[jt,vt]};import{z as n}from"zod";import{z as i}from"zod";var Rt=i.enum(["in","ni"]),Nt=i.enum(["lt","gt","le","ge","eq","ne","cn","nc","is","isnt"]),Ar=i.enum(["and","or"]),Ce=i.union([i.number(),i.string(),i.boolean(),i.null()]),Ge=i.string().or(i.null()),At=i.tuple([Ge,Rt,i.array(Ce).or(i.null())]),Bt=i.tuple([Ge,Nt,Ce]),pe=i.union([At,Bt]),ce=i.tuple([i.lazy(()=>i.union([ce,pe,i.null(),i.boolean()])),i.enum(["and","or"]),i.lazy(()=>i.union([ce,pe,i.null(),i.boolean()]))]),L=i.union([ce,pe,i.null(),i.boolean()]),b=i.union([f,F,B,i.array(C)]);import{z as o}from"zod";var Ie=o.enum(["avg","max","min","sum","median"]),Te=o.enum(["avg","max","min","sum","count"]),Dt=o.object({method:Ie,attribute:o.string()}),Ht=o.object({methods:o.array(o.union([Ie,o.literal("count")])),attribute:o.string().optional()}),Pe=o.object({boundary:b.optional(),filters:L.optional(),aggregation:Dt.optional()}),Ee=o.object({layerId:o.string(),attribute:o.string(),limit:o.number().optional(),boundary:b.optional(),filters:L.optional(),values:Pe.optional()}),Jr=o.object({key:o.union([o.number(),o.string(),o.boolean()]),value:o.number().nullable()}),Jt=o.object({type:o.literal("equal-intervals"),count:o.number()}),Zt=o.object({type:o.literal("time-interval"),interval:o.enum(["hour","day","week","month","year"])}),ze=o.object({layerId:o.string(),attribute:o.string(),steps:o.union([Jt,Zt,o.array(o.number())]),boundary:b.optional(),filters:L.optional(),values:Pe.optional()}),Zr=o.object({min:o.number(),max:o.number(),value:o.number()}),Fe=o.object({layerId:o.string(),boundary:b.optional(),filters:L.optional(),aggregation:Ht}),ke=o.enum(["h3"]),qt=o.object({type:ke,resolution:o.number(),method:Te.extract(["count"])}),Wt=o.object({type:ke,resolution:o.number(),method:Te.exclude(["count"]),attribute:o.string()}),_t=o.union([qt,Wt]),Ve=o.object({layerId:o.string(),boundary:b.optional(),filters:L.optional(),gridConfig:_t});import{z as r}from"zod";var Qr=r.enum(["processing","completed","failed","incomplete"]),we=r.object({type:r.literal("geoJsonUrl"),url:r.string().url(),refreshInterval:r.number().min(250).max(5*60*1e3).nullable().optional()}),Ue=r.object({type:r.literal("geoJsonData"),data:r.object({}).passthrough().or(r.instanceof(ArrayBuffer))}),Oe=r.object({type:r.literal("geoJsonFile"),file:r.instanceof(File)}),je=r.object({id:r.string(),style:r.object({}).passthrough().optional(),shownInLegend:r.boolean().optional(),name:r.string().optional(),caption:r.string().optional(),description:r.string().optional(),bounds:f.optional(),source:r.union([we,Ue,Oe]).optional()}),ve=r.object({ids:r.array(r.string()).optional()}),Re=r.object({ids:r.array(r.string()).optional()}),E=r.object({id:r.string(),layerId:r.string()}),Ne=r.object({ids:E.array().optional(),layerIds:r.string().array().optional()}),Ae=r.object({layerIds:r.array(r.string()).optional(),areaQuery:r.union([r.object({coordinates:A}),r.object({boundary:f})]).optional()}),Qt=r.object({Point:r.object({}).passthrough().optional(),Line:r.object({}).passthrough().optional(),Polygon:r.object({}).passthrough().optional()}),Be=r.object({source:r.union([we,Ue,Oe]),name:r.string(),bounds:f.optional(),caption:r.string().optional(),description:r.string().optional(),geometryStyles:Qt.optional()});var $t=t("getLayer",n.string()),Kt=t("getLayers",ve.optional()),Xt=t("setLayerVisibility",I),Yt=d("onLayerChange",n.object({id:n.string()})),eo=t("setLayerStyle",n.object({id:n.string(),style:n.object({}).passthrough()})),to=t("setLayerLegendVisibility",I),oo=t("createLayersFromGeoJson",Be),ro=t("updateLayer",je),no=t("deleteLayer",n.string()),ao=t("getLayerGroup",n.string()),io=t("getLayerGroups",Re.optional()),so=t("setLayerGroupVisibility",I),lo=t("setLayerGroupLegendVisibility",I),po=d("onLayerGroupChange",n.object({id:n.string()})),co=t("getLegendItem",E),mo=t("getLegendItems",Ne.optional()),go=d("onLegendItemChange",E),yo=t("setLegendItemVisibility",n.object({show:E.array().optional(),hide:E.array().optional()})),uo=t("getLayerFilters",n.string()),ho=t("setLayerFilters",n.object({layerId:n.string(),filters:L,note:n.string().optional()})),fo=d("onLayerFiltersChange",n.object({layerId:n.string()})),So=t("getLayerBoundaries",n.string()),xo=t("setLayerBoundary",n.object({layerIds:n.array(n.string()),boundary:b.nullable()})),Lo=d("onLayerBoundariesChange",n.object({layerId:n.string()})),bo=t("getRenderedFeatures",Ae.optional()),Mo=t("getFeature",n.object({id:n.string().or(n.number()),layerId:n.string()})),Co=t("getFeatures",n.object({layerId:n.string(),filters:L.optional(),sorting:D.optional(),boundary:b.optional(),search:n.string().optional(),pagination:n.string().optional().nullish()})),Go=t("getGeoJsonFeature",n.object({id:n.string().or(n.number()),layerId:n.string()})),Io=t("getCategoryData",Ee),To=t("getHistogramData",ze),Po=t("getAggregates",Fe),Eo=t("getPrecomputedAggregates",Ve),zo=t("getLayerSchema",n.string()),De={methods:[$t,Kt,Xt,eo,to,oo,no,ro,ao,io,so,lo,co,mo,yo,uo,ho,So,xo,bo,Mo,Co,Go,Io,To,Po,Eo,zo],listeners:[Yt,po,go,fo,Lo]};import{z as Fo}from"zod";var ko=t("getMapDetails",Fo.undefined()),He={methods:[ko],listeners:[]};import{z as W}from"zod";import{z as G}from"zod";var Je=G.object({id:G.string().or(G.number()),layerId:G.string(),showPopup:G.boolean().optional(),fitViewport:G.boolean().or(G.object({maxZoom:G.number()})).optional()});var Vo=t("getSelection",W.undefined()),wo=l("onSelectionChange"),Uo=t("selectFeature",Je),Oo=t("clearSelection",W.object({features:W.boolean().optional(),elements:W.boolean().optional()}).optional()),Ze={methods:[Vo,Uo,Oo],listeners:[wo]};import{z as qo}from"zod";import{z as p}from"zod";var qe=["circle","highlighter","line","marker","note","pin","polygon","route","text"],jo=[...qe,"link"],We=p.enum(jo),_e=p.enum(qe),vo=oe.pick({color:!0,symbol:!0,frame:!0}).extend({afterCreation:p.enum(["enter name","add another","select"])}).required(),Ro=q.pick({color:!0,strokeOpacity:!0,strokeWidth:!0,strokeStyle:!0,distanceMarker:!0}).required(),No=q.pick({color:!0,routingMode:!0,strokeOpacity:!0,strokeWidth:!0,strokeStyle:!0,distanceMarker:!0,endCaps:!0}).required(),Ao=re.pick({color:!0,fillOpacity:!0,strokeOpacity:!0,strokeWidth:!0,strokeStyle:!0,areaMarker:!0}).required(),Bo=ne.pick({color:!0,fillOpacity:!0,strokeOpacity:!0,strokeWidth:!0,strokeStyle:!0,radiusMarker:!0}).required(),Do=ae.pick({color:!0,opacity:!0,size:!0}).required(),Ho=ie.pick({color:!0,opacity:!0,renderHoles:!0}).extend({size:p.number().min(0).max(200)}).required(),Jo=se.pick({color:!0,align:!0,style:!0}).required(),Zo=le.pick({color:!0,align:!0,style:!0}).required(),Qe=p.discriminatedUnion("tool",[vo.partial().extend({tool:p.literal("pin")}),Ro.partial().extend({tool:p.literal("line")}),No.partial().extend({tool:p.literal("route")}),Ao.partial().extend({tool:p.literal("polygon")}),Bo.partial().extend({tool:p.literal("circle")}),Do.partial().extend({tool:p.literal("marker")}),Ho.partial().extend({tool:p.literal("highlighter")}),Jo.partial().extend({tool:p.literal("text")}),Zo.partial().extend({tool:p.literal("note")})]);var Wo=t("setTool",We.nullable()),_o=t("getTool",qo.undefined()),Qo=l("onToolChange"),$o=t("setToolSettings",Qe),Ko=t("getToolSettings",_e),Xo=l("onToolSettingsChange"),$e={methods:[Wo,_o,$o,Ko],listeners:[Qo,Xo]};import{z as me}from"zod";import{z as m}from"zod";var Ke=m.object({showLegend:m.boolean().optional(),cooperativeGestures:m.boolean().optional(),fullScreenButton:m.boolean().optional(),geolocation:m.boolean().optional(),zoomControls:m.boolean().optional(),scaleBar:m.boolean().optional()}),Xe=m.object({featureSelectPanel:m.boolean().optional(),featureHoverPanel:m.boolean().optional(),elementSelectPanel:m.boolean().optional(),linkClickOpen:m.boolean().optional(),imageLightboxOpen:m.boolean().optional()});var Yo=t("updateUiControls",Ke),er=t("setOnMapInteractionsUi",Xe),tr=t("showLayerDataTable",me.object({layerId:me.string(),sorting:D.optional()}).optional()),or=t("hideLayerDataTable",me.undefined()),Ye={methods:[Yo,er,tr,or],listeners:null};import{z as rt}from"zod";import{z as Q}from"zod";var _=Q.object({center:A,zoom:ue}),et=Q.object({center:_.shape.center.optional(),zoom:_.shape.zoom.optional()}),tt=Q.object({minZoom:_.shape.zoom.nullish(),maxZoom:_.shape.zoom.nullish(),bounds:f.nullish()}).nullable(),ot=Q.object({bounds:f});var rr=t("getViewport",rt.undefined()),nr=t("setViewport",et),ar=t("getViewportConstraints",rt.undefined()),ir=t("setViewportConstraints",tt),sr=t("fitViewportToBounds",ot),lr=l("onViewportMove"),pr=l("onViewportMoveEnd"),cr=l("onMapIdle"),nt={methods:[nr,rr,ar,ir,sr],listeners:[lr,pr,cr]};var ge=[Ye,nt,De,be,Ze,Me,$e,He];function Wn(a,T,ye){let $=new Map;async function de(y){if(!ur.safeParse(y.data).success){ye?.onUnknownMessage?.(y.data);return}let v=st.safeParse(y.data);if(!v.success){ye?.onInvalidMessage?.(y.data,v.error),y.ports[0]?.postMessage(at(v.error.message));return}let{data:c}=v;if(c.type==="felt.ready")y.ports[0]?.postMessage(!0);else if(c.type==="felt.addListener"){if(c.event.eventName==="")throw new Error("felt.addListener eventName cannot be empty");let z="options"in c.event?{options:"options"in c.event?c.event.options:void 0,handler:X=>{y.ports[0]?.postMessage(X)}}:{handler:X=>{y.ports[0]?.postMessage(X)}},K=T.listeners[c.event.eventName](z);$.set(c.event.id,K)}else if(c.type==="felt.removeListener")$.get(c.id)?.(),$.delete(c.id);else try{let z=T.methods[c.type],K=await z(c.params);y.ports[0]?.postMessage(K)}catch(z){y.ports[0]?.postMessage(at(z))}}return a.addEventListener("message",de),()=>{a.removeEventListener("message",de)}}var it={methods:ge.map(a=>a.methods??[]).flat(),listeners:ge.map(a=>a.listeners??[]).flat()},mr=g.discriminatedUnion("eventName",[g.strictObject({eventName:g.literal("")}),...it.listeners]),gr=g.strictObject({type:g.literal("felt.addListener"),event:mr}),yr=g.strictObject({type:g.literal("felt.removeListener"),id:g.string()}),dr=g.strictObject({type:g.literal("felt.ready")}),st=g.discriminatedUnion("type",[dr,gr,yr,...it.methods]),ur=g.object({type:g.enum(st.options.map(a=>a.shape.type.value))});function at(a){return{__error__:hr(a)}}function hr(a){return a instanceof Error?a.message:typeof a=="object"&&a!==null&&"message"in a?String(a.message):typeof a=="string"?a:"Unknown error"}export{Wn as createMessageHandler};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@feltmaps/js-sdk",
3
- "version": "1.7.0-next.0",
3
+ "version": "1.7.0-next.1",
4
4
  "description": "An SDK for Felt maps",
5
5
  "keywords": [
6
6
  "felt",