import { s as __toESM, t as __commonJSMin } from "./chunk-BNovOVIE.js";
import { t as require_react } from "./react-Bs6Z0kvn.js";
import { t as require_compiler_runtime } from "./compiler-runtime-B_OLMU9S.js";
import { l as createLucideIcon } from "./dist-D_UjpfOY.js";
import { t as Button } from "./button-DNlNlZY_.js";
import { t as require_jsx_runtime } from "./jsx-runtime-9hcJiI23.js";
import { n as Constants } from "./constants-CvyfaCvs.js";
var Pencil = createLucideIcon("pencil", [["path", {
  d: "M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",
  key: "1a8usu"
}], ["path", {
  d: "m15 5 4 4",
  key: "1mk7zo"
}]]), Plus = createLucideIcon("plus", [["path", {
  d: "M5 12h14",
  key: "1ays0h"
}], ["path", {
  d: "M12 5v14",
  key: "s699le"
}]]), Trash = createLucideIcon("trash", [
  ["path", {
    d: "M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",
    key: "miytrc"
  }],
  ["path", {
    d: "M3 6h18",
    key: "d0wm0j"
  }],
  ["path", {
    d: "M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",
    key: "e791ji"
  }]
]), require_ReactPropTypesSecret = /* @__PURE__ */ __commonJSMin(((e, h) => {
  h.exports = "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";
})), require_factoryWithThrowingShims = /* @__PURE__ */ __commonJSMin(((e, h) => {
  var g = require_ReactPropTypesSecret();
  function _() {
  }
  function v() {
  }
  v.resetWarningCache = _, h.exports = function() {
    function e2(e3, h3, _2, v2, y2, b) {
      if (b !== g) {
        var x = /* @__PURE__ */ Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");
        throw x.name = "Invariant Violation", x;
      }
    }
    e2.isRequired = e2;
    function h2() {
      return e2;
    }
    var y = {
      array: e2,
      bigint: e2,
      bool: e2,
      func: e2,
      number: e2,
      object: e2,
      string: e2,
      symbol: e2,
      any: e2,
      arrayOf: h2,
      element: e2,
      elementType: e2,
      instanceOf: h2,
      node: e2,
      objectOf: h2,
      oneOf: h2,
      oneOfType: h2,
      shape: h2,
      exact: h2,
      checkPropTypes: v,
      resetWarningCache: _
    };
    return y.PropTypes = y, y;
  };
})), require_prop_types = /* @__PURE__ */ __commonJSMin(((e, h) => {
  h.exports = require_factoryWithThrowingShims()();
})), import_react = /* @__PURE__ */ __toESM(require_react()), ErrorBoundaryContext = (0, import_react.createContext)(null), initialState = {
  didCatch: false,
  error: null
}, ErrorBoundary = class extends import_react.Component {
  constructor(e) {
    super(e), this.resetErrorBoundary = this.resetErrorBoundary.bind(this), this.state = initialState;
  }
  static getDerivedStateFromError(e) {
    return {
      didCatch: true,
      error: e
    };
  }
  resetErrorBoundary() {
    let { error: e } = this.state;
    if (e !== null) {
      var h, g, _ = [...arguments];
      (h = (g = this.props).onReset) == null || h.call(g, {
        args: _,
        reason: "imperative-api"
      }), this.setState(initialState);
    }
  }
  componentDidCatch(e, h) {
    var g, _;
    (g = (_ = this.props).onError) == null || g.call(_, e, h);
  }
  componentDidUpdate(e, h) {
    let { didCatch: g } = this.state, { resetKeys: _ } = this.props;
    if (g && h.error !== null && hasArrayChanged(e.resetKeys, _)) {
      var v, y;
      (v = (y = this.props).onReset) == null || v.call(y, {
        next: _,
        prev: e.resetKeys,
        reason: "keys"
      }), this.setState(initialState);
    }
  }
  render() {
    let { children: e, fallbackRender: h, FallbackComponent: g, fallback: _ } = this.props, { didCatch: v, error: y } = this.state, b = e;
    if (v) {
      let e2 = {
        error: y,
        resetErrorBoundary: this.resetErrorBoundary
      };
      if (typeof h == "function") b = h(e2);
      else if (g) b = (0, import_react.createElement)(g, e2);
      else if (_ !== void 0) b = _;
      else throw y;
    }
    return (0, import_react.createElement)(ErrorBoundaryContext.Provider, { value: {
      didCatch: v,
      error: y,
      resetErrorBoundary: this.resetErrorBoundary
    } }, b);
  }
};
function hasArrayChanged() {
  let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [], h = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : [];
  return e.length !== h.length || e.some((e2, g) => !Object.is(e2, h[g]));
}
var import_compiler_runtime = require_compiler_runtime(), import_jsx_runtime = /* @__PURE__ */ __toESM(require_jsx_runtime(), 1);
const ErrorBoundary$1 = (e) => {
  let h = (0, import_compiler_runtime.c)(2), g;
  return h[0] === e.children ? g = h[1] : (g = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ErrorBoundary, {
    FallbackComponent,
    children: e.children
  }), h[0] = e.children, h[1] = g), g;
};
var FallbackComponent = (e) => {
  var _a;
  let h = (0, import_compiler_runtime.c)(9), g;
  h[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (g = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("h1", {
    className: "text-2xl font-bold",
    children: "Something went wrong"
  }), h[0] = g) : g = h[0];
  let _ = (_a = e.error) == null ? void 0 : _a.message, v;
  h[1] === _ ? v = h[2] : (v = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("pre", {
    className: "text-xs bg-muted/40 border rounded-md p-4 max-w-[80%] whitespace-normal",
    children: _
  }), h[1] = _, h[2] = v);
  let b;
  h[3] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (b = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { children: [
    "If this is an issue with marimo, please report it on",
    " ",
    /* @__PURE__ */ (0, import_jsx_runtime.jsx)("a", {
      href: Constants.issuesPage,
      target: "_blank",
      className: "underline",
      children: "GitHub"
    }),
    "."
  ] }), h[3] = b) : b = h[3];
  let S;
  h[4] === e.resetErrorBoundary ? S = h[5] : (S = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, {
    "data-testid": "reset-error-boundary-button",
    onClick: e.resetErrorBoundary,
    variant: "outline",
    children: "Try again"
  }), h[4] = e.resetErrorBoundary, h[5] = S);
  let C;
  return h[6] !== v || h[7] !== S ? (C = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
    className: "flex-1 flex items-center justify-center flex-col space-y-4 max-w-2xl mx-auto px-6",
    children: [
      g,
      v,
      b,
      S
    ]
  }), h[6] = v, h[7] = S, h[8] = C) : C = h[8], C;
};
const BulkEdit = {
  Insert: "insert",
  Remove: "remove",
  Rename: "rename"
};
export {
  Plus as a,
  Trash as i,
  ErrorBoundary$1 as n,
  Pencil as o,
  require_prop_types as r,
  BulkEdit as t
};
