import {
  ExperimentsTable
} from "/build/_shared/chunk-3FARDXDG.js";
import "/build/_shared/chunk-W6HEMSBR.js";
import "/build/_shared/chunk-XSZNYPTW.js";
import "/build/_shared/chunk-KSAJCXX3.js";
import "/build/_shared/chunk-F5GZ2BM6.js";
import "/build/_shared/chunk-ZESRKRPI.js";
import {
  require_dayjs_min
} from "/build/_shared/chunk-RFBEIH4W.js";
import {
  PageDocLink
} from "/build/_shared/chunk-TPFG27GP.js";
import {
  PageSubtitle
} from "/build/_shared/chunk-Z534YQLL.js";
import "/build/_shared/chunk-4CHLX6OP.js";
import {
  PageLayout
} from "/build/_shared/chunk-IVHXUM2B.js";
import "/build/_shared/chunk-P2DAPPQF.js";
import "/build/_shared/chunk-AI5FD5Y6.js";
import {
  require_jsx_dev_runtime
} from "/build/_shared/chunk-D5XSJF2M.js";
import {
  init_esm2 as init_esm,
  useLoaderData
} from "/build/_shared/chunk-VJFCZKPM.js";
import "/build/_shared/chunk-OCFPP4X2.js";
import "/build/_shared/chunk-HWKMUXRS.js";
import {
  withAuth
} from "/build/_shared/chunk-RHQW4WCH.js";
import {
  require_node
} from "/build/_shared/chunk-MDLUSIM2.js";
import "/build/_shared/chunk-EB6A6RVQ.js";
import {
  Routes
} from "/build/_shared/chunk-5222SY3A.js";
import {
  createHotContext,
  init_remix_hmr
} from "/build/_shared/chunk-4FTV3JJX.js";
import "/build/_shared/chunk-YLRAJVC6.js";
import {
  __toESM
} from "/build/_shared/chunk-RODUX5XG.js";

// app/routes/app+/project+/$projectId+/env+/$envId+/experiments+/index.tsx
init_remix_hmr();
var import_node = __toESM(require_node(), 1);
init_esm();
var import_dayjs = __toESM(require_dayjs_min(), 1);

// app/pages/experiments/ExperimentsPage.tsx
init_remix_hmr();
var import_jsx_dev_runtime = __toESM(require_jsx_dev_runtime(), 1);
if (!window.$RefreshReg$ || !window.$RefreshSig$ || !window.$RefreshRuntime$) {
  console.warn("remix:hmr: React Fast Refresh only works when the Remix compiler is running in development mode.");
} else {
  prevRefreshReg = window.$RefreshReg$;
  prevRefreshSig = window.$RefreshSig$;
  window.$RefreshReg$ = (type, id) => {
    window.$RefreshRuntime$.register(type, '"app/pages/experiments/ExperimentsPage.tsx"' + id);
  };
  window.$RefreshSig$ = window.$RefreshRuntime$.createSignatureFunctionForTransform;
}
var prevRefreshReg;
var prevRefreshSig;
if (import.meta) {
  import.meta.hot = createHotContext(
    //@ts-expect-error
    "app/pages/experiments/ExperimentsPage.tsx"
  );
  import.meta.hot.lastModified = "1715882071664.0928";
}
var ExperimentsPage = ({
  experiments,
  totalCount,
  currentPage,
  totalPages
}) => {
  const breadcrumbs = [{
    label: "Experiments"
  }];
  const subtitle = () => {
    return /* @__PURE__ */ (0, import_jsx_dev_runtime.jsxDEV)(PageSubtitle, { children: [
      "Run experiments from your codebase to validate your system.",
      " ",
      /* @__PURE__ */ (0, import_jsx_dev_runtime.jsxDEV)(PageDocLink, { to: Routes.external.docs.experiments, children: "Experiments Docs." }, void 0, false, {
        fileName: "app/pages/experiments/ExperimentsPage.tsx",
        lineNumber: 38,
        columnNumber: 9
      }, this)
    ] }, void 0, true, {
      fileName: "app/pages/experiments/ExperimentsPage.tsx",
      lineNumber: 36,
      columnNumber: 12
    }, this);
  };
  return /* @__PURE__ */ (0, import_jsx_dev_runtime.jsxDEV)(PageLayout, { breadcrumbs, subtitle, children: /* @__PURE__ */ (0, import_jsx_dev_runtime.jsxDEV)(ExperimentsTable, { experiments, totalCount, currentPage, totalPages }, void 0, false, {
    fileName: "app/pages/experiments/ExperimentsPage.tsx",
    lineNumber: 42,
    columnNumber: 7
  }, this) }, void 0, false, {
    fileName: "app/pages/experiments/ExperimentsPage.tsx",
    lineNumber: 41,
    columnNumber: 10
  }, this);
};
_c = ExperimentsPage;
var _c;
$RefreshReg$(_c, "ExperimentsPage");
window.$RefreshReg$ = prevRefreshReg;
window.$RefreshSig$ = prevRefreshSig;

// app/routes/app+/project+/$projectId+/env+/$envId+/experiments+/index.tsx
var import_jsx_dev_runtime2 = __toESM(require_jsx_dev_runtime(), 1);
if (!window.$RefreshReg$ || !window.$RefreshSig$ || !window.$RefreshRuntime$) {
  console.warn("remix:hmr: React Fast Refresh only works when the Remix compiler is running in development mode.");
} else {
  prevRefreshReg = window.$RefreshReg$;
  prevRefreshSig = window.$RefreshSig$;
  window.$RefreshReg$ = (type, id) => {
    window.$RefreshRuntime$.register(type, '"app/routes/app+/project+/$projectId+/env+/$envId+/experiments+/index.tsx"' + id);
  };
  window.$RefreshSig$ = window.$RefreshRuntime$.createSignatureFunctionForTransform;
}
var prevRefreshReg;
var prevRefreshSig;
var _s = $RefreshSig$();
if (import.meta) {
  import.meta.hot = createHotContext(
    //@ts-expect-error
    "app/routes/app+/project+/$projectId+/env+/$envId+/experiments+/index.tsx"
  );
  import.meta.hot.lastModified = "1715882071673.1272";
}
var loader = withAuth(async ({
  request,
  api,
  params
}) => {
  const envId = params.envId;
  const {
    searchParams
  } = new URL(request.url);
  const currentPage = parseInt(searchParams.get("page") || "1");
  const pageSize = 20;
  const skipAmount = (currentPage - 1) * pageSize;
  const {
    experiments,
    totalCount
  } = await api.experiment.experimentControllerGetPaginatedExperimentsForEnvironment({
    envId,
    take: pageSize.toString(),
    skip: skipAmount.toString()
  });
  const totalPages = Math.ceil(totalCount / pageSize);
  const formattedExperiments = experiments.map((experiment) => ({
    ...experiment,
    createdAt: (0, import_dayjs.default)(experiment.createdAt).format("MMM D YY / h:mm:ss a")
  }));
  return (0, import_node.json)({
    experiments: formattedExperiments,
    totalCount,
    currentPage,
    totalPages
  });
});
function ExperimentsRoute() {
  _s();
  const {
    experiments,
    totalCount,
    currentPage,
    totalPages
  } = useLoaderData();
  return /* @__PURE__ */ (0, import_jsx_dev_runtime2.jsxDEV)(ExperimentsPage, { experiments, totalCount, currentPage, totalPages }, void 0, false, {
    fileName: "app/routes/app+/project+/$projectId+/env+/$envId+/experiments+/index.tsx",
    lineNumber: 67,
    columnNumber: 10
  }, this);
}
_s(ExperimentsRoute, "Rj0Ci2jFIcdusZtiBHjtBjR7Mgo=", false, function() {
  return [useLoaderData];
});
_c2 = ExperimentsRoute;
var _c2;
$RefreshReg$(_c2, "ExperimentsRoute");
window.$RefreshReg$ = prevRefreshReg;
window.$RefreshSig$ = prevRefreshSig;
export {
  ExperimentsRoute as default
};
//# sourceMappingURL=/build/routes/app+/project+/$projectId+/env+/$envId+/experiments+/index-HLBX3PT3.js.map
