var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
  for (var name in all)
    __defProp(target, name, { get: all[name], enumerable: !0 });
}, __copyProps = (to, from, except, desc) => {
  if (from && typeof from == "object" || typeof from == "function")
    for (let key of __getOwnPropNames(from))
      !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
var Progress_exports = {};
__export(Progress_exports, {
  Progress: () => Progress
});
module.exports = __toCommonJS(Progress_exports);
var import_jsx_runtime = require("react/jsx-runtime"), import_react = require("react"), import_tamagui = require("tamagui"), Context = /* @__PURE__ */ (0, import_react.createContext)({
  width: 0
}), ProgressContext = (0, import_tamagui.createStyledContext)({
  variant: "determinate",
  value: 0
}), Frame = (0, import_tamagui.styled)(import_tamagui.XStack, {
  name: "ProgressFrame",
  context: ProgressContext,
  flexDirection: "row",
  alignItems: "center",
  justifyContent: "space-between",
  height: 4,
  maxHeight: 4,
  position: "relative"
}), FrameHOC = Frame.styleable(function(props, ref) {
  var [width, setWidth] = (0, import_react.useState)(0);
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Context.Provider, {
    value: {
      width
    },
    children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Frame, {
      ...props,
      ref,
      onLayout: function(e) {
        return setWidth(e.nativeEvent.layout.width);
      }
    })
  });
}), Track = (0, import_tamagui.styled)(import_tamagui.ThemeableStack, {
  name: "ProgressTrack",
  context: ProgressContext,
  backgroundColor: "$primaryContainer",
  height: 4,
  animateOnly: [
    "width"
  ],
  animation: "slow",
  flexDirection: "row",
  borderRadius: "$shape.corner_full",
  fg: 1
}), Indicator = (0, import_tamagui.styled)(import_tamagui.ThemeableStack, {
  name: "ProgressIndicator",
  context: ProgressContext,
  height: 4,
  backgroundColor: "$primary",
  animateOnly: [
    "width"
  ],
  animation: "slow",
  borderRadius: "$shape.corner_full",
  mr: 4,
  position: "absolute",
  left: 0,
  bottom: 0,
  zIndex: 10
}), IndicatorHOC = Indicator.styleable(function(props, ref) {
  var _useContext, { value } = (0, import_react.useContext)(ProgressContext), width = (_useContext = (0, import_react.useContext)(Context)) === null || _useContext === void 0 ? void 0 : _useContext.width, displayWidth = Math.min(width * value, width);
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Indicator, {
    ...props,
    ref,
    width: displayWidth
  });
}), Target = (0, import_tamagui.styled)(import_tamagui.View, {
  name: "ProgressTarget",
  context: ProgressContext,
  width: 4,
  height: 4,
  borderRadius: 100,
  backgroundColor: "$primary"
}), Progress = (0, import_tamagui.withStaticProperties)(FrameHOC, {
  Props: ProgressContext.Provider,
  Track,
  Indicator: IndicatorHOC,
  Target
});
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
  Progress
});
//# sourceMappingURL=Progress.js.map
