import { j as jsxRuntimeExports, h as Button } from "./doenetml-cB_aZGJ5.js";
import { T as TooltipProvider, a as TooltipAnchor, b as Tooltip } from "./tooltip-provider-CHxHcyV8.js";
function AnswerResponseButton({
  answerId,
  answerComponentIdx,
  activityId,
  docId,
  numResponses = 0,
  flags
}) {
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(TooltipProvider, { children: [
    /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipAnchor, { className: "answer-response-tooltip-anchor", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
      Button,
      {
        className: "doenet-button action-button answer-response-button",
        onClick: () => {
          const message = {
            subject: "requestAnswerResponses",
            answerComponentIdx,
            answerId,
            activityId,
            docId
          };
          if (flags.messageParent && window.parent) {
            window.parent.postMessage(message);
          } else {
            window.postMessage(message);
          }
        },
        children: numResponses
      }
    ) }),
    /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { className: "answer-response-tooltip", children: [
      "Show ",
      numResponses,
      " response",
      numResponses === 1 ? "" : "s",
      " to ",
      answerId
    ] })
  ] });
}
export {
  AnswerResponseButton as A
};
