@kispace-io/gs-lib 1.3.5 → 1.3.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -331,9 +331,15 @@ const createProxy = (operations) => {
331
331
  return new Proxy({}, {
332
332
  get: (_, prop) => {
333
333
  return async (...args) => {
334
- for (const operation of operations) {
335
- await operation[prop](...args);
336
- }
334
+ await Promise.all(
335
+ operations.map((operation) => {
336
+ const fn = operation[prop];
337
+ if (typeof fn === "function") {
338
+ return fn.apply(operation, args);
339
+ }
340
+ return void 0;
341
+ })
342
+ );
337
343
  };
338
344
  }
339
345
  });
@@ -1591,6 +1597,20 @@ class OpenLayersMapRenderer {
1591
1597
  this.olMap?.dispose();
1592
1598
  this.olMap = void 0;
1593
1599
  }
1600
+ async transform(coord, options) {
1601
+ if (!this.olMap) {
1602
+ throw new Error("Map not available for coordinate transformation");
1603
+ }
1604
+ const view = this.olMap.getView();
1605
+ const mapProj = view.getProjection()?.getCode() || "EPSG:3857";
1606
+ const source2 = options?.sourceProjection ?? mapProj;
1607
+ const target = options?.targetProjection ?? "EPSG:4326";
1608
+ if (source2 === target) {
1609
+ return coord;
1610
+ }
1611
+ const result = proj.transform(coord, source2, target);
1612
+ return result;
1613
+ }
1594
1614
  }
1595
1615
  class OpenLayersMapOperations {
1596
1616
  constructor(olMap, renderer) {
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../src/gs-model.ts","../src/scripted-runtime-registry.ts","../src/map-renderer.ts","../src/base-map-builder.ts","../src/ol/gs-ol-adapters.ts","../src/ol/gs-gs2ol.ts","../src/ol/gs-ol2gs.ts","../src/ol/gs-ol-lib.ts","../src/ol/openlayers-map-renderer.ts","../src/index.ts"],"sourcesContent":["import { v4 as uuidv4 } from '@eclipse-lyra/core/externals/third-party'\n\nexport const KEY_LABEL = \"label\";\nexport const KEY_NAME = \"name\";\nexport const KEY_URL = \"url\";\nexport const KEY_FORMAT = \"format\";\nexport const KEY_ICON_PATH = \"iconPath\";\nexport const KEY_STATE = \"_state\";\nexport const KEY_SRC = \"src\";\nexport const KEY_SOURCETYPE = \"sourceType\"\nexport const KEY_ENV = \"_env\"\nexport const KEY_GS_MANAGED = \"gsManaged\"\nexport const KEY_SETTINGS = \"settings\"\nexport const KEY_UUID = \"uuid\"\nexport const KEY_EVENT_SUBSCRIPTIONS = \"_eventSubscriptions\"\n\nexport const LAYER_GEOCODED_MARKERS = \"geocoded-markers\"\n\nexport interface GsBag {\n [key: string]: any\n}\n\nexport function ensureUuid<T extends GsState>(obj: T): T {\n if (!obj.uuid) {\n obj.uuid = uuidv4()\n }\n return obj\n}\n\nexport function ensureUuidsRecursive<T extends GsState>(obj: T): T {\n ensureUuid(obj)\n \n if ('geometry' in obj && (obj as any).geometry) {\n ensureUuid((obj as any).geometry)\n }\n \n if ('source' in obj && (obj as any).source) {\n const source = (obj as any).source\n ensureUuid(source)\n if (source.features && Array.isArray(source.features)) {\n source.features.forEach((feature: any) => ensureUuidsRecursive(feature))\n }\n }\n \n if ('layers' in obj && Array.isArray((obj as any).layers)) {\n (obj as any).layers.forEach((layer: any) => ensureUuidsRecursive(layer))\n }\n \n if ('overlays' in obj && Array.isArray((obj as any).overlays)) {\n (obj as any).overlays.forEach((overlay: any) => ensureUuid(overlay))\n }\n \n if ('controls' in obj && Array.isArray((obj as any).controls)) {\n (obj as any).controls.forEach((control: any) => ensureUuid(control))\n }\n \n if ('interactions' in obj && Array.isArray((obj as any).interactions)) {\n (obj as any).interactions.forEach((interaction: any) => ensureUuid(interaction))\n }\n \n if ('view' in obj && (obj as any).view) {\n ensureUuid((obj as any).view)\n }\n \n return obj\n}\n\nexport interface GsState {\n uuid?: string\n state?: GsBag\n}\n\nexport enum GsSourceType {\n OSM = \"OSM\", GeoJSON = \"GeoJSON\", Features = \"Features\", KML = \"KML\", GeoTIFF = \"GeoTIFF\", GPX = \"GPX\", BM = \"BM\", WMS = \"WMS\", WMTS = \"WMTS\", XYZ = \"XYZ\", Scripted = \"Scripted\"\n}\n\nexport enum GsLayerType {\n TILE = \"TILE\", VECTOR = \"VECTOR\", GROUP = \"GROUP\", SCRIPTED = \"SCRIPTED\"\n}\n\nexport enum GsGeometryType {\n Point = \"Point\",\n MultiPoint = \"MultiPoint\",\n Polygon = \"Polygon\",\n MultiPolygon = \"MultiPolygon\",\n LineString = \"LineString\",\n MultiLineString = \"MultiLineString\",\n Circle = \"Circle\",\n LinearRing = \"LinearRing\"\n}\n\nexport interface GsGeometry extends GsState {\n type: GsGeometryType,\n coordinates: number[]\n}\n\nexport interface GsResource {\n}\n\nexport interface GsIcon extends GsResource {\n src: string\n}\n\nexport interface GsFeature extends GsState {\n geometry: GsGeometry\n}\n\nexport interface GsSource extends GsState {\n type: GsSourceType\n url?: string\n features?: GsFeature[]\n}\n\nexport interface GsLayer extends GsState {\n name?: string\n type: GsLayerType,\n source: GsSource,\n visible?: boolean\n}\n\nexport interface GsScriptedVectorLayer extends GsLayer {\n type: GsLayerType.SCRIPTED\n lang?: string\n params?: Record<string, any>\n}\n\nexport interface GsScript extends GsState {\n src: string,\n}\n\nexport interface GsOverlay extends GsScript {\n position: \"bottom-left\" | \"bottom-center\" | \"bottom-right\" | \"center-left\" | \"center-center\" | \"center-right\" | \"top-left\" | \"top-center\" | \"top-right\",\n}\n\nexport interface GsControl extends GsScript {\n}\n\nexport interface GsInteraction extends GsState {\n\n}\n\nexport interface GsView extends GsState {\n center: number[],\n zoom: number,\n projection: string,\n /** Camera pitch in degrees (0 = looking straight down, 60 = tilted view) */\n pitch?: number,\n /** Camera bearing/rotation in degrees (0 = north up) */\n bearing?: number,\n /** Map rotation in radians (OpenLayers) - deprecated, use bearing instead */\n rotation?: number\n}\n\nexport interface GsStrokeStyle {\n color?: string\n width?: number\n lineDash?: number[]\n lineCap?: 'butt' | 'round' | 'square'\n lineJoin?: 'bevel' | 'round' | 'miter'\n miterLimit?: number\n}\n\nexport interface GsFillStyle {\n color?: string\n}\n\nexport interface GsImageStyle {\n type: 'circle' | 'icon' | 'regular-shape'\n \n radius?: number\n fill?: GsFillStyle\n stroke?: GsStrokeStyle\n \n src?: string\n scale?: number\n anchor?: [number, number]\n anchorXUnits?: 'fraction' | 'pixels'\n anchorYUnits?: 'fraction' | 'pixels'\n anchorOrigin?: 'bottom-left' | 'bottom-right' | 'top-left' | 'top-right'\n color?: string\n crossOrigin?: string\n offset?: [number, number]\n offsetOrigin?: 'bottom-left' | 'bottom-right' | 'top-left' | 'top-right'\n size?: [number, number]\n \n points?: number\n radius1?: number\n radius2?: number\n angle?: number\n \n opacity?: number\n rotation?: number\n rotateWithView?: boolean\n displacement?: [number, number]\n}\n\nexport interface GsTextStyle {\n text?: string\n font?: string\n maxAngle?: number\n offsetX?: number\n offsetY?: number\n overflow?: boolean\n placement?: 'point' | 'line'\n repeat?: number\n scale?: number\n rotateWithView?: boolean\n rotation?: number\n textAlign?: 'left' | 'center' | 'right' | 'end' | 'start'\n justify?: 'left' | 'center' | 'right'\n textBaseline?: 'bottom' | 'top' | 'middle' | 'alphabetic' | 'hanging' | 'ideographic'\n fill?: GsFillStyle\n stroke?: GsStrokeStyle\n backgroundFill?: GsFillStyle\n backgroundStroke?: GsStrokeStyle\n padding?: [number, number, number, number]\n}\n\nexport interface GsStyle {\n id?: string\n stroke?: GsStrokeStyle\n fill?: GsFillStyle\n image?: GsImageStyle\n text?: GsTextStyle\n zIndex?: number\n}\n\nexport interface GsStylesMap {\n [key: string]: GsStyle\n}\n\nexport const DEFAULT_STYLES: GsStylesMap = {\n 'default-point': {\n id: 'default-point',\n image: {\n type: 'circle',\n radius: 5,\n fill: { color: 'rgba(0, 100, 255, 0.8)' },\n stroke: { color: 'white', width: 2 }\n }\n },\n 'default-line': {\n id: 'default-line',\n stroke: {\n color: 'rgba(0, 100, 255, 0.8)',\n width: 2\n }\n },\n 'default-polygon': {\n id: 'default-polygon',\n fill: { color: 'rgba(0, 100, 255, 0.3)' },\n stroke: {\n color: 'rgba(0, 100, 255, 0.8)',\n width: 2\n }\n },\n 'selection': {\n id: 'selection',\n image: {\n type: 'circle',\n radius: 7,\n fill: { color: 'rgba(255, 255, 0, 0.3)' },\n stroke: { color: 'rgba(255, 255, 0, 1)', width: 3 }\n },\n stroke: {\n color: 'rgba(255, 255, 0, 1)',\n width: 3\n },\n fill: {\n color: 'rgba(255, 255, 0, 0.3)'\n }\n }\n}\n\nexport interface GsStyleRule {\n id?: string\n condition: {\n geometryType?: GsGeometryType | GsGeometryType[]\n layerName?: string\n property?: {\n key: string\n value?: any\n operator?: 'equals' | 'not-equals' | 'contains' | 'greater-than' | 'less-than' | 'exists'\n }\n }\n styleId: string\n priority?: number\n}\n\nexport function evaluateStyleRule(rule: GsStyleRule, feature: GsFeature, layerName?: string): boolean {\n const condition = rule.condition\n \n if (condition.geometryType) {\n const types = Array.isArray(condition.geometryType) ? condition.geometryType : [condition.geometryType]\n if (!types.includes(feature.geometry.type)) {\n return false\n }\n }\n \n if (condition.layerName && condition.layerName !== layerName) {\n return false\n }\n \n if (condition.property) {\n const prop = condition.property\n const featureValue = feature.state?.[prop.key]\n \n if (!prop.operator || prop.operator === 'exists') {\n return featureValue !== undefined\n }\n \n if (prop.operator === 'equals') {\n return featureValue === prop.value\n }\n \n if (prop.operator === 'not-equals') {\n return featureValue !== prop.value\n }\n \n if (prop.operator === 'contains' && typeof featureValue === 'string' && typeof prop.value === 'string') {\n return featureValue.includes(prop.value)\n }\n \n if (prop.operator === 'greater-than' && typeof featureValue === 'number' && typeof prop.value === 'number') {\n return featureValue > prop.value\n }\n \n if (prop.operator === 'less-than' && typeof featureValue === 'number' && typeof prop.value === 'number') {\n return featureValue < prop.value\n }\n }\n \n return true\n}\n\nexport function getStyleForFeature(feature: GsFeature, rules: GsStyleRule[], stylesMap: GsStylesMap, layerName?: string): GsStyle | undefined {\n const sortedRules = [...rules].sort((a, b) => (b.priority || 0) - (a.priority || 0))\n \n for (const rule of sortedRules) {\n if (evaluateStyleRule(rule, feature, layerName)) {\n return stylesMap[rule.styleId]\n }\n }\n \n return undefined\n}\n\nexport interface GsMap extends GsState {\n view: GsView,\n layers: GsLayer[],\n overlays: GsOverlay[],\n controls: GsControl[],\n interactions: GsInteraction[],\n styles: GsStylesMap,\n styleRules: GsStyleRule[],\n chatHistory: any[]\n}\n\nexport const DEFAULT_STYLE_RULES: GsStyleRule[] = [\n {\n id: 'default-points',\n condition: {\n geometryType: [GsGeometryType.Point, GsGeometryType.MultiPoint]\n },\n styleId: 'default-point',\n priority: 0\n },\n {\n id: 'default-lines',\n condition: {\n geometryType: [GsGeometryType.LineString, GsGeometryType.MultiLineString]\n },\n styleId: 'default-line',\n priority: 0\n },\n {\n id: 'default-polygons',\n condition: {\n geometryType: [GsGeometryType.Polygon, GsGeometryType.MultiPolygon, GsGeometryType.Circle]\n },\n styleId: 'default-polygon',\n priority: 0\n }\n]\n\nexport const DEFAULT_GSMAP = ensureUuid({\n view: ensureUuid({\n center: [0, 0],\n zoom: 0,\n projection: 'EPSG:3857'\n } as GsView),\n layers: [ensureUuid({\n type: GsLayerType.TILE,\n source: ensureUuid({\n type: GsSourceType.OSM\n } as GsSource),\n } as GsLayer)],\n overlays: [] as GsOverlay[],\n controls: [] as GsControl[],\n interactions: [] as GsInteraction[],\n state: {},\n styles: { ...DEFAULT_STYLES },\n styleRules: [...DEFAULT_STYLE_RULES]\n} as GsMap)\n\n","export interface ScriptedVars {\n params: Record<string, any>\n env: Record<string, string>\n viewState: { extent: number[], zoom: number, projection: string }\n signal?: AbortSignal\n}\n\nexport interface ScriptedRuntime {\n run(src: string, vars: ScriptedVars): Promise<unknown>\n}\n\nclass ScriptedRuntimeRegistryImpl {\n private runtimes = new Map<string, ScriptedRuntime>()\n\n register(lang: string, runtime: ScriptedRuntime): void {\n this.runtimes.set(lang, runtime)\n }\n\n get(lang: string): ScriptedRuntime | undefined {\n return this.runtimes.get(lang)\n }\n}\n\nexport const scriptedRuntimeRegistry = new ScriptedRuntimeRegistryImpl()\n\nconst jsRuntime: ScriptedRuntime = {\n async run(src: string, vars: ScriptedVars): Promise<unknown> {\n const mod = await import(/* @vite-ignore */ src)\n const fn = mod instanceof Function ? mod : mod.default\n if (typeof fn !== 'function') {\n throw new Error(`Scripted layer module at \"${src}\" must export a default function`)\n }\n return fn(vars)\n }\n}\n\nscriptedRuntimeRegistry.register('javascript', jsRuntime)\n","import { GsMap, GsLayer, GsControl, GsOverlay } from \"./gs-model\";\n\n/**\n * Sync event types that describe what changed in the map\n */\nexport type MapSyncEvent = \n | { type: 'viewChanged', view: { center: [number, number], zoom: number, rotation?: number, pitch?: number, bearing?: number } }\n | { type: 'featuresChanged', layerUuid: string, features: any[] }\n | { type: 'featureSelected', layerUuid: string, feature: any, metrics?: { length?: number, area?: number } }\n | { type: 'featureDeselected' }\n | { type: 'drawingDisabled' };\n\n/**\n * Screenshot result from captureScreenshot\n */\nexport type ScreenshotResult = \n | { success: true, dataUrl: string, width: number, height: number }\n | { success: false, error: string };\n\n/**\n * Abstract interface for map rendering\n * The host app only knows about this interface and the GsMap domain model\n * \n * This interface is focused purely on rendering and map state management.\n * For operations, use MapOperations interface instead.\n */\nexport interface MapRenderer {\n render(container: string | HTMLElement): Promise<void>;\n reattached?(): Promise<void>;\n modelToUI(updatedGsMap?: GsMap): Promise<void>;\n getViewExtent(): Promise<number[]>;\n getOperations(): MapOperations;\n setOnDirty(callback: () => void): void;\n triggerDirty(): void;\n setOnSync(callback: (event: MapSyncEvent) => void): void;\n triggerSync(event: MapSyncEvent): void;\n setOnClick?(callback: () => void): void;\n captureScreenshot(): Promise<ScreenshotResult>;\n destroy(): void;\n}\n\nexport function findLayerByUuid(gsMap: GsMap, uuid: string): GsLayer | undefined {\n return gsMap.layers.find(layer => layer.uuid === uuid);\n}\n\nexport function findLayerIndexByUuid(gsMap: GsMap, uuid: string): number {\n return gsMap.layers.findIndex(layer => layer.uuid === uuid);\n}\n\nexport function findControlByUuid(gsMap: GsMap, uuid: string): GsControl | undefined {\n return gsMap.controls.find(control => control.uuid === uuid);\n}\n\nexport function findControlIndexByUuid(gsMap: GsMap, uuid: string): number {\n return gsMap.controls.findIndex(control => control.uuid === uuid);\n}\n\nexport function findOverlayByUuid(gsMap: GsMap, uuid: string): GsOverlay | undefined {\n return gsMap.overlays.find(overlay => overlay.uuid === uuid);\n}\n\nexport function findOverlayIndexByUuid(gsMap: GsMap, uuid: string): number {\n return gsMap.overlays.findIndex(overlay => overlay.uuid === uuid);\n}\n\n/**\n * Map operations interface for high-level map commands\n * These operations work with the domain model and are framework-agnostic\n */\nexport interface MapOperations {\n // View operations\n setZoom(zoom: number): Promise<void>;\n setCenter(center: [number, number]): Promise<void>;\n \n // Display operations\n switchColorMode(mode?: 'dark' | 'light'): Promise<void>;\n \n // Layer operations\n addLayer(layer: any, isBasemap?: boolean): Promise<void>;\n deleteLayer(uuid: string): Promise<void>;\n renameLayer(uuid: string, newName: string): Promise<void>;\n moveLayer(uuid: string, targetUuid?: string): Promise<void>;\n setLayerVisible(uuid: string, visible: boolean): Promise<void>;\n \n // Control operations\n addControlFromModule(src: string): Promise<void>;\n removeControl(uuid: string): Promise<void>;\n \n // Overlay operations\n addOverlayFromModule(src: string, position?: string): Promise<void>;\n removeOverlay(uuid: string): Promise<void>;\n \n // Drawing operations (UI-only, no domain model changes until features are added)\n enableDrawing(geometryType: 'Point' | 'LineString' | 'Polygon', layerUuid: string): Promise<void>;\n disableDrawing(): Promise<void>;\n \n // Feature selection and deletion\n enableFeatureSelection(): Promise<void>;\n disableSelection(): Promise<void>;\n deleteSelectedFeatures(): Promise<void>;\n}\n\nexport const createProxy = (operations: MapOperations[]): MapOperations => {\n return new Proxy({}, {\n get: (_, prop: string) => {\n return async (...args: any[]) => {\n // Execute the operation on all registered operations\n for (const operation of operations) {\n await (operation as any)[prop](...args);\n }\n };\n }\n }) as MapOperations;\n}\n\n","import {GsMap, GsScript} from './gs-model'\n\n// esbuild types (without importing the implementation to avoid bundling Node.js version in browser)\ntype EsbuildPlugin = {\n name: string\n setup: (build: any) => void\n}\n\n// Type for esbuild instance (works with both esbuild and esbuild-wasm)\ntype EsbuildInstance = {\n build: (options: any) => Promise<{ \n outputFiles?: Array<{ path?: string; contents: Uint8Array }>;\n metafile?: {\n outputs?: Record<string, { entryPoint?: string; [key: string]: any }>;\n [key: string]: any;\n };\n }>\n}\n\nexport interface BuildOptions {\n title: string,\n gsMap: GsMap,\n env: any,\n version: string\n}\n\nexport interface FileSystem {\n readFile(path: string): Promise<string | Uint8Array>\n writeFile(path: string, content: string | Uint8Array): Promise<void>\n ensureDir(path: string): Promise<void>\n exists(path: string): Promise<boolean>\n deleteDir?(path: string): Promise<void>\n}\n\nexport interface ProgressCallback {\n (step: number, message: string, totalSteps?: number): void\n}\n\n\n/**\n * Generate the entry point JavaScript code for the map application\n */\nexport function generateAppJs(vars: {\n gsMap: GsMap,\n gsLibPath: string,\n env: any\n}): string {\n // Collect all script paths from controls and overlays\n const allScripts = [...(vars.gsMap.controls || []), ...(vars.gsMap.overlays || [])]\n const scriptPaths = allScripts\n .map((script: GsScript) => script.src)\n .filter((src: string) => src) // Filter out empty src\n \n // Generate static imports for all scripts so esbuild can bundle them\n // Static imports ensure esbuild bundles them, and they'll be available at runtime\n const scriptImports = scriptPaths.map((src: string, index: number) => {\n // Escape the src for use in template string\n const escapedSrc = src.replace(/`/g, '\\\\`').replace(/\\$/g, '\\\\$')\n return `import script${index} from '${escapedSrc}'`\n })\n \n // Create a modules map that maps src to the imported module\n // This allows gs-lib to properly parameterize user modules at runtime\n const modulesMap = scriptPaths.map((src: string, index: number) => {\n const escapedSrc = JSON.stringify(src)\n return `${escapedSrc}: script${index}`\n }).join(',\\n ')\n \n return `\nimport {gsLib} from \"${vars.gsLibPath}\"\nimport \"./gs-lib/gs-lib.css\"\n\n${scriptImports.join('\\n')}\n\nexport const renderMap = (mapContainerSelector) => {\n const modules = {\n ${modulesMap}\n }\n return gsLib({\n containerSelector: mapContainerSelector,\n gsMap: ${JSON.stringify(vars.gsMap)},\n mapOptions: {\n controls: {zoom: false, attribution: false}\n },\n env: ${JSON.stringify(vars.env || {})},\n modules: modules\n })\n}\n`\n}\n\n/**\n * Generate precache manifest for Workbox\n */\nexport function generatePrecacheManifest(assets: Array<{ url: string, revision?: string | null }>): string {\n return JSON.stringify(assets, null, 2)\n}\n\n/**\n * Process service worker content by injecting precache manifest\n */\nexport function processServiceWorker(\n content: string, \n precacheManifest?: Array<{ url: string, revision?: string | null }>\n): string {\n // Inject precache manifest if provided\n if (precacheManifest) {\n const manifestJson = generatePrecacheManifest(precacheManifest)\n // Replace the __WB_MANIFEST placeholder or inject before precacheAndRoute\n if (content.includes('self.__WB_MANIFEST')) {\n return content.replace(\n 'self.__WB_MANIFEST || []',\n `${manifestJson}`\n )\n } else {\n // Inject manifest before precacheAndRoute line\n return content.replace(\n /workbox\\.precaching\\.precacheAndRoute\\(/,\n `self.__WB_MANIFEST = ${manifestJson};\\nworkbox.precaching.precacheAndRoute(`\n )\n }\n }\n \n return content\n}\n\n/**\n * Process manifest content by updating title and version\n */\nexport function processManifest(content: string, title: string, version: string): string {\n const manifest = JSON.parse(content)\n manifest.name = title\n manifest.short_name = title\n manifest.description = title\n manifest.version = version\n return JSON.stringify(manifest, null, 2)\n}\n\n/**\n * Process HTML template by replacing title placeholder, app.js reference, and app.css reference\n */\nexport function processHtml(content: string, title: string, appJsFilename?: string, appCssFilename?: string): string {\n let processed = content.replace(/\\$TITLE/g, title)\n if (appJsFilename) {\n // Replace the app.js import with the hashed filename\n processed = processed.replace(/\\.\\/app\\.js/g, `./${appJsFilename}`)\n }\n if (appCssFilename) {\n // Replace the app.css reference with the hashed filename\n processed = processed.replace(/href=[\"']app\\.css[\"']/g, `href=\"${appCssFilename}\"`)\n }\n return processed\n}\n\n/**\n * Bundle the application code using esbuild with hashed filenames\n * @param esbuildInstance - The esbuild instance to use (esbuild-wasm for browser, esbuild for Node.js)\n * @returns Object with both JS and CSS filenames (CSS may be null if not generated)\n */\nexport async function bundleApp(\n entryPointPath: string,\n outputDir: string,\n gsLibPath: string,\n fileSys: FileSystem,\n resolvePlugin: EsbuildPlugin,\n esbuildInstance: EsbuildInstance,\n progress?: ProgressCallback,\n currentStep?: { value: number },\n totalSteps?: number\n): Promise<{ js: string; css: string | null }> {\n const updateProgress = (message: string) => {\n if (progress) {\n if (currentStep !== undefined) {\n progress(++currentStep.value, message, totalSteps)\n } else {\n progress(0, message, totalSteps)\n }\n }\n }\n \n updateProgress(\"Bundling and minifying code...\")\n \n const result = await esbuildInstance.build({\n entryPoints: [entryPointPath],\n bundle: true,\n outdir: outputDir,\n format: \"esm\",\n minify: true,\n plugins: [resolvePlugin],\n entryNames: '[name]-[hash]',\n // Runtime dependencies (lit, webawesome) are bundled with gs-lib\n external: [],\n // Bundle all dependencies\n packages: 'bundle',\n write: false, // Don't write to disk, we'll handle it\n metafile: true // Generate metafile to get output information\n })\n \n updateProgress(\"Saving bundled output...\")\n \n if (!result.outputFiles || result.outputFiles.length === 0) {\n throw new Error('No output files generated by esbuild')\n }\n \n // Write all output files and find the main entry file and CSS file\n let mainOutputFile: string | null = null\n let cssOutputFile: string | null = null\n \n // Try to use metafile to find the entry point output\n if (result.metafile && result.metafile.outputs) {\n // Find the output file that corresponds to our entry point\n const entryName = 'app' // Our entry point is app.js\n for (const [outputPath, output] of Object.entries(result.metafile.outputs)) {\n if (output && typeof output === 'object' && 'entryPoint' in output) {\n if (outputPath.includes(entryName) && outputPath.endsWith('.js')) {\n mainOutputFile = outputPath\n } else if (outputPath.endsWith('.css')) {\n cssOutputFile = outputPath\n }\n }\n }\n }\n \n // Extract filename from path (works in both browser and Node.js)\n const extractFilename = (filePath: string): string => {\n const lastSlash = Math.max(filePath.lastIndexOf('/'), filePath.lastIndexOf('\\\\'))\n return lastSlash >= 0 ? filePath.substring(lastSlash + 1) : filePath\n }\n \n // Write output files and find the main entry file and CSS (fallback if metafile didn't work)\n for (const file of result.outputFiles) {\n let filePath = file.path || ''\n \n // esbuild returns paths relative to outdir, but may be absolute\n // Extract just the filename if it's a full path, or use as-is if relative\n let relativePath: string\n let filename: string\n \n if (filePath.startsWith('/') || (filePath.length > 2 && filePath[1] === ':')) {\n // Absolute path - extract filename and build relative path\n filename = extractFilename(filePath)\n relativePath = `${outputDir}/${filename}`\n } else {\n // Relative path - ensure it's under outputDir\n filename = extractFilename(filePath)\n relativePath = filePath.startsWith(outputDir) ? filePath : `${outputDir}/${filePath}`\n }\n \n await fileSys.writeFile(relativePath, file.contents)\n \n // The entry file will be named app-[hash].js\n if (!mainOutputFile && filename.includes('app-') && filename.endsWith('.js')) {\n mainOutputFile = filename\n }\n // CSS file will be named app-[hash].css\n if (!cssOutputFile && filename.includes('app-') && filename.endsWith('.css')) {\n cssOutputFile = filename\n }\n }\n \n if (!mainOutputFile) {\n throw new Error('Could not find main output file')\n }\n \n return {\n js: extractFilename(mainOutputFile),\n css: cssOutputFile ? extractFilename(cssOutputFile) : null\n }\n}\n\n/**\n * Interface for copying files from gs-lib package\n * This abstracts the difference between browser (import promises) and Node.js (file system)\n */\nexport interface GsLibFileCopier {\n /**\n * Copy a text file from gs-lib\n * @param srcPath - Source path relative to gs-lib package (e.g., \"dist/index.js\", \"public/index.html\")\n * @param destPath - Destination path in the project\n * @param processor - Optional function to process content before saving\n */\n copyTextFile(srcPath: string, destPath: string, processor?: (content: string) => string | Promise<string>): Promise<void>\n \n /**\n * Copy a binary file from gs-lib\n * @param srcPath - Source path relative to gs-lib package\n * @param destPath - Destination path in the project\n */\n copyBinaryFile(srcPath: string, destPath: string): Promise<void>\n}\n\n/**\n * Create a standard GsLibFileCopier that uses FileSystem to read from gs-lib package\n */\nexport function createFileSystemGsLibCopier(\n fs: FileSystem,\n gsLibPackagePath: string\n): GsLibFileCopier {\n const copyFile = async (\n srcPath: string,\n destPath: string,\n asText: boolean,\n processor?: (content: string) => string | Promise<string>\n ): Promise<void> => {\n const fullSrcPath = `${gsLibPackagePath}/${srcPath}`\n let content: string | Uint8Array = await fs.readFile(fullSrcPath)\n \n if (asText) {\n // Convert to string if needed\n if (content instanceof Uint8Array) {\n content = new TextDecoder().decode(content)\n } else {\n content = content as string\n }\n \n if (processor) {\n content = await processor(content)\n }\n }\n \n await fs.writeFile(destPath, content)\n }\n \n return {\n async copyTextFile(srcPath: string, destPath: string, processor?: (content: string) => string | Promise<string>): Promise<void> {\n await copyFile(srcPath, destPath, true, processor)\n },\n async copyBinaryFile(srcPath: string, destPath: string): Promise<void> {\n await copyFile(srcPath, destPath, false)\n }\n }\n}\n\n/**\n * Recursively copy a directory\n */\nasync function copyDirectory(fs: FileSystem, src: string, dest: string): Promise<void> {\n // This is a simplified version - would need full directory traversal\n // For now, we'll handle specific known directories\n await fs.ensureDir(dest)\n}\n\n/**\n * Calculate total build steps based on configuration\n */\nexport function calculateTotalSteps(\n hasReadStep: boolean,\n hasAssets: boolean,\n cleanBeforeBuild: boolean,\n cleanAfterBuild: boolean\n): number {\n const baseSteps = 9 // buildMap base steps\n const bundleSteps = 2 // bundling steps\n const completedStep = 1 // build completed step\n const readStep = hasReadStep ? 1 : 0\n const assetsStep = hasAssets ? 1 : 0\n const cleanupBeforeStep = cleanBeforeBuild ? 1 : 0\n const cleanupAfterStep = cleanAfterBuild ? 1 : 0\n \n return readStep + cleanupBeforeStep + baseSteps + bundleSteps + completedStep + assetsStep + cleanupAfterStep\n}\n\n/**\n * Create a standard copyAssets function that works with FileSystem\n */\nexport function createCopyAssetsFunction(fs: FileSystem): (fs: FileSystem, outputDir: string, progress?: ProgressCallback) => Promise<void> {\n return async (fileSys: FileSystem, outputDir: string, progress?: ProgressCallback) => {\n if (await fileSys.exists('assets')) {\n await copyDirectory(fileSys, 'assets', `${outputDir}/assets`)\n }\n }\n}\n\n/**\n * Unified build function that works in both browser and Node.js\n * This is the single source of truth for the build process\n */\nexport async function buildMap(\n options: BuildOptions,\n fs: FileSystem,\n resolvePlugin: EsbuildPlugin,\n esbuildInstance: EsbuildInstance,\n config: {\n outputDir?: string,\n buildDir?: string,\n gsLibPath?: string,\n gsLibPackagePath?: string,\n gsLibCopier?: GsLibFileCopier,\n cleanBeforeBuild?: boolean,\n cleanAfterBuild?: boolean,\n copyAssets?: (fs: FileSystem, outputDir: string, progress?: ProgressCallback) => Promise<void>\n } = {},\n progress?: ProgressCallback\n): Promise<void> {\n const {\n outputDir = 'dist',\n buildDir = '__build',\n gsLibPath = `${buildDir}/gs-lib/index.js`,\n gsLibPackagePath,\n gsLibCopier: providedGsLibCopier,\n cleanBeforeBuild = true,\n cleanAfterBuild = true,\n copyAssets\n } = config\n \n // Create gsLibCopier if not provided, using FileSystem\n const gsLibCopier = providedGsLibCopier || (gsLibPackagePath ? createFileSystemGsLibCopier(fs, gsLibPackagePath) : null)\n if (!gsLibCopier) {\n throw new Error('Either gsLibCopier or gsLibPackagePath must be provided')\n }\n \n const buildGsLibPath = gsLibPath\n \n let step = (config as any).startingStep ?? 0\n const totalSteps = (config as any).totalSteps\n const updateProgress = (message: string) => {\n if (progress) progress(++step, message, totalSteps)\n }\n \n // Clean up build directories before starting\n if (cleanBeforeBuild) {\n updateProgress(\"Cleaning build directories...\")\n const cleanupPromises: Promise<void>[] = []\n if (fs.deleteDir) {\n cleanupPromises.push(\n fs.deleteDir(buildDir).catch(() => {}), // Ignore errors if directory doesn't exist\n fs.deleteDir(outputDir).catch(() => {})\n )\n } else {\n // Fallback: try to use Node.js fs if available\n try {\n const nodeFs = await import('fs/promises')\n const path = await import('path')\n const projectRoot = process.cwd()\n cleanupPromises.push(\n nodeFs.rm(path.resolve(projectRoot, buildDir), { recursive: true, force: true }).catch(() => {}),\n nodeFs.rm(path.resolve(projectRoot, outputDir), { recursive: true, force: true }).catch(() => {})\n )\n } catch {\n // If Node.js fs is not available, skip cleanup\n }\n }\n await Promise.all(cleanupPromises)\n }\n \n // Ensure directories exist\n updateProgress(\"Preparing build directories...\")\n await Promise.all([\n fs.ensureDir(`${outputDir}/assets/icons/`),\n fs.ensureDir(`${buildDir}/gs-lib/`)\n ])\n \n // Copy gs-lib package files\n updateProgress(\"Copying gs-lib package...\")\n await Promise.all([\n gsLibCopier.copyTextFile('dist/index.js', `${buildDir}/gs-lib/index.js`),\n gsLibCopier.copyTextFile('dist/gs-lib.css', `${buildDir}/gs-lib/gs-lib.css`)\n ])\n \n // Copy and process PWA files\n updateProgress(\"Copying PWA core files...\")\n await gsLibCopier.copyTextFile('public/pwa/staticwebapp.config.json', `${outputDir}/staticwebapp.config.json`)\n \n updateProgress(\"Creating manifest file...\")\n await gsLibCopier.copyTextFile('public/pwa/manifest.json', `${outputDir}/manifest.json`, (content) => processManifest(content, options.title, options.version))\n \n // Copy PWA icons\n updateProgress(\"Copying PWA icons...\")\n const iconFiles = [\n '24x24.png', '48x48.png', '192x192.png', '512x512.png',\n 'icon_24.png', 'icon_48.png', 'icon_192.png', 'icon_512.png'\n ]\n await Promise.all(iconFiles.map(icon =>\n gsLibCopier.copyBinaryFile(`public/pwa/assets/icons/${icon}`, `${outputDir}/assets/icons/${icon}`)\n ))\n \n // Copy workspace assets if provided\n if (copyAssets) {\n updateProgress(\"Copying workspace assets...\")\n await copyAssets(fs, outputDir, progress)\n }\n \n // Generate entry point\n updateProgress(\"Generating application code...\")\n const entryPointContent = generateAppJs({\n gsMap: options.gsMap,\n gsLibPath: buildGsLibPath,\n env: { ...options.env, BUILD_TIME: new Date() }\n })\n await fs.writeFile(`${buildDir}/app.js`, entryPointContent)\n \n // Bundle with hashed filenames\n const stepRef = { value: step }\n const bundleResult = await bundleApp(`${buildDir}/app.js`, outputDir, buildGsLibPath, fs, resolvePlugin, esbuildInstance, progress, stepRef, totalSteps)\n step = stepRef.value\n const appJsFilename = bundleResult.js\n const appCssFilename = bundleResult.css\n \n // Copy and process HTML with hashed app.js and app.css filenames\n updateProgress(\"Generating HTML file...\")\n await gsLibCopier.copyTextFile('public/index.html', `${outputDir}/index.html`, (content) => processHtml(content, options.title, appJsFilename, appCssFilename || undefined))\n \n // Generate precache manifest after all assets are created\n // Hashed filenames naturally handle cache invalidation, so we can use null revision\n // For non-hashed assets, we can also use null since Workbox will check file content\n // Note: index.html and manifest.json are NOT precached - they use NetworkFirst strategy\n // This ensures the browser gets the latest versions that reference the current hashed app.js\n const precacheManifest: Array<{ url: string, revision: string | null }> = [\n { url: `/${appJsFilename}`, revision: null }, // Hashed filename handles versioning\n ...(appCssFilename ? [{ url: `/${appCssFilename}`, revision: null }] : []), // Hashed CSS filename handles versioning\n ...iconFiles.map(icon => ({ url: `/assets/icons/${icon}`, revision: null })) // Workbox will check file content\n ]\n \n // Process and inject service worker with precache manifest\n updateProgress(\"Processing service worker...\")\n await gsLibCopier.copyTextFile('public/pwa/sw.js', `${outputDir}/sw.js`, (content) => \n processServiceWorker(content, precacheManifest)\n )\n \n // Cleanup\n if (cleanAfterBuild) {\n updateProgress(\"Cleaning up temporary files...\")\n if (fs.deleteDir) {\n await fs.deleteDir(buildDir)\n } else {\n // Fallback: try to use Node.js fs if available (for CLI usage)\n try {\n const nodeFs = await import('fs/promises')\n const path = await import('path')\n const fullPath = path.resolve(process.cwd(), buildDir)\n await nodeFs.rm(fullPath, { recursive: true, force: true })\n } catch (error) {\n // If Node.js fs is not available (browser context), skip cleanup\n // The browser FileSystem should implement deleteDir\n }\n }\n }\n \n updateProgress(\"Build completed!\")\n}\n\n","import {Map} from \"ol\";\nimport {GsOlControl, GsOlOverlay} from \"./gs-gs2ol\";\nimport {render as litRender} from \"@eclipse-lyra/core/externals/lit\";\n\nexport class GsOlAdapter<T extends GsOlControl | GsOlOverlay> {\n protected map: Map;\n protected olObject: T;\n\n private templateFunction?: Function;\n protected retargetSelector?: string;\n\n constructor(olObject: T) {\n this.map = olObject.getMap()!\n this.olObject = olObject\n }\n\n public getMap(): any {\n return this.map;\n }\n\n public getElement() {\n return this.olObject.getElement();\n }\n\n public render(strings?: TemplateStringsArray | Function) {\n if (strings === undefined && this.templateFunction) {\n strings = this.templateFunction()\n } else if (strings instanceof Function) {\n this.templateFunction = strings as Function\n strings = this.templateFunction()\n }\n if (strings) {\n litRender(strings, this.getElement())\n }\n }\n\n protected onRendered() {\n }\n\n public style(styleJson: any) {\n const style = this.getElement().style\n for (const property in styleJson) {\n const value = styleJson[property]\n style.setProperty(property, value);\n }\n }\n}\n\nexport class GsControlAdapter extends GsOlAdapter<GsOlControl> {\n public style(styleJson: any) {\n super.style(styleJson)\n\n if (\"--gs-contribution\" in styleJson) {\n this.retargetSelector = styleJson[\"--gs-contribution\"]\n }\n }\n\n public rendered() {\n if (this.retargetSelector) {\n const [parentPath, queryString] = this.retargetSelector.split(\"?\");\n const parent = this.map.getTargetElement().querySelector(parentPath) as HTMLElement\n if (parent) {\n const element = this.olObject.getElement()\n if (queryString) {\n const params = new URLSearchParams(queryString);\n const sibling = parent.querySelector(`[name='${params.get(\"before\")}']`) as HTMLElement\n if (sibling) {\n parent.insertBefore(element, sibling)\n }\n } else {\n parent.appendChild(element)\n }\n this.olObject.setTarget(element);\n this.render()\n }\n }\n }\n}\n\nexport class GsOverlayAdapter extends GsOlAdapter<GsOlOverlay> {\n public show(coords: number[]) {\n this.getElement().style.display = \"block\"\n this.olObject.setPosition(coords)\n }\n\n public hide() {\n this.getElement().style.display = \"none\"\n }\n}","import {\n DEFAULT_GSMAP,\n GsControl,\n GsFeature,\n GsFillStyle,\n GsGeometry,\n GsIcon,\n GsImageStyle,\n GsLayer,\n GsLayerType,\n GsMap,\n GsOverlay,\n GsScriptedVectorLayer,\n GsSource,\n GsSourceType,\n GsState,\n GsStrokeStyle,\n GsStyle,\n GsTextStyle,\n KEY_ENV,\n KEY_EVENT_SUBSCRIPTIONS,\n KEY_FORMAT,\n KEY_GS_MANAGED,\n KEY_LABEL,\n KEY_NAME,\n KEY_SOURCETYPE,\n KEY_SRC,\n KEY_STATE,\n KEY_UUID,\n KEY_URL\n} from \"../gs-model\";\nimport { scriptedRuntimeRegistry, type ScriptedVars } from \"../scripted-runtime-registry\";\nimport {Feature, Map, Overlay, View} from \"ol\";\nimport {MapOptions} from \"ol/Map\";\nimport BaseObject from \"ol/Object\";\nimport * as olGeom from \"ol/geom\";\nimport {Circle as CircleStyle, Fill, Icon, RegularShape, Stroke, Style, Text} from \"ol/style\";\nimport {GeoTIFF, OSM, Source, TileWMS, WMTS, XYZ} from \"ol/source\";\nimport {optionsFromCapabilities} from \"ol/source/WMTS\";\nimport FeatureFormat from \"ol/format/Feature\";\nimport WMTSCapabilities from \"ol/format/WMTSCapabilities\";\nimport VectorSource from \"ol/source/Vector\";\nimport {bbox} from \"ol/loadingstrategy\";\nimport {transformExtent} from \"ol/proj\";\nimport {GeoJSON, GPX} from \"ol/format\";\nimport TileLayer from \"ol/layer/Tile\";\nimport TileSource from \"ol/source/Tile\";\nimport VectorLayer from \"ol/layer/Vector\";\nimport BaseLayer from \"ol/layer/Base\";\nimport {apply as applyMapboxStyle} from \"ol-mapbox-style\";\nimport LayerGroup from \"ol/layer/Group\";\nimport {Control} from \"ol/control\";\nimport * as ol from \"./gs-olns\"\nimport {lit} from \"../gs-litns\";\nimport {v4 as uuidv4} from '@eclipse-lyra/core/externals/third-party'\nimport {subscribe, publish, unsubscribe} from '@eclipse-lyra/core/core/events'\nimport {GsControlAdapter, GsOverlayAdapter} from \"./gs-ol-adapters\";\nimport {rtUtils} from \"../index\";\nimport Layer from \"ol/layer/Layer\";\n\nconst withState = <T extends BaseObject>(state: GsState, olObject: T): T => {\n if (state.uuid) {\n olObject.set(KEY_UUID, state.uuid)\n }\n if (state.state) {\n // add as properties for easy access via get(...)\n for (let stateKey in state.state) {\n olObject.set(stateKey, state.state[stateKey])\n }\n // add states as object as it is not possible to differentiate own state keys from OL keys\n olObject.set(KEY_STATE, state.state)\n }\n return olObject\n}\n\nexport const toOLGeometry = (geometry: GsGeometry) => {\n return withState(geometry, new olGeom[geometry.type](geometry.coordinates));\n}\n\nexport const toOlResource = (resource: GsIcon) => {\n return new Icon({\n src: resource.src\n })\n}\n\nexport const toOlStroke = (gsStroke: GsStrokeStyle): Stroke => {\n return new Stroke({\n color: gsStroke.color,\n width: gsStroke.width,\n lineDash: gsStroke.lineDash,\n lineCap: gsStroke.lineCap,\n lineJoin: gsStroke.lineJoin,\n miterLimit: gsStroke.miterLimit\n })\n}\n\nexport const toOlFill = (gsFill: GsFillStyle): Fill => {\n return new Fill({\n color: gsFill.color\n })\n}\n\nexport const toOlCircleImage = (gsImage: GsImageStyle): CircleStyle => {\n return new CircleStyle({\n radius: gsImage.radius || 5,\n fill: gsImage.fill ? toOlFill(gsImage.fill) : undefined,\n stroke: gsImage.stroke ? toOlStroke(gsImage.stroke) : undefined,\n displacement: gsImage.displacement,\n scale: gsImage.scale,\n rotation: gsImage.rotation,\n rotateWithView: gsImage.rotateWithView,\n declutterMode: undefined\n })\n}\n\nexport const toOlIconImage = (gsImage: GsImageStyle): Icon => {\n if (!gsImage.src) {\n throw new Error('Icon image requires src property')\n }\n return new Icon({\n src: gsImage.src,\n anchor: gsImage.anchor || [0.5, 1],\n anchorXUnits: gsImage.anchorXUnits || 'fraction',\n anchorYUnits: gsImage.anchorYUnits || 'fraction',\n anchorOrigin: gsImage.anchorOrigin,\n scale: gsImage.scale || 1,\n opacity: gsImage.opacity,\n rotation: gsImage.rotation,\n rotateWithView: gsImage.rotateWithView,\n displacement: gsImage.displacement,\n offset: gsImage.offset,\n offsetOrigin: gsImage.offsetOrigin,\n size: gsImage.size,\n color: gsImage.color,\n crossOrigin: gsImage.crossOrigin,\n declutterMode: undefined\n })\n}\n\nexport const toOlRegularShapeImage = (gsImage: GsImageStyle): RegularShape => {\n return new RegularShape({\n points: gsImage.points || 3,\n radius: gsImage.radius || gsImage.radius1 || 5,\n radius2: gsImage.radius2,\n angle: gsImage.angle || 0,\n displacement: gsImage.displacement,\n fill: gsImage.fill ? toOlFill(gsImage.fill) : undefined,\n stroke: gsImage.stroke ? toOlStroke(gsImage.stroke) : undefined,\n rotation: gsImage.rotation,\n rotateWithView: gsImage.rotateWithView,\n scale: gsImage.scale,\n declutterMode: undefined\n })\n}\n\nexport const toOlImage = (gsImage: GsImageStyle): CircleStyle | Icon | RegularShape => {\n switch (gsImage.type) {\n case 'circle':\n return toOlCircleImage(gsImage)\n case 'icon':\n return toOlIconImage(gsImage)\n case 'regular-shape':\n return toOlRegularShapeImage(gsImage)\n default:\n throw new Error(`Unknown image type: ${gsImage.type}`)\n }\n}\n\nexport const toOlText = (gsText: GsTextStyle): Text => {\n return new Text({\n text: gsText.text,\n font: gsText.font,\n maxAngle: gsText.maxAngle,\n offsetX: gsText.offsetX,\n offsetY: gsText.offsetY,\n overflow: gsText.overflow,\n placement: gsText.placement,\n repeat: gsText.repeat,\n scale: gsText.scale,\n rotateWithView: gsText.rotateWithView,\n rotation: gsText.rotation,\n textAlign: gsText.textAlign,\n justify: gsText.justify,\n textBaseline: gsText.textBaseline,\n fill: gsText.fill ? toOlFill(gsText.fill) : undefined,\n stroke: gsText.stroke ? toOlStroke(gsText.stroke) : undefined,\n backgroundFill: gsText.backgroundFill ? toOlFill(gsText.backgroundFill) : undefined,\n backgroundStroke: gsText.backgroundStroke ? toOlStroke(gsText.backgroundStroke) : undefined,\n padding: gsText.padding,\n declutterMode: undefined\n })\n}\n\nexport const toOlStyle = (gsStyle: GsStyle): Style => {\n const styleOptions: any = {}\n \n if (gsStyle.stroke) {\n styleOptions.stroke = toOlStroke(gsStyle.stroke)\n }\n \n if (gsStyle.fill) {\n styleOptions.fill = toOlFill(gsStyle.fill)\n }\n \n if (gsStyle.image) {\n styleOptions.image = toOlImage(gsStyle.image)\n }\n \n if (gsStyle.text) {\n styleOptions.text = toOlText(gsStyle.text)\n }\n \n if (gsStyle.zIndex !== undefined) {\n styleOptions.zIndex = gsStyle.zIndex\n }\n \n return new Style(styleOptions)\n}\n\nexport const toOlFeature = (feature: GsFeature): Feature => {\n return withState(feature, new Feature({\n geometry: toOLGeometry(feature.geometry),\n }))\n}\n\nexport const OL_SOURCES: any = {}\nOL_SOURCES[GsSourceType.OSM] = (source: GsSource) => {\n const olSource = new OSM();\n olSource.set(KEY_LABEL, source.type)\n return olSource\n}\nOL_SOURCES[GsSourceType.XYZ] = (source: GsSource) => {\n const olSource = new XYZ({\n url: source.url!,\n crossOrigin: 'anonymous'\n });\n olSource.set(KEY_URL, source.url!)\n olSource.set(KEY_LABEL, `${source.type}@${source.url}`)\n return olSource\n}\nOL_SOURCES[GsSourceType.WMS] = (source: GsSource) => {\n const olSource = new TileWMS({\n url: source.url!,\n params: {\n 'LAYERS': '', // Will be overridden by source.state\n ...source.state || {}\n },\n crossOrigin: 'anonymous' // Required for COEP, same as OSM default\n })\n olSource.set(KEY_URL, source.url!)\n olSource.set(KEY_LABEL, `${source.type}@${source.url}`)\n return olSource\n}\nOL_SOURCES[GsSourceType.WMTS] = (source: GsSource, olLayer?: Layer) => {\n const state = source.state || {}\n const parser = new WMTSCapabilities()\n \n // Create a minimal placeholder source\n const olSource = new WMTS({\n url: source.url!,\n layer: state['LAYER'] || '',\n matrixSet: state['MATRIXSET'] || 'GLOBAL_WEBMERCATOR',\n style: state['STYLE'] || 'default',\n crossOrigin: 'anonymous'\n } as any)\n\n // Fetch and parse capabilities, then replace the source on the layer\n fetch(source.url!)\n .then(response => response.text())\n .then(text => {\n const result = parser.read(text)\n const options = optionsFromCapabilities(result, {\n layer: state['LAYER'] || '',\n matrixSet: state['MATRIXSET'] || 'GLOBAL_WEBMERCATOR',\n })\n \n if (options) {\n // Create a new WMTS source with proper options\n const newSource = new WMTS({\n ...options,\n crossOrigin: 'anonymous'\n })\n newSource.set(KEY_URL, source.url!)\n newSource.set(KEY_LABEL, `${source.type}@${source.url}`)\n \n // Replace the source on the layer\n if (olLayer && olLayer.setSource) {\n olLayer.setSource(newSource)\n }\n }\n })\n .catch(error => {\n console.error('Failed to fetch WMTS capabilities:', error)\n })\n\n olSource.set(KEY_URL, source.url!)\n olSource.set(KEY_LABEL, `${source.type}@${source.url}`)\n return olSource\n}\n\nconst formatSource = (source: GsSource, format: FeatureFormat): Source => {\n const olSource = new VectorSource({\n format: format,\n url: source.url!\n })\n\n olSource.set(KEY_FORMAT, source.type)\n olSource.set(KEY_URL, source.url!)\n olSource.set(KEY_LABEL, `${source.type}@${source.url}`)\n return olSource\n}\n\nOL_SOURCES[GsSourceType.GeoJSON] = (source: GsSource) => {\n return formatSource(source, new GeoJSON())\n}\nOL_SOURCES[GsSourceType.GPX] = (source: GsSource) => {\n return formatSource(source, new GPX())\n}\nOL_SOURCES[GsSourceType.GeoTIFF] = (source: GsSource) => {\n const olSource = new GeoTIFF({\n sources: [\n {\n url: source.url!\n }\n ]\n })\n\n olSource.set(KEY_URL, source.url!)\n olSource.set(KEY_LABEL, `${source.type}@${source.url}`)\n return olSource\n}\nOL_SOURCES[GsSourceType.Features] = (source: GsSource) => {\n const features = (source.features || [])\n .map(feature => toOlFeature(feature))!\n const olSource = new VectorSource({\n features: features\n })\n olSource.set(KEY_LABEL, source.type)\n return olSource\n}\n\nexport const toOlSource = (source: GsSource, olLayer?: TileLayer<TileSource>) => {\n return withState(source, OL_SOURCES[source.type](source, olLayer))\n}\n\nexport const resolveScriptLang = (src: string, lang?: string): string => {\n if (lang) return lang\n const ext = src.split('?')[0].split('.').pop()?.toLowerCase() ?? ''\n if (ext === 'py') return 'python'\n return 'javascript'\n}\n\nexport const OL_LAYERS: any = {}\nOL_LAYERS[GsLayerType.TILE] = (layer: GsLayer) => {\n const tileLayer = new TileLayer()\n const source = toOlSource(layer.source, tileLayer) as TileSource\n tileLayer.setSource(source)\n return tileLayer\n}\nOL_LAYERS[GsLayerType.VECTOR] = (layer: GsLayer) => {\n return new VectorLayer({\n source: toOlSource(layer.source) as VectorSource,\n });\n}\nOL_LAYERS[GsLayerType.GROUP] = (layer: GsLayer) => {\n const group = new LayerGroup();\n group.set(KEY_URL, layer.source.url)\n group.set(KEY_SOURCETYPE, layer.source.type)\n applyMapboxStyle(group, layer.source.url).then()\n return group\n}\nOL_LAYERS[GsLayerType.SCRIPTED] = (layer: GsScriptedVectorLayer, env: any) => {\n const src = layer.source.url!\n const lang = resolveScriptLang(src, layer.lang)\n const runtime = scriptedRuntimeRegistry.get(lang)\n if (!runtime) throw new Error(`No scripted runtime registered for lang \"${lang}\"`)\n\n let olVectorLayer: VectorLayer<VectorSource>\n const source = new VectorSource({\n loader: async (extent, resolution, projection, success, failure) => {\n const view = olVectorLayer?.getMapInternal()?.getView()\n const vars: ScriptedVars = {\n params: layer.params ?? {},\n env: env ?? {},\n viewState: {\n extent: transformExtent(extent, projection, 'EPSG:4326'),\n zoom: view?.getZoomForResolution(resolution) ?? 0,\n projection: 'EPSG:4326',\n },\n }\n try {\n const result = await runtime.run(src, vars)\n const format = new GeoJSON()\n source.clear()\n const allFeatures: any[] = []\n const readBatch = (data: any) => {\n const features = format.readFeatures(data, {\n dataProjection: 'EPSG:4326',\n featureProjection: projection,\n })\n source.addFeatures(features)\n allFeatures.push(...features)\n }\n if (result && typeof (result as any)[Symbol.asyncIterator] === 'function') {\n for await (const batch of result as AsyncIterable<any>) {\n readBatch(batch)\n }\n } else {\n readBatch(result)\n }\n success!(allFeatures)\n } catch (e) {\n console.error('Scripted layer error:', e)\n failure!()\n }\n },\n strategy: bbox,\n })\n\n olVectorLayer = new VectorLayer({ source })\n return olVectorLayer\n}\n\nexport const toOlLayer = (layer: GsLayer, env?: any) => {\n const olLayer: BaseLayer = withState(layer, OL_LAYERS[layer.type](layer, env))\n olLayer.set(KEY_LABEL, layer.type)\n olLayer.set(KEY_NAME, layer.name)\n olLayer.set(KEY_GS_MANAGED, true)\n olLayer.setVisible(layer.visible ?? true)\n return olLayer\n}\n\nexport class GsOlControl extends Control {\n constructor(options?: any) {\n const element = document.createElement('div');\n element.style.margin = \"0\"\n element.style.padding = \"0\"\n super({\n ...options,\n element: element,\n });\n }\n\n public getElement() {\n return this.element;\n }\n}\n\nexport class GsOlOverlay extends Overlay {\n constructor(options?: any) {\n const element = document.createElement('div');\n element.style.margin = \"0\"\n element.style.padding = \"0\"\n super({\n ...options\n });\n }\n\n public getElement() {\n return this.element;\n }\n}\n\nexport const toOlOverlay = (overlay: GsOverlay) => {\n const olOverlay = withState(overlay, new GsOlOverlay({\n positioning: overlay.position,\n stopEvent: true\n }))\n olOverlay.set(KEY_SRC, overlay.src)\n return olOverlay\n}\n\nexport const toOlControl = (control: GsControl) => {\n const olControl = withState(control, new GsOlControl())\n olControl.set(KEY_SRC, control.src)\n return olControl\n}\n\nconst importSrc = async (adapter: GsControlAdapter | GsOverlayAdapter, src: string, importer?: Importer) => {\n const olMap = adapter.getMap()!;\n return (importer || DefaultImporter)(src).then((mod) => {\n const init = () => {\n olMap.removeEventListener(\"rendercomplete\", init)\n const vars: any = {\n // backward compatibility\n ...lit,\n // forward compatibility\n lit: lit,\n style: adapter.style.bind(adapter),\n render: adapter.render.bind(adapter),\n map: olMap,\n element: adapter.getElement(),\n querySelector: adapter.getElement().querySelector.bind(adapter.getElement()),\n querySelectorAll: adapter.getElement().querySelector.bind(adapter.getElement()),\n ol: ol,\n env: olMap.get(KEY_ENV) || {},\n utils: {\n uuid: uuidv4\n },\n asset: (path: string) => {\n return rtUtils.resolveUrl(`assets/${path}`)\n },\n signal: (_name: string) => {\n },\n events: (topic: string, callback: Function | any) => {\n if (callback instanceof Function) {\n const token = subscribe(topic, callback);\n let subscriptions = olMap.get(KEY_EVENT_SUBSCRIPTIONS) as string[] | undefined;\n if (!subscriptions) {\n subscriptions = [];\n olMap.set(KEY_EVENT_SUBSCRIPTIONS, subscriptions);\n }\n subscriptions.push(token);\n return token;\n } else {\n return publish(topic, callback);\n }\n },\n settings: (key: string, callback?: Function | any) => {\n const mapUuid = olMap.get(KEY_UUID) as string | undefined;\n const storageKey = mapUuid ? `gs-settings-${mapUuid}` : 'gs-settings';\n \n const loadSettings = (): any => {\n try {\n const stored = localStorage.getItem(storageKey);\n return stored ? JSON.parse(stored) : {};\n } catch {\n return {};\n }\n };\n \n const saveSettings = (settings: any): void => {\n try {\n localStorage.setItem(storageKey, JSON.stringify(settings));\n } catch (error) {\n console.error('Failed to save settings to localStorage:', error);\n }\n };\n \n const settings = loadSettings();\n \n // if no callback, assume caller wants the key value\n if (callback === undefined) {\n return settings[key];\n }\n // if a function, register as event topic, call it with current value, and return value\n if (callback instanceof Function) {\n vars.events(key, callback);\n callback(settings[key]);\n return settings[key];\n }\n settings[key] = callback;\n saveSettings(settings);\n // publish as event to inform settings listeners\n return publish(key, callback);\n }\n }\n const objectType = adapter instanceof GsControlAdapter ? \"control\" : \"overlay\"\n vars[objectType] = adapter\n \n const templateFunction = mod instanceof Function ? mod : mod.default\n if (templateFunction) {\n vars.state = <T>(initialValue: T) => {\n const createReactiveProperty = (target: any, key: string, getValue: () => any, setValue: (v: any) => void) => {\n Object.defineProperty(target, key, {\n get() {\n return getValue();\n },\n set(newValue: any) {\n const oldValue = getValue();\n if (oldValue !== newValue) {\n setValue(newValue);\n adapter.render();\n }\n },\n enumerable: true,\n configurable: true\n });\n };\n \n if (typeof initialValue === 'object' && initialValue !== null && !Array.isArray(initialValue)) {\n const values: any = { ...initialValue };\n \n return new Proxy({} as any, {\n get(_target, prop: string) {\n return values[prop];\n },\n set(_target, prop: string, newValue: any) {\n if (values[prop] !== newValue) {\n values[prop] = newValue;\n adapter.render();\n }\n return true;\n },\n has(_target, prop: string) {\n return prop in values;\n },\n ownKeys(_target) {\n return Object.keys(values);\n },\n getOwnPropertyDescriptor(_target, prop: string) {\n if (prop in values) {\n return {\n enumerable: true,\n configurable: true,\n value: values[prop]\n };\n }\n return undefined;\n }\n });\n } else {\n const stateObj: any = {};\n let value = initialValue;\n createReactiveProperty(\n stateObj,\n 'value',\n () => value,\n (v) => { value = v; }\n );\n return stateObj;\n }\n };\n \n const component = templateFunction(vars)\n \n if (component instanceof Function) {\n adapter.render(component);\n } else {\n adapter.render(component)\n }\n }\n if (adapter instanceof GsControlAdapter) {\n adapter.rendered()\n }\n olMap.render()\n }\n olMap.on(\"rendercomplete\", init)\n })\n}\n\nexport const importOverlaySource = async (olOverlay: GsOlOverlay, src: string, importer?: Importer) => {\n const overlayAdapter = new GsOverlayAdapter(olOverlay)\n return importSrc(overlayAdapter, src, importer)\n}\n\nexport const importControlSource = async (olControl: GsOlControl, src: string, importer?: Importer) => {\n const controlAdapter = new GsControlAdapter(olControl)\n return importSrc(controlAdapter, src, importer)\n}\n\nexport type Importer = (src: string) => Promise<any>\nexport const DefaultImporter: Importer = (src: string) => import(src)\n\nexport const cleanupEventSubscriptions = (olMap: Map): void => {\n const subscriptions = olMap.get(KEY_EVENT_SUBSCRIPTIONS) as string[] | undefined;\n if (subscriptions) {\n subscriptions.forEach(token => unsubscribe(token));\n olMap.set(KEY_EVENT_SUBSCRIPTIONS, []);\n }\n}\n\nexport const toOlMap = async (gsMap: GsMap, options?: MapOptions, env?: any, importer?: Importer, target?: HTMLElement) => {\n const olMap = withState(gsMap, new Map(options));\n olMap.set(KEY_ENV, env)\n olMap.setView(new View({\n center: gsMap.view.center && gsMap.view.center.length == 2 ? gsMap.view.center : DEFAULT_GSMAP.view.center,\n zoom: gsMap.view.zoom || DEFAULT_GSMAP.view.zoom,\n projection: gsMap.view.projection || DEFAULT_GSMAP.view.projection\n }))\n for (const layer of gsMap.layers || []) {\n const olLayer = toOlLayer(layer, env)\n olMap.addLayer(olLayer)\n }\n\n // Attach map to DOM early so it renders immediately\n // This prevents blank screens when user modules request permissions (e.g., geolocation)\n if (target) {\n olMap.setTarget(target)\n }\n\n for (const overlay of gsMap.overlays || []) {\n const olOverlay = toOlOverlay(overlay)\n olMap.addOverlay(olOverlay)\n await importOverlaySource(olOverlay, overlay.src, importer)\n }\n\n for (const control of gsMap.controls || []) {\n const olControl = toOlControl(control)\n olMap.addControl(olControl)\n await importControlSource(olControl, control.src, importer)\n }\n\n return olMap\n}","import {Feature} from \"ol\";\nimport * as olGeom from \"ol/geom\";\nimport {\n GsFeature,\n GsGeometry,\n GsLayerType,\n GsSourceType,\n GsState,\n KEY_STATE,\n KEY_UUID\n} from \"../gs-model\";\nimport BaseObject from \"ol/Object\";\n\nexport const toGsLayerType = (tag: string) => {\n switch (tag?.toLowerCase()) {\n case \"osm\":\n case \"bing\":\n case \"google\":\n case \"geotiff\":\n case \"wms\":\n case \"wmts\":\n case \"xyz\":\n return GsLayerType.TILE\n case \"bm\":\n case \"basemap.de\":\n return GsLayerType.GROUP\n case \"scripted\":\n return GsLayerType.SCRIPTED\n default:\n return GsLayerType.VECTOR\n }\n}\n\nexport const toGsSourceType = (tag: string) => {\n if (tag) {\n tag = tag.toLowerCase()\n const sourceTypes = Object.values(GsSourceType)\n const hit = sourceTypes.find(t => tag === t.toLowerCase())\n if (hit) {\n return hit\n }\n }\n throw new Error(\"Unsupported source type: \" + tag)\n}\n\nexport const toSourceUrl = (sourceType: GsSourceType) => {\n switch (sourceType) {\n case GsSourceType.BM:\n return \"https://sgx.geodatenzentrum.de/gdz_basemapworld_vektor/styles/bm_web_wld_col.json\"\n }\n return undefined\n}\n\nconst withGsState = <T extends GsState>(olObj: BaseObject, gsState: T): T => {\n // Get state first (contains original domain model data including UUID)\n const state = olObj.get(KEY_STATE)\n gsState.state = state\n \n // Preserve UUID if it exists (from domain model or previously assigned)\n // Priority: 1) UUID from state (original from domain model), 2) KEY_UUID (synced during conversion)\n // Do NOT generate UUIDs here - external features or unmanaged features should remain without UUIDs\n if (state?.uuid) {\n gsState.uuid = state.uuid\n } else {\n const uuid = olObj.get(KEY_UUID)\n if (uuid) {\n gsState.uuid = uuid\n }\n // If no UUID exists, leave it undefined (feature is external/unmanaged)\n }\n \n return gsState\n}\n\nexport function toGsGeometry(geometry: olGeom.SimpleGeometry): GsGeometry {\n return withGsState(geometry, {\n type: geometry.getType(),\n coordinates: geometry.getCoordinates()\n } as GsGeometry)\n}\n\nexport function toGsFeature(feature: Feature) {\n return withGsState(feature, {\n geometry: toGsGeometry(feature.getGeometry() as olGeom.SimpleGeometry)\n } as GsFeature)\n}\n\n\n","import {toOlMap, Importer} from \"./gs-gs2ol\";\nimport {GsMap} from \"../gs-model\";\nimport \"ol/ol.css\";\nimport {defaultControls, defaultInteractions} from \"./gs-olns\";\n// Note: WebAwesome is imported via gs-litns (which is imported by gs-gs2ol), so it's available to user modules\n\nexport * from \"../gs-model\";\nexport * from \"./gs-gs2ol\";\n\nexport interface GsAppOptions {\n containerSelector: string | HTMLElement,\n gsMap: GsMap,\n env?: any,\n modules?: any,\n importer?: Importer,\n mapOptions?: {\n controls: any\n }\n}\n\nexport const olLib = async (options: GsAppOptions) => {\n const mapOptions = {\n interactions: defaultInteractions({keyboard: false}),\n controls: defaultControls(options.mapOptions?.controls)\n }\n \n let importer: Importer | undefined = options.importer;\n \n if (!importer && options.modules) {\n importer = async (src: string) => {\n const module = options.modules[src];\n if (module) {\n // If module is a string, it's a URL/identifier - import it\n if (typeof module === 'string') {\n return import(module);\n }\n // If module is already an object, it's the imported module - return it directly\n return module;\n }\n throw new Error(`Module not found: ${src}`);\n };\n }\n \n // Handle both string selector and DOM element\n const target = typeof options.containerSelector === 'string' \n ? document.querySelector(options.containerSelector)! as HTMLElement\n : options.containerSelector;\n \n // Create map and attach to DOM first to ensure immediate rendering\n // Controls and overlays are loaded after the map is visible\n const olMap = await toOlMap(options.gsMap, mapOptions, options.env, importer, target)\n \n return olMap\n}\n\n","import { MapOperations, MapRenderer, MapSyncEvent, ScreenshotResult } from \"../map-renderer\";\nimport {\n GsMap,\n GsSourceType,\n KEY_NAME,\n KEY_STATE,\n KEY_UUID,\n GsFeature,\n GsGeometry,\n ensureUuid,\n getStyleForFeature\n} from \"../gs-model\";\nimport { toOlLayer, cleanupEventSubscriptions, toOlStyle } from \"./gs-gs2ol\";\nimport { toGsFeature } from \"./gs-ol2gs\";\nimport { olLib } from \"./gs-ol-lib\";\nimport { v4 as uuidv4 } from 'uuid';\nimport {\n Map as OlMap,\n Feature,\n style,\n sphere,\n geom,\n layer as layerNS,\n source as sourceNS,\n interaction as interactionNS,\n FeatureLike,\n eventsCondition,\n BaseLayer\n} from \"./gs-olns\";\n\n/**\n * Lightweight helper to extract minimal GsFeature data for style evaluation\n * Avoids the overhead of full toGsFeature() conversion\n */\nfunction getFeatureStyleData(feature: Feature): GsFeature {\n const geometry = feature.getGeometry() as geom.Geometry;\n return ensureUuid({\n geometry: ensureUuid({\n type: geometry.getType(),\n coordinates: [] // Not needed for style rules\n } as GsGeometry),\n state: feature.get(KEY_STATE)\n } as GsFeature);\n}\n\n/**\n * OpenLayers map renderer that manages OpenLayers maps\n * Provides complete isolation between the host app and the rendering engine\n * User modules are handled by the toOlMap() function\n */\nexport class OpenLayersMapRenderer implements MapRenderer {\n public olMap?: OlMap; // Made public for backward compatibility\n gsMap: GsMap;\n private env?: any;\n private onDirtyCallback?: () => void;\n private onSyncCallback?: (event: MapSyncEvent) => void;\n private isDestroyed: boolean = false;\n private operations?: OpenLayersMapOperations;\n private styleCache: Map<string, style.Style> = new Map();\n\n constructor(gsMap: GsMap, env?: any) {\n this.gsMap = gsMap;\n this.env = env;\n }\n\n async reattached(): Promise<void> {\n // OpenLayers doesn't need special handling for reattachment\n // The map stays attached to its container element\n }\n\n async render(container: string | HTMLElement): Promise<void> {\n try {\n // Use the runtime library to render the map\n this.olMap = await olLib({\n containerSelector: container,\n gsMap: this.gsMap,\n env: this.env,\n mapOptions: {\n controls: { zoom: false, attribution: false }\n }\n });\n \n // Create operations after map is available\n this.operations = new OpenLayersMapOperations(this.olMap, this);\n \n // Apply styling to all vector layers\n this.applyStylesToLayers();\n \n // Set up event listeners after the map is rendered\n this.olMap.once('rendercomplete', () => {\n this.setupEventListeners();\n });\n \n } catch (error) {\n console.error('Failed to render map:', error);\n throw error;\n }\n }\n \n private applyStylesToLayers(): void {\n if (!this.olMap) return;\n \n const layers = this.olMap.getLayers().getArray();\n layers.forEach(layer => {\n if (layer instanceof layerNS.Vector) {\n this.applyStyleToVectorLayer(layer);\n }\n });\n }\n \n private applyStyleToVectorLayer(layer: layerNS.Vector): void {\n const layerName = layer.get(KEY_NAME);\n \n // Create a style function that applies rules to each feature\n const styleFunction = (feature: FeatureLike) => {\n // Only process actual Feature objects (not RenderFeature)\n if (!(feature instanceof Feature)) {\n return undefined;\n }\n \n // Extract minimal data needed for style evaluation (lightweight, no coordinate conversion)\n const featureStyleData = getFeatureStyleData(feature);\n const styleRules = this.gsMap.styleRules;\n const stylesMap = this.gsMap.styles;\n \n if (styleRules && stylesMap) {\n const gsStyle = getStyleForFeature(featureStyleData, styleRules, stylesMap, layerName);\n if (gsStyle && gsStyle.id) {\n // Check cache first\n let olStyle = this.styleCache.get(gsStyle.id);\n if (!olStyle) {\n // Convert and cache\n olStyle = toOlStyle(gsStyle);\n this.styleCache.set(gsStyle.id, olStyle);\n }\n return olStyle;\n } else if (gsStyle) {\n // Style without ID - can't cache, convert directly\n return toOlStyle(gsStyle);\n }\n }\n \n // Return undefined to use default OpenLayers styling\n return undefined;\n };\n \n layer.setStyle(styleFunction);\n }\n \n private clearStyleCache(): void {\n this.styleCache.clear();\n }\n \n async modelToUI(updatedGsMap?: GsMap): Promise<void> {\n if (!this.olMap) {\n throw new Error('Map not initialized');\n }\n \n // Update the gsMap if provided\n if (updatedGsMap) {\n this.gsMap = updatedGsMap;\n }\n \n // Clear style cache when model changes (styles/rules may have changed)\n this.clearStyleCache();\n \n // Get the container before destroying the map\n const target = this.olMap.getTarget();\n if (!target || typeof target === 'string') {\n throw new Error('Map container not found or invalid');\n }\n\n this.destroy();\n\n // Clear the DOM container\n target.innerHTML = '';\n\n this.isDestroyed = false;\n await this.render(target);\n }\n \n\n getOperations(): MapOperations {\n if (!this.operations) {\n throw new Error(\"Operations not available - map not rendered yet\");\n }\n return this.operations;\n }\n\n async getViewExtent(): Promise<number[]> {\n console.debug(\"Getting view extent\");\n if (!this.olMap) {\n throw new Error(\"Map not available for extent calculation\");\n }\n\n const view = this.olMap.getView();\n const extent = view.calculateExtent();\n console.debug(`View extent: ${extent}`);\n return extent;\n }\n\n async captureScreenshot(): Promise<ScreenshotResult> {\n if (!this.olMap) {\n return { success: false, error: 'Map not available' };\n }\n\n const olMap = this.olMap;\n\n // Wait for the map to finish rendering\n await new Promise<void>((resolve) => {\n olMap.renderSync();\n olMap.once('rendercomplete', () => resolve());\n // Fallback timeout in case rendercomplete doesn't fire\n setTimeout(() => resolve(), 2000);\n });\n\n const size = olMap.getSize();\n const width = size ? size[0] : olMap.getViewport().clientWidth;\n const height = size ? size[1] : olMap.getViewport().clientHeight;\n\n try {\n const canvas = olMap.getViewport().querySelector('canvas');\n if (!canvas) {\n return { success: false, error: 'Map canvas not found' };\n }\n\n const dataUrl = canvas.toDataURL('image/png');\n return { success: true, dataUrl, width, height };\n } catch (error: any) {\n return { success: false, error: `Failed to capture canvas: ${error.message}` };\n }\n }\n\n setOnDirty(callback: () => void): void {\n this.onDirtyCallback = callback;\n }\n\n setOnSync(callback: (event: MapSyncEvent) => void): void {\n this.onSyncCallback = callback;\n }\n\n triggerDirty(): void {\n if (this.isDestroyed || !this.onDirtyCallback) return;\n this.onDirtyCallback();\n }\n\n triggerSync(event: MapSyncEvent): void {\n if (this.isDestroyed || !this.onSyncCallback) return;\n this.onSyncCallback(event);\n }\n\n private syncViewToModel(): void {\n if (!this.olMap) return;\n\n const view = this.olMap.getView();\n const center = view.getCenter();\n const zoom = view.getZoom();\n const rotation = view.getRotation();\n\n // Notify host with specific view change event\n if (center && zoom !== undefined) {\n this.triggerSync({\n type: 'viewChanged',\n view: { center: center as [number, number], zoom, rotation }\n });\n }\n }\n\n public syncLayerFeaturesToModel(layerUuid: string): void {\n if (!this.olMap) return;\n\n const layers = this.olMap.getLayers();\n let olLayer: BaseLayer | undefined;\n for (let i = 0; i < layers.getLength(); i++) {\n const layer = layers.item(i);\n if (layer.get(KEY_UUID) === layerUuid) {\n olLayer = layer;\n break;\n }\n }\n \n if (!olLayer || !(olLayer instanceof layerNS.Vector)) return;\n\n const source = olLayer.getSource();\n if (!source) return;\n\n // Convert OpenLayers features back to GsFeatures\n const olFeatures = source.getFeatures();\n const gsFeatures = olFeatures.map((olFeature: Feature) => toGsFeature(olFeature));\n\n // Notify host with features change event\n this.triggerSync({\n type: 'featuresChanged',\n layerUuid,\n features: gsFeatures\n });\n }\n\n private setupEventListeners(): void {\n if (!this.olMap) return;\n\n // Sync view changes back to domain model before triggering dirty\n this.olMap.getView().on('change:center', () => {\n this.syncViewToModel();\n this.triggerDirty();\n });\n this.olMap.getView().on('change:resolution', () => {\n this.syncViewToModel();\n this.triggerDirty();\n });\n this.olMap.getView().on('change:rotation', () => {\n this.syncViewToModel();\n this.triggerDirty();\n });\n\n this.olMap.getLayers().on('add', () => this.triggerDirty());\n this.olMap.getLayers().on('remove', () => this.triggerDirty());\n\n this.olMap.getControls().on('add', () => this.triggerDirty());\n this.olMap.getControls().on('remove', () => this.triggerDirty());\n\n this.olMap.getOverlays().on('add', () => this.triggerDirty());\n this.olMap.getOverlays().on('remove', () => this.triggerDirty());\n }\n\n \n destroy(): void {\n this.isDestroyed = true;\n this.clearStyleCache();\n // Cleanup operations (removes keyboard listeners) before destroying map\n if (this.operations) {\n const ops = this.operations as any;\n if (ops.cleanup) {\n ops.cleanup();\n }\n }\n // Cleanup event subscriptions before disposing map\n if (this.olMap) {\n cleanupEventSubscriptions(this.olMap);\n }\n this.olMap?.dispose();\n this.olMap = undefined;\n }\n\n}\n\n/**\n * OpenLayers-specific map operations implementation\n */\nexport class OpenLayersMapOperations implements MapOperations {\n private drawInteraction?: interactionNS.Draw;\n private selectInteraction?: interactionNS.Select;\n private activeDrawingLayerUuid?: string;\n private keyDownListener?: (event: KeyboardEvent) => void;\n\n constructor(\n private olMap: OlMap,\n private renderer?: OpenLayersMapRenderer\n ) {\n if (!olMap) {\n throw new Error(\"OpenLayers map is required for operations\");\n }\n \n // Setup ESC key handler\n this.keyDownListener = (event: KeyboardEvent) => {\n if (event.key === 'Escape') {\n if (this.drawInteraction) {\n this.disableDrawing();\n this.renderer?.triggerSync({ type: 'drawingDisabled' } as any);\n }\n if (this.selectInteraction) {\n this.disableSelection();\n }\n }\n };\n \n const target = this.olMap.getTargetElement();\n if (target && target instanceof HTMLElement) {\n target.setAttribute('tabindex', '-1');\n target.addEventListener('keydown', this.keyDownListener);\n }\n }\n\n async setZoom(zoom: number): Promise<void> {\n this.olMap.getView().setZoom(zoom);\n }\n\n async setCenter(center: [number, number]): Promise<void> {\n this.olMap.getView().setCenter(center);\n }\n\n async switchColorMode(mode?: 'dark' | 'light'): Promise<void> {\n const olMap = this.olMap;\n let darkMode: boolean = olMap.get(\"darkmode\") ?? false;\n\n if (mode === 'dark') {\n darkMode = true;\n } else if (mode === 'light') {\n darkMode = false;\n } else {\n darkMode = !darkMode;\n }\n\n olMap.set(\"darkmode\", darkMode);\n\n const canvasElements = document.querySelectorAll('canvas');\n canvasElements.forEach(canvas => {\n canvas.style.filter = darkMode ? \"invert(100%)\" : \"\";\n });\n\n olMap.render();\n }\n\n async addLayer(layer: any, isBasemap?: boolean): Promise<void> {\n const olLayer = toOlLayer(layer);\n if (isBasemap) {\n this.olMap.getLayers().insertAt(0, olLayer);\n } else {\n this.olMap.getLayers().push(olLayer);\n }\n }\n\n async deleteLayer(uuid: string): Promise<void> {\n const layers = this.olMap.getLayers();\n for (let i = 0; i < layers.getLength(); i++) {\n const layer = layers.item(i);\n if (layer.get(KEY_UUID) === uuid) {\n layers.removeAt(i);\n return;\n }\n }\n }\n\n async renameLayer(uuid: string, newName: string): Promise<void> {\n const layers = this.olMap.getLayers();\n for (let i = 0; i < layers.getLength(); i++) {\n const layer = layers.item(i);\n if (layer.get(KEY_UUID) === uuid) {\n layer.set(KEY_NAME, newName);\n return;\n }\n }\n }\n\n async moveLayer(uuid: string, targetUuid?: string): Promise<void> {\n const layers = this.olMap.getLayers();\n let fromIndex = -1;\n let toIndex = -1;\n \n for (let i = 0; i < layers.getLength(); i++) {\n const layer = layers.item(i);\n if (layer.get(KEY_UUID) === uuid) {\n fromIndex = i;\n }\n if (targetUuid && layer.get(KEY_UUID) === targetUuid) {\n toIndex = i;\n }\n }\n \n if (fromIndex < 0) return;\n \n if (targetUuid) {\n if (toIndex < 0 || fromIndex === toIndex) return;\n } else {\n toIndex = fromIndex > 0 ? fromIndex - 1 : fromIndex + 1;\n }\n\n if (toIndex >= 0 && toIndex < layers.getLength() && fromIndex !== toIndex) {\n const layer = layers.item(fromIndex);\n layers.removeAt(fromIndex);\n layers.insertAt(toIndex, layer);\n }\n }\n\n async setLayerVisible(uuid: string, visible: boolean): Promise<void> {\n const layers = this.olMap.getLayers();\n for (let i = 0; i < layers.getLength(); i++) {\n const layer = layers.item(i);\n if (layer.get(KEY_UUID) === uuid) {\n layer.setVisible(visible);\n return;\n }\n }\n }\n\n async addControlFromModule(_src: string): Promise<void> {}\n async removeControl(_uuid: string): Promise<void> {}\n async addOverlayFromModule(_src: string, _position?: string): Promise<void> {}\n async removeOverlay(_uuid: string): Promise<void> {}\n\n private setCursor(cursor: string): void {\n const viewport = this.olMap.getViewport();\n if (viewport) {\n (viewport as HTMLElement).style.cursor = cursor;\n }\n }\n\n async enableDrawing(geometryType: 'Point' | 'LineString' | 'Polygon', layerUuid: string): Promise<void> {\n this.disableSelection();\n \n if (this.drawInteraction) {\n this.olMap.removeInteraction(this.drawInteraction);\n }\n \n this.activeDrawingLayerUuid = layerUuid;\n this.setCursor('crosshair');\n \n const layers = this.olMap.getLayers();\n let layer: BaseLayer | undefined;\n for (let i = 0; i < layers.getLength(); i++) {\n const l = layers.item(i);\n if (l.get(KEY_UUID) === layerUuid) {\n layer = l;\n break;\n }\n }\n \n if (!layer || !(layer instanceof layerNS.Vector)) {\n throw new Error('Drawing only supported on vector layers');\n }\n \n const source = layer.getSource();\n if (!source) {\n throw new Error('Layer has no source');\n }\n \n const layerSourceType = layer.get('sourceType');\n if (layerSourceType && layerSourceType !== GsSourceType.Features) {\n throw new Error('Drawing only supported on layers with in-memory features');\n }\n \n this.drawInteraction = new interactionNS.Draw({\n source: source,\n type: geometryType\n });\n \n const onFeatureAdded = (event: any) => {\n const feature = event.feature;\n if (feature && !feature.get(KEY_UUID)) {\n const uuid = uuidv4();\n feature.set(KEY_UUID, uuid);\n const state = feature.get(KEY_STATE) || {};\n state.uuid = uuid;\n feature.set(KEY_STATE, state);\n }\n \n if (this.renderer && this.activeDrawingLayerUuid) {\n this.renderer.syncLayerFeaturesToModel(this.activeDrawingLayerUuid);\n }\n this.renderer?.triggerDirty();\n };\n \n source.on('addfeature', onFeatureAdded);\n \n (this.drawInteraction as any)._featureAddedListener = onFeatureAdded;\n (this.drawInteraction as any)._sourceRef = source;\n \n this.olMap.addInteraction(this.drawInteraction);\n }\n\n async disableDrawing(): Promise<void> {\n if (this.drawInteraction) {\n const listener = (this.drawInteraction as any)._featureAddedListener;\n const source = (this.drawInteraction as any)._sourceRef;\n if (listener && source) {\n source.un('addfeature', listener);\n }\n \n this.olMap.removeInteraction(this.drawInteraction);\n this.drawInteraction = undefined;\n this.setCursor('');\n }\n }\n \n cleanup(): void {\n if (this.keyDownListener) {\n const target = this.olMap.getTargetElement();\n if (target && target instanceof HTMLElement) {\n target.removeEventListener('keydown', this.keyDownListener);\n }\n this.keyDownListener = undefined;\n }\n }\n\n async enableFeatureSelection(): Promise<void> {\n this.disableDrawing();\n this.disableSelection();\n \n const olLayers = this.olMap.getLayers();\n const vectorLayers = olLayers.getArray().filter(layer => layer instanceof layerNS.Vector) as layerNS.Vector<sourceNS.Vector>[];\n \n if (vectorLayers.length === 0) {\n throw new Error('No vector layers available for selection');\n }\n \n const gsMap = this.renderer?.gsMap;\n const selectionStyle = gsMap?.styles?.['selection'];\n \n const selectOptions: any = {\n condition: eventsCondition.click,\n layers: vectorLayers,\n hitTolerance: 5,\n style: selectionStyle ? toOlStyle(selectionStyle) : (_feature: any) => {\n const stroke = new style.Stroke({ color: 'rgba(255, 255, 0, 1)', width: 3 });\n const fill = new style.Fill({ color: 'rgba(255, 255, 0, 0.3)' });\n return new style.Style({\n image: new style.Circle({ radius: 7, fill: fill, stroke: stroke }),\n stroke: stroke,\n fill: fill\n });\n }\n };\n \n this.selectInteraction = new interactionNS.Select(selectOptions);\n \n this.selectInteraction.on('select', (event: any) => {\n if (event.selected.length > 0) {\n const selectedFeature = event.selected[0];\n let featureLayerUuid: string | undefined;\n olLayers.getArray().forEach((layer) => {\n if (layer instanceof layerNS.Vector) {\n const source = layer.getSource();\n if (source && source.hasFeature(selectedFeature)) {\n const uuid = layer.get(KEY_UUID);\n if (uuid) featureLayerUuid = uuid;\n }\n }\n });\n \n if (featureLayerUuid && this.renderer) {\n const gsFeature = toGsFeature(selectedFeature);\n const geometry = selectedFeature.getGeometry();\n const metrics: { length?: number, area?: number } = {};\n \n if (geometry) {\n const geometryType = geometry.getType();\n try {\n if (geometryType === 'LineString' || geometryType === 'MultiLineString') {\n metrics.length = sphere.getLength(geometry, { projection: this.olMap.getView().getProjection() });\n } else if (geometryType === 'Polygon' || geometryType === 'MultiPolygon') {\n metrics.area = sphere.getArea(geometry, { projection: this.olMap.getView().getProjection() });\n const coordinates = geometryType === 'Polygon' \n ? (geometry as any).getCoordinates()[0]\n : (geometry as any).getCoordinates()[0][0];\n if (coordinates?.length > 0) {\n const perimeterLine = new geom.LineString(coordinates);\n metrics.length = sphere.getLength(perimeterLine, { projection: this.olMap.getView().getProjection() });\n }\n }\n } catch (error) {\n console.warn('Error calculating feature metrics:', error);\n }\n }\n \n this.renderer.triggerSync({\n type: 'featureSelected',\n layerUuid: featureLayerUuid,\n feature: gsFeature,\n metrics\n });\n }\n } else if (event.deselected.length > 0) {\n this.renderer?.triggerSync({ type: 'featureDeselected' });\n }\n });\n \n this.olMap.addInteraction(this.selectInteraction);\n this.setCursor('pointer');\n }\n\n async deleteSelectedFeatures(): Promise<void> {\n if (!this.selectInteraction) {\n throw new Error('No selection interaction active');\n }\n \n const selectedFeatures = this.selectInteraction.getFeatures();\n \n if (selectedFeatures.getLength() === 0) {\n throw new Error('No features selected');\n }\n \n const layersToSync = new Set<string>();\n const olLayers = this.olMap.getLayers();\n \n selectedFeatures.forEach((feature: any) => {\n for (let i = 0; i < olLayers.getLength(); i++) {\n const layer = olLayers.item(i);\n if (layer instanceof layerNS.Vector) {\n const source = layer.getSource();\n if (source && source.hasFeature(feature)) {\n source.removeFeature(feature);\n const layerUuid = layer.get(KEY_UUID);\n if (layerUuid) layersToSync.add(layerUuid);\n break;\n }\n }\n }\n });\n \n selectedFeatures.clear();\n \n if (this.renderer && layersToSync.size > 0) {\n layersToSync.forEach(layerUuid => {\n this.renderer!.syncLayerFeaturesToModel(layerUuid);\n });\n }\n this.renderer?.triggerDirty();\n }\n\n async disableSelection(): Promise<void> {\n if (this.selectInteraction) {\n this.olMap.removeInteraction(this.selectInteraction);\n this.selectInteraction = undefined;\n this.setCursor('');\n this.renderer?.triggerSync({ type: 'featureDeselected' });\n }\n }\n}\n\n","// Core exports - renderer-agnostic model and utilities\n// For renderer-specific functionality, import from '@kispace-io/gs-lib/ol' or '@kispace-io/gs-lib/ml'\nexport * from \"./gs-model\"\nexport * from \"./scripted-runtime-registry\"\n\n// Map renderer interface (no implementation)\nexport * from \"./map-renderer\"\n\n// map-builder is only used by build service - export explicitly to avoid tree-shaking issues\nexport { buildMap, generateAppJs, processServiceWorker, processManifest, processHtml, bundleApp, type BuildOptions, type FileSystem, type GsLibFileCopier, type ProgressCallback } from \"./base-map-builder\"\n\nexport const rtUtils = {\n async resolveUrl(url: string) {\n return url\n }\n};\n\nexport * from \"./ol/index\"\n\n// Backward compatibility: export olLib as gsLib for generated build code\nexport { olLib as gsLib } from \"./ol/gs-ol-lib\""],"names":["uuidv4","source","GsSourceType","GsLayerType","GsGeometryType","litRender","style","CircleStyle","format","applyMapboxStyle","extent","settings","Map","defaultInteractions","defaultControls","geom"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEO,MAAM,YAAY;AAClB,MAAM,WAAW;AACjB,MAAM,UAAU;AAChB,MAAM,aAAa;AACnB,MAAM,gBAAgB;AACtB,MAAM,YAAY;AAClB,MAAM,UAAU;AAChB,MAAM,iBAAiB;AACvB,MAAM,UAAU;AAChB,MAA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Aa,IAAI,SAAS;AACzC;AAAA,UACJ;AAAA,QACJ;AAAA,MACJ;AAAA,IACJ,CAAC;AAED,qBAAiB,MAAA;AAEjB,QAAI,KAAK,YAAY,aAAa,OAAO,GAAG;AACxC,mBAAa,QAAQ,CAAA,cAAa;AAC9B,aAAK,SAAU,yBAAyB,SAAS;AAAA,MACrD,CAAC;AAAA,IACL;AACA,SAAK,UAAU,aAAA;AAAA,EACnB;AAAA,EAEA,MAAM,mBAAkC;AACpC,QAAI,KAAK,mBAAmB;AACxB,WAAK,MAAM,kBAAkB,KAAK,iBAAiB;AACnD,WAAK,oBAAoB;AACzB,WAAK,UAAU,EAAE;AACjB,WAAK,UAAU,YAAY,EAAE,MAAM,qBAAqB;AAAA,IAC5D;AAAA,EACJ;AACJ;AClsBO,MAAM,UAAU;AAAA,EACnB,MAAM,WAAW,KAAa;AAC1B,WAAO;AAAA,EACX;AACJ;"}
1
+ {"version":3,"file":"index.js","sources":["../src/gs-model.ts","../src/scripted-runtime-registry.ts","../src/map-renderer.ts","../src/base-map-builder.ts","../src/ol/gs-ol-adapters.ts","../src/ol/gs-gs2ol.ts","../src/ol/gs-ol2gs.ts","../src/ol/gs-ol-lib.ts","../src/ol/openlayers-map-renderer.ts","../src/index.ts"],"sourcesContent":["import { v4 as uuidv4 } from '@eclipse-lyra/core/externals/third-party'\n\nexport const KEY_LABEL = \"label\";\nexport const KEY_NAME = \"name\";\nexport const KEY_URL = \"url\";\nexport const KEY_FORMAT = \"format\";\nexport const KEY_ICON_PATH = \"iconPath\";\nexport const KEY_STATE = \"_state\";\nexport const KEY_SRC = \"src\";\nexport const KEY_SOURCETYPE = \"sourceType\"\nexport const KEY_ENV = \"_env\"\nexport const KEY_GS_MANAGED = \"gsManaged\"\nexport const KEY_SETTINGS = \"settings\"\nexport const KEY_UUID = \"uuid\"\nexport const KEY_EVENT_SUBSCRIPTIONS = \"_eventSubscriptions\"\n\nexport const LAYER_GEOCODED_MARKERS = \"geocoded-markers\"\n\nexport interface GsBag {\n [key: string]: any\n}\n\nexport function ensureUuid<T extends GsState>(obj: T): T {\n if (!obj.uuid) {\n obj.uuid = uuidv4()\n }\n return obj\n}\n\nexport function ensureUuidsRecursive<T extends GsState>(obj: T): T {\n ensureUuid(obj)\n \n if ('geometry' in obj && (obj as any).geometry) {\n ensureUuid((obj as any).geometry)\n }\n \n if ('source' in obj && (obj as any).source) {\n const source = (obj as any).source\n ensureUuid(source)\n if (source.features && Array.isArray(source.features)) {\n source.features.forEach((feature: any) => ensureUuidsRecursive(feature))\n }\n }\n \n if ('layers' in obj && Array.isArray((obj as any).layers)) {\n (obj as any).layers.forEach((layer: any) => ensureUuidsRecursive(layer))\n }\n \n if ('overlays' in obj && Array.isArray((obj as any).overlays)) {\n (obj as any).overlays.forEach((overlay: any) => ensureUuid(overlay))\n }\n \n if ('controls' in obj && Array.isArray((obj as any).controls)) {\n (obj as any).controls.forEach((control: any) => ensureUuid(control))\n }\n \n if ('interactions' in obj && Array.isArray((obj as any).interactions)) {\n (obj as any).interactions.forEach((interaction: any) => ensureUuid(interaction))\n }\n \n if ('view' in obj && (obj as any).view) {\n ensureUuid((obj as any).view)\n }\n \n return obj\n}\n\nexport interface GsState {\n uuid?: string\n state?: GsBag\n}\n\nexport enum GsSourceType {\n OSM = \"OSM\", GeoJSON = \"GeoJSON\", Features = \"Features\", KML = \"KML\", GeoTIFF = \"GeoTIFF\", GPX = \"GPX\", BM = \"BM\", WMS = \"WMS\", WMTS = \"WMTS\", XYZ = \"XYZ\", Scripted = \"Scripted\"\n}\n\nexport enum GsLayerType {\n TILE = \"TILE\", VECTOR = \"VECTOR\", GROUP = \"GROUP\", SCRIPTED = \"SCRIPTED\"\n}\n\nexport enum GsGeometryType {\n Point = \"Point\",\n MultiPoint = \"MultiPoint\",\n Polygon = \"Polygon\",\n MultiPolygon = \"MultiPolygon\",\n LineString = \"LineString\",\n MultiLineString = \"MultiLineString\",\n Circle = \"Circle\",\n LinearRing = \"LinearRing\"\n}\n\nexport interface GsGeometry extends GsState {\n type: GsGeometryType,\n coordinates: number[]\n}\n\nexport interface GsResource {\n}\n\nexport interface GsIcon extends GsResource {\n src: string\n}\n\nexport interface GsFeature extends GsState {\n geometry: GsGeometry\n}\n\nexport interface GsSource extends GsState {\n type: GsSourceType\n url?: string\n features?: GsFeature[]\n}\n\nexport interface GsLayer extends GsState {\n name?: string\n type: GsLayerType,\n source: GsSource,\n visible?: boolean\n}\n\nexport interface GsScriptedVectorLayer extends GsLayer {\n type: GsLayerType.SCRIPTED\n lang?: string\n params?: Record<string, any>\n}\n\nexport interface GsScript extends GsState {\n src: string,\n}\n\nexport interface GsOverlay extends GsScript {\n position: \"bottom-left\" | \"bottom-center\" | \"bottom-right\" | \"center-left\" | \"center-center\" | \"center-right\" | \"top-left\" | \"top-center\" | \"top-right\",\n}\n\nexport interface GsControl extends GsScript {\n}\n\nexport interface GsInteraction extends GsState {\n\n}\n\nexport interface GsView extends GsState {\n center: number[],\n zoom: number,\n projection: string,\n /** Camera pitch in degrees (0 = looking straight down, 60 = tilted view) */\n pitch?: number,\n /** Camera bearing/rotation in degrees (0 = north up) */\n bearing?: number,\n /** Map rotation in radians (OpenLayers) - deprecated, use bearing instead */\n rotation?: number\n}\n\nexport interface GsStrokeStyle {\n color?: string\n width?: number\n lineDash?: number[]\n lineCap?: 'butt' | 'round' | 'square'\n lineJoin?: 'bevel' | 'round' | 'miter'\n miterLimit?: number\n}\n\nexport interface GsFillStyle {\n color?: string\n}\n\nexport interface GsImageStyle {\n type: 'circle' | 'icon' | 'regular-shape'\n \n radius?: number\n fill?: GsFillStyle\n stroke?: GsStrokeStyle\n \n src?: string\n scale?: number\n anchor?: [number, number]\n anchorXUnits?: 'fraction' | 'pixels'\n anchorYUnits?: 'fraction' | 'pixels'\n anchorOrigin?: 'bottom-left' | 'bottom-right' | 'top-left' | 'top-right'\n color?: string\n crossOrigin?: string\n offset?: [number, number]\n offsetOrigin?: 'bottom-left' | 'bottom-right' | 'top-left' | 'top-right'\n size?: [number, number]\n \n points?: number\n radius1?: number\n radius2?: number\n angle?: number\n \n opacity?: number\n rotation?: number\n rotateWithView?: boolean\n displacement?: [number, number]\n}\n\nexport interface GsTextStyle {\n text?: string\n font?: string\n maxAngle?: number\n offsetX?: number\n offsetY?: number\n overflow?: boolean\n placement?: 'point' | 'line'\n repeat?: number\n scale?: number\n rotateWithView?: boolean\n rotation?: number\n textAlign?: 'left' | 'center' | 'right' | 'end' | 'start'\n justify?: 'left' | 'center' | 'right'\n textBaseline?: 'bottom' | 'top' | 'middle' | 'alphabetic' | 'hanging' | 'ideographic'\n fill?: GsFillStyle\n stroke?: GsStrokeStyle\n backgroundFill?: GsFillStyle\n backgroundStroke?: GsStrokeStyle\n padding?: [number, number, number, number]\n}\n\nexport interface GsStyle {\n id?: string\n stroke?: GsStrokeStyle\n fill?: GsFillStyle\n image?: GsImageStyle\n text?: GsTextStyle\n zIndex?: number\n}\n\nexport interface GsStylesMap {\n [key: string]: GsStyle\n}\n\nexport const DEFAULT_STYLES: GsStylesMap = {\n 'default-point': {\n id: 'default-point',\n image: {\n type: 'circle',\n radius: 5,\n fill: { color: 'rgba(0, 100, 255, 0.8)' },\n stroke: { color: 'white', width: 2 }\n }\n },\n 'default-line': {\n id: 'default-line',\n stroke: {\n color: 'rgba(0, 100, 255, 0.8)',\n width: 2\n }\n },\n 'default-polygon': {\n id: 'default-polygon',\n fill: { color: 'rgba(0, 100, 255, 0.3)' },\n stroke: {\n color: 'rgba(0, 100, 255, 0.8)',\n width: 2\n }\n },\n 'selection': {\n id: 'selection',\n image: {\n type: 'circle',\n radius: 7,\n fill: { color: 'rgba(255, 255, 0, 0.3)' },\n stroke: { color: 'rgba(255, 255, 0, 1)', width: 3 }\n },\n stroke: {\n color: 'rgba(255, 255, 0, 1)',\n width: 3\n },\n fill: {\n color: 'rgba(255, 255, 0, 0.3)'\n }\n }\n}\n\nexport interface GsStyleRule {\n id?: string\n condition: {\n geometryType?: GsGeometryType | GsGeometryType[]\n layerName?: string\n property?: {\n key: string\n value?: any\n operator?: 'equals' | 'not-equals' | 'contains' | 'greater-than' | 'less-than' | 'exists'\n }\n }\n styleId: string\n priority?: number\n}\n\nexport function evaluateStyleRule(rule: GsStyleRule, feature: GsFeature, layerName?: string): boolean {\n const condition = rule.condition\n \n if (condition.geometryType) {\n const types = Array.isArray(condition.geometryType) ? condition.geometryType : [condition.geometryType]\n if (!types.includes(feature.geometry.type)) {\n return false\n }\n }\n \n if (condition.layerName && condition.layerName !== layerName) {\n return false\n }\n \n if (condition.property) {\n const prop = condition.property\n const featureValue = feature.state?.[prop.key]\n \n if (!prop.operator || prop.operator === 'exists') {\n return featureValue !== undefined\n }\n \n if (prop.operator === 'equals') {\n return featureValue === prop.value\n }\n \n if (prop.operator === 'not-equals') {\n return featureValue !== prop.value\n }\n \n if (prop.operator === 'contains' && typeof featureValue === 'string' && typeof prop.value === 'string') {\n return featureValue.includes(prop.value)\n }\n \n if (prop.operator === 'greater-than' && typeof featureValue === 'number' && typeof prop.value === 'number') {\n return featureValue > prop.value\n }\n \n if (prop.operator === 'less-than' && typeof featureValue === 'number' && typeof prop.value === 'number') {\n return featureValue < prop.value\n }\n }\n \n return true\n}\n\nexport function getStyleForFeature(feature: GsFeature, rules: GsStyleRule[], stylesMap: GsStylesMap, layerName?: string): GsStyle | undefined {\n const sortedRules = [...rules].sort((a, b) => (b.priority || 0) - (a.priority || 0))\n \n for (const rule of sortedRules) {\n if (evaluateStyleRule(rule, feature, layerName)) {\n return stylesMap[rule.styleId]\n }\n }\n \n return undefined\n}\n\nexport interface GsMap extends GsState {\n view: GsView,\n layers: GsLayer[],\n overlays: GsOverlay[],\n controls: GsControl[],\n interactions: GsInteraction[],\n styles: GsStylesMap,\n styleRules: GsStyleRule[],\n chatHistory: any[]\n}\n\nexport const DEFAULT_STYLE_RULES: GsStyleRule[] = [\n {\n id: 'default-points',\n condition: {\n geometryType: [GsGeometryType.Point, GsGeometryType.MultiPoint]\n },\n styleId: 'default-point',\n priority: 0\n },\n {\n id: 'default-lines',\n condition: {\n geometryType: [GsGeometryType.LineString, GsGeometryType.MultiLineString]\n },\n styleId: 'default-line',\n priority: 0\n },\n {\n id: 'default-polygons',\n condition: {\n geometryType: [GsGeometryType.Polygon, GsGeometryType.MultiPolygon, GsGeometryType.Circle]\n },\n styleId: 'default-polygon',\n priority: 0\n }\n]\n\nexport const DEFAULT_GSMAP = ensureUuid({\n view: ensureUuid({\n center: [0, 0],\n zoom: 0,\n projection: 'EPSG:3857'\n } as GsView),\n layers: [ensureUuid({\n type: GsLayerType.TILE,\n source: ensureUuid({\n type: GsSourceType.OSM\n } as GsSource),\n } as GsLayer)],\n overlays: [] as GsOverlay[],\n controls: [] as GsControl[],\n interactions: [] as GsInteraction[],\n state: {},\n styles: { ...DEFAULT_STYLES },\n styleRules: [...DEFAULT_STYLE_RULES]\n} as GsMap)\n\n","export interface ScriptedVars {\n params: Record<string, any>\n env: Record<string, string>\n viewState: { extent: number[], zoom: number, projection: string }\n signal?: AbortSignal\n}\n\nexport interface ScriptedRuntime {\n run(src: string, vars: ScriptedVars): Promise<unknown>\n}\n\nclass ScriptedRuntimeRegistryImpl {\n private runtimes = new Map<string, ScriptedRuntime>()\n\n register(lang: string, runtime: ScriptedRuntime): void {\n this.runtimes.set(lang, runtime)\n }\n\n get(lang: string): ScriptedRuntime | undefined {\n return this.runtimes.get(lang)\n }\n}\n\nexport const scriptedRuntimeRegistry = new ScriptedRuntimeRegistryImpl()\n\nconst jsRuntime: ScriptedRuntime = {\n async run(src: string, vars: ScriptedVars): Promise<unknown> {\n const mod = await import(/* @vite-ignore */ src)\n const fn = mod instanceof Function ? mod : mod.default\n if (typeof fn !== 'function') {\n throw new Error(`Scripted layer module at \"${src}\" must export a default function`)\n }\n return fn(vars)\n }\n}\n\nscriptedRuntimeRegistry.register('javascript', jsRuntime)\n","import { GsMap, GsLayer, GsControl, GsOverlay } from \"./gs-model\";\n\n/**\n * Sync event types that describe what changed in the map\n */\nexport type MapSyncEvent = \n | { type: 'viewChanged', view: { center: [number, number], zoom: number, rotation?: number, pitch?: number, bearing?: number } }\n | { type: 'featuresChanged', layerUuid: string, features: any[] }\n | { type: 'featureSelected', layerUuid: string, feature: any, metrics?: { length?: number, area?: number } }\n | { type: 'featureDeselected' }\n | { type: 'drawingDisabled' };\n\n/**\n * Screenshot result from captureScreenshot\n */\nexport type ScreenshotResult = \n | { success: true, dataUrl: string, width: number, height: number }\n | { success: false, error: string };\n\n/**\n * Abstract interface for map rendering\n * The host app only knows about this interface and the GsMap domain model\n * \n * This interface is focused purely on rendering and map state management.\n * For operations, use MapOperations interface instead.\n */\nexport interface MapRenderer {\n render(container: string | HTMLElement): Promise<void>;\n reattached?(): Promise<void>;\n modelToUI(updatedGsMap?: GsMap): Promise<void>;\n getViewExtent(): Promise<number[]>;\n getOperations(): MapOperations;\n setOnDirty(callback: () => void): void;\n triggerDirty(): void;\n setOnSync(callback: (event: MapSyncEvent) => void): void;\n triggerSync(event: MapSyncEvent): void;\n setOnClick?(callback: () => void): void;\n captureScreenshot(): Promise<ScreenshotResult>;\n /**\n * Transform a coordinate from one projection to another.\n *\n * - If sourceProjection is omitted, the map's current projection is assumed.\n * - If targetProjection is omitted, WGS84 (EPSG:4326) is assumed.\n */\n transform(\n coord: [number, number],\n options?: {\n sourceProjection?: string;\n targetProjection?: string;\n }\n ): Promise<[number, number]>;\n destroy(): void;\n}\n\nexport function findLayerByUuid(gsMap: GsMap, uuid: string): GsLayer | undefined {\n return gsMap.layers.find(layer => layer.uuid === uuid);\n}\n\nexport function findLayerIndexByUuid(gsMap: GsMap, uuid: string): number {\n return gsMap.layers.findIndex(layer => layer.uuid === uuid);\n}\n\nexport function findControlByUuid(gsMap: GsMap, uuid: string): GsControl | undefined {\n return gsMap.controls.find(control => control.uuid === uuid);\n}\n\nexport function findControlIndexByUuid(gsMap: GsMap, uuid: string): number {\n return gsMap.controls.findIndex(control => control.uuid === uuid);\n}\n\nexport function findOverlayByUuid(gsMap: GsMap, uuid: string): GsOverlay | undefined {\n return gsMap.overlays.find(overlay => overlay.uuid === uuid);\n}\n\nexport function findOverlayIndexByUuid(gsMap: GsMap, uuid: string): number {\n return gsMap.overlays.findIndex(overlay => overlay.uuid === uuid);\n}\n\n/**\n * Map operations interface for high-level map commands\n * These operations work with the domain model and are framework-agnostic\n */\nexport interface MapOperations {\n // View operations\n setZoom(zoom: number): Promise<void>;\n setCenter(center: [number, number]): Promise<void>;\n \n // Display operations\n switchColorMode(mode?: 'dark' | 'light'): Promise<void>;\n \n // Layer operations\n addLayer(layer: any, isBasemap?: boolean): Promise<void>;\n deleteLayer(uuid: string): Promise<void>;\n renameLayer(uuid: string, newName: string): Promise<void>;\n moveLayer(uuid: string, targetUuid?: string): Promise<void>;\n setLayerVisible(uuid: string, visible: boolean): Promise<void>;\n \n // Control operations\n addControlFromModule(src: string): Promise<void>;\n removeControl(uuid: string): Promise<void>;\n \n // Overlay operations\n addOverlayFromModule(src: string, position?: string): Promise<void>;\n removeOverlay(uuid: string): Promise<void>;\n \n // Drawing operations (UI-only, no domain model changes until features are added)\n enableDrawing(geometryType: 'Point' | 'LineString' | 'Polygon', layerUuid: string): Promise<void>;\n disableDrawing(): Promise<void>;\n \n // Feature selection and deletion\n enableFeatureSelection(): Promise<void>;\n disableSelection(): Promise<void>;\n deleteSelectedFeatures(): Promise<void>;\n\n}\n\nexport const createProxy = (operations: MapOperations[]): MapOperations => {\n return new Proxy({}, {\n get: (_, prop: string) => {\n return async (...args: any[]) => {\n await Promise.all(\n operations.map((operation: any) => {\n const fn = operation[prop];\n if (typeof fn === \"function\") {\n return fn.apply(operation, args);\n }\n return undefined;\n }),\n );\n };\n }\n }) as MapOperations;\n}\n\n","import {GsMap, GsScript} from './gs-model'\n\n// esbuild types (without importing the implementation to avoid bundling Node.js version in browser)\ntype EsbuildPlugin = {\n name: string\n setup: (build: any) => void\n}\n\n// Type for esbuild instance (works with both esbuild and esbuild-wasm)\ntype EsbuildInstance = {\n build: (options: any) => Promise<{ \n outputFiles?: Array<{ path?: string; contents: Uint8Array }>;\n metafile?: {\n outputs?: Record<string, { entryPoint?: string; [key: string]: any }>;\n [key: string]: any;\n };\n }>\n}\n\nexport interface BuildOptions {\n title: string,\n gsMap: GsMap,\n env: any,\n version: string\n}\n\nexport interface FileSystem {\n readFile(path: string): Promise<string | Uint8Array>\n writeFile(path: string, content: string | Uint8Array): Promise<void>\n ensureDir(path: string): Promise<void>\n exists(path: string): Promise<boolean>\n deleteDir?(path: string): Promise<void>\n}\n\nexport interface ProgressCallback {\n (step: number, message: string, totalSteps?: number): void\n}\n\n\n/**\n * Generate the entry point JavaScript code for the map application\n */\nexport function generateAppJs(vars: {\n gsMap: GsMap,\n gsLibPath: string,\n env: any\n}): string {\n // Collect all script paths from controls and overlays\n const allScripts = [...(vars.gsMap.controls || []), ...(vars.gsMap.overlays || [])]\n const scriptPaths = allScripts\n .map((script: GsScript) => script.src)\n .filter((src: string) => src) // Filter out empty src\n \n // Generate static imports for all scripts so esbuild can bundle them\n // Static imports ensure esbuild bundles them, and they'll be available at runtime\n const scriptImports = scriptPaths.map((src: string, index: number) => {\n // Escape the src for use in template string\n const escapedSrc = src.replace(/`/g, '\\\\`').replace(/\\$/g, '\\\\$')\n return `import script${index} from '${escapedSrc}'`\n })\n \n // Create a modules map that maps src to the imported module\n // This allows gs-lib to properly parameterize user modules at runtime\n const modulesMap = scriptPaths.map((src: string, index: number) => {\n const escapedSrc = JSON.stringify(src)\n return `${escapedSrc}: script${index}`\n }).join(',\\n ')\n \n return `\nimport {gsLib} from \"${vars.gsLibPath}\"\nimport \"./gs-lib/gs-lib.css\"\n\n${scriptImports.join('\\n')}\n\nexport const renderMap = (mapContainerSelector) => {\n const modules = {\n ${modulesMap}\n }\n return gsLib({\n containerSelector: mapContainerSelector,\n gsMap: ${JSON.stringify(vars.gsMap)},\n mapOptions: {\n controls: {zoom: false, attribution: false}\n },\n env: ${JSON.stringify(vars.env || {})},\n modules: modules\n })\n}\n`\n}\n\n/**\n * Generate precache manifest for Workbox\n */\nexport function generatePrecacheManifest(assets: Array<{ url: string, revision?: string | null }>): string {\n return JSON.stringify(assets, null, 2)\n}\n\n/**\n * Process service worker content by injecting precache manifest\n */\nexport function processServiceWorker(\n content: string, \n precacheManifest?: Array<{ url: string, revision?: string | null }>\n): string {\n // Inject precache manifest if provided\n if (precacheManifest) {\n const manifestJson = generatePrecacheManifest(precacheManifest)\n // Replace the __WB_MANIFEST placeholder or inject before precacheAndRoute\n if (content.includes('self.__WB_MANIFEST')) {\n return content.replace(\n 'self.__WB_MANIFEST || []',\n `${manifestJson}`\n )\n } else {\n // Inject manifest before precacheAndRoute line\n return content.replace(\n /workbox\\.precaching\\.precacheAndRoute\\(/,\n `self.__WB_MANIFEST = ${manifestJson};\\nworkbox.precaching.precacheAndRoute(`\n )\n }\n }\n \n return content\n}\n\n/**\n * Process manifest content by updating title and version\n */\nexport function processManifest(content: string, title: string, version: string): string {\n const manifest = JSON.parse(content)\n manifest.name = title\n manifest.short_name = title\n manifest.description = title\n manifest.version = version\n return JSON.stringify(manifest, null, 2)\n}\n\n/**\n * Process HTML template by replacing title placeholder, app.js reference, and app.css reference\n */\nexport function processHtml(content: string, title: string, appJsFilename?: string, appCssFilename?: string): string {\n let processed = content.replace(/\\$TITLE/g, title)\n if (appJsFilename) {\n // Replace the app.js import with the hashed filename\n processed = processed.replace(/\\.\\/app\\.js/g, `./${appJsFilename}`)\n }\n if (appCssFilename) {\n // Replace the app.css reference with the hashed filename\n processed = processed.replace(/href=[\"']app\\.css[\"']/g, `href=\"${appCssFilename}\"`)\n }\n return processed\n}\n\n/**\n * Bundle the application code using esbuild with hashed filenames\n * @param esbuildInstance - The esbuild instance to use (esbuild-wasm for browser, esbuild for Node.js)\n * @returns Object with both JS and CSS filenames (CSS may be null if not generated)\n */\nexport async function bundleApp(\n entryPointPath: string,\n outputDir: string,\n gsLibPath: string,\n fileSys: FileSystem,\n resolvePlugin: EsbuildPlugin,\n esbuildInstance: EsbuildInstance,\n progress?: ProgressCallback,\n currentStep?: { value: number },\n totalSteps?: number\n): Promise<{ js: string; css: string | null }> {\n const updateProgress = (message: string) => {\n if (progress) {\n if (currentStep !== undefined) {\n progress(++currentStep.value, message, totalSteps)\n } else {\n progress(0, message, totalSteps)\n }\n }\n }\n \n updateProgress(\"Bundling and minifying code...\")\n \n const result = await esbuildInstance.build({\n entryPoints: [entryPointPath],\n bundle: true,\n outdir: outputDir,\n format: \"esm\",\n minify: true,\n plugins: [resolvePlugin],\n entryNames: '[name]-[hash]',\n // Runtime dependencies (lit, webawesome) are bundled with gs-lib\n external: [],\n // Bundle all dependencies\n packages: 'bundle',\n write: false, // Don't write to disk, we'll handle it\n metafile: true // Generate metafile to get output information\n })\n \n updateProgress(\"Saving bundled output...\")\n \n if (!result.outputFiles || result.outputFiles.length === 0) {\n throw new Error('No output files generated by esbuild')\n }\n \n // Write all output files and find the main entry file and CSS file\n let mainOutputFile: string | null = null\n let cssOutputFile: string | null = null\n \n // Try to use metafile to find the entry point output\n if (result.metafile && result.metafile.outputs) {\n // Find the output file that corresponds to our entry point\n const entryName = 'app' // Our entry point is app.js\n for (const [outputPath, output] of Object.entries(result.metafile.outputs)) {\n if (output && typeof output === 'object' && 'entryPoint' in output) {\n if (outputPath.includes(entryName) && outputPath.endsWith('.js')) {\n mainOutputFile = outputPath\n } else if (outputPath.endsWith('.css')) {\n cssOutputFile = outputPath\n }\n }\n }\n }\n \n // Extract filename from path (works in both browser and Node.js)\n const extractFilename = (filePath: string): string => {\n const lastSlash = Math.max(filePath.lastIndexOf('/'), filePath.lastIndexOf('\\\\'))\n return lastSlash >= 0 ? filePath.substring(lastSlash + 1) : filePath\n }\n \n // Write output files and find the main entry file and CSS (fallback if metafile didn't work)\n for (const file of result.outputFiles) {\n let filePath = file.path || ''\n \n // esbuild returns paths relative to outdir, but may be absolute\n // Extract just the filename if it's a full path, or use as-is if relative\n let relativePath: string\n let filename: string\n \n if (filePath.startsWith('/') || (filePath.length > 2 && filePath[1] === ':')) {\n // Absolute path - extract filename and build relative path\n filename = extractFilename(filePath)\n relativePath = `${outputDir}/${filename}`\n } else {\n // Relative path - ensure it's under outputDir\n filename = extractFilename(filePath)\n relativePath = filePath.startsWith(outputDir) ? filePath : `${outputDir}/${filePath}`\n }\n \n await fileSys.writeFile(relativePath, file.contents)\n \n // The entry file will be named app-[hash].js\n if (!mainOutputFile && filename.includes('app-') && filename.endsWith('.js')) {\n mainOutputFile = filename\n }\n // CSS file will be named app-[hash].css\n if (!cssOutputFile && filename.includes('app-') && filename.endsWith('.css')) {\n cssOutputFile = filename\n }\n }\n \n if (!mainOutputFile) {\n throw new Error('Could not find main output file')\n }\n \n return {\n js: extractFilename(mainOutputFile),\n css: cssOutputFile ? extractFilename(cssOutputFile) : null\n }\n}\n\n/**\n * Interface for copying files from gs-lib package\n * This abstracts the difference between browser (import promises) and Node.js (file system)\n */\nexport interface GsLibFileCopier {\n /**\n * Copy a text file from gs-lib\n * @param srcPath - Source path relative to gs-lib package (e.g., \"dist/index.js\", \"public/index.html\")\n * @param destPath - Destination path in the project\n * @param processor - Optional function to process content before saving\n */\n copyTextFile(srcPath: string, destPath: string, processor?: (content: string) => string | Promise<string>): Promise<void>\n \n /**\n * Copy a binary file from gs-lib\n * @param srcPath - Source path relative to gs-lib package\n * @param destPath - Destination path in the project\n */\n copyBinaryFile(srcPath: string, destPath: string): Promise<void>\n}\n\n/**\n * Create a standard GsLibFileCopier that uses FileSystem to read from gs-lib package\n */\nexport function createFileSystemGsLibCopier(\n fs: FileSystem,\n gsLibPackagePath: string\n): GsLibFileCopier {\n const copyFile = async (\n srcPath: string,\n destPath: string,\n asText: boolean,\n processor?: (content: string) => string | Promise<string>\n ): Promise<void> => {\n const fullSrcPath = `${gsLibPackagePath}/${srcPath}`\n let content: string | Uint8Array = await fs.readFile(fullSrcPath)\n \n if (asText) {\n // Convert to string if needed\n if (content instanceof Uint8Array) {\n content = new TextDecoder().decode(content)\n } else {\n content = content as string\n }\n \n if (processor) {\n content = await processor(content)\n }\n }\n \n await fs.writeFile(destPath, content)\n }\n \n return {\n async copyTextFile(srcPath: string, destPath: string, processor?: (content: string) => string | Promise<string>): Promise<void> {\n await copyFile(srcPath, destPath, true, processor)\n },\n async copyBinaryFile(srcPath: string, destPath: string): Promise<void> {\n await copyFile(srcPath, destPath, false)\n }\n }\n}\n\n/**\n * Recursively copy a directory\n */\nasync function copyDirectory(fs: FileSystem, src: string, dest: string): Promise<void> {\n // This is a simplified version - would need full directory traversal\n // For now, we'll handle specific known directories\n await fs.ensureDir(dest)\n}\n\n/**\n * Calculate total build steps based on configuration\n */\nexport function calculateTotalSteps(\n hasReadStep: boolean,\n hasAssets: boolean,\n cleanBeforeBuild: boolean,\n cleanAfterBuild: boolean\n): number {\n const baseSteps = 9 // buildMap base steps\n const bundleSteps = 2 // bundling steps\n const completedStep = 1 // build completed step\n const readStep = hasReadStep ? 1 : 0\n const assetsStep = hasAssets ? 1 : 0\n const cleanupBeforeStep = cleanBeforeBuild ? 1 : 0\n const cleanupAfterStep = cleanAfterBuild ? 1 : 0\n \n return readStep + cleanupBeforeStep + baseSteps + bundleSteps + completedStep + assetsStep + cleanupAfterStep\n}\n\n/**\n * Create a standard copyAssets function that works with FileSystem\n */\nexport function createCopyAssetsFunction(fs: FileSystem): (fs: FileSystem, outputDir: string, progress?: ProgressCallback) => Promise<void> {\n return async (fileSys: FileSystem, outputDir: string, progress?: ProgressCallback) => {\n if (await fileSys.exists('assets')) {\n await copyDirectory(fileSys, 'assets', `${outputDir}/assets`)\n }\n }\n}\n\n/**\n * Unified build function that works in both browser and Node.js\n * This is the single source of truth for the build process\n */\nexport async function buildMap(\n options: BuildOptions,\n fs: FileSystem,\n resolvePlugin: EsbuildPlugin,\n esbuildInstance: EsbuildInstance,\n config: {\n outputDir?: string,\n buildDir?: string,\n gsLibPath?: string,\n gsLibPackagePath?: string,\n gsLibCopier?: GsLibFileCopier,\n cleanBeforeBuild?: boolean,\n cleanAfterBuild?: boolean,\n copyAssets?: (fs: FileSystem, outputDir: string, progress?: ProgressCallback) => Promise<void>\n } = {},\n progress?: ProgressCallback\n): Promise<void> {\n const {\n outputDir = 'dist',\n buildDir = '__build',\n gsLibPath = `${buildDir}/gs-lib/index.js`,\n gsLibPackagePath,\n gsLibCopier: providedGsLibCopier,\n cleanBeforeBuild = true,\n cleanAfterBuild = true,\n copyAssets\n } = config\n \n // Create gsLibCopier if not provided, using FileSystem\n const gsLibCopier = providedGsLibCopier || (gsLibPackagePath ? createFileSystemGsLibCopier(fs, gsLibPackagePath) : null)\n if (!gsLibCopier) {\n throw new Error('Either gsLibCopier or gsLibPackagePath must be provided')\n }\n \n const buildGsLibPath = gsLibPath\n \n let step = (config as any).startingStep ?? 0\n const totalSteps = (config as any).totalSteps\n const updateProgress = (message: string) => {\n if (progress) progress(++step, message, totalSteps)\n }\n \n // Clean up build directories before starting\n if (cleanBeforeBuild) {\n updateProgress(\"Cleaning build directories...\")\n const cleanupPromises: Promise<void>[] = []\n if (fs.deleteDir) {\n cleanupPromises.push(\n fs.deleteDir(buildDir).catch(() => {}), // Ignore errors if directory doesn't exist\n fs.deleteDir(outputDir).catch(() => {})\n )\n } else {\n // Fallback: try to use Node.js fs if available\n try {\n const nodeFs = await import('fs/promises')\n const path = await import('path')\n const projectRoot = process.cwd()\n cleanupPromises.push(\n nodeFs.rm(path.resolve(projectRoot, buildDir), { recursive: true, force: true }).catch(() => {}),\n nodeFs.rm(path.resolve(projectRoot, outputDir), { recursive: true, force: true }).catch(() => {})\n )\n } catch {\n // If Node.js fs is not available, skip cleanup\n }\n }\n await Promise.all(cleanupPromises)\n }\n \n // Ensure directories exist\n updateProgress(\"Preparing build directories...\")\n await Promise.all([\n fs.ensureDir(`${outputDir}/assets/icons/`),\n fs.ensureDir(`${buildDir}/gs-lib/`)\n ])\n \n // Copy gs-lib package files\n updateProgress(\"Copying gs-lib package...\")\n await Promise.all([\n gsLibCopier.copyTextFile('dist/index.js', `${buildDir}/gs-lib/index.js`),\n gsLibCopier.copyTextFile('dist/gs-lib.css', `${buildDir}/gs-lib/gs-lib.css`)\n ])\n \n // Copy and process PWA files\n updateProgress(\"Copying PWA core files...\")\n await gsLibCopier.copyTextFile('public/pwa/staticwebapp.config.json', `${outputDir}/staticwebapp.config.json`)\n \n updateProgress(\"Creating manifest file...\")\n await gsLibCopier.copyTextFile('public/pwa/manifest.json', `${outputDir}/manifest.json`, (content) => processManifest(content, options.title, options.version))\n \n // Copy PWA icons\n updateProgress(\"Copying PWA icons...\")\n const iconFiles = [\n '24x24.png', '48x48.png', '192x192.png', '512x512.png',\n 'icon_24.png', 'icon_48.png', 'icon_192.png', 'icon_512.png'\n ]\n await Promise.all(iconFiles.map(icon =>\n gsLibCopier.copyBinaryFile(`public/pwa/assets/icons/${icon}`, `${outputDir}/assets/icons/${icon}`)\n ))\n \n // Copy workspace assets if provided\n if (copyAssets) {\n updateProgress(\"Copying workspace assets...\")\n await copyAssets(fs, outputDir, progress)\n }\n \n // Generate entry point\n updateProgress(\"Generating application code...\")\n const entryPointContent = generateAppJs({\n gsMap: options.gsMap,\n gsLibPath: buildGsLibPath,\n env: { ...options.env, BUILD_TIME: new Date() }\n })\n await fs.writeFile(`${buildDir}/app.js`, entryPointContent)\n \n // Bundle with hashed filenames\n const stepRef = { value: step }\n const bundleResult = await bundleApp(`${buildDir}/app.js`, outputDir, buildGsLibPath, fs, resolvePlugin, esbuildInstance, progress, stepRef, totalSteps)\n step = stepRef.value\n const appJsFilename = bundleResult.js\n const appCssFilename = bundleResult.css\n \n // Copy and process HTML with hashed app.js and app.css filenames\n updateProgress(\"Generating HTML file...\")\n await gsLibCopier.copyTextFile('public/index.html', `${outputDir}/index.html`, (content) => processHtml(content, options.title, appJsFilename, appCssFilename || undefined))\n \n // Generate precache manifest after all assets are created\n // Hashed filenames naturally handle cache invalidation, so we can use null revision\n // For non-hashed assets, we can also use null since Workbox will check file content\n // Note: index.html and manifest.json are NOT precached - they use NetworkFirst strategy\n // This ensures the browser gets the latest versions that reference the current hashed app.js\n const precacheManifest: Array<{ url: string, revision: string | null }> = [\n { url: `/${appJsFilename}`, revision: null }, // Hashed filename handles versioning\n ...(appCssFilename ? [{ url: `/${appCssFilename}`, revision: null }] : []), // Hashed CSS filename handles versioning\n ...iconFiles.map(icon => ({ url: `/assets/icons/${icon}`, revision: null })) // Workbox will check file content\n ]\n \n // Process and inject service worker with precache manifest\n updateProgress(\"Processing service worker...\")\n await gsLibCopier.copyTextFile('public/pwa/sw.js', `${outputDir}/sw.js`, (content) => \n processServiceWorker(content, precacheManifest)\n )\n \n // Cleanup\n if (cleanAfterBuild) {\n updateProgress(\"Cleaning up temporary files...\")\n if (fs.deleteDir) {\n await fs.deleteDir(buildDir)\n } else {\n // Fallback: try to use Node.js fs if available (for CLI usage)\n try {\n const nodeFs = await import('fs/promises')\n const path = await import('path')\n const fullPath = path.resolve(process.cwd(), buildDir)\n await nodeFs.rm(fullPath, { recursive: true, force: true })\n } catch (error) {\n // If Node.js fs is not available (browser context), skip cleanup\n // The browser FileSystem should implement deleteDir\n }\n }\n }\n \n updateProgress(\"Build completed!\")\n}\n\n","import {Map} from \"ol\";\nimport {GsOlControl, GsOlOverlay} from \"./gs-gs2ol\";\nimport {render as litRender} from \"@eclipse-lyra/core/externals/lit\";\n\nexport class GsOlAdapter<T extends GsOlControl | GsOlOverlay> {\n protected map: Map;\n protected olObject: T;\n\n private templateFunction?: Function;\n protected retargetSelector?: string;\n\n constructor(olObject: T) {\n this.map = olObject.getMap()!\n this.olObject = olObject\n }\n\n public getMap(): any {\n return this.map;\n }\n\n public getElement() {\n return this.olObject.getElement();\n }\n\n public render(strings?: TemplateStringsArray | Function) {\n if (strings === undefined && this.templateFunction) {\n strings = this.templateFunction()\n } else if (strings instanceof Function) {\n this.templateFunction = strings as Function\n strings = this.templateFunction()\n }\n if (strings) {\n litRender(strings, this.getElement())\n }\n }\n\n protected onRendered() {\n }\n\n public style(styleJson: any) {\n const style = this.getElement().style\n for (const property in styleJson) {\n const value = styleJson[property]\n style.setProperty(property, value);\n }\n }\n}\n\nexport class GsControlAdapter extends GsOlAdapter<GsOlControl> {\n public style(styleJson: any) {\n super.style(styleJson)\n\n if (\"--gs-contribution\" in styleJson) {\n this.retargetSelector = styleJson[\"--gs-contribution\"]\n }\n }\n\n public rendered() {\n if (this.retargetSelector) {\n const [parentPath, queryString] = this.retargetSelector.split(\"?\");\n const parent = this.map.getTargetElement().querySelector(parentPath) as HTMLElement\n if (parent) {\n const element = this.olObject.getElement()\n if (queryString) {\n const params = new URLSearchParams(queryString);\n const sibling = parent.querySelector(`[name='${params.get(\"before\")}']`) as HTMLElement\n if (sibling) {\n parent.insertBefore(element, sibling)\n }\n } else {\n parent.appendChild(element)\n }\n this.olObject.setTarget(element);\n this.render()\n }\n }\n }\n}\n\nexport class GsOverlayAdapter extends GsOlAdapter<GsOlOverlay> {\n public show(coords: number[]) {\n this.getElement().style.display = \"block\"\n this.olObject.setPosition(coords)\n }\n\n public hide() {\n this.getElement().style.display = \"none\"\n }\n}","import {\n DEFAULT_GSMAP,\n GsControl,\n GsFeature,\n GsFillStyle,\n GsGeometry,\n GsIcon,\n GsImageStyle,\n GsLayer,\n GsLayerType,\n GsMap,\n GsOverlay,\n GsScriptedVectorLayer,\n GsSource,\n GsSourceType,\n GsState,\n GsStrokeStyle,\n GsStyle,\n GsTextStyle,\n KEY_ENV,\n KEY_EVENT_SUBSCRIPTIONS,\n KEY_FORMAT,\n KEY_GS_MANAGED,\n KEY_LABEL,\n KEY_NAME,\n KEY_SOURCETYPE,\n KEY_SRC,\n KEY_STATE,\n KEY_UUID,\n KEY_URL\n} from \"../gs-model\";\nimport { scriptedRuntimeRegistry, type ScriptedVars } from \"../scripted-runtime-registry\";\nimport {Feature, Map, Overlay, View} from \"ol\";\nimport {MapOptions} from \"ol/Map\";\nimport BaseObject from \"ol/Object\";\nimport * as olGeom from \"ol/geom\";\nimport {Circle as CircleStyle, Fill, Icon, RegularShape, Stroke, Style, Text} from \"ol/style\";\nimport {GeoTIFF, OSM, Source, TileWMS, WMTS, XYZ} from \"ol/source\";\nimport {optionsFromCapabilities} from \"ol/source/WMTS\";\nimport FeatureFormat from \"ol/format/Feature\";\nimport WMTSCapabilities from \"ol/format/WMTSCapabilities\";\nimport VectorSource from \"ol/source/Vector\";\nimport {bbox} from \"ol/loadingstrategy\";\nimport {transformExtent} from \"ol/proj\";\nimport {GeoJSON, GPX} from \"ol/format\";\nimport TileLayer from \"ol/layer/Tile\";\nimport TileSource from \"ol/source/Tile\";\nimport VectorLayer from \"ol/layer/Vector\";\nimport BaseLayer from \"ol/layer/Base\";\nimport {apply as applyMapboxStyle} from \"ol-mapbox-style\";\nimport LayerGroup from \"ol/layer/Group\";\nimport {Control} from \"ol/control\";\nimport * as ol from \"./gs-olns\"\nimport {lit} from \"../gs-litns\";\nimport {v4 as uuidv4} from '@eclipse-lyra/core/externals/third-party'\nimport {subscribe, publish, unsubscribe} from '@eclipse-lyra/core/core/events'\nimport {GsControlAdapter, GsOverlayAdapter} from \"./gs-ol-adapters\";\nimport {rtUtils} from \"../index\";\nimport Layer from \"ol/layer/Layer\";\n\nconst withState = <T extends BaseObject>(state: GsState, olObject: T): T => {\n if (state.uuid) {\n olObject.set(KEY_UUID, state.uuid)\n }\n if (state.state) {\n // add as properties for easy access via get(...)\n for (let stateKey in state.state) {\n olObject.set(stateKey, state.state[stateKey])\n }\n // add states as object as it is not possible to differentiate own state keys from OL keys\n olObject.set(KEY_STATE, state.state)\n }\n return olObject\n}\n\nexport const toOLGeometry = (geometry: GsGeometry) => {\n return withState(geometry, new olGeom[geometry.type](geometry.coordinates));\n}\n\nexport const toOlResource = (resource: GsIcon) => {\n return new Icon({\n src: resource.src\n })\n}\n\nexport const toOlStroke = (gsStroke: GsStrokeStyle): Stroke => {\n return new Stroke({\n color: gsStroke.color,\n width: gsStroke.width,\n lineDash: gsStroke.lineDash,\n lineCap: gsStroke.lineCap,\n lineJoin: gsStroke.lineJoin,\n miterLimit: gsStroke.miterLimit\n })\n}\n\nexport const toOlFill = (gsFill: GsFillStyle): Fill => {\n return new Fill({\n color: gsFill.color\n })\n}\n\nexport const toOlCircleImage = (gsImage: GsImageStyle): CircleStyle => {\n return new CircleStyle({\n radius: gsImage.radius || 5,\n fill: gsImage.fill ? toOlFill(gsImage.fill) : undefined,\n stroke: gsImage.stroke ? toOlStroke(gsImage.stroke) : undefined,\n displacement: gsImage.displacement,\n scale: gsImage.scale,\n rotation: gsImage.rotation,\n rotateWithView: gsImage.rotateWithView,\n declutterMode: undefined\n })\n}\n\nexport const toOlIconImage = (gsImage: GsImageStyle): Icon => {\n if (!gsImage.src) {\n throw new Error('Icon image requires src property')\n }\n return new Icon({\n src: gsImage.src,\n anchor: gsImage.anchor || [0.5, 1],\n anchorXUnits: gsImage.anchorXUnits || 'fraction',\n anchorYUnits: gsImage.anchorYUnits || 'fraction',\n anchorOrigin: gsImage.anchorOrigin,\n scale: gsImage.scale || 1,\n opacity: gsImage.opacity,\n rotation: gsImage.rotation,\n rotateWithView: gsImage.rotateWithView,\n displacement: gsImage.displacement,\n offset: gsImage.offset,\n offsetOrigin: gsImage.offsetOrigin,\n size: gsImage.size,\n color: gsImage.color,\n crossOrigin: gsImage.crossOrigin,\n declutterMode: undefined\n })\n}\n\nexport const toOlRegularShapeImage = (gsImage: GsImageStyle): RegularShape => {\n return new RegularShape({\n points: gsImage.points || 3,\n radius: gsImage.radius || gsImage.radius1 || 5,\n radius2: gsImage.radius2,\n angle: gsImage.angle || 0,\n displacement: gsImage.displacement,\n fill: gsImage.fill ? toOlFill(gsImage.fill) : undefined,\n stroke: gsImage.stroke ? toOlStroke(gsImage.stroke) : undefined,\n rotation: gsImage.rotation,\n rotateWithView: gsImage.rotateWithView,\n scale: gsImage.scale,\n declutterMode: undefined\n })\n}\n\nexport const toOlImage = (gsImage: GsImageStyle): CircleStyle | Icon | RegularShape => {\n switch (gsImage.type) {\n case 'circle':\n return toOlCircleImage(gsImage)\n case 'icon':\n return toOlIconImage(gsImage)\n case 'regular-shape':\n return toOlRegularShapeImage(gsImage)\n default:\n throw new Error(`Unknown image type: ${gsImage.type}`)\n }\n}\n\nexport const toOlText = (gsText: GsTextStyle): Text => {\n return new Text({\n text: gsText.text,\n font: gsText.font,\n maxAngle: gsText.maxAngle,\n offsetX: gsText.offsetX,\n offsetY: gsText.offsetY,\n overflow: gsText.overflow,\n placement: gsText.placement,\n repeat: gsText.repeat,\n scale: gsText.scale,\n rotateWithView: gsText.rotateWithView,\n rotation: gsText.rotation,\n textAlign: gsText.textAlign,\n justify: gsText.justify,\n textBaseline: gsText.textBaseline,\n fill: gsText.fill ? toOlFill(gsText.fill) : undefined,\n stroke: gsText.stroke ? toOlStroke(gsText.stroke) : undefined,\n backgroundFill: gsText.backgroundFill ? toOlFill(gsText.backgroundFill) : undefined,\n backgroundStroke: gsText.backgroundStroke ? toOlStroke(gsText.backgroundStroke) : undefined,\n padding: gsText.padding,\n declutterMode: undefined\n })\n}\n\nexport const toOlStyle = (gsStyle: GsStyle): Style => {\n const styleOptions: any = {}\n \n if (gsStyle.stroke) {\n styleOptions.stroke = toOlStroke(gsStyle.stroke)\n }\n \n if (gsStyle.fill) {\n styleOptions.fill = toOlFill(gsStyle.fill)\n }\n \n if (gsStyle.image) {\n styleOptions.image = toOlImage(gsStyle.image)\n }\n \n if (gsStyle.text) {\n styleOptions.text = toOlText(gsStyle.text)\n }\n \n if (gsStyle.zIndex !== undefined) {\n styleOptions.zIndex = gsStyle.zIndex\n }\n \n return new Style(styleOptions)\n}\n\nexport const toOlFeature = (feature: GsFeature): Feature => {\n return withState(feature, new Feature({\n geometry: toOLGeometry(feature.geometry),\n }))\n}\n\nexport const OL_SOURCES: any = {}\nOL_SOURCES[GsSourceType.OSM] = (source: GsSource) => {\n const olSource = new OSM();\n olSource.set(KEY_LABEL, source.type)\n return olSource\n}\nOL_SOURCES[GsSourceType.XYZ] = (source: GsSource) => {\n const olSource = new XYZ({\n url: source.url!,\n crossOrigin: 'anonymous'\n });\n olSource.set(KEY_URL, source.url!)\n olSource.set(KEY_LABEL, `${source.type}@${source.url}`)\n return olSource\n}\nOL_SOURCES[GsSourceType.WMS] = (source: GsSource) => {\n const olSource = new TileWMS({\n url: source.url!,\n params: {\n 'LAYERS': '', // Will be overridden by source.state\n ...source.state || {}\n },\n crossOrigin: 'anonymous' // Required for COEP, same as OSM default\n })\n olSource.set(KEY_URL, source.url!)\n olSource.set(KEY_LABEL, `${source.type}@${source.url}`)\n return olSource\n}\nOL_SOURCES[GsSourceType.WMTS] = (source: GsSource, olLayer?: Layer) => {\n const state = source.state || {}\n const parser = new WMTSCapabilities()\n \n // Create a minimal placeholder source\n const olSource = new WMTS({\n url: source.url!,\n layer: state['LAYER'] || '',\n matrixSet: state['MATRIXSET'] || 'GLOBAL_WEBMERCATOR',\n style: state['STYLE'] || 'default',\n crossOrigin: 'anonymous'\n } as any)\n\n // Fetch and parse capabilities, then replace the source on the layer\n fetch(source.url!)\n .then(response => response.text())\n .then(text => {\n const result = parser.read(text)\n const options = optionsFromCapabilities(result, {\n layer: state['LAYER'] || '',\n matrixSet: state['MATRIXSET'] || 'GLOBAL_WEBMERCATOR',\n })\n \n if (options) {\n // Create a new WMTS source with proper options\n const newSource = new WMTS({\n ...options,\n crossOrigin: 'anonymous'\n })\n newSource.set(KEY_URL, source.url!)\n newSource.set(KEY_LABEL, `${source.type}@${source.url}`)\n \n // Replace the source on the layer\n if (olLayer && olLayer.setSource) {\n olLayer.setSource(newSource)\n }\n }\n })\n .catch(error => {\n console.error('Failed to fetch WMTS capabilities:', error)\n })\n\n olSource.set(KEY_URL, source.url!)\n olSource.set(KEY_LABEL, `${source.type}@${source.url}`)\n return olSource\n}\n\nconst formatSource = (source: GsSource, format: FeatureFormat): Source => {\n const olSource = new VectorSource({\n format: format,\n url: source.url!\n })\n\n olSource.set(KEY_FORMAT, source.type)\n olSource.set(KEY_URL, source.url!)\n olSource.set(KEY_LABEL, `${source.type}@${source.url}`)\n return olSource\n}\n\nOL_SOURCES[GsSourceType.GeoJSON] = (source: GsSource) => {\n return formatSource(source, new GeoJSON())\n}\nOL_SOURCES[GsSourceType.GPX] = (source: GsSource) => {\n return formatSource(source, new GPX())\n}\nOL_SOURCES[GsSourceType.GeoTIFF] = (source: GsSource) => {\n const olSource = new GeoTIFF({\n sources: [\n {\n url: source.url!\n }\n ]\n })\n\n olSource.set(KEY_URL, source.url!)\n olSource.set(KEY_LABEL, `${source.type}@${source.url}`)\n return olSource\n}\nOL_SOURCES[GsSourceType.Features] = (source: GsSource) => {\n const features = (source.features || [])\n .map(feature => toOlFeature(feature))!\n const olSource = new VectorSource({\n features: features\n })\n olSource.set(KEY_LABEL, source.type)\n return olSource\n}\n\nexport const toOlSource = (source: GsSource, olLayer?: TileLayer<TileSource>) => {\n return withState(source, OL_SOURCES[source.type](source, olLayer))\n}\n\nexport const resolveScriptLang = (src: string, lang?: string): string => {\n if (lang) return lang\n const ext = src.split('?')[0].split('.').pop()?.toLowerCase() ?? ''\n if (ext === 'py') return 'python'\n return 'javascript'\n}\n\nexport const OL_LAYERS: any = {}\nOL_LAYERS[GsLayerType.TILE] = (layer: GsLayer) => {\n const tileLayer = new TileLayer()\n const source = toOlSource(layer.source, tileLayer) as TileSource\n tileLayer.setSource(source)\n return tileLayer\n}\nOL_LAYERS[GsLayerType.VECTOR] = (layer: GsLayer) => {\n return new VectorLayer({\n source: toOlSource(layer.source) as VectorSource,\n });\n}\nOL_LAYERS[GsLayerType.GROUP] = (layer: GsLayer) => {\n const group = new LayerGroup();\n group.set(KEY_URL, layer.source.url)\n group.set(KEY_SOURCETYPE, layer.source.type)\n applyMapboxStyle(group, layer.source.url).then()\n return group\n}\nOL_LAYERS[GsLayerType.SCRIPTED] = (layer: GsScriptedVectorLayer, env: any) => {\n const src = layer.source.url!\n const lang = resolveScriptLang(src, layer.lang)\n const runtime = scriptedRuntimeRegistry.get(lang)\n if (!runtime) throw new Error(`No scripted runtime registered for lang \"${lang}\"`)\n\n let olVectorLayer: VectorLayer<VectorSource>\n const source = new VectorSource({\n loader: async (extent, resolution, projection, success, failure) => {\n const view = olVectorLayer?.getMapInternal()?.getView()\n const vars: ScriptedVars = {\n params: layer.params ?? {},\n env: env ?? {},\n viewState: {\n extent: transformExtent(extent, projection, 'EPSG:4326'),\n zoom: view?.getZoomForResolution(resolution) ?? 0,\n projection: 'EPSG:4326',\n },\n }\n try {\n const result = await runtime.run(src, vars)\n const format = new GeoJSON()\n source.clear()\n const allFeatures: any[] = []\n const readBatch = (data: any) => {\n const features = format.readFeatures(data, {\n dataProjection: 'EPSG:4326',\n featureProjection: projection,\n })\n source.addFeatures(features)\n allFeatures.push(...features)\n }\n if (result && typeof (result as any)[Symbol.asyncIterator] === 'function') {\n for await (const batch of result as AsyncIterable<any>) {\n readBatch(batch)\n }\n } else {\n readBatch(result)\n }\n success!(allFeatures)\n } catch (e) {\n console.error('Scripted layer error:', e)\n failure!()\n }\n },\n strategy: bbox,\n })\n\n olVectorLayer = new VectorLayer({ source })\n return olVectorLayer\n}\n\nexport const toOlLayer = (layer: GsLayer, env?: any) => {\n const olLayer: BaseLayer = withState(layer, OL_LAYERS[layer.type](layer, env))\n olLayer.set(KEY_LABEL, layer.type)\n olLayer.set(KEY_NAME, layer.name)\n olLayer.set(KEY_GS_MANAGED, true)\n olLayer.setVisible(layer.visible ?? true)\n return olLayer\n}\n\nexport class GsOlControl extends Control {\n constructor(options?: any) {\n const element = document.createElement('div');\n element.style.margin = \"0\"\n element.style.padding = \"0\"\n super({\n ...options,\n element: element,\n });\n }\n\n public getElement() {\n return this.element;\n }\n}\n\nexport class GsOlOverlay extends Overlay {\n constructor(options?: any) {\n const element = document.createElement('div');\n element.style.margin = \"0\"\n element.style.padding = \"0\"\n super({\n ...options\n });\n }\n\n public getElement() {\n return this.element;\n }\n}\n\nexport const toOlOverlay = (overlay: GsOverlay) => {\n const olOverlay = withState(overlay, new GsOlOverlay({\n positioning: overlay.position,\n stopEvent: true\n }))\n olOverlay.set(KEY_SRC, overlay.src)\n return olOverlay\n}\n\nexport const toOlControl = (control: GsControl) => {\n const olControl = withState(control, new GsOlControl())\n olControl.set(KEY_SRC, control.src)\n return olControl\n}\n\nconst importSrc = async (adapter: GsControlAdapter | GsOverlayAdapter, src: string, importer?: Importer) => {\n const olMap = adapter.getMap()!;\n return (importer || DefaultImporter)(src).then((mod) => {\n const init = () => {\n olMap.removeEventListener(\"rendercomplete\", init)\n const vars: any = {\n // backward compatibility\n ...lit,\n // forward compatibility\n lit: lit,\n style: adapter.style.bind(adapter),\n render: adapter.render.bind(adapter),\n map: olMap,\n element: adapter.getElement(),\n querySelector: adapter.getElement().querySelector.bind(adapter.getElement()),\n querySelectorAll: adapter.getElement().querySelector.bind(adapter.getElement()),\n ol: ol,\n env: olMap.get(KEY_ENV) || {},\n utils: {\n uuid: uuidv4\n },\n asset: (path: string) => {\n return rtUtils.resolveUrl(`assets/${path}`)\n },\n signal: (_name: string) => {\n },\n events: (topic: string, callback: Function | any) => {\n if (callback instanceof Function) {\n const token = subscribe(topic, callback);\n let subscriptions = olMap.get(KEY_EVENT_SUBSCRIPTIONS) as string[] | undefined;\n if (!subscriptions) {\n subscriptions = [];\n olMap.set(KEY_EVENT_SUBSCRIPTIONS, subscriptions);\n }\n subscriptions.push(token);\n return token;\n } else {\n return publish(topic, callback);\n }\n },\n settings: (key: string, callback?: Function | any) => {\n const mapUuid = olMap.get(KEY_UUID) as string | undefined;\n const storageKey = mapUuid ? `gs-settings-${mapUuid}` : 'gs-settings';\n \n const loadSettings = (): any => {\n try {\n const stored = localStorage.getItem(storageKey);\n return stored ? JSON.parse(stored) : {};\n } catch {\n return {};\n }\n };\n \n const saveSettings = (settings: any): void => {\n try {\n localStorage.setItem(storageKey, JSON.stringify(settings));\n } catch (error) {\n console.error('Failed to save settings to localStorage:', error);\n }\n };\n \n const settings = loadSettings();\n \n // if no callback, assume caller wants the key value\n if (callback === undefined) {\n return settings[key];\n }\n // if a function, register as event topic, call it with current value, and return value\n if (callback instanceof Function) {\n vars.events(key, callback);\n callback(settings[key]);\n return settings[key];\n }\n settings[key] = callback;\n saveSettings(settings);\n // publish as event to inform settings listeners\n return publish(key, callback);\n }\n }\n const objectType = adapter instanceof GsControlAdapter ? \"control\" : \"overlay\"\n vars[objectType] = adapter\n \n const templateFunction = mod instanceof Function ? mod : mod.default\n if (templateFunction) {\n vars.state = <T>(initialValue: T) => {\n const createReactiveProperty = (target: any, key: string, getValue: () => any, setValue: (v: any) => void) => {\n Object.defineProperty(target, key, {\n get() {\n return getValue();\n },\n set(newValue: any) {\n const oldValue = getValue();\n if (oldValue !== newValue) {\n setValue(newValue);\n adapter.render();\n }\n },\n enumerable: true,\n configurable: true\n });\n };\n \n if (typeof initialValue === 'object' && initialValue !== null && !Array.isArray(initialValue)) {\n const values: any = { ...initialValue };\n \n return new Proxy({} as any, {\n get(_target, prop: string) {\n return values[prop];\n },\n set(_target, prop: string, newValue: any) {\n if (values[prop] !== newValue) {\n values[prop] = newValue;\n adapter.render();\n }\n return true;\n },\n has(_target, prop: string) {\n return prop in values;\n },\n ownKeys(_target) {\n return Object.keys(values);\n },\n getOwnPropertyDescriptor(_target, prop: string) {\n if (prop in values) {\n return {\n enumerable: true,\n configurable: true,\n value: values[prop]\n };\n }\n return undefined;\n }\n });\n } else {\n const stateObj: any = {};\n let value = initialValue;\n createReactiveProperty(\n stateObj,\n 'value',\n () => value,\n (v) => { value = v; }\n );\n return stateObj;\n }\n };\n \n const component = templateFunction(vars)\n \n if (component instanceof Function) {\n adapter.render(component);\n } else {\n adapter.render(component)\n }\n }\n if (adapter instanceof GsControlAdapter) {\n adapter.rendered()\n }\n olMap.render()\n }\n olMap.on(\"rendercomplete\", init)\n })\n}\n\nexport const importOverlaySource = async (olOverlay: GsOlOverlay, src: string, importer?: Importer) => {\n const overlayAdapter = new GsOverlayAdapter(olOverlay)\n return importSrc(overlayAdapter, src, importer)\n}\n\nexport const importControlSource = async (olControl: GsOlControl, src: string, importer?: Importer) => {\n const controlAdapter = new GsControlAdapter(olControl)\n return importSrc(controlAdapter, src, importer)\n}\n\nexport type Importer = (src: string) => Promise<any>\nexport const DefaultImporter: Importer = (src: string) => import(src)\n\nexport const cleanupEventSubscriptions = (olMap: Map): void => {\n const subscriptions = olMap.get(KEY_EVENT_SUBSCRIPTIONS) as string[] | undefined;\n if (subscriptions) {\n subscriptions.forEach(token => unsubscribe(token));\n olMap.set(KEY_EVENT_SUBSCRIPTIONS, []);\n }\n}\n\nexport const toOlMap = async (gsMap: GsMap, options?: MapOptions, env?: any, importer?: Importer, target?: HTMLElement) => {\n const olMap = withState(gsMap, new Map(options));\n olMap.set(KEY_ENV, env)\n olMap.setView(new View({\n center: gsMap.view.center && gsMap.view.center.length == 2 ? gsMap.view.center : DEFAULT_GSMAP.view.center,\n zoom: gsMap.view.zoom || DEFAULT_GSMAP.view.zoom,\n projection: gsMap.view.projection || DEFAULT_GSMAP.view.projection\n }))\n for (const layer of gsMap.layers || []) {\n const olLayer = toOlLayer(layer, env)\n olMap.addLayer(olLayer)\n }\n\n // Attach map to DOM early so it renders immediately\n // This prevents blank screens when user modules request permissions (e.g., geolocation)\n if (target) {\n olMap.setTarget(target)\n }\n\n for (const overlay of gsMap.overlays || []) {\n const olOverlay = toOlOverlay(overlay)\n olMap.addOverlay(olOverlay)\n await importOverlaySource(olOverlay, overlay.src, importer)\n }\n\n for (const control of gsMap.controls || []) {\n const olControl = toOlControl(control)\n olMap.addControl(olControl)\n await importControlSource(olControl, control.src, importer)\n }\n\n return olMap\n}","import {Feature} from \"ol\";\nimport * as olGeom from \"ol/geom\";\nimport {\n GsFeature,\n GsGeometry,\n GsLayerType,\n GsSourceType,\n GsState,\n KEY_STATE,\n KEY_UUID\n} from \"../gs-model\";\nimport BaseObject from \"ol/Object\";\n\nexport const toGsLayerType = (tag: string) => {\n switch (tag?.toLowerCase()) {\n case \"osm\":\n case \"bing\":\n case \"google\":\n case \"geotiff\":\n case \"wms\":\n case \"wmts\":\n case \"xyz\":\n return GsLayerType.TILE\n case \"bm\":\n case \"basemap.de\":\n return GsLayerType.GROUP\n case \"scripted\":\n return GsLayerType.SCRIPTED\n default:\n return GsLayerType.VECTOR\n }\n}\n\nexport const toGsSourceType = (tag: string) => {\n if (tag) {\n tag = tag.toLowerCase()\n const sourceTypes = Object.values(GsSourceType)\n const hit = sourceTypes.find(t => tag === t.toLowerCase())\n if (hit) {\n return hit\n }\n }\n throw new Error(\"Unsupported source type: \" + tag)\n}\n\nexport const toSourceUrl = (sourceType: GsSourceType) => {\n switch (sourceType) {\n case GsSourceType.BM:\n return \"https://sgx.geodatenzentrum.de/gdz_basemapworld_vektor/styles/bm_web_wld_col.json\"\n }\n return undefined\n}\n\nconst withGsState = <T extends GsState>(olObj: BaseObject, gsState: T): T => {\n // Get state first (contains original domain model data including UUID)\n const state = olObj.get(KEY_STATE)\n gsState.state = state\n \n // Preserve UUID if it exists (from domain model or previously assigned)\n // Priority: 1) UUID from state (original from domain model), 2) KEY_UUID (synced during conversion)\n // Do NOT generate UUIDs here - external features or unmanaged features should remain without UUIDs\n if (state?.uuid) {\n gsState.uuid = state.uuid\n } else {\n const uuid = olObj.get(KEY_UUID)\n if (uuid) {\n gsState.uuid = uuid\n }\n // If no UUID exists, leave it undefined (feature is external/unmanaged)\n }\n \n return gsState\n}\n\nexport function toGsGeometry(geometry: olGeom.SimpleGeometry): GsGeometry {\n return withGsState(geometry, {\n type: geometry.getType(),\n coordinates: geometry.getCoordinates()\n } as GsGeometry)\n}\n\nexport function toGsFeature(feature: Feature) {\n return withGsState(feature, {\n geometry: toGsGeometry(feature.getGeometry() as olGeom.SimpleGeometry)\n } as GsFeature)\n}\n\n\n","import {toOlMap, Importer} from \"./gs-gs2ol\";\nimport {GsMap} from \"../gs-model\";\nimport \"ol/ol.css\";\nimport {defaultControls, defaultInteractions} from \"./gs-olns\";\n// Note: WebAwesome is imported via gs-litns (which is imported by gs-gs2ol), so it's available to user modules\n\nexport * from \"../gs-model\";\nexport * from \"./gs-gs2ol\";\n\nexport interface GsAppOptions {\n containerSelector: string | HTMLElement,\n gsMap: GsMap,\n env?: any,\n modules?: any,\n importer?: Importer,\n mapOptions?: {\n controls: any\n }\n}\n\nexport const olLib = async (options: GsAppOptions) => {\n const mapOptions = {\n interactions: defaultInteractions({keyboard: false}),\n controls: defaultControls(options.mapOptions?.controls)\n }\n \n let importer: Importer | undefined = options.importer;\n \n if (!importer && options.modules) {\n importer = async (src: string) => {\n const module = options.modules[src];\n if (module) {\n // If module is a string, it's a URL/identifier - import it\n if (typeof module === 'string') {\n return import(module);\n }\n // If module is already an object, it's the imported module - return it directly\n return module;\n }\n throw new Error(`Module not found: ${src}`);\n };\n }\n \n // Handle both string selector and DOM element\n const target = typeof options.containerSelector === 'string' \n ? document.querySelector(options.containerSelector)! as HTMLElement\n : options.containerSelector;\n \n // Create map and attach to DOM first to ensure immediate rendering\n // Controls and overlays are loaded after the map is visible\n const olMap = await toOlMap(options.gsMap, mapOptions, options.env, importer, target)\n \n return olMap\n}\n\n","import { MapOperations, MapRenderer, MapSyncEvent, ScreenshotResult } from \"../map-renderer\";\nimport {\n GsMap,\n GsSourceType,\n KEY_NAME,\n KEY_STATE,\n KEY_UUID,\n GsFeature,\n GsGeometry,\n ensureUuid,\n getStyleForFeature\n} from \"../gs-model\";\nimport { toOlLayer, cleanupEventSubscriptions, toOlStyle } from \"./gs-gs2ol\";\nimport { toGsFeature } from \"./gs-ol2gs\";\nimport { olLib } from \"./gs-ol-lib\";\nimport { v4 as uuidv4 } from 'uuid';\nimport {\n Map as OlMap,\n Feature,\n style,\n sphere,\n geom,\n layer as layerNS,\n source as sourceNS,\n interaction as interactionNS,\n FeatureLike,\n eventsCondition,\n BaseLayer,\n proj\n} from \"./gs-olns\";\n\n/**\n * Lightweight helper to extract minimal GsFeature data for style evaluation\n * Avoids the overhead of full toGsFeature() conversion\n */\nfunction getFeatureStyleData(feature: Feature): GsFeature {\n const geometry = feature.getGeometry() as geom.Geometry;\n return ensureUuid({\n geometry: ensureUuid({\n type: geometry.getType(),\n coordinates: [] // Not needed for style rules\n } as GsGeometry),\n state: feature.get(KEY_STATE)\n } as GsFeature);\n}\n\n/**\n * OpenLayers map renderer that manages OpenLayers maps\n * Provides complete isolation between the host app and the rendering engine\n * User modules are handled by the toOlMap() function\n */\nexport class OpenLayersMapRenderer implements MapRenderer {\n public olMap?: OlMap; // Made public for backward compatibility\n gsMap: GsMap;\n private env?: any;\n private onDirtyCallback?: () => void;\n private onSyncCallback?: (event: MapSyncEvent) => void;\n private isDestroyed: boolean = false;\n private operations?: OpenLayersMapOperations;\n private styleCache: Map<string, style.Style> = new Map();\n\n constructor(gsMap: GsMap, env?: any) {\n this.gsMap = gsMap;\n this.env = env;\n }\n\n async reattached(): Promise<void> {\n // OpenLayers doesn't need special handling for reattachment\n // The map stays attached to its container element\n }\n\n async render(container: string | HTMLElement): Promise<void> {\n try {\n // Use the runtime library to render the map\n this.olMap = await olLib({\n containerSelector: container,\n gsMap: this.gsMap,\n env: this.env,\n mapOptions: {\n controls: { zoom: false, attribution: false }\n }\n });\n \n // Create operations after map is available\n this.operations = new OpenLayersMapOperations(this.olMap, this);\n \n // Apply styling to all vector layers\n this.applyStylesToLayers();\n \n // Set up event listeners after the map is rendered\n this.olMap.once('rendercomplete', () => {\n this.setupEventListeners();\n });\n \n } catch (error) {\n console.error('Failed to render map:', error);\n throw error;\n }\n }\n \n private applyStylesToLayers(): void {\n if (!this.olMap) return;\n \n const layers = this.olMap.getLayers().getArray();\n layers.forEach(layer => {\n if (layer instanceof layerNS.Vector) {\n this.applyStyleToVectorLayer(layer);\n }\n });\n }\n \n private applyStyleToVectorLayer(layer: layerNS.Vector): void {\n const layerName = layer.get(KEY_NAME);\n \n // Create a style function that applies rules to each feature\n const styleFunction = (feature: FeatureLike) => {\n // Only process actual Feature objects (not RenderFeature)\n if (!(feature instanceof Feature)) {\n return undefined;\n }\n \n // Extract minimal data needed for style evaluation (lightweight, no coordinate conversion)\n const featureStyleData = getFeatureStyleData(feature);\n const styleRules = this.gsMap.styleRules;\n const stylesMap = this.gsMap.styles;\n \n if (styleRules && stylesMap) {\n const gsStyle = getStyleForFeature(featureStyleData, styleRules, stylesMap, layerName);\n if (gsStyle && gsStyle.id) {\n // Check cache first\n let olStyle = this.styleCache.get(gsStyle.id);\n if (!olStyle) {\n // Convert and cache\n olStyle = toOlStyle(gsStyle);\n this.styleCache.set(gsStyle.id, olStyle);\n }\n return olStyle;\n } else if (gsStyle) {\n // Style without ID - can't cache, convert directly\n return toOlStyle(gsStyle);\n }\n }\n \n // Return undefined to use default OpenLayers styling\n return undefined;\n };\n \n layer.setStyle(styleFunction);\n }\n \n private clearStyleCache(): void {\n this.styleCache.clear();\n }\n \n async modelToUI(updatedGsMap?: GsMap): Promise<void> {\n if (!this.olMap) {\n throw new Error('Map not initialized');\n }\n \n // Update the gsMap if provided\n if (updatedGsMap) {\n this.gsMap = updatedGsMap;\n }\n \n // Clear style cache when model changes (styles/rules may have changed)\n this.clearStyleCache();\n \n // Get the container before destroying the map\n const target = this.olMap.getTarget();\n if (!target || typeof target === 'string') {\n throw new Error('Map container not found or invalid');\n }\n\n this.destroy();\n\n // Clear the DOM container\n target.innerHTML = '';\n\n this.isDestroyed = false;\n await this.render(target);\n }\n \n\n getOperations(): MapOperations {\n if (!this.operations) {\n throw new Error(\"Operations not available - map not rendered yet\");\n }\n return this.operations;\n }\n\n async getViewExtent(): Promise<number[]> {\n console.debug(\"Getting view extent\");\n if (!this.olMap) {\n throw new Error(\"Map not available for extent calculation\");\n }\n\n const view = this.olMap.getView();\n const extent = view.calculateExtent();\n console.debug(`View extent: ${extent}`);\n return extent;\n }\n\n async captureScreenshot(): Promise<ScreenshotResult> {\n if (!this.olMap) {\n return { success: false, error: 'Map not available' };\n }\n\n const olMap = this.olMap;\n\n // Wait for the map to finish rendering\n await new Promise<void>((resolve) => {\n olMap.renderSync();\n olMap.once('rendercomplete', () => resolve());\n // Fallback timeout in case rendercomplete doesn't fire\n setTimeout(() => resolve(), 2000);\n });\n\n const size = olMap.getSize();\n const width = size ? size[0] : olMap.getViewport().clientWidth;\n const height = size ? size[1] : olMap.getViewport().clientHeight;\n\n try {\n const canvas = olMap.getViewport().querySelector('canvas');\n if (!canvas) {\n return { success: false, error: 'Map canvas not found' };\n }\n\n const dataUrl = canvas.toDataURL('image/png');\n return { success: true, dataUrl, width, height };\n } catch (error: any) {\n return { success: false, error: `Failed to capture canvas: ${error.message}` };\n }\n }\n\n setOnDirty(callback: () => void): void {\n this.onDirtyCallback = callback;\n }\n\n setOnSync(callback: (event: MapSyncEvent) => void): void {\n this.onSyncCallback = callback;\n }\n\n triggerDirty(): void {\n if (this.isDestroyed || !this.onDirtyCallback) return;\n this.onDirtyCallback();\n }\n\n triggerSync(event: MapSyncEvent): void {\n if (this.isDestroyed || !this.onSyncCallback) return;\n this.onSyncCallback(event);\n }\n\n private syncViewToModel(): void {\n if (!this.olMap) return;\n\n const view = this.olMap.getView();\n const center = view.getCenter();\n const zoom = view.getZoom();\n const rotation = view.getRotation();\n\n // Notify host with specific view change event\n if (center && zoom !== undefined) {\n this.triggerSync({\n type: 'viewChanged',\n view: { center: center as [number, number], zoom, rotation }\n });\n }\n }\n\n public syncLayerFeaturesToModel(layerUuid: string): void {\n if (!this.olMap) return;\n\n const layers = this.olMap.getLayers();\n let olLayer: BaseLayer | undefined;\n for (let i = 0; i < layers.getLength(); i++) {\n const layer = layers.item(i);\n if (layer.get(KEY_UUID) === layerUuid) {\n olLayer = layer;\n break;\n }\n }\n \n if (!olLayer || !(olLayer instanceof layerNS.Vector)) return;\n\n const source = olLayer.getSource();\n if (!source) return;\n\n // Convert OpenLayers features back to GsFeatures\n const olFeatures = source.getFeatures();\n const gsFeatures = olFeatures.map((olFeature: Feature) => toGsFeature(olFeature));\n\n // Notify host with features change event\n this.triggerSync({\n type: 'featuresChanged',\n layerUuid,\n features: gsFeatures\n });\n }\n\n private setupEventListeners(): void {\n if (!this.olMap) return;\n\n // Sync view changes back to domain model before triggering dirty\n this.olMap.getView().on('change:center', () => {\n this.syncViewToModel();\n this.triggerDirty();\n });\n this.olMap.getView().on('change:resolution', () => {\n this.syncViewToModel();\n this.triggerDirty();\n });\n this.olMap.getView().on('change:rotation', () => {\n this.syncViewToModel();\n this.triggerDirty();\n });\n\n this.olMap.getLayers().on('add', () => this.triggerDirty());\n this.olMap.getLayers().on('remove', () => this.triggerDirty());\n\n this.olMap.getControls().on('add', () => this.triggerDirty());\n this.olMap.getControls().on('remove', () => this.triggerDirty());\n\n this.olMap.getOverlays().on('add', () => this.triggerDirty());\n this.olMap.getOverlays().on('remove', () => this.triggerDirty());\n }\n\n \n destroy(): void {\n this.isDestroyed = true;\n this.clearStyleCache();\n // Cleanup operations (removes keyboard listeners) before destroying map\n if (this.operations) {\n const ops = this.operations as any;\n if (ops.cleanup) {\n ops.cleanup();\n }\n }\n // Cleanup event subscriptions before disposing map\n if (this.olMap) {\n cleanupEventSubscriptions(this.olMap);\n }\n this.olMap?.dispose();\n this.olMap = undefined;\n }\n\n async transform(\n coord: [number, number],\n options?: { sourceProjection?: string; targetProjection?: string }\n ): Promise<[number, number]> {\n if (!this.olMap) {\n throw new Error(\"Map not available for coordinate transformation\");\n }\n\n const view = this.olMap.getView();\n const mapProj = view.getProjection()?.getCode() || \"EPSG:3857\";\n const source = options?.sourceProjection ?? mapProj;\n const target = options?.targetProjection ?? \"EPSG:4326\";\n\n if (source === target) {\n return coord;\n }\n\n const result = proj.transform(coord, source, target);\n return result as [number, number];\n }\n\n}\n\n/**\n * OpenLayers-specific map operations implementation\n */\nexport class OpenLayersMapOperations implements MapOperations {\n private drawInteraction?: interactionNS.Draw;\n private selectInteraction?: interactionNS.Select;\n private activeDrawingLayerUuid?: string;\n private keyDownListener?: (event: KeyboardEvent) => void;\n\n constructor(\n private olMap: OlMap,\n private renderer?: OpenLayersMapRenderer\n ) {\n if (!olMap) {\n throw new Error(\"OpenLayers map is required for operations\");\n }\n \n // Setup ESC key handler\n this.keyDownListener = (event: KeyboardEvent) => {\n if (event.key === 'Escape') {\n if (this.drawInteraction) {\n this.disableDrawing();\n this.renderer?.triggerSync({ type: 'drawingDisabled' } as any);\n }\n if (this.selectInteraction) {\n this.disableSelection();\n }\n }\n };\n \n const target = this.olMap.getTargetElement();\n if (target && target instanceof HTMLElement) {\n target.setAttribute('tabindex', '-1');\n target.addEventListener('keydown', this.keyDownListener);\n }\n }\n\n async setZoom(zoom: number): Promise<void> {\n this.olMap.getView().setZoom(zoom);\n }\n\n async setCenter(center: [number, number]): Promise<void> {\n this.olMap.getView().setCenter(center);\n }\n\n async switchColorMode(mode?: 'dark' | 'light'): Promise<void> {\n const olMap = this.olMap;\n let darkMode: boolean = olMap.get(\"darkmode\") ?? false;\n\n if (mode === 'dark') {\n darkMode = true;\n } else if (mode === 'light') {\n darkMode = false;\n } else {\n darkMode = !darkMode;\n }\n\n olMap.set(\"darkmode\", darkMode);\n\n const canvasElements = document.querySelectorAll('canvas');\n canvasElements.forEach(canvas => {\n canvas.style.filter = darkMode ? \"invert(100%)\" : \"\";\n });\n\n olMap.render();\n }\n\n async addLayer(layer: any, isBasemap?: boolean): Promise<void> {\n const olLayer = toOlLayer(layer);\n if (isBasemap) {\n this.olMap.getLayers().insertAt(0, olLayer);\n } else {\n this.olMap.getLayers().push(olLayer);\n }\n }\n\n async deleteLayer(uuid: string): Promise<void> {\n const layers = this.olMap.getLayers();\n for (let i = 0; i < layers.getLength(); i++) {\n const layer = layers.item(i);\n if (layer.get(KEY_UUID) === uuid) {\n layers.removeAt(i);\n return;\n }\n }\n }\n\n async renameLayer(uuid: string, newName: string): Promise<void> {\n const layers = this.olMap.getLayers();\n for (let i = 0; i < layers.getLength(); i++) {\n const layer = layers.item(i);\n if (layer.get(KEY_UUID) === uuid) {\n layer.set(KEY_NAME, newName);\n return;\n }\n }\n }\n\n async moveLayer(uuid: string, targetUuid?: string): Promise<void> {\n const layers = this.olMap.getLayers();\n let fromIndex = -1;\n let toIndex = -1;\n \n for (let i = 0; i < layers.getLength(); i++) {\n const layer = layers.item(i);\n if (layer.get(KEY_UUID) === uuid) {\n fromIndex = i;\n }\n if (targetUuid && layer.get(KEY_UUID) === targetUuid) {\n toIndex = i;\n }\n }\n \n if (fromIndex < 0) return;\n \n if (targetUuid) {\n if (toIndex < 0 || fromIndex === toIndex) return;\n } else {\n toIndex = fromIndex > 0 ? fromIndex - 1 : fromIndex + 1;\n }\n\n if (toIndex >= 0 && toIndex < layers.getLength() && fromIndex !== toIndex) {\n const layer = layers.item(fromIndex);\n layers.removeAt(fromIndex);\n layers.insertAt(toIndex, layer);\n }\n }\n\n async setLayerVisible(uuid: string, visible: boolean): Promise<void> {\n const layers = this.olMap.getLayers();\n for (let i = 0; i < layers.getLength(); i++) {\n const layer = layers.item(i);\n if (layer.get(KEY_UUID) === uuid) {\n layer.setVisible(visible);\n return;\n }\n }\n }\n\n async addControlFromModule(_src: string): Promise<void> {}\n async removeControl(_uuid: string): Promise<void> {}\n async addOverlayFromModule(_src: string, _position?: string): Promise<void> {}\n async removeOverlay(_uuid: string): Promise<void> {}\n\n private setCursor(cursor: string): void {\n const viewport = this.olMap.getViewport();\n if (viewport) {\n (viewport as HTMLElement).style.cursor = cursor;\n }\n }\n\n async enableDrawing(geometryType: 'Point' | 'LineString' | 'Polygon', layerUuid: string): Promise<void> {\n this.disableSelection();\n \n if (this.drawInteraction) {\n this.olMap.removeInteraction(this.drawInteraction);\n }\n \n this.activeDrawingLayerUuid = layerUuid;\n this.setCursor('crosshair');\n \n const layers = this.olMap.getLayers();\n let layer: BaseLayer | undefined;\n for (let i = 0; i < layers.getLength(); i++) {\n const l = layers.item(i);\n if (l.get(KEY_UUID) === layerUuid) {\n layer = l;\n break;\n }\n }\n \n if (!layer || !(layer instanceof layerNS.Vector)) {\n throw new Error('Drawing only supported on vector layers');\n }\n \n const source = layer.getSource();\n if (!source) {\n throw new Error('Layer has no source');\n }\n \n const layerSourceType = layer.get('sourceType');\n if (layerSourceType && layerSourceType !== GsSourceType.Features) {\n throw new Error('Drawing only supported on layers with in-memory features');\n }\n \n this.drawInteraction = new interactionNS.Draw({\n source: source,\n type: geometryType\n });\n \n const onFeatureAdded = (event: any) => {\n const feature = event.feature;\n if (feature && !feature.get(KEY_UUID)) {\n const uuid = uuidv4();\n feature.set(KEY_UUID, uuid);\n const state = feature.get(KEY_STATE) || {};\n state.uuid = uuid;\n feature.set(KEY_STATE, state);\n }\n \n if (this.renderer && this.activeDrawingLayerUuid) {\n this.renderer.syncLayerFeaturesToModel(this.activeDrawingLayerUuid);\n }\n this.renderer?.triggerDirty();\n };\n \n source.on('addfeature', onFeatureAdded);\n \n (this.drawInteraction as any)._featureAddedListener = onFeatureAdded;\n (this.drawInteraction as any)._sourceRef = source;\n \n this.olMap.addInteraction(this.drawInteraction);\n }\n\n async disableDrawing(): Promise<void> {\n if (this.drawInteraction) {\n const listener = (this.drawInteraction as any)._featureAddedListener;\n const source = (this.drawInteraction as any)._sourceRef;\n if (listener && source) {\n source.un('addfeature', listener);\n }\n \n this.olMap.removeInteraction(this.drawInteraction);\n this.drawInteraction = undefined;\n this.setCursor('');\n }\n }\n \n cleanup(): void {\n if (this.keyDownListener) {\n const target = this.olMap.getTargetElement();\n if (target && target instanceof HTMLElement) {\n target.removeEventListener('keydown', this.keyDownListener);\n }\n this.keyDownListener = undefined;\n }\n }\n\n async enableFeatureSelection(): Promise<void> {\n this.disableDrawing();\n this.disableSelection();\n \n const olLayers = this.olMap.getLayers();\n const vectorLayers = olLayers.getArray().filter(layer => layer instanceof layerNS.Vector) as layerNS.Vector<sourceNS.Vector>[];\n \n if (vectorLayers.length === 0) {\n throw new Error('No vector layers available for selection');\n }\n \n const gsMap = this.renderer?.gsMap;\n const selectionStyle = gsMap?.styles?.['selection'];\n \n const selectOptions: any = {\n condition: eventsCondition.click,\n layers: vectorLayers,\n hitTolerance: 5,\n style: selectionStyle ? toOlStyle(selectionStyle) : (_feature: any) => {\n const stroke = new style.Stroke({ color: 'rgba(255, 255, 0, 1)', width: 3 });\n const fill = new style.Fill({ color: 'rgba(255, 255, 0, 0.3)' });\n return new style.Style({\n image: new style.Circle({ radius: 7, fill: fill, stroke: stroke }),\n stroke: stroke,\n fill: fill\n });\n }\n };\n \n this.selectInteraction = new interactionNS.Select(selectOptions);\n \n this.selectInteraction.on('select', (event: any) => {\n if (event.selected.length > 0) {\n const selectedFeature = event.selected[0];\n let featureLayerUuid: string | undefined;\n olLayers.getArray().forEach((layer) => {\n if (layer instanceof layerNS.Vector) {\n const source = layer.getSource();\n if (source && source.hasFeature(selectedFeature)) {\n const uuid = layer.get(KEY_UUID);\n if (uuid) featureLayerUuid = uuid;\n }\n }\n });\n \n if (featureLayerUuid && this.renderer) {\n const gsFeature = toGsFeature(selectedFeature);\n const geometry = selectedFeature.getGeometry();\n const metrics: { length?: number, area?: number } = {};\n \n if (geometry) {\n const geometryType = geometry.getType();\n try {\n if (geometryType === 'LineString' || geometryType === 'MultiLineString') {\n metrics.length = sphere.getLength(geometry, { projection: this.olMap.getView().getProjection() });\n } else if (geometryType === 'Polygon' || geometryType === 'MultiPolygon') {\n metrics.area = sphere.getArea(geometry, { projection: this.olMap.getView().getProjection() });\n const coordinates = geometryType === 'Polygon' \n ? (geometry as any).getCoordinates()[0]\n : (geometry as any).getCoordinates()[0][0];\n if (coordinates?.length > 0) {\n const perimeterLine = new geom.LineString(coordinates);\n metrics.length = sphere.getLength(perimeterLine, { projection: this.olMap.getView().getProjection() });\n }\n }\n } catch (error) {\n console.warn('Error calculating feature metrics:', error);\n }\n }\n \n this.renderer.triggerSync({\n type: 'featureSelected',\n layerUuid: featureLayerUuid,\n feature: gsFeature,\n metrics\n });\n }\n } else if (event.deselected.length > 0) {\n this.renderer?.triggerSync({ type: 'featureDeselected' });\n }\n });\n \n this.olMap.addInteraction(this.selectInteraction);\n this.setCursor('pointer');\n }\n\n async deleteSelectedFeatures(): Promise<void> {\n if (!this.selectInteraction) {\n throw new Error('No selection interaction active');\n }\n \n const selectedFeatures = this.selectInteraction.getFeatures();\n \n if (selectedFeatures.getLength() === 0) {\n throw new Error('No features selected');\n }\n \n const layersToSync = new Set<string>();\n const olLayers = this.olMap.getLayers();\n \n selectedFeatures.forEach((feature: any) => {\n for (let i = 0; i < olLayers.getLength(); i++) {\n const layer = olLayers.item(i);\n if (layer instanceof layerNS.Vector) {\n const source = layer.getSource();\n if (source && source.hasFeature(feature)) {\n source.removeFeature(feature);\n const layerUuid = layer.get(KEY_UUID);\n if (layerUuid) layersToSync.add(layerUuid);\n break;\n }\n }\n }\n });\n \n selectedFeatures.clear();\n \n if (this.renderer && layersToSync.size > 0) {\n layersToSync.forEach(layerUuid => {\n this.renderer!.syncLayerFeaturesToModel(layerUuid);\n });\n }\n this.renderer?.triggerDirty();\n }\n\n async disableSelection(): Promise<void> {\n if (this.selectInteraction) {\n this.olMap.removeInteraction(this.selectInteraction);\n this.selectInteraction = undefined;\n this.setCursor('');\n this.renderer?.triggerSync({ type: 'featureDeselected' });\n }\n }\n}\n\n","// Core exports - renderer-agnostic model and utilities\n// For renderer-specific functionality, import from '@kispace-io/gs-lib/ol' or '@kispace-io/gs-lib/ml'\nexport * from \"./gs-model\"\nexport * from \"./scripted-runtime-registry\"\n\n// Map renderer interface (no implementation)\nexport * from \"./map-renderer\"\n\n// map-builder is only used by build service - export explicitly to avoid tree-shaking issues\nexport { buildMap, generateAppJs, processServiceWorker, processManifest, processHtml, bundleApp, type BuildOptions, type FileSystem, type GsLibFileCopier, type ProgressCallback } from \"./base-map-builder\"\n\nexport const rtUtils = {\n async resolveUrl(url: string) {\n return url\n }\n};\n\nexport * from \"./ol/index\"\n\n// Backward compatibility: export olLib as gsLib for generated build code\nexport { olLib as gsLib } from \"./ol/gs-ol-lib\""],"names":["uuidv4","source","GsSourceType","GsLayerType","GsGeometryType","litRender","style","CircleStyle","format","applyMapboxStyle","extent","settings","Map","defaultInteractions","defaultControls","geom"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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KAAa;AAC1B,WAAO;AAAA,EACX;AACJ;"}
@@ -59,6 +59,16 @@ export interface MapRenderer {
59
59
  triggerSync(event: MapSyncEvent): void;
60
60
  setOnClick?(callback: () => void): void;
61
61
  captureScreenshot(): Promise<ScreenshotResult>;
62
+ /**
63
+ * Transform a coordinate from one projection to another.
64
+ *
65
+ * - If sourceProjection is omitted, the map's current projection is assumed.
66
+ * - If targetProjection is omitted, WGS84 (EPSG:4326) is assumed.
67
+ */
68
+ transform(coord: [number, number], options?: {
69
+ sourceProjection?: string;
70
+ targetProjection?: string;
71
+ }): Promise<[number, number]>;
62
72
  destroy(): void;
63
73
  }
64
74
  export declare function findLayerByUuid(gsMap: GsMap, uuid: string): GsLayer | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"map-renderer.d.ts","sourceRoot":"","sources":["../src/map-renderer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAElE;;GAEG;AACH,MAAM,MAAM,YAAY,GAClB;IAAE,IAAI,EAAE,aAAa,CAAC;IAAC,IAAI,EAAE;QAAE,MAAM,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,CAAA;CAAE,GAC9H;IAAE,IAAI,EAAE,iBAAiB,CAAC;IAAC,SAAS,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,GAAG,EAAE,CAAA;CAAE,GAC/D;IAAE,IAAI,EAAE,iBAAiB,CAAC;IAAC,SAAS,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,GAAG,CAAC;IAAC,OAAO,CAAC,EAAE;QAAE,MAAM,CAAC,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAA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29
29
  getMap(): Map | undefined;
30
30
  getGsMap(): GsMap;
31
31
  destroy(): void;
32
+ transform(coord: [number, number], options?: {
33
+ sourceProjection?: string;
34
+ targetProjection?: string;
35
+ }): Promise<[number, number]>;
32
36
  }
33
37
  /**
34
38
  * MapLibre-specific map operations implementation
@@ -1 +1 @@
1
- {"version":3,"file":"maplibre-map-renderer.d.ts","sourceRoot":"","sources":["../../src/ml/maplibre-map-renderer.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAC7F,OAAO,EACH,KAAK,EAOR,MAAM,aAAa,CAAC;AAarB,OAAO,EAAE,GAAG,EAA4C,MAAM,aAAa,CAAC;AAE5E;;GAEG;AACH,qBAAa,mBAAoB,YAAW,WAAW;IACnD,OAAO,CAAC,GAAG,CAAC,CAAM;IAClB,OAAO,CAAC,KAAK,CAAQ;IACrB,OAAO,CAAC,GAAG,CAAC,CAAM;IAClB,OAAO,CAAC,eAAe,CAAC,CAAa;IACrC,OAAO,CAAC,cAAc,CAAC,CAAgC;IACvD,OAAO,CAAC,WAAW,CAAkB;IACrC,OAAO,CAAC,UAAU,CAAC,CAAwB;gBAE/B,KAAK,EAAE,KAAK,EAAE,GAAG,CAAC,EAAE,GAAG;IAK7B,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IAE3B,MAAM,CAAC,SAAS,EAAE,MAAM,GAAG,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC;IAiBtD,SAAS,CAAC,YAAY,CAAC,EAAE,KAAK,GAAG,OAAO,CAAC,IAAI,CAAC;IAapD,aAAa,IAAI,aAAa;IAKxB,aAAa,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;IAMlC,iBAAiB,IAAI,OAAO,CAAC,gBAAgB,CAAC;IAiBpD,UAAU,CAAC,QAAQ,EAAE,MAAM,IAAI,GAAG,IAAI;IACtC,SAAS,CAAC,Q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C,IAAI,CAAC;IACrE,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAE3C,aAAa,CAAC,YAAY,EAAE,OAAO,GAAG,YAAY,GAAG,SAAS,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAkBvG,OAAO,CAAC,iBAAiB;IAwBnB,cAAc,IAAI,OAAO,CAAC,IAAI,CAAC;IAS/B,sBAAsB,IAAI,OAAO,CAAC,IAAI,CAAC;IAyBvC,gBAAgB,IAAI,OAAO,CAAC,IAAI,CAAC;IAejC,sBAAsB,IAAI,OAAO,CAAC,IAAI,CAAC;IA2B7C,OAAO,IAAI,IAAI;CAUlB"}
@@ -33,6 +33,10 @@ export declare class OpenLayersMapRenderer implements MapRenderer {
33
33
  syncLayerFeaturesToModel(layerUuid: string): void;
34
34
  private setupEventListeners;
35
35
  destroy(): void;
36
+ transform(coord: [number, number], options?: {
37
+ sourceProjection?: string;
38
+ targetProjection?: string;
39
+ }): Promise<[number, number]>;
36
40
  }
37
41
  /**
38
42
  * OpenLayers-specific map operations implementation
@@ -1 +1 @@
1
- {"version":3,"file":"openlayers-map-renderer.d.ts","sourceRoot":"","sources":["../../src/ol/openlayers-map-renderer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAC7F,OAAO,EACH,KAAK,EASR,MAAM,aAAa,CAAC;AAKrB,OAAO,EACH,GAAG,IAAI,KAAK,EAWf,MAAM,WAAW,CAAC;AAiBnB;;;;GAIG;AACH,qBAAa,qBAAsB,YAAW,WAAW;IAC9C,KAAK,CAAC,EAAE,KAAK,CAAC;IACrB,KAAK,EAAE,KAAK,CAAC;IACb,OAAO,CAAC,GAAG,CAAC,CAAM;IAClB,OAAO,CAAC,eAAe,CAAC,CAAa;IACrC,OAAO,CAAC,cAAc,CAAC,CAAgC;IACvD,OAAO,CAAC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G,OAAO,CAAC,IAAI,CAAC;IAWxC,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAWzD,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IA8B3D,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;IAW9D,oBAAoB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IACjD,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAC3C,oBAAoB,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IACrE,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAEjD,OAAO,CAAC,SAAS;IAOX,aAAa,CAAC,YAAY,EAAE,OAAO,GAAG,YAAY,GAAG,SAAS,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IA+DjG,cAAc,IAAI,OAAO,CAAC,IAAI,CAAC;IAcrC,OAAO,IAAI,IAAI;IAUT,sBAAsB,IAAI,OAAO,CAAC,IAAI,CAAC;IAsFvC,sBAAsB,IAAI,OAAO,CAAC,IAAI,CAAC;IAuCvC,gBAAgB,IAAI,OAAO,CAAC,IAAI,CAAC;CAQ1C"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kispace-io/gs-lib",
3
- "version": "1.3.5",
3
+ "version": "1.3.7",
4
4
  "type": "module",
5
5
  "license": "EPL-2.0",
6
6
  "repository": {
@@ -36,6 +36,19 @@ export interface MapRenderer {
36
36
  triggerSync(event: MapSyncEvent): void;
37
37
  setOnClick?(callback: () => void): void;
38
38
  captureScreenshot(): Promise<ScreenshotResult>;
39
+ /**
40
+ * Transform a coordinate from one projection to another.
41
+ *
42
+ * - If sourceProjection is omitted, the map's current projection is assumed.
43
+ * - If targetProjection is omitted, WGS84 (EPSG:4326) is assumed.
44
+ */
45
+ transform(
46
+ coord: [number, number],
47
+ options?: {
48
+ sourceProjection?: string;
49
+ targetProjection?: string;
50
+ }
51
+ ): Promise<[number, number]>;
39
52
  destroy(): void;
40
53
  }
41
54
 
@@ -98,16 +111,22 @@ export interface MapOperations {
98
111
  enableFeatureSelection(): Promise<void>;
99
112
  disableSelection(): Promise<void>;
100
113
  deleteSelectedFeatures(): Promise<void>;
114
+
101
115
  }
102
116
 
103
117
  export const createProxy = (operations: MapOperations[]): MapOperations => {
104
118
  return new Proxy({}, {
105
119
  get: (_, prop: string) => {
106
120
  return async (...args: any[]) => {
107
- // Execute the operation on all registered operations
108
- for (const operation of operations) {
109
- await (operation as any)[prop](...args);
110
- }
121
+ await Promise.all(
122
+ operations.map((operation: any) => {
123
+ const fn = operation[prop];
124
+ if (typeof fn === "function") {
125
+ return fn.apply(operation, args);
126
+ }
127
+ return undefined;
128
+ }),
129
+ );
111
130
  };
112
131
  }
113
132
  }) as MapOperations;
@@ -20,7 +20,10 @@ import {
20
20
  toMlCirclePaint,
21
21
  toWgs84,
22
22
  toWebMercator,
23
- ML_KEY_GS_LAYER_UUID
23
+ ML_KEY_GS_LAYER_UUID,
24
+ transformCoords,
25
+ EPSG_3857,
26
+ EPSG_4326
24
27
  } from './gs-gs2ml';
25
28
  import { toGsFeature } from './gs-ml2gs';
26
29
  import { v4 as uuidv4 } from 'uuid';
@@ -175,6 +178,15 @@ export class MapLibreMapRenderer implements MapRenderer {
175
178
  this.map?.remove();
176
179
  this.map = undefined;
177
180
  }
181
+
182
+ async transform(
183
+ coord: [number, number],
184
+ options?: { sourceProjection?: string; targetProjection?: string }
185
+ ): Promise<[number, number]> {
186
+ const source = options?.sourceProjection ?? EPSG_3857;
187
+ const target = options?.targetProjection ?? EPSG_4326;
188
+ return transformCoords(coord, source, target);
189
+ }
178
190
  }
179
191
 
180
192
  /**
@@ -25,7 +25,8 @@ import {
25
25
  interaction as interactionNS,
26
26
  FeatureLike,
27
27
  eventsCondition,
28
- BaseLayer
28
+ BaseLayer,
29
+ proj
29
30
  } from "./gs-olns";
30
31
 
31
32
  /**
@@ -342,6 +343,27 @@ export class OpenLayersMapRenderer implements MapRenderer {
342
343
  this.olMap = undefined;
343
344
  }
344
345
 
346
+ async transform(
347
+ coord: [number, number],
348
+ options?: { sourceProjection?: string; targetProjection?: string }
349
+ ): Promise<[number, number]> {
350
+ if (!this.olMap) {
351
+ throw new Error("Map not available for coordinate transformation");
352
+ }
353
+
354
+ const view = this.olMap.getView();
355
+ const mapProj = view.getProjection()?.getCode() || "EPSG:3857";
356
+ const source = options?.sourceProjection ?? mapProj;
357
+ const target = options?.targetProjection ?? "EPSG:4326";
358
+
359
+ if (source === target) {
360
+ return coord;
361
+ }
362
+
363
+ const result = proj.transform(coord, source, target);
364
+ return result as [number, number];
365
+ }
366
+
345
367
  }
346
368
 
347
369
  /**