@blogmcp/sdk 0.3.2 → 0.6.1

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.
Files changed (128) hide show
  1. package/dist/core/client-types.d.ts +7 -1
  2. package/dist/core/client.d.ts +25 -1
  3. package/dist/core/client.js +38 -34
  4. package/dist/core/consultation-adapter.d.ts +90 -0
  5. package/dist/core/consultation-adapter.js +200 -0
  6. package/dist/core/consultations.d.ts +108 -0
  7. package/dist/core/consultations.js +95 -0
  8. package/dist/core/errors.d.ts +52 -0
  9. package/dist/core/errors.js +73 -0
  10. package/dist/core/index.d.ts +7 -1
  11. package/dist/core/index.js +80 -64
  12. package/dist/core/queries.d.ts +16 -1
  13. package/dist/core/queries.js +198 -61
  14. package/dist/core/review/format.d.ts +30 -0
  15. package/dist/core/review/format.js +78 -0
  16. package/dist/core/review/index.d.ts +6 -0
  17. package/dist/core/review/index.js +9 -0
  18. package/dist/core/review/types.d.ts +176 -0
  19. package/dist/core/review/types.js +9 -0
  20. package/dist/core/server-only.d.ts +12 -0
  21. package/dist/core/server-only.js +11 -0
  22. package/dist/core/types.d.ts +295 -0
  23. package/dist/packages/mdx-render-vue/dist/composables/useGallery.js +12 -11
  24. package/dist/packages/mdx-render-vue/dist/composables/useTripMap.js +16 -16
  25. package/dist/packages/mdx-render-vue/dist/edit/TripMapEdit.vue.js +1 -1
  26. package/dist/packages/mdx-render-vue/dist/registry.js +21 -22
  27. package/dist/packages/mdx-render-vue/dist/render/alert/Alert.vue2.js +1 -1
  28. package/dist/packages/mdx-render-vue/dist/render/badge/Badge.vue2.js +1 -1
  29. package/dist/packages/mdx-render-vue/dist/render/button/Button.vue2.js +1 -1
  30. package/dist/packages/mdx-render-vue/dist/render/callout/CalloutDefault.vue.js +1 -1
  31. package/dist/packages/mdx-render-vue/dist/render/callout/CalloutMinimal.vue.js +1 -1
  32. package/dist/packages/mdx-render-vue/dist/render/tripmap/TripMapDefault.vue.js +2 -2
  33. package/dist/packages/tripmap-core/dist/attribution.js +121 -6
  34. package/dist/packages/tripmap-core/dist/css.js +68 -16
  35. package/dist/packages/tripmap-core/dist/detail.js +10 -9
  36. package/dist/packages/tripmap-core/dist/engine.js +285 -247
  37. package/dist/packages/tripmap-core/dist/export.js +48 -46
  38. package/dist/packages/tripmap-core/dist/filmstrip.js +30 -17
  39. package/dist/packages/tripmap-core/dist/framing.js +30 -30
  40. package/dist/packages/tripmap-core/dist/generated/maplibre-worker.bundle.js +1 -1
  41. package/dist/packages/tripmap-core/dist/heading.js +8 -0
  42. package/dist/packages/tripmap-core/dist/href.js +18 -0
  43. package/dist/packages/tripmap-core/dist/index.js +32 -24
  44. package/dist/packages/tripmap-core/dist/lightbox.js +31 -29
  45. package/dist/packages/tripmap-core/dist/line.js +6 -6
  46. package/dist/packages/tripmap-core/dist/markers.js +47 -43
  47. package/dist/packages/tripmap-core/dist/nodes.js +56 -43
  48. package/dist/packages/tripmap-core/dist/playback.js +17 -17
  49. package/dist/packages/tripmap-core/dist/preload.js +14 -14
  50. package/dist/packages/tripmap-core/dist/theme.js +21 -21
  51. package/dist/{node_modules → packages/tripmap-core/node_modules}/maplibre-gl/dist/maplibre-gl.js +1890 -1720
  52. package/dist/{node_modules → packages/tripmap-core/node_modules}/pmtiles/dist/esm/index.js +1 -1
  53. package/dist/react/KbMdxContent.js +7 -8
  54. package/dist/vue/components/KbMdxContent.vue2.js +6 -7
  55. package/package.json +8 -3
  56. package/src/core/client-types.ts +13 -2
  57. package/src/core/client.ts +40 -5
  58. package/src/core/consultation-adapter.ts +408 -0
  59. package/src/core/consultations.ts +224 -0
  60. package/src/core/errors.ts +145 -0
  61. package/src/core/index.ts +68 -0
  62. package/src/core/queries.ts +167 -3
  63. package/src/core/review/format.ts +138 -0
  64. package/src/core/review/index.ts +22 -0
  65. package/src/core/review/types.ts +168 -0
  66. package/src/core/server-only.ts +20 -0
  67. package/src/core/types.ts +337 -0
  68. package/dist/_virtual/constants.js +0 -4
  69. package/dist/_virtual/index.js +0 -2
  70. package/dist/_virtual/index2.js +0 -4
  71. package/dist/_virtual/index3.js +0 -2
  72. package/dist/_virtual/re.js +0 -4
  73. package/dist/node_modules/@braintree/sanitize-url/dist/constants.js +0 -8
  74. package/dist/node_modules/@braintree/sanitize-url/dist/index.js +0 -60
  75. package/dist/node_modules/dompurify/dist/purify.es.js +0 -662
  76. package/dist/node_modules/semver/classes/comparator.js +0 -56
  77. package/dist/node_modules/semver/classes/range.js +0 -148
  78. package/dist/node_modules/semver/classes/semver.js +0 -169
  79. package/dist/node_modules/semver/functions/clean.js +0 -14
  80. package/dist/node_modules/semver/functions/cmp.js +0 -39
  81. package/dist/node_modules/semver/functions/coerce.js +0 -33
  82. package/dist/node_modules/semver/functions/compare-build.js +0 -14
  83. package/dist/node_modules/semver/functions/compare-loose.js +0 -11
  84. package/dist/node_modules/semver/functions/compare.js +0 -11
  85. package/dist/node_modules/semver/functions/diff.js +0 -24
  86. package/dist/node_modules/semver/functions/eq.js +0 -11
  87. package/dist/node_modules/semver/functions/gt.js +0 -11
  88. package/dist/node_modules/semver/functions/gte.js +0 -11
  89. package/dist/node_modules/semver/functions/inc.js +0 -21
  90. package/dist/node_modules/semver/functions/lt.js +0 -11
  91. package/dist/node_modules/semver/functions/lte.js +0 -11
  92. package/dist/node_modules/semver/functions/major.js +0 -11
  93. package/dist/node_modules/semver/functions/minor.js +0 -11
  94. package/dist/node_modules/semver/functions/neq.js +0 -11
  95. package/dist/node_modules/semver/functions/parse.js +0 -21
  96. package/dist/node_modules/semver/functions/patch.js +0 -11
  97. package/dist/node_modules/semver/functions/prerelease.js +0 -14
  98. package/dist/node_modules/semver/functions/rcompare.js +0 -11
  99. package/dist/node_modules/semver/functions/rsort.js +0 -11
  100. package/dist/node_modules/semver/functions/satisfies.js +0 -18
  101. package/dist/node_modules/semver/functions/sort.js +0 -11
  102. package/dist/node_modules/semver/functions/valid.js +0 -14
  103. package/dist/node_modules/semver/index.js +0 -97
  104. package/dist/node_modules/semver/internal/constants.js +0 -28
  105. package/dist/node_modules/semver/internal/debug.js +0 -8
  106. package/dist/node_modules/semver/internal/identifiers.js +0 -18
  107. package/dist/node_modules/semver/internal/lrucache.js +0 -32
  108. package/dist/node_modules/semver/internal/parse-options.js +0 -10
  109. package/dist/node_modules/semver/internal/re.js +0 -32
  110. package/dist/node_modules/semver/ranges/gtr.js +0 -11
  111. package/dist/node_modules/semver/ranges/intersects.js +0 -11
  112. package/dist/node_modules/semver/ranges/ltr.js +0 -11
  113. package/dist/node_modules/semver/ranges/max-satisfying.js +0 -22
  114. package/dist/node_modules/semver/ranges/min-satisfying.js +0 -22
  115. package/dist/node_modules/semver/ranges/min-version.js +0 -42
  116. package/dist/node_modules/semver/ranges/outside.js +0 -44
  117. package/dist/node_modules/semver/ranges/simplify.js +0 -24
  118. package/dist/node_modules/semver/ranges/subset.js +0 -94
  119. package/dist/node_modules/semver/ranges/to-comparators.js +0 -11
  120. package/dist/node_modules/semver/ranges/valid.js +0 -17
  121. package/dist/packages/mdx-schema/dist/composables/useMdxParsing.js +0 -389
  122. package/dist/packages/mdx-schema/dist/metadata/index.js +0 -526
  123. package/dist/packages/mdx-schema/dist/prepareProps.js +0 -46
  124. package/dist/packages/mdx-schema/dist/styles/index.js +0 -141
  125. package/dist/packages/mdx-schema/dist/tripmap.js +0 -88
  126. package/dist/packages/mdx-schema/dist/types/index.js +0 -26
  127. package/dist/packages/sanitize/dist/html.js +0 -89
  128. /package/dist/{node_modules → packages/tripmap-core/node_modules}/maplibre-gl/dist/maplibre-gl-shared.js +0 -0
@@ -0,0 +1,8 @@
1
+ function i(t, n) {
2
+ if (typeof t != "number" || !Number.isFinite(t)) return null;
3
+ const e = Number.isFinite(n) ? n : 0;
4
+ return ((t - e) % 360 + 360) % 360;
5
+ }
6
+ export {
7
+ i as headingRotation
8
+ };
@@ -0,0 +1,18 @@
1
+ const o = "https://tripmap.invalid/", l = new URL(o).origin, u = /^[\u0000-\u0020]+|[\u0000-\u0020]+$/g, c = /[\t\n\r]/g, i = /^(?:\/|\.\.?\/|[#?])/, s = /^[a-z][a-z0-9+.-]*:/i;
2
+ function E(r) {
3
+ if (typeof r != "string") return null;
4
+ const t = r.replace(u, "").replace(c, "");
5
+ if (!t) return null;
6
+ const e = i.test(t);
7
+ if (!e && !s.test(t)) return null;
8
+ let n;
9
+ try {
10
+ n = new URL(t, o);
11
+ } catch {
12
+ return null;
13
+ }
14
+ return e ? n.origin === l ? t : null : n.protocol === "https:" || n.protocol === "http:" ? t : null;
15
+ }
16
+ export {
17
+ E as safeNodeHref
18
+ };
@@ -1,14 +1,15 @@
1
- import { buildTripNodes as d, formatTimeHHMM as g, lineNodes as u, normalizeHandNode as c, tripSummary as m } from "./nodes.js";
2
- import { approxDistanceKm as b, computeFramingBounds as y } from "./framing.js";
3
- import { OSM_ATTRIBUTION as N, buildAttributions as w } from "./attribution.js";
4
- const r = "0.1.0", n = {
1
+ import { buildTripNodes as u, captureTimeMs as c, formatTimeHHMM as g, lineNodes as m, normalizeHandNode as p, tripSummary as b } from "./nodes.js";
2
+ import { safeNodeHref as f } from "./href.js";
3
+ import { approxDistanceKm as v, computeFramingBounds as w } from "./framing.js";
4
+ import { OSM_ATTRIBUTION as T, buildAttributions as A } from "./attribution.js";
5
+ const a = "0.1.9", r = {
5
6
  light: "https://tiles.openfreemap.org/styles/liberty",
6
7
  dark: "https://tiles.openfreemap.org/styles/dark"
7
- }, l = () => import("./engine.js");
8
- function o(e) {
8
+ }, n = () => import("./engine.js");
9
+ function s(e) {
9
10
  return {
10
- styleUrl: e.styleUrl || n.light,
11
- darkStyleUrl: e.darkStyleUrl || e.styleUrl || n.dark,
11
+ styleUrl: e.styleUrl || r.light,
12
+ darkStyleUrl: e.darkStyleUrl || e.styleUrl || r.dark,
12
13
  theme: e.theme ?? "auto",
13
14
  cluster: e.cluster ?? !0,
14
15
  clusterRadius: e.clusterRadius ?? 40,
@@ -17,6 +18,9 @@ function o(e) {
17
18
  showPlayback: e.showPlayback ?? !0,
18
19
  showFullscreen: e.showFullscreen ?? !0,
19
20
  showExport: e.showExport ?? !0,
21
+ showGeolocate: e.showGeolocate ?? !0,
22
+ showTime: e.showTime ?? !0,
23
+ watermark: e.watermark,
20
24
  title: e.title,
21
25
  detail: e.detail ?? "popup",
22
26
  detailHost: e.detailHost,
@@ -35,14 +39,16 @@ function o(e) {
35
39
  lightboxClose: e.labels?.lightboxClose ?? "Close",
36
40
  lightboxPrev: e.labels?.lightboxPrev ?? "Previous photo",
37
41
  lightboxNext: e.labels?.lightboxNext ?? "Next photo",
38
- zoomImage: e.labels?.zoomImage ?? "View full screen"
42
+ zoomImage: e.labels?.zoomImage ?? "View full screen",
43
+ findMyLocation: e.labels?.findMyLocation ?? "Show my location",
44
+ locationNotAvailable: e.labels?.locationNotAvailable ?? "Location not available"
39
45
  },
40
46
  events: e.events ?? {}
41
47
  };
42
48
  }
43
- class a {
49
+ class o {
44
50
  constructor(t, i) {
45
- this.container = t, this.resolved = o(i), this.loader = i.engineLoader ?? l;
51
+ this.container = t, this.resolved = s(i), this.loader = i.engineLoader ?? n;
46
52
  }
47
53
  resolved;
48
54
  engine = null;
@@ -64,8 +70,8 @@ class a {
64
70
  try {
65
71
  t = await this.loader();
66
72
  } catch (i) {
67
- const s = i instanceof Error ? i : new Error("tripmap: engine load failed");
68
- throw this.resolved.events.onError?.(s), s;
73
+ const l = i instanceof Error ? i : new Error("tripmap: engine load failed");
74
+ throw this.resolved.events.onError?.(l), l;
69
75
  }
70
76
  this.destroyed || (this.engine = t.createEngine(this.container, this.resolved), this.pendingNodes && this.engine.setNodes(this.pendingNodes), this.pendingTheme && this.engine.setTheme(this.pendingTheme), this.pendingActive && this.engine.setActiveNode(this.pendingActive.id, this.pendingActive), this.pendingNodes = null, this.pendingTheme = null, this.pendingActive = null);
71
77
  })(), this.initPromise);
@@ -91,16 +97,18 @@ class a {
91
97
  }
92
98
  }
93
99
  export {
94
- n as DEFAULT_STYLE_URLS,
95
- N as OSM_ATTRIBUTION,
96
- a as TripMap,
97
- r as VERSION,
98
- b as approxDistanceKm,
99
- w as buildAttributions,
100
- d as buildTripNodes,
101
- y as computeFramingBounds,
100
+ r as DEFAULT_STYLE_URLS,
101
+ T as OSM_ATTRIBUTION,
102
+ o as TripMap,
103
+ a as VERSION,
104
+ v as approxDistanceKm,
105
+ A as buildAttributions,
106
+ u as buildTripNodes,
107
+ c as captureTimeMs,
108
+ w as computeFramingBounds,
102
109
  g as formatTimeHHMM,
103
- u as lineNodes,
104
- c as normalizeHandNode,
105
- m as tripSummary
110
+ m as lineNodes,
111
+ p as normalizeHandNode,
112
+ f as safeNodeHref,
113
+ b as tripSummary
106
114
  };
@@ -1,7 +1,7 @@
1
- function c(h) {
1
+ function d(h) {
2
2
  return h.largeImageUrl || h.imageUrl || h.thumbnailUrl;
3
3
  }
4
- class p {
4
+ class u {
5
5
  constructor(t, e, n) {
6
6
  this.host = t, this.labels = e, this.callbacks = n;
7
7
  }
@@ -22,8 +22,8 @@ class p {
22
22
  }
23
23
  /** Open on `id`; `nodes` is filtered to the ones with an image. */
24
24
  open(t, e) {
25
- this.nodes = t.filter((s) => !!c(s));
26
- const n = this.nodes.findIndex((s) => s.id === e);
25
+ this.nodes = t.filter((i) => !!d(i));
26
+ const n = this.nodes.findIndex((i) => i.id === e);
27
27
  n < 0 || (this.index = n, this.root || this.mount(), this.render());
28
28
  }
29
29
  next() {
@@ -47,48 +47,50 @@ class p {
47
47
  };
48
48
  mount() {
49
49
  const t = this.host.ownerDocument, e = t.createElement("div");
50
- e.className = "tripmap-lightbox", e.setAttribute("role", "dialog"), e.setAttribute("aria-modal", "true"), e.addEventListener("click", (d) => {
51
- d.target === e && this.close();
50
+ e.className = "tripmap-lightbox", e.setAttribute("role", "dialog"), e.setAttribute("aria-modal", "true"), e.addEventListener("click", (p) => {
51
+ p.target === e && this.close();
52
52
  });
53
53
  const n = t.createElement("button");
54
54
  n.type = "button", n.className = "tripmap-lightbox__close", n.setAttribute("aria-label", this.labels.close), n.textContent = "×", n.addEventListener("click", () => this.close());
55
+ const i = t.createElement("button");
56
+ i.type = "button", i.className = "tripmap-lightbox__nav tripmap-lightbox__nav--prev", i.setAttribute("aria-label", this.labels.prev), i.textContent = "‹", i.addEventListener("click", () => this.prev());
55
57
  const s = t.createElement("button");
56
- s.type = "button", s.className = "tripmap-lightbox__nav tripmap-lightbox__nav--prev", s.setAttribute("aria-label", this.labels.prev), s.textContent = "‹", s.addEventListener("click", () => this.prev());
57
- const o = t.createElement("button");
58
- o.type = "button", o.className = "tripmap-lightbox__nav tripmap-lightbox__nav--next", o.setAttribute("aria-label", this.labels.next), o.textContent = "›", o.addEventListener("click", () => this.next());
59
- const l = t.createElement("figure");
60
- l.className = "tripmap-lightbox__figure";
61
- const i = t.createElement("img");
62
- i.className = "tripmap-lightbox__img", i.decoding = "async", i.draggable = !1;
63
- const r = t.createElement("figcaption");
64
- r.className = "tripmap-lightbox__caption", l.appendChild(i), l.appendChild(r), e.appendChild(n), e.appendChild(s), e.appendChild(l), e.appendChild(o);
58
+ s.type = "button", s.className = "tripmap-lightbox__nav tripmap-lightbox__nav--next", s.setAttribute("aria-label", this.labels.next), s.textContent = "›", s.addEventListener("click", () => this.next());
59
+ const r = t.createElement("figure");
60
+ r.className = "tripmap-lightbox__figure";
61
+ const o = t.createElement("img");
62
+ o.className = "tripmap-lightbox__img", o.decoding = "async", o.draggable = !1;
63
+ const l = t.createElement("figcaption");
64
+ l.className = "tripmap-lightbox__caption", r.appendChild(o), r.appendChild(l), e.appendChild(n), e.appendChild(i), e.appendChild(r), e.appendChild(s);
65
65
  const a = t.fullscreenElement;
66
- (a && (a === this.host || a.contains(this.host)) ? a : t.body).appendChild(e), this.restoreFocus = t.activeElement instanceof HTMLElement ? t.activeElement : null, this.bodyOverflow = t.body.style.overflow, t.body.style.overflow = "hidden", t.addEventListener("keydown", this.onKeyDown), this.root = e, this.img = i, this.caption = r, this.prevBtn = s, this.nextBtn = o, n.focus();
66
+ (a && (a === this.host || a.contains(this.host)) ? a : t.body).appendChild(e), this.restoreFocus = t.activeElement instanceof HTMLElement ? t.activeElement : null, this.bodyOverflow = t.body.style.overflow, t.body.style.overflow = "hidden", t.addEventListener("keydown", this.onKeyDown), this.root = e, this.img = o, this.caption = l, this.prevBtn = i, this.nextBtn = s, n.focus();
67
67
  }
68
68
  render() {
69
69
  const t = this.nodes[this.index];
70
70
  if (!t || !this.img || !this.caption || !this.root) return;
71
- const e = c(t);
71
+ const e = d(t);
72
72
  this.img.src = e, this.img.alt = t.altText || t.title || "", this.caption.textContent = "";
73
73
  const n = [];
74
- t.title && n.push(t.title), t.capturedAt && n.push(this.callbacks.formatTime(t.capturedAt));
74
+ t.title && n.push(t.title);
75
+ const i = t.capturedAt ? this.callbacks.formatTime(t.capturedAt) : "";
76
+ i && n.push(i);
75
77
  const s = this.host.ownerDocument.createElement("span");
76
78
  s.className = "tripmap-lightbox__caption-head", s.textContent = n.join(" · "), n.length && this.caption.appendChild(s);
77
- const o = t.description || t.altText;
78
- if (o) {
79
- const i = this.host.ownerDocument.createElement("span");
80
- i.className = "tripmap-lightbox__caption-text", i.textContent = o, this.caption.appendChild(i);
79
+ const r = t.description || t.altText;
80
+ if (r) {
81
+ const l = this.host.ownerDocument.createElement("span");
82
+ l.className = "tripmap-lightbox__caption-text", l.textContent = r, this.caption.appendChild(l);
81
83
  }
82
- const l = this.nodes.length > 1;
83
- if (this.prevBtn && (this.prevBtn.hidden = !l), this.nextBtn && (this.nextBtn.hidden = !l), this.root.dataset.tripmapNode = t.id, l && this.callbacks.preload)
84
- for (const i of [1, -1]) {
85
- const r = this.nodes[(this.index + i + this.nodes.length) % this.nodes.length], a = c(r);
86
- a && this.callbacks.preload(a);
84
+ const o = this.nodes.length > 1;
85
+ if (this.prevBtn && (this.prevBtn.hidden = !o), this.nextBtn && (this.nextBtn.hidden = !o), this.root.dataset.tripmapNode = t.id, o && this.callbacks.preload)
86
+ for (const l of [1, -1]) {
87
+ const a = this.nodes[(this.index + l + this.nodes.length) % this.nodes.length], c = d(a);
88
+ c && this.callbacks.preload(c);
87
89
  }
88
90
  this.callbacks.onChange?.(t);
89
91
  }
90
92
  }
91
93
  export {
92
- p as Lightbox,
93
- c as lightboxImageUrl
94
+ u as Lightbox,
95
+ d as lightboxImageUrl
94
96
  };
@@ -1,6 +1,6 @@
1
- import { lineNodes as t } from "./nodes.js";
2
- function o(i) {
3
- const e = t(i);
1
+ import { lineNodes as i } from "./nodes.js";
2
+ function l(t) {
3
+ const e = i(t);
4
4
  return e.length < 2 ? null : {
5
5
  type: "Feature",
6
6
  geometry: {
@@ -18,7 +18,7 @@ const r = [
18
18
  "#60a5fa",
19
19
  1,
20
20
  "#1d4ed8"
21
- ], l = {
21
+ ], a = {
22
22
  "line-width": 3,
23
23
  "line-opacity": 0.85,
24
24
  "line-gradient": r
@@ -29,6 +29,6 @@ const r = [
29
29
  export {
30
30
  r as LINE_GRADIENT_EXPRESSION,
31
31
  p as LINE_LAYER_LAYOUT,
32
- l as LINE_LAYER_PAINT,
33
- o as buildLineFeature
32
+ a as LINE_LAYER_PAINT,
33
+ l as buildLineFeature
34
34
  };
@@ -1,37 +1,38 @@
1
- class p {
2
- constructor(i) {
3
- this.adapter = i;
1
+ import { safeNodeHref as m } from "./href.js";
2
+ class u {
3
+ constructor(r) {
4
+ this.adapter = r;
4
5
  }
5
6
  entries = /* @__PURE__ */ new Map();
6
7
  /** Diff the desired set against the mounted set by key. */
7
- sync(i) {
8
+ sync(r) {
8
9
  const n = /* @__PURE__ */ new Set();
9
- for (const t of i) {
10
+ for (const t of r) {
10
11
  n.add(t.key);
11
- const r = this.entries.get(t.key);
12
- if (r) {
13
- (r.lngLat[0] !== t.lngLat[0] || r.lngLat[1] !== t.lngLat[1]) && (this.adapter.move(r.handle, t.lngLat), r.lngLat = t.lngLat);
12
+ const i = this.entries.get(t.key);
13
+ if (i) {
14
+ (i.lngLat[0] !== t.lngLat[0] || i.lngLat[1] !== t.lngLat[1]) && (this.adapter.move(i.handle, t.lngLat), i.lngLat = t.lngLat);
14
15
  continue;
15
16
  }
16
- const a = t.createEl(), s = this.adapter.mount(a, t.lngLat);
17
- this.entries.set(t.key, { el: a, handle: s, lngLat: t.lngLat });
17
+ const s = t.createEl(), a = this.adapter.mount(s, t.lngLat);
18
+ this.entries.set(t.key, { el: s, handle: a, lngLat: t.lngLat });
18
19
  }
19
- for (const [t, r] of this.entries)
20
- n.has(t) || (this.adapter.unmount(r.handle), this.entries.delete(t));
20
+ for (const [t, i] of this.entries)
21
+ n.has(t) || (this.adapter.unmount(i.handle), this.entries.delete(t));
21
22
  }
22
- get(i) {
23
- return this.entries.get(i)?.el;
23
+ get(r) {
24
+ return this.entries.get(r)?.el;
24
25
  }
25
26
  keys() {
26
27
  return [...this.entries.keys()];
27
28
  }
28
29
  clear() {
29
- for (const i of this.entries.values()) this.adapter.unmount(i.handle);
30
+ for (const r of this.entries.values()) this.adapter.unmount(r.handle);
30
31
  this.entries.clear();
31
32
  }
32
33
  }
33
34
  const o = "tripmap-marker--active";
34
- function c(e, i) {
35
+ function g(e, r) {
35
36
  const n = document.createElement("button");
36
37
  if (n.type = "button", n.className = "tripmap-marker", n.dataset.tripmapNode = e.id, n.setAttribute("aria-label", e.title || e.altText || e.id), e.thumbnailUrl) {
37
38
  const t = document.createElement("img");
@@ -42,54 +43,57 @@ function c(e, i) {
42
43
  t.className = "tripmap-marker__dot", n.appendChild(t);
43
44
  }
44
45
  return n.addEventListener("click", (t) => {
45
- t.stopPropagation(), i(e);
46
+ t.stopPropagation(), r(e);
46
47
  }), n;
47
48
  }
48
- function m(e, i, n) {
49
+ function h(e, r, n) {
49
50
  const t = document.createElement("button");
50
51
  t.type = "button", t.className = "tripmap-marker tripmap-marker--cluster", t.setAttribute("aria-label", `${e}`);
51
- const r = document.createElement("span");
52
- return r.className = "tripmap-marker__count", r.textContent = String(e), t.appendChild(r), t.addEventListener("click", (a) => {
53
- a.stopPropagation(), n();
52
+ const i = document.createElement("span");
53
+ return i.className = "tripmap-marker__count", i.textContent = String(e), t.appendChild(i), t.addEventListener("click", (s) => {
54
+ s.stopPropagation(), n();
54
55
  }), t;
55
56
  }
56
- function d(e, i) {
57
- e?.classList.toggle(o, i);
57
+ function f(e, r) {
58
+ e?.classList.toggle(o, r);
58
59
  }
59
- function u(e, i, n = {}) {
60
+ function k(e, r, n = {}) {
60
61
  const t = document.createElement("div");
61
62
  if (t.className = "tripmap-popup", e.imageUrl || e.thumbnailUrl) {
62
63
  const a = n.image ?? document.createElement("img");
63
- if (n.image || (a.src = e.imageUrl || e.thumbnailUrl, a.loading = "eager", a.decoding = "async"), a.alt = e.altText || "", a.className = "tripmap-popup__img", e.href) {
64
- const s = document.createElement("a");
65
- s.href = e.href, s.appendChild(a), t.appendChild(s);
64
+ n.image || (a.src = e.imageUrl || e.thumbnailUrl, a.loading = "eager", a.decoding = "async"), a.alt = e.altText || "", a.className = "tripmap-popup__img";
65
+ const c = m(e.href);
66
+ if (c) {
67
+ const l = document.createElement("a");
68
+ l.href = c, l.appendChild(a), t.appendChild(l);
66
69
  } else if (n.onImageClick) {
67
- const s = document.createElement("button");
68
- s.type = "button", s.className = "tripmap-popup__zoom", n.zoomLabel && s.setAttribute("aria-label", n.zoomLabel), s.appendChild(a), s.addEventListener("click", (l) => {
69
- l.stopPropagation(), n.onImageClick?.(e);
70
- }), t.appendChild(s);
70
+ const l = document.createElement("button");
71
+ l.type = "button", l.className = "tripmap-popup__zoom", n.zoomLabel && l.setAttribute("aria-label", n.zoomLabel), l.appendChild(a), l.addEventListener("click", (p) => {
72
+ p.stopPropagation(), n.onImageClick?.(e);
73
+ }), t.appendChild(l);
71
74
  } else
72
75
  t.appendChild(a);
73
76
  }
74
- const r = document.createElement("div");
75
- if (r.className = "tripmap-popup__meta", e.title) {
77
+ const i = document.createElement("div");
78
+ if (i.className = "tripmap-popup__meta", e.title) {
76
79
  const a = document.createElement("strong");
77
- a.className = "tripmap-popup__title", a.textContent = e.title, r.appendChild(a);
80
+ a.className = "tripmap-popup__title", a.textContent = e.title, i.appendChild(a);
78
81
  }
79
- if (e.capturedAt) {
82
+ const s = e.capturedAt ? r(e.capturedAt) : "";
83
+ if (s) {
80
84
  const a = document.createElement("span");
81
- a.className = "tripmap-popup__time", a.textContent = i(e.capturedAt), r.appendChild(a);
85
+ a.className = "tripmap-popup__time", a.textContent = s, i.appendChild(a);
82
86
  }
83
87
  if (e.description || e.altText) {
84
88
  const a = document.createElement("p");
85
- a.className = "tripmap-popup__desc", a.textContent = e.description || e.altText || "", r.appendChild(a);
89
+ a.className = "tripmap-popup__desc", a.textContent = e.description || e.altText || "", i.appendChild(a);
86
90
  }
87
- return r.childNodes.length > 0 && t.appendChild(r), t;
91
+ return i.childNodes.length > 0 && t.appendChild(i), t;
88
92
  }
89
93
  export {
90
- p as MarkerPool,
91
- m as createClusterMarkerEl,
92
- c as createNodeMarkerEl,
93
- u as createPopupContent,
94
- d as setMarkerActive
94
+ u as MarkerPool,
95
+ h as createClusterMarkerEl,
96
+ g as createNodeMarkerEl,
97
+ k as createPopupContent,
98
+ f as setMarkerActive
95
99
  };
@@ -1,55 +1,68 @@
1
- function d(n, t) {
2
- return typeof n == "number" && typeof t == "number" && Number.isFinite(n) && Number.isFinite(t) && Math.abs(n) <= 90 && Math.abs(t) <= 180;
3
- }
4
- function r(n) {
5
- if (!n) return null;
6
- const t = Date.parse(n);
7
- return Number.isNaN(t) ? null : t;
8
- }
9
- function c(n, t) {
10
- return !n || !d(n.lat, n.lng) ? null : {
11
- id: n.id || `waypoint-${t}`,
12
- lat: n.lat,
13
- lng: n.lng,
14
- capturedAt: r(n.capturedAt) !== null ? n.capturedAt : void 0,
15
- thumbnailUrl: n.thumbnailUrl,
16
- title: n.title,
17
- description: n.description,
18
- href: n.href,
1
+ import { safeNodeHref as f } from "./href.js";
2
+ const p = 90, a = 180;
3
+ function s(t, n) {
4
+ return typeof t == "number" && typeof n == "number" && Number.isFinite(t) && Number.isFinite(n) && Math.abs(t) <= p && Math.abs(n) <= a;
5
+ }
6
+ const m = /^(\d{4}-\d{2}-\d{2})[Tt ](\d{2}:\d{2}(?::\d{2}(?:\.\d+)?)?)$/;
7
+ function o(t) {
8
+ if (typeof t != "string" || !t) return null;
9
+ const n = m.exec(t.trim()), i = Date.parse(n ? `${n[1]}T${n[2]}Z` : t);
10
+ return Number.isNaN(i) ? null : i;
11
+ }
12
+ function h(t, n) {
13
+ return !t || !s(t.lat, t.lng) ? null : {
14
+ id: t.id || `waypoint-${n}`,
15
+ lat: t.lat,
16
+ lng: t.lng,
17
+ capturedAt: o(t.capturedAt) !== null ? t.capturedAt : void 0,
18
+ thumbnailUrl: t.thumbnailUrl,
19
+ title: t.title,
20
+ description: t.description,
21
+ // Where author JSON becomes a node: an unsafe link is dropped here, so no
22
+ // consumer of the node (popup, SSR fallback) ever holds it.
23
+ href: f(t.href) ?? void 0,
19
24
  kind: "waypoint"
20
25
  };
21
26
  }
22
- function f(n, t = []) {
23
- const i = [], u = /* @__PURE__ */ new Set();
24
- for (const e of n)
25
- !e || !e.id || !d(e.lat, e.lng) || u.has(e.id) || (u.add(e.id), i.push({ kind: "photo", ...e }));
26
- t.forEach((e, a) => {
27
- const l = c(e, a);
28
- !l || u.has(l.id) || (u.add(l.id), i.push(l));
27
+ function M(t, n = []) {
28
+ const i = [], r = /* @__PURE__ */ new Set();
29
+ for (const e of t)
30
+ !e || !e.id || !s(e.lat, e.lng) || r.has(e.id) || (r.add(e.id), i.push({ kind: "photo", ...e }));
31
+ n.forEach((e, d) => {
32
+ const u = h(e, d);
33
+ !u || r.has(u.id) || (r.add(u.id), i.push(u));
29
34
  });
30
- const o = i.filter((e) => r(e.capturedAt) !== null), s = i.filter((e) => r(e.capturedAt) === null);
31
- return o.sort((e, a) => r(e.capturedAt) - r(a.capturedAt)), [...o, ...s];
35
+ const c = i.filter((e) => o(e.capturedAt) !== null), l = i.filter((e) => o(e.capturedAt) === null);
36
+ return c.sort((e, d) => o(e.capturedAt) - o(d.capturedAt)), [...c, ...l];
32
37
  }
33
- function p(n) {
34
- return n.filter((t) => r(t.capturedAt) !== null);
38
+ function A(t) {
39
+ return t.filter((n) => o(n.capturedAt) !== null);
35
40
  }
36
- function h(n) {
37
- const t = /T(\d{2}):(\d{2})/.exec(n);
38
- return t ? `${t[1]}:${t[2]}` : "";
41
+ function g(t) {
42
+ const n = /T(\d{2}):(\d{2})/.exec(t);
43
+ return n ? `${n[1]}:${n[2]}` : "";
39
44
  }
40
- function m(n) {
41
- const t = p(n);
45
+ const T = /^(\d{4}-\d{2}-\d{2})(?:[Tt ]|$)/;
46
+ function E(t) {
47
+ const n = A(t), i = n[0] ?? null;
42
48
  return {
43
- count: n.length,
44
- first: t[0] ?? null,
45
- last: t[t.length - 1] ?? null,
46
- dateIso: t[0]?.capturedAt?.slice(0, 10) ?? null
49
+ count: t.length,
50
+ first: i,
51
+ last: n[n.length - 1] ?? null,
52
+ // Timed means captureTimeMs read it, so capturedAt is a string here.
53
+ dateIso: i ? N(i.capturedAt) : null
47
54
  };
48
55
  }
56
+ function N(t) {
57
+ const n = T.exec(t.trim());
58
+ return n ? n[1] : new Date(o(t)).toISOString().slice(0, 10);
59
+ }
49
60
  export {
50
- f as buildTripNodes,
51
- h as formatTimeHHMM,
52
- p as lineNodes,
53
- c as normalizeHandNode,
54
- m as tripSummary
61
+ M as buildTripNodes,
62
+ o as captureTimeMs,
63
+ g as formatTimeHHMM,
64
+ A as lineNodes,
65
+ h as normalizeHandNode,
66
+ f as safeNodeHref,
67
+ E as tripSummary
55
68
  };
@@ -1,29 +1,29 @@
1
- import { lineNodes as d } from "./nodes.js";
2
- const m = 2e3;
3
- function h(c, o, i = {}) {
4
- const e = d(c), p = i.dwellMs ?? m;
5
- let t = !1, r;
1
+ import { lineNodes as m } from "./nodes.js";
2
+ const w = 2e3;
3
+ function T(r, t, u = {}) {
4
+ const e = m(r), a = u.dwellMs ?? w;
5
+ let o = !1, l;
6
6
  const n = {
7
7
  stop() {
8
- t || (t = !0, r && clearTimeout(r), f(), o.onDone?.());
8
+ o || (o = !0, l && clearTimeout(l), f(), t.onDone?.());
9
9
  }
10
- }, f = o.onUserInterrupt?.(() => n.stop()) ?? (() => {
10
+ }, f = t.onUserInterrupt?.(() => n.stop()) ?? (() => {
11
11
  });
12
- async function u() {
13
- o.preload?.(e[0]);
12
+ async function p() {
13
+ t.preload?.(e[0]);
14
14
  for (let s = 0; s < e.length; s++) {
15
- const a = e[s];
16
- if (t || (await o.flyTo(a), t)) return;
17
- o.showNode(a);
18
- const l = e[s + 1];
19
- l && o.preload?.(l), await new Promise((w) => {
20
- r = setTimeout(w, p);
15
+ const i = e[s];
16
+ if (o || (await t.flyTo(i), o)) return;
17
+ t.showNode(i);
18
+ const c = e[s + 1];
19
+ c && t.preload?.(c), await new Promise((d) => {
20
+ l = setTimeout(d, a);
21
21
  });
22
22
  }
23
23
  n.stop();
24
24
  }
25
- return e.length === 0 ? n.stop() : u(), n;
25
+ return e.length === 0 ? n.stop() : p(), n;
26
26
  }
27
27
  export {
28
- h as startPlayback
28
+ T as startPlayback
29
29
  };
@@ -1,4 +1,4 @@
1
- class c {
1
+ class o {
2
2
  constructor(e, t = 4) {
3
3
  this.doc = e, this.limit = t;
4
4
  }
@@ -8,24 +8,24 @@ class c {
8
8
  const t = this.entries.get(e);
9
9
  if (t)
10
10
  return this.entries.delete(e), this.entries.set(e, t), t.ready;
11
- const s = this.doc.createElement("img");
12
- s.decoding = "async";
13
- const r = new Promise((i) => {
14
- s.addEventListener(
11
+ const i = this.doc.createElement("img");
12
+ i.decoding = "async";
13
+ const n = new Promise((s) => {
14
+ i.addEventListener(
15
15
  "load",
16
16
  () => {
17
- const n = typeof s.decode == "function" ? s.decode() : void 0;
18
- n ? n.then(i, i) : i();
17
+ const r = typeof i.decode == "function" ? i.decode() : void 0;
18
+ r ? r.then(s, s) : s();
19
19
  },
20
20
  { once: !0 }
21
- ), s.addEventListener("error", () => i(), { once: !0 });
21
+ ), i.addEventListener("error", () => s(), { once: !0 });
22
22
  });
23
- for (s.src = e, this.entries.set(e, { img: s, ready: r }); this.entries.size > this.limit; ) {
24
- const i = this.entries.keys().next().value;
25
- if (i === void 0) break;
26
- this.entries.delete(i);
23
+ for (i.src = e, this.entries.set(e, { img: i, ready: n }); this.entries.size > this.limit; ) {
24
+ const s = this.entries.keys().next().value;
25
+ if (s === void 0) break;
26
+ this.entries.delete(s);
27
27
  }
28
- return r;
28
+ return n;
29
29
  }
30
30
  /** Hand out the preloaded element (it leaves the cache — it is about to be mounted). */
31
31
  take(e) {
@@ -40,5 +40,5 @@ class c {
40
40
  }
41
41
  }
42
42
  export {
43
- c as ImagePreloader
43
+ o as ImagePreloader
44
44
  };