import {
  ANIMATION_KEYFRAMES,
  AppRegistry,
  CanvasEvents,
  ContextManager,
  DEFAULT_COOLDOWN,
  DEFAULT_TTL,
  EVENT_SCHEMA_VERSION,
  EventBus,
  ExecutorRegistry,
  MAX_VISIBLE_TOASTS,
  NavigationMonitor,
  NotificationToastStack,
  RUNTIME_VERSION,
  RuntimeProvider,
  SDK_SCHEMA_VERSION,
  SDK_VERSION,
  STATIC_SLOT_STYLES,
  SessionMetricTracker,
  ShadowCanvasOverlay,
  ShadowRootProvider,
  SmartCanvasApp,
  SmartCanvasController,
  SmartCanvasElement,
  StandardEvents,
  StateStore,
  Syntro,
  TileCard,
  WidgetRegistry,
  appRegistry,
  applyStaticSlotStyles,
  base,
  border,
  brand,
  cleanupAppContext,
  createActionEngine,
  createAppContext,
  createAppLoader,
  createCanvasConfigFetcher,
  createContextManager,
  createDecisionEngine,
  createEventAccumulator,
  createEventBus,
  createGrowthBookClient,
  createNoopClient,
  createPostHogClient,
  createPostHogNormalizer,
  createSessionMetricTracker,
  createSmartCanvas,
  createSmartCanvasController,
  createSmartCanvasRuntime,
  createStateStore,
  createSurfaceContainer,
  createSurfaces,
  decodeToken,
  encodeToken,
  evaluate,
  evaluateCondition,
  evaluateRule,
  evaluateRuleStrategy,
  evaluateScoreStrategy,
  evaluateSync,
  executorRegistry,
  getAntiFlickerSnippet,
  getAppIdFromActionKind,
  getAppIdFromWidgetId,
  getExecutor,
  getSlotAnchorId,
  getSlotType,
  getSlotZIndex,
  hasExecutor,
  interpolateTemplate,
  isCoreActionKind,
  matchEvent,
  normalizePostHogEvent,
  playEnterAnimation,
  playExitAnimation,
  purple,
  red,
  registerConfigPredicates,
  registerSmartCanvasElement,
  resolveConfigUri,
  runtime,
  runtime2,
  setupAdjacentPositioning,
  setupInlinePositioning,
  shouldNormalizeEvent,
  slateGrey,
  useDecision,
  useNotifications,
  useNotifyWatcher,
  usePageContext,
  useRuntime,
  useRuntimeContext,
  useRuntimeEvents,
  useRuntimeState,
  useSessionContext,
  useShadowCanvasConfig,
  useShadowRoot,
  useViewportContext,
  validateAction,
  validateActions,
  widgetRegistry
} from "./chunk-RUKIPJEJ.js";
import {
  AddClassZ,
  BadgePositionZ,
  BadgeZ,
  CtaButtonZ,
  HighlightStyleZ,
  HighlightZ,
  InsertHtmlZ,
  InsertPositionZ,
  ModalContentZ,
  ModalZ,
  MountWidgetZ,
  NavigateZ,
  ParallelZ,
  PlacementZ,
  PulseZ,
  RemoveClassZ,
  ScrollBehaviorZ,
  ScrollLogicalPositionZ,
  ScrollToZ,
  SequenceZ,
  SetAttrZ,
  SetStyleZ,
  SetTextZ,
  TooltipContentZ,
  TooltipTriggerZ,
  TooltipZ,
  TourStepForSchemaZ,
  TourZ,
  WaitZ,
  WidgetConfigZ,
  coreActionStepSchemas
} from "./chunk-AYTRRBR5.js";

// src/index.ts
import React4 from "react";
import { createPortal as createPortal2, flushSync } from "react-dom";
import * as ReactDOMClient from "react-dom/client";

// ../adaptives/adaptive-chatbot/dist/ChatAssistant.js
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import React, { useEffect, useRef as useRef2 } from "react";
import { createRoot } from "react-dom/client";

// ../adaptives/adaptive-chatbot/dist/useChat.js
import { useCallback, useRef, useState } from "react";

// ../adaptives/adaptive-chatbot/dist/actionParser.js
var JSON_FENCE_RE = /```json\s*\n([\s\S]*?)```/g;
function parseActions(input) {
  const actions = [];
  let displayText = input;
  const matches = [];
  let match;
  JSON_FENCE_RE.lastIndex = 0;
  while ((match = JSON_FENCE_RE.exec(input)) !== null) {
    matches.push({
      fullMatch: match[0],
      json: match[1],
      index: match.index
    });
  }
  for (let i = matches.length - 1; i >= 0; i--) {
    const { fullMatch, json } = matches[i];
    let parsed;
    try {
      parsed = JSON.parse(json);
    } catch {
      continue;
    }
    if (typeof parsed === "object" && parsed !== null && "kind" in parsed && typeof parsed.kind === "string") {
      actions.unshift(parsed);
      displayText = displayText.replace(fullMatch, "");
    }
  }
  displayText = displayText.replace(/\n{3,}/g, "\n\n").trim();
  return { displayText, actions };
}

// ../adaptives/adaptive-chatbot/dist/apiClient.js
var AuthError = class extends Error {
  constructor(message) {
    super(message);
    this.name = "AuthError";
  }
};
function getAuthHeaders() {
  const cookieMatch = document.cookie.match(/stytch_session_jwt=([^;]*)/);
  if (!cookieMatch || !cookieMatch[1]) {
    throw new AuthError("No authentication token found");
  }
  const workspaceId = localStorage.getItem("syntrologie_workspace_id");
  if (!workspaceId) {
    throw new AuthError("No workspace ID found");
  }
  return {
    Authorization: `Bearer ${cookieMatch[1]}`,
    "X-Workspace-Id": workspaceId
  };
}
async function sendMessage(url, request) {
  const authHeaders = getAuthHeaders();
  const response = await fetch(url, {
    method: "POST",
    headers: {
      "Content-Type": "application/json",
      ...authHeaders
    },
    body: JSON.stringify(request)
  });
  if (!response.ok) {
    if (response.status === 401) {
      throw new AuthError("Session expired or unauthorized");
    }
    throw new Error(`Chat request failed: ${response.status} ${response.statusText}`);
  }
  return response.json();
}

// ../adaptives/adaptive-chatbot/dist/useChat.js
var nextId = 0;
function generateId() {
  return `msg-${Date.now()}-${++nextId}`;
}
function useChat(options) {
  const { backendUrl, tileId, runtime: runtime7, greeting, maxHistory = 20, mlflowRunId, config } = options;
  const [messages, setMessages] = useState(() => {
    if (greeting) {
      return [
        {
          id: generateId(),
          role: "assistant",
          text: greeting,
          timestamp: Date.now()
        }
      ];
    }
    return [];
  });
  const [isLoading, setIsLoading] = useState(false);
  const [error, setError] = useState(null);
  const batchHandleRef = useRef(null);
  const send = useCallback(async (text) => {
    var _a;
    const trimmed = text.trim();
    if (!trimmed)
      return;
    setError(null);
    const userMessage = {
      id: generateId(),
      role: "user",
      text: trimmed,
      timestamp: Date.now()
    };
    setMessages((prev) => [...prev, userMessage]);
    setIsLoading(true);
    try {
      const currentMessages = [...messages, userMessage];
      const historySlice = currentMessages.slice(-maxHistory).map((m) => ({
        role: m.role,
        content: m.text
      }));
      const response = await sendMessage(backendUrl, {
        message: trimmed,
        history: historySlice,
        mlflow_run_id: mlflowRunId,
        current_config: config
      });
      const { displayText, actions } = parseActions(response.response);
      const assistantMessage = {
        id: generateId(),
        role: "assistant",
        text: displayText,
        timestamp: Date.now()
      };
      setMessages((prev) => [...prev, assistantMessage]);
      if (actions.length > 0) {
        if ((_a = batchHandleRef.current) == null ? void 0 : _a.isApplied()) {
          await batchHandleRef.current.revertAll();
        }
        batchHandleRef.current = await runtime7.actions.applyBatch(actions);
        runtime7.events.publish("chatbot.actions_applied", {
          count: actions.length,
          kinds: actions.map((a) => a.kind),
          tileId
        });
      }
    } catch (err) {
      const message = err instanceof Error ? err.message : "An unexpected error occurred";
      setError(message);
    } finally {
      setIsLoading(false);
    }
  }, [backendUrl, messages, maxHistory, mlflowRunId, config, runtime7, tileId]);
  const clearMessages = useCallback(() => {
    var _a;
    setMessages([]);
    setError(null);
    if ((_a = batchHandleRef.current) == null ? void 0 : _a.isApplied()) {
      batchHandleRef.current.revertAll();
      batchHandleRef.current = null;
    }
    sessionStorage.removeItem(`syntro:chatbot:history:${tileId}`);
  }, [tileId]);
  return {
    messages,
    isLoading,
    error,
    sendMessage: send,
    clearMessages
  };
}

// ../adaptives/adaptive-chatbot/dist/ChatAssistant.js
var styles = {
  container: {
    display: "flex",
    flexDirection: "column",
    height: "100%",
    fontFamily: "system-ui, -apple-system, sans-serif",
    fontSize: "14px",
    touchAction: "none"
  },
  messageList: {
    flex: 1,
    overflowY: "auto",
    padding: "12px",
    display: "flex",
    flexDirection: "column",
    gap: "8px"
  },
  messageBubble: {
    maxWidth: "85%",
    padding: "8px 12px",
    borderRadius: "12px",
    lineHeight: 1.5,
    wordBreak: "break-word"
  },
  userMessage: {
    alignSelf: "flex-end",
    backgroundColor: purple[4],
    color: base.white,
    borderBottomRightRadius: "4px"
  },
  assistantMessage: {
    alignSelf: "flex-start",
    backgroundColor: "rgba(255, 255, 255, 0.08)",
    color: slateGrey[10],
    borderBottomLeftRadius: "4px"
  },
  loadingDots: {
    alignSelf: "flex-start",
    padding: "8px 16px",
    backgroundColor: "rgba(255, 255, 255, 0.05)",
    borderRadius: "12px",
    color: slateGrey[8],
    fontSize: "13px"
  },
  errorBanner: {
    padding: "8px 12px",
    backgroundColor: "rgba(239, 68, 68, 0.1)",
    color: red[4],
    fontSize: "13px",
    borderRadius: "8px",
    margin: "0 12px"
  },
  inputForm: {
    display: "flex",
    gap: "8px",
    padding: "12px",
    borderTop: "1px solid rgba(255, 255, 255, 0.06)"
  },
  input: {
    flex: 1,
    padding: "8px 12px",
    borderRadius: "8px",
    border: "1px solid rgba(255, 255, 255, 0.1)",
    backgroundColor: "rgba(0, 0, 0, 0.2)",
    color: slateGrey[12],
    fontSize: "14px",
    outline: "none",
    fontFamily: "inherit"
  },
  sendButton: {
    padding: "8px 16px",
    borderRadius: "8px",
    border: "none",
    backgroundColor: purple[4],
    color: base.white,
    fontWeight: 600,
    fontSize: "13px",
    cursor: "pointer",
    whiteSpace: "nowrap"
  },
  sendButtonDisabled: {
    opacity: 0.5,
    cursor: "not-allowed"
  }
};
function MessageBubble({ message }) {
  const isUser = message.role === "user";
  const bubbleStyle = {
    ...styles.messageBubble,
    ...isUser ? styles.userMessage : styles.assistantMessage
  };
  return _jsx("div", { style: bubbleStyle, children: message.text });
}
function ChatAssistant({ config, runtime: runtime7, tileId }) {
  const { messages, isLoading, error, sendMessage: sendMessage2, clearMessages: _clearMessages } = useChat({
    backendUrl: config.backendUrl,
    tileId,
    runtime: runtime7,
    greeting: config.greeting,
    maxHistory: config.maxHistory,
    mlflowRunId: config.mlflowRunId
  });
  const messageListRef = useRef2(null);
  const inputRef = useRef2(null);
  useEffect(() => {
    if (messageListRef.current) {
      messageListRef.current.scrollTop = messageListRef.current.scrollHeight;
    }
  }, []);
  const handleSubmit = (e) => {
    e.preventDefault();
    const input = inputRef.current;
    if (!input || !input.value.trim() || isLoading)
      return;
    const text = input.value;
    input.value = "";
    sendMessage2(text);
  };
  return _jsxs("div", { style: styles.container, "data-testid": "chat-assistant", children: [_jsxs("div", { ref: messageListRef, style: styles.messageList, children: [messages.map((msg) => _jsx(MessageBubble, { message: msg }, msg.id)), isLoading && _jsx("div", { style: styles.loadingDots, children: "Thinking..." })] }), error && _jsx("div", { style: styles.errorBanner, children: error }), _jsxs("form", { onSubmit: handleSubmit, style: styles.inputForm, children: [_jsx("input", { ref: inputRef, style: styles.input, placeholder: "Ask anything...", disabled: isLoading, "data-testid": "chat-input" }), _jsx("button", { type: "submit", disabled: isLoading, style: {
    ...styles.sendButton,
    ...isLoading ? styles.sendButtonDisabled : {}
  }, "data-testid": "chat-send", children: "Send" })] })] });
}
var ChatAssistantMountableWidget = {
  mount(container, mountConfig) {
    const { config, runtime: runtime7, tileId = "chatbot-widget" } = mountConfig || {};
    if (config && runtime7 && typeof createRoot === "function") {
      const root = createRoot(container);
      root.render(React.createElement(ChatAssistant, {
        config,
        runtime: runtime7,
        tileId
      }));
      return () => {
        root.unmount();
      };
    }
    if (!config || !runtime7) {
      container.innerHTML = `<div style="padding: 16px; color: ${slateGrey[8]};">Chat widget requires config and runtime.</div>`;
      return () => {
        container.innerHTML = "";
      };
    }
    container.innerHTML = `
      <div style="padding: 16px; font-family: system-ui; color: ${slateGrey[10]};">
        <p style="margin: 0 0 8px; color: ${slateGrey[8]};">${config.greeting || "Hi! How can I help?"}</p>
        <p style="margin: 0; font-size: 12px; color: ${slateGrey[7]};">Chat widget mounted. Awaiting React renderer.</p>
      </div>
    `;
    return () => {
      container.innerHTML = "";
    };
  }
};

// ../adaptives/adaptive-chatbot/dist/runtime.js
var runtime3 = {
  id: "adaptive-chatbot",
  version: "1.0.0",
  name: "Chat Assistant",
  description: "AI chat assistant with action execution capabilities",
  /** No action executors — chatbot uses existing action kinds via applyBatch */
  executors: [],
  /** Widget definitions for the runtime's WidgetRegistry */
  widgets: [
    {
      id: "adaptive-chatbot:assistant",
      component: ChatAssistantMountableWidget,
      metadata: {
        name: "Chat Assistant",
        description: "AI-powered chat assistant that can execute DOM actions",
        icon: "\u{1F4AC}"
      }
    }
  ]
};

// ../adaptives/adaptive-faq/dist/executors.js
function resolveItem(store, itemId, itemQuestion) {
  if (itemId) {
    const found = store.getState().items.find((i) => i.config.id === itemId);
    if (found)
      return found;
  }
  if (itemQuestion) {
    const found = store.findByQuestion(itemQuestion);
    if (found)
      return found;
  }
  throw new Error("FAQ item not found");
}
async function executeScrollToFaq(action, context, store) {
  var _a;
  const item = resolveItem(store, action.itemId, action.itemQuestion);
  const { id } = item.config;
  if (action.expand !== false) {
    store.expand(id);
  }
  const el = document.querySelector(`[data-faq-item-id="${id}"]`);
  if (el) {
    el.scrollIntoView({
      behavior: (_a = action.behavior) != null ? _a : "smooth"
    });
  }
  context.publishEvent("faq:scroll_to", { itemId: id });
  return {
    cleanup: () => {
    }
  };
}
async function executeToggleFaqItem(action, context, store) {
  var _a;
  const item = resolveItem(store, action.itemId, action.itemQuestion);
  const { id } = item.config;
  const desiredState = (_a = action.state) != null ? _a : "toggle";
  let newState;
  switch (desiredState) {
    case "open":
      store.expand(id);
      newState = "open";
      break;
    case "closed":
      store.collapse(id);
      newState = "closed";
      break;
    default: {
      const wasExpanded = store.getState().expandedItems.has(id);
      store.toggle(id);
      newState = wasExpanded ? "closed" : "open";
      break;
    }
  }
  context.publishEvent("faq:toggle", { itemId: id, newState });
  return {
    cleanup: () => {
    }
  };
}
async function executeUpdateFaq(action, context, store) {
  var _a, _b, _c;
  switch (action.operation) {
    case "add": {
      const items = (_a = action.items) != null ? _a : [];
      const position = action.position === "prepend" ? "prepend" : "append";
      store.addItems(items, position);
      break;
    }
    case "remove": {
      if (!action.itemId) {
        throw new Error("FAQ item not found");
      }
      const exists = store.getState().items.some((i) => i.config.id === action.itemId);
      if (!exists) {
        throw new Error("FAQ item not found");
      }
      store.removeItem(action.itemId);
      break;
    }
    case "reorder": {
      const order = (_b = action.order) != null ? _b : [];
      store.reorderItems(order);
      break;
    }
    case "replace": {
      const items = (_c = action.items) != null ? _c : [];
      store.replaceItems(items);
      break;
    }
  }
  context.publishEvent("faq:update", { operation: action.operation });
  return {
    cleanup: () => {
    }
  };
}
var executorDefinitions = [
  { kind: "faq:scroll_to", executor: executeScrollToFaq },
  { kind: "faq:toggle_item", executor: executeToggleFaqItem },
  { kind: "faq:update", executor: executeUpdateFaq }
];

// ../adaptives/adaptive-faq/dist/FAQWidget.js
import { jsx as _jsx2, jsxs as _jsxs2 } from "react/jsx-runtime";
import React2, { useCallback as useCallback2, useEffect as useEffect2, useMemo, useReducer, useState as useState2 } from "react";
import { createRoot as createRoot2 } from "react-dom/client";
function getAnswerText(answer) {
  if (typeof answer === "string")
    return answer;
  if (answer.type === "rich")
    return answer.html;
  return answer.content;
}
function renderAnswer(answer) {
  if (typeof answer === "string") {
    return _jsx2("p", { style: { margin: 0 }, children: answer });
  }
  if (answer.type === "rich") {
    return _jsx2("div", { style: { margin: 0 }, dangerouslySetInnerHTML: { __html: answer.html } });
  }
  return _jsx2("p", { style: { margin: 0 }, children: answer.content });
}
function resolveFeedbackConfig(feedback) {
  if (!feedback)
    return null;
  if (feedback === true) {
    return { style: "thumbs" };
  }
  return feedback;
}
function getFeedbackPrompt(feedbackConfig) {
  return feedbackConfig.prompt || "Was this helpful?";
}
var baseStyles = {
  container: {
    fontFamily: "system-ui, -apple-system, sans-serif",
    maxWidth: "800px",
    margin: "0 auto"
  },
  searchWrapper: {
    marginBottom: "16px"
  },
  searchInput: {
    width: "100%",
    padding: "12px 16px",
    borderRadius: "8px",
    fontSize: "14px",
    outline: "none",
    transition: "border-color 0.15s ease"
  },
  accordion: {
    display: "flex",
    flexDirection: "column",
    gap: "8px"
  },
  item: {
    borderRadius: "8px",
    overflow: "hidden",
    transition: "box-shadow 0.15s ease"
  },
  question: {
    width: "100%",
    padding: "16px 20px",
    display: "flex",
    alignItems: "center",
    justifyContent: "space-between",
    border: "none",
    cursor: "pointer",
    fontSize: "15px",
    fontWeight: 500,
    textAlign: "left",
    transition: "background-color 0.15s ease"
  },
  chevron: {
    fontSize: "18px",
    transition: "transform 0.2s ease"
  },
  answer: {
    padding: "0 20px 16px 20px",
    fontSize: "14px",
    lineHeight: 1.6,
    overflow: "hidden",
    transition: "max-height 0.2s ease, padding 0.2s ease"
  },
  category: {
    display: "inline-block",
    fontSize: "11px",
    fontWeight: 600,
    textTransform: "uppercase",
    letterSpacing: "0.05em",
    padding: "4px 8px",
    borderRadius: "4px",
    marginBottom: "8px"
  },
  categoryHeader: {
    fontSize: "13px",
    fontWeight: 700,
    textTransform: "uppercase",
    letterSpacing: "0.05em",
    padding: "12px 4px 6px 4px",
    marginTop: "8px"
  },
  feedback: {
    display: "flex",
    alignItems: "center",
    gap: "8px",
    marginTop: "12px",
    paddingTop: "10px",
    borderTop: "1px solid rgba(0, 0, 0, 0.08)",
    fontSize: "13px"
  },
  feedbackButton: {
    background: "none",
    border: "1px solid transparent",
    cursor: "pointer",
    fontSize: "16px",
    padding: "4px 8px",
    borderRadius: "4px",
    transition: "background-color 0.15s ease, border-color 0.15s ease"
  },
  feedbackButtonSelected: {
    borderColor: "rgba(0, 0, 0, 0.2)",
    backgroundColor: "rgba(0, 0, 0, 0.04)"
  },
  emptyState: {
    textAlign: "center",
    padding: "48px 24px",
    fontSize: "14px"
  },
  noResults: {
    textAlign: "center",
    padding: "32px 16px",
    fontSize: "14px"
  }
};
var themeStyles = {
  light: {
    container: {
      backgroundColor: base.white,
      color: slateGrey[1]
    },
    searchInput: {
      backgroundColor: slateGrey[12],
      border: `1px solid ${slateGrey[11]}`,
      color: slateGrey[1]
    },
    item: {
      backgroundColor: slateGrey[12],
      border: `1px solid ${slateGrey[11]}`
    },
    itemExpanded: {
      boxShadow: "0 4px 12px rgba(0, 0, 0, 0.08)"
    },
    question: {
      backgroundColor: "transparent",
      color: slateGrey[1]
    },
    questionHover: {
      backgroundColor: slateGrey[12]
    },
    answer: {
      color: slateGrey[6]
    },
    category: {
      backgroundColor: purple[8],
      color: purple[2]
    },
    categoryHeader: {
      color: slateGrey[7]
    },
    emptyState: {
      color: slateGrey[8]
    },
    feedbackPrompt: {
      color: slateGrey[7]
    }
  },
  dark: {
    container: {
      backgroundColor: slateGrey[1],
      color: slateGrey[12]
    },
    searchInput: {
      backgroundColor: slateGrey[3],
      border: `1px solid ${slateGrey[5]}`,
      color: slateGrey[12]
    },
    item: {
      backgroundColor: slateGrey[3],
      border: `1px solid ${slateGrey[5]}`
    },
    itemExpanded: {
      boxShadow: "0 4px 12px rgba(0, 0, 0, 0.3)"
    },
    question: {
      backgroundColor: "transparent",
      color: slateGrey[12]
    },
    questionHover: {
      backgroundColor: slateGrey[5]
    },
    answer: {
      color: slateGrey[8]
    },
    category: {
      backgroundColor: purple[0],
      color: purple[6]
    },
    categoryHeader: {
      color: slateGrey[8]
    },
    emptyState: {
      color: slateGrey[7]
    },
    feedbackPrompt: {
      color: slateGrey[8]
    }
  }
};
function FAQItem({ item, isExpanded, onToggle, theme, feedbackConfig, feedbackValue, onFeedback }) {
  const [isHovered, setIsHovered] = useState2(false);
  const colors = themeStyles[theme];
  const { question, answer } = item.config;
  const itemStyle = {
    ...baseStyles.item,
    ...colors.item,
    ...isExpanded ? colors.itemExpanded : {}
  };
  const questionStyle = {
    ...baseStyles.question,
    ...colors.question,
    ...isHovered ? colors.questionHover : {}
  };
  const chevronStyle = {
    ...baseStyles.chevron,
    transform: isExpanded ? "rotate(180deg)" : "rotate(0deg)"
  };
  const answerStyle = {
    ...baseStyles.answer,
    ...colors.answer,
    maxHeight: isExpanded ? "500px" : "0",
    paddingBottom: isExpanded ? "16px" : "0"
  };
  const feedbackStyle = {
    ...baseStyles.feedback,
    ...colors.feedbackPrompt
  };
  return _jsxs2("div", { style: itemStyle, "data-faq-item-id": item.config.id, children: [_jsxs2("button", { type: "button", style: questionStyle, onClick: onToggle, onMouseEnter: () => setIsHovered(true), onMouseLeave: () => setIsHovered(false), "aria-expanded": isExpanded, children: [_jsx2("span", { children: question }), _jsx2("span", { style: chevronStyle, children: "\u25BC" })] }), _jsxs2("div", { style: answerStyle, "aria-hidden": !isExpanded, children: [renderAnswer(answer), isExpanded && feedbackConfig && _jsxs2("div", { style: feedbackStyle, children: [_jsx2("span", { children: getFeedbackPrompt(feedbackConfig) }), _jsx2("button", { type: "button", style: {
    ...baseStyles.feedbackButton,
    ...feedbackValue === "up" ? baseStyles.feedbackButtonSelected : {}
  }, "aria-label": "Thumbs up", onClick: () => onFeedback(item.config.id, question, "up"), children: "\u{1F44D}" }), _jsx2("button", { type: "button", style: {
    ...baseStyles.feedbackButton,
    ...feedbackValue === "down" ? baseStyles.feedbackButtonSelected : {}
  }, "aria-label": "Thumbs down", onClick: () => onFeedback(item.config.id, question, "down"), children: "\u{1F44E}" })] })] })] });
}
function FAQWidget({ config, runtime: runtime7, instanceId }) {
  const [renderTick, forceUpdate] = useReducer((x) => x + 1, 0);
  const [expandedIds, setExpandedIds] = useState2(/* @__PURE__ */ new Set());
  const [searchQuery, setSearchQuery] = useState2("");
  const [feedbackState, setFeedbackState] = useState2(/* @__PURE__ */ new Map());
  const feedbackConfig = useMemo(() => resolveFeedbackConfig(config.feedback), [config.feedback]);
  useEffect2(() => {
    const unsubscribe = runtime7.context.subscribe(() => {
      forceUpdate();
    });
    return unsubscribe;
  }, [runtime7.context]);
  useEffect2(() => {
    var _a;
    if (!((_a = runtime7.accumulator) == null ? void 0 : _a.subscribe))
      return;
    return runtime7.accumulator.subscribe(() => {
      forceUpdate();
    });
  }, [runtime7.accumulator]);
  useEffect2(() => {
    var _a, _b;
    if (!config.scope || !((_a = runtime7.accumulator) == null ? void 0 : _a.register))
      return;
    const { events: eventNames, urlContains, props: propFilters } = config.scope;
    const keys = /* @__PURE__ */ new Set();
    for (const action of config.actions) {
      if (((_b = action.showWhen) == null ? void 0 : _b.type) === "rules") {
        for (const rule of action.showWhen.rules) {
          for (const cond of rule.conditions) {
            if (cond.type === "event_count" && cond.key) {
              keys.add(cond.key);
            }
          }
        }
      }
    }
    for (const key of keys) {
      runtime7.accumulator.register(key, (event) => {
        var _a2, _b2, _c;
        if (!eventNames.includes(event.name))
          return false;
        if (urlContains) {
          const pathname = String((_b2 = (_a2 = event.props) == null ? void 0 : _a2.pathname) != null ? _b2 : "");
          if (!pathname.includes(urlContains))
            return false;
        }
        if (propFilters) {
          for (const [k, v] of Object.entries(propFilters)) {
            if (((_c = event.props) == null ? void 0 : _c[k]) !== v)
              return false;
          }
        }
        return true;
      });
    }
  }, [config.scope, config.actions, runtime7.accumulator]);
  useEffect2(() => {
    if (!runtime7.events.subscribe)
      return;
    if (runtime7.events.getRecent) {
      const recentEvents = runtime7.events.getRecent({ patterns: ["^action\\.tooltip_cta_clicked$", "^action\\.modal_cta_clicked$"] }, 10);
      const pendingEvent = recentEvents.filter((e) => {
        var _a;
        const actionId = (_a = e.props) == null ? void 0 : _a.actionId;
        return typeof actionId === "string" && actionId.startsWith("faq:open:");
      }).pop();
      if (pendingEvent && Date.now() - pendingEvent.ts < 1e4) {
        const questionId = pendingEvent.props.actionId.replace("faq:open:", "");
        setExpandedIds(/* @__PURE__ */ new Set([questionId]));
        requestAnimationFrame(() => {
          const el = document.querySelector(`[data-faq-item-id="${questionId}"]`);
          if (el)
            el.scrollIntoView({ behavior: "smooth", block: "center" });
        });
      }
    }
    const unsubscribe = runtime7.events.subscribe({ patterns: ["^action\\.tooltip_cta_clicked$", "^action\\.modal_cta_clicked$"] }, (event) => {
      var _a;
      const actionId = (_a = event.props) == null ? void 0 : _a.actionId;
      if (typeof actionId !== "string" || !actionId.startsWith("faq:open:"))
        return;
      const questionId = actionId.replace("faq:open:", "");
      setExpandedIds(/* @__PURE__ */ new Set([questionId]));
      requestAnimationFrame(() => {
        const el = document.querySelector(`[data-faq-item-id="${questionId}"]`);
        if (el)
          el.scrollIntoView({ behavior: "smooth", block: "center" });
      });
      runtime7.events.publish("canvas.requestOpen");
    });
    return unsubscribe;
  }, [runtime7]);
  const visibleQuestions = useMemo(() => config.actions.filter((q) => {
    if (!q.showWhen)
      return true;
    const result = runtime7.evaluateSync(q.showWhen);
    return result.value;
  }), [config.actions, runtime7, renderTick]);
  const orderedQuestions = useMemo(() => {
    if (config.ordering === "priority") {
      return [...visibleQuestions].sort((a, b) => {
        var _a, _b;
        return ((_a = b.config.priority) != null ? _a : 0) - ((_b = a.config.priority) != null ? _b : 0);
      });
    }
    return visibleQuestions;
  }, [visibleQuestions, config.ordering]);
  const filteredQuestions = useMemo(() => {
    if (!config.searchable || !searchQuery.trim()) {
      return orderedQuestions;
    }
    const query = searchQuery.toLowerCase();
    return orderedQuestions.filter((q) => {
      var _a;
      return q.config.question.toLowerCase().includes(query) || getAnswerText(q.config.answer).toLowerCase().includes(query) || ((_a = q.config.category) == null ? void 0 : _a.toLowerCase().includes(query));
    });
  }, [orderedQuestions, searchQuery, config.searchable]);
  const categoryGroups = useMemo(() => {
    const groups = /* @__PURE__ */ new Map();
    for (const q of filteredQuestions) {
      const cat = q.config.category;
      if (!groups.has(cat)) {
        groups.set(cat, []);
      }
      groups.get(cat).push(q);
    }
    return groups;
  }, [filteredQuestions]);
  const hasCategories = useMemo(() => filteredQuestions.some((q) => q.config.category), [filteredQuestions]);
  const resolvedTheme = useMemo(() => {
    var _a;
    if (config.theme && config.theme !== "auto")
      return config.theme;
    if (typeof window !== "undefined") {
      return ((_a = window.matchMedia) == null ? void 0 : _a.call(window, "(prefers-color-scheme: dark)").matches) ? "dark" : "light";
    }
    return "light";
  }, [config.theme]);
  const handleToggle = useCallback2((id) => {
    setExpandedIds((prev) => {
      const next = new Set(prev);
      if (config.expandBehavior === "single") {
        if (prev.has(id)) {
          return /* @__PURE__ */ new Set();
        }
        return /* @__PURE__ */ new Set([id]);
      }
      if (prev.has(id)) {
        next.delete(id);
      } else {
        next.add(id);
      }
      return next;
    });
    runtime7.events.publish("faq:toggled", {
      instanceId,
      questionId: id,
      expanded: !expandedIds.has(id),
      timestamp: Date.now()
    });
  }, [config.expandBehavior, runtime7.events, instanceId, expandedIds]);
  const handleFeedback = useCallback2((itemId, question, value) => {
    setFeedbackState((prev) => {
      const next = new Map(prev);
      next.set(itemId, value);
      return next;
    });
    runtime7.events.publish("faq:feedback", {
      itemId,
      question,
      value
    });
  }, [runtime7.events]);
  const containerStyle = {
    ...baseStyles.container,
    ...themeStyles[resolvedTheme].container
  };
  const searchInputStyle = {
    ...baseStyles.searchInput,
    ...themeStyles[resolvedTheme].searchInput
  };
  const emptyStateStyle = {
    ...baseStyles.emptyState,
    ...themeStyles[resolvedTheme].emptyState
  };
  const categoryHeaderStyle = {
    ...baseStyles.categoryHeader,
    ...themeStyles[resolvedTheme].categoryHeader
  };
  const renderItems = (items) => items.map((q) => _jsx2(FAQItem, { item: q, isExpanded: expandedIds.has(q.config.id), onToggle: () => handleToggle(q.config.id), theme: resolvedTheme, feedbackConfig, feedbackValue: feedbackState.get(q.config.id), onFeedback: handleFeedback }, q.config.id));
  if (visibleQuestions.length === 0) {
    return _jsx2("div", { style: containerStyle, "data-adaptive-id": instanceId, "data-adaptive-type": "adaptive-faq", children: _jsx2("div", { style: emptyStateStyle, children: "No FAQ questions available." }) });
  }
  return _jsxs2("div", { style: containerStyle, "data-adaptive-id": instanceId, "data-adaptive-type": "adaptive-faq", children: [config.searchable && _jsx2("div", { style: baseStyles.searchWrapper, children: _jsx2("input", { type: "text", placeholder: "Search questions...", value: searchQuery, onChange: (e) => setSearchQuery(e.target.value), style: searchInputStyle }) }), _jsx2("div", { style: baseStyles.accordion, children: hasCategories ? Array.from(categoryGroups.entries()).map(([category, items]) => _jsxs2(React2.Fragment, { children: [category && _jsx2("div", { style: categoryHeaderStyle, "data-category-header": category, children: category }), renderItems(items)] }, category != null ? category : "__ungrouped")) : renderItems(filteredQuestions) }), config.searchable && filteredQuestions.length === 0 && searchQuery && _jsxs2("div", { style: { ...baseStyles.noResults, ...themeStyles[resolvedTheme].emptyState }, children: ['No questions found matching "', searchQuery, '"'] })] });
}
var FAQMountableWidget = {
  mount(container, config) {
    const { runtime: runtime7, instanceId = "faq-widget", ...faqConfig } = config || {
      expandBehavior: "single",
      searchable: false,
      theme: "auto",
      actions: []
    };
    if (runtime7 && typeof createRoot2 === "function") {
      const root = createRoot2(container);
      root.render(React2.createElement(FAQWidget, {
        config: faqConfig,
        runtime: runtime7,
        instanceId
      }));
      return () => {
        root.unmount();
      };
    }
    const questions = faqConfig.actions || [];
    container.innerHTML = `
      <div style="font-family: system-ui; max-width: 800px;">
        ${questions.map((q) => `
          <div style="margin-bottom: 8px; padding: 16px; background: ${slateGrey[12]}; border-radius: 8px;">
            <strong>${q.config.question}</strong>
            <p style="margin-top: 8px; color: ${slateGrey[6]};">${getAnswerText(q.config.answer)}</p>
          </div>
        `).join("")}
      </div>
    `;
    return () => {
      container.innerHTML = "";
    };
  }
};

// ../adaptives/adaptive-faq/dist/runtime.js
var runtime4 = {
  id: "adaptive-faq",
  version: "2.0.0",
  name: "FAQ Accordion",
  description: "Collapsible Q&A accordion with actions, rich content, feedback, and personalization",
  /**
   * Action executors for programmatic FAQ interaction.
   */
  executors: executorDefinitions,
  /**
   * Widget definitions for the runtime's WidgetRegistry.
   */
  widgets: [
    {
      id: "adaptive-faq:accordion",
      component: FAQMountableWidget,
      metadata: {
        name: "FAQ Accordion",
        description: "Collapsible Q&A accordion with search, categories, and feedback",
        icon: "\u2753"
      }
    }
  ],
  /**
   * Extract notify watcher entries from tile config props.
   * The runtime evaluates these continuously (even with drawer closed)
   * and publishes faq:question_revealed when showWhen transitions false → true.
   */
  notifyWatchers(props) {
    var _a;
    const actions = (_a = props.actions) != null ? _a : [];
    return actions.filter((a) => a.notify && a.showWhen).map((a) => ({
      id: `faq:${a.config.id}`,
      strategy: a.showWhen,
      eventName: "faq:question_revealed",
      eventProps: {
        questionId: a.config.id,
        question: a.config.question,
        title: a.notify.title,
        body: a.notify.body,
        icon: a.notify.icon
      }
    }));
  }
};

// ../adaptives/adaptive-gamification/dist/runtime.js
var executeAwardBadge = async (action, context) => {
  const { badgeId } = action;
  context.publishEvent("gamification.badge_awarded", {
    badgeId,
    awardedAt: Date.now()
  });
  return {
    cleanup: () => {
    }
  };
};
var executeAddPoints = async (action, context) => {
  const { points, reason } = action;
  context.publishEvent("gamification.points_added", {
    points,
    reason,
    timestamp: Date.now()
  });
  return {
    cleanup: () => {
    }
  };
};
var badgeTriggerHandler = {
  names: ["page_view", "button_click"],
  handler: (_event, _ctx) => {
    console.log("[Gamification] Event received for badge trigger check");
  }
};
var executors = [
  { kind: "gamification:awardBadge", executor: executeAwardBadge },
  { kind: "gamification:addPoints", executor: executeAddPoints }
];
var eventHandlers = [badgeTriggerHandler];
var runtime5 = {
  id: "adaptive-gamification",
  version: "1.0.0",
  name: "Gamification",
  description: "Badges, rewards, points, and engagement mechanics",
  executors,
  eventHandlers
};

// ../adaptives/adaptive-nav/dist/NavWidget.js
import { jsx as _jsx3, jsxs as _jsxs3 } from "react/jsx-runtime";
import React3, { useCallback as useCallback3, useEffect as useEffect3, useMemo as useMemo2, useReducer as useReducer2, useState as useState3 } from "react";
import { createRoot as createRoot3 } from "react-dom/client";
function escapeHtml(str) {
  return str.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;");
}
var baseStyles2 = {
  container: {
    fontFamily: "system-ui, -apple-system, sans-serif",
    padding: "8px",
    maxWidth: "100%",
    overflow: "hidden"
  },
  accordion: {
    display: "flex",
    flexDirection: "column",
    gap: "4px"
  },
  item: {
    borderRadius: "8px",
    overflow: "hidden",
    transition: "box-shadow 0.2s ease"
  },
  header: {
    display: "flex",
    alignItems: "center",
    gap: "8px",
    width: "100%",
    padding: "12px 16px",
    border: "none",
    cursor: "pointer",
    fontSize: "14px",
    fontWeight: 500,
    fontFamily: "inherit",
    textAlign: "left",
    transition: "background-color 0.15s ease"
  },
  chevron: {
    fontSize: "10px",
    transition: "transform 0.2s ease",
    marginLeft: "auto",
    flexShrink: 0
  },
  icon: {
    fontSize: "16px",
    flexShrink: 0
  },
  body: {
    overflow: "hidden",
    transition: "max-height 0.25s ease, padding-bottom 0.25s ease",
    padding: "0 16px"
  },
  description: {
    fontSize: "13px",
    lineHeight: "1.5",
    margin: 0
  },
  linkButton: {
    display: "inline-flex",
    alignItems: "center",
    gap: "4px",
    marginTop: "10px",
    padding: "6px 12px",
    borderRadius: "6px",
    textDecoration: "none",
    fontSize: "13px",
    fontWeight: 500,
    cursor: "pointer",
    border: "none",
    transition: "background-color 0.15s ease"
  },
  categoryHeader: {
    fontSize: "11px",
    fontWeight: 600,
    textTransform: "uppercase",
    letterSpacing: "0.05em",
    padding: "12px 4px 4px"
  },
  emptyState: {
    fontSize: "13px",
    padding: "16px",
    textAlign: "center"
  }
};
var themeStyles2 = {
  light: {
    container: {
      backgroundColor: base.white,
      color: slateGrey[1]
    },
    item: {
      backgroundColor: slateGrey[12],
      border: `1px solid ${slateGrey[11]}`
    },
    itemExpanded: {
      boxShadow: "0 4px 12px rgba(0, 0, 0, 0.08)"
    },
    header: {
      backgroundColor: "transparent",
      color: slateGrey[1]
    },
    headerHover: {
      backgroundColor: slateGrey[12]
    },
    body: {
      color: slateGrey[6]
    },
    linkButton: {
      backgroundColor: purple[8],
      color: purple[2]
    },
    categoryHeader: {
      color: slateGrey[7]
    },
    emptyState: {
      color: slateGrey[8]
    }
  },
  dark: {
    container: {
      backgroundColor: slateGrey[1],
      color: slateGrey[12]
    },
    item: {
      backgroundColor: slateGrey[3],
      border: `1px solid ${slateGrey[5]}`
    },
    itemExpanded: {
      boxShadow: "0 4px 12px rgba(0, 0, 0, 0.3)"
    },
    header: {
      backgroundColor: "transparent",
      color: slateGrey[12]
    },
    headerHover: {
      backgroundColor: slateGrey[5]
    },
    body: {
      color: slateGrey[8]
    },
    linkButton: {
      backgroundColor: purple[0],
      color: purple[6]
    },
    categoryHeader: {
      color: slateGrey[8]
    },
    emptyState: {
      color: slateGrey[7]
    }
  }
};
function NavTipItem({ item, isExpanded, onToggle, onNavigate, theme }) {
  const [isHovered, setIsHovered] = useState3(false);
  const colors = themeStyles2[theme];
  const { title, description, href, icon, external } = item.config;
  const itemStyle = {
    ...baseStyles2.item,
    ...colors.item,
    ...isExpanded ? colors.itemExpanded : {}
  };
  const headerStyle = {
    ...baseStyles2.header,
    ...colors.header,
    ...isHovered ? colors.headerHover : {}
  };
  const chevronStyle = {
    ...baseStyles2.chevron,
    transform: isExpanded ? "rotate(180deg)" : "rotate(0deg)"
  };
  const bodyStyle = {
    ...baseStyles2.body,
    ...colors.body,
    maxHeight: isExpanded ? "500px" : "0",
    paddingBottom: isExpanded ? "16px" : "0"
  };
  const handleLinkClick = (e) => {
    e.preventDefault();
    e.stopPropagation();
    if (href) {
      onNavigate(href, external != null ? external : false);
    }
  };
  return _jsxs3("div", { style: itemStyle, "data-nav-tip-id": item.config.id, children: [_jsxs3("button", { type: "button", style: headerStyle, onClick: onToggle, onMouseEnter: () => setIsHovered(true), onMouseLeave: () => setIsHovered(false), "aria-expanded": isExpanded, children: [icon && _jsx3("span", { style: baseStyles2.icon, children: icon }), _jsx3("span", { children: title }), _jsx3("span", { style: chevronStyle, children: "\u25BC" })] }), _jsxs3("div", { style: bodyStyle, "aria-hidden": !isExpanded, children: [_jsx3("p", { style: baseStyles2.description, children: description }), href && _jsxs3("a", { href, onClick: handleLinkClick, style: { ...baseStyles2.linkButton, ...colors.linkButton }, target: external ? "_blank" : void 0, rel: external ? "noopener noreferrer" : void 0, children: ["Go ", external ? "\u2197" : "\u2192"] })] })] });
}
function NavWidget({ config, runtime: runtime7, instanceId }) {
  const [renderTick, forceUpdate] = useReducer2((x) => x + 1, 0);
  const [expandedIds, setExpandedIds] = useState3(/* @__PURE__ */ new Set());
  useEffect3(() => {
    const unsubscribe = runtime7.context.subscribe(() => {
      forceUpdate();
    });
    return unsubscribe;
  }, [runtime7.context]);
  useEffect3(() => {
    var _a;
    if (!((_a = runtime7.accumulator) == null ? void 0 : _a.subscribe))
      return;
    return runtime7.accumulator.subscribe(() => {
      forceUpdate();
    });
  }, [runtime7.accumulator]);
  useEffect3(() => {
    var _a, _b;
    if (!config.scope || !((_a = runtime7.accumulator) == null ? void 0 : _a.register))
      return;
    const { events: eventNames, urlContains, props: propFilters } = config.scope;
    const keys = /* @__PURE__ */ new Set();
    for (const action of config.actions) {
      if (((_b = action.showWhen) == null ? void 0 : _b.type) === "rules") {
        for (const rule of action.showWhen.rules) {
          for (const cond of rule.conditions) {
            if (cond.type === "event_count" && cond.key) {
              keys.add(cond.key);
            }
          }
        }
      }
    }
    for (const key of keys) {
      runtime7.accumulator.register(key, (event) => {
        var _a2, _b2, _c;
        if (!eventNames.includes(event.name))
          return false;
        if (urlContains) {
          const pathname = String((_b2 = (_a2 = event.props) == null ? void 0 : _a2.pathname) != null ? _b2 : "");
          if (!pathname.includes(urlContains))
            return false;
        }
        if (propFilters) {
          for (const [k, v] of Object.entries(propFilters)) {
            if (((_c = event.props) == null ? void 0 : _c[k]) !== v)
              return false;
          }
        }
        return true;
      });
    }
  }, [config.scope, config.actions, runtime7.accumulator]);
  const visibleTips = useMemo2(() => config.actions.filter((tip) => {
    if (!tip.showWhen)
      return true;
    try {
      const result = runtime7.evaluateSync(tip.showWhen);
      return result.value;
    } catch {
      return false;
    }
  }), [config.actions, runtime7, renderTick]);
  const categoryGroups = useMemo2(() => {
    const groups = /* @__PURE__ */ new Map();
    for (const tip of visibleTips) {
      const cat = tip.config.category;
      if (!groups.has(cat)) {
        groups.set(cat, []);
      }
      groups.get(cat).push(tip);
    }
    return groups;
  }, [visibleTips]);
  const hasCategories = useMemo2(() => visibleTips.some((t) => t.config.category), [visibleTips]);
  const resolvedTheme = useMemo2(() => {
    var _a;
    if (config.theme && config.theme !== "auto")
      return config.theme;
    if (typeof window !== "undefined") {
      return ((_a = window.matchMedia) == null ? void 0 : _a.call(window, "(prefers-color-scheme: dark)").matches) ? "dark" : "light";
    }
    return "light";
  }, [config.theme]);
  const handleToggle = useCallback3((id) => {
    setExpandedIds((prev) => {
      const wasExpanded = prev.has(id);
      let next;
      if (config.expandBehavior === "single") {
        for (const prevId of prev) {
          if (prevId !== id) {
            runtime7.events.publish("nav:toggled", {
              instanceId,
              tipId: prevId,
              expanded: false,
              timestamp: Date.now()
            });
          }
        }
        next = wasExpanded ? /* @__PURE__ */ new Set() : /* @__PURE__ */ new Set([id]);
      } else {
        next = new Set(prev);
        if (wasExpanded) {
          next.delete(id);
        } else {
          next.add(id);
        }
      }
      runtime7.events.publish("nav:toggled", {
        instanceId,
        tipId: id,
        expanded: !wasExpanded,
        timestamp: Date.now()
      });
      return next;
    });
  }, [config.expandBehavior, runtime7.events, instanceId]);
  const handleNavigate = useCallback3((href, external) => {
    const normalizedHref = href.trim().toLowerCase();
    if (normalizedHref.startsWith("javascript:") || normalizedHref.startsWith("data:")) {
      return;
    }
    runtime7.events.publish("nav:tip_clicked", {
      instanceId,
      href,
      external,
      timestamp: Date.now()
    });
    if (external) {
      window.open(href, "_blank", "noopener,noreferrer");
    } else {
      window.location.href = href;
    }
  }, [runtime7.events, instanceId]);
  const containerStyle = {
    ...baseStyles2.container,
    ...themeStyles2[resolvedTheme].container
  };
  const categoryHeaderStyle = {
    ...baseStyles2.categoryHeader,
    ...themeStyles2[resolvedTheme].categoryHeader
  };
  const emptyStateStyle = {
    ...baseStyles2.emptyState,
    ...themeStyles2[resolvedTheme].emptyState
  };
  const renderItems = (items) => items.map((tip) => _jsx3(NavTipItem, { item: tip, isExpanded: expandedIds.has(tip.config.id), onToggle: () => handleToggle(tip.config.id), onNavigate: handleNavigate, theme: resolvedTheme }, tip.config.id));
  if (visibleTips.length === 0) {
    return _jsx3("div", { style: containerStyle, "data-adaptive-id": instanceId, "data-adaptive-type": "adaptive-nav", children: _jsx3("div", { style: emptyStateStyle, children: "No navigation tips available." }) });
  }
  return _jsx3("div", { style: containerStyle, "data-adaptive-id": instanceId, "data-adaptive-type": "adaptive-nav", children: _jsx3("div", { style: baseStyles2.accordion, children: hasCategories ? Array.from(categoryGroups.entries()).map(([category, items]) => _jsxs3(React3.Fragment, { children: [category && _jsx3("div", { style: categoryHeaderStyle, "data-category-header": category, children: category }), renderItems(items)] }, category != null ? category : "__ungrouped")) : renderItems(visibleTips) }) });
}
var NavMountableWidget = {
  mount(container, config) {
    const { runtime: runtime7, instanceId = "nav-widget", ...navConfig } = config || {
      expandBehavior: "single",
      theme: "auto",
      actions: []
    };
    if (runtime7 && typeof createRoot3 === "function") {
      const root = createRoot3(container);
      root.render(React3.createElement(NavWidget, {
        config: navConfig,
        runtime: runtime7,
        instanceId
      }));
      return () => {
        root.unmount();
      };
    }
    const tips = navConfig.actions || [];
    container.innerHTML = `
      <div style="font-family: system-ui; max-width: 100%;">
        ${tips.map((tip) => `
          <div style="margin-bottom: 4px; padding: 12px 16px; background: ${slateGrey[12]}; border-radius: 8px;">
            ${tip.config.icon ? `<span>${escapeHtml(tip.config.icon)}</span> ` : ""}<strong>${escapeHtml(tip.config.title)}</strong>
            <p style="margin-top: 8px; color: ${slateGrey[6]}; font-size: 13px;">${escapeHtml(tip.config.description)}</p>
            ${tip.config.href ? `<a href="${escapeHtml(tip.config.href)}" style="color: ${purple[2]}; font-size: 13px;">Go &rarr;</a>` : ""}
          </div>
        `).join("")}
      </div>
    `;
    return () => {
      container.innerHTML = "";
    };
  }
};

// ../adaptives/adaptive-nav/dist/runtime.js
var executeScrollTo = async (action, context) => {
  var _a, _b, _c, _d;
  const anchorEl = context.resolveAnchor(action.anchorId);
  if (!anchorEl) {
    throw new Error(`Anchor not found: ${action.anchorId}`);
  }
  anchorEl.scrollIntoView({
    behavior: (_a = action.behavior) != null ? _a : "smooth",
    block: (_b = action.block) != null ? _b : "center",
    inline: (_c = action.inline) != null ? _c : "nearest"
  });
  context.publishEvent("action.applied", {
    id: context.generateId(),
    kind: "navigation:scrollTo",
    anchorId: action.anchorId,
    behavior: (_d = action.behavior) != null ? _d : "smooth"
  });
  return {
    cleanup: () => {
    }
  };
};
function isSameOrigin(url) {
  try {
    const parsed = new URL(url, window.location.origin);
    return parsed.origin === window.location.origin;
  } catch {
    return false;
  }
}
var executeNavigate = async (action, context) => {
  var _a;
  const url = action.url.trim();
  if (url.toLowerCase().startsWith("javascript:")) {
    throw new Error("javascript: URLs are not allowed");
  }
  const target = (_a = action.target) != null ? _a : "_self";
  context.publishEvent("action.applied", {
    id: context.generateId(),
    kind: "navigation:navigate",
    url: action.url,
    target
  });
  if (target === "_blank") {
    window.open(url, "_blank", "noopener,noreferrer");
  } else if (!action.forceFullNavigation && isSameOrigin(url)) {
    window.history.pushState(null, "", url);
    window.dispatchEvent(new PopStateEvent("popstate"));
  } else {
    window.location.href = url;
  }
  return {
    cleanup: () => {
    }
  };
};
var executors2 = [
  { kind: "navigation:scrollTo", executor: executeScrollTo },
  { kind: "navigation:navigate", executor: executeNavigate }
];
var runtime6 = {
  id: "adaptive-nav",
  version: "2.0.0",
  name: "Navigation Tips",
  description: "Navigation actions and accordion-based tips with per-item conditional visibility",
  /**
   * Navigation action executors (scrollTo, navigate).
   */
  executors: executors2,
  /**
   * Widget definitions for the runtime's WidgetRegistry.
   */
  widgets: [
    {
      id: "adaptive-nav:tips",
      component: NavMountableWidget,
      metadata: {
        name: "Navigation Tips",
        description: "Accordion of contextual navigation tips with per-item visibility",
        icon: "\u{1F9ED}"
      }
    }
  ],
  /**
   * Extract notify watcher entries from tile config props.
   * The runtime evaluates these continuously (even with drawer closed)
   * and publishes nav:tip_revealed when showWhen transitions false → true.
   */
  notifyWatchers(props) {
    var _a;
    const actions = (_a = props.actions) != null ? _a : [];
    return actions.filter((a) => a.notify && a.showWhen).map((a) => ({
      id: `nav:${a.config.id}`,
      strategy: a.showWhen,
      eventName: "nav:tip_revealed",
      eventProps: {
        tipId: a.config.id,
        title: a.notify.title,
        body: a.notify.body,
        icon: a.notify.icon
      }
    }));
  }
};

// src/apps/builtinRuntimeModules.generated.ts
var allRuntimes = [runtime3, runtime, runtime4, runtime5, runtime6, runtime2];
var builtinAdaptiveManifests = allRuntimes.map((r) => ({
  id: r.id,
  version: r.version,
  name: r.name,
  description: r.description,
  runtime: {
    actions: (r.executors || []).map(({ kind, executor }) => ({ kind, executor })),
    widgets: r.widgets,
    notifyWatchers: r.notifyWatchers,
    events: r.eventHandlers
  },
  editor: void 0,
  metadata: { isBuiltIn: true }
}));
function registerBuiltinRuntimeModules(registry) {
  let count = 0;
  for (const manifest of builtinAdaptiveManifests) {
    if (!registry.has(manifest.id)) {
      registry.register(manifest);
      count++;
    }
  }
  console.log("[Syntro Runtime] Registered", count, "built-in runtime modules");
}

// src/components/TileWheel.tsx
import { useEffect as useEffect4, useMemo as useMemo3, useState as useState4 } from "react";
import { jsx, jsxs } from "react/jsx-runtime";
function TileWheel({ tiles, intervalMs = 7e3, telemetry }) {
  const [index, setIndex] = useState4(0);
  const ordered = useMemo3(
    () => [...tiles].sort((a, b) => {
      var _a, _b;
      return ((_a = a.priority) != null ? _a : 0) - ((_b = b.priority) != null ? _b : 0);
    }),
    [tiles]
  );
  useEffect4(() => {
    telemetry == null ? void 0 : telemetry.trackCanvasOpened("wheel");
  }, [telemetry]);
  useEffect4(() => {
    if (ordered.length <= 1) return;
    const id = setInterval(() => {
      setIndex((prev) => (prev + 1) % ordered.length);
    }, intervalMs);
    return () => clearInterval(id);
  }, [ordered, intervalMs]);
  useEffect4(() => {
    const current = ordered[index];
    if (current) {
      telemetry == null ? void 0 : telemetry.trackRectangleViewed(current.id, "wheel");
    }
  }, [index, ordered, telemetry]);
  if (!ordered.length) return null;
  return /* @__PURE__ */ jsxs(
    "div",
    {
      style: {
        position: "relative",
        overflow: "hidden",
        borderRadius: "1.5rem",
        border: `1px solid ${border.primary}`,
        background: slateGrey[1],
        padding: "1.5rem",
        boxShadow: "0 25px 50px -12px rgba(0, 0, 0, 0.25)"
      },
      "data-shadow-canvas-id": "wheel",
      children: [
        /* @__PURE__ */ jsx(
          "div",
          {
            style: {
              display: "flex",
              transition: "transform 700ms ease-out",
              transform: `translateX(-${index * 100}%)`,
              width: `${ordered.length * 100}%`
            },
            children: ordered.map((tile) => /* @__PURE__ */ jsx("div", { style: { width: "100%", flexShrink: 0, padding: "0 1rem" }, children: /* @__PURE__ */ jsx(TileCard, { config: tile, surface: "wheel", telemetry }) }, tile.id))
          }
        ),
        /* @__PURE__ */ jsx("div", { style: { marginTop: "1rem", display: "flex", justifyContent: "center", gap: "0.5rem" }, children: ordered.map((tile, idx) => /* @__PURE__ */ jsx(
          "button",
          {
            type: "button",
            style: {
              height: "0.5rem",
              width: "1.5rem",
              borderRadius: "9999px",
              background: idx === index ? brand[3] : slateGrey[6],
              border: "none",
              cursor: "pointer",
              padding: 0
            },
            onClick: () => setIndex(idx)
          },
          tile.id
        )) })
      ]
    }
  );
}

// src/config-validator.ts
function parseVersion(version) {
  const parts = version.split(".");
  return {
    major: parseInt(parts[0] || "0", 10),
    minor: parseInt(parts[1] || "0", 10)
  };
}
function validateConfig(config) {
  const warnings = [];
  const errors = [];
  if (!config || typeof config !== "object") {
    return {
      valid: false,
      errors: ["Config must be an object"],
      warnings
    };
  }
  const typedConfig = config;
  if (!typedConfig.tiles) {
    errors.push("Config missing required field: tiles");
  }
  if (!typedConfig.actions) {
    errors.push("Config missing required field: actions");
  }
  if (!typedConfig.fetchedAt) {
    errors.push("Config missing required field: fetchedAt");
  }
  if (errors.length > 0) {
    return { valid: false, errors, warnings };
  }
  const configVersion = typedConfig.schemaVersion || "1.0";
  const configVer = parseVersion(configVersion);
  const sdkVer = parseVersion(SDK_SCHEMA_VERSION);
  if (configVer.major > sdkVer.major) {
    warnings.push(
      `Config schema v${configVersion} is newer than SDK v${SDK_SCHEMA_VERSION}. Some features may not work. Update SDK to latest version.`
    );
  }
  if (configVer.major < sdkVer.major || !typedConfig.schemaVersion) {
    warnings.push(
      `Config schema v${configVersion} is older than SDK v${SDK_SCHEMA_VERSION}. Migrating config to current version.`
    );
    return {
      valid: true,
      warnings,
      errors,
      migratedConfig: migrateConfig(typedConfig, configVersion)
    };
  }
  return {
    valid: true,
    warnings,
    errors
  };
}
function migrateConfig(config, fromVersion) {
  let migrated = { ...config };
  const fromVer = parseVersion(fromVersion);
  if (fromVer.major === 1) {
    migrated = migrateV1ToV2(migrated);
  }
  migrated.schemaVersion = SDK_SCHEMA_VERSION;
  return migrated;
}
function migrateV1ToV2(config) {
  const migrated = {
    schemaVersion: "2.0",
    tiles: [],
    actions: config.actions || [],
    fetchedAt: config.fetchedAt || (/* @__PURE__ */ new Date()).toISOString()
  };
  if (config.tiles && Array.isArray(config.tiles)) {
    migrated.tiles = config.tiles.map((tile) => {
      const migratedTile = { ...tile };
      if (tile.experiment && !tile.activation) {
        const exp = tile.experiment;
        if (exp.featureKey) {
          migratedTile.activation = {
            strategy: {
              type: "external",
              provider: "growthbook",
              featureKey: exp.featureKey,
              fallback: false
            }
          };
        }
        delete migratedTile.experiment;
      }
      return migratedTile;
    });
  }
  if (config.configVersion) migrated.configVersion = config.configVersion;
  if (config.canvasTitle) migrated.canvasTitle = config.canvasTitle;
  if (config.theme) migrated.theme = config.theme;
  if (config.launcher) migrated.launcher = config.launcher;
  if (config.routes) migrated.routes = config.routes;
  return migrated;
}
function needsMigration(config) {
  if (!config || typeof config !== "object") {
    return false;
  }
  const typedConfig = config;
  const configVersion = typedConfig.schemaVersion || "1.0";
  const configVer = parseVersion(configVersion);
  const sdkVer = parseVersion(SDK_SCHEMA_VERSION);
  return configVer.major < sdkVer.major || !typedConfig.schemaVersion;
}

// src/overlays/schema.ts
import { z } from "zod";
var SelectorZ = z.union([
  z.object({ type: z.literal("data"), key: z.string(), value: z.string().optional() }),
  z.object({ type: z.literal("css"), value: z.string() }),
  z.object({ type: z.literal("aria"), role: z.string().optional(), label: z.string().optional() }),
  z.object({ type: z.literal("shadow-css"), value: z.string() }),
  z.object({ type: z.literal("ref"), el: z.any() })
  // runtime-only
]);
var TooltipStepZ = z.object({
  kind: z.literal("tooltip"),
  id: z.string(),
  anchor: SelectorZ,
  content: z.object({ title: z.string().optional(), body: z.string() }),
  placement: z.enum(["top", "bottom", "left", "right", "auto"]).optional(),
  offsetPx: z.number().optional(),
  blocking: z.boolean().optional(),
  trigger: z.enum(["immediate", "hover", "click"]).optional(),
  dismiss: z.object({
    onEsc: z.boolean().optional(),
    closeButton: z.boolean().optional(),
    timeoutMs: z.number().optional()
  }).optional()
});
var HighlightStepZ = z.object({
  kind: z.literal("highlight"),
  id: z.string(),
  anchor: SelectorZ,
  copy: z.string().optional(),
  ring: z.object({ paddingPx: z.number().optional(), radiusPx: z.number().optional() }).optional(),
  scrim: z.object({ opacity: z.number().optional() }).optional(),
  ringColor: z.string().optional(),
  blocking: z.boolean().optional(),
  dismiss: z.object({
    onClickOutside: z.boolean().optional(),
    onEsc: z.boolean().optional(),
    timeoutMs: z.number().optional()
  }).optional()
});
var CanvasRecipeZ = z.object({
  id: z.string(),
  version: z.number(),
  routes: z.array(z.string()).optional(),
  steps: z.array(z.union([TooltipStepZ, HighlightStepZ]))
});
function validateRecipe(json) {
  return CanvasRecipeZ.parse(json);
}

// src/overlays/fetcher.ts
var createOverlayRecipeFetcher = ({
  configUri,
  experiments,
  featureKey = "smart-canvas-overlay-uri",
  credentials = "include"
} = {}) => async () => {
  const uri = resolveConfigUri({ configUri, experiments, featureKey });
  if (!uri) {
    throw new Error("SmartCanvas overlays: recipe URI missing (env + feature unset).");
  }
  const response = await fetch(uri, { credentials });
  if (!response.ok) {
    throw new Error(`SmartCanvas overlays: failed to fetch recipe (${response.status})`);
  }
  const json = await response.json();
  return CanvasRecipeZ.parse(json);
};

// src/SmartCanvasPortal.tsx
import { useLayoutEffect, useState as useState5 } from "react";
import { createPortal } from "react-dom";
function SmartCanvasPortal({ element, children }) {
  const [mountNode, setMountNode] = useState5(null);
  useLayoutEffect(() => {
    if (!element) {
      setMountNode(null);
      return;
    }
    setMountNode(element.getMountNode());
    return () => setMountNode(null);
  }, [element]);
  if (!mountNode) return null;
  return createPortal(children, mountNode);
}

// src/context/schema.ts
import { z as z2 } from "zod";
var PageContextZ = z2.object({
  url: z2.string(),
  routeId: z2.string().optional(),
  title: z2.string().optional(),
  locale: z2.string().optional()
});
var PageHistoryEntryZ = z2.object({
  url: z2.string(),
  ts: z2.number()
});
var SessionContextZ = z2.object({
  sessionId: z2.string(),
  startTs: z2.number(),
  pageHistory: z2.array(PageHistoryEntryZ).optional()
});
var ViewportContextZ = z2.object({
  width: z2.number(),
  height: z2.number()
});
var BoundingBoxZ = z2.object({
  x: z2.number(),
  y: z2.number(),
  w: z2.number(),
  h: z2.number()
});
var AnchorStateZ = z2.object({
  anchorId: z2.string(),
  present: z2.boolean(),
  visible: z2.boolean().optional(),
  boundingBox: BoundingBoxZ.optional()
});
var AugmentationZ = z2.record(
  z2.string(),
  z2.union([z2.number(), z2.string(), z2.boolean(), z2.undefined()])
);
var RuntimeContextZ = z2.object({
  page: PageContextZ,
  session: SessionContextZ,
  viewport: ViewportContextZ,
  anchors: z2.array(AnchorStateZ).optional(),
  augmented: AugmentationZ.optional()
});
function validateRuntimeContext(data) {
  return RuntimeContextZ.safeParse(data);
}

// src/decisions/schema.ts
import { z as z3 } from "zod";
var PageUrlConditionZ = z3.object({
  type: z3.literal("page_url"),
  url: z3.string()
});
var RouteConditionZ = z3.object({
  type: z3.literal("route"),
  routeId: z3.string()
});
var AnchorVisibleConditionZ = z3.object({
  type: z3.literal("anchor_visible"),
  anchorId: z3.string(),
  state: z3.enum(["visible", "present", "absent"])
});
var EventOccurredConditionZ = z3.object({
  type: z3.literal("event_occurred"),
  eventName: z3.string(),
  withinMs: z3.number().optional()
});
var StateEqualsConditionZ = z3.object({
  type: z3.literal("state_equals"),
  key: z3.string(),
  value: z3.unknown()
});
var ViewportConditionZ = z3.object({
  type: z3.literal("viewport"),
  minWidth: z3.number().optional(),
  maxWidth: z3.number().optional(),
  minHeight: z3.number().optional(),
  maxHeight: z3.number().optional()
});
var SessionMetricConditionZ = z3.object({
  type: z3.literal("session_metric"),
  key: z3.string(),
  operator: z3.enum(["gte", "lte", "eq", "gt", "lt"]),
  threshold: z3.number()
});
var DismissedConditionZ = z3.object({
  type: z3.literal("dismissed"),
  key: z3.string(),
  inverted: z3.boolean().optional()
});
var CooldownActiveConditionZ = z3.object({
  type: z3.literal("cooldown_active"),
  key: z3.string(),
  inverted: z3.boolean().optional()
});
var FrequencyLimitConditionZ = z3.object({
  type: z3.literal("frequency_limit"),
  key: z3.string(),
  limit: z3.number(),
  inverted: z3.boolean().optional()
});
var EventCountConditionZ = z3.object({
  type: z3.literal("event_count"),
  key: z3.string(),
  operator: z3.enum(["gte", "lte", "eq", "gt", "lt"]),
  count: z3.number().int().min(0),
  withinMs: z3.number().positive().optional()
});
var ConditionZ = z3.discriminatedUnion("type", [
  PageUrlConditionZ,
  RouteConditionZ,
  AnchorVisibleConditionZ,
  EventOccurredConditionZ,
  StateEqualsConditionZ,
  ViewportConditionZ,
  SessionMetricConditionZ,
  DismissedConditionZ,
  CooldownActiveConditionZ,
  FrequencyLimitConditionZ,
  EventCountConditionZ
]);
var RuleZ = z3.object({
  conditions: z3.array(ConditionZ),
  value: z3.unknown()
});
var RuleStrategyZ = z3.object({
  type: z3.literal("rules"),
  rules: z3.array(RuleZ),
  default: z3.unknown()
});
var ScoreStrategyZ = z3.object({
  type: z3.literal("score"),
  field: z3.string(),
  threshold: z3.number(),
  above: z3.unknown(),
  below: z3.unknown()
});
var ModelStrategyZ = z3.object({
  type: z3.literal("model"),
  modelId: z3.string(),
  inputs: z3.array(z3.string()),
  outputMapping: z3.record(z3.string(), z3.unknown()),
  default: z3.unknown()
});
var ExternalStrategyZ = z3.object({
  type: z3.literal("external"),
  endpoint: z3.string(),
  method: z3.enum(["GET", "POST"]).optional(),
  default: z3.unknown(),
  timeoutMs: z3.number().optional()
});
var DecisionStrategyZ = z3.discriminatedUnion("type", [
  RuleStrategyZ,
  ScoreStrategyZ,
  ModelStrategyZ,
  ExternalStrategyZ
]);
var RouteFilterZ = z3.object({
  include: z3.array(z3.string()).optional(),
  exclude: z3.array(z3.string()).optional()
});
var ActivationConfigZ = z3.object({
  routes: RouteFilterZ.optional(),
  strategy: DecisionStrategyZ.optional()
});
function validateCondition(data) {
  return ConditionZ.safeParse(data);
}
function validateStrategy(data) {
  return DecisionStrategyZ.safeParse(data);
}
function validateActivationConfig(data) {
  return ActivationConfigZ.safeParse(data);
}

// src/events/schema.ts
import { z as z4 } from "zod";
var EventSourceZ = z4.enum(["posthog", "canvas", "derived"]);
var NormalizedEventZ = z4.object({
  ts: z4.number(),
  name: z4.string(),
  source: EventSourceZ,
  props: z4.record(z4.string(), z4.unknown()).optional(),
  schemaVersion: z4.string()
});
var EventFilterZ = z4.object({
  names: z4.array(z4.string()).optional(),
  patterns: z4.array(z4.string()).optional(),
  sources: z4.array(EventSourceZ).optional()
});
function validateNormalizedEvent(data) {
  return NormalizedEventZ.safeParse(data);
}
function validateEventFilter(data) {
  return EventFilterZ.safeParse(data);
}

// src/state/schema.ts
import { z as z5 } from "zod";
var StoredValueZ = z5.object({
  value: z5.unknown(),
  expiresAt: z5.number().optional()
});
var FrequencyEntryZ = z5.object({
  count: z5.number(),
  resetAt: z5.number().optional()
});
function validateStoredValue(data) {
  return StoredValueZ.safeParse(data);
}
function validateFrequencyEntry(data) {
  return FrequencyEntryZ.safeParse(data);
}

// src/index.ts
var RUNTIME_SDK_BUILD = typeof __BUILD_TIMESTAMP__ !== "undefined" ? `${__BUILD_TIMESTAMP__} (${__BUILD_GIT_HASH__})` : "dev";
if (typeof window !== "undefined") {
  console.log(`[Syntro Runtime] Build: ${RUNTIME_SDK_BUILD}`);
  const existing = window.SynOS;
  const registry = (existing == null ? void 0 : existing.appRegistry) || appRegistry;
  window.SynOS = {
    ...existing,
    appRegistry: registry,
    _runtimeBuild: RUNTIME_SDK_BUILD,
    React: React4,
    ReactDOM: { ...ReactDOMClient, createPortal: createPortal2, flushSync }
  };
  registerBuiltinRuntimeModules(registry);
}
export {
  ANIMATION_KEYFRAMES,
  ActivationConfigZ,
  AddClassZ,
  AnchorStateZ,
  AnchorVisibleConditionZ,
  AppRegistry,
  AugmentationZ,
  BadgePositionZ,
  BadgeZ,
  BoundingBoxZ,
  CanvasEvents,
  CanvasRecipeZ,
  ConditionZ,
  ContextManager,
  CooldownActiveConditionZ,
  CtaButtonZ,
  DEFAULT_COOLDOWN,
  DEFAULT_TTL,
  DecisionStrategyZ,
  DismissedConditionZ,
  EVENT_SCHEMA_VERSION,
  EventBus,
  EventCountConditionZ,
  EventFilterZ,
  EventOccurredConditionZ,
  EventSourceZ,
  ExecutorRegistry,
  ExternalStrategyZ,
  FrequencyEntryZ,
  FrequencyLimitConditionZ,
  HighlightStepZ,
  HighlightStyleZ,
  HighlightZ,
  InsertHtmlZ,
  InsertPositionZ,
  MAX_VISIBLE_TOASTS,
  ModalContentZ,
  ModalZ,
  ModelStrategyZ,
  MountWidgetZ,
  NavigateZ,
  NavigationMonitor,
  NormalizedEventZ,
  NotificationToastStack,
  PageContextZ,
  PageHistoryEntryZ,
  PageUrlConditionZ,
  ParallelZ,
  PlacementZ,
  PulseZ,
  RUNTIME_SDK_BUILD,
  RUNTIME_VERSION,
  RemoveClassZ,
  RouteConditionZ,
  RouteFilterZ,
  RuleStrategyZ,
  RuleZ,
  RuntimeContextZ,
  RuntimeProvider,
  SDK_SCHEMA_VERSION,
  SDK_VERSION,
  STATIC_SLOT_STYLES,
  ScoreStrategyZ,
  ScrollBehaviorZ,
  ScrollLogicalPositionZ,
  ScrollToZ,
  SelectorZ,
  SequenceZ,
  SessionContextZ,
  SessionMetricConditionZ,
  SessionMetricTracker,
  SetAttrZ,
  SetStyleZ,
  SetTextZ,
  ShadowCanvasOverlay,
  ShadowRootProvider,
  SmartCanvasApp,
  SmartCanvasController,
  SmartCanvasElement,
  SmartCanvasPortal,
  StandardEvents,
  StateEqualsConditionZ,
  StateStore,
  StoredValueZ,
  Syntro,
  TileCard,
  TileWheel,
  TooltipContentZ,
  TooltipStepZ,
  TooltipTriggerZ,
  TooltipZ,
  TourStepForSchemaZ,
  TourZ,
  ViewportConditionZ,
  ViewportContextZ,
  WaitZ,
  WidgetConfigZ,
  WidgetRegistry,
  appRegistry,
  applyStaticSlotStyles,
  cleanupAppContext,
  runtime as contentRuntime,
  coreActionStepSchemas,
  createActionEngine,
  createAppContext,
  createAppLoader,
  createCanvasConfigFetcher,
  createContextManager,
  createDecisionEngine,
  createEventAccumulator,
  createEventBus,
  createGrowthBookClient,
  createNoopClient,
  createOverlayRecipeFetcher,
  createPostHogClient,
  createPostHogNormalizer,
  createSessionMetricTracker,
  createSmartCanvas,
  createSmartCanvasController,
  createSmartCanvasRuntime,
  createStateStore,
  createSurfaceContainer,
  createSurfaces,
  decodeToken,
  encodeToken,
  evaluate,
  evaluateCondition,
  evaluateRule,
  evaluateRuleStrategy,
  evaluateScoreStrategy,
  evaluateSync,
  executorRegistry,
  getAntiFlickerSnippet,
  getAppIdFromActionKind,
  getAppIdFromWidgetId,
  getExecutor,
  getSlotAnchorId,
  getSlotType,
  getSlotZIndex,
  hasExecutor,
  interpolateTemplate,
  isCoreActionKind,
  matchEvent,
  needsMigration,
  normalizePostHogEvent,
  runtime2 as overlaysRuntime,
  parseVersion,
  playEnterAnimation,
  playExitAnimation,
  registerConfigPredicates,
  registerSmartCanvasElement,
  resolveConfigUri,
  setupAdjacentPositioning,
  setupInlinePositioning,
  shouldNormalizeEvent,
  useDecision,
  useNotifications,
  useNotifyWatcher,
  usePageContext,
  useRuntime,
  useRuntimeContext,
  useRuntimeEvents,
  useRuntimeState,
  useSessionContext,
  useShadowCanvasConfig,
  useShadowRoot,
  useViewportContext,
  validateAction,
  validateActions,
  validateActivationConfig,
  validateCondition,
  validateConfig,
  validateEventFilter,
  validateFrequencyEntry,
  validateNormalizedEvent,
  validateRecipe,
  validateRuntimeContext,
  validateStoredValue,
  validateStrategy,
  widgetRegistry
};
//# sourceMappingURL=index.js.map
