@feltmaps/js-sdk 1.5.0-next.15 → 1.5.0-next.17
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/chunk-QXPO53SH.js +1 -0
- package/dist/client.cjs +1 -1
- package/dist/client.d.cts +34 -15
- package/dist/client.d.ts +34 -15
- package/dist/client.js +1 -1
- package/dist/handler.cjs +1 -1
- package/dist/handler.d.cts +501 -203
- package/dist/handler.d.ts +501 -203
- package/dist/handler.js +1 -1
- package/dist/{types-PSY3LPGC.d.cts → types-DrMm8Los.d.cts} +2832 -434
- package/dist/{types-PSY3LPGC.d.ts → types-DrMm8Los.d.ts} +2832 -434
- package/handler.d.ts +501 -203
- package/handler.js +1 -1
- package/package.json +1 -2
- package/{types-PSY3LPGC.d.ts → types-DrMm8Los.d.ts} +2832 -434
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function r(n){return n.data&&typeof n.data=="object"&&"__error__"in n.data}function t(n){return{__error__:e(n)}}function e(n){return n instanceof Error?n.message:typeof n=="object"&&n!==null&&"message"in n?String(n.message):typeof n=="string"?n:"Unknown error"}export{r as a,t as b};
|
package/dist/client.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var c=Object.defineProperty;var G=Object.getOwnPropertyDescriptor;var
|
|
1
|
+
"use strict";var c=Object.defineProperty;var G=Object.getOwnPropertyDescriptor;var V=Object.getOwnPropertyNames;var b=Object.prototype.hasOwnProperty;var f=(e,r)=>{for(var n in r)c(e,n,{get:r[n],enumerable:!0})},I=(e,r,n,s)=>{if(r&&typeof r=="object"||typeof r=="function")for(let a of V(r))!b.call(e,a)&&a!==n&&c(e,a,{get:()=>r[a],enumerable:!(s=G(r,a))||s.enumerable});return e};var x=e=>I(c({},"__esModule",{value:!0}),e);var K={};f(K,{Felt:()=>S});module.exports=x(K);function u(e){return e.data&&typeof e.data=="object"&&"__error__"in e.data}function o(e,r){return n=>{let s=new MessageChannel,a=n.handler,i="options"in n?n.options:void 0,m=crypto.randomUUID();return e.postMessage({type:"felt.addListener",event:i?{eventName:r,id:m,options:i}:{eventName:r,id:m}},"*",[s.port2]),s.port1.onmessage=g=>{u(g)||a(g.data)},()=>{s.port1.onmessage=null,s.port1.close(),s.port2.close(),e.postMessage({type:"felt.removeListener",id:m},"*")}}}function t(e,r,n){return async s=>{let a=new MessageChannel,i=s&&n?await n(s):s;return e.postMessage({type:r,params:i},"*",[a.port2]),new Promise((m,g)=>{a.port1.onmessage=y=>{u(y)?g(new Error(y.data.__error__)):m(y.data),a.port1.close(),a.port2.close()}})}}var C=e=>({getElement:t(e,"getElement"),getElementGeometry:t(e,"getElementGeometry"),getElements:t(e,"getElements"),setElementGroupVisibility:t(e,"setElementGroupVisibility"),getElementGroup:t(e,"getElementGroup"),getElementGroups:t(e,"getElementGroups"),onElementChange:o(e,"onElementChange"),onElementCreate:o(e,"onElementCreate"),onElementCreateEnd:o(e,"onElementCreateEnd"),onElementDelete:o(e,"onElementDelete"),onElementGroupChange:o(e,"onElementGroupChange"),createElement:t(e,"createElement"),updateElement:t(e,"updateElement"),deleteElement:t(e,"deleteElement")});var L=e=>({onPointerClick:o(e,"onPointerClick"),onPointerMove:o(e,"onPointerMove")});var h=e=>({getLayer:t(e,"getLayer"),getLayers:t(e,"getLayers"),setLayerVisibility:t(e,"setLayerVisibility"),setLayerStyle:t(e,"setLayerStyle"),setLayerLegendVisibility:t(e,"setLayerLegendVisibility"),onLayerChange:o(e,"onLayerChange"),createLayer:t(e,"createLayer",async r=>"url"in r.source||"arrayBuffer"in r.source?r:{source:{...r.source,arrayBuffer:await r.source.file.arrayBuffer()}}),deleteLayer:t(e,"deleteLayer"),getLayerGroup:t(e,"getLayerGroup"),getLayerGroups:t(e,"getLayerGroups"),setLayerGroupVisibility:t(e,"setLayerGroupVisibility"),setLayerGroupLegendVisibility:t(e,"setLayerGroupLegendVisibility"),onLayerGroupChange:o(e,"onLayerGroupChange"),getLegendItem:t(e,"getLegendItem"),getLegendItems:t(e,"getLegendItems"),setLegendItemVisibility:t(e,"setLegendItemVisibility"),onLegendItemChange:o(e,"onLegendItemChange"),getLayerFilters:t(e,"getLayerFilters"),setLayerFilters:t(e,"setLayerFilters"),onLayerFiltersChange:o(e,"onLayerFiltersChange"),getRenderedFeatures:t(e,"getRenderedFeatures"),getFeature:t(e,"getFeature"),getGeoJsonFeature:t(e,"getGeoJsonFeature"),getCategoryData:t(e,"getCategoryData"),getHistogramData:t(e,"getHistogramData"),getAggregates:t(e,"getAggregates"),getLayerSchema:t(e,"getLayerSchema")});var T=e=>({getMapDetails:t(e,"getMapDetails")});var E=e=>({onSelectionChange:o(e,"onSelectionChange"),getSelection:t(e,"getSelection"),selectFeature:t(e,"selectFeature"),clearSelection:t(e,"clearSelection")});var P=e=>({setTool:t(e,"setTool"),getTool:t(e,"getTool"),onToolChange:o(e,"onToolChange"),setToolSettings:t(e,"setToolSettings"),getToolSettings:t(e,"getToolSettings"),onToolSettingsChange:o(e,"onToolSettingsChange")});var v=e=>({updateUiControls:t(e,"updateUiControls"),setOnMapInteractionsUi:t(e,"setOnMapInteractionsUi"),showLayerDataTable:t(e,"showLayerDataTable"),hideLayerDataTable:t(e,"hideLayerDataTable")});var M=e=>({getViewport:t(e,"getViewport"),setViewport:t(e,"setViewport"),getViewportConstraints:t(e,"getViewportConstraints"),setViewportConstraints:t(e,"setViewportConstraints"),fitViewportToBounds:t(e,"fitViewportToBounds"),onViewportMove:o(e,"onViewportMove"),onViewportMoveEnd:o(e,"onViewportMoveEnd"),onMapIdle:o(e,"onMapIdle")});function F(e){return{iframe:null,...M(e),...v(e),...h(e),...C(e),...E(e),...L(e),...P(e),...T(e)}}var S={embed(e,r,n){let s={uiControls:{showLegend:!0,cooperativeGestures:!0,fullScreenButton:!0,geolocation:!1,zoomControls:!0,scaleBar:!0},initialViewport:void 0,origin:"https://felt.com"},a=n?.origin??s.origin,i=new URL(`${a}/embed/map/${r}`),m={showLegend:"legend",cooperativeGestures:"cooperativeGestures",fullScreenButton:"link",geolocation:"geolocation",zoomControls:"zoomControls",scaleBar:"scaleBar"},g={...s.uiControls,...n?.uiControls};for(let[p,d]of k(g))d!=null&&i.searchParams.set(m[p],d?"1":"0");if(n?.token&&i.searchParams.set("token",n.token),n?.initialViewport){let p=n.initialViewport;i.searchParams.set("loc",`${p.center.latitude},${p.center.longitude},${p.zoom}z`)}let y=e.tagName==="IFRAME",l=y?e:e.ownerDocument.createElement("iframe");return l.src=i.toString(),y||(l.style.width="100%",l.style.height="100%",l.style.border="none",l.style.margin="0",e.appendChild(l)),l.referrerPolicy="strict-origin-when-cross-origin",new Promise((p,d)=>{l.addEventListener("load",()=>{l.contentWindow==null?d(new Error("Failed to load Felt map")):p(l.contentWindow)},{once:!0})}).then(S.connect).then(p=>(Object.defineProperties(p,{iframe:{value:l,writable:!1,configurable:!1}}),p))},connect(e){let r=F(e);return new Promise((n,s)=>{let a=setTimeout(()=>{s(new Error("Failed to load Felt map")),clearInterval(m)},5e3),i=new MessageChannel,m=setInterval(()=>{e.postMessage({type:"felt.ready"},"*",[i.port2])},100);i.port1.onmessage=g=>{g.data===!0&&(clearInterval(m),clearTimeout(a),i.port1.close(),i.port2.close(),n(r))}})}},k=Object.entries;0&&(module.exports={Felt});
|
package/dist/client.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { E as Element, G as GeoJsonGeometry, a as GetElementsConstraint, b as ElementGroup, c as GetElementGroupsConstraint, S as SetVisibilityRequest, d as ElementChangeCallbackParams, e as ElementGroupChangeCallbackParams, f as ElementCreate, g as ElementUpdate, L as Layer, h as GetLayersConstraint, i as LayerChangeCallbackParams, j as GeoJsonArrayBufferSource, k as GeoJsonFileSource, l as GeoJsonUrlSource, m as LayerGroup, n as GetLayerGroupsConstraint, o as LayerGroupChangeCallbackParams, p as LegendItemIdentifier, q as LegendItem, r as LegendItemsConstraint, s as LegendItemChangeCallbackParams, t as LayerFilters, F as Filters, u as GetRenderedFeaturesConstraint, v as LayerFeature, w as GeoJsonFeature, x as GetLayerCategoriesParams, y as GetLayerCategoriesGroup, z as GetLayerHistogramParams, A as GetLayerHistogramBin, B as AggregationMethod, C as GetLayerCalculationParams, D as LayerSchema, M as MapInteractionEvent, H as MapDetails, I as EntityNode, J as FeatureSelection, T as ToolType, K as InputToolSettings, N as ConfigurableToolType, O as ToolSettingsMap, P as ToolSettingsChangeEvent, Q as zInfer, R as SortConfig, V as ViewportState, U as SetViewportCenterZoomParams, W as ViewportConstraints, X as ViewportFitBoundsParams, Y as ViewportCenterZoom } from './types-
|
|
2
|
-
export { aC as AggregationConfig, Z as CircleElementCreate, _ as CircleElementRead, $ as CircleElementUpdate, aW as CircleToolSettings, aF as ElementGroupNode, aG as ElementNode, ap as EphemeralLayerSource, aH as FeatureNode, aK as FeltBoundary, aL as FeltZoom, az as FilterExpression, aA as FilterLogicGate, aB as FilterTernary, aM as GeoJsonProperties, a0 as HighlighterElementCreate, a1 as HighlighterElementRead, a2 as HighlighterElementUpdate, aX as HighlighterToolSettings, a3 as ImageElementCreate, a4 as ImageElementRead, a5 as ImageElementUpdate, aN as LatLng, aI as LayerGroupNode, aJ as LayerNode, aq as LayerProcessingStatus, as as LayerSchemaAttribute, at as LayerSchemaBooleanAttribute, au as LayerSchemaCommonAttribute, av as LayerSchemaDateAttribute, aw as LayerSchemaDateTimeAttribute, ax as LayerSchemaNumericAttribute, ay as LayerSchemaTextAttribute, aO as LineStringGeometry, aY as LineToolSettings, a6 as LinkElementRead, aP as LngLatTuple, a7 as MarkerElementCreate, a8 as MarkerElementRead, a9 as MarkerElementUpdate, aZ as MarkerToolSettings, aD as MultiAggregationConfig, aQ as MultiLineStringGeometry, aR as MultiPointGeometry, aS as MultiPolygonGeometry, aa as NoteElementCreate, ab as NoteElementRead, ac as NoteElementUpdate, a_ as NoteToolSettings, ad as PathElementCreate, ae as PathElementRead, af as PathElementUpdate, a$ as PinToolSettings, ag as PlaceElementCreate, ah as PlaceElementRead, ai as PlaceElementUpdate, b0 as PlaceFrame, b1 as PlaceSymbol, aT as PointGeometry, aj as PolygonElementCreate, ak as PolygonElementRead, al as PolygonElementUpdate, aU as PolygonGeometry, b2 as PolygonToolSettings, ar as RasterValue, b3 as RouteToolSettings, aV as SortDirection, am as TextElementCreate, an as TextElementRead, ao as TextElementUpdate, b4 as TextToolSettings, aE as ValueConfiguration } from './types-
|
|
1
|
+
import { E as Element, G as GeoJsonGeometry, a as GetElementsConstraint, b as ElementGroup, c as GetElementGroupsConstraint, S as SetVisibilityRequest, d as ElementChangeCallbackParams, e as ElementGroupChangeCallbackParams, f as ElementCreate, g as ElementUpdate, L as Layer, h as GetLayersConstraint, i as LayerChangeCallbackParams, j as GeoJsonArrayBufferSource, k as GeoJsonFileSource, l as GeoJsonUrlSource, m as LayerGroup, n as GetLayerGroupsConstraint, o as LayerGroupChangeCallbackParams, p as LegendItemIdentifier, q as LegendItem, r as LegendItemsConstraint, s as LegendItemChangeCallbackParams, t as LayerFilters, F as Filters, u as GetRenderedFeaturesConstraint, v as LayerFeature, w as GeoJsonFeature, x as GetLayerCategoriesParams, y as GetLayerCategoriesGroup, z as GetLayerHistogramParams, A as GetLayerHistogramBin, B as AggregationMethod, C as GetLayerCalculationParams, D as LayerSchema, M as MapInteractionEvent, H as MapDetails, I as EntityNode, J as FeatureSelection, T as ToolType, K as InputToolSettings, N as ConfigurableToolType, O as ToolSettingsMap, P as ToolSettingsChangeEvent, Q as zInfer, R as SortConfig, V as ViewportState, U as SetViewportCenterZoomParams, W as ViewportConstraints, X as ViewportFitBoundsParams, Y as ViewportCenterZoom } from './types-DrMm8Los.cjs';
|
|
2
|
+
export { aC as AggregationConfig, Z as CircleElementCreate, _ as CircleElementRead, $ as CircleElementUpdate, aW as CircleToolSettings, aF as ElementGroupNode, aG as ElementNode, ap as EphemeralLayerSource, aH as FeatureNode, aK as FeltBoundary, aL as FeltZoom, az as FilterExpression, aA as FilterLogicGate, aB as FilterTernary, aM as GeoJsonProperties, a0 as HighlighterElementCreate, a1 as HighlighterElementRead, a2 as HighlighterElementUpdate, aX as HighlighterToolSettings, a3 as ImageElementCreate, a4 as ImageElementRead, a5 as ImageElementUpdate, aN as LatLng, aI as LayerGroupNode, aJ as LayerNode, aq as LayerProcessingStatus, as as LayerSchemaAttribute, at as LayerSchemaBooleanAttribute, au as LayerSchemaCommonAttribute, av as LayerSchemaDateAttribute, aw as LayerSchemaDateTimeAttribute, ax as LayerSchemaNumericAttribute, ay as LayerSchemaTextAttribute, aO as LineStringGeometry, aY as LineToolSettings, a6 as LinkElementRead, aP as LngLatTuple, a7 as MarkerElementCreate, a8 as MarkerElementRead, a9 as MarkerElementUpdate, aZ as MarkerToolSettings, aD as MultiAggregationConfig, aQ as MultiLineStringGeometry, aR as MultiPointGeometry, aS as MultiPolygonGeometry, aa as NoteElementCreate, ab as NoteElementRead, ac as NoteElementUpdate, a_ as NoteToolSettings, ad as PathElementCreate, ae as PathElementRead, af as PathElementUpdate, a$ as PinToolSettings, ag as PlaceElementCreate, ah as PlaceElementRead, ai as PlaceElementUpdate, b0 as PlaceFrame, b1 as PlaceSymbol, aT as PointGeometry, aj as PolygonElementCreate, ak as PolygonElementRead, al as PolygonElementUpdate, aU as PolygonGeometry, b2 as PolygonToolSettings, ar as RasterValue, b3 as RouteToolSettings, aV as SortDirection, am as TextElementCreate, an as TextElementRead, ao as TextElementUpdate, b4 as TextToolSettings, aE as ValueConfiguration } from './types-DrMm8Los.cjs';
|
|
3
3
|
import { z } from 'zod';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -25,7 +25,23 @@ interface ElementsController {
|
|
|
25
25
|
*/
|
|
26
26
|
id: string): Promise<Element | null>;
|
|
27
27
|
/**
|
|
28
|
-
* Get the geometry of an element.
|
|
28
|
+
* Get the geometry of an element in GeoJSON geometry format.
|
|
29
|
+
*
|
|
30
|
+
* For most element types, the geometry returned is based on the `coordinates`
|
|
31
|
+
* property of the element, with some differences:
|
|
32
|
+
*
|
|
33
|
+
* - For Circle elements, the geometry is a Polygon drawn from the `center` and
|
|
34
|
+
* `radius` properties.
|
|
35
|
+
*
|
|
36
|
+
* - Path elements become MultiLineString geometries.
|
|
37
|
+
*
|
|
38
|
+
* - Marker elements return a MultiLineString of the path traced by the user
|
|
39
|
+
* as they drew the marker. Note that this is not the polygon formed by filled-in
|
|
40
|
+
* "pen" stroke, which doesn't exactly follow the path traced by the user as it
|
|
41
|
+
* is smoothed and interpolated to create a continuous line.
|
|
42
|
+
*
|
|
43
|
+
* - Text, Note and Image elements do not return geometry, so will return `null`.
|
|
44
|
+
*
|
|
29
45
|
*
|
|
30
46
|
* @example
|
|
31
47
|
* ```typescript
|
|
@@ -121,7 +137,7 @@ interface ElementsController {
|
|
|
121
137
|
* still being created by a drawing tool.
|
|
122
138
|
*
|
|
123
139
|
* If you want to know when the element is finished being created, you can
|
|
124
|
-
* use the `
|
|
140
|
+
* use the {@link ElementsController.onElementCreateEnd | `onElementCreateEnd`} listener.
|
|
125
141
|
*
|
|
126
142
|
* @param change - An object describing the change that occurred.
|
|
127
143
|
*/
|
|
@@ -130,7 +146,7 @@ interface ElementsController {
|
|
|
130
146
|
/**
|
|
131
147
|
* Listens for when a new element is finished being created by a drawing tool.
|
|
132
148
|
*
|
|
133
|
-
* This differs from the `onElementCreate` listener, which fires whenever an
|
|
149
|
+
* This differs from the {@link ElementsController.onElementCreate | `onElementCreate`} listener, which fires whenever an
|
|
134
150
|
* element is first created. This fires when the user finishes creating an element
|
|
135
151
|
* which could be after a series of interactions.
|
|
136
152
|
*
|
|
@@ -167,10 +183,10 @@ interface ElementsController {
|
|
|
167
183
|
* This will fire when an element is being edited, either on the map by the user
|
|
168
184
|
* or programatically.
|
|
169
185
|
*
|
|
170
|
-
* Like the `onElementCreate` listener, this will fire when an element is
|
|
186
|
+
* Like the {@link ElementsController.onElementCreate | `onElementCreate`} listener, this will fire when an element is
|
|
171
187
|
* still being created by a drawing tool.
|
|
172
188
|
*
|
|
173
|
-
* You can check the `isBeingCreated` property to determine if the element is
|
|
189
|
+
* You can check the {@link ElementChangeCallbackParams.isBeingCreated | `isBeingCreated`} property to determine if the element is
|
|
174
190
|
* still being created by a drawing tool.
|
|
175
191
|
*
|
|
176
192
|
* @returns A function to unsubscribe from the listener
|
|
@@ -213,7 +229,7 @@ interface ElementsController {
|
|
|
213
229
|
* ```typescript
|
|
214
230
|
* const unsubscribe = felt.onElementDelete({
|
|
215
231
|
* options: { id: "element-1" },
|
|
216
|
-
* handler: (
|
|
232
|
+
* handler: () => console.log("element-1 deleted"),
|
|
217
233
|
* });
|
|
218
234
|
*
|
|
219
235
|
* // later on...
|
|
@@ -278,7 +294,7 @@ interface ElementsController {
|
|
|
278
294
|
* // Update a polygon's style
|
|
279
295
|
* await felt.updateElement({
|
|
280
296
|
* id: "element-2",
|
|
281
|
-
* color: "#
|
|
297
|
+
* color: "#ABC123",
|
|
282
298
|
* fillOpacity: 0.5
|
|
283
299
|
* });
|
|
284
300
|
* ```
|
|
@@ -707,6 +723,8 @@ interface LayersController {
|
|
|
707
723
|
* Get a feature in GeoJSON format from the map by its ID and layer ID.
|
|
708
724
|
*
|
|
709
725
|
* The response is a GeoJSON Feature object with the complete geometry of the
|
|
726
|
+
* feature. Note that for some _very_ large geometries, the response may take a
|
|
727
|
+
* long time to return, and may return a very large object.
|
|
710
728
|
*
|
|
711
729
|
* @example
|
|
712
730
|
* ```typescript
|
|
@@ -1643,17 +1661,17 @@ declare const FeltEmbedOptionsSchema: z.ZodObject<{
|
|
|
1643
1661
|
}>;
|
|
1644
1662
|
zoom: z.ZodNumber;
|
|
1645
1663
|
}, "strip", z.ZodTypeAny, {
|
|
1646
|
-
zoom: number;
|
|
1647
1664
|
center: {
|
|
1648
1665
|
latitude: number;
|
|
1649
1666
|
longitude: number;
|
|
1650
1667
|
};
|
|
1651
|
-
}, {
|
|
1652
1668
|
zoom: number;
|
|
1669
|
+
}, {
|
|
1653
1670
|
center: {
|
|
1654
1671
|
latitude: number;
|
|
1655
1672
|
longitude: number;
|
|
1656
1673
|
};
|
|
1674
|
+
zoom: number;
|
|
1657
1675
|
}>>;
|
|
1658
1676
|
}, "strip", z.ZodTypeAny, {
|
|
1659
1677
|
origin?: string | undefined;
|
|
@@ -1667,11 +1685,11 @@ declare const FeltEmbedOptionsSchema: z.ZodObject<{
|
|
|
1667
1685
|
scaleBar?: boolean | undefined;
|
|
1668
1686
|
} | undefined;
|
|
1669
1687
|
initialViewport?: {
|
|
1670
|
-
zoom: number;
|
|
1671
1688
|
center: {
|
|
1672
1689
|
latitude: number;
|
|
1673
1690
|
longitude: number;
|
|
1674
1691
|
};
|
|
1692
|
+
zoom: number;
|
|
1675
1693
|
} | undefined;
|
|
1676
1694
|
}, {
|
|
1677
1695
|
origin?: string | undefined;
|
|
@@ -1685,11 +1703,11 @@ declare const FeltEmbedOptionsSchema: z.ZodObject<{
|
|
|
1685
1703
|
scaleBar?: boolean | undefined;
|
|
1686
1704
|
} | undefined;
|
|
1687
1705
|
initialViewport?: {
|
|
1688
|
-
zoom: number;
|
|
1689
1706
|
center: {
|
|
1690
1707
|
latitude: number;
|
|
1691
1708
|
longitude: number;
|
|
1692
1709
|
};
|
|
1710
|
+
zoom: number;
|
|
1693
1711
|
} | undefined;
|
|
1694
1712
|
}>;
|
|
1695
1713
|
|
|
@@ -1732,12 +1750,13 @@ declare const FeltEmbedOptionsSchema: z.ZodObject<{
|
|
|
1732
1750
|
*/
|
|
1733
1751
|
declare const Felt: {
|
|
1734
1752
|
/**
|
|
1735
|
-
* Embeds a Felt map into the provided container
|
|
1753
|
+
* Embeds a Felt map into the provided container, returning a promise that resolves
|
|
1754
|
+
* to a {@link FeltController} object that you can use to control the map.
|
|
1736
1755
|
*
|
|
1737
1756
|
* @param container - The container element to embed the map into.
|
|
1738
1757
|
* @param mapId - The ID of the map to embed.
|
|
1739
1758
|
* @param options - The options to configure the map.
|
|
1740
|
-
* @returns
|
|
1759
|
+
* @returns A promise for a {@link FeltController}.
|
|
1741
1760
|
*/
|
|
1742
1761
|
embed(container: HTMLElement, mapId: string, options?: FeltEmbedOptions): Promise<FeltController>;
|
|
1743
1762
|
/**
|
package/dist/client.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { E as Element, G as GeoJsonGeometry, a as GetElementsConstraint, b as ElementGroup, c as GetElementGroupsConstraint, S as SetVisibilityRequest, d as ElementChangeCallbackParams, e as ElementGroupChangeCallbackParams, f as ElementCreate, g as ElementUpdate, L as Layer, h as GetLayersConstraint, i as LayerChangeCallbackParams, j as GeoJsonArrayBufferSource, k as GeoJsonFileSource, l as GeoJsonUrlSource, m as LayerGroup, n as GetLayerGroupsConstraint, o as LayerGroupChangeCallbackParams, p as LegendItemIdentifier, q as LegendItem, r as LegendItemsConstraint, s as LegendItemChangeCallbackParams, t as LayerFilters, F as Filters, u as GetRenderedFeaturesConstraint, v as LayerFeature, w as GeoJsonFeature, x as GetLayerCategoriesParams, y as GetLayerCategoriesGroup, z as GetLayerHistogramParams, A as GetLayerHistogramBin, B as AggregationMethod, C as GetLayerCalculationParams, D as LayerSchema, M as MapInteractionEvent, H as MapDetails, I as EntityNode, J as FeatureSelection, T as ToolType, K as InputToolSettings, N as ConfigurableToolType, O as ToolSettingsMap, P as ToolSettingsChangeEvent, Q as zInfer, R as SortConfig, V as ViewportState, U as SetViewportCenterZoomParams, W as ViewportConstraints, X as ViewportFitBoundsParams, Y as ViewportCenterZoom } from './types-
|
|
2
|
-
export { aC as AggregationConfig, Z as CircleElementCreate, _ as CircleElementRead, $ as CircleElementUpdate, aW as CircleToolSettings, aF as ElementGroupNode, aG as ElementNode, ap as EphemeralLayerSource, aH as FeatureNode, aK as FeltBoundary, aL as FeltZoom, az as FilterExpression, aA as FilterLogicGate, aB as FilterTernary, aM as GeoJsonProperties, a0 as HighlighterElementCreate, a1 as HighlighterElementRead, a2 as HighlighterElementUpdate, aX as HighlighterToolSettings, a3 as ImageElementCreate, a4 as ImageElementRead, a5 as ImageElementUpdate, aN as LatLng, aI as LayerGroupNode, aJ as LayerNode, aq as LayerProcessingStatus, as as LayerSchemaAttribute, at as LayerSchemaBooleanAttribute, au as LayerSchemaCommonAttribute, av as LayerSchemaDateAttribute, aw as LayerSchemaDateTimeAttribute, ax as LayerSchemaNumericAttribute, ay as LayerSchemaTextAttribute, aO as LineStringGeometry, aY as LineToolSettings, a6 as LinkElementRead, aP as LngLatTuple, a7 as MarkerElementCreate, a8 as MarkerElementRead, a9 as MarkerElementUpdate, aZ as MarkerToolSettings, aD as MultiAggregationConfig, aQ as MultiLineStringGeometry, aR as MultiPointGeometry, aS as MultiPolygonGeometry, aa as NoteElementCreate, ab as NoteElementRead, ac as NoteElementUpdate, a_ as NoteToolSettings, ad as PathElementCreate, ae as PathElementRead, af as PathElementUpdate, a$ as PinToolSettings, ag as PlaceElementCreate, ah as PlaceElementRead, ai as PlaceElementUpdate, b0 as PlaceFrame, b1 as PlaceSymbol, aT as PointGeometry, aj as PolygonElementCreate, ak as PolygonElementRead, al as PolygonElementUpdate, aU as PolygonGeometry, b2 as PolygonToolSettings, ar as RasterValue, b3 as RouteToolSettings, aV as SortDirection, am as TextElementCreate, an as TextElementRead, ao as TextElementUpdate, b4 as TextToolSettings, aE as ValueConfiguration } from './types-
|
|
1
|
+
import { E as Element, G as GeoJsonGeometry, a as GetElementsConstraint, b as ElementGroup, c as GetElementGroupsConstraint, S as SetVisibilityRequest, d as ElementChangeCallbackParams, e as ElementGroupChangeCallbackParams, f as ElementCreate, g as ElementUpdate, L as Layer, h as GetLayersConstraint, i as LayerChangeCallbackParams, j as GeoJsonArrayBufferSource, k as GeoJsonFileSource, l as GeoJsonUrlSource, m as LayerGroup, n as GetLayerGroupsConstraint, o as LayerGroupChangeCallbackParams, p as LegendItemIdentifier, q as LegendItem, r as LegendItemsConstraint, s as LegendItemChangeCallbackParams, t as LayerFilters, F as Filters, u as GetRenderedFeaturesConstraint, v as LayerFeature, w as GeoJsonFeature, x as GetLayerCategoriesParams, y as GetLayerCategoriesGroup, z as GetLayerHistogramParams, A as GetLayerHistogramBin, B as AggregationMethod, C as GetLayerCalculationParams, D as LayerSchema, M as MapInteractionEvent, H as MapDetails, I as EntityNode, J as FeatureSelection, T as ToolType, K as InputToolSettings, N as ConfigurableToolType, O as ToolSettingsMap, P as ToolSettingsChangeEvent, Q as zInfer, R as SortConfig, V as ViewportState, U as SetViewportCenterZoomParams, W as ViewportConstraints, X as ViewportFitBoundsParams, Y as ViewportCenterZoom } from './types-DrMm8Los.js';
|
|
2
|
+
export { aC as AggregationConfig, Z as CircleElementCreate, _ as CircleElementRead, $ as CircleElementUpdate, aW as CircleToolSettings, aF as ElementGroupNode, aG as ElementNode, ap as EphemeralLayerSource, aH as FeatureNode, aK as FeltBoundary, aL as FeltZoom, az as FilterExpression, aA as FilterLogicGate, aB as FilterTernary, aM as GeoJsonProperties, a0 as HighlighterElementCreate, a1 as HighlighterElementRead, a2 as HighlighterElementUpdate, aX as HighlighterToolSettings, a3 as ImageElementCreate, a4 as ImageElementRead, a5 as ImageElementUpdate, aN as LatLng, aI as LayerGroupNode, aJ as LayerNode, aq as LayerProcessingStatus, as as LayerSchemaAttribute, at as LayerSchemaBooleanAttribute, au as LayerSchemaCommonAttribute, av as LayerSchemaDateAttribute, aw as LayerSchemaDateTimeAttribute, ax as LayerSchemaNumericAttribute, ay as LayerSchemaTextAttribute, aO as LineStringGeometry, aY as LineToolSettings, a6 as LinkElementRead, aP as LngLatTuple, a7 as MarkerElementCreate, a8 as MarkerElementRead, a9 as MarkerElementUpdate, aZ as MarkerToolSettings, aD as MultiAggregationConfig, aQ as MultiLineStringGeometry, aR as MultiPointGeometry, aS as MultiPolygonGeometry, aa as NoteElementCreate, ab as NoteElementRead, ac as NoteElementUpdate, a_ as NoteToolSettings, ad as PathElementCreate, ae as PathElementRead, af as PathElementUpdate, a$ as PinToolSettings, ag as PlaceElementCreate, ah as PlaceElementRead, ai as PlaceElementUpdate, b0 as PlaceFrame, b1 as PlaceSymbol, aT as PointGeometry, aj as PolygonElementCreate, ak as PolygonElementRead, al as PolygonElementUpdate, aU as PolygonGeometry, b2 as PolygonToolSettings, ar as RasterValue, b3 as RouteToolSettings, aV as SortDirection, am as TextElementCreate, an as TextElementRead, ao as TextElementUpdate, b4 as TextToolSettings, aE as ValueConfiguration } from './types-DrMm8Los.js';
|
|
3
3
|
import { z } from 'zod';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -25,7 +25,23 @@ interface ElementsController {
|
|
|
25
25
|
*/
|
|
26
26
|
id: string): Promise<Element | null>;
|
|
27
27
|
/**
|
|
28
|
-
* Get the geometry of an element.
|
|
28
|
+
* Get the geometry of an element in GeoJSON geometry format.
|
|
29
|
+
*
|
|
30
|
+
* For most element types, the geometry returned is based on the `coordinates`
|
|
31
|
+
* property of the element, with some differences:
|
|
32
|
+
*
|
|
33
|
+
* - For Circle elements, the geometry is a Polygon drawn from the `center` and
|
|
34
|
+
* `radius` properties.
|
|
35
|
+
*
|
|
36
|
+
* - Path elements become MultiLineString geometries.
|
|
37
|
+
*
|
|
38
|
+
* - Marker elements return a MultiLineString of the path traced by the user
|
|
39
|
+
* as they drew the marker. Note that this is not the polygon formed by filled-in
|
|
40
|
+
* "pen" stroke, which doesn't exactly follow the path traced by the user as it
|
|
41
|
+
* is smoothed and interpolated to create a continuous line.
|
|
42
|
+
*
|
|
43
|
+
* - Text, Note and Image elements do not return geometry, so will return `null`.
|
|
44
|
+
*
|
|
29
45
|
*
|
|
30
46
|
* @example
|
|
31
47
|
* ```typescript
|
|
@@ -121,7 +137,7 @@ interface ElementsController {
|
|
|
121
137
|
* still being created by a drawing tool.
|
|
122
138
|
*
|
|
123
139
|
* If you want to know when the element is finished being created, you can
|
|
124
|
-
* use the `
|
|
140
|
+
* use the {@link ElementsController.onElementCreateEnd | `onElementCreateEnd`} listener.
|
|
125
141
|
*
|
|
126
142
|
* @param change - An object describing the change that occurred.
|
|
127
143
|
*/
|
|
@@ -130,7 +146,7 @@ interface ElementsController {
|
|
|
130
146
|
/**
|
|
131
147
|
* Listens for when a new element is finished being created by a drawing tool.
|
|
132
148
|
*
|
|
133
|
-
* This differs from the `onElementCreate` listener, which fires whenever an
|
|
149
|
+
* This differs from the {@link ElementsController.onElementCreate | `onElementCreate`} listener, which fires whenever an
|
|
134
150
|
* element is first created. This fires when the user finishes creating an element
|
|
135
151
|
* which could be after a series of interactions.
|
|
136
152
|
*
|
|
@@ -167,10 +183,10 @@ interface ElementsController {
|
|
|
167
183
|
* This will fire when an element is being edited, either on the map by the user
|
|
168
184
|
* or programatically.
|
|
169
185
|
*
|
|
170
|
-
* Like the `onElementCreate` listener, this will fire when an element is
|
|
186
|
+
* Like the {@link ElementsController.onElementCreate | `onElementCreate`} listener, this will fire when an element is
|
|
171
187
|
* still being created by a drawing tool.
|
|
172
188
|
*
|
|
173
|
-
* You can check the `isBeingCreated` property to determine if the element is
|
|
189
|
+
* You can check the {@link ElementChangeCallbackParams.isBeingCreated | `isBeingCreated`} property to determine if the element is
|
|
174
190
|
* still being created by a drawing tool.
|
|
175
191
|
*
|
|
176
192
|
* @returns A function to unsubscribe from the listener
|
|
@@ -213,7 +229,7 @@ interface ElementsController {
|
|
|
213
229
|
* ```typescript
|
|
214
230
|
* const unsubscribe = felt.onElementDelete({
|
|
215
231
|
* options: { id: "element-1" },
|
|
216
|
-
* handler: (
|
|
232
|
+
* handler: () => console.log("element-1 deleted"),
|
|
217
233
|
* });
|
|
218
234
|
*
|
|
219
235
|
* // later on...
|
|
@@ -278,7 +294,7 @@ interface ElementsController {
|
|
|
278
294
|
* // Update a polygon's style
|
|
279
295
|
* await felt.updateElement({
|
|
280
296
|
* id: "element-2",
|
|
281
|
-
* color: "#
|
|
297
|
+
* color: "#ABC123",
|
|
282
298
|
* fillOpacity: 0.5
|
|
283
299
|
* });
|
|
284
300
|
* ```
|
|
@@ -707,6 +723,8 @@ interface LayersController {
|
|
|
707
723
|
* Get a feature in GeoJSON format from the map by its ID and layer ID.
|
|
708
724
|
*
|
|
709
725
|
* The response is a GeoJSON Feature object with the complete geometry of the
|
|
726
|
+
* feature. Note that for some _very_ large geometries, the response may take a
|
|
727
|
+
* long time to return, and may return a very large object.
|
|
710
728
|
*
|
|
711
729
|
* @example
|
|
712
730
|
* ```typescript
|
|
@@ -1643,17 +1661,17 @@ declare const FeltEmbedOptionsSchema: z.ZodObject<{
|
|
|
1643
1661
|
}>;
|
|
1644
1662
|
zoom: z.ZodNumber;
|
|
1645
1663
|
}, "strip", z.ZodTypeAny, {
|
|
1646
|
-
zoom: number;
|
|
1647
1664
|
center: {
|
|
1648
1665
|
latitude: number;
|
|
1649
1666
|
longitude: number;
|
|
1650
1667
|
};
|
|
1651
|
-
}, {
|
|
1652
1668
|
zoom: number;
|
|
1669
|
+
}, {
|
|
1653
1670
|
center: {
|
|
1654
1671
|
latitude: number;
|
|
1655
1672
|
longitude: number;
|
|
1656
1673
|
};
|
|
1674
|
+
zoom: number;
|
|
1657
1675
|
}>>;
|
|
1658
1676
|
}, "strip", z.ZodTypeAny, {
|
|
1659
1677
|
origin?: string | undefined;
|
|
@@ -1667,11 +1685,11 @@ declare const FeltEmbedOptionsSchema: z.ZodObject<{
|
|
|
1667
1685
|
scaleBar?: boolean | undefined;
|
|
1668
1686
|
} | undefined;
|
|
1669
1687
|
initialViewport?: {
|
|
1670
|
-
zoom: number;
|
|
1671
1688
|
center: {
|
|
1672
1689
|
latitude: number;
|
|
1673
1690
|
longitude: number;
|
|
1674
1691
|
};
|
|
1692
|
+
zoom: number;
|
|
1675
1693
|
} | undefined;
|
|
1676
1694
|
}, {
|
|
1677
1695
|
origin?: string | undefined;
|
|
@@ -1685,11 +1703,11 @@ declare const FeltEmbedOptionsSchema: z.ZodObject<{
|
|
|
1685
1703
|
scaleBar?: boolean | undefined;
|
|
1686
1704
|
} | undefined;
|
|
1687
1705
|
initialViewport?: {
|
|
1688
|
-
zoom: number;
|
|
1689
1706
|
center: {
|
|
1690
1707
|
latitude: number;
|
|
1691
1708
|
longitude: number;
|
|
1692
1709
|
};
|
|
1710
|
+
zoom: number;
|
|
1693
1711
|
} | undefined;
|
|
1694
1712
|
}>;
|
|
1695
1713
|
|
|
@@ -1732,12 +1750,13 @@ declare const FeltEmbedOptionsSchema: z.ZodObject<{
|
|
|
1732
1750
|
*/
|
|
1733
1751
|
declare const Felt: {
|
|
1734
1752
|
/**
|
|
1735
|
-
* Embeds a Felt map into the provided container
|
|
1753
|
+
* Embeds a Felt map into the provided container, returning a promise that resolves
|
|
1754
|
+
* to a {@link FeltController} object that you can use to control the map.
|
|
1736
1755
|
*
|
|
1737
1756
|
* @param container - The container element to embed the map into.
|
|
1738
1757
|
* @param mapId - The ID of the map to embed.
|
|
1739
1758
|
* @param options - The options to configure the map.
|
|
1740
|
-
* @returns
|
|
1759
|
+
* @returns A promise for a {@link FeltController}.
|
|
1741
1760
|
*/
|
|
1742
1761
|
embed(container: HTMLElement, mapId: string, options?: FeltEmbedOptions): Promise<FeltController>;
|
|
1743
1762
|
/**
|
package/dist/client.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function r(e,n){return o=>{let s=new MessageChannel,l=o.handler,a="options"in o?o.options:void 0,m=crypto.randomUUID();return e.postMessage({type:"felt.addListener",event:a?{eventName:n,id:m,options:a}:{eventName:n,id:m}},"*",[s.port2]),s.port1.onmessage=g=>{l(g.data)},()=>{s.port1.onmessage=null,s.port1.close(),s.port2.close(),e.postMessage({type:"felt.removeListener",id:m},"*")}}}function t(e,n,o){return async s=>{let l=new MessageChannel,a=s&&o?await o(s):s;return e.postMessage({type:n,params:a},"*",[l.port2]),new Promise((m,g)=>{l.port1.onmessage=y=>{y
|
|
1
|
+
import{a as c}from"./chunk-QXPO53SH.js";function r(e,n){return o=>{let s=new MessageChannel,l=o.handler,a="options"in o?o.options:void 0,m=crypto.randomUUID();return e.postMessage({type:"felt.addListener",event:a?{eventName:n,id:m,options:a}:{eventName:n,id:m}},"*",[s.port2]),s.port1.onmessage=g=>{c(g)||l(g.data)},()=>{s.port1.onmessage=null,s.port1.close(),s.port2.close(),e.postMessage({type:"felt.removeListener",id:m},"*")}}}function t(e,n,o){return async s=>{let l=new MessageChannel,a=s&&o?await o(s):s;return e.postMessage({type:n,params:a},"*",[l.port2]),new Promise((m,g)=>{l.port1.onmessage=y=>{c(y)?g(new Error(y.data.__error__)):m(y.data),l.port1.close(),l.port2.close()}})}}var u=e=>({getElement:t(e,"getElement"),getElementGeometry:t(e,"getElementGeometry"),getElements:t(e,"getElements"),setElementGroupVisibility:t(e,"setElementGroupVisibility"),getElementGroup:t(e,"getElementGroup"),getElementGroups:t(e,"getElementGroups"),onElementChange:r(e,"onElementChange"),onElementCreate:r(e,"onElementCreate"),onElementCreateEnd:r(e,"onElementCreateEnd"),onElementDelete:r(e,"onElementDelete"),onElementGroupChange:r(e,"onElementGroupChange"),createElement:t(e,"createElement"),updateElement:t(e,"updateElement"),deleteElement:t(e,"deleteElement")});var C=e=>({onPointerClick:r(e,"onPointerClick"),onPointerMove:r(e,"onPointerMove")});var L=e=>({getLayer:t(e,"getLayer"),getLayers:t(e,"getLayers"),setLayerVisibility:t(e,"setLayerVisibility"),setLayerStyle:t(e,"setLayerStyle"),setLayerLegendVisibility:t(e,"setLayerLegendVisibility"),onLayerChange:r(e,"onLayerChange"),createLayer:t(e,"createLayer",async n=>"url"in n.source||"arrayBuffer"in n.source?n:{source:{...n.source,arrayBuffer:await n.source.file.arrayBuffer()}}),deleteLayer:t(e,"deleteLayer"),getLayerGroup:t(e,"getLayerGroup"),getLayerGroups:t(e,"getLayerGroups"),setLayerGroupVisibility:t(e,"setLayerGroupVisibility"),setLayerGroupLegendVisibility:t(e,"setLayerGroupLegendVisibility"),onLayerGroupChange:r(e,"onLayerGroupChange"),getLegendItem:t(e,"getLegendItem"),getLegendItems:t(e,"getLegendItems"),setLegendItemVisibility:t(e,"setLegendItemVisibility"),onLegendItemChange:r(e,"onLegendItemChange"),getLayerFilters:t(e,"getLayerFilters"),setLayerFilters:t(e,"setLayerFilters"),onLayerFiltersChange:r(e,"onLayerFiltersChange"),getRenderedFeatures:t(e,"getRenderedFeatures"),getFeature:t(e,"getFeature"),getGeoJsonFeature:t(e,"getGeoJsonFeature"),getCategoryData:t(e,"getCategoryData"),getHistogramData:t(e,"getHistogramData"),getAggregates:t(e,"getAggregates"),getLayerSchema:t(e,"getLayerSchema")});var h=e=>({getMapDetails:t(e,"getMapDetails")});var T=e=>({onSelectionChange:r(e,"onSelectionChange"),getSelection:t(e,"getSelection"),selectFeature:t(e,"selectFeature"),clearSelection:t(e,"clearSelection")});var P=e=>({setTool:t(e,"setTool"),getTool:t(e,"getTool"),onToolChange:r(e,"onToolChange"),setToolSettings:t(e,"setToolSettings"),getToolSettings:t(e,"getToolSettings"),onToolSettingsChange:r(e,"onToolSettingsChange")});var E=e=>({updateUiControls:t(e,"updateUiControls"),setOnMapInteractionsUi:t(e,"setOnMapInteractionsUi"),showLayerDataTable:t(e,"showLayerDataTable"),hideLayerDataTable:t(e,"hideLayerDataTable")});var v=e=>({getViewport:t(e,"getViewport"),setViewport:t(e,"setViewport"),getViewportConstraints:t(e,"getViewportConstraints"),setViewportConstraints:t(e,"setViewportConstraints"),fitViewportToBounds:t(e,"fitViewportToBounds"),onViewportMove:r(e,"onViewportMove"),onViewportMoveEnd:r(e,"onViewportMoveEnd"),onMapIdle:r(e,"onMapIdle")});function M(e){return{iframe:null,...v(e),...E(e),...L(e),...u(e),...T(e),...C(e),...P(e),...h(e)}}var F={embed(e,n,o){let s={uiControls:{showLegend:!0,cooperativeGestures:!0,fullScreenButton:!0,geolocation:!1,zoomControls:!0,scaleBar:!0},initialViewport:void 0,origin:"https://felt.com"},l=o?.origin??s.origin,a=new URL(`${l}/embed/map/${n}`),m={showLegend:"legend",cooperativeGestures:"cooperativeGestures",fullScreenButton:"link",geolocation:"geolocation",zoomControls:"zoomControls",scaleBar:"scaleBar"},g={...s.uiControls,...o?.uiControls};for(let[p,d]of G(g))d!=null&&a.searchParams.set(m[p],d?"1":"0");if(o?.token&&a.searchParams.set("token",o.token),o?.initialViewport){let p=o.initialViewport;a.searchParams.set("loc",`${p.center.latitude},${p.center.longitude},${p.zoom}z`)}let y=e.tagName==="IFRAME",i=y?e:e.ownerDocument.createElement("iframe");return i.src=a.toString(),y||(i.style.width="100%",i.style.height="100%",i.style.border="none",i.style.margin="0",e.appendChild(i)),i.referrerPolicy="strict-origin-when-cross-origin",new Promise((p,d)=>{i.addEventListener("load",()=>{i.contentWindow==null?d(new Error("Failed to load Felt map")):p(i.contentWindow)},{once:!0})}).then(F.connect).then(p=>(Object.defineProperties(p,{iframe:{value:i,writable:!1,configurable:!1}}),p))},connect(e){let n=M(e);return new Promise((o,s)=>{let l=setTimeout(()=>{s(new Error("Failed to load Felt map")),clearInterval(m)},5e3),a=new MessageChannel,m=setInterval(()=>{e.postMessage({type:"felt.ready"},"*",[a.port2])},100);a.port1.onmessage=g=>{g.data===!0&&(clearInterval(m),clearTimeout(l),a.port1.close(),a.port2.close(),o(n))}})}},G=Object.entries;export{F as Felt};
|
package/dist/handler.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var J=Object.defineProperty;var at=Object.getOwnPropertyDescriptor;var it=Object.getOwnPropertyNames;var st=Object.prototype.hasOwnProperty;var lt=(r,l)=>{for(var E in l)J(r,E,{get:l[E],enumerable:!0})},mt=(r,l,E,F)=>{if(l&&typeof l=="object"||typeof l=="function")for(let C of it(l))!st.call(r,C)&&C!==E&&J(r,C,{get:()=>l[C],enumerable:!(F=at(l,C))||F.enumerable});return r};var pt=r=>mt(J({},"__esModule",{value:!0}),r);var yr={};lt(yr,{createMessageHandler:()=>ar});module.exports=pt(yr);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 m(r){return f.z.strictObject({eventName:f.z.literal(r),id:f.z.string()})}var s=require("zod"),O=s.z.number(),U=s.z.number(),j=s.z.object({latitude:U,longitude:O}),G=s.z.tuple([O,U]),ge=s.z.object({type:s.z.literal("Point"),coordinates:G}),de=s.z.object({type:s.z.literal("Polygon"),coordinates:s.z.array(s.z.array(G))}),ct=s.z.object({type:s.z.literal("LineString"),coordinates:s.z.array(G)}),I=s.z.object({type:s.z.literal("MultiLineString"),coordinates:s.z.array(ct.shape.coordinates)}),ue=s.z.number().min(1).max(23),T=s.z.tuple([O,U,O,U]),z=s.z.object({show:s.z.array(s.z.string()).optional(),hide:s.z.array(s.z.string()).optional()}),yt=s.z.enum(["asc","desc"]),he=s.z.object({attribute:s.z.string(),direction:yt});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()),interaction:e.z.enum(["default","locked"]).optional()}),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"])}),gt=e.z.enum(["meter","kilometer","foot","mile"]),fe=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()}),_=u.extend(N.shape).extend(W.shape).extend({type:e.z.literal("Path"),coordinates:I.shape.coordinates,distanceMarker:e.z.boolean(),endCaps:e.z.boolean(),routingMode:e.z.enum(["driving","cycling","walking","flying"]).nullable()}),Q=u.extend(N.shape).extend(W.shape).extend({type:e.z.literal("Polygon"),coordinates:I.shape.coordinates,fillOpacity:e.z.number().min(0).max(1),areaMarker:e.z.boolean()}),Se=u.extend(N.shape).extend(W.shape).extend({type:e.z.literal("Circle"),coordinates:G,radius:e.z.number(),radiusDisplayAngle:e.z.number(),radiusDisplayUnit:gt.nullable(),fillOpacity:e.z.number().min(0).max(1),radiusMarker:e.z.boolean()}),$=u.extend({type:e.z.literal("Marker"),coordinates:I.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)}),K=u.extend({type:e.z.literal("Highlighter"),coordinates:I.shape.coordinates,opacity:e.z.number().min(0).max(1)}),xe=e.z.object({position:G,rotation:e.z.number(),scale:e.z.number(),zoom:e.z.number().min(0).max(23),coordinates:I.shape.coordinates}),be=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(xe.shape).extend(be.shape).extend({type:e.z.literal("Text")}),Y=u.extend(xe.shape).extend(be.shape).extend({type:e.z.literal("Note"),widthScale:e.z.number().min(0)}),ee=u.extend({type:e.z.literal("Image"),coordinates:I.shape.coordinates,imageUrl:e.z.string(),opacity:e.z.number().min(0).max(1)}).omit({color:!0}),dt=u.extend({type:e.z.literal("Link"),coordinates:I.shape.coordinates,url:e.z.string()}),x={type:!0,coordinates:!0},b={id:!0},te=fe.partial().required(x).omit(b),R=_.partial().required(x).omit(b),oe=Q.partial().required(x).omit(b),re=Se.partial().required(x).required({radius:!0}).omit(b),ne=$.partial().required(x).omit(b),ae=K.partial().required(x).omit(b),ie=X.partial().required(x).required({text:!0}).omit(b).omit({coordinates:!0,name:!0}),se=Y.partial().required(x).required({text:!0}).omit(b).omit({coordinates:!0,name:!0}),ut=ee.partial().required(x).required({imageUrl:!0}).omit(b),Me=e.z.discriminatedUnion("type",[te,R,oe,re,ne,ae,ut,ie,se]);var Sr=_.omit({coordinates:!0}),xr=Q.omit({coordinates:!0});var br=$.omit({coordinates:!0}),Mr=K.omit({coordinates:!0}),Lr=X.omit({coordinates:!0}),Cr=Y.omit({coordinates:!0}),Gr=ee.omit({coordinates:!0}),Ir=dt.omit({coordinates:!0}),M={type:!0,id:!0},ht=fe.partial().required(M),ft=_.partial().required(M),St=Q.partial().required(M),xt=Se.partial().required(M),bt=$.partial().required(M),Mt=K.partial().required(M),Lt=X.partial().required(M).omit({coordinates:!0,name:!0}),Ct=Y.partial().required(M).omit({coordinates:!0,name:!0}),Gt=ee.partial().required(M),Le=e.z.discriminatedUnion("type",[ht,ft,St,xt,bt,Mt,Lt,Ct,Gt]),Ce=e.z.object({ids:e.z.array(e.z.string()).optional()}),Ge=e.z.object({ids:e.z.array(e.z.string()).optional()});var It=t("getElement",d.z.string()),Et=t("getElementGeometry",d.z.string()),Tt=t("getElements",Ce.optional()),zt=t("getElementGroup",d.z.string()),Pt=t("getElementGroups",Ge.optional()),Ft=t("setElementGroupVisibility",z),kt=S("onElementChange",d.z.object({id:d.z.string()})),vt=m("onElementCreate"),wt=m("onElementCreateEnd"),Vt=S("onElementDelete",d.z.object({id:d.z.string()})),Ot=S("onElementGroupChange",d.z.object({id:d.z.string()})),Ut=t("createElement",Me),jt=t("updateElement",Le),Nt=t("deleteElement",d.z.string()),Ie={methods:[It,Et,Tt,zt,Pt,Ft,Ut,jt,Nt],listeners:[kt,vt,wt,Vt,Ot]};var Rt=m("onPointerClick"),At=m("onPointerMove"),Ee={methods:null,listeners:[Rt,At]};var i=require("zod");var a=require("zod"),qt=a.z.enum(["in","ni"]),Bt=a.z.enum(["lt","gt","le","ge","eq","ne","cn","nc","is","isnt"]),wr=a.z.enum(["and","or"]),Te=a.z.union([a.z.number(),a.z.string(),a.z.boolean(),a.z.null()]),ze=a.z.string().or(a.z.null()),Ht=a.z.tuple([ze,qt,a.z.array(Te).or(a.z.null())]),Dt=a.z.tuple([ze,Bt,Te]),le=a.z.union([Ht,Dt]),me=a.z.tuple([a.z.lazy(()=>a.z.union([me,le,a.z.null(),a.z.boolean()])),a.z.enum(["and","or"]),a.z.lazy(()=>a.z.union([me,le,a.z.null(),a.z.boolean()]))]),P=a.z.union([me,le,a.z.null(),a.z.boolean()]);var o=require("zod");var Pe=o.z.enum(["avg","max","min","sum","median"]),Zt=o.z.object({method:Pe,attribute:o.z.string()}),Jt=o.z.object({methods:o.z.array(o.z.union([Pe,o.z.literal("count")])),attribute:o.z.string().optional()}),A=o.z.union([T,de,o.z.array(G)]),Fe=o.z.object({boundary:A.optional(),filters:P.optional(),aggregation:Zt.optional()}),ke=o.z.object({layerId:o.z.string(),attribute:o.z.string(),limit:o.z.number().optional(),boundary:A.optional(),filters:P.optional(),values:Fe.optional()}),jr=o.z.object({key:o.z.union([o.z.number(),o.z.string(),o.z.boolean()]),value:o.z.number().nullable()}),Wt=o.z.object({type:o.z.literal("equal-intervals"),count:o.z.number()}),_t=o.z.object({type:o.z.literal("time-interval"),interval:o.z.enum(["hour","day","week","month","year"])}),ve=o.z.object({layerId:o.z.string(),attribute:o.z.string(),steps:o.z.union([Wt,_t,o.z.array(o.z.number())]),boundary:A.optional(),filters:P.optional(),values:Fe.optional()}),Nr=o.z.object({min:o.z.number(),max:o.z.number(),value:o.z.number()}),we=o.z.object({layerId:o.z.string(),boundary:A.optional(),filters:P.optional(),aggregation:Jt});var n=require("zod");var qr=n.z.enum(["processing","completed","failed","incomplete"]),Ve=n.z.object({ids:n.z.array(n.z.string()).optional()}),Oe=n.z.object({ids:n.z.array(n.z.string()).optional()}),k=n.z.object({id:n.z.string(),layerId:n.z.string()}),Ue=n.z.object({ids:k.array().optional(),layerIds:n.z.string().array().optional()}),je=n.z.object({layerIds:n.z.array(n.z.string()).optional(),areaQuery:n.z.union([n.z.object({coordinates:j}),n.z.object({boundary:T})]).optional()}),Qt=n.z.object({Point:n.z.object({}).passthrough().optional(),Line:n.z.object({}).passthrough().optional(),Polygon:n.z.object({}).passthrough().optional()}),pe=n.z.object({type:n.z.literal("application/geo+json"),name:n.z.string(),geometryStyles:Qt.optional()}),$t=pe.extend({file:n.z.instanceof(File)}),Kt=pe.extend({url:n.z.string().url()}),Xt=pe.extend({arrayBuffer:n.z.instanceof(ArrayBuffer)}),Ne=n.z.union([Xt,$t,Kt]);var Yt=t("getLayer",i.z.string()),eo=t("getLayers",Ve.optional()),to=t("setLayerVisibility",z),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",z),ao=t("createLayer",i.z.object({source:Ne})),io=t("deleteLayer",i.z.string()),so=t("getLayerGroup",i.z.string()),lo=t("getLayerGroups",Oe.optional()),mo=t("setLayerGroupVisibility",z),po=t("setLayerGroupLegendVisibility",z),co=S("onLayerGroupChange",i.z.object({id:i.z.string()})),yo=t("getLegendItem",k),go=t("getLegendItems",Ue.optional()),uo=S("onLegendItemChange",k),ho=t("setLegendItemVisibility",i.z.object({show:k.array().optional(),hide:k.array().optional()})),fo=t("getLayerFilters",i.z.string()),So=t("setLayerFilters",i.z.object({layerId:i.z.string(),filters:P,note:i.z.string().optional()})),xo=S("onLayerFiltersChange",i.z.object({layerId:i.z.string()})),bo=t("getRenderedFeatures",je.optional()),Mo=t("getFeature",i.z.object({id:i.z.string().or(i.z.number()),layerId:i.z.string()})),Lo=t("getGeoJsonFeature",i.z.object({id:i.z.string().or(i.z.number()),layerId:i.z.string()})),Co=t("getCategoryData",ke),Go=t("getHistogramData",ve),Io=t("getAggregates",we),Eo=t("getLayerSchema",i.z.string()),Re={methods:[Yt,eo,to,ro,no,ao,io,so,lo,mo,po,yo,go,ho,fo,So,bo,Mo,Lo,Co,Go,Io,Eo],listeners:[oo,co,uo,xo]};var Ae=require("zod");var To=t("getMapDetails",Ae.z.undefined()),qe={methods:[To],listeners:[]};var w=require("zod");var L=require("zod"),Be=L.z.object({id:L.z.string().or(L.z.number()),layerId:L.z.string(),showPopup:L.z.boolean().optional(),fitViewport:L.z.boolean().or(L.z.object({maxZoom:L.z.number()})).optional()});var zo=t("getSelection",w.z.undefined()),Po=m("onSelectionChange"),Fo=t("selectFeature",Be),ko=t("clearSelection",w.z.object({features:w.z.boolean().optional(),elements:w.z.boolean().optional()}).optional()),He={methods:[zo,Fo,ko],listeners:[Po]};var _e=require("zod");var p=require("zod");var De=["pin","line","route","polygon","circle","marker","highlighter","text","note"],Ze=p.z.enum([...De,"link"]),Je=p.z.enum(De),vo=te.pick({color:!0,symbol:!0,frame:!0}).extend({afterCreation:p.z.enum(["enter name","add another","select"])}).required(),wo=R.pick({color:!0,strokeOpacity:!0,strokeWidth:!0,strokeStyle:!0,distanceMarker:!0}).required(),Vo=R.pick({color:!0,routingMode:!0,strokeOpacity:!0,strokeWidth:!0,strokeStyle:!0,distanceMarker:!0,endCaps:!0}).required(),Oo=oe.pick({color:!0,fillOpacity:!0,strokeOpacity:!0,strokeWidth:!0,strokeStyle:!0,areaMarker:!0}).required(),Uo=re.pick({color:!0,fillOpacity:!0,strokeOpacity:!0,strokeWidth:!0,strokeStyle:!0,radiusMarker:!0}).required(),jo=ne.pick({color:!0,opacity:!0,size:!0}).required(),No=ae.pick({color:!0,opacity:!0}).extend({size:p.z.number().min(0).max(200)}).required(),Ro=ie.pick({color:!0,align:!0,style:!0}).required(),Ao=se.pick({color:!0,align:!0,style:!0}).required(),We=p.z.discriminatedUnion("tool",[vo.partial().extend({tool:p.z.literal("pin")}),wo.partial().extend({tool:p.z.literal("line")}),Vo.partial().extend({tool:p.z.literal("route")}),Oo.partial().extend({tool:p.z.literal("polygon")}),Uo.partial().extend({tool:p.z.literal("circle")}),jo.partial().extend({tool:p.z.literal("marker")}),No.partial().extend({tool:p.z.literal("highlighter")}),Ro.partial().extend({tool:p.z.literal("text")}),Ao.partial().extend({tool:p.z.literal("note")})]);var qo=t("setTool",Ze.nullable()),Bo=t("getTool",_e.z.undefined()),Ho=m("onToolChange"),Do=t("setToolSettings",We),Zo=t("getToolSettings",Je),Jo=m("onToolSettingsChange"),Qe={methods:[qo,Bo,Do,Zo],listeners:[Ho,Jo]};var q=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()}),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 Wo=t("updateUiControls",$e),_o=t("setOnMapInteractionsUi",Ke),Qo=t("showLayerDataTable",q.z.object({layerId:q.z.string(),sorting:he.optional()}).optional()),$o=t("hideLayerDataTable",q.z.undefined()),Xe={methods:[Wo,_o,Qo,$o],listeners:null};var ce=require("zod");var V=require("zod");var B=V.z.object({center:j,zoom:ue}),Ye=V.z.object({center:B.shape.center.optional(),zoom:B.shape.zoom.optional()}),et=V.z.object({minZoom:B.shape.zoom.nullish(),maxZoom:B.shape.zoom.nullish(),bounds:T.nullish()}).nullable(),tt=V.z.object({bounds:T});var Ko=t("getViewport",ce.z.undefined()),Xo=t("setViewport",Ye),Yo=t("getViewportConstraints",ce.z.undefined()),er=t("setViewportConstraints",et),tr=t("fitViewportToBounds",tt),or=m("onViewportMove"),rr=m("onViewportMoveEnd"),nr=m("onMapIdle"),ot={methods:[Xo,Ko,Yo,er,tr],listeners:[or,rr,nr]};var ye=[Xe,ot,Re,Ie,He,Ee,Qe,qe];function ar(r,l,E){let F=new Map;async function C(h){if(!cr.safeParse(h.data).success){E?.onUnknownMessage?.(h.data);return}let H=nt.safeParse(h.data);if(!H.success){E?.onInvalidMessage?.(h.data,H.error);return}let{data:g}=H;if(g.type==="felt.ready")h.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:Z=>{h.ports[0]?.postMessage(Z)}}:{handler:Z=>{h.ports[0]?.postMessage(Z)}},D=l.listeners[g.event.eventName](v);F.set(g.event.id,D)}else if(g.type==="felt.removeListener")F.get(g.id)?.(),F.delete(g.id);else try{let v=l.methods[g.type],D=await v(g.params);h.ports[0]?.postMessage(D)}catch(v){h.ports[0]?.postMessage({__error__:ir(v)})}}return r.addEventListener("message",C),()=>{r.removeEventListener("message",C)}}function ir(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 rt={methods:ye.map(r=>r.methods??[]).flat(),listeners:ye.map(r=>r.listeners??[]).flat()},sr=y.z.discriminatedUnion("eventName",[y.z.strictObject({eventName:y.z.literal("")}),...rt.listeners]),lr=y.z.strictObject({type:y.z.literal("felt.addListener"),event:sr}),mr=y.z.strictObject({type:y.z.literal("felt.removeListener"),id:y.z.string()}),pr=y.z.strictObject({type:y.z.literal("felt.ready")}),nt=y.z.discriminatedUnion("type",[pr,lr,mr,...rt.methods]),cr=y.z.object({type:y.z.enum(nt.options.map(r=>r.shape.type.value))});0&&(module.exports={createMessageHandler});
|
|
1
|
+
"use strict";var oe=Object.defineProperty;var it=Object.getOwnPropertyDescriptor;var st=Object.getOwnPropertyNames;var lt=Object.prototype.hasOwnProperty;var pt=(o,l)=>{for(var G in l)oe(o,G,{get:l[G],enumerable:!0})},mt=(o,l,G,z)=>{if(l&&typeof l=="object"||typeof l=="function")for(let b of st(l))!lt.call(o,b)&&b!==G&&oe(o,b,{get:()=>l[b],enumerable:!(z=it(l,b))||z.enumerable});return o};var ct=o=>mt(oe({},"__esModule",{value:!0}),o);var yr={};pt(yr,{createMessageHandler:()=>sr});module.exports=ct(yr);var g=require("zod");function re(o){return{__error__:gt(o)}}function gt(o){return o instanceof Error?o.message:typeof o=="object"&&o!==null&&"message"in o?String(o.message):typeof o=="string"?o:"Unknown error"}var d=require("zod");var f=require("zod");function t(o,l){return f.z.strictObject({type:f.z.literal(o),params:l})}function S(o,l){return f.z.strictObject({eventName:f.z.literal(o),id:f.z.string(),options:l})}function p(o){return f.z.strictObject({eventName:f.z.literal(o),id:f.z.string()})}var i=require("zod"),H=i.z.number(),D=i.z.number(),Z=i.z.object({latitude:D,longitude:H}),C=i.z.tuple([H,D]),P=i.z.object({type:i.z.literal("Polygon"),coordinates:i.z.array(i.z.array(C).min(4).refine(o=>o[0][0]===o[o.length-1][0]&&o[0][1]===o[o.length-1][1],"The last point of each ring must be identical to the first"))}),fe=i.z.object({type:i.z.literal("MultiPolygon"),coordinates:i.z.array(P.shape.coordinates)}),yt=i.z.object({type:i.z.literal("LineString"),coordinates:i.z.array(C).min(2)}),w=i.z.object({type:i.z.literal("MultiLineString"),coordinates:i.z.array(yt.shape.coordinates)}),Se=i.z.number().min(1).max(23),I=i.z.tuple([H,D,H,D]),T=i.z.object({show:i.z.array(i.z.string()).optional(),hide:i.z.array(i.z.string()).optional()}),dt=i.z.enum(["asc","desc"]),xe=i.z.object({attribute:i.z.string(),direction:dt});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()}),Q=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"])}),ut=e.z.enum(["meter","kilometer","foot","mile"]),q=h.extend(Q.shape).extend({type:e.z.literal("Place"),coordinates:C,symbol:e.z.string(),frame:e.z.enum(["frame-circle","frame-square"]).nullable(),hideLabel:e.z.boolean()}),V=h.extend(Q.shape).extend(ne.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(Q.shape).extend(ne.shape).extend({type:e.z.literal("Polygon"),coordinates:P.shape.coordinates,fillOpacity:e.z.number().min(0).max(1),areaMarker:e.z.boolean()}),J=h.extend(Q.shape).extend(ne.shape).extend({type:e.z.literal("Circle"),center:C,radius:e.z.number(),radiusMarker:e.z.boolean(),radiusDisplayAngle:e.z.number(),radiusDisplayUnit:ut.nullable(),fillOpacity:e.z.number().min(0).max(1)}),U=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)}),j=h.extend({type:e.z.literal("Highlighter"),coordinates:fe.shape.coordinates,renderHoles:e.z.boolean(),opacity:e.z.number().min(0).max(1)}),Le=e.z.object({position:C,rotation:e.z.number(),scale:e.z.number(),zoom:e.z.number().min(0).max(23),coordinates:P.shape.coordinates}),Me=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()}),_=h.extend(Le.shape).extend(Me.shape).extend({type:e.z.literal("Text")}),W=h.extend(Le.shape).extend(Me.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}),ht=h.extend({type:e.z.literal("Link"),coordinates:w.shape.coordinates,url:e.z.string()}),F={type:!0,coordinates:!0},x={id:!0},ae=q.partial().extend(q.pick(F).shape).omit(x),$=V.partial().extend(V.pick(F).shape).omit(x),ie=O.partial().extend(O.pick(F).shape).omit(x),se=J.partial().extend(J.pick({type:!0,center:!0,radius:!0}).shape).omit(x),le=U.partial().extend(U.pick(F).shape).omit(x),pe=j.partial().extend(j.pick(F).shape).omit(x),me=_.partial().omit({...x,coordinates:!0,name:!0,type:!0}).extend({type:e.z.literal("Text"),text:e.z.string()}),ce=W.partial().omit({...x,coordinates:!0,name:!0,type:!0}).extend({type:e.z.literal("Note"),text:e.z.string()}),ft=N.partial().extend(N.pick({...F,imageUrl:!0}).shape).omit(x),be=e.z.discriminatedUnion("type",[ae,$,ie,se,le,pe,ft,me,ce]);var Lr=V.omit({coordinates:!0}),Mr=O.omit({coordinates:!0});var br=U.omit({coordinates:!0}),Cr=j.omit({coordinates:!0}),Gr=_.omit({coordinates:!0}),Ir=W.omit({coordinates:!0}),Tr=N.omit({coordinates:!0}),Er=ht.omit({coordinates:!0}),L={type:!0,id:!0},St=q.partial().extend(q.pick(L).shape),xt=V.partial().extend(V.pick(L).shape),Lt=O.partial().extend(O.pick(L).shape),Mt=J.partial().extend(J.pick(L).shape),bt=U.partial().extend(U.pick(L).shape),Ct=j.partial().extend(j.pick(L).shape),Gt=_.partial().extend(_.pick(L).shape).omit({coordinates:!0,name:!0}),It=W.partial().extend(W.pick(L).shape).omit({coordinates:!0,name:!0}),Tt=N.partial().extend(N.pick(L).shape),Ce=e.z.discriminatedUnion("type",[St,xt,Lt,Mt,bt,Ct,Gt,It,Tt]),Ge=e.z.object({ids:e.z.array(e.z.string()).optional()}),Ie=e.z.object({ids:e.z.array(e.z.string()).optional()});var Et=t("getElement",d.z.string()),zt=t("getElementGeometry",d.z.string()),Pt=t("getElements",Ge.optional()),Ft=t("getElementGroup",d.z.string()),kt=t("getElementGroups",Ie.optional()),vt=t("setElementGroupVisibility",T),wt=S("onElementChange",d.z.object({id:d.z.string()})),Vt=p("onElementCreate"),Ot=p("onElementCreateEnd"),Ut=S("onElementDelete",d.z.object({id:d.z.string()})),jt=S("onElementGroupChange",d.z.object({id:d.z.string()})),Nt=t("createElement",be),Rt=t("updateElement",Ce),At=t("deleteElement",d.z.string()),Te={methods:[Et,zt,Pt,Ft,kt,vt,Nt,Rt,At],listeners:[wt,Vt,Ot,Ut,jt]};var Bt=p("onPointerClick"),Ht=p("onPointerMove"),Ee={methods:null,listeners:[Bt,Ht]};var s=require("zod");var a=require("zod"),Dt=a.z.enum(["in","ni"]),Zt=a.z.enum(["lt","gt","le","ge","eq","ne","cn","nc","is","isnt"]),Or=a.z.enum(["and","or"]),ze=a.z.union([a.z.number(),a.z.string(),a.z.boolean(),a.z.null()]),Pe=a.z.string().or(a.z.null()),qt=a.z.tuple([Pe,Dt,a.z.array(ze).or(a.z.null())]),Jt=a.z.tuple([Pe,Zt,ze]),ge=a.z.union([qt,Jt]),ye=a.z.tuple([a.z.lazy(()=>a.z.union([ye,ge,a.z.null(),a.z.boolean()])),a.z.enum(["and","or"]),a.z.lazy(()=>a.z.union([ye,ge,a.z.null(),a.z.boolean()]))]),E=a.z.union([ye,ge,a.z.null(),a.z.boolean()]);var r=require("zod");var Fe=r.z.enum(["avg","max","min","sum","median"]),_t=r.z.object({method:Fe,attribute:r.z.string()}),Wt=r.z.object({methods:r.z.array(r.z.union([Fe,r.z.literal("count")])),attribute:r.z.string().optional()}),K=r.z.union([I,P,r.z.array(C)]),ke=r.z.object({boundary:K.optional(),filters:E.optional(),aggregation:_t.optional()}),ve=r.z.object({layerId:r.z.string(),attribute:r.z.string(),limit:r.z.number().optional(),boundary:K.optional(),filters:E.optional(),values:ke.optional()}),Rr=r.z.object({key:r.z.union([r.z.number(),r.z.string(),r.z.boolean()]),value:r.z.number().nullable()}),Qt=r.z.object({type:r.z.literal("equal-intervals"),count:r.z.number()}),$t=r.z.object({type:r.z.literal("time-interval"),interval:r.z.enum(["hour","day","week","month","year"])}),we=r.z.object({layerId:r.z.string(),attribute:r.z.string(),steps:r.z.union([Qt,$t,r.z.array(r.z.number())]),boundary:K.optional(),filters:E.optional(),values:ke.optional()}),Ar=r.z.object({min:r.z.number(),max:r.z.number(),value:r.z.number()}),Ve=r.z.object({layerId:r.z.string(),boundary:K.optional(),filters:E.optional(),aggregation:Wt});var n=require("zod");var Dr=n.z.enum(["processing","completed","failed","incomplete"]),Oe=n.z.object({ids:n.z.array(n.z.string()).optional()}),Ue=n.z.object({ids:n.z.array(n.z.string()).optional()}),k=n.z.object({id:n.z.string(),layerId:n.z.string()}),je=n.z.object({ids:k.array().optional(),layerIds:n.z.string().array().optional()}),Ne=n.z.object({layerIds:n.z.array(n.z.string()).optional(),areaQuery:n.z.union([n.z.object({coordinates:Z}),n.z.object({boundary:I})]).optional()}),Kt=n.z.object({Point:n.z.object({}).passthrough().optional(),Line:n.z.object({}).passthrough().optional(),Polygon:n.z.object({}).passthrough().optional()}),de=n.z.object({type:n.z.literal("application/geo+json"),name:n.z.string(),geometryStyles:Kt.optional()}),Xt=de.extend({file:n.z.instanceof(File)}),Yt=de.extend({url:n.z.string().url()}),eo=de.extend({arrayBuffer:n.z.instanceof(ArrayBuffer)}),Re=n.z.union([eo,Xt,Yt]);var to=t("getLayer",s.z.string()),oo=t("getLayers",Oe.optional()),ro=t("setLayerVisibility",T),no=S("onLayerChange",s.z.object({id:s.z.string()})),ao=t("setLayerStyle",s.z.object({id:s.z.string(),style:s.z.object({}).passthrough()})),io=t("setLayerLegendVisibility",T),so=t("createLayer",s.z.object({source:Re})),lo=t("deleteLayer",s.z.string()),po=t("getLayerGroup",s.z.string()),mo=t("getLayerGroups",Ue.optional()),co=t("setLayerGroupVisibility",T),go=t("setLayerGroupLegendVisibility",T),yo=S("onLayerGroupChange",s.z.object({id:s.z.string()})),uo=t("getLegendItem",k),ho=t("getLegendItems",je.optional()),fo=S("onLegendItemChange",k),So=t("setLegendItemVisibility",s.z.object({show:k.array().optional(),hide:k.array().optional()})),xo=t("getLayerFilters",s.z.string()),Lo=t("setLayerFilters",s.z.object({layerId:s.z.string(),filters:E,note:s.z.string().optional()})),Mo=S("onLayerFiltersChange",s.z.object({layerId:s.z.string()})),bo=t("getRenderedFeatures",Ne.optional()),Co=t("getFeature",s.z.object({id:s.z.string().or(s.z.number()),layerId:s.z.string()})),Go=t("getGeoJsonFeature",s.z.object({id:s.z.string().or(s.z.number()),layerId:s.z.string()})),Io=t("getCategoryData",ve),To=t("getHistogramData",we),Eo=t("getAggregates",Ve),zo=t("getLayerSchema",s.z.string()),Ae={methods:[to,oo,ro,ao,io,so,lo,po,mo,co,go,uo,ho,So,xo,Lo,bo,Co,Go,Io,To,Eo,zo],listeners:[no,yo,fo,Mo]};var Be=require("zod");var Po=t("getMapDetails",Be.z.undefined()),He={methods:[Po],listeners:[]};var R=require("zod");var M=require("zod"),De=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",R.z.undefined()),ko=p("onSelectionChange"),vo=t("selectFeature",De),wo=t("clearSelection",R.z.object({features:R.z.boolean().optional(),elements:R.z.boolean().optional()}).optional()),Ze={methods:[Fo,vo,wo],listeners:[ko]};var Qe=require("zod");var m=require("zod");var qe=["pin","line","route","polygon","circle","marker","highlighter","text","note"],Je=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(),Oo=$.pick({color:!0,strokeOpacity:!0,strokeWidth:!0,strokeStyle:!0,distanceMarker:!0}).required(),Uo=$.pick({color:!0,routingMode:!0,strokeOpacity:!0,strokeWidth:!0,strokeStyle:!0,distanceMarker:!0,endCaps:!0}).required(),jo=ie.pick({color:!0,fillOpacity:!0,strokeOpacity:!0,strokeWidth:!0,strokeStyle:!0,areaMarker:!0}).required(),No=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(),Ao=pe.pick({color:!0,opacity:!0,renderHoles:!0}).extend({size:m.z.number().min(0).max(200)}).required(),Bo=me.pick({color:!0,align:!0,style:!0}).required(),Ho=ce.pick({color:!0,align:!0,style:!0}).required(),We=m.z.discriminatedUnion("tool",[Vo.partial().extend({tool:m.z.literal("pin")}),Oo.partial().extend({tool:m.z.literal("line")}),Uo.partial().extend({tool:m.z.literal("route")}),jo.partial().extend({tool:m.z.literal("polygon")}),No.partial().extend({tool:m.z.literal("circle")}),Ro.partial().extend({tool:m.z.literal("marker")}),Ao.partial().extend({tool:m.z.literal("highlighter")}),Bo.partial().extend({tool:m.z.literal("text")}),Ho.partial().extend({tool:m.z.literal("note")})]);var Do=t("setTool",Je.nullable()),Zo=t("getTool",Qe.z.undefined()),qo=p("onToolChange"),Jo=t("setToolSettings",We),_o=t("getToolSettings",_e),Wo=p("onToolSettingsChange"),$e={methods:[Do,Zo,Jo,_o],listeners:[qo,Wo]};var X=require("zod");var c=require("zod"),Ke=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()}),Xe=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",Ke),$o=t("setOnMapInteractionsUi",Xe),Ko=t("showLayerDataTable",X.z.object({layerId:X.z.string(),sorting:xe.optional()}).optional()),Xo=t("hideLayerDataTable",X.z.undefined()),Ye={methods:[Qo,$o,Ko,Xo],listeners:null};var ue=require("zod");var A=require("zod");var Y=A.z.object({center:Z,zoom:Se}),et=A.z.object({center:Y.shape.center.optional(),zoom:Y.shape.zoom.optional()}),tt=A.z.object({minZoom:Y.shape.zoom.nullish(),maxZoom:Y.shape.zoom.nullish(),bounds:I.nullish()}).nullable(),ot=A.z.object({bounds:I});var Yo=t("getViewport",ue.z.undefined()),er=t("setViewport",et),tr=t("getViewportConstraints",ue.z.undefined()),or=t("setViewportConstraints",tt),rr=t("fitViewportToBounds",ot),nr=p("onViewportMove"),ar=p("onViewportMoveEnd"),ir=p("onMapIdle"),rt={methods:[er,Yo,tr,or,rr],listeners:[nr,ar,ir]};var he=[Ye,rt,Ae,Te,Ze,Ee,$e,He];function sr(o,l,G){let z=new Map;async function b(u){if(!gr.safeParse(u.data).success){G?.onUnknownMessage?.(u.data);return}let B=at.safeParse(u.data);if(!B.success){G?.onInvalidMessage?.(u.data,B.error),u.ports[0]?.postMessage(re(B.error.message));return}let{data:y}=B;if(y.type==="felt.ready")u.ports[0]?.postMessage(!0);else if(y.type==="felt.addListener"){if(y.event.eventName==="")throw new Error("felt.addListener eventName cannot be empty");let v="options"in y.event?{options:"options"in y.event?y.event.options:void 0,handler:te=>{u.ports[0]?.postMessage(te)}}:{handler:te=>{u.ports[0]?.postMessage(te)}},ee=l.listeners[y.event.eventName](v);z.set(y.event.id,ee)}else if(y.type==="felt.removeListener")z.get(y.id)?.(),z.delete(y.id);else try{let v=l.methods[y.type],ee=await v(y.params);u.ports[0]?.postMessage(ee)}catch(v){u.ports[0]?.postMessage(re(v))}}return o.addEventListener("message",b),()=>{o.removeEventListener("message",b)}}var nt={methods:he.map(o=>o.methods??[]).flat(),listeners:he.map(o=>o.listeners??[]).flat()},lr=g.z.discriminatedUnion("eventName",[g.z.strictObject({eventName:g.z.literal("")}),...nt.listeners]),pr=g.z.strictObject({type:g.z.literal("felt.addListener"),event:lr}),mr=g.z.strictObject({type:g.z.literal("felt.removeListener"),id:g.z.string()}),cr=g.z.strictObject({type:g.z.literal("felt.ready")}),at=g.z.discriminatedUnion("type",[cr,pr,mr,...nt.methods]),gr=g.z.object({type:g.z.enum(at.options.map(o=>o.shape.type.value))});0&&(module.exports={createMessageHandler});
|