@feltmaps/js-sdk 1.5.0-next.4 → 1.5.0-next.5

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 CHANGED
@@ -1 +1 @@
1
- "use strict";var g=Object.defineProperty;var F=Object.getOwnPropertyDescriptor;var S=Object.getOwnPropertyNames;var M=Object.prototype.hasOwnProperty;var b=(e,n)=>{for(var r in n)g(e,r,{get:n[r],enumerable:!0})},I=(e,n,r,s)=>{if(n&&typeof n=="object"||typeof n=="function")for(let l of S(n))!M.call(e,l)&&l!==r&&g(e,l,{get:()=>n[l],enumerable:!(s=F(n,l))||s.enumerable});return e};var G=e=>I(g({},"__esModule",{value:!0}),e);var f={};b(f,{Felt:()=>V});module.exports=G(f);function o(e,n){return r=>{let s=new MessageChannel,l=r.handler,i="options"in r?r.options:void 0,a=crypto.randomUUID();return e.postMessage({type:"felt.addListener",event:i?{eventName:n,id:a,options:i}:{eventName:n,id:a}},"*",[s.port2]),s.port1.onmessage=d=>{l(d.data)},()=>{s.port1.onmessage=null,s.port1.close(),s.port2.close(),e.postMessage({type:"felt.removeListener",id:a},"*")}}}function t(e,n){return r=>{let s=new MessageChannel;return e.postMessage({type:n,params:r},"*",[s.port2]),new Promise((l,i)=>{s.port1.onmessage=a=>{a.data&&typeof a.data=="object"&&"__error__"in a.data?i(new Error(a.data.__error__)):l(a.data),s.port1.close(),s.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:o(e,"onElementChange"),onElementCreate:o(e,"onElementCreate"),onElementDelete:o(e,"onElementDelete"),onElementGroupChange:o(e,"onElementGroupChange"),createElement:t(e,"createElement"),updateElement:t(e,"updateElement"),deleteElement:t(e,"deleteElement")});var C=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"),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"),getRenderedFeatures:t(e,"getRenderedFeatures")});var L=e=>({onSelectionChange:o(e,"onSelectionChange"),getSelection:t(e,"getSelection"),selectFeature:t(e,"selectFeature"),clearSelection:t(e,"clearSelection")});var T=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 E=e=>({updateUiControls:t(e,"updateUiControls"),setOnMapInteractionsUi:t(e,"setOnMapInteractionsUi")});var v=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 P(e){return{iframe:null,...v(e),...E(e),...h(e),...u(e),...L(e),...C(e),...T(e)}}var V={embed(e,n,r){let s={uiControls:{showLegend:!0,cooperativeGestures:!0,fullScreenButton:!0,geolocation:!1,zoomControls:!0,scaleBar:!0},initialViewport:void 0,origin:"https://felt.com"},l=r?.origin??s.origin,i=new URL(`${l}/embed/map/${n}`),a={showLegend:"legend",cooperativeGestures:"cooperativeGestures",fullScreenButton:"link",geolocation:"geolocation",zoomControls:"zoomControls",scaleBar:"scaleBar"},d={...s.uiControls,...r?.uiControls};for(let[m,y]of x(d))y!=null&&i.searchParams.set(a[m],y?"1":"0");if(r?.token&&i.searchParams.set("token",r.token),r?.initialViewport){let m=r.initialViewport;i.searchParams.set("loc",`${m.center.latitude},${m.center.longitude},${m.zoom}z`)}let c=e.tagName==="IFRAME",p=c?e:e.ownerDocument.createElement("iframe");return p.src=i.toString(),c||(p.style.width="100%",p.style.height="100%",p.style.border="none",p.style.margin="0",e.appendChild(p)),p.referrerPolicy="strict-origin-when-cross-origin",new Promise((m,y)=>{p.addEventListener("load",()=>{p.contentWindow==null?y(new Error("Failed to load Felt map")):m(p.contentWindow)},{once:!0})}).then(V.connect).then(m=>(Object.defineProperties(m,{iframe:{value:p,writable:!1,configurable:!1}}),m))},connect(e){let n=P(e);return new Promise((r,s)=>{let l=setTimeout(()=>{s(new Error("Failed to load Felt map")),clearInterval(a)},5e3),i=new MessageChannel,a=setInterval(()=>{e.postMessage({type:"felt.ready"},"*",[i.port2])},100);i.port1.onmessage=d=>{d.data===!0&&(clearInterval(a),clearTimeout(l),i.port1.close(),i.port2.close(),r(n))}})}},x=Object.entries;0&&(module.exports={Felt});
1
+ "use strict";var g=Object.defineProperty;var F=Object.getOwnPropertyDescriptor;var S=Object.getOwnPropertyNames;var b=Object.prototype.hasOwnProperty;var I=(e,n)=>{for(var r in n)g(e,r,{get:n[r],enumerable:!0})},x=(e,n,r,s)=>{if(n&&typeof n=="object"||typeof n=="function")for(let l of S(n))!b.call(e,l)&&l!==r&&g(e,l,{get:()=>n[l],enumerable:!(s=F(n,l))||s.enumerable});return e};var f=e=>x(g({},"__esModule",{value:!0}),e);var K={};I(K,{Felt:()=>M});module.exports=f(K);function o(e,n){return r=>{let s=new MessageChannel,l=r.handler,i="options"in r?r.options:void 0,a=crypto.randomUUID();return e.postMessage({type:"felt.addListener",event:i?{eventName:n,id:a,options:i}:{eventName:n,id:a}},"*",[s.port2]),s.port1.onmessage=d=>{l(d.data)},()=>{s.port1.onmessage=null,s.port1.close(),s.port2.close(),e.postMessage({type:"felt.removeListener",id:a},"*")}}}function t(e,n){return r=>{let s=new MessageChannel;return e.postMessage({type:n,params:r},"*",[s.port2]),new Promise((l,i)=>{s.port1.onmessage=a=>{a.data&&typeof a.data=="object"&&"__error__"in a.data?i(new Error(a.data.__error__)):l(a.data),s.port1.close(),s.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:o(e,"onElementChange"),onElementCreate:o(e,"onElementCreate"),onElementDelete:o(e,"onElementDelete"),onElementGroupChange:o(e,"onElementGroupChange"),createElement:t(e,"createElement"),updateElement:t(e,"updateElement"),deleteElement:t(e,"deleteElement")});var C=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"),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"),getRenderedFeatures:t(e,"getRenderedFeatures")});var L=e=>({getMapDetails:t(e,"getMapDetails")});var T=e=>({onSelectionChange:o(e,"onSelectionChange"),getSelection:t(e,"getSelection"),selectFeature:t(e,"selectFeature"),clearSelection:t(e,"clearSelection")});var E=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")});var P=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 V(e){return{iframe:null,...P(e),...v(e),...h(e),...u(e),...T(e),...C(e),...E(e),...L(e)}}var M={embed(e,n,r){let s={uiControls:{showLegend:!0,cooperativeGestures:!0,fullScreenButton:!0,geolocation:!1,zoomControls:!0,scaleBar:!0},initialViewport:void 0,origin:"https://felt.com"},l=r?.origin??s.origin,i=new URL(`${l}/embed/map/${n}`),a={showLegend:"legend",cooperativeGestures:"cooperativeGestures",fullScreenButton:"link",geolocation:"geolocation",zoomControls:"zoomControls",scaleBar:"scaleBar"},d={...s.uiControls,...r?.uiControls};for(let[m,y]of G(d))y!=null&&i.searchParams.set(a[m],y?"1":"0");if(r?.token&&i.searchParams.set("token",r.token),r?.initialViewport){let m=r.initialViewport;i.searchParams.set("loc",`${m.center.latitude},${m.center.longitude},${m.zoom}z`)}let c=e.tagName==="IFRAME",p=c?e:e.ownerDocument.createElement("iframe");return p.src=i.toString(),c||(p.style.width="100%",p.style.height="100%",p.style.border="none",p.style.margin="0",e.appendChild(p)),p.referrerPolicy="strict-origin-when-cross-origin",new Promise((m,y)=>{p.addEventListener("load",()=>{p.contentWindow==null?y(new Error("Failed to load Felt map")):m(p.contentWindow)},{once:!0})}).then(M.connect).then(m=>(Object.defineProperties(m,{iframe:{value:p,writable:!1,configurable:!1}}),m))},connect(e){let n=V(e);return new Promise((r,s)=>{let l=setTimeout(()=>{s(new Error("Failed to load Felt map")),clearInterval(a)},5e3),i=new MessageChannel,a=setInterval(()=>{e.postMessage({type:"felt.ready"},"*",[i.port2])},100);i.port1.onmessage=d=>{d.data===!0&&(clearInterval(a),clearTimeout(l),i.port1.close(),i.port2.close(),r(n))}})}},G=Object.entries;0&&(module.exports={Felt});
package/dist/client.d.cts CHANGED
@@ -1,5 +1,5 @@
1
- import { E as Element, G as Geometry, 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 LayerGroup, k as GetLayerGroupsConstraint, l as LayerGroupChangeCallbackParams, m as LegendItemIdentifier, n as LegendItem, o as LegendItemsConstraint, p as LegendItemChangeCallbackParams, q as LayerFilters, F as Filters, r as GetRenderedFeaturesConstraint, s as Feature, M as MapInteractionEvent, t as EntityNode, u as FeatureSelection, T as ToolType, I as InputToolSettings, C as ConfigurableToolType, v as ToolSettingsMap, w as ToolSettingsChangeEvent, z as zInfer, V as ViewportState, x as SetViewportCenterZoomParams, y as ViewportConstraints, A as ViewportFitBoundsParams, B as ViewportCenterZoom } from './types-CPZlLnbg.cjs';
2
- export { D as CircleElementCreate, H as CircleElementRead, J as CircleElementUpdate, av as CircleToolSettings, ah as ElementGroupNode, ai as ElementNode, aj as FeatureNode, am as FeltBoundary, an as FeltZoom, ae as FilterExpression, af as FilterLogicGate, ag as FilterTernary, K as HighlighterElementCreate, N as HighlighterElementRead, O as HighlighterElementUpdate, aw as HighlighterToolSettings, P as ImageElementCreate, Q as ImageElementRead, R as ImageElementUpdate, ao as LatLng, ak as LayerGroupNode, al as LayerNode, ac as LayerProcessingStatus, ap as LineStringGeometry, ax as LineToolSettings, U as LinkElementRead, aq as LngLatTuple, W as MarkerElementCreate, X as MarkerElementRead, Y as MarkerElementUpdate, ay as MarkerToolSettings, ar as MultiLineStringGeometry, as as MultiPolygonGeometry, Z as NoteElementCreate, _ as NoteElementRead, $ as NoteElementUpdate, az as NoteToolSettings, a0 as PathElementCreate, a1 as PathElementRead, a2 as PathElementUpdate, aA as PinToolSettings, a3 as PlaceElementCreate, a4 as PlaceElementRead, a5 as PlaceElementUpdate, aB as PlaceFrame, aC as PlaceSymbol, at as PointGeometry, a6 as PolygonElementCreate, a7 as PolygonElementRead, a8 as PolygonElementUpdate, au as PolygonGeometry, aD as PolygonToolSettings, ad as RasterValue, aE as RouteToolSettings, a9 as TextElementCreate, aa as TextElementRead, ab as TextElementUpdate, aF as TextToolSettings } from './types-CPZlLnbg.cjs';
1
+ import { E as Element, G as Geometry, 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 LayerGroup, k as GetLayerGroupsConstraint, l as LayerGroupChangeCallbackParams, m as LegendItemIdentifier, n as LegendItem, o as LegendItemsConstraint, p as LegendItemChangeCallbackParams, q as LayerFilters, F as Filters, r as GetRenderedFeaturesConstraint, s as Feature, M as MapInteractionEvent, t as MapDetails, u as EntityNode, v as FeatureSelection, T as ToolType, I as InputToolSettings, C as ConfigurableToolType, w as ToolSettingsMap, x as ToolSettingsChangeEvent, z as zInfer, V as ViewportState, y as SetViewportCenterZoomParams, A as ViewportConstraints, B as ViewportFitBoundsParams, D as ViewportCenterZoom } from './types-BKxKmuZn.cjs';
2
+ export { H as CircleElementCreate, J as CircleElementRead, K as CircleElementUpdate, aw as CircleToolSettings, ai as ElementGroupNode, aj as ElementNode, ak as FeatureNode, an as FeltBoundary, ao as FeltZoom, af as FilterExpression, ag as FilterLogicGate, ah as FilterTernary, N as HighlighterElementCreate, O as HighlighterElementRead, P as HighlighterElementUpdate, ax as HighlighterToolSettings, Q as ImageElementCreate, R as ImageElementRead, U as ImageElementUpdate, ap as LatLng, al as LayerGroupNode, am as LayerNode, ad as LayerProcessingStatus, aq as LineStringGeometry, ay as LineToolSettings, W as LinkElementRead, ar as LngLatTuple, X as MarkerElementCreate, Y as MarkerElementRead, Z as MarkerElementUpdate, az as MarkerToolSettings, as as MultiLineStringGeometry, at as MultiPolygonGeometry, _ as NoteElementCreate, $ as NoteElementRead, a0 as NoteElementUpdate, aA as NoteToolSettings, a1 as PathElementCreate, a2 as PathElementRead, a3 as PathElementUpdate, aB as PinToolSettings, a4 as PlaceElementCreate, a5 as PlaceElementRead, a6 as PlaceElementUpdate, aC as PlaceFrame, aD as PlaceSymbol, au as PointGeometry, a7 as PolygonElementCreate, a8 as PolygonElementRead, a9 as PolygonElementUpdate, av as PolygonGeometry, aE as PolygonToolSettings, ae as RasterValue, aF as RouteToolSettings, aa as TextElementCreate, ab as TextElementRead, ac as TextElementUpdate, aG as TextToolSettings } from './types-BKxKmuZn.cjs';
3
3
  import { z } from 'zod';
4
4
 
5
5
  /**
@@ -593,6 +593,17 @@ interface InteractionsController {
593
593
  }): VoidFunction;
594
594
  }
595
595
 
596
+ /**
597
+ * @group Controller
598
+ * @public
599
+ */
600
+ interface MiscController {
601
+ /**
602
+ * Gets the details of the map.
603
+ */
604
+ getMapDetails(): Promise<MapDetails>;
605
+ }
606
+
596
607
  /**
597
608
  * The Selection controller allows you to listen for changes to the selection on the map.
598
609
  *
@@ -1095,7 +1106,7 @@ interface ViewportController {
1095
1106
  * @group Controller
1096
1107
  * @public
1097
1108
  */
1098
- interface FeltController extends ViewportController, UiController, LayersController, ElementsController, SelectionController, InteractionsController, ToolsController {
1109
+ interface FeltController extends ViewportController, UiController, LayersController, ElementsController, SelectionController, InteractionsController, ToolsController, InteractionsController, MiscController {
1099
1110
  /**
1100
1111
  * The iframe element containing the Felt map, if it is an embedded map.
1101
1112
  *
@@ -1266,4 +1277,4 @@ declare const Felt: {
1266
1277
  connect(feltWindow: Window): Promise<FeltController>;
1267
1278
  };
1268
1279
 
1269
- export { ConfigurableToolType, Element, ElementChangeCallbackParams, ElementCreate, ElementGroup, ElementGroupChangeCallbackParams, ElementUpdate, type ElementsController, EntityNode, Feature, FeatureSelection, Felt, type FeltController, type FeltEmbedOptions, Filters, Geometry, GetElementGroupsConstraint, GetElementsConstraint, GetLayerGroupsConstraint, GetLayersConstraint, GetRenderedFeaturesConstraint, InputToolSettings, type InteractionsController, Layer, LayerChangeCallbackParams, LayerFilters, LayerGroup, LayerGroupChangeCallbackParams, type LayersController, LegendItem, LegendItemChangeCallbackParams, LegendItemIdentifier, LegendItemsConstraint, MapInteractionEvent, type UiOnMapInteractionsOptions as OnMapInteractionsOptions, type SelectionController, SetViewportCenterZoomParams, SetVisibilityRequest, ToolSettingsChangeEvent, ToolSettingsMap, ToolType, type ToolsController, type UiController, type UiControlsOptions, ViewportCenterZoom, ViewportConstraints, type ViewportController, ViewportFitBoundsParams, ViewportState };
1280
+ export { ConfigurableToolType, Element, ElementChangeCallbackParams, ElementCreate, ElementGroup, ElementGroupChangeCallbackParams, ElementUpdate, type ElementsController, EntityNode, Feature, FeatureSelection, Felt, type FeltController, type FeltEmbedOptions, Filters, Geometry, GetElementGroupsConstraint, GetElementsConstraint, GetLayerGroupsConstraint, GetLayersConstraint, GetRenderedFeaturesConstraint, InputToolSettings, type InteractionsController, Layer, LayerChangeCallbackParams, LayerFilters, LayerGroup, LayerGroupChangeCallbackParams, type LayersController, LegendItem, LegendItemChangeCallbackParams, LegendItemIdentifier, LegendItemsConstraint, MapDetails, MapInteractionEvent, type MiscController, type UiOnMapInteractionsOptions as OnMapInteractionsOptions, type SelectionController, SetViewportCenterZoomParams, SetVisibilityRequest, ToolSettingsChangeEvent, ToolSettingsMap, ToolType, type ToolsController, type UiController, type UiControlsOptions, ViewportCenterZoom, ViewportConstraints, type ViewportController, ViewportFitBoundsParams, ViewportState };
package/dist/client.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { E as Element, G as Geometry, 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 LayerGroup, k as GetLayerGroupsConstraint, l as LayerGroupChangeCallbackParams, m as LegendItemIdentifier, n as LegendItem, o as LegendItemsConstraint, p as LegendItemChangeCallbackParams, q as LayerFilters, F as Filters, r as GetRenderedFeaturesConstraint, s as Feature, M as MapInteractionEvent, t as EntityNode, u as FeatureSelection, T as ToolType, I as InputToolSettings, C as ConfigurableToolType, v as ToolSettingsMap, w as ToolSettingsChangeEvent, z as zInfer, V as ViewportState, x as SetViewportCenterZoomParams, y as ViewportConstraints, A as ViewportFitBoundsParams, B as ViewportCenterZoom } from './types-CPZlLnbg.js';
2
- export { D as CircleElementCreate, H as CircleElementRead, J as CircleElementUpdate, av as CircleToolSettings, ah as ElementGroupNode, ai as ElementNode, aj as FeatureNode, am as FeltBoundary, an as FeltZoom, ae as FilterExpression, af as FilterLogicGate, ag as FilterTernary, K as HighlighterElementCreate, N as HighlighterElementRead, O as HighlighterElementUpdate, aw as HighlighterToolSettings, P as ImageElementCreate, Q as ImageElementRead, R as ImageElementUpdate, ao as LatLng, ak as LayerGroupNode, al as LayerNode, ac as LayerProcessingStatus, ap as LineStringGeometry, ax as LineToolSettings, U as LinkElementRead, aq as LngLatTuple, W as MarkerElementCreate, X as MarkerElementRead, Y as MarkerElementUpdate, ay as MarkerToolSettings, ar as MultiLineStringGeometry, as as MultiPolygonGeometry, Z as NoteElementCreate, _ as NoteElementRead, $ as NoteElementUpdate, az as NoteToolSettings, a0 as PathElementCreate, a1 as PathElementRead, a2 as PathElementUpdate, aA as PinToolSettings, a3 as PlaceElementCreate, a4 as PlaceElementRead, a5 as PlaceElementUpdate, aB as PlaceFrame, aC as PlaceSymbol, at as PointGeometry, a6 as PolygonElementCreate, a7 as PolygonElementRead, a8 as PolygonElementUpdate, au as PolygonGeometry, aD as PolygonToolSettings, ad as RasterValue, aE as RouteToolSettings, a9 as TextElementCreate, aa as TextElementRead, ab as TextElementUpdate, aF as TextToolSettings } from './types-CPZlLnbg.js';
1
+ import { E as Element, G as Geometry, 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 LayerGroup, k as GetLayerGroupsConstraint, l as LayerGroupChangeCallbackParams, m as LegendItemIdentifier, n as LegendItem, o as LegendItemsConstraint, p as LegendItemChangeCallbackParams, q as LayerFilters, F as Filters, r as GetRenderedFeaturesConstraint, s as Feature, M as MapInteractionEvent, t as MapDetails, u as EntityNode, v as FeatureSelection, T as ToolType, I as InputToolSettings, C as ConfigurableToolType, w as ToolSettingsMap, x as ToolSettingsChangeEvent, z as zInfer, V as ViewportState, y as SetViewportCenterZoomParams, A as ViewportConstraints, B as ViewportFitBoundsParams, D as ViewportCenterZoom } from './types-BKxKmuZn.js';
2
+ export { H as CircleElementCreate, J as CircleElementRead, K as CircleElementUpdate, aw as CircleToolSettings, ai as ElementGroupNode, aj as ElementNode, ak as FeatureNode, an as FeltBoundary, ao as FeltZoom, af as FilterExpression, ag as FilterLogicGate, ah as FilterTernary, N as HighlighterElementCreate, O as HighlighterElementRead, P as HighlighterElementUpdate, ax as HighlighterToolSettings, Q as ImageElementCreate, R as ImageElementRead, U as ImageElementUpdate, ap as LatLng, al as LayerGroupNode, am as LayerNode, ad as LayerProcessingStatus, aq as LineStringGeometry, ay as LineToolSettings, W as LinkElementRead, ar as LngLatTuple, X as MarkerElementCreate, Y as MarkerElementRead, Z as MarkerElementUpdate, az as MarkerToolSettings, as as MultiLineStringGeometry, at as MultiPolygonGeometry, _ as NoteElementCreate, $ as NoteElementRead, a0 as NoteElementUpdate, aA as NoteToolSettings, a1 as PathElementCreate, a2 as PathElementRead, a3 as PathElementUpdate, aB as PinToolSettings, a4 as PlaceElementCreate, a5 as PlaceElementRead, a6 as PlaceElementUpdate, aC as PlaceFrame, aD as PlaceSymbol, au as PointGeometry, a7 as PolygonElementCreate, a8 as PolygonElementRead, a9 as PolygonElementUpdate, av as PolygonGeometry, aE as PolygonToolSettings, ae as RasterValue, aF as RouteToolSettings, aa as TextElementCreate, ab as TextElementRead, ac as TextElementUpdate, aG as TextToolSettings } from './types-BKxKmuZn.js';
3
3
  import { z } from 'zod';
4
4
 
5
5
  /**
@@ -593,6 +593,17 @@ interface InteractionsController {
593
593
  }): VoidFunction;
594
594
  }
595
595
 
596
+ /**
597
+ * @group Controller
598
+ * @public
599
+ */
600
+ interface MiscController {
601
+ /**
602
+ * Gets the details of the map.
603
+ */
604
+ getMapDetails(): Promise<MapDetails>;
605
+ }
606
+
596
607
  /**
597
608
  * The Selection controller allows you to listen for changes to the selection on the map.
598
609
  *
@@ -1095,7 +1106,7 @@ interface ViewportController {
1095
1106
  * @group Controller
1096
1107
  * @public
1097
1108
  */
1098
- interface FeltController extends ViewportController, UiController, LayersController, ElementsController, SelectionController, InteractionsController, ToolsController {
1109
+ interface FeltController extends ViewportController, UiController, LayersController, ElementsController, SelectionController, InteractionsController, ToolsController, InteractionsController, MiscController {
1099
1110
  /**
1100
1111
  * The iframe element containing the Felt map, if it is an embedded map.
1101
1112
  *
@@ -1266,4 +1277,4 @@ declare const Felt: {
1266
1277
  connect(feltWindow: Window): Promise<FeltController>;
1267
1278
  };
1268
1279
 
1269
- export { ConfigurableToolType, Element, ElementChangeCallbackParams, ElementCreate, ElementGroup, ElementGroupChangeCallbackParams, ElementUpdate, type ElementsController, EntityNode, Feature, FeatureSelection, Felt, type FeltController, type FeltEmbedOptions, Filters, Geometry, GetElementGroupsConstraint, GetElementsConstraint, GetLayerGroupsConstraint, GetLayersConstraint, GetRenderedFeaturesConstraint, InputToolSettings, type InteractionsController, Layer, LayerChangeCallbackParams, LayerFilters, LayerGroup, LayerGroupChangeCallbackParams, type LayersController, LegendItem, LegendItemChangeCallbackParams, LegendItemIdentifier, LegendItemsConstraint, MapInteractionEvent, type UiOnMapInteractionsOptions as OnMapInteractionsOptions, type SelectionController, SetViewportCenterZoomParams, SetVisibilityRequest, ToolSettingsChangeEvent, ToolSettingsMap, ToolType, type ToolsController, type UiController, type UiControlsOptions, ViewportCenterZoom, ViewportConstraints, type ViewportController, ViewportFitBoundsParams, ViewportState };
1280
+ export { ConfigurableToolType, Element, ElementChangeCallbackParams, ElementCreate, ElementGroup, ElementGroupChangeCallbackParams, ElementUpdate, type ElementsController, EntityNode, Feature, FeatureSelection, Felt, type FeltController, type FeltEmbedOptions, Filters, Geometry, GetElementGroupsConstraint, GetElementsConstraint, GetLayerGroupsConstraint, GetLayersConstraint, GetRenderedFeaturesConstraint, InputToolSettings, type InteractionsController, Layer, LayerChangeCallbackParams, LayerFilters, LayerGroup, LayerGroupChangeCallbackParams, type LayersController, LegendItem, LegendItemChangeCallbackParams, LegendItemIdentifier, LegendItemsConstraint, MapDetails, MapInteractionEvent, type MiscController, type UiOnMapInteractionsOptions as OnMapInteractionsOptions, type SelectionController, SetViewportCenterZoomParams, SetVisibilityRequest, ToolSettingsChangeEvent, ToolSettingsMap, ToolType, type ToolsController, type UiController, type UiControlsOptions, ViewportCenterZoom, ViewportConstraints, type ViewportController, ViewportFitBoundsParams, ViewportState };
package/dist/client.js CHANGED
@@ -1 +1 @@
1
- function o(e,p){return n=>{let r=new MessageChannel,m=n.handler,s="options"in n?n.options:void 0,i=crypto.randomUUID();return e.postMessage({type:"felt.addListener",event:s?{eventName:p,id:i,options:s}:{eventName:p,id:i}},"*",[r.port2]),r.port1.onmessage=d=>{m(d.data)},()=>{r.port1.onmessage=null,r.port1.close(),r.port2.close(),e.postMessage({type:"felt.removeListener",id:i},"*")}}}function t(e,p){return n=>{let r=new MessageChannel;return e.postMessage({type:p,params:n},"*",[r.port2]),new Promise((m,s)=>{r.port1.onmessage=i=>{i.data&&typeof i.data=="object"&&"__error__"in i.data?s(new Error(i.data.__error__)):m(i.data),r.port1.close(),r.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"),onElementDelete:o(e,"onElementDelete"),onElementGroupChange:o(e,"onElementGroupChange"),createElement:t(e,"createElement"),updateElement:t(e,"updateElement"),deleteElement:t(e,"deleteElement")});var u=e=>({onPointerClick:o(e,"onPointerClick"),onPointerMove:o(e,"onPointerMove")});var C=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"),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"),getRenderedFeatures:t(e,"getRenderedFeatures")});var h=e=>({onSelectionChange:o(e,"onSelectionChange"),getSelection:t(e,"getSelection"),selectFeature:t(e,"selectFeature"),clearSelection:t(e,"clearSelection")});var L=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 T=e=>({updateUiControls:t(e,"updateUiControls"),setOnMapInteractionsUi:t(e,"setOnMapInteractionsUi")});var E=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 v(e){return{iframe:null,...E(e),...T(e),...C(e),...c(e),...h(e),...u(e),...L(e)}}var P={embed(e,p,n){let r={uiControls:{showLegend:!0,cooperativeGestures:!0,fullScreenButton:!0,geolocation:!1,zoomControls:!0,scaleBar:!0},initialViewport:void 0,origin:"https://felt.com"},m=n?.origin??r.origin,s=new URL(`${m}/embed/map/${p}`),i={showLegend:"legend",cooperativeGestures:"cooperativeGestures",fullScreenButton:"link",geolocation:"geolocation",zoomControls:"zoomControls",scaleBar:"scaleBar"},d={...r.uiControls,...n?.uiControls};for(let[l,y]of V(d))y!=null&&s.searchParams.set(i[l],y?"1":"0");if(n?.token&&s.searchParams.set("token",n.token),n?.initialViewport){let l=n.initialViewport;s.searchParams.set("loc",`${l.center.latitude},${l.center.longitude},${l.zoom}z`)}let g=e.tagName==="IFRAME",a=g?e:e.ownerDocument.createElement("iframe");return a.src=s.toString(),g||(a.style.width="100%",a.style.height="100%",a.style.border="none",a.style.margin="0",e.appendChild(a)),a.referrerPolicy="strict-origin-when-cross-origin",new Promise((l,y)=>{a.addEventListener("load",()=>{a.contentWindow==null?y(new Error("Failed to load Felt map")):l(a.contentWindow)},{once:!0})}).then(P.connect).then(l=>(Object.defineProperties(l,{iframe:{value:a,writable:!1,configurable:!1}}),l))},connect(e){let p=v(e);return new Promise((n,r)=>{let m=setTimeout(()=>{r(new Error("Failed to load Felt map")),clearInterval(i)},5e3),s=new MessageChannel,i=setInterval(()=>{e.postMessage({type:"felt.ready"},"*",[s.port2])},100);s.port1.onmessage=d=>{d.data===!0&&(clearInterval(i),clearTimeout(m),s.port1.close(),s.port2.close(),n(p))}})}},V=Object.entries;export{P as Felt};
1
+ function o(e,p){return n=>{let r=new MessageChannel,m=n.handler,s="options"in n?n.options:void 0,i=crypto.randomUUID();return e.postMessage({type:"felt.addListener",event:s?{eventName:p,id:i,options:s}:{eventName:p,id:i}},"*",[r.port2]),r.port1.onmessage=d=>{m(d.data)},()=>{r.port1.onmessage=null,r.port1.close(),r.port2.close(),e.postMessage({type:"felt.removeListener",id:i},"*")}}}function t(e,p){return n=>{let r=new MessageChannel;return e.postMessage({type:p,params:n},"*",[r.port2]),new Promise((m,s)=>{r.port1.onmessage=i=>{i.data&&typeof i.data=="object"&&"__error__"in i.data?s(new Error(i.data.__error__)):m(i.data),r.port1.close(),r.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"),onElementDelete:o(e,"onElementDelete"),onElementGroupChange:o(e,"onElementGroupChange"),createElement:t(e,"createElement"),updateElement:t(e,"updateElement"),deleteElement:t(e,"deleteElement")});var u=e=>({onPointerClick:o(e,"onPointerClick"),onPointerMove:o(e,"onPointerMove")});var C=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"),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"),getRenderedFeatures:t(e,"getRenderedFeatures")});var h=e=>({getMapDetails:t(e,"getMapDetails")});var L=e=>({onSelectionChange:o(e,"onSelectionChange"),getSelection:t(e,"getSelection"),selectFeature:t(e,"selectFeature"),clearSelection:t(e,"clearSelection")});var T=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 E=e=>({updateUiControls:t(e,"updateUiControls"),setOnMapInteractionsUi:t(e,"setOnMapInteractionsUi")});var v=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 P(e){return{iframe:null,...v(e),...E(e),...C(e),...c(e),...L(e),...u(e),...T(e),...h(e)}}var V={embed(e,p,n){let r={uiControls:{showLegend:!0,cooperativeGestures:!0,fullScreenButton:!0,geolocation:!1,zoomControls:!0,scaleBar:!0},initialViewport:void 0,origin:"https://felt.com"},m=n?.origin??r.origin,s=new URL(`${m}/embed/map/${p}`),i={showLegend:"legend",cooperativeGestures:"cooperativeGestures",fullScreenButton:"link",geolocation:"geolocation",zoomControls:"zoomControls",scaleBar:"scaleBar"},d={...r.uiControls,...n?.uiControls};for(let[l,y]of M(d))y!=null&&s.searchParams.set(i[l],y?"1":"0");if(n?.token&&s.searchParams.set("token",n.token),n?.initialViewport){let l=n.initialViewport;s.searchParams.set("loc",`${l.center.latitude},${l.center.longitude},${l.zoom}z`)}let g=e.tagName==="IFRAME",a=g?e:e.ownerDocument.createElement("iframe");return a.src=s.toString(),g||(a.style.width="100%",a.style.height="100%",a.style.border="none",a.style.margin="0",e.appendChild(a)),a.referrerPolicy="strict-origin-when-cross-origin",new Promise((l,y)=>{a.addEventListener("load",()=>{a.contentWindow==null?y(new Error("Failed to load Felt map")):l(a.contentWindow)},{once:!0})}).then(V.connect).then(l=>(Object.defineProperties(l,{iframe:{value:a,writable:!1,configurable:!1}}),l))},connect(e){let p=P(e);return new Promise((n,r)=>{let m=setTimeout(()=>{r(new Error("Failed to load Felt map")),clearInterval(i)},5e3),s=new MessageChannel,i=setInterval(()=>{e.postMessage({type:"felt.ready"},"*",[s.port2])},100);s.port1.onmessage=d=>{d.data===!0&&(clearInterval(i),clearTimeout(m),s.port1.close(),s.port2.close(),n(p))}})}},M=Object.entries;export{V as Felt};
package/dist/handler.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";var Z=Object.defineProperty;var De=Object.getOwnPropertyDescriptor;var We=Object.getOwnPropertyNames;var Ke=Object.prototype.hasOwnProperty;var _e=(o,i)=>{for(var I in i)Z(o,I,{get:i[I],enumerable:!0})},Qe=(o,i,I,T)=>{if(i&&typeof i=="object"||typeof i=="function")for(let b of We(i))!Ke.call(o,b)&&b!==I&&Z(o,b,{get:()=>i[b],enumerable:!(T=De(i,b))||T.enumerable});return o};var $e=o=>Qe(Z({},"__esModule",{value:!0}),o);var ko={};_e(ko,{createMessageHandler:()=>Co});module.exports=$e(ko);var c=require("zod");var y=require("zod");var h=require("zod");function t(o,i){return h.z.strictObject({type:h.z.literal(o),params:i})}function L(o,i){return h.z.strictObject({eventName:h.z.literal(o),id:h.z.string(),options:i})}function l(o){return h.z.strictObject({eventName:h.z.literal(o),id:h.z.string()})}var r=require("zod"),V=r.z.number(),v=r.z.number(),O=r.z.object({latitude:v,longitude:V}),P=r.z.tuple([V,v]),me=r.z.object({type:r.z.literal("Point"),coordinates:P}),Je=r.z.object({type:r.z.literal("LineString"),coordinates:r.z.array(P)}),C=r.z.object({type:r.z.literal("MultiLineString"),coordinates:r.z.array(Je.shape.coordinates)}),ce=r.z.number().min(1).max(23),k=r.z.tuple([V,v,V,v]),E=r.z.object({show:r.z.array(r.z.string()).optional(),hide:r.z.array(r.z.string()).optional()});var e=require("zod");var g=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())}),U=e.z.object({imageUrl:e.z.string().nullable()}),B=e.z.object({strokeOpacity:e.z.number(),strokeWidth:e.z.number(),strokeStyle:e.z.enum(["solid","dashed","dotted"])}),Xe=e.z.enum(["meter","kilometer","foot","mile"]),H=g.extend(U.shape).extend({type:e.z.literal("Place"),coordinates:me.shape.coordinates,symbol:e.z.string(),frame:e.z.enum(["frame-circle","frame-square"]).nullable(),hideLabel:e.z.boolean()}),A=g.extend(U.shape).extend(B.shape).extend({type:e.z.literal("Path"),coordinates:C.shape.coordinates,distanceMarker:e.z.boolean(),endCaps:e.z.boolean(),routingMode:e.z.enum(["driving","cycling","walking","flying"]).nullable()}),D=g.extend(U.shape).extend(B.shape).extend({type:e.z.literal("Polygon"),coordinates:C.shape.coordinates,fillOpacity:e.z.number().min(0).max(1),areaMarker:e.z.boolean()}),W=g.extend(U.shape).extend(B.shape).extend({type:e.z.literal("Circle"),coordinates:P,radius:e.z.number(),radiusDisplayAngle:e.z.number(),radiusDisplayUnit:Xe.nullable(),fillOpacity:e.z.number().min(0).max(1),radiusMarker:e.z.boolean()}),K=g.extend({type:e.z.literal("Marker"),coordinates:C.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)}),_=g.extend({type:e.z.literal("Highlighter"),coordinates:C.shape.coordinates,opacity:e.z.number().min(0).max(1)}),de=e.z.object({position:P,rotation:e.z.number(),scale:e.z.number(),zoom:e.z.number().min(0).max(23),coordinates:C.shape.coordinates}),ye=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()}),Q=g.extend(de.shape).extend(ye.shape).extend({type:e.z.literal("Text")}),$=g.extend(de.shape).extend(ye.shape).extend({type:e.z.literal("Note"),widthScale:e.z.number().min(0)}),J=g.extend({type:e.z.literal("Image"),coordinates:C.shape.coordinates,imageUrl:e.z.string(),opacity:e.z.number().min(0).max(1)}).omit({color:!0}),Ye=g.extend({type:e.z.literal("Link"),coordinates:C.shape.coordinates,url:e.z.string()}),f={type:!0,coordinates:!0},S={id:!0},X=H.partial().required(f).omit(S),R=A.partial().required(f).omit(S),Y=D.partial().required(f).omit(S),ee=W.partial().required(f).required({radius:!0}).omit(S),te=K.partial().required(f).omit(S),oe=_.partial().required(f).omit(S),ne=Q.partial().required(f).required({text:!0}).omit(S).omit({coordinates:!0,name:!0}),re=$.partial().required(f).required({text:!0}).omit(S).omit({coordinates:!0,name:!0}),et=J.partial().required(f).required({imageUrl:!0}).omit(S),ge=e.z.discriminatedUnion("type",[X,R,Y,ee,te,oe,et,ne,re]),Uo=H.omit({coordinates:!0}),Ro=A.omit({coordinates:!0}),No=D.omit({coordinates:!0}),jo=W.omit({coordinates:!0}),qo=K.omit({coordinates:!0}),Zo=_.omit({coordinates:!0}),Bo=Q.omit({coordinates:!0}),Ho=$.omit({coordinates:!0}),Ao=J.omit({coordinates:!0}),Do=Ye.omit({coordinates:!0}),x={type:!0,id:!0},tt=H.partial().required(x),ot=A.partial().required(x),nt=D.partial().required(x),rt=W.partial().required(x),at=K.partial().required(x),it=_.partial().required(x),st=Q.partial().required(x).omit({coordinates:!0,name:!0}),lt=$.partial().required(x).omit({coordinates:!0,name:!0}),pt=J.partial().required(x),ue=e.z.discriminatedUnion("type",[tt,ot,nt,rt,at,it,st,lt,pt]),he=e.z.object({ids:e.z.array(e.z.string()).optional()}),fe=e.z.object({ids:e.z.array(e.z.string()).optional()});var mt=t("getElement",y.z.string()),ct=t("getElementGeometry",y.z.string()),dt=t("getElements",he.optional()),yt=t("getElementGroup",y.z.string()),gt=t("getElementGroups",fe.optional()),ut=t("setElementGroupVisibility",E),ht=L("onElementChange",y.z.object({id:y.z.string()})),ft=l("onElementCreate"),St=L("onElementDelete",y.z.object({id:y.z.string()})),xt=L("onElementGroupChange",y.z.object({id:y.z.string()})),Mt=t("createElement",ge),bt=t("updateElement",ue),Lt=t("deleteElement",y.z.string()),Se={methods:[mt,ct,dt,yt,gt,ut,Mt,bt,Lt],listeners:[ht,ft,St,xt]};var Ct=l("onPointerClick"),It=l("onPointerMove"),xe={methods:null,listeners:[Ct,It]};var s=require("zod");var n=require("zod"),Et=n.z.enum(["in","ni"]),Tt=n.z.enum(["lt","gt","le","ge","eq","ne","cn","nc","is","isnt"]),Yo=n.z.enum(["and","or"]),Me=n.z.union([n.z.number(),n.z.string(),n.z.boolean(),n.z.null()]),be=n.z.string().or(n.z.null()),Gt=n.z.tuple([be,Et,n.z.array(Me).or(n.z.null())]),zt=n.z.tuple([be,Tt,Me]),ae=n.z.union([Gt,zt]),ie=n.z.tuple([n.z.lazy(()=>n.z.union([ie,ae,n.z.null(),n.z.boolean()])),n.z.enum(["and","or"]),n.z.lazy(()=>n.z.union([ie,ae,n.z.null(),n.z.boolean()]))]),Le=n.z.union([ie,ae,n.z.null(),n.z.boolean()]);var a=require("zod");var on=a.z.enum(["processing","completed","failed","incomplete"]),Ce=a.z.object({ids:a.z.array(a.z.string()).optional()}),Ie=a.z.object({ids:a.z.array(a.z.string()).optional()}),G=a.z.object({id:a.z.string(),layerId:a.z.string()}),Ee=a.z.object({ids:G.array().optional(),layerIds:a.z.string().array().optional()}),Te=a.z.object({layerIds:a.z.array(a.z.string()).optional(),areaQuery:a.z.union([a.z.object({coordinates:O}),a.z.object({boundary:k})]).optional()});var Pt=t("getLayer",s.z.string()),kt=t("getLayers",Ce.optional()),Ft=t("setLayerVisibility",E),wt=L("onLayerChange",s.z.object({id:s.z.string()})),Vt=t("setLayerStyle",s.z.object({id:s.z.string(),style:s.z.object({}).passthrough()})),vt=t("setLayerLegendVisibility",E),Ot=t("getLayerGroup",s.z.string()),Ut=t("getLayerGroups",Ie.optional()),Rt=t("setLayerGroupVisibility",E),Nt=t("setLayerGroupLegendVisibility",E),jt=L("onLayerGroupChange",s.z.object({id:s.z.string()})),qt=t("getLegendItem",G),Zt=t("getLegendItems",Ee.optional()),Bt=L("onLegendItemChange",G),Ht=t("setLegendItemVisibility",s.z.object({show:G.array().optional(),hide:G.array().optional()})),At=t("getLayerFilters",s.z.string()),Dt=t("setLayerFilters",s.z.object({layerId:s.z.string(),filters:Le,note:s.z.string().optional()})),Wt=t("getRenderedFeatures",Te.optional()),Ge={methods:[Pt,kt,Ft,Vt,vt,Ot,Ut,Rt,Nt,qt,Zt,Ht,At,Dt,Wt],listeners:[wt,jt,Bt]};var F=require("zod");var M=require("zod"),ze=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 Kt=t("getSelection",F.z.undefined()),_t=l("onSelectionChange"),Qt=t("selectFeature",ze),$t=t("clearSelection",F.z.object({features:F.z.boolean().optional(),elements:F.z.boolean().optional()}).optional()),Pe={methods:[Kt,Qt,$t],listeners:[_t]};var ve=require("zod");var p=require("zod");var ke=["pin","line","route","polygon","circle","marker","highlighter","text","note"],Fe=p.z.enum([...ke,"link"]),we=p.z.enum(ke),Jt=X.pick({color:!0,symbol:!0,frame:!0}).required(),Xt=R.pick({color:!0,strokeOpacity:!0,strokeWidth:!0,strokeStyle:!0,distanceMarker:!0}).required(),Yt=R.pick({color:!0,routingMode:!0,strokeOpacity:!0,strokeWidth:!0,strokeStyle:!0,distanceMarker:!0,endCaps:!0}).required(),eo=Y.pick({color:!0,fillOpacity:!0,strokeOpacity:!0,strokeWidth:!0,strokeStyle:!0,areaMarker:!0}).required(),to=ee.pick({color:!0,fillOpacity:!0,strokeOpacity:!0,strokeWidth:!0,strokeStyle:!0,radiusMarker:!0}).required(),oo=te.pick({color:!0,opacity:!0,size:!0}).required(),no=oe.pick({color:!0,opacity:!0}).extend({size:p.z.number().min(0).max(200)}).required(),ro=ne.pick({color:!0,align:!0,style:!0}).required(),ao=re.pick({color:!0,align:!0,style:!0}).required(),Ve=p.z.discriminatedUnion("tool",[Jt.partial().extend({tool:p.z.literal("pin")}),Xt.partial().extend({tool:p.z.literal("line")}),Yt.partial().extend({tool:p.z.literal("route")}),eo.partial().extend({tool:p.z.literal("polygon")}),to.partial().extend({tool:p.z.literal("circle")}),oo.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 io=t("setTool",Fe.nullable()),so=t("getTool",ve.z.undefined()),lo=l("onToolChange"),po=t("setToolSettings",Ve),mo=t("getToolSettings",we),co=l("onToolSettingsChange"),Oe={methods:[io,so,po,mo],listeners:[lo,co]};var m=require("zod"),Ue=m.z.object({showLegend:m.z.boolean().optional(),cooperativeGestures:m.z.boolean().optional(),fullScreenButton:m.z.boolean().optional(),geolocation:m.z.boolean().optional(),zoomControls:m.z.boolean().optional(),scaleBar:m.z.boolean().optional()}),Re=m.z.object({featureSelectPanel:m.z.boolean().optional(),featureHoverPanel:m.z.boolean().optional(),elementSelectPanel:m.z.boolean().optional(),linkClickOpen:m.z.boolean().optional(),imageLightboxOpen:m.z.boolean().optional()});var yo=t("updateUiControls",Ue),go=t("setOnMapInteractionsUi",Re),Ne={methods:[yo,go],listeners:null};var se=require("zod");var w=require("zod");var N=w.z.object({center:O,zoom:ce}),je=w.z.object({center:N.shape.center.optional(),zoom:N.shape.zoom.optional()}),qe=w.z.object({minZoom:N.shape.zoom.nullish(),maxZoom:N.shape.zoom.nullish(),bounds:k.nullish()}).nullable(),Ze=w.z.object({bounds:k});var uo=t("getViewport",se.z.undefined()),ho=t("setViewport",je),fo=t("getViewportConstraints",se.z.undefined()),So=t("setViewportConstraints",qe),xo=t("fitViewportToBounds",Ze),Mo=l("onViewportMove"),bo=l("onViewportMoveEnd"),Lo=l("onMapIdle"),Be={methods:[ho,uo,fo,So,xo],listeners:[Mo,bo,Lo]};var le=[Ne,Be,Ge,Se,Pe,xe,Oe];function Co(o,i,I){let T=new Map;async function b(u){if(!Po.safeParse(u.data).success){I?.onUnknownMessage?.(u.data);return}let pe=Ae.safeParse(u.data);if(!pe.success){I?.onInvalidMessage?.(u.data);return}let{data:d}=pe;if(d.type==="felt.ready")u.ports[0]?.postMessage(!0);else if(d.type==="felt.addListener"){if(d.event.eventName==="")throw new Error("felt.addListener eventName cannot be empty");let z="options"in d.event?{options:"options"in d.event?d.event.options:void 0,handler:q=>{u.ports[0]?.postMessage(q)}}:{handler:q=>{u.ports[0]?.postMessage(q)}},j=i.listeners[d.event.eventName](z);T.set(d.event.id,j)}else if(d.type==="felt.removeListener")T.get(d.id)?.(),T.delete(d.id);else try{let z=i.methods[d.type],j=await z(d.params);u.ports[0]?.postMessage(j)}catch(z){u.ports[0]?.postMessage({__error__:Io(z)})}}return o.addEventListener("message",b),()=>{o.removeEventListener("message",b)}}function Io(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 He={methods:le.map(o=>o.methods??[]).flat(),listeners:le.map(o=>o.listeners??[]).flat()},Eo=c.z.discriminatedUnion("eventName",[c.z.strictObject({eventName:c.z.literal("")}),...He.listeners]),To=c.z.strictObject({type:c.z.literal("felt.addListener"),event:Eo}),Go=c.z.strictObject({type:c.z.literal("felt.removeListener"),id:c.z.string()}),zo=c.z.strictObject({type:c.z.literal("felt.ready")}),Ae=c.z.discriminatedUnion("type",[zo,To,Go,...He.methods]),Po=c.z.object({type:c.z.enum(Ae.options.map(o=>o.shape.type.value))});0&&(module.exports={createMessageHandler});
1
+ "use strict";var Z=Object.defineProperty;var Ke=Object.getOwnPropertyDescriptor;var _e=Object.getOwnPropertyNames;var Qe=Object.prototype.hasOwnProperty;var $e=(o,i)=>{for(var I in i)Z(o,I,{get:i[I],enumerable:!0})},Je=(o,i,I,T)=>{if(i&&typeof i=="object"||typeof i=="function")for(let b of _e(i))!Qe.call(o,b)&&b!==I&&Z(o,b,{get:()=>i[b],enumerable:!(T=Ke(i,b))||T.enumerable});return o};var Xe=o=>Je(Z({},"__esModule",{value:!0}),o);var Vo={};$e(Vo,{createMessageHandler:()=>To});module.exports=Xe(Vo);var c=require("zod");var y=require("zod");var h=require("zod");function t(o,i){return h.z.strictObject({type:h.z.literal(o),params:i})}function L(o,i){return h.z.strictObject({eventName:h.z.literal(o),id:h.z.string(),options:i})}function l(o){return h.z.strictObject({eventName:h.z.literal(o),id:h.z.string()})}var r=require("zod"),V=r.z.number(),v=r.z.number(),O=r.z.object({latitude:v,longitude:V}),P=r.z.tuple([V,v]),me=r.z.object({type:r.z.literal("Point"),coordinates:P}),Ye=r.z.object({type:r.z.literal("LineString"),coordinates:r.z.array(P)}),C=r.z.object({type:r.z.literal("MultiLineString"),coordinates:r.z.array(Ye.shape.coordinates)}),ce=r.z.number().min(1).max(23),k=r.z.tuple([V,v,V,v]),E=r.z.object({show:r.z.array(r.z.string()).optional(),hide:r.z.array(r.z.string()).optional()});var e=require("zod");var g=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())}),U=e.z.object({imageUrl:e.z.string().nullable()}),B=e.z.object({strokeOpacity:e.z.number(),strokeWidth:e.z.number(),strokeStyle:e.z.enum(["solid","dashed","dotted"])}),et=e.z.enum(["meter","kilometer","foot","mile"]),H=g.extend(U.shape).extend({type:e.z.literal("Place"),coordinates:me.shape.coordinates,symbol:e.z.string(),frame:e.z.enum(["frame-circle","frame-square"]).nullable(),hideLabel:e.z.boolean()}),A=g.extend(U.shape).extend(B.shape).extend({type:e.z.literal("Path"),coordinates:C.shape.coordinates,distanceMarker:e.z.boolean(),endCaps:e.z.boolean(),routingMode:e.z.enum(["driving","cycling","walking","flying"]).nullable()}),D=g.extend(U.shape).extend(B.shape).extend({type:e.z.literal("Polygon"),coordinates:C.shape.coordinates,fillOpacity:e.z.number().min(0).max(1),areaMarker:e.z.boolean()}),W=g.extend(U.shape).extend(B.shape).extend({type:e.z.literal("Circle"),coordinates:P,radius:e.z.number(),radiusDisplayAngle:e.z.number(),radiusDisplayUnit:et.nullable(),fillOpacity:e.z.number().min(0).max(1),radiusMarker:e.z.boolean()}),K=g.extend({type:e.z.literal("Marker"),coordinates:C.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)}),_=g.extend({type:e.z.literal("Highlighter"),coordinates:C.shape.coordinates,opacity:e.z.number().min(0).max(1)}),de=e.z.object({position:P,rotation:e.z.number(),scale:e.z.number(),zoom:e.z.number().min(0).max(23),coordinates:C.shape.coordinates}),ye=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()}),Q=g.extend(de.shape).extend(ye.shape).extend({type:e.z.literal("Text")}),$=g.extend(de.shape).extend(ye.shape).extend({type:e.z.literal("Note"),widthScale:e.z.number().min(0)}),J=g.extend({type:e.z.literal("Image"),coordinates:C.shape.coordinates,imageUrl:e.z.string(),opacity:e.z.number().min(0).max(1)}).omit({color:!0}),tt=g.extend({type:e.z.literal("Link"),coordinates:C.shape.coordinates,url:e.z.string()}),f={type:!0,coordinates:!0},S={id:!0},X=H.partial().required(f).omit(S),R=A.partial().required(f).omit(S),Y=D.partial().required(f).omit(S),ee=W.partial().required(f).required({radius:!0}).omit(S),te=K.partial().required(f).omit(S),oe=_.partial().required(f).omit(S),ne=Q.partial().required(f).required({text:!0}).omit(S).omit({coordinates:!0,name:!0}),re=$.partial().required(f).required({text:!0}).omit(S).omit({coordinates:!0,name:!0}),ot=J.partial().required(f).required({imageUrl:!0}).omit(S),ge=e.z.discriminatedUnion("type",[X,R,Y,ee,te,oe,ot,ne,re]),jo=H.omit({coordinates:!0}),qo=A.omit({coordinates:!0}),Zo=D.omit({coordinates:!0}),Bo=W.omit({coordinates:!0}),Ho=K.omit({coordinates:!0}),Ao=_.omit({coordinates:!0}),Do=Q.omit({coordinates:!0}),Wo=$.omit({coordinates:!0}),Ko=J.omit({coordinates:!0}),_o=tt.omit({coordinates:!0}),x={type:!0,id:!0},nt=H.partial().required(x),rt=A.partial().required(x),at=D.partial().required(x),it=W.partial().required(x),st=K.partial().required(x),lt=_.partial().required(x),pt=Q.partial().required(x).omit({coordinates:!0,name:!0}),mt=$.partial().required(x).omit({coordinates:!0,name:!0}),ct=J.partial().required(x),ue=e.z.discriminatedUnion("type",[nt,rt,at,it,st,lt,pt,mt,ct]),he=e.z.object({ids:e.z.array(e.z.string()).optional()}),fe=e.z.object({ids:e.z.array(e.z.string()).optional()});var dt=t("getElement",y.z.string()),yt=t("getElementGeometry",y.z.string()),gt=t("getElements",he.optional()),ut=t("getElementGroup",y.z.string()),ht=t("getElementGroups",fe.optional()),ft=t("setElementGroupVisibility",E),St=L("onElementChange",y.z.object({id:y.z.string()})),xt=l("onElementCreate"),Mt=L("onElementDelete",y.z.object({id:y.z.string()})),bt=L("onElementGroupChange",y.z.object({id:y.z.string()})),Lt=t("createElement",ge),Ct=t("updateElement",ue),It=t("deleteElement",y.z.string()),Se={methods:[dt,yt,gt,ut,ht,ft,Lt,Ct,It],listeners:[St,xt,Mt,bt]};var Et=l("onPointerClick"),Tt=l("onPointerMove"),xe={methods:null,listeners:[Et,Tt]};var s=require("zod");var n=require("zod"),Gt=n.z.enum(["in","ni"]),zt=n.z.enum(["lt","gt","le","ge","eq","ne","cn","nc","is","isnt"]),on=n.z.enum(["and","or"]),Me=n.z.union([n.z.number(),n.z.string(),n.z.boolean(),n.z.null()]),be=n.z.string().or(n.z.null()),Pt=n.z.tuple([be,Gt,n.z.array(Me).or(n.z.null())]),kt=n.z.tuple([be,zt,Me]),ae=n.z.union([Pt,kt]),ie=n.z.tuple([n.z.lazy(()=>n.z.union([ie,ae,n.z.null(),n.z.boolean()])),n.z.enum(["and","or"]),n.z.lazy(()=>n.z.union([ie,ae,n.z.null(),n.z.boolean()]))]),Le=n.z.union([ie,ae,n.z.null(),n.z.boolean()]);var a=require("zod");var an=a.z.enum(["processing","completed","failed","incomplete"]),Ce=a.z.object({ids:a.z.array(a.z.string()).optional()}),Ie=a.z.object({ids:a.z.array(a.z.string()).optional()}),G=a.z.object({id:a.z.string(),layerId:a.z.string()}),Ee=a.z.object({ids:G.array().optional(),layerIds:a.z.string().array().optional()}),Te=a.z.object({layerIds:a.z.array(a.z.string()).optional(),areaQuery:a.z.union([a.z.object({coordinates:O}),a.z.object({boundary:k})]).optional()});var Ft=t("getLayer",s.z.string()),wt=t("getLayers",Ce.optional()),Vt=t("setLayerVisibility",E),vt=L("onLayerChange",s.z.object({id:s.z.string()})),Ot=t("setLayerStyle",s.z.object({id:s.z.string(),style:s.z.object({}).passthrough()})),Ut=t("setLayerLegendVisibility",E),Rt=t("getLayerGroup",s.z.string()),Nt=t("getLayerGroups",Ie.optional()),jt=t("setLayerGroupVisibility",E),qt=t("setLayerGroupLegendVisibility",E),Zt=L("onLayerGroupChange",s.z.object({id:s.z.string()})),Bt=t("getLegendItem",G),Ht=t("getLegendItems",Ee.optional()),At=L("onLegendItemChange",G),Dt=t("setLegendItemVisibility",s.z.object({show:G.array().optional(),hide:G.array().optional()})),Wt=t("getLayerFilters",s.z.string()),Kt=t("setLayerFilters",s.z.object({layerId:s.z.string(),filters:Le,note:s.z.string().optional()})),_t=t("getRenderedFeatures",Te.optional()),Ge={methods:[Ft,wt,Vt,Ot,Ut,Rt,Nt,jt,qt,Bt,Ht,Dt,Wt,Kt,_t],listeners:[vt,Zt,At]};var ze=require("zod");var Qt=t("getMapDetails",ze.z.undefined()),Pe={methods:[Qt],listeners:[]};var F=require("zod");var M=require("zod"),ke=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 $t=t("getSelection",F.z.undefined()),Jt=l("onSelectionChange"),Xt=t("selectFeature",ke),Yt=t("clearSelection",F.z.object({features:F.z.boolean().optional(),elements:F.z.boolean().optional()}).optional()),Fe={methods:[$t,Xt,Yt],listeners:[Jt]};var Ue=require("zod");var p=require("zod");var we=["pin","line","route","polygon","circle","marker","highlighter","text","note"],Ve=p.z.enum([...we,"link"]),ve=p.z.enum(we),eo=X.pick({color:!0,symbol:!0,frame:!0}).required(),to=R.pick({color:!0,strokeOpacity:!0,strokeWidth:!0,strokeStyle:!0,distanceMarker:!0}).required(),oo=R.pick({color:!0,routingMode:!0,strokeOpacity:!0,strokeWidth:!0,strokeStyle:!0,distanceMarker:!0,endCaps:!0}).required(),no=Y.pick({color:!0,fillOpacity:!0,strokeOpacity:!0,strokeWidth:!0,strokeStyle:!0,areaMarker:!0}).required(),ro=ee.pick({color:!0,fillOpacity:!0,strokeOpacity:!0,strokeWidth:!0,strokeStyle:!0,radiusMarker:!0}).required(),ao=te.pick({color:!0,opacity:!0,size:!0}).required(),io=oe.pick({color:!0,opacity:!0}).extend({size:p.z.number().min(0).max(200)}).required(),so=ne.pick({color:!0,align:!0,style:!0}).required(),lo=re.pick({color:!0,align:!0,style:!0}).required(),Oe=p.z.discriminatedUnion("tool",[eo.partial().extend({tool:p.z.literal("pin")}),to.partial().extend({tool:p.z.literal("line")}),oo.partial().extend({tool:p.z.literal("route")}),no.partial().extend({tool:p.z.literal("polygon")}),ro.partial().extend({tool:p.z.literal("circle")}),ao.partial().extend({tool:p.z.literal("marker")}),io.partial().extend({tool:p.z.literal("highlighter")}),so.partial().extend({tool:p.z.literal("text")}),lo.partial().extend({tool:p.z.literal("note")})]);var po=t("setTool",Ve.nullable()),mo=t("getTool",Ue.z.undefined()),co=l("onToolChange"),yo=t("setToolSettings",Oe),go=t("getToolSettings",ve),uo=l("onToolSettingsChange"),Re={methods:[po,mo,yo,go],listeners:[co,uo]};var m=require("zod"),Ne=m.z.object({showLegend:m.z.boolean().optional(),cooperativeGestures:m.z.boolean().optional(),fullScreenButton:m.z.boolean().optional(),geolocation:m.z.boolean().optional(),zoomControls:m.z.boolean().optional(),scaleBar:m.z.boolean().optional()}),je=m.z.object({featureSelectPanel:m.z.boolean().optional(),featureHoverPanel:m.z.boolean().optional(),elementSelectPanel:m.z.boolean().optional(),linkClickOpen:m.z.boolean().optional(),imageLightboxOpen:m.z.boolean().optional()});var ho=t("updateUiControls",Ne),fo=t("setOnMapInteractionsUi",je),qe={methods:[ho,fo],listeners:null};var se=require("zod");var w=require("zod");var N=w.z.object({center:O,zoom:ce}),Ze=w.z.object({center:N.shape.center.optional(),zoom:N.shape.zoom.optional()}),Be=w.z.object({minZoom:N.shape.zoom.nullish(),maxZoom:N.shape.zoom.nullish(),bounds:k.nullish()}).nullable(),He=w.z.object({bounds:k});var So=t("getViewport",se.z.undefined()),xo=t("setViewport",Ze),Mo=t("getViewportConstraints",se.z.undefined()),bo=t("setViewportConstraints",Be),Lo=t("fitViewportToBounds",He),Co=l("onViewportMove"),Io=l("onViewportMoveEnd"),Eo=l("onMapIdle"),Ae={methods:[xo,So,Mo,bo,Lo],listeners:[Co,Io,Eo]};var le=[qe,Ae,Ge,Se,Fe,xe,Re,Pe];function To(o,i,I){let T=new Map;async function b(u){if(!wo.safeParse(u.data).success){I?.onUnknownMessage?.(u.data);return}let pe=We.safeParse(u.data);if(!pe.success){I?.onInvalidMessage?.(u.data);return}let{data:d}=pe;if(d.type==="felt.ready")u.ports[0]?.postMessage(!0);else if(d.type==="felt.addListener"){if(d.event.eventName==="")throw new Error("felt.addListener eventName cannot be empty");let z="options"in d.event?{options:"options"in d.event?d.event.options:void 0,handler:q=>{u.ports[0]?.postMessage(q)}}:{handler:q=>{u.ports[0]?.postMessage(q)}},j=i.listeners[d.event.eventName](z);T.set(d.event.id,j)}else if(d.type==="felt.removeListener")T.get(d.id)?.(),T.delete(d.id);else try{let z=i.methods[d.type],j=await z(d.params);u.ports[0]?.postMessage(j)}catch(z){u.ports[0]?.postMessage({__error__:Go(z)})}}return o.addEventListener("message",b),()=>{o.removeEventListener("message",b)}}function Go(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 De={methods:le.map(o=>o.methods??[]).flat(),listeners:le.map(o=>o.listeners??[]).flat()},zo=c.z.discriminatedUnion("eventName",[c.z.strictObject({eventName:c.z.literal("")}),...De.listeners]),Po=c.z.strictObject({type:c.z.literal("felt.addListener"),event:zo}),ko=c.z.strictObject({type:c.z.literal("felt.removeListener"),id:c.z.string()}),Fo=c.z.strictObject({type:c.z.literal("felt.ready")}),We=c.z.discriminatedUnion("type",[Fo,Po,ko,...De.methods]),wo=c.z.object({type:c.z.enum(We.options.map(o=>o.shape.type.value))});0&&(module.exports={createMessageHandler});
@@ -1,6 +1,6 @@
1
1
  import * as zod from 'zod';
2
2
  import { z } from 'zod';
3
- import { z as zInfer, E as Element, G as Geometry, b as ElementGroup, d as ElementChangeCallbackParams, e as ElementGroupChangeCallbackParams, M as MapInteractionEvent, L as Layer, j as LayerGroup, n as LegendItem, q as LayerFilters, s as Feature, i as LayerChangeCallbackParams, l as LayerGroupChangeCallbackParams, p as LegendItemChangeCallbackParams, ag as FilterTernary, t as EntityNode, T as ToolType, v as ToolSettingsMap, w as ToolSettingsChangeEvent, V as ViewportState, y as ViewportConstraints, aG as UnionToIntersection, aH as PromiseOrNot } from './types-CPZlLnbg.cjs';
3
+ import { z as zInfer, E as Element, G as Geometry, b as ElementGroup, d as ElementChangeCallbackParams, e as ElementGroupChangeCallbackParams, M as MapInteractionEvent, L as Layer, j as LayerGroup, n as LegendItem, q as LayerFilters, s as Feature, i as LayerChangeCallbackParams, l as LayerGroupChangeCallbackParams, p as LegendItemChangeCallbackParams, ah as FilterTernary, t as MapDetails, u as EntityNode, T as ToolType, w as ToolSettingsMap, x as ToolSettingsChangeEvent, V as ViewportState, A as ViewportConstraints, aH as UnionToIntersection, aI as PromiseOrNot } from './types-BKxKmuZn.cjs';
4
4
 
5
5
  type Method<TRequest extends {
6
6
  type: string;
@@ -1991,6 +1991,23 @@ type LayersSchema = {
1991
1991
  };
1992
1992
  };
1993
1993
 
1994
+ declare const GetMapDetailsMessage: z.ZodObject<{
1995
+ type: z.ZodLiteral<"getMapDetails">;
1996
+ params: z.ZodUndefined;
1997
+ }, z.UnknownKeysParam, z.ZodTypeAny, {
1998
+ type: "getMapDetails";
1999
+ params?: undefined;
2000
+ }, {
2001
+ type: "getMapDetails";
2002
+ params?: undefined;
2003
+ }>;
2004
+ type MiscSchema = {
2005
+ methods: {
2006
+ getMapDetails: Method<zInfer<typeof GetMapDetailsMessage>, MapDetails>;
2007
+ };
2008
+ listeners: {};
2009
+ };
2010
+
1994
2011
  declare const GetSelectionMessage: z.ZodObject<{
1995
2012
  type: z.ZodLiteral<"getSelection">;
1996
2013
  params: z.ZodUndefined;
@@ -2659,7 +2676,7 @@ type ViewportSchema = {
2659
2676
  };
2660
2677
  };
2661
2678
 
2662
- type AllModules = UiSchema | ViewportSchema | LayersSchema | ElementsSchema | SelectionSchema | InteractionsSchema | ToolsSchema;
2679
+ type AllModules = UiSchema | ViewportSchema | LayersSchema | ElementsSchema | SelectionSchema | InteractionsSchema | ToolsSchema | InteractionsSchema | MiscSchema;
2663
2680
 
2664
2681
  type FeltHandlers = {
2665
2682
  methods: FeltMethodHandlers;
package/dist/handler.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as zod from 'zod';
2
2
  import { z } from 'zod';
3
- import { z as zInfer, E as Element, G as Geometry, b as ElementGroup, d as ElementChangeCallbackParams, e as ElementGroupChangeCallbackParams, M as MapInteractionEvent, L as Layer, j as LayerGroup, n as LegendItem, q as LayerFilters, s as Feature, i as LayerChangeCallbackParams, l as LayerGroupChangeCallbackParams, p as LegendItemChangeCallbackParams, ag as FilterTernary, t as EntityNode, T as ToolType, v as ToolSettingsMap, w as ToolSettingsChangeEvent, V as ViewportState, y as ViewportConstraints, aG as UnionToIntersection, aH as PromiseOrNot } from './types-CPZlLnbg.js';
3
+ import { z as zInfer, E as Element, G as Geometry, b as ElementGroup, d as ElementChangeCallbackParams, e as ElementGroupChangeCallbackParams, M as MapInteractionEvent, L as Layer, j as LayerGroup, n as LegendItem, q as LayerFilters, s as Feature, i as LayerChangeCallbackParams, l as LayerGroupChangeCallbackParams, p as LegendItemChangeCallbackParams, ah as FilterTernary, t as MapDetails, u as EntityNode, T as ToolType, w as ToolSettingsMap, x as ToolSettingsChangeEvent, V as ViewportState, A as ViewportConstraints, aH as UnionToIntersection, aI as PromiseOrNot } from './types-BKxKmuZn.js';
4
4
 
5
5
  type Method<TRequest extends {
6
6
  type: string;
@@ -1991,6 +1991,23 @@ type LayersSchema = {
1991
1991
  };
1992
1992
  };
1993
1993
 
1994
+ declare const GetMapDetailsMessage: z.ZodObject<{
1995
+ type: z.ZodLiteral<"getMapDetails">;
1996
+ params: z.ZodUndefined;
1997
+ }, z.UnknownKeysParam, z.ZodTypeAny, {
1998
+ type: "getMapDetails";
1999
+ params?: undefined;
2000
+ }, {
2001
+ type: "getMapDetails";
2002
+ params?: undefined;
2003
+ }>;
2004
+ type MiscSchema = {
2005
+ methods: {
2006
+ getMapDetails: Method<zInfer<typeof GetMapDetailsMessage>, MapDetails>;
2007
+ };
2008
+ listeners: {};
2009
+ };
2010
+
1994
2011
  declare const GetSelectionMessage: z.ZodObject<{
1995
2012
  type: z.ZodLiteral<"getSelection">;
1996
2013
  params: z.ZodUndefined;
@@ -2659,7 +2676,7 @@ type ViewportSchema = {
2659
2676
  };
2660
2677
  };
2661
2678
 
2662
- type AllModules = UiSchema | ViewportSchema | LayersSchema | ElementsSchema | SelectionSchema | InteractionsSchema | ToolsSchema;
2679
+ type AllModules = UiSchema | ViewportSchema | LayersSchema | ElementsSchema | SelectionSchema | InteractionsSchema | ToolsSchema | InteractionsSchema | MiscSchema;
2663
2680
 
2664
2681
  type FeltHandlers = {
2665
2682
  methods: FeltMethodHandlers;
package/dist/handler.js CHANGED
@@ -1 +1 @@
1
- import{z as c}from"zod";import{z as y}from"zod";import{z as S}from"zod";function t(n,C){return S.strictObject({type:S.literal(n),params:C})}function x(n,C){return S.strictObject({eventName:S.literal(n),id:S.string(),options:C})}function i(n){return S.strictObject({eventName:S.literal(n),id:S.string()})}import{z as r}from"zod";var z=r.number(),P=r.number(),k=r.object({latitude:P,longitude:z}),T=r.tuple([z,P]),le=r.object({type:r.literal("Point"),coordinates:T}),He=r.object({type:r.literal("LineString"),coordinates:r.array(T)}),M=r.object({type:r.literal("MultiLineString"),coordinates:r.array(He.shape.coordinates)}),pe=r.number().min(1).max(23),G=r.tuple([z,P,z,P]),L=r.object({show:r.array(r.string()).optional(),hide:r.array(r.string()).optional()});import{z as e}from"zod";var d=e.object({id:e.string(),groupId:e.string().nullable(),color:e.string(),name:e.union([e.string(),e.null()]),description:e.union([e.string(),e.null()]),attributes:e.record(e.string(),e.unknown())}),F=e.object({imageUrl:e.string().nullable()}),j=e.object({strokeOpacity:e.number(),strokeWidth:e.number(),strokeStyle:e.enum(["solid","dashed","dotted"])}),Ae=e.enum(["meter","kilometer","foot","mile"]),q=d.extend(F.shape).extend({type:e.literal("Place"),coordinates:le.shape.coordinates,symbol:e.string(),frame:e.enum(["frame-circle","frame-square"]).nullable(),hideLabel:e.boolean()}),Z=d.extend(F.shape).extend(j.shape).extend({type:e.literal("Path"),coordinates:M.shape.coordinates,distanceMarker:e.boolean(),endCaps:e.boolean(),routingMode:e.enum(["driving","cycling","walking","flying"]).nullable()}),B=d.extend(F.shape).extend(j.shape).extend({type:e.literal("Polygon"),coordinates:M.shape.coordinates,fillOpacity:e.number().min(0).max(1),areaMarker:e.boolean()}),H=d.extend(F.shape).extend(j.shape).extend({type:e.literal("Circle"),coordinates:T,radius:e.number(),radiusDisplayAngle:e.number(),radiusDisplayUnit:Ae.nullable(),fillOpacity:e.number().min(0).max(1),radiusMarker:e.boolean()}),A=d.extend({type:e.literal("Marker"),coordinates:M.shape.coordinates,opacity:e.number().min(0).max(1),size:e.number().min(0).max(100),zoom:e.number().min(0).max(23)}),D=d.extend({type:e.literal("Highlighter"),coordinates:M.shape.coordinates,opacity:e.number().min(0).max(1)}),me=e.object({position:T,rotation:e.number(),scale:e.number(),zoom:e.number().min(0).max(23),coordinates:M.shape.coordinates}),ce=e.object({text:e.string(),align:e.enum(["left","center","right"]),style:e.enum(["italic","light","regular","caps"]),name:e.string()}),W=d.extend(me.shape).extend(ce.shape).extend({type:e.literal("Text")}),K=d.extend(me.shape).extend(ce.shape).extend({type:e.literal("Note"),widthScale:e.number().min(0)}),_=d.extend({type:e.literal("Image"),coordinates:M.shape.coordinates,imageUrl:e.string(),opacity:e.number().min(0).max(1)}).omit({color:!0}),De=d.extend({type:e.literal("Link"),coordinates:M.shape.coordinates,url:e.string()}),u={type:!0,coordinates:!0},h={id:!0},Q=q.partial().required(u).omit(h),w=Z.partial().required(u).omit(h),$=B.partial().required(u).omit(h),J=H.partial().required(u).required({radius:!0}).omit(h),X=A.partial().required(u).omit(h),Y=D.partial().required(u).omit(h),ee=W.partial().required(u).required({text:!0}).omit(h).omit({coordinates:!0,name:!0}),te=K.partial().required(u).required({text:!0}).omit(h).omit({coordinates:!0,name:!0}),We=_.partial().required(u).required({imageUrl:!0}).omit(h),de=e.discriminatedUnion("type",[Q,w,$,J,X,Y,We,ee,te]),Po=q.omit({coordinates:!0}),ko=Z.omit({coordinates:!0}),Fo=B.omit({coordinates:!0}),wo=H.omit({coordinates:!0}),Vo=A.omit({coordinates:!0}),vo=D.omit({coordinates:!0}),Oo=W.omit({coordinates:!0}),Uo=K.omit({coordinates:!0}),Ro=_.omit({coordinates:!0}),No=De.omit({coordinates:!0}),f={type:!0,id:!0},Ke=q.partial().required(f),_e=Z.partial().required(f),Qe=B.partial().required(f),$e=H.partial().required(f),Je=A.partial().required(f),Xe=D.partial().required(f),Ye=W.partial().required(f).omit({coordinates:!0,name:!0}),et=K.partial().required(f).omit({coordinates:!0,name:!0}),tt=_.partial().required(f),ye=e.discriminatedUnion("type",[Ke,_e,Qe,$e,Je,Xe,Ye,et,tt]),ge=e.object({ids:e.array(e.string()).optional()}),ue=e.object({ids:e.array(e.string()).optional()});var ot=t("getElement",y.string()),nt=t("getElementGeometry",y.string()),rt=t("getElements",ge.optional()),at=t("getElementGroup",y.string()),it=t("getElementGroups",ue.optional()),st=t("setElementGroupVisibility",L),lt=x("onElementChange",y.object({id:y.string()})),pt=i("onElementCreate"),mt=x("onElementDelete",y.object({id:y.string()})),ct=x("onElementGroupChange",y.object({id:y.string()})),dt=t("createElement",de),yt=t("updateElement",ye),gt=t("deleteElement",y.string()),he={methods:[ot,nt,rt,at,it,st,dt,yt,gt],listeners:[lt,pt,mt,ct]};var ut=i("onPointerClick"),ht=i("onPointerMove"),fe={methods:null,listeners:[ut,ht]};import{z as s}from"zod";import{z as o}from"zod";var ft=o.enum(["in","ni"]),St=o.enum(["lt","gt","le","ge","eq","ne","cn","nc","is","isnt"]),_o=o.enum(["and","or"]),Se=o.union([o.number(),o.string(),o.boolean(),o.null()]),xe=o.string().or(o.null()),xt=o.tuple([xe,ft,o.array(Se).or(o.null())]),Mt=o.tuple([xe,St,Se]),oe=o.union([xt,Mt]),ne=o.tuple([o.lazy(()=>o.union([ne,oe,o.null(),o.boolean()])),o.enum(["and","or"]),o.lazy(()=>o.union([ne,oe,o.null(),o.boolean()]))]),Me=o.union([ne,oe,o.null(),o.boolean()]);import{z as a}from"zod";var Xo=a.enum(["processing","completed","failed","incomplete"]),be=a.object({ids:a.array(a.string()).optional()}),Le=a.object({ids:a.array(a.string()).optional()}),I=a.object({id:a.string(),layerId:a.string()}),Ce=a.object({ids:I.array().optional(),layerIds:a.string().array().optional()}),Ie=a.object({layerIds:a.array(a.string()).optional(),areaQuery:a.union([a.object({coordinates:k}),a.object({boundary:G})]).optional()});var bt=t("getLayer",s.string()),Lt=t("getLayers",be.optional()),Ct=t("setLayerVisibility",L),It=x("onLayerChange",s.object({id:s.string()})),Et=t("setLayerStyle",s.object({id:s.string(),style:s.object({}).passthrough()})),Tt=t("setLayerLegendVisibility",L),Gt=t("getLayerGroup",s.string()),zt=t("getLayerGroups",Le.optional()),Pt=t("setLayerGroupVisibility",L),kt=t("setLayerGroupLegendVisibility",L),Ft=x("onLayerGroupChange",s.object({id:s.string()})),wt=t("getLegendItem",I),Vt=t("getLegendItems",Ce.optional()),vt=x("onLegendItemChange",I),Ot=t("setLegendItemVisibility",s.object({show:I.array().optional(),hide:I.array().optional()})),Ut=t("getLayerFilters",s.string()),Rt=t("setLayerFilters",s.object({layerId:s.string(),filters:Me,note:s.string().optional()})),Nt=t("getRenderedFeatures",Ie.optional()),Ee={methods:[bt,Lt,Ct,Et,Tt,Gt,zt,Pt,kt,wt,Vt,Ot,Ut,Rt,Nt],listeners:[It,Ft,vt]};import{z as V}from"zod";import{z as b}from"zod";var Te=b.object({id:b.string().or(b.number()),layerId:b.string(),showPopup:b.boolean().optional(),fitViewport:b.boolean().or(b.object({maxZoom:b.number()})).optional()});var jt=t("getSelection",V.undefined()),qt=i("onSelectionChange"),Zt=t("selectFeature",Te),Bt=t("clearSelection",V.object({features:V.boolean().optional(),elements:V.boolean().optional()}).optional()),Ge={methods:[jt,Zt,Bt],listeners:[qt]};import{z as Xt}from"zod";import{z as p}from"zod";var ze=["pin","line","route","polygon","circle","marker","highlighter","text","note"],Pe=p.enum([...ze,"link"]),ke=p.enum(ze),Ht=Q.pick({color:!0,symbol:!0,frame:!0}).required(),At=w.pick({color:!0,strokeOpacity:!0,strokeWidth:!0,strokeStyle:!0,distanceMarker:!0}).required(),Dt=w.pick({color:!0,routingMode:!0,strokeOpacity:!0,strokeWidth:!0,strokeStyle:!0,distanceMarker:!0,endCaps:!0}).required(),Wt=$.pick({color:!0,fillOpacity:!0,strokeOpacity:!0,strokeWidth:!0,strokeStyle:!0,areaMarker:!0}).required(),Kt=J.pick({color:!0,fillOpacity:!0,strokeOpacity:!0,strokeWidth:!0,strokeStyle:!0,radiusMarker:!0}).required(),_t=X.pick({color:!0,opacity:!0,size:!0}).required(),Qt=Y.pick({color:!0,opacity:!0}).extend({size:p.number().min(0).max(200)}).required(),$t=ee.pick({color:!0,align:!0,style:!0}).required(),Jt=te.pick({color:!0,align:!0,style:!0}).required(),Fe=p.discriminatedUnion("tool",[Ht.partial().extend({tool:p.literal("pin")}),At.partial().extend({tool:p.literal("line")}),Dt.partial().extend({tool:p.literal("route")}),Wt.partial().extend({tool:p.literal("polygon")}),Kt.partial().extend({tool:p.literal("circle")}),_t.partial().extend({tool:p.literal("marker")}),Qt.partial().extend({tool:p.literal("highlighter")}),$t.partial().extend({tool:p.literal("text")}),Jt.partial().extend({tool:p.literal("note")})]);var Yt=t("setTool",Pe.nullable()),eo=t("getTool",Xt.undefined()),to=i("onToolChange"),oo=t("setToolSettings",Fe),no=t("getToolSettings",ke),ro=i("onToolSettingsChange"),we={methods:[Yt,eo,oo,no],listeners:[to,ro]};import{z as m}from"zod";var Ve=m.object({showLegend:m.boolean().optional(),cooperativeGestures:m.boolean().optional(),fullScreenButton:m.boolean().optional(),geolocation:m.boolean().optional(),zoomControls:m.boolean().optional(),scaleBar:m.boolean().optional()}),ve=m.object({featureSelectPanel:m.boolean().optional(),featureHoverPanel:m.boolean().optional(),elementSelectPanel:m.boolean().optional(),linkClickOpen:m.boolean().optional(),imageLightboxOpen:m.boolean().optional()});var ao=t("updateUiControls",Ve),io=t("setOnMapInteractionsUi",ve),Oe={methods:[ao,io],listeners:null};import{z as je}from"zod";import{z as O}from"zod";var v=O.object({center:k,zoom:pe}),Ue=O.object({center:v.shape.center.optional(),zoom:v.shape.zoom.optional()}),Re=O.object({minZoom:v.shape.zoom.nullish(),maxZoom:v.shape.zoom.nullish(),bounds:G.nullish()}).nullable(),Ne=O.object({bounds:G});var so=t("getViewport",je.undefined()),lo=t("setViewport",Ue),po=t("getViewportConstraints",je.undefined()),mo=t("setViewportConstraints",Re),co=t("fitViewportToBounds",Ne),yo=i("onViewportMove"),go=i("onViewportMoveEnd"),uo=i("onMapIdle"),qe={methods:[lo,so,po,mo,co],listeners:[yo,go,uo]};var re=[Oe,qe,Ee,he,Ge,fe,we];function Bn(n,C,ae){let U=new Map;async function ie(g){if(!bo.safeParse(g.data).success){ae?.onUnknownMessage?.(g.data);return}let se=Be.safeParse(g.data);if(!se.success){ae?.onInvalidMessage?.(g.data);return}let{data:l}=se;if(l.type==="felt.ready")g.ports[0]?.postMessage(!0);else if(l.type==="felt.addListener"){if(l.event.eventName==="")throw new Error("felt.addListener eventName cannot be empty");let E="options"in l.event?{options:"options"in l.event?l.event.options:void 0,handler:N=>{g.ports[0]?.postMessage(N)}}:{handler:N=>{g.ports[0]?.postMessage(N)}},R=C.listeners[l.event.eventName](E);U.set(l.event.id,R)}else if(l.type==="felt.removeListener")U.get(l.id)?.(),U.delete(l.id);else try{let E=C.methods[l.type],R=await E(l.params);g.ports[0]?.postMessage(R)}catch(E){g.ports[0]?.postMessage({__error__:ho(E)})}}return n.addEventListener("message",ie),()=>{n.removeEventListener("message",ie)}}function ho(n){return n instanceof Error?n.message:typeof n=="object"&&n!==null&&"message"in n?String(n.message):typeof n=="string"?n:"Unknown error"}var Ze={methods:re.map(n=>n.methods??[]).flat(),listeners:re.map(n=>n.listeners??[]).flat()},fo=c.discriminatedUnion("eventName",[c.strictObject({eventName:c.literal("")}),...Ze.listeners]),So=c.strictObject({type:c.literal("felt.addListener"),event:fo}),xo=c.strictObject({type:c.literal("felt.removeListener"),id:c.string()}),Mo=c.strictObject({type:c.literal("felt.ready")}),Be=c.discriminatedUnion("type",[Mo,So,xo,...Ze.methods]),bo=c.object({type:c.enum(Be.options.map(n=>n.shape.type.value))});export{Bn as createMessageHandler};
1
+ import{z as c}from"zod";import{z as y}from"zod";import{z as S}from"zod";function t(n,C){return S.strictObject({type:S.literal(n),params:C})}function x(n,C){return S.strictObject({eventName:S.literal(n),id:S.string(),options:C})}function i(n){return S.strictObject({eventName:S.literal(n),id:S.string()})}import{z as r}from"zod";var z=r.number(),P=r.number(),k=r.object({latitude:P,longitude:z}),T=r.tuple([z,P]),le=r.object({type:r.literal("Point"),coordinates:T}),Ae=r.object({type:r.literal("LineString"),coordinates:r.array(T)}),M=r.object({type:r.literal("MultiLineString"),coordinates:r.array(Ae.shape.coordinates)}),pe=r.number().min(1).max(23),G=r.tuple([z,P,z,P]),L=r.object({show:r.array(r.string()).optional(),hide:r.array(r.string()).optional()});import{z as e}from"zod";var d=e.object({id:e.string(),groupId:e.string().nullable(),color:e.string(),name:e.union([e.string(),e.null()]),description:e.union([e.string(),e.null()]),attributes:e.record(e.string(),e.unknown())}),F=e.object({imageUrl:e.string().nullable()}),j=e.object({strokeOpacity:e.number(),strokeWidth:e.number(),strokeStyle:e.enum(["solid","dashed","dotted"])}),De=e.enum(["meter","kilometer","foot","mile"]),q=d.extend(F.shape).extend({type:e.literal("Place"),coordinates:le.shape.coordinates,symbol:e.string(),frame:e.enum(["frame-circle","frame-square"]).nullable(),hideLabel:e.boolean()}),Z=d.extend(F.shape).extend(j.shape).extend({type:e.literal("Path"),coordinates:M.shape.coordinates,distanceMarker:e.boolean(),endCaps:e.boolean(),routingMode:e.enum(["driving","cycling","walking","flying"]).nullable()}),B=d.extend(F.shape).extend(j.shape).extend({type:e.literal("Polygon"),coordinates:M.shape.coordinates,fillOpacity:e.number().min(0).max(1),areaMarker:e.boolean()}),H=d.extend(F.shape).extend(j.shape).extend({type:e.literal("Circle"),coordinates:T,radius:e.number(),radiusDisplayAngle:e.number(),radiusDisplayUnit:De.nullable(),fillOpacity:e.number().min(0).max(1),radiusMarker:e.boolean()}),A=d.extend({type:e.literal("Marker"),coordinates:M.shape.coordinates,opacity:e.number().min(0).max(1),size:e.number().min(0).max(100),zoom:e.number().min(0).max(23)}),D=d.extend({type:e.literal("Highlighter"),coordinates:M.shape.coordinates,opacity:e.number().min(0).max(1)}),me=e.object({position:T,rotation:e.number(),scale:e.number(),zoom:e.number().min(0).max(23),coordinates:M.shape.coordinates}),ce=e.object({text:e.string(),align:e.enum(["left","center","right"]),style:e.enum(["italic","light","regular","caps"]),name:e.string()}),W=d.extend(me.shape).extend(ce.shape).extend({type:e.literal("Text")}),K=d.extend(me.shape).extend(ce.shape).extend({type:e.literal("Note"),widthScale:e.number().min(0)}),_=d.extend({type:e.literal("Image"),coordinates:M.shape.coordinates,imageUrl:e.string(),opacity:e.number().min(0).max(1)}).omit({color:!0}),We=d.extend({type:e.literal("Link"),coordinates:M.shape.coordinates,url:e.string()}),u={type:!0,coordinates:!0},h={id:!0},Q=q.partial().required(u).omit(h),w=Z.partial().required(u).omit(h),$=B.partial().required(u).omit(h),J=H.partial().required(u).required({radius:!0}).omit(h),X=A.partial().required(u).omit(h),Y=D.partial().required(u).omit(h),ee=W.partial().required(u).required({text:!0}).omit(h).omit({coordinates:!0,name:!0}),te=K.partial().required(u).required({text:!0}).omit(h).omit({coordinates:!0,name:!0}),Ke=_.partial().required(u).required({imageUrl:!0}).omit(h),de=e.discriminatedUnion("type",[Q,w,$,J,X,Y,Ke,ee,te]),wo=q.omit({coordinates:!0}),Vo=Z.omit({coordinates:!0}),vo=B.omit({coordinates:!0}),Oo=H.omit({coordinates:!0}),Uo=A.omit({coordinates:!0}),Ro=D.omit({coordinates:!0}),No=W.omit({coordinates:!0}),jo=K.omit({coordinates:!0}),qo=_.omit({coordinates:!0}),Zo=We.omit({coordinates:!0}),f={type:!0,id:!0},_e=q.partial().required(f),Qe=Z.partial().required(f),$e=B.partial().required(f),Je=H.partial().required(f),Xe=A.partial().required(f),Ye=D.partial().required(f),et=W.partial().required(f).omit({coordinates:!0,name:!0}),tt=K.partial().required(f).omit({coordinates:!0,name:!0}),ot=_.partial().required(f),ye=e.discriminatedUnion("type",[_e,Qe,$e,Je,Xe,Ye,et,tt,ot]),ge=e.object({ids:e.array(e.string()).optional()}),ue=e.object({ids:e.array(e.string()).optional()});var nt=t("getElement",y.string()),rt=t("getElementGeometry",y.string()),at=t("getElements",ge.optional()),it=t("getElementGroup",y.string()),st=t("getElementGroups",ue.optional()),lt=t("setElementGroupVisibility",L),pt=x("onElementChange",y.object({id:y.string()})),mt=i("onElementCreate"),ct=x("onElementDelete",y.object({id:y.string()})),dt=x("onElementGroupChange",y.object({id:y.string()})),yt=t("createElement",de),gt=t("updateElement",ye),ut=t("deleteElement",y.string()),he={methods:[nt,rt,at,it,st,lt,yt,gt,ut],listeners:[pt,mt,ct,dt]};var ht=i("onPointerClick"),ft=i("onPointerMove"),fe={methods:null,listeners:[ht,ft]};import{z as s}from"zod";import{z as o}from"zod";var St=o.enum(["in","ni"]),xt=o.enum(["lt","gt","le","ge","eq","ne","cn","nc","is","isnt"]),Jo=o.enum(["and","or"]),Se=o.union([o.number(),o.string(),o.boolean(),o.null()]),xe=o.string().or(o.null()),Mt=o.tuple([xe,St,o.array(Se).or(o.null())]),bt=o.tuple([xe,xt,Se]),oe=o.union([Mt,bt]),ne=o.tuple([o.lazy(()=>o.union([ne,oe,o.null(),o.boolean()])),o.enum(["and","or"]),o.lazy(()=>o.union([ne,oe,o.null(),o.boolean()]))]),Me=o.union([ne,oe,o.null(),o.boolean()]);import{z as a}from"zod";var tn=a.enum(["processing","completed","failed","incomplete"]),be=a.object({ids:a.array(a.string()).optional()}),Le=a.object({ids:a.array(a.string()).optional()}),I=a.object({id:a.string(),layerId:a.string()}),Ce=a.object({ids:I.array().optional(),layerIds:a.string().array().optional()}),Ie=a.object({layerIds:a.array(a.string()).optional(),areaQuery:a.union([a.object({coordinates:k}),a.object({boundary:G})]).optional()});var Lt=t("getLayer",s.string()),Ct=t("getLayers",be.optional()),It=t("setLayerVisibility",L),Et=x("onLayerChange",s.object({id:s.string()})),Tt=t("setLayerStyle",s.object({id:s.string(),style:s.object({}).passthrough()})),Gt=t("setLayerLegendVisibility",L),zt=t("getLayerGroup",s.string()),Pt=t("getLayerGroups",Le.optional()),kt=t("setLayerGroupVisibility",L),Ft=t("setLayerGroupLegendVisibility",L),wt=x("onLayerGroupChange",s.object({id:s.string()})),Vt=t("getLegendItem",I),vt=t("getLegendItems",Ce.optional()),Ot=x("onLegendItemChange",I),Ut=t("setLegendItemVisibility",s.object({show:I.array().optional(),hide:I.array().optional()})),Rt=t("getLayerFilters",s.string()),Nt=t("setLayerFilters",s.object({layerId:s.string(),filters:Me,note:s.string().optional()})),jt=t("getRenderedFeatures",Ie.optional()),Ee={methods:[Lt,Ct,It,Tt,Gt,zt,Pt,kt,Ft,Vt,vt,Ut,Rt,Nt,jt],listeners:[Et,wt,Ot]};import{z as qt}from"zod";var Zt=t("getMapDetails",qt.undefined()),Te={methods:[Zt],listeners:[]};import{z as V}from"zod";import{z as b}from"zod";var Ge=b.object({id:b.string().or(b.number()),layerId:b.string(),showPopup:b.boolean().optional(),fitViewport:b.boolean().or(b.object({maxZoom:b.number()})).optional()});var Bt=t("getSelection",V.undefined()),Ht=i("onSelectionChange"),At=t("selectFeature",Ge),Dt=t("clearSelection",V.object({features:V.boolean().optional(),elements:V.boolean().optional()}).optional()),ze={methods:[Bt,At,Dt],listeners:[Ht]};import{z as to}from"zod";import{z as p}from"zod";var Pe=["pin","line","route","polygon","circle","marker","highlighter","text","note"],ke=p.enum([...Pe,"link"]),Fe=p.enum(Pe),Wt=Q.pick({color:!0,symbol:!0,frame:!0}).required(),Kt=w.pick({color:!0,strokeOpacity:!0,strokeWidth:!0,strokeStyle:!0,distanceMarker:!0}).required(),_t=w.pick({color:!0,routingMode:!0,strokeOpacity:!0,strokeWidth:!0,strokeStyle:!0,distanceMarker:!0,endCaps:!0}).required(),Qt=$.pick({color:!0,fillOpacity:!0,strokeOpacity:!0,strokeWidth:!0,strokeStyle:!0,areaMarker:!0}).required(),$t=J.pick({color:!0,fillOpacity:!0,strokeOpacity:!0,strokeWidth:!0,strokeStyle:!0,radiusMarker:!0}).required(),Jt=X.pick({color:!0,opacity:!0,size:!0}).required(),Xt=Y.pick({color:!0,opacity:!0}).extend({size:p.number().min(0).max(200)}).required(),Yt=ee.pick({color:!0,align:!0,style:!0}).required(),eo=te.pick({color:!0,align:!0,style:!0}).required(),we=p.discriminatedUnion("tool",[Wt.partial().extend({tool:p.literal("pin")}),Kt.partial().extend({tool:p.literal("line")}),_t.partial().extend({tool:p.literal("route")}),Qt.partial().extend({tool:p.literal("polygon")}),$t.partial().extend({tool:p.literal("circle")}),Jt.partial().extend({tool:p.literal("marker")}),Xt.partial().extend({tool:p.literal("highlighter")}),Yt.partial().extend({tool:p.literal("text")}),eo.partial().extend({tool:p.literal("note")})]);var oo=t("setTool",ke.nullable()),no=t("getTool",to.undefined()),ro=i("onToolChange"),ao=t("setToolSettings",we),io=t("getToolSettings",Fe),so=i("onToolSettingsChange"),Ve={methods:[oo,no,ao,io],listeners:[ro,so]};import{z as m}from"zod";var ve=m.object({showLegend:m.boolean().optional(),cooperativeGestures:m.boolean().optional(),fullScreenButton:m.boolean().optional(),geolocation:m.boolean().optional(),zoomControls:m.boolean().optional(),scaleBar:m.boolean().optional()}),Oe=m.object({featureSelectPanel:m.boolean().optional(),featureHoverPanel:m.boolean().optional(),elementSelectPanel:m.boolean().optional(),linkClickOpen:m.boolean().optional(),imageLightboxOpen:m.boolean().optional()});var lo=t("updateUiControls",ve),po=t("setOnMapInteractionsUi",Oe),Ue={methods:[lo,po],listeners:null};import{z as qe}from"zod";import{z as O}from"zod";var v=O.object({center:k,zoom:pe}),Re=O.object({center:v.shape.center.optional(),zoom:v.shape.zoom.optional()}),Ne=O.object({minZoom:v.shape.zoom.nullish(),maxZoom:v.shape.zoom.nullish(),bounds:G.nullish()}).nullable(),je=O.object({bounds:G});var mo=t("getViewport",qe.undefined()),co=t("setViewport",Re),yo=t("getViewportConstraints",qe.undefined()),go=t("setViewportConstraints",Ne),uo=t("fitViewportToBounds",je),ho=i("onViewportMove"),fo=i("onViewportMoveEnd"),So=i("onMapIdle"),Ze={methods:[co,mo,yo,go,uo],listeners:[ho,fo,So]};var re=[Ue,Ze,Ee,he,ze,fe,Ve,Te];function Qn(n,C,ae){let U=new Map;async function ie(g){if(!Io.safeParse(g.data).success){ae?.onUnknownMessage?.(g.data);return}let se=He.safeParse(g.data);if(!se.success){ae?.onInvalidMessage?.(g.data);return}let{data:l}=se;if(l.type==="felt.ready")g.ports[0]?.postMessage(!0);else if(l.type==="felt.addListener"){if(l.event.eventName==="")throw new Error("felt.addListener eventName cannot be empty");let E="options"in l.event?{options:"options"in l.event?l.event.options:void 0,handler:N=>{g.ports[0]?.postMessage(N)}}:{handler:N=>{g.ports[0]?.postMessage(N)}},R=C.listeners[l.event.eventName](E);U.set(l.event.id,R)}else if(l.type==="felt.removeListener")U.get(l.id)?.(),U.delete(l.id);else try{let E=C.methods[l.type],R=await E(l.params);g.ports[0]?.postMessage(R)}catch(E){g.ports[0]?.postMessage({__error__:xo(E)})}}return n.addEventListener("message",ie),()=>{n.removeEventListener("message",ie)}}function xo(n){return n instanceof Error?n.message:typeof n=="object"&&n!==null&&"message"in n?String(n.message):typeof n=="string"?n:"Unknown error"}var Be={methods:re.map(n=>n.methods??[]).flat(),listeners:re.map(n=>n.listeners??[]).flat()},Mo=c.discriminatedUnion("eventName",[c.strictObject({eventName:c.literal("")}),...Be.listeners]),bo=c.strictObject({type:c.literal("felt.addListener"),event:Mo}),Lo=c.strictObject({type:c.literal("felt.removeListener"),id:c.string()}),Co=c.strictObject({type:c.literal("felt.ready")}),He=c.discriminatedUnion("type",[Co,bo,Lo,...Be.methods]),Io=c.object({type:c.enum(He.options.map(n=>n.shape.type.value))});export{Qn as createMessageHandler};
@@ -1963,6 +1963,26 @@ interface MapInteractionEvent {
1963
1963
  rasterValues: Array<RasterValue>;
1964
1964
  }
1965
1965
 
1966
+ /**
1967
+ * The details of a map.
1968
+ *
1969
+ * @group Types
1970
+ */
1971
+ type MapDetails = {
1972
+ /**
1973
+ * The id of the map.
1974
+ */
1975
+ id: string;
1976
+ /**
1977
+ * The title of the map.
1978
+ */
1979
+ title: string;
1980
+ /**
1981
+ * The description of the map.
1982
+ */
1983
+ description: string | null;
1984
+ };
1985
+
1966
1986
  /**
1967
1987
  * A reference to any kind of entity in the map.
1968
1988
  *
@@ -2426,4 +2446,4 @@ declare const ViewportFitBoundsParamsSchema: z.ZodObject<{
2426
2446
  bounds: [number, number, number, number];
2427
2447
  }>;
2428
2448
 
2429
- export type { NoteElementUpdate as $, ViewportFitBoundsParams as A, ViewportCenterZoom as B, ConfigurableToolType as C, CircleElementCreate as D, Element as E, Filters as F, Geometry as G, CircleElementRead as H, InputToolSettings as I, CircleElementUpdate as J, HighlighterElementCreate as K, Layer as L, MapInteractionEvent as M, HighlighterElementRead as N, HighlighterElementUpdate as O, ImageElementCreate as P, ImageElementRead as Q, ImageElementUpdate as R, SetVisibilityRequest as S, ToolType as T, LinkElementRead as U, ViewportState as V, MarkerElementCreate as W, MarkerElementRead as X, MarkerElementUpdate as Y, NoteElementCreate as Z, NoteElementRead as _, GetElementsConstraint as a, PathElementCreate as a0, PathElementRead as a1, PathElementUpdate as a2, PlaceElementCreate as a3, PlaceElementRead as a4, PlaceElementUpdate as a5, PolygonElementCreate as a6, PolygonElementRead as a7, PolygonElementUpdate as a8, TextElementCreate as a9, PinToolSettings as aA, PlaceFrame as aB, PlaceSymbol as aC, PolygonToolSettings as aD, RouteToolSettings as aE, TextToolSettings as aF, UnionToIntersection as aG, PromiseOrNot as aH, TextElementRead as aa, TextElementUpdate as ab, LayerProcessingStatus as ac, RasterValue as ad, FilterExpression as ae, FilterLogicGate as af, FilterTernary as ag, ElementGroupNode as ah, ElementNode as ai, FeatureNode as aj, LayerGroupNode as ak, LayerNode as al, FeltBoundary as am, FeltZoom as an, LatLng as ao, LineStringGeometry as ap, LngLatTuple as aq, MultiLineStringGeometry as ar, MultiPolygonGeometry as as, PointGeometry as at, PolygonGeometry as au, CircleToolSettings as av, HighlighterToolSettings as aw, LineToolSettings as ax, MarkerToolSettings as ay, NoteToolSettings as az, ElementGroup as b, GetElementGroupsConstraint as c, ElementChangeCallbackParams as d, ElementGroupChangeCallbackParams as e, ElementCreate as f, ElementUpdate as g, GetLayersConstraint as h, LayerChangeCallbackParams as i, LayerGroup as j, GetLayerGroupsConstraint as k, LayerGroupChangeCallbackParams as l, LegendItemIdentifier as m, LegendItem as n, LegendItemsConstraint as o, LegendItemChangeCallbackParams as p, LayerFilters as q, GetRenderedFeaturesConstraint as r, Feature as s, EntityNode as t, FeatureSelection as u, ToolSettingsMap as v, ToolSettingsChangeEvent as w, SetViewportCenterZoomParams as x, ViewportConstraints as y, zInfer as z };
2449
+ export type { NoteElementRead as $, ViewportConstraints as A, ViewportFitBoundsParams as B, ConfigurableToolType as C, ViewportCenterZoom as D, Element as E, Filters as F, Geometry as G, CircleElementCreate as H, InputToolSettings as I, CircleElementRead as J, CircleElementUpdate as K, Layer as L, MapInteractionEvent as M, HighlighterElementCreate as N, HighlighterElementRead as O, HighlighterElementUpdate as P, ImageElementCreate as Q, ImageElementRead as R, SetVisibilityRequest as S, ToolType as T, ImageElementUpdate as U, ViewportState as V, LinkElementRead as W, MarkerElementCreate as X, MarkerElementRead as Y, MarkerElementUpdate as Z, NoteElementCreate as _, GetElementsConstraint as a, NoteElementUpdate as a0, PathElementCreate as a1, PathElementRead as a2, PathElementUpdate as a3, PlaceElementCreate as a4, PlaceElementRead as a5, PlaceElementUpdate as a6, PolygonElementCreate as a7, PolygonElementRead as a8, PolygonElementUpdate as a9, NoteToolSettings as aA, PinToolSettings as aB, PlaceFrame as aC, PlaceSymbol as aD, PolygonToolSettings as aE, RouteToolSettings as aF, TextToolSettings as aG, UnionToIntersection as aH, PromiseOrNot as aI, TextElementCreate as aa, TextElementRead as ab, TextElementUpdate as ac, LayerProcessingStatus as ad, RasterValue as ae, FilterExpression as af, FilterLogicGate as ag, FilterTernary as ah, ElementGroupNode as ai, ElementNode as aj, FeatureNode as ak, LayerGroupNode as al, LayerNode as am, FeltBoundary as an, FeltZoom as ao, LatLng as ap, LineStringGeometry as aq, LngLatTuple as ar, MultiLineStringGeometry as as, MultiPolygonGeometry as at, PointGeometry as au, PolygonGeometry as av, CircleToolSettings as aw, HighlighterToolSettings as ax, LineToolSettings as ay, MarkerToolSettings as az, ElementGroup as b, GetElementGroupsConstraint as c, ElementChangeCallbackParams as d, ElementGroupChangeCallbackParams as e, ElementCreate as f, ElementUpdate as g, GetLayersConstraint as h, LayerChangeCallbackParams as i, LayerGroup as j, GetLayerGroupsConstraint as k, LayerGroupChangeCallbackParams as l, LegendItemIdentifier as m, LegendItem as n, LegendItemsConstraint as o, LegendItemChangeCallbackParams as p, LayerFilters as q, GetRenderedFeaturesConstraint as r, Feature as s, MapDetails as t, EntityNode as u, FeatureSelection as v, ToolSettingsMap as w, ToolSettingsChangeEvent as x, SetViewportCenterZoomParams as y, zInfer as z };
@@ -1963,6 +1963,26 @@ interface MapInteractionEvent {
1963
1963
  rasterValues: Array<RasterValue>;
1964
1964
  }
1965
1965
 
1966
+ /**
1967
+ * The details of a map.
1968
+ *
1969
+ * @group Types
1970
+ */
1971
+ type MapDetails = {
1972
+ /**
1973
+ * The id of the map.
1974
+ */
1975
+ id: string;
1976
+ /**
1977
+ * The title of the map.
1978
+ */
1979
+ title: string;
1980
+ /**
1981
+ * The description of the map.
1982
+ */
1983
+ description: string | null;
1984
+ };
1985
+
1966
1986
  /**
1967
1987
  * A reference to any kind of entity in the map.
1968
1988
  *
@@ -2426,4 +2446,4 @@ declare const ViewportFitBoundsParamsSchema: z.ZodObject<{
2426
2446
  bounds: [number, number, number, number];
2427
2447
  }>;
2428
2448
 
2429
- export type { NoteElementUpdate as $, ViewportFitBoundsParams as A, ViewportCenterZoom as B, ConfigurableToolType as C, CircleElementCreate as D, Element as E, Filters as F, Geometry as G, CircleElementRead as H, InputToolSettings as I, CircleElementUpdate as J, HighlighterElementCreate as K, Layer as L, MapInteractionEvent as M, HighlighterElementRead as N, HighlighterElementUpdate as O, ImageElementCreate as P, ImageElementRead as Q, ImageElementUpdate as R, SetVisibilityRequest as S, ToolType as T, LinkElementRead as U, ViewportState as V, MarkerElementCreate as W, MarkerElementRead as X, MarkerElementUpdate as Y, NoteElementCreate as Z, NoteElementRead as _, GetElementsConstraint as a, PathElementCreate as a0, PathElementRead as a1, PathElementUpdate as a2, PlaceElementCreate as a3, PlaceElementRead as a4, PlaceElementUpdate as a5, PolygonElementCreate as a6, PolygonElementRead as a7, PolygonElementUpdate as a8, TextElementCreate as a9, PinToolSettings as aA, PlaceFrame as aB, PlaceSymbol as aC, PolygonToolSettings as aD, RouteToolSettings as aE, TextToolSettings as aF, UnionToIntersection as aG, PromiseOrNot as aH, TextElementRead as aa, TextElementUpdate as ab, LayerProcessingStatus as ac, RasterValue as ad, FilterExpression as ae, FilterLogicGate as af, FilterTernary as ag, ElementGroupNode as ah, ElementNode as ai, FeatureNode as aj, LayerGroupNode as ak, LayerNode as al, FeltBoundary as am, FeltZoom as an, LatLng as ao, LineStringGeometry as ap, LngLatTuple as aq, MultiLineStringGeometry as ar, MultiPolygonGeometry as as, PointGeometry as at, PolygonGeometry as au, CircleToolSettings as av, HighlighterToolSettings as aw, LineToolSettings as ax, MarkerToolSettings as ay, NoteToolSettings as az, ElementGroup as b, GetElementGroupsConstraint as c, ElementChangeCallbackParams as d, ElementGroupChangeCallbackParams as e, ElementCreate as f, ElementUpdate as g, GetLayersConstraint as h, LayerChangeCallbackParams as i, LayerGroup as j, GetLayerGroupsConstraint as k, LayerGroupChangeCallbackParams as l, LegendItemIdentifier as m, LegendItem as n, LegendItemsConstraint as o, LegendItemChangeCallbackParams as p, LayerFilters as q, GetRenderedFeaturesConstraint as r, Feature as s, EntityNode as t, FeatureSelection as u, ToolSettingsMap as v, ToolSettingsChangeEvent as w, SetViewportCenterZoomParams as x, ViewportConstraints as y, zInfer as z };
2449
+ export type { NoteElementRead as $, ViewportConstraints as A, ViewportFitBoundsParams as B, ConfigurableToolType as C, ViewportCenterZoom as D, Element as E, Filters as F, Geometry as G, CircleElementCreate as H, InputToolSettings as I, CircleElementRead as J, CircleElementUpdate as K, Layer as L, MapInteractionEvent as M, HighlighterElementCreate as N, HighlighterElementRead as O, HighlighterElementUpdate as P, ImageElementCreate as Q, ImageElementRead as R, SetVisibilityRequest as S, ToolType as T, ImageElementUpdate as U, ViewportState as V, LinkElementRead as W, MarkerElementCreate as X, MarkerElementRead as Y, MarkerElementUpdate as Z, NoteElementCreate as _, GetElementsConstraint as a, NoteElementUpdate as a0, PathElementCreate as a1, PathElementRead as a2, PathElementUpdate as a3, PlaceElementCreate as a4, PlaceElementRead as a5, PlaceElementUpdate as a6, PolygonElementCreate as a7, PolygonElementRead as a8, PolygonElementUpdate as a9, NoteToolSettings as aA, PinToolSettings as aB, PlaceFrame as aC, PlaceSymbol as aD, PolygonToolSettings as aE, RouteToolSettings as aF, TextToolSettings as aG, UnionToIntersection as aH, PromiseOrNot as aI, TextElementCreate as aa, TextElementRead as ab, TextElementUpdate as ac, LayerProcessingStatus as ad, RasterValue as ae, FilterExpression as af, FilterLogicGate as ag, FilterTernary as ah, ElementGroupNode as ai, ElementNode as aj, FeatureNode as ak, LayerGroupNode as al, LayerNode as am, FeltBoundary as an, FeltZoom as ao, LatLng as ap, LineStringGeometry as aq, LngLatTuple as ar, MultiLineStringGeometry as as, MultiPolygonGeometry as at, PointGeometry as au, PolygonGeometry as av, CircleToolSettings as aw, HighlighterToolSettings as ax, LineToolSettings as ay, MarkerToolSettings as az, ElementGroup as b, GetElementGroupsConstraint as c, ElementChangeCallbackParams as d, ElementGroupChangeCallbackParams as e, ElementCreate as f, ElementUpdate as g, GetLayersConstraint as h, LayerChangeCallbackParams as i, LayerGroup as j, GetLayerGroupsConstraint as k, LayerGroupChangeCallbackParams as l, LegendItemIdentifier as m, LegendItem as n, LegendItemsConstraint as o, LegendItemChangeCallbackParams as p, LayerFilters as q, GetRenderedFeaturesConstraint as r, Feature as s, MapDetails as t, EntityNode as u, FeatureSelection as v, ToolSettingsMap as w, ToolSettingsChangeEvent as x, SetViewportCenterZoomParams as y, zInfer as z };
package/handler.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as zod from 'zod';
2
2
  import { z } from 'zod';
3
- import { z as zInfer, E as Element, G as Geometry, b as ElementGroup, d as ElementChangeCallbackParams, e as ElementGroupChangeCallbackParams, M as MapInteractionEvent, L as Layer, j as LayerGroup, n as LegendItem, q as LayerFilters, s as Feature, i as LayerChangeCallbackParams, l as LayerGroupChangeCallbackParams, p as LegendItemChangeCallbackParams, ag as FilterTernary, t as EntityNode, T as ToolType, v as ToolSettingsMap, w as ToolSettingsChangeEvent, V as ViewportState, y as ViewportConstraints, aG as UnionToIntersection, aH as PromiseOrNot } from './types-CPZlLnbg.js';
3
+ import { z as zInfer, E as Element, G as Geometry, b as ElementGroup, d as ElementChangeCallbackParams, e as ElementGroupChangeCallbackParams, M as MapInteractionEvent, L as Layer, j as LayerGroup, n as LegendItem, q as LayerFilters, s as Feature, i as LayerChangeCallbackParams, l as LayerGroupChangeCallbackParams, p as LegendItemChangeCallbackParams, ah as FilterTernary, t as MapDetails, u as EntityNode, T as ToolType, w as ToolSettingsMap, x as ToolSettingsChangeEvent, V as ViewportState, A as ViewportConstraints, aH as UnionToIntersection, aI as PromiseOrNot } from './types-BKxKmuZn.js';
4
4
 
5
5
  type Method<TRequest extends {
6
6
  type: string;
@@ -1991,6 +1991,23 @@ type LayersSchema = {
1991
1991
  };
1992
1992
  };
1993
1993
 
1994
+ declare const GetMapDetailsMessage: z.ZodObject<{
1995
+ type: z.ZodLiteral<"getMapDetails">;
1996
+ params: z.ZodUndefined;
1997
+ }, z.UnknownKeysParam, z.ZodTypeAny, {
1998
+ type: "getMapDetails";
1999
+ params?: undefined;
2000
+ }, {
2001
+ type: "getMapDetails";
2002
+ params?: undefined;
2003
+ }>;
2004
+ type MiscSchema = {
2005
+ methods: {
2006
+ getMapDetails: Method<zInfer<typeof GetMapDetailsMessage>, MapDetails>;
2007
+ };
2008
+ listeners: {};
2009
+ };
2010
+
1994
2011
  declare const GetSelectionMessage: z.ZodObject<{
1995
2012
  type: z.ZodLiteral<"getSelection">;
1996
2013
  params: z.ZodUndefined;
@@ -2659,7 +2676,7 @@ type ViewportSchema = {
2659
2676
  };
2660
2677
  };
2661
2678
 
2662
- type AllModules = UiSchema | ViewportSchema | LayersSchema | ElementsSchema | SelectionSchema | InteractionsSchema | ToolsSchema;
2679
+ type AllModules = UiSchema | ViewportSchema | LayersSchema | ElementsSchema | SelectionSchema | InteractionsSchema | ToolsSchema | InteractionsSchema | MiscSchema;
2663
2680
 
2664
2681
  type FeltHandlers = {
2665
2682
  methods: FeltMethodHandlers;
package/handler.js CHANGED
@@ -1 +1 @@
1
- "use strict";var Z=Object.defineProperty;var De=Object.getOwnPropertyDescriptor;var We=Object.getOwnPropertyNames;var Ke=Object.prototype.hasOwnProperty;var _e=(o,i)=>{for(var I in i)Z(o,I,{get:i[I],enumerable:!0})},Qe=(o,i,I,T)=>{if(i&&typeof i=="object"||typeof i=="function")for(let b of We(i))!Ke.call(o,b)&&b!==I&&Z(o,b,{get:()=>i[b],enumerable:!(T=De(i,b))||T.enumerable});return o};var $e=o=>Qe(Z({},"__esModule",{value:!0}),o);var ko={};_e(ko,{createMessageHandler:()=>Co});module.exports=$e(ko);var c=require("zod");var y=require("zod");var h=require("zod");function t(o,i){return h.z.strictObject({type:h.z.literal(o),params:i})}function L(o,i){return h.z.strictObject({eventName:h.z.literal(o),id:h.z.string(),options:i})}function l(o){return h.z.strictObject({eventName:h.z.literal(o),id:h.z.string()})}var r=require("zod"),V=r.z.number(),v=r.z.number(),O=r.z.object({latitude:v,longitude:V}),P=r.z.tuple([V,v]),me=r.z.object({type:r.z.literal("Point"),coordinates:P}),Je=r.z.object({type:r.z.literal("LineString"),coordinates:r.z.array(P)}),C=r.z.object({type:r.z.literal("MultiLineString"),coordinates:r.z.array(Je.shape.coordinates)}),ce=r.z.number().min(1).max(23),k=r.z.tuple([V,v,V,v]),E=r.z.object({show:r.z.array(r.z.string()).optional(),hide:r.z.array(r.z.string()).optional()});var e=require("zod");var g=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())}),U=e.z.object({imageUrl:e.z.string().nullable()}),B=e.z.object({strokeOpacity:e.z.number(),strokeWidth:e.z.number(),strokeStyle:e.z.enum(["solid","dashed","dotted"])}),Xe=e.z.enum(["meter","kilometer","foot","mile"]),H=g.extend(U.shape).extend({type:e.z.literal("Place"),coordinates:me.shape.coordinates,symbol:e.z.string(),frame:e.z.enum(["frame-circle","frame-square"]).nullable(),hideLabel:e.z.boolean()}),A=g.extend(U.shape).extend(B.shape).extend({type:e.z.literal("Path"),coordinates:C.shape.coordinates,distanceMarker:e.z.boolean(),endCaps:e.z.boolean(),routingMode:e.z.enum(["driving","cycling","walking","flying"]).nullable()}),D=g.extend(U.shape).extend(B.shape).extend({type:e.z.literal("Polygon"),coordinates:C.shape.coordinates,fillOpacity:e.z.number().min(0).max(1),areaMarker:e.z.boolean()}),W=g.extend(U.shape).extend(B.shape).extend({type:e.z.literal("Circle"),coordinates:P,radius:e.z.number(),radiusDisplayAngle:e.z.number(),radiusDisplayUnit:Xe.nullable(),fillOpacity:e.z.number().min(0).max(1),radiusMarker:e.z.boolean()}),K=g.extend({type:e.z.literal("Marker"),coordinates:C.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)}),_=g.extend({type:e.z.literal("Highlighter"),coordinates:C.shape.coordinates,opacity:e.z.number().min(0).max(1)}),de=e.z.object({position:P,rotation:e.z.number(),scale:e.z.number(),zoom:e.z.number().min(0).max(23),coordinates:C.shape.coordinates}),ye=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()}),Q=g.extend(de.shape).extend(ye.shape).extend({type:e.z.literal("Text")}),$=g.extend(de.shape).extend(ye.shape).extend({type:e.z.literal("Note"),widthScale:e.z.number().min(0)}),J=g.extend({type:e.z.literal("Image"),coordinates:C.shape.coordinates,imageUrl:e.z.string(),opacity:e.z.number().min(0).max(1)}).omit({color:!0}),Ye=g.extend({type:e.z.literal("Link"),coordinates:C.shape.coordinates,url:e.z.string()}),f={type:!0,coordinates:!0},S={id:!0},X=H.partial().required(f).omit(S),R=A.partial().required(f).omit(S),Y=D.partial().required(f).omit(S),ee=W.partial().required(f).required({radius:!0}).omit(S),te=K.partial().required(f).omit(S),oe=_.partial().required(f).omit(S),ne=Q.partial().required(f).required({text:!0}).omit(S).omit({coordinates:!0,name:!0}),re=$.partial().required(f).required({text:!0}).omit(S).omit({coordinates:!0,name:!0}),et=J.partial().required(f).required({imageUrl:!0}).omit(S),ge=e.z.discriminatedUnion("type",[X,R,Y,ee,te,oe,et,ne,re]),Uo=H.omit({coordinates:!0}),Ro=A.omit({coordinates:!0}),No=D.omit({coordinates:!0}),jo=W.omit({coordinates:!0}),qo=K.omit({coordinates:!0}),Zo=_.omit({coordinates:!0}),Bo=Q.omit({coordinates:!0}),Ho=$.omit({coordinates:!0}),Ao=J.omit({coordinates:!0}),Do=Ye.omit({coordinates:!0}),x={type:!0,id:!0},tt=H.partial().required(x),ot=A.partial().required(x),nt=D.partial().required(x),rt=W.partial().required(x),at=K.partial().required(x),it=_.partial().required(x),st=Q.partial().required(x).omit({coordinates:!0,name:!0}),lt=$.partial().required(x).omit({coordinates:!0,name:!0}),pt=J.partial().required(x),ue=e.z.discriminatedUnion("type",[tt,ot,nt,rt,at,it,st,lt,pt]),he=e.z.object({ids:e.z.array(e.z.string()).optional()}),fe=e.z.object({ids:e.z.array(e.z.string()).optional()});var mt=t("getElement",y.z.string()),ct=t("getElementGeometry",y.z.string()),dt=t("getElements",he.optional()),yt=t("getElementGroup",y.z.string()),gt=t("getElementGroups",fe.optional()),ut=t("setElementGroupVisibility",E),ht=L("onElementChange",y.z.object({id:y.z.string()})),ft=l("onElementCreate"),St=L("onElementDelete",y.z.object({id:y.z.string()})),xt=L("onElementGroupChange",y.z.object({id:y.z.string()})),Mt=t("createElement",ge),bt=t("updateElement",ue),Lt=t("deleteElement",y.z.string()),Se={methods:[mt,ct,dt,yt,gt,ut,Mt,bt,Lt],listeners:[ht,ft,St,xt]};var Ct=l("onPointerClick"),It=l("onPointerMove"),xe={methods:null,listeners:[Ct,It]};var s=require("zod");var n=require("zod"),Et=n.z.enum(["in","ni"]),Tt=n.z.enum(["lt","gt","le","ge","eq","ne","cn","nc","is","isnt"]),Yo=n.z.enum(["and","or"]),Me=n.z.union([n.z.number(),n.z.string(),n.z.boolean(),n.z.null()]),be=n.z.string().or(n.z.null()),Gt=n.z.tuple([be,Et,n.z.array(Me).or(n.z.null())]),zt=n.z.tuple([be,Tt,Me]),ae=n.z.union([Gt,zt]),ie=n.z.tuple([n.z.lazy(()=>n.z.union([ie,ae,n.z.null(),n.z.boolean()])),n.z.enum(["and","or"]),n.z.lazy(()=>n.z.union([ie,ae,n.z.null(),n.z.boolean()]))]),Le=n.z.union([ie,ae,n.z.null(),n.z.boolean()]);var a=require("zod");var on=a.z.enum(["processing","completed","failed","incomplete"]),Ce=a.z.object({ids:a.z.array(a.z.string()).optional()}),Ie=a.z.object({ids:a.z.array(a.z.string()).optional()}),G=a.z.object({id:a.z.string(),layerId:a.z.string()}),Ee=a.z.object({ids:G.array().optional(),layerIds:a.z.string().array().optional()}),Te=a.z.object({layerIds:a.z.array(a.z.string()).optional(),areaQuery:a.z.union([a.z.object({coordinates:O}),a.z.object({boundary:k})]).optional()});var Pt=t("getLayer",s.z.string()),kt=t("getLayers",Ce.optional()),Ft=t("setLayerVisibility",E),wt=L("onLayerChange",s.z.object({id:s.z.string()})),Vt=t("setLayerStyle",s.z.object({id:s.z.string(),style:s.z.object({}).passthrough()})),vt=t("setLayerLegendVisibility",E),Ot=t("getLayerGroup",s.z.string()),Ut=t("getLayerGroups",Ie.optional()),Rt=t("setLayerGroupVisibility",E),Nt=t("setLayerGroupLegendVisibility",E),jt=L("onLayerGroupChange",s.z.object({id:s.z.string()})),qt=t("getLegendItem",G),Zt=t("getLegendItems",Ee.optional()),Bt=L("onLegendItemChange",G),Ht=t("setLegendItemVisibility",s.z.object({show:G.array().optional(),hide:G.array().optional()})),At=t("getLayerFilters",s.z.string()),Dt=t("setLayerFilters",s.z.object({layerId:s.z.string(),filters:Le,note:s.z.string().optional()})),Wt=t("getRenderedFeatures",Te.optional()),Ge={methods:[Pt,kt,Ft,Vt,vt,Ot,Ut,Rt,Nt,qt,Zt,Ht,At,Dt,Wt],listeners:[wt,jt,Bt]};var F=require("zod");var M=require("zod"),ze=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 Kt=t("getSelection",F.z.undefined()),_t=l("onSelectionChange"),Qt=t("selectFeature",ze),$t=t("clearSelection",F.z.object({features:F.z.boolean().optional(),elements:F.z.boolean().optional()}).optional()),Pe={methods:[Kt,Qt,$t],listeners:[_t]};var ve=require("zod");var p=require("zod");var ke=["pin","line","route","polygon","circle","marker","highlighter","text","note"],Fe=p.z.enum([...ke,"link"]),we=p.z.enum(ke),Jt=X.pick({color:!0,symbol:!0,frame:!0}).required(),Xt=R.pick({color:!0,strokeOpacity:!0,strokeWidth:!0,strokeStyle:!0,distanceMarker:!0}).required(),Yt=R.pick({color:!0,routingMode:!0,strokeOpacity:!0,strokeWidth:!0,strokeStyle:!0,distanceMarker:!0,endCaps:!0}).required(),eo=Y.pick({color:!0,fillOpacity:!0,strokeOpacity:!0,strokeWidth:!0,strokeStyle:!0,areaMarker:!0}).required(),to=ee.pick({color:!0,fillOpacity:!0,strokeOpacity:!0,strokeWidth:!0,strokeStyle:!0,radiusMarker:!0}).required(),oo=te.pick({color:!0,opacity:!0,size:!0}).required(),no=oe.pick({color:!0,opacity:!0}).extend({size:p.z.number().min(0).max(200)}).required(),ro=ne.pick({color:!0,align:!0,style:!0}).required(),ao=re.pick({color:!0,align:!0,style:!0}).required(),Ve=p.z.discriminatedUnion("tool",[Jt.partial().extend({tool:p.z.literal("pin")}),Xt.partial().extend({tool:p.z.literal("line")}),Yt.partial().extend({tool:p.z.literal("route")}),eo.partial().extend({tool:p.z.literal("polygon")}),to.partial().extend({tool:p.z.literal("circle")}),oo.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 io=t("setTool",Fe.nullable()),so=t("getTool",ve.z.undefined()),lo=l("onToolChange"),po=t("setToolSettings",Ve),mo=t("getToolSettings",we),co=l("onToolSettingsChange"),Oe={methods:[io,so,po,mo],listeners:[lo,co]};var m=require("zod"),Ue=m.z.object({showLegend:m.z.boolean().optional(),cooperativeGestures:m.z.boolean().optional(),fullScreenButton:m.z.boolean().optional(),geolocation:m.z.boolean().optional(),zoomControls:m.z.boolean().optional(),scaleBar:m.z.boolean().optional()}),Re=m.z.object({featureSelectPanel:m.z.boolean().optional(),featureHoverPanel:m.z.boolean().optional(),elementSelectPanel:m.z.boolean().optional(),linkClickOpen:m.z.boolean().optional(),imageLightboxOpen:m.z.boolean().optional()});var yo=t("updateUiControls",Ue),go=t("setOnMapInteractionsUi",Re),Ne={methods:[yo,go],listeners:null};var se=require("zod");var w=require("zod");var N=w.z.object({center:O,zoom:ce}),je=w.z.object({center:N.shape.center.optional(),zoom:N.shape.zoom.optional()}),qe=w.z.object({minZoom:N.shape.zoom.nullish(),maxZoom:N.shape.zoom.nullish(),bounds:k.nullish()}).nullable(),Ze=w.z.object({bounds:k});var uo=t("getViewport",se.z.undefined()),ho=t("setViewport",je),fo=t("getViewportConstraints",se.z.undefined()),So=t("setViewportConstraints",qe),xo=t("fitViewportToBounds",Ze),Mo=l("onViewportMove"),bo=l("onViewportMoveEnd"),Lo=l("onMapIdle"),Be={methods:[ho,uo,fo,So,xo],listeners:[Mo,bo,Lo]};var le=[Ne,Be,Ge,Se,Pe,xe,Oe];function Co(o,i,I){let T=new Map;async function b(u){if(!Po.safeParse(u.data).success){I?.onUnknownMessage?.(u.data);return}let pe=Ae.safeParse(u.data);if(!pe.success){I?.onInvalidMessage?.(u.data);return}let{data:d}=pe;if(d.type==="felt.ready")u.ports[0]?.postMessage(!0);else if(d.type==="felt.addListener"){if(d.event.eventName==="")throw new Error("felt.addListener eventName cannot be empty");let z="options"in d.event?{options:"options"in d.event?d.event.options:void 0,handler:q=>{u.ports[0]?.postMessage(q)}}:{handler:q=>{u.ports[0]?.postMessage(q)}},j=i.listeners[d.event.eventName](z);T.set(d.event.id,j)}else if(d.type==="felt.removeListener")T.get(d.id)?.(),T.delete(d.id);else try{let z=i.methods[d.type],j=await z(d.params);u.ports[0]?.postMessage(j)}catch(z){u.ports[0]?.postMessage({__error__:Io(z)})}}return o.addEventListener("message",b),()=>{o.removeEventListener("message",b)}}function Io(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 He={methods:le.map(o=>o.methods??[]).flat(),listeners:le.map(o=>o.listeners??[]).flat()},Eo=c.z.discriminatedUnion("eventName",[c.z.strictObject({eventName:c.z.literal("")}),...He.listeners]),To=c.z.strictObject({type:c.z.literal("felt.addListener"),event:Eo}),Go=c.z.strictObject({type:c.z.literal("felt.removeListener"),id:c.z.string()}),zo=c.z.strictObject({type:c.z.literal("felt.ready")}),Ae=c.z.discriminatedUnion("type",[zo,To,Go,...He.methods]),Po=c.z.object({type:c.z.enum(Ae.options.map(o=>o.shape.type.value))});0&&(module.exports={createMessageHandler});
1
+ "use strict";var Z=Object.defineProperty;var Ke=Object.getOwnPropertyDescriptor;var _e=Object.getOwnPropertyNames;var Qe=Object.prototype.hasOwnProperty;var $e=(o,i)=>{for(var I in i)Z(o,I,{get:i[I],enumerable:!0})},Je=(o,i,I,T)=>{if(i&&typeof i=="object"||typeof i=="function")for(let b of _e(i))!Qe.call(o,b)&&b!==I&&Z(o,b,{get:()=>i[b],enumerable:!(T=Ke(i,b))||T.enumerable});return o};var Xe=o=>Je(Z({},"__esModule",{value:!0}),o);var Vo={};$e(Vo,{createMessageHandler:()=>To});module.exports=Xe(Vo);var c=require("zod");var y=require("zod");var h=require("zod");function t(o,i){return h.z.strictObject({type:h.z.literal(o),params:i})}function L(o,i){return h.z.strictObject({eventName:h.z.literal(o),id:h.z.string(),options:i})}function l(o){return h.z.strictObject({eventName:h.z.literal(o),id:h.z.string()})}var r=require("zod"),V=r.z.number(),v=r.z.number(),O=r.z.object({latitude:v,longitude:V}),P=r.z.tuple([V,v]),me=r.z.object({type:r.z.literal("Point"),coordinates:P}),Ye=r.z.object({type:r.z.literal("LineString"),coordinates:r.z.array(P)}),C=r.z.object({type:r.z.literal("MultiLineString"),coordinates:r.z.array(Ye.shape.coordinates)}),ce=r.z.number().min(1).max(23),k=r.z.tuple([V,v,V,v]),E=r.z.object({show:r.z.array(r.z.string()).optional(),hide:r.z.array(r.z.string()).optional()});var e=require("zod");var g=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())}),U=e.z.object({imageUrl:e.z.string().nullable()}),B=e.z.object({strokeOpacity:e.z.number(),strokeWidth:e.z.number(),strokeStyle:e.z.enum(["solid","dashed","dotted"])}),et=e.z.enum(["meter","kilometer","foot","mile"]),H=g.extend(U.shape).extend({type:e.z.literal("Place"),coordinates:me.shape.coordinates,symbol:e.z.string(),frame:e.z.enum(["frame-circle","frame-square"]).nullable(),hideLabel:e.z.boolean()}),A=g.extend(U.shape).extend(B.shape).extend({type:e.z.literal("Path"),coordinates:C.shape.coordinates,distanceMarker:e.z.boolean(),endCaps:e.z.boolean(),routingMode:e.z.enum(["driving","cycling","walking","flying"]).nullable()}),D=g.extend(U.shape).extend(B.shape).extend({type:e.z.literal("Polygon"),coordinates:C.shape.coordinates,fillOpacity:e.z.number().min(0).max(1),areaMarker:e.z.boolean()}),W=g.extend(U.shape).extend(B.shape).extend({type:e.z.literal("Circle"),coordinates:P,radius:e.z.number(),radiusDisplayAngle:e.z.number(),radiusDisplayUnit:et.nullable(),fillOpacity:e.z.number().min(0).max(1),radiusMarker:e.z.boolean()}),K=g.extend({type:e.z.literal("Marker"),coordinates:C.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)}),_=g.extend({type:e.z.literal("Highlighter"),coordinates:C.shape.coordinates,opacity:e.z.number().min(0).max(1)}),de=e.z.object({position:P,rotation:e.z.number(),scale:e.z.number(),zoom:e.z.number().min(0).max(23),coordinates:C.shape.coordinates}),ye=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()}),Q=g.extend(de.shape).extend(ye.shape).extend({type:e.z.literal("Text")}),$=g.extend(de.shape).extend(ye.shape).extend({type:e.z.literal("Note"),widthScale:e.z.number().min(0)}),J=g.extend({type:e.z.literal("Image"),coordinates:C.shape.coordinates,imageUrl:e.z.string(),opacity:e.z.number().min(0).max(1)}).omit({color:!0}),tt=g.extend({type:e.z.literal("Link"),coordinates:C.shape.coordinates,url:e.z.string()}),f={type:!0,coordinates:!0},S={id:!0},X=H.partial().required(f).omit(S),R=A.partial().required(f).omit(S),Y=D.partial().required(f).omit(S),ee=W.partial().required(f).required({radius:!0}).omit(S),te=K.partial().required(f).omit(S),oe=_.partial().required(f).omit(S),ne=Q.partial().required(f).required({text:!0}).omit(S).omit({coordinates:!0,name:!0}),re=$.partial().required(f).required({text:!0}).omit(S).omit({coordinates:!0,name:!0}),ot=J.partial().required(f).required({imageUrl:!0}).omit(S),ge=e.z.discriminatedUnion("type",[X,R,Y,ee,te,oe,ot,ne,re]),jo=H.omit({coordinates:!0}),qo=A.omit({coordinates:!0}),Zo=D.omit({coordinates:!0}),Bo=W.omit({coordinates:!0}),Ho=K.omit({coordinates:!0}),Ao=_.omit({coordinates:!0}),Do=Q.omit({coordinates:!0}),Wo=$.omit({coordinates:!0}),Ko=J.omit({coordinates:!0}),_o=tt.omit({coordinates:!0}),x={type:!0,id:!0},nt=H.partial().required(x),rt=A.partial().required(x),at=D.partial().required(x),it=W.partial().required(x),st=K.partial().required(x),lt=_.partial().required(x),pt=Q.partial().required(x).omit({coordinates:!0,name:!0}),mt=$.partial().required(x).omit({coordinates:!0,name:!0}),ct=J.partial().required(x),ue=e.z.discriminatedUnion("type",[nt,rt,at,it,st,lt,pt,mt,ct]),he=e.z.object({ids:e.z.array(e.z.string()).optional()}),fe=e.z.object({ids:e.z.array(e.z.string()).optional()});var dt=t("getElement",y.z.string()),yt=t("getElementGeometry",y.z.string()),gt=t("getElements",he.optional()),ut=t("getElementGroup",y.z.string()),ht=t("getElementGroups",fe.optional()),ft=t("setElementGroupVisibility",E),St=L("onElementChange",y.z.object({id:y.z.string()})),xt=l("onElementCreate"),Mt=L("onElementDelete",y.z.object({id:y.z.string()})),bt=L("onElementGroupChange",y.z.object({id:y.z.string()})),Lt=t("createElement",ge),Ct=t("updateElement",ue),It=t("deleteElement",y.z.string()),Se={methods:[dt,yt,gt,ut,ht,ft,Lt,Ct,It],listeners:[St,xt,Mt,bt]};var Et=l("onPointerClick"),Tt=l("onPointerMove"),xe={methods:null,listeners:[Et,Tt]};var s=require("zod");var n=require("zod"),Gt=n.z.enum(["in","ni"]),zt=n.z.enum(["lt","gt","le","ge","eq","ne","cn","nc","is","isnt"]),on=n.z.enum(["and","or"]),Me=n.z.union([n.z.number(),n.z.string(),n.z.boolean(),n.z.null()]),be=n.z.string().or(n.z.null()),Pt=n.z.tuple([be,Gt,n.z.array(Me).or(n.z.null())]),kt=n.z.tuple([be,zt,Me]),ae=n.z.union([Pt,kt]),ie=n.z.tuple([n.z.lazy(()=>n.z.union([ie,ae,n.z.null(),n.z.boolean()])),n.z.enum(["and","or"]),n.z.lazy(()=>n.z.union([ie,ae,n.z.null(),n.z.boolean()]))]),Le=n.z.union([ie,ae,n.z.null(),n.z.boolean()]);var a=require("zod");var an=a.z.enum(["processing","completed","failed","incomplete"]),Ce=a.z.object({ids:a.z.array(a.z.string()).optional()}),Ie=a.z.object({ids:a.z.array(a.z.string()).optional()}),G=a.z.object({id:a.z.string(),layerId:a.z.string()}),Ee=a.z.object({ids:G.array().optional(),layerIds:a.z.string().array().optional()}),Te=a.z.object({layerIds:a.z.array(a.z.string()).optional(),areaQuery:a.z.union([a.z.object({coordinates:O}),a.z.object({boundary:k})]).optional()});var Ft=t("getLayer",s.z.string()),wt=t("getLayers",Ce.optional()),Vt=t("setLayerVisibility",E),vt=L("onLayerChange",s.z.object({id:s.z.string()})),Ot=t("setLayerStyle",s.z.object({id:s.z.string(),style:s.z.object({}).passthrough()})),Ut=t("setLayerLegendVisibility",E),Rt=t("getLayerGroup",s.z.string()),Nt=t("getLayerGroups",Ie.optional()),jt=t("setLayerGroupVisibility",E),qt=t("setLayerGroupLegendVisibility",E),Zt=L("onLayerGroupChange",s.z.object({id:s.z.string()})),Bt=t("getLegendItem",G),Ht=t("getLegendItems",Ee.optional()),At=L("onLegendItemChange",G),Dt=t("setLegendItemVisibility",s.z.object({show:G.array().optional(),hide:G.array().optional()})),Wt=t("getLayerFilters",s.z.string()),Kt=t("setLayerFilters",s.z.object({layerId:s.z.string(),filters:Le,note:s.z.string().optional()})),_t=t("getRenderedFeatures",Te.optional()),Ge={methods:[Ft,wt,Vt,Ot,Ut,Rt,Nt,jt,qt,Bt,Ht,Dt,Wt,Kt,_t],listeners:[vt,Zt,At]};var ze=require("zod");var Qt=t("getMapDetails",ze.z.undefined()),Pe={methods:[Qt],listeners:[]};var F=require("zod");var M=require("zod"),ke=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 $t=t("getSelection",F.z.undefined()),Jt=l("onSelectionChange"),Xt=t("selectFeature",ke),Yt=t("clearSelection",F.z.object({features:F.z.boolean().optional(),elements:F.z.boolean().optional()}).optional()),Fe={methods:[$t,Xt,Yt],listeners:[Jt]};var Ue=require("zod");var p=require("zod");var we=["pin","line","route","polygon","circle","marker","highlighter","text","note"],Ve=p.z.enum([...we,"link"]),ve=p.z.enum(we),eo=X.pick({color:!0,symbol:!0,frame:!0}).required(),to=R.pick({color:!0,strokeOpacity:!0,strokeWidth:!0,strokeStyle:!0,distanceMarker:!0}).required(),oo=R.pick({color:!0,routingMode:!0,strokeOpacity:!0,strokeWidth:!0,strokeStyle:!0,distanceMarker:!0,endCaps:!0}).required(),no=Y.pick({color:!0,fillOpacity:!0,strokeOpacity:!0,strokeWidth:!0,strokeStyle:!0,areaMarker:!0}).required(),ro=ee.pick({color:!0,fillOpacity:!0,strokeOpacity:!0,strokeWidth:!0,strokeStyle:!0,radiusMarker:!0}).required(),ao=te.pick({color:!0,opacity:!0,size:!0}).required(),io=oe.pick({color:!0,opacity:!0}).extend({size:p.z.number().min(0).max(200)}).required(),so=ne.pick({color:!0,align:!0,style:!0}).required(),lo=re.pick({color:!0,align:!0,style:!0}).required(),Oe=p.z.discriminatedUnion("tool",[eo.partial().extend({tool:p.z.literal("pin")}),to.partial().extend({tool:p.z.literal("line")}),oo.partial().extend({tool:p.z.literal("route")}),no.partial().extend({tool:p.z.literal("polygon")}),ro.partial().extend({tool:p.z.literal("circle")}),ao.partial().extend({tool:p.z.literal("marker")}),io.partial().extend({tool:p.z.literal("highlighter")}),so.partial().extend({tool:p.z.literal("text")}),lo.partial().extend({tool:p.z.literal("note")})]);var po=t("setTool",Ve.nullable()),mo=t("getTool",Ue.z.undefined()),co=l("onToolChange"),yo=t("setToolSettings",Oe),go=t("getToolSettings",ve),uo=l("onToolSettingsChange"),Re={methods:[po,mo,yo,go],listeners:[co,uo]};var m=require("zod"),Ne=m.z.object({showLegend:m.z.boolean().optional(),cooperativeGestures:m.z.boolean().optional(),fullScreenButton:m.z.boolean().optional(),geolocation:m.z.boolean().optional(),zoomControls:m.z.boolean().optional(),scaleBar:m.z.boolean().optional()}),je=m.z.object({featureSelectPanel:m.z.boolean().optional(),featureHoverPanel:m.z.boolean().optional(),elementSelectPanel:m.z.boolean().optional(),linkClickOpen:m.z.boolean().optional(),imageLightboxOpen:m.z.boolean().optional()});var ho=t("updateUiControls",Ne),fo=t("setOnMapInteractionsUi",je),qe={methods:[ho,fo],listeners:null};var se=require("zod");var w=require("zod");var N=w.z.object({center:O,zoom:ce}),Ze=w.z.object({center:N.shape.center.optional(),zoom:N.shape.zoom.optional()}),Be=w.z.object({minZoom:N.shape.zoom.nullish(),maxZoom:N.shape.zoom.nullish(),bounds:k.nullish()}).nullable(),He=w.z.object({bounds:k});var So=t("getViewport",se.z.undefined()),xo=t("setViewport",Ze),Mo=t("getViewportConstraints",se.z.undefined()),bo=t("setViewportConstraints",Be),Lo=t("fitViewportToBounds",He),Co=l("onViewportMove"),Io=l("onViewportMoveEnd"),Eo=l("onMapIdle"),Ae={methods:[xo,So,Mo,bo,Lo],listeners:[Co,Io,Eo]};var le=[qe,Ae,Ge,Se,Fe,xe,Re,Pe];function To(o,i,I){let T=new Map;async function b(u){if(!wo.safeParse(u.data).success){I?.onUnknownMessage?.(u.data);return}let pe=We.safeParse(u.data);if(!pe.success){I?.onInvalidMessage?.(u.data);return}let{data:d}=pe;if(d.type==="felt.ready")u.ports[0]?.postMessage(!0);else if(d.type==="felt.addListener"){if(d.event.eventName==="")throw new Error("felt.addListener eventName cannot be empty");let z="options"in d.event?{options:"options"in d.event?d.event.options:void 0,handler:q=>{u.ports[0]?.postMessage(q)}}:{handler:q=>{u.ports[0]?.postMessage(q)}},j=i.listeners[d.event.eventName](z);T.set(d.event.id,j)}else if(d.type==="felt.removeListener")T.get(d.id)?.(),T.delete(d.id);else try{let z=i.methods[d.type],j=await z(d.params);u.ports[0]?.postMessage(j)}catch(z){u.ports[0]?.postMessage({__error__:Go(z)})}}return o.addEventListener("message",b),()=>{o.removeEventListener("message",b)}}function Go(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 De={methods:le.map(o=>o.methods??[]).flat(),listeners:le.map(o=>o.listeners??[]).flat()},zo=c.z.discriminatedUnion("eventName",[c.z.strictObject({eventName:c.z.literal("")}),...De.listeners]),Po=c.z.strictObject({type:c.z.literal("felt.addListener"),event:zo}),ko=c.z.strictObject({type:c.z.literal("felt.removeListener"),id:c.z.string()}),Fo=c.z.strictObject({type:c.z.literal("felt.ready")}),We=c.z.discriminatedUnion("type",[Fo,Po,ko,...De.methods]),wo=c.z.object({type:c.z.enum(We.options.map(o=>o.shape.type.value))});0&&(module.exports={createMessageHandler});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@feltmaps/js-sdk",
3
- "version": "1.5.0-next.4",
3
+ "version": "1.5.0-next.5",
4
4
  "description": "An SDK for Felt maps",
5
5
  "keywords": [
6
6
  "felt",
@@ -1963,6 +1963,26 @@ interface MapInteractionEvent {
1963
1963
  rasterValues: Array<RasterValue>;
1964
1964
  }
1965
1965
 
1966
+ /**
1967
+ * The details of a map.
1968
+ *
1969
+ * @group Types
1970
+ */
1971
+ type MapDetails = {
1972
+ /**
1973
+ * The id of the map.
1974
+ */
1975
+ id: string;
1976
+ /**
1977
+ * The title of the map.
1978
+ */
1979
+ title: string;
1980
+ /**
1981
+ * The description of the map.
1982
+ */
1983
+ description: string | null;
1984
+ };
1985
+
1966
1986
  /**
1967
1987
  * A reference to any kind of entity in the map.
1968
1988
  *
@@ -2426,4 +2446,4 @@ declare const ViewportFitBoundsParamsSchema: z.ZodObject<{
2426
2446
  bounds: [number, number, number, number];
2427
2447
  }>;
2428
2448
 
2429
- export type { NoteElementUpdate as $, ViewportFitBoundsParams as A, ViewportCenterZoom as B, ConfigurableToolType as C, CircleElementCreate as D, Element as E, Filters as F, Geometry as G, CircleElementRead as H, InputToolSettings as I, CircleElementUpdate as J, HighlighterElementCreate as K, Layer as L, MapInteractionEvent as M, HighlighterElementRead as N, HighlighterElementUpdate as O, ImageElementCreate as P, ImageElementRead as Q, ImageElementUpdate as R, SetVisibilityRequest as S, ToolType as T, LinkElementRead as U, ViewportState as V, MarkerElementCreate as W, MarkerElementRead as X, MarkerElementUpdate as Y, NoteElementCreate as Z, NoteElementRead as _, GetElementsConstraint as a, PathElementCreate as a0, PathElementRead as a1, PathElementUpdate as a2, PlaceElementCreate as a3, PlaceElementRead as a4, PlaceElementUpdate as a5, PolygonElementCreate as a6, PolygonElementRead as a7, PolygonElementUpdate as a8, TextElementCreate as a9, PinToolSettings as aA, PlaceFrame as aB, PlaceSymbol as aC, PolygonToolSettings as aD, RouteToolSettings as aE, TextToolSettings as aF, UnionToIntersection as aG, PromiseOrNot as aH, TextElementRead as aa, TextElementUpdate as ab, LayerProcessingStatus as ac, RasterValue as ad, FilterExpression as ae, FilterLogicGate as af, FilterTernary as ag, ElementGroupNode as ah, ElementNode as ai, FeatureNode as aj, LayerGroupNode as ak, LayerNode as al, FeltBoundary as am, FeltZoom as an, LatLng as ao, LineStringGeometry as ap, LngLatTuple as aq, MultiLineStringGeometry as ar, MultiPolygonGeometry as as, PointGeometry as at, PolygonGeometry as au, CircleToolSettings as av, HighlighterToolSettings as aw, LineToolSettings as ax, MarkerToolSettings as ay, NoteToolSettings as az, ElementGroup as b, GetElementGroupsConstraint as c, ElementChangeCallbackParams as d, ElementGroupChangeCallbackParams as e, ElementCreate as f, ElementUpdate as g, GetLayersConstraint as h, LayerChangeCallbackParams as i, LayerGroup as j, GetLayerGroupsConstraint as k, LayerGroupChangeCallbackParams as l, LegendItemIdentifier as m, LegendItem as n, LegendItemsConstraint as o, LegendItemChangeCallbackParams as p, LayerFilters as q, GetRenderedFeaturesConstraint as r, Feature as s, EntityNode as t, FeatureSelection as u, ToolSettingsMap as v, ToolSettingsChangeEvent as w, SetViewportCenterZoomParams as x, ViewportConstraints as y, zInfer as z };
2449
+ export type { NoteElementRead as $, ViewportConstraints as A, ViewportFitBoundsParams as B, ConfigurableToolType as C, ViewportCenterZoom as D, Element as E, Filters as F, Geometry as G, CircleElementCreate as H, InputToolSettings as I, CircleElementRead as J, CircleElementUpdate as K, Layer as L, MapInteractionEvent as M, HighlighterElementCreate as N, HighlighterElementRead as O, HighlighterElementUpdate as P, ImageElementCreate as Q, ImageElementRead as R, SetVisibilityRequest as S, ToolType as T, ImageElementUpdate as U, ViewportState as V, LinkElementRead as W, MarkerElementCreate as X, MarkerElementRead as Y, MarkerElementUpdate as Z, NoteElementCreate as _, GetElementsConstraint as a, NoteElementUpdate as a0, PathElementCreate as a1, PathElementRead as a2, PathElementUpdate as a3, PlaceElementCreate as a4, PlaceElementRead as a5, PlaceElementUpdate as a6, PolygonElementCreate as a7, PolygonElementRead as a8, PolygonElementUpdate as a9, NoteToolSettings as aA, PinToolSettings as aB, PlaceFrame as aC, PlaceSymbol as aD, PolygonToolSettings as aE, RouteToolSettings as aF, TextToolSettings as aG, UnionToIntersection as aH, PromiseOrNot as aI, TextElementCreate as aa, TextElementRead as ab, TextElementUpdate as ac, LayerProcessingStatus as ad, RasterValue as ae, FilterExpression as af, FilterLogicGate as ag, FilterTernary as ah, ElementGroupNode as ai, ElementNode as aj, FeatureNode as ak, LayerGroupNode as al, LayerNode as am, FeltBoundary as an, FeltZoom as ao, LatLng as ap, LineStringGeometry as aq, LngLatTuple as ar, MultiLineStringGeometry as as, MultiPolygonGeometry as at, PointGeometry as au, PolygonGeometry as av, CircleToolSettings as aw, HighlighterToolSettings as ax, LineToolSettings as ay, MarkerToolSettings as az, ElementGroup as b, GetElementGroupsConstraint as c, ElementChangeCallbackParams as d, ElementGroupChangeCallbackParams as e, ElementCreate as f, ElementUpdate as g, GetLayersConstraint as h, LayerChangeCallbackParams as i, LayerGroup as j, GetLayerGroupsConstraint as k, LayerGroupChangeCallbackParams as l, LegendItemIdentifier as m, LegendItem as n, LegendItemsConstraint as o, LegendItemChangeCallbackParams as p, LayerFilters as q, GetRenderedFeaturesConstraint as r, Feature as s, MapDetails as t, EntityNode as u, FeatureSelection as v, ToolSettingsMap as w, ToolSettingsChangeEvent as x, SetViewportCenterZoomParams as y, zInfer as z };