import { j as jsxRuntimeExports, u as useWidgetsCore, I as useWidgetsLogger, J as useTransition, H as ms, K as animated } from "./root-fe47297d.js";
import { a as adaptivecards, m as micromark, u as useQuery, d as distExports, $ as $5d3850c4d0b4e6c7$export$be92b6f5f03c0fe9, b as $5d3850c4d0b4e6c7$export$7c6e2c02157bb7d2, c as $5d3850c4d0b4e6c7$export$f39c2d165cd861fe, C as ChevronLeftIcon } from "./stream-ecbee7cf.js";
import { v as tx, p as css, u as tw, w as keyframes } from "./_isIterateeCall-2d6870f8.js";
import { m as merge } from "./_baseEach-d6ae4b0b.js";
import { r as reactExports } from "./index-c2167df6.js";
import { g as getDefaultExportFromCjs } from "./_commonjsHelpers-ca272635.js";
import { X as isExecuteAction, Y as isOpenUrlAction, Z as isShowCardAction, _ as isSubmitAction, o as objectType, s as stringType, V as literalType, $ as arrayType, Q as adaptiveCardSchema } from "./index-cd8d8f61.js";
import { u as useQueryClient, L as Loader } from "./root-a309b12a.js";
import "./client-85be4bc5.js";
import "./_arrayMap-15997ada.js";
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);
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 text-inherit">
        ${micromark(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;
    nodes.forEach((node) => node.setAttribute("tabindex", "-1"));
    return () => nodes.forEach((node) => 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: ${tw.theme("padding.3")} !important;
            border-radius: ${tw.theme("borderRadius.lg")};
          }

          .ac-horizontal-separator {
            margin-block: ${tw.theme("margin[0.5]")};
          }

          .ac-selectable {
            /* [disabled] & {
              pointer-events: none;
              opacity: ${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: ${tw.theme("opacity.60")};
            } */

            padding: ${tw.theme("padding.2")};
            background-color: ${hostConfig.containerStyles.default.backgroundColor};
            border: 1px solid ${hostConfig.containerStyles.default.foregroundColors.light.subtle};
            border-radius: ${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: ${tw.theme("opacity.60")};
            } */

            padding-inline: ${tw.theme("padding.4")};
            padding-block: ${tw.theme("padding.1")};
            border-radius: ${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: ${tw.theme("transitionProperty.DEFAULT")};
              transition-timing-function: ${tw.theme("transitionTimingFunction.DEFAULT")};
              transition-duration: ${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: adaptiveCardSchema
    })
  ).length(1)
}).transform((response) => {
  return response.items[0].view;
});
function View(props) {
  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: "Delete notification",
                                  verticalContentAlignment: "Center"
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    }
                  ]
                }
              ]
            },
            {
              type: "TextBlock",
              text: "Delete this notification from all channels? This cannot be undone.",
              wrap: true,
              weight: "bolder",
              size: "medium",
              spacing: "default",
              separator: false
            }
          ],
          actions: [
            {
              id: "delete-notification-actioned",
              type: "Action.Execute",
              verb: "deleteNotificationActioned",
              title: "Yes, delete",
              data: {
                ...parsedAction.data
              }
            },
            {
              id: "delete-notification-cancelled",
              type: "Action.Execute",
              verb: "deleteNotificationCancelled",
              title: "Keep notification",
              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
    suspense: true,
    // Don't bubble errors after the initial query
    useErrorBoundary: !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;
  const isDeleted = rootState == null ? void 0 : rootState.deleted;
  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 = useTransition(detail, {
    from: { display: "none", opacity: 0, scale: Number(tw.theme("scale.95")) },
    enter: [{ display: "flex" }, { opacity: 1, scale: Number(tw.theme("scale.100")) }],
    leave: [{ opacity: 0, scale: Number(tw.theme("scale.95")) }, { display: "none" }],
    config: { duration: ms(String(tw.theme("transitionDuration.DEFAULT"))) }
  });
  const spinDelay = distExports.useSpinDelay(isFetching, { delay: 500, minDuration: 2e3 });
  reactExports.useEffect(() => {
    if (rootState == null ? void 0 : rootState.submitted) {
      setDetail(null);
    }
  }, [rootState == null ? void 0 : rootState.submitted]);
  if (isFetching && !isRoot) {
    return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-1 flex-col items-center justify-center", children: /* @__PURE__ */ jsxRuntimeExports.jsx(Loader, { label: "Loading" }) });
  }
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(RootStateProvider, { state: [rootState, setRootState], children: [
    /* @__PURE__ */ jsxRuntimeExports.jsxs(
      "div",
      {
        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%,
                  ${tw.theme("colors.white")} 50%,
                  transparent 85%
                );
                animation: ${loadingAnimation} 2s infinite alternate ease-in-out;
                opacity: 0.8;
              }s
            `]: 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: "There was an error with your request, please try again." }),
          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: "Response submitted successfully!" }),
          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: "This notification has been deleted." }),
          /* @__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 (event.detail && !isControlled) {
                    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($5d3850c4d0b4e6c7$export$be92b6f5f03c0fe9, { open: !!detail, onOpenChange: () => setDetail(null), modal: false, children: openTransitions((style, detail2) => {
      return detail2 && /* @__PURE__ */ jsxRuntimeExports.jsx(
        $5d3850c4d0b4e6c7$export$7c6e2c02157bb7d2,
        {
          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, hidden: !detail2, children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex justify-start p-2", children: /* @__PURE__ */ jsxRuntimeExports.jsx($5d3850c4d0b4e6c7$export$f39c2d165cd861fe, { asChild: true, children: /* @__PURE__ */ jsxRuntimeExports.jsxs("button", { className: "flex items-center justify-center gap-1 rounded px-2 py-1 text-gray-600", children: [
              /* @__PURE__ */ jsxRuntimeExports.jsx(ChevronLeftIcon, { className: "-mb-0.5 -ml-1 h-6 w-6" }),
              /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-sm font-light", children: "Back" })
            ] }) }) }),
            /* @__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() {
  var _a, _b;
  const containerForegroundColors = {
    default: {
      default: tw.theme("colors.zinc.900"),
      subtle: tw.theme("colors.zinc.700")
    },
    dark: {
      default: tw.theme("colors.zinc.900"),
      subtle: tw.theme("colors.zinc.700")
    },
    light: {
      default: tw.theme("colors.zinc.600"),
      subtle: tw.theme("colors.zinc.500")
    },
    accent: {
      default: tw.theme("colors.brand.900"),
      subtle: tw.theme("colors.brand.700")
    },
    good: {
      default: tw.theme("colors.emerald.900"),
      subtle: tw.theme("colors.emerald.700")
    },
    warning: {
      default: tw.theme("colors.yellow.900"),
      subtle: tw.theme("colors.yellow.700")
    },
    attention: {
      default: tw.theme("colors.rose.900"),
      subtle: tw.theme("colors.rose.700")
    }
  };
  return {
    fontTypes: {
      default: {
        fontFamily: (_a = tw.theme("fontFamily.sans")) == null ? void 0 : _a.join(","),
        fontSizes: {
          small: Number(toPx(tw.theme("fontSize.xs[0]"))),
          default: Number(toPx(tw.theme("fontSize.sm[0]"))),
          medium: Number(toPx(tw.theme("fontSize.base[0]"))),
          large: Number(toPx(tw.theme("fontSize.lg[0]"))),
          extraLarge: Number(toPx(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: (_b = tw.theme("fontFamily.mono")) == null ? void 0 : _b.join(","),
        fontSizes: {
          small: Number(toPx(tw.theme("fontSize.xs[0]"))),
          default: Number(toPx(tw.theme("fontSize.sm[0]"))),
          medium: Number(toPx(tw.theme("fontSize.base[0]"))),
          large: Number(toPx(tw.theme("fontSize.lg[0]"))),
          extraLarge: Number(toPx(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(tw.theme("fontSize.xs[1]"))),
      default: Number(toPx(tw.theme("fontSize.sm[1]"))),
      medium: Number(toPx(tw.theme("fontSize.base[1]"))),
      large: Number(toPx(tw.theme("fontSize.lg[1]"))),
      extraLarge: Number(toPx(tw.theme("fontSize.xl[1]")))
    },
    containerStyles: {
      default: {
        backgroundColor: tw.theme("colors.white"),
        foregroundColors: containerForegroundColors
      },
      emphasis: {
        backgroundColor: tw.theme("colors.zinc.100"),
        foregroundColors: containerForegroundColors
      },
      accent: {
        backgroundColor: tw.theme("colors.blue.100"),
        foregroundColors: containerForegroundColors
      },
      good: {
        backgroundColor: tw.theme("colors.emerald.100"),
        foregroundColors: containerForegroundColors
      },
      warning: {
        backgroundColor: tw.theme("colors.yellow.100"),
        foregroundColors: containerForegroundColors
      },
      attention: {
        backgroundColor: tw.theme("colors.rose.100"),
        foregroundColors: containerForegroundColors
      }
    },
    spacing: {
      small: Number(toPx(tw.theme("spacing.1"))),
      default: Number(toPx(tw.theme("spacing.2"))),
      padding: Number(toPx(tw.theme("spacing.3"))),
      medium: Number(toPx(tw.theme("spacing.4"))),
      large: Number(toPx(tw.theme("spacing.5"))),
      extraLarge: Number(toPx(tw.theme("spacing.6")))
    },
    imageSizes: {
      small: Number(toPx(tw.theme("width.8"))),
      medium: Number(toPx(tw.theme("width.16"))),
      large: Number(toPx(tw.theme("width.32")))
    },
    actions: {
      maxActions: 6
    }
  };
}
export {
  View as default
};
//# sourceMappingURL=view-c3be14f3.js.map
