import {
  PageDocLink
} from "/build/_shared/chunk-T75MUU5G.js";
import {
  Button
} from "/build/_shared/chunk-UWBTKPLD.js";
import {
  Badge,
  idShortener
} from "/build/_shared/chunk-634BMO4L.js";
import {
  require_dayjs_min
} from "/build/_shared/chunk-HUUSILLY.js";
import {
  PageSubtitle
} from "/build/_shared/chunk-VV3RU6RL.js";
import {
  Table,
  TableBody,
  TableCell,
  TableHead,
  TableHeader,
  TableRow
} from "/build/_shared/chunk-P3C75TI5.js";
import {
  PageLayout
} from "/build/_shared/chunk-BXT5AGPN.js";
import {
  ExternalLink,
  RefreshCw
} from "/build/_shared/chunk-EJE2TVVM.js";
import "/build/_shared/chunk-LGQ4GCFK.js";
import "/build/_shared/chunk-AI5FD5Y6.js";
import {
  withAuth
} from "/build/_shared/chunk-NHF4CNMF.js";
import "/build/_shared/chunk-KQKP3VNY.js";
import {
  Link,
  init_esm2 as init_esm,
  useLoaderData,
  useParams,
  useRevalidator
} from "/build/_shared/chunk-ZC2TL3GZ.js";
import {
  require_jsx_dev_runtime
} from "/build/_shared/chunk-ED7KKCRB.js";
import "/build/_shared/chunk-RYE6BCZB.js";
import "/build/_shared/chunk-PECDPABK.js";
import {
  require_node
} from "/build/_shared/chunk-G7CHZRZX.js";
import "/build/_shared/chunk-TLLKLDIT.js";
import {
  Routes
} from "/build/_shared/chunk-N27UEDHN.js";
import {
  createHotContext,
  init_remix_hmr
} from "/build/_shared/chunk-G7KTOMTD.js";
import "/build/_shared/chunk-ZIPKILLR.js";
import {
  __toESM
} from "/build/_shared/chunk-PNG5AS42.js";

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

// app/pages/finetuning/FineTuningPage.tsx
init_remix_hmr();
init_esm();

// app/pages/finetuning/FineTunesTable.tsx
init_remix_hmr();

// app/pages/finetuning/FineTuneCell.tsx
init_remix_hmr();
init_esm();
var import_dayjs = __toESM(require_dayjs_min(), 1);
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/finetuning/FineTuneCell.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/pages/finetuning/FineTuneCell.tsx"
  );
  import.meta.hot.lastModified = "1713199469913.7";
}
var FineTuneCell = ({
  finetune
}) => {
  _s();
  const params = useParams();
  const metadata = finetune.metadata;
  const {
    variant
  } = idShortener(finetune.id);
  const to = `https://platform.openai.com/finetune/${metadata.id}`;
  return /* @__PURE__ */ (0, import_jsx_dev_runtime.jsxDEV)(TableRow, { children: [
    /* @__PURE__ */ (0, import_jsx_dev_runtime.jsxDEV)(TableCell, { className: "max-w-36", children: metadata?.fine_tuned_model ? /* @__PURE__ */ (0, import_jsx_dev_runtime.jsxDEV)(Badge, { variant, children: metadata?.fine_tuned_model }, void 0, false, {
      fileName: "app/pages/finetuning/FineTuneCell.tsx",
      lineNumber: 41,
      columnNumber: 39
    }, this) : "\u2014" }, void 0, false, {
      fileName: "app/pages/finetuning/FineTuneCell.tsx",
      lineNumber: 40,
      columnNumber: 7
    }, this),
    /* @__PURE__ */ (0, import_jsx_dev_runtime.jsxDEV)(TableCell, { children: /* @__PURE__ */ (0, import_jsx_dev_runtime.jsxDEV)(Link, { to: Routes.app.project.env.datasetsId({
      projectId: params.projectId,
      envId: params.envId,
      datasetId: finetune.dataset.id
    }), className: "flex gap-1", children: [
      /* @__PURE__ */ (0, import_jsx_dev_runtime.jsxDEV)(ExternalLink, { className: "h-4 w-4" }, void 0, false, {
        fileName: "app/pages/finetuning/FineTuneCell.tsx",
        lineNumber: 49,
        columnNumber: 11
      }, this),
      /* @__PURE__ */ (0, import_jsx_dev_runtime.jsxDEV)("p", { children: finetune.dataset.name }, void 0, false, {
        fileName: "app/pages/finetuning/FineTuneCell.tsx",
        lineNumber: 50,
        columnNumber: 11
      }, this)
    ] }, void 0, true, {
      fileName: "app/pages/finetuning/FineTuneCell.tsx",
      lineNumber: 44,
      columnNumber: 9
    }, this) }, void 0, false, {
      fileName: "app/pages/finetuning/FineTuneCell.tsx",
      lineNumber: 43,
      columnNumber: 7
    }, this),
    /* @__PURE__ */ (0, import_jsx_dev_runtime.jsxDEV)(TableCell, { children: finetune.provider }, void 0, false, {
      fileName: "app/pages/finetuning/FineTuneCell.tsx",
      lineNumber: 53,
      columnNumber: 7
    }, this),
    /* @__PURE__ */ (0, import_jsx_dev_runtime.jsxDEV)(TableCell, { children: finetune.model }, void 0, false, {
      fileName: "app/pages/finetuning/FineTuneCell.tsx",
      lineNumber: 54,
      columnNumber: 7
    }, this),
    /* @__PURE__ */ (0, import_jsx_dev_runtime.jsxDEV)(TableCell, { children: finetune.status }, void 0, false, {
      fileName: "app/pages/finetuning/FineTuneCell.tsx",
      lineNumber: 55,
      columnNumber: 7
    }, this),
    /* @__PURE__ */ (0, import_jsx_dev_runtime.jsxDEV)(TableCell, { children: metadata.created_at ? (0, import_dayjs.default)(metadata.created_at * 1e3).format("h:mma D/M/YY") : "\u2014" }, void 0, false, {
      fileName: "app/pages/finetuning/FineTuneCell.tsx",
      lineNumber: 56,
      columnNumber: 7
    }, this),
    /* @__PURE__ */ (0, import_jsx_dev_runtime.jsxDEV)(TableCell, { children: metadata.finished_at ? (0, import_dayjs.default)(metadata.finished_at * 1e3).format("h:mma D/M/YY") : "\u2014" }, void 0, false, {
      fileName: "app/pages/finetuning/FineTuneCell.tsx",
      lineNumber: 57,
      columnNumber: 7
    }, this),
    /* @__PURE__ */ (0, import_jsx_dev_runtime.jsxDEV)(TableCell, { children: /* @__PURE__ */ (0, import_jsx_dev_runtime.jsxDEV)(Link, { to, target: "_blank", rel: "noopener noreferrer", children: /* @__PURE__ */ (0, import_jsx_dev_runtime.jsxDEV)(ExternalLink, { className: "h-4 w-4" }, void 0, false, {
      fileName: "app/pages/finetuning/FineTuneCell.tsx",
      lineNumber: 60,
      columnNumber: 11
    }, this) }, void 0, false, {
      fileName: "app/pages/finetuning/FineTuneCell.tsx",
      lineNumber: 59,
      columnNumber: 9
    }, this) }, void 0, false, {
      fileName: "app/pages/finetuning/FineTuneCell.tsx",
      lineNumber: 58,
      columnNumber: 7
    }, this)
  ] }, finetune.id, true, {
    fileName: "app/pages/finetuning/FineTuneCell.tsx",
    lineNumber: 39,
    columnNumber: 10
  }, this);
};
_s(FineTuneCell, "+jVsTcECDRo3yq2d7EQxlN9Ixog=", false, function() {
  return [useParams];
});
_c = FineTuneCell;
var _c;
$RefreshReg$(_c, "FineTuneCell");
window.$RefreshReg$ = prevRefreshReg;
window.$RefreshSig$ = prevRefreshSig;

// app/pages/finetuning/FineTunesTable.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/pages/finetuning/FineTunesTable.tsx"' + id);
  };
  window.$RefreshSig$ = window.$RefreshRuntime$.createSignatureFunctionForTransform;
}
var prevRefreshReg;
var prevRefreshSig;
if (import.meta) {
  import.meta.hot = createHotContext(
    //@ts-expect-error
    "app/pages/finetuning/FineTunesTable.tsx"
  );
  import.meta.hot.lastModified = "1713199469913.8267";
}
var FineTunesTable = ({
  fineTunes
}) => {
  console.log(fineTunes);
  return /* @__PURE__ */ (0, import_jsx_dev_runtime2.jsxDEV)(Table, { children: [
    /* @__PURE__ */ (0, import_jsx_dev_runtime2.jsxDEV)(TableHeader, { children: /* @__PURE__ */ (0, import_jsx_dev_runtime2.jsxDEV)(TableRow, { children: [
      /* @__PURE__ */ (0, import_jsx_dev_runtime2.jsxDEV)(TableHead, { children: "ID" }, void 0, false, {
        fileName: "app/pages/finetuning/FineTunesTable.tsx",
        lineNumber: 30,
        columnNumber: 11
      }, this),
      /* @__PURE__ */ (0, import_jsx_dev_runtime2.jsxDEV)(TableHead, { children: "Dataset" }, void 0, false, {
        fileName: "app/pages/finetuning/FineTunesTable.tsx",
        lineNumber: 31,
        columnNumber: 11
      }, this),
      /* @__PURE__ */ (0, import_jsx_dev_runtime2.jsxDEV)(TableHead, { children: "Provider" }, void 0, false, {
        fileName: "app/pages/finetuning/FineTunesTable.tsx",
        lineNumber: 32,
        columnNumber: 11
      }, this),
      /* @__PURE__ */ (0, import_jsx_dev_runtime2.jsxDEV)(TableHead, { children: "Model" }, void 0, false, {
        fileName: "app/pages/finetuning/FineTunesTable.tsx",
        lineNumber: 33,
        columnNumber: 11
      }, this),
      /* @__PURE__ */ (0, import_jsx_dev_runtime2.jsxDEV)(TableHead, { children: "Status" }, void 0, false, {
        fileName: "app/pages/finetuning/FineTunesTable.tsx",
        lineNumber: 34,
        columnNumber: 11
      }, this),
      /* @__PURE__ */ (0, import_jsx_dev_runtime2.jsxDEV)(TableHead, { children: "Started" }, void 0, false, {
        fileName: "app/pages/finetuning/FineTunesTable.tsx",
        lineNumber: 35,
        columnNumber: 11
      }, this),
      /* @__PURE__ */ (0, import_jsx_dev_runtime2.jsxDEV)(TableHead, { children: "Ended" }, void 0, false, {
        fileName: "app/pages/finetuning/FineTunesTable.tsx",
        lineNumber: 36,
        columnNumber: 11
      }, this),
      /* @__PURE__ */ (0, import_jsx_dev_runtime2.jsxDEV)(TableHead, { children: "Actions" }, void 0, false, {
        fileName: "app/pages/finetuning/FineTunesTable.tsx",
        lineNumber: 37,
        columnNumber: 11
      }, this)
    ] }, void 0, true, {
      fileName: "app/pages/finetuning/FineTunesTable.tsx",
      lineNumber: 29,
      columnNumber: 9
    }, this) }, void 0, false, {
      fileName: "app/pages/finetuning/FineTunesTable.tsx",
      lineNumber: 28,
      columnNumber: 7
    }, this),
    /* @__PURE__ */ (0, import_jsx_dev_runtime2.jsxDEV)(TableBody, { children: fineTunes.length ? fineTunes.map((finetune) => /* @__PURE__ */ (0, import_jsx_dev_runtime2.jsxDEV)(FineTuneCell, { finetune }, finetune.id, false, {
      fileName: "app/pages/finetuning/FineTunesTable.tsx",
      lineNumber: 41,
      columnNumber: 55
    }, this)) : /* @__PURE__ */ (0, import_jsx_dev_runtime2.jsxDEV)(TableRow, { children: /* @__PURE__ */ (0, import_jsx_dev_runtime2.jsxDEV)(TableCell, { colSpan: 8, className: "h-24 text-center", children: "No fine-tunes." }, void 0, false, {
      fileName: "app/pages/finetuning/FineTunesTable.tsx",
      lineNumber: 42,
      columnNumber: 13
    }, this) }, void 0, false, {
      fileName: "app/pages/finetuning/FineTunesTable.tsx",
      lineNumber: 41,
      columnNumber: 113
    }, this) }, void 0, false, {
      fileName: "app/pages/finetuning/FineTunesTable.tsx",
      lineNumber: 40,
      columnNumber: 7
    }, this)
  ] }, void 0, true, {
    fileName: "app/pages/finetuning/FineTunesTable.tsx",
    lineNumber: 27,
    columnNumber: 10
  }, this);
};
_c2 = FineTunesTable;
var _c2;
$RefreshReg$(_c2, "FineTunesTable");
window.$RefreshReg$ = prevRefreshReg;
window.$RefreshSig$ = prevRefreshSig;

// app/pages/finetuning/FineTuningPage.tsx
var import_jsx_dev_runtime3 = __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/finetuning/FineTuningPage.tsx"' + id);
  };
  window.$RefreshSig$ = window.$RefreshRuntime$.createSignatureFunctionForTransform;
}
var prevRefreshReg;
var prevRefreshSig;
if (import.meta) {
  import.meta.hot = createHotContext(
    //@ts-expect-error
    "app/pages/finetuning/FineTuningPage.tsx"
  );
  import.meta.hot.lastModified = "1713199469913.9197";
}
var FineTuningPage = ({
  fineTunes
}) => {
  var _s3 = $RefreshSig$();
  const breadcrumbs = [{
    label: "Fine-Tuning"
  }];
  const subtitle = () => {
    return /* @__PURE__ */ (0, import_jsx_dev_runtime3.jsxDEV)(PageSubtitle, { children: [
      "Fine-tune models using your datasets.",
      " ",
      /* @__PURE__ */ (0, import_jsx_dev_runtime3.jsxDEV)(PageDocLink, { to: Routes.external.docs.experiments, children: "Fine-Tuning Docs." }, void 0, false, {
        fileName: "app/pages/finetuning/FineTuningPage.tsx",
        lineNumber: 39,
        columnNumber: 9
      }, this)
    ] }, void 0, true, {
      fileName: "app/pages/finetuning/FineTuningPage.tsx",
      lineNumber: 37,
      columnNumber: 12
    }, this);
  };
  const action = () => {
    _s3();
    const {
      revalidate
    } = useRevalidator();
    return /* @__PURE__ */ (0, import_jsx_dev_runtime3.jsxDEV)(Button, { variant: "ghost", size: "icon", onClick: revalidate, children: /* @__PURE__ */ (0, import_jsx_dev_runtime3.jsxDEV)(RefreshCw, { className: "h-4 w-4" }, void 0, false, {
      fileName: "app/pages/finetuning/FineTuningPage.tsx",
      lineNumber: 48,
      columnNumber: 9
    }, this) }, void 0, false, {
      fileName: "app/pages/finetuning/FineTuningPage.tsx",
      lineNumber: 47,
      columnNumber: 12
    }, this);
  };
  _s3(action, "/2nAreLMb/EjetTPbT2NN38bc3s=", false, function() {
    return [useRevalidator];
  });
  return /* @__PURE__ */ (0, import_jsx_dev_runtime3.jsxDEV)(PageLayout, { breadcrumbs, subtitle, action, children: /* @__PURE__ */ (0, import_jsx_dev_runtime3.jsxDEV)(FineTunesTable, { fineTunes }, void 0, false, {
    fileName: "app/pages/finetuning/FineTuningPage.tsx",
    lineNumber: 55,
    columnNumber: 7
  }, this) }, void 0, false, {
    fileName: "app/pages/finetuning/FineTuningPage.tsx",
    lineNumber: 54,
    columnNumber: 10
  }, this);
};
_c3 = FineTuningPage;
var _c3;
$RefreshReg$(_c3, "FineTuningPage");
window.$RefreshReg$ = prevRefreshReg;
window.$RefreshSig$ = prevRefreshSig;

// app/routes/app+/project+/$projectId+/env+/$envId+/finetuning+/index.tsx
var import_jsx_dev_runtime4 = __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+/finetuning+/index.tsx"' + id);
  };
  window.$RefreshSig$ = window.$RefreshRuntime$.createSignatureFunctionForTransform;
}
var prevRefreshReg;
var prevRefreshSig;
var _s2 = $RefreshSig$();
if (import.meta) {
  import.meta.hot = createHotContext(
    //@ts-expect-error
    "app/routes/app+/project+/$projectId+/env+/$envId+/finetuning+/index.tsx"
  );
  import.meta.hot.lastModified = "1713199469916.791";
}
var loader = withAuth(async ({
  api,
  params
}) => {
  const envId = params.envId;
  const fineTunes = await api.fineTuning.fineTuningControllerGetFineTunesForEnv({
    envId
  });
  return (0, import_node.json)({
    fineTunes
  });
});
function FineTuningRoute() {
  _s2();
  const {
    fineTunes
  } = useLoaderData();
  return /* @__PURE__ */ (0, import_jsx_dev_runtime4.jsxDEV)(FineTuningPage, { fineTunes }, void 0, false, {
    fileName: "app/routes/app+/project+/$projectId+/env+/$envId+/finetuning+/index.tsx",
    lineNumber: 43,
    columnNumber: 10
  }, this);
}
_s2(FineTuningRoute, "0Ul24eL5+2zQi818BQhz8YWbQWw=", false, function() {
  return [useLoaderData];
});
_c4 = FineTuningRoute;
var _c4;
$RefreshReg$(_c4, "FineTuningRoute");
window.$RefreshReg$ = prevRefreshReg;
window.$RefreshSig$ = prevRefreshSig;
export {
  FineTuningRoute as default
};
//# sourceMappingURL=/build/routes/app+/project+/$projectId+/env+/$envId+/finetuning+/index-4FNMMHWT.js.map
