@syntrologie/runtime-sdk 2.8.0-canary.8 → 2.8.0

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.
@@ -34,6 +34,11 @@ function guardAgainstReconciliation(container, anchor, reinsertFn, opts) {
34
34
  debounceTimer = setTimeout(() => {
35
35
  if (disconnected)
36
36
  return;
37
+ if (!anchor.isConnected) {
38
+ observer.disconnect();
39
+ disconnected = true;
40
+ return;
41
+ }
37
42
  retries++;
38
43
  try {
39
44
  reinsertFn();
@@ -75,7 +80,16 @@ var ALLOWED_TAGS = /* @__PURE__ */ new Set([
75
80
  "sup",
76
81
  "sub",
77
82
  "a",
78
- "button"
83
+ "button",
84
+ // SVG elements (for inline Lucide icons in config HTML)
85
+ "svg",
86
+ "path",
87
+ "circle",
88
+ "line",
89
+ "polyline",
90
+ "polygon",
91
+ "rect",
92
+ "g"
79
93
  ]);
80
94
  function sanitizeHtml(html) {
81
95
  var _a2;
@@ -213,15 +227,20 @@ var executeInsertHtml = async (action, context) => {
213
227
  container.removeEventListener("click", deepLinkHandler);
214
228
  }
215
229
  guardCleanup();
216
- if (action.position === "replace" && originalContent !== null) {
217
- const restoredEl = document.createElement(anchorEl.tagName);
218
- restoredEl.innerHTML = originalContent;
219
- Array.from(anchorEl.attributes).forEach((attr) => {
220
- restoredEl.setAttribute(attr.name, attr.value);
221
- });
222
- container.replaceWith(restoredEl);
223
- } else {
224
- container.remove();
230
+ if (!container.isConnected)
231
+ return;
232
+ try {
233
+ if (action.position === "replace" && originalContent !== null) {
234
+ const restoredEl = document.createElement(anchorEl.tagName);
235
+ restoredEl.innerHTML = originalContent;
236
+ Array.from(anchorEl.attributes).forEach((attr) => {
237
+ restoredEl.setAttribute(attr.name, attr.value);
238
+ });
239
+ container.replaceWith(restoredEl);
240
+ } else {
241
+ container.remove();
242
+ }
243
+ } catch {
225
244
  }
226
245
  },
227
246
  updateFn: (changes) => {
@@ -251,6 +270,8 @@ var executeSetText = async (action, context) => {
251
270
  });
252
271
  return {
253
272
  cleanup: () => {
273
+ if (!anchorEl.isConnected)
274
+ return;
254
275
  anchorEl.textContent = originalText;
255
276
  },
256
277
  updateFn: (changes) => {
@@ -292,6 +313,8 @@ var executeSetAttr = async (action, context) => {
292
313
  });
293
314
  return {
294
315
  cleanup: () => {
316
+ if (!anchorEl.isConnected)
317
+ return;
295
318
  if (hadAttribute && originalValue !== null) {
296
319
  anchorEl.setAttribute(action.attr, originalValue);
297
320
  } else {
@@ -325,6 +348,8 @@ var executeAddClass = async (action, context) => {
325
348
  });
326
349
  return {
327
350
  cleanup: () => {
351
+ if (!anchorEl.isConnected)
352
+ return;
328
353
  if (!hadClass) {
329
354
  anchorEl.classList.remove(action.className);
330
355
  }
@@ -351,6 +376,8 @@ var executeRemoveClass = async (action, context) => {
351
376
  });
352
377
  return {
353
378
  cleanup: () => {
379
+ if (!anchorEl.isConnected)
380
+ return;
354
381
  if (hadClass) {
355
382
  anchorEl.classList.add(action.className);
356
383
  }
@@ -383,6 +410,8 @@ var executeSetStyle = async (action, context) => {
383
410
  });
384
411
  return {
385
412
  cleanup: () => {
413
+ if (!anchorEl.isConnected)
414
+ return;
386
415
  for (const [prop, originalValue] of originalStyles) {
387
416
  if (originalValue) {
388
417
  anchorEl.style.setProperty(prop, originalValue);
@@ -1558,10 +1587,10 @@ function showHighlight(anchorEl, overlayRoot, opts) {
1558
1587
  return;
1559
1588
  }
1560
1589
  const rect = anchorEl.getBoundingClientRect();
1561
- const x = Math.max(0, rect.left - padding);
1562
- const y = Math.max(0, rect.top - padding);
1563
- const w = Math.min(window.innerWidth, rect.width + padding * 2);
1564
- const h = Math.min(window.innerHeight, rect.height + padding * 2);
1590
+ const x = rect.left - padding;
1591
+ const y = rect.top - padding;
1592
+ const w = rect.width + padding * 2;
1593
+ const h = rect.height + padding * 2;
1565
1594
  Object.assign(ring.style, {
1566
1595
  left: `${x}px`,
1567
1596
  top: `${y}px`,
@@ -1610,17 +1639,22 @@ function showHighlight(anchorEl, overlayRoot, opts) {
1610
1639
  window.addEventListener("scroll", onScroll, true);
1611
1640
  window.addEventListener("resize", onResize);
1612
1641
  const onKey = (e) => {
1613
- if (e.key === "Escape" && onEsc)
1642
+ var _a3;
1643
+ if (e.key === "Escape" && onEsc) {
1644
+ (_a3 = opts == null ? void 0 : opts.onDismiss) == null ? void 0 : _a3.call(opts);
1614
1645
  handle.destroy();
1646
+ }
1615
1647
  };
1616
1648
  if (onEsc) {
1617
1649
  window.addEventListener("keydown", onKey);
1618
1650
  }
1619
1651
  const onClick = (event) => {
1652
+ var _a3;
1620
1653
  if (blocking) {
1621
1654
  event.preventDefault();
1622
1655
  event.stopPropagation();
1623
1656
  } else if (onClickOutside) {
1657
+ (_a3 = opts == null ? void 0 : opts.onDismiss) == null ? void 0 : _a3.call(opts);
1624
1658
  handle.destroy();
1625
1659
  }
1626
1660
  };
@@ -1637,8 +1671,14 @@ function showHighlight(anchorEl, overlayRoot, opts) {
1637
1671
  scrim.style.pointerEvents = "none";
1638
1672
  scrim.style.opacity = "0";
1639
1673
  setTimeout(() => {
1640
- scrim.remove();
1641
- ring.remove();
1674
+ try {
1675
+ scrim.remove();
1676
+ } catch {
1677
+ }
1678
+ try {
1679
+ ring.remove();
1680
+ } catch {
1681
+ }
1642
1682
  }, 220);
1643
1683
  }
1644
1684
  };
@@ -1666,7 +1706,16 @@ var ALLOWED_TAGS2 = /* @__PURE__ */ new Set([
1666
1706
  "sup",
1667
1707
  "sub",
1668
1708
  "a",
1669
- "button"
1709
+ "button",
1710
+ // SVG elements (for inline Lucide icons in config HTML)
1711
+ "svg",
1712
+ "path",
1713
+ "circle",
1714
+ "line",
1715
+ "polyline",
1716
+ "polygon",
1717
+ "rect",
1718
+ "g"
1670
1719
  ]);
1671
1720
  function sanitizeHtml2(html) {
1672
1721
  var _a2;
@@ -1875,8 +1924,14 @@ var executeModal = async (action, context) => {
1875
1924
  modal2.style.transform = "translate(-50%, -50%) scale(0.95)";
1876
1925
  scrimEl.style.opacity = "0";
1877
1926
  setTimeout(() => {
1878
- modal2.remove();
1879
- scrimEl.remove();
1927
+ try {
1928
+ modal2.remove();
1929
+ } catch {
1930
+ }
1931
+ try {
1932
+ scrimEl.remove();
1933
+ } catch {
1934
+ }
1880
1935
  }, 200);
1881
1936
  context.publishEvent("action.modal_dismissed", {
1882
1937
  actionClicked
@@ -1923,10 +1978,12 @@ function getAnchorReference(anchorEl) {
1923
1978
  }
1924
1979
  function showTooltip(anchorEl, overlayRoot, opts) {
1925
1980
  var _a2;
1926
- const rect = anchorEl.getBoundingClientRect();
1927
- const isLargeElement = rect.width > window.innerWidth * 0.8 || rect.height > window.innerHeight * 0.8;
1928
- if (!isLargeElement) {
1929
- anchorEl.scrollIntoView({ behavior: "smooth", block: "center", inline: "center" });
1981
+ if (!opts.trigger || opts.trigger === "immediate") {
1982
+ const rect = anchorEl.getBoundingClientRect();
1983
+ const isLargeElement = rect.width > window.innerWidth * 0.8 || rect.height > window.innerHeight * 0.8;
1984
+ if (!isLargeElement) {
1985
+ anchorEl.scrollIntoView({ behavior: "smooth", block: "center", inline: "center" });
1986
+ }
1930
1987
  }
1931
1988
  const div = document.createElement("div");
1932
1989
  div.className = "syntro-tooltip";
@@ -2136,7 +2193,12 @@ function showTooltip(anchorEl, overlayRoot, opts) {
2136
2193
  }
2137
2194
  div.style.pointerEvents = "none";
2138
2195
  div.style.opacity = "0";
2139
- setTimeout(() => div.remove(), 200);
2196
+ setTimeout(() => {
2197
+ try {
2198
+ div.remove();
2199
+ } catch {
2200
+ }
2201
+ }, 200);
2140
2202
  }
2141
2203
  };
2142
2204
  return handle;
@@ -2169,7 +2231,7 @@ function WorkflowTracker({ workflows, expanded, onStepClick, onDismiss }) {
2169
2231
  }
2170
2232
 
2171
2233
  // ../adaptives/adaptive-overlays/dist/WorkflowWidget.js
2172
- function showWorkflowToast(container, notification) {
2234
+ function showWorkflowToast(notification) {
2173
2235
  const toast = document.createElement("div");
2174
2236
  toast.setAttribute("data-testid", "workflow-toast");
2175
2237
  toast.className = "se-fixed se-bottom-4 se-right-4 se-z-50";
@@ -2203,7 +2265,7 @@ function showWorkflowToast(container, notification) {
2203
2265
  bodyEl.textContent = notification.body;
2204
2266
  toast.appendChild(bodyEl);
2205
2267
  }
2206
- container.appendChild(toast);
2268
+ document.body.appendChild(toast);
2207
2269
  let removeTimer;
2208
2270
  const fadeTimer = setTimeout(() => {
2209
2271
  toast.style.opacity = "0";
@@ -2302,10 +2364,10 @@ function WorkflowWidgetInner({ runtime: runtime3 }) {
2302
2364
  return newEntries.length > 0 ? [...prev, ...newEntries] : prev;
2303
2365
  });
2304
2366
  for (const [tourId, { meta }] of tourWorkflows) {
2305
- if (!notifiedRef.current.has(tourId) && meta.notification && containerRef.current && !dismissed.includes(tourId) && !completed[tourId]) {
2367
+ if (!notifiedRef.current.has(tourId) && meta.notification && !dismissed.includes(tourId) && !completed[tourId]) {
2306
2368
  notifiedRef.current.add(tourId);
2307
2369
  (_c = stateNs == null ? void 0 : stateNs.set) == null ? void 0 : _c.call(stateNs, "notified", [...notifiedRef.current]);
2308
- const cleanup = showWorkflowToast(containerRef.current, meta.notification);
2370
+ const cleanup = showWorkflowToast(meta.notification);
2309
2371
  toastCleanupsRef.current.push(cleanup);
2310
2372
  }
2311
2373
  }
@@ -2338,8 +2400,8 @@ function WorkflowWidgetInner({ runtime: runtime3 }) {
2338
2400
  notifiedRef.current.add(tourId);
2339
2401
  (_c = stateNs == null ? void 0 : stateNs.set) == null ? void 0 : _c.call(stateNs, "notified", [...notifiedRef.current]);
2340
2402
  const workflow = currentWorkflows.get(tourId);
2341
- if ((workflow == null ? void 0 : workflow.meta.notification) && containerRef.current) {
2342
- const cleanup = showWorkflowToast(containerRef.current, workflow.meta.notification);
2403
+ if (workflow == null ? void 0 : workflow.meta.notification) {
2404
+ const cleanup = showWorkflowToast(workflow.meta.notification);
2343
2405
  toastCleanupsRef.current.push(cleanup);
2344
2406
  }
2345
2407
  }
@@ -2443,6 +2505,10 @@ var executeHighlight = async (action, context) => {
2443
2505
  return { cleanup: () => {
2444
2506
  } };
2445
2507
  }
2508
+ if (anchorEl.getAttribute("data-syntro-highlight-dismissed")) {
2509
+ return { cleanup: () => {
2510
+ } };
2511
+ }
2446
2512
  const existing = anchorEl.getAttribute("data-syntro-highlight");
2447
2513
  if (existing) {
2448
2514
  const prev = context.overlayRoot.querySelectorAll(".syntro-spotlight-scrim, .syntro-spotlight-ring");
@@ -2465,7 +2531,10 @@ var executeHighlight = async (action, context) => {
2465
2531
  ringColor,
2466
2532
  blocking: (_i = action.blocking) != null ? _i : false,
2467
2533
  onClickOutside: (_j = action.onClickOutside) != null ? _j : true,
2468
- onEsc: (_k = action.onEsc) != null ? _k : true
2534
+ onEsc: (_k = action.onEsc) != null ? _k : true,
2535
+ onDismiss: () => {
2536
+ anchorEl.setAttribute("data-syntro-highlight-dismissed", "true");
2537
+ }
2469
2538
  });
2470
2539
  context.publishEvent("action.applied", {
2471
2540
  id: context.generateId(),
@@ -2476,6 +2545,7 @@ var executeHighlight = async (action, context) => {
2476
2545
  cleanup: () => {
2477
2546
  handle.destroy();
2478
2547
  anchorEl.removeAttribute("data-syntro-highlight");
2548
+ anchorEl.removeAttribute("data-syntro-highlight-dismissed");
2479
2549
  }
2480
2550
  };
2481
2551
  };
@@ -2565,6 +2635,8 @@ var executePulse = async (action, context) => {
2565
2635
  return {
2566
2636
  cleanup: () => {
2567
2637
  clearTimeout(timeoutId);
2638
+ if (!anchorEl.isConnected)
2639
+ return;
2568
2640
  anchorEl.style.animation = originalAnimation;
2569
2641
  anchorEl.removeAttribute("data-syntro-pulse");
2570
2642
  }
@@ -2634,7 +2706,12 @@ var executeBadge = async (action, context) => {
2634
2706
  });
2635
2707
  return {
2636
2708
  cleanup: () => {
2637
- badge2.remove();
2709
+ try {
2710
+ badge2.remove();
2711
+ } catch {
2712
+ }
2713
+ if (!anchorEl.isConnected)
2714
+ return;
2638
2715
  if (originalPosition !== void 0) {
2639
2716
  anchorEl.style.position = originalPosition;
2640
2717
  }
@@ -3358,7 +3435,7 @@ function getAntiFlickerSnippet(config = {}) {
3358
3435
  }
3359
3436
 
3360
3437
  // src/version.ts
3361
- var SDK_VERSION = "2.8.0-canary.8";
3438
+ var SDK_VERSION = "2.8.0";
3362
3439
 
3363
3440
  // src/types.ts
3364
3441
  var SDK_SCHEMA_VERSION = "2.0";
@@ -3641,7 +3718,8 @@ function registerFromTriggerWhen(triggerWhen, accumulator) {
3641
3718
  if (cond.type === "event_count" && cond.key) {
3642
3719
  const counter = cond.counter;
3643
3720
  const predicate = counter ? buildPredicate(counter) : () => true;
3644
- accumulator.register(cond.key, predicate);
3721
+ const needsTimestamps = typeof cond.withinMs === "number";
3722
+ accumulator.register(cond.key, predicate, needsTimestamps);
3645
3723
  }
3646
3724
  }
3647
3725
  }
@@ -3853,8 +3931,65 @@ var CanvasEvents = {
3853
3931
  custom: customCanvasEvent
3854
3932
  };
3855
3933
 
3934
+ // src/components/emojiToIcon.tsx
3935
+ import {
3936
+ AlertTriangle,
3937
+ ArrowRight,
3938
+ Banknote,
3939
+ Bell,
3940
+ BookOpen,
3941
+ CheckCircle,
3942
+ ClipboardList,
3943
+ Compass,
3944
+ FileText,
3945
+ Gamepad2,
3946
+ HelpCircle,
3947
+ Landmark,
3948
+ Layers,
3949
+ Lightbulb,
3950
+ MessageCircle,
3951
+ SkipForward,
3952
+ Sparkles,
3953
+ Timer,
3954
+ Trophy
3955
+ } from "lucide-react";
3956
+ import { jsx as jsx2 } from "react/jsx-runtime";
3957
+ var EMOJI_ICON_MAP = {
3958
+ "\u2753": HelpCircle,
3959
+ "\u{1F9ED}": Compass,
3960
+ "\u{1F4DD}": FileText,
3961
+ "\u{1F3AF}": Layers,
3962
+ "\u{1F3C6}": Trophy,
3963
+ "\u2728": Sparkles,
3964
+ "\u{1F4AC}": MessageCircle,
3965
+ "\u{1F3AE}": Gamepad2,
3966
+ "\u{1F4A1}": Lightbulb,
3967
+ "\u{1F4B0}": Banknote,
3968
+ "\u{1F4CB}": ClipboardList,
3969
+ "\u2705": CheckCircle,
3970
+ "\u26A0\uFE0F": AlertTriangle,
3971
+ "\u{1F4B5}": Banknote,
3972
+ "\u{1F3DB}\uFE0F": Landmark,
3973
+ "\u23ED\uFE0F": SkipForward,
3974
+ "\u27A1\uFE0F": ArrowRight,
3975
+ "\u23F1\uFE0F": Timer,
3976
+ "\u{1F4D6}": BookOpen,
3977
+ "\u{1F514}": Bell
3978
+ };
3979
+ function EmojiIcon({
3980
+ emoji,
3981
+ size = 14,
3982
+ color = "currentColor"
3983
+ }) {
3984
+ const Icon = EMOJI_ICON_MAP[emoji];
3985
+ if (!Icon) {
3986
+ return /* @__PURE__ */ jsx2("span", { children: emoji });
3987
+ }
3988
+ return /* @__PURE__ */ jsx2(Icon, { size, color });
3989
+ }
3990
+
3856
3991
  // src/notifications/NotificationToastStack.tsx
3857
- import { jsx as jsx2, jsxs } from "react/jsx-runtime";
3992
+ import { jsx as jsx3, jsxs } from "react/jsx-runtime";
3858
3993
  var TOAST_STYLES_ID = "syntro-toast-styles";
3859
3994
  var TOAST_CSS = `
3860
3995
  @keyframes syntro-toast-slide-in {
@@ -3891,7 +4026,7 @@ function NotificationToastStack({
3891
4026
  const { shadowRoot } = useShadowRoot();
3892
4027
  ensureToastStyles(shadowRoot);
3893
4028
  if (notifications.length === 0) return null;
3894
- return /* @__PURE__ */ jsx2(
4029
+ return /* @__PURE__ */ jsx3(
3895
4030
  "div",
3896
4031
  {
3897
4032
  "data-testid": "notification-toast-stack",
@@ -3946,7 +4081,7 @@ function NotificationToastStack({
3946
4081
  padding: "10px 12px"
3947
4082
  },
3948
4083
  children: [
3949
- /* @__PURE__ */ jsx2(
4084
+ /* @__PURE__ */ jsx3(
3950
4085
  "div",
3951
4086
  {
3952
4087
  style: {
@@ -3960,11 +4095,11 @@ function NotificationToastStack({
3960
4095
  flexShrink: 0,
3961
4096
  fontSize: "14px"
3962
4097
  },
3963
- children: (_a2 = notif.icon) != null ? _a2 : "\u{1F514}"
4098
+ children: /* @__PURE__ */ jsx3(EmojiIcon, { emoji: (_a2 = notif.icon) != null ? _a2 : "\u{1F514}", size: 14 })
3964
4099
  }
3965
4100
  ),
3966
4101
  /* @__PURE__ */ jsxs("div", { style: { flex: 1, minWidth: 0 }, children: [
3967
- /* @__PURE__ */ jsx2(
4102
+ /* @__PURE__ */ jsx3(
3968
4103
  "div",
3969
4104
  {
3970
4105
  style: {
@@ -3979,7 +4114,7 @@ function NotificationToastStack({
3979
4114
  children: notif.title
3980
4115
  }
3981
4116
  ),
3982
- notif.body && /* @__PURE__ */ jsx2(
4117
+ notif.body && /* @__PURE__ */ jsx3(
3983
4118
  "div",
3984
4119
  {
3985
4120
  style: {
@@ -3995,7 +4130,7 @@ function NotificationToastStack({
3995
4130
  }
3996
4131
  )
3997
4132
  ] }),
3998
- /* @__PURE__ */ jsx2(
4133
+ /* @__PURE__ */ jsx3(
3999
4134
  "button",
4000
4135
  {
4001
4136
  type: "button",
@@ -4020,7 +4155,7 @@ function NotificationToastStack({
4020
4155
  ]
4021
4156
  }
4022
4157
  ),
4023
- /* @__PURE__ */ jsx2("div", { style: { height: "2px", background: "rgba(0, 0, 0, 0.08)" }, children: /* @__PURE__ */ jsx2(
4158
+ /* @__PURE__ */ jsx3("div", { style: { height: "2px", background: "rgba(0, 0, 0, 0.08)" }, children: /* @__PURE__ */ jsx3(
4024
4159
  "div",
4025
4160
  {
4026
4161
  className: "syntro-toast-progress",
@@ -4234,7 +4369,7 @@ function useNotifyWatcher(runtime3, tiles, appRegistry2) {
4234
4369
 
4235
4370
  // src/RuntimeProvider.tsx
4236
4371
  import { createContext as createContext2, useContext as useContext2, useEffect as useEffect4, useMemo as useMemo2, useState as useState3 } from "react";
4237
- import { jsx as jsx3 } from "react/jsx-runtime";
4372
+ import { jsx as jsx4 } from "react/jsx-runtime";
4238
4373
  var RuntimeReactContext = createContext2({
4239
4374
  runtime: null,
4240
4375
  context: null
@@ -4252,7 +4387,7 @@ function RuntimeProvider({ runtime: runtime3, children }) {
4252
4387
  return unsubscribe;
4253
4388
  }, [runtime3]);
4254
4389
  const value = useMemo2(() => ({ runtime: runtime3, context }), [runtime3, context]);
4255
- return /* @__PURE__ */ jsx3(RuntimeReactContext.Provider, { value, children });
4390
+ return /* @__PURE__ */ jsx4(RuntimeReactContext.Provider, { value, children });
4256
4391
  }
4257
4392
  function useRuntime() {
4258
4393
  const { runtime: runtime3 } = useContext2(RuntimeReactContext);
@@ -4326,41 +4461,17 @@ import {
4326
4461
  } from "react";
4327
4462
 
4328
4463
  // src/components/TileIcon.tsx
4329
- import {
4330
- Compass,
4331
- FileText,
4332
- Gamepad2,
4333
- HelpCircle,
4334
- Layers,
4335
- MessageCircle,
4336
- Sparkles,
4337
- Trophy
4338
- } from "lucide-react";
4339
- import { jsx as jsx4 } from "react/jsx-runtime";
4340
- var ICON_MAP = {
4341
- "\u2753": HelpCircle,
4342
- "\u{1F9ED}": Compass,
4343
- "\u{1F4DD}": FileText,
4344
- "\u{1F3AF}": Layers,
4345
- "\u{1F3C6}": Trophy,
4346
- "\u2728": Sparkles,
4347
- "\u{1F4AC}": MessageCircle,
4348
- "\u{1F3AE}": Gamepad2
4349
- };
4464
+ import { jsx as jsx5 } from "react/jsx-runtime";
4350
4465
  function TileIcon({
4351
4466
  emoji,
4352
4467
  size = 18,
4353
4468
  color = "currentColor"
4354
4469
  }) {
4355
- const Icon = ICON_MAP[emoji];
4356
- if (!Icon) {
4357
- return /* @__PURE__ */ jsx4("span", { children: emoji });
4358
- }
4359
- return /* @__PURE__ */ jsx4(Icon, { size, color });
4470
+ return /* @__PURE__ */ jsx5(EmojiIcon, { emoji, size, color });
4360
4471
  }
4361
4472
 
4362
4473
  // src/components/TileCard.tsx
4363
- import { jsx as jsx5, jsxs as jsxs2 } from "react/jsx-runtime";
4474
+ import { jsx as jsx6, jsxs as jsxs2 } from "react/jsx-runtime";
4364
4475
  function WidgetMount({ widgetId, props }) {
4365
4476
  var _a2;
4366
4477
  const runtime3 = useRuntime();
@@ -4390,7 +4501,6 @@ function WidgetMount({ widgetId, props }) {
4390
4501
  return () => {
4391
4502
  handle.unmount();
4392
4503
  handleRef.current = null;
4393
- container.remove();
4394
4504
  };
4395
4505
  }, [registry, widgetId, widgetAvailable]);
4396
4506
  const propsJson = JSON.stringify(props);
@@ -4418,7 +4528,7 @@ function WidgetMount({ widgetId, props }) {
4418
4528
  }
4419
4529
  );
4420
4530
  }
4421
- return /* @__PURE__ */ jsx5("div", { ref: parentRef });
4531
+ return /* @__PURE__ */ jsx6("div", { ref: parentRef });
4422
4532
  }
4423
4533
  function TileCard({
4424
4534
  config,
@@ -4491,9 +4601,9 @@ function TileCard({
4491
4601
  onMouseLeave,
4492
4602
  children: [
4493
4603
  /* @__PURE__ */ jsxs2("div", { style: headerStyle, children: [
4494
- /* @__PURE__ */ jsx5("div", { style: iconStyle, children: /* @__PURE__ */ jsx5(TileIcon, { emoji: resolvedIcon, size: resolvedSubtitle ? 36 : 24 }) }),
4604
+ /* @__PURE__ */ jsx6("div", { style: iconStyle, children: /* @__PURE__ */ jsx6(TileIcon, { emoji: resolvedIcon, size: resolvedSubtitle ? 36 : 24 }) }),
4495
4605
  /* @__PURE__ */ jsxs2("div", { style: { flex: 1, minWidth: 0 }, children: [
4496
- /* @__PURE__ */ jsx5(
4606
+ /* @__PURE__ */ jsx6(
4497
4607
  "h3",
4498
4608
  {
4499
4609
  style: {
@@ -4508,7 +4618,7 @@ function TileCard({
4508
4618
  children: title != null ? title : widget
4509
4619
  }
4510
4620
  ),
4511
- resolvedSubtitle && /* @__PURE__ */ jsx5(
4621
+ resolvedSubtitle && /* @__PURE__ */ jsx6(
4512
4622
  "p",
4513
4623
  {
4514
4624
  style: {
@@ -4525,14 +4635,14 @@ function TileCard({
4525
4635
  )
4526
4636
  ] })
4527
4637
  ] }),
4528
- /* @__PURE__ */ jsx5(
4638
+ /* @__PURE__ */ jsx6(
4529
4639
  "div",
4530
4640
  {
4531
4641
  style: {
4532
4642
  padding: "var(--sc-tile-body-padding, 0 0.75rem 0.5rem)",
4533
4643
  borderTop: "1px solid rgba(255, 255, 255, 0.06)"
4534
4644
  },
4535
- children: /* @__PURE__ */ jsx5("div", { style: { paddingTop: "var(--sc-tile-gap, 0.25rem)" }, children: /* @__PURE__ */ jsx5(WidgetMount, { widgetId: widget, props: { ...props, instanceId: config.id } }) })
4645
+ children: /* @__PURE__ */ jsx6("div", { style: { paddingTop: "var(--sc-tile-gap, 0.25rem)" }, children: /* @__PURE__ */ jsx6(WidgetMount, { widgetId: widget, props: { ...props, instanceId: config.id } }) })
4536
4646
  }
4537
4647
  )
4538
4648
  ]
@@ -4940,7 +5050,7 @@ function flattenThemeConfig(config) {
4940
5050
 
4941
5051
  // src/theme/ThemeProvider.tsx
4942
5052
  import { createContext as createContext3, useContext as useContext3, useEffect as useEffect6, useMemo as useMemo4 } from "react";
4943
- import { jsx as jsx6 } from "react/jsx-runtime";
5053
+ import { jsx as jsx7 } from "react/jsx-runtime";
4944
5054
  var ThemeContext = createContext3(null);
4945
5055
  function ThemeProvider({
4946
5056
  children,
@@ -4971,7 +5081,7 @@ ${cssRules}
4971
5081
  mode: merged.mode,
4972
5082
  cssVariables
4973
5083
  };
4974
- return /* @__PURE__ */ jsx6(ThemeContext.Provider, { value, children });
5084
+ return /* @__PURE__ */ jsx7(ThemeContext.Provider, { value, children });
4975
5085
  }
4976
5086
  function useTheme() {
4977
5087
  const context = useContext3(ThemeContext);
@@ -4982,7 +5092,7 @@ function useTheme() {
4982
5092
  }
4983
5093
 
4984
5094
  // src/components/ShadowCanvasOverlay.tsx
4985
- import { Fragment, jsx as jsx7, jsxs as jsxs3 } from "react/jsx-runtime";
5095
+ import { Fragment, jsx as jsx8, jsxs as jsxs3 } from "react/jsx-runtime";
4986
5096
  var LAUNCHER_STYLES_ID = "syntro-launcher-styles";
4987
5097
  function ensureLauncherStyles(target, css) {
4988
5098
  if (target.querySelector(`#${LAUNCHER_STYLES_ID}`)) return;
@@ -5223,7 +5333,7 @@ function ShadowCanvasOverlay({
5223
5333
  pointerEvents: "none",
5224
5334
  padding: "0"
5225
5335
  };
5226
- const content = /* @__PURE__ */ jsx7(
5336
+ const content = /* @__PURE__ */ jsx8(
5227
5337
  "div",
5228
5338
  {
5229
5339
  "data-shadow-canvas-id": "overlay-root",
@@ -5235,7 +5345,7 @@ function ShadowCanvasOverlay({
5235
5345
  },
5236
5346
  children: /* @__PURE__ */ jsxs3("div", { style: wrapperStyle, children: [
5237
5347
  /* @__PURE__ */ jsxs3("div", { ref: containerRef, "data-shadow-canvas-id": "overlay-container", style: containerStyle, children: [
5238
- isFocused && canvasTitle && /* @__PURE__ */ jsx7("header", { style: { color: "white", padding: "1.5rem 1.5rem 0" }, children: /* @__PURE__ */ jsx7(
5348
+ isFocused && canvasTitle && /* @__PURE__ */ jsx8("header", { style: { color: "white", padding: "1.5rem 1.5rem 0" }, children: /* @__PURE__ */ jsx8(
5239
5349
  "p",
5240
5350
  {
5241
5351
  style: {
@@ -5248,7 +5358,7 @@ function ShadowCanvasOverlay({
5248
5358
  children: canvasTitle
5249
5359
  }
5250
5360
  ) }),
5251
- /* @__PURE__ */ jsx7("div", { style: { flex: 1, overflowY: "auto", padding: isFocused ? "0" : "1rem" }, children: isLoading ? /* @__PURE__ */ jsx7(
5361
+ /* @__PURE__ */ jsx8("div", { style: { flex: 1, overflowY: "auto", padding: isFocused ? "0" : "1rem" }, children: isLoading ? /* @__PURE__ */ jsx8(
5252
5362
  "div",
5253
5363
  {
5254
5364
  style: { color: "var(--sc-overlay-text-color)", padding: isFocused ? "1rem" : "0" },
@@ -5268,7 +5378,7 @@ function ShadowCanvasOverlay({
5268
5378
  }
5269
5379
  ) : isFocused ? (
5270
5380
  /* Focused Mode: Render first tile full size */
5271
- tiles.length > 0 ? /* @__PURE__ */ jsx7(
5381
+ tiles.length > 0 ? /* @__PURE__ */ jsx8(
5272
5382
  TileCard,
5273
5383
  {
5274
5384
  config: tiles[0],
@@ -5279,7 +5389,7 @@ function ShadowCanvasOverlay({
5279
5389
  ) : null
5280
5390
  ) : (
5281
5391
  /* Standard Mode: Stacked cards — widgets always visible */
5282
- /* @__PURE__ */ jsx7(
5392
+ /* @__PURE__ */ jsx8(
5283
5393
  "div",
5284
5394
  {
5285
5395
  style: {
@@ -5288,7 +5398,7 @@ function ShadowCanvasOverlay({
5288
5398
  gap: "0.75rem",
5289
5399
  width: "100%"
5290
5400
  },
5291
- children: tiles.map((tile) => /* @__PURE__ */ jsx7(
5401
+ children: tiles.map((tile) => /* @__PURE__ */ jsx8(
5292
5402
  TileCard,
5293
5403
  {
5294
5404
  config: tile,
@@ -5303,7 +5413,7 @@ function ShadowCanvasOverlay({
5303
5413
  ) }),
5304
5414
  footerSlot
5305
5415
  ] }),
5306
- /* @__PURE__ */ jsx7(
5416
+ /* @__PURE__ */ jsx8(
5307
5417
  "div",
5308
5418
  {
5309
5419
  onClick: toggle2,
@@ -5331,7 +5441,7 @@ function ShadowCanvasOverlay({
5331
5441
  zIndex: zIndex + 47
5332
5442
  },
5333
5443
  children: [
5334
- /* @__PURE__ */ jsx7(
5444
+ /* @__PURE__ */ jsx8(
5335
5445
  NotificationToastStack,
5336
5446
  {
5337
5447
  notifications,
@@ -5401,11 +5511,11 @@ function ShadowCanvasOverlay({
5401
5511
  focusable: "false",
5402
5512
  style: { transition: "transform 200ms ease" },
5403
5513
  children: [
5404
- /* @__PURE__ */ jsx7("path", { d: "M18 6L6 18" }),
5405
- /* @__PURE__ */ jsx7("path", { d: "M6 6l12 12" })
5514
+ /* @__PURE__ */ jsx8("path", { d: "M18 6L6 18" }),
5515
+ /* @__PURE__ */ jsx8("path", { d: "M6 6l12 12" })
5406
5516
  ]
5407
5517
  }
5408
- ) : launcherIcon ? /* @__PURE__ */ jsx7(
5518
+ ) : launcherIcon ? /* @__PURE__ */ jsx8(
5409
5519
  "img",
5410
5520
  {
5411
5521
  src: launcherIcon,
@@ -5433,16 +5543,16 @@ function ShadowCanvasOverlay({
5433
5543
  focusable: "false",
5434
5544
  style: { transition: "transform 200ms ease" },
5435
5545
  children: [
5436
- /* @__PURE__ */ jsx7("path", { d: "M12 3l1.912 5.813a2 2 0 0 0 1.275 1.275L21 12l-5.813 1.912a2 2 0 0 0-1.275 1.275L12 21l-1.912-5.813a2 2 0 0 0-1.275-1.275L3 12l5.813-1.912a2 2 0 0 0 1.275-1.275L12 3Z" }),
5437
- /* @__PURE__ */ jsx7("path", { d: "M5 3v4" }),
5438
- /* @__PURE__ */ jsx7("path", { d: "M3 5h4" }),
5439
- /* @__PURE__ */ jsx7("path", { d: "M19 17v4" }),
5440
- /* @__PURE__ */ jsx7("path", { d: "M17 19h4" })
5546
+ /* @__PURE__ */ jsx8("path", { d: "M12 3l1.912 5.813a2 2 0 0 0 1.275 1.275L21 12l-5.813 1.912a2 2 0 0 0-1.275 1.275L12 21l-1.912-5.813a2 2 0 0 0-1.275-1.275L3 12l5.813-1.912a2 2 0 0 0 1.275-1.275L12 3Z" }),
5547
+ /* @__PURE__ */ jsx8("path", { d: "M5 3v4" }),
5548
+ /* @__PURE__ */ jsx8("path", { d: "M3 5h4" }),
5549
+ /* @__PURE__ */ jsx8("path", { d: "M19 17v4" }),
5550
+ /* @__PURE__ */ jsx8("path", { d: "M17 19h4" })
5441
5551
  ]
5442
5552
  }
5443
5553
  ),
5444
5554
  !isOpen && notifications.length > 0 && /* @__PURE__ */ jsxs3("div", { style: { position: "absolute", top: -2, right: -2, pointerEvents: "none" }, children: [
5445
- /* @__PURE__ */ jsx7(
5555
+ /* @__PURE__ */ jsx8(
5446
5556
  "span",
5447
5557
  {
5448
5558
  className: "syntro-badge-ping",
@@ -5454,7 +5564,7 @@ function ShadowCanvasOverlay({
5454
5564
  }
5455
5565
  }
5456
5566
  ),
5457
- /* @__PURE__ */ jsx7(
5567
+ /* @__PURE__ */ jsx8(
5458
5568
  "span",
5459
5569
  {
5460
5570
  className: "syntro-badge-glow",
@@ -5465,7 +5575,7 @@ function ShadowCanvasOverlay({
5465
5575
  }
5466
5576
  }
5467
5577
  ),
5468
- /* @__PURE__ */ jsx7(
5578
+ /* @__PURE__ */ jsx8(
5469
5579
  "span",
5470
5580
  {
5471
5581
  className: "syntro-badge-bounce",
@@ -5600,7 +5710,7 @@ function useShadowCanvasConfig({
5600
5710
 
5601
5711
  // src/SmartCanvasApp.tsx
5602
5712
  import { useEffect as useEffect9, useMemo as useMemo7, useRef as useRef7, useState as useState7 } from "react";
5603
- import { jsx as jsx8 } from "react/jsx-runtime";
5713
+ import { jsx as jsx9 } from "react/jsx-runtime";
5604
5714
  function SmartCanvasApp({
5605
5715
  controller,
5606
5716
  fetcher,
@@ -5623,7 +5733,7 @@ function SmartCanvasApp({
5623
5733
  workspaceTheme
5624
5734
  }) {
5625
5735
  if (runtime3) {
5626
- return /* @__PURE__ */ jsx8(RuntimeProvider, { runtime: runtime3, children: /* @__PURE__ */ jsx8(
5736
+ return /* @__PURE__ */ jsx9(RuntimeProvider, { runtime: runtime3, children: /* @__PURE__ */ jsx9(
5627
5737
  SmartCanvasAppInner,
5628
5738
  {
5629
5739
  controller,
@@ -5648,7 +5758,7 @@ function SmartCanvasApp({
5648
5758
  }
5649
5759
  ) });
5650
5760
  }
5651
- return /* @__PURE__ */ jsx8(
5761
+ return /* @__PURE__ */ jsx9(
5652
5762
  SmartCanvasAppInner,
5653
5763
  {
5654
5764
  controller,
@@ -5803,16 +5913,13 @@ function SmartCanvasAppInner({
5803
5913
  }, [runtime3, controller]);
5804
5914
  const { shadowRoot } = useShadowRoot();
5805
5915
  const themeConfig = configState.theme;
5806
- if (!configState.isLoading && !hasContent) {
5807
- return null;
5808
- }
5809
- return /* @__PURE__ */ jsx8(
5916
+ return /* @__PURE__ */ jsx9(
5810
5917
  ThemeProvider,
5811
5918
  {
5812
5919
  themeConfig,
5813
5920
  workspaceTheme,
5814
5921
  shadowRoot,
5815
- children: /* @__PURE__ */ jsx8(
5922
+ children: !configState.isLoading && !hasContent ? null : /* @__PURE__ */ jsx9(
5816
5923
  ShadowCanvasOverlay,
5817
5924
  {
5818
5925
  tiles: configState.tiles,
@@ -5837,7 +5944,7 @@ function SmartCanvasAppInner({
5837
5944
 
5838
5945
  // src/SmartCanvasElement.tsx
5839
5946
  import { createRoot as createRoot2 } from "react-dom/client";
5840
- import { jsx as jsx9 } from "react/jsx-runtime";
5947
+ import { jsx as jsx10 } from "react/jsx-runtime";
5841
5948
  var TAG_NAME = "smart-canvas";
5842
5949
  var BASE_CSS = `
5843
5950
  :host {
@@ -5938,13 +6045,13 @@ var SmartCanvasElement = class extends HTMLElement {
5938
6045
  __privateSet(this, _root, createRoot2(__privateGet(this, _mount)));
5939
6046
  }
5940
6047
  __privateGet(this, _root).render(
5941
- /* @__PURE__ */ jsx9(
6048
+ /* @__PURE__ */ jsx10(
5942
6049
  ShadowRootProvider,
5943
6050
  {
5944
6051
  shadowRoot: __privateGet(this, _shadow),
5945
6052
  portalRoot: __privateGet(this, _portalRoot),
5946
6053
  overlayContainer: __privateGet(this, _overlayContainer),
5947
- children: /* @__PURE__ */ jsx9(SmartCanvasApp, { ...__privateGet(this, _lastAppProps), controller: __privateGet(this, _controller), canvasHost: this })
6054
+ children: /* @__PURE__ */ jsx10(SmartCanvasApp, { ...__privateGet(this, _lastAppProps), controller: __privateGet(this, _controller), canvasHost: this })
5948
6055
  }
5949
6056
  )
5950
6057
  );
@@ -6513,7 +6620,7 @@ var createSmartCanvas = async (config = {}) => {
6513
6620
  console.log(
6514
6621
  "[SmartCanvas] Actions to apply:",
6515
6622
  canvasConfig.actions.map(
6516
- (a, i) => `[${i}] ${a.kind}${a.anchorId ? ` anchor="${typeof a.anchorId === "string" ? a.anchorId : a.anchorId.selector}"` : ""}${a.label ? ` "${a.label}"` : ""}`
6623
+ (a, i) => `[${i}] ${a.kind}${a.anchorId ? ` anchor="${a.anchorId.selector}"` : ""}${a.label ? ` "${a.label}"` : ""}`
6517
6624
  ).join(", ")
6518
6625
  );
6519
6626
  }
@@ -8241,13 +8348,9 @@ function createActionEngine(options) {
8241
8348
  entry2.state = "reverted";
8242
8349
  publishEvent("action.reverted", { id, kind: action.kind });
8243
8350
  } catch (error2) {
8244
- entry2.state = "failed";
8245
- publishEvent("action.failed", {
8246
- id,
8247
- kind: action.kind,
8248
- error: String(error2)
8249
- });
8250
- throw error2;
8351
+ console.warn(`[ActionEngine] Cleanup error for ${action.kind} (${id}), ignoring:`, error2);
8352
+ entry2.state = "reverted";
8353
+ publishEvent("action.reverted", { id, kind: action.kind });
8251
8354
  } finally {
8252
8355
  activeActions.delete(id);
8253
8356
  }
@@ -8291,7 +8394,7 @@ function createActionEngine(options) {
8291
8394
  errorMessages,
8292
8395
  "\nActions:",
8293
8396
  actions.map(
8294
- (a, i) => ` [${i}] ${a.kind} ${a.anchorId ? `anchor="${typeof a.anchorId === "string" ? a.anchorId : a.anchorId.selector}"` : ""} ${a.label ? `label="${a.label}"` : ""}`
8397
+ (a, i) => ` [${i}] ${a.kind} ${a.anchorId ? `anchor="${a.anchorId.selector}"` : ""} ${a.label ? `label="${a.label}"` : ""}`
8295
8398
  ).join("\n")
8296
8399
  );
8297
8400
  throw new Error(`Batch validation failed: ${errorMessages}`);
@@ -8391,6 +8494,7 @@ function createAnchorResolver(opts) {
8391
8494
  function resolve(selector) {
8392
8495
  if (!root) return null;
8393
8496
  try {
8497
+ if (root.matches(selector)) return root;
8394
8498
  return root.querySelector(selector);
8395
8499
  } catch {
8396
8500
  return null;
@@ -8736,7 +8840,7 @@ function createContextManager(options) {
8736
8840
 
8737
8841
  // src/decisions/strategies/rules.ts
8738
8842
  function evaluateCondition(condition, evalContext) {
8739
- var _a2, _b, _c, _d, _e, _f, _g;
8843
+ var _a2, _b, _c, _d, _e;
8740
8844
  const { context, state, events } = evalContext;
8741
8845
  switch (condition.type) {
8742
8846
  case "page_url": {
@@ -8750,8 +8854,7 @@ function evaluateCondition(condition, evalContext) {
8750
8854
  return context.page.routeId === condition.routeId;
8751
8855
  }
8752
8856
  case "anchor_visible": {
8753
- const condSelector = typeof condition.anchorId === "string" ? condition.anchorId : (_b = (_a2 = condition.anchorId) == null ? void 0 : _a2.selector) != null ? _b : "";
8754
- const anchor = (_c = context.anchors) == null ? void 0 : _c.find((a) => a.anchorId === condSelector);
8857
+ const anchor = (_a2 = context.anchors) == null ? void 0 : _a2.find((a) => a.anchorId === condition.anchorId);
8755
8858
  switch (condition.state) {
8756
8859
  case "visible":
8757
8860
  return (anchor == null ? void 0 : anchor.visible) === true;
@@ -8765,7 +8868,7 @@ function evaluateCondition(condition, evalContext) {
8765
8868
  }
8766
8869
  case "event_occurred": {
8767
8870
  if (!events) return false;
8768
- const withinMs = (_d = condition.withinMs) != null ? _d : 6e4;
8871
+ const withinMs = (_b = condition.withinMs) != null ? _b : 6e4;
8769
8872
  return events.hasRecentEvent(condition.eventName, withinMs);
8770
8873
  }
8771
8874
  case "state_equals": {
@@ -8801,17 +8904,17 @@ function evaluateCondition(condition, evalContext) {
8801
8904
  }
8802
8905
  }
8803
8906
  case "dismissed": {
8804
- if (!state) return (_e = condition.inverted) != null ? _e : false;
8907
+ if (!state) return (_c = condition.inverted) != null ? _c : false;
8805
8908
  const isDismissed = state.isDismissed(condition.key);
8806
8909
  return condition.inverted ? !isDismissed : isDismissed;
8807
8910
  }
8808
8911
  case "cooldown_active": {
8809
- if (!state) return (_f = condition.inverted) != null ? _f : false;
8912
+ if (!state) return (_d = condition.inverted) != null ? _d : false;
8810
8913
  const isActive = state.isCooldownActive(condition.key);
8811
8914
  return condition.inverted ? !isActive : isActive;
8812
8915
  }
8813
8916
  case "frequency_limit": {
8814
- if (!state) return (_g = condition.inverted) != null ? _g : false;
8917
+ if (!state) return (_e = condition.inverted) != null ? _e : false;
8815
8918
  const count = state.getFrequencyCount(condition.key);
8816
8919
  const limitReached = count >= condition.limit;
8817
8920
  return condition.inverted ? !limitReached : limitReached;
@@ -9246,16 +9349,24 @@ function getEventName(phEvent) {
9246
9349
  }
9247
9350
  return eventName.replace("$", "posthog.");
9248
9351
  }
9352
+ var INTERACTIVE_TAGS = /* @__PURE__ */ new Set(["a", "button", "input", "select", "textarea"]);
9353
+ function resolveInteractiveTag(elements, directTag) {
9354
+ if (directTag && INTERACTIVE_TAGS.has(directTag)) return directTag;
9355
+ if (!elements) return directTag;
9356
+ for (const el of elements) {
9357
+ const tag2 = el.tag_name;
9358
+ if (tag2 && INTERACTIVE_TAGS.has(tag2)) return tag2;
9359
+ }
9360
+ return directTag;
9361
+ }
9249
9362
  function extractProps(phEvent) {
9250
- var _a2;
9363
+ var _a2, _b;
9251
9364
  const props = {};
9252
9365
  const phProps = phEvent.properties || {};
9253
9366
  const elements = phProps.$elements;
9254
- if (phProps.$tag_name) {
9255
- props.tagName = phProps.$tag_name;
9256
- } else if ((_a2 = elements == null ? void 0 : elements[0]) == null ? void 0 : _a2.tag_name) {
9257
- props.tagName = elements[0].tag_name;
9258
- }
9367
+ const directTag = (_b = phProps.$tag_name) != null ? _b : (_a2 = elements == null ? void 0 : elements[0]) == null ? void 0 : _a2.tag_name;
9368
+ const isClickEvent = phEvent.event === "$autocapture" || phEvent.event === "$click";
9369
+ props.tagName = isClickEvent ? resolveInteractiveTag(elements, directTag) : directTag;
9259
9370
  if (phProps.$el_text) props.elementText = phProps.$el_text;
9260
9371
  if (elements) props.elements = elements;
9261
9372
  if (phProps.$current_url) props.url = phProps.$current_url;
@@ -10124,9 +10235,18 @@ function createSurfaces(options) {
10124
10235
  }
10125
10236
  async function unmountEntry(entry) {
10126
10237
  var _a2;
10127
- await playExitAnimation(entry.container, entry.options.animation);
10128
- (_a2 = entry.cleanup) == null ? void 0 : _a2.call(entry);
10129
- entry.container.remove();
10238
+ if (entry.container.isConnected) {
10239
+ await playExitAnimation(entry.container, entry.options.animation);
10240
+ }
10241
+ try {
10242
+ (_a2 = entry.cleanup) == null ? void 0 : _a2.call(entry);
10243
+ } catch (error2) {
10244
+ console.warn("[Surfaces] Cleanup error during unmount, ignoring:", error2);
10245
+ }
10246
+ try {
10247
+ entry.container.remove();
10248
+ } catch {
10249
+ }
10130
10250
  mounts.delete(entry.slot);
10131
10251
  publishEvent("surface.unmounted", {
10132
10252
  slot: entry.slot,
@@ -10309,7 +10429,9 @@ var WidgetRegistry = class {
10309
10429
  var _a2;
10310
10430
  const mounted = this.mountedWidgets.get(mountId);
10311
10431
  if (mounted) {
10312
- (_a2 = mounted.cleanup) == null ? void 0 : _a2.call(mounted);
10432
+ if (container.isConnected) {
10433
+ (_a2 = mounted.cleanup) == null ? void 0 : _a2.call(mounted);
10434
+ }
10313
10435
  this.mountedWidgets.delete(mountId);
10314
10436
  container.removeAttribute("data-widget-mount-id");
10315
10437
  container.removeAttribute("data-widget-id");
@@ -11159,7 +11281,7 @@ async function init(options) {
11159
11281
  console.log(
11160
11282
  "[Syntro Bootstrap] Actions in config:",
11161
11283
  config.actions.map(
11162
- (a, i) => `[${i}] ${a.kind}${a.anchorId ? ` anchor="${typeof a.anchorId === "string" ? a.anchorId : a.anchorId.selector}"` : ""}${a.label ? ` "${a.label}"` : ""}`
11284
+ (a, i) => `[${i}] ${a.kind}${a.anchorId ? ` anchor="${a.anchorId.selector}"` : ""}${a.label ? ` "${a.label}"` : ""}`
11163
11285
  ).join(", ")
11164
11286
  );
11165
11287
  }
@@ -11330,4 +11452,4 @@ export {
11330
11452
  encodeToken,
11331
11453
  Syntro
11332
11454
  };
11333
- //# sourceMappingURL=chunk-OB5AKUQT.js.map
11455
+ //# sourceMappingURL=chunk-4J6BCKWS.js.map