@feltmaps/js-sdk 1.5.1 → 1.6.0-next.0
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.cjs +1 -1
- package/dist/client.d.cts +3 -624
- package/dist/client.d.ts +3 -624
- package/dist/client.js +1 -1
- package/dist/handler.cjs +1 -1
- package/dist/handler.d.cts +110 -1
- package/dist/handler.d.ts +110 -1
- package/dist/handler.js +1 -1
- package/dist/{types-CnYUajGG.d.cts → types-B241Rd9q.d.cts} +753 -15
- package/dist/{types-CnYUajGG.d.ts → types-B241Rd9q.d.ts} +753 -15
- package/handler.d.ts +110 -1
- package/handler.js +1 -1
- package/package.json +1 -1
- package/{types-CnYUajGG.d.ts → types-B241Rd9q.d.ts} +753 -15
package/handler.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z, ZodError } from 'zod';
|
|
2
|
-
import {
|
|
2
|
+
import { z as zInfer, E as Element, G as GeoJsonGeometry, b as ElementGroup, d as ElementChangeCallbackParams, e as ElementGroupChangeCallbackParams, M as MapInteractionEvent, aa as Layer, ad as LayerGroup, ag as LegendItem, aE as LayerFilters, ap as LayerFeature, bf as UnwrapPromise, L as LayersController, aV as GeoJsonFeature, aI as GetLayerCategoriesGroup, aK as GetLayerHistogramBin, aG as AggregationMethod, ar as LayerSchema, ab as LayerChangeCallbackParams, ae as LayerGroupChangeCallbackParams, ah as LegendItemChangeCallbackParams, aB as FilterTernary, h as MapDetails, i as EntityNode, T as ToolType, j as ToolSettingsMap, k as ToolSettingsChangeEvent, V as ViewportState, n as ViewportConstraints, bg as UnionToIntersection, bh as PromiseOrNot } from './types-B241Rd9q.js';
|
|
3
3
|
|
|
4
4
|
type Method<TRequest extends {
|
|
5
5
|
type: string;
|
|
@@ -2669,6 +2669,114 @@ declare const GetFeatureMessage: z.ZodObject<{
|
|
|
2669
2669
|
};
|
|
2670
2670
|
type: "getFeature";
|
|
2671
2671
|
}>;
|
|
2672
|
+
declare const GetFeaturesMessage: z.ZodObject<{
|
|
2673
|
+
type: z.ZodLiteral<"getFeatures">;
|
|
2674
|
+
params: z.ZodObject<{
|
|
2675
|
+
layerId: z.ZodString;
|
|
2676
|
+
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]>>;
|
|
2677
|
+
sorting: z.ZodOptional<z.ZodObject<{
|
|
2678
|
+
attribute: z.ZodString;
|
|
2679
|
+
direction: z.ZodEnum<["asc", "desc"]>;
|
|
2680
|
+
}, "strip", z.ZodTypeAny, {
|
|
2681
|
+
attribute: string;
|
|
2682
|
+
direction: "asc" | "desc";
|
|
2683
|
+
}, {
|
|
2684
|
+
attribute: string;
|
|
2685
|
+
direction: "asc" | "desc";
|
|
2686
|
+
}>>;
|
|
2687
|
+
boundary: z.ZodOptional<z.ZodUnion<[z.ZodTuple<[z.ZodNumber, z.ZodNumber, z.ZodNumber, z.ZodNumber], null>, z.ZodObject<{
|
|
2688
|
+
type: z.ZodLiteral<"Polygon">;
|
|
2689
|
+
coordinates: z.ZodArray<z.ZodEffects<z.ZodArray<z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>, "many">, [number, number][], [number, number][]>, "many">;
|
|
2690
|
+
}, "strip", z.ZodTypeAny, {
|
|
2691
|
+
type: "Polygon";
|
|
2692
|
+
coordinates: [number, number][][];
|
|
2693
|
+
}, {
|
|
2694
|
+
type: "Polygon";
|
|
2695
|
+
coordinates: [number, number][][];
|
|
2696
|
+
}>, z.ZodObject<{
|
|
2697
|
+
type: z.ZodLiteral<"MultiPolygon">;
|
|
2698
|
+
coordinates: z.ZodArray<z.ZodArray<z.ZodEffects<z.ZodArray<z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>, "many">, [number, number][], [number, number][]>, "many">, "many">;
|
|
2699
|
+
}, "strip", z.ZodTypeAny, {
|
|
2700
|
+
type: "MultiPolygon";
|
|
2701
|
+
coordinates: [number, number][][][];
|
|
2702
|
+
}, {
|
|
2703
|
+
type: "MultiPolygon";
|
|
2704
|
+
coordinates: [number, number][][][];
|
|
2705
|
+
}>, z.ZodArray<z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>, "many">]>>;
|
|
2706
|
+
search: z.ZodOptional<z.ZodString>;
|
|
2707
|
+
pagination: z.ZodOptional<z.ZodNullable<z.ZodOptional<z.ZodString>>>;
|
|
2708
|
+
}, "strip", z.ZodTypeAny, {
|
|
2709
|
+
layerId: string;
|
|
2710
|
+
search?: string | undefined;
|
|
2711
|
+
boundary?: [number, number, number, number] | [number, number][] | {
|
|
2712
|
+
type: "Polygon";
|
|
2713
|
+
coordinates: [number, number][][];
|
|
2714
|
+
} | {
|
|
2715
|
+
type: "MultiPolygon";
|
|
2716
|
+
coordinates: [number, number][][][];
|
|
2717
|
+
} | undefined;
|
|
2718
|
+
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;
|
|
2719
|
+
sorting?: {
|
|
2720
|
+
attribute: string;
|
|
2721
|
+
direction: "asc" | "desc";
|
|
2722
|
+
} | undefined;
|
|
2723
|
+
pagination?: string | null | undefined;
|
|
2724
|
+
}, {
|
|
2725
|
+
layerId: string;
|
|
2726
|
+
search?: string | undefined;
|
|
2727
|
+
boundary?: [number, number, number, number] | [number, number][] | {
|
|
2728
|
+
type: "Polygon";
|
|
2729
|
+
coordinates: [number, number][][];
|
|
2730
|
+
} | {
|
|
2731
|
+
type: "MultiPolygon";
|
|
2732
|
+
coordinates: [number, number][][][];
|
|
2733
|
+
} | undefined;
|
|
2734
|
+
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;
|
|
2735
|
+
sorting?: {
|
|
2736
|
+
attribute: string;
|
|
2737
|
+
direction: "asc" | "desc";
|
|
2738
|
+
} | undefined;
|
|
2739
|
+
pagination?: string | null | undefined;
|
|
2740
|
+
}>;
|
|
2741
|
+
}, z.UnknownKeysParam, z.ZodTypeAny, {
|
|
2742
|
+
params: {
|
|
2743
|
+
layerId: string;
|
|
2744
|
+
search?: string | undefined;
|
|
2745
|
+
boundary?: [number, number, number, number] | [number, number][] | {
|
|
2746
|
+
type: "Polygon";
|
|
2747
|
+
coordinates: [number, number][][];
|
|
2748
|
+
} | {
|
|
2749
|
+
type: "MultiPolygon";
|
|
2750
|
+
coordinates: [number, number][][][];
|
|
2751
|
+
} | undefined;
|
|
2752
|
+
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;
|
|
2753
|
+
sorting?: {
|
|
2754
|
+
attribute: string;
|
|
2755
|
+
direction: "asc" | "desc";
|
|
2756
|
+
} | undefined;
|
|
2757
|
+
pagination?: string | null | undefined;
|
|
2758
|
+
};
|
|
2759
|
+
type: "getFeatures";
|
|
2760
|
+
}, {
|
|
2761
|
+
params: {
|
|
2762
|
+
layerId: string;
|
|
2763
|
+
search?: string | undefined;
|
|
2764
|
+
boundary?: [number, number, number, number] | [number, number][] | {
|
|
2765
|
+
type: "Polygon";
|
|
2766
|
+
coordinates: [number, number][][];
|
|
2767
|
+
} | {
|
|
2768
|
+
type: "MultiPolygon";
|
|
2769
|
+
coordinates: [number, number][][][];
|
|
2770
|
+
} | undefined;
|
|
2771
|
+
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;
|
|
2772
|
+
sorting?: {
|
|
2773
|
+
attribute: string;
|
|
2774
|
+
direction: "asc" | "desc";
|
|
2775
|
+
} | undefined;
|
|
2776
|
+
pagination?: string | null | undefined;
|
|
2777
|
+
};
|
|
2778
|
+
type: "getFeatures";
|
|
2779
|
+
}>;
|
|
2672
2780
|
declare const GetGeoJsonFeatureMessage: z.ZodObject<{
|
|
2673
2781
|
type: z.ZodLiteral<"getGeoJsonFeature">;
|
|
2674
2782
|
params: z.ZodObject<{
|
|
@@ -3260,6 +3368,7 @@ type LayersSchema = {
|
|
|
3260
3368
|
setLayerFilters: Method<zInfer<typeof SetFiltersMessage>, void>;
|
|
3261
3369
|
getRenderedFeatures: Method<zInfer<typeof GetRenderedFeaturesMessage>, Array<LayerFeature>>;
|
|
3262
3370
|
getFeature: Method<zInfer<typeof GetFeatureMessage>, LayerFeature | null>;
|
|
3371
|
+
getFeatures: Method<zInfer<typeof GetFeaturesMessage>, UnwrapPromise<ReturnType<LayersController["getFeatures"]>>>;
|
|
3263
3372
|
getGeoJsonFeature: Method<zInfer<typeof GetGeoJsonFeatureMessage>, GeoJsonFeature | null>;
|
|
3264
3373
|
getCategoryData: Method<zInfer<typeof GetLayerCategoriesMessage>, Array<GetLayerCategoriesGroup>>;
|
|
3265
3374
|
getHistogramData: Method<zInfer<typeof GetLayerHistogramMessage>, Array<GetLayerHistogramBin>>;
|
package/handler.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var te=Object.defineProperty;var lt=Object.getOwnPropertyDescriptor;var pt=Object.getOwnPropertyNames;var mt=Object.prototype.hasOwnProperty;var ct=(r,l)=>{for(var I in l)te(r,I,{get:l[I],enumerable:!0})},yt=(r,l,I,z)=>{if(l&&typeof l=="object"||typeof l=="function")for(let C of pt(l))!mt.call(r,C)&&C!==I&&te(r,C,{get:()=>l[C],enumerable:!(z=lt(l,C))||z.enumerable});return r};var gt=r=>yt(te({},"__esModule",{value:!0}),r);var gr={};ct(gr,{createMessageHandler:()=>ir});module.exports=gt(gr);var y=require("zod");var d=require("zod");var f=require("zod");function t(r,l){return f.z.strictObject({type:f.z.literal(r),params:l})}function S(r,l){return f.z.strictObject({eventName:f.z.literal(r),id:f.z.string(),options:l})}function p(r){return f.z.strictObject({eventName:f.z.literal(r),id:f.z.string()})}var i=require("zod"),H=i.z.number(),J=i.z.number(),B=i.z.object({latitude:J,longitude:H}),G=i.z.tuple([H,J]),V=i.z.object({type:i.z.literal("Polygon"),coordinates:i.z.array(i.z.array(G).min(4).refine(r=>r[0][0]===r[r.length-1][0]&&r[0][1]===r[r.length-1][1],"The last point of each ring must be identical to the first"))}),Z=i.z.object({type:i.z.literal("MultiPolygon"),coordinates:i.z.array(V.shape.coordinates)}),dt=i.z.object({type:i.z.literal("LineString"),coordinates:i.z.array(G).min(2)}),v=i.z.object({type:i.z.literal("MultiLineString"),coordinates:i.z.array(dt.shape.coordinates)}),he=i.z.number().min(1).max(23),x=i.z.tuple([H,J,H,J]),T=i.z.object({show:i.z.array(i.z.string()).optional(),hide:i.z.array(i.z.string()).optional()}),ut=i.z.enum(["asc","desc"]),fe=i.z.object({attribute:i.z.string(),direction:ut});var e=require("zod");var h=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()}),ne=e.z.object({strokeOpacity:e.z.number(),strokeWidth:e.z.number(),strokeStyle:e.z.enum(["solid","dashed","dotted"])}),ht=e.z.enum(["meter","kilometer","foot","mile"]),q=h.extend(_.shape).extend({type:e.z.literal("Place"),coordinates:G,symbol:e.z.string(),frame:e.z.enum(["frame-circle","frame-square"]).nullable(),hideLabel:e.z.boolean()}),w=h.extend(_.shape).extend(ne.shape).extend({type:e.z.literal("Path"),coordinates:v.shape.coordinates,distanceMarker:e.z.boolean(),routingMode:e.z.enum(["driving","cycling","walking","flying"]).nullable(),endCaps:e.z.boolean()}),U=h.extend(_.shape).extend(ne.shape).extend({type:e.z.literal("Polygon"),coordinates:V.shape.coordinates,fillOpacity:e.z.number().min(0).max(1),areaMarker:e.z.boolean()}),W=h.extend(_.shape).extend(ne.shape).extend({type:e.z.literal("Circle"),center:G,radius:e.z.number(),radiusMarker:e.z.boolean(),radiusDisplayAngle:e.z.number(),radiusDisplayUnit:ht.nullable(),fillOpacity:e.z.number().min(0).max(1)}),O=h.extend({type:e.z.literal("Marker"),coordinates:v.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=h.extend({type:e.z.literal("Highlighter"),coordinates:Z.shape.coordinates,renderHoles:e.z.boolean(),opacity:e.z.number().min(0).max(1)}),Se=e.z.object({position:G,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()}),oe=h.extend(Se.shape).extend({type:e.z.literal("Text")}),re=h.extend(Se.shape).extend({type:e.z.literal("Note"),widthScale:e.z.number().min(0)}),R=h.extend({type:e.z.literal("Image"),coordinates:v.shape.coordinates,imageUrl:e.z.string(),opacity:e.z.number().min(0).max(1)}).omit({color:!0}),ft=h.extend({type:e.z.literal("Link"),coordinates:v.shape.coordinates,url:e.z.string()}),P={type:!0,coordinates:!0},L={id:!0},ae=q.partial().extend(q.pick(P).shape).omit(L),Q=w.partial().extend(w.pick(P).shape).omit(L),ie=U.partial().extend(U.pick(P).shape).omit(L),se=W.partial().extend(W.pick({type:!0,center:!0,radius:!0}).shape).omit(L),le=O.partial().extend(O.pick(P).shape).omit(L),pe=j.partial().extend(j.pick(P).shape).omit(L),me=oe.partial().omit({...L,name:!0,type:!0}).extend({type:e.z.literal("Text"),text:e.z.string()}),ce=re.partial().omit({...L,name:!0,type:!0}).extend({type:e.z.literal("Note"),text:e.z.string()}),St=R.partial().extend(R.pick({...P,imageUrl:!0}).shape).omit(L),xe=e.z.discriminatedUnion("type",[ae,Q,ie,se,le,pe,St,me,ce]);var xr=w.omit({coordinates:!0}),Lr=U.omit({coordinates:!0});var br=O.omit({coordinates:!0}),Mr=j.omit({coordinates:!0});var Cr=R.omit({coordinates:!0}),Gr=ft.omit({coordinates:!0}),b={type:!0,id:!0},xt=q.partial().extend(q.pick(b).shape),Lt=w.partial().extend(w.pick(b).shape),bt=U.partial().extend(U.pick(b).shape),Mt=W.partial().extend(W.pick(b).shape),Ct=O.partial().extend(O.pick(b).shape),Gt=j.partial().extend(j.pick(b).shape),It=oe.partial().extend(oe.pick(b).shape).omit({name:!0}),Tt=re.partial().extend(re.pick(b).shape).omit({name:!0}),Et=R.partial().extend(R.pick(b).shape),Le=e.z.discriminatedUnion("type",[xt,Lt,bt,Mt,Ct,Gt,It,Tt,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()),Pt=t("getElementGeometry",d.z.string()),Ft=t("getElements",be.optional()),kt=t("getElementGroup",d.z.string()),Vt=t("getElementGroups",Me.optional()),vt=t("setElementGroupVisibility",T),wt=S("onElementChange",d.z.object({id:d.z.string()})),Ut=p("onElementCreate"),Ot=p("onElementCreateEnd"),jt=S("onElementDelete",d.z.object({id:d.z.string()})),Rt=S("onElementGroupChange",d.z.object({id:d.z.string()})),Nt=t("createElement",xe),At=t("updateElement",Le),Dt=t("deleteElement",d.z.string()),Ce={methods:[zt,Pt,Ft,kt,Vt,vt,Nt,At,Dt],listeners:[wt,Ut,Ot,jt,Rt]};var Ht=p("onPointerClick"),Jt=p("onPointerMove"),Ge={methods:null,listeners:[Ht,Jt]};var s=require("zod");var a=require("zod"),Bt=a.z.enum(["in","ni"]),Zt=a.z.enum(["lt","gt","le","ge","eq","ne","cn","nc","is","isnt"]),Vr=a.z.enum(["and","or"]),Ie=a.z.union([a.z.number(),a.z.string(),a.z.boolean(),a.z.null()]),Te=a.z.string().or(a.z.null()),qt=a.z.tuple([Te,Bt,a.z.array(Ie).or(a.z.null())]),Wt=a.z.tuple([Te,Zt,Ie]),ye=a.z.union([qt,Wt]),ge=a.z.tuple([a.z.lazy(()=>a.z.union([ge,ye,a.z.null(),a.z.boolean()])),a.z.enum(["and","or"]),a.z.lazy(()=>a.z.union([ge,ye,a.z.null(),a.z.boolean()]))]),E=a.z.union([ge,ye,a.z.null(),a.z.boolean()]);var n=require("zod");var Ee=n.z.enum(["avg","max","min","sum","median"]),_t=n.z.object({method:Ee,attribute:n.z.string()}),Qt=n.z.object({methods:n.z.array(n.z.union([Ee,n.z.literal("count")])),attribute:n.z.string().optional()}),$=n.z.union([x,V,Z,n.z.array(G)]),ze=n.z.object({boundary:$.optional(),filters:E.optional(),aggregation:_t.optional()}),Pe=n.z.object({layerId:n.z.string(),attribute:n.z.string(),limit:n.z.number().optional(),boundary:$.optional(),filters:E.optional(),values:ze.optional()}),Or=n.z.object({key:n.z.union([n.z.number(),n.z.string(),n.z.boolean()]),value:n.z.number().nullable()}),$t=n.z.object({type:n.z.literal("equal-intervals"),count:n.z.number()}),Kt=n.z.object({type:n.z.literal("time-interval"),interval:n.z.enum(["hour","day","week","month","year"])}),Fe=n.z.object({layerId:n.z.string(),attribute:n.z.string(),steps:n.z.union([$t,Kt,n.z.array(n.z.number())]),boundary:$.optional(),filters:E.optional(),values:ze.optional()}),jr=n.z.object({min:n.z.number(),max:n.z.number(),value:n.z.number()}),ke=n.z.object({layerId:n.z.string(),boundary:$.optional(),filters:E.optional(),aggregation:Qt});var o=require("zod");var Ar=o.z.enum(["processing","completed","failed","incomplete"]),Ve=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()}),ve=o.z.object({type:o.z.literal("geoJsonData"),data:o.z.object({}).passthrough().or(o.z.instanceof(ArrayBuffer))}),we=o.z.object({type:o.z.literal("geoJsonFile"),file:o.z.instanceof(File)}),Ue=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([Ve,ve,we]).optional()}),Oe=o.z.object({ids:o.z.array(o.z.string()).optional()}),je=o.z.object({ids:o.z.array(o.z.string()).optional()}),F=o.z.object({id:o.z.string(),layerId:o.z.string()}),Re=o.z.object({ids:F.array().optional(),layerIds:o.z.string().array().optional()}),Ne=o.z.object({layerIds:o.z.array(o.z.string()).optional(),areaQuery:o.z.union([o.z.object({coordinates:B}),o.z.object({boundary:x})]).optional()}),Xt=o.z.object({Point:o.z.object({}).passthrough().optional(),Line:o.z.object({}).passthrough().optional(),Polygon:o.z.object({}).passthrough().optional()}),Ae=o.z.object({source:o.z.union([Ve,ve,we]),name:o.z.string(),bounds:x.optional(),caption:o.z.string().optional(),description:o.z.string().optional(),geometryStyles:Xt.optional()});var Yt=t("getLayer",s.z.string()),eo=t("getLayers",Oe.optional()),to=t("setLayerVisibility",T),oo=S("onLayerChange",s.z.object({id:s.z.string()})),ro=t("setLayerStyle",s.z.object({id:s.z.string(),style:s.z.object({}).passthrough()})),no=t("setLayerLegendVisibility",T),ao=t("createLayersFromGeoJson",Ae),io=t("updateLayer",Ue),so=t("deleteLayer",s.z.string()),lo=t("getLayerGroup",s.z.string()),po=t("getLayerGroups",je.optional()),mo=t("setLayerGroupVisibility",T),co=t("setLayerGroupLegendVisibility",T),yo=S("onLayerGroupChange",s.z.object({id:s.z.string()})),go=t("getLegendItem",F),uo=t("getLegendItems",Re.optional()),ho=S("onLegendItemChange",F),fo=t("setLegendItemVisibility",s.z.object({show:F.array().optional(),hide:F.array().optional()})),So=t("getLayerFilters",s.z.string()),xo=t("setLayerFilters",s.z.object({layerId:s.z.string(),filters:E,note:s.z.string().optional()})),Lo=S("onLayerFiltersChange",s.z.object({layerId:s.z.string()})),bo=t("getRenderedFeatures",Ne.optional()),Mo=t("getFeature",s.z.object({id:s.z.string().or(s.z.number()),layerId:s.z.string()})),Co=t("getGeoJsonFeature",s.z.object({id:s.z.string().or(s.z.number()),layerId:s.z.string()})),Go=t("getCategoryData",Pe),Io=t("getHistogramData",Fe),To=t("getAggregates",ke),Eo=t("getLayerSchema",s.z.string()),De={methods:[Yt,eo,to,ro,no,ao,so,io,lo,po,mo,co,go,uo,fo,So,xo,bo,Mo,Co,Go,Io,To,Eo],listeners:[oo,yo,ho,Lo]};var He=require("zod");var zo=t("getMapDetails",He.z.undefined()),Je={methods:[zo],listeners:[]};var N=require("zod");var M=require("zod"),Be=M.z.object({id:M.z.string().or(M.z.number()),layerId:M.z.string(),showPopup:M.z.boolean().optional(),fitViewport:M.z.boolean().or(M.z.object({maxZoom:M.z.number()})).optional()});var Po=t("getSelection",N.z.undefined()),Fo=p("onSelectionChange"),ko=t("selectFeature",Be),Vo=t("clearSelection",N.z.object({features:N.z.boolean().optional(),elements:N.z.boolean().optional()}).optional()),Ze={methods:[Po,ko,Vo],listeners:[Fo]};var $e=require("zod");var m=require("zod");var qe=["pin","line","route","polygon","circle","marker","highlighter","text","note"],We=m.z.enum([...qe,"link"]),_e=m.z.enum(qe),vo=ae.pick({color:!0,symbol:!0,frame:!0}).extend({afterCreation:m.z.enum(["enter name","add another","select"])}).required(),wo=Q.pick({color:!0,strokeOpacity:!0,strokeWidth:!0,strokeStyle:!0,distanceMarker:!0}).required(),Uo=Q.pick({color:!0,routingMode:!0,strokeOpacity:!0,strokeWidth:!0,strokeStyle:!0,distanceMarker:!0,endCaps:!0}).required(),Oo=ie.pick({color:!0,fillOpacity:!0,strokeOpacity:!0,strokeWidth:!0,strokeStyle:!0,areaMarker:!0}).required(),jo=se.pick({color:!0,fillOpacity:!0,strokeOpacity:!0,strokeWidth:!0,strokeStyle:!0,radiusMarker:!0}).required(),Ro=le.pick({color:!0,opacity:!0,size:!0}).required(),No=pe.pick({color:!0,opacity:!0,renderHoles:!0}).extend({size:m.z.number().min(0).max(200)}).required(),Ao=me.pick({color:!0,align:!0,style:!0}).required(),Do=ce.pick({color:!0,align:!0,style:!0}).required(),Qe=m.z.discriminatedUnion("tool",[vo.partial().extend({tool:m.z.literal("pin")}),wo.partial().extend({tool:m.z.literal("line")}),Uo.partial().extend({tool:m.z.literal("route")}),Oo.partial().extend({tool:m.z.literal("polygon")}),jo.partial().extend({tool:m.z.literal("circle")}),Ro.partial().extend({tool:m.z.literal("marker")}),No.partial().extend({tool:m.z.literal("highlighter")}),Ao.partial().extend({tool:m.z.literal("text")}),Do.partial().extend({tool:m.z.literal("note")})]);var Ho=t("setTool",We.nullable()),Jo=t("getTool",$e.z.undefined()),Bo=p("onToolChange"),Zo=t("setToolSettings",Qe),qo=t("getToolSettings",_e),Wo=p("onToolSettingsChange"),Ke={methods:[Ho,Jo,Zo,qo],listeners:[Bo,Wo]};var K=require("zod");var c=require("zod"),Xe=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()}),Ye=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 _o=t("updateUiControls",Xe),Qo=t("setOnMapInteractionsUi",Ye),$o=t("showLayerDataTable",K.z.object({layerId:K.z.string(),sorting:fe.optional()}).optional()),Ko=t("hideLayerDataTable",K.z.undefined()),et={methods:[_o,Qo,$o,Ko],listeners:null};var de=require("zod");var A=require("zod");var X=A.z.object({center:B,zoom:he}),tt=A.z.object({center:X.shape.center.optional(),zoom:X.shape.zoom.optional()}),ot=A.z.object({minZoom:X.shape.zoom.nullish(),maxZoom:X.shape.zoom.nullish(),bounds:x.nullish()}).nullable(),rt=A.z.object({bounds:x});var Xo=t("getViewport",de.z.undefined()),Yo=t("setViewport",tt),er=t("getViewportConstraints",de.z.undefined()),tr=t("setViewportConstraints",ot),or=t("fitViewportToBounds",rt),rr=p("onViewportMove"),nr=p("onViewportMoveEnd"),ar=p("onMapIdle"),nt={methods:[Yo,Xo,er,tr,or],listeners:[rr,nr,ar]};var ue=[et,nt,De,Ce,Ze,Ge,Ke,Je];function ir(r,l,I){let z=new Map;async function C(u){if(!cr.safeParse(u.data).success){I?.onUnknownMessage?.(u.data);return}let D=st.safeParse(u.data);if(!D.success){I?.onInvalidMessage?.(u.data,D.error),u.ports[0]?.postMessage(at(D.error.message));return}let{data:g}=D;if(g.type==="felt.ready")u.ports[0]?.postMessage(!0);else if(g.type==="felt.addListener"){if(g.event.eventName==="")throw new Error("felt.addListener eventName cannot be empty");let k="options"in g.event?{options:"options"in g.event?g.event.options:void 0,handler:ee=>{u.ports[0]?.postMessage(ee)}}:{handler:ee=>{u.ports[0]?.postMessage(ee)}},Y=l.listeners[g.event.eventName](k);z.set(g.event.id,Y)}else if(g.type==="felt.removeListener")z.get(g.id)?.(),z.delete(g.id);else try{let k=l.methods[g.type],Y=await k(g.params);u.ports[0]?.postMessage(Y)}catch(k){u.ports[0]?.postMessage(at(k))}}return r.addEventListener("message",C),()=>{r.removeEventListener("message",C)}}var it={methods:ue.map(r=>r.methods??[]).flat(),listeners:ue.map(r=>r.listeners??[]).flat()},sr=y.z.discriminatedUnion("eventName",[y.z.strictObject({eventName:y.z.literal("")}),...it.listeners]),lr=y.z.strictObject({type:y.z.literal("felt.addListener"),event:sr}),pr=y.z.strictObject({type:y.z.literal("felt.removeListener"),id:y.z.string()}),mr=y.z.strictObject({type:y.z.literal("felt.ready")}),st=y.z.discriminatedUnion("type",[mr,lr,pr,...it.methods]),cr=y.z.object({type:y.z.enum(st.options.map(r=>r.shape.type.value))});function at(r){return{__error__:yr(r)}}function yr(r){return r instanceof Error?r.message:typeof r=="object"&&r!==null&&"message"in r?String(r.message):typeof r=="string"?r:"Unknown error"}0&&(module.exports={createMessageHandler});
|
|
1
|
+
"use strict";var oe=Object.defineProperty;var lt=Object.getOwnPropertyDescriptor;var pt=Object.getOwnPropertyNames;var mt=Object.prototype.hasOwnProperty;var ct=(r,l)=>{for(var T in l)oe(r,T,{get:l[T],enumerable:!0})},yt=(r,l,T,P)=>{if(l&&typeof l=="object"||typeof l=="function")for(let C of pt(l))!mt.call(r,C)&&C!==T&&oe(r,C,{get:()=>l[C],enumerable:!(P=lt(l,C))||P.enumerable});return r};var gt=r=>yt(oe({},"__esModule",{value:!0}),r);var dr={};ct(dr,{createMessageHandler:()=>sr});module.exports=gt(dr);var y=require("zod");var d=require("zod");var f=require("zod");function t(r,l){return f.z.strictObject({type:f.z.literal(r),params:l})}function S(r,l){return f.z.strictObject({eventName:f.z.literal(r),id:f.z.string(),options:l})}function p(r){return f.z.strictObject({eventName:f.z.literal(r),id:f.z.string()})}var s=require("zod"),J=s.z.number(),B=s.z.number(),Z=s.z.object({latitude:B,longitude:J}),G=s.z.tuple([J,B]),v=s.z.object({type:s.z.literal("Polygon"),coordinates:s.z.array(s.z.array(G).min(4).refine(r=>r[0][0]===r[r.length-1][0]&&r[0][1]===r[r.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(v.shape.coordinates)}),dt=s.z.object({type:s.z.literal("LineString"),coordinates:s.z.array(G).min(2)}),w=s.z.object({type:s.z.literal("MultiLineString"),coordinates:s.z.array(dt.shape.coordinates)}),fe=s.z.number().min(1).max(23),x=s.z.tuple([J,B,J,B]),E=s.z.object({show:s.z.array(s.z.string()).optional(),hide:s.z.array(s.z.string()).optional()}),ut=s.z.enum(["asc","desc"]),W=s.z.object({attribute:s.z.string(),direction:ut});var e=require("zod");var h=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"])}),ht=e.z.enum(["meter","kilometer","foot","mile"]),_=h.extend($.shape).extend({type:e.z.literal("Place"),coordinates:G,symbol:e.z.string(),frame:e.z.enum(["frame-circle","frame-square"]).nullable(),hideLabel:e.z.boolean()}),U=h.extend($.shape).extend(ae.shape).extend({type:e.z.literal("Path"),coordinates:w.shape.coordinates,distanceMarker:e.z.boolean(),routingMode:e.z.enum(["driving","cycling","walking","flying"]).nullable(),endCaps:e.z.boolean()}),O=h.extend($.shape).extend(ae.shape).extend({type:e.z.literal("Polygon"),coordinates:v.shape.coordinates,fillOpacity:e.z.number().min(0).max(1),areaMarker:e.z.boolean()}),Q=h.extend($.shape).extend(ae.shape).extend({type:e.z.literal("Circle"),center:G,radius:e.z.number(),radiusMarker:e.z.boolean(),radiusDisplayAngle:e.z.number(),radiusDisplayUnit:ht.nullable(),fillOpacity:e.z.number().min(0).max(1)}),j=h.extend({type:e.z.literal("Marker"),coordinates:w.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=h.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:G,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=h.extend(Se.shape).extend({type:e.z.literal("Text")}),ne=h.extend(Se.shape).extend({type:e.z.literal("Note"),widthScale:e.z.number().min(0)}),N=h.extend({type:e.z.literal("Image"),coordinates:w.shape.coordinates,imageUrl:e.z.string(),opacity:e.z.number().min(0).max(1)}).omit({color:!0}),ft=h.extend({type:e.z.literal("Link"),coordinates:w.shape.coordinates,url:e.z.string()}),F={type:!0,coordinates:!0},L={id:!0},ie=_.partial().extend(_.pick(F).shape).omit(L),K=U.partial().extend(U.pick(F).shape).omit(L),se=O.partial().extend(O.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),me=R.partial().extend(R.pick(F).shape).omit(L),ce=re.partial().omit({...L,name:!0,type:!0}).extend({type:e.z.literal("Text"),text:e.z.string()}),ye=ne.partial().omit({...L,name:!0,type:!0}).extend({type:e.z.literal("Note"),text:e.z.string()}),St=N.partial().extend(N.pick({...F,imageUrl:!0}).shape).omit(L),xe=e.z.discriminatedUnion("type",[ie,K,se,le,pe,me,St,ce,ye]);var Lr=U.omit({coordinates:!0}),br=O.omit({coordinates:!0});var Mr=j.omit({coordinates:!0}),Cr=R.omit({coordinates:!0});var Gr=N.omit({coordinates:!0}),Ir=ft.omit({coordinates:!0}),b={type:!0,id:!0},xt=_.partial().extend(_.pick(b).shape),Lt=U.partial().extend(U.pick(b).shape),bt=O.partial().extend(O.pick(b).shape),Mt=Q.partial().extend(Q.pick(b).shape),Ct=j.partial().extend(j.pick(b).shape),Gt=R.partial().extend(R.pick(b).shape),It=re.partial().extend(re.pick(b).shape).omit({name:!0}),Tt=ne.partial().extend(ne.pick(b).shape).omit({name:!0}),Et=N.partial().extend(N.pick(b).shape),Le=e.z.discriminatedUnion("type",[xt,Lt,bt,Mt,Ct,Gt,It,Tt,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()),Pt=t("getElementGeometry",d.z.string()),Ft=t("getElements",be.optional()),kt=t("getElementGroup",d.z.string()),Vt=t("getElementGroups",Me.optional()),vt=t("setElementGroupVisibility",E),wt=S("onElementChange",d.z.object({id:d.z.string()})),Ut=p("onElementCreate"),Ot=p("onElementCreateEnd"),jt=S("onElementDelete",d.z.object({id:d.z.string()})),Rt=S("onElementGroupChange",d.z.object({id:d.z.string()})),Nt=t("createElement",xe),At=t("updateElement",Le),Dt=t("deleteElement",d.z.string()),Ce={methods:[zt,Pt,Ft,kt,Vt,vt,Nt,At,Dt],listeners:[wt,Ut,Ot,jt,Rt]};var Ht=p("onPointerClick"),Jt=p("onPointerMove"),Ge={methods:null,listeners:[Ht,Jt]};var i=require("zod");var a=require("zod");var Bt=a.z.enum(["in","ni"]),Zt=a.z.enum(["lt","gt","le","ge","eq","ne","cn","nc","is","isnt"]),wr=a.z.enum(["and","or"]),Ie=a.z.union([a.z.number(),a.z.string(),a.z.boolean(),a.z.null()]),Te=a.z.string().or(a.z.null()),qt=a.z.tuple([Te,Bt,a.z.array(Ie).or(a.z.null())]),Wt=a.z.tuple([Te,Zt,Ie]),ge=a.z.union([qt,Wt]),de=a.z.tuple([a.z.lazy(()=>a.z.union([de,ge,a.z.null(),a.z.boolean()])),a.z.enum(["and","or"]),a.z.lazy(()=>a.z.union([de,ge,a.z.null(),a.z.boolean()]))]),I=a.z.union([de,ge,a.z.null(),a.z.boolean()]),z=a.z.union([x,v,q,a.z.array(G)]);var n=require("zod");var Ee=n.z.enum(["avg","max","min","sum","median"]),_t=n.z.object({method:Ee,attribute:n.z.string()}),Qt=n.z.object({methods:n.z.array(n.z.union([Ee,n.z.literal("count")])),attribute:n.z.string().optional()}),ze=n.z.object({boundary:z.optional(),filters:I.optional(),aggregation:_t.optional()}),Pe=n.z.object({layerId:n.z.string(),attribute:n.z.string(),limit:n.z.number().optional(),boundary:z.optional(),filters:I.optional(),values:ze.optional()}),jr=n.z.object({key:n.z.union([n.z.number(),n.z.string(),n.z.boolean()]),value:n.z.number().nullable()}),$t=n.z.object({type:n.z.literal("equal-intervals"),count:n.z.number()}),Kt=n.z.object({type:n.z.literal("time-interval"),interval:n.z.enum(["hour","day","week","month","year"])}),Fe=n.z.object({layerId:n.z.string(),attribute:n.z.string(),steps:n.z.union([$t,Kt,n.z.array(n.z.number())]),boundary:z.optional(),filters:I.optional(),values:ze.optional()}),Rr=n.z.object({min:n.z.number(),max:n.z.number(),value:n.z.number()}),ke=n.z.object({layerId:n.z.string(),boundary:z.optional(),filters:I.optional(),aggregation:Qt});var o=require("zod");var Dr=o.z.enum(["processing","completed","failed","incomplete"]),Ve=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()}),ve=o.z.object({type:o.z.literal("geoJsonData"),data:o.z.object({}).passthrough().or(o.z.instanceof(ArrayBuffer))}),we=o.z.object({type:o.z.literal("geoJsonFile"),file:o.z.instanceof(File)}),Ue=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([Ve,ve,we]).optional()}),Oe=o.z.object({ids:o.z.array(o.z.string()).optional()}),je=o.z.object({ids:o.z.array(o.z.string()).optional()}),k=o.z.object({id:o.z.string(),layerId:o.z.string()}),Re=o.z.object({ids:k.array().optional(),layerIds:o.z.string().array().optional()}),Ne=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()}),Xt=o.z.object({Point:o.z.object({}).passthrough().optional(),Line:o.z.object({}).passthrough().optional(),Polygon:o.z.object({}).passthrough().optional()}),Ae=o.z.object({source:o.z.union([Ve,ve,we]),name:o.z.string(),bounds:x.optional(),caption:o.z.string().optional(),description:o.z.string().optional(),geometryStyles:Xt.optional()});var Yt=t("getLayer",i.z.string()),eo=t("getLayers",Oe.optional()),to=t("setLayerVisibility",E),oo=S("onLayerChange",i.z.object({id:i.z.string()})),ro=t("setLayerStyle",i.z.object({id:i.z.string(),style:i.z.object({}).passthrough()})),no=t("setLayerLegendVisibility",E),ao=t("createLayersFromGeoJson",Ae),io=t("updateLayer",Ue),so=t("deleteLayer",i.z.string()),lo=t("getLayerGroup",i.z.string()),po=t("getLayerGroups",je.optional()),mo=t("setLayerGroupVisibility",E),co=t("setLayerGroupLegendVisibility",E),yo=S("onLayerGroupChange",i.z.object({id:i.z.string()})),go=t("getLegendItem",k),uo=t("getLegendItems",Re.optional()),ho=S("onLegendItemChange",k),fo=t("setLegendItemVisibility",i.z.object({show:k.array().optional(),hide:k.array().optional()})),So=t("getLayerFilters",i.z.string()),xo=t("setLayerFilters",i.z.object({layerId:i.z.string(),filters:I,note:i.z.string().optional()})),Lo=S("onLayerFiltersChange",i.z.object({layerId:i.z.string()})),bo=t("getRenderedFeatures",Ne.optional()),Mo=t("getFeature",i.z.object({id:i.z.string().or(i.z.number()),layerId:i.z.string()})),Co=t("getFeatures",i.z.object({layerId:i.z.string(),filters:I.optional(),sorting:W.optional(),boundary:z.optional(),search:i.z.string().optional(),pagination:i.z.string().optional().nullish()})),Go=t("getGeoJsonFeature",i.z.object({id:i.z.string().or(i.z.number()),layerId:i.z.string()})),Io=t("getCategoryData",Pe),To=t("getHistogramData",Fe),Eo=t("getAggregates",ke),zo=t("getLayerSchema",i.z.string()),De={methods:[Yt,eo,to,ro,no,ao,so,io,lo,po,mo,co,go,uo,fo,So,xo,bo,Mo,Co,Go,Io,To,Eo,zo],listeners:[oo,yo,ho,Lo]};var He=require("zod");var Po=t("getMapDetails",He.z.undefined()),Je={methods:[Po],listeners:[]};var A=require("zod");var M=require("zod"),Be=M.z.object({id:M.z.string().or(M.z.number()),layerId:M.z.string(),showPopup:M.z.boolean().optional(),fitViewport:M.z.boolean().or(M.z.object({maxZoom:M.z.number()})).optional()});var Fo=t("getSelection",A.z.undefined()),ko=p("onSelectionChange"),Vo=t("selectFeature",Be),vo=t("clearSelection",A.z.object({features:A.z.boolean().optional(),elements:A.z.boolean().optional()}).optional()),Ze={methods:[Fo,Vo,vo],listeners:[ko]};var $e=require("zod");var m=require("zod");var qe=["pin","line","route","polygon","circle","marker","highlighter","text","note"],We=m.z.enum([...qe,"link"]),_e=m.z.enum(qe),wo=ie.pick({color:!0,symbol:!0,frame:!0}).extend({afterCreation:m.z.enum(["enter name","add another","select"])}).required(),Uo=K.pick({color:!0,strokeOpacity:!0,strokeWidth:!0,strokeStyle:!0,distanceMarker:!0}).required(),Oo=K.pick({color:!0,routingMode:!0,strokeOpacity:!0,strokeWidth:!0,strokeStyle:!0,distanceMarker:!0,endCaps:!0}).required(),jo=se.pick({color:!0,fillOpacity:!0,strokeOpacity:!0,strokeWidth:!0,strokeStyle:!0,areaMarker:!0}).required(),Ro=le.pick({color:!0,fillOpacity:!0,strokeOpacity:!0,strokeWidth:!0,strokeStyle:!0,radiusMarker:!0}).required(),No=pe.pick({color:!0,opacity:!0,size:!0}).required(),Ao=me.pick({color:!0,opacity:!0,renderHoles:!0}).extend({size:m.z.number().min(0).max(200)}).required(),Do=ce.pick({color:!0,align:!0,style:!0}).required(),Ho=ye.pick({color:!0,align:!0,style:!0}).required(),Qe=m.z.discriminatedUnion("tool",[wo.partial().extend({tool:m.z.literal("pin")}),Uo.partial().extend({tool:m.z.literal("line")}),Oo.partial().extend({tool:m.z.literal("route")}),jo.partial().extend({tool:m.z.literal("polygon")}),Ro.partial().extend({tool:m.z.literal("circle")}),No.partial().extend({tool:m.z.literal("marker")}),Ao.partial().extend({tool:m.z.literal("highlighter")}),Do.partial().extend({tool:m.z.literal("text")}),Ho.partial().extend({tool:m.z.literal("note")})]);var Jo=t("setTool",We.nullable()),Bo=t("getTool",$e.z.undefined()),Zo=p("onToolChange"),qo=t("setToolSettings",Qe),Wo=t("getToolSettings",_e),_o=p("onToolSettingsChange"),Ke={methods:[Jo,Bo,qo,Wo],listeners:[Zo,_o]};var X=require("zod");var c=require("zod"),Xe=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()}),Ye=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 Qo=t("updateUiControls",Xe),$o=t("setOnMapInteractionsUi",Ye),Ko=t("showLayerDataTable",X.z.object({layerId:X.z.string(),sorting:W.optional()}).optional()),Xo=t("hideLayerDataTable",X.z.undefined()),et={methods:[Qo,$o,Ko,Xo],listeners:null};var ue=require("zod");var D=require("zod");var Y=D.z.object({center:Z,zoom:fe}),tt=D.z.object({center:Y.shape.center.optional(),zoom:Y.shape.zoom.optional()}),ot=D.z.object({minZoom:Y.shape.zoom.nullish(),maxZoom:Y.shape.zoom.nullish(),bounds:x.nullish()}).nullable(),rt=D.z.object({bounds:x});var Yo=t("getViewport",ue.z.undefined()),er=t("setViewport",tt),tr=t("getViewportConstraints",ue.z.undefined()),or=t("setViewportConstraints",ot),rr=t("fitViewportToBounds",rt),nr=p("onViewportMove"),ar=p("onViewportMoveEnd"),ir=p("onMapIdle"),nt={methods:[er,Yo,tr,or,rr],listeners:[nr,ar,ir]};var he=[et,nt,De,Ce,Ze,Ge,Ke,Je];function sr(r,l,T){let P=new Map;async function C(u){if(!yr.safeParse(u.data).success){T?.onUnknownMessage?.(u.data);return}let H=st.safeParse(u.data);if(!H.success){T?.onInvalidMessage?.(u.data,H.error),u.ports[0]?.postMessage(at(H.error.message));return}let{data:g}=H;if(g.type==="felt.ready")u.ports[0]?.postMessage(!0);else if(g.type==="felt.addListener"){if(g.event.eventName==="")throw new Error("felt.addListener eventName cannot be empty");let V="options"in g.event?{options:"options"in g.event?g.event.options:void 0,handler:te=>{u.ports[0]?.postMessage(te)}}:{handler:te=>{u.ports[0]?.postMessage(te)}},ee=l.listeners[g.event.eventName](V);P.set(g.event.id,ee)}else if(g.type==="felt.removeListener")P.get(g.id)?.(),P.delete(g.id);else try{let V=l.methods[g.type],ee=await V(g.params);u.ports[0]?.postMessage(ee)}catch(V){u.ports[0]?.postMessage(at(V))}}return r.addEventListener("message",C),()=>{r.removeEventListener("message",C)}}var it={methods:he.map(r=>r.methods??[]).flat(),listeners:he.map(r=>r.listeners??[]).flat()},lr=y.z.discriminatedUnion("eventName",[y.z.strictObject({eventName:y.z.literal("")}),...it.listeners]),pr=y.z.strictObject({type:y.z.literal("felt.addListener"),event:lr}),mr=y.z.strictObject({type:y.z.literal("felt.removeListener"),id:y.z.string()}),cr=y.z.strictObject({type:y.z.literal("felt.ready")}),st=y.z.discriminatedUnion("type",[cr,pr,mr,...it.methods]),yr=y.z.object({type:y.z.enum(st.options.map(r=>r.shape.type.value))});function at(r){return{__error__:gr(r)}}function gr(r){return r instanceof Error?r.message:typeof r=="object"&&r!==null&&"message"in r?String(r.message):typeof r=="string"?r:"Unknown error"}0&&(module.exports={createMessageHandler});
|