@feltmaps/js-sdk 1.5.0-next.6 → 1.5.0-next.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/handler.d.ts CHANGED
@@ -1,6 +1,5 @@
1
- import * as zod from 'zod';
2
1
  import { z } from 'zod';
3
- import { J as zInfer, E as Element, G as Geometry, b as ElementGroup, d as ElementChangeCallbackParams, e as ElementGroupChangeCallbackParams, M as MapInteractionEvent, L as Layer, j as LayerGroup, n as LegendItem, q as LayerFilters, s as Feature, u as GetLayerCategoriesGroup, w as GetLayerHistogramBin, A as AggregationMethod, i as LayerChangeCallbackParams, l as LayerGroupChangeCallbackParams, p as LegendItemChangeCallbackParams, an as FilterTernary, y as MapDetails, z as EntityNode, T as ToolType, D as ToolSettingsMap, H as ToolSettingsChangeEvent, V as ViewportState, N as ViewportConstraints, aQ as UnionToIntersection, aR as PromiseOrNot } from './types-CQwkpLq-.js';
2
+ import { J as zInfer, E as Element, G as Geometry, b as ElementGroup, d as ElementChangeCallbackParams, e as ElementGroupChangeCallbackParams, M as MapInteractionEvent, L as Layer, j as LayerGroup, n as LegendItem, q as LayerFilters, s as Feature, u as GetLayerCategoriesGroup, w as GetLayerHistogramBin, A as AggregationMethod, i as LayerChangeCallbackParams, l as LayerGroupChangeCallbackParams, p as LegendItemChangeCallbackParams, ao as FilterTernary, y as MapDetails, z as EntityNode, T as ToolType, D as ToolSettingsMap, H as ToolSettingsChangeEvent, V as ViewportState, O as ViewportConstraints, aS as UnionToIntersection, aT as PromiseOrNot } from './types-XLCA2cX-.js';
4
3
 
5
4
  type Method<TRequest extends {
6
5
  type: string;
@@ -1429,6 +1428,9 @@ type ElementsSchema = {
1429
1428
  onElementChange: Listener<zInfer<typeof OnElementChangeMessage.shape.options>, ElementChangeCallbackParams>;
1430
1429
  onElementGroupChange: Listener<zInfer<typeof OnElementGroupChangeMessage.shape.options>, ElementGroupChangeCallbackParams>;
1431
1430
  onElementCreate: ListenerNoOptions<ElementChangeCallbackParams>;
1431
+ onElementCreateEnd: ListenerNoOptions<{
1432
+ element: Element;
1433
+ }>;
1432
1434
  onElementDelete: Listener<zInfer<typeof OnElementDeleteMessage.shape.options>, void>;
1433
1435
  };
1434
1436
  };
@@ -2027,8 +2029,8 @@ declare const GetLayerCategoriesMessage: z.ZodObject<{
2027
2029
  } | undefined;
2028
2030
  }>>;
2029
2031
  }, "strip", z.ZodTypeAny, {
2030
- layerId: string;
2031
2032
  attribute: string;
2033
+ layerId: string;
2032
2034
  values?: {
2033
2035
  boundary?: [number, number][] | {
2034
2036
  type: "Polygon";
@@ -2047,8 +2049,8 @@ declare const GetLayerCategoriesMessage: z.ZodObject<{
2047
2049
  filters?: boolean | [string | null, "in" | "ni", (string | number | boolean | null)[] | null] | [string | null, "lt" | "gt" | "le" | "ge" | "eq" | "ne" | "cn" | "nc" | "is" | "isnt", string | number | boolean | null] | FilterTernary | null | undefined;
2048
2050
  limit?: number | undefined;
2049
2051
  }, {
2050
- layerId: string;
2051
2052
  attribute: string;
2053
+ layerId: string;
2052
2054
  values?: {
2053
2055
  boundary?: [number, number][] | {
2054
2056
  type: "Polygon";
@@ -2069,8 +2071,8 @@ declare const GetLayerCategoriesMessage: z.ZodObject<{
2069
2071
  }>;
2070
2072
  }, z.UnknownKeysParam, z.ZodTypeAny, {
2071
2073
  params: {
2072
- layerId: string;
2073
2074
  attribute: string;
2075
+ layerId: string;
2074
2076
  values?: {
2075
2077
  boundary?: [number, number][] | {
2076
2078
  type: "Polygon";
@@ -2092,8 +2094,8 @@ declare const GetLayerCategoriesMessage: z.ZodObject<{
2092
2094
  type: "getCategoryData";
2093
2095
  }, {
2094
2096
  params: {
2095
- layerId: string;
2096
2097
  attribute: string;
2098
+ layerId: string;
2097
2099
  values?: {
2098
2100
  boundary?: [number, number][] | {
2099
2101
  type: "Polygon";
@@ -2193,8 +2195,8 @@ declare const GetLayerHistogramMessage: z.ZodObject<{
2193
2195
  } | undefined;
2194
2196
  }>>;
2195
2197
  }, "strip", z.ZodTypeAny, {
2196
- layerId: string;
2197
2198
  attribute: string;
2199
+ layerId: string;
2198
2200
  steps: number[] | {
2199
2201
  type: "equal-intervals";
2200
2202
  count: number;
@@ -2219,8 +2221,8 @@ declare const GetLayerHistogramMessage: z.ZodObject<{
2219
2221
  } | [number, number, number, number] | undefined;
2220
2222
  filters?: boolean | [string | null, "in" | "ni", (string | number | boolean | null)[] | null] | [string | null, "lt" | "gt" | "le" | "ge" | "eq" | "ne" | "cn" | "nc" | "is" | "isnt", string | number | boolean | null] | FilterTernary | null | undefined;
2221
2223
  }, {
2222
- layerId: string;
2223
2224
  attribute: string;
2225
+ layerId: string;
2224
2226
  steps: number[] | {
2225
2227
  type: "equal-intervals";
2226
2228
  count: number;
@@ -2247,8 +2249,8 @@ declare const GetLayerHistogramMessage: z.ZodObject<{
2247
2249
  }>;
2248
2250
  }, z.UnknownKeysParam, z.ZodTypeAny, {
2249
2251
  params: {
2250
- layerId: string;
2251
2252
  attribute: string;
2253
+ layerId: string;
2252
2254
  steps: number[] | {
2253
2255
  type: "equal-intervals";
2254
2256
  count: number;
@@ -2276,8 +2278,8 @@ declare const GetLayerHistogramMessage: z.ZodObject<{
2276
2278
  type: "getHistogramData";
2277
2279
  }, {
2278
2280
  params: {
2279
- layerId: string;
2280
2281
  attribute: string;
2282
+ layerId: string;
2281
2283
  steps: number[] | {
2282
2284
  type: "equal-intervals";
2283
2285
  count: number;
@@ -2870,16 +2872,16 @@ type ToolsSchema = {
2870
2872
  };
2871
2873
  };
2872
2874
 
2873
- declare const UiControlsMessage: zod.ZodObject<{
2874
- type: zod.ZodLiteral<"updateUiControls">;
2875
- params: zod.ZodObject<{
2876
- showLegend: zod.ZodOptional<zod.ZodBoolean>;
2877
- cooperativeGestures: zod.ZodOptional<zod.ZodBoolean>;
2878
- fullScreenButton: zod.ZodOptional<zod.ZodBoolean>;
2879
- geolocation: zod.ZodOptional<zod.ZodBoolean>;
2880
- zoomControls: zod.ZodOptional<zod.ZodBoolean>;
2881
- scaleBar: zod.ZodOptional<zod.ZodBoolean>;
2882
- }, "strip", zod.ZodTypeAny, {
2875
+ declare const UiControlsMessage: z.ZodObject<{
2876
+ type: z.ZodLiteral<"updateUiControls">;
2877
+ params: z.ZodObject<{
2878
+ showLegend: z.ZodOptional<z.ZodBoolean>;
2879
+ cooperativeGestures: z.ZodOptional<z.ZodBoolean>;
2880
+ fullScreenButton: z.ZodOptional<z.ZodBoolean>;
2881
+ geolocation: z.ZodOptional<z.ZodBoolean>;
2882
+ zoomControls: z.ZodOptional<z.ZodBoolean>;
2883
+ scaleBar: z.ZodOptional<z.ZodBoolean>;
2884
+ }, "strip", z.ZodTypeAny, {
2883
2885
  showLegend?: boolean | undefined;
2884
2886
  cooperativeGestures?: boolean | undefined;
2885
2887
  fullScreenButton?: boolean | undefined;
@@ -2894,7 +2896,7 @@ declare const UiControlsMessage: zod.ZodObject<{
2894
2896
  zoomControls?: boolean | undefined;
2895
2897
  scaleBar?: boolean | undefined;
2896
2898
  }>;
2897
- }, zod.UnknownKeysParam, zod.ZodTypeAny, {
2899
+ }, z.UnknownKeysParam, z.ZodTypeAny, {
2898
2900
  params: {
2899
2901
  showLegend?: boolean | undefined;
2900
2902
  cooperativeGestures?: boolean | undefined;
@@ -2915,15 +2917,15 @@ declare const UiControlsMessage: zod.ZodObject<{
2915
2917
  };
2916
2918
  type: "updateUiControls";
2917
2919
  }>;
2918
- declare const OnMapInteractionsMessage: zod.ZodObject<{
2919
- type: zod.ZodLiteral<"setOnMapInteractionsUi">;
2920
- params: zod.ZodObject<{
2921
- featureSelectPanel: zod.ZodOptional<zod.ZodBoolean>;
2922
- featureHoverPanel: zod.ZodOptional<zod.ZodBoolean>;
2923
- elementSelectPanel: zod.ZodOptional<zod.ZodBoolean>;
2924
- linkClickOpen: zod.ZodOptional<zod.ZodBoolean>;
2925
- imageLightboxOpen: zod.ZodOptional<zod.ZodBoolean>;
2926
- }, "strip", zod.ZodTypeAny, {
2920
+ declare const OnMapInteractionsMessage: z.ZodObject<{
2921
+ type: z.ZodLiteral<"setOnMapInteractionsUi">;
2922
+ params: z.ZodObject<{
2923
+ featureSelectPanel: z.ZodOptional<z.ZodBoolean>;
2924
+ featureHoverPanel: z.ZodOptional<z.ZodBoolean>;
2925
+ elementSelectPanel: z.ZodOptional<z.ZodBoolean>;
2926
+ linkClickOpen: z.ZodOptional<z.ZodBoolean>;
2927
+ imageLightboxOpen: z.ZodOptional<z.ZodBoolean>;
2928
+ }, "strip", z.ZodTypeAny, {
2927
2929
  featureSelectPanel?: boolean | undefined;
2928
2930
  featureHoverPanel?: boolean | undefined;
2929
2931
  elementSelectPanel?: boolean | undefined;
@@ -2936,7 +2938,7 @@ declare const OnMapInteractionsMessage: zod.ZodObject<{
2936
2938
  linkClickOpen?: boolean | undefined;
2937
2939
  imageLightboxOpen?: boolean | undefined;
2938
2940
  }>;
2939
- }, zod.UnknownKeysParam, zod.ZodTypeAny, {
2941
+ }, z.UnknownKeysParam, z.ZodTypeAny, {
2940
2942
  params: {
2941
2943
  featureSelectPanel?: boolean | undefined;
2942
2944
  featureHoverPanel?: boolean | undefined;
@@ -2955,10 +2957,68 @@ declare const OnMapInteractionsMessage: zod.ZodObject<{
2955
2957
  };
2956
2958
  type: "setOnMapInteractionsUi";
2957
2959
  }>;
2960
+ declare const ShowLayerDataTableMessage: z.ZodObject<{
2961
+ type: z.ZodLiteral<"showLayerDataTable">;
2962
+ params: z.ZodOptional<z.ZodObject<{
2963
+ layerId: z.ZodString;
2964
+ sorting: z.ZodOptional<z.ZodObject<{
2965
+ attribute: z.ZodString;
2966
+ direction: z.ZodEnum<["asc", "desc"]>;
2967
+ }, "strip", z.ZodTypeAny, {
2968
+ attribute: string;
2969
+ direction: "asc" | "desc";
2970
+ }, {
2971
+ attribute: string;
2972
+ direction: "asc" | "desc";
2973
+ }>>;
2974
+ }, "strip", z.ZodTypeAny, {
2975
+ layerId: string;
2976
+ sorting?: {
2977
+ attribute: string;
2978
+ direction: "asc" | "desc";
2979
+ } | undefined;
2980
+ }, {
2981
+ layerId: string;
2982
+ sorting?: {
2983
+ attribute: string;
2984
+ direction: "asc" | "desc";
2985
+ } | undefined;
2986
+ }>>;
2987
+ }, z.UnknownKeysParam, z.ZodTypeAny, {
2988
+ type: "showLayerDataTable";
2989
+ params?: {
2990
+ layerId: string;
2991
+ sorting?: {
2992
+ attribute: string;
2993
+ direction: "asc" | "desc";
2994
+ } | undefined;
2995
+ } | undefined;
2996
+ }, {
2997
+ type: "showLayerDataTable";
2998
+ params?: {
2999
+ layerId: string;
3000
+ sorting?: {
3001
+ attribute: string;
3002
+ direction: "asc" | "desc";
3003
+ } | undefined;
3004
+ } | undefined;
3005
+ }>;
3006
+ declare const HideLayerDataTableMessage: z.ZodObject<{
3007
+ type: z.ZodLiteral<"hideLayerDataTable">;
3008
+ params: z.ZodUndefined;
3009
+ }, z.UnknownKeysParam, z.ZodTypeAny, {
3010
+ type: "hideLayerDataTable";
3011
+ params?: undefined;
3012
+ }, {
3013
+ type: "hideLayerDataTable";
3014
+ params?: undefined;
3015
+ }>;
2958
3016
  type UiSchema = {
2959
3017
  methods: {
2960
3018
  updateUiControls: Method<zInfer<typeof UiControlsMessage>, void>;
2961
3019
  setOnMapInteractionsUi: Method<zInfer<typeof OnMapInteractionsMessage>, void>;
3020
+ showLayerDataTable: Method<zInfer<typeof ShowLayerDataTableMessage>, void>;
3021
+ hideLayerDataTable: Method<zInfer<typeof HideLayerDataTableMessage>, void>;
2962
3022
  };
2963
3023
  listeners: {};
2964
3024
  };
package/handler.js CHANGED
@@ -1 +1 @@
1
- "use strict";var Z=Object.defineProperty;var tt=Object.getOwnPropertyDescriptor;var ot=Object.getOwnPropertyNames;var rt=Object.prototype.hasOwnProperty;var nt=(r,s)=>{for(var E in s)Z(r,E,{get:s[E],enumerable:!0})},at=(r,s,E,F)=>{if(s&&typeof s=="object"||typeof s=="function")for(let L of ot(s))!rt.call(r,L)&&L!==E&&Z(r,L,{get:()=>s[L],enumerable:!(F=tt(s,L))||F.enumerable});return r};var it=r=>at(Z({},"__esModule",{value:!0}),r);var _o={};nt(_o,{createMessageHandler:()=>Ao});module.exports=it(_o);var g=require("zod");var y=require("zod");var f=require("zod");function t(r,s){return f.z.strictObject({type:f.z.literal(r),params:s})}function C(r,s){return f.z.strictObject({eventName:f.z.literal(r),id:f.z.string(),options:s})}function p(r){return f.z.strictObject({eventName:f.z.literal(r),id:f.z.string()})}var a=require("zod"),O=a.z.number(),U=a.z.number(),R=a.z.object({latitude:U,longitude:O}),I=a.z.tuple([O,U]),de=a.z.object({type:a.z.literal("Point"),coordinates:I}),ye=a.z.object({type:a.z.literal("Polygon"),coordinates:a.z.array(a.z.array(I))}),st=a.z.object({type:a.z.literal("LineString"),coordinates:a.z.array(I)}),G=a.z.object({type:a.z.literal("MultiLineString"),coordinates:a.z.array(st.shape.coordinates)}),ue=a.z.number().min(1).max(23),T=a.z.tuple([O,U,O,U]),z=a.z.object({show:a.z.array(a.z.string()).optional(),hide:a.z.array(a.z.string()).optional()});var e=require("zod");var u=e.z.object({id:e.z.string(),groupId:e.z.string().nullable(),color:e.z.string(),name:e.z.union([e.z.string(),e.z.null()]),description:e.z.union([e.z.string(),e.z.null()]),attributes:e.z.record(e.z.string(),e.z.unknown())}),N=e.z.object({imageUrl:e.z.string().nullable()}),D=e.z.object({strokeOpacity:e.z.number(),strokeWidth:e.z.number(),strokeStyle:e.z.enum(["solid","dashed","dotted"])}),lt=e.z.enum(["meter","kilometer","foot","mile"]),W=u.extend(N.shape).extend({type:e.z.literal("Place"),coordinates:de.shape.coordinates,symbol:e.z.string(),frame:e.z.enum(["frame-circle","frame-square"]).nullable(),hideLabel:e.z.boolean()}),K=u.extend(N.shape).extend(D.shape).extend({type:e.z.literal("Path"),coordinates:G.shape.coordinates,distanceMarker:e.z.boolean(),endCaps:e.z.boolean(),routingMode:e.z.enum(["driving","cycling","walking","flying"]).nullable()}),_=u.extend(N.shape).extend(D.shape).extend({type:e.z.literal("Polygon"),coordinates:G.shape.coordinates,fillOpacity:e.z.number().min(0).max(1),areaMarker:e.z.boolean()}),Q=u.extend(N.shape).extend(D.shape).extend({type:e.z.literal("Circle"),coordinates:I,radius:e.z.number(),radiusDisplayAngle:e.z.number(),radiusDisplayUnit:lt.nullable(),fillOpacity:e.z.number().min(0).max(1),radiusMarker:e.z.boolean()}),$=u.extend({type:e.z.literal("Marker"),coordinates:G.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)}),J=u.extend({type:e.z.literal("Highlighter"),coordinates:G.shape.coordinates,opacity:e.z.number().min(0).max(1)}),he=e.z.object({position:I,rotation:e.z.number(),scale:e.z.number(),zoom:e.z.number().min(0).max(23),coordinates:G.shape.coordinates}),fe=e.z.object({text:e.z.string(),align:e.z.enum(["left","center","right"]),style:e.z.enum(["italic","light","regular","caps"]),name:e.z.string()}),X=u.extend(he.shape).extend(fe.shape).extend({type:e.z.literal("Text")}),Y=u.extend(he.shape).extend(fe.shape).extend({type:e.z.literal("Note"),widthScale:e.z.number().min(0)}),ee=u.extend({type:e.z.literal("Image"),coordinates:G.shape.coordinates,imageUrl:e.z.string(),opacity:e.z.number().min(0).max(1)}).omit({color:!0}),pt=u.extend({type:e.z.literal("Link"),coordinates:G.shape.coordinates,url:e.z.string()}),S={type:!0,coordinates:!0},x={id:!0},te=W.partial().required(S).omit(x),j=K.partial().required(S).omit(x),oe=_.partial().required(S).omit(x),re=Q.partial().required(S).required({radius:!0}).omit(x),ne=$.partial().required(S).omit(x),ae=J.partial().required(S).omit(x),ie=X.partial().required(S).required({text:!0}).omit(x).omit({coordinates:!0,name:!0}),se=Y.partial().required(S).required({text:!0}).omit(x).omit({coordinates:!0,name:!0}),mt=ee.partial().required(S).required({imageUrl:!0}).omit(x),Se=e.z.discriminatedUnion("type",[te,j,oe,re,ne,ae,mt,ie,se]),er=W.omit({coordinates:!0}),tr=K.omit({coordinates:!0}),or=_.omit({coordinates:!0}),rr=Q.omit({coordinates:!0}),nr=$.omit({coordinates:!0}),ar=J.omit({coordinates:!0}),ir=X.omit({coordinates:!0}),sr=Y.omit({coordinates:!0}),lr=ee.omit({coordinates:!0}),pr=pt.omit({coordinates:!0}),M={type:!0,id:!0},ct=W.partial().required(M),gt=K.partial().required(M),dt=_.partial().required(M),yt=Q.partial().required(M),ut=$.partial().required(M),ht=J.partial().required(M),ft=X.partial().required(M).omit({coordinates:!0,name:!0}),St=Y.partial().required(M).omit({coordinates:!0,name:!0}),xt=ee.partial().required(M),xe=e.z.discriminatedUnion("type",[ct,gt,dt,yt,ut,ht,ft,St,xt]),Me=e.z.object({ids:e.z.array(e.z.string()).optional()}),be=e.z.object({ids:e.z.array(e.z.string()).optional()});var Mt=t("getElement",y.z.string()),bt=t("getElementGeometry",y.z.string()),Lt=t("getElements",Me.optional()),Ct=t("getElementGroup",y.z.string()),It=t("getElementGroups",be.optional()),Gt=t("setElementGroupVisibility",z),Et=C("onElementChange",y.z.object({id:y.z.string()})),Tt=p("onElementCreate"),zt=C("onElementDelete",y.z.object({id:y.z.string()})),Pt=C("onElementGroupChange",y.z.object({id:y.z.string()})),Ft=t("createElement",Se),kt=t("updateElement",xe),vt=t("deleteElement",y.z.string()),Le={methods:[Mt,bt,Lt,Ct,It,Gt,Ft,kt,vt],listeners:[Et,Tt,zt,Pt]};var wt=p("onPointerClick"),Vt=p("onPointerMove"),Ce={methods:null,listeners:[wt,Vt]};var l=require("zod");var n=require("zod"),Ot=n.z.enum(["in","ni"]),Ut=n.z.enum(["lt","gt","le","ge","eq","ne","cn","nc","is","isnt"]),fr=n.z.enum(["and","or"]),Ie=n.z.union([n.z.number(),n.z.string(),n.z.boolean(),n.z.null()]),Ge=n.z.string().or(n.z.null()),Rt=n.z.tuple([Ge,Ot,n.z.array(Ie).or(n.z.null())]),Nt=n.z.tuple([Ge,Ut,Ie]),le=n.z.union([Rt,Nt]),pe=n.z.tuple([n.z.lazy(()=>n.z.union([pe,le,n.z.null(),n.z.boolean()])),n.z.enum(["and","or"]),n.z.lazy(()=>n.z.union([pe,le,n.z.null(),n.z.boolean()]))]),P=n.z.union([pe,le,n.z.null(),n.z.boolean()]);var o=require("zod");var Ee=o.z.enum(["avg","max","min","sum","median"]),jt=o.z.object({method:Ee,attribute:o.z.string()}),qt=o.z.object({methods:o.z.array(o.z.union([Ee,o.z.literal("count")])),attribute:o.z.string().optional()}),q=o.z.union([T,ye,o.z.array(I)]),Te=o.z.object({boundary:q.optional(),filters:P.optional(),aggregation:jt.optional()}),ze=o.z.object({layerId:o.z.string(),attribute:o.z.string(),limit:o.z.number().optional(),boundary:q.optional(),filters:P.optional(),values:Te.optional()}),br=o.z.object({key:o.z.union([o.z.number(),o.z.string(),o.z.boolean()]),value:o.z.number().nullable()}),At=o.z.object({type:o.z.literal("equal-intervals"),count:o.z.number()}),Ht=o.z.object({type:o.z.literal("time-interval"),interval:o.z.enum(["hour","day","week","month","year"])}),Pe=o.z.object({layerId:o.z.string(),attribute:o.z.string(),steps:o.z.union([At,Ht,o.z.array(o.z.number())]),boundary:q.optional(),filters:P.optional(),values:Te.optional()}),Lr=o.z.object({min:o.z.number(),max:o.z.number(),value:o.z.number()}),Fe=o.z.object({layerId:o.z.string(),boundary:q.optional(),filters:P.optional(),aggregation:qt});var i=require("zod");var Gr=i.z.enum(["processing","completed","failed","incomplete"]),ke=i.z.object({ids:i.z.array(i.z.string()).optional()}),ve=i.z.object({ids:i.z.array(i.z.string()).optional()}),k=i.z.object({id:i.z.string(),layerId:i.z.string()}),we=i.z.object({ids:k.array().optional(),layerIds:i.z.string().array().optional()}),Ve=i.z.object({layerIds:i.z.array(i.z.string()).optional(),areaQuery:i.z.union([i.z.object({coordinates:R}),i.z.object({boundary:T})]).optional()});var Bt=t("getLayer",l.z.string()),Zt=t("getLayers",ke.optional()),Dt=t("setLayerVisibility",z),Wt=C("onLayerChange",l.z.object({id:l.z.string()})),Kt=t("setLayerStyle",l.z.object({id:l.z.string(),style:l.z.object({}).passthrough()})),_t=t("setLayerLegendVisibility",z),Qt=t("getLayerGroup",l.z.string()),$t=t("getLayerGroups",ve.optional()),Jt=t("setLayerGroupVisibility",z),Xt=t("setLayerGroupLegendVisibility",z),Yt=C("onLayerGroupChange",l.z.object({id:l.z.string()})),eo=t("getLegendItem",k),to=t("getLegendItems",we.optional()),oo=C("onLegendItemChange",k),ro=t("setLegendItemVisibility",l.z.object({show:k.array().optional(),hide:k.array().optional()})),no=t("getLayerFilters",l.z.string()),ao=t("setLayerFilters",l.z.object({layerId:l.z.string(),filters:P,note:l.z.string().optional()})),io=t("getRenderedFeatures",Ve.optional()),so=t("getCategoryData",ze),lo=t("getHistogramData",Pe),po=t("getAggregates",Fe),Oe={methods:[Bt,Zt,Dt,Kt,_t,Qt,$t,Jt,Xt,eo,to,ro,no,ao,io,so,lo,po],listeners:[Wt,Yt,oo]};var Ue=require("zod");var mo=t("getMapDetails",Ue.z.undefined()),Re={methods:[mo],listeners:[]};var w=require("zod");var b=require("zod"),Ne=b.z.object({id:b.z.string().or(b.z.number()),layerId:b.z.string(),showPopup:b.z.boolean().optional(),fitViewport:b.z.boolean().or(b.z.object({maxZoom:b.z.number()})).optional()});var co=t("getSelection",w.z.undefined()),go=p("onSelectionChange"),yo=t("selectFeature",Ne),uo=t("clearSelection",w.z.object({features:w.z.boolean().optional(),elements:w.z.boolean().optional()}).optional()),je={methods:[co,yo,uo],listeners:[go]};var Ze=require("zod");var m=require("zod");var qe=["pin","line","route","polygon","circle","marker","highlighter","text","note"],Ae=m.z.enum([...qe,"link"]),He=m.z.enum(qe),ho=te.pick({color:!0,symbol:!0,frame:!0}).required(),fo=j.pick({color:!0,strokeOpacity:!0,strokeWidth:!0,strokeStyle:!0,distanceMarker:!0}).required(),So=j.pick({color:!0,routingMode:!0,strokeOpacity:!0,strokeWidth:!0,strokeStyle:!0,distanceMarker:!0,endCaps:!0}).required(),xo=oe.pick({color:!0,fillOpacity:!0,strokeOpacity:!0,strokeWidth:!0,strokeStyle:!0,areaMarker:!0}).required(),Mo=re.pick({color:!0,fillOpacity:!0,strokeOpacity:!0,strokeWidth:!0,strokeStyle:!0,radiusMarker:!0}).required(),bo=ne.pick({color:!0,opacity:!0,size:!0}).required(),Lo=ae.pick({color:!0,opacity:!0}).extend({size:m.z.number().min(0).max(200)}).required(),Co=ie.pick({color:!0,align:!0,style:!0}).required(),Io=se.pick({color:!0,align:!0,style:!0}).required(),Be=m.z.discriminatedUnion("tool",[ho.partial().extend({tool:m.z.literal("pin")}),fo.partial().extend({tool:m.z.literal("line")}),So.partial().extend({tool:m.z.literal("route")}),xo.partial().extend({tool:m.z.literal("polygon")}),Mo.partial().extend({tool:m.z.literal("circle")}),bo.partial().extend({tool:m.z.literal("marker")}),Lo.partial().extend({tool:m.z.literal("highlighter")}),Co.partial().extend({tool:m.z.literal("text")}),Io.partial().extend({tool:m.z.literal("note")})]);var Go=t("setTool",Ae.nullable()),Eo=t("getTool",Ze.z.undefined()),To=p("onToolChange"),zo=t("setToolSettings",Be),Po=t("getToolSettings",He),Fo=p("onToolSettingsChange"),De={methods:[Go,Eo,zo,Po],listeners:[To,Fo]};var c=require("zod"),We=c.z.object({showLegend:c.z.boolean().optional(),cooperativeGestures:c.z.boolean().optional(),fullScreenButton:c.z.boolean().optional(),geolocation:c.z.boolean().optional(),zoomControls:c.z.boolean().optional(),scaleBar:c.z.boolean().optional()}),Ke=c.z.object({featureSelectPanel:c.z.boolean().optional(),featureHoverPanel:c.z.boolean().optional(),elementSelectPanel:c.z.boolean().optional(),linkClickOpen:c.z.boolean().optional(),imageLightboxOpen:c.z.boolean().optional()});var ko=t("updateUiControls",We),vo=t("setOnMapInteractionsUi",Ke),_e={methods:[ko,vo],listeners:null};var me=require("zod");var V=require("zod");var A=V.z.object({center:R,zoom:ue}),Qe=V.z.object({center:A.shape.center.optional(),zoom:A.shape.zoom.optional()}),$e=V.z.object({minZoom:A.shape.zoom.nullish(),maxZoom:A.shape.zoom.nullish(),bounds:T.nullish()}).nullable(),Je=V.z.object({bounds:T});var wo=t("getViewport",me.z.undefined()),Vo=t("setViewport",Qe),Oo=t("getViewportConstraints",me.z.undefined()),Uo=t("setViewportConstraints",$e),Ro=t("fitViewportToBounds",Je),No=p("onViewportMove"),jo=p("onViewportMoveEnd"),qo=p("onMapIdle"),Xe={methods:[Vo,wo,Oo,Uo,Ro],listeners:[No,jo,qo]};var ce=[_e,Xe,Oe,Le,je,Ce,De,Re];function Ao(r,s,E){let F=new Map;async function L(h){if(!Ko.safeParse(h.data).success){E?.onUnknownMessage?.(h.data);return}let ge=et.safeParse(h.data);if(!ge.success){E?.onInvalidMessage?.(h.data);return}let{data:d}=ge;if(d.type==="felt.ready")h.ports[0]?.postMessage(!0);else if(d.type==="felt.addListener"){if(d.event.eventName==="")throw new Error("felt.addListener eventName cannot be empty");let v="options"in d.event?{options:"options"in d.event?d.event.options:void 0,handler:B=>{h.ports[0]?.postMessage(B)}}:{handler:B=>{h.ports[0]?.postMessage(B)}},H=s.listeners[d.event.eventName](v);F.set(d.event.id,H)}else if(d.type==="felt.removeListener")F.get(d.id)?.(),F.delete(d.id);else try{let v=s.methods[d.type],H=await v(d.params);h.ports[0]?.postMessage(H)}catch(v){h.ports[0]?.postMessage({__error__:Ho(v)})}}return r.addEventListener("message",L),()=>{r.removeEventListener("message",L)}}function Ho(r){return r instanceof Error?r.message:typeof r=="object"&&r!==null&&"message"in r?String(r.message):typeof r=="string"?r:"Unknown error"}var Ye={methods:ce.map(r=>r.methods??[]).flat(),listeners:ce.map(r=>r.listeners??[]).flat()},Bo=g.z.discriminatedUnion("eventName",[g.z.strictObject({eventName:g.z.literal("")}),...Ye.listeners]),Zo=g.z.strictObject({type:g.z.literal("felt.addListener"),event:Bo}),Do=g.z.strictObject({type:g.z.literal("felt.removeListener"),id:g.z.string()}),Wo=g.z.strictObject({type:g.z.literal("felt.ready")}),et=g.z.discriminatedUnion("type",[Wo,Zo,Do,...Ye.methods]),Ko=g.z.object({type:g.z.enum(et.options.map(r=>r.shape.type.value))});0&&(module.exports={createMessageHandler});
1
+ "use strict";var Z=Object.defineProperty;var rt=Object.getOwnPropertyDescriptor;var nt=Object.getOwnPropertyNames;var at=Object.prototype.hasOwnProperty;var it=(r,s)=>{for(var E in s)Z(r,E,{get:s[E],enumerable:!0})},st=(r,s,E,F)=>{if(s&&typeof s=="object"||typeof s=="function")for(let L of nt(s))!at.call(r,L)&&L!==E&&Z(r,L,{get:()=>s[L],enumerable:!(F=rt(s,L))||F.enumerable});return r};var lt=r=>st(Z({},"__esModule",{value:!0}),r);var er={};it(er,{createMessageHandler:()=>Ko});module.exports=lt(er);var g=require("zod");var y=require("zod");var f=require("zod");function t(r,s){return f.z.strictObject({type:f.z.literal(r),params:s})}function C(r,s){return f.z.strictObject({eventName:f.z.literal(r),id:f.z.string(),options:s})}function l(r){return f.z.strictObject({eventName:f.z.literal(r),id:f.z.string()})}var a=require("zod"),O=a.z.number(),U=a.z.number(),R=a.z.object({latitude:U,longitude:O}),I=a.z.tuple([O,U]),ge=a.z.object({type:a.z.literal("Point"),coordinates:I}),de=a.z.object({type:a.z.literal("Polygon"),coordinates:a.z.array(a.z.array(I))}),pt=a.z.object({type:a.z.literal("LineString"),coordinates:a.z.array(I)}),G=a.z.object({type:a.z.literal("MultiLineString"),coordinates:a.z.array(pt.shape.coordinates)}),ye=a.z.number().min(1).max(23),T=a.z.tuple([O,U,O,U]),z=a.z.object({show:a.z.array(a.z.string()).optional(),hide:a.z.array(a.z.string()).optional()}),mt=a.z.enum(["asc","desc"]),ue=a.z.object({attribute:a.z.string(),direction:mt});var e=require("zod");var u=e.z.object({id:e.z.string(),groupId:e.z.string().nullable(),color:e.z.string(),name:e.z.union([e.z.string(),e.z.null()]),description:e.z.union([e.z.string(),e.z.null()]),attributes:e.z.record(e.z.string(),e.z.unknown())}),N=e.z.object({imageUrl:e.z.string().nullable()}),W=e.z.object({strokeOpacity:e.z.number(),strokeWidth:e.z.number(),strokeStyle:e.z.enum(["solid","dashed","dotted"])}),ct=e.z.enum(["meter","kilometer","foot","mile"]),he=u.extend(N.shape).extend({type:e.z.literal("Place"),coordinates:ge.shape.coordinates,symbol:e.z.string(),frame:e.z.enum(["frame-circle","frame-square"]).nullable(),hideLabel:e.z.boolean()}),K=u.extend(N.shape).extend(W.shape).extend({type:e.z.literal("Path"),coordinates:G.shape.coordinates,distanceMarker:e.z.boolean(),endCaps:e.z.boolean(),routingMode:e.z.enum(["driving","cycling","walking","flying"]).nullable()}),_=u.extend(N.shape).extend(W.shape).extend({type:e.z.literal("Polygon"),coordinates:G.shape.coordinates,fillOpacity:e.z.number().min(0).max(1),areaMarker:e.z.boolean()}),fe=u.extend(N.shape).extend(W.shape).extend({type:e.z.literal("Circle"),coordinates:I,radius:e.z.number(),radiusDisplayAngle:e.z.number(),radiusDisplayUnit:ct.nullable(),fillOpacity:e.z.number().min(0).max(1),radiusMarker:e.z.boolean()}),Q=u.extend({type:e.z.literal("Marker"),coordinates:G.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)}),$=u.extend({type:e.z.literal("Highlighter"),coordinates:G.shape.coordinates,opacity:e.z.number().min(0).max(1)}),Se=e.z.object({position:I,rotation:e.z.number(),scale:e.z.number(),zoom:e.z.number().min(0).max(23),coordinates:G.shape.coordinates}),xe=e.z.object({text:e.z.string(),align:e.z.enum(["left","center","right"]),style:e.z.enum(["italic","light","regular","caps"]),name:e.z.string()}),J=u.extend(Se.shape).extend(xe.shape).extend({type:e.z.literal("Text")}),X=u.extend(Se.shape).extend(xe.shape).extend({type:e.z.literal("Note"),widthScale:e.z.number().min(0)}),Y=u.extend({type:e.z.literal("Image"),coordinates:G.shape.coordinates,imageUrl:e.z.string(),opacity:e.z.number().min(0).max(1)}).omit({color:!0}),gt=u.extend({type:e.z.literal("Link"),coordinates:G.shape.coordinates,url:e.z.string()}),S={type:!0,coordinates:!0},x={id:!0},ee=he.partial().required(S).omit(x),j=K.partial().required(S).omit(x),te=_.partial().required(S).omit(x),oe=fe.partial().required(S).required({radius:!0}).omit(x),re=Q.partial().required(S).omit(x),ne=$.partial().required(S).omit(x),ae=J.partial().required(S).required({text:!0}).omit(x).omit({coordinates:!0,name:!0}),ie=X.partial().required(S).required({text:!0}).omit(x).omit({coordinates:!0,name:!0}),dt=Y.partial().required(S).required({imageUrl:!0}).omit(x),Me=e.z.discriminatedUnion("type",[ee,j,te,oe,re,ne,dt,ae,ie]);var ir=K.omit({coordinates:!0}),sr=_.omit({coordinates:!0});var lr=Q.omit({coordinates:!0}),pr=$.omit({coordinates:!0}),mr=J.omit({coordinates:!0}),cr=X.omit({coordinates:!0}),gr=Y.omit({coordinates:!0}),dr=gt.omit({coordinates:!0}),M={type:!0,id:!0},yt=he.partial().required(M),ut=K.partial().required(M),ht=_.partial().required(M),ft=fe.partial().required(M),St=Q.partial().required(M),xt=$.partial().required(M),Mt=J.partial().required(M).omit({coordinates:!0,name:!0}),bt=X.partial().required(M).omit({coordinates:!0,name:!0}),Lt=Y.partial().required(M),be=e.z.discriminatedUnion("type",[yt,ut,ht,ft,St,xt,Mt,bt,Lt]),Le=e.z.object({ids:e.z.array(e.z.string()).optional()}),Ce=e.z.object({ids:e.z.array(e.z.string()).optional()});var Ct=t("getElement",y.z.string()),It=t("getElementGeometry",y.z.string()),Gt=t("getElements",Le.optional()),Et=t("getElementGroup",y.z.string()),Tt=t("getElementGroups",Ce.optional()),zt=t("setElementGroupVisibility",z),Pt=C("onElementChange",y.z.object({id:y.z.string()})),Ft=l("onElementCreate"),kt=l("onElementCreateEnd"),wt=C("onElementDelete",y.z.object({id:y.z.string()})),vt=C("onElementGroupChange",y.z.object({id:y.z.string()})),Vt=t("createElement",Me),Ot=t("updateElement",be),Ut=t("deleteElement",y.z.string()),Ie={methods:[Ct,It,Gt,Et,Tt,zt,Vt,Ot,Ut],listeners:[Pt,Ft,kt,wt,vt]};var Rt=l("onPointerClick"),Nt=l("onPointerMove"),Ge={methods:null,listeners:[Rt,Nt]};var p=require("zod");var n=require("zod"),jt=n.z.enum(["in","ni"]),qt=n.z.enum(["lt","gt","le","ge","eq","ne","cn","nc","is","isnt"]),br=n.z.enum(["and","or"]),Ee=n.z.union([n.z.number(),n.z.string(),n.z.boolean(),n.z.null()]),Te=n.z.string().or(n.z.null()),At=n.z.tuple([Te,jt,n.z.array(Ee).or(n.z.null())]),Ht=n.z.tuple([Te,qt,Ee]),se=n.z.union([At,Ht]),le=n.z.tuple([n.z.lazy(()=>n.z.union([le,se,n.z.null(),n.z.boolean()])),n.z.enum(["and","or"]),n.z.lazy(()=>n.z.union([le,se,n.z.null(),n.z.boolean()]))]),P=n.z.union([le,se,n.z.null(),n.z.boolean()]);var o=require("zod");var ze=o.z.enum(["avg","max","min","sum","median"]),Bt=o.z.object({method:ze,attribute:o.z.string()}),Dt=o.z.object({methods:o.z.array(o.z.union([ze,o.z.literal("count")])),attribute:o.z.string().optional()}),q=o.z.union([T,de,o.z.array(I)]),Pe=o.z.object({boundary:q.optional(),filters:P.optional(),aggregation:Bt.optional()}),Fe=o.z.object({layerId:o.z.string(),attribute:o.z.string(),limit:o.z.number().optional(),boundary:q.optional(),filters:P.optional(),values:Pe.optional()}),Gr=o.z.object({key:o.z.union([o.z.number(),o.z.string(),o.z.boolean()]),value:o.z.number().nullable()}),Zt=o.z.object({type:o.z.literal("equal-intervals"),count:o.z.number()}),Wt=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([Zt,Wt,o.z.array(o.z.number())]),boundary:q.optional(),filters:P.optional(),values:Pe.optional()}),Er=o.z.object({min:o.z.number(),max:o.z.number(),value:o.z.number()}),we=o.z.object({layerId:o.z.string(),boundary:q.optional(),filters:P.optional(),aggregation:Dt});var i=require("zod");var Pr=i.z.enum(["processing","completed","failed","incomplete"]),ve=i.z.object({ids:i.z.array(i.z.string()).optional()}),Ve=i.z.object({ids:i.z.array(i.z.string()).optional()}),k=i.z.object({id:i.z.string(),layerId:i.z.string()}),Oe=i.z.object({ids:k.array().optional(),layerIds:i.z.string().array().optional()}),Ue=i.z.object({layerIds:i.z.array(i.z.string()).optional(),areaQuery:i.z.union([i.z.object({coordinates:R}),i.z.object({boundary:T})]).optional()});var Kt=t("getLayer",p.z.string()),_t=t("getLayers",ve.optional()),Qt=t("setLayerVisibility",z),$t=C("onLayerChange",p.z.object({id:p.z.string()})),Jt=t("setLayerStyle",p.z.object({id:p.z.string(),style:p.z.object({}).passthrough()})),Xt=t("setLayerLegendVisibility",z),Yt=t("getLayerGroup",p.z.string()),eo=t("getLayerGroups",Ve.optional()),to=t("setLayerGroupVisibility",z),oo=t("setLayerGroupLegendVisibility",z),ro=C("onLayerGroupChange",p.z.object({id:p.z.string()})),no=t("getLegendItem",k),ao=t("getLegendItems",Oe.optional()),io=C("onLegendItemChange",k),so=t("setLegendItemVisibility",p.z.object({show:k.array().optional(),hide:k.array().optional()})),lo=t("getLayerFilters",p.z.string()),po=t("setLayerFilters",p.z.object({layerId:p.z.string(),filters:P,note:p.z.string().optional()})),mo=t("getRenderedFeatures",Ue.optional()),co=t("getCategoryData",Fe),go=t("getHistogramData",ke),yo=t("getAggregates",we),Re={methods:[Kt,_t,Qt,Jt,Xt,Yt,eo,to,oo,no,ao,so,lo,po,mo,co,go,yo],listeners:[$t,ro,io]};var Ne=require("zod");var uo=t("getMapDetails",Ne.z.undefined()),je={methods:[uo],listeners:[]};var v=require("zod");var b=require("zod"),qe=b.z.object({id:b.z.string().or(b.z.number()),layerId:b.z.string(),showPopup:b.z.boolean().optional(),fitViewport:b.z.boolean().or(b.z.object({maxZoom:b.z.number()})).optional()});var ho=t("getSelection",v.z.undefined()),fo=l("onSelectionChange"),So=t("selectFeature",qe),xo=t("clearSelection",v.z.object({features:v.z.boolean().optional(),elements:v.z.boolean().optional()}).optional()),Ae={methods:[ho,So,xo],listeners:[fo]};var We=require("zod");var m=require("zod");var He=["pin","line","route","polygon","circle","marker","highlighter","text","note"],Be=m.z.enum([...He,"link"]),De=m.z.enum(He),Mo=ee.pick({color:!0,symbol:!0,frame:!0}).required(),bo=j.pick({color:!0,strokeOpacity:!0,strokeWidth:!0,strokeStyle:!0,distanceMarker:!0}).required(),Lo=j.pick({color:!0,routingMode:!0,strokeOpacity:!0,strokeWidth:!0,strokeStyle:!0,distanceMarker:!0,endCaps:!0}).required(),Co=te.pick({color:!0,fillOpacity:!0,strokeOpacity:!0,strokeWidth:!0,strokeStyle:!0,areaMarker:!0}).required(),Io=oe.pick({color:!0,fillOpacity:!0,strokeOpacity:!0,strokeWidth:!0,strokeStyle:!0,radiusMarker:!0}).required(),Go=re.pick({color:!0,opacity:!0,size:!0}).required(),Eo=ne.pick({color:!0,opacity:!0}).extend({size:m.z.number().min(0).max(200)}).required(),To=ae.pick({color:!0,align:!0,style:!0}).required(),zo=ie.pick({color:!0,align:!0,style:!0}).required(),Ze=m.z.discriminatedUnion("tool",[Mo.partial().extend({tool:m.z.literal("pin")}),bo.partial().extend({tool:m.z.literal("line")}),Lo.partial().extend({tool:m.z.literal("route")}),Co.partial().extend({tool:m.z.literal("polygon")}),Io.partial().extend({tool:m.z.literal("circle")}),Go.partial().extend({tool:m.z.literal("marker")}),Eo.partial().extend({tool:m.z.literal("highlighter")}),To.partial().extend({tool:m.z.literal("text")}),zo.partial().extend({tool:m.z.literal("note")})]);var Po=t("setTool",Be.nullable()),Fo=t("getTool",We.z.undefined()),ko=l("onToolChange"),wo=t("setToolSettings",Ze),vo=t("getToolSettings",De),Vo=l("onToolSettingsChange"),Ke={methods:[Po,Fo,wo,vo],listeners:[ko,Vo]};var A=require("zod");var c=require("zod"),_e=c.z.object({showLegend:c.z.boolean().optional(),cooperativeGestures:c.z.boolean().optional(),fullScreenButton:c.z.boolean().optional(),geolocation:c.z.boolean().optional(),zoomControls:c.z.boolean().optional(),scaleBar:c.z.boolean().optional()}),Qe=c.z.object({featureSelectPanel:c.z.boolean().optional(),featureHoverPanel:c.z.boolean().optional(),elementSelectPanel:c.z.boolean().optional(),linkClickOpen:c.z.boolean().optional(),imageLightboxOpen:c.z.boolean().optional()});var Oo=t("updateUiControls",_e),Uo=t("setOnMapInteractionsUi",Qe),Ro=t("showLayerDataTable",A.z.object({layerId:A.z.string(),sorting:ue.optional()}).optional()),No=t("hideLayerDataTable",A.z.undefined()),$e={methods:[Oo,Uo,Ro,No],listeners:null};var pe=require("zod");var V=require("zod");var H=V.z.object({center:R,zoom:ye}),Je=V.z.object({center:H.shape.center.optional(),zoom:H.shape.zoom.optional()}),Xe=V.z.object({minZoom:H.shape.zoom.nullish(),maxZoom:H.shape.zoom.nullish(),bounds:T.nullish()}).nullable(),Ye=V.z.object({bounds:T});var jo=t("getViewport",pe.z.undefined()),qo=t("setViewport",Je),Ao=t("getViewportConstraints",pe.z.undefined()),Ho=t("setViewportConstraints",Xe),Bo=t("fitViewportToBounds",Ye),Do=l("onViewportMove"),Zo=l("onViewportMoveEnd"),Wo=l("onMapIdle"),et={methods:[qo,jo,Ao,Ho,Bo],listeners:[Do,Zo,Wo]};var me=[$e,et,Re,Ie,Ae,Ge,Ke,je];function Ko(r,s,E){let F=new Map;async function L(h){if(!Yo.safeParse(h.data).success){E?.onUnknownMessage?.(h.data);return}let ce=ot.safeParse(h.data);if(!ce.success){E?.onInvalidMessage?.(h.data);return}let{data:d}=ce;if(d.type==="felt.ready")h.ports[0]?.postMessage(!0);else if(d.type==="felt.addListener"){if(d.event.eventName==="")throw new Error("felt.addListener eventName cannot be empty");let w="options"in d.event?{options:"options"in d.event?d.event.options:void 0,handler:D=>{h.ports[0]?.postMessage(D)}}:{handler:D=>{h.ports[0]?.postMessage(D)}},B=s.listeners[d.event.eventName](w);F.set(d.event.id,B)}else if(d.type==="felt.removeListener")F.get(d.id)?.(),F.delete(d.id);else try{let w=s.methods[d.type],B=await w(d.params);h.ports[0]?.postMessage(B)}catch(w){h.ports[0]?.postMessage({__error__:_o(w)})}}return r.addEventListener("message",L),()=>{r.removeEventListener("message",L)}}function _o(r){return r instanceof Error?r.message:typeof r=="object"&&r!==null&&"message"in r?String(r.message):typeof r=="string"?r:"Unknown error"}var tt={methods:me.map(r=>r.methods??[]).flat(),listeners:me.map(r=>r.listeners??[]).flat()},Qo=g.z.discriminatedUnion("eventName",[g.z.strictObject({eventName:g.z.literal("")}),...tt.listeners]),$o=g.z.strictObject({type:g.z.literal("felt.addListener"),event:Qo}),Jo=g.z.strictObject({type:g.z.literal("felt.removeListener"),id:g.z.string()}),Xo=g.z.strictObject({type:g.z.literal("felt.ready")}),ot=g.z.discriminatedUnion("type",[Xo,$o,Jo,...tt.methods]),Yo=g.z.object({type:g.z.enum(ot.options.map(r=>r.shape.type.value))});0&&(module.exports={createMessageHandler});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@feltmaps/js-sdk",
3
- "version": "1.5.0-next.6",
3
+ "version": "1.5.0-next.7",
4
4
  "description": "An SDK for Felt maps",
5
5
  "keywords": [
6
6
  "felt",
@@ -378,7 +378,7 @@ declare const ImageCreateSchema: z.ZodObject<Omit<{
378
378
  attributes?: Record<string, unknown> | undefined;
379
379
  opacity?: number | undefined;
380
380
  }>;
381
- declare const PlaceReadSchema: z.ZodObject<Omit<z.objectUtil.extendShape<z.objectUtil.extendShape<{
381
+ declare const PlaceReadSchema: z.ZodObject<z.objectUtil.extendShape<z.objectUtil.extendShape<{
382
382
  id: z.ZodString;
383
383
  groupId: z.ZodNullable<z.ZodString>;
384
384
  color: z.ZodString;
@@ -393,9 +393,10 @@ declare const PlaceReadSchema: z.ZodObject<Omit<z.objectUtil.extendShape<z.objec
393
393
  symbol: z.ZodString;
394
394
  frame: z.ZodNullable<z.ZodEnum<["frame-circle", "frame-square"]>>;
395
395
  hideLabel: z.ZodBoolean;
396
- }>, "coordinates">, "strip", z.ZodTypeAny, {
396
+ }>, "strip", z.ZodTypeAny, {
397
397
  symbol: string;
398
398
  type: "Place";
399
+ coordinates: [number, number];
399
400
  id: string;
400
401
  groupId: string | null;
401
402
  color: string;
@@ -408,6 +409,7 @@ declare const PlaceReadSchema: z.ZodObject<Omit<z.objectUtil.extendShape<z.objec
408
409
  }, {
409
410
  symbol: string;
410
411
  type: "Place";
412
+ coordinates: [number, number];
411
413
  id: string;
412
414
  groupId: string | null;
413
415
  color: string;
@@ -515,7 +517,7 @@ declare const PolygonReadSchema: z.ZodObject<Omit<z.objectUtil.extendShape<z.obj
515
517
  fillOpacity: number;
516
518
  areaMarker: boolean;
517
519
  }>;
518
- declare const CircleReadSchema: z.ZodObject<Omit<z.objectUtil.extendShape<z.objectUtil.extendShape<z.objectUtil.extendShape<{
520
+ declare const CircleReadSchema: z.ZodObject<z.objectUtil.extendShape<z.objectUtil.extendShape<z.objectUtil.extendShape<{
519
521
  id: z.ZodString;
520
522
  groupId: z.ZodNullable<z.ZodString>;
521
523
  color: z.ZodString;
@@ -536,8 +538,9 @@ declare const CircleReadSchema: z.ZodObject<Omit<z.objectUtil.extendShape<z.obje
536
538
  radiusDisplayUnit: z.ZodNullable<z.ZodEnum<["meter", "kilometer", "foot", "mile"]>>;
537
539
  fillOpacity: z.ZodNumber;
538
540
  radiusMarker: z.ZodBoolean;
539
- }>, "coordinates">, "strip", z.ZodTypeAny, {
541
+ }>, "strip", z.ZodTypeAny, {
540
542
  type: "Circle";
543
+ coordinates: [number, number];
541
544
  id: string;
542
545
  groupId: string | null;
543
546
  color: string;
@@ -555,6 +558,7 @@ declare const CircleReadSchema: z.ZodObject<Omit<z.objectUtil.extendShape<z.obje
555
558
  radiusMarker: boolean;
556
559
  }, {
557
560
  type: "Circle";
561
+ coordinates: [number, number];
558
562
  id: string;
559
563
  groupId: string | null;
560
564
  color: string;
@@ -1317,7 +1321,7 @@ declare const GetElementGroupsConstraintSchema: z.ZodObject<{
1317
1321
  ids?: string[] | undefined;
1318
1322
  }>;
1319
1323
  /**
1320
- * The parameters for the `onElementChange` listener.
1324
+ * The parameters for the `onElementChange` and the `onElementCreate` listeners.
1321
1325
  *
1322
1326
  * @group Elements
1323
1327
  */
@@ -1326,6 +1330,22 @@ interface ElementChangeCallbackParams {
1326
1330
  * The new data for the element or null if the element was removed.
1327
1331
  */
1328
1332
  element: Element | null;
1333
+ /**
1334
+ * Whether or not this element is still being created by a drawing tool.
1335
+ *
1336
+ * For example, if the user begins drawing a polygon, they need to place
1337
+ * multiple points until they've ultimately completed the polygon. All
1338
+ * the time they are still placing points, this will be true.
1339
+ *
1340
+ * For elements that require text entry (such as Places, Text and Notes)
1341
+ * this will be true all the time the user is typing text until the point
1342
+ * at which the user finishes, by pressing Escape for example.
1343
+ *
1344
+ * If the user is editing an existing element, this will be false.
1345
+ *
1346
+ * For elements that are created programatically, this will be false.
1347
+ */
1348
+ isBeingCreated: boolean;
1329
1349
  }
1330
1350
  /**
1331
1351
  * The parameters for the `onElementGroupChange` listener.
@@ -1464,6 +1484,40 @@ declare const SetVisibilityRequestSchema: z.ZodObject<{
1464
1484
  show?: string[] | undefined;
1465
1485
  hide?: string[] | undefined;
1466
1486
  }>;
1487
+ /**
1488
+ * Specifies the direction to sort data in
1489
+ *
1490
+ * @group Types
1491
+ */
1492
+ type SortDirection = z.infer<typeof SortDirectionSchema>;
1493
+ /** @ignore */
1494
+ declare const SortDirectionSchema: z.ZodEnum<["asc", "desc"]>;
1495
+ /**
1496
+ * Configuration for sorting data by a specific attribute
1497
+ *
1498
+ * @group Types
1499
+ */
1500
+ interface SortConfig extends zInfer<typeof SortConfigSchema> {
1501
+ }
1502
+ /** @ignore */
1503
+ declare const SortConfigSchema: z.ZodObject<{
1504
+ /**
1505
+ * The attribute to sort by. What this represents depends on the context.
1506
+ * For instance, when sorting features in a data table, the attribute is
1507
+ * the column to sort by.
1508
+ */
1509
+ attribute: z.ZodString;
1510
+ /**
1511
+ * The direction to sort in
1512
+ */
1513
+ direction: z.ZodEnum<["asc", "desc"]>;
1514
+ }, "strip", z.ZodTypeAny, {
1515
+ attribute: string;
1516
+ direction: "asc" | "desc";
1517
+ }, {
1518
+ attribute: string;
1519
+ direction: "asc" | "desc";
1520
+ }>;
1467
1521
 
1468
1522
  /**
1469
1523
  * A feature is a single geographical item in a layer.
@@ -1888,6 +1942,31 @@ declare const FilterLogicGateSchema: z.ZodEnum<["and", "or"]>;
1888
1942
  type FilterExpression = z.infer<typeof FilterExpressionSchema>;
1889
1943
  declare const FilterExpressionSchema: 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>]>;
1890
1944
  /**
1945
+ * A `FilterTernary` is a tree structure for combining expressions with logical operators.
1946
+ *
1947
+ * When combining three or more conditions, you must use proper nesting rather than a flat list.
1948
+ *
1949
+ * @example
1950
+ * ```typescript
1951
+ * // A simple filter with a single condition
1952
+ * const filter = [
1953
+ * ["AREA", "gt", 30_000],
1954
+ * "and",
1955
+ * ["COLOR", "eq", "red"]
1956
+ * ]
1957
+ *
1958
+ * // A complex filter with multiple conditions
1959
+ * const filter = [
1960
+ * ["AREA", "gt", 30_000],
1961
+ * "and",
1962
+ * [
1963
+ * ["COLOR", "eq", "red"],
1964
+ * "or",
1965
+ * ["TYPE", "eq", "residential"]
1966
+ * ]
1967
+ * ]
1968
+ * ```
1969
+ *
1891
1970
  * @group Filters
1892
1971
  */
1893
1972
  type FilterTernary = [
@@ -1900,6 +1979,12 @@ type FilterTernary = [
1900
1979
  * Filters can be used to change which features in a layer are rendered. Filters can be
1901
1980
  * applied to a layer by the `setLayerFilters` method on the Felt controller.
1902
1981
  *
1982
+ * Filters use a tree structure for combining expressions with logical operators, called a
1983
+ * {@link FilterTernary}. When combining three or more conditions, you must use proper nesting
1984
+ * rather than a flat list.
1985
+ *
1986
+ * See the examples below for the correct structure to use when building complex filters.
1987
+ *
1903
1988
  * @remarks
1904
1989
  * The possible operators are:
1905
1990
  * - `lt`: Less than
@@ -1917,17 +2002,82 @@ type FilterTernary = [
1917
2002
  *
1918
2003
  * @example
1919
2004
  * ```typescript
1920
- * // a simple filter
2005
+ * // 1. Simple filter: single condition
1921
2006
  * felt.setLayerFilters({
1922
2007
  * layerId: "layer-1",
1923
2008
  * filters: ["AREA", "gt", 30_000],
1924
2009
  * });
1925
2010
  *
1926
- * // compound filters can be constructed using boolean logic:
2011
+ * // 2. Basic compound filter: two conditions with AND
2012
+ * felt.setLayerFilters({
2013
+ * layerId: "layer-1",
2014
+ * filters: [
2015
+ * ["AREA", "gt", 30_000], // First condition
2016
+ * "and", // Logic operator
2017
+ * ["COLOR", "eq", "red"] // Second condition
2018
+ * ]
2019
+ * });
2020
+ *
2021
+ * // 3. Complex filter: three or more conditions require nesting
2022
+ * // ⚠️ IMPORTANT: Filters use a tree structure, not a flat list
1927
2023
  * felt.setLayerFilters({
1928
2024
  * layerId: "layer-1",
1929
- * filters: [["AREA", "gt", 30_000], "and", ["COLOR", "eq", "red"]]
1930
- * })
2025
+ * filters: [
2026
+ * ["AREA", "gt", 30_000], // First condition
2027
+ * "and", // First logic operator
2028
+ * [ // Nested group starts
2029
+ * ["COLOR", "eq", "red"], // Second condition
2030
+ * "and", // Second logic operator
2031
+ * ["TYPE", "eq", "residential"] // Third condition
2032
+ * ] // Nested group ends
2033
+ * ]
2034
+ * });
2035
+ *
2036
+ * // 4. Even more complex: four conditions with proper nesting
2037
+ * // Visual structure:
2038
+ * // AND
2039
+ * // / \
2040
+ * // condition AND
2041
+ * // / \
2042
+ * // condition AND
2043
+ * // / \
2044
+ * // condition condition
2045
+ * felt.setLayerFilters({
2046
+ * layerId: "layer-1",
2047
+ * filters: [
2048
+ * ["AREA", "gt", 30_000], // First condition
2049
+ * "and",
2050
+ * [
2051
+ * ["COLOR", "eq", "red"], // Second condition
2052
+ * "and",
2053
+ * [
2054
+ * ["TYPE", "eq", "residential"], // Third condition
2055
+ * "and",
2056
+ * ["YEAR", "gt", 2000] // Fourth condition
2057
+ * ]
2058
+ * ]
2059
+ * ]
2060
+ * });
2061
+ *
2062
+ * // 5. Mixed operators: combining AND and OR
2063
+ * // Visual structure:
2064
+ * // AND
2065
+ * // / \
2066
+ * // condition OR
2067
+ * // / \
2068
+ * // condition condition
2069
+ * felt.setLayerFilters({
2070
+ * layerId: "layer-1",
2071
+ * filters: [
2072
+ * ["AREA", "gt", 30_000], // Must have large area
2073
+ * "and",
2074
+ * [
2075
+ * ["COLOR", "eq", "red"], // Must be either red
2076
+ * "or",
2077
+ * ["TYPE", "eq", "residential"] // OR residential type
2078
+ * ]
2079
+ * ]
2080
+ * });
1931
2081
  * ```
1932
2082
  *
1933
2083
  * @group Filters
@@ -2179,8 +2329,8 @@ declare const GetLayerCategoriesParamsSchema: z.ZodObject<{
2179
2329
  } | undefined;
2180
2330
  }>>;
2181
2331
  }, "strip", z.ZodTypeAny, {
2182
- layerId: string;
2183
2332
  attribute: string;
2333
+ layerId: string;
2184
2334
  values?: {
2185
2335
  boundary?: [number, number][] | {
2186
2336
  type: "Polygon";
@@ -2199,8 +2349,8 @@ declare const GetLayerCategoriesParamsSchema: z.ZodObject<{
2199
2349
  filters?: boolean | [string | null, "in" | "ni", (string | number | boolean | null)[] | null] | [string | null, "lt" | "gt" | "le" | "ge" | "eq" | "ne" | "cn" | "nc" | "is" | "isnt", string | number | boolean | null] | FilterTernary | null | undefined;
2200
2350
  limit?: number | undefined;
2201
2351
  }, {
2202
- layerId: string;
2203
2352
  attribute: string;
2353
+ layerId: string;
2204
2354
  values?: {
2205
2355
  boundary?: [number, number][] | {
2206
2356
  type: "Polygon";
@@ -2370,8 +2520,8 @@ declare const GetLayerHistogramParamsSchema: z.ZodObject<{
2370
2520
  } | undefined;
2371
2521
  }>>;
2372
2522
  }, "strip", z.ZodTypeAny, {
2373
- layerId: string;
2374
2523
  attribute: string;
2524
+ layerId: string;
2375
2525
  steps: number[] | {
2376
2526
  type: "equal-intervals";
2377
2527
  count: number;
@@ -2396,8 +2546,8 @@ declare const GetLayerHistogramParamsSchema: z.ZodObject<{
2396
2546
  } | [number, number, number, number] | undefined;
2397
2547
  filters?: boolean | [string | null, "in" | "ni", (string | number | boolean | null)[] | null] | [string | null, "lt" | "gt" | "le" | "ge" | "eq" | "ne" | "cn" | "nc" | "is" | "isnt", string | number | boolean | null] | FilterTernary | null | undefined;
2398
2548
  }, {
2399
- layerId: string;
2400
2549
  attribute: string;
2550
+ layerId: string;
2401
2551
  steps: number[] | {
2402
2552
  type: "equal-intervals";
2403
2553
  count: number;
@@ -3044,4 +3194,4 @@ declare const ViewportFitBoundsParamsSchema: z.ZodObject<{
3044
3194
  bounds: [number, number, number, number];
3045
3195
  }>;
3046
3196
 
3047
- export type { ImageElementUpdate as $, AggregationMethod as A, FeatureSelection as B, ConfigurableToolType as C, ToolSettingsMap as D, Element as E, Filters as F, Geometry as G, ToolSettingsChangeEvent as H, InputToolSettings as I, zInfer as J, SetViewportCenterZoomParams as K, Layer as L, MapInteractionEvent as M, ViewportConstraints as N, ViewportFitBoundsParams as O, ViewportCenterZoom as P, CircleElementCreate as Q, CircleElementRead as R, SetVisibilityRequest as S, ToolType as T, CircleElementUpdate as U, ViewportState as V, HighlighterElementCreate as W, HighlighterElementRead as X, HighlighterElementUpdate as Y, ImageElementCreate as Z, ImageElementRead as _, GetElementsConstraint as a, LinkElementRead as a0, MarkerElementCreate as a1, MarkerElementRead as a2, MarkerElementUpdate as a3, NoteElementCreate as a4, NoteElementRead as a5, NoteElementUpdate as a6, PathElementCreate as a7, PathElementRead as a8, PathElementUpdate as a9, LngLatTuple as aA, MultiLineStringGeometry as aB, MultiPolygonGeometry as aC, PointGeometry as aD, PolygonGeometry as aE, CircleToolSettings as aF, HighlighterToolSettings as aG, LineToolSettings as aH, MarkerToolSettings as aI, NoteToolSettings as aJ, PinToolSettings as aK, PlaceFrame as aL, PlaceSymbol as aM, PolygonToolSettings as aN, RouteToolSettings as aO, TextToolSettings as aP, UnionToIntersection as aQ, PromiseOrNot as aR, PlaceElementCreate as aa, PlaceElementRead as ab, PlaceElementUpdate as ac, PolygonElementCreate as ad, PolygonElementRead as ae, PolygonElementUpdate as af, TextElementCreate as ag, TextElementRead as ah, TextElementUpdate as ai, LayerProcessingStatus as aj, RasterValue as ak, FilterExpression as al, FilterLogicGate as am, FilterTernary as an, AggregationConfig as ao, MultiAggregationConfig as ap, ValueConfiguration as aq, ElementGroupNode as ar, ElementNode as as, FeatureNode as at, LayerGroupNode as au, LayerNode as av, FeltBoundary as aw, FeltZoom as ax, LatLng as ay, LineStringGeometry as az, ElementGroup as b, GetElementGroupsConstraint as c, ElementChangeCallbackParams as d, ElementGroupChangeCallbackParams as e, ElementCreate as f, ElementUpdate as g, GetLayersConstraint as h, LayerChangeCallbackParams as i, LayerGroup as j, GetLayerGroupsConstraint as k, LayerGroupChangeCallbackParams as l, LegendItemIdentifier as m, LegendItem as n, LegendItemsConstraint as o, LegendItemChangeCallbackParams as p, LayerFilters as q, GetRenderedFeaturesConstraint as r, Feature as s, GetLayerCategoriesParams as t, GetLayerCategoriesGroup as u, GetLayerHistogramParams as v, GetLayerHistogramBin as w, GetLayerCalculationParams as x, MapDetails as y, EntityNode as z };
3197
+ export type { ImageElementRead as $, AggregationMethod as A, FeatureSelection as B, ConfigurableToolType as C, ToolSettingsMap as D, Element as E, Filters as F, Geometry as G, ToolSettingsChangeEvent as H, InputToolSettings as I, zInfer as J, SortConfig as K, Layer as L, MapInteractionEvent as M, SetViewportCenterZoomParams as N, ViewportConstraints as O, ViewportFitBoundsParams as P, ViewportCenterZoom as Q, CircleElementCreate as R, SetVisibilityRequest as S, ToolType as T, CircleElementRead as U, ViewportState as V, CircleElementUpdate as W, HighlighterElementCreate as X, HighlighterElementRead as Y, HighlighterElementUpdate as Z, ImageElementCreate as _, GetElementsConstraint as a, ImageElementUpdate as a0, LinkElementRead as a1, MarkerElementCreate as a2, MarkerElementRead as a3, MarkerElementUpdate as a4, NoteElementCreate as a5, NoteElementRead as a6, NoteElementUpdate as a7, PathElementCreate as a8, PathElementRead as a9, LineStringGeometry as aA, LngLatTuple as aB, MultiLineStringGeometry as aC, MultiPolygonGeometry as aD, PointGeometry as aE, PolygonGeometry as aF, SortDirection as aG, CircleToolSettings as aH, HighlighterToolSettings as aI, LineToolSettings as aJ, MarkerToolSettings as aK, NoteToolSettings as aL, PinToolSettings as aM, PlaceFrame as aN, PlaceSymbol as aO, PolygonToolSettings as aP, RouteToolSettings as aQ, TextToolSettings as aR, UnionToIntersection as aS, PromiseOrNot as aT, PathElementUpdate as aa, PlaceElementCreate as ab, PlaceElementRead as ac, PlaceElementUpdate as ad, PolygonElementCreate as ae, PolygonElementRead as af, PolygonElementUpdate as ag, TextElementCreate as ah, TextElementRead as ai, TextElementUpdate as aj, LayerProcessingStatus as ak, RasterValue as al, FilterExpression as am, FilterLogicGate as an, FilterTernary as ao, AggregationConfig as ap, MultiAggregationConfig as aq, ValueConfiguration as ar, ElementGroupNode as as, ElementNode as at, FeatureNode as au, LayerGroupNode as av, LayerNode as aw, FeltBoundary as ax, FeltZoom as ay, LatLng as az, ElementGroup as b, GetElementGroupsConstraint as c, ElementChangeCallbackParams as d, ElementGroupChangeCallbackParams as e, ElementCreate as f, ElementUpdate as g, GetLayersConstraint as h, LayerChangeCallbackParams as i, LayerGroup as j, GetLayerGroupsConstraint as k, LayerGroupChangeCallbackParams as l, LegendItemIdentifier as m, LegendItem as n, LegendItemsConstraint as o, LegendItemChangeCallbackParams as p, LayerFilters as q, GetRenderedFeaturesConstraint as r, Feature as s, GetLayerCategoriesParams as t, GetLayerCategoriesGroup as u, GetLayerHistogramParams as v, GetLayerHistogramBin as w, GetLayerCalculationParams as x, MapDetails as y, EntityNode as z };