import { j as jsxRuntimeExports, t as useCallbackRef$1, q as useComposedRefs, v as Primitive, x as composeEventHandlers, a4 as Presence, a5 as Slot, a6 as DismissableLayer, s as useControllableState, y as useId, a7 as omit, a8 as castArray, a9 as useTransition, m as ms, c as useTranslation, u as useWidgetsCore, g as useWidgetsLogger, A as useQueryClient, k as createAnchor, aa as animated } from "./root-DkXjXudT.js";
import { r as reactExports } from "./index-_B6UFTan.js";
import { b as adaptivecards, u as useQuery, n as name } from "./groupBy-jfu_DKi7.js";
import { g as getDefaultExportFromCjs, E as tw, aC as isExecuteAction, aD as isOpenUrlAction, aE as isShowCardAction, aF as isSubmitAction, q as tx, G as css, ao as keyframes, o as objectType, z as stringType, ar as literalType, y as arrayType, az as adaptiveCardObjectSchema } from "./index-B_ccougm.js";
import { m as merge } from "./merge-CQYTStJ2.js";
import { t as textToHtml, d as distExports } from "./markdown-CKTxOgOa.js";
import { L as Loader } from "./loader-DPk2fY1u.js";
function ChevronLeftIcon({
  title,
  titleId,
  ...props
}, svgRef) {
  return /* @__PURE__ */ reactExports.createElement("svg", Object.assign({
    xmlns: "http://www.w3.org/2000/svg",
    fill: "none",
    viewBox: "0 0 24 24",
    strokeWidth: 1.5,
    stroke: "currentColor",
    "aria-hidden": "true",
    "data-slot": "icon",
    ref: svgRef,
    "aria-labelledby": titleId
  }, props), title ? /* @__PURE__ */ reactExports.createElement("title", {
    id: titleId
  }, title) : null, /* @__PURE__ */ reactExports.createElement("path", {
    strokeLinecap: "round",
    strokeLinejoin: "round",
    d: "M15.75 19.5 8.25 12l7.5-7.5"
  }));
}
const ForwardRef = /* @__PURE__ */ reactExports.forwardRef(ChevronLeftIcon);
function createContext2(rootComponentName, defaultContext) {
  const Context = reactExports.createContext(defaultContext);
  const Provider = (props) => {
    const { children, ...context } = props;
    const value = reactExports.useMemo(() => context, Object.values(context));
    return /* @__PURE__ */ jsxRuntimeExports.jsx(Context.Provider, { value, children });
  };
  Provider.displayName = rootComponentName + "Provider";
  function useContext2(consumerName) {
    const context = reactExports.useContext(Context);
    if (context) return context;
    if (defaultContext !== void 0) return defaultContext;
    throw new Error(`\`${consumerName}\` must be used within \`${rootComponentName}\``);
  }
  return [Provider, useContext2];
}
function createContextScope(scopeName, createContextScopeDeps = []) {
  let defaultContexts = [];
  function createContext3(rootComponentName, defaultContext) {
    const BaseContext = reactExports.createContext(defaultContext);
    const index = defaultContexts.length;
    defaultContexts = [...defaultContexts, defaultContext];
    const Provider = (props) => {
      var _a;
      const { scope, children, ...context } = props;
      const Context = ((_a = scope == null ? void 0 : scope[scopeName]) == null ? void 0 : _a[index]) || BaseContext;
      const value = reactExports.useMemo(() => context, Object.values(context));
      return /* @__PURE__ */ jsxRuntimeExports.jsx(Context.Provider, { value, children });
    };
    Provider.displayName = rootComponentName + "Provider";
    function useContext2(consumerName, scope) {
      var _a;
      const Context = ((_a = scope == null ? void 0 : scope[scopeName]) == null ? void 0 : _a[index]) || BaseContext;
      const context = reactExports.useContext(Context);
      if (context) return context;
      if (defaultContext !== void 0) return defaultContext;
      throw new Error(`\`${consumerName}\` must be used within \`${rootComponentName}\``);
    }
    return [Provider, useContext2];
  }
  const createScope = () => {
    const scopeContexts = defaultContexts.map((defaultContext) => {
      return reactExports.createContext(defaultContext);
    });
    return function useScope(scope) {
      const contexts = (scope == null ? void 0 : scope[scopeName]) || scopeContexts;
      return reactExports.useMemo(
        () => ({ [`__scope${scopeName}`]: { ...scope, [scopeName]: contexts } }),
        [scope, contexts]
      );
    };
  };
  createScope.scopeName = scopeName;
  return [createContext3, composeContextScopes(createScope, ...createContextScopeDeps)];
}
function composeContextScopes(...scopes) {
  const baseScope = scopes[0];
  if (scopes.length === 1) return baseScope;
  const createScope = () => {
    const scopeHooks = scopes.map((createScope2) => ({
      useScope: createScope2(),
      scopeName: createScope2.scopeName
    }));
    return function useComposedScopes(overrideScopes) {
      const nextScopes = scopeHooks.reduce((nextScopes2, { useScope, scopeName }) => {
        const scopeProps = useScope(overrideScopes);
        const currentScope = scopeProps[`__scope${scopeName}`];
        return { ...nextScopes2, ...currentScope };
      }, {});
      return reactExports.useMemo(() => ({ [`__scope${baseScope.scopeName}`]: nextScopes }), [nextScopes]);
    };
  };
  createScope.scopeName = baseScope.scopeName;
  return createScope;
}
var AUTOFOCUS_ON_MOUNT = "focusScope.autoFocusOnMount";
var AUTOFOCUS_ON_UNMOUNT = "focusScope.autoFocusOnUnmount";
var EVENT_OPTIONS = { bubbles: false, cancelable: true };
var FOCUS_SCOPE_NAME = "FocusScope";
var FocusScope = reactExports.forwardRef((props, forwardedRef) => {
  const {
    loop = false,
    trapped = false,
    onMountAutoFocus: onMountAutoFocusProp,
    onUnmountAutoFocus: onUnmountAutoFocusProp,
    ...scopeProps
  } = props;
  const [container, setContainer] = reactExports.useState(null);
  const onMountAutoFocus = useCallbackRef$1(onMountAutoFocusProp);
  const onUnmountAutoFocus = useCallbackRef$1(onUnmountAutoFocusProp);
  const lastFocusedElementRef = reactExports.useRef(null);
  const composedRefs = useComposedRefs(forwardedRef, (node) => setContainer(node));
  const focusScope = reactExports.useRef({
    paused: false,
    pause() {
      this.paused = true;
    },
    resume() {
      this.paused = false;
    }
  }).current;
  reactExports.useEffect(() => {
    if (trapped) {
      let handleFocusIn2 = function(event) {
        if (focusScope.paused || !container) return;
        const target = event.target;
        if (container.contains(target)) {
          lastFocusedElementRef.current = target;
        } else {
          focus(lastFocusedElementRef.current, { select: true });
        }
      }, handleFocusOut2 = function(event) {
        if (focusScope.paused || !container) return;
        const relatedTarget = event.relatedTarget;
        if (relatedTarget === null) return;
        if (!container.contains(relatedTarget)) {
          focus(lastFocusedElementRef.current, { select: true });
        }
      }, handleMutations2 = function(mutations) {
        const focusedElement = document.activeElement;
        if (focusedElement !== document.body) return;
        for (const mutation of mutations) {
          if (mutation.removedNodes.length > 0) focus(container);
        }
      };
      document.addEventListener("focusin", handleFocusIn2);
      document.addEventListener("focusout", handleFocusOut2);
      const mutationObserver = new MutationObserver(handleMutations2);
      if (container) mutationObserver.observe(container, { childList: true, subtree: true });
      return () => {
        document.removeEventListener("focusin", handleFocusIn2);
        document.removeEventListener("focusout", handleFocusOut2);
        mutationObserver.disconnect();
      };
    }
  }, [trapped, container, focusScope.paused]);
  reactExports.useEffect(() => {
    if (container) {
      focusScopesStack.add(focusScope);
      const previouslyFocusedElement = document.activeElement;
      const hasFocusedCandidate = container.contains(previouslyFocusedElement);
      if (!hasFocusedCandidate) {
        const mountEvent = new CustomEvent(AUTOFOCUS_ON_MOUNT, EVENT_OPTIONS);
        container.addEventListener(AUTOFOCUS_ON_MOUNT, onMountAutoFocus);
        container.dispatchEvent(mountEvent);
        if (!mountEvent.defaultPrevented) {
          focusFirst(removeLinks(getTabbableCandidates(container)), { select: true });
          if (document.activeElement === previouslyFocusedElement) {
            focus(container);
          }
        }
      }
      return () => {
        container.removeEventListener(AUTOFOCUS_ON_MOUNT, onMountAutoFocus);
        setTimeout(() => {
          const unmountEvent = new CustomEvent(AUTOFOCUS_ON_UNMOUNT, EVENT_OPTIONS);
          container.addEventListener(AUTOFOCUS_ON_UNMOUNT, onUnmountAutoFocus);
          container.dispatchEvent(unmountEvent);
          if (!unmountEvent.defaultPrevented) {
            focus(previouslyFocusedElement ?? document.body, { select: true });
          }
          container.removeEventListener(AUTOFOCUS_ON_UNMOUNT, onUnmountAutoFocus);
          focusScopesStack.remove(focusScope);
        }, 0);
      };
    }
  }, [container, onMountAutoFocus, onUnmountAutoFocus, focusScope]);
  const handleKeyDown = reactExports.useCallback(
    (event) => {
      if (!loop && !trapped) return;
      if (focusScope.paused) return;
      const isTabKey = event.key === "Tab" && !event.altKey && !event.ctrlKey && !event.metaKey;
      const focusedElement = document.activeElement;
      if (isTabKey && focusedElement) {
        const container2 = event.currentTarget;
        const [first, last] = getTabbableEdges(container2);
        const hasTabbableElementsInside = first && last;
        if (!hasTabbableElementsInside) {
          if (focusedElement === container2) event.preventDefault();
        } else {
          if (!event.shiftKey && focusedElement === last) {
            event.preventDefault();
            if (loop) focus(first, { select: true });
          } else if (event.shiftKey && focusedElement === first) {
            event.preventDefault();
            if (loop) focus(last, { select: true });
          }
        }
      }
    },
    [loop, trapped, focusScope.paused]
  );
  return /* @__PURE__ */ jsxRuntimeExports.jsx(Primitive.div, { tabIndex: -1, ...scopeProps, ref: composedRefs, onKeyDown: handleKeyDown });
});
FocusScope.displayName = FOCUS_SCOPE_NAME;
function focusFirst(candidates, { select = false } = {}) {
  const previouslyFocusedElement = document.activeElement;
  for (const candidate of candidates) {
    focus(candidate, { select });
    if (document.activeElement !== previouslyFocusedElement) return;
  }
}
function getTabbableEdges(container) {
  const candidates = getTabbableCandidates(container);
  const first = findVisible(candidates, container);
  const last = findVisible(candidates.reverse(), container);
  return [first, last];
}
function getTabbableCandidates(container) {
  const nodes = [];
  const walker = document.createTreeWalker(container, NodeFilter.SHOW_ELEMENT, {
    acceptNode: (node) => {
      const isHiddenInput = node.tagName === "INPUT" && node.type === "hidden";
      if (node.disabled || node.hidden || isHiddenInput) return NodeFilter.FILTER_SKIP;
      return node.tabIndex >= 0 ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
    }
  });
  while (walker.nextNode()) nodes.push(walker.currentNode);
  return nodes;
}
function findVisible(elements, container) {
  for (const element of elements) {
    if (!isHidden(element, { upTo: container })) return element;
  }
}
function isHidden(node, { upTo }) {
  if (getComputedStyle(node).visibility === "hidden") return true;
  while (node) {
    if (upTo !== void 0 && node === upTo) return false;
    if (getComputedStyle(node).display === "none") return true;
    node = node.parentElement;
  }
  return false;
}
function isSelectableInput(element) {
  return element instanceof HTMLInputElement && "select" in element;
}
function focus(element, { select = false } = {}) {
  if (element && element.focus) {
    const previouslyFocusedElement = document.activeElement;
    element.focus({ preventScroll: true });
    if (element !== previouslyFocusedElement && isSelectableInput(element) && select)
      element.select();
  }
}
var focusScopesStack = createFocusScopesStack();
function createFocusScopesStack() {
  let stack = [];
  return {
    add(focusScope) {
      const activeFocusScope = stack[0];
      if (focusScope !== activeFocusScope) {
        activeFocusScope == null ? void 0 : activeFocusScope.pause();
      }
      stack = arrayRemove(stack, focusScope);
      stack.unshift(focusScope);
    },
    remove(focusScope) {
      var _a;
      stack = arrayRemove(stack, focusScope);
      (_a = stack[0]) == null ? void 0 : _a.resume();
    }
  };
}
function arrayRemove(array, item) {
  const updatedArray = [...array];
  const index = updatedArray.indexOf(item);
  if (index !== -1) {
    updatedArray.splice(index, 1);
  }
  return updatedArray;
}
function removeLinks(items) {
  return items.filter((item) => item.tagName !== "A");
}
var count = 0;
function useFocusGuards() {
  reactExports.useEffect(() => {
    const edgeGuards = document.querySelectorAll("[data-radix-focus-guard]");
    document.body.insertAdjacentElement("afterbegin", edgeGuards[0] ?? createFocusGuard());
    document.body.insertAdjacentElement("beforeend", edgeGuards[1] ?? createFocusGuard());
    count++;
    return () => {
      if (count === 1) {
        document.querySelectorAll("[data-radix-focus-guard]").forEach((node) => node.remove());
      }
      count--;
    };
  }, []);
}
function createFocusGuard() {
  const element = document.createElement("span");
  element.setAttribute("data-radix-focus-guard", "");
  element.tabIndex = 0;
  element.style.outline = "none";
  element.style.opacity = "0";
  element.style.position = "fixed";
  element.style.pointerEvents = "none";
  return element;
}
var __assign = function() {
  __assign = Object.assign || function __assign2(t) {
    for (var s, i = 1, n = arguments.length; i < n; i++) {
      s = arguments[i];
      for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
    }
    return t;
  };
  return __assign.apply(this, arguments);
};
function __rest(s, e) {
  var t = {};
  for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
    t[p] = s[p];
  if (s != null && typeof Object.getOwnPropertySymbols === "function")
    for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
      if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
        t[p[i]] = s[p[i]];
    }
  return t;
}
function __spreadArray(to, from, pack) {
  if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
    if (ar || !(i in from)) {
      if (!ar) ar = Array.prototype.slice.call(from, 0, i);
      ar[i] = from[i];
    }
  }
  return to.concat(ar || Array.prototype.slice.call(from));
}
var zeroRightClassName = "right-scroll-bar-position";
var fullWidthClassName = "width-before-scroll-bar";
var noScrollbarsClassName = "with-scroll-bars-hidden";
var removedBarSizeVariable = "--removed-body-scroll-bar-size";
function assignRef(ref, value) {
  if (typeof ref === "function") {
    ref(value);
  } else if (ref) {
    ref.current = value;
  }
  return ref;
}
function useCallbackRef(initialValue, callback) {
  var ref = reactExports.useState(function() {
    return {
      // value
      value: initialValue,
      // last callback
      callback,
      // "memoized" public interface
      facade: {
        get current() {
          return ref.value;
        },
        set current(value) {
          var last = ref.value;
          if (last !== value) {
            ref.value = value;
            ref.callback(value, last);
          }
        }
      }
    };
  })[0];
  ref.callback = callback;
  return ref.facade;
}
var useIsomorphicLayoutEffect = typeof window !== "undefined" ? reactExports.useLayoutEffect : reactExports.useEffect;
var currentValues = /* @__PURE__ */ new WeakMap();
function useMergeRefs(refs, defaultValue) {
  var callbackRef = useCallbackRef(null, function(newValue) {
    return refs.forEach(function(ref) {
      return assignRef(ref, newValue);
    });
  });
  useIsomorphicLayoutEffect(function() {
    var oldValue = currentValues.get(callbackRef);
    if (oldValue) {
      var prevRefs_1 = new Set(oldValue);
      var nextRefs_1 = new Set(refs);
      var current_1 = callbackRef.current;
      prevRefs_1.forEach(function(ref) {
        if (!nextRefs_1.has(ref)) {
          assignRef(ref, null);
        }
      });
      nextRefs_1.forEach(function(ref) {
        if (!prevRefs_1.has(ref)) {
          assignRef(ref, current_1);
        }
      });
    }
    currentValues.set(callbackRef, refs);
  }, [refs]);
  return callbackRef;
}
function ItoI(a) {
  return a;
}
function innerCreateMedium(defaults, middleware) {
  if (middleware === void 0) {
    middleware = ItoI;
  }
  var buffer = [];
  var assigned = false;
  var medium = {
    read: function() {
      if (assigned) {
        throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");
      }
      if (buffer.length) {
        return buffer[buffer.length - 1];
      }
      return defaults;
    },
    useMedium: function(data) {
      var item = middleware(data, assigned);
      buffer.push(item);
      return function() {
        buffer = buffer.filter(function(x) {
          return x !== item;
        });
      };
    },
    assignSyncMedium: function(cb) {
      assigned = true;
      while (buffer.length) {
        var cbs = buffer;
        buffer = [];
        cbs.forEach(cb);
      }
      buffer = {
        push: function(x) {
          return cb(x);
        },
        filter: function() {
          return buffer;
        }
      };
    },
    assignMedium: function(cb) {
      assigned = true;
      var pendingQueue = [];
      if (buffer.length) {
        var cbs = buffer;
        buffer = [];
        cbs.forEach(cb);
        pendingQueue = buffer;
      }
      var executeQueue = function() {
        var cbs2 = pendingQueue;
        pendingQueue = [];
        cbs2.forEach(cb);
      };
      var cycle = function() {
        return Promise.resolve().then(executeQueue);
      };
      cycle();
      buffer = {
        push: function(x) {
          pendingQueue.push(x);
          cycle();
        },
        filter: function(filter) {
          pendingQueue = pendingQueue.filter(filter);
          return buffer;
        }
      };
    }
  };
  return medium;
}
function createSidecarMedium(options) {
  if (options === void 0) {
    options = {};
  }
  var medium = innerCreateMedium(null);
  medium.options = __assign({ async: true, ssr: false }, options);
  return medium;
}
var SideCar$1 = function(_a) {
  var sideCar = _a.sideCar, rest = __rest(_a, ["sideCar"]);
  if (!sideCar) {
    throw new Error("Sidecar: please provide `sideCar` property to import the right car");
  }
  var Target = sideCar.read();
  if (!Target) {
    throw new Error("Sidecar medium not found");
  }
  return reactExports.createElement(Target, __assign({}, rest));
};
SideCar$1.isSideCarExport = true;
function exportSidecar(medium, exported) {
  medium.useMedium(exported);
  return SideCar$1;
}
var effectCar = createSidecarMedium();
var nothing = function() {
  return;
};
var RemoveScroll = reactExports.forwardRef(function(props, parentRef) {
  var ref = reactExports.useRef(null);
  var _a = reactExports.useState({
    onScrollCapture: nothing,
    onWheelCapture: nothing,
    onTouchMoveCapture: nothing
  }), callbacks = _a[0], setCallbacks = _a[1];
  var forwardProps = props.forwardProps, children = props.children, className = props.className, removeScrollBar = props.removeScrollBar, enabled = props.enabled, shards = props.shards, sideCar = props.sideCar, noIsolation = props.noIsolation, inert = props.inert, allowPinchZoom = props.allowPinchZoom, _b = props.as, Container = _b === void 0 ? "div" : _b, gapMode = props.gapMode, rest = __rest(props, ["forwardProps", "children", "className", "removeScrollBar", "enabled", "shards", "sideCar", "noIsolation", "inert", "allowPinchZoom", "as", "gapMode"]);
  var SideCar2 = sideCar;
  var containerRef = useMergeRefs([ref, parentRef]);
  var containerProps = __assign(__assign({}, rest), callbacks);
  return reactExports.createElement(
    reactExports.Fragment,
    null,
    enabled && reactExports.createElement(SideCar2, { sideCar: effectCar, removeScrollBar, shards, noIsolation, inert, setCallbacks, allowPinchZoom: !!allowPinchZoom, lockRef: ref, gapMode }),
    forwardProps ? reactExports.cloneElement(reactExports.Children.only(children), __assign(__assign({}, containerProps), { ref: containerRef })) : reactExports.createElement(Container, __assign({}, containerProps, { className, ref: containerRef }), children)
  );
});
RemoveScroll.defaultProps = {
  enabled: true,
  removeScrollBar: true,
  inert: false
};
RemoveScroll.classNames = {
  fullWidth: fullWidthClassName,
  zeroRight: zeroRightClassName
};
var getNonce = function() {
  if (typeof __webpack_nonce__ !== "undefined") {
    return __webpack_nonce__;
  }
  return void 0;
};
function makeStyleTag() {
  if (!document)
    return null;
  var tag = document.createElement("style");
  tag.type = "text/css";
  var nonce = getNonce();
  if (nonce) {
    tag.setAttribute("nonce", nonce);
  }
  return tag;
}
function injectStyles(tag, css2) {
  if (tag.styleSheet) {
    tag.styleSheet.cssText = css2;
  } else {
    tag.appendChild(document.createTextNode(css2));
  }
}
function insertStyleTag(tag) {
  var head = document.head || document.getElementsByTagName("head")[0];
  head.appendChild(tag);
}
var stylesheetSingleton = function() {
  var counter = 0;
  var stylesheet = null;
  return {
    add: function(style) {
      if (counter == 0) {
        if (stylesheet = makeStyleTag()) {
          injectStyles(stylesheet, style);
          insertStyleTag(stylesheet);
        }
      }
      counter++;
    },
    remove: function() {
      counter--;
      if (!counter && stylesheet) {
        stylesheet.parentNode && stylesheet.parentNode.removeChild(stylesheet);
        stylesheet = null;
      }
    }
  };
};
var styleHookSingleton = function() {
  var sheet = stylesheetSingleton();
  return function(styles, isDynamic) {
    reactExports.useEffect(function() {
      sheet.add(styles);
      return function() {
        sheet.remove();
      };
    }, [styles && isDynamic]);
  };
};
var styleSingleton = function() {
  var useStyle = styleHookSingleton();
  var Sheet = function(_a) {
    var styles = _a.styles, dynamic = _a.dynamic;
    useStyle(styles, dynamic);
    return null;
  };
  return Sheet;
};
var zeroGap = {
  left: 0,
  top: 0,
  right: 0,
  gap: 0
};
var parse = function(x) {
  return parseInt(x || "", 10) || 0;
};
var getOffset = function(gapMode) {
  var cs = window.getComputedStyle(document.body);
  var left = cs[gapMode === "padding" ? "paddingLeft" : "marginLeft"];
  var top = cs[gapMode === "padding" ? "paddingTop" : "marginTop"];
  var right = cs[gapMode === "padding" ? "paddingRight" : "marginRight"];
  return [parse(left), parse(top), parse(right)];
};
var getGapWidth = function(gapMode) {
  if (gapMode === void 0) {
    gapMode = "margin";
  }
  if (typeof window === "undefined") {
    return zeroGap;
  }
  var offsets = getOffset(gapMode);
  var documentWidth = document.documentElement.clientWidth;
  var windowWidth = window.innerWidth;
  return {
    left: offsets[0],
    top: offsets[1],
    right: offsets[2],
    gap: Math.max(0, windowWidth - documentWidth + offsets[2] - offsets[0])
  };
};
var Style = styleSingleton();
var lockAttribute = "data-scroll-locked";
var getStyles = function(_a, allowRelative, gapMode, important) {
  var left = _a.left, top = _a.top, right = _a.right, gap = _a.gap;
  if (gapMode === void 0) {
    gapMode = "margin";
  }
  return "\n  .".concat(noScrollbarsClassName, " {\n   overflow: hidden ").concat(important, ";\n   padding-right: ").concat(gap, "px ").concat(important, ";\n  }\n  body[").concat(lockAttribute, "] {\n    overflow: hidden ").concat(important, ";\n    overscroll-behavior: contain;\n    ").concat([
    allowRelative && "position: relative ".concat(important, ";"),
    gapMode === "margin" && "\n    padding-left: ".concat(left, "px;\n    padding-top: ").concat(top, "px;\n    padding-right: ").concat(right, "px;\n    margin-left:0;\n    margin-top:0;\n    margin-right: ").concat(gap, "px ").concat(important, ";\n    "),
    gapMode === "padding" && "padding-right: ".concat(gap, "px ").concat(important, ";")
  ].filter(Boolean).join(""), "\n  }\n  \n  .").concat(zeroRightClassName, " {\n    right: ").concat(gap, "px ").concat(important, ";\n  }\n  \n  .").concat(fullWidthClassName, " {\n    margin-right: ").concat(gap, "px ").concat(important, ";\n  }\n  \n  .").concat(zeroRightClassName, " .").concat(zeroRightClassName, " {\n    right: 0 ").concat(important, ";\n  }\n  \n  .").concat(fullWidthClassName, " .").concat(fullWidthClassName, " {\n    margin-right: 0 ").concat(important, ";\n  }\n  \n  body[").concat(lockAttribute, "] {\n    ").concat(removedBarSizeVariable, ": ").concat(gap, "px;\n  }\n");
};
var getCurrentUseCounter = function() {
  var counter = parseInt(document.body.getAttribute(lockAttribute) || "0", 10);
  return isFinite(counter) ? counter : 0;
};
var useLockAttribute = function() {
  reactExports.useEffect(function() {
    document.body.setAttribute(lockAttribute, (getCurrentUseCounter() + 1).toString());
    return function() {
      var newCounter = getCurrentUseCounter() - 1;
      if (newCounter <= 0) {
        document.body.removeAttribute(lockAttribute);
      } else {
        document.body.setAttribute(lockAttribute, newCounter.toString());
      }
    };
  }, []);
};
var RemoveScrollBar = function(_a) {
  var noRelative = _a.noRelative, noImportant = _a.noImportant, _b = _a.gapMode, gapMode = _b === void 0 ? "margin" : _b;
  useLockAttribute();
  var gap = reactExports.useMemo(function() {
    return getGapWidth(gapMode);
  }, [gapMode]);
  return reactExports.createElement(Style, { styles: getStyles(gap, !noRelative, gapMode, !noImportant ? "!important" : "") });
};
var passiveSupported = false;
if (typeof window !== "undefined") {
  try {
    var options = Object.defineProperty({}, "passive", {
      get: function() {
        passiveSupported = true;
        return true;
      }
    });
    window.addEventListener("test", options, options);
    window.removeEventListener("test", options, options);
  } catch (err) {
    passiveSupported = false;
  }
}
var nonPassive = passiveSupported ? { passive: false } : false;
var alwaysContainsScroll = function(node) {
  return node.tagName === "TEXTAREA";
};
var elementCanBeScrolled = function(node, overflow) {
  if (!(node instanceof Element)) {
    return false;
  }
  var styles = window.getComputedStyle(node);
  return (
    // not-not-scrollable
    styles[overflow] !== "hidden" && // contains scroll inside self
    !(styles.overflowY === styles.overflowX && !alwaysContainsScroll(node) && styles[overflow] === "visible")
  );
};
var elementCouldBeVScrolled = function(node) {
  return elementCanBeScrolled(node, "overflowY");
};
var elementCouldBeHScrolled = function(node) {
  return elementCanBeScrolled(node, "overflowX");
};
var locationCouldBeScrolled = function(axis, node) {
  var ownerDocument = node.ownerDocument;
  var current = node;
  do {
    if (typeof ShadowRoot !== "undefined" && current instanceof ShadowRoot) {
      current = current.host;
    }
    var isScrollable = elementCouldBeScrolled(axis, current);
    if (isScrollable) {
      var _a = getScrollVariables(axis, current), scrollHeight = _a[1], clientHeight = _a[2];
      if (scrollHeight > clientHeight) {
        return true;
      }
    }
    current = current.parentNode;
  } while (current && current !== ownerDocument.body);
  return false;
};
var getVScrollVariables = function(_a) {
  var scrollTop = _a.scrollTop, scrollHeight = _a.scrollHeight, clientHeight = _a.clientHeight;
  return [
    scrollTop,
    scrollHeight,
    clientHeight
  ];
};
var getHScrollVariables = function(_a) {
  var scrollLeft = _a.scrollLeft, scrollWidth = _a.scrollWidth, clientWidth = _a.clientWidth;
  return [
    scrollLeft,
    scrollWidth,
    clientWidth
  ];
};
var elementCouldBeScrolled = function(axis, node) {
  return axis === "v" ? elementCouldBeVScrolled(node) : elementCouldBeHScrolled(node);
};
var getScrollVariables = function(axis, node) {
  return axis === "v" ? getVScrollVariables(node) : getHScrollVariables(node);
};
var getDirectionFactor = function(axis, direction) {
  return axis === "h" && direction === "rtl" ? -1 : 1;
};
var handleScroll = function(axis, endTarget, event, sourceDelta, noOverscroll) {
  var directionFactor = getDirectionFactor(axis, window.getComputedStyle(endTarget).direction);
  var delta = directionFactor * sourceDelta;
  var target = event.target;
  var targetInLock = endTarget.contains(target);
  var shouldCancelScroll = false;
  var isDeltaPositive = delta > 0;
  var availableScroll = 0;
  var availableScrollTop = 0;
  do {
    var _a = getScrollVariables(axis, target), position = _a[0], scroll_1 = _a[1], capacity = _a[2];
    var elementScroll = scroll_1 - capacity - directionFactor * position;
    if (position || elementScroll) {
      if (elementCouldBeScrolled(axis, target)) {
        availableScroll += elementScroll;
        availableScrollTop += position;
      }
    }
    if (target instanceof ShadowRoot) {
      target = target.host;
    } else {
      target = target.parentNode;
    }
  } while (
    // portaled content
    !targetInLock && target !== document.body || // self content
    targetInLock && (endTarget.contains(target) || endTarget === target)
  );
  if (isDeltaPositive && (Math.abs(availableScroll) < 1 || !noOverscroll)) {
    shouldCancelScroll = true;
  } else if (!isDeltaPositive && (Math.abs(availableScrollTop) < 1 || !noOverscroll)) {
    shouldCancelScroll = true;
  }
  return shouldCancelScroll;
};
var getTouchXY = function(event) {
  return "changedTouches" in event ? [event.changedTouches[0].clientX, event.changedTouches[0].clientY] : [0, 0];
};
var getDeltaXY = function(event) {
  return [event.deltaX, event.deltaY];
};
var extractRef = function(ref) {
  return ref && "current" in ref ? ref.current : ref;
};
var deltaCompare = function(x, y) {
  return x[0] === y[0] && x[1] === y[1];
};
var generateStyle = function(id) {
  return "\n  .block-interactivity-".concat(id, " {pointer-events: none;}\n  .allow-interactivity-").concat(id, " {pointer-events: all;}\n");
};
var idCounter = 0;
var lockStack = [];
function RemoveScrollSideCar(props) {
  var shouldPreventQueue = reactExports.useRef([]);
  var touchStartRef = reactExports.useRef([0, 0]);
  var activeAxis = reactExports.useRef();
  var id = reactExports.useState(idCounter++)[0];
  var Style2 = reactExports.useState(styleSingleton)[0];
  var lastProps = reactExports.useRef(props);
  reactExports.useEffect(function() {
    lastProps.current = props;
  }, [props]);
  reactExports.useEffect(function() {
    if (props.inert) {
      document.body.classList.add("block-interactivity-".concat(id));
      var allow_1 = __spreadArray([props.lockRef.current], (props.shards || []).map(extractRef), true).filter(Boolean);
      allow_1.forEach(function(el) {
        return el.classList.add("allow-interactivity-".concat(id));
      });
      return function() {
        document.body.classList.remove("block-interactivity-".concat(id));
        allow_1.forEach(function(el) {
          return el.classList.remove("allow-interactivity-".concat(id));
        });
      };
    }
    return;
  }, [props.inert, props.lockRef.current, props.shards]);
  var shouldCancelEvent = reactExports.useCallback(function(event, parent) {
    if ("touches" in event && event.touches.length === 2 || event.type === "wheel" && event.ctrlKey) {
      return !lastProps.current.allowPinchZoom;
    }
    var touch = getTouchXY(event);
    var touchStart = touchStartRef.current;
    var deltaX = "deltaX" in event ? event.deltaX : touchStart[0] - touch[0];
    var deltaY = "deltaY" in event ? event.deltaY : touchStart[1] - touch[1];
    var currentAxis;
    var target = event.target;
    var moveDirection = Math.abs(deltaX) > Math.abs(deltaY) ? "h" : "v";
    if ("touches" in event && moveDirection === "h" && target.type === "range") {
      return false;
    }
    var canBeScrolledInMainDirection = locationCouldBeScrolled(moveDirection, target);
    if (!canBeScrolledInMainDirection) {
      return true;
    }
    if (canBeScrolledInMainDirection) {
      currentAxis = moveDirection;
    } else {
      currentAxis = moveDirection === "v" ? "h" : "v";
      canBeScrolledInMainDirection = locationCouldBeScrolled(moveDirection, target);
    }
    if (!canBeScrolledInMainDirection) {
      return false;
    }
    if (!activeAxis.current && "changedTouches" in event && (deltaX || deltaY)) {
      activeAxis.current = currentAxis;
    }
    if (!currentAxis) {
      return true;
    }
    var cancelingAxis = activeAxis.current || currentAxis;
    return handleScroll(cancelingAxis, parent, event, cancelingAxis === "h" ? deltaX : deltaY, true);
  }, []);
  var shouldPrevent = reactExports.useCallback(function(_event) {
    var event = _event;
    if (!lockStack.length || lockStack[lockStack.length - 1] !== Style2) {
      return;
    }
    var delta = "deltaY" in event ? getDeltaXY(event) : getTouchXY(event);
    var sourceEvent = shouldPreventQueue.current.filter(function(e) {
      return e.name === event.type && (e.target === event.target || event.target === e.shadowParent) && deltaCompare(e.delta, delta);
    })[0];
    if (sourceEvent && sourceEvent.should) {
      if (event.cancelable) {
        event.preventDefault();
      }
      return;
    }
    if (!sourceEvent) {
      var shardNodes = (lastProps.current.shards || []).map(extractRef).filter(Boolean).filter(function(node) {
        return node.contains(event.target);
      });
      var shouldStop = shardNodes.length > 0 ? shouldCancelEvent(event, shardNodes[0]) : !lastProps.current.noIsolation;
      if (shouldStop) {
        if (event.cancelable) {
          event.preventDefault();
        }
      }
    }
  }, []);
  var shouldCancel = reactExports.useCallback(function(name2, delta, target, should) {
    var event = { name: name2, delta, target, should, shadowParent: getOutermostShadowParent(target) };
    shouldPreventQueue.current.push(event);
    setTimeout(function() {
      shouldPreventQueue.current = shouldPreventQueue.current.filter(function(e) {
        return e !== event;
      });
    }, 1);
  }, []);
  var scrollTouchStart = reactExports.useCallback(function(event) {
    touchStartRef.current = getTouchXY(event);
    activeAxis.current = void 0;
  }, []);
  var scrollWheel = reactExports.useCallback(function(event) {
    shouldCancel(event.type, getDeltaXY(event), event.target, shouldCancelEvent(event, props.lockRef.current));
  }, []);
  var scrollTouchMove = reactExports.useCallback(function(event) {
    shouldCancel(event.type, getTouchXY(event), event.target, shouldCancelEvent(event, props.lockRef.current));
  }, []);
  reactExports.useEffect(function() {
    lockStack.push(Style2);
    props.setCallbacks({
      onScrollCapture: scrollWheel,
      onWheelCapture: scrollWheel,
      onTouchMoveCapture: scrollTouchMove
    });
    document.addEventListener("wheel", shouldPrevent, nonPassive);
    document.addEventListener("touchmove", shouldPrevent, nonPassive);
    document.addEventListener("touchstart", scrollTouchStart, nonPassive);
    return function() {
      lockStack = lockStack.filter(function(inst) {
        return inst !== Style2;
      });
      document.removeEventListener("wheel", shouldPrevent, nonPassive);
      document.removeEventListener("touchmove", shouldPrevent, nonPassive);
      document.removeEventListener("touchstart", scrollTouchStart, nonPassive);
    };
  }, []);
  var removeScrollBar = props.removeScrollBar, inert = props.inert;
  return reactExports.createElement(
    reactExports.Fragment,
    null,
    inert ? reactExports.createElement(Style2, { styles: generateStyle(id) }) : null,
    removeScrollBar ? reactExports.createElement(RemoveScrollBar, { gapMode: props.gapMode }) : null
  );
}
function getOutermostShadowParent(node) {
  var shadowParent = null;
  while (node !== null) {
    if (node instanceof ShadowRoot) {
      shadowParent = node.host;
      node = node.host;
    }
    node = node.parentNode;
  }
  return shadowParent;
}
const SideCar = exportSidecar(effectCar, RemoveScrollSideCar);
var ReactRemoveScroll = reactExports.forwardRef(function(props, ref) {
  return reactExports.createElement(RemoveScroll, __assign({}, props, { ref, sideCar: SideCar }));
});
ReactRemoveScroll.classNames = RemoveScroll.classNames;
var getDefaultParent = function(originalTarget) {
  if (typeof document === "undefined") {
    return null;
  }
  var sampleTarget = Array.isArray(originalTarget) ? originalTarget[0] : originalTarget;
  return sampleTarget.ownerDocument.body;
};
var counterMap = /* @__PURE__ */ new WeakMap();
var uncontrolledNodes = /* @__PURE__ */ new WeakMap();
var markerMap = {};
var lockCount = 0;
var unwrapHost = function(node) {
  return node && (node.host || unwrapHost(node.parentNode));
};
var correctTargets = function(parent, targets) {
  return targets.map(function(target) {
    if (parent.contains(target)) {
      return target;
    }
    var correctedTarget = unwrapHost(target);
    if (correctedTarget && parent.contains(correctedTarget)) {
      return correctedTarget;
    }
    console.error("aria-hidden", target, "in not contained inside", parent, ". Doing nothing");
    return null;
  }).filter(function(x) {
    return Boolean(x);
  });
};
var applyAttributeToOthers = function(originalTarget, parentNode, markerName, controlAttribute) {
  var targets = correctTargets(parentNode, Array.isArray(originalTarget) ? originalTarget : [originalTarget]);
  if (!markerMap[markerName]) {
    markerMap[markerName] = /* @__PURE__ */ new WeakMap();
  }
  var markerCounter = markerMap[markerName];
  var hiddenNodes = [];
  var elementsToKeep = /* @__PURE__ */ new Set();
  var elementsToStop = new Set(targets);
  var keep = function(el) {
    if (!el || elementsToKeep.has(el)) {
      return;
    }
    elementsToKeep.add(el);
    keep(el.parentNode);
  };
  targets.forEach(keep);
  var deep = function(parent) {
    if (!parent || elementsToStop.has(parent)) {
      return;
    }
    Array.prototype.forEach.call(parent.children, function(node) {
      if (elementsToKeep.has(node)) {
        deep(node);
      } else {
        try {
          var attr = node.getAttribute(controlAttribute);
          var alreadyHidden = attr !== null && attr !== "false";
          var counterValue = (counterMap.get(node) || 0) + 1;
          var markerValue = (markerCounter.get(node) || 0) + 1;
          counterMap.set(node, counterValue);
          markerCounter.set(node, markerValue);
          hiddenNodes.push(node);
          if (counterValue === 1 && alreadyHidden) {
            uncontrolledNodes.set(node, true);
          }
          if (markerValue === 1) {
            node.setAttribute(markerName, "true");
          }
          if (!alreadyHidden) {
            node.setAttribute(controlAttribute, "true");
          }
        } catch (e) {
          console.error("aria-hidden: cannot operate on ", node, e);
        }
      }
    });
  };
  deep(parentNode);
  elementsToKeep.clear();
  lockCount++;
  return function() {
    hiddenNodes.forEach(function(node) {
      var counterValue = counterMap.get(node) - 1;
      var markerValue = markerCounter.get(node) - 1;
      counterMap.set(node, counterValue);
      markerCounter.set(node, markerValue);
      if (!counterValue) {
        if (!uncontrolledNodes.has(node)) {
          node.removeAttribute(controlAttribute);
        }
        uncontrolledNodes.delete(node);
      }
      if (!markerValue) {
        node.removeAttribute(markerName);
      }
    });
    lockCount--;
    if (!lockCount) {
      counterMap = /* @__PURE__ */ new WeakMap();
      counterMap = /* @__PURE__ */ new WeakMap();
      uncontrolledNodes = /* @__PURE__ */ new WeakMap();
      markerMap = {};
    }
  };
};
var hideOthers = function(originalTarget, parentNode, markerName) {
  if (markerName === void 0) {
    markerName = "data-aria-hidden";
  }
  var targets = Array.from(Array.isArray(originalTarget) ? originalTarget : [originalTarget]);
  var activeParentNode = getDefaultParent(originalTarget);
  if (!activeParentNode) {
    return function() {
      return null;
    };
  }
  targets.push.apply(targets, Array.from(activeParentNode.querySelectorAll("[aria-live]")));
  return applyAttributeToOthers(targets, activeParentNode, markerName, "aria-hidden");
};
var DIALOG_NAME = "Dialog";
var [createDialogContext, createDialogScope] = createContextScope(DIALOG_NAME);
var [DialogProvider, useDialogContext] = createDialogContext(DIALOG_NAME);
var Dialog = (props) => {
  const {
    __scopeDialog,
    children,
    open: openProp,
    defaultOpen,
    onOpenChange,
    modal = true
  } = props;
  const triggerRef = reactExports.useRef(null);
  const contentRef = reactExports.useRef(null);
  const [open = false, setOpen] = useControllableState({
    prop: openProp,
    defaultProp: defaultOpen,
    onChange: onOpenChange
  });
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    DialogProvider,
    {
      scope: __scopeDialog,
      triggerRef,
      contentRef,
      contentId: useId(),
      titleId: useId(),
      descriptionId: useId(),
      open,
      onOpenChange: setOpen,
      onOpenToggle: reactExports.useCallback(() => setOpen((prevOpen) => !prevOpen), [setOpen]),
      modal,
      children
    }
  );
};
Dialog.displayName = DIALOG_NAME;
var TRIGGER_NAME = "DialogTrigger";
var DialogTrigger = reactExports.forwardRef(
  (props, forwardedRef) => {
    const { __scopeDialog, ...triggerProps } = props;
    const context = useDialogContext(TRIGGER_NAME, __scopeDialog);
    const composedTriggerRef = useComposedRefs(forwardedRef, context.triggerRef);
    return /* @__PURE__ */ jsxRuntimeExports.jsx(
      Primitive.button,
      {
        type: "button",
        "aria-haspopup": "dialog",
        "aria-expanded": context.open,
        "aria-controls": context.contentId,
        "data-state": getState(context.open),
        ...triggerProps,
        ref: composedTriggerRef,
        onClick: composeEventHandlers(props.onClick, context.onOpenToggle)
      }
    );
  }
);
DialogTrigger.displayName = TRIGGER_NAME;
var PORTAL_NAME = "DialogPortal";
var [PortalProvider, usePortalContext] = createDialogContext(PORTAL_NAME, {
  forceMount: void 0
});
var OVERLAY_NAME = "DialogOverlay";
var DialogOverlay = reactExports.forwardRef(
  (props, forwardedRef) => {
    const portalContext = usePortalContext(OVERLAY_NAME, props.__scopeDialog);
    const { forceMount = portalContext.forceMount, ...overlayProps } = props;
    const context = useDialogContext(OVERLAY_NAME, props.__scopeDialog);
    return context.modal ? /* @__PURE__ */ jsxRuntimeExports.jsx(Presence, { present: forceMount || context.open, children: /* @__PURE__ */ jsxRuntimeExports.jsx(DialogOverlayImpl, { ...overlayProps, ref: forwardedRef }) }) : null;
  }
);
DialogOverlay.displayName = OVERLAY_NAME;
var DialogOverlayImpl = reactExports.forwardRef(
  (props, forwardedRef) => {
    const { __scopeDialog, ...overlayProps } = props;
    const context = useDialogContext(OVERLAY_NAME, __scopeDialog);
    return (
      // Make sure `Content` is scrollable even when it doesn't live inside `RemoveScroll`
      // ie. when `Overlay` and `Content` are siblings
      /* @__PURE__ */ jsxRuntimeExports.jsx(ReactRemoveScroll, { as: Slot, allowPinchZoom: true, shards: [context.contentRef], children: /* @__PURE__ */ jsxRuntimeExports.jsx(
        Primitive.div,
        {
          "data-state": getState(context.open),
          ...overlayProps,
          ref: forwardedRef,
          style: { pointerEvents: "auto", ...overlayProps.style }
        }
      ) })
    );
  }
);
var CONTENT_NAME = "DialogContent";
var DialogContent = reactExports.forwardRef(
  (props, forwardedRef) => {
    const portalContext = usePortalContext(CONTENT_NAME, props.__scopeDialog);
    const { forceMount = portalContext.forceMount, ...contentProps } = props;
    const context = useDialogContext(CONTENT_NAME, props.__scopeDialog);
    return /* @__PURE__ */ jsxRuntimeExports.jsx(Presence, { present: forceMount || context.open, children: context.modal ? /* @__PURE__ */ jsxRuntimeExports.jsx(DialogContentModal, { ...contentProps, ref: forwardedRef }) : /* @__PURE__ */ jsxRuntimeExports.jsx(DialogContentNonModal, { ...contentProps, ref: forwardedRef }) });
  }
);
DialogContent.displayName = CONTENT_NAME;
var DialogContentModal = reactExports.forwardRef(
  (props, forwardedRef) => {
    const context = useDialogContext(CONTENT_NAME, props.__scopeDialog);
    const contentRef = reactExports.useRef(null);
    const composedRefs = useComposedRefs(forwardedRef, context.contentRef, contentRef);
    reactExports.useEffect(() => {
      const content = contentRef.current;
      if (content) return hideOthers(content);
    }, []);
    return /* @__PURE__ */ jsxRuntimeExports.jsx(
      DialogContentImpl,
      {
        ...props,
        ref: composedRefs,
        trapFocus: context.open,
        disableOutsidePointerEvents: true,
        onCloseAutoFocus: composeEventHandlers(props.onCloseAutoFocus, (event) => {
          var _a;
          event.preventDefault();
          (_a = context.triggerRef.current) == null ? void 0 : _a.focus();
        }),
        onPointerDownOutside: composeEventHandlers(props.onPointerDownOutside, (event) => {
          const originalEvent = event.detail.originalEvent;
          const ctrlLeftClick = originalEvent.button === 0 && originalEvent.ctrlKey === true;
          const isRightClick = originalEvent.button === 2 || ctrlLeftClick;
          if (isRightClick) event.preventDefault();
        }),
        onFocusOutside: composeEventHandlers(
          props.onFocusOutside,
          (event) => event.preventDefault()
        )
      }
    );
  }
);
var DialogContentNonModal = reactExports.forwardRef(
  (props, forwardedRef) => {
    const context = useDialogContext(CONTENT_NAME, props.__scopeDialog);
    const hasInteractedOutsideRef = reactExports.useRef(false);
    const hasPointerDownOutsideRef = reactExports.useRef(false);
    return /* @__PURE__ */ jsxRuntimeExports.jsx(
      DialogContentImpl,
      {
        ...props,
        ref: forwardedRef,
        trapFocus: false,
        disableOutsidePointerEvents: false,
        onCloseAutoFocus: (event) => {
          var _a, _b;
          (_a = props.onCloseAutoFocus) == null ? void 0 : _a.call(props, event);
          if (!event.defaultPrevented) {
            if (!hasInteractedOutsideRef.current) (_b = context.triggerRef.current) == null ? void 0 : _b.focus();
            event.preventDefault();
          }
          hasInteractedOutsideRef.current = false;
          hasPointerDownOutsideRef.current = false;
        },
        onInteractOutside: (event) => {
          var _a, _b;
          (_a = props.onInteractOutside) == null ? void 0 : _a.call(props, event);
          if (!event.defaultPrevented) {
            hasInteractedOutsideRef.current = true;
            if (event.detail.originalEvent.type === "pointerdown") {
              hasPointerDownOutsideRef.current = true;
            }
          }
          const target = event.target;
          const targetIsTrigger = (_b = context.triggerRef.current) == null ? void 0 : _b.contains(target);
          if (targetIsTrigger) event.preventDefault();
          if (event.detail.originalEvent.type === "focusin" && hasPointerDownOutsideRef.current) {
            event.preventDefault();
          }
        }
      }
    );
  }
);
var DialogContentImpl = reactExports.forwardRef(
  (props, forwardedRef) => {
    const { __scopeDialog, trapFocus, onOpenAutoFocus, onCloseAutoFocus, ...contentProps } = props;
    const context = useDialogContext(CONTENT_NAME, __scopeDialog);
    const contentRef = reactExports.useRef(null);
    const composedRefs = useComposedRefs(forwardedRef, contentRef);
    useFocusGuards();
    return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
      /* @__PURE__ */ jsxRuntimeExports.jsx(
        FocusScope,
        {
          asChild: true,
          loop: true,
          trapped: trapFocus,
          onMountAutoFocus: onOpenAutoFocus,
          onUnmountAutoFocus: onCloseAutoFocus,
          children: /* @__PURE__ */ jsxRuntimeExports.jsx(
            DismissableLayer,
            {
              role: "dialog",
              id: context.contentId,
              "aria-describedby": context.descriptionId,
              "aria-labelledby": context.titleId,
              "data-state": getState(context.open),
              ...contentProps,
              ref: composedRefs,
              onDismiss: () => context.onOpenChange(false)
            }
          )
        }
      ),
      /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx(TitleWarning, { titleId: context.titleId }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(DescriptionWarning, { contentRef, descriptionId: context.descriptionId })
      ] })
    ] });
  }
);
var TITLE_NAME = "DialogTitle";
var DialogTitle = reactExports.forwardRef(
  (props, forwardedRef) => {
    const { __scopeDialog, ...titleProps } = props;
    const context = useDialogContext(TITLE_NAME, __scopeDialog);
    return /* @__PURE__ */ jsxRuntimeExports.jsx(Primitive.h2, { id: context.titleId, ...titleProps, ref: forwardedRef });
  }
);
DialogTitle.displayName = TITLE_NAME;
var DESCRIPTION_NAME = "DialogDescription";
var DialogDescription = reactExports.forwardRef(
  (props, forwardedRef) => {
    const { __scopeDialog, ...descriptionProps } = props;
    const context = useDialogContext(DESCRIPTION_NAME, __scopeDialog);
    return /* @__PURE__ */ jsxRuntimeExports.jsx(Primitive.p, { id: context.descriptionId, ...descriptionProps, ref: forwardedRef });
  }
);
DialogDescription.displayName = DESCRIPTION_NAME;
var CLOSE_NAME = "DialogClose";
var DialogClose = reactExports.forwardRef(
  (props, forwardedRef) => {
    const { __scopeDialog, ...closeProps } = props;
    const context = useDialogContext(CLOSE_NAME, __scopeDialog);
    return /* @__PURE__ */ jsxRuntimeExports.jsx(
      Primitive.button,
      {
        type: "button",
        ...closeProps,
        ref: forwardedRef,
        onClick: composeEventHandlers(props.onClick, () => context.onOpenChange(false))
      }
    );
  }
);
DialogClose.displayName = CLOSE_NAME;
function getState(open) {
  return open ? "open" : "closed";
}
var TITLE_WARNING_NAME = "DialogTitleWarning";
var [WarningProvider, useWarningContext] = createContext2(TITLE_WARNING_NAME, {
  contentName: CONTENT_NAME,
  titleName: TITLE_NAME,
  docsSlug: "dialog"
});
var TitleWarning = ({ titleId }) => {
  const titleWarningContext = useWarningContext(TITLE_WARNING_NAME);
  const MESSAGE = `\`${titleWarningContext.contentName}\` requires a \`${titleWarningContext.titleName}\` for the component to be accessible for screen reader users.

If you want to hide the \`${titleWarningContext.titleName}\`, you can wrap it with our VisuallyHidden component.

For more information, see https://radix-ui.com/primitives/docs/components/${titleWarningContext.docsSlug}`;
  reactExports.useEffect(() => {
    if (titleId) {
      const hasTitle = document.getElementById(titleId);
      if (!hasTitle) console.error(MESSAGE);
    }
  }, [MESSAGE, titleId]);
  return null;
};
var DESCRIPTION_WARNING_NAME = "DialogDescriptionWarning";
var DescriptionWarning = ({ contentRef, descriptionId }) => {
  const descriptionWarningContext = useWarningContext(DESCRIPTION_WARNING_NAME);
  const MESSAGE = `Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${descriptionWarningContext.contentName}}.`;
  reactExports.useEffect(() => {
    var _a;
    const describedById = (_a = contentRef.current) == null ? void 0 : _a.getAttribute("aria-describedby");
    if (descriptionId && describedById) {
      const hasDescription = document.getElementById(descriptionId);
      if (!hasDescription) console.warn(MESSAGE);
    }
  }, [MESSAGE, contentRef, descriptionId]);
  return null;
};
var Root = Dialog;
var Content = DialogContent;
var Close = DialogClose;
var parseUnit$1 = function parseUnit(str, out) {
  if (!out)
    out = [0, ""];
  str = String(str);
  var num = parseFloat(str, 10);
  out[0] = num;
  out[1] = str.match(/[\d.\-\+]*\s*(.*)/)[1] || "";
  return out;
};
var parseUnit2 = parseUnit$1;
var browser = toPX;
var PIXELS_PER_INCH = getSizeBrutal("in", document.body);
function getPropertyInPX(element, prop) {
  var parts = parseUnit2(getComputedStyle(element).getPropertyValue(prop));
  return parts[0] * toPX(parts[1], element);
}
function getSizeBrutal(unit, element) {
  var testDIV = document.createElement("div");
  testDIV.style["height"] = "128" + unit;
  element.appendChild(testDIV);
  var size = getPropertyInPX(testDIV, "height") / 128;
  element.removeChild(testDIV);
  return size;
}
function toPX(str, element) {
  if (!str) return null;
  element = element || document.body;
  str = (str + "" || "px").trim().toLowerCase();
  if (element === window || element === document) {
    element = document.body;
  }
  switch (str) {
    case "%":
      return element.clientHeight / 100;
    case "ch":
    case "ex":
      return getSizeBrutal(str, element);
    case "em":
      return getPropertyInPX(element, "font-size");
    case "rem":
      return getPropertyInPX(document.body, "font-size");
    case "vw":
      return window.innerWidth / 100;
    case "vh":
      return window.innerHeight / 100;
    case "vmin":
      return Math.min(window.innerWidth, window.innerHeight) / 100;
    case "vmax":
      return Math.max(window.innerWidth, window.innerHeight) / 100;
    case "in":
      return PIXELS_PER_INCH;
    case "cm":
      return PIXELS_PER_INCH / 2.54;
    case "mm":
      return PIXELS_PER_INCH / 25.4;
    case "pt":
      return PIXELS_PER_INCH / 72;
    case "pc":
      return PIXELS_PER_INCH / 6;
    case "px":
      return 1;
  }
  var parts = parseUnit2(str);
  if (!isNaN(parts[0]) && parts[1]) {
    var px = toPX(parts[1], element);
    return typeof px === "number" ? parts[0] * px : null;
  }
  return null;
}
const toPx = /* @__PURE__ */ getDefaultExportFromCjs(browser);
const defaultProps = () => ({
  config: {
    duration: ms(String(tw.theme("transitionDuration.DEFAULT")))
  }
});
function useSimpleTransition(data, props) {
  const options = merge({}, defaultProps(), omit(props, "from", "to"), {
    from: merge({}, ...castArray(props.from)),
    enter: props.to,
    leave: props.from
  });
  return useTransition(data, options);
}
if (!adaptivecards.AdaptiveCard.onProcessMarkdown) {
  adaptivecards.AdaptiveCard.onProcessMarkdown = (text, result) => {
    result.outputHtml = `
      <div class="prose prose-sm prose-p:m-0 prose-p:overflow-hidden prose-p:text-ellipsis prose-a:text-brand-900 max-w-none [color:inherit] [font-size:inherit] [line-height:inherit]">
        ${textToHtml(text)}
      </div>
    `;
    result.didProcess = true;
  };
}
function getHostConfig(hostConfig) {
  if (hostConfig instanceof adaptivecards.HostConfig) return hostConfig;
  return new adaptivecards.HostConfig(hostConfig ?? {});
}
function AdaptiveCard(props) {
  var _a, _b, _c, _d, _e, _f;
  const [error, setError] = reactExports.useState();
  if (error) throw error;
  const ref = reactExports.useRef(null);
  const adaptiveCard = reactExports.useRef(new adaptivecards.AdaptiveCard());
  const hostConfig = adaptiveCard.current.hostConfig = getHostConfig(props.hostConfig);
  adaptiveCard.current.onExecuteAction = (action) => {
    var _a2, _b2, _c2, _d2, _e2;
    if ("data" in action && typeof action.data === "object") action.data = { ...action.data };
    const event = new CustomEvent(action.getJsonTypeName(), {
      cancelable: true,
      detail: action
    });
    if (isExecuteAction(event.detail)) {
      (_a2 = props.onExecuteAction) == null ? void 0 : _a2.call(props, event);
    }
    if (isOpenUrlAction(event.detail)) {
      (_b2 = props.onOpenUrlAction) == null ? void 0 : _b2.call(props, event);
    }
    if (isShowCardAction(event.detail)) {
      (_c2 = props.onShowCardAction) == null ? void 0 : _c2.call(props, event);
    }
    if (isSubmitAction(event.detail)) {
      (_d2 = props.onSubmitAction) == null ? void 0 : _d2.call(props, event);
    }
    if (event.defaultPrevented) return;
    (_e2 = props.onAction) == null ? void 0 : _e2.call(props, event);
  };
  reactExports.useEffect(() => {
    if (!ref.current) return;
    try {
      adaptiveCard.current.parse(props.payload);
      const result = adaptiveCard.current.render();
      if (!result) throw new Error("Render returned undefined");
      ref.current.replaceChildren(result);
    } catch (error2) {
      setError(error2);
    }
  }, [props.payload, props.hostConfig]);
  reactExports.useEffect(() => {
    var _a2;
    if (!props.disabled) return;
    const nodes = (_a2 = ref.current) == null ? void 0 : _a2.querySelectorAll(".ac-selectable[tabindex]");
    if (!(nodes == null ? void 0 : nodes.length)) return;
    for (const node of nodes) {
      node.setAttribute("tabindex", "-1");
    }
    return () => {
      for (const node of nodes) {
        node.setAttribute("tabindex", "0");
      }
    };
  }, [props.disabled]);
  return (
    // Use a fieldset so setting "disabled" will deactivate inputs
    // (It is valid for a `fieldset` to appear outside of a `form`)
    /* @__PURE__ */ jsxRuntimeExports.jsx(
      "fieldset",
      {
        ref,
        disabled: props.disabled,
        className: tx(
          "min-w-0",
          // Browsers default fieldsets to `min-width: min-content`,
          "flex flex-1 flex-col",
          { "pointer-events-none opacity-60": props.disabled },
          css`
          .ac-adaptiveCard {
            flex: 1 !important;
            padding: ${String(tw.theme("padding.3"))} !important;
            border-radius: ${String(tw.theme("borderRadius.lg"))};
          }
          .ac-horizontal-separator {
            margin-block: ${String(tw.theme("margin[0.5]"))};
          }
          .ac-selectable {
            /* [disabled] & { pointer-events: none; opacity: ${String(tw.theme("opacity.60"))}; } */
            cursor: pointer;
          }
          .ac-textBlock {
            overflow-wrap: normal !important;
          }
          .ac-textInput,
          .ac-multichoiceInput,
          .ac-dateInput,
          .ac-timeInput,
          .ac-numberInput {
            /* [disabled] & { pointer-events: none; opacity: ${String(tw.theme("opacity.60"))}; } */
            padding: ${String(tw.theme("padding.2"))};
            background-color: ${hostConfig.containerStyles.default.backgroundColor};
            border: 1px solid ${hostConfig.containerStyles.default.foregroundColors.light.subtle};
            border-radius: ${String(tw.theme("borderRadius.DEFAULT"))};
            font-family: ${(_a = hostConfig.fontTypes) == null ? void 0 : _a.default.fontFamily};
            font-size: ${(_b = hostConfig.fontTypes) == null ? void 0 : _b.default.fontSizes.default}px;
            line-height: ${(_c = hostConfig.lineHeights) == null ? void 0 : _c.default}px;
          }
          .ac-actionSet {
            flex-wrap: wrap;
            gap: 10px;
            & > div:empty {
              display: none;
            }
          }
          button.ac-pushButton,
          button.ac-pushButton-disabled {
            /* [disabled] & { pointer-events: none; opacity: ${String(tw.theme("opacity.60"))}; } */
            padding-inline: ${String(tw.theme("padding.4"))};
            padding-block: ${String(tw.theme("padding.1"))};
            border-radius: ${String(tw.theme("borderRadius.full"))};
            font-family: ${(_d = hostConfig.fontTypes) == null ? void 0 : _d.default.fontFamily};
            font-size: ${(_e = hostConfig.fontTypes) == null ? void 0 : _e.default.fontSizes.default}px;
            line-height: ${(_f = hostConfig.lineHeights) == null ? void 0 : _f.default}px;
            overflow: hidden;
            &,
            &:hover,
            &:focus,
            &:active {
              box-shadow: none;
            }
            @media (prefers-reduced-motion: no-preference) {
              transition-property: ${String(tw.theme("transitionProperty.DEFAULT"))};
              transition-timing-function: ${String(tw.theme("transitionTimingFunction.DEFAULT"))};
              transition-duration: ${String(tw.theme("transitionDuration.DEFAULT"))};
            }
            &.style-default {
              background-color: ${hostConfig.containerStyles.default.backgroundColor};
              border: 1px solid ${hostConfig.containerStyles.default.foregroundColors.accent.subtle};
              color: ${hostConfig.containerStyles.default.foregroundColors.accent.default};
              &:hover,
              &:focus {
                background-color: ${hostConfig.containerStyles.default.foregroundColors.accent.subtle};
                border: 1px solid ${hostConfig.containerStyles.default.foregroundColors.accent.default};
                color: ${hostConfig.containerStyles.default.backgroundColor};
              }
              &:active {
                background-color: ${hostConfig.containerStyles.emphasis.backgroundColor};
                border: 1px solid ${hostConfig.containerStyles.default.foregroundColors.light.subtle};
                color: ${hostConfig.containerStyles.default.foregroundColors.accent.subtle};
              }
            }
            &.style-positive {
              background-color: ${hostConfig.containerStyles.default.foregroundColors.accent.default};
              border: 1px solid ${hostConfig.containerStyles.default.foregroundColors.accent.subtle};
              color: ${hostConfig.containerStyles.default.backgroundColor};
              &:hover,
              &:focus {
                background-color: ${hostConfig.containerStyles.default.foregroundColors.accent.subtle};
                border: 1px solid ${hostConfig.containerStyles.default.foregroundColors.accent.default};
                color: ${hostConfig.containerStyles.default.backgroundColor};
              }
              &:active {
                background-color: ${hostConfig.containerStyles.default.foregroundColors.accent.default};
                border: 1px solid ${hostConfig.containerStyles.emphasis.backgroundColor};
                color: ${hostConfig.containerStyles.default.backgroundColor};
              }
            }
            &.style-destructive {
              background-color: ${hostConfig.containerStyles.default.backgroundColor};
              border: 1px solid ${hostConfig.containerStyles.default.foregroundColors.attention.default};
              color: ${hostConfig.containerStyles.default.foregroundColors.attention.default};
              &:hover,
              &:focus {
                background-color: ${hostConfig.containerStyles.default.foregroundColors.attention.default};
                border: 1px solid ${hostConfig.containerStyles.default.foregroundColors.attention.subtle};
                color: ${hostConfig.containerStyles.default.backgroundColor};
              }
              &:active {
                background-color: ${hostConfig.containerStyles.default.foregroundColors.attention.subtle};
                border: 1px solid ${hostConfig.containerStyles.default.foregroundColors.attention.default};
                color: ${hostConfig.containerStyles.default.foregroundColors.attention.default};
              }
            }
          }
        `
        )
      }
    )
  );
}
const RootStateContext = reactExports.createContext(null);
function useRootState(initialState) {
  const context = reactExports.useContext(RootStateContext);
  if (context) return [void 0, context[1]];
  return reactExports.useState(initialState);
}
function RootStateProvider(props) {
  return /* @__PURE__ */ jsxRuntimeExports.jsx(RootStateContext.Provider, { value: props.state, children: props.children });
}
const loadingAnimation = keyframes`
  from {
    left: 0;
    transform: translateX(-100%);
  }
  to {
    left: 100%;
    transform: translateX(0);
  }
`;
function useIsControlled(test) {
  const logger = useWidgetsLogger();
  const [isControlled, setIsControlled] = reactExports.useState(test);
  if (test() && !isControlled) {
    logger.error("Component changed from uncontrolled to controlled.");
    setIsControlled(true);
  }
  return isControlled;
}
const getViewActionSchema = objectType({
  data: objectType({
    __internal__: objectType({
      spaceId: stringType()
    }),
    endpoint: stringType()
  }).passthrough().transform(({ __internal__: { spaceId }, endpoint, ...data }) => ({
    spaceId,
    endpoint,
    data
  }))
});
const actionNotificationActionSchema = objectType({
  data: objectType({
    __internal__: objectType({
      spaceId: stringType(),
      notificationId: stringType()
    }),
    data: objectType({}).passthrough(),
    analytics: objectType({}).passthrough().optional()
  }).passthrough().transform(({ __internal__: { spaceId, notificationId }, ...data }) => ({
    spaceId,
    notificationId,
    data
  }))
});
const deleteNotificationActionSchema = objectType({
  verb: literalType("deleteNotification"),
  data: objectType({
    __internal__: objectType({
      spaceId: stringType(),
      notificationId: stringType()
    })
  }).passthrough().transform(({ __internal__: { spaceId, notificationId } }) => ({
    spaceId,
    notificationId
  }))
});
const deleteNotificationActionedActionSchema = objectType({
  verb: literalType("deleteNotificationActioned"),
  data: objectType({
    spaceId: stringType(),
    notificationId: stringType()
  })
});
const deleteNotificationCancelledActionSchema = objectType({
  verb: literalType("deleteNotificationCancelled"),
  data: objectType({
    spaceId: stringType(),
    notificationId: stringType()
  })
});
const askFeedbackActionSchema = objectType({
  data: objectType({
    __internal__: objectType({
      spaceId: stringType()
    }),
    text: stringType(),
    id: literalType("feedback")
  }).passthrough().transform(({ __internal__: { spaceId }, text, id, ...data }) => ({
    spaceId,
    message: text,
    id,
    data
  }))
});
const askFeedbackResponseSchema = objectType({
  items: arrayType(
    objectType({
      view: adaptiveCardObjectSchema
    })
  ).length(1)
}).transform((response) => {
  return response.items[0].view;
});
function View(props) {
  const { t } = useTranslation();
  const [rootState, setRootState] = useRootState({});
  const core = useWidgetsCore();
  const logger = useWidgetsLogger();
  const queryClient = useQueryClient();
  let resolvedAction;
  let resolvedPayload;
  if ("endpoint" in props) {
    resolvedAction = {
      data: {
        __internal__: { spaceId: props.spaceId },
        endpoint: props.endpoint,
        ...props.data
      }
    };
  }
  if ("payload" in props && props.payload) {
    resolvedPayload = props.payload;
  }
  if ("initialEndpoint" in props) {
    resolvedAction = {
      data: {
        __internal__: { spaceId: props.spaceId },
        endpoint: props.initialEndpoint,
        ...props.initialData
      }
    };
  }
  if ("initialPayload" in props && props.initialPayload) {
    resolvedPayload = props.initialPayload;
  }
  const isControlled = useIsControlled(() => "payload" in props || "endpoint" in props);
  const [internalAction, setInternalAction] = reactExports.useState();
  const action = internalAction ?? resolvedAction;
  const payload = reactExports.useRef(resolvedPayload);
  const viewQuery = useQuery({
    queryKey: [action ?? { payload: resolvedPayload }],
    queryFn: async () => {
      if (!action) return payload.current;
      if (getViewActionSchema.safeParse(action).success) {
        const parsedAction = getViewActionSchema.parse(action);
        return core.getView(parsedAction.data);
      }
      if (actionNotificationActionSchema.safeParse(action).success) {
        const parsedAction = actionNotificationActionSchema.parse(action);
        await core.actionNotification(parsedAction.data);
        setRootState({ submitted: true });
        return {
          type: "AdaptiveCard",
          version: "1.6"
        };
      }
      if (deleteNotificationActionSchema.safeParse(action).success) {
        const parsedAction = deleteNotificationActionSchema.parse(action);
        return {
          type: "AdaptiveCard",
          version: "1.3",
          body: [
            {
              type: "Container",
              verticalContentAlignment: "center",
              items: [
                {
                  type: "ColumnSet",
                  separator: false,
                  columns: [
                    {
                      type: "Column",
                      width: "auto",
                      items: [
                        {
                          type: "Image",
                          size: "Small",
                          style: "Person",
                          // Currently always the production endpoint
                          url: `https://cdn.workgrid.com/ask/trash-can-red.png`,
                          horizontalAlignment: "Center"
                        }
                      ]
                    },
                    {
                      type: "Column",
                      width: "stretch",
                      items: [
                        {
                          type: "ColumnSet",
                          columns: [
                            {
                              type: "Column",
                              items: [
                                {
                                  type: "TextBlock",
                                  text: t("delete-notification.subject"),
                                  verticalContentAlignment: "Center"
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    }
                  ]
                }
              ]
            },
            {
              type: "TextBlock",
              text: t("delete-notification.warning"),
              wrap: true,
              weight: "bolder",
              size: "medium",
              spacing: "default",
              separator: false
            }
          ],
          actions: [
            {
              id: "delete-notification-actioned",
              type: "Action.Execute",
              verb: "deleteNotificationActioned",
              title: t("delete-notification.actions.confirm"),
              data: {
                ...parsedAction.data
              }
            },
            {
              id: "delete-notification-cancelled",
              type: "Action.Execute",
              verb: "deleteNotificationCancelled",
              title: t("delete-notification.actions.cancel"),
              data: {
                ...parsedAction.data
              }
            }
          ]
        };
      }
      if (deleteNotificationActionedActionSchema.safeParse(action).success) {
        const parsedAction = deleteNotificationActionedActionSchema.parse(action);
        const response = await core.getNotification(parsedAction.data);
        await core.deleteNotification(parsedAction.data);
        setRootState({ deleted: true });
        return response;
      }
      if (deleteNotificationCancelledActionSchema.safeParse(action).success) {
        const parsedAction = deleteNotificationCancelledActionSchema.parse(action);
        return core.getNotification(parsedAction.data);
      }
      if (askFeedbackActionSchema.safeParse(action).success) {
        const parsedAction = askFeedbackActionSchema.parse(action);
        const response = await core.ask(parsedAction.data);
        return askFeedbackResponseSchema.parse(response);
      }
      logger.error("Unexpected action", { action });
    },
    // Ensure payload is defined before rendering
    // @ts-expect-error useSuspenseQuery does not support overriding throwOnError
    suspense: true,
    // Don't bubble errors after the initial query
    throwOnError: !action,
    // Show previous payload white fetching
    // (`keepPreviousData` is cleared on error)
    placeholderData: payload.current
  });
  if (viewQuery.data) payload.current = viewQuery.data;
  const isFetching = viewQuery.isFetching;
  const isError = viewQuery.isError;
  const isSubmitted = (rootState == null ? void 0 : rootState.submitted) ?? false;
  const isDeleted = (rootState == null ? void 0 : rootState.deleted) ?? false;
  const isDisabled = isFetching || isSubmitted || isDeleted;
  const isRoot = !!rootState;
  const hostConfig = reactExports.useRef();
  hostConfig.current ?? (hostConfig.current = new adaptivecards.HostConfig(merge(getDefaultHostConfig(), props.hostConfig)));
  const [detail, setDetail] = reactExports.useState(null);
  const openTransitions = useSimpleTransition(detail, {
    from: [{ opacity: 0, scale: Number(tw.theme("scale.95")) }, { display: "none" }],
    to: [{ display: "" }, { opacity: 1, scale: Number(tw.theme("scale.100")) }]
  });
  const spinDelay = distExports.useSpinDelay(isFetching, { delay: 500, minDuration: 2e3, ssr: false });
  reactExports.useEffect(() => {
    if (rootState == null ? void 0 : rootState.submitted) {
      setDetail(null);
    }
  }, [rootState == null ? void 0 : rootState.submitted]);
  if (isFetching && !isRoot) {
    return /* @__PURE__ */ jsxRuntimeExports.jsx(Loader, { label: t("loading") });
  }
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(RootStateProvider, { state: [rootState, setRootState], children: [
    /* @__PURE__ */ jsxRuntimeExports.jsxs(
      "div",
      {
        ...isRoot && createAnchor(name),
        className: tx(
          "relative bg-white",
          "flex flex-1 flex-col",
          { rounded: isRoot },
          {
            [css`
              &::before {
                content: '';
                position: absolute;
                top: -3px;
                left: 0;
                transform: translateX(-100%);
                width: 4rem;
                height: 5px;
                border-radius: 100%;
                background-image: linear-gradient(
                  135deg,
                  transparent 15%,
                  ${String(tw.theme("colors.white"))} 50%,
                  transparent 85%
                );
                animation: ${loadingAnimation} 2s infinite alternate ease-in-out;
                opacity: 0.8;
              }
            `]: spinDelay
          },
          {
            [css`
              border-top: 3px solid ${hostConfig.current.containerStyles.default.foregroundColors.accent.subtle};
            `]: isRoot
          }
        ),
        children: [
          isError && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mx-2 mt-2 bg-rose-300 bg-opacity-20 px-2 py-1 text-xs text-rose-700", children: t("request-failed") }),
          isSubmitted && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mx-2 mt-2 bg-emerald-300 bg-opacity-20 px-2 py-1 text-xs text-emerald-700", children: t("response-submitted") }),
          isDeleted && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mx-2 mt-2 bg-zinc-300 bg-opacity-20 px-2 py-1 text-xs text-zinc-700", children: t("delete-notification.success") }),
          /* @__PURE__ */ jsxRuntimeExports.jsx(
            AdaptiveCard,
            {
              disabled: isDisabled,
              payload: payload.current,
              hostConfig: hostConfig.current,
              onAction: (event) => {
                var _a;
                (_a = props.onAction) == null ? void 0 : _a.call(props, event);
                if (event.defaultPrevented) return;
                if (isExecuteAction(event.detail) || isSubmitAction(event.detail)) {
                  if (isControlled) return;
                  const action2 = event.detail.toJSON();
                  queryClient.removeQueries({ queryKey: [action2] });
                  setInternalAction(action2);
                }
              },
              onExecuteAction: (event) => {
                var _a;
                (_a = props.onExecuteAction) == null ? void 0 : _a.call(props, event);
                if (event.defaultPrevented) return;
              },
              onOpenUrlAction: (event) => {
                var _a;
                (_a = props.onOpenUrlAction) == null ? void 0 : _a.call(props, event);
                if (event.defaultPrevented) return;
                window.open(event.detail.url, "_blank");
              },
              onShowCardAction: (event) => {
                var _a, _b;
                (_a = props.onShowCardAction) == null ? void 0 : _a.call(props, event);
                if (event.defaultPrevented) return;
                setDetail((_b = event.detail.toJSON()) == null ? void 0 : _b.card);
              },
              onSubmitAction: (event) => {
                var _a;
                (_a = props.onSubmitAction) == null ? void 0 : _a.call(props, event);
                if (event.defaultPrevented) return;
              }
            }
          )
        ]
      }
    ),
    /* @__PURE__ */ jsxRuntimeExports.jsx(
      Root,
      {
        open: !!detail,
        onOpenChange: () => {
          setDetail(null);
        },
        modal: false,
        children: openTransitions((style, detail2) => {
          return detail2 && /* @__PURE__ */ jsxRuntimeExports.jsx(
            Content,
            {
              forceMount: true,
              onInteractOutside: (event) => {
                event.preventDefault();
              },
              onEscapeKeyDown: (event) => {
                event.preventDefault();
              },
              asChild: true,
              children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
                animated.div,
                {
                  className: "absolute inset-0 z-10 flex flex-col bg-white",
                  style,
                  "aria-hidden": !detail2,
                  children: [
                    /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex justify-start p-2", children: /* @__PURE__ */ jsxRuntimeExports.jsx(Close, { asChild: true, children: /* @__PURE__ */ jsxRuntimeExports.jsxs("button", { className: "flex items-center justify-center gap-1 rounded px-2 py-1 text-zinc-600", children: [
                      /* @__PURE__ */ jsxRuntimeExports.jsx(ForwardRef, { className: "-mb-0.5 -ml-1 h-6 w-6" }),
                      /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-sm font-light", children: t("close-detail") })
                    ] }) }) }),
                    /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-1 flex-col overflow-auto", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
                      View,
                      {
                        spaceId: props.spaceId,
                        initialPayload: detail2,
                        hostConfig: props.hostConfig,
                        onAction: (event) => {
                          var _a;
                          (_a = props.onAction) == null ? void 0 : _a.call(props, event);
                          if (event.defaultPrevented) return;
                        },
                        onExecuteAction: (event) => {
                          var _a;
                          (_a = props.onExecuteAction) == null ? void 0 : _a.call(props, event);
                          if (event.defaultPrevented) return;
                        },
                        onOpenUrlAction: (event) => {
                          var _a;
                          (_a = props.onOpenUrlAction) == null ? void 0 : _a.call(props, event);
                          if (event.defaultPrevented) return;
                        },
                        onShowCardAction: (event) => {
                          var _a;
                          (_a = props.onShowCardAction) == null ? void 0 : _a.call(props, event);
                          if (event.defaultPrevented) return;
                        },
                        onSubmitAction: (event) => {
                          var _a;
                          (_a = props.onSubmitAction) == null ? void 0 : _a.call(props, event);
                          if (event.defaultPrevented) return;
                        }
                      }
                    ) })
                  ]
                }
              )
            }
          );
        })
      }
    )
  ] });
}
function getDefaultHostConfig() {
  const containerForegroundColors = {
    default: {
      default: String(tw.theme("colors.zinc.900")),
      subtle: String(tw.theme("colors.zinc.700"))
    },
    dark: {
      default: String(tw.theme("colors.zinc.900")),
      subtle: String(tw.theme("colors.zinc.700"))
    },
    light: {
      default: String(tw.theme("colors.zinc.600")),
      subtle: String(tw.theme("colors.zinc.500"))
    },
    accent: {
      default: String(tw.theme("colors.brand.900")),
      subtle: String(tw.theme("colors.brand.700"))
    },
    good: {
      default: String(tw.theme("colors.emerald.900")),
      subtle: String(tw.theme("colors.emerald.700"))
    },
    warning: {
      default: String(tw.theme("colors.amber.900")),
      subtle: String(tw.theme("colors.amber.700"))
    },
    attention: {
      default: String(tw.theme("colors.rose.900")),
      subtle: String(tw.theme("colors.rose.700"))
    }
  };
  return {
    fontTypes: {
      default: {
        fontFamily: String(tw.theme("fontFamily.sans")),
        fontSizes: {
          small: Number(toPx(String(tw.theme("fontSize.xs[0]")))),
          default: Number(toPx(String(tw.theme("fontSize.sm[0]")))),
          medium: Number(toPx(String(tw.theme("fontSize.base[0]")))),
          large: Number(toPx(String(tw.theme("fontSize.lg[0]")))),
          extraLarge: Number(toPx(String(tw.theme("fontSize.xl[0]"))))
        },
        fontWeights: {
          default: Number(tw.theme("fontWeight.normal")),
          lighter: Number(tw.theme("fontWeight.light")),
          bolder: Number(tw.theme("fontWeight.bold"))
        }
      },
      monospace: {
        fontFamily: String(tw.theme("fontFamily.mono")),
        fontSizes: {
          small: Number(toPx(String(tw.theme("fontSize.xs[0]")))),
          default: Number(toPx(String(tw.theme("fontSize.sm[0]")))),
          medium: Number(toPx(String(tw.theme("fontSize.base[0]")))),
          large: Number(toPx(String(tw.theme("fontSize.lg[0]")))),
          extraLarge: Number(toPx(String(tw.theme("fontSize.xl[0]"))))
        },
        fontWeights: {
          default: Number(tw.theme("fontWeight.normal")),
          lighter: Number(tw.theme("fontWeight.light")),
          bolder: Number(tw.theme("fontWeight.bold"))
        }
      }
    },
    lineHeights: {
      small: Number(toPx(String(tw.theme("fontSize.xs[1]")))),
      default: Number(toPx(String(tw.theme("fontSize.sm[1]")))),
      medium: Number(toPx(String(tw.theme("fontSize.base[1]")))),
      large: Number(toPx(String(tw.theme("fontSize.lg[1]")))),
      extraLarge: Number(toPx(String(tw.theme("fontSize.xl[1]"))))
    },
    containerStyles: {
      default: {
        backgroundColor: String(tw.theme("colors.white")),
        foregroundColors: containerForegroundColors
      },
      emphasis: {
        backgroundColor: String(tw.theme("colors.zinc.100")),
        foregroundColors: containerForegroundColors
      },
      accent: {
        backgroundColor: String(tw.theme("colors.brand.100")),
        foregroundColors: containerForegroundColors
      },
      good: {
        backgroundColor: String(tw.theme("colors.emerald.100")),
        foregroundColors: containerForegroundColors
      },
      warning: {
        backgroundColor: String(tw.theme("colors.amber.100")),
        foregroundColors: containerForegroundColors
      },
      attention: {
        backgroundColor: String(tw.theme("colors.rose.100")),
        foregroundColors: containerForegroundColors
      }
    },
    spacing: {
      small: Number(toPx(String(tw.theme("spacing.1")))),
      default: Number(toPx(String(tw.theme("spacing.2")))),
      padding: Number(toPx(String(tw.theme("spacing.3")))),
      medium: Number(toPx(String(tw.theme("spacing.4")))),
      large: Number(toPx(String(tw.theme("spacing.5")))),
      extraLarge: Number(toPx(String(tw.theme("spacing.6"))))
    },
    imageSizes: {
      small: Number(toPx(String(tw.theme("width.8")))),
      medium: Number(toPx(String(tw.theme("width.16")))),
      large: Number(toPx(String(tw.theme("width.32"))))
    },
    actions: {
      maxActions: 6
    }
  };
}
export {
  View as default
};
//# sourceMappingURL=view-CN9guNO6.js.map
