var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
  for (var name in all)
    __defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
  if (from && typeof from === "object" || typeof from === "function") {
    for (let key of __getOwnPropNames(from))
      if (!__hasOwnProp.call(to, key) && key !== except)
        __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  }
  return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
  // If the importer is in node compatibility mode or this is not an ESM
  // file that has been converted to a CommonJS file using a Babel-
  // compatible transform (i.e. "__esModule" has not been set), then set
  // "default" to the CommonJS "module.exports" for node compatibility.
  isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
  mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);

// src/components/pisellTimeNavigator/components/ScaleLayer.tsx
var ScaleLayer_exports = {};
__export(ScaleLayer_exports, {
  ScaleLayer: () => ScaleLayer
});
module.exports = __toCommonJS(ScaleLayer_exports);
var import_react = __toESM(require("react"));
var import_classnames = __toESM(require("classnames"));
function ScaleLayer({
  orientation,
  ticks,
  stepMinutes,
  majorStepMinutes,
  timeFormat,
  locale,
  style,
  className,
  horizontalCellSizePx,
  cellWidthsPx,
  leadingPaddingPx,
  trailingPaddingPx
}) {
  const isHorizontal = orientation === "horizontal";
  return /* @__PURE__ */ import_react.default.createElement(
    "div",
    {
      className: (0, import_classnames.default)(
        "pisell-time-navigator-scale",
        `pisell-time-navigator-scale--${orientation}`,
        className
      ),
      style
    },
    isHorizontal && leadingPaddingPx != null && leadingPaddingPx > 0 && /* @__PURE__ */ import_react.default.createElement(
      "div",
      {
        "aria-hidden": true,
        style: {
          width: leadingPaddingPx,
          minWidth: leadingPaddingPx,
          maxWidth: leadingPaddingPx,
          flex: "0 0 auto"
        }
      }
    ),
    ticks.map((tick, i) => {
      const isMajor = tick.minute() === 0 && tick.second() === 0;
      const label = isHorizontal && isMajor ? locale ? tick.locale(locale).format("H") : tick.format("H") : locale ? tick.locale(locale).format(timeFormat) : tick.format(timeFormat);
      if (isHorizontal) {
        const baseCw = horizontalCellSizePx != null && horizontalCellSizePx > 0 ? horizontalCellSizePx : void 0;
        const cw = cellWidthsPx != null && cellWidthsPx[i] != null ? cellWidthsPx[i] : baseCw;
        const compactPad = cw != null ? cw < 36 ? 2 : cw < 52 ? 6 : 10 : void 0;
        return /* @__PURE__ */ import_react.default.createElement(
          "div",
          {
            key: i,
            className: (0, import_classnames.default)(
              "pisell-time-navigator-scale-cell",
              "pisell-time-navigator-scale-cell--h",
              { "pisell-time-navigator-scale-cell--major": isMajor }
            ),
            style: cw != null ? {
              width: cw,
              minWidth: cw,
              maxWidth: cw,
              flex: "0 0 auto",
              boxSizing: "border-box",
              ...compactPad != null ? { padding: compactPad } : {}
            } : void 0
          },
          isMajor && /* @__PURE__ */ import_react.default.createElement(
            "span",
            {
              className: "pisell-time-navigator-scale-label",
              style: cw != null && cw < 48 ? {
                fontSize: Math.max(10, Math.round(cw * 0.32)),
                lineHeight: 1.15
              } : void 0
            },
            label
          ),
          !isMajor && /* @__PURE__ */ import_react.default.createElement("span", { className: "pisell-time-navigator-scale-dot", "aria-hidden": true })
        );
      }
      return /* @__PURE__ */ import_react.default.createElement(
        "div",
        {
          key: i,
          className: (0, import_classnames.default)(
            "pisell-time-navigator-scale-cell",
            "pisell-time-navigator-scale-cell--v",
            { "pisell-time-navigator-scale-cell--major": isMajor }
          )
        },
        /* @__PURE__ */ import_react.default.createElement("span", { className: "pisell-time-navigator-scale-divider", "aria-hidden": true }),
        isMajor && /* @__PURE__ */ import_react.default.createElement("span", { className: "pisell-time-navigator-scale-label" }, label)
      );
    }),
    isHorizontal && trailingPaddingPx != null && trailingPaddingPx > 0 && /* @__PURE__ */ import_react.default.createElement(
      "div",
      {
        "aria-hidden": true,
        style: {
          width: trailingPaddingPx,
          minWidth: trailingPaddingPx,
          maxWidth: trailingPaddingPx,
          flex: "0 0 auto"
        }
      }
    )
  );
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
  ScaleLayer
});
