"use client";
'use strict';

var React = require('react');
var classVarianceAuthority = require('class-variance-authority');
var clsx = require('clsx');
var tailwindMerge = require('tailwind-merge');
var jsxRuntime = require('react/jsx-runtime');

function _interopNamespace(e) {
  if (e && e.__esModule) return e;
  var n = Object.create(null);
  if (e) {
    Object.keys(e).forEach(function (k) {
      if (k !== 'default') {
        var d = Object.getOwnPropertyDescriptor(e, k);
        Object.defineProperty(n, k, d.get ? d : {
          enumerable: true,
          get: function () { return e[k]; }
        });
      }
    });
  }
  n.default = e;
  return Object.freeze(n);
}

var React__namespace = /*#__PURE__*/_interopNamespace(React);

var __defProp = Object.defineProperty;
var __defProps = Object.defineProperties;
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __propIsEnum = Object.prototype.propertyIsEnumerable;
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __spreadValues = (a, b) => {
  for (var prop in b || (b = {}))
    if (__hasOwnProp.call(b, prop))
      __defNormalProp(a, prop, b[prop]);
  if (__getOwnPropSymbols)
    for (var prop of __getOwnPropSymbols(b)) {
      if (__propIsEnum.call(b, prop))
        __defNormalProp(a, prop, b[prop]);
    }
  return a;
};
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
var __objRest = (source, exclude) => {
  var target = {};
  for (var prop in source)
    if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
      target[prop] = source[prop];
  if (source != null && __getOwnPropSymbols)
    for (var prop of __getOwnPropSymbols(source)) {
      if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
        target[prop] = source[prop];
    }
  return target;
};
function cn(...inputs) {
  return tailwindMerge.twMerge(clsx.clsx(inputs));
}
var aiTextAreaContainerVariants = classVarianceAuthority.cva(
  "flex flex-col overflow-hidden rounded-[var(--radius-Card-md,12px)] w-full transition-[background-color] duration-150 focus-within:transition-none",
  {
    variants: {
      variant: {
        default: "border border-border bg-white shadow-none hover:border-input-hover focus-within:border-input-hover focus-within:ring-0 dark:bg-sidebar",
        shadow: "border border-border bg-white shadow-none hover:border-input-hover focus-within:border-input-hover focus-within:ring-0 dark:bg-sidebar",
        soft: "bg-muted/60 focus-within:ring-0 dark:bg-muted/40"
      }
    },
    defaultVariants: { variant: "default" }
  }
);
function AiTextArea(_a) {
  var _b = _a, {
    className,
    containerClassName,
    variant,
    label,
    caption,
    children
  } = _b, props = __objRest(_b, [
    "className",
    "containerClassName",
    "variant",
    "label",
    "caption",
    "children"
  ]);
  return /* @__PURE__ */ jsxRuntime.jsxs("div", __spreadProps(__spreadValues({ "data-slot": "ai-textarea", className: cn("flex flex-col gap-2 w-full", className) }, props), { children: [
    label && /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-slot": "ai-textarea-label", className: "flex items-center justify-between", children: [
      /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center gap-1", children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm font-medium leading-5 text-foreground", children: label }) }),
      /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center gap-1 h-5 w-[78px]" })
    ] }),
    /* @__PURE__ */ jsxRuntime.jsx(
      "div",
      {
        "data-slot": "ai-textarea-container",
        className: cn(aiTextAreaContainerVariants({ variant }), containerClassName),
        children
      }
    ),
    caption && /* @__PURE__ */ jsxRuntime.jsx("p", { "data-slot": "ai-textarea-caption", className: "text-xs leading-4 text-muted-foreground", children: caption })
  ] }));
}
function AiTextAreaInput(_a) {
  var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
  return /* @__PURE__ */ jsxRuntime.jsx(
    "textarea",
    __spreadValues({
      "data-slot": "ai-textarea-input",
      className: cn(
        "flex w-full resize-none field-sizing-content min-h-[40px] bg-transparent px-3 pt-2.5 pb-0 text-sm leading-5 text-foreground outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",
        className
      )
    }, props)
  );
}
function AiTextAreaToolbar(_a) {
  var _b = _a, { className, separator, children } = _b, props = __objRest(_b, ["className", "separator", "children"]);
  return /* @__PURE__ */ jsxRuntime.jsx(
    "div",
    __spreadProps(__spreadValues({
      "data-slot": "ai-textarea-toolbar",
      className: cn(
        "flex items-center justify-between",
        separator ? "border-t border-border p-2" : "px-3 pb-3",
        className
      )
    }, props), {
      children
    })
  );
}
function AiTextAreaToolbarGroup(_a) {
  var _b = _a, {
    className
  } = _b, props = __objRest(_b, [
    "className"
  ]);
  return /* @__PURE__ */ jsxRuntime.jsx(
    "div",
    __spreadValues({
      "data-slot": "ai-textarea-toolbar-group",
      className: cn("flex items-center gap-1", className)
    }, props)
  );
}
function AiTextAreaToolbarSeparator(_a) {
  var _b = _a, {
    className
  } = _b, props = __objRest(_b, [
    "className"
  ]);
  return /* @__PURE__ */ jsxRuntime.jsx(
    "div",
    __spreadValues({
      "data-slot": "ai-textarea-toolbar-separator",
      className: cn("mx-0.5 h-4 w-px shrink-0 bg-border", className)
    }, props)
  );
}
var aiTextAreaChipVariants = classVarianceAuthority.cva(
  "inline-flex shrink-0 items-center justify-center overflow-hidden text-sm font-medium text-muted-foreground transition-colors hover:text-foreground cursor-pointer select-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
  {
    variants: {
      shape: {
        pill: "rounded-full",
        rounded: "rounded-xs"
      },
      size: {
        sm: "min-h-6 min-w-6",
        default: "min-h-7 min-w-7"
      }
    },
    defaultVariants: { shape: "pill", size: "default" }
  }
);
function AiTextAreaChip(_a) {
  var _b = _a, {
    className,
    shape,
    size,
    children
  } = _b, props = __objRest(_b, [
    "className",
    "shape",
    "size",
    "children"
  ]);
  const childArray = React__namespace.Children.toArray(children);
  const hasLabel = childArray.some(
    (child) => typeof child === "string" || React__namespace.isValidElement(child) && child.type === "span"
  );
  return /* @__PURE__ */ jsxRuntime.jsx(
    "button",
    __spreadProps(__spreadValues({
      type: "button",
      "data-slot": "ai-textarea-chip",
      className: cn(
        "bg-muted/60 dark:bg-muted/50",
        aiTextAreaChipVariants({ shape, size }),
        hasLabel ? "gap-1 px-2 py-1" : "p-0",
        className
      )
    }, props), {
      children
    })
  );
}
var aiTextAreaActionButtonVariants = classVarianceAuthority.cva(
  "inline-flex shrink-0 items-center justify-center overflow-hidden transition-colors cursor-pointer outline-none text-muted-foreground hover:text-foreground select-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
  {
    variants: {
      size: {
        sm: "size-7 rounded-sm",
        default: "size-7 rounded-full"
      }
    },
    defaultVariants: { size: "default" }
  }
);
function AiTextAreaActionButton(_a) {
  var _b = _a, {
    className,
    size
  } = _b, props = __objRest(_b, [
    "className",
    "size"
  ]);
  return /* @__PURE__ */ jsxRuntime.jsx(
    "button",
    __spreadValues({
      type: "button",
      "data-slot": "ai-textarea-action-button",
      className: cn(aiTextAreaActionButtonVariants({ size, className }))
    }, props)
  );
}
var aiTextAreaSubmitVariants = classVarianceAuthority.cva(
  "relative inline-flex shrink-0 items-center justify-center overflow-hidden bg-primary text-primary-foreground shadow-none transition-colors hover:bg-primary/90 cursor-pointer outline-none disabled:pointer-events-none disabled:opacity-50 select-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
  {
    variants: {
      shape: {
        icon: "size-7 rounded-full p-0",
        pill: "h-7 gap-1 rounded-xs px-2 py-1 text-sm font-medium",
        "pill-sm": "h-6 gap-1 rounded-xs px-1.5 py-1 text-xs font-medium"
      }
    },
    defaultVariants: { shape: "icon" }
  }
);
function AiTextAreaSubmit(_a) {
  var _b = _a, {
    className,
    shape,
    children
  } = _b, props = __objRest(_b, [
    "className",
    "shape",
    "children"
  ]);
  return /* @__PURE__ */ jsxRuntime.jsx(
    "button",
    __spreadProps(__spreadValues({
      type: "submit",
      "data-slot": "ai-textarea-submit",
      className: cn(aiTextAreaSubmitVariants({ shape }), className)
    }, props), {
      children
    })
  );
}
function AiTextAreaSecondaryButton(_a) {
  var _b = _a, {
    className
  } = _b, props = __objRest(_b, [
    "className"
  ]);
  return /* @__PURE__ */ jsxRuntime.jsx(
    "button",
    __spreadProps(__spreadValues({
      type: "button",
      "data-slot": "ai-textarea-secondary-button",
      className: cn(
        "relative inline-flex shrink-0 items-center justify-center gap-1 rounded-xs border border-border bg-background px-2 py-1 text-sm font-medium text-foreground shadow-none transition-colors hover:border-input-hover hover:bg-muted cursor-pointer outline-none select-none dark:border-border dark:hover:border-input-hover",
        className
      )
    }, props), {
      children: typeof props.children === "string" ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "px-0.5", children: props.children }) : props.children
    })
  );
}

exports.AiTextArea = AiTextArea;
exports.AiTextAreaActionButton = AiTextAreaActionButton;
exports.AiTextAreaChip = AiTextAreaChip;
exports.AiTextAreaInput = AiTextAreaInput;
exports.AiTextAreaSecondaryButton = AiTextAreaSecondaryButton;
exports.AiTextAreaSubmit = AiTextAreaSubmit;
exports.AiTextAreaToolbar = AiTextAreaToolbar;
exports.AiTextAreaToolbarGroup = AiTextAreaToolbarGroup;
exports.AiTextAreaToolbarSeparator = AiTextAreaToolbarSeparator;
exports.aiTextAreaActionButtonVariants = aiTextAreaActionButtonVariants;
exports.aiTextAreaChipVariants = aiTextAreaChipVariants;
exports.aiTextAreaContainerVariants = aiTextAreaContainerVariants;
exports.aiTextAreaSubmitVariants = aiTextAreaSubmitVariants;
//# sourceMappingURL=ai-textarea.cjs.map
//# sourceMappingURL=ai-textarea.cjs.map