tokentracker-cli 0.42.1 → 0.43.0

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.
Files changed (42) hide show
  1. package/dashboard/dist/assets/{ActivityHeatmap-BmI8V0xx.js → ActivityHeatmap-0IDxIr7i.js} +1 -1
  2. package/dashboard/dist/assets/{Card-nuVuYcuu.js → Card-hVCKEGdC.js} +1 -1
  3. package/dashboard/dist/assets/{DashboardPage-Bh_iJ-xm.js → DashboardPage-C3QvJSI2.js} +2 -2
  4. package/dashboard/dist/assets/{DevicePage-9WJtHDTf.js → DevicePage-UVSutySl.js} +1 -1
  5. package/dashboard/dist/assets/{DialogTitle-rNImNh43.js → DialogTitle-D0S8c1BO.js} +1 -1
  6. package/dashboard/dist/assets/{FadeIn-SiqDw-Yh.js → FadeIn-anio8NgI.js} +1 -1
  7. package/dashboard/dist/assets/{HeaderGithubStar-8B6qistC.js → HeaderGithubStar-wRjA_Fvu.js} +1 -1
  8. package/dashboard/dist/assets/{IpCheckPage-BfLN01PA.js → IpCheckPage-vl0aIVv0.js} +1 -1
  9. package/dashboard/dist/assets/{LandingPage-DlihjDi3.js → LandingPage-CJO4q92s.js} +1 -1
  10. package/dashboard/dist/assets/{LeaderboardAvatar-PUmreq-E.js → LeaderboardAvatar-CjPVgiDo.js} +1 -1
  11. package/dashboard/dist/assets/{LeaderboardPage-D9Uv75pz.js → LeaderboardPage-DiQn0DqL.js} +3 -3
  12. package/dashboard/dist/assets/{LeaderboardProfileModal-Cvmto6VZ.js → LeaderboardProfileModal-yovVjgnB.js} +1 -1
  13. package/dashboard/dist/assets/{LeaderboardProfilePage-LCr8enw5.js → LeaderboardProfilePage-C0vqt4m5.js} +1 -1
  14. package/dashboard/dist/assets/{LimitsPage-D2lQnS6r.js → LimitsPage-8o294HKr.js} +1 -1
  15. package/dashboard/dist/assets/{LocalOnlyNotice-BFPVcZOL.js → LocalOnlyNotice-BQsPhRvE.js} +1 -1
  16. package/dashboard/dist/assets/{LoginPage-DRVDDFRN.js → LoginPage-D8hQf3xT.js} +1 -1
  17. package/dashboard/dist/assets/{PopoverPopup-5Ua0f-tT.js → PopoverPopup-rhSAh0x6.js} +1 -1
  18. package/dashboard/dist/assets/{Select-RhwT9_Zs.js → Select-ByLRQqzg.js} +1 -1
  19. package/dashboard/dist/assets/{SelectItemText-CCXz3qQg.js → SelectItemText-CHHy8UA1.js} +1 -1
  20. package/dashboard/dist/assets/{SettingsPage-Rkf_akM3.js → SettingsPage-DGyuX3ua.js} +1 -1
  21. package/dashboard/dist/assets/SkillsPage-CMsfSZar.js +1 -0
  22. package/dashboard/dist/assets/{WidgetsPage-MPCZCDLm.js → WidgetsPage-DavgYHA1.js} +1 -1
  23. package/dashboard/dist/assets/{WrappedPage-BkUgUFbt.js → WrappedPage-BARpWxxH.js} +1 -1
  24. package/dashboard/dist/assets/{agent-logos-3H0wwvp3.js → agent-logos-BsEMlmFc.js} +1 -1
  25. package/dashboard/dist/assets/{arrow-up-right-C8hVO4Rh.js → arrow-up-right-Nh5NXsRd.js} +1 -1
  26. package/dashboard/dist/assets/{download-Xu7TCfqI.js → download-Bz-ad2Zi.js} +1 -1
  27. package/dashboard/dist/assets/{info-BjGPzMRM.js → info-Edlzr0qR.js} +1 -1
  28. package/dashboard/dist/assets/main-BfK9LoKV.css +1 -0
  29. package/dashboard/dist/assets/{main-Cbe-Gxyo.js → main-CGYVeoRd.js} +2 -2
  30. package/dashboard/dist/assets/{use-limits-display-prefs-CpGpuPFi.js → use-limits-display-prefs-Cc82ZSkQ.js} +1 -1
  31. package/dashboard/dist/assets/{use-native-settings-D6-_mQ1G.js → use-native-settings-rTdpowec.js} +1 -1
  32. package/dashboard/dist/assets/{use-usage-limits-PLO1ai-F.js → use-usage-limits-DFjNciSe.js} +1 -1
  33. package/dashboard/dist/assets/{useCurrency-BcN5S6nj.js → useCurrency-BY5HnhWy.js} +1 -1
  34. package/dashboard/dist/assets/{useScrollLock-rh9yhh-j.js → useScrollLock-oNpe5Ufe.js} +1 -1
  35. package/dashboard/dist/index.html +2 -2
  36. package/dashboard/dist/share.html +2 -2
  37. package/package.json +1 -1
  38. package/src/lib/local-api.js +31 -10
  39. package/src/lib/pricing/seed-snapshot.json +1 -1
  40. package/src/lib/skills-manager.js +134 -41
  41. package/dashboard/dist/assets/SkillsPage-Di6zoCoj.js +0 -1
  42. package/dashboard/dist/assets/main-xEkHCXyP.css +0 -1
@@ -174,13 +174,22 @@ function sanitizePathSegment(value) {
174
174
  }
175
175
 
176
176
  function sanitizeRelativePath(value) {
177
- const raw = String(value || "").replace(/\\/g, "/").trim();
178
- if (!raw || raw.startsWith("/") || raw.includes("\0")) return null;
177
+ const input = String(value || "").trim();
178
+ const raw = input.replace(/\\/g, "/");
179
+ if (!raw || raw.includes("\0")) return null;
180
+ if (path.posix.isAbsolute(raw) || path.win32.isAbsolute(input) || path.win32.isAbsolute(raw)) return null;
179
181
  const parts = raw.split("/").filter(Boolean);
180
- if (!parts.length || parts.some((part) => part === "." || part === "..")) return null;
182
+ if (!parts.length || parts.some((part) => part === "." || part === ".." || part.includes(":"))) return null;
181
183
  return parts.join("/");
182
184
  }
183
185
 
186
+ function sanitizeLocalSkillPath(value) {
187
+ const safe = sanitizeRelativePath(value);
188
+ if (!safe) return null;
189
+ if (safe.split("/").some((part) => part.startsWith("."))) return null;
190
+ return safe;
191
+ }
192
+
184
193
  function installNameFromDirectory(directory) {
185
194
  const safe = sanitizeRelativePath(directory);
186
195
  if (!safe) return null;
@@ -256,6 +265,36 @@ function findSkillMarker(dir) {
256
265
  return null;
257
266
  }
258
267
 
268
+ const MAX_LOCAL_SKILL_SCAN_DEPTH = 3;
269
+
270
+ function scanSkillDirectories(rootDir) {
271
+ const found = [];
272
+ const walk = (dir, relDir = "", depth = 0) => {
273
+ let entries = [];
274
+ try {
275
+ entries = fs.readdirSync(dir, { withFileTypes: true });
276
+ } catch (_e) {
277
+ return;
278
+ }
279
+ entries.sort((a, b) => a.name.localeCompare(b.name));
280
+ for (const entry of entries) {
281
+ if (!entry.isDirectory() && !entry.isSymbolicLink()) continue;
282
+ if (!entry.name || entry.name.startsWith(".")) continue;
283
+ const rel = relDir ? `${relDir}/${entry.name}` : entry.name;
284
+ const full = path.join(dir, entry.name);
285
+ if (findSkillMarker(full)) {
286
+ found.push(rel);
287
+ continue;
288
+ }
289
+ // Direct symlinked skills are accepted above, but symlinked group folders
290
+ // are not traversed so the scan stays within the target skills tree.
291
+ if (entry.isDirectory() && depth + 1 < MAX_LOCAL_SKILL_SCAN_DEPTH) walk(full, rel, depth + 1);
292
+ }
293
+ };
294
+ walk(rootDir);
295
+ return found;
296
+ }
297
+
259
298
  const HASH_IGNORE = new Set([".git", ".DS_Store", "Thumbs.db", ".gitignore"]);
260
299
 
261
300
  // Stable content fingerprint of a skill directory: walk files in sorted order,
@@ -531,19 +570,67 @@ function isSymlink(targetPath) {
531
570
  }
532
571
  }
533
572
 
573
+ function targetSkillPath(baseDir, directory) {
574
+ const safe = sanitizeRelativePath(directory);
575
+ if (!safe) return null;
576
+ const root = path.resolve(baseDir);
577
+ const targetPath = path.resolve(root, safe);
578
+ if (!pathStrictlyWithin(root, targetPath)) return null;
579
+ try {
580
+ const rootStat = fs.lstatSync(root);
581
+ if (rootStat.isSymbolicLink() || !rootStat.isDirectory()) return null;
582
+ } catch (e) {
583
+ if (e?.code !== "ENOENT") return null;
584
+ }
585
+ const parts = safe.split("/");
586
+ let current = root;
587
+ for (let i = 0; i < parts.length - 1; i += 1) {
588
+ current = path.join(current, parts[i]);
589
+ let stat;
590
+ try {
591
+ stat = fs.lstatSync(current);
592
+ } catch (e) {
593
+ if (e?.code === "ENOENT") continue;
594
+ return null;
595
+ }
596
+ if (stat.isSymbolicLink() || !stat.isDirectory()) return null;
597
+ }
598
+ return targetPath;
599
+ }
600
+
601
+ function managedSkillPath(directory) {
602
+ const skillPath = targetSkillPath(ssotDir(), directory);
603
+ if (!skillPath) throw new Error(`Invalid skill directory: ${directory}`);
604
+ return skillPath;
605
+ }
606
+
534
607
  function copyDir(source, dest) {
535
608
  assertNotNested(source, dest);
536
609
  removePath(dest);
537
610
  fs.cpSync(source, dest, { recursive: true, force: true });
538
611
  }
539
612
 
613
+ function removeEmptyAncestors(startDir, stopDir) {
614
+ let current = path.resolve(startDir);
615
+ const stop = path.resolve(stopDir);
616
+ while (pathStrictlyWithin(stop, current)) {
617
+ try {
618
+ fs.rmdirSync(current);
619
+ } catch (_e) {
620
+ return;
621
+ }
622
+ current = path.dirname(current);
623
+ }
624
+ }
625
+
540
626
  function syncSkillToTarget(directory, targetId) {
541
627
  const target = TARGETS[targetId];
542
628
  if (!target) throw new Error(`Unsupported target: ${targetId}`);
543
- const source = path.join(ssotDir(), directory);
629
+ const source = managedSkillPath(directory);
544
630
  if (!fs.existsSync(source)) throw new Error(`Managed skill not found: ${directory}`);
545
631
  for (const baseDir of targetDirs(target)) {
546
- const dest = path.join(baseDir, directory);
632
+ const dest = targetSkillPath(baseDir, directory);
633
+ if (!dest) throw new Error(`Invalid skill directory: ${directory}`);
547
634
  assertNotNested(source, dest);
548
635
  ensureDir(path.dirname(dest));
549
636
  removePath(dest);
@@ -559,7 +646,10 @@ function removeSkillFromTarget(directory, targetId) {
559
646
  const target = TARGETS[targetId];
560
647
  if (!target) return;
561
648
  for (const baseDir of targetDirs(target)) {
562
- removePath(path.join(baseDir, directory));
649
+ const targetPath = targetSkillPath(baseDir, directory);
650
+ if (!targetPath) continue;
651
+ removePath(targetPath);
652
+ removeEmptyAncestors(path.dirname(targetPath), baseDir);
563
653
  }
564
654
  }
565
655
 
@@ -567,7 +657,8 @@ function scanTargetSkill(directory, targetId) {
567
657
  const target = TARGETS[targetId];
568
658
  if (!target) return false;
569
659
  for (const baseDir of targetDirs(target)) {
570
- const candidate = path.join(baseDir, directory);
660
+ const candidate = targetSkillPath(baseDir, directory);
661
+ if (!candidate) continue;
571
662
  if (fs.existsSync(candidate) || isSymlink(candidate)) return true;
572
663
  }
573
664
  return false;
@@ -582,7 +673,8 @@ function classifyTargetSkill(directory, targetId) {
582
673
  if (!target) return "off";
583
674
  let state = "off";
584
675
  for (const baseDir of targetDirs(target)) {
585
- const candidate = path.join(baseDir, directory);
676
+ const candidate = targetSkillPath(baseDir, directory);
677
+ if (!candidate) continue;
586
678
  if (fs.existsSync(candidate)) return "synced";
587
679
  if (isSymlink(candidate)) state = "orphan";
588
680
  }
@@ -612,19 +704,11 @@ function listInstalledSkills() {
612
704
  const unmanaged = new Map();
613
705
  for (const target of Object.values(TARGETS)) {
614
706
  for (const dir of targetDirs(target)) {
615
- let entries = [];
616
- try {
617
- entries = fs.readdirSync(dir, { withFileTypes: true });
618
- } catch (_e) {
619
- continue;
620
- }
621
- for (const entry of entries) {
622
- if (!entry.isDirectory() && !entry.isSymbolicLink()) continue;
623
- const directory = entry.name;
624
- if (!directory || directory.startsWith(".") || managedDirs.has(directory.toLowerCase())) continue;
707
+ for (const directory of scanSkillDirectories(dir)) {
708
+ if (!directory || managedDirs.has(directory.toLowerCase())) continue;
625
709
  const skillPath = findSkillMarker(path.join(dir, directory));
626
710
  if (!skillPath) continue;
627
- const metadata = readSkillMetadata(fs.readFileSync(skillPath, "utf8"), directory);
711
+ const metadata = readSkillMetadata(fs.readFileSync(skillPath, "utf8"), installNameFromDirectory(directory) || directory);
628
712
  const key = directory.toLowerCase();
629
713
  if (!unmanaged.has(key)) {
630
714
  unmanaged.set(key, {
@@ -670,6 +754,8 @@ async function installSkill(skillInput, targetIds = ["claude", "codex"]) {
670
754
  };
671
755
  if (!skill.repoOwner || !skill.repoName) throw new Error("Missing GitHub repository information");
672
756
  const sourceDir = sanitizeRelativePath(skill.directory);
757
+ // GitHub-sourced skills keep the historical flat install name even when
758
+ // sourceDirectory is nested; local nested-skill support uses importLocalSkill().
673
759
  const installName = installNameFromDirectory(sourceDir);
674
760
  if (!sourceDir || !installName) throw new Error("Invalid skill directory");
675
761
 
@@ -695,7 +781,7 @@ async function installSkill(skillInput, targetIds = ["claude", "codex"]) {
695
781
  );
696
782
  if (!files.some((entry) => /(^|\/)SKILL\.md$/i.test(entry.path))) throw new Error("SKILL.md not found in selected directory");
697
783
 
698
- const dest = path.join(ssotDir(), installName);
784
+ const dest = managedSkillPath(installName);
699
785
  const temp = path.join(dataDir(), "tmp", `${installName}-${Date.now()}`);
700
786
  removePath(temp);
701
787
  ensureDir(temp);
@@ -751,16 +837,18 @@ function uninstallSkill(id) {
751
837
  const registry = readRegistry();
752
838
  const skill = registry.skills.find((entry) => entry.id === id || entry.key === id);
753
839
  if (!skill) throw new Error("Managed skill not found");
840
+ const ssotPath = managedSkillPath(skill.directory);
754
841
  for (const targetId of Object.keys(TARGETS)) removeSkillFromTarget(skill.directory, targetId);
755
842
  // Move SSOT copy into a trash bucket so it can be restored briefly. The
756
843
  // registry entry is retained but flagged so restoreSkill can re-link it.
757
- const ssotPath = path.join(ssotDir(), skill.directory);
758
844
  if (fs.existsSync(ssotPath)) {
759
845
  ensureDir(trashDir());
760
846
  const stamp = Date.now();
761
- const trashPath = path.join(trashDir(), `${skill.directory}-${stamp}`);
847
+ const trashName = `${Buffer.from(String(skill.directory || ""), "utf8").toString("base64url")}-${stamp}`;
848
+ const trashPath = path.join(trashDir(), trashName);
762
849
  try {
763
850
  fs.renameSync(ssotPath, trashPath);
851
+ removeEmptyAncestors(path.dirname(ssotPath), ssotDir());
764
852
  skill.trashedAt = stamp;
765
853
  skill.trashedDirectory = path.basename(trashPath);
766
854
  skill.previousTargets = skill.targets || [];
@@ -773,6 +861,7 @@ function uninstallSkill(id) {
773
861
  return { ok: true, trashed: true, restoreId: skill.id, ttlMs: TRASH_TTL_MS };
774
862
  } catch (_e) {
775
863
  removePath(ssotPath);
864
+ removeEmptyAncestors(path.dirname(ssotPath), ssotDir());
776
865
  }
777
866
  }
778
867
  registry.skills = registry.skills.filter((entry) => entry.id !== skill.id);
@@ -808,7 +897,7 @@ function restoreSkill(id) {
808
897
  throw new Error("Restore window expired");
809
898
  }
810
899
  const trashPath = path.join(trashDir(), skill.trashedDirectory || "");
811
- const ssotPath = path.join(ssotDir(), skill.directory);
900
+ const ssotPath = managedSkillPath(skill.directory);
812
901
  if (!fs.existsSync(trashPath)) throw new Error("Trashed copy is missing");
813
902
  ensureDir(path.dirname(ssotPath));
814
903
  removePath(ssotPath);
@@ -840,11 +929,12 @@ function setSkillTargets(id, targetIds) {
840
929
  }
841
930
 
842
931
  function findLocalSkillSource(directory) {
843
- const installName = sanitizePathSegment(directory);
844
- if (!installName) return null;
932
+ const sourceDir = sanitizeLocalSkillPath(directory);
933
+ if (!sourceDir) return null;
845
934
  for (const target of Object.values(TARGETS)) {
846
935
  for (const baseDir of targetDirs(target)) {
847
- const skillPath = path.join(baseDir, installName);
936
+ const skillPath = targetSkillPath(baseDir, sourceDir);
937
+ if (!skillPath) continue;
848
938
  if (findSkillMarker(skillPath)) {
849
939
  return { path: skillPath, targetId: target.id };
850
940
  }
@@ -854,33 +944,36 @@ function findLocalSkillSource(directory) {
854
944
  }
855
945
 
856
946
  function importLocalSkill(directory, targetIds = []) {
857
- const installName = sanitizePathSegment(directory);
858
- if (!installName) throw new Error("Invalid skill directory");
947
+ const sourceDir = sanitizeLocalSkillPath(directory);
948
+ if (!sourceDir) throw new Error("Invalid skill directory");
859
949
  const registry = readRegistry();
860
- const existing = registry.skills.find((entry) => entry.directory.toLowerCase() === installName.toLowerCase());
950
+ const existing = registry.skills.find((entry) => String(entry.directory || "").toLowerCase() === sourceDir.toLowerCase());
861
951
  if (existing) {
952
+ if (!String(existing.id || existing.key || "").startsWith("local:")) {
953
+ throw new Error(`Skill directory "${sourceDir}" is already managed by another installed skill`);
954
+ }
862
955
  if (!targetIds || !targetIds.length) {
863
956
  return { ...existing, managed: true, targets: existing.targets || [] };
864
957
  }
865
958
  return setSkillTargets(existing.id, targetIds);
866
959
  }
867
960
 
868
- const source = findLocalSkillSource(installName);
961
+ const source = findLocalSkillSource(sourceDir);
869
962
  if (!source) throw new Error("Local skill not found");
870
963
 
871
- const dest = path.join(ssotDir(), installName);
964
+ const dest = managedSkillPath(sourceDir);
872
965
  copyDir(source.path, dest);
873
966
  const skillMarker = findSkillMarker(dest);
874
- const metadata = readSkillMetadata(skillMarker ? fs.readFileSync(skillMarker, "utf8") : "", installName);
875
- const discoveredTargets = Object.keys(TARGETS).filter((targetId) => scanTargetSkill(installName, targetId));
967
+ const metadata = readSkillMetadata(skillMarker ? fs.readFileSync(skillMarker, "utf8") : "", installNameFromDirectory(sourceDir));
968
+ const discoveredTargets = Object.keys(TARGETS).filter((targetId) => scanTargetSkill(sourceDir, targetId));
876
969
  const selectedTargets = (targetIds.length ? targetIds : discoveredTargets).filter((targetId) => TARGETS[targetId]);
877
970
  const skill = {
878
- id: `local:${installName}`,
879
- key: `local:${installName}`,
971
+ id: `local:${sourceDir}`,
972
+ key: `local:${sourceDir}`,
880
973
  name: metadata.name,
881
974
  description: metadata.description,
882
- directory: installName,
883
- sourceDirectory: installName,
975
+ directory: sourceDir,
976
+ sourceDirectory: sourceDir,
884
977
  readmeUrl: null,
885
978
  repoOwner: null,
886
979
  repoName: null,
@@ -893,15 +986,15 @@ function importLocalSkill(directory, targetIds = []) {
893
986
  registry.skills.push(skill);
894
987
  saveRegistry(registry);
895
988
  for (const targetId of Object.keys(TARGETS)) {
896
- if (selectedTargets.includes(targetId)) syncSkillToTarget(installName, targetId);
897
- else removeSkillFromTarget(installName, targetId);
989
+ if (selectedTargets.includes(targetId)) syncSkillToTarget(sourceDir, targetId);
990
+ else removeSkillFromTarget(sourceDir, targetId);
898
991
  }
899
- appendActivity({ action: "import", name: skill.name, directory: installName, targets: selectedTargets });
992
+ appendActivity({ action: "import", name: skill.name, directory: sourceDir, targets: selectedTargets });
900
993
  return { ...skill, managed: true, targets: selectedTargets };
901
994
  }
902
995
 
903
996
  function deleteLocalSkill(directory, targetIds = []) {
904
- const installName = sanitizePathSegment(directory);
997
+ const installName = sanitizeLocalSkillPath(directory);
905
998
  if (!installName) throw new Error("Invalid skill directory");
906
999
  const selectedTargets = targetIds.length ? targetIds : Object.keys(TARGETS);
907
1000
  for (const targetId of selectedTargets) removeSkillFromTarget(installName, targetId);
@@ -1 +0,0 @@
1
- import{c as Oe,r as n,a as ea,j as e,M as U,V as W,b2 as rt,X as Se,G as r,b3 as da,b4 as _a,b5 as st,u as it,b6 as pa,b7 as nt,b8 as ot,b9 as lt,ba as ya,bb as dt,bc as ct,b as ut,bd as gt,be as mt,bf as xt,S as ht,e as pt,m as fa,ad as yt,I as ft,U as ye,bg as bt,bh as kt,bi as wt,bj as vt,bk as jt,bl as Nt,i as Ct,aZ as St,bm as ca,R as _t,bn as Pt,bo as ba,bp as Ce,bq as ka,br as wa,bs as Rt,bt as va,bu as ja,bv as Lt,bw as It}from"./main-Cbe-Gxyo.js";import{L as $t}from"./LocalOnlyNotice-BFPVcZOL.js";import{C as Dt}from"./Card-nuVuYcuu.js";import{u as Et,D as Mt,a as Bt,b as Tt,c as Ot,d as Ut,e as zt}from"./DialogTitle-rNImNh43.js";import{u as Xe,t as Ft,a as At,C as _e}from"./useScrollLock-rh9yhh-j.js";import{I as Pa}from"./info-BjGPzMRM.js";import{u as Vt}from"./useCurrency-BcN5S6nj.js";import{L as ae,P as Ra,a as La,b as Ia,c as $a,d as Da,C as Kt}from"./PopoverPopup-5Ua0f-tT.js";import{u as qt,s as Ht,f as Ea,a as Gt,b as Wt,c as Qt,d as Xt,e as Yt,g as Jt,S as Ma,h as Ba,i as Ta,C as ma,j as Oa,k as Ua,l as za,m as Ye,n as Je,o as Ze}from"./SelectItemText-CCXz3qQg.js";import{D as Fa}from"./download-Xu7TCfqI.js";import"./arrow-up-right-C8hVO4Rh.js";const Zt=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m16 12-4-4-4 4",key:"177agl"}],["path",{d:"M12 16V8",key:"1sbj14"}]],Aa=Oe("circle-arrow-up",Zt);const er=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]],ua=Oe("external-link",er);const ar=[["path",{d:"M12 3q1 4 4 6.5t3 5.5a1 1 0 0 1-14 0 5 5 0 0 1 1-3 1 1 0 0 0 5 0c0-2-1.5-3-1.5-5q0-2 2.5-4",key:"1slcih"}]],tr=Oe("flame",ar);const rr=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],Va=Oe("plus",rr);const sr=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],xa=Oe("trash-2",sr),ir=n.forwardRef(function(s,l){const{render:g,className:c,style:h,id:u,...m}=s,{store:x}=Et(),y=Xe(u);return x.useSyncedValueWithCleanup("descriptionElementId",y),ea("p",s,{ref:l,props:[{id:y},m]})});function Na({open:a,title:s,description:l,confirmLabel:g,cancelLabel:c,destructive:h=!1,busy:u=!1,onConfirm:m,onCancel:x}){return e.jsx(Mt,{open:a,onOpenChange:y=>{!y&&!u&&x?.()},children:e.jsxs(Bt,{children:[e.jsx(Tt,{className:"fixed inset-0 z-[100] bg-black/40 backdrop-blur-[2px] transition-opacity duration-200 ease-out data-[ending-style]:opacity-0 data-[starting-style]:opacity-0"}),e.jsx(Ot,{className:"fixed inset-0 z-[101] flex items-center justify-center p-4",children:e.jsxs(Ut,{className:"relative w-full max-w-md rounded-2xl bg-white p-6 shadow-[0_20px_60px_-20px_rgba(0,0,0,0.25)] ring-1 ring-oai-gray-200 transition-[opacity,transform] duration-[220ms] ease-[cubic-bezier(0.16,1,0.3,1)] data-[ending-style]:translate-y-2 data-[ending-style]:scale-[0.96] data-[ending-style]:opacity-0 data-[starting-style]:translate-y-2 data-[starting-style]:scale-[0.96] data-[starting-style]:opacity-0 dark:bg-oai-gray-950 dark:shadow-[0_20px_60px_-10px_rgba(0,0,0,0.65)] dark:ring-oai-gray-800",children:[e.jsx(zt,{className:"text-base font-semibold text-oai-black dark:text-white",children:s}),l?e.jsx(ir,{className:"mt-2 text-sm leading-6 text-oai-gray-600 dark:text-oai-gray-300",children:l}):null,e.jsxs("div",{className:"mt-5 flex justify-end gap-2",children:[e.jsx(U,{type:"button",variant:"secondary",size:"sm",disabled:u,onClick:()=>x?.(),children:c}),e.jsx(U,{type:"button",size:"sm",disabled:u,onClick:()=>m?.(),className:W(h&&"!bg-red-600 hover:!bg-red-700 focus-visible:!outline-red-600 dark:!bg-red-600 dark:hover:!bg-red-500"),children:g})]})]})})]})})}function ha({id:a,value:s,onChange:l,placeholder:g,disabled:c=!1,type:h="text",label:u,error:m,className:x="",...y}){const o=n.useId(),k=a||o,C=m?`${k}-error`:void 0,N=`w-full bg-oai-white dark:bg-oai-gray-900 border border-oai-gray-300 dark:border-oai-gray-700 rounded-md text-oai-black dark:text-oai-white placeholder-oai-gray-400 dark:placeholder-oai-gray-500 transition-all duration-200 focus:outline-none focus:border-oai-brand dark:focus:border-oai-brand focus:ring-1 focus:ring-oai-brand/30 ${c?"bg-oai-gray-50 dark:bg-oai-gray-800 text-oai-gray-400 dark:text-oai-gray-400 cursor-not-allowed":""} ${m?"border-oai-error focus:border-oai-error focus:ring-oai-error/30":""} h-10 px-3 text-sm ${x}`;return e.jsxs("div",{className:"w-full",children:[u&&e.jsx("label",{htmlFor:k,className:"block text-sm font-medium text-oai-gray-700 dark:text-oai-gray-300 mb-1.5 transition-colors duration-200",children:u}),e.jsx("input",{id:k,type:h,value:s,onChange:l,placeholder:g,disabled:c,"aria-invalid":m?!0:void 0,"aria-describedby":C,className:N,...y}),m&&e.jsx("p",{id:C,className:"mt-1.5 text-sm text-oai-error",children:m})]})}const Ka=n.forwardRef(function(s,l){const{render:g,className:c,style:h,...u}=s,{store:m}=qt(),y={open:rt(m,Ht.open)};return ea("span",s,{state:y,ref:l,props:[{"aria-hidden":!0,children:"▼"},u],stateAttributesMapping:Ft})}),nr="tt:hint:dismissed:";function qa(a){return nr+a}function or(a){if(typeof window>"u")return!1;try{return window.localStorage.getItem(qa(a))==="1"}catch{return!1}}function lr({id:a,children:s,className:l,ariaLabel:g}){const[c,h]=n.useState(()=>or(a)),u=n.useCallback(()=>{if(typeof window<"u")try{window.localStorage.setItem(qa(a),"1")}catch{}h(!0)},[a]);return c?null:e.jsxs("div",{role:"note","aria-label":g||r("hint.dismissible_aria"),className:W("relative rounded-lg border border-oai-gray-200 bg-oai-gray-50 px-4 py-3 text-sm text-oai-gray-700","dark:border-oai-gray-800 dark:bg-oai-gray-900/40 dark:text-oai-gray-300",l),children:[e.jsx("button",{type:"button",onClick:u,"aria-label":r("hint.dismiss"),className:"absolute top-2 right-2 inline-flex h-7 w-7 items-center justify-center rounded-md text-oai-gray-500 transition-colors hover:bg-oai-gray-200/70 hover:text-oai-gray-700 focus:outline-none focus:ring-2 focus:ring-oai-blue/30 dark:text-oai-gray-400 dark:hover:bg-oai-gray-800/70 dark:hover:text-oai-gray-200",children:e.jsx(Se,{className:"h-4 w-4","aria-hidden":"true"})}),e.jsxs("div",{className:"flex items-start gap-2 pr-8",children:[e.jsx(Pa,{className:"mt-0.5 h-4 w-4 shrink-0 text-oai-gray-500 dark:text-oai-gray-400","aria-hidden":"true"}),e.jsx("div",{className:"min-w-0 flex-1",children:s})]})]})}function dr(a){if(!a)return null;for(const s of a.elements){const l=s.tagName;if(l==="BUTTON"||l==="INPUT"){const g=s;if(g.type==="submit")return g}}return null}let Ca=(function(a){return a.checked="data-checked",a.unchecked="data-unchecked",a.indeterminate="data-indeterminate",a.disabled="data-disabled",a.readonly="data-readonly",a.required="data-required",a.valid="data-valid",a.invalid="data-invalid",a.touched="data-touched",a.dirty="data-dirty",a.filled="data-filled",a.focused="data-focused",a})({});function Ha(a){return n.useMemo(()=>({checked(s){return a.indeterminate?{}:s?{[Ca.checked]:""}:{[Ca.unchecked]:""}},...Ea}),[a.indeterminate])}const cr=n.createContext({disabled:!1});function ur(){return n.useContext(cr)}function gr(a,s,l,g=!0,c){const[h,u]=n.useState(),m=Xe(c?`${c}-label`:void 0),x=a??s??h;return da(()=>{const y=a||s||!g?void 0:mr(l.current,m);h!==y&&u(y)}),x}function mr(a,s){const l=xr(a);if(l)return!l.id&&s&&(l.id=s),l.id||void 0}function xr(a){if(!a)return;const s=a.parentElement;if(s&&s.tagName==="LABEL")return s;const l=a.id;if(l){const c=a.nextElementSibling;if(c&&c.htmlFor===l)return c}const g=a.labels;return g&&g[0]}const hr=n.createContext(void 0);function pr(a=!0){const s=n.useContext(hr);if(s===void 0&&!a)throw new Error(_a(3));return s}const Ga=n.createContext(void 0);function yr(){const a=n.useContext(Ga);if(a===void 0)throw new Error(_a(14));return a}const fr="data-parent",br=n.forwardRef(function(s,l){const{checked:g,className:c,defaultChecked:h=!1,"aria-labelledby":u,disabled:m=!1,form:x,id:y,indeterminate:o=!1,inputRef:k,name:C,onCheckedChange:w,parent:v=!1,readOnly:f=!1,render:N,required:I=!1,uncheckedValue:z,value:Q,nativeButton:F=!1,style:de,...j}=s,{clearErrors:te}=Gt(),{disabled:$,name:H,setDirty:X,setFilled:re,setFocused:A,setTouched:fe,state:be,validationMode:Ue,validityData:Pe,shouldValidateOnChange:ze,validation:Fe}=Wt(),B=ur(),{labelId:se,controlId:Re,registerControlId:Y,getDescriptionProps:ke}=Qt(),S=pr(),ie=S?.parent,ne=ie&&S.allValues,J=$||B.disabled||S?.disabled||m,Z=H??C,P=Q??Z,he=Xe(),aa=Xe();let G=Re;ne?G=v?aa:`${ie.id}-${P}`:y&&(G=y);let we={};ne&&(v?we=S.parent.getParentProps():P&&(we=S.parent.getChildProps(P)));const{checked:ve=g,indeterminate:ce=o,onCheckedChange:je,...Ne}=we,T=S?.value,pe=S?.setValue,ue=S?.defaultValue,ge=n.useRef(null),oe=st(()=>Symbol("checkbox-control")),Le=n.useRef(!1),{getButtonProps:Ae,buttonRef:Ve}=it({disabled:J,native:F}),L=S?.validation??Fe,[D,ta]=Xt({controlled:P&&T&&!v?T.includes(P):ve,default:P&&ue&&!v?ue.includes(P):h,name:"Checkbox",state:"checked"});da(()=>{Y!==pa&&(Le.current=!0,Y(oe.current,G))},[G,Y,oe]),n.useEffect(()=>{const b=oe.current;return()=>{!Le.current||Y===pa||(Le.current=!1,Y(b,void 0))}},[Y,oe]),Yt(ge,he,D,void 0,!S);const le=n.useRef(null),Ke=nt(k,le,L.inputRef),Ie=gr(u,se,le,!F,G??void 0);da(()=>{le.current&&(le.current.indeterminate=ce,D&&re(!0))},[D,ce,re]),Jt(D,()=>{S&&!v||(te(Z),re(D),X(D!==Pe.initialValue),ze()?L.commit(D):L.commit(D,!0))});const ra=ot({checked:D,disabled:J,form:x,name:v?void 0:Z,id:F?void 0:G??void 0,required:I,ref:Ke,style:Z?dt:ct,tabIndex:-1,type:"checkbox","aria-hidden":!0,onChange(b){if(b.nativeEvent.defaultPrevented)return;if(f){b.preventDefault();return}const V=b.currentTarget.checked,me=ut(gt,b.nativeEvent);if(je?.(V,me),w?.(V,me),!me.isCanceled&&(ta(V),P&&T&&pe&&!v&&!ne)){const R=V?[...T,P]:T.filter(K=>K!==P);pe(R,me)}},onFocus(){ge.current?.focus()}},Q!==void 0?{value:(S?D&&Q:Q)||""}:lt,ke,S?L.getValidationProps:L.getInputValidationProps),$e=ne?!!ve:D,qe=ne&&ce||o;n.useEffect(()=>{if(!ie||!P)return;const b=ie.disabledStatesRef.current;return b.set(P,J),()=>{b.delete(P)}},[ie,J,P]);const De=n.useMemo(()=>({...be,checked:$e,disabled:J,readOnly:f,required:I,indeterminate:qe}),[be,$e,J,f,I,qe]),sa=Ha(De),ia=ea("span",s,{state:De,ref:[Ve,ge,l,S?.registerControlRef],props:[{id:F?G??void 0:he,role:"checkbox","aria-checked":ce?"mixed":D,"aria-readonly":f||void 0,"aria-required":I||void 0,"aria-labelledby":Ie,[fr]:v?"":void 0,onFocus(){A(!0)},onBlur(){const b=le.current;b&&(fe(!0),A(!1),Ue==="onBlur"&&L.commit(S?T:b.checked))},onKeyDown(b){if(b.key!=="Enter"||(b.preventBaseUIHandler(),b.defaultPrevented))return;const V=le.current?.form??null,me=b.currentTarget,R=b.nativeEvent,K=b.preventDefault,Ee=R.preventDefault;let Me=!1;b.preventDefault=()=>{Me=!0,K.call(b)},R.preventDefault=()=>{Me=!0,Ee.call(R)},Ee.call(R),ya(me).queueMicrotask(()=>{b.preventDefault=K,R.preventDefault=Ee,Me||dr(V)?.click()})},onClick(b){if(f||J)return;b.preventDefault();const V=le.current;V&&V.dispatchEvent(new(ya(V)).PointerEvent("click",{bubbles:!0,shiftKey:b.shiftKey,ctrlKey:b.ctrlKey,altKey:b.altKey,metaKey:b.metaKey}))}},ke,L.getValidationProps,j,Ne,Ae],stateAttributesMapping:sa});return e.jsxs(Ga.Provider,{value:De,children:[ia,!D&&!S&&Z&&!v&&z!==void 0&&e.jsx("input",{type:"hidden",form:x,name:Z,value:z}),e.jsx("input",{...ra,suppressHydrationWarning:!0})]})}),kr=n.forwardRef(function(s,l){const{render:g,className:c,style:h,keepMounted:u=!1,...m}=s,x=yr(),y=x.checked||x.indeterminate,{mounted:o,transitionStatus:k,setMounted:C}=At(y),w=n.useRef(null),v={...x,transitionStatus:k};mt({open:y,ref:w,onComplete(){y||C(!1)}});const N={...Ha(x),...xt,...Ea},I=u||o,z=ea("span",s,{ref:[l,w],state:v,stateAttributesMapping:N,props:m});return I?z:null});function wr(a,s){return`target:${a}:${s}`}function vr(a){return`remove:${a.id||a.directory}`}function Wa(a){if(!a)return null;const s=new Date(a).getTime();return Number.isFinite(s)?Math.floor((Date.now()-s)/864e5):null}function jr(a){const s=Wa(a);if(s==null)return null;if(s<=0)return r("skills.usage.today");if(s<30)return r("skills.usage.days_ago",{days:s});const l=Math.max(1,Math.floor(s/30));return r("skills.usage.months_ago",{months:l})}function Nr(a){const s=Wa(a);return s==null?"bg-oai-gray-300 dark:bg-oai-gray-600":s<=7?"bg-emerald-500":s<=30?"bg-amber-500":"bg-oai-gray-300 dark:bg-oai-gray-600"}function oa({label:a,children:s}){return e.jsxs("div",{className:"flex items-center justify-between gap-3 py-2 text-sm",children:[e.jsx("dt",{className:"flex items-center gap-1 text-oai-gray-500 dark:text-oai-gray-400",children:a}),e.jsx("dd",{className:"text-right font-medium tabular-nums text-oai-black dark:text-white",children:s})]})}function Cr({skill:a,targets:s,busyKey:l,usage:g,hasUpdate:c,updating:h,onUpdate:u,onClose:m,onToggleTarget:x,onRemove:y}){return e.jsx(ht,{children:a?e.jsx(Sr,{skill:a,targets:s,busyKey:l,usage:g,hasUpdate:c,updating:h,onUpdate:u,onClose:m,onToggleTarget:x,onRemove:y},a.id||a.directory):null})}function Sr({skill:a,targets:s,busyKey:l,usage:g,hasUpdate:c,updating:h,onUpdate:u,onClose:m,onToggleTarget:x,onRemove:y}){const o=pt(),{currency:k,rate:C}=Vt(),w=n.useRef(null);n.useEffect(()=>{const j=$=>{$.key==="Escape"&&($.stopPropagation(),m?.())},te=$=>{const H=$.target;H instanceof Element&&(w.current?.contains(H)||H.closest('[data-skill-row="1"]')||m?.())};return document.addEventListener("keydown",j),document.addEventListener("mousedown",te),()=>{document.removeEventListener("keydown",j),document.removeEventListener("mousedown",te)}},[m]);const v=a.name||a.directory,f=!!(a.repoOwner&&a.repoName),N=f?`https://github.com/${a.repoOwner}/${a.repoName}`:null,I=new Set(a.targets||[]),z=l===vr(a),Q=jr(g?.lastUsedAt),F=!!(g&&g.invocations>0),de=o?{duration:0}:{type:"spring",stiffness:320,damping:30,mass:.7};return e.jsxs(e.Fragment,{children:[e.jsx(fa.div,{className:"fixed inset-0 z-20 bg-oai-black/30 backdrop-blur-[2px] lg:hidden",initial:o?!1:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:o?0:.15},onClick:m,"aria-hidden":!0}),e.jsxs(fa.aside,{ref:w,role:"complementary","aria-label":v,initial:o?!1:{opacity:0,x:24,scale:.98},animate:{opacity:1,x:0,scale:1},exit:o?{opacity:0}:{opacity:0,x:24,scale:.98},transition:de,className:"fixed inset-x-3 bottom-3 top-20 z-30 flex flex-col overflow-hidden rounded-2xl border border-white/40 bg-white/75 shadow-[0_24px_60px_-20px_rgba(15,23,42,0.25)] backdrop-blur-xl backdrop-saturate-150 supports-[backdrop-filter]:bg-white/65 dark:border-white/10 dark:bg-oai-gray-950/70 dark:shadow-[0_24px_60px_-20px_rgba(0,0,0,0.7)] dark:supports-[backdrop-filter]:bg-oai-gray-950/55 lg:inset-auto lg:right-6 lg:top-24 lg:bottom-6 lg:w-[22rem] lg:max-h-[calc(100vh-7.5rem)]",children:[e.jsxs("header",{className:"flex items-center gap-3 border-b border-white/40 bg-gradient-to-b from-white/30 to-transparent px-5 pb-4 pt-5 dark:border-white/10 dark:from-white/[0.04]",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("h2",{className:"truncate text-base font-semibold text-oai-black dark:text-white",title:v,children:v}),f?e.jsxs("a",{href:N,target:"_blank",rel:"noreferrer noopener",className:"mt-1 inline-flex max-w-full items-center gap-1 truncate text-xs text-oai-gray-500 transition-colors hover:text-oai-black hover:underline dark:text-oai-gray-400 dark:hover:text-white",title:N,children:[e.jsxs("span",{className:"truncate",children:[a.repoOwner,"/",a.repoName]}),e.jsx(ua,{className:"h-3 w-3 shrink-0","aria-hidden":!0})]}):a.directory&&a.directory!==v?e.jsx("div",{className:"mt-1 truncate text-xs text-oai-gray-500 dark:text-oai-gray-400",title:a.directory,children:a.directory}):null]}),e.jsx("button",{type:"button",onClick:m,"aria-label":r("skills.detail.close"),className:"-mr-1 inline-flex h-9 w-9 shrink-0 items-center justify-center rounded-full text-oai-gray-500 transition hover:bg-oai-gray-100 hover:text-oai-black focus:outline-none focus:ring-2 focus:ring-oai-gray-400/30 dark:text-oai-gray-400 dark:hover:bg-oai-gray-800 dark:hover:text-white",children:e.jsx(Se,{className:"h-4 w-4","aria-hidden":!0})})]}),e.jsxs("div",{className:"min-h-0 flex-1 overflow-y-auto px-5 py-5",children:[c?e.jsxs("div",{className:"mb-4 flex items-center gap-3 rounded-xl bg-sky-50/80 px-3 py-2.5 ring-1 ring-sky-200 dark:bg-sky-950/30 dark:ring-sky-800/60",children:[e.jsx(Aa,{className:"h-4 w-4 shrink-0 text-sky-600 dark:text-sky-300","aria-hidden":!0}),e.jsx("span",{className:"min-w-0 flex-1 text-xs text-sky-800 dark:text-sky-200",children:r("skills.update.available")}),e.jsxs("button",{type:"button",onClick:()=>u?.(a),disabled:h,className:"inline-flex h-7 shrink-0 items-center gap-1 rounded-md bg-sky-600 px-2.5 text-xs font-semibold text-white transition hover:bg-sky-700 focus:outline-none focus:ring-2 focus:ring-sky-400/40 disabled:cursor-not-allowed disabled:opacity-60 dark:bg-sky-500 dark:hover:bg-sky-400",children:[h?e.jsx(ae,{className:"h-3 w-3 animate-spin","aria-hidden":!0}):null,r("skills.update.action")]})]}):null,a.description?e.jsx("p",{className:"text-sm leading-6 text-oai-gray-600 dark:text-oai-gray-300",children:a.description}):null,e.jsxs("section",{className:"mt-6",children:[e.jsx("h3",{className:"mb-1 text-[11px] font-semibold uppercase tracking-wider text-oai-gray-500 dark:text-oai-gray-400",children:r("skills.usage.section_title")}),e.jsxs("dl",{className:"divide-y divide-oai-gray-200/60 dark:divide-white/[0.06]",children:[e.jsx(oa,{label:r("skills.usage.invocations"),children:yt(g?.invocations||0)}),e.jsx(oa,{label:r("skills.usage.last_used"),children:e.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[e.jsx("span",{className:W("h-1.5 w-1.5 rounded-full",Nr(g?.lastUsedAt)),"aria-hidden":!0}),F?Q||r("skills.usage.unknown"):r("skills.usage.never")]})}),e.jsx(oa,{label:e.jsxs(e.Fragment,{children:[r("skills.usage.cost"),e.jsx("span",{title:r("skills.usage.disclaimer"),className:"inline-flex cursor-help text-oai-gray-400 dark:text-oai-gray-500",children:e.jsx(Pa,{className:"h-3 w-3","aria-label":r("skills.usage.disclaimer")})})]}),children:ft(g?.cost||0,{currency:k,rate:C})})]}),F?null:e.jsx("p",{className:"mt-2 text-[11px] leading-4 text-oai-gray-400 dark:text-oai-gray-500",children:r("skills.usage.unused")})]}),e.jsxs("section",{className:"mt-6",children:[e.jsx("h3",{className:"mb-1 text-[11px] font-semibold uppercase tracking-wider text-oai-gray-500 dark:text-oai-gray-400",children:r("skills.detail.sync_section_title")}),e.jsx("div",{children:(s||[]).map(j=>{const te=I.has(j.id),$=l===wr(a.id,j.id),H=`skill-detail-sync-${a.id||a.directory}-${j.id}`;return e.jsxs("label",{htmlFor:H,className:"-mx-2 flex cursor-pointer items-center gap-3 rounded-md px-2 py-2 text-sm text-oai-black transition-colors hover:bg-oai-gray-100/70 dark:text-white dark:hover:bg-white/[0.05]",children:[e.jsx(br,{id:H,checked:te,disabled:$,onCheckedChange:X=>x?.(a,j.id,!!X),className:"peer flex h-4 w-4 shrink-0 items-center justify-center rounded-[4px] border border-oai-gray-300/80 bg-white/80 shadow-sm transition-colors hover:border-oai-gray-400 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-gray-400/40 focus-visible:ring-offset-1 focus-visible:ring-offset-transparent disabled:cursor-not-allowed disabled:opacity-50 data-[checked]:border-oai-black data-[checked]:bg-oai-black dark:border-oai-gray-500/60 dark:bg-oai-gray-900/60 dark:hover:border-oai-gray-400 dark:data-[checked]:border-white dark:data-[checked]:bg-white",children:e.jsx(kr,{className:"flex items-center justify-center text-white dark:text-oai-black",children:e.jsx(_e,{className:"h-3 w-3",strokeWidth:3.5,"aria-hidden":!0})})}),e.jsx("span",{className:"flex h-5 w-5 shrink-0 items-center justify-center","aria-hidden":!0,children:e.jsx(ye,{provider:j.id,size:16})}),e.jsx("span",{className:"flex-1",children:j.label}),$?e.jsx(ae,{className:"h-3.5 w-3.5 animate-spin text-oai-gray-400","aria-hidden":!0}):null]},j.id)})})]})]}),e.jsxs("footer",{className:"border-t border-white/40 bg-white/30 px-5 py-4 dark:border-white/10 dark:bg-white/[0.02]",children:[e.jsxs("button",{type:"button",onClick:()=>y?.(a),disabled:z,className:"inline-flex w-full items-center justify-center gap-2 rounded-lg border border-red-200/70 bg-white px-3 py-2 text-sm font-medium text-red-600 transition hover:border-red-300 hover:bg-red-50 focus:outline-none focus:ring-2 focus:ring-red-400/30 disabled:cursor-not-allowed disabled:opacity-60 dark:border-red-900/60 dark:bg-oai-gray-950 dark:text-red-300 dark:hover:border-red-800 dark:hover:bg-red-950/30",children:[z?e.jsx(ae,{className:"h-3.5 w-3.5 animate-spin","aria-hidden":!0}):e.jsx(xa,{className:"h-3.5 w-3.5","aria-hidden":!0}),r("skills.detail.remove_button")]}),e.jsx("p",{className:"mt-2 text-center text-[11px] text-oai-gray-500 dark:text-oai-gray-400",children:r("skills.detail.remove_confirm_hint")})]})]})]})}const _r=typeof window<"u"&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1"),la=["claude","codex"],O="popular",Pr={claude:"text-orange-500 dark:text-orange-300",codex:"text-emerald-600 dark:text-emerald-300",grok:"text-zinc-700 dark:text-zinc-200",antigravity:"text-violet-600 dark:text-violet-300",gemini:"text-sky-600 dark:text-sky-300",opencode:"text-amber-600 dark:text-amber-300",hermes:"text-indigo-500 dark:text-indigo-300"},xe="all",M="skillssh";function ga(a){return`${a.repoOwner||"local"}/${a.repoName||"local"}:${a.directory}`}function Qe(a){return`install:${ga(a)}`}function Sa(a){return`remove:${a.id||a.directory}`}function Qa(a,s){return`target:${a}:${s}`}function Rr({target:a,state:s,busy:l,onToggle:g}){const c=s==="synced",h=s==="orphan",u=h?r("skills.dot.orphan_aria",{agent:a.label}):c?r("skills.dot.synced_aria",{agent:a.label}):r("skills.dot.off_aria",{agent:a.label});return e.jsxs("button",{type:"button",title:u,"aria-label":u,"aria-pressed":c,disabled:l,onClick:m=>{m.stopPropagation(),g?.(a.id,!c)},className:"relative flex h-7 w-7 items-center justify-center rounded-md transition-colors hover:bg-oai-gray-100 focus:outline-none focus:ring-2 focus:ring-oai-gray-400/40 disabled:cursor-not-allowed dark:hover:bg-oai-gray-800/60",children:[l?e.jsx(ae,{className:"h-4 w-4 animate-spin text-oai-gray-400","aria-hidden":!0}):e.jsx("span",{className:W("flex h-[18px] w-[18px] items-center justify-center transition",c&&Pr[a.id],!c&&!h&&"opacity-35 grayscale"),"aria-hidden":!0,children:e.jsx(ye,{provider:a.id,size:18})}),h&&!l?e.jsx("span",{className:"absolute -bottom-px -right-px h-2 w-2 rounded-full bg-amber-500 ring-2 ring-oai-white dark:ring-oai-gray-900","aria-hidden":!0}):null]})}function Lr({skill:a,targets:s,onToggleTarget:l,busyKey:g}){return e.jsx("div",{className:"flex items-center gap-1",onClick:c=>c.stopPropagation(),children:s.map(c=>e.jsx(Rr,{target:c,state:a.targetStates?.[c.id]||"off",busy:g===Qa(a.id,c.id),onToggle:(h,u)=>l?.(a,h,u)},c.id))})}function Ir({skill:a,targets:s,selected:l,onSelect:g,selectable:c,checked:h,onToggleSelect:u,onToggleTarget:m,hasUpdate:x,busyKey:y}){const o=a.repoOwner&&a.repoName?`${a.repoOwner}/${a.repoName}`:null,k=o?`${a.directory} · ${o}`:a.directory,C=w=>{(w.key==="Enter"||w.key===" ")&&(w.preventDefault(),g?.(a))};return e.jsxs("div",{"data-skill-row":"1",role:"button",tabIndex:0,"aria-pressed":l,"aria-label":r("skills.row.open_details",{name:a.name||a.directory}),onClick:()=>g?.(a),onKeyDown:C,className:W("cursor-pointer rounded-md py-3 pr-2 transition focus:outline-none focus:ring-2 focus:ring-oai-gray-400/30",l?"bg-oai-gray-100 ring-1 ring-oai-gray-200 dark:bg-oai-gray-800/60 dark:ring-oai-gray-800":h?"bg-oai-gray-50 dark:bg-oai-gray-900/40":"hover:bg-oai-gray-50 dark:hover:bg-oai-gray-900/40"),children:[e.jsxs("div",{className:"flex items-center gap-3",children:[c?e.jsx("label",{className:"flex shrink-0 items-center",onClick:w=>w.stopPropagation(),children:e.jsx("input",{type:"checkbox",checked:h,onChange:w=>u?.(a,w.target.checked),"aria-label":r("skills.select.row_aria",{name:a.name||a.directory}),className:"h-4 w-4 rounded border-oai-gray-300 text-oai-black focus:ring-oai-gray-400 dark:border-oai-gray-600 dark:bg-oai-gray-900 dark:text-white"})}):null,e.jsx("h2",{className:"min-w-0 flex-1 truncate text-sm font-semibold text-oai-black dark:text-white",title:k,children:a.name||a.directory}),x?e.jsxs("span",{className:"inline-flex shrink-0 items-center gap-1 rounded-full bg-sky-50 px-1.5 py-0.5 text-[10px] font-semibold text-sky-700 ring-1 ring-sky-200 dark:bg-sky-950/40 dark:text-sky-300 dark:ring-sky-800/60",children:[e.jsx(Aa,{className:"h-2.5 w-2.5","aria-hidden":!0}),r("skills.update.badge")]}):null,e.jsx(Lr,{skill:a,targets:s,onToggleTarget:m,busyKey:y}),e.jsx(Kt,{className:W("hidden h-4 w-4 shrink-0 text-oai-gray-300 transition-colors dark:text-oai-gray-600 lg:block",l&&"text-oai-gray-500 dark:text-oai-gray-300"),"aria-hidden":!0})]}),a.description?e.jsx("p",{className:W("mt-1 line-clamp-2 text-xs text-oai-gray-500 dark:text-oai-gray-400",c&&"pl-7"),children:a.description}):null]})}function $r({agentFilter:a,agentOptions:s,onAgentFilter:l,filteredCount:g,totalCount:c,anyFilter:h,onClearFilters:u,searchQuery:m,onSearchQuery:x,searchPlaceholder:y}){return e.jsxs("div",{className:"mb-2 flex flex-wrap items-center gap-2 pt-1 text-xs text-oai-gray-600 dark:text-oai-gray-300",children:[e.jsxs(Ma,{value:a,onValueChange:l,children:[e.jsxs(Ba,{"aria-label":r("skills.filter.agent_label"),className:"inline-flex h-8 items-center gap-1.5 rounded-md border border-oai-gray-200 bg-oai-white px-2.5 text-xs font-medium text-oai-gray-700 transition hover:border-oai-gray-300 focus:outline-none focus:ring-2 focus:ring-oai-gray-400/30 data-[popup-open]:border-oai-gray-300 dark:border-oai-gray-800 dark:bg-oai-gray-900 dark:text-oai-gray-200 dark:hover:border-oai-gray-700",children:[e.jsxs("span",{className:"text-oai-gray-500 dark:text-oai-gray-400",children:[r("skills.filter.agent_label"),":"]}),e.jsx(Ta,{children:o=>o==="all"?r("skills.filter.agent_all"):s.find(k=>k.id===o)?.label||o}),e.jsx(Ka,{className:"text-oai-gray-400",children:e.jsx(ma,{className:"h-3.5 w-3.5","aria-hidden":!0})})]}),e.jsx(Oa,{children:e.jsx(Ua,{sideOffset:4,alignItemWithTrigger:!1,className:"z-[60]",children:e.jsxs(za,{className:"min-w-[var(--anchor-width)] overflow-hidden rounded-md border border-oai-gray-200 bg-white p-1 shadow-[0_12px_32px_-12px_rgba(0,0,0,0.18)] outline-none dark:border-oai-gray-800 dark:bg-oai-gray-950 dark:shadow-[0_12px_32px_-12px_rgba(0,0,0,0.6)]",children:[e.jsxs(Ye,{value:"all",className:"flex cursor-default select-none items-center justify-between gap-2 rounded px-3 py-1.5 text-sm text-oai-black outline-none data-[highlighted]:bg-oai-gray-100 dark:text-white dark:data-[highlighted]:bg-oai-gray-800",children:[e.jsx(Je,{children:r("skills.filter.agent_all")}),e.jsx(Ze,{children:e.jsx(_e,{className:"h-3.5 w-3.5","aria-hidden":!0})})]}),s.map(o=>e.jsxs(Ye,{value:o.id,className:"flex cursor-default select-none items-center justify-between gap-2 rounded px-3 py-1.5 text-sm text-oai-black outline-none data-[highlighted]:bg-oai-gray-100 dark:text-white dark:data-[highlighted]:bg-oai-gray-800",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ye,{provider:o.id,size:14}),e.jsx(Je,{children:o.label})]}),e.jsx(Ze,{children:e.jsx(_e,{className:"h-3.5 w-3.5","aria-hidden":!0})})]},o.id))]})})})]}),e.jsxs("div",{className:"relative w-56 max-w-full",children:[e.jsx(ca,{className:"pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-oai-gray-400","aria-hidden":!0}),e.jsx(ha,{type:"search",value:m,onChange:o=>x(o.target.value),onKeyDown:o=>{o.key==="Escape"&&m&&(o.preventDefault(),x(""))},"aria-label":r("skills.action.search_aria"),placeholder:y,className:"h-8 pl-9 pr-8 !border-oai-gray-200 dark:!border-oai-gray-800 focus:!border-oai-gray-400 focus:!ring-oai-gray-400/20 dark:focus:!border-oai-gray-500 dark:focus:!ring-oai-gray-500/20 [&::-webkit-search-cancel-button]:appearance-none"}),e.jsx("button",{type:"button",onMouseDown:o=>o.preventDefault(),onClick:()=>x(""),"aria-label":r("skills.action.search_clear"),"aria-hidden":!m,tabIndex:m?0:-1,className:W("absolute right-2 top-1/2 flex h-6 w-6 -translate-y-1/2 items-center justify-center rounded-full text-oai-gray-400 transition duration-150 ease-out before:absolute before:-inset-1.5 before:content-[''] hover:bg-oai-gray-100 hover:text-oai-gray-600 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-gray-400/40 motion-reduce:transition-none dark:hover:bg-oai-gray-800 dark:hover:text-oai-gray-200",m?"scale-100 opacity-100":"pointer-events-none scale-90 opacity-0"),children:e.jsx(Se,{className:"h-3.5 w-3.5","aria-hidden":!0})})]}),e.jsx("span",{role:"status","aria-live":"polite",className:"ml-auto shrink-0 tabular-nums text-oai-gray-500 dark:text-oai-gray-400",children:r("skills.filter.result_count",{filtered:g,total:c})}),h?e.jsxs("button",{type:"button",onClick:u,className:"shrink-0 inline-flex h-7 items-center gap-1 rounded-full bg-oai-gray-100 px-2.5 text-[11px] font-medium text-oai-gray-700 transition hover:bg-oai-gray-200 focus:outline-none focus:ring-2 focus:ring-oai-gray-400/30 dark:bg-oai-gray-800/70 dark:text-oai-gray-200 dark:hover:bg-oai-gray-700",children:[e.jsx(Se,{className:"h-3 w-3","aria-hidden":!0}),r("skills.filter.clear")]}):null]})}function Dr({count:a,targets:s,busy:l,onBulkSync:g,onBulkRemove:c,onClear:h}){return e.jsxs("div",{role:"toolbar","aria-label":r("skills.select.toolbar_aria"),className:"mb-2 flex flex-wrap items-center gap-2 rounded-lg border border-oai-gray-200 bg-oai-gray-50 px-3 py-2 dark:border-oai-gray-800 dark:bg-oai-gray-900/50",children:[e.jsx("span",{className:"text-xs font-medium text-oai-gray-700 dark:text-oai-gray-200","aria-live":"polite",children:r("skills.select.count",{count:a})}),e.jsxs("div",{className:"ml-auto flex items-center gap-2",children:[e.jsxs(Ra,{children:[e.jsxs(La,{disabled:l,className:"inline-flex h-8 items-center gap-1.5 rounded-md border border-oai-gray-200 bg-oai-white px-2.5 text-xs font-medium text-oai-gray-700 transition hover:border-oai-gray-300 focus:outline-none focus:ring-2 focus:ring-oai-gray-400/30 disabled:opacity-60 dark:border-oai-gray-800 dark:bg-oai-gray-900 dark:text-oai-gray-200",children:[e.jsx(Fa,{className:"h-3.5 w-3.5","aria-hidden":!0}),r("skills.select.bulk_sync"),e.jsx(ma,{className:"h-3 w-3","aria-hidden":!0})]}),e.jsx(Ia,{children:e.jsx($a,{sideOffset:6,side:"bottom",align:"end",className:"!z-[80]",children:e.jsxs(Da,{className:"min-w-[200px] rounded-lg bg-white p-1.5 shadow-lg ring-1 ring-oai-gray-200 dark:bg-oai-gray-950 dark:ring-oai-gray-800",children:[e.jsx("div",{className:"px-2 pb-1 pt-0.5 text-[11px] font-medium uppercase tracking-wide text-oai-gray-500 dark:text-oai-gray-400",children:r("skills.select.bulk_sync_hint")}),s.map(u=>e.jsxs("button",{type:"button",onClick:()=>g(u.id),className:"flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-left text-sm text-oai-black hover:bg-oai-gray-100 dark:text-white dark:hover:bg-oai-gray-800",children:[e.jsx(ye,{provider:u.id,size:16}),e.jsx("span",{className:"flex-1",children:u.label})]},u.id))]})})})]}),e.jsxs(U,{type:"button",variant:"ghost",size:"sm",disabled:l,onClick:c,children:[e.jsx(xa,{className:"mr-1.5 h-3.5 w-3.5","aria-hidden":!0}),r("skills.select.bulk_remove")]}),e.jsxs("button",{type:"button",onClick:h,className:"inline-flex h-7 items-center gap-1 rounded-full px-2 text-[11px] font-medium text-oai-gray-500 transition hover:text-oai-black focus:outline-none focus:ring-2 focus:ring-oai-gray-400/30 dark:text-oai-gray-400 dark:hover:text-white",children:[e.jsx(Se,{className:"h-3 w-3","aria-hidden":!0}),r("skills.select.clear")]})]})]})}function Er({items:a,totalCount:s,targets:l,agentOptions:g,agentFilter:c,onAgentFilter:h,anyFilter:u,onClearFilters:m,searchQuery:x,onSearchQuery:y,searchPlaceholder:o,selectedId:k,onSelect:C,onToggleTarget:w,busyKey:v,updates:f,selectedIds:N,onToggleSelect:I,onClearSelection:z,onBulkSync:Q,onBulkRemove:F}){const de=N.size;return e.jsxs("div",{children:[de>0?e.jsx(Dr,{count:de,targets:l,busy:v==="batch",onBulkSync:Q,onBulkRemove:F,onClear:z}):e.jsx($r,{agentFilter:c,agentOptions:g,onAgentFilter:h,filteredCount:a.length,totalCount:s,anyFilter:u,onClearFilters:m,searchQuery:x,onSearchQuery:y,searchPlaceholder:o}),a.length===0?e.jsxs("div",{className:"flex flex-col items-center gap-3 rounded-lg border border-dashed border-oai-gray-200 px-4 py-10 text-center text-sm text-oai-gray-500 dark:border-oai-gray-800 dark:text-oai-gray-400",children:[e.jsx("p",{children:r("skills.empty.no_match")}),e.jsx(U,{type:"button",variant:"secondary",size:"sm",onClick:m,children:r("skills.filter.clear")})]}):e.jsx("div",{className:"divide-y divide-oai-gray-200/70 dark:divide-oai-gray-800/70",children:a.map(j=>e.jsx(Ir,{skill:j,targets:l,selected:k===(j.id||j.directory),onSelect:C,selectable:!0,checked:N.has(j.id),onToggleSelect:I,onToggleTarget:w,hasUpdate:!!(j.id&&f?.[j.id]),busyKey:v},j.id||j.key))})]})}const Mr={contentVisibility:"auto",containIntrinsicSize:"0 240px"},Br=_t.memo(function({skill:s,installed:l,installing:g,allTargets:c,defaultTargets:h,onInstall:u,onManage:m}){const[x,y]=n.useState(()=>(h||[]).filter(f=>c.some(N=>N.id===f))),o=f=>{y(N=>N.includes(f)?N.filter(I=>I!==f):[...N,f])},k=s.repoOwner&&s.repoName?`${s.repoOwner}/${s.repoName}`:null,C=k?`https://github.com/${s.repoOwner}/${s.repoName}`:null,w=s.installs!=null?r("skills.card.installs",{count:Number(s.installs||0).toLocaleString()}):null,v=x.length?x.map(f=>c.find(N=>N.id===f)?.label||f).join(", "):r("skills.action.choose_targets");return e.jsxs(Dt,{className:"h-full rounded-lg",bodyClassName:"flex h-full flex-col",children:[e.jsx("div",{className:"flex items-start justify-between gap-3",children:e.jsxs("div",{className:"min-w-0",children:[s.readmeUrl?e.jsxs("a",{href:s.readmeUrl,target:"_blank",rel:"noopener noreferrer",className:"group inline-flex max-w-full items-center gap-1 truncate text-base font-semibold text-oai-black hover:underline dark:text-white",title:s.readmeUrl,children:[e.jsx("span",{className:"truncate",children:s.name||s.directory}),e.jsx(ua,{className:"h-3.5 w-3.5 shrink-0 text-oai-gray-400 opacity-0 transition-opacity group-hover:opacity-100","aria-hidden":!0})]}):e.jsx("h2",{className:"truncate text-base font-semibold text-oai-black dark:text-white",children:s.name||s.directory}),k||w?e.jsxs("div",{className:"mt-1 flex flex-wrap items-center gap-x-1.5 truncate text-xs text-oai-gray-500 dark:text-oai-gray-400",children:[C?e.jsxs("a",{href:C,target:"_blank",rel:"noopener noreferrer",onClick:f=>f.stopPropagation(),className:"inline-flex items-center gap-1 truncate rounded text-oai-gray-500 hover:text-oai-black hover:underline focus:outline-none focus:ring-2 focus:ring-oai-gray-400/30 dark:text-oai-gray-400 dark:hover:text-white",title:C,children:[e.jsx("span",{className:"truncate",children:k}),e.jsx(ua,{className:"h-2.5 w-2.5 shrink-0","aria-hidden":!0})]}):null,k&&w?e.jsx("span",{"aria-hidden":!0,children:"·"}):null,w?e.jsx("span",{className:"truncate",children:w}):null]}):null]})}),s.description?e.jsx("p",{className:"mt-3 line-clamp-3 text-sm leading-6 text-oai-gray-600 dark:text-oai-gray-300",children:s.description}):null,e.jsx("div",{className:"mt-auto pt-5",children:l?e.jsxs(U,{type:"button",variant:"secondary",size:"sm",onClick:()=>m?.(s),className:"w-full",children:[e.jsx(_e,{className:"mr-1.5 h-3.5 w-3.5 text-emerald-500 dark:text-emerald-400","aria-hidden":!0}),r("skills.card.manage")]}):e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex flex-wrap items-baseline gap-x-2 gap-y-1 text-xs text-oai-gray-600 dark:text-oai-gray-300",children:[e.jsx("span",{className:"text-oai-gray-500 dark:text-oai-gray-400",children:r("skills.card.targets_prefix")}),e.jsx("span",{className:"min-w-0 truncate font-medium text-oai-black dark:text-white",children:x.length?v:r("skills.target.none")}),e.jsxs(Ra,{children:[e.jsx(La,{disabled:g,"aria-label":r("skills.action.choose_targets"),className:"rounded text-xs font-medium text-oai-gray-500 underline decoration-oai-gray-300 decoration-dotted underline-offset-2 transition hover:text-oai-black hover:decoration-oai-gray-500 focus:outline-none focus:ring-2 focus:ring-oai-gray-400/30 disabled:cursor-not-allowed disabled:opacity-60 dark:text-oai-gray-400 dark:decoration-oai-gray-600 dark:hover:text-white dark:hover:decoration-oai-gray-400",children:r("skills.card.targets_change")}),e.jsx(Ia,{children:e.jsx($a,{sideOffset:6,side:"bottom",align:"end",className:"!z-[80]",children:e.jsxs(Da,{className:"min-w-[220px] rounded-lg bg-white p-1.5 shadow-lg ring-1 ring-oai-gray-200 dark:bg-oai-gray-950 dark:ring-oai-gray-800",children:[e.jsx("div",{className:"px-2 pb-1 pt-0.5 text-[11px] font-medium uppercase tracking-wide text-oai-gray-500 dark:text-oai-gray-400",children:r("skills.target.menu_label")}),c.map(f=>{const N=x.includes(f.id);return e.jsxs("label",{className:"flex cursor-pointer items-center gap-2 rounded-md px-2 py-1.5 text-sm text-oai-black hover:bg-oai-gray-100 dark:text-white dark:hover:bg-oai-gray-800",children:[e.jsx("input",{type:"checkbox",className:"h-4 w-4 shrink-0 rounded border-oai-gray-300 text-oai-black focus:ring-oai-gray-400 dark:border-oai-gray-600 dark:bg-oai-gray-900 dark:text-white",checked:N,onChange:()=>o(f.id)}),e.jsx(ye,{provider:f.id,size:16}),e.jsx("span",{className:"flex-1 text-left",children:f.label})]},f.id)})]})})})]})]}),e.jsxs(U,{type:"button",size:"sm",onClick:()=>u(s,x),disabled:g||x.length===0,className:"w-full",children:[g?e.jsx(ae,{className:"mr-1.5 h-3.5 w-3.5 animate-spin","aria-hidden":!0}):e.jsx(Fa,{className:"mr-1.5 h-3.5 w-3.5","aria-hidden":!0}),r("skills.action.install")]})]})})]})});function Tr({repos:a,repoInput:s,onRepoInput:l,busyKey:g,onAdd:c,onRemove:h}){return e.jsxs("div",{className:"rounded-lg border border-oai-gray-200 bg-white p-4 dark:border-oai-gray-800 dark:bg-oai-gray-950",children:[e.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center",children:[e.jsx(ha,{value:s,onChange:u=>l(u.target.value),placeholder:r("skills.repo.placeholder"),className:"min-w-0 flex-1"}),e.jsxs(U,{type:"button",variant:"secondary",size:"md",onClick:c,disabled:g==="repo:add",className:"shrink-0 whitespace-nowrap",children:[g==="repo:add"?e.jsx(ae,{className:"mr-1.5 h-4 w-4 animate-spin","aria-hidden":!0}):e.jsx(Va,{className:"mr-1.5 h-4 w-4","aria-hidden":!0}),r("skills.repo.add")]})]}),a.length?e.jsx("div",{className:"mt-3 divide-y divide-oai-gray-200/70 dark:divide-oai-gray-800/70",children:a.map(u=>{const m=g===`repo:${u.owner}/${u.name}`;return e.jsxs("div",{className:"flex items-center justify-between gap-3 py-2",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"truncate text-sm font-medium text-oai-black dark:text-white",children:[u.owner,"/",u.name]}),e.jsx("div",{className:"text-xs text-oai-gray-500 dark:text-oai-gray-400",children:u.branch})]}),e.jsxs(U,{type:"button",variant:"ghost",size:"sm",disabled:m,onClick:()=>h(u),className:"shrink-0",children:[m?e.jsx(ae,{className:"h-3.5 w-3.5 animate-spin","aria-hidden":!0}):e.jsx(xa,{className:"h-3.5 w-3.5","aria-hidden":!0}),e.jsx("span",{className:"sr-only",children:r("skills.repo.remove")})]})]},`${u.owner}/${u.name}`)})}):null]})}function Or(){return typeof window>"u"?"my":new URLSearchParams(window.location.search).get("tab")==="browse"?"browse":"my"}function Xr(){const[a,s]=n.useState(Or),[l,g]=n.useState({skills:[],targets:[]}),[c,h]=n.useState([]),[u,m]=n.useState([]),[x,y]=n.useState([]),[o,k]=n.useState(xe),[C,w]=n.useState(""),[v,f]=n.useState(""),[N,I]=n.useState(""),[z,Q]=n.useState(""),[F,de]=n.useState(""),[j,te]=n.useState(!1),[$,H]=n.useState("all"),[X,re]=n.useState(null),[A,fe]=n.useState(""),[be,Ue]=n.useState(!0),[Pe,ze]=n.useState(!1),[Fe,B]=n.useState(""),[se,Re]=n.useState(null),[Y,ke]=n.useState(null),[S,ie]=n.useState(()=>new Set),[ne,J]=n.useState({}),[Z,P]=n.useState({}),[he,aa]=n.useState([]),[G,we]=n.useState(!1),ve=n.useRef(!1),ce=n.useMemo(()=>{const t=new Set;for(const i of l.skills||[]){t.add(ga(i).toLowerCase()),i.repoOwner&&i.repoName&&t.add(`${i.repoOwner}/${i.repoName}:${i.sourceDirectory||i.directory}`.toLowerCase());const d=String(i.directory||"").split(/[\\/]/).pop().toLowerCase();d&&t.add(`dir:${d}`)}return t},[l.skills]),je=n.useCallback(async()=>{const t=await bt();g({skills:t.skills||[],targets:t.targets||[]})},[]),Ne=n.useCallback(async()=>{const t=await kt();y(t.repos||[])},[]),T=n.useCallback(async({force:t=!1}={})=>{ze(!0);try{const i=await wt({force:t});h(i.skills||[])}finally{ze(!1)}},[]),pe=n.useCallback(async({force:t=!1}={})=>{we(!0);try{const i=await vt({force:t});aa(i.skills||[])}finally{we(!1)}},[]),ue=n.useCallback(async()=>{try{const t=await jt();J(t?.updates||{})}catch{J({})}},[]),ge=n.useCallback(async()=>{try{const t=await Nt(),i={};for(const d of t?.skills||[])d.installed&&(d.directory&&(i[String(d.directory).toLowerCase()]=d),i[String(d.skill).toLowerCase()]=d);P(i)}catch{P({})}},[]),oe=n.useCallback(async()=>{Ue(!0),B("");try{await Promise.all([je(),Ne()])}catch(t){B(t?.message||r("skills.error.generic"))}finally{Ue(!1)}},[je,Ne]),Le=n.useCallback(async()=>{await oe();const t=i=>B(i?.message||r("skills.error.generic"));a==="my"?(ue(),ge()):o===O?pe({force:!0}).catch(t):o!==M&&T({force:!0}).catch(t)},[T,oe,pe,ue,ge,o,a]);n.useEffect(()=>{oe()},[oe]),n.useEffect(()=>{if(ve.current||typeof window>"u")return;const t=new URLSearchParams(window.location.search),i=t.get("skill");if(!i){ve.current=!0;return}const d=l.skills||[];if(!d.length)return;const p=d.find(_=>_.directory===i||_.id===i);p&&(s("my"),re(p.id||p.directory)),ve.current=!0,t.delete("skill");const E=t.toString();window.history.replaceState({},"",`${window.location.pathname}${E?`?${E}`:""}${window.location.hash}`)},[l.skills]),n.useEffect(()=>{a==="browse"&&(o===M||o===O||c.length===0&&T().catch(t=>B(t?.message||r("skills.error.generic"))))},[c.length,T,o,a]),n.useEffect(()=>{a!=="browse"||o!==O||he.length===0&&pe().catch(t=>B(t?.message||r("skills.error.generic")))},[pe,he.length,o,a]);const Ae=Object.keys(ne).length>0,Ve=Object.keys(Z).length>0;if(n.useEffect(()=>{a==="my"&&(Ae||ue(),Ve||ge())},[a,Ae,Ve,ue,ge]),n.useEffect(()=>{const t=setTimeout(()=>f(C),200);return()=>clearTimeout(t)},[C]),n.useEffect(()=>{const t=setTimeout(()=>Q(N),120);return()=>clearTimeout(t)},[N]),n.useEffect(()=>{if(typeof window>"u")return;const t=new URLSearchParams(window.location.search),i=t.get("tab");if(a==="my"){if(!i)return;t.delete("tab")}else{if(i===a)return;t.set("tab",a)}const d=t.toString(),p=`${window.location.pathname}${d?`?${d}`:""}${window.location.hash}`;window.history.replaceState({},"",p)},[a]),!_r&&!Ct())return e.jsx("div",{className:"flex flex-col flex-1 text-oai-black dark:text-oai-white font-oai antialiased",children:e.jsx($t,{})});const L=async(t,i)=>{fe(t),B("");try{await i(),await je()}catch(d){B(d?.message||r("skills.error.generic"))}finally{fe("")}},D=(t,i)=>{const d=(i&&i.length?i:la).filter(p=>(l.targets||[]).some(E=>E.id===p));L(Qe(t),async()=>{await ba(t,d);const p=d.map(E=>(l.targets||[]).find(_=>_.id===E)?.label||E).join(", ");Ce({title:r("skills.toast.installed",{name:t.name||t.directory,targets:p||r("skills.target.none")}),timeout:4e3})})},ta=t=>{Re(t)},le=()=>{const t=se;t&&(Re(null),L(Sa(t),async()=>{let i=null;t.managed?i=await ka(t.id):await wa(t.directory,t.targets||[]);const d=!!(i?.trashed&&t.managed&&t.id);Ce({title:r("skills.toast.removed",{name:t.name||t.directory}),timeout:6e3,data:d?{onUndo:async()=>{try{await Rt(t.id),await je()}catch(p){B(p?.message||r("skills.error.generic"))}}}:void 0})}))},Ke=(t,i,d)=>L(Qa(t.id,i),async()=>{const p=new Set(t.targets||[]);d?p.add(i):p.delete(i),t.managed?await va(t.id,Array.from(p)):await ja(t.directory,Array.from(p));const E={name:t.name||t.directory,agent:$e(i)};Ce({title:d?r("skills.toast.synced_one",E):r("skills.toast.unsynced_one",E),timeout:3e3})}),Ie=n.useCallback(()=>ie(new Set),[]),ra=n.useCallback((t,i)=>{ie(d=>{const p=new Set(d);return i?p.add(t.id):p.delete(t.id),p})},[]),$e=t=>(l.targets||[]).find(i=>i.id===t)?.label||t,qe=t=>{const i=(l.skills||[]).filter(d=>S.has(d.id));i.length&&L("batch",async()=>{for(const d of i){const p=new Set(d.targets||[]);p.add(t),d.managed?await va(d.id,Array.from(p)):await ja(d.directory,Array.from(p))}Ie(),Ce({title:r("skills.toast.bulk_synced",{count:i.length,agent:$e(t)}),timeout:4e3})})},De=()=>{const t=(l.skills||[]).filter(i=>S.has(i.id));t.length&&ke(t)},sa=()=>{const t=Y;t&&(ke(null),L("batch",async()=>{for(const i of t)i.managed?await ka(i.id):await wa(i.directory,i.targets||[]);Ie(),Ce({title:r("skills.toast.bulk_removed",{count:t.length}),timeout:4e3})}))},ia=t=>{!t?.repoOwner||!t?.repoName||L(Qe(t),async()=>{await ba({key:t.key,name:t.name,description:t.description,directory:t.sourceDirectory||t.directory,repoOwner:t.repoOwner,repoName:t.repoName,repoBranch:t.repoBranch,readmeUrl:t.readmeUrl},t.targets&&t.targets.length?t.targets:la),await ue(),Ce({title:r("skills.toast.updated",{name:t.name||t.directory}),timeout:4e3})})},b=async()=>{const t=C.trim();if(!(t.length<2)){fe("search"),B("");try{const i=await Pt(t);m(i.skills||[])}catch(i){B(i?.message||r("skills.error.generic"))}finally{fe("")}}},V=async()=>{const t=F.trim().replace(/^https:\/\/github\.com\//,"").replace(/\.git$/,""),[i,d]=t.split("/");if(!i||!d){B(r("skills.repo.invalid"));return}await L("repo:add",async()=>{await It({owner:i,name:d,branch:"main",enabled:!0}),de(""),await Ne(),await T()})},me=async t=>{await L(`repo:${t.owner}/${t.name}`,async()=>{await Lt(t.owner,t.name),await Ne(),await T()})},R=l.targets||[],K=l.skills||[],Ee=n.useMemo(()=>{const t=$==="all"?K:K.filter(d=>(d.targets||[]).includes($)),i=z.trim().toLowerCase();return i?t.filter(d=>(d.name||"").toLowerCase().includes(i)||(d.directory||"").toLowerCase().includes(i)||(d.description||"").toLowerCase().includes(i)):t},[K,$,z]),Me=$!=="all",ee=n.useMemo(()=>X&&K.find(t=>(t.id||t.directory)===X)||null,[K,X]),Xa=n.useCallback(()=>{H("all"),I("")},[]),Ya=n.useCallback(t=>{re(i=>{const d=t?.id||t?.directory||null;return i===d?null:d})},[]),Ja=n.useCallback(()=>re(null),[]),Za=n.useCallback(t=>{const i=String(t.directory||"").split(/[\\/]/).pop().toLowerCase(),d=(l.skills||[]).find(p=>String(p.directory||"").toLowerCase()===i);d&&re(d.id||d.directory)},[l.skills]);n.useEffect(()=>{a!=="my"&&S.size&&ie(new Set)},[a,S.size]),n.useEffect(()=>{X&&!ee&&re(null)},[ee,X]);const Be=n.useMemo(()=>{const t=o===M?u:o===O?he:c,d=o===M||o===O||o===xe?t:t.filter(_=>`${_.repoOwner}/${_.repoName}`===o),p=v.trim().toLowerCase();return(o===M||!p?d:d.filter(_=>(_.name||"").toLowerCase().includes(p)||(_.directory||"").toLowerCase().includes(p)||(_.description||"").toLowerCase().includes(p))).map(_=>{const na=ga(_).toLowerCase(),q=String(_.directory||"").split(/[\\/]/).pop().toLowerCase(),We=q?`dir:${q}`:"";return{..._,installed:ce.has(na)||We&&ce.has(We)}})},[v,c,ce,he,u,o]),et=e.jsx("div",{className:"flex h-64 items-center justify-center",children:e.jsx(ae,{className:"h-8 w-8 animate-spin text-oai-gray-400","aria-hidden":!0})}),at=e.jsxs("div",{className:"flex h-64 flex-col items-center justify-center gap-3 px-6 text-center",children:[e.jsx(ae,{className:"h-8 w-8 animate-spin text-oai-gray-400","aria-hidden":!0}),e.jsx("p",{className:"max-w-md text-xs text-oai-gray-500 dark:text-oai-gray-400",children:r("skills.browse.loading_hint")})]}),He=(t,i=null)=>e.jsxs("div",{className:"flex flex-col items-center gap-4 rounded-lg border border-dashed border-oai-gray-200 px-4 py-10 text-center text-sm text-oai-gray-500 dark:border-oai-gray-800 dark:text-oai-gray-400",children:[e.jsx("p",{children:r(t)}),i]});let Ge;if(be)Ge=et;else if(a==="my")Ge=K.length?e.jsx(Er,{items:Ee,totalCount:K.length,targets:R,agentOptions:R,agentFilter:$,onAgentFilter:H,anyFilter:Me,onClearFilters:Xa,searchQuery:N,onSearchQuery:I,searchPlaceholder:r("skills.my.placeholder"),selectedId:X,onSelect:Ya,onToggleTarget:Ke,busyKey:A,updates:ne,selectedIds:S,onToggleSelect:ra,onClearSelection:Ie,onBulkSync:qe,onBulkRemove:De}):e.jsxs("div",{className:"flex flex-col items-center gap-4 rounded-lg border border-dashed border-oai-gray-200 px-4 py-10 text-center dark:border-oai-gray-800",children:[R.length>0?e.jsxs("div",{className:"relative h-11 w-80 overflow-hidden","aria-hidden":!0,children:[e.jsx("div",{className:"pointer-events-none absolute inset-0",style:{maskImage:"linear-gradient(to right, transparent 8%, black 20%, black 32%, transparent 44%, transparent 56%, black 68%, black 80%, transparent 92%)",WebkitMaskImage:"linear-gradient(to right, transparent 8%, black 20%, black 32%, transparent 44%, transparent 56%, black 68%, black 80%, transparent 92%)"},children:e.jsx("div",{className:"absolute inset-y-0 left-0 flex w-max items-center animate-marquee-x",style:{filter:"blur(2.5px)"},children:[...R,...R].map((t,i)=>e.jsx("span",{className:"shrink-0 px-3",children:e.jsx(ye,{provider:t.id,size:30})},`b-${i}`))})}),e.jsx("div",{className:"pointer-events-none absolute inset-0",style:{maskImage:"linear-gradient(to right, transparent 28%, black 42%, black 58%, transparent 72%)",WebkitMaskImage:"linear-gradient(to right, transparent 28%, black 42%, black 58%, transparent 72%)"},children:e.jsx("div",{className:"absolute inset-y-0 left-0 flex w-max items-center animate-marquee-x",children:[...R,...R].map((t,i)=>e.jsx("span",{className:"shrink-0 px-3",children:e.jsx(ye,{provider:t.id,size:30})},`c-${i}`))})}),e.jsx("div",{className:"pointer-events-none absolute inset-y-0 left-0 w-20 bg-gradient-to-r from-oai-white to-transparent dark:from-oai-gray-900"}),e.jsx("div",{className:"pointer-events-none absolute inset-y-0 right-0 w-20 bg-gradient-to-l from-oai-white to-transparent dark:from-oai-gray-900"})]}):null,e.jsx("p",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-400",children:r("skills.empty.my")}),e.jsx(U,{type:"button",size:"sm",onClick:()=>s("browse"),children:r("skills.empty.my_cta")})]});else{const t=o===M,i=o===O,d=x.length===0&&!t&&!i,p=Pe&&!t&&!i||i&&G,E=!t&&!i&&(v.trim()!==""||o!==xe),_=()=>{w(""),k(xe)},na=!d&&!p&&(Be.length>0||E)?e.jsxs("div",{className:"mb-2 flex flex-wrap items-center gap-2 px-1 text-xs text-oai-gray-500 dark:text-oai-gray-400",children:[e.jsx("span",{children:r("skills.filter.result_count_browse",{count:Be.length})}),E?e.jsxs("button",{type:"button",onClick:_,className:"ml-auto inline-flex h-7 items-center gap-1 rounded-full bg-oai-gray-100 px-2.5 text-[11px] font-medium text-oai-gray-700 transition hover:bg-oai-gray-200 focus:outline-none focus:ring-2 focus:ring-oai-gray-400/30 dark:bg-oai-gray-800/70 dark:text-oai-gray-200 dark:hover:bg-oai-gray-700",children:[e.jsx(Se,{className:"h-3 w-3","aria-hidden":!0}),r("skills.filter.clear")]}):null]}):null;let q;d?q=e.jsx("div",{className:"rounded-lg border border-dashed border-oai-gray-200 p-6 text-center dark:border-oai-gray-800",children:e.jsx("p",{className:"text-sm text-oai-gray-600 dark:text-oai-gray-300",children:r("skills.browse.empty_sources")})}):p?q=at:t&&C.trim().length<2?q=e.jsx("div",{className:"rounded-lg border border-dashed border-oai-gray-200 px-4 py-6 text-center text-sm text-oai-gray-500 dark:border-oai-gray-800 dark:text-oai-gray-400",children:r("skills.browse.hint_skillssh")}):Be.length?q=e.jsx("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2 xl:grid-cols-3",children:Be.map(Te=>e.jsx("div",{style:Mr,children:e.jsx(Br,{skill:Te,installed:!!Te.installed,installing:A===Qe(Te),allTargets:R,defaultTargets:la,onInstall:D,onManage:Za})},Te.id||Te.key))}):E?q=He("skills.empty.no_match",e.jsx(U,{type:"button",variant:"secondary",size:"sm",onClick:_,children:r("skills.filter.clear")})):t?q=He("skills.empty.search"):i?q=He("skills.empty.popular"):q=He("skills.empty.browse");const We=d||j?e.jsx("div",{className:"mb-5",children:e.jsx(Tr,{repos:x,repoInput:F,onRepoInput:de,busyKey:A,onAdd:V,onRemove:me})}):null,tt=!j&&!t&&!i&&x.length<=1&&Be.length>0?e.jsx(lr,{id:"skills-browse-intro",className:"mt-6",children:e.jsxs("div",{className:"flex flex-wrap items-center gap-x-2 gap-y-1",children:[e.jsx("span",{children:r("skills.browse.add_repo_hint")}),e.jsx("button",{type:"button",onClick:()=>te(!0),className:"rounded font-medium text-oai-gray-700 underline decoration-dotted underline-offset-2 transition hover:text-oai-black focus:outline-none focus:ring-2 focus:ring-oai-gray-400/30 dark:text-oai-gray-200 dark:hover:text-white",children:r("skills.browse.manage_sources")})]})}):null;Ge=e.jsxs(e.Fragment,{children:[We,na,q,tt]})}return e.jsxs("div",{className:"flex flex-1 flex-col font-oai text-oai-black antialiased dark:text-oai-white",children:[e.jsx("main",{className:"flex-1 pb-12 pt-8 sm:pb-16 sm:pt-10",children:e.jsxs("div",{className:"mx-auto max-w-6xl px-4 sm:px-6",children:[e.jsxs("div",{className:"mb-6 flex items-end justify-between gap-4",children:[e.jsx("h1",{className:"text-3xl font-semibold tracking-tight text-oai-black dark:text-white sm:text-4xl",children:r("skills.page.title")}),e.jsxs(U,{type:"button",variant:"secondary",size:"sm",onClick:Le,disabled:be||Pe||G,children:[e.jsx(St,{className:W("mr-1.5 h-3.5 w-3.5",(be||Pe||G)&&"animate-spin"),"aria-hidden":!0}),r("skills.action.refresh")]})]}),e.jsx("div",{className:"mb-5 flex gap-6 border-b border-oai-gray-200 dark:border-oai-gray-800",children:[["my",r("skills.tab.my")],["browse",r("skills.tab.browse")]].map(([t,i])=>e.jsx("button",{type:"button","aria-pressed":a===t,onClick:()=>s(t),className:W("-mb-px border-b-2 pb-2 text-sm font-medium transition-colors",a===t?"border-oai-black text-oai-black dark:border-white dark:text-white":"border-transparent text-oai-gray-500 hover:text-oai-black dark:text-oai-gray-400 dark:hover:text-white"),children:i},t))}),Fe?e.jsx("div",{className:"mb-4 rounded-lg border border-red-200 bg-red-50 px-4 py-3 text-sm text-red-700 dark:border-red-900/60 dark:bg-red-950/30 dark:text-red-200",children:Fe}):null,a==="browse"?e.jsxs("div",{className:"mb-5 flex flex-col gap-3 sm:flex-row sm:items-center",children:[e.jsx("div",{role:"tablist","aria-label":r("skills.source.label"),className:"inline-flex h-10 shrink-0 items-center rounded-md border border-oai-gray-200 bg-oai-white p-1 dark:border-oai-gray-800 dark:bg-oai-gray-900",children:[["repo",r("skills.mode.repo"),o!==M&&o!==O],["popular",r("skills.mode.popular"),o===O],["skillssh",r("skills.mode.skillssh"),o===M]].map(([t,i,d])=>e.jsxs("button",{type:"button",role:"tab","aria-selected":d,onClick:()=>{t==="skillssh"?k(M):t==="popular"?k(O):(o===M||o===O)&&k(xe)},className:W("inline-flex items-center gap-1.5 rounded px-3 py-1 text-sm font-medium transition-colors",d?"bg-oai-gray-100 text-oai-black dark:bg-oai-gray-700 dark:text-white":"text-oai-gray-500 hover:text-oai-gray-800 dark:text-oai-gray-400 dark:hover:text-oai-gray-200"),children:[t==="popular"?e.jsx(tr,{className:"h-3.5 w-3.5","aria-hidden":!0}):null,i]},t))}),o!==M&&o!==O?e.jsxs(Ma,{value:o,onValueChange:k,children:[e.jsxs(Ba,{"aria-label":r("skills.source.label"),className:"inline-flex h-10 w-44 shrink-0 items-center justify-between gap-2 rounded-md border border-oai-gray-200 bg-oai-white px-3 text-sm text-oai-black focus:outline-none data-[popup-open]:border-oai-gray-300 dark:border-oai-gray-800 dark:bg-oai-gray-900 dark:text-white dark:data-[popup-open]:border-oai-gray-700",children:[e.jsx(Ta,{children:t=>t===xe?r("skills.source.all"):t}),e.jsx(Ka,{className:"text-oai-gray-400",children:e.jsx(ma,{className:"h-4 w-4","aria-hidden":!0})})]}),e.jsx(Oa,{children:e.jsx(Ua,{sideOffset:4,alignItemWithTrigger:!1,className:"z-[60]",children:e.jsxs(za,{className:"min-w-[var(--anchor-width)] overflow-hidden rounded-md border border-oai-gray-200 bg-white p-1 shadow-[0_12px_32px_-12px_rgba(0,0,0,0.18)] outline-none transition-[opacity,transform] duration-150 ease-out data-[ending-style]:scale-[0.97] data-[ending-style]:opacity-0 data-[starting-style]:scale-[0.97] data-[starting-style]:opacity-0 dark:border-oai-gray-800 dark:bg-oai-gray-950 dark:shadow-[0_12px_32px_-12px_rgba(0,0,0,0.6)]",children:[e.jsxs(Ye,{value:xe,className:"flex cursor-default select-none items-center justify-between gap-2 rounded px-3 py-1.5 text-sm text-oai-black outline-none data-[highlighted]:bg-oai-gray-100 dark:text-white dark:data-[highlighted]:bg-oai-gray-800",children:[e.jsx(Je,{children:r("skills.source.all")}),e.jsx(Ze,{children:e.jsx(_e,{className:"h-3.5 w-3.5","aria-hidden":!0})})]}),x.map(t=>{const i=`${t.owner}/${t.name}`;return e.jsxs(Ye,{value:i,className:"flex cursor-default select-none items-center justify-between gap-2 rounded px-3 py-1.5 text-sm text-oai-black outline-none data-[highlighted]:bg-oai-gray-100 dark:text-white dark:data-[highlighted]:bg-oai-gray-800",children:[e.jsx(Je,{children:i}),e.jsx(Ze,{children:e.jsx(_e,{className:"h-3.5 w-3.5","aria-hidden":!0})})]},i)})]})})})]}):null,e.jsxs("div",{className:"relative flex-1",children:[e.jsx(ca,{className:"pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-oai-gray-400","aria-hidden":!0}),e.jsx(ha,{type:"search",value:C,onChange:t=>w(t.target.value),onKeyDown:t=>{t.key==="Enter"&&o===M&&b()},"aria-label":r("skills.action.search_aria"),placeholder:o===M?r("skills.browse.placeholder_skillssh"):o===O?r("skills.browse.placeholder_popular"):o===xe?r("skills.browse.placeholder_all"):r("skills.browse.placeholder_repo",{repo:o}),className:"pl-9 !border-oai-gray-200 dark:!border-oai-gray-800 focus:!border-oai-gray-400 focus:!ring-oai-gray-400/20 dark:focus:!border-oai-gray-500 dark:focus:!ring-oai-gray-500/20"})]}),o===M?e.jsxs(U,{type:"button",onClick:b,disabled:C.trim().length<2||A==="search",className:"focus:!ring-oai-gray-400/30",children:[A==="search"?e.jsx(ae,{className:"mr-1.5 h-4 w-4 animate-spin","aria-hidden":!0}):e.jsx(ca,{className:"mr-1.5 h-4 w-4","aria-hidden":!0}),r("skills.action.search")]}):o===O?null:e.jsxs(U,{type:"button",variant:"secondary",size:"sm",onClick:()=>te(t=>!t),"aria-expanded":j,className:"!h-10 shrink-0 whitespace-nowrap !border-oai-gray-200 dark:!border-oai-gray-800 hover:!border-oai-gray-300 dark:hover:!border-oai-gray-700 hover:!text-oai-black dark:hover:!text-white focus:!ring-oai-gray-400/30",children:[e.jsx(Va,{className:"mr-1.5 h-3.5 w-3.5","aria-hidden":!0}),r("skills.browse.manage_sources"),e.jsx("span",{className:"ml-1.5 rounded bg-oai-gray-100 px-1.5 py-0.5 text-xs font-medium text-oai-gray-600 dark:bg-oai-gray-800 dark:text-oai-gray-300",children:x.length})]})]}):null,Ge,e.jsx(Cr,{skill:ee,targets:R,busyKey:A,usage:ee&&(Z[String(ee.directory||"").toLowerCase()]||Z[String(ee.name||"").toLowerCase()])||null,hasUpdate:!!(ee?.id&&ne?.[ee.id]),updating:ee?A===Qe(ee):!1,onUpdate:ia,onClose:Ja,onToggleTarget:Ke,onRemove:ta})]})}),e.jsx(Na,{open:!!se,title:r("skills.confirm.remove_title",{name:se?.name||se?.directory||""}),description:se?se.managed?r("skills.confirm.remove_managed"):r("skills.confirm.remove_local"):"",confirmLabel:r("skills.action.remove"),cancelLabel:r("shared.action.cancel"),destructive:!0,busy:A===Sa(se||{}),onCancel:()=>Re(null),onConfirm:le}),e.jsx(Na,{open:!!Y,title:r("skills.confirm.bulk_remove_title",{count:Y?.length||0}),description:r("skills.confirm.bulk_remove_desc"),confirmLabel:r("skills.action.remove"),cancelLabel:r("shared.action.cancel"),destructive:!0,busy:A==="batch",onCancel:()=>ke(null),onConfirm:sa})]})}export{Xr as SkillsPage};