@opendfieldmap/map 0.2.0-beta → 0.2.1-beta

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.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import type { OEM, OEMOptions } from './types';
2
2
  export type * from './types';
3
3
  export { gameToOEMPosition, gameXZToOEMPosition, mapToGameXZPosition, oemToGamePosition, toOEMMapPosition, fromOEMMapPosition, toOEMLeafletMapPosition } from '@opendfieldmap/core';
4
- export type { OEMGamePosition, OEMGameTransform, OEMGameXZPosition, OEMMapPosition } from '@opendfieldmap/core';
4
+ export type { OEMGamePosition, OEMGameTransform, OEMGameXZPosition, OEMMapOffset, OEMMapPosition } from '@opendfieldmap/core';
5
5
  /** Creates the framework-agnostic OEM rendering kernel in a browser. */
6
6
  export declare function createOEM(container: string | HTMLElement, options: OEMOptions): Promise<OEM>;
package/dist/index.js CHANGED
@@ -2,7 +2,7 @@
2
2
  import { loadOEMManifest, validateOEMManifest } from "@opendfieldmap/core";
3
3
  import { gameToOEMPosition, gameXZToOEMPosition, mapToGameXZPosition, oemToGamePosition, toOEMMapPosition, fromOEMMapPosition, toOEMLeafletMapPosition } from "@opendfieldmap/core";
4
4
  var runtimePromise;
5
- var loadRuntime = () => runtimePromise ??= import("./runtime-QH7IV2ZV.js");
5
+ var loadRuntime = () => runtimePromise ??= import("./runtime-YB3JS7EZ.js");
6
6
  if (typeof document !== "undefined") void loadRuntime();
7
7
  async function createOEM(container, options) {
8
8
  if (typeof document === "undefined") throw new Error("createOEM must run in a browser");
package/dist/index.js.map CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/index.ts"],
4
- "sourcesContent": ["import { loadOEMManifest, validateOEMManifest } from '@opendfieldmap/core';\nimport type { OEM, OEMOptions } from './types';\nexport type * from './types';\nexport { gameToOEMPosition, gameXZToOEMPosition, mapToGameXZPosition, oemToGamePosition, toOEMMapPosition, fromOEMMapPosition, toOEMLeafletMapPosition } from '@opendfieldmap/core';\nexport type { OEMGamePosition, OEMGameTransform, OEMGameXZPosition, OEMMapPosition } from '@opendfieldmap/core';\n\ntype OEMRuntime = typeof import('./runtime');\nlet runtimePromise: Promise<OEMRuntime> | undefined;\nconst loadRuntime = (): Promise<OEMRuntime> => runtimePromise ??= import('./runtime');\n\nif (typeof document !== 'undefined') void loadRuntime();\n\n/** Creates the framework-agnostic OEM rendering kernel in a browser. */\nexport async function createOEM(container: string | HTMLElement, options: OEMOptions): Promise<OEM> {\n if (typeof document === 'undefined') throw new Error('createOEM must run in a browser');\n if (options.customPoints !== undefined && options.customPointsUrl !== undefined) {\n throw new Error('Pass either customPoints or customPointsUrl, not both');\n }\n options.signal?.throwIfAborted();\n const element = typeof container === 'string' ? document.querySelector<HTMLElement>(container) : container;\n if (!element) throw new Error(`OEM container not found: ${container}`);\n const [manifest, { OEM: OEMClass }] = await Promise.all([\n options.manifest ? validateOEMManifest(options.manifest) : loadOEMManifest(options.resources, options.signal),\n loadRuntime(),\n ]);\n options.signal?.throwIfAborted();\n const instance = new OEMClass(element, manifest, options);\n try {\n await instance.setFeatures(options.features ?? {});\n if (options.customPointsUrl !== undefined) await instance.loadCustomPoints(options.customPointsUrl);\n options.signal?.throwIfAborted();\n return instance;\n } catch (error) {\n instance.destroy();\n throw error;\n }\n}\n"],
4
+ "sourcesContent": ["import { loadOEMManifest, validateOEMManifest } from '@opendfieldmap/core';\nimport type { OEM, OEMOptions } from './types';\nexport type * from './types';\nexport { gameToOEMPosition, gameXZToOEMPosition, mapToGameXZPosition, oemToGamePosition, toOEMMapPosition, fromOEMMapPosition, toOEMLeafletMapPosition } from '@opendfieldmap/core';\nexport type { OEMGamePosition, OEMGameTransform, OEMGameXZPosition, OEMMapOffset, OEMMapPosition } from '@opendfieldmap/core';\n\ntype OEMRuntime = typeof import('./runtime');\nlet runtimePromise: Promise<OEMRuntime> | undefined;\nconst loadRuntime = (): Promise<OEMRuntime> => runtimePromise ??= import('./runtime');\n\nif (typeof document !== 'undefined') void loadRuntime();\n\n/** Creates the framework-agnostic OEM rendering kernel in a browser. */\nexport async function createOEM(container: string | HTMLElement, options: OEMOptions): Promise<OEM> {\n if (typeof document === 'undefined') throw new Error('createOEM must run in a browser');\n if (options.customPoints !== undefined && options.customPointsUrl !== undefined) {\n throw new Error('Pass either customPoints or customPointsUrl, not both');\n }\n options.signal?.throwIfAborted();\n const element = typeof container === 'string' ? document.querySelector<HTMLElement>(container) : container;\n if (!element) throw new Error(`OEM container not found: ${container}`);\n const [manifest, { OEM: OEMClass }] = await Promise.all([\n options.manifest ? validateOEMManifest(options.manifest) : loadOEMManifest(options.resources, options.signal),\n loadRuntime(),\n ]);\n options.signal?.throwIfAborted();\n const instance = new OEMClass(element, manifest, options);\n try {\n await instance.setFeatures(options.features ?? {});\n if (options.customPointsUrl !== undefined) await instance.loadCustomPoints(options.customPointsUrl);\n options.signal?.throwIfAborted();\n return instance;\n } catch (error) {\n instance.destroy();\n throw error;\n }\n}\n"],
5
5
  "mappings": ";AAAA,SAAS,iBAAiB,2BAA2B;AAGrD,SAAS,mBAAmB,qBAAqB,qBAAqB,mBAAmB,kBAAkB,oBAAoB,+BAA+B;AAI9J,IAAI;AACJ,IAAM,cAAc,MAA2B,mBAAmB,OAAO,uBAAW;AAEpF,IAAI,OAAO,aAAa,YAAa,MAAK,YAAY;AAGtD,eAAsB,UAAU,WAAiC,SAAmC;AAClG,MAAI,OAAO,aAAa,YAAa,OAAM,IAAI,MAAM,iCAAiC;AACtF,MAAI,QAAQ,iBAAiB,UAAa,QAAQ,oBAAoB,QAAW;AAC/E,UAAM,IAAI,MAAM,uDAAuD;AAAA,EACzE;AACA,UAAQ,QAAQ,eAAe;AAC/B,QAAM,UAAU,OAAO,cAAc,WAAW,SAAS,cAA2B,SAAS,IAAI;AACjG,MAAI,CAAC,QAAS,OAAM,IAAI,MAAM,4BAA4B,SAAS,EAAE;AACrE,QAAM,CAAC,UAAU,EAAE,KAAK,SAAS,CAAC,IAAI,MAAM,QAAQ,IAAI;AAAA,IACtD,QAAQ,WAAW,oBAAoB,QAAQ,QAAQ,IAAI,gBAAgB,QAAQ,WAAW,QAAQ,MAAM;AAAA,IAC5G,YAAY;AAAA,EACd,CAAC;AACD,UAAQ,QAAQ,eAAe;AAC/B,QAAM,WAAW,IAAI,SAAS,SAAS,UAAU,OAAO;AACxD,MAAI;AACF,UAAM,SAAS,YAAY,QAAQ,YAAY,CAAC,CAAC;AACjD,QAAI,QAAQ,oBAAoB,OAAW,OAAM,SAAS,iBAAiB,QAAQ,eAAe;AAClG,YAAQ,QAAQ,eAAe;AAC/B,WAAO;AAAA,EACT,SAAS,OAAO;AACd,aAAS,QAAQ;AACjB,UAAM;AAAA,EACR;AACF;",
6
6
  "names": []
7
7
  }
@@ -505,6 +505,7 @@ var OEM = class {
505
505
  if (mounted.has(container)) throw new Error("This container already hosts an OEM instance");
506
506
  this.region = getOEMRegion(manifest, options.view?.regionId ?? options.regionId ?? manifest.defaultRegionId);
507
507
  this.filter = cloneFilter(options.pointFilter ?? {});
508
+ this.boundarySource = options.features?.boundarySource ?? "oem";
508
509
  this.customPoints = this.normalizeCustomPoints(options.customPoints ?? []);
509
510
  this.markerClustering = options.markerClustering ?? true;
510
511
  const initialFloor = options.view?.floorId ?? options.floorId ?? "M";
@@ -593,6 +594,7 @@ var OEM = class {
593
594
  region;
594
595
  floorId = "M";
595
596
  features = {};
597
+ boundarySource = "oem";
596
598
  listeners = /* @__PURE__ */ new Map();
597
599
  requests = /* @__PURE__ */ new Map();
598
600
  baseTiles;
@@ -604,6 +606,9 @@ var OEM = class {
604
606
  boundariesLayer = L4.layerGroup();
605
607
  points = [];
606
608
  customPoints = [];
609
+ clickPoints = [];
610
+ clickPointOptions;
611
+ clickPointSequence = 0;
607
612
  customPointsRequest;
608
613
  pointIndex;
609
614
  pointIndexRequest;
@@ -663,10 +668,23 @@ var OEM = class {
663
668
  return { ...cloneCustomPoint(point), id };
664
669
  });
665
670
  }
671
+ normalizeClickPointOptions(options) {
672
+ const probe = {
673
+ id: "click-point-option",
674
+ position: { regionId: this.region.id, x: 0, z: 0 },
675
+ style: options?.style,
676
+ icon: options?.icon
677
+ };
678
+ this.normalizeCustomPoints([probe]);
679
+ if (options.mode !== "multiple" && options.mode !== "single") {
680
+ throw new Error(`Invalid click point mode: ${options.mode}`);
681
+ }
682
+ return { mode: options.mode, style: options.style, icon: options.icon };
683
+ }
666
684
  position(latlng) {
667
685
  return fromOEMLeafletPosition(latlng.lat, latlng.lng, this.region, this.floorId);
668
686
  }
669
- inferSubregionId(x, y) {
687
+ inferSubregionId(x, z) {
670
688
  const selected = this.filter.subregions?.filter((id) => this.region.subregions.some((subregion) => subregion.id === id));
671
689
  if (selected?.length === 1) {
672
690
  const subregion = this.region.subregions.find((entry) => entry.id === selected[0]);
@@ -674,28 +692,39 @@ var OEM = class {
674
692
  const scale2 = 2 ** this.region.maxNativeZoom;
675
693
  const [[minX, minY], [maxX, maxY]] = subregion.bounds;
676
694
  const pixelX2 = x * scale2;
677
- const pixelY2 = y * scale2;
678
- if (pixelX2 >= minX && pixelX2 <= maxX && pixelY2 >= minY && pixelY2 <= maxY) return subregion.id;
695
+ const pixelZ2 = z * scale2;
696
+ if (pixelX2 >= minX && pixelX2 <= maxX && pixelZ2 >= minY && pixelZ2 <= maxY) return subregion.id;
679
697
  }
680
698
  const scale = 2 ** this.region.maxNativeZoom;
681
699
  const pixelX = x * scale;
682
- const pixelY = y * scale;
700
+ const pixelZ = z * scale;
683
701
  return this.region.subregions.find((subregion) => {
684
702
  if (!subregion.bounds) return false;
685
703
  const [[minX, minY], [maxX, maxY]] = subregion.bounds;
686
- return pixelX >= minX && pixelX <= maxX && pixelY >= minY && pixelY <= maxY;
704
+ return pixelX >= minX && pixelX <= maxX && pixelZ >= minY && pixelZ <= maxY;
687
705
  })?.id;
688
706
  }
689
707
  emitMapClick = (event) => {
690
708
  if (this.destroyed) return;
691
- const subregionId = this.inferSubregionId(event.latlng.lng, -event.latlng.lat);
709
+ const subregionId = this.inferSubregionId(event.latlng.lng, event.latlng.lat);
692
710
  const position = {
693
711
  regionId: this.region.id,
694
712
  x: event.latlng.lng,
695
- y: -event.latlng.lat,
713
+ z: event.latlng.lat,
696
714
  floorId: this.floorId,
697
715
  ...subregionId ? { subregionId } : {}
698
716
  };
717
+ if (this.clickPointOptions) {
718
+ const point = {
719
+ id: `oem-click-point-${++this.clickPointSequence}`,
720
+ position,
721
+ style: this.clickPointOptions.style,
722
+ icon: this.clickPointOptions.icon
723
+ };
724
+ if (this.clickPointOptions.mode === "single") this.clickPoints = [point];
725
+ else this.clickPoints.push(point);
726
+ this.renderCustomPoints();
727
+ }
699
728
  this.emit("click", { position, game: mapToGameXZPosition(position, this.region) });
700
729
  };
701
730
  emit(event, payload) {
@@ -724,7 +753,7 @@ var OEM = class {
724
753
  emitView = () => {
725
754
  if (this.destroyed || this.updatingView) return;
726
755
  const view = this.getView();
727
- if (this.emittedView && view.regionId === this.emittedView.regionId && view.floorId === this.emittedView.floorId && view.x === this.emittedView.x && view.y === this.emittedView.y && view.zoom === this.emittedView.zoom) return;
756
+ if (this.emittedView && view.regionId === this.emittedView.regionId && view.floorId === this.emittedView.floorId && view.x === this.emittedView.x && view.z === this.emittedView.z && view.zoom === this.emittedView.zoom) return;
728
757
  this.emittedView = view;
729
758
  this.emit("viewchange", view);
730
759
  this.renderLabels();
@@ -763,10 +792,10 @@ var OEM = class {
763
792
  }
764
793
  /** Converts the region's published pixel extent to Simple CRS bounds. */
765
794
  regionBounds() {
766
- const { x, y } = this.region.boundsOffset;
795
+ const { x, z } = this.region.boundsOffset;
767
796
  return L4.latLngBounds(
768
- toOEMLeafletPosition({ regionId: this.region.id, x, y }, this.region),
769
- toOEMLeafletPosition({ regionId: this.region.id, x: x + this.region.dimensions[0], y: y + this.region.dimensions[1] }, this.region)
797
+ toOEMLeafletPosition({ regionId: this.region.id, x, z }, this.region),
798
+ toOEMLeafletPosition({ regionId: this.region.id, x: x + this.region.dimensions[0], z: z + this.region.dimensions[1] }, this.region)
770
799
  );
771
800
  }
772
801
  /** Creates a coverage-aware layer for one region floor. */
@@ -873,6 +902,16 @@ var OEM = class {
873
902
  async setFeatures(features) {
874
903
  this.assertAlive();
875
904
  const loads = [];
905
+ if (features.boundarySource !== void 0) {
906
+ if (features.boundarySource !== "oem" && features.boundarySource !== "game") {
907
+ throw new Error(`Unknown OEM boundary source: ${features.boundarySource}`);
908
+ }
909
+ if (features.boundarySource !== this.boundarySource) {
910
+ this.boundarySource = features.boundarySource;
911
+ this.cancelRequest("boundaries");
912
+ if (this.features.boundaries) loads.push(this.loadFeature("boundaries"));
913
+ }
914
+ }
876
915
  for (const feature of FEATURE_NAMES) {
877
916
  if (features[feature] === void 0 || features[feature] === this.features[feature]) continue;
878
917
  this.features[feature] = features[feature];
@@ -897,6 +936,22 @@ var OEM = class {
897
936
  this.customPoints = this.normalizeCustomPoints(points);
898
937
  this.renderCustomPoints();
899
938
  }
939
+ /** Enables or disables automatic custom-point creation from map clicks. */
940
+ setClickPointMode(options) {
941
+ this.assertAlive();
942
+ this.clickPointOptions = options == null ? void 0 : this.normalizeClickPointOptions(options);
943
+ if (this.clickPointOptions?.mode === "single" && this.clickPoints.length > 1) {
944
+ this.clickPoints = [this.clickPoints.at(-1)];
945
+ this.renderCustomPoints();
946
+ }
947
+ }
948
+ /** Removes only points created by the click-point mode. */
949
+ clearClickPoints() {
950
+ this.assertAlive();
951
+ if (!this.clickPoints.length) return;
952
+ this.clickPoints = [];
953
+ this.renderCustomPoints();
954
+ }
900
955
  loadCustomPoints(url) {
901
956
  this.assertAlive();
902
957
  const value = url.trim();
@@ -937,7 +992,7 @@ var OEM = class {
937
992
  this.customPointsRequest?.controller.abort();
938
993
  this.customPointsRequest = void 0;
939
994
  this.customPoints = [];
940
- this.customPointsLayer.clearLayers();
995
+ this.renderCustomPoints();
941
996
  }
942
997
  /** Returns a loaded published point from the current region, if available. */
943
998
  getPoint(pointId) {
@@ -1040,7 +1095,8 @@ var OEM = class {
1040
1095
  this.messages = messages;
1041
1096
  this.renderLabels(true);
1042
1097
  } else {
1043
- const boundaries = this.region.boundaries ? await read(this.region.boundaries) : [];
1098
+ const reference = this.boundarySource === "game" ? this.region.gameBoundaries : this.region.boundaries;
1099
+ const boundaries = reference ? await read(reference) : [];
1044
1100
  if (request.signal.aborted) return;
1045
1101
  this.renderBoundaries(boundaries);
1046
1102
  }
@@ -1102,7 +1158,7 @@ var OEM = class {
1102
1158
  }
1103
1159
  renderCustomPoints() {
1104
1160
  this.customPointsLayer.clearLayers();
1105
- for (const point of this.customPoints) {
1161
+ for (const point of [...this.customPoints, ...this.clickPoints]) {
1106
1162
  if (point.position.regionId !== this.region.id) continue;
1107
1163
  const marker = new OEMMarker(toOEMLeafletMapPosition(point.position), {
1108
1164
  interactive: false,
@@ -1273,6 +1329,8 @@ var OEM = class {
1273
1329
  this.root.remove();
1274
1330
  this.points = [];
1275
1331
  this.customPoints = [];
1332
+ this.clickPoints = [];
1333
+ this.clickPointOptions = void 0;
1276
1334
  this.customPointsLayer.clearLayers();
1277
1335
  this.pointShardRequests.clear();
1278
1336
  mounted.delete(this.container);
@@ -1281,4 +1339,4 @@ var OEM = class {
1281
1339
  export {
1282
1340
  OEM
1283
1341
  };
1284
- //# sourceMappingURL=runtime-QH7IV2ZV.js.map
1342
+ //# sourceMappingURL=runtime-YB3JS7EZ.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/runtime.ts", "../src/atlos/smoothTileLayer.ts", "../src/atlos/smoothWheelZoom.ts", "../src/atlos/mapOverdrag.ts", "../src/tileVersion.ts", "../src/assets/ghicon.svg"],
4
+ "sourcesContent": ["import L from 'leaflet';\nimport 'leaflet.markercluster';\nimport {\n createOEMPointUrl,\n fetchOEMJson,\n fromOEMLeafletPosition,\n getOEMRegion,\n mapToGameXZPosition,\n normalizeOEMLocale,\n resolveOEMAsset,\n toOEMLeafletMapPosition,\n toOEMLeafletPosition,\n} from '@opendfieldmap/core';\nimport type {\n OEMAsset,\n OEMBoundary,\n OEMBoundarySource,\n OEMFloor,\n OEMLabel,\n OEMLocaleMessages,\n OEMManifest,\n OEMPoint,\n OEMPointFilter,\n OEMMapPosition,\n OEMPointType,\n OEMPosition,\n OEMRegion,\n OEMView,\n} from '@opendfieldmap/core';\nimport type { OEM as OEMContract, OEMClickPointOptions, OEMCustomPoint, OEMEvents, OEMFeatures, OEMOptions, OEMZoomOptions } from './types';\nimport { SmoothTileLayer } from './atlos/smoothTileLayer';\nimport { enableSmoothWheelZoom } from './atlos/smoothWheelZoom';\nimport { isMapOverdragged, toMapBounds } from './atlos/mapOverdrag';\nimport { appendOEMTileVersion, lookupOEMTile } from './tileVersion';\nimport GithubIcon from './assets/ghicon.svg';\n\nconst mounted = new WeakSet<HTMLElement>();\nconst CLUSTER_SUBCATEGORIES = new Set(['boss', 'collection', 'mob', 'natural', 'valuable', 'exploration']);\nconst FEATURE_NAMES = ['points', 'labels', 'boundaries'] as const;\ntype OEMFeatureName = typeof FEATURE_NAMES[number];\nconst BRAND_URL = 'https://oem.re/';\nconst GITHUB_URL = 'https://github.com/Terra-Online/OEM-SDK';\nconst TERMS_URL = 'https://blog.opendfieldmap.org/docs/tos#intellectual-property-and-copyright';\n\nconst cloneFilter = (filter: OEMPointFilter): OEMPointFilter => ({\n types: filter.types ? [...filter.types] : undefined,\n subregions: filter.subregions ? [...filter.subregions] : undefined,\n floorOnly: filter.floorOnly,\n});\n\nconst sameList = (left?: string[], right?: string[]): boolean =>\n left === right || (!!left && !!right && left.length === right.length &&\n left.every((value, index) => value === right[index]));\n\nconst sameFilter = (left: OEMPointFilter, right: OEMPointFilter): boolean =>\n left.floorOnly === right.floorOnly &&\n sameList(left.types, right.types) &&\n sameList(left.subregions, right.subregions);\n\nconst clonePoint = (point: OEMPoint): OEMPoint => ({\n ...point,\n raw: { ...point.raw },\n position: { ...point.position },\n});\n\nconst cloneCustomPoint = (point: OEMCustomPoint): OEMCustomPoint => ({\n ...point,\n position: { ...point.position },\n});\n\n/** Leaflet marker with the subpixel positioning used by Atlos. */\nclass OEMMarker extends L.Marker {\n update(): this {\n const marker = this as unknown as { _icon?: HTMLElement; _map?: L.Map; _latlng: L.LatLng; _setPos(point: L.Point): void };\n if (marker._icon && marker._map) marker._setPos(marker._map.latLngToLayerPoint(marker._latlng));\n return this;\n }\n _animateZoom(event: { center: L.LatLng; zoom: number }): void {\n const marker = this as unknown as {\n _map?: L.Map & { _latLngToNewLayerPoint(latlng: L.LatLng, zoom: number, center: L.LatLng): L.Point };\n _latlng: L.LatLng;\n _setPos(point: L.Point): void;\n };\n if (marker._map) marker._setPos(marker._map._latLngToNewLayerPoint(marker._latlng, event.zoom, event.center));\n }\n}\n\n/** Tile layer that skips coordinates absent from the published coverage index. */\nclass CoveredTileLayer extends SmoothTileLayer {\n constructor(url: string, options: L.TileLayerOptions, private coverage: OEMRegion['coverage'], private floor: OEMFloor) {\n super(url, options);\n }\n getTileUrl(coords: L.Coords): string {\n const tile = lookupOEMTile(this.coverage, this.floor, coords.z, coords.x, coords.y);\n return appendOEMTileVersion(super.getTileUrl(coords), tile.version);\n }\n _isValidTile(coords: L.Coords): boolean {\n const prototype = L.GridLayer.prototype as unknown as {\n _isValidTile(this: L.GridLayer, value: L.Coords): boolean;\n };\n return prototype._isValidTile.call(this, coords) &&\n lookupOEMTile(this.coverage, this.floor, coords.z, coords.x, coords.y).covered;\n }\n}\n\n/** Leaflet-backed implementation of the public OEM interface. */\nexport class OEM implements OEMContract {\n destroyed = false;\n private map: L.Map;\n private root: HTMLDivElement;\n private region: OEMRegion;\n private floorId = 'M';\n private features: OEMFeatures = {};\n private boundarySource: OEMBoundarySource = 'oem';\n private listeners = new Map<keyof OEMEvents, Set<(payload: never) => void>>();\n private requests = new Map<OEMFeatureName, AbortController>();\n private baseTiles?: L.TileLayer;\n private floorTiles?: L.TileLayer;\n private pointsLayer = L.layerGroup();\n private customPointsLayer = L.layerGroup();\n private pointClusters = new Map<string, L.MarkerClusterGroup>();\n private labelsLayer = L.layerGroup();\n private boundariesLayer = L.layerGroup();\n private points: OEMPoint[] = [];\n private customPoints: OEMCustomPoint[] = [];\n private clickPoints: OEMCustomPoint[] = [];\n private clickPointOptions?: OEMClickPointOptions;\n private clickPointSequence = 0;\n private customPointsRequest?: { controller: AbortController; promise: Promise<void> };\n private pointIndex?: Record<string, string>;\n private pointIndexRequest?: Promise<Record<string, string>>;\n private pointShardRequests = new Map<string, Promise<OEMPoint[]>>();\n private types: Record<string, OEMPointType> = {};\n private labels: OEMLabel[] = [];\n private visibleLabelType?: OEMLabel['type'];\n private messages: OEMLocaleMessages = {};\n private filter: OEMPointFilter = {};\n private markerClustering: boolean;\n private locale: string;\n private resolvedLocale: string;\n private attributionBrand: HTMLAnchorElement;\n private attributionLink: HTMLAnchorElement;\n private observer?: ResizeObserver;\n private updatingView = false;\n private emittedView?: OEMView;\n private overdragFrame?: number;\n private overdragged = false;\n private wheel: ReturnType<typeof enableSmoothWheelZoom>;\n\n constructor(private container: HTMLElement, readonly manifest: OEMManifest, private options: OEMOptions) {\n if (mounted.has(container)) throw new Error('This container already hosts an OEM instance');\n this.region = getOEMRegion(manifest, options.view?.regionId ?? options.regionId ?? manifest.defaultRegionId);\n this.filter = cloneFilter(options.pointFilter ?? {});\n this.boundarySource = options.features?.boundarySource ?? 'oem';\n this.customPoints = this.normalizeCustomPoints(options.customPoints ?? []);\n this.markerClustering = options.markerClustering ?? true;\n const initialFloor = options.view?.floorId ?? options.floorId ?? 'M';\n this.validateFloor(initialFloor);\n if (options.view) this.validatePosition(options.view);\n this.locale = options.locale ?? manifest.fallbackLocale;\n this.resolvedLocale = normalizeOEMLocale(this.locale, Object.keys(manifest.locales), manifest.fallbackLocale);\n this.root = document.createElement('div');\n this.root.className = 'mapRoot';\n this.root.dataset.theme = options.theme ?? 'light';\n container.append(this.root);\n mounted.add(container);\n this.map = L.map(this.root, {\n crs: L.CRS.Simple, minZoom: 0, maxZoom: 3, zoomControl: false, attributionControl: false,\n dragging: !options.lockDrag, touchZoom: !options.lockZoom, boxZoom: !options.lockZoom,\n keyboard: !options.lockZoom, doubleClickZoom: false, scrollWheelZoom: false, zoomAnimation: true,\n markerZoomAnimation: true, fadeAnimation: true, zoomSnap: 0, zoomDelta: 0.25,\n });\n this.wheel = enableSmoothWheelZoom(this.map, {\n enableInertia: true,\n panEnabled: !options.lockDrag,\n zoomEnabled: !options.lockZoom,\n });\n const pane = this.map.createPane('placeLabels');\n pane.style.zIndex = '650';\n pane.style.pointerEvents = 'none';\n this.pointsLayer.addTo(this.map);\n this.customPointsLayer.addTo(this.map);\n this.labelsLayer.addTo(this.map);\n this.boundariesLayer.addTo(this.map);\n const credit = document.createElement('div');\n credit.className = 'attribution';\n const github = document.createElement('a');\n github.className = 'attributionGithub';\n github.href = GITHUB_URL;\n github.target = '_blank';\n github.rel = 'noopener noreferrer';\n github.setAttribute('aria-label', 'GitHub');\n github.innerHTML = GithubIcon;\n const githubSvg = github.querySelector('svg');\n githubSvg?.setAttribute('aria-hidden', 'true');\n githubSvg?.setAttribute('focusable', 'false');\n this.attributionBrand = document.createElement('a');\n this.attributionBrand.className = 'attributionBrand';\n this.attributionBrand.href = BRAND_URL;\n const separator = document.createElement('span');\n separator.className = 'attributionSeparator';\n separator.textContent = '\u00B7';\n separator.setAttribute('aria-hidden', 'true');\n this.attributionLink = document.createElement('a');\n this.attributionLink.className = 'attributionLink';\n this.attributionLink.href = TERMS_URL;\n this.attributionLink.target = '_blank';\n this.attributionLink.rel = 'noopener noreferrer';\n credit.append(github, this.attributionBrand, separator, this.attributionLink);\n this.updateAttribution();\n this.root.append(credit);\n this.applyRegion(options.view);\n this.setFloor(initialFloor);\n this.renderCustomPoints();\n this.map.on('click', this.emitMapClick);\n this.map.on('moveend zoomend', this.emitView);\n this.map.on('move drag', this.scheduleOverdragUpdate);\n this.map.on('moveend dragend movestart zoomstart', this.clearOverdrag);\n if (typeof ResizeObserver !== 'undefined') {\n this.observer = new ResizeObserver(() => this.resize());\n this.observer.observe(container);\n }\n options.signal?.addEventListener('abort', this.destroy, { once: true });\n }\n\n /** Prevents calls against a released map instance. */\n private assertAlive(): void { if (this.destroyed) throw new Error('OEM instance has been destroyed'); }\n private validateFloor(id: string): void {\n if (!this.region.floors.some((floor) => floor.id === id)) throw new Error(`Unknown floor ${id} in ${this.region.id}`);\n }\n private validatePosition(position: OEMPosition): void { toOEMLeafletPosition(position, this.region); }\n private normalizeCustomPoints(points: readonly OEMCustomPoint[]): OEMCustomPoint[] {\n const ids = new Set<string>();\n return points.map((point) => {\n if (!point || typeof point.id !== 'string' || !point.id.trim()) {\n throw new Error(`Custom point IDs must be non-empty and unique: ${point?.id}`);\n }\n const id = point.id.trim();\n if (ids.has(id)) throw new Error(`Custom point IDs must be non-empty and unique: ${id}`);\n ids.add(id);\n if (!point.position || typeof point.position.regionId !== 'string') {\n throw new Error(`Invalid custom point position: ${id}`);\n }\n if (point.style !== 'framed' && point.style !== 'no-frame') {\n throw new Error(`Invalid custom point style: ${id}`);\n }\n if (typeof point.icon !== 'string' || !point.icon) {\n throw new Error(`Custom point icon must be a non-empty URL: ${id}`);\n }\n const pointRegion = getOEMRegion(this.manifest, point.position.regionId);\n toOEMLeafletMapPosition(point.position);\n if (point.position.subregionId && !pointRegion.subregions.some((subregion) => subregion.id === point.position.subregionId)) {\n throw new Error(`Unknown custom point subregion ${point.position.subregionId} in ${point.position.regionId}`);\n }\n if (point.position.floorId && !pointRegion.floors.some((floor) => floor.id === point.position.floorId)) {\n throw new Error(`Unknown custom point floor ${point.position.floorId} in ${point.position.regionId}`);\n }\n return { ...cloneCustomPoint(point), id };\n });\n }\n private normalizeClickPointOptions(options: OEMClickPointOptions): OEMClickPointOptions {\n const probe: OEMCustomPoint = {\n id: 'click-point-option',\n position: { regionId: this.region.id, x: 0, z: 0 },\n style: options?.style,\n icon: options?.icon,\n };\n this.normalizeCustomPoints([probe]);\n if (options.mode !== 'multiple' && options.mode !== 'single') {\n throw new Error(`Invalid click point mode: ${options.mode}`);\n }\n return { mode: options.mode, style: options.style, icon: options.icon };\n }\n private position(latlng: L.LatLng): OEMPosition {\n return fromOEMLeafletPosition(latlng.lat, latlng.lng, this.region, this.floorId);\n }\n private inferSubregionId(x: number, z: number): string | undefined {\n const selected = this.filter.subregions?.filter((id) => this.region.subregions.some((subregion) => subregion.id === id));\n if (selected?.length === 1) {\n const subregion = this.region.subregions.find((entry) => entry.id === selected[0]);\n if (!subregion?.bounds) return subregion?.id;\n const scale = 2 ** this.region.maxNativeZoom;\n const [[minX, minY], [maxX, maxY]] = subregion.bounds;\n const pixelX = x * scale;\n const pixelZ = z * scale;\n if (pixelX >= minX && pixelX <= maxX && pixelZ >= minY && pixelZ <= maxY) return subregion.id;\n }\n const scale = 2 ** this.region.maxNativeZoom;\n const pixelX = x * scale;\n const pixelZ = z * scale;\n return this.region.subregions.find((subregion) => {\n if (!subregion.bounds) return false;\n const [[minX, minY], [maxX, maxY]] = subregion.bounds;\n return pixelX >= minX && pixelX <= maxX && pixelZ >= minY && pixelZ <= maxY;\n })?.id;\n }\n private emitMapClick = (event: L.LeafletMouseEvent): void => {\n if (this.destroyed) return;\n const subregionId = this.inferSubregionId(event.latlng.lng, event.latlng.lat);\n const position: OEMMapPosition = {\n regionId: this.region.id,\n x: event.latlng.lng,\n z: event.latlng.lat,\n floorId: this.floorId,\n ...(subregionId ? { subregionId } : {}),\n };\n if (this.clickPointOptions) {\n const point: OEMCustomPoint = {\n id: `oem-click-point-${++this.clickPointSequence}`,\n position,\n style: this.clickPointOptions.style,\n icon: this.clickPointOptions.icon,\n };\n if (this.clickPointOptions.mode === 'single') this.clickPoints = [point];\n else this.clickPoints.push(point);\n this.renderCustomPoints();\n }\n this.emit('click', { position, game: mapToGameXZPosition(position, this.region) });\n };\n private emit<Event extends keyof OEMEvents>(event: Event, payload: OEMEvents[Event]): void {\n this.listeners.get(event)?.forEach((handler) => handler(payload as never));\n if (event === 'error') this.options.onError?.(payload as Error);\n }\n private scheduleOverdragUpdate = (): void => {\n if (this.overdragFrame !== undefined) return;\n this.overdragFrame = requestAnimationFrame(() => {\n this.overdragFrame = undefined;\n const bounds = toMapBounds(this.map.options.maxBounds);\n const overdragged = !!bounds && isMapOverdragged(this.map, bounds);\n if (overdragged === this.overdragged) return;\n this.overdragged = overdragged;\n this.root.classList.toggle('overdrag', overdragged);\n });\n };\n private clearOverdrag = (): void => {\n if (this.overdragFrame !== undefined) cancelAnimationFrame(this.overdragFrame);\n this.overdragFrame = undefined;\n if (!this.overdragged) return;\n this.overdragged = false;\n this.root.classList.remove('overdrag');\n };\n /** Emits one resolved view for duplicate Leaflet move and zoom events. */\n private emitView = (): void => {\n if (this.destroyed || this.updatingView) return;\n const view = this.getView();\n if (this.emittedView && view.regionId === this.emittedView.regionId &&\n view.floorId === this.emittedView.floorId && view.x === this.emittedView.x &&\n view.z === this.emittedView.z && view.zoom === this.emittedView.zoom) return;\n this.emittedView = view;\n this.emit('viewchange', view);\n this.renderLabels();\n };\n /** Resolves the compact attribution without inheriting the map control font. */\n private updateAttribution(): void {\n const messages = this.manifest.controls[this.resolvedLocale] ?? this.manifest.controls[this.manifest.fallbackLocale];\n if (!messages) throw new Error('Missing OEM attribution messages');\n this.attributionBrand.textContent = messages.brandName;\n this.attributionLink.textContent = messages.termsOfService;\n }\n on<Event extends keyof OEMEvents>(event: Event, handler: (payload: OEMEvents[Event]) => void): () => void {\n this.assertAlive();\n const handlers = this.listeners.get(event) ?? new Set();\n handlers.add(handler as (payload: never) => void);\n this.listeners.set(event, handlers);\n return () => { handlers.delete(handler as (payload: never) => void); };\n }\n /** Rebuilds the base map constraints and main tile layer for one region. */\n private applyRegion(view?: OEMView): void {\n this.updatingView = true;\n this.baseTiles?.remove();\n this.floorTiles?.remove();\n this.floorTiles = undefined;\n this.floorId = 'M';\n this.map.setMaxBounds(L.latLngBounds([]));\n this.map.setMinZoom(this.region.minZoom);\n this.map.setMaxZoom(this.region.maxZoom);\n const target = view ?? this.region.initialView;\n this.map.setView(toOEMLeafletPosition(target, this.region), this.clampZoom(target.zoom), { animate: false });\n this.map.setMaxBounds(this.regionBounds());\n this.baseTiles = this.makeTiles('M').addTo(this.map);\n this.updatingView = false;\n }\n /** Converts the region's published pixel extent to Simple CRS bounds. */\n private regionBounds(): L.LatLngBounds {\n const { x, z } = this.region.boundsOffset;\n return L.latLngBounds(\n toOEMLeafletPosition({ regionId: this.region.id, x, z }, this.region),\n toOEMLeafletPosition({ regionId: this.region.id, x: x + this.region.dimensions[0], z: z + this.region.dimensions[1] }, this.region),\n );\n }\n /** Creates a coverage-aware layer for one region floor. */\n private makeTiles(floorId: string): L.TileLayer {\n const floor = this.region.floors.find((entry) => entry.id === floorId)!;\n const regionId = this.region.id;\n const layer = new CoveredTileLayer(resolveOEMAsset(this.options.resources.baseUrl, floor.tileTemplate), {\n tileSize: this.region.tileSize, noWrap: true, bounds: this.regionBounds(),\n maxNativeZoom: this.region.maxNativeZoom, maxZoom: Math.ceil(this.region.maxZoom),\n }, this.region.coverage, floor);\n layer.on('load', () => { if (!this.destroyed && this.region.id === regionId) this.emit('load', { regionId, floorId }); });\n layer.on('tileerror', () => this.emit('error', new Error(`Tile load failed: ${regionId}/${floorId}`)));\n return layer;\n }\n private clampZoom(zoom: number): number {\n if (!Number.isFinite(zoom)) throw new Error('Zoom must be finite');\n return Math.max(this.region.minZoom, Math.min(this.region.maxZoom, zoom));\n }\n /** Returns the current view in the OEM pixel coordinate system. */\n getView(): OEMView { this.assertAlive(); return { ...this.position(this.map.getCenter()), zoom: this.map.getZoom() }; }\n\n /** Sets the view without exposing Leaflet's coordinate objects. */\n setView(view: OEMView): void {\n this.assertAlive();\n this.validatePosition(view);\n const zoom = this.clampZoom(view.zoom);\n if (view.floorId) this.setFloor(view.floorId);\n this.map.setView(toOEMLeafletPosition(view, this.region), zoom, { animate: false });\n }\n /** Changes zoom around the current center with an optional native transition. */\n setZoom(zoom: number, options: OEMZoomOptions = {}): void {\n this.assertAlive();\n this.map.setZoom(this.clampZoom(zoom), { animate: options.animate ?? false });\n }\n /** Fits the map to an OEM pixel-coordinate extent. */\n fitBounds(bounds: [OEMPosition, OEMPosition]): void {\n this.assertAlive();\n this.map.fitBounds(L.latLngBounds(toOEMLeafletPosition(bounds[0], this.region), toOEMLeafletPosition(bounds[1], this.region)), { animate: false });\n }\n /** Switches regions and reloads only the features currently enabled. */\n async setRegion(regionId: string): Promise<void> {\n this.assertAlive();\n const region = getOEMRegion(this.manifest, regionId);\n if (region === this.region) return;\n this.cancelRequests();\n this.region = region;\n this.points = [];\n this.labels = [];\n this.visibleLabelType = undefined;\n this.clearPointLayers();\n this.labelsLayer.clearLayers();\n this.boundariesLayer.clearLayers();\n this.applyRegion();\n this.renderCustomPoints();\n this.emit('regionchange', { regionId });\n this.emit('floorchange', { floorId: 'M' });\n this.emitView();\n await this.loadFeatures();\n }\n /** Switches the rendered floor while retaining the current region view. */\n setFloor(floorId: string): void {\n this.assertAlive();\n this.validateFloor(floorId);\n if (floorId === this.floorId) return;\n this.floorTiles?.remove();\n this.floorTiles = undefined;\n this.floorId = floorId;\n const base = this.baseTiles?.getContainer();\n if (base) base.style.filter = floorId === 'M' ? 'brightness(1)' : 'brightness(0.5)';\n if (floorId !== 'M') this.floorTiles = this.makeTiles(floorId).addTo(this.map);\n this.renderPoints();\n this.renderCustomPoints();\n this.emit('floorchange', { floorId });\n this.emitView();\n }\n /** Changes label language and applies the manifest fallback chain. */\n async setLocale(locale: string): Promise<void> {\n this.assertAlive();\n const resolved = normalizeOEMLocale(locale, Object.keys(this.manifest.locales), this.manifest.fallbackLocale);\n const changed = resolved !== this.resolvedLocale;\n this.locale = locale;\n if (!changed) return;\n this.resolvedLocale = resolved;\n this.updateAttribution();\n if (this.features.labels) await this.loadFeature('labels');\n }\n /** Returns both the requested and resolved locale values. */\n getLocale(): { requested: string; resolved: string } { return { requested: this.locale, resolved: this.resolvedLocale }; }\n\n /** Changes only this instance's theme attribute. */\n setTheme(theme: 'light' | 'dark'): void { this.assertAlive(); this.root.dataset.theme = theme; }\n\n /** Enables or disables static layers and cancels disabled layer requests. */\n async setFeatures(features: OEMFeatures): Promise<void> {\n this.assertAlive();\n const loads: Promise<void>[] = [];\n if (features.boundarySource !== undefined) {\n if (features.boundarySource !== 'oem' && features.boundarySource !== 'game') {\n throw new Error(`Unknown OEM boundary source: ${features.boundarySource}`);\n }\n if (features.boundarySource !== this.boundarySource) {\n this.boundarySource = features.boundarySource;\n this.cancelRequest('boundaries');\n if (this.features.boundaries) loads.push(this.loadFeature('boundaries'));\n }\n }\n for (const feature of FEATURE_NAMES) {\n if (features[feature] === undefined || features[feature] === this.features[feature]) continue;\n this.features[feature] = features[feature];\n this.cancelRequest(feature);\n if (features[feature]) loads.push(this.loadFeature(feature));\n else if (feature === 'points') { this.points = []; this.clearPointLayers(); }\n else if (feature === 'labels') { this.labels = []; this.visibleLabelType = undefined; this.labelsLayer.clearLayers(); }\n else this.boundariesLayer.clearLayers();\n }\n await Promise.all(loads);\n }\n\n /** Replaces host-defined points without reloading static map data. */\n setCustomPoints(points: readonly OEMCustomPoint[]): void {\n this.assertAlive();\n this.customPointsRequest?.controller.abort();\n this.customPointsRequest = undefined;\n this.customPoints = this.normalizeCustomPoints(points);\n this.renderCustomPoints();\n }\n\n /** Enables or disables automatic custom-point creation from map clicks. */\n setClickPointMode(options?: OEMClickPointOptions | null): void {\n this.assertAlive();\n this.clickPointOptions = options == null ? undefined : this.normalizeClickPointOptions(options);\n if (this.clickPointOptions?.mode === 'single' && this.clickPoints.length > 1) {\n this.clickPoints = [this.clickPoints.at(-1)!];\n this.renderCustomPoints();\n }\n }\n\n /** Removes only points created by the click-point mode. */\n clearClickPoints(): void {\n this.assertAlive();\n if (!this.clickPoints.length) return;\n this.clickPoints = [];\n this.renderCustomPoints();\n }\n\n loadCustomPoints(url: string): Promise<void> {\n this.assertAlive();\n const value = url.trim();\n if (!value) throw new Error('Custom points URL must be a non-empty URL');\n let resolvedUrl: string;\n try {\n resolvedUrl = new URL(value, document.baseURI).toString();\n } catch {\n throw new Error(`Invalid custom points URL: ${url}`);\n }\n this.customPointsRequest?.controller.abort();\n const controller = new AbortController();\n const abort = () => controller.abort();\n this.options.signal?.addEventListener('abort', abort, { once: true });\n const request: { controller: AbortController; promise: Promise<void> } = { controller, promise: Promise.resolve() };\n request.promise = fetchOEMJson<unknown>(resolvedUrl, controller.signal).then((value) => {\n if (!Array.isArray(value)) throw new Error('Custom points JSON must be an array');\n const points = value.map((point) => {\n if (!point || typeof point !== 'object' || typeof (point as { icon?: unknown }).icon !== 'string') return point as OEMCustomPoint;\n return {\n ...(point as OEMCustomPoint),\n icon: new URL((point as OEMCustomPoint).icon, resolvedUrl).toString(),\n };\n });\n if (controller.signal.aborted || this.destroyed) return;\n this.customPoints = this.normalizeCustomPoints(points);\n this.renderCustomPoints();\n }).finally(() => {\n this.options.signal?.removeEventListener('abort', abort);\n if (this.customPointsRequest === request) this.customPointsRequest = undefined;\n });\n this.customPointsRequest = request;\n return request.promise;\n }\n\n /** Removes all host-defined points from this map instance. */\n clearCustomPoints(): void {\n this.assertAlive();\n this.customPointsRequest?.controller.abort();\n this.customPointsRequest = undefined;\n this.customPoints = [];\n this.renderCustomPoints();\n }\n\n /** Returns a loaded published point from the current region, if available. */\n getPoint(pointId: string): OEMPoint | undefined {\n this.assertAlive();\n const id = pointId.trim();\n if (!id) throw new Error('Point ID must not be empty');\n const point = this.points.find((entry) => entry.id === id);\n return point ? clonePoint(point) : undefined;\n }\n\n /** Loads one published point by using the release point index when available. */\n async loadPoint(pointId: string): Promise<OEMPoint | undefined> {\n this.assertAlive();\n const id = pointId.trim();\n if (!id) throw new Error('Point ID must not be empty');\n const loaded = this.getPoint(id);\n if (loaded) return loaded;\n\n const pointIndex = await this.loadPointIndex();\n this.assertAlive();\n const paths = pointIndex[id]\n ? [pointIndex[id]]\n : this.manifest.pointIndex\n ? []\n : this.manifest.regions.flatMap((region) => region.points.map((ref) => ref.path));\n for (const path of paths) {\n const points = await this.loadPointShard(path);\n const point = points.find((entry) => entry.id === id);\n if (point) return clonePoint(point);\n }\n return undefined;\n }\n\n private async loadPointIndex(): Promise<Record<string, string>> {\n if (!this.manifest.pointIndex) return {};\n if (this.pointIndex) return this.pointIndex;\n if (!this.pointIndexRequest) {\n this.pointIndexRequest = fetchOEMJson<unknown>(\n resolveOEMAsset(this.options.resources.baseUrl, this.manifest.pointIndex.path),\n this.options.signal,\n ).then((value) => {\n if (!value || typeof value !== 'object' || Array.isArray(value)) throw new Error('Invalid OEM point index');\n const index: Record<string, string> = {};\n for (const [id, path] of Object.entries(value)) {\n if (!id || typeof path !== 'string' || !path) throw new Error(`Invalid OEM point index entry: ${id}`);\n resolveOEMAsset(this.options.resources.baseUrl, path);\n index[id] = path;\n }\n this.pointIndex = index;\n return index;\n }).catch((error) => {\n this.pointIndexRequest = undefined;\n throw error;\n });\n }\n return this.pointIndexRequest;\n }\n\n private loadPointShard(path: string): Promise<OEMPoint[]> {\n const cached = this.pointShardRequests.get(path);\n if (cached) return cached;\n const request = fetchOEMJson<unknown>(resolveOEMAsset(this.options.resources.baseUrl, path), this.options.signal).then((value) => {\n if (!Array.isArray(value)) throw new Error(`Invalid OEM point shard: ${path}`);\n return value as OEMPoint[];\n }).catch((error) => {\n if (this.pointShardRequests.get(path) === request) this.pointShardRequests.delete(path);\n throw error;\n });\n this.pointShardRequests.set(path, request);\n return request;\n }\n\n private cancelRequest(feature: OEMFeatureName): void {\n if (!this.requests.has(feature)) return;\n this.requests.get(feature)!.abort();\n this.requests.delete(feature);\n this.emit('loading', { feature, loading: false });\n }\n private cancelRequests(): void { for (const feature of this.requests.keys()) this.cancelRequest(feature); }\n private async loadFeatures(): Promise<void> {\n await Promise.all(FEATURE_NAMES.filter((feature) => this.features[feature]).map((feature) => this.loadFeature(feature)));\n }\n /** Loads one feature with a request token so stale responses are ignored. */\n private async loadFeature(feature: OEMFeatureName): Promise<void> {\n this.cancelRequest(feature);\n const request = new AbortController();\n this.requests.set(feature, request);\n this.emit('loading', { feature, loading: true });\n const read = <Data>(ref: OEMAsset) => fetchOEMJson<Data>(resolveOEMAsset(this.options.resources.baseUrl, ref.path), request.signal);\n try {\n if (feature === 'points') {\n const [groups, types] = await Promise.all([\n Promise.all(this.region.points.map((ref) => read<OEMPoint[]>(ref))),\n Object.keys(this.types).length ? this.types : read<Record<string, OEMPointType>>(this.manifest.types),\n ]);\n if (request.signal.aborted) return;\n this.points = groups.flat();\n this.types = types;\n this.renderPoints();\n } else if (feature === 'labels') {\n const [labels, messages] = await Promise.all([\n this.region.labels ? read<OEMLabel[]>(this.region.labels) : Promise.resolve([]),\n this.manifest.locales[this.resolvedLocale] ? read<OEMLocaleMessages>(this.manifest.locales[this.resolvedLocale]) : Promise.resolve({}),\n ]);\n if (request.signal.aborted) return;\n this.labels = labels;\n this.messages = messages;\n this.renderLabels(true);\n } else {\n const reference = this.boundarySource === 'game' ? this.region.gameBoundaries : this.region.boundaries;\n const boundaries = reference ? await read<OEMBoundary[]>(reference) : [];\n if (request.signal.aborted) return;\n this.renderBoundaries(boundaries);\n }\n } catch (error) {\n if (!request.signal.aborted) {\n this.features[feature] = false;\n this.emit('error', error instanceof Error ? error : new Error(String(error)));\n throw error;\n }\n } finally {\n if (this.requests.get(feature) === request) {\n this.requests.delete(feature);\n this.emit('loading', { feature, loading: false });\n }\n }\n }\n /** Applies a client-side filter without making another network request. */\n setPointFilter(filter: OEMPointFilter): void {\n this.assertAlive();\n const next = cloneFilter(filter);\n if (sameFilter(this.filter, next)) return;\n this.filter = next;\n this.renderPoints();\n }\n\n /** Enables or disables Atlos-style marker clustering without reloading point data. */\n setMarkerClustering(enabled: boolean): void {\n this.assertAlive();\n if (enabled === this.markerClustering) return;\n this.markerClustering = enabled;\n this.renderPoints();\n }\n\n private clearPointLayers(): void {\n this.pointsLayer.clearLayers();\n for (const group of this.pointClusters.values()) {\n group.clearLayers();\n group.remove();\n }\n this.pointClusters.clear();\n }\n\n private createCustomPointVisual(point: OEMCustomPoint): HTMLElement {\n const inner = document.createElement('div');\n inner.className = point.style === 'no-frame' ? 'noFrameInner' : 'markerInner';\n inner.setAttribute('aria-label', point.id);\n if (point.position.floorId && point.position.floorId !== this.floorId) inner.classList.add('offLayer');\n const image = document.createElement('img');\n image.src = point.icon;\n image.alt = point.id;\n image.draggable = false;\n if (point.style === 'no-frame') {\n image.className = 'noFrameImage';\n inner.append(image);\n } else {\n const frame = document.createElement('div');\n frame.className = 'frameImage';\n frame.append(image);\n inner.append(frame);\n }\n return inner;\n }\n\n private renderCustomPoints(): void {\n this.customPointsLayer.clearLayers();\n for (const point of [...this.customPoints, ...this.clickPoints]) {\n if (point.position.regionId !== this.region.id) continue;\n const marker = new OEMMarker(toOEMLeafletMapPosition(point.position), {\n interactive: false,\n keyboard: false,\n bubblingMouseEvents: false,\n icon: L.divIcon({\n html: this.createCustomPointVisual(point),\n className: `${point.style === 'no-frame' ? 'noFrameMarkerIcon' : 'frameMarkerIcon'} incompleteMarker`,\n iconSize: point.style === 'no-frame' ? [50, 50] : [32, 32],\n iconAnchor: point.style === 'no-frame' ? [25, 25] : [16, 32],\n }),\n });\n marker.addTo(this.customPointsLayer);\n }\n }\n\n /** Builds the shared Atlos marker composition for points and cluster summaries. */\n private createMarkerVisual(type: OEMPointType, point?: OEMPoint, count?: number): HTMLElement {\n const inner = document.createElement(point ? 'a' : 'div');\n inner.className = type.noFrame ? 'noFrameInner' : 'markerInner';\n if (point) {\n const link = inner as HTMLAnchorElement;\n link.href = createOEMPointUrl(point.id);\n link.target = '_blank';\n link.rel = 'noopener noreferrer';\n inner.classList.toggle('offLayer', point.position.floorId !== this.floorId);\n if (point.tier) inner.dataset.tier = point.position.floorId;\n }\n if (count !== undefined) inner.classList.add('clusterMarker');\n const image = document.createElement('img');\n image.src = resolveOEMAsset(this.options.resources.baseUrl, type.icon);\n image.alt = type.key;\n image.draggable = false;\n if (type.noFrame) {\n image.className = 'noFrameImage';\n inner.append(image);\n } else {\n const frame = document.createElement('div');\n frame.className = 'frameImage';\n frame.append(image);\n inner.append(frame);\n }\n if (type.subIcon) {\n const sub = document.createElement('div');\n sub.className = 'subIconContainer';\n const subImage = document.createElement('img');\n subImage.className = 'subIcon';\n subImage.src = resolveOEMAsset(this.options.resources.baseUrl, type.subIcon);\n subImage.alt = '';\n sub.append(subImage);\n inner.append(sub);\n }\n if (count !== undefined) {\n const badge = document.createElement('span');\n badge.className = 'clusterCount';\n badge.textContent = String(count);\n inner.append(badge);\n }\n return inner;\n }\n\n private createPointMarker(point: OEMPoint, type: OEMPointType): OEMMarker {\n return new OEMMarker(toOEMLeafletPosition(point.position, this.region), {\n interactive: true, keyboard: false, bubblingMouseEvents: false,\n icon: L.divIcon({ html: this.createMarkerVisual(type, point),\n className: `${type.noFrame ? 'noFrameMarkerIcon' : 'frameMarkerIcon'} incompleteMarker`,\n iconSize: type.noFrame ? [50, 50] : [32, 32], iconAnchor: type.noFrame ? [25, 25] : [16, 32] }),\n });\n }\n\n private createPointCluster(type: OEMPointType): L.MarkerClusterGroup {\n return L.markerClusterGroup({\n showCoverageOnHover: false,\n zoomToBoundsOnClick: !this.options.lockZoom,\n spiderfyOnMaxZoom: !this.options.lockZoom,\n disableClusteringAtZoom: 2,\n maxClusterRadius: 60,\n iconCreateFunction: (cluster) => L.divIcon({\n html: this.createMarkerVisual(type, undefined, cluster.getChildCount()),\n className: `${type.noFrame ? 'noFrameMarkerIcon' : 'frameMarkerIcon'} markerClusterCustom`,\n iconSize: type.noFrame ? [50, 50] : [32, 32],\n iconAnchor: type.noFrame ? [25, 25] : [16, 32],\n }),\n });\n }\n\n /** Rebuilds visible markers and groups eligible types with Atlos clustering rules. */\n private renderPoints(): void {\n this.clearPointLayers();\n const types = this.filter.types ? new Set(this.filter.types) : undefined;\n const subregions = this.filter.subregions ? new Set(this.filter.subregions) : undefined;\n for (const point of this.points) {\n if (types && !types.has(point.type)) continue;\n if (subregions && !subregions.has(point.subregionId)) continue;\n if (this.filter.floorOnly && point.position.floorId !== this.floorId) continue;\n const type = this.types[point.type];\n if (!type) continue;\n const marker = this.createPointMarker(point, type);\n if (this.markerClustering && CLUSTER_SUBCATEGORIES.has(type.category.sub)) {\n let group = this.pointClusters.get(type.key);\n if (!group) {\n group = this.createPointCluster(type);\n this.pointClusters.set(type.key, group);\n }\n group.addLayer(marker);\n } else marker.addTo(this.pointsLayer);\n }\n for (const group of this.pointClusters.values()) if (group.getLayers().length) group.addTo(this.map);\n }\n\n /** Renders Atlos-style fill and dashed stroke layers for published subregions. */\n private renderBoundaries(boundaries: OEMBoundary[]): void {\n this.boundariesLayer.clearLayers();\n for (const boundary of boundaries) {\n const rings = boundary.rings.map((ring) => ring.map((position) => toOEMLeafletPosition(position, this.region)));\n L.polygon(rings, { color: 'transparent', fillOpacity: 0.2, interactive: false,\n className: 'subregionBoundaryFill' }).addTo(this.boundariesLayer);\n L.polygon(rings, { weight: 2, opacity: 0.8, fill: false, interactive: false,\n className: 'subregionBoundaryStroke' }).addTo(this.boundariesLayer);\n }\n }\n /** Renders Atlos site or subregion labels according to the current zoom. */\n private renderLabels(force = false): void {\n const showSub = this.map.getZoom() <= 0.25 && this.labels.some((label) => label.type === 'sub');\n const visibleType: OEMLabel['type'] = showSub ? 'sub' : 'site';\n if (!force && visibleType === this.visibleLabelType) return;\n this.visibleLabelType = visibleType;\n this.labelsLayer.clearLayers();\n for (const label of this.labels) {\n if (label.type !== visibleType) continue;\n const inner = document.createElement('div');\n inner.className = label.type === 'sub' ? 'innerSub' : 'innerSite';\n inner.textContent = this.messages[label.textKey] ?? label.id.split('/').at(-1) ?? label.id;\n new OEMMarker(toOEMLeafletPosition(label.position, this.region), {\n pane: 'placeLabels', interactive: false, keyboard: false,\n icon: L.divIcon({ className: 'mapLabel', html: inner, iconSize: [0, 0] }),\n }).addTo(this.labelsLayer);\n }\n }\n /** Recalculates Leaflet dimensions after the host element changes size. */\n resize(): void { if (!this.destroyed) this.map.invalidateSize({ animate: false }); }\n\n /** Releases listeners, observers, pending requests, layers and DOM nodes. */\n destroy = (): void => {\n if (this.destroyed) return;\n this.destroyed = true;\n this.cancelRequests();\n this.customPointsRequest?.controller.abort();\n this.customPointsRequest = undefined;\n if (this.overdragFrame !== undefined) cancelAnimationFrame(this.overdragFrame);\n this.observer?.disconnect();\n this.wheel.dispose();\n this.options.signal?.removeEventListener('abort', this.destroy);\n this.listeners.clear();\n this.map.remove();\n this.root.remove();\n this.points = [];\n this.customPoints = [];\n this.clickPoints = [];\n this.clickPointOptions = undefined;\n this.customPointsLayer.clearLayers();\n this.pointShardRequests.clear();\n mounted.delete(this.container);\n };\n}\n", "import L from 'leaflet';\ninterface TileLevel {\n el: HTMLElement;\n origin: L.Point;\n zoom: number;\n}\ninterface ContinuousPixelMap extends L.Map {\n _getNewPixelOrigin(center: L.LatLng, zoom: number): L.Point;\n}\nexport class SmoothTileLayer extends L.TileLayer {\n _setZoomTransform(level: TileLevel, center: L.LatLng, zoom: number) {\n const map = (this as unknown as {\n _map?: ContinuousPixelMap;\n })._map;\n if (!map)\n return;\n const scale = map.getZoomScale(zoom, level.zoom);\n const translate = level.origin\n .multiplyBy(scale)\n .subtract(map._getNewPixelOrigin(center, zoom));\n if (L.Browser.any3d) {\n L.DomUtil.setTransform(level.el, translate, scale);\n }\n else {\n L.DomUtil.setPosition(level.el, translate);\n }\n }\n}\n", "import L from 'leaflet';\nimport { WHEEL_GESTURE_IDLE_MS, WheelInputRouter, type WheelGestureMode, } from 'trackpad-input';\nconst ZOOM_PER_WHEEL_PIXEL = 0.003;\nconst TRACKPAD_PINCH_ZOOM_PER_PIXEL = 0.01;\nconst INERTIA_INITIAL_FACTOR = 0.07;\nconst INERTIA_MAX_STEP = 0.008;\nconst INERTIA_FRICTION_PER_FRAME = 0.72;\nconst INERTIA_STOP_THRESHOLD = 0.00025;\nconst FRAME_DURATION = 1000 / 60;\nconst TRACKPAD_OVERDRAG_MAX_PX = 96;\nconst TRACKPAD_OVERDRAG_RESISTANCE = 0.65;\nconst TRACKPAD_OVERDRAG_SETTLE_THRESHOLD_PX = 80;\nconst TRACKPAD_OVERDRAG_SETTLE_MS = 48;\ninterface ContinuousZoomEventData {\n pinch: true;\n round: false;\n}\nconst CONTINUOUS_ZOOM_EVENT_DATA: ContinuousZoomEventData = {\n pinch: true,\n round: false,\n};\nexport interface SmoothWheelZoomOptions {\n /** Enables inertial continuation after wheel zoom input. */\n enableInertia?: boolean;\n /** Enables trackpad gestures classified as map panning. */\n panEnabled?: boolean;\n /** Enables wheel and trackpad gestures classified as map zooming. */\n zoomEnabled?: boolean;\n}\ninterface ContinuousZoomMap extends L.Map {\n _animatingZoom?: boolean;\n _getMapPanePos(): L.Point;\n _getNewPixelOrigin(center: L.LatLng, zoom: number): L.Point;\n _latLngToNewLayerPoint(latLng: L.LatLng, zoom: number, center: L.LatLng): L.Point;\n _limitCenter(center: L.LatLng, zoom: number, bounds: L.LatLngBounds): L.LatLng;\n _limitZoom(zoom: number): number;\n _move(center: L.LatLng, zoom: number, data?: ContinuousZoomEventData): this;\n _moveEnd(zoomChanged: boolean): this;\n _moveStart(zoomChanged: boolean, noMoveStart: boolean): this;\n _onZoomTransitionEnd?(): void;\n _rawPanBy(offset: L.Point): void;\n _stop(): this;\n}\ninterface SubpixelMarker {\n _icon?: HTMLElement;\n _latlng: L.LatLng;\n _map?: ContinuousZoomMap;\n _setPos(point: L.Point): void;\n}\ninterface MarkerZoomAnimation {\n center: L.LatLng;\n zoom: number;\n}\nconst installSubpixelPixelOrigin = (map: ContinuousZoomMap) => {\n map._getNewPixelOrigin = function (center, zoom) {\n return this.project(center, zoom)\n .subtract(this.getSize().divideBy(2))\n .add(this._getMapPanePos());\n };\n map.latLngToLayerPoint = function (latLng) {\n return this.project(latLng, this.getZoom()).subtract(this.getPixelOrigin());\n };\n};\nexport class SmoothWheelZoom {\n private readonly map: ContinuousZoomMap;\n private readonly container: HTMLElement;\n private readonly inertiaEnabled: boolean;\n private readonly panEnabled: boolean;\n private readonly zoomEnabled: boolean;\n private readonly wheelInputRouter: WheelInputRouter<WheelEvent>;\n private zoomFrame: number | null = null;\n private panFrame: number | null = null;\n private endTimer: number | null = null;\n private panTailTimer: number | null = null;\n private targetZoom: number | null = null;\n private anchorPoint: L.Point | null = null;\n private anchorLatLng: L.LatLng | null = null;\n private zoomVelocity = 0;\n private lastZoomInputTime: number | null = null;\n private inertiaStep = 0;\n private lastFrameTime: number | null = null;\n private pendingPanOffset = L.point(0, 0);\n private panRawCenterPoint: L.Point | null = null;\n private gestureMode: WheelGestureMode | null = null;\n private gestureActive = false;\n private trackpadDragging = false;\n private overdragSettling = false;\n private disposed = false;\n constructor(map: L.Map, options: SmoothWheelZoomOptions = {}) {\n this.map = map as ContinuousZoomMap;\n this.container = map.getContainer();\n this.inertiaEnabled = options.enableInertia ?? true;\n this.panEnabled = options.panEnabled ?? true;\n this.zoomEnabled = options.zoomEnabled ?? true;\n this.wheelInputRouter = new WheelInputRouter<WheelEvent>({\n onPan: (event) => this.handleRoutedWheel('pan', event),\n onZoom: (event) => this.handleRoutedWheel('zoom', event),\n });\n installSubpixelPixelOrigin(this.map);\n map.scrollWheelZoom.disable();\n this.container.addEventListener('wheel', this.handleWheel, {\n passive: false,\n });\n map.once('unload', this.dispose);\n }\n dispose = () => {\n if (this.disposed)\n return;\n this.disposed = true;\n this.container.removeEventListener('wheel', this.handleWheel);\n this.map.off('unload', this.dispose);\n this.clearScheduledWork();\n };\n private handleWheel = (event: WheelEvent) => {\n event.preventDefault();\n event.stopPropagation();\n this.finishLeafletZoomAnimation();\n const gestureMode = this.wheelInputRouter.route(event);\n if (gestureMode === 'pending' && this.overdragSettling) {\n this.clearOverdragSettlement();\n }\n };\n private handleRoutedWheel(gestureMode: WheelGestureMode, event: WheelEvent) {\n if ((gestureMode === 'pan' && !this.panEnabled) || (gestureMode === 'zoom' && !this.zoomEnabled))\n return;\n if (this.overdragSettling && gestureMode === 'pan') {\n this.schedulePanTailRelease();\n return;\n }\n if (this.overdragSettling)\n this.clearOverdragSettlement();\n this.routeWheelEvent(gestureMode, event);\n }\n private routeWheelEvent(gestureMode: WheelGestureMode, event: WheelEvent) {\n if (this.gestureActive &&\n this.gestureMode !== null &&\n this.gestureMode !== gestureMode) {\n this.finishGesture();\n }\n this.gestureMode = gestureMode;\n if (gestureMode === 'pan') {\n this.handleTrackpadPan(event);\n return;\n }\n this.handleZoom(event);\n }\n private handleZoom(event: WheelEvent) {\n const wheelDelta = L.DomEvent.getWheelDelta(event);\n if (!wheelDelta)\n return;\n const zoomDelta = event.ctrlKey && event.deltaMode === 0\n ? -event.deltaY * TRACKPAD_PINCH_ZOOM_PER_PIXEL\n : wheelDelta * ZOOM_PER_WHEEL_PIXEL;\n const currentTarget = this.targetZoom ?? this.map.getZoom();\n const nextTarget = this.map._limitZoom(currentTarget + zoomDelta);\n this.updateAnchor(event);\n this.targetZoom = nextTarget;\n if (this.inertiaEnabled) {\n this.updateZoomVelocity(nextTarget - currentTarget, performance.now());\n this.inertiaStep = Math.max(-INERTIA_MAX_STEP, Math.min(INERTIA_MAX_STEP, this.zoomVelocity * INERTIA_INITIAL_FACTOR));\n }\n else {\n this.inertiaStep = 0;\n }\n if (nextTarget !== this.map.getZoom())\n this.startGesture(true);\n if (this.gestureActive &&\n nextTarget !== this.map.getZoom() &&\n this.zoomFrame === null) {\n this.zoomFrame = requestAnimationFrame(this.applyZoomFrame);\n }\n this.scheduleGestureEnd();\n }\n private handleTrackpadPan(event: WheelEvent) {\n const offset = L.point(event.deltaX, event.deltaY);\n if (offset.x === 0 && offset.y === 0) {\n if (this.gestureActive && !this.overdragSettling) {\n this.scheduleGestureEnd();\n }\n return;\n }\n const wasActive = this.gestureActive;\n this.startGesture(false);\n if (!wasActive) {\n this.trackpadDragging = true;\n this.map.fire('dragstart');\n }\n this.pendingPanOffset = this.pendingPanOffset.add(offset);\n if (this.panFrame === null) {\n this.panFrame = requestAnimationFrame(this.applyPanFrame);\n }\n if (!this.overdragSettling)\n this.scheduleGestureEnd();\n }\n private startGesture(zoomChanged: boolean) {\n if (this.gestureActive)\n return;\n this.map._stop();\n this.map._moveStart(zoomChanged, false);\n this.gestureActive = true;\n }\n private updateAnchor(event: WheelEvent) {\n const point = this.map.mouseEventToContainerPoint(event);\n if (this.anchorPoint?.equals(point) && this.anchorLatLng !== null) {\n return;\n }\n this.anchorPoint = point;\n this.anchorLatLng = this.continuousContainerPointToLatLng(point);\n }\n private continuousContainerPointToLatLng(point: L.Point) {\n const centerPoint = this.map.getSize().divideBy(2);\n const center = this.map.getCenter();\n const zoom = this.map.getZoom();\n return this.map.unproject(this.map.project(center, zoom).add(point.subtract(centerPoint)), zoom);\n }\n private updateZoomVelocity(delta: number, timestamp: number) {\n if (this.lastZoomInputTime === null ||\n delta * this.zoomVelocity <= 0 ||\n timestamp - this.lastZoomInputTime > WHEEL_GESTURE_IDLE_MS) {\n this.zoomVelocity = delta;\n }\n else {\n const elapsed = Math.max(8, Math.min(40, timestamp - this.lastZoomInputTime));\n const frameDelta = delta * (FRAME_DURATION / elapsed);\n this.zoomVelocity = this.zoomVelocity * 0.65 + frameDelta * 0.35;\n }\n this.lastZoomInputTime = timestamp;\n }\n private applyZoomFrame = (timestamp: number) => {\n this.zoomFrame = null;\n if (!this.gestureActive)\n return;\n const elapsed = this.lastFrameTime === null\n ? FRAME_DURATION\n : Math.max(8, Math.min(34, timestamp - this.lastFrameTime));\n this.lastFrameTime = timestamp;\n const currentZoom = this.map.getZoom();\n const directTarget = this.targetZoom;\n let zoom = directTarget ?? currentZoom;\n this.targetZoom = null;\n if (this.inertiaEnabled && directTarget === null) {\n if (Math.abs(this.inertiaStep) < INERTIA_STOP_THRESHOLD) {\n this.inertiaStep = 0;\n }\n else {\n const zoomBeforeInertia = zoom;\n zoom = this.map._limitZoom(zoom + this.inertiaStep * (elapsed / FRAME_DURATION));\n if (zoom === zoomBeforeInertia) {\n this.inertiaStep = 0;\n }\n else {\n this.inertiaStep *= Math.pow(INERTIA_FRICTION_PER_FRAME, elapsed / FRAME_DURATION);\n }\n }\n }\n if (zoom !== currentZoom) {\n this.moveToZoom(zoom);\n }\n if (this.targetZoom !== null ||\n (this.inertiaEnabled &&\n Math.abs(this.inertiaStep) >= INERTIA_STOP_THRESHOLD)) {\n this.zoomFrame = requestAnimationFrame(this.applyZoomFrame);\n return;\n }\n this.lastFrameTime = null;\n if (this.endTimer === null) {\n this.finishGesture();\n }\n };\n private applyPanFrame = () => {\n this.panFrame = null;\n if (!this.gestureActive || this.gestureMode !== 'pan')\n return;\n const offset = this.pendingPanOffset;\n this.pendingPanOffset = L.point(0, 0);\n if (offset.x !== 0 || offset.y !== 0) {\n const overdragAmount = this.applyConstrainedPan(offset);\n this.map.fire('move').fire('drag');\n if (overdragAmount >= TRACKPAD_OVERDRAG_SETTLE_THRESHOLD_PX) {\n this.beginOverdragSettlement();\n }\n }\n if (this.pendingPanOffset.x !== 0 || this.pendingPanOffset.y !== 0) {\n this.panFrame = requestAnimationFrame(this.applyPanFrame);\n return;\n }\n if (this.endTimer === null) {\n this.finishGesture();\n }\n };\n private applyConstrainedPan(offset: L.Point) {\n const zoom = this.map.getZoom();\n const currentCenterPoint = this.map.project(this.map.getCenter(), zoom);\n this.panRawCenterPoint ??= currentCenterPoint;\n this.panRawCenterPoint = this.panRawCenterPoint.add(offset);\n const configuredBounds = this.map.options.maxBounds;\n if (!configuredBounds) {\n this.map._rawPanBy(offset);\n return 0;\n }\n const maxBounds = configuredBounds instanceof L.LatLngBounds\n ? configuredBounds\n : L.latLngBounds(configuredBounds);\n const rawCenter = this.map.unproject(this.panRawCenterPoint, zoom);\n const limitedCenter = this.map._limitCenter(rawCenter, zoom, maxBounds);\n const limitedCenterPoint = this.map.project(limitedCenter, zoom);\n const rawOverdrag = this.panRawCenterPoint.subtract(limitedCenterPoint);\n const visualOverdrag = L.point(this.resistOverdrag(rawOverdrag.x), this.resistOverdrag(rawOverdrag.y));\n const visualCenterPoint = limitedCenterPoint.add(visualOverdrag);\n const visualOffset = visualCenterPoint.subtract(currentCenterPoint);\n if (visualOffset.x !== 0 || visualOffset.y !== 0) {\n this.map._rawPanBy(visualOffset);\n }\n return Math.max(Math.abs(visualOverdrag.x), Math.abs(visualOverdrag.y));\n }\n private resistOverdrag(value: number) {\n if (value === 0)\n return 0;\n const magnitude = TRACKPAD_OVERDRAG_MAX_PX *\n (1 -\n Math.exp((-Math.abs(value) * TRACKPAD_OVERDRAG_RESISTANCE) /\n TRACKPAD_OVERDRAG_MAX_PX));\n return Math.sign(value) * magnitude;\n }\n private beginOverdragSettlement() {\n if (this.overdragSettling)\n return;\n this.overdragSettling = true;\n this.schedulePanTailRelease();\n if (this.endTimer !== null)\n window.clearTimeout(this.endTimer);\n this.endTimer = window.setTimeout(this.handleGestureEnd, TRACKPAD_OVERDRAG_SETTLE_MS);\n }\n private schedulePanTailRelease() {\n if (this.panTailTimer !== null) {\n window.clearTimeout(this.panTailTimer);\n }\n this.panTailTimer = window.setTimeout(() => {\n this.panTailTimer = null;\n this.overdragSettling = false;\n }, WHEEL_GESTURE_IDLE_MS);\n }\n private clearOverdragSettlement() {\n this.overdragSettling = false;\n if (this.panTailTimer !== null) {\n window.clearTimeout(this.panTailTimer);\n this.panTailTimer = null;\n }\n }\n private moveToZoom(zoom: number) {\n if (this.anchorPoint === null || this.anchorLatLng === null)\n return;\n const centerPoint = this.map.getSize().divideBy(2);\n const cursorOffset = this.anchorPoint.subtract(centerPoint);\n let center = this.map.unproject(this.map.project(this.anchorLatLng, zoom).subtract(cursorOffset), zoom);\n const configuredBounds = this.map.options.maxBounds;\n if (configuredBounds) {\n const maxBounds = configuredBounds instanceof L.LatLngBounds\n ? configuredBounds\n : L.latLngBounds(configuredBounds);\n center = this.map._limitCenter(center, zoom, maxBounds);\n }\n this.map._move(center, zoom, CONTINUOUS_ZOOM_EVENT_DATA);\n }\n private scheduleGestureEnd() {\n if (this.endTimer !== null) {\n window.clearTimeout(this.endTimer);\n }\n this.endTimer = window.setTimeout(this.handleGestureEnd, WHEEL_GESTURE_IDLE_MS);\n }\n private handleGestureEnd = () => {\n this.endTimer = null;\n if (this.zoomFrame === null &&\n this.panFrame === null &&\n this.targetZoom === null &&\n this.pendingPanOffset.x === 0 &&\n this.pendingPanOffset.y === 0 &&\n (!this.inertiaEnabled ||\n Math.abs(this.inertiaStep) < INERTIA_STOP_THRESHOLD)) {\n this.finishGesture();\n }\n };\n private finishGesture() {\n if (this.endTimer !== null) {\n window.clearTimeout(this.endTimer);\n this.endTimer = null;\n }\n if (this.zoomFrame !== null) {\n cancelAnimationFrame(this.zoomFrame);\n this.zoomFrame = null;\n }\n if (this.panFrame !== null) {\n cancelAnimationFrame(this.panFrame);\n this.panFrame = null;\n }\n if (!this.gestureActive) {\n this.resetVisualState();\n return;\n }\n const wasTrackpadDrag = this.trackpadDragging;\n this.gestureActive = false;\n this.trackpadDragging = false;\n if (wasTrackpadDrag)\n this.map.fire('dragend');\n this.map._moveEnd(this.gestureMode === 'zoom');\n this.resetVisualState();\n }\n private finishLeafletZoomAnimation() {\n if (this.map._animatingZoom) {\n this.map._onZoomTransitionEnd?.();\n }\n }\n private resetVisualState() {\n this.targetZoom = null;\n this.anchorPoint = null;\n this.anchorLatLng = null;\n this.zoomVelocity = 0;\n this.lastZoomInputTime = null;\n this.inertiaStep = 0;\n this.lastFrameTime = null;\n this.pendingPanOffset = L.point(0, 0);\n this.panRawCenterPoint = null;\n this.gestureMode = null;\n this.trackpadDragging = false;\n }\n private clearScheduledWork() {\n if (this.zoomFrame !== null) {\n cancelAnimationFrame(this.zoomFrame);\n this.zoomFrame = null;\n }\n if (this.panFrame !== null) {\n cancelAnimationFrame(this.panFrame);\n this.panFrame = null;\n }\n if (this.endTimer !== null) {\n window.clearTimeout(this.endTimer);\n this.endTimer = null;\n }\n this.clearOverdragSettlement();\n this.gestureActive = false;\n this.resetVisualState();\n this.wheelInputRouter.dispose();\n }\n}\nexport const enableSmoothWheelZoom = (map: L.Map, options?: SmoothWheelZoomOptions) => new SmoothWheelZoom(map, options);\n", "import L from 'leaflet';\ninterface BoundsAwareMap extends L.Map {\n _limitCenter(center: L.LatLng, zoom: number, bounds: L.LatLngBounds): L.LatLng;\n}\nexport const toMapBounds = (bounds: L.Map['options']['maxBounds']): L.LatLngBounds | null => {\n if (!bounds)\n return null;\n if (bounds instanceof L.LatLngBounds)\n return bounds;\n return Array.isArray(bounds) && bounds.length === 2\n ? L.latLngBounds(bounds[0], bounds[1])\n : null;\n};\nexport const isMapOverdragged = (map: L.Map, bounds: L.LatLngBounds): boolean => {\n const constrainedMap = map as BoundsAwareMap;\n const center = map.getCenter();\n const constrainedCenter = constrainedMap._limitCenter(center, map.getZoom(), bounds);\n return (map\n .project(center, map.getZoom())\n .distanceTo(map.project(constrainedCenter, map.getZoom())) > 1);\n};\n", "import type { OEMFloor, OEMRegion } from '@opendfieldmap/core';\n\nexport interface OEMTileLookup { covered: boolean; version?: string }\n\nexport const lookupOEMTile = (\n coverage: OEMRegion['coverage'],\n floor: OEMFloor,\n zoom: number,\n x: number,\n y: number,\n): OEMTileLookup => {\n const ranges = coverage[String(zoom)]?.[floor.id]?.[String(y)] ?? [];\n let offset = 0;\n for (let index = 0; index < ranges.length; index += 2) {\n const start = ranges[index];\n const end = ranges[index + 1];\n if (x >= start && x <= end) {\n return {\n covered: true,\n version: floor.tileVersions?.[String(zoom)]?.[String(y)]?.[offset + x - start],\n };\n }\n offset += end - start + 1;\n }\n return { covered: false };\n};\n\nexport const appendOEMTileVersion = (url: string, version?: string): string =>\n version ? `${url}${url.includes('?') ? '&' : '?'}v=${encodeURIComponent(version)}` : url;\n", "<svg width=\"83\" height=\"81\" viewBox=\"0 0 83 81\" xmlns=\"http://www.w3.org/2000/svg\">\n<path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M41.3763 0C18.4963 0 0 18.5625 0 41.5268C0 59.8835 11.8512 75.422 28.292 80.9215C30.3475 81.335 31.1004 80.028 31.1004 78.9286C31.1004 77.9659 31.0327 74.666 31.0327 71.2277C19.5228 73.7032 17.1259 66.2774 17.1259 66.2774C15.2762 61.4647 12.5355 60.2277 12.5355 60.2277C8.76836 57.6838 12.8099 57.6838 12.8099 57.6838C16.9887 57.9589 19.1815 61.9464 19.1815 61.9464C22.8801 68.2712 28.84 66.4841 31.2376 65.3839C31.5798 62.7024 32.6766 60.8462 33.8411 59.8151C24.6612 58.8524 15.0027 55.2774 15.0027 39.3263C15.0027 34.7887 16.6457 31.0762 19.2492 28.1888C18.8385 27.1578 17.3995 22.8943 19.6608 17.188C19.6608 17.188 23.1545 16.0878 31.0318 21.4507C34.4044 20.5417 37.8825 20.0792 41.3763 20.0753C44.87 20.0753 48.4314 20.5571 51.72 21.4507C59.5982 16.0878 63.0919 17.188 63.0919 17.188C65.3532 22.8943 63.9134 27.1578 63.5026 28.1888C66.1747 31.0762 67.75 34.7887 67.75 39.3263C67.75 55.2774 58.0915 58.7832 48.843 59.8151C50.3505 61.1213 51.6514 63.596 51.6514 67.5152C51.6514 73.0839 51.5837 77.5533 51.5837 78.9277C51.5837 80.028 52.3374 81.335 54.3921 80.9224C70.8329 75.4211 82.6841 59.8835 82.6841 41.5268C82.7518 18.5625 64.1878 0 41.3763 0Z\"/>\n</svg>\n"],
5
+ "mappings": ";AAAA,OAAOA,QAAO;AACd,OAAO;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;;;ACZP,OAAO,OAAO;AASP,IAAM,kBAAN,cAA8B,EAAE,UAAU;AAAA,EAC7C,kBAAkB,OAAkB,QAAkB,MAAc;AAChE,UAAM,MAAO,KAEV;AACH,QAAI,CAAC;AACD;AACJ,UAAM,QAAQ,IAAI,aAAa,MAAM,MAAM,IAAI;AAC/C,UAAM,YAAY,MAAM,OACnB,WAAW,KAAK,EAChB,SAAS,IAAI,mBAAmB,QAAQ,IAAI,CAAC;AAClD,QAAI,EAAE,QAAQ,OAA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AAO;AACjB,SAAK,SAAS,CAAC;AACf,SAAK,eAAe,CAAC;AACrB,SAAK,cAAc,CAAC;AACpB,SAAK,oBAAoB;AACzB,SAAK,kBAAkB,YAAY;AACnC,SAAK,mBAAmB,MAAM;AAC9B,YAAQ,OAAO,KAAK,SAAS;AAAA,EAC/B;AACF;",
6
+ "names": ["L", "L", "L", "L", "scale", "pixelX", "pixelZ", "value"]
7
+ }
package/dist/runtime.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import 'leaflet.markercluster';
2
2
  import type { OEMManifest, OEMPoint, OEMPointFilter, OEMPosition, OEMView } from '@opendfieldmap/core';
3
- import type { OEM as OEMContract, OEMCustomPoint, OEMEvents, OEMFeatures, OEMOptions, OEMZoomOptions } from './types';
3
+ import type { OEM as OEMContract, OEMClickPointOptions, OEMCustomPoint, OEMEvents, OEMFeatures, OEMOptions, OEMZoomOptions } from './types';
4
4
  /** Leaflet-backed implementation of the public OEM interface. */
5
5
  export declare class OEM implements OEMContract {
6
6
  private container;
@@ -12,6 +12,7 @@ export declare class OEM implements OEMContract {
12
12
  private region;
13
13
  private floorId;
14
14
  private features;
15
+ private boundarySource;
15
16
  private listeners;
16
17
  private requests;
17
18
  private baseTiles?;
@@ -23,6 +24,9 @@ export declare class OEM implements OEMContract {
23
24
  private boundariesLayer;
24
25
  private points;
25
26
  private customPoints;
27
+ private clickPoints;
28
+ private clickPointOptions?;
29
+ private clickPointSequence;
26
30
  private customPointsRequest?;
27
31
  private pointIndex?;
28
32
  private pointIndexRequest?;
@@ -49,6 +53,7 @@ export declare class OEM implements OEMContract {
49
53
  private validateFloor;
50
54
  private validatePosition;
51
55
  private normalizeCustomPoints;
56
+ private normalizeClickPointOptions;
52
57
  private position;
53
58
  private inferSubregionId;
54
59
  private emitMapClick;
@@ -92,6 +97,10 @@ export declare class OEM implements OEMContract {
92
97
  setFeatures(features: OEMFeatures): Promise<void>;
93
98
  /** Replaces host-defined points without reloading static map data. */
94
99
  setCustomPoints(points: readonly OEMCustomPoint[]): void;
100
+ /** Enables or disables automatic custom-point creation from map clicks. */
101
+ setClickPointMode(options?: OEMClickPointOptions | null): void;
102
+ /** Removes only points created by the click-point mode. */
103
+ clearClickPoints(): void;
95
104
  loadCustomPoints(url: string): Promise<void>;
96
105
  /** Removes all host-defined points from this map instance. */
97
106
  clearCustomPoints(): void;
package/dist/types.d.ts CHANGED
@@ -1,9 +1,10 @@
1
- import type { OEMGameXZPosition, OEMManifest, OEMMapPosition, OEMPoint, OEMPointFilter, OEMPosition, OEMResources, OEMView } from '@opendfieldmap/core';
1
+ import type { OEMBoundarySource, OEMGameXZPosition, OEMManifest, OEMMapPosition, OEMPoint, OEMPointFilter, OEMPosition, OEMResources, OEMView } from '@opendfieldmap/core';
2
2
  /** Optional static layers controlled independently by the host. */
3
3
  export interface OEMFeatures {
4
4
  points?: boolean;
5
5
  labels?: boolean;
6
6
  boundaries?: boolean;
7
+ boundarySource?: OEMBoundarySource;
7
8
  }
8
9
  /** Low-level rendering options used by the public Widget package. */
9
10
  export interface OEMOptions {
@@ -38,6 +39,13 @@ export interface OEMCustomPoint {
38
39
  /** Image URL used by the Atlos marker composition. */
39
40
  icon: string;
40
41
  }
42
+ /** Visual configuration for points created from map clicks. */
43
+ export interface OEMClickPointOptions {
44
+ /** Keeps every clicked point, or replaces the previous clicked point. */
45
+ mode: 'multiple' | 'single';
46
+ style: OEMCustomPoint['style'];
47
+ icon: string;
48
+ }
41
49
  /** Coordinates reported when the host selects a location on the map. */
42
50
  export interface OEMMapClick {
43
51
  position: OEMMapPosition;
@@ -91,6 +99,10 @@ export interface OEM {
91
99
  setFeatures(features: OEMFeatures): Promise<void>;
92
100
  setPointFilter(filter: OEMPointFilter): void;
93
101
  setCustomPoints(points: readonly OEMCustomPoint[]): void;
102
+ /** Enables automatic custom-point creation when the map is clicked. */
103
+ setClickPointMode(options?: OEMClickPointOptions | null): void;
104
+ /** Removes points that were created by map clicks, while keeping host points. */
105
+ clearClickPoints(): void;
94
106
  loadCustomPoints(url: string): Promise<void>;
95
107
  clearCustomPoints(): void;
96
108
  getPoint(pointId: string): OEMPoint | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opendfieldmap/map",
3
- "version": "0.2.0-beta",
3
+ "version": "0.2.1-beta",
4
4
  "description": "Rendering kernel for Open Endfield Map widgets",
5
5
  "type": "module",
6
6
  "license": "AGPL-3.0-only",
@@ -22,7 +22,7 @@
22
22
  "leaflet": "1.9.4",
23
23
  "leaflet.markercluster": "1.5.3",
24
24
  "trackpad-input": "0.1.1",
25
- "@opendfieldmap/core": "^0.2.0-beta"
25
+ "@opendfieldmap/core": "^0.2.1-beta"
26
26
  },
27
27
  "devDependencies": {
28
28
  "@types/leaflet": "1.9.16",
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../src/runtime.ts", "../src/atlos/smoothTileLayer.ts", "../src/atlos/smoothWheelZoom.ts", "../src/atlos/mapOverdrag.ts", "../src/tileVersion.ts", "../src/assets/ghicon.svg"],
4
- "sourcesContent": ["import L from 'leaflet';\nimport 'leaflet.markercluster';\nimport {\n createOEMPointUrl,\n fetchOEMJson,\n fromOEMLeafletPosition,\n getOEMRegion,\n mapToGameXZPosition,\n normalizeOEMLocale,\n resolveOEMAsset,\n toOEMLeafletMapPosition,\n toOEMLeafletPosition,\n} from '@opendfieldmap/core';\nimport type {\n OEMAsset,\n OEMBoundary,\n OEMFloor,\n OEMLabel,\n OEMLocaleMessages,\n OEMManifest,\n OEMPoint,\n OEMPointFilter,\n OEMMapPosition,\n OEMPointType,\n OEMPosition,\n OEMRegion,\n OEMView,\n} from '@opendfieldmap/core';\nimport type { OEM as OEMContract, OEMCustomPoint, OEMEvents, OEMFeatures, OEMOptions, OEMZoomOptions } from './types';\nimport { SmoothTileLayer } from './atlos/smoothTileLayer';\nimport { enableSmoothWheelZoom } from './atlos/smoothWheelZoom';\nimport { isMapOverdragged, toMapBounds } from './atlos/mapOverdrag';\nimport { appendOEMTileVersion, lookupOEMTile } from './tileVersion';\nimport GithubIcon from './assets/ghicon.svg';\n\nconst mounted = new WeakSet<HTMLElement>();\nconst CLUSTER_SUBCATEGORIES = new Set(['boss', 'collection', 'mob', 'natural', 'valuable', 'exploration']);\nconst FEATURE_NAMES = ['points', 'labels', 'boundaries'] as const;\nconst BRAND_URL = 'https://oem.re/';\nconst GITHUB_URL = 'https://github.com/Terra-Online/OEM-SDK';\nconst TERMS_URL = 'https://blog.opendfieldmap.org/docs/tos#intellectual-property-and-copyright';\n\nconst cloneFilter = (filter: OEMPointFilter): OEMPointFilter => ({\n types: filter.types ? [...filter.types] : undefined,\n subregions: filter.subregions ? [...filter.subregions] : undefined,\n floorOnly: filter.floorOnly,\n});\n\nconst sameList = (left?: string[], right?: string[]): boolean =>\n left === right || (!!left && !!right && left.length === right.length &&\n left.every((value, index) => value === right[index]));\n\nconst sameFilter = (left: OEMPointFilter, right: OEMPointFilter): boolean =>\n left.floorOnly === right.floorOnly &&\n sameList(left.types, right.types) &&\n sameList(left.subregions, right.subregions);\n\nconst clonePoint = (point: OEMPoint): OEMPoint => ({\n ...point,\n raw: { ...point.raw },\n position: { ...point.position },\n});\n\nconst cloneCustomPoint = (point: OEMCustomPoint): OEMCustomPoint => ({\n ...point,\n position: { ...point.position },\n});\n\n/** Leaflet marker with the subpixel positioning used by Atlos. */\nclass OEMMarker extends L.Marker {\n update(): this {\n const marker = this as unknown as { _icon?: HTMLElement; _map?: L.Map; _latlng: L.LatLng; _setPos(point: L.Point): void };\n if (marker._icon && marker._map) marker._setPos(marker._map.latLngToLayerPoint(marker._latlng));\n return this;\n }\n _animateZoom(event: { center: L.LatLng; zoom: number }): void {\n const marker = this as unknown as {\n _map?: L.Map & { _latLngToNewLayerPoint(latlng: L.LatLng, zoom: number, center: L.LatLng): L.Point };\n _latlng: L.LatLng;\n _setPos(point: L.Point): void;\n };\n if (marker._map) marker._setPos(marker._map._latLngToNewLayerPoint(marker._latlng, event.zoom, event.center));\n }\n}\n\n/** Tile layer that skips coordinates absent from the published coverage index. */\nclass CoveredTileLayer extends SmoothTileLayer {\n constructor(url: string, options: L.TileLayerOptions, private coverage: OEMRegion['coverage'], private floor: OEMFloor) {\n super(url, options);\n }\n getTileUrl(coords: L.Coords): string {\n const tile = lookupOEMTile(this.coverage, this.floor, coords.z, coords.x, coords.y);\n return appendOEMTileVersion(super.getTileUrl(coords), tile.version);\n }\n _isValidTile(coords: L.Coords): boolean {\n const prototype = L.GridLayer.prototype as unknown as {\n _isValidTile(this: L.GridLayer, value: L.Coords): boolean;\n };\n return prototype._isValidTile.call(this, coords) &&\n lookupOEMTile(this.coverage, this.floor, coords.z, coords.x, coords.y).covered;\n }\n}\n\n/** Leaflet-backed implementation of the public OEM interface. */\nexport class OEM implements OEMContract {\n destroyed = false;\n private map: L.Map;\n private root: HTMLDivElement;\n private region: OEMRegion;\n private floorId = 'M';\n private features: OEMFeatures = {};\n private listeners = new Map<keyof OEMEvents, Set<(payload: never) => void>>();\n private requests = new Map<keyof OEMFeatures, AbortController>();\n private baseTiles?: L.TileLayer;\n private floorTiles?: L.TileLayer;\n private pointsLayer = L.layerGroup();\n private customPointsLayer = L.layerGroup();\n private pointClusters = new Map<string, L.MarkerClusterGroup>();\n private labelsLayer = L.layerGroup();\n private boundariesLayer = L.layerGroup();\n private points: OEMPoint[] = [];\n private customPoints: OEMCustomPoint[] = [];\n private customPointsRequest?: { controller: AbortController; promise: Promise<void> };\n private pointIndex?: Record<string, string>;\n private pointIndexRequest?: Promise<Record<string, string>>;\n private pointShardRequests = new Map<string, Promise<OEMPoint[]>>();\n private types: Record<string, OEMPointType> = {};\n private labels: OEMLabel[] = [];\n private visibleLabelType?: OEMLabel['type'];\n private messages: OEMLocaleMessages = {};\n private filter: OEMPointFilter = {};\n private markerClustering: boolean;\n private locale: string;\n private resolvedLocale: string;\n private attributionBrand: HTMLAnchorElement;\n private attributionLink: HTMLAnchorElement;\n private observer?: ResizeObserver;\n private updatingView = false;\n private emittedView?: OEMView;\n private overdragFrame?: number;\n private overdragged = false;\n private wheel: ReturnType<typeof enableSmoothWheelZoom>;\n\n constructor(private container: HTMLElement, readonly manifest: OEMManifest, private options: OEMOptions) {\n if (mounted.has(container)) throw new Error('This container already hosts an OEM instance');\n this.region = getOEMRegion(manifest, options.view?.regionId ?? options.regionId ?? manifest.defaultRegionId);\n this.filter = cloneFilter(options.pointFilter ?? {});\n this.customPoints = this.normalizeCustomPoints(options.customPoints ?? []);\n this.markerClustering = options.markerClustering ?? true;\n const initialFloor = options.view?.floorId ?? options.floorId ?? 'M';\n this.validateFloor(initialFloor);\n if (options.view) this.validatePosition(options.view);\n this.locale = options.locale ?? manifest.fallbackLocale;\n this.resolvedLocale = normalizeOEMLocale(this.locale, Object.keys(manifest.locales), manifest.fallbackLocale);\n this.root = document.createElement('div');\n this.root.className = 'mapRoot';\n this.root.dataset.theme = options.theme ?? 'light';\n container.append(this.root);\n mounted.add(container);\n this.map = L.map(this.root, {\n crs: L.CRS.Simple, minZoom: 0, maxZoom: 3, zoomControl: false, attributionControl: false,\n dragging: !options.lockDrag, touchZoom: !options.lockZoom, boxZoom: !options.lockZoom,\n keyboard: !options.lockZoom, doubleClickZoom: false, scrollWheelZoom: false, zoomAnimation: true,\n markerZoomAnimation: true, fadeAnimation: true, zoomSnap: 0, zoomDelta: 0.25,\n });\n this.wheel = enableSmoothWheelZoom(this.map, {\n enableInertia: true,\n panEnabled: !options.lockDrag,\n zoomEnabled: !options.lockZoom,\n });\n const pane = this.map.createPane('placeLabels');\n pane.style.zIndex = '650';\n pane.style.pointerEvents = 'none';\n this.pointsLayer.addTo(this.map);\n this.customPointsLayer.addTo(this.map);\n this.labelsLayer.addTo(this.map);\n this.boundariesLayer.addTo(this.map);\n const credit = document.createElement('div');\n credit.className = 'attribution';\n const github = document.createElement('a');\n github.className = 'attributionGithub';\n github.href = GITHUB_URL;\n github.target = '_blank';\n github.rel = 'noopener noreferrer';\n github.setAttribute('aria-label', 'GitHub');\n github.innerHTML = GithubIcon;\n const githubSvg = github.querySelector('svg');\n githubSvg?.setAttribute('aria-hidden', 'true');\n githubSvg?.setAttribute('focusable', 'false');\n this.attributionBrand = document.createElement('a');\n this.attributionBrand.className = 'attributionBrand';\n this.attributionBrand.href = BRAND_URL;\n const separator = document.createElement('span');\n separator.className = 'attributionSeparator';\n separator.textContent = '\u00B7';\n separator.setAttribute('aria-hidden', 'true');\n this.attributionLink = document.createElement('a');\n this.attributionLink.className = 'attributionLink';\n this.attributionLink.href = TERMS_URL;\n this.attributionLink.target = '_blank';\n this.attributionLink.rel = 'noopener noreferrer';\n credit.append(github, this.attributionBrand, separator, this.attributionLink);\n this.updateAttribution();\n this.root.append(credit);\n this.applyRegion(options.view);\n this.setFloor(initialFloor);\n this.renderCustomPoints();\n this.map.on('click', this.emitMapClick);\n this.map.on('moveend zoomend', this.emitView);\n this.map.on('move drag', this.scheduleOverdragUpdate);\n this.map.on('moveend dragend movestart zoomstart', this.clearOverdrag);\n if (typeof ResizeObserver !== 'undefined') {\n this.observer = new ResizeObserver(() => this.resize());\n this.observer.observe(container);\n }\n options.signal?.addEventListener('abort', this.destroy, { once: true });\n }\n\n /** Prevents calls against a released map instance. */\n private assertAlive(): void { if (this.destroyed) throw new Error('OEM instance has been destroyed'); }\n private validateFloor(id: string): void {\n if (!this.region.floors.some((floor) => floor.id === id)) throw new Error(`Unknown floor ${id} in ${this.region.id}`);\n }\n private validatePosition(position: OEMPosition): void { toOEMLeafletPosition(position, this.region); }\n private normalizeCustomPoints(points: readonly OEMCustomPoint[]): OEMCustomPoint[] {\n const ids = new Set<string>();\n return points.map((point) => {\n if (!point || typeof point.id !== 'string' || !point.id.trim()) {\n throw new Error(`Custom point IDs must be non-empty and unique: ${point?.id}`);\n }\n const id = point.id.trim();\n if (ids.has(id)) throw new Error(`Custom point IDs must be non-empty and unique: ${id}`);\n ids.add(id);\n if (!point.position || typeof point.position.regionId !== 'string') {\n throw new Error(`Invalid custom point position: ${id}`);\n }\n if (point.style !== 'framed' && point.style !== 'no-frame') {\n throw new Error(`Invalid custom point style: ${id}`);\n }\n if (typeof point.icon !== 'string' || !point.icon) {\n throw new Error(`Custom point icon must be a non-empty URL: ${id}`);\n }\n const pointRegion = getOEMRegion(this.manifest, point.position.regionId);\n toOEMLeafletMapPosition(point.position);\n if (point.position.subregionId && !pointRegion.subregions.some((subregion) => subregion.id === point.position.subregionId)) {\n throw new Error(`Unknown custom point subregion ${point.position.subregionId} in ${point.position.regionId}`);\n }\n if (point.position.floorId && !pointRegion.floors.some((floor) => floor.id === point.position.floorId)) {\n throw new Error(`Unknown custom point floor ${point.position.floorId} in ${point.position.regionId}`);\n }\n return { ...cloneCustomPoint(point), id };\n });\n }\n private position(latlng: L.LatLng): OEMPosition {\n return fromOEMLeafletPosition(latlng.lat, latlng.lng, this.region, this.floorId);\n }\n private inferSubregionId(x: number, y: number): string | undefined {\n const selected = this.filter.subregions?.filter((id) => this.region.subregions.some((subregion) => subregion.id === id));\n if (selected?.length === 1) {\n const subregion = this.region.subregions.find((entry) => entry.id === selected[0]);\n if (!subregion?.bounds) return subregion?.id;\n const scale = 2 ** this.region.maxNativeZoom;\n const [[minX, minY], [maxX, maxY]] = subregion.bounds;\n const pixelX = x * scale;\n const pixelY = y * scale;\n if (pixelX >= minX && pixelX <= maxX && pixelY >= minY && pixelY <= maxY) return subregion.id;\n }\n const scale = 2 ** this.region.maxNativeZoom;\n const pixelX = x * scale;\n const pixelY = y * scale;\n return this.region.subregions.find((subregion) => {\n if (!subregion.bounds) return false;\n const [[minX, minY], [maxX, maxY]] = subregion.bounds;\n return pixelX >= minX && pixelX <= maxX && pixelY >= minY && pixelY <= maxY;\n })?.id;\n }\n private emitMapClick = (event: L.LeafletMouseEvent): void => {\n if (this.destroyed) return;\n const subregionId = this.inferSubregionId(event.latlng.lng, -event.latlng.lat);\n const position: OEMMapPosition = {\n regionId: this.region.id,\n x: event.latlng.lng,\n y: -event.latlng.lat,\n floorId: this.floorId,\n ...(subregionId ? { subregionId } : {}),\n };\n this.emit('click', { position, game: mapToGameXZPosition(position, this.region) });\n };\n private emit<Event extends keyof OEMEvents>(event: Event, payload: OEMEvents[Event]): void {\n this.listeners.get(event)?.forEach((handler) => handler(payload as never));\n if (event === 'error') this.options.onError?.(payload as Error);\n }\n private scheduleOverdragUpdate = (): void => {\n if (this.overdragFrame !== undefined) return;\n this.overdragFrame = requestAnimationFrame(() => {\n this.overdragFrame = undefined;\n const bounds = toMapBounds(this.map.options.maxBounds);\n const overdragged = !!bounds && isMapOverdragged(this.map, bounds);\n if (overdragged === this.overdragged) return;\n this.overdragged = overdragged;\n this.root.classList.toggle('overdrag', overdragged);\n });\n };\n private clearOverdrag = (): void => {\n if (this.overdragFrame !== undefined) cancelAnimationFrame(this.overdragFrame);\n this.overdragFrame = undefined;\n if (!this.overdragged) return;\n this.overdragged = false;\n this.root.classList.remove('overdrag');\n };\n /** Emits one resolved view for duplicate Leaflet move and zoom events. */\n private emitView = (): void => {\n if (this.destroyed || this.updatingView) return;\n const view = this.getView();\n if (this.emittedView && view.regionId === this.emittedView.regionId &&\n view.floorId === this.emittedView.floorId && view.x === this.emittedView.x &&\n view.y === this.emittedView.y && view.zoom === this.emittedView.zoom) return;\n this.emittedView = view;\n this.emit('viewchange', view);\n this.renderLabels();\n };\n /** Resolves the compact attribution without inheriting the map control font. */\n private updateAttribution(): void {\n const messages = this.manifest.controls[this.resolvedLocale] ?? this.manifest.controls[this.manifest.fallbackLocale];\n if (!messages) throw new Error('Missing OEM attribution messages');\n this.attributionBrand.textContent = messages.brandName;\n this.attributionLink.textContent = messages.termsOfService;\n }\n on<Event extends keyof OEMEvents>(event: Event, handler: (payload: OEMEvents[Event]) => void): () => void {\n this.assertAlive();\n const handlers = this.listeners.get(event) ?? new Set();\n handlers.add(handler as (payload: never) => void);\n this.listeners.set(event, handlers);\n return () => { handlers.delete(handler as (payload: never) => void); };\n }\n /** Rebuilds the base map constraints and main tile layer for one region. */\n private applyRegion(view?: OEMView): void {\n this.updatingView = true;\n this.baseTiles?.remove();\n this.floorTiles?.remove();\n this.floorTiles = undefined;\n this.floorId = 'M';\n this.map.setMaxBounds(L.latLngBounds([]));\n this.map.setMinZoom(this.region.minZoom);\n this.map.setMaxZoom(this.region.maxZoom);\n const target = view ?? this.region.initialView;\n this.map.setView(toOEMLeafletPosition(target, this.region), this.clampZoom(target.zoom), { animate: false });\n this.map.setMaxBounds(this.regionBounds());\n this.baseTiles = this.makeTiles('M').addTo(this.map);\n this.updatingView = false;\n }\n /** Converts the region's published pixel extent to Simple CRS bounds. */\n private regionBounds(): L.LatLngBounds {\n const { x, y } = this.region.boundsOffset;\n return L.latLngBounds(\n toOEMLeafletPosition({ regionId: this.region.id, x, y }, this.region),\n toOEMLeafletPosition({ regionId: this.region.id, x: x + this.region.dimensions[0], y: y + this.region.dimensions[1] }, this.region),\n );\n }\n /** Creates a coverage-aware layer for one region floor. */\n private makeTiles(floorId: string): L.TileLayer {\n const floor = this.region.floors.find((entry) => entry.id === floorId)!;\n const regionId = this.region.id;\n const layer = new CoveredTileLayer(resolveOEMAsset(this.options.resources.baseUrl, floor.tileTemplate), {\n tileSize: this.region.tileSize, noWrap: true, bounds: this.regionBounds(),\n maxNativeZoom: this.region.maxNativeZoom, maxZoom: Math.ceil(this.region.maxZoom),\n }, this.region.coverage, floor);\n layer.on('load', () => { if (!this.destroyed && this.region.id === regionId) this.emit('load', { regionId, floorId }); });\n layer.on('tileerror', () => this.emit('error', new Error(`Tile load failed: ${regionId}/${floorId}`)));\n return layer;\n }\n private clampZoom(zoom: number): number {\n if (!Number.isFinite(zoom)) throw new Error('Zoom must be finite');\n return Math.max(this.region.minZoom, Math.min(this.region.maxZoom, zoom));\n }\n /** Returns the current view in the OEM pixel coordinate system. */\n getView(): OEMView { this.assertAlive(); return { ...this.position(this.map.getCenter()), zoom: this.map.getZoom() }; }\n\n /** Sets the view without exposing Leaflet's coordinate objects. */\n setView(view: OEMView): void {\n this.assertAlive();\n this.validatePosition(view);\n const zoom = this.clampZoom(view.zoom);\n if (view.floorId) this.setFloor(view.floorId);\n this.map.setView(toOEMLeafletPosition(view, this.region), zoom, { animate: false });\n }\n /** Changes zoom around the current center with an optional native transition. */\n setZoom(zoom: number, options: OEMZoomOptions = {}): void {\n this.assertAlive();\n this.map.setZoom(this.clampZoom(zoom), { animate: options.animate ?? false });\n }\n /** Fits the map to an OEM pixel-coordinate extent. */\n fitBounds(bounds: [OEMPosition, OEMPosition]): void {\n this.assertAlive();\n this.map.fitBounds(L.latLngBounds(toOEMLeafletPosition(bounds[0], this.region), toOEMLeafletPosition(bounds[1], this.region)), { animate: false });\n }\n /** Switches regions and reloads only the features currently enabled. */\n async setRegion(regionId: string): Promise<void> {\n this.assertAlive();\n const region = getOEMRegion(this.manifest, regionId);\n if (region === this.region) return;\n this.cancelRequests();\n this.region = region;\n this.points = [];\n this.labels = [];\n this.visibleLabelType = undefined;\n this.clearPointLayers();\n this.labelsLayer.clearLayers();\n this.boundariesLayer.clearLayers();\n this.applyRegion();\n this.renderCustomPoints();\n this.emit('regionchange', { regionId });\n this.emit('floorchange', { floorId: 'M' });\n this.emitView();\n await this.loadFeatures();\n }\n /** Switches the rendered floor while retaining the current region view. */\n setFloor(floorId: string): void {\n this.assertAlive();\n this.validateFloor(floorId);\n if (floorId === this.floorId) return;\n this.floorTiles?.remove();\n this.floorTiles = undefined;\n this.floorId = floorId;\n const base = this.baseTiles?.getContainer();\n if (base) base.style.filter = floorId === 'M' ? 'brightness(1)' : 'brightness(0.5)';\n if (floorId !== 'M') this.floorTiles = this.makeTiles(floorId).addTo(this.map);\n this.renderPoints();\n this.renderCustomPoints();\n this.emit('floorchange', { floorId });\n this.emitView();\n }\n /** Changes label language and applies the manifest fallback chain. */\n async setLocale(locale: string): Promise<void> {\n this.assertAlive();\n const resolved = normalizeOEMLocale(locale, Object.keys(this.manifest.locales), this.manifest.fallbackLocale);\n const changed = resolved !== this.resolvedLocale;\n this.locale = locale;\n if (!changed) return;\n this.resolvedLocale = resolved;\n this.updateAttribution();\n if (this.features.labels) await this.loadFeature('labels');\n }\n /** Returns both the requested and resolved locale values. */\n getLocale(): { requested: string; resolved: string } { return { requested: this.locale, resolved: this.resolvedLocale }; }\n\n /** Changes only this instance's theme attribute. */\n setTheme(theme: 'light' | 'dark'): void { this.assertAlive(); this.root.dataset.theme = theme; }\n\n /** Enables or disables static layers and cancels disabled layer requests. */\n async setFeatures(features: OEMFeatures): Promise<void> {\n this.assertAlive();\n const loads: Promise<void>[] = [];\n for (const feature of FEATURE_NAMES) {\n if (features[feature] === undefined || features[feature] === this.features[feature]) continue;\n this.features[feature] = features[feature];\n this.cancelRequest(feature);\n if (features[feature]) loads.push(this.loadFeature(feature));\n else if (feature === 'points') { this.points = []; this.clearPointLayers(); }\n else if (feature === 'labels') { this.labels = []; this.visibleLabelType = undefined; this.labelsLayer.clearLayers(); }\n else this.boundariesLayer.clearLayers();\n }\n await Promise.all(loads);\n }\n\n /** Replaces host-defined points without reloading static map data. */\n setCustomPoints(points: readonly OEMCustomPoint[]): void {\n this.assertAlive();\n this.customPointsRequest?.controller.abort();\n this.customPointsRequest = undefined;\n this.customPoints = this.normalizeCustomPoints(points);\n this.renderCustomPoints();\n }\n\n loadCustomPoints(url: string): Promise<void> {\n this.assertAlive();\n const value = url.trim();\n if (!value) throw new Error('Custom points URL must be a non-empty URL');\n let resolvedUrl: string;\n try {\n resolvedUrl = new URL(value, document.baseURI).toString();\n } catch {\n throw new Error(`Invalid custom points URL: ${url}`);\n }\n this.customPointsRequest?.controller.abort();\n const controller = new AbortController();\n const abort = () => controller.abort();\n this.options.signal?.addEventListener('abort', abort, { once: true });\n const request: { controller: AbortController; promise: Promise<void> } = { controller, promise: Promise.resolve() };\n request.promise = fetchOEMJson<unknown>(resolvedUrl, controller.signal).then((value) => {\n if (!Array.isArray(value)) throw new Error('Custom points JSON must be an array');\n const points = value.map((point) => {\n if (!point || typeof point !== 'object' || typeof (point as { icon?: unknown }).icon !== 'string') return point as OEMCustomPoint;\n return {\n ...(point as OEMCustomPoint),\n icon: new URL((point as OEMCustomPoint).icon, resolvedUrl).toString(),\n };\n });\n if (controller.signal.aborted || this.destroyed) return;\n this.customPoints = this.normalizeCustomPoints(points);\n this.renderCustomPoints();\n }).finally(() => {\n this.options.signal?.removeEventListener('abort', abort);\n if (this.customPointsRequest === request) this.customPointsRequest = undefined;\n });\n this.customPointsRequest = request;\n return request.promise;\n }\n\n /** Removes all host-defined points from this map instance. */\n clearCustomPoints(): void {\n this.assertAlive();\n this.customPointsRequest?.controller.abort();\n this.customPointsRequest = undefined;\n this.customPoints = [];\n this.customPointsLayer.clearLayers();\n }\n\n /** Returns a loaded published point from the current region, if available. */\n getPoint(pointId: string): OEMPoint | undefined {\n this.assertAlive();\n const id = pointId.trim();\n if (!id) throw new Error('Point ID must not be empty');\n const point = this.points.find((entry) => entry.id === id);\n return point ? clonePoint(point) : undefined;\n }\n\n /** Loads one published point by using the release point index when available. */\n async loadPoint(pointId: string): Promise<OEMPoint | undefined> {\n this.assertAlive();\n const id = pointId.trim();\n if (!id) throw new Error('Point ID must not be empty');\n const loaded = this.getPoint(id);\n if (loaded) return loaded;\n\n const pointIndex = await this.loadPointIndex();\n this.assertAlive();\n const paths = pointIndex[id]\n ? [pointIndex[id]]\n : this.manifest.pointIndex\n ? []\n : this.manifest.regions.flatMap((region) => region.points.map((ref) => ref.path));\n for (const path of paths) {\n const points = await this.loadPointShard(path);\n const point = points.find((entry) => entry.id === id);\n if (point) return clonePoint(point);\n }\n return undefined;\n }\n\n private async loadPointIndex(): Promise<Record<string, string>> {\n if (!this.manifest.pointIndex) return {};\n if (this.pointIndex) return this.pointIndex;\n if (!this.pointIndexRequest) {\n this.pointIndexRequest = fetchOEMJson<unknown>(\n resolveOEMAsset(this.options.resources.baseUrl, this.manifest.pointIndex.path),\n this.options.signal,\n ).then((value) => {\n if (!value || typeof value !== 'object' || Array.isArray(value)) throw new Error('Invalid OEM point index');\n const index: Record<string, string> = {};\n for (const [id, path] of Object.entries(value)) {\n if (!id || typeof path !== 'string' || !path) throw new Error(`Invalid OEM point index entry: ${id}`);\n resolveOEMAsset(this.options.resources.baseUrl, path);\n index[id] = path;\n }\n this.pointIndex = index;\n return index;\n }).catch((error) => {\n this.pointIndexRequest = undefined;\n throw error;\n });\n }\n return this.pointIndexRequest;\n }\n\n private loadPointShard(path: string): Promise<OEMPoint[]> {\n const cached = this.pointShardRequests.get(path);\n if (cached) return cached;\n const request = fetchOEMJson<unknown>(resolveOEMAsset(this.options.resources.baseUrl, path), this.options.signal).then((value) => {\n if (!Array.isArray(value)) throw new Error(`Invalid OEM point shard: ${path}`);\n return value as OEMPoint[];\n }).catch((error) => {\n if (this.pointShardRequests.get(path) === request) this.pointShardRequests.delete(path);\n throw error;\n });\n this.pointShardRequests.set(path, request);\n return request;\n }\n\n private cancelRequest(feature: keyof OEMFeatures): void {\n if (!this.requests.has(feature)) return;\n this.requests.get(feature)!.abort();\n this.requests.delete(feature);\n this.emit('loading', { feature, loading: false });\n }\n private cancelRequests(): void { for (const feature of this.requests.keys()) this.cancelRequest(feature); }\n private async loadFeatures(): Promise<void> {\n await Promise.all(FEATURE_NAMES.filter((feature) => this.features[feature]).map((feature) => this.loadFeature(feature)));\n }\n /** Loads one feature with a request token so stale responses are ignored. */\n private async loadFeature(feature: keyof OEMFeatures): Promise<void> {\n this.cancelRequest(feature);\n const request = new AbortController();\n this.requests.set(feature, request);\n this.emit('loading', { feature, loading: true });\n const read = <Data>(ref: OEMAsset) => fetchOEMJson<Data>(resolveOEMAsset(this.options.resources.baseUrl, ref.path), request.signal);\n try {\n if (feature === 'points') {\n const [groups, types] = await Promise.all([\n Promise.all(this.region.points.map((ref) => read<OEMPoint[]>(ref))),\n Object.keys(this.types).length ? this.types : read<Record<string, OEMPointType>>(this.manifest.types),\n ]);\n if (request.signal.aborted) return;\n this.points = groups.flat();\n this.types = types;\n this.renderPoints();\n } else if (feature === 'labels') {\n const [labels, messages] = await Promise.all([\n this.region.labels ? read<OEMLabel[]>(this.region.labels) : Promise.resolve([]),\n this.manifest.locales[this.resolvedLocale] ? read<OEMLocaleMessages>(this.manifest.locales[this.resolvedLocale]) : Promise.resolve({}),\n ]);\n if (request.signal.aborted) return;\n this.labels = labels;\n this.messages = messages;\n this.renderLabels(true);\n } else {\n const boundaries = this.region.boundaries ? await read<OEMBoundary[]>(this.region.boundaries) : [];\n if (request.signal.aborted) return;\n this.renderBoundaries(boundaries);\n }\n } catch (error) {\n if (!request.signal.aborted) {\n this.features[feature] = false;\n this.emit('error', error instanceof Error ? error : new Error(String(error)));\n throw error;\n }\n } finally {\n if (this.requests.get(feature) === request) {\n this.requests.delete(feature);\n this.emit('loading', { feature, loading: false });\n }\n }\n }\n /** Applies a client-side filter without making another network request. */\n setPointFilter(filter: OEMPointFilter): void {\n this.assertAlive();\n const next = cloneFilter(filter);\n if (sameFilter(this.filter, next)) return;\n this.filter = next;\n this.renderPoints();\n }\n\n /** Enables or disables Atlos-style marker clustering without reloading point data. */\n setMarkerClustering(enabled: boolean): void {\n this.assertAlive();\n if (enabled === this.markerClustering) return;\n this.markerClustering = enabled;\n this.renderPoints();\n }\n\n private clearPointLayers(): void {\n this.pointsLayer.clearLayers();\n for (const group of this.pointClusters.values()) {\n group.clearLayers();\n group.remove();\n }\n this.pointClusters.clear();\n }\n\n private createCustomPointVisual(point: OEMCustomPoint): HTMLElement {\n const inner = document.createElement('div');\n inner.className = point.style === 'no-frame' ? 'noFrameInner' : 'markerInner';\n inner.setAttribute('aria-label', point.id);\n if (point.position.floorId && point.position.floorId !== this.floorId) inner.classList.add('offLayer');\n const image = document.createElement('img');\n image.src = point.icon;\n image.alt = point.id;\n image.draggable = false;\n if (point.style === 'no-frame') {\n image.className = 'noFrameImage';\n inner.append(image);\n } else {\n const frame = document.createElement('div');\n frame.className = 'frameImage';\n frame.append(image);\n inner.append(frame);\n }\n return inner;\n }\n\n private renderCustomPoints(): void {\n this.customPointsLayer.clearLayers();\n for (const point of this.customPoints) {\n if (point.position.regionId !== this.region.id) continue;\n const marker = new OEMMarker(toOEMLeafletMapPosition(point.position), {\n interactive: false,\n keyboard: false,\n bubblingMouseEvents: false,\n icon: L.divIcon({\n html: this.createCustomPointVisual(point),\n className: `${point.style === 'no-frame' ? 'noFrameMarkerIcon' : 'frameMarkerIcon'} incompleteMarker`,\n iconSize: point.style === 'no-frame' ? [50, 50] : [32, 32],\n iconAnchor: point.style === 'no-frame' ? [25, 25] : [16, 32],\n }),\n });\n marker.addTo(this.customPointsLayer);\n }\n }\n\n /** Builds the shared Atlos marker composition for points and cluster summaries. */\n private createMarkerVisual(type: OEMPointType, point?: OEMPoint, count?: number): HTMLElement {\n const inner = document.createElement(point ? 'a' : 'div');\n inner.className = type.noFrame ? 'noFrameInner' : 'markerInner';\n if (point) {\n const link = inner as HTMLAnchorElement;\n link.href = createOEMPointUrl(point.id);\n link.target = '_blank';\n link.rel = 'noopener noreferrer';\n inner.classList.toggle('offLayer', point.position.floorId !== this.floorId);\n if (point.tier) inner.dataset.tier = point.position.floorId;\n }\n if (count !== undefined) inner.classList.add('clusterMarker');\n const image = document.createElement('img');\n image.src = resolveOEMAsset(this.options.resources.baseUrl, type.icon);\n image.alt = type.key;\n image.draggable = false;\n if (type.noFrame) {\n image.className = 'noFrameImage';\n inner.append(image);\n } else {\n const frame = document.createElement('div');\n frame.className = 'frameImage';\n frame.append(image);\n inner.append(frame);\n }\n if (type.subIcon) {\n const sub = document.createElement('div');\n sub.className = 'subIconContainer';\n const subImage = document.createElement('img');\n subImage.className = 'subIcon';\n subImage.src = resolveOEMAsset(this.options.resources.baseUrl, type.subIcon);\n subImage.alt = '';\n sub.append(subImage);\n inner.append(sub);\n }\n if (count !== undefined) {\n const badge = document.createElement('span');\n badge.className = 'clusterCount';\n badge.textContent = String(count);\n inner.append(badge);\n }\n return inner;\n }\n\n private createPointMarker(point: OEMPoint, type: OEMPointType): OEMMarker {\n return new OEMMarker(toOEMLeafletPosition(point.position, this.region), {\n interactive: true, keyboard: false, bubblingMouseEvents: false,\n icon: L.divIcon({ html: this.createMarkerVisual(type, point),\n className: `${type.noFrame ? 'noFrameMarkerIcon' : 'frameMarkerIcon'} incompleteMarker`,\n iconSize: type.noFrame ? [50, 50] : [32, 32], iconAnchor: type.noFrame ? [25, 25] : [16, 32] }),\n });\n }\n\n private createPointCluster(type: OEMPointType): L.MarkerClusterGroup {\n return L.markerClusterGroup({\n showCoverageOnHover: false,\n zoomToBoundsOnClick: !this.options.lockZoom,\n spiderfyOnMaxZoom: !this.options.lockZoom,\n disableClusteringAtZoom: 2,\n maxClusterRadius: 60,\n iconCreateFunction: (cluster) => L.divIcon({\n html: this.createMarkerVisual(type, undefined, cluster.getChildCount()),\n className: `${type.noFrame ? 'noFrameMarkerIcon' : 'frameMarkerIcon'} markerClusterCustom`,\n iconSize: type.noFrame ? [50, 50] : [32, 32],\n iconAnchor: type.noFrame ? [25, 25] : [16, 32],\n }),\n });\n }\n\n /** Rebuilds visible markers and groups eligible types with Atlos clustering rules. */\n private renderPoints(): void {\n this.clearPointLayers();\n const types = this.filter.types ? new Set(this.filter.types) : undefined;\n const subregions = this.filter.subregions ? new Set(this.filter.subregions) : undefined;\n for (const point of this.points) {\n if (types && !types.has(point.type)) continue;\n if (subregions && !subregions.has(point.subregionId)) continue;\n if (this.filter.floorOnly && point.position.floorId !== this.floorId) continue;\n const type = this.types[point.type];\n if (!type) continue;\n const marker = this.createPointMarker(point, type);\n if (this.markerClustering && CLUSTER_SUBCATEGORIES.has(type.category.sub)) {\n let group = this.pointClusters.get(type.key);\n if (!group) {\n group = this.createPointCluster(type);\n this.pointClusters.set(type.key, group);\n }\n group.addLayer(marker);\n } else marker.addTo(this.pointsLayer);\n }\n for (const group of this.pointClusters.values()) if (group.getLayers().length) group.addTo(this.map);\n }\n\n /** Renders Atlos-style fill and dashed stroke layers for published subregions. */\n private renderBoundaries(boundaries: OEMBoundary[]): void {\n this.boundariesLayer.clearLayers();\n for (const boundary of boundaries) {\n const rings = boundary.rings.map((ring) => ring.map((position) => toOEMLeafletPosition(position, this.region)));\n L.polygon(rings, { color: 'transparent', fillOpacity: 0.2, interactive: false,\n className: 'subregionBoundaryFill' }).addTo(this.boundariesLayer);\n L.polygon(rings, { weight: 2, opacity: 0.8, fill: false, interactive: false,\n className: 'subregionBoundaryStroke' }).addTo(this.boundariesLayer);\n }\n }\n /** Renders Atlos site or subregion labels according to the current zoom. */\n private renderLabels(force = false): void {\n const showSub = this.map.getZoom() <= 0.25 && this.labels.some((label) => label.type === 'sub');\n const visibleType: OEMLabel['type'] = showSub ? 'sub' : 'site';\n if (!force && visibleType === this.visibleLabelType) return;\n this.visibleLabelType = visibleType;\n this.labelsLayer.clearLayers();\n for (const label of this.labels) {\n if (label.type !== visibleType) continue;\n const inner = document.createElement('div');\n inner.className = label.type === 'sub' ? 'innerSub' : 'innerSite';\n inner.textContent = this.messages[label.textKey] ?? label.id.split('/').at(-1) ?? label.id;\n new OEMMarker(toOEMLeafletPosition(label.position, this.region), {\n pane: 'placeLabels', interactive: false, keyboard: false,\n icon: L.divIcon({ className: 'mapLabel', html: inner, iconSize: [0, 0] }),\n }).addTo(this.labelsLayer);\n }\n }\n /** Recalculates Leaflet dimensions after the host element changes size. */\n resize(): void { if (!this.destroyed) this.map.invalidateSize({ animate: false }); }\n\n /** Releases listeners, observers, pending requests, layers and DOM nodes. */\n destroy = (): void => {\n if (this.destroyed) return;\n this.destroyed = true;\n this.cancelRequests();\n this.customPointsRequest?.controller.abort();\n this.customPointsRequest = undefined;\n if (this.overdragFrame !== undefined) cancelAnimationFrame(this.overdragFrame);\n this.observer?.disconnect();\n this.wheel.dispose();\n this.options.signal?.removeEventListener('abort', this.destroy);\n this.listeners.clear();\n this.map.remove();\n this.root.remove();\n this.points = [];\n this.customPoints = [];\n this.customPointsLayer.clearLayers();\n this.pointShardRequests.clear();\n mounted.delete(this.container);\n };\n}\n", "import L from 'leaflet';\ninterface TileLevel {\n el: HTMLElement;\n origin: L.Point;\n zoom: number;\n}\ninterface ContinuousPixelMap extends L.Map {\n _getNewPixelOrigin(center: L.LatLng, zoom: number): L.Point;\n}\nexport class SmoothTileLayer extends L.TileLayer {\n _setZoomTransform(level: TileLevel, center: L.LatLng, zoom: number) {\n const map = (this as unknown as {\n _map?: ContinuousPixelMap;\n })._map;\n if (!map)\n return;\n const scale = map.getZoomScale(zoom, level.zoom);\n const translate = level.origin\n .multiplyBy(scale)\n .subtract(map._getNewPixelOrigin(center, zoom));\n if (L.Browser.any3d) {\n L.DomUtil.setTransform(level.el, translate, scale);\n }\n else {\n L.DomUtil.setPosition(level.el, translate);\n }\n }\n}\n", "import L from 'leaflet';\nimport { WHEEL_GESTURE_IDLE_MS, WheelInputRouter, type WheelGestureMode, } from 'trackpad-input';\nconst ZOOM_PER_WHEEL_PIXEL = 0.003;\nconst TRACKPAD_PINCH_ZOOM_PER_PIXEL = 0.01;\nconst INERTIA_INITIAL_FACTOR = 0.07;\nconst INERTIA_MAX_STEP = 0.008;\nconst INERTIA_FRICTION_PER_FRAME = 0.72;\nconst INERTIA_STOP_THRESHOLD = 0.00025;\nconst FRAME_DURATION = 1000 / 60;\nconst TRACKPAD_OVERDRAG_MAX_PX = 96;\nconst TRACKPAD_OVERDRAG_RESISTANCE = 0.65;\nconst TRACKPAD_OVERDRAG_SETTLE_THRESHOLD_PX = 80;\nconst TRACKPAD_OVERDRAG_SETTLE_MS = 48;\ninterface ContinuousZoomEventData {\n pinch: true;\n round: false;\n}\nconst CONTINUOUS_ZOOM_EVENT_DATA: ContinuousZoomEventData = {\n pinch: true,\n round: false,\n};\nexport interface SmoothWheelZoomOptions {\n /** Enables inertial continuation after wheel zoom input. */\n enableInertia?: boolean;\n /** Enables trackpad gestures classified as map panning. */\n panEnabled?: boolean;\n /** Enables wheel and trackpad gestures classified as map zooming. */\n zoomEnabled?: boolean;\n}\ninterface ContinuousZoomMap extends L.Map {\n _animatingZoom?: boolean;\n _getMapPanePos(): L.Point;\n _getNewPixelOrigin(center: L.LatLng, zoom: number): L.Point;\n _latLngToNewLayerPoint(latLng: L.LatLng, zoom: number, center: L.LatLng): L.Point;\n _limitCenter(center: L.LatLng, zoom: number, bounds: L.LatLngBounds): L.LatLng;\n _limitZoom(zoom: number): number;\n _move(center: L.LatLng, zoom: number, data?: ContinuousZoomEventData): this;\n _moveEnd(zoomChanged: boolean): this;\n _moveStart(zoomChanged: boolean, noMoveStart: boolean): this;\n _onZoomTransitionEnd?(): void;\n _rawPanBy(offset: L.Point): void;\n _stop(): this;\n}\ninterface SubpixelMarker {\n _icon?: HTMLElement;\n _latlng: L.LatLng;\n _map?: ContinuousZoomMap;\n _setPos(point: L.Point): void;\n}\ninterface MarkerZoomAnimation {\n center: L.LatLng;\n zoom: number;\n}\nconst installSubpixelPixelOrigin = (map: ContinuousZoomMap) => {\n map._getNewPixelOrigin = function (center, zoom) {\n return this.project(center, zoom)\n .subtract(this.getSize().divideBy(2))\n .add(this._getMapPanePos());\n };\n map.latLngToLayerPoint = function (latLng) {\n return this.project(latLng, this.getZoom()).subtract(this.getPixelOrigin());\n };\n};\nexport class SmoothWheelZoom {\n private readonly map: ContinuousZoomMap;\n private readonly container: HTMLElement;\n private readonly inertiaEnabled: boolean;\n private readonly panEnabled: boolean;\n private readonly zoomEnabled: boolean;\n private readonly wheelInputRouter: WheelInputRouter<WheelEvent>;\n private zoomFrame: number | null = null;\n private panFrame: number | null = null;\n private endTimer: number | null = null;\n private panTailTimer: number | null = null;\n private targetZoom: number | null = null;\n private anchorPoint: L.Point | null = null;\n private anchorLatLng: L.LatLng | null = null;\n private zoomVelocity = 0;\n private lastZoomInputTime: number | null = null;\n private inertiaStep = 0;\n private lastFrameTime: number | null = null;\n private pendingPanOffset = L.point(0, 0);\n private panRawCenterPoint: L.Point | null = null;\n private gestureMode: WheelGestureMode | null = null;\n private gestureActive = false;\n private trackpadDragging = false;\n private overdragSettling = false;\n private disposed = false;\n constructor(map: L.Map, options: SmoothWheelZoomOptions = {}) {\n this.map = map as ContinuousZoomMap;\n this.container = map.getContainer();\n this.inertiaEnabled = options.enableInertia ?? true;\n this.panEnabled = options.panEnabled ?? true;\n this.zoomEnabled = options.zoomEnabled ?? true;\n this.wheelInputRouter = new WheelInputRouter<WheelEvent>({\n onPan: (event) => this.handleRoutedWheel('pan', event),\n onZoom: (event) => this.handleRoutedWheel('zoom', event),\n });\n installSubpixelPixelOrigin(this.map);\n map.scrollWheelZoom.disable();\n this.container.addEventListener('wheel', this.handleWheel, {\n passive: false,\n });\n map.once('unload', this.dispose);\n }\n dispose = () => {\n if (this.disposed)\n return;\n this.disposed = true;\n this.container.removeEventListener('wheel', this.handleWheel);\n this.map.off('unload', this.dispose);\n this.clearScheduledWork();\n };\n private handleWheel = (event: WheelEvent) => {\n event.preventDefault();\n event.stopPropagation();\n this.finishLeafletZoomAnimation();\n const gestureMode = this.wheelInputRouter.route(event);\n if (gestureMode === 'pending' && this.overdragSettling) {\n this.clearOverdragSettlement();\n }\n };\n private handleRoutedWheel(gestureMode: WheelGestureMode, event: WheelEvent) {\n if ((gestureMode === 'pan' && !this.panEnabled) || (gestureMode === 'zoom' && !this.zoomEnabled))\n return;\n if (this.overdragSettling && gestureMode === 'pan') {\n this.schedulePanTailRelease();\n return;\n }\n if (this.overdragSettling)\n this.clearOverdragSettlement();\n this.routeWheelEvent(gestureMode, event);\n }\n private routeWheelEvent(gestureMode: WheelGestureMode, event: WheelEvent) {\n if (this.gestureActive &&\n this.gestureMode !== null &&\n this.gestureMode !== gestureMode) {\n this.finishGesture();\n }\n this.gestureMode = gestureMode;\n if (gestureMode === 'pan') {\n this.handleTrackpadPan(event);\n return;\n }\n this.handleZoom(event);\n }\n private handleZoom(event: WheelEvent) {\n const wheelDelta = L.DomEvent.getWheelDelta(event);\n if (!wheelDelta)\n return;\n const zoomDelta = event.ctrlKey && event.deltaMode === 0\n ? -event.deltaY * TRACKPAD_PINCH_ZOOM_PER_PIXEL\n : wheelDelta * ZOOM_PER_WHEEL_PIXEL;\n const currentTarget = this.targetZoom ?? this.map.getZoom();\n const nextTarget = this.map._limitZoom(currentTarget + zoomDelta);\n this.updateAnchor(event);\n this.targetZoom = nextTarget;\n if (this.inertiaEnabled) {\n this.updateZoomVelocity(nextTarget - currentTarget, performance.now());\n this.inertiaStep = Math.max(-INERTIA_MAX_STEP, Math.min(INERTIA_MAX_STEP, this.zoomVelocity * INERTIA_INITIAL_FACTOR));\n }\n else {\n this.inertiaStep = 0;\n }\n if (nextTarget !== this.map.getZoom())\n this.startGesture(true);\n if (this.gestureActive &&\n nextTarget !== this.map.getZoom() &&\n this.zoomFrame === null) {\n this.zoomFrame = requestAnimationFrame(this.applyZoomFrame);\n }\n this.scheduleGestureEnd();\n }\n private handleTrackpadPan(event: WheelEvent) {\n const offset = L.point(event.deltaX, event.deltaY);\n if (offset.x === 0 && offset.y === 0) {\n if (this.gestureActive && !this.overdragSettling) {\n this.scheduleGestureEnd();\n }\n return;\n }\n const wasActive = this.gestureActive;\n this.startGesture(false);\n if (!wasActive) {\n this.trackpadDragging = true;\n this.map.fire('dragstart');\n }\n this.pendingPanOffset = this.pendingPanOffset.add(offset);\n if (this.panFrame === null) {\n this.panFrame = requestAnimationFrame(this.applyPanFrame);\n }\n if (!this.overdragSettling)\n this.scheduleGestureEnd();\n }\n private startGesture(zoomChanged: boolean) {\n if (this.gestureActive)\n return;\n this.map._stop();\n this.map._moveStart(zoomChanged, false);\n this.gestureActive = true;\n }\n private updateAnchor(event: WheelEvent) {\n const point = this.map.mouseEventToContainerPoint(event);\n if (this.anchorPoint?.equals(point) && this.anchorLatLng !== null) {\n return;\n }\n this.anchorPoint = point;\n this.anchorLatLng = this.continuousContainerPointToLatLng(point);\n }\n private continuousContainerPointToLatLng(point: L.Point) {\n const centerPoint = this.map.getSize().divideBy(2);\n const center = this.map.getCenter();\n const zoom = this.map.getZoom();\n return this.map.unproject(this.map.project(center, zoom).add(point.subtract(centerPoint)), zoom);\n }\n private updateZoomVelocity(delta: number, timestamp: number) {\n if (this.lastZoomInputTime === null ||\n delta * this.zoomVelocity <= 0 ||\n timestamp - this.lastZoomInputTime > WHEEL_GESTURE_IDLE_MS) {\n this.zoomVelocity = delta;\n }\n else {\n const elapsed = Math.max(8, Math.min(40, timestamp - this.lastZoomInputTime));\n const frameDelta = delta * (FRAME_DURATION / elapsed);\n this.zoomVelocity = this.zoomVelocity * 0.65 + frameDelta * 0.35;\n }\n this.lastZoomInputTime = timestamp;\n }\n private applyZoomFrame = (timestamp: number) => {\n this.zoomFrame = null;\n if (!this.gestureActive)\n return;\n const elapsed = this.lastFrameTime === null\n ? FRAME_DURATION\n : Math.max(8, Math.min(34, timestamp - this.lastFrameTime));\n this.lastFrameTime = timestamp;\n const currentZoom = this.map.getZoom();\n const directTarget = this.targetZoom;\n let zoom = directTarget ?? currentZoom;\n this.targetZoom = null;\n if (this.inertiaEnabled && directTarget === null) {\n if (Math.abs(this.inertiaStep) < INERTIA_STOP_THRESHOLD) {\n this.inertiaStep = 0;\n }\n else {\n const zoomBeforeInertia = zoom;\n zoom = this.map._limitZoom(zoom + this.inertiaStep * (elapsed / FRAME_DURATION));\n if (zoom === zoomBeforeInertia) {\n this.inertiaStep = 0;\n }\n else {\n this.inertiaStep *= Math.pow(INERTIA_FRICTION_PER_FRAME, elapsed / FRAME_DURATION);\n }\n }\n }\n if (zoom !== currentZoom) {\n this.moveToZoom(zoom);\n }\n if (this.targetZoom !== null ||\n (this.inertiaEnabled &&\n Math.abs(this.inertiaStep) >= INERTIA_STOP_THRESHOLD)) {\n this.zoomFrame = requestAnimationFrame(this.applyZoomFrame);\n return;\n }\n this.lastFrameTime = null;\n if (this.endTimer === null) {\n this.finishGesture();\n }\n };\n private applyPanFrame = () => {\n this.panFrame = null;\n if (!this.gestureActive || this.gestureMode !== 'pan')\n return;\n const offset = this.pendingPanOffset;\n this.pendingPanOffset = L.point(0, 0);\n if (offset.x !== 0 || offset.y !== 0) {\n const overdragAmount = this.applyConstrainedPan(offset);\n this.map.fire('move').fire('drag');\n if (overdragAmount >= TRACKPAD_OVERDRAG_SETTLE_THRESHOLD_PX) {\n this.beginOverdragSettlement();\n }\n }\n if (this.pendingPanOffset.x !== 0 || this.pendingPanOffset.y !== 0) {\n this.panFrame = requestAnimationFrame(this.applyPanFrame);\n return;\n }\n if (this.endTimer === null) {\n this.finishGesture();\n }\n };\n private applyConstrainedPan(offset: L.Point) {\n const zoom = this.map.getZoom();\n const currentCenterPoint = this.map.project(this.map.getCenter(), zoom);\n this.panRawCenterPoint ??= currentCenterPoint;\n this.panRawCenterPoint = this.panRawCenterPoint.add(offset);\n const configuredBounds = this.map.options.maxBounds;\n if (!configuredBounds) {\n this.map._rawPanBy(offset);\n return 0;\n }\n const maxBounds = configuredBounds instanceof L.LatLngBounds\n ? configuredBounds\n : L.latLngBounds(configuredBounds);\n const rawCenter = this.map.unproject(this.panRawCenterPoint, zoom);\n const limitedCenter = this.map._limitCenter(rawCenter, zoom, maxBounds);\n const limitedCenterPoint = this.map.project(limitedCenter, zoom);\n const rawOverdrag = this.panRawCenterPoint.subtract(limitedCenterPoint);\n const visualOverdrag = L.point(this.resistOverdrag(rawOverdrag.x), this.resistOverdrag(rawOverdrag.y));\n const visualCenterPoint = limitedCenterPoint.add(visualOverdrag);\n const visualOffset = visualCenterPoint.subtract(currentCenterPoint);\n if (visualOffset.x !== 0 || visualOffset.y !== 0) {\n this.map._rawPanBy(visualOffset);\n }\n return Math.max(Math.abs(visualOverdrag.x), Math.abs(visualOverdrag.y));\n }\n private resistOverdrag(value: number) {\n if (value === 0)\n return 0;\n const magnitude = TRACKPAD_OVERDRAG_MAX_PX *\n (1 -\n Math.exp((-Math.abs(value) * TRACKPAD_OVERDRAG_RESISTANCE) /\n TRACKPAD_OVERDRAG_MAX_PX));\n return Math.sign(value) * magnitude;\n }\n private beginOverdragSettlement() {\n if (this.overdragSettling)\n return;\n this.overdragSettling = true;\n this.schedulePanTailRelease();\n if (this.endTimer !== null)\n window.clearTimeout(this.endTimer);\n this.endTimer = window.setTimeout(this.handleGestureEnd, TRACKPAD_OVERDRAG_SETTLE_MS);\n }\n private schedulePanTailRelease() {\n if (this.panTailTimer !== null) {\n window.clearTimeout(this.panTailTimer);\n }\n this.panTailTimer = window.setTimeout(() => {\n this.panTailTimer = null;\n this.overdragSettling = false;\n }, WHEEL_GESTURE_IDLE_MS);\n }\n private clearOverdragSettlement() {\n this.overdragSettling = false;\n if (this.panTailTimer !== null) {\n window.clearTimeout(this.panTailTimer);\n this.panTailTimer = null;\n }\n }\n private moveToZoom(zoom: number) {\n if (this.anchorPoint === null || this.anchorLatLng === null)\n return;\n const centerPoint = this.map.getSize().divideBy(2);\n const cursorOffset = this.anchorPoint.subtract(centerPoint);\n let center = this.map.unproject(this.map.project(this.anchorLatLng, zoom).subtract(cursorOffset), zoom);\n const configuredBounds = this.map.options.maxBounds;\n if (configuredBounds) {\n const maxBounds = configuredBounds instanceof L.LatLngBounds\n ? configuredBounds\n : L.latLngBounds(configuredBounds);\n center = this.map._limitCenter(center, zoom, maxBounds);\n }\n this.map._move(center, zoom, CONTINUOUS_ZOOM_EVENT_DATA);\n }\n private scheduleGestureEnd() {\n if (this.endTimer !== null) {\n window.clearTimeout(this.endTimer);\n }\n this.endTimer = window.setTimeout(this.handleGestureEnd, WHEEL_GESTURE_IDLE_MS);\n }\n private handleGestureEnd = () => {\n this.endTimer = null;\n if (this.zoomFrame === null &&\n this.panFrame === null &&\n this.targetZoom === null &&\n this.pendingPanOffset.x === 0 &&\n this.pendingPanOffset.y === 0 &&\n (!this.inertiaEnabled ||\n Math.abs(this.inertiaStep) < INERTIA_STOP_THRESHOLD)) {\n this.finishGesture();\n }\n };\n private finishGesture() {\n if (this.endTimer !== null) {\n window.clearTimeout(this.endTimer);\n this.endTimer = null;\n }\n if (this.zoomFrame !== null) {\n cancelAnimationFrame(this.zoomFrame);\n this.zoomFrame = null;\n }\n if (this.panFrame !== null) {\n cancelAnimationFrame(this.panFrame);\n this.panFrame = null;\n }\n if (!this.gestureActive) {\n this.resetVisualState();\n return;\n }\n const wasTrackpadDrag = this.trackpadDragging;\n this.gestureActive = false;\n this.trackpadDragging = false;\n if (wasTrackpadDrag)\n this.map.fire('dragend');\n this.map._moveEnd(this.gestureMode === 'zoom');\n this.resetVisualState();\n }\n private finishLeafletZoomAnimation() {\n if (this.map._animatingZoom) {\n this.map._onZoomTransitionEnd?.();\n }\n }\n private resetVisualState() {\n this.targetZoom = null;\n this.anchorPoint = null;\n this.anchorLatLng = null;\n this.zoomVelocity = 0;\n this.lastZoomInputTime = null;\n this.inertiaStep = 0;\n this.lastFrameTime = null;\n this.pendingPanOffset = L.point(0, 0);\n this.panRawCenterPoint = null;\n this.gestureMode = null;\n this.trackpadDragging = false;\n }\n private clearScheduledWork() {\n if (this.zoomFrame !== null) {\n cancelAnimationFrame(this.zoomFrame);\n this.zoomFrame = null;\n }\n if (this.panFrame !== null) {\n cancelAnimationFrame(this.panFrame);\n this.panFrame = null;\n }\n if (this.endTimer !== null) {\n window.clearTimeout(this.endTimer);\n this.endTimer = null;\n }\n this.clearOverdragSettlement();\n this.gestureActive = false;\n this.resetVisualState();\n this.wheelInputRouter.dispose();\n }\n}\nexport const enableSmoothWheelZoom = (map: L.Map, options?: SmoothWheelZoomOptions) => new SmoothWheelZoom(map, options);\n", "import L from 'leaflet';\ninterface BoundsAwareMap extends L.Map {\n _limitCenter(center: L.LatLng, zoom: number, bounds: L.LatLngBounds): L.LatLng;\n}\nexport const toMapBounds = (bounds: L.Map['options']['maxBounds']): L.LatLngBounds | null => {\n if (!bounds)\n return null;\n if (bounds instanceof L.LatLngBounds)\n return bounds;\n return Array.isArray(bounds) && bounds.length === 2\n ? L.latLngBounds(bounds[0], bounds[1])\n : null;\n};\nexport const isMapOverdragged = (map: L.Map, bounds: L.LatLngBounds): boolean => {\n const constrainedMap = map as BoundsAwareMap;\n const center = map.getCenter();\n const constrainedCenter = constrainedMap._limitCenter(center, map.getZoom(), bounds);\n return (map\n .project(center, map.getZoom())\n .distanceTo(map.project(constrainedCenter, map.getZoom())) > 1);\n};\n", "import type { OEMFloor, OEMRegion } from '@opendfieldmap/core';\n\nexport interface OEMTileLookup { covered: boolean; version?: string }\n\nexport const lookupOEMTile = (\n coverage: OEMRegion['coverage'],\n floor: OEMFloor,\n zoom: number,\n x: number,\n y: number,\n): OEMTileLookup => {\n const ranges = coverage[String(zoom)]?.[floor.id]?.[String(y)] ?? [];\n let offset = 0;\n for (let index = 0; index < ranges.length; index += 2) {\n const start = ranges[index];\n const end = ranges[index + 1];\n if (x >= start && x <= end) {\n return {\n covered: true,\n version: floor.tileVersions?.[String(zoom)]?.[String(y)]?.[offset + x - start],\n };\n }\n offset += end - start + 1;\n }\n return { covered: false };\n};\n\nexport const appendOEMTileVersion = (url: string, version?: string): string =>\n version ? `${url}${url.includes('?') ? '&' : '?'}v=${encodeURIComponent(version)}` : url;\n", "<svg width=\"83\" height=\"81\" viewBox=\"0 0 83 81\" xmlns=\"http://www.w3.org/2000/svg\">\n<path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M41.3763 0C18.4963 0 0 18.5625 0 41.5268C0 59.8835 11.8512 75.422 28.292 80.9215C30.3475 81.335 31.1004 80.028 31.1004 78.9286C31.1004 77.9659 31.0327 74.666 31.0327 71.2277C19.5228 73.7032 17.1259 66.2774 17.1259 66.2774C15.2762 61.4647 12.5355 60.2277 12.5355 60.2277C8.76836 57.6838 12.8099 57.6838 12.8099 57.6838C16.9887 57.9589 19.1815 61.9464 19.1815 61.9464C22.8801 68.2712 28.84 66.4841 31.2376 65.3839C31.5798 62.7024 32.6766 60.8462 33.8411 59.8151C24.6612 58.8524 15.0027 55.2774 15.0027 39.3263C15.0027 34.7887 16.6457 31.0762 19.2492 28.1888C18.8385 27.1578 17.3995 22.8943 19.6608 17.188C19.6608 17.188 23.1545 16.0878 31.0318 21.4507C34.4044 20.5417 37.8825 20.0792 41.3763 20.0753C44.87 20.0753 48.4314 20.5571 51.72 21.4507C59.5982 16.0878 63.0919 17.188 63.0919 17.188C65.3532 22.8943 63.9134 27.1578 63.5026 28.1888C66.1747 31.0762 67.75 34.7887 67.75 39.3263C67.75 55.2774 58.0915 58.7832 48.843 59.8151C50.3505 61.1213 51.6514 63.596 51.6514 67.5152C51.6514 73.0839 51.5837 77.5533 51.5837 78.9277C51.5837 80.028 52.3374 81.335 54.3921 80.9224C70.8329 75.4211 82.6841 59.8835 82.6841 41.5268C82.7518 18.5625 64.1878 0 41.3763 0Z\"/>\n</svg>\n"],
5
- "mappings": ";AAAA,OAAOA,QAAO;AACd,OAAO;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;;;ACZP,OAAO,OAAO;AASP,IAAM,kBAAN,cAA8B,EAAE,UAAU;AAAA,EAC7C,kBAAkB,OAAkB,QAAkB,MAAc;AAChE,UAAM,MAAO,KAEV;AACH,QAAI,CAAC;AACD;AACJ,UAAM,QAAQ,IAAI,aAAa,MAAM,MAAM,IAAI;AAC/C,UAAM,YAAY,MAAM,OACnB,WAAW,KAAK,EAChB,SAAS,IAAI,mBAAmB,QAAQ,IAAI,CAAC;AAClD,QAAI,EAAE,QAAQ,OAAO;AACjB,QAAE,QAAQ,aAAa,MAAM,IAAI,WAAW,KAAK;AAAA,IACrD,OACK;AACD,QAAE,QAAQ,YAAY,MAAM,IAAI,SAAS;AAAA,IAC7C;AAAA,EACJ;AACJ;;;AC3BA,OAAOC,QAAO;AACd,SAAS,uBAAuB,wBAAgD;AAChF,IAAM,uBAAuB;AAC7B,IAAM,gCAAgC;AACtC,IAAM,yBAAyB;AAC/B,IAAM,mBAAmB;AACzB,IAAM,6BAA6B;AACnC,IAAM,yBAAyB;AAC/B,IAAM,iBAAiB,MAAO;AAC9B,IAAM,2BAA2B;AACjC,IAAM,+BAA+B;AACrC,IAAM,wCAAwC;AAC9C,IAAM,8BAA8B;AAKpC,IAAM,6BAAsD;AAAA,EACxD,OA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