import u from "./index-objectWithoutPropertiesLoose.js";
import n from "./index-extends.js";
import "react";
import e from "./index-_virtual16.js";
import l from "./index-styled.js";
import { jsx as o } from "react/jsx-runtime";
import c from "./index-rootShouldForwardProp.js";
var d;
const m = ["children", "classes", "className", "label", "notched"], b = l("fieldset", {
  shouldForwardProp: c
})({
  textAlign: "left",
  position: "absolute",
  bottom: 0,
  right: 0,
  top: -5,
  left: 0,
  margin: 0,
  padding: "0 8px",
  pointerEvents: "none",
  borderRadius: "inherit",
  borderStyle: "solid",
  borderWidth: 1,
  overflow: "hidden",
  minWidth: "0%"
}), g = l("legend", {
  shouldForwardProp: c
})(({
  ownerState: i,
  theme: t
}) => n({
  float: "unset",
  // Fix conflict with bootstrap
  width: "auto",
  // Fix conflict with bootstrap
  overflow: "hidden"
}, !i.withLabel && {
  padding: 0,
  lineHeight: "11px",
  // sync with `height` in `legend` styles
  transition: t.transitions.create("width", {
    duration: 150,
    easing: t.transitions.easing.easeOut
  })
}, i.withLabel && n({
  display: "block",
  // Fix conflict with normalize.css and sanitize.css
  padding: 0,
  height: 11,
  // sync with `lineHeight` in `legend` styles
  fontSize: "0.75em",
  visibility: "hidden",
  maxWidth: 0.01,
  transition: t.transitions.create("max-width", {
    duration: 50,
    easing: t.transitions.easing.easeOut
  }),
  whiteSpace: "nowrap",
  "& > span": {
    paddingLeft: 5,
    paddingRight: 5,
    display: "inline-block",
    opacity: 0,
    visibility: "visible"
  }
}, i.notched && {
  maxWidth: "100%",
  transition: t.transitions.create("max-width", {
    duration: 100,
    easing: t.transitions.easing.easeOut,
    delay: 50
  })
})));
function f(i) {
  const {
    className: t,
    label: a,
    notched: h
  } = i, p = u(i, m), s = a != null && a !== "", r = n({}, i, {
    notched: h,
    withLabel: s
  });
  return /* @__PURE__ */ o(b, n({
    "aria-hidden": !0,
    className: t,
    ownerState: r
  }, p, {
    children: /* @__PURE__ */ o(g, {
      ownerState: r,
      children: s ? /* @__PURE__ */ o("span", {
        children: a
      }) : (
        // notranslate needed while Google Translate will not fix zero-width space issue
        d || (d = /* @__PURE__ */ o("span", {
          className: "notranslate",
          children: "​"
        }))
      )
    })
  }));
}
process.env.NODE_ENV !== "production" && (f.propTypes = {
  /**
   * The content of the component.
   */
  children: e.node,
  /**
   * Override or extend the styles applied to the component.
   */
  classes: e.object,
  /**
   * @ignore
   */
  className: e.string,
  /**
   * The label.
   */
  label: e.node,
  /**
   * If `true`, the outline is notched to accommodate the label.
   */
  notched: e.bool.isRequired,
  /**
   * @ignore
   */
  style: e.object
});
export {
  f as default
};
