@ozguraltan/strapi-content-input 1.0.7 → 1.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4,7 +4,7 @@ const jsxRuntime = require("react/jsx-runtime");
4
4
  const React = require("react");
5
5
  const reactDom = require("react-dom");
6
6
  const cloneDeep = require("lodash/cloneDeep");
7
- const index = require("./index-CEOkAoB9.js");
7
+ const index = require("./index-ysKdDQY1.js");
8
8
  const admin = require("@strapi/strapi/admin");
9
9
  const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
10
10
  const React__default = /* @__PURE__ */ _interopDefault(React);
@@ -850,7 +850,8 @@ const translations = {
850
850
  gridGallery: "Grid Gallery",
851
851
  galleryDisplayType: "Gallery Display Type",
852
852
  galleryImages: "Gallery Images",
853
- addGalleryImage: "+ Add Image",
853
+ addGalleryImage: "+ Add Image(s)",
854
+ clearAllImages: "Clear All",
854
855
  noGalleryImages: "No images added to this gallery yet.",
855
856
  popupOnOnClick: "Open in Lightbox Popup on Click",
856
857
  imageProcess: "Image Processing",
@@ -979,17 +980,37 @@ const translations = {
979
980
  // Media Picker
980
981
  selectImage: "Select Image",
981
982
  selectMedia: "Select Media",
983
+ selectMultipleMedia: "Select Images",
982
984
  removeImage: "Remove Image",
983
985
  mediaUrlPlaceholder: "Image URL or choose from Media Library...",
984
986
  mediaLibraryTitle: "Strapi Media Library",
985
987
  filesCount: "files",
986
988
  refresh: "Refresh",
987
989
  uploading: "Uploading...",
988
- uploadNewFile: "Upload New File",
990
+ uploadNewFile: "Upload New File(s)",
989
991
  searchFilesPlaceholder: "Search by file name or extension...",
990
992
  loadingMediaFiles: "Loading media files...",
991
993
  noMediaFilesFound: "No matching files found in the media library. Use the Upload New File button above to upload from your computer.",
992
- selectedBadge: "SELECTED"
994
+ selectedBadge: "SELECTED",
995
+ multiSelectHint: "Click multiple images to select them in order",
996
+ selectedCountLabel: "selected",
997
+ selectAllVisible: "Select All",
998
+ clearSelection: "Clear Selection",
999
+ addSelectedMedia: "Add Selected",
1000
+ "media.selectImage": "Select Image",
1001
+ "media.selectMedia": "Select Media",
1002
+ "media.selectMultipleMedia": "Select Images",
1003
+ "media.removeImage": "Remove Image",
1004
+ "media.urlPlaceholder": "Image URL or choose from Media Library...",
1005
+ "media.libraryTitle": "Strapi Media Library",
1006
+ "media.filesCount": "files",
1007
+ "media.refresh": "Refresh",
1008
+ "media.uploading": "Uploading...",
1009
+ "media.uploadNew": "Upload New File(s)",
1010
+ "media.searchPlaceholder": "Search by file name or extension...",
1011
+ "media.loadingFiles": "Loading media files...",
1012
+ "media.noMatchingFiles": "No matching files found in the media library. Use the Upload New File button above to upload from your computer.",
1013
+ "media.selectedBadge": "SELECTED"
993
1014
  },
994
1015
  tr: {
995
1016
  // Core entities & actions
@@ -1163,7 +1184,8 @@ const translations = {
1163
1184
  gridGallery: "Grid (Izgara Galeri)",
1164
1185
  galleryDisplayType: "Galeri Gösterim Tipi",
1165
1186
  galleryImages: "Galeri Görselleri",
1166
- addGalleryImage: "+ Görsel Ekle",
1187
+ addGalleryImage: "+ Görsel(ler) Ekle",
1188
+ clearAllImages: "Tümünü Temizle",
1167
1189
  noGalleryImages: "Henüz galeriye görsel eklenmedi.",
1168
1190
  popupOnOnClick: "Tıklandığında Pop-up (Lightbox) Olarak Büyüt",
1169
1191
  imageProcess: "Görsel İşleme (Image Process)",
@@ -1292,17 +1314,37 @@ const translations = {
1292
1314
  // Media Picker
1293
1315
  selectImage: "Görsel Seç",
1294
1316
  selectMedia: "Medya Seç",
1317
+ selectMultipleMedia: "Çoklu Görsel Seç",
1295
1318
  removeImage: "Görseli Kaldır",
1296
1319
  mediaUrlPlaceholder: "Görsel URL veya Medya Kütüphanesi...",
1297
1320
  mediaLibraryTitle: "Strapi Medya Kütüphanesi",
1298
1321
  filesCount: "dosya",
1299
1322
  refresh: "Yenile",
1300
1323
  uploading: "Yükleniyor...",
1301
- uploadNewFile: "Yeni Dosya Yükle",
1324
+ uploadNewFile: "Yeni Dosya(lar) Yükle",
1302
1325
  searchFilesPlaceholder: "Dosya adı veya uzantı ara...",
1303
1326
  loadingMediaFiles: "Medya dosyaları yükleniyor...",
1304
1327
  noMediaFilesFound: "Medya kütüphanesinde eşleşen dosya bulunamadı. Sağ üstteki Yeni Dosya Yükle butonuyla bilgisayarınızdan dosya yükleyebilirsiniz.",
1305
- selectedBadge: "SEÇİLİ"
1328
+ selectedBadge: "SEÇİLİ",
1329
+ multiSelectHint: "Birden fazla görseli sırayla seçmek için üzerine tıklayın",
1330
+ selectedCountLabel: "seçildi",
1331
+ selectAllVisible: "Tümünü Seç",
1332
+ clearSelection: "Seçimi Temizle",
1333
+ addSelectedMedia: "Seçilenleri Ekle",
1334
+ "media.selectImage": "Görsel Seç",
1335
+ "media.selectMedia": "Medya Seç",
1336
+ "media.selectMultipleMedia": "Çoklu Görsel Seç",
1337
+ "media.removeImage": "Görseli Kaldır",
1338
+ "media.urlPlaceholder": "Görsel URL veya Medya Kütüphanesi...",
1339
+ "media.libraryTitle": "Strapi Medya Kütüphanesi",
1340
+ "media.filesCount": "dosya",
1341
+ "media.refresh": "Yenile",
1342
+ "media.uploading": "Yükleniyor...",
1343
+ "media.uploadNew": "Yeni Dosya(lar) Yükle",
1344
+ "media.searchPlaceholder": "Dosya adı veya uzantı ara...",
1345
+ "media.loadingFiles": "Medya dosyaları yükleniyor...",
1346
+ "media.noMatchingFiles": "Medya kütüphanesinde eşleşen dosya bulunamadı. Sağ üstteki Yeni Dosya Yükle butonuyla bilgisayarınızdan dosya yükleyebilirsiniz.",
1347
+ "media.selectedBadge": "SEÇİLİ"
1306
1348
  }
1307
1349
  };
1308
1350
  function createTranslator(locale = "en") {
@@ -3146,6 +3188,9 @@ const RichHtmlEditor = ({
3146
3188
  const tr = locale === "tr";
3147
3189
  const effectivePlaceholder = placeholder || (tr ? "Metin içeriğinizi buraya yazın..." : "Type your text content here...");
3148
3190
  const { get, post } = admin.useFetchClient();
3191
+ const components = admin.useStrapiApp("RichHtmlEditor", (state) => state.components);
3192
+ const NativeMediaLibraryDialog = components?.["media-library"];
3193
+ const [nativePickerOpen, setNativePickerOpen] = React.useState(false);
3149
3194
  const [sourceMode, setSourceMode] = React.useState(false);
3150
3195
  const editorRef = React.useRef(null);
3151
3196
  const isFocusedRef = React.useRef(false);
@@ -3255,9 +3300,14 @@ const RichHtmlEditor = ({
3255
3300
  setLinkDownload(false);
3256
3301
  setLinkDownloadName("");
3257
3302
  }
3258
- setShowMediaBrowser(openWithMedia);
3259
- if (openWithMedia) {
3260
- loadMediaLibrary();
3303
+ if (openWithMedia && NativeMediaLibraryDialog) {
3304
+ setShowMediaBrowser(false);
3305
+ setNativePickerOpen(true);
3306
+ } else {
3307
+ setShowMediaBrowser(openWithMedia);
3308
+ if (openWithMedia) {
3309
+ loadMediaLibrary();
3310
+ }
3261
3311
  }
3262
3312
  setLinkModalOpen(true);
3263
3313
  };
@@ -3745,7 +3795,7 @@ const RichHtmlEditor = ({
3745
3795
  position: "fixed",
3746
3796
  inset: 0,
3747
3797
  background: "rgba(15, 23, 42, 0.55)",
3748
- zIndex: 11e3,
3798
+ zIndex: 260,
3749
3799
  display: "flex",
3750
3800
  alignItems: "center",
3751
3801
  justifyContent: "center",
@@ -3870,6 +3920,10 @@ const RichHtmlEditor = ({
3870
3920
  {
3871
3921
  type: "button",
3872
3922
  onClick: () => {
3923
+ if (NativeMediaLibraryDialog) {
3924
+ setNativePickerOpen(true);
3925
+ return;
3926
+ }
3873
3927
  const next = !showMediaBrowser;
3874
3928
  setShowMediaBrowser(next);
3875
3929
  if (next && mediaFiles.length === 0) {
@@ -4346,6 +4400,20 @@ const RichHtmlEditor = ({
4346
4400
  }
4347
4401
  ),
4348
4402
  document.body
4403
+ ),
4404
+ nativePickerOpen && NativeMediaLibraryDialog && /* @__PURE__ */ jsxRuntime.jsx(
4405
+ NativeMediaLibraryDialog,
4406
+ {
4407
+ allowedTypes: ["files", "images", "videos", "audios"],
4408
+ multiple: false,
4409
+ onClose: () => setNativePickerOpen(false),
4410
+ onSelectAssets: (selectedAssets) => {
4411
+ if (Array.isArray(selectedAssets) && selectedAssets.length > 0) {
4412
+ selectMediaFileForLink(selectedAssets[0]);
4413
+ }
4414
+ setNativePickerOpen(false);
4415
+ }
4416
+ }
4349
4417
  )
4350
4418
  ]
4351
4419
  }
@@ -5316,7 +5384,7 @@ const TabAccordionEditor = ({ widget, onChange }) => {
5316
5384
  style: {
5317
5385
  position: "fixed",
5318
5386
  inset: 0,
5319
- zIndex: 10030,
5387
+ zIndex: 215,
5320
5388
  background: "rgba(15, 23, 42, 0.65)",
5321
5389
  display: "flex",
5322
5390
  alignItems: "center",
@@ -6868,6 +6936,24 @@ function resolveYoutubeVideoId(raw) {
6868
6936
  if (extracted === "dQw4w9WgXcQ") return "M7lc1UVf-VE";
6869
6937
  return extracted;
6870
6938
  }
6939
+ function buildSharpImageUrl(rawUrl, imageSettings) {
6940
+ if (!rawUrl) return "";
6941
+ if (!imageSettings || !imageSettings.process) return rawUrl;
6942
+ const proc = String(imageSettings.process).toLowerCase();
6943
+ if (proc !== "fit" && proc !== "widen") return rawUrl;
6944
+ const w = Number(imageSettings.cWidth) || 0;
6945
+ const h = Number(imageSettings.cHeight) || 0;
6946
+ if (w <= 0 && h <= 0) return rawUrl;
6947
+ if (rawUrl.includes("/api/content-input/image") || rawUrl.includes("/content-input/image")) {
6948
+ return rawUrl;
6949
+ }
6950
+ const params = new URLSearchParams();
6951
+ params.set("src", rawUrl);
6952
+ params.set("process", proc);
6953
+ if (w > 0) params.set("w", String(w));
6954
+ if (proc === "fit" && h > 0) params.set("h", String(h));
6955
+ return `/api/content-input/image?${params.toString()}`;
6956
+ }
6871
6957
  const WidgetPreview = ({
6872
6958
  widget,
6873
6959
  isEditing,
@@ -7117,7 +7203,7 @@ const WidgetPreview = ({
7117
7203
  const imgProcess = imageSettings.process || "";
7118
7204
  const customW = Number(imageSettings.cWidth) || 0;
7119
7205
  const customH = Number(imageSettings.cHeight) || 0;
7120
- const imgObjectFit = imgProcess === "fit" ? "contain" : "cover";
7206
+ const imgObjectFit = "cover";
7121
7207
  if (images.length === 0) {
7122
7208
  return /* @__PURE__ */ jsxRuntime.jsxs(
7123
7209
  "div",
@@ -7155,7 +7241,7 @@ const WidgetPreview = ({
7155
7241
  position: "fixed",
7156
7242
  inset: 0,
7157
7243
  background: "rgba(15, 23, 42, 0.86)",
7158
- zIndex: 11500,
7244
+ zIndex: 280,
7159
7245
  display: "flex",
7160
7246
  alignItems: "center",
7161
7247
  justifyContent: "center",
@@ -7348,7 +7434,7 @@ const WidgetPreview = ({
7348
7434
  children: /* @__PURE__ */ jsxRuntime.jsx(
7349
7435
  "img",
7350
7436
  {
7351
- src: img.target_url || img.url,
7437
+ src: buildSharpImageUrl(img.target_url || img.url, imageSettings),
7352
7438
  alt: img.caption || `${t("widgets.gallery.label")} ${i + 1}`,
7353
7439
  style: {
7354
7440
  width: "100%",
@@ -7378,18 +7464,17 @@ const WidgetPreview = ({
7378
7464
  const itemIndex = (safeIdx + offset) % images.length;
7379
7465
  return { item: images[itemIndex], index: itemIndex };
7380
7466
  });
7381
- const containerHeight = customH > 0 ? Math.min(customH, 380) : 220;
7467
+ const slideAspectRatio = imgProcess === "fit" && customW > 0 && customH > 0 ? `${customW} / ${customH}` : slidesPerView > 1 ? "4 / 3" : "16 / 9";
7382
7468
  return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
7383
7469
  /* @__PURE__ */ jsxRuntime.jsxs(
7384
7470
  "div",
7385
7471
  {
7386
7472
  style: {
7387
7473
  position: "relative",
7474
+ width: "100%",
7388
7475
  borderRadius: 6,
7389
7476
  overflow: "hidden",
7390
7477
  background: "#0f172a",
7391
- height: containerHeight,
7392
- maxWidth: customW > 0 ? `${customW}px` : void 0,
7393
7478
  cursor: grabCursor ? "grab" : isPopupEnabled ? "zoom-in" : "default"
7394
7479
  },
7395
7480
  children: [
@@ -7398,15 +7483,15 @@ const WidgetPreview = ({
7398
7483
  {
7399
7484
  style: {
7400
7485
  display: "grid",
7401
- gridTemplateColumns: `repeat(${slidesPerView}, 1fr)`,
7486
+ gridTemplateColumns: `repeat(${slidesPerView}, minmax(0, 1fr))`,
7402
7487
  gap: spaceBetween,
7403
7488
  width: "100%",
7404
- height: "100%",
7405
7489
  padding: slidesPerView > 1 && spaceBetween > 0 ? 4 : 0,
7406
7490
  boxSizing: "border-box"
7407
7491
  },
7408
7492
  children: visibleSlides.map(({ item, index: index2 }) => {
7409
- const slideUrl = item?.target_url || item?.url || "";
7493
+ const rawSlideUrl = item?.target_url || item?.url || "";
7494
+ const slideUrl = buildSharpImageUrl(rawSlideUrl, imageSettings);
7410
7495
  return /* @__PURE__ */ jsxRuntime.jsx(
7411
7496
  "div",
7412
7497
  {
@@ -7419,7 +7504,7 @@ const WidgetPreview = ({
7419
7504
  style: {
7420
7505
  position: "relative",
7421
7506
  width: "100%",
7422
- height: "100%",
7507
+ aspectRatio: slideAspectRatio,
7423
7508
  overflow: "hidden",
7424
7509
  borderRadius: slidesPerView > 1 ? 4 : 0,
7425
7510
  background: "#1e293b"
@@ -7854,7 +7939,7 @@ const WidgetPreview = ({
7854
7939
  position: "fixed",
7855
7940
  inset: 0,
7856
7941
  background: "rgba(15, 23, 42, 0.82)",
7857
- zIndex: 11500,
7942
+ zIndex: 280,
7858
7943
  display: "flex",
7859
7944
  alignItems: "center",
7860
7945
  justifyContent: "center",
@@ -11431,11 +11516,20 @@ const UnitInput = ({
11431
11516
  )
11432
11517
  ] });
11433
11518
  };
11434
- function mapStrapiFileToAsset(file) {
11435
- const srcset = file?.formats ? Object.values(file.formats).filter((f) => f && f.url && f.width).map((f) => `${f.url} ${f.width}w`).join(", ") : "";
11519
+ function getFileKey(file) {
11520
+ return String(file?.id ?? file?.documentId ?? file?.url ?? file?.name ?? "");
11521
+ }
11522
+ function mapStrapiFileToAsset(file, cacheBust) {
11523
+ const appendBust = (u) => {
11524
+ if (!u || !cacheBust) return u;
11525
+ const sep = u.includes("?") ? "&" : "?";
11526
+ return `${u}${sep}v=${Date.now()}`;
11527
+ };
11528
+ const srcset = file?.formats ? Object.values(file.formats).filter((f) => f && f.url && f.width).map((f) => `${appendBust(f.url)} ${f.width}w`).join(", ") : "";
11529
+ const finalUrl = appendBust(file.url || "");
11436
11530
  return {
11437
- target_url: file.url || "",
11438
- url: file.url || "",
11531
+ target_url: finalUrl,
11532
+ url: finalUrl,
11439
11533
  filename: file.name || file.filename || "media",
11440
11534
  mime_type: file.mime || file.mime_type || "application/octet-stream",
11441
11535
  size: file.size || 0,
@@ -11445,20 +11539,58 @@ function mapStrapiFileToAsset(file) {
11445
11539
  srcset: srcset || void 0
11446
11540
  };
11447
11541
  }
11542
+ const ASPECT_PRESETS = [
11543
+ { label: "Free", ratio: null },
11544
+ { label: "1:1", ratio: 1 },
11545
+ { label: "16:9", ratio: 16 / 9 },
11546
+ { label: "4:3", ratio: 4 / 3 },
11547
+ { label: "3:2", ratio: 3 / 2 },
11548
+ { label: "4:5", ratio: 4 / 5 }
11549
+ ];
11448
11550
  const StrapiMediaPicker = ({
11449
11551
  value,
11450
11552
  onChange,
11451
- label
11553
+ label,
11554
+ multiple = false,
11555
+ onSelectMultiple
11452
11556
  }) => {
11453
- const { t } = useEditorTranslator();
11454
- const { get, post } = admin.useFetchClient();
11557
+ const { t, locale } = useEditorTranslator();
11558
+ const tr = locale === "tr";
11559
+ const { get, post, put, del } = admin.useFetchClient();
11455
11560
  const [modalOpen, setModalOpen] = React.useState(false);
11456
11561
  const [files, setFiles] = React.useState([]);
11562
+ const [folders, setFolders] = React.useState([]);
11563
+ const [currentFolderId, setCurrentFolderId] = React.useState(null);
11564
+ const [selectedFiles, setSelectedFiles] = React.useState([]);
11457
11565
  const [loading, setLoading] = React.useState(false);
11458
11566
  const [uploading, setUploading] = React.useState(false);
11459
11567
  const [search, setSearch] = React.useState("");
11460
- const [urlInput, setUrlInput] = React.useState(value?.target_url || value?.url || "");
11568
+ const [typeFilter, setTypeFilter] = React.useState("all");
11569
+ const [sortBy, setSortBy] = React.useState(
11570
+ "newest"
11571
+ );
11572
+ const [creatingFolder, setCreatingFolder] = React.useState(false);
11573
+ const [newFolderName, setNewFolderName] = React.useState("");
11574
+ const [editingFile, setEditingFile] = React.useState(null);
11575
+ const [editTab, setEditTab] = React.useState("crop");
11576
+ const [editName, setEditName] = React.useState("");
11577
+ const [editAlt, setEditAlt] = React.useState("");
11578
+ const [editCaption, setEditCaption] = React.useState("");
11579
+ const [editFolderId, setEditFolderId] = React.useState(null);
11580
+ const [savingDetails, setSavingDetails] = React.useState(false);
11581
+ const [naturalSize, setNaturalSize] = React.useState({
11582
+ width: 0,
11583
+ height: 0
11584
+ });
11585
+ const [cropRect, setCropRect] = React.useState({ x: 0, y: 0, width: 100, height: 100 });
11586
+ const [cropRotate, setCropRotate] = React.useState(0);
11587
+ const [aspectPreset, setAspectPreset] = React.useState(null);
11588
+ const [croppingBusy, setCroppingBusy] = React.useState(false);
11589
+ const [cropError, setCropError] = React.useState(null);
11590
+ const cropImgRef = React.useRef(null);
11591
+ const cropBoxRef = React.useRef(null);
11461
11592
  const fileInputRef = React.useRef(null);
11593
+ const [urlInput, setUrlInput] = React.useState(value?.target_url || value?.url || "");
11462
11594
  const effectiveLabel = label !== void 0 ? label : t("media.selectImage", "Select Image");
11463
11595
  React.useEffect(() => {
11464
11596
  setUrlInput(value?.target_url || value?.url || "");
@@ -11468,47 +11600,125 @@ const StrapiMediaPicker = ({
11468
11600
  try {
11469
11601
  const res = await get("/content-input/media");
11470
11602
  const primaryList = Array.isArray(res?.data?.data) ? res.data.data : Array.isArray(res?.data) ? res.data : null;
11603
+ const folderList = Array.isArray(res?.data?.folders) ? res.data.folders : [];
11604
+ if (folderList.length > 0) {
11605
+ setFolders(folderList);
11606
+ }
11471
11607
  if (primaryList) {
11472
11608
  setFiles(primaryList);
11473
- return;
11609
+ setLoading(false);
11610
+ return primaryList;
11474
11611
  }
11475
11612
  } catch {
11476
11613
  }
11477
11614
  try {
11478
- const fallbackRes = await get("/upload/files?pageSize=100&page=1");
11615
+ const fallbackRes = await get("/upload/files?pageSize=200&page=1");
11479
11616
  const fallbackList = Array.isArray(fallbackRes?.data?.results) ? fallbackRes.data.results : Array.isArray(fallbackRes?.data) ? fallbackRes.data : [];
11480
11617
  setFiles(fallbackList);
11618
+ return fallbackList;
11481
11619
  } catch {
11482
11620
  setFiles([]);
11621
+ return [];
11483
11622
  } finally {
11484
11623
  setLoading(false);
11485
11624
  }
11486
11625
  };
11487
- React.useEffect(() => {
11488
- if (!modalOpen) return;
11489
- setLoading(false);
11490
- }, [files, modalOpen]);
11626
+ const openEditorForFile = (file, initialTab = "crop") => {
11627
+ setEditingFile(file);
11628
+ setEditTab(file?.mime?.startsWith("image/") ? initialTab : "details");
11629
+ setEditName(file?.name || "");
11630
+ setEditAlt(file?.alternativeText || "");
11631
+ setEditCaption(file?.caption || "");
11632
+ setEditFolderId(file?.folder?.id ?? file?.folder ?? null);
11633
+ setCropRotate(0);
11634
+ setAspectPreset(null);
11635
+ setCropError(null);
11636
+ const w = Number(file?.width) || 800;
11637
+ const h = Number(file?.height) || 600;
11638
+ setNaturalSize({ width: w, height: h });
11639
+ setCropRect({
11640
+ x: 0,
11641
+ y: 0,
11642
+ width: w,
11643
+ height: h
11644
+ });
11645
+ };
11491
11646
  const handleOpenModal = (e) => {
11492
11647
  e.preventDefault();
11493
11648
  e.stopPropagation();
11649
+ setSelectedFiles([]);
11650
+ setEditingFile(null);
11494
11651
  setModalOpen(true);
11495
11652
  loadLibrary().finally(() => setLoading(false));
11496
11653
  };
11654
+ const handleOpenCropCurrent = async (e) => {
11655
+ e.preventDefault();
11656
+ e.stopPropagation();
11657
+ const currentUrl = (value?.target_url || value?.url || "").split("?")[0];
11658
+ if (!currentUrl) return;
11659
+ setModalOpen(true);
11660
+ const loaded = files.length > 0 ? files : await loadLibrary();
11661
+ const match = loaded.find(
11662
+ (f) => f.url && f.url.split("?")[0] === currentUrl || value?.filename && f.name === value.filename
11663
+ );
11664
+ if (match) {
11665
+ openEditorForFile(match, "crop");
11666
+ }
11667
+ };
11668
+ const toggleFileSelection = (file) => {
11669
+ const key = getFileKey(file);
11670
+ setSelectedFiles((prev) => {
11671
+ const exists = prev.some((f) => getFileKey(f) === key);
11672
+ if (exists) {
11673
+ return prev.filter((f) => getFileKey(f) !== key);
11674
+ }
11675
+ return [...prev, file];
11676
+ });
11677
+ };
11678
+ const handleConfirmMultiple = () => {
11679
+ if (selectedFiles.length === 0) return;
11680
+ const assets = selectedFiles.map((f) => mapStrapiFileToAsset(f));
11681
+ if (onSelectMultiple) {
11682
+ onSelectMultiple(assets);
11683
+ } else {
11684
+ assets.forEach((asset) => onChange(asset));
11685
+ }
11686
+ setSelectedFiles([]);
11687
+ setModalOpen(false);
11688
+ };
11497
11689
  const handleFileUpload = async (e) => {
11498
- const selectedFiles = e.target.files;
11499
- if (!selectedFiles || selectedFiles.length === 0) return;
11690
+ const inputFiles = e.target.files;
11691
+ if (!inputFiles || inputFiles.length === 0) return;
11500
11692
  setUploading(true);
11501
11693
  try {
11502
11694
  const formData = new FormData();
11503
- for (let i = 0; i < selectedFiles.length; i++) {
11504
- formData.append("files", selectedFiles[i]);
11695
+ for (let i = 0; i < inputFiles.length; i++) {
11696
+ formData.append("files", inputFiles[i]);
11697
+ }
11698
+ if (currentFolderId) {
11699
+ formData.append("fileInfo", JSON.stringify({ folder: currentFolderId }));
11505
11700
  }
11506
11701
  const res = await post("/upload", formData);
11507
11702
  const uploadedList = Array.isArray(res?.data) ? res.data : Array.isArray(res?.data?.data) ? res.data.data : [];
11508
11703
  await loadLibrary();
11509
11704
  if (uploadedList.length > 0) {
11510
- onChange(mapStrapiFileToAsset(uploadedList[0]));
11511
- setModalOpen(false);
11705
+ if (!modalOpen) {
11706
+ if (multiple) {
11707
+ const assets = uploadedList.map((f) => mapStrapiFileToAsset(f));
11708
+ if (onSelectMultiple) {
11709
+ onSelectMultiple(assets);
11710
+ } else {
11711
+ assets.forEach((a) => onChange(a));
11712
+ }
11713
+ } else {
11714
+ onChange(mapStrapiFileToAsset(uploadedList[0]));
11715
+ }
11716
+ } else if (multiple) {
11717
+ setSelectedFiles((prev) => [...prev, ...uploadedList]);
11718
+ } else {
11719
+ onChange(mapStrapiFileToAsset(uploadedList[0]));
11720
+ setModalOpen(false);
11721
+ }
11512
11722
  }
11513
11723
  } catch {
11514
11724
  } finally {
@@ -11517,10 +11727,197 @@ const StrapiMediaPicker = ({
11517
11727
  if (fileInputRef.current) fileInputRef.current.value = "";
11518
11728
  }
11519
11729
  };
11730
+ const handleCreateFolder = async () => {
11731
+ const trimmed = newFolderName.trim();
11732
+ if (!trimmed) return;
11733
+ try {
11734
+ const res = await post("/content-input/media/folder", {
11735
+ name: trimmed,
11736
+ parent: currentFolderId
11737
+ });
11738
+ const created = res?.data?.data || res?.data;
11739
+ setNewFolderName("");
11740
+ setCreatingFolder(false);
11741
+ await loadLibrary();
11742
+ if (created?.id) {
11743
+ setCurrentFolderId(Number(created.id));
11744
+ }
11745
+ } catch {
11746
+ }
11747
+ };
11748
+ const handleSaveDetails = async () => {
11749
+ if (!editingFile?.id) return;
11750
+ setSavingDetails(true);
11751
+ try {
11752
+ const res = await put(`/content-input/media/${editingFile.id}`, {
11753
+ name: editName.trim() || editingFile.name,
11754
+ alternativeText: editAlt,
11755
+ caption: editCaption,
11756
+ folder: editFolderId
11757
+ });
11758
+ const updated = res?.data?.data || res?.data;
11759
+ await loadLibrary();
11760
+ if (updated) {
11761
+ setEditingFile(updated);
11762
+ }
11763
+ } catch {
11764
+ } finally {
11765
+ setSavingDetails(false);
11766
+ }
11767
+ };
11768
+ const handleDeleteAsset = async (file, e) => {
11769
+ if (e) {
11770
+ e.preventDefault();
11771
+ e.stopPropagation();
11772
+ }
11773
+ if (!file?.id) return;
11774
+ const confirmMsg = tr ? `"${file.name}" dosyasını Strapi Medya Kütüphanesinden kalıcı olarak silmek istediğinize emin misiniz?` : `Are you sure you want to permanently delete "${file.name}" from the Strapi Media Library?`;
11775
+ if (typeof window !== "undefined" && !window.confirm(confirmMsg)) return;
11776
+ try {
11777
+ await del(`/content-input/media/${file.id}`);
11778
+ setSelectedFiles((prev) => prev.filter((f) => getFileKey(f) !== getFileKey(file)));
11779
+ if (editingFile?.id === file.id) {
11780
+ setEditingFile(null);
11781
+ }
11782
+ await loadLibrary();
11783
+ } catch {
11784
+ }
11785
+ };
11786
+ const handleExecuteCrop = async (mode) => {
11787
+ if (!editingFile?.id) return;
11788
+ setCroppingBusy(true);
11789
+ setCropError(null);
11790
+ try {
11791
+ const res = await post("/content-input/media/crop", {
11792
+ id: editingFile.id,
11793
+ mode,
11794
+ x: Math.round(cropRect.x),
11795
+ y: Math.round(cropRect.y),
11796
+ width: Math.round(cropRect.width),
11797
+ height: Math.round(cropRect.height),
11798
+ rotate: cropRotate,
11799
+ name: editName.trim() || editingFile.name,
11800
+ alternativeText: editAlt,
11801
+ caption: editCaption
11802
+ });
11803
+ const resultFile = res?.data?.data || res?.data;
11804
+ await loadLibrary();
11805
+ if (resultFile) {
11806
+ const mapped = mapStrapiFileToAsset(resultFile, true);
11807
+ if (multiple && onSelectMultiple) {
11808
+ onSelectMultiple([mapped]);
11809
+ } else {
11810
+ onChange(mapped);
11811
+ }
11812
+ setEditingFile(null);
11813
+ setModalOpen(false);
11814
+ }
11815
+ } catch (err) {
11816
+ setCropError(err?.message || (tr ? "Kırpma işlemi başarısız oldu" : "Crop operation failed"));
11817
+ } finally {
11818
+ setCroppingBusy(false);
11819
+ }
11820
+ };
11821
+ const applyAspectPreset = (ratio) => {
11822
+ setAspectPreset(ratio);
11823
+ if (!ratio || !naturalSize.width || !naturalSize.height) return;
11824
+ let newW = naturalSize.width;
11825
+ let newH = Math.round(newW / ratio);
11826
+ if (newH > naturalSize.height) {
11827
+ newH = naturalSize.height;
11828
+ newW = Math.round(newH * ratio);
11829
+ }
11830
+ const newX = Math.max(0, Math.round((naturalSize.width - newW) / 2));
11831
+ const newY = Math.max(0, Math.round((naturalSize.height - newH) / 2));
11832
+ setCropRect({ x: newX, y: newY, width: newW, height: newH });
11833
+ };
11834
+ const startCropDrag = (e, dragType) => {
11835
+ e.preventDefault();
11836
+ e.stopPropagation();
11837
+ const container = cropBoxRef.current;
11838
+ if (!container || !naturalSize.width || !naturalSize.height) return;
11839
+ const bounds = container.getBoundingClientRect();
11840
+ if (!bounds.width || !bounds.height) return;
11841
+ const scaleX = naturalSize.width / bounds.width;
11842
+ const scaleY = naturalSize.height / bounds.height;
11843
+ const startClientX = e.clientX;
11844
+ const startClientY = e.clientY;
11845
+ const initial = { ...cropRect };
11846
+ const onMove = (ev) => {
11847
+ const dx = (ev.clientX - startClientX) * scaleX;
11848
+ const dy = (ev.clientY - startClientY) * scaleY;
11849
+ if (dragType === "move") {
11850
+ const nextX = Math.max(
11851
+ 0,
11852
+ Math.min(naturalSize.width - initial.width, Math.round(initial.x + dx))
11853
+ );
11854
+ const nextY = Math.max(
11855
+ 0,
11856
+ Math.min(naturalSize.height - initial.height, Math.round(initial.y + dy))
11857
+ );
11858
+ setCropRect({ ...initial, x: nextX, y: nextY });
11859
+ return;
11860
+ }
11861
+ let x = initial.x;
11862
+ let y = initial.y;
11863
+ let w = initial.width;
11864
+ let h = initial.height;
11865
+ if (dragType.includes("e")) {
11866
+ w = Math.max(20, Math.min(naturalSize.width - x, Math.round(initial.width + dx)));
11867
+ }
11868
+ if (dragType.includes("s")) {
11869
+ h = Math.max(20, Math.min(naturalSize.height - y, Math.round(initial.height + dy)));
11870
+ }
11871
+ if (dragType.includes("w")) {
11872
+ const maxDx = initial.width - 20;
11873
+ const clampedDx = Math.max(-initial.x, Math.min(maxDx, Math.round(dx)));
11874
+ x = initial.x + clampedDx;
11875
+ w = initial.width - clampedDx;
11876
+ }
11877
+ if (dragType.includes("n")) {
11878
+ const maxDy = initial.height - 20;
11879
+ const clampedDy = Math.max(-initial.y, Math.min(maxDy, Math.round(dy)));
11880
+ y = initial.y + clampedDy;
11881
+ h = initial.height - clampedDy;
11882
+ }
11883
+ if (aspectPreset) {
11884
+ h = Math.round(w / aspectPreset);
11885
+ if (y + h > naturalSize.height) {
11886
+ h = naturalSize.height - y;
11887
+ w = Math.round(h * aspectPreset);
11888
+ }
11889
+ }
11890
+ setCropRect({ x, y, width: Math.max(16, w), height: Math.max(16, h) });
11891
+ };
11892
+ const onUp = () => {
11893
+ window.removeEventListener("mousemove", onMove);
11894
+ window.removeEventListener("mouseup", onUp);
11895
+ };
11896
+ window.addEventListener("mousemove", onMove);
11897
+ window.addEventListener("mouseup", onUp);
11898
+ };
11520
11899
  const handleUrlApply = () => {
11521
11900
  const trimmed = urlInput.trim();
11522
11901
  if (!trimmed) {
11523
- if (value) onChange(null);
11902
+ if (!multiple && value) onChange(null);
11903
+ return;
11904
+ }
11905
+ if (multiple) {
11906
+ const parts = trimmed.split(/[\n,]+/).map((s) => s.trim()).filter(Boolean);
11907
+ if (parts.length === 0) return;
11908
+ const assets = parts.map((u) => ({
11909
+ target_url: u,
11910
+ url: u,
11911
+ filename: u.split("/").pop() || "external-image",
11912
+ mime_type: "image/jpeg",
11913
+ caption: ""
11914
+ }));
11915
+ if (onSelectMultiple) {
11916
+ onSelectMultiple(assets);
11917
+ } else {
11918
+ assets.forEach((a) => onChange(a));
11919
+ }
11920
+ setUrlInput("");
11524
11921
  return;
11525
11922
  }
11526
11923
  if (trimmed === (value?.target_url || value?.url || "")) return;
@@ -11534,9 +11931,39 @@ const StrapiMediaPicker = ({
11534
11931
  };
11535
11932
  const previewUrl = value?.target_url || value?.url || "";
11536
11933
  const q = search.trim().toLowerCase();
11537
- const filteredFiles = files.filter(
11538
- (f) => !q || (f.name || "").toLowerCase().includes(q) || (f.ext || "").toLowerCase().includes(q) || (f.mime || "").toLowerCase().includes(q)
11539
- );
11934
+ const visibleFolders = folders.filter((fld) => {
11935
+ const parentId = fld.parent?.id ?? fld.parent ?? null;
11936
+ return parentId === currentFolderId;
11937
+ });
11938
+ const currentFolderObj = currentFolderId !== null ? folders.find((f) => Number(f.id) === currentFolderId) : null;
11939
+ const filteredFiles = files.filter((f) => {
11940
+ if (!q && currentFolderId !== null) {
11941
+ const fileFolderId = f.folder?.id ?? f.folder ?? null;
11942
+ if (Number(fileFolderId) !== currentFolderId) return false;
11943
+ }
11944
+ if (typeFilter === "image" && !f.mime?.startsWith("image/")) return false;
11945
+ if (typeFilter === "video" && !f.mime?.startsWith("video/")) return false;
11946
+ if (typeFilter === "audio" && !f.mime?.startsWith("audio/")) return false;
11947
+ if (typeFilter === "doc" && (f.mime?.startsWith("image/") || f.mime?.startsWith("video/") || f.mime?.startsWith("audio/"))) {
11948
+ return false;
11949
+ }
11950
+ if (!q) return true;
11951
+ return (f.name || "").toLowerCase().includes(q) || (f.alternativeText || "").toLowerCase().includes(q) || (f.caption || "").toLowerCase().includes(q) || (f.ext || "").toLowerCase().includes(q) || (f.mime || "").toLowerCase().includes(q);
11952
+ }).sort((a, b) => {
11953
+ if (sortBy === "oldest") {
11954
+ return new Date(a.createdAt || 0).getTime() - new Date(b.createdAt || 0).getTime();
11955
+ }
11956
+ if (sortBy === "nameAsc") {
11957
+ return String(a.name || "").localeCompare(String(b.name || ""));
11958
+ }
11959
+ if (sortBy === "nameDesc") {
11960
+ return String(b.name || "").localeCompare(String(a.name || ""));
11961
+ }
11962
+ if (sortBy === "sizeDesc") {
11963
+ return (Number(b.size) || 0) - (Number(a.size) || 0);
11964
+ }
11965
+ return new Date(b.createdAt || 0).getTime() - new Date(a.createdAt || 0).getTime();
11966
+ });
11540
11967
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", flexDirection: "column", gap: 8 }, children: [
11541
11968
  effectiveLabel && /* @__PURE__ */ jsxRuntime.jsx("label", { style: { fontSize: 12, fontWeight: 600, color: "#475569" }, children: effectiveLabel }),
11542
11969
  previewUrl ? /* @__PURE__ */ jsxRuntime.jsxs(
@@ -11582,7 +12009,7 @@ const StrapiMediaPicker = ({
11582
12009
  children: value?.filename || t("common.image", "Image")
11583
12010
  }
11584
12011
  ),
11585
- /* @__PURE__ */ jsxRuntime.jsx(
12012
+ /* @__PURE__ */ jsxRuntime.jsxs(
11586
12013
  "div",
11587
12014
  {
11588
12015
  style: {
@@ -11592,10 +12019,33 @@ const StrapiMediaPicker = ({
11592
12019
  textOverflow: "ellipsis",
11593
12020
  whiteSpace: "nowrap"
11594
12021
  },
11595
- children: previewUrl
12022
+ children: [
12023
+ value?.width && value?.height ? `${value.width}×${value.height} · ` : "",
12024
+ previewUrl
12025
+ ]
11596
12026
  }
11597
12027
  )
11598
12028
  ] }),
12029
+ /* @__PURE__ */ jsxRuntime.jsx(
12030
+ "button",
12031
+ {
12032
+ type: "button",
12033
+ onClick: handleOpenCropCurrent,
12034
+ title: tr ? "Görseli Kırp / Düzenle" : "Crop / Edit Image",
12035
+ style: {
12036
+ border: "1px solid #cbd5e1",
12037
+ borderRadius: 4,
12038
+ background: "#ffffff",
12039
+ color: "#2669a0",
12040
+ cursor: "pointer",
12041
+ padding: 4,
12042
+ display: "inline-flex",
12043
+ alignItems: "center",
12044
+ justifyContent: "center"
12045
+ },
12046
+ children: /* @__PURE__ */ jsxRuntime.jsx(index.MaterialIcon, { name: "crop", size: 15, color: "#2669a0" })
12047
+ }
12048
+ ),
11599
12049
  /* @__PURE__ */ jsxRuntime.jsx(
11600
12050
  "button",
11601
12051
  {
@@ -11644,6 +12094,44 @@ const StrapiMediaPicker = ({
11644
12094
  }
11645
12095
  }
11646
12096
  ),
12097
+ /* @__PURE__ */ jsxRuntime.jsx(
12098
+ "input",
12099
+ {
12100
+ ref: fileInputRef,
12101
+ type: "file",
12102
+ multiple,
12103
+ onChange: handleFileUpload,
12104
+ style: { display: "none" }
12105
+ }
12106
+ ),
12107
+ /* @__PURE__ */ jsxRuntime.jsx(
12108
+ "button",
12109
+ {
12110
+ type: "button",
12111
+ disabled: uploading,
12112
+ onClick: (e) => {
12113
+ e.preventDefault();
12114
+ e.stopPropagation();
12115
+ fileInputRef.current?.click();
12116
+ },
12117
+ title: t("media.uploadNew", "Upload New File(s)"),
12118
+ style: {
12119
+ display: "inline-flex",
12120
+ alignItems: "center",
12121
+ justifyContent: "center",
12122
+ padding: "6px 9px",
12123
+ fontSize: 12,
12124
+ fontWeight: 600,
12125
+ background: "#ffffff",
12126
+ color: "#2669a0",
12127
+ border: "1px solid #cbd5e1",
12128
+ borderRadius: 5,
12129
+ cursor: uploading ? "wait" : "pointer",
12130
+ whiteSpace: "nowrap"
12131
+ },
12132
+ children: /* @__PURE__ */ jsxRuntime.jsx(index.MaterialIcon, { name: "upload_file", size: 16, color: "#2669a0" })
12133
+ }
12134
+ ),
11647
12135
  /* @__PURE__ */ jsxRuntime.jsxs(
11648
12136
  "button",
11649
12137
  {
@@ -11664,8 +12152,8 @@ const StrapiMediaPicker = ({
11664
12152
  whiteSpace: "nowrap"
11665
12153
  },
11666
12154
  children: [
11667
- /* @__PURE__ */ jsxRuntime.jsx(index.MaterialIcon, { name: "image", size: 15, color: "#fff" }),
11668
- t("media.selectMedia", "Select Media")
12155
+ /* @__PURE__ */ jsxRuntime.jsx(index.MaterialIcon, { name: multiple ? "collections" : "image", size: 15, color: "#fff" }),
12156
+ multiple ? t("media.selectMultipleMedia", "Select Images") : t("media.selectMedia", "Select Media")
11669
12157
  ]
11670
12158
  }
11671
12159
  )
@@ -11678,27 +12166,31 @@ const StrapiMediaPicker = ({
11678
12166
  style: {
11679
12167
  position: "fixed",
11680
12168
  inset: 0,
11681
- background: "rgba(15, 23, 42, 0.6)",
11682
- zIndex: 11e3,
12169
+ background: "rgba(15, 23, 42, 0.65)",
12170
+ zIndex: 310,
11683
12171
  display: "flex",
11684
12172
  alignItems: "center",
11685
12173
  justifyContent: "center",
11686
- padding: 24
12174
+ padding: 20
11687
12175
  },
11688
12176
  onClick: (e) => {
11689
12177
  e.stopPropagation();
11690
- setModalOpen(false);
12178
+ if (editingFile) {
12179
+ setEditingFile(null);
12180
+ } else {
12181
+ setModalOpen(false);
12182
+ }
11691
12183
  },
11692
12184
  children: /* @__PURE__ */ jsxRuntime.jsxs(
11693
12185
  "div",
11694
12186
  {
11695
12187
  style: {
11696
12188
  width: "100%",
11697
- maxWidth: 780,
11698
- maxHeight: "84vh",
12189
+ maxWidth: 960,
12190
+ height: "min(720px, 90vh)",
11699
12191
  background: "#fff",
11700
- borderRadius: 8,
11701
- boxShadow: "0 24px 48px rgba(0,0,0,0.3)",
12192
+ borderRadius: 10,
12193
+ boxShadow: "0 24px 56px rgba(0,0,0,0.35)",
11702
12194
  display: "flex",
11703
12195
  flexDirection: "column",
11704
12196
  overflow: "hidden"
@@ -11715,86 +12207,125 @@ const StrapiMediaPicker = ({
11715
12207
  padding: "12px 18px",
11716
12208
  borderBottom: "1px solid #e2e8f0",
11717
12209
  background: "#f8fafc",
11718
- gap: 10
12210
+ gap: 10,
12211
+ flexWrap: "wrap"
11719
12212
  },
11720
12213
  children: [
11721
12214
  /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", alignItems: "center", gap: 8 }, children: [
11722
- /* @__PURE__ */ jsxRuntime.jsx(index.MaterialIcon, { name: "collections", size: 18, color: "#2669a0" }),
11723
- /* @__PURE__ */ jsxRuntime.jsxs("strong", { style: { fontSize: 14, color: "#0f172a" }, children: [
11724
- t("media.libraryTitle", "Strapi Media Library"),
11725
- " (",
11726
- files.length,
11727
- " ",
11728
- t("media.filesCount", "files"),
11729
- ")"
11730
- ] })
11731
- ] }),
11732
- /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", alignItems: "center", gap: 8 }, children: [
11733
- /* @__PURE__ */ jsxRuntime.jsxs(
12215
+ editingFile ? /* @__PURE__ */ jsxRuntime.jsxs(
11734
12216
  "button",
11735
12217
  {
11736
12218
  type: "button",
11737
- onClick: () => loadLibrary().finally(() => setLoading(false)),
11738
- title: t("media.refresh", "Refresh"),
12219
+ onClick: () => setEditingFile(null),
11739
12220
  style: {
11740
12221
  display: "inline-flex",
11741
12222
  alignItems: "center",
11742
12223
  gap: 4,
11743
- padding: "6px 10px",
12224
+ padding: "4px 8px",
12225
+ borderRadius: 5,
12226
+ border: "1px solid #cbd5e1",
11744
12227
  background: "#ffffff",
11745
12228
  color: "#334155",
11746
- border: "1px solid #cbd5e1",
11747
- borderRadius: 5,
11748
12229
  fontSize: 12,
11749
12230
  fontWeight: 600,
11750
12231
  cursor: "pointer"
11751
12232
  },
11752
12233
  children: [
11753
- /* @__PURE__ */ jsxRuntime.jsx(index.MaterialIcon, { name: "refresh", size: 15 }),
11754
- t("media.refresh", "Refresh")
12234
+ /* @__PURE__ */ jsxRuntime.jsx(index.MaterialIcon, { name: "arrow_back", size: 15 }),
12235
+ tr ? "Kütüphaneye Dön" : "Back to Library"
11755
12236
  ]
11756
12237
  }
11757
- ),
12238
+ ) : /* @__PURE__ */ jsxRuntime.jsx(index.MaterialIcon, { name: "collections", size: 18, color: "#2669a0" }),
12239
+ /* @__PURE__ */ jsxRuntime.jsx("strong", { style: { fontSize: 14, color: "#0f172a" }, children: editingFile ? `${tr ? "Görsel Düzenle & Kırp" : "Edit & Crop Asset"}: ${editingFile.name}` : `${t("media.libraryTitle", "Strapi Media Library")} (${filteredFiles.length} ${t(
12240
+ "media.filesCount",
12241
+ "files"
12242
+ )})` })
12243
+ ] }),
12244
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", alignItems: "center", gap: 8 }, children: [
12245
+ !editingFile && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
12246
+ /* @__PURE__ */ jsxRuntime.jsxs(
12247
+ "button",
12248
+ {
12249
+ type: "button",
12250
+ onClick: () => setCreatingFolder((v) => !v),
12251
+ style: {
12252
+ display: "inline-flex",
12253
+ alignItems: "center",
12254
+ gap: 4,
12255
+ padding: "6px 10px",
12256
+ background: "#ffffff",
12257
+ color: "#334155",
12258
+ border: "1px solid #cbd5e1",
12259
+ borderRadius: 5,
12260
+ fontSize: 12,
12261
+ fontWeight: 600,
12262
+ cursor: "pointer"
12263
+ },
12264
+ children: [
12265
+ /* @__PURE__ */ jsxRuntime.jsx(index.MaterialIcon, { name: "create_new_folder", size: 15, color: "#2669a0" }),
12266
+ tr ? "Yeni Klasör" : "New Folder"
12267
+ ]
12268
+ }
12269
+ ),
12270
+ /* @__PURE__ */ jsxRuntime.jsxs(
12271
+ "button",
12272
+ {
12273
+ type: "button",
12274
+ onClick: () => loadLibrary().finally(() => setLoading(false)),
12275
+ title: t("media.refresh", "Refresh"),
12276
+ style: {
12277
+ display: "inline-flex",
12278
+ alignItems: "center",
12279
+ gap: 4,
12280
+ padding: "6px 10px",
12281
+ background: "#ffffff",
12282
+ color: "#334155",
12283
+ border: "1px solid #cbd5e1",
12284
+ borderRadius: 5,
12285
+ fontSize: 12,
12286
+ fontWeight: 600,
12287
+ cursor: "pointer"
12288
+ },
12289
+ children: [
12290
+ /* @__PURE__ */ jsxRuntime.jsx(index.MaterialIcon, { name: "refresh", size: 15 }),
12291
+ t("media.refresh", "Refresh")
12292
+ ]
12293
+ }
12294
+ ),
12295
+ /* @__PURE__ */ jsxRuntime.jsxs(
12296
+ "button",
12297
+ {
12298
+ type: "button",
12299
+ disabled: uploading,
12300
+ onClick: () => fileInputRef.current?.click(),
12301
+ style: {
12302
+ display: "inline-flex",
12303
+ alignItems: "center",
12304
+ gap: 5,
12305
+ padding: "6px 12px",
12306
+ background: "#2669a0",
12307
+ color: "#fff",
12308
+ border: "none",
12309
+ borderRadius: 5,
12310
+ fontSize: 12,
12311
+ fontWeight: 600,
12312
+ cursor: "pointer"
12313
+ },
12314
+ children: [
12315
+ /* @__PURE__ */ jsxRuntime.jsx(index.MaterialIcon, { name: "upload_file", size: 15, color: "#fff" }),
12316
+ uploading ? t("media.uploading", "Uploading...") : t("media.uploadNew", "Upload New File(s)")
12317
+ ]
12318
+ }
12319
+ )
12320
+ ] }),
11758
12321
  /* @__PURE__ */ jsxRuntime.jsx(
11759
- "input",
11760
- {
11761
- ref: fileInputRef,
11762
- type: "file",
11763
- multiple: true,
11764
- onChange: handleFileUpload,
11765
- style: { display: "none" }
11766
- }
11767
- ),
11768
- /* @__PURE__ */ jsxRuntime.jsxs(
11769
12322
  "button",
11770
12323
  {
11771
12324
  type: "button",
11772
- disabled: uploading,
11773
- onClick: () => fileInputRef.current?.click(),
11774
- style: {
11775
- display: "inline-flex",
11776
- alignItems: "center",
11777
- gap: 5,
11778
- padding: "6px 12px",
11779
- background: "#2669a0",
11780
- color: "#fff",
11781
- border: "none",
11782
- borderRadius: 5,
11783
- fontSize: 12,
11784
- fontWeight: 600,
11785
- cursor: "pointer"
11786
- },
11787
- children: [
11788
- /* @__PURE__ */ jsxRuntime.jsx(index.MaterialIcon, { name: "upload_file", size: 15, color: "#fff" }),
11789
- uploading ? t("media.uploading", "Uploading...") : t("media.uploadNew", "Upload New File")
11790
- ]
11791
- }
11792
- ),
11793
- /* @__PURE__ */ jsxRuntime.jsx(
11794
- "button",
11795
- {
11796
- type: "button",
11797
- onClick: () => setModalOpen(false),
12325
+ onClick: () => {
12326
+ setEditingFile(null);
12327
+ setModalOpen(false);
12328
+ },
11798
12329
  style: {
11799
12330
  border: "none",
11800
12331
  background: "transparent",
@@ -11809,151 +12340,1259 @@ const StrapiMediaPicker = ({
11809
12340
  ]
11810
12341
  }
11811
12342
  ),
11812
- /* @__PURE__ */ jsxRuntime.jsx("div", { style: { padding: "10px 18px", borderBottom: "1px solid #f1f5f9" }, children: /* @__PURE__ */ jsxRuntime.jsx(
11813
- "input",
11814
- {
11815
- type: "text",
11816
- value: search,
11817
- onChange: (e) => setSearch(e.target.value),
11818
- placeholder: t("media.searchPlaceholder", "Search file name or extension..."),
11819
- style: {
11820
- width: "100%",
11821
- padding: "7px 10px",
11822
- fontSize: 12,
11823
- border: "1px solid #cbd5e1",
11824
- borderRadius: 5
11825
- }
11826
- }
11827
- ) }),
11828
- /* @__PURE__ */ jsxRuntime.jsx("div", { style: { padding: 18, overflowY: "auto", flex: 1 }, children: loading ? /* @__PURE__ */ jsxRuntime.jsx(
11829
- "div",
11830
- {
11831
- style: { textAlign: "center", padding: 32, color: "#64748b", fontSize: 13 },
11832
- children: t("media.loadingFiles", "Loading media files...")
11833
- }
11834
- ) : filteredFiles.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx(
11835
- "div",
11836
- {
11837
- style: { textAlign: "center", padding: 32, color: "#64748b", fontSize: 13 },
11838
- children: t(
11839
- "media.noMatchingFiles",
11840
- "No matching files found in the media library. Use the Upload New File button above to upload from your computer."
11841
- )
11842
- }
11843
- ) : /* @__PURE__ */ jsxRuntime.jsx(
11844
- "div",
11845
- {
11846
- style: {
11847
- display: "grid",
11848
- gridTemplateColumns: "repeat(auto-fill, minmax(145px, 1fr))",
11849
- gap: 12
11850
- },
11851
- children: filteredFiles.map((file) => {
11852
- const isCurrent = previewUrl && (file.url === previewUrl || file.name === value?.filename);
11853
- const thumbSrc = file.formats?.thumbnail?.url || file.formats?.small?.url || file.url || "";
11854
- return /* @__PURE__ */ jsxRuntime.jsxs(
11855
- "div",
11856
- {
11857
- onClick: () => {
11858
- onChange(mapStrapiFileToAsset(file));
11859
- setModalOpen(false);
11860
- },
11861
- style: {
11862
- border: isCurrent ? "2px solid #2669a0" : "1px solid #e2e8f0",
11863
- borderRadius: 6,
11864
- overflow: "hidden",
11865
- cursor: "pointer",
11866
- background: isCurrent ? "#eff6ff" : "#fff",
11867
- boxShadow: isCurrent ? "0 0 0 2px rgba(38, 105, 160, 0.16)" : "0 1px 3px rgba(0,0,0,0.04)"
11868
- },
11869
- children: [
11870
- /* @__PURE__ */ jsxRuntime.jsxs(
12343
+ editingFile ? /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", flex: 1, minHeight: 0, overflow: "hidden" }, children: [
12344
+ /* @__PURE__ */ jsxRuntime.jsxs(
12345
+ "div",
12346
+ {
12347
+ style: {
12348
+ flex: 1,
12349
+ background: "repeating-conic-gradient(#e2e8f0 0% 25%, #f8fafc 0% 50%) 50% / 20px 20px",
12350
+ display: "flex",
12351
+ flexDirection: "column",
12352
+ minWidth: 0,
12353
+ borderRight: "1px solid #e2e8f0"
12354
+ },
12355
+ children: [
12356
+ editingFile.mime?.startsWith("image/") && /* @__PURE__ */ jsxRuntime.jsxs(
12357
+ "div",
12358
+ {
12359
+ style: {
12360
+ display: "flex",
12361
+ alignItems: "center",
12362
+ justifyContent: "space-between",
12363
+ padding: "8px 14px",
12364
+ background: "#ffffff",
12365
+ borderBottom: "1px solid #e2e8f0",
12366
+ gap: 8,
12367
+ flexWrap: "wrap"
12368
+ },
12369
+ children: [
12370
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", alignItems: "center", gap: 4 }, children: [
12371
+ /* @__PURE__ */ jsxRuntime.jsx(
12372
+ "span",
12373
+ {
12374
+ style: {
12375
+ fontSize: 11,
12376
+ fontWeight: 700,
12377
+ color: "#475569",
12378
+ marginRight: 4
12379
+ },
12380
+ children: tr ? "En-Boy Oranı:" : "Aspect Ratio:"
12381
+ }
12382
+ ),
12383
+ ASPECT_PRESETS.map((preset) => {
12384
+ const active = aspectPreset === preset.ratio;
12385
+ return /* @__PURE__ */ jsxRuntime.jsx(
12386
+ "button",
12387
+ {
12388
+ type: "button",
12389
+ onClick: () => applyAspectPreset(preset.ratio),
12390
+ style: {
12391
+ padding: "4px 8px",
12392
+ fontSize: 11,
12393
+ fontWeight: 600,
12394
+ borderRadius: 4,
12395
+ border: active ? "1.5px solid #2669a0" : "1px solid #cbd5e1",
12396
+ background: active ? "#2669a0" : "#ffffff",
12397
+ color: active ? "#ffffff" : "#334155",
12398
+ cursor: "pointer"
12399
+ },
12400
+ children: preset.label === "Free" ? tr ? "Serbest" : "Free" : preset.label
12401
+ },
12402
+ preset.label
12403
+ );
12404
+ })
12405
+ ] }),
12406
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", alignItems: "center", gap: 6 }, children: [
12407
+ /* @__PURE__ */ jsxRuntime.jsxs(
12408
+ "button",
12409
+ {
12410
+ type: "button",
12411
+ onClick: () => setCropRotate((r) => (r - 90 + 360) % 360),
12412
+ title: tr ? "Sola Döndür (-90°)" : "Rotate Left (-90°)",
12413
+ style: {
12414
+ display: "inline-flex",
12415
+ alignItems: "center",
12416
+ gap: 3,
12417
+ padding: "4px 8px",
12418
+ fontSize: 11,
12419
+ fontWeight: 600,
12420
+ border: "1px solid #cbd5e1",
12421
+ borderRadius: 4,
12422
+ background: "#fff",
12423
+ color: "#334155",
12424
+ cursor: "pointer"
12425
+ },
12426
+ children: [
12427
+ /* @__PURE__ */ jsxRuntime.jsx(index.MaterialIcon, { name: "rotate_left", size: 15 }),
12428
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: "-90°" })
12429
+ ]
12430
+ }
12431
+ ),
12432
+ /* @__PURE__ */ jsxRuntime.jsxs(
12433
+ "button",
12434
+ {
12435
+ type: "button",
12436
+ onClick: () => setCropRotate((r) => (r + 90) % 360),
12437
+ title: tr ? "Sağa Döndür (+90°)" : "Rotate Right (+90°)",
12438
+ style: {
12439
+ display: "inline-flex",
12440
+ alignItems: "center",
12441
+ gap: 3,
12442
+ padding: "4px 8px",
12443
+ fontSize: 11,
12444
+ fontWeight: 600,
12445
+ border: "1px solid #cbd5e1",
12446
+ borderRadius: 4,
12447
+ background: "#fff",
12448
+ color: "#334155",
12449
+ cursor: "pointer"
12450
+ },
12451
+ children: [
12452
+ /* @__PURE__ */ jsxRuntime.jsx(index.MaterialIcon, { name: "rotate_right", size: 15 }),
12453
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: "+90°" })
12454
+ ]
12455
+ }
12456
+ ),
12457
+ /* @__PURE__ */ jsxRuntime.jsx(
12458
+ "button",
12459
+ {
12460
+ type: "button",
12461
+ onClick: () => {
12462
+ setCropRotate(0);
12463
+ setAspectPreset(null);
12464
+ setCropRect({
12465
+ x: 0,
12466
+ y: 0,
12467
+ width: naturalSize.width,
12468
+ height: naturalSize.height
12469
+ });
12470
+ },
12471
+ style: {
12472
+ padding: "4px 8px",
12473
+ fontSize: 11,
12474
+ fontWeight: 600,
12475
+ border: "1px solid #cbd5e1",
12476
+ borderRadius: 4,
12477
+ background: "#fff",
12478
+ color: "#64748b",
12479
+ cursor: "pointer"
12480
+ },
12481
+ children: tr ? "Sıfırla" : "Reset"
12482
+ }
12483
+ )
12484
+ ] })
12485
+ ]
12486
+ }
12487
+ ),
12488
+ /* @__PURE__ */ jsxRuntime.jsx(
12489
+ "div",
12490
+ {
12491
+ style: {
12492
+ flex: 1,
12493
+ display: "flex",
12494
+ alignItems: "center",
12495
+ justifyContent: "center",
12496
+ padding: 24,
12497
+ overflow: "hidden",
12498
+ position: "relative"
12499
+ },
12500
+ children: editingFile.mime?.startsWith("image/") ? /* @__PURE__ */ jsxRuntime.jsxs(
11871
12501
  "div",
12502
+ {
12503
+ ref: cropBoxRef,
12504
+ style: {
12505
+ position: "relative",
12506
+ display: "inline-block",
12507
+ maxWidth: "100%",
12508
+ maxHeight: "100%",
12509
+ boxShadow: "0 8px 24px rgba(15, 23, 42, 0.2)",
12510
+ userSelect: "none"
12511
+ },
12512
+ children: [
12513
+ /* @__PURE__ */ jsxRuntime.jsx(
12514
+ "img",
12515
+ {
12516
+ ref: cropImgRef,
12517
+ src: editingFile.url,
12518
+ alt: editingFile.name,
12519
+ onLoad: (e) => {
12520
+ const img = e.currentTarget;
12521
+ const nw = img.naturalWidth || editingFile.width || 800;
12522
+ const nh = img.naturalHeight || editingFile.height || 600;
12523
+ setNaturalSize({ width: nw, height: nh });
12524
+ setCropRect({ x: 0, y: 0, width: nw, height: nh });
12525
+ },
12526
+ style: {
12527
+ display: "block",
12528
+ maxWidth: "540px",
12529
+ maxHeight: "440px",
12530
+ width: "auto",
12531
+ height: "auto",
12532
+ transform: cropRotate ? `rotate(${cropRotate}deg)` : void 0,
12533
+ pointerEvents: "none"
12534
+ }
12535
+ }
12536
+ ),
12537
+ naturalSize.width > 0 && naturalSize.height > 0 && /* @__PURE__ */ jsxRuntime.jsxs(
12538
+ "div",
12539
+ {
12540
+ onMouseDown: (e) => startCropDrag(e, "move"),
12541
+ style: {
12542
+ position: "absolute",
12543
+ left: `${cropRect.x / naturalSize.width * 100}%`,
12544
+ top: `${cropRect.y / naturalSize.height * 100}%`,
12545
+ width: `${cropRect.width / naturalSize.width * 100}%`,
12546
+ height: `${cropRect.height / naturalSize.height * 100}%`,
12547
+ border: "2px dashed #38bdf8",
12548
+ boxShadow: "0 0 0 9999px rgba(15, 23, 42, 0.55)",
12549
+ cursor: "move",
12550
+ boxSizing: "border-box"
12551
+ },
12552
+ children: [
12553
+ /* @__PURE__ */ jsxRuntime.jsxs(
12554
+ "div",
12555
+ {
12556
+ style: {
12557
+ position: "absolute",
12558
+ top: 6,
12559
+ left: 6,
12560
+ background: "rgba(15, 23, 42, 0.85)",
12561
+ color: "#ffffff",
12562
+ fontSize: 10,
12563
+ fontWeight: 700,
12564
+ padding: "2px 6px",
12565
+ borderRadius: 4,
12566
+ pointerEvents: "none",
12567
+ whiteSpace: "nowrap"
12568
+ },
12569
+ children: [
12570
+ Math.round(cropRect.width),
12571
+ " × ",
12572
+ Math.round(cropRect.height),
12573
+ " px"
12574
+ ]
12575
+ }
12576
+ ),
12577
+ [
12578
+ { pos: "nw", top: -6, left: -6, cursor: "nwse-resize" },
12579
+ { pos: "ne", top: -6, right: -6, cursor: "nesw-resize" },
12580
+ { pos: "sw", bottom: -6, left: -6, cursor: "nesw-resize" },
12581
+ { pos: "se", bottom: -6, right: -6, cursor: "nwse-resize" }
12582
+ ].map((h) => /* @__PURE__ */ jsxRuntime.jsx(
12583
+ "div",
12584
+ {
12585
+ onMouseDown: (e) => startCropDrag(e, h.pos),
12586
+ style: {
12587
+ position: "absolute",
12588
+ top: "top" in h ? h.top : void 0,
12589
+ bottom: "bottom" in h ? h.bottom : void 0,
12590
+ left: "left" in h ? h.left : void 0,
12591
+ right: "right" in h ? h.right : void 0,
12592
+ width: 12,
12593
+ height: 12,
12594
+ background: "#ffffff",
12595
+ border: "2px solid #0284c7",
12596
+ borderRadius: 2,
12597
+ cursor: h.cursor
12598
+ }
12599
+ },
12600
+ h.pos
12601
+ ))
12602
+ ]
12603
+ }
12604
+ )
12605
+ ]
12606
+ }
12607
+ ) : /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { textAlign: "center", color: "#475569" }, children: [
12608
+ /* @__PURE__ */ jsxRuntime.jsx(index.MaterialIcon, { name: "description", size: 56, color: "#64748b" }),
12609
+ /* @__PURE__ */ jsxRuntime.jsx("div", { style: { marginTop: 8, fontWeight: 600 }, children: editingFile.name })
12610
+ ] })
12611
+ }
12612
+ )
12613
+ ]
12614
+ }
12615
+ ),
12616
+ /* @__PURE__ */ jsxRuntime.jsxs(
12617
+ "div",
12618
+ {
12619
+ style: {
12620
+ width: 320,
12621
+ background: "#ffffff",
12622
+ display: "flex",
12623
+ flexDirection: "column",
12624
+ overflowY: "auto",
12625
+ padding: 16,
12626
+ gap: 14
12627
+ },
12628
+ children: [
12629
+ editingFile.mime?.startsWith("image/") && /* @__PURE__ */ jsxRuntime.jsxs(
12630
+ "div",
12631
+ {
12632
+ style: {
12633
+ padding: 12,
12634
+ borderRadius: 8,
12635
+ background: "#f8fafc",
12636
+ border: "1px solid #cbd5e1",
12637
+ display: "flex",
12638
+ flexDirection: "column",
12639
+ gap: 10
12640
+ },
12641
+ children: [
12642
+ /* @__PURE__ */ jsxRuntime.jsxs(
12643
+ "div",
12644
+ {
12645
+ style: {
12646
+ fontSize: 11,
12647
+ fontWeight: 700,
12648
+ color: "#1e3a8a",
12649
+ textTransform: "uppercase",
12650
+ display: "flex",
12651
+ alignItems: "center",
12652
+ gap: 5
12653
+ },
12654
+ children: [
12655
+ /* @__PURE__ */ jsxRuntime.jsx(index.MaterialIcon, { name: "crop", size: 15, color: "#2669a0" }),
12656
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: tr ? "Kırpma Boyutları (Sharp)" : "Crop Coordinates (Sharp)" })
12657
+ ]
12658
+ }
12659
+ ),
12660
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "grid", gridTemplateColumns: "1fr 1fr", gap: 8 }, children: [
12661
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
12662
+ /* @__PURE__ */ jsxRuntime.jsx("label", { style: { fontSize: 10, fontWeight: 600, color: "#64748b" }, children: tr ? "Genişlik (W px)" : "Width (W px)" }),
12663
+ /* @__PURE__ */ jsxRuntime.jsx(
12664
+ "input",
12665
+ {
12666
+ type: "number",
12667
+ min: 16,
12668
+ max: naturalSize.width || 1e4,
12669
+ value: Math.round(cropRect.width),
12670
+ onChange: (e) => setCropRect((prev) => ({
12671
+ ...prev,
12672
+ width: Math.max(16, Number(e.target.value) || 16)
12673
+ })),
12674
+ style: {
12675
+ width: "100%",
12676
+ padding: "5px 8px",
12677
+ fontSize: 12,
12678
+ border: "1px solid #cbd5e1",
12679
+ borderRadius: 4
12680
+ }
12681
+ }
12682
+ )
12683
+ ] }),
12684
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
12685
+ /* @__PURE__ */ jsxRuntime.jsx("label", { style: { fontSize: 10, fontWeight: 600, color: "#64748b" }, children: tr ? "Yükseklik (H px)" : "Height (H px)" }),
12686
+ /* @__PURE__ */ jsxRuntime.jsx(
12687
+ "input",
12688
+ {
12689
+ type: "number",
12690
+ min: 16,
12691
+ max: naturalSize.height || 1e4,
12692
+ value: Math.round(cropRect.height),
12693
+ onChange: (e) => setCropRect((prev) => ({
12694
+ ...prev,
12695
+ height: Math.max(16, Number(e.target.value) || 16)
12696
+ })),
12697
+ style: {
12698
+ width: "100%",
12699
+ padding: "5px 8px",
12700
+ fontSize: 12,
12701
+ border: "1px solid #cbd5e1",
12702
+ borderRadius: 4
12703
+ }
12704
+ }
12705
+ )
12706
+ ] }),
12707
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
12708
+ /* @__PURE__ */ jsxRuntime.jsx("label", { style: { fontSize: 10, fontWeight: 600, color: "#64748b" }, children: "X (Sol / Left px)" }),
12709
+ /* @__PURE__ */ jsxRuntime.jsx(
12710
+ "input",
12711
+ {
12712
+ type: "number",
12713
+ min: 0,
12714
+ value: Math.round(cropRect.x),
12715
+ onChange: (e) => setCropRect((prev) => ({
12716
+ ...prev,
12717
+ x: Math.max(0, Number(e.target.value) || 0)
12718
+ })),
12719
+ style: {
12720
+ width: "100%",
12721
+ padding: "5px 8px",
12722
+ fontSize: 12,
12723
+ border: "1px solid #cbd5e1",
12724
+ borderRadius: 4
12725
+ }
12726
+ }
12727
+ )
12728
+ ] }),
12729
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
12730
+ /* @__PURE__ */ jsxRuntime.jsx("label", { style: { fontSize: 10, fontWeight: 600, color: "#64748b" }, children: "Y (Üst / Top px)" }),
12731
+ /* @__PURE__ */ jsxRuntime.jsx(
12732
+ "input",
12733
+ {
12734
+ type: "number",
12735
+ min: 0,
12736
+ value: Math.round(cropRect.y),
12737
+ onChange: (e) => setCropRect((prev) => ({
12738
+ ...prev,
12739
+ y: Math.max(0, Number(e.target.value) || 0)
12740
+ })),
12741
+ style: {
12742
+ width: "100%",
12743
+ padding: "5px 8px",
12744
+ fontSize: 12,
12745
+ border: "1px solid #cbd5e1",
12746
+ borderRadius: 4
12747
+ }
12748
+ }
12749
+ )
12750
+ ] })
12751
+ ] }),
12752
+ cropError && /* @__PURE__ */ jsxRuntime.jsx(
12753
+ "div",
12754
+ {
12755
+ style: {
12756
+ padding: "6px 8px",
12757
+ borderRadius: 4,
12758
+ background: "#fef2f2",
12759
+ color: "#dc2626",
12760
+ fontSize: 11
12761
+ },
12762
+ children: cropError
12763
+ }
12764
+ ),
12765
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", flexDirection: "column", gap: 6 }, children: [
12766
+ /* @__PURE__ */ jsxRuntime.jsxs(
12767
+ "button",
12768
+ {
12769
+ type: "button",
12770
+ disabled: croppingBusy,
12771
+ onClick: () => handleExecuteCrop("duplicate"),
12772
+ style: {
12773
+ padding: "8px 12px",
12774
+ fontSize: 12,
12775
+ fontWeight: 700,
12776
+ borderRadius: 5,
12777
+ border: "none",
12778
+ background: "#2669a0",
12779
+ color: "#ffffff",
12780
+ cursor: croppingBusy ? "wait" : "pointer",
12781
+ display: "flex",
12782
+ alignItems: "center",
12783
+ justifyContent: "center",
12784
+ gap: 6
12785
+ },
12786
+ children: [
12787
+ /* @__PURE__ */ jsxRuntime.jsx(index.MaterialIcon, { name: "content_copy", size: 15, color: "#fff" }),
12788
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: croppingBusy ? tr ? "İşleniyor..." : "Processing..." : tr ? "Kopyasını Oluştur & Kırp" : "Duplicate & Crop Asset" })
12789
+ ]
12790
+ }
12791
+ ),
12792
+ /* @__PURE__ */ jsxRuntime.jsxs(
12793
+ "button",
12794
+ {
12795
+ type: "button",
12796
+ disabled: croppingBusy,
12797
+ onClick: () => handleExecuteCrop("replace"),
12798
+ style: {
12799
+ padding: "7px 12px",
12800
+ fontSize: 12,
12801
+ fontWeight: 600,
12802
+ borderRadius: 5,
12803
+ border: "1px solid #2669a0",
12804
+ background: "#eff6ff",
12805
+ color: "#1e3a8a",
12806
+ cursor: croppingBusy ? "wait" : "pointer",
12807
+ display: "flex",
12808
+ alignItems: "center",
12809
+ justifyContent: "center",
12810
+ gap: 6
12811
+ },
12812
+ children: [
12813
+ /* @__PURE__ */ jsxRuntime.jsx(index.MaterialIcon, { name: "crop", size: 15, color: "#1e3a8a" }),
12814
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: tr ? "Orijinal Görseli Kırp (Üzerine Yaz)" : "Crop Original Asset" })
12815
+ ]
12816
+ }
12817
+ )
12818
+ ] })
12819
+ ]
12820
+ }
12821
+ ),
12822
+ /* @__PURE__ */ jsxRuntime.jsxs(
12823
+ "div",
12824
+ {
12825
+ style: {
12826
+ display: "flex",
12827
+ flexDirection: "column",
12828
+ gap: 8,
12829
+ borderTop: "1px solid #e2e8f0",
12830
+ paddingTop: 12
12831
+ },
12832
+ children: [
12833
+ /* @__PURE__ */ jsxRuntime.jsx(
12834
+ "div",
12835
+ {
12836
+ style: {
12837
+ fontSize: 11,
12838
+ fontWeight: 700,
12839
+ color: "#334155",
12840
+ textTransform: "uppercase"
12841
+ },
12842
+ children: tr ? "Dosya Bilgileri (Metadata)" : "Asset Metadata"
12843
+ }
12844
+ ),
12845
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
12846
+ /* @__PURE__ */ jsxRuntime.jsx("label", { style: { fontSize: 11, fontWeight: 600, color: "#475569" }, children: tr ? "Dosya Adı" : "File Name" }),
12847
+ /* @__PURE__ */ jsxRuntime.jsx(
12848
+ "input",
12849
+ {
12850
+ type: "text",
12851
+ value: editName,
12852
+ onChange: (e) => setEditName(e.target.value),
12853
+ style: {
12854
+ width: "100%",
12855
+ padding: "6px 8px",
12856
+ fontSize: 12,
12857
+ border: "1px solid #cbd5e1",
12858
+ borderRadius: 4,
12859
+ marginTop: 2
12860
+ }
12861
+ }
12862
+ )
12863
+ ] }),
12864
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
12865
+ /* @__PURE__ */ jsxRuntime.jsx("label", { style: { fontSize: 11, fontWeight: 600, color: "#475569" }, children: tr ? "Alternatif Metin (Alt Text / SEO)" : "Alternative Text (Alt / SEO)" }),
12866
+ /* @__PURE__ */ jsxRuntime.jsx(
12867
+ "input",
12868
+ {
12869
+ type: "text",
12870
+ value: editAlt,
12871
+ onChange: (e) => setEditAlt(e.target.value),
12872
+ style: {
12873
+ width: "100%",
12874
+ padding: "6px 8px",
12875
+ fontSize: 12,
12876
+ border: "1px solid #cbd5e1",
12877
+ borderRadius: 4,
12878
+ marginTop: 2
12879
+ }
12880
+ }
12881
+ )
12882
+ ] }),
12883
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
12884
+ /* @__PURE__ */ jsxRuntime.jsx("label", { style: { fontSize: 11, fontWeight: 600, color: "#475569" }, children: tr ? "Altyazı (Caption)" : "Caption" }),
12885
+ /* @__PURE__ */ jsxRuntime.jsx(
12886
+ "input",
12887
+ {
12888
+ type: "text",
12889
+ value: editCaption,
12890
+ onChange: (e) => setEditCaption(e.target.value),
12891
+ style: {
12892
+ width: "100%",
12893
+ padding: "6px 8px",
12894
+ fontSize: 12,
12895
+ border: "1px solid #cbd5e1",
12896
+ borderRadius: 4,
12897
+ marginTop: 2
12898
+ }
12899
+ }
12900
+ )
12901
+ ] }),
12902
+ folders.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
12903
+ /* @__PURE__ */ jsxRuntime.jsx("label", { style: { fontSize: 11, fontWeight: 600, color: "#475569" }, children: tr ? "Klasör Konumu" : "Folder Location" }),
12904
+ /* @__PURE__ */ jsxRuntime.jsxs(
12905
+ "select",
12906
+ {
12907
+ value: editFolderId ?? "",
12908
+ onChange: (e) => setEditFolderId(e.target.value ? Number(e.target.value) : null),
12909
+ style: {
12910
+ width: "100%",
12911
+ padding: "6px 8px",
12912
+ fontSize: 12,
12913
+ border: "1px solid #cbd5e1",
12914
+ borderRadius: 4,
12915
+ marginTop: 2,
12916
+ background: "#fff"
12917
+ },
12918
+ children: [
12919
+ /* @__PURE__ */ jsxRuntime.jsx("option", { value: "", children: tr ? "Ana Dizin (Root)" : "Media Library Root" }),
12920
+ folders.map((fld) => /* @__PURE__ */ jsxRuntime.jsx("option", { value: fld.id, children: fld.name }, fld.id))
12921
+ ]
12922
+ }
12923
+ )
12924
+ ] }),
12925
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", gap: 6, marginTop: 4 }, children: [
12926
+ /* @__PURE__ */ jsxRuntime.jsx(
12927
+ "button",
12928
+ {
12929
+ type: "button",
12930
+ disabled: savingDetails,
12931
+ onClick: handleSaveDetails,
12932
+ style: {
12933
+ flex: 1,
12934
+ padding: "7px 10px",
12935
+ fontSize: 12,
12936
+ fontWeight: 600,
12937
+ borderRadius: 5,
12938
+ border: "1px solid #cbd5e1",
12939
+ background: "#f8fafc",
12940
+ color: "#0f172a",
12941
+ cursor: "pointer"
12942
+ },
12943
+ children: savingDetails ? tr ? "Kaydediliyor..." : "Saving..." : tr ? "Bilgileri Kaydet" : "Save Metadata"
12944
+ }
12945
+ ),
12946
+ /* @__PURE__ */ jsxRuntime.jsx(
12947
+ "button",
12948
+ {
12949
+ type: "button",
12950
+ onClick: (e) => handleDeleteAsset(editingFile, e),
12951
+ title: tr ? "Dosyayı Kütüphaneden Sil" : "Delete from Media Library",
12952
+ style: {
12953
+ padding: "7px 10px",
12954
+ fontSize: 12,
12955
+ fontWeight: 600,
12956
+ borderRadius: 5,
12957
+ border: "1px solid #fecaca",
12958
+ background: "#fef2f2",
12959
+ color: "#dc2626",
12960
+ cursor: "pointer"
12961
+ },
12962
+ children: /* @__PURE__ */ jsxRuntime.jsx(index.MaterialIcon, { name: "delete_outline", size: 16, color: "#dc2626" })
12963
+ }
12964
+ )
12965
+ ] })
12966
+ ]
12967
+ }
12968
+ )
12969
+ ]
12970
+ }
12971
+ )
12972
+ ] }) : (
12973
+ /* VIEW 2: MEDIA LIBRARY BROWSER (Folders, Filters, Sort, Multi-Select, Item Actions) */
12974
+ /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
12975
+ creatingFolder && /* @__PURE__ */ jsxRuntime.jsxs(
12976
+ "div",
12977
+ {
12978
+ style: {
12979
+ padding: "8px 18px",
12980
+ background: "#eff6ff",
12981
+ borderBottom: "1px solid #bfdbfe",
12982
+ display: "flex",
12983
+ alignItems: "center",
12984
+ gap: 8
12985
+ },
12986
+ children: [
12987
+ /* @__PURE__ */ jsxRuntime.jsx(index.MaterialIcon, { name: "folder", size: 16, color: "#2669a0" }),
12988
+ /* @__PURE__ */ jsxRuntime.jsx(
12989
+ "input",
12990
+ {
12991
+ type: "text",
12992
+ value: newFolderName,
12993
+ onChange: (e) => setNewFolderName(e.target.value),
12994
+ onKeyDown: (e) => {
12995
+ if (e.key === "Enter") {
12996
+ e.preventDefault();
12997
+ handleCreateFolder();
12998
+ }
12999
+ },
13000
+ placeholder: tr ? "Yeni klasör adı yazın..." : "Enter new folder name...",
13001
+ style: {
13002
+ flex: 1,
13003
+ padding: "5px 10px",
13004
+ fontSize: 12,
13005
+ border: "1px solid #93c5fd",
13006
+ borderRadius: 4,
13007
+ background: "#fff"
13008
+ }
13009
+ }
13010
+ ),
13011
+ /* @__PURE__ */ jsxRuntime.jsx(
13012
+ "button",
13013
+ {
13014
+ type: "button",
13015
+ onClick: handleCreateFolder,
13016
+ style: {
13017
+ padding: "5px 12px",
13018
+ fontSize: 12,
13019
+ fontWeight: 600,
13020
+ background: "#2669a0",
13021
+ color: "#fff",
13022
+ border: "none",
13023
+ borderRadius: 4,
13024
+ cursor: "pointer"
13025
+ },
13026
+ children: tr ? "Oluştur" : "Create"
13027
+ }
13028
+ ),
13029
+ /* @__PURE__ */ jsxRuntime.jsx(
13030
+ "button",
13031
+ {
13032
+ type: "button",
13033
+ onClick: () => setCreatingFolder(false),
13034
+ style: {
13035
+ padding: "5px 10px",
13036
+ fontSize: 12,
13037
+ border: "1px solid #cbd5e1",
13038
+ background: "#fff",
13039
+ borderRadius: 4,
13040
+ cursor: "pointer"
13041
+ },
13042
+ children: tr ? "İptal" : "Cancel"
13043
+ }
13044
+ )
13045
+ ]
13046
+ }
13047
+ ),
13048
+ /* @__PURE__ */ jsxRuntime.jsxs(
13049
+ "div",
13050
+ {
13051
+ style: {
13052
+ padding: "10px 18px",
13053
+ borderBottom: "1px solid #f1f5f9",
13054
+ display: "flex",
13055
+ alignItems: "center",
13056
+ gap: 8,
13057
+ flexWrap: "wrap"
13058
+ },
13059
+ children: [
13060
+ /* @__PURE__ */ jsxRuntime.jsx(
13061
+ "input",
13062
+ {
13063
+ type: "text",
13064
+ value: search,
13065
+ onChange: (e) => setSearch(e.target.value),
13066
+ placeholder: t("media.searchPlaceholder", "Search file name or extension..."),
13067
+ style: {
13068
+ flex: 1,
13069
+ minWidth: 180,
13070
+ padding: "7px 10px",
13071
+ fontSize: 12,
13072
+ border: "1px solid #cbd5e1",
13073
+ borderRadius: 5
13074
+ }
13075
+ }
13076
+ ),
13077
+ /* @__PURE__ */ jsxRuntime.jsx("div", { style: { display: "flex", gap: 4 }, children: [
13078
+ { key: "all", label: tr ? "Tümü" : "All" },
13079
+ { key: "image", label: tr ? "Görsel" : "Images" },
13080
+ { key: "video", label: tr ? "Video" : "Videos" },
13081
+ { key: "doc", label: tr ? "Belge" : "Docs" }
13082
+ ].map((tf) => {
13083
+ const active = typeFilter === tf.key;
13084
+ return /* @__PURE__ */ jsxRuntime.jsx(
13085
+ "button",
13086
+ {
13087
+ type: "button",
13088
+ onClick: () => setTypeFilter(tf.key),
13089
+ style: {
13090
+ padding: "5px 9px",
13091
+ fontSize: 11,
13092
+ fontWeight: 600,
13093
+ borderRadius: 5,
13094
+ border: active ? "1.5px solid #2669a0" : "1px solid #cbd5e1",
13095
+ background: active ? "#eff6ff" : "#ffffff",
13096
+ color: active ? "#2669a0" : "#475569",
13097
+ cursor: "pointer"
13098
+ },
13099
+ children: tf.label
13100
+ },
13101
+ tf.key
13102
+ );
13103
+ }) }),
13104
+ /* @__PURE__ */ jsxRuntime.jsxs(
13105
+ "select",
13106
+ {
13107
+ value: sortBy,
13108
+ onChange: (e) => setSortBy(e.target.value),
13109
+ style: {
13110
+ padding: "6px 8px",
13111
+ fontSize: 11,
13112
+ fontWeight: 600,
13113
+ border: "1px solid #cbd5e1",
13114
+ borderRadius: 5,
13115
+ background: "#ffffff",
13116
+ color: "#334155"
13117
+ },
13118
+ children: [
13119
+ /* @__PURE__ */ jsxRuntime.jsx("option", { value: "newest", children: tr ? "En Yeni" : "Newest first" }),
13120
+ /* @__PURE__ */ jsxRuntime.jsx("option", { value: "oldest", children: tr ? "En Eski" : "Oldest first" }),
13121
+ /* @__PURE__ */ jsxRuntime.jsx("option", { value: "nameAsc", children: tr ? "Ad (A - Z)" : "Name (A - Z)" }),
13122
+ /* @__PURE__ */ jsxRuntime.jsx("option", { value: "nameDesc", children: tr ? "Ad (Z - A)" : "Name (Z - A)" }),
13123
+ /* @__PURE__ */ jsxRuntime.jsx("option", { value: "sizeDesc", children: tr ? "Boyut (Büyükten)" : "Size (Largest)" })
13124
+ ]
13125
+ }
13126
+ ),
13127
+ multiple && filteredFiles.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
13128
+ /* @__PURE__ */ jsxRuntime.jsx(
13129
+ "button",
13130
+ {
13131
+ type: "button",
13132
+ onClick: () => {
13133
+ const existingKeys = new Set(selectedFiles.map(getFileKey));
13134
+ const additions = filteredFiles.filter(
13135
+ (f) => !existingKeys.has(getFileKey(f))
13136
+ );
13137
+ setSelectedFiles([...selectedFiles, ...additions]);
13138
+ },
13139
+ style: {
13140
+ padding: "6px 10px",
13141
+ fontSize: 11,
13142
+ fontWeight: 600,
13143
+ border: "1px solid #cbd5e1",
13144
+ borderRadius: 5,
13145
+ background: "#ffffff",
13146
+ color: "#334155",
13147
+ cursor: "pointer",
13148
+ whiteSpace: "nowrap"
13149
+ },
13150
+ children: t("selectAllVisible", "Select All")
13151
+ }
13152
+ ),
13153
+ selectedFiles.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(
13154
+ "button",
13155
+ {
13156
+ type: "button",
13157
+ onClick: () => setSelectedFiles([]),
13158
+ style: {
13159
+ padding: "6px 10px",
13160
+ fontSize: 11,
13161
+ fontWeight: 600,
13162
+ border: "1px solid #fecaca",
13163
+ borderRadius: 5,
13164
+ background: "#fef2f2",
13165
+ color: "#dc2626",
13166
+ cursor: "pointer",
13167
+ whiteSpace: "nowrap"
13168
+ },
13169
+ children: t("clearSelection", "Clear Selection")
13170
+ }
13171
+ )
13172
+ ] })
13173
+ ]
13174
+ }
13175
+ ),
13176
+ (folders.length > 0 || currentFolderId !== null) && /* @__PURE__ */ jsxRuntime.jsxs(
13177
+ "div",
13178
+ {
13179
+ style: {
13180
+ padding: "8px 18px",
13181
+ borderBottom: "1px solid #f1f5f9",
13182
+ background: "#f8fafc",
13183
+ display: "flex",
13184
+ alignItems: "center",
13185
+ gap: 6,
13186
+ flexWrap: "wrap"
13187
+ },
13188
+ children: [
13189
+ /* @__PURE__ */ jsxRuntime.jsxs(
13190
+ "button",
13191
+ {
13192
+ type: "button",
13193
+ onClick: () => setCurrentFolderId(null),
13194
+ style: {
13195
+ display: "inline-flex",
13196
+ alignItems: "center",
13197
+ gap: 4,
13198
+ padding: "4px 8px",
13199
+ fontSize: 11,
13200
+ fontWeight: 700,
13201
+ borderRadius: 4,
13202
+ border: currentFolderId === null ? "1.5px solid #2669a0" : "1px solid #cbd5e1",
13203
+ background: currentFolderId === null ? "#2669a0" : "#ffffff",
13204
+ color: currentFolderId === null ? "#ffffff" : "#334155",
13205
+ cursor: "pointer"
13206
+ },
13207
+ children: [
13208
+ /* @__PURE__ */ jsxRuntime.jsx(
13209
+ index.MaterialIcon,
13210
+ {
13211
+ name: "folder",
13212
+ size: 14,
13213
+ color: currentFolderId === null ? "#ffffff" : "#2669a0"
13214
+ }
13215
+ ),
13216
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: tr ? "Ana Dizin" : "Media Library" })
13217
+ ]
13218
+ }
13219
+ ),
13220
+ currentFolderObj && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
13221
+ /* @__PURE__ */ jsxRuntime.jsx("span", { style: { color: "#94a3b8", fontSize: 12 }, children: "/" }),
13222
+ /* @__PURE__ */ jsxRuntime.jsx(
13223
+ "span",
11872
13224
  {
11873
13225
  style: {
11874
- height: 100,
11875
- background: "#f1f5f9",
11876
- display: "flex",
11877
- alignItems: "center",
11878
- justifyContent: "center",
11879
- position: "relative"
13226
+ fontSize: 12,
13227
+ fontWeight: 700,
13228
+ color: "#1e3a8a",
13229
+ padding: "3px 8px",
13230
+ background: "#dbeafe",
13231
+ borderRadius: 4
11880
13232
  },
11881
- children: [
11882
- file.mime?.startsWith("image/") ? /* @__PURE__ */ jsxRuntime.jsx(
11883
- "img",
11884
- {
11885
- src: thumbSrc,
11886
- alt: file.name,
11887
- style: { width: "100%", height: "100%", objectFit: "cover" }
11888
- }
11889
- ) : /* @__PURE__ */ jsxRuntime.jsx(index.MaterialIcon, { name: "description", size: 30, color: "#64748b" }),
11890
- isCurrent && /* @__PURE__ */ jsxRuntime.jsx(
11891
- "span",
13233
+ children: currentFolderObj.name
13234
+ }
13235
+ )
13236
+ ] }),
13237
+ visibleFolders.map((fld) => /* @__PURE__ */ jsxRuntime.jsxs(
13238
+ "button",
13239
+ {
13240
+ type: "button",
13241
+ onClick: () => setCurrentFolderId(Number(fld.id)),
13242
+ style: {
13243
+ display: "inline-flex",
13244
+ alignItems: "center",
13245
+ gap: 5,
13246
+ padding: "4px 10px",
13247
+ fontSize: 11,
13248
+ fontWeight: 600,
13249
+ borderRadius: 4,
13250
+ border: "1px solid #cbd5e1",
13251
+ background: "#ffffff",
13252
+ color: "#1e293b",
13253
+ cursor: "pointer"
13254
+ },
13255
+ children: [
13256
+ /* @__PURE__ */ jsxRuntime.jsx(index.MaterialIcon, { name: "folder", size: 14, color: "#f59e0b" }),
13257
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: fld.name })
13258
+ ]
13259
+ },
13260
+ fld.id
13261
+ ))
13262
+ ]
13263
+ }
13264
+ ),
13265
+ /* @__PURE__ */ jsxRuntime.jsx("div", { style: { padding: 18, overflowY: "auto", flex: 1 }, children: loading ? /* @__PURE__ */ jsxRuntime.jsx(
13266
+ "div",
13267
+ {
13268
+ style: {
13269
+ textAlign: "center",
13270
+ padding: 32,
13271
+ color: "#64748b",
13272
+ fontSize: 13
13273
+ },
13274
+ children: t("media.loadingFiles", "Loading media files...")
13275
+ }
13276
+ ) : filteredFiles.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx(
13277
+ "div",
13278
+ {
13279
+ style: {
13280
+ textAlign: "center",
13281
+ padding: 32,
13282
+ color: "#64748b",
13283
+ fontSize: 13
13284
+ },
13285
+ children: t(
13286
+ "media.noMatchingFiles",
13287
+ "No matching files found in the media library. Use the Upload New File button above to upload from your computer."
13288
+ )
13289
+ }
13290
+ ) : /* @__PURE__ */ jsxRuntime.jsx(
13291
+ "div",
13292
+ {
13293
+ style: {
13294
+ display: "grid",
13295
+ gridTemplateColumns: "repeat(auto-fill, minmax(160px, 1fr))",
13296
+ gap: 12
13297
+ },
13298
+ children: filteredFiles.map((file) => {
13299
+ const fileKey = getFileKey(file);
13300
+ const multiIndex = multiple ? selectedFiles.findIndex((f) => getFileKey(f) === fileKey) : -1;
13301
+ const isMultiSelected = multiIndex !== -1;
13302
+ const isCurrent = multiple ? isMultiSelected : Boolean(
13303
+ previewUrl && (file.url === previewUrl.split("?")[0] || file.name === value?.filename)
13304
+ );
13305
+ const thumbSrc = file.formats?.thumbnail?.url || file.formats?.small?.url || file.url || "";
13306
+ return /* @__PURE__ */ jsxRuntime.jsxs(
13307
+ "div",
13308
+ {
13309
+ onClick: () => {
13310
+ if (multiple) {
13311
+ toggleFileSelection(file);
13312
+ } else {
13313
+ onChange(mapStrapiFileToAsset(file));
13314
+ setModalOpen(false);
13315
+ }
13316
+ },
13317
+ onDoubleClick: () => {
13318
+ if (multiple) {
13319
+ const asset = mapStrapiFileToAsset(file);
13320
+ const listToCommit = selectedFiles.length > 0 ? selectedFiles.map((f) => mapStrapiFileToAsset(f)) : [asset];
13321
+ if (onSelectMultiple) {
13322
+ onSelectMultiple(listToCommit);
13323
+ } else {
13324
+ listToCommit.forEach((a) => onChange(a));
13325
+ }
13326
+ setSelectedFiles([]);
13327
+ setModalOpen(false);
13328
+ }
13329
+ },
13330
+ style: {
13331
+ border: isCurrent ? "2px solid #2669a0" : "1px solid #e2e8f0",
13332
+ borderRadius: 6,
13333
+ overflow: "hidden",
13334
+ cursor: "pointer",
13335
+ background: isCurrent ? "#eff6ff" : "#fff",
13336
+ boxShadow: isCurrent ? "0 0 0 2px rgba(38, 105, 160, 0.16)" : "0 1px 3px rgba(0,0,0,0.04)",
13337
+ userSelect: "none",
13338
+ display: "flex",
13339
+ flexDirection: "column"
13340
+ },
13341
+ children: [
13342
+ /* @__PURE__ */ jsxRuntime.jsxs(
13343
+ "div",
13344
+ {
13345
+ style: {
13346
+ height: 112,
13347
+ background: "#f1f5f9",
13348
+ display: "flex",
13349
+ alignItems: "center",
13350
+ justifyContent: "center",
13351
+ position: "relative"
13352
+ },
13353
+ children: [
13354
+ file.mime?.startsWith("image/") ? /* @__PURE__ */ jsxRuntime.jsx(
13355
+ "img",
13356
+ {
13357
+ src: thumbSrc,
13358
+ alt: file.name,
13359
+ style: { width: "100%", height: "100%", objectFit: "cover" }
13360
+ }
13361
+ ) : /* @__PURE__ */ jsxRuntime.jsx(index.MaterialIcon, { name: "description", size: 30, color: "#64748b" }),
13362
+ multiple ? /* @__PURE__ */ jsxRuntime.jsx(
13363
+ "span",
13364
+ {
13365
+ style: {
13366
+ position: "absolute",
13367
+ top: 6,
13368
+ left: 6,
13369
+ minWidth: 22,
13370
+ height: 22,
13371
+ padding: isMultiSelected ? "0 6px" : 0,
13372
+ borderRadius: 11,
13373
+ background: isMultiSelected ? "#2669a0" : "rgba(255, 255, 255, 0.9)",
13374
+ border: isMultiSelected ? "1.5px solid #ffffff" : "1.5px solid #94a3b8",
13375
+ color: "#ffffff",
13376
+ fontSize: 10,
13377
+ fontWeight: 700,
13378
+ display: "inline-flex",
13379
+ alignItems: "center",
13380
+ justifyContent: "center",
13381
+ boxShadow: "0 1px 3px rgba(0,0,0,0.2)"
13382
+ },
13383
+ children: isMultiSelected ? `✓ ${multiIndex + 1}` : ""
13384
+ }
13385
+ ) : isCurrent && /* @__PURE__ */ jsxRuntime.jsx(
13386
+ "span",
13387
+ {
13388
+ style: {
13389
+ position: "absolute",
13390
+ top: 5,
13391
+ left: 5,
13392
+ background: "#2669a0",
13393
+ color: "#fff",
13394
+ fontSize: 9,
13395
+ fontWeight: 700,
13396
+ padding: "2px 6px",
13397
+ borderRadius: 4
13398
+ },
13399
+ children: t("media.selectedBadge", "SELECTED")
13400
+ }
13401
+ ),
13402
+ /* @__PURE__ */ jsxRuntime.jsxs(
13403
+ "div",
13404
+ {
13405
+ style: {
13406
+ position: "absolute",
13407
+ top: 5,
13408
+ right: 5,
13409
+ display: "flex",
13410
+ gap: 4
13411
+ },
13412
+ onClick: (e) => e.stopPropagation(),
13413
+ children: [
13414
+ /* @__PURE__ */ jsxRuntime.jsx(
13415
+ "button",
13416
+ {
13417
+ type: "button",
13418
+ onClick: (e) => {
13419
+ e.stopPropagation();
13420
+ openEditorForFile(file, "crop");
13421
+ },
13422
+ title: file.mime?.startsWith("image/") ? tr ? "Görseli Kırp & Düzenle" : "Crop & Edit Image" : tr ? "Dosya Bilgilerini Düzenle" : "Edit File Details",
13423
+ style: {
13424
+ width: 24,
13425
+ height: 24,
13426
+ borderRadius: 4,
13427
+ border: "1px solid rgba(15,23,42,0.15)",
13428
+ background: "rgba(255,255,255,0.92)",
13429
+ color: "#1e293b",
13430
+ display: "inline-flex",
13431
+ alignItems: "center",
13432
+ justifyContent: "center",
13433
+ cursor: "pointer",
13434
+ padding: 0
13435
+ },
13436
+ children: /* @__PURE__ */ jsxRuntime.jsx(
13437
+ index.MaterialIcon,
13438
+ {
13439
+ name: file.mime?.startsWith("image/") ? "crop" : "edit",
13440
+ size: 14,
13441
+ color: "#2669a0"
13442
+ }
13443
+ )
13444
+ }
13445
+ ),
13446
+ /* @__PURE__ */ jsxRuntime.jsx(
13447
+ "button",
13448
+ {
13449
+ type: "button",
13450
+ onClick: (e) => handleDeleteAsset(file, e),
13451
+ title: tr ? "Kütüphaneden Sil" : "Delete from Library",
13452
+ style: {
13453
+ width: 24,
13454
+ height: 24,
13455
+ borderRadius: 4,
13456
+ border: "1px solid rgba(15,23,42,0.15)",
13457
+ background: "rgba(255,255,255,0.92)",
13458
+ color: "#dc2626",
13459
+ display: "inline-flex",
13460
+ alignItems: "center",
13461
+ justifyContent: "center",
13462
+ cursor: "pointer",
13463
+ padding: 0
13464
+ },
13465
+ children: /* @__PURE__ */ jsxRuntime.jsx(index.MaterialIcon, { name: "delete_outline", size: 14, color: "#dc2626" })
13466
+ }
13467
+ )
13468
+ ]
13469
+ }
13470
+ ),
13471
+ file.ext && /* @__PURE__ */ jsxRuntime.jsx(
13472
+ "span",
13473
+ {
13474
+ style: {
13475
+ position: "absolute",
13476
+ bottom: 4,
13477
+ right: 4,
13478
+ background: "rgba(15,23,42,0.75)",
13479
+ color: "#fff",
13480
+ fontSize: 9,
13481
+ fontWeight: 700,
13482
+ padding: "1px 5px",
13483
+ borderRadius: 3,
13484
+ textTransform: "uppercase"
13485
+ },
13486
+ children: file.ext.replace(".", "")
13487
+ }
13488
+ )
13489
+ ]
13490
+ }
13491
+ ),
13492
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { padding: "6px 8px" }, children: [
13493
+ /* @__PURE__ */ jsxRuntime.jsx(
13494
+ "div",
11892
13495
  {
11893
13496
  style: {
11894
- position: "absolute",
11895
- top: 5,
11896
- left: 5,
11897
- background: "#2669a0",
11898
- color: "#fff",
11899
- fontSize: 9,
11900
- fontWeight: 700,
11901
- padding: "2px 6px",
11902
- borderRadius: 4
13497
+ fontSize: 11,
13498
+ fontWeight: 600,
13499
+ color: "#1e293b",
13500
+ overflow: "hidden",
13501
+ textOverflow: "ellipsis",
13502
+ whiteSpace: "nowrap"
11903
13503
  },
11904
- children: t("media.selectedBadge", "SELECTED")
13504
+ title: file.name,
13505
+ children: file.name
11905
13506
  }
11906
13507
  ),
11907
- file.ext && /* @__PURE__ */ jsxRuntime.jsx(
11908
- "span",
11909
- {
11910
- style: {
11911
- position: "absolute",
11912
- bottom: 4,
11913
- right: 4,
11914
- background: "rgba(15,23,42,0.75)",
11915
- color: "#fff",
11916
- fontSize: 9,
11917
- fontWeight: 700,
11918
- padding: "1px 5px",
11919
- borderRadius: 3,
11920
- textTransform: "uppercase"
11921
- },
11922
- children: file.ext.replace(".", "")
11923
- }
11924
- )
11925
- ]
13508
+ (file.width || file.size) && /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { fontSize: 10, color: "#64748b", marginTop: 2 }, children: [
13509
+ file.width && file.height ? `${file.width}×${file.height}` : "",
13510
+ file.width && file.size ? " · " : "",
13511
+ file.size ? `${Math.round(Number(file.size))} KB` : ""
13512
+ ] })
13513
+ ] })
13514
+ ]
13515
+ },
13516
+ fileKey
13517
+ );
13518
+ })
13519
+ }
13520
+ ) }),
13521
+ /* @__PURE__ */ jsxRuntime.jsxs(
13522
+ "div",
13523
+ {
13524
+ style: {
13525
+ display: "flex",
13526
+ alignItems: "center",
13527
+ justifyContent: "space-between",
13528
+ padding: "12px 18px",
13529
+ borderTop: "1px solid #e2e8f0",
13530
+ background: "#f8fafc",
13531
+ gap: 12
13532
+ },
13533
+ children: [
13534
+ /* @__PURE__ */ jsxRuntime.jsx("div", { style: { fontSize: 12, color: "#475569", fontWeight: 500 }, children: multiple ? selectedFiles.length > 0 ? /* @__PURE__ */ jsxRuntime.jsxs("span", { style: { color: "#0f172a", fontWeight: 700 }, children: [
13535
+ selectedFiles.length,
13536
+ " ",
13537
+ t("selectedCountLabel", "selected")
13538
+ ] }) : /* @__PURE__ */ jsxRuntime.jsx("span", { children: t("multiSelectHint", "Click multiple images to select them in order") }) : /* @__PURE__ */ jsxRuntime.jsx("span", { children: tr ? "Seçmek için görsele tıklayın; kırpmak veya düzenlemek için sağ üstteki Kırp ikonunu kullanın." : "Click an image to select it, or click the Crop icon on any card to crop/edit." }) }),
13539
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", alignItems: "center", gap: 8 }, children: [
13540
+ /* @__PURE__ */ jsxRuntime.jsx(
13541
+ "button",
13542
+ {
13543
+ type: "button",
13544
+ onClick: () => {
13545
+ setSelectedFiles([]);
13546
+ setModalOpen(false);
13547
+ },
13548
+ style: {
13549
+ padding: "7px 14px",
13550
+ fontSize: 12,
13551
+ fontWeight: 600,
13552
+ border: "1px solid #cbd5e1",
13553
+ borderRadius: 5,
13554
+ background: "#ffffff",
13555
+ color: "#475569",
13556
+ cursor: "pointer"
13557
+ },
13558
+ children: t("cancel", "Cancel")
11926
13559
  }
11927
13560
  ),
11928
- /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { padding: "6px 8px" }, children: [
11929
- /* @__PURE__ */ jsxRuntime.jsx(
11930
- "div",
11931
- {
11932
- style: {
11933
- fontSize: 11,
11934
- fontWeight: 600,
11935
- color: "#1e293b",
11936
- overflow: "hidden",
11937
- textOverflow: "ellipsis",
11938
- whiteSpace: "nowrap"
11939
- },
11940
- title: file.name,
11941
- children: file.name
11942
- }
11943
- ),
11944
- (file.width || file.size) && /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { fontSize: 10, color: "#64748b", marginTop: 2 }, children: [
11945
- file.width && file.height ? `${file.width}×${file.height}` : "",
11946
- file.width && file.size ? " · " : "",
11947
- file.size ? `${Math.round(Number(file.size))} KB` : ""
11948
- ] })
11949
- ] })
11950
- ]
11951
- },
11952
- file.id || file.documentId || file.url
11953
- );
11954
- })
11955
- }
11956
- ) })
13561
+ multiple && /* @__PURE__ */ jsxRuntime.jsxs(
13562
+ "button",
13563
+ {
13564
+ type: "button",
13565
+ disabled: selectedFiles.length === 0,
13566
+ onClick: handleConfirmMultiple,
13567
+ style: {
13568
+ display: "inline-flex",
13569
+ alignItems: "center",
13570
+ gap: 6,
13571
+ padding: "7px 16px",
13572
+ fontSize: 12,
13573
+ fontWeight: 700,
13574
+ border: "none",
13575
+ borderRadius: 5,
13576
+ background: selectedFiles.length > 0 ? "#2669a0" : "#94a3b8",
13577
+ color: "#ffffff",
13578
+ cursor: selectedFiles.length > 0 ? "pointer" : "not-allowed"
13579
+ },
13580
+ children: [
13581
+ /* @__PURE__ */ jsxRuntime.jsx(index.MaterialIcon, { name: "check", size: 16, color: "#ffffff" }),
13582
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
13583
+ t("addSelectedMedia", "Add Selected"),
13584
+ " ",
13585
+ selectedFiles.length > 0 ? `(${selectedFiles.length})` : ""
13586
+ ] })
13587
+ ]
13588
+ }
13589
+ )
13590
+ ] })
13591
+ ]
13592
+ }
13593
+ )
13594
+ ] })
13595
+ )
11957
13596
  ]
11958
13597
  }
11959
13598
  )
@@ -13050,18 +14689,54 @@ const WidgetEditor = ({ widget, onChange }) => {
13050
14689
  {
13051
14690
  label: t("addGalleryImage"),
13052
14691
  value: null,
14692
+ multiple: true,
13053
14693
  onChange: (asset) => {
13054
14694
  if (asset) updateData([...images, asset]);
14695
+ },
14696
+ onSelectMultiple: (newAssets) => {
14697
+ if (newAssets && newAssets.length > 0) {
14698
+ updateData([...images, ...newAssets]);
14699
+ }
13055
14700
  }
13056
14701
  }
13057
14702
  ) }),
13058
14703
  /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
13059
- /* @__PURE__ */ jsxRuntime.jsxs("label", { style: labelStyle, children: [
13060
- t("galleryImages"),
13061
- " (",
13062
- images.length,
13063
- ")"
13064
- ] }),
14704
+ /* @__PURE__ */ jsxRuntime.jsxs(
14705
+ "div",
14706
+ {
14707
+ style: {
14708
+ display: "flex",
14709
+ alignItems: "center",
14710
+ justifyContent: "space-between",
14711
+ marginBottom: 4
14712
+ },
14713
+ children: [
14714
+ /* @__PURE__ */ jsxRuntime.jsxs("label", { style: { ...labelStyle, marginBottom: 0 }, children: [
14715
+ t("galleryImages"),
14716
+ " (",
14717
+ images.length,
14718
+ ")"
14719
+ ] }),
14720
+ images.length > 1 && /* @__PURE__ */ jsxRuntime.jsx(
14721
+ "button",
14722
+ {
14723
+ type: "button",
14724
+ onClick: () => updateData([]),
14725
+ style: {
14726
+ border: "none",
14727
+ background: "transparent",
14728
+ color: "#dc2626",
14729
+ fontSize: 11,
14730
+ fontWeight: 600,
14731
+ cursor: "pointer",
14732
+ padding: "2px 4px"
14733
+ },
14734
+ children: t("clearAllImages")
14735
+ }
14736
+ )
14737
+ ]
14738
+ }
14739
+ ),
13065
14740
  images.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx(
13066
14741
  "div",
13067
14742
  {
@@ -16026,6 +17701,9 @@ const VisualEditorModal = ({ open, onClose }) => {
16026
17701
  React.useEffect(() => {
16027
17702
  if (!open) return;
16028
17703
  const onKeyDown = (e) => {
17704
+ if (typeof document !== "undefined" && document.querySelector('[role="dialog"], [data-radix-popper-content-wrapper]')) {
17705
+ return;
17706
+ }
16029
17707
  const target = e.target;
16030
17708
  const isInput = target && (target.tagName === "INPUT" || target.tagName === "TEXTAREA" || target.tagName === "SELECT" || target.isContentEditable);
16031
17709
  if (e.key === "Escape") {
@@ -16184,7 +17862,7 @@ const VisualEditorModal = ({ open, onClose }) => {
16184
17862
  style: {
16185
17863
  position: "fixed",
16186
17864
  inset: 0,
16187
- zIndex: 9999,
17865
+ zIndex: 200,
16188
17866
  background: "#f8fafc",
16189
17867
  display: "flex",
16190
17868
  flexDirection: "column",
@@ -16438,7 +18116,7 @@ const CIContextMenu = () => {
16438
18116
  position: "fixed",
16439
18117
  left: pos.left,
16440
18118
  top: pos.top,
16441
- zIndex: 10500,
18119
+ zIndex: 250,
16442
18120
  minWidth: 235,
16443
18121
  background: "#ffffff",
16444
18122
  border: "1px solid #cbd5e1",
@@ -18005,7 +19683,7 @@ const InnerContentBuilder = ({
18005
19683
  position: "fixed",
18006
19684
  inset: 0,
18007
19685
  background: "rgba(15, 23, 42, 0.5)",
18008
- zIndex: 10200,
19686
+ zIndex: 230,
18009
19687
  display: "flex",
18010
19688
  alignItems: "center",
18011
19689
  justifyContent: "center",
@@ -18129,7 +19807,7 @@ const InnerContentBuilder = ({
18129
19807
  position: "fixed",
18130
19808
  inset: 0,
18131
19809
  background: "rgba(15, 23, 42, 0.5)",
18132
- zIndex: 10200,
19810
+ zIndex: 230,
18133
19811
  display: "flex",
18134
19812
  alignItems: "center",
18135
19813
  justifyContent: "center",