"use strict";
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
const jsxRuntime = require("react/jsx-runtime");
const index$1 = require("../../icons/index.cjs");
;/* empty css                                                                                                                                                                                        */
;/* empty css                                                                                                                                                                                         */
;/* empty css                                                                                                                                                                                                 */
;/* empty css                                                                                                                                                                                            */
;/* empty css                                                                                                                                                                                            */
const index = require("../../primitive/Typography/index.cjs");
const CopyButton = require("../../primitive/CopyButton/CopyButton.cjs");
require("clsx");
const styles = require("../../utils/styles.cjs");
const Box = require("../../node_modules/.pnpm/@mantine_core@7.15.2_patch_hash_jclkxeaefn6uz54h34k3r3yjsq_@mantine_hooks@7.15.2_react@18.3.1_szqfuioo5damkjdixckhzmwycq/node_modules/@mantine/core/esm/core/Box/Box.cjs");
const Tooltip = require("../../node_modules/.pnpm/@mantine_core@7.15.2_patch_hash_jclkxeaefn6uz54h34k3r3yjsq_@mantine_hooks@7.15.2_react@18.3.1_szqfuioo5damkjdixckhzmwycq/node_modules/@mantine/core/esm/components/Tooltip/Tooltip.cjs");
const ActionIcon = require("../../node_modules/.pnpm/@mantine_core@7.15.2_patch_hash_jclkxeaefn6uz54h34k3r3yjsq_@mantine_hooks@7.15.2_react@18.3.1_szqfuioo5damkjdixckhzmwycq/node_modules/@mantine/core/esm/components/ActionIcon/ActionIcon.cjs");
const FormCopyText = ({
  timeout = 3e3,
  value,
  valueProps,
  tooltipProps,
  size = 16,
  ...props
}) => {
  return /* @__PURE__ */ jsxRuntime.jsx(CopyButton.CopyButton, { value, timeout, children: ({ copied, copy }) => /* @__PURE__ */ jsxRuntime.jsxs(
    Box.Box,
    {
      sx: styles.mergeSxList([
        (theme) => ({
          display: "flex",
          alignItems: "center",
          paddingLeft: 12,
          paddingRight: 8,
          height: 40,
          borderRadius: theme.defaultRadius,
          backgroundColor: theme.colors.carbon[2],
          border: `1px solid ${theme.colors.carbon[5]}`
        }),
        props.sx
      ]),
      ...props,
      children: [
        /* @__PURE__ */ jsxRuntime.jsx(
          index.Typography,
          {
            variant: "body-lg",
            c: "carbon.8",
            sx: styles.mergeSxList([
              () => ({
                flex: "1",
                whiteSpace: "nowrap",
                overflow: "hidden",
                textOverflow: "ellipsis",
                marginRight: 8
              }),
              valueProps == null ? void 0 : valueProps.sx
            ]),
            ...valueProps,
            children: value
          }
        ),
        /* @__PURE__ */ jsxRuntime.jsx(Tooltip.Tooltip, { label: copied ? "Copied" : "Copy", withArrow: true, ...tooltipProps, children: /* @__PURE__ */ jsxRuntime.jsx(ActionIcon.ActionIcon, { "aria-label": "Copy", color: "carbon.8", variant: "transparent", onClick: copy, children: /* @__PURE__ */ jsxRuntime.jsx(
          index$1.IconCopy01,
          {
            size,
            onClick: () => {
              var _a;
              copy();
              (_a = props.onClick) == null ? void 0 : _a.call(props);
            }
          }
        ) }) })
      ]
    }
  ) });
};
exports.FormCopyText = FormCopyText;
