@eveshipfit/ui-ingame 1.14.0 → 1.15.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 (3) hide show
  1. package/dist/index.mjs +1138 -564
  2. package/dist/style.css +94 -0
  3. package/package.json +3 -3
package/dist/index.mjs CHANGED
@@ -2,7 +2,7 @@ import './style.css';
2
2
  import { c } from "react/compiler-runtime";
3
3
  import { Activity, Fragment, createContext, useContext, useDeferredValue, useEffect, useEffectEvent, useId, useLayoutEffect, useRef, useState } from "react";
4
4
  import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
5
- import { UNIFORM, formatAttribute, formatClock, formatDuration, formatNumber, useAttribute, useAttributeTooltip, useBayContents, useBayUsage, useBoosters, useBrowse, useCanFit, useChargeSearch, useChargeTree, useChargedModules, useCharges, useDamageProfiles, useDrag, useDroneRoom, useEngine, useFighterTubeUsage, useFighterTubes, useFit, useFitHistory, useFitPrice, useFitStore, useHardpoints, useHasRoom, useHullRefuses, useHullTree, useImages, useImplantSearch, useImplantTree, useImplants, useInfo, useLocalFits, useMissingSkills, useModes, useModuleSearch, useModuleTree, useMutate, usePersonalFits, usePlacement, usePreview, useRackUsage, useRefusal, useSde, useShowInfo, useShownSnapshot, useSlots, useSnapshot, useStats, useType, useTypeBonuses, useTypePrice } from "@eveshipfit/react-hooks";
5
+ import { UNIFORM, canSaveFits, formatAttribute, formatClock, formatDuration, formatNumber, useAttribute, useAttributeTooltip, useBayContents, useBayUsage, useBoosters, useBrowse, useCanFit, useCharacters, useChargeSearch, useChargeTree, useChargedModules, useCharges, useDamageProfiles, useDrag, useDroneRoom, useEngine, useFighterTubeUsage, useFighterTubes, useFit, useFitHistory, useFitPrice, useFitSaving, useFitStore, useHardpoints, useHasRoom, useHullRefuses, useHullTree, useImages, useImplantSearch, useImplantTree, useImplants, useInfo, useLocalFits, useMissingSkills, useModes, useModuleSearch, useModuleTree, useMutate, usePersonalFits, usePlacement, usePreview, useRackUsage, useRefusal, useSde, useShowInfo, useShownSnapshot, useSlots, useSnapshot, useStats, useType, useTypeBonuses, useTypePrice } from "@eveshipfit/react-hooks";
6
6
  import { baseValue, canMutate, clampToRange, mutaplasmidsOf, mutatedDronesOf, mutationRanges, mutationRollOf, parseItemLink, parseMutationText, rollFits, rollMutation, squadronSize, tubeTakes, withMutaplasmid } from "@eveshipfit/fitting";
7
7
  // src/primitives/Dialog/Dialog.module.css
8
8
  var Dialog_module_default = {
@@ -978,7 +978,7 @@ function SlotPress(t0) {
978
978
  className,
979
979
  "aria-label": label,
980
980
  onClick: onPress,
981
- onKeyDown: _temp$24
981
+ onKeyDown: _temp$25
982
982
  });
983
983
  $[0] = className;
984
984
  $[1] = label;
@@ -987,7 +987,7 @@ function SlotPress(t0) {
987
987
  } else t1 = $[3];
988
988
  return t1;
989
989
  }
990
- function _temp$24(event) {
990
+ function _temp$25(event) {
991
991
  if (event.key !== "Enter" && event.key !== " ") return;
992
992
  event.preventDefault();
993
993
  event.currentTarget.dispatchEvent(new MouseEvent("click", {
@@ -1403,7 +1403,7 @@ function useDecoded(src) {
1403
1403
  image.decode().then(() => {
1404
1404
  decoded.add(src);
1405
1405
  setReady(src);
1406
- }, _temp$23);
1406
+ }, _temp$24);
1407
1407
  };
1408
1408
  t1 = [src];
1409
1409
  $[0] = src;
@@ -1423,7 +1423,7 @@ function useDecoded(src) {
1423
1423
  } else t2 = $[5];
1424
1424
  return t2;
1425
1425
  }
1426
- function _temp$23() {}
1426
+ function _temp$24() {}
1427
1427
  function WheelGauge(t0) {
1428
1428
  const $ = c(15);
1429
1429
  const { resource, used, total, valueText } = t0;
@@ -1898,19 +1898,19 @@ function Menu(t0) {
1898
1898
  role: "menu",
1899
1899
  tabIndex: -1,
1900
1900
  onToggle: t4,
1901
- onKeyDown: _temp$22,
1901
+ onKeyDown: _temp$23,
1902
1902
  onClick: stopped,
1903
1903
  onDoubleClick: stopped,
1904
1904
  onPointerDown: stopped,
1905
1905
  onMouseDown: stopped,
1906
- onContextMenu: _temp2$11,
1906
+ onContextMenu: _temp2$12,
1907
1907
  children: opened.entries.map((entry, index) => entry === "separator" ? /* @__PURE__ */ jsx("hr", { className: ContextMenu_module_default.separator }, index) : /* @__PURE__ */ jsxs("button", {
1908
1908
  type: "button",
1909
1909
  role: "menuitem",
1910
1910
  tabIndex: -1,
1911
1911
  disabled: entry.disabled,
1912
1912
  onClick: () => select(entry),
1913
- onPointerMove: _temp3$6,
1913
+ onPointerMove: _temp3$5,
1914
1914
  children: [/* @__PURE__ */ jsx("span", {
1915
1915
  className: ContextMenu_module_default.icon,
1916
1916
  children: entry.icon && /* @__PURE__ */ jsx(Icon, { name: entry.icon })
@@ -1923,14 +1923,14 @@ function Menu(t0) {
1923
1923
  } else t3 = $[7];
1924
1924
  return t3;
1925
1925
  }
1926
- function _temp3$6(event_2) {
1926
+ function _temp3$5(event_2) {
1927
1927
  return event_2.currentTarget.focus();
1928
1928
  }
1929
- function _temp2$11(event_1) {
1929
+ function _temp2$12(event_1) {
1930
1930
  event_1.preventDefault();
1931
1931
  event_1.stopPropagation();
1932
1932
  }
1933
- function _temp$22(event_0) {
1933
+ function _temp$23(event_0) {
1934
1934
  event_0.stopPropagation();
1935
1935
  walk(event_0);
1936
1936
  }
@@ -2828,7 +2828,7 @@ function SensorStrengths(t0) {
2828
2828
  if ($[0] !== strengths) {
2829
2829
  t4 = Symbol.for("react.early_return_sentinel");
2830
2830
  bb0: {
2831
- const shown = strengths.filter(_temp$21);
2831
+ const shown = strengths.filter(_temp$22);
2832
2832
  if (shown.length === 0) {
2833
2833
  t4 = null;
2834
2834
  break bb0;
@@ -2836,7 +2836,7 @@ function SensorStrengths(t0) {
2836
2836
  T0 = Attribute;
2837
2837
  t3 = "ECMResistance";
2838
2838
  t1 = ModuleTooltip_module_default.block;
2839
- t2 = shown.map(_temp2$10);
2839
+ t2 = shown.map(_temp2$11);
2840
2840
  }
2841
2841
  $[0] = strengths;
2842
2842
  $[1] = T0;
@@ -2876,14 +2876,14 @@ function SensorStrengths(t0) {
2876
2876
  return t6;
2877
2877
  }
2878
2878
  /** The four ECM jammer strengths, like "5.8 Gravimetric ECM Jammer Strength". */
2879
- function _temp2$10(strength) {
2879
+ function _temp2$11(strength) {
2880
2880
  return /* @__PURE__ */ jsxs("span", { children: [
2881
2881
  strength.text,
2882
2882
  " ",
2883
2883
  strength.displayName
2884
2884
  ] }, strength.name);
2885
2885
  }
2886
- function _temp$21(t0) {
2886
+ function _temp$22(t0) {
2887
2887
  const { value } = t0;
2888
2888
  return value;
2889
2889
  }
@@ -2930,14 +2930,14 @@ function Cloak(t0) {
2930
2930
  itemRef,
2931
2931
  name: "maxVelocityModifier",
2932
2932
  decimals: 0,
2933
- format: _temp$20
2933
+ format: _temp$21
2934
2934
  });
2935
2935
  $[0] = itemRef;
2936
2936
  $[1] = t1;
2937
2937
  } else t1 = $[1];
2938
2938
  return t1;
2939
2939
  }
2940
- function _temp$20(value, format) {
2940
+ function _temp$21(value, format) {
2941
2941
  return percent$1((value - 1) * 100, format);
2942
2942
  }
2943
2943
  // src/components/FittingWheel/ModuleLines/CommandBonus.tsx
@@ -3671,7 +3671,7 @@ function Resistance$1(t0) {
3671
3671
  const t1 = useLayers(itemRef);
3672
3672
  let t2;
3673
3673
  if ($[0] !== t1) {
3674
- const layers = t1.filter(_temp2$9);
3674
+ const layers = t1.filter(_temp2$10);
3675
3675
  t2 = layers.map((layer) => /* @__PURE__ */ jsx(Layer, {
3676
3676
  ...layer,
3677
3677
  withIcon: layers.length > 1
@@ -3682,11 +3682,11 @@ function Resistance$1(t0) {
3682
3682
  return t2;
3683
3683
  }
3684
3684
  /** The resistances a module gives, for every layer. */
3685
- function _temp2$9(t0) {
3685
+ function _temp2$10(t0) {
3686
3686
  const { resistances } = t0;
3687
- return resistances.some(_temp$19);
3687
+ return resistances.some(_temp$20);
3688
3688
  }
3689
- function _temp$19(t0) {
3689
+ function _temp$20(t0) {
3690
3690
  const { value } = t0;
3691
3691
  return value !== 1;
3692
3692
  }
@@ -3696,13 +3696,13 @@ function DamageControl(t0) {
3696
3696
  const t1 = useLayers(itemRef);
3697
3697
  let t2;
3698
3698
  if ($[0] !== t1) {
3699
- t2 = t1.map(_temp3$5);
3699
+ t2 = t1.map(_temp3$4);
3700
3700
  $[0] = t1;
3701
3701
  $[1] = t2;
3702
3702
  } else t2 = $[1];
3703
3703
  return t2;
3704
3704
  }
3705
- function _temp3$5(layer) {
3705
+ function _temp3$4(layer) {
3706
3706
  return /* @__PURE__ */ jsx(Layer, {
3707
3707
  ...layer,
3708
3708
  withIcon: true
@@ -3893,7 +3893,7 @@ function ResistanceBonus(t0) {
3893
3893
  t3,
3894
3894
  t4,
3895
3895
  t5
3896
- ].filter(_temp$18);
3896
+ ].filter(_temp$19);
3897
3897
  const [first] = bonuses;
3898
3898
  if (first === void 0) {
3899
3899
  t6 = null;
@@ -3928,7 +3928,7 @@ function ResistanceBonus(t0) {
3928
3928
  className: ModuleTooltip_module_default.block,
3929
3929
  children: ["Resistance Bonus:", /* @__PURE__ */ jsx("span", {
3930
3930
  className: ModuleTooltip_module_default.bonuses,
3931
- children: bonuses.map(_temp2$8)
3931
+ children: bonuses.map(_temp2$9)
3932
3932
  })]
3933
3933
  });
3934
3934
  $[7] = bonuses;
@@ -3936,14 +3936,14 @@ function ResistanceBonus(t0) {
3936
3936
  } else t7 = $[8];
3937
3937
  return t7;
3938
3938
  }
3939
- function _temp2$8(t0) {
3939
+ function _temp2$9(t0) {
3940
3940
  const { name, text } = t0;
3941
3941
  return /* @__PURE__ */ jsx(Bonus, {
3942
3942
  name,
3943
3943
  text
3944
3944
  }, name);
3945
3945
  }
3946
- function _temp$18(bonus) {
3946
+ function _temp$19(bonus) {
3947
3947
  return bonus.value;
3948
3948
  }
3949
3949
  // src/components/FittingWheel/ModuleLines/SensorBooster.tsx
@@ -4044,14 +4044,14 @@ function SignatureSuppressor(t0) {
4044
4044
  itemRef,
4045
4045
  name: "signatureSuppressorSignatureRadiusBonusPassive",
4046
4046
  decimals: 0,
4047
- format: _temp$17
4047
+ format: _temp$18
4048
4048
  });
4049
4049
  $[0] = itemRef;
4050
4050
  $[1] = t1;
4051
4051
  } else t1 = $[1];
4052
4052
  return t1;
4053
4053
  }
4054
- function _temp$17(value, format) {
4054
+ function _temp$18(value, format) {
4055
4055
  return percent$1((1 - value) * 100, format);
4056
4056
  }
4057
4057
  // src/components/FittingWheel/ModuleLines/Smartbomb.tsx
@@ -4152,7 +4152,7 @@ function StasisWebifier(props) {
4152
4152
  t0 = {
4153
4153
  of: props.itemRef,
4154
4154
  decimals: 0,
4155
- format: _temp$16
4155
+ format: _temp$17
4156
4156
  };
4157
4157
  $[0] = props.itemRef;
4158
4158
  $[1] = t0;
@@ -4182,7 +4182,7 @@ function StasisWebifier(props) {
4182
4182
  } else t3 = $[8];
4183
4183
  return t3;
4184
4184
  }
4185
- function _temp$16(value, format) {
4185
+ function _temp$17(value, format) {
4186
4186
  return percent$1(-value, format);
4187
4187
  }
4188
4188
  // src/components/FittingWheel/ModuleLines/TrackingComputer.tsx
@@ -5212,7 +5212,7 @@ function FittingAugmentations(t0) {
5212
5212
  const boosters = useBoosters();
5213
5213
  let t1;
5214
5214
  if ($[0] !== implants || $[1] !== readOnly) {
5215
- t1 = !readOnly || implants.some(_temp$15);
5215
+ t1 = !readOnly || implants.some(_temp$16);
5216
5216
  $[0] = implants;
5217
5217
  $[1] = readOnly;
5218
5218
  $[2] = t1;
@@ -5267,7 +5267,7 @@ function FittingAugmentations(t0) {
5267
5267
  } else t5 = $[15];
5268
5268
  return t5;
5269
5269
  }
5270
- function _temp$15(slot) {
5270
+ function _temp$16(slot) {
5271
5271
  return slot.item !== void 0;
5272
5272
  }
5273
5273
  function FittingAugmentation(t0) {
@@ -5719,9 +5719,9 @@ function FittingCentre() {
5719
5719
  })
5720
5720
  },
5721
5721
  "separator",
5722
- fit.items.some(_temp$14) && {
5722
+ fit.items.some(_temp$15) && {
5723
5723
  label: "Strip Fitting",
5724
- onSelect: () => store.remove(...store.getSnapshot().fit.items.flatMap(_temp2$7))
5724
+ onSelect: () => store.remove(...store.getSnapshot().fit.items.flatMap(_temp2$8))
5725
5725
  }
5726
5726
  ]);
5727
5727
  };
@@ -5813,10 +5813,10 @@ function FittingCentre() {
5813
5813
  } else t8 = $[43];
5814
5814
  return t8;
5815
5815
  }
5816
- function _temp2$7(item_0, ref) {
5816
+ function _temp2$8(item_0, ref) {
5817
5817
  return keptOnStrip.has(item_0.slot.type) ? [] : [ref];
5818
5818
  }
5819
- function _temp$14(item_1) {
5819
+ function _temp$15(item_1) {
5820
5820
  return !keptOnStrip.has(item_1.slot.type);
5821
5821
  }
5822
5822
  const copiedRacks = [
@@ -5930,7 +5930,7 @@ function FittingModes(t0) {
5930
5930
  if (modes.length === 0) return null;
5931
5931
  let t1;
5932
5932
  if ($[0] !== modes) {
5933
- t1 = modes.map(_temp3$4);
5933
+ t1 = modes.map(_temp3$3);
5934
5934
  $[0] = modes;
5935
5935
  $[1] = t1;
5936
5936
  } else t1 = $[1];
@@ -5955,7 +5955,7 @@ function FittingModes(t0) {
5955
5955
  } else t3 = $[8];
5956
5956
  return t3;
5957
5957
  }
5958
- function _temp3$4(t0) {
5958
+ function _temp3$3(t0) {
5959
5959
  const { id, name } = t0;
5960
5960
  return {
5961
5961
  typeId: id,
@@ -6139,11 +6139,20 @@ var ItemBrowser_module_default = {
6139
6139
  "info": "xFSZwa_info",
6140
6140
  "kind": "xFSZwa_kind",
6141
6141
  "menu": "xFSZwa_menu",
6142
+ "menuRule": "xFSZwa_menuRule",
6142
6143
  "panel": "xFSZwa_panel",
6144
+ "saveAnchor": "xFSZwa_saveAnchor",
6145
+ "saveArrow": "xFSZwa_saveArrow",
6146
+ "saveMain": "xFSZwa_saveMain",
6147
+ "saveMenu": "xFSZwa_saveMenu",
6148
+ "saveName": "xFSZwa_saveName",
6149
+ "saveNote": "xFSZwa_saveNote",
6150
+ "saveUpgrade": "xFSZwa_saveUpgrade",
6143
6151
  "search": "xFSZwa_search",
6144
6152
  "simulate": "xFSZwa_simulate",
6145
6153
  "tab": "xFSZwa_tab",
6146
6154
  "tabs": "xFSZwa_tabs",
6155
+ "tick": "xFSZwa_tick",
6147
6156
  "tree": "xFSZwa_tree",
6148
6157
  "unseen": "xFSZwa_unseen",
6149
6158
  "views": "xFSZwa_views"
@@ -6283,7 +6292,7 @@ function CopyForm(t0) {
6283
6292
  rows,
6284
6293
  readOnly: true,
6285
6294
  value: text,
6286
- onFocus: _temp$13
6295
+ onFocus: _temp$14
6287
6296
  });
6288
6297
  $[3] = id;
6289
6298
  $[4] = rows;
@@ -6302,7 +6311,7 @@ function CopyForm(t0) {
6302
6311
  } else t3 = $[9];
6303
6312
  return t3;
6304
6313
  }
6305
- function _temp$13(event) {
6314
+ function _temp$14(event) {
6306
6315
  return event.currentTarget.select();
6307
6316
  }
6308
6317
  // src/components/ItemInfo/anchoredCard.ts
@@ -6798,7 +6807,7 @@ function Variations(t0) {
6798
6807
  const swapper = t6;
6799
6808
  let t7;
6800
6809
  if ($[18] !== anchor || $[19] !== sde || $[20] !== show || $[21] !== swapper || $[22] !== target.typeId || $[23] !== variations) {
6801
- const groups = Map.groupBy(variations, _temp$12);
6810
+ const groups = Map.groupBy(variations, _temp$13);
6802
6811
  t7 = /* @__PURE__ */ jsx("ul", {
6803
6812
  className: ItemInfo_module_default.list,
6804
6813
  children: [...groups].map((t8) => {
@@ -6831,7 +6840,7 @@ function Variations(t0) {
6831
6840
  } else t7 = $[24];
6832
6841
  return t7;
6833
6842
  }
6834
- function _temp$12(type_0) {
6843
+ function _temp$13(type_0) {
6835
6844
  return type_0.metaGroupId;
6836
6845
  }
6837
6846
  function Variation(t0) {
@@ -7113,7 +7122,7 @@ function MutaplasmidPicker(t0) {
7113
7122
  tabIndex: -1,
7114
7123
  "data-active": mutaplasmid_0.id === active || void 0,
7115
7124
  onFocus: () => setActive(mutaplasmid_0.id),
7116
- onPointerMove: _temp$11,
7125
+ onPointerMove: _temp$12,
7117
7126
  onClick: () => choose(mutaplasmid_0.id),
7118
7127
  children: names[index_0]
7119
7128
  }, mutaplasmid_0.id))
@@ -7138,7 +7147,7 @@ function MutaplasmidPicker(t0) {
7138
7147
  } else t15 = $[24];
7139
7148
  return t15;
7140
7149
  }
7141
- function _temp$11(event_2) {
7150
+ function _temp$12(event_2) {
7142
7151
  return event_2.currentTarget.focus();
7143
7152
  }
7144
7153
  /** Each stat's range under one mutaplasmid, the widest one's behind it, and the roll. */
@@ -7161,7 +7170,7 @@ function RangeChart(t0) {
7161
7170
  if ($[7] !== rangesOf) {
7162
7171
  t3 = (t4) => {
7163
7172
  const { id } = t4;
7164
- return rangesOf(id).flatMap(_temp2$6);
7173
+ return rangesOf(id).flatMap(_temp2$7);
7165
7174
  };
7166
7175
  $[7] = rangesOf;
7167
7176
  $[8] = t3;
@@ -7192,7 +7201,7 @@ function RangeChart(t0) {
7192
7201
  let t7;
7193
7202
  if ($[12] !== at || $[13] !== mutaplasmids || $[14] !== names || $[15] !== rangesOf || $[16] !== roll.attributes || $[17] !== sde || $[18] !== shown) {
7194
7203
  const widest = mutaplasmids.at(-1)?.id ?? shown;
7195
- const behind = new Map(rangesOf(widest).map(_temp3$3));
7204
+ const behind = new Map(rangesOf(widest).map(_temp3$2));
7196
7205
  let t8;
7197
7206
  if ($[23] !== mutaplasmids || $[24] !== names) {
7198
7207
  t8 = (mutaplasmidId) => names[mutaplasmids.findIndex((t9) => {
@@ -7338,10 +7347,10 @@ function RangeChart(t0) {
7338
7347
  } else t14 = $[48];
7339
7348
  return t14;
7340
7349
  }
7341
- function _temp3$3(range_0) {
7350
+ function _temp3$2(range_0) {
7342
7351
  return [range_0.attributeId, range_0];
7343
7352
  }
7344
- function _temp2$6(range) {
7353
+ function _temp2$7(range) {
7345
7354
  return [ratio(range, range.min), ratio(range, range.max)];
7346
7355
  }
7347
7356
  function percent(value) {
@@ -7536,7 +7545,7 @@ function DronesCard(t0) {
7536
7545
  let t7;
7537
7546
  let t8;
7538
7547
  if ($[1] !== active || $[2] !== base || $[3] !== rolls || $[4] !== sde || $[5] !== shown || $[6] !== store || $[7] !== typeId || $[8] !== unselected) {
7539
- const all = rolls.map(_temp$10);
7548
+ const all = rolls.map(_temp$11);
7540
7549
  let t9;
7541
7550
  if ($[16] !== unselected) {
7542
7551
  t9 = (index_0) => !unselected.has(index_0);
@@ -7617,7 +7626,7 @@ function DronesCard(t0) {
7617
7626
  } else t9 = $[26];
7618
7627
  return t9;
7619
7628
  }
7620
- function _temp$10(_, index) {
7629
+ function _temp$11(_, index) {
7621
7630
  return index;
7622
7631
  }
7623
7632
  /** One drone of a row, with how it rolled the stat that matters most. */
@@ -8435,7 +8444,7 @@ function ShipBonuses(t0) {
8435
8444
  title: "Misc bonus:",
8436
8445
  bonuses: bonuses?.misc ?? []
8437
8446
  }
8438
- ].filter(_temp$9);
8447
+ ].filter(_temp$10);
8439
8448
  let t2;
8440
8449
  if ($[6] !== sde || $[7] !== typeId) {
8441
8450
  t2 = sde.type(typeId)?.name;
@@ -8471,7 +8480,7 @@ function ShipBonuses(t0) {
8471
8480
  } else t1 = $[5];
8472
8481
  return t1;
8473
8482
  }
8474
- function _temp$9(section) {
8483
+ function _temp$10(section) {
8475
8484
  return section.bonuses.length > 0;
8476
8485
  }
8477
8486
  function formatBonus(sde, bonus) {
@@ -8921,7 +8930,7 @@ function FighterTooltip(t0) {
8921
8930
  } else t7 = $[10];
8922
8931
  let t8;
8923
8932
  if ($[11] !== itemRef || $[12] !== quantity || $[13] !== type?.fighterAbilities) {
8924
- t8 = type?.fighterAbilities.filter(_temp$8).map((ability) => /* @__PURE__ */ jsx(AbilityLines, {
8933
+ t8 = type?.fighterAbilities.filter(_temp$9).map((ability) => /* @__PURE__ */ jsx(AbilityLines, {
8925
8934
  itemRef,
8926
8935
  ability,
8927
8936
  quantity
@@ -8979,7 +8988,7 @@ function FighterTooltip(t0) {
8979
8988
  } else t12 = $[26];
8980
8989
  return t12;
8981
8990
  }
8982
- function _temp$8(t0) {
8991
+ function _temp$9(t0) {
8983
8992
  const { slot } = t0;
8984
8993
  return slot !== 1;
8985
8994
  }
@@ -9352,8 +9361,8 @@ function BayContents(t0) {
9352
9361
  const maxActive = t1;
9353
9362
  let t2;
9354
9363
  if ($[2] !== contents || $[3] !== fighters || $[4] !== fit) {
9355
- const launched = fighters ? fit.items.flatMap(_temp$7) : [];
9356
- t2 = [...contents.flatMap(_temp2$5), ...launched];
9364
+ const launched = fighters ? fit.items.flatMap(_temp$8) : [];
9365
+ t2 = [...contents.flatMap(_temp2$6), ...launched];
9357
9366
  $[2] = contents;
9358
9367
  $[3] = fighters;
9359
9368
  $[4] = fit;
@@ -9560,11 +9569,11 @@ function BayContents(t0) {
9560
9569
  return t13;
9561
9570
  }
9562
9571
  /** One box per drone the character can launch. */
9563
- function _temp2$5(t0) {
9572
+ function _temp2$6(t0) {
9564
9573
  const { refs } = t0;
9565
9574
  return refs;
9566
9575
  }
9567
- function _temp$7(item, ref) {
9576
+ function _temp$8(item, ref) {
9568
9577
  return item.slot.type === "fighter_tube" ? [ref] : [];
9569
9578
  }
9570
9579
  function DroneSelection(t0) {
@@ -10294,7 +10303,7 @@ function FitName() {
10294
10303
  defaultValue: fit.name,
10295
10304
  placeholder: ship?.name,
10296
10305
  ref: input,
10297
- onFocus: _temp$6,
10306
+ onFocus: _temp$7,
10298
10307
  onBlur: (event_1) => rename(event_1.currentTarget.value),
10299
10308
  onKeyDown: (event_2) => {
10300
10309
  if (event_2.key === "Escape") event_2.currentTarget.value = fit.name ?? "";
@@ -10337,7 +10346,7 @@ function FitName() {
10337
10346
  } else t10 = $[27];
10338
10347
  return t10;
10339
10348
  }
10340
- function _temp$6(event_0) {
10349
+ function _temp$7(event_0) {
10341
10350
  return event_0.currentTarget.select();
10342
10351
  }
10343
10352
  function PreviewName() {
@@ -10409,7 +10418,7 @@ function Violations() {
10409
10418
  group: t2
10410
10419
  };
10411
10420
  const linesOf = (kind) => {
10412
- const violations = kind === "skill" ? missingSkills(stats.violations).map(_temp2$4) : stats.violations.filter((t5) => {
10421
+ const violations = kind === "skill" ? missingSkills(stats.violations).map(_temp2$5) : stats.violations.filter((t5) => {
10413
10422
  const { rule: rule_0 } = t5;
10414
10423
  return violationKind(rule_0) === kind;
10415
10424
  });
@@ -10432,7 +10441,7 @@ function Violations() {
10432
10441
  className: FittingWindow_module_default.alertTitle,
10433
10442
  children: title
10434
10443
  }),
10435
- description: lines.map(_temp3$2)
10444
+ description: lines.map(_temp3$1)
10436
10445
  })
10437
10446
  }),
10438
10447
  children: /* @__PURE__ */ jsxs("span", {
@@ -10478,13 +10487,13 @@ function Violations() {
10478
10487
  } else t5 = $[16];
10479
10488
  return t5;
10480
10489
  }
10481
- function _temp3$2(line) {
10490
+ function _temp3$1(line) {
10482
10491
  return /* @__PURE__ */ jsx("span", {
10483
10492
  className: FittingWindow_module_default.alertLine,
10484
10493
  children: line
10485
10494
  }, line);
10486
10495
  }
10487
- function _temp2$4(rule) {
10496
+ function _temp2$5(rule) {
10488
10497
  return {
10489
10498
  target: { type: "ship" },
10490
10499
  rule
@@ -11686,52 +11695,543 @@ function Charges(t0) {
11686
11695
  } else t12 = $[47];
11687
11696
  return t12;
11688
11697
  }
11698
+ // src/components/ItemBrowser/saveFit.tsx
11699
+ const MAX_ESI_NAME = 50;
11700
+ /** Saves a fit to where saves go, asking what it needs first; render `dialog` once. */
11701
+ function useSaveFit() {
11702
+ const $ = c(68);
11703
+ const engine = useEngine();
11704
+ let t0;
11705
+ if ($[0] !== engine) {
11706
+ t0 = (typeId) => engine.sde.type(typeId)?.name ?? String(typeId);
11707
+ $[0] = engine;
11708
+ $[1] = t0;
11709
+ } else t0 = $[1];
11710
+ const typeName = t0;
11711
+ const { characters, target, fits, pick, save: saveToTarget } = useFitSaving();
11712
+ const [asking, setAsking] = useState();
11713
+ const [notice, setNotice] = useState();
11714
+ const [saving, setSaving] = useState(false);
11715
+ let t1;
11716
+ if ($[2] !== saveToTarget || $[3] !== target) {
11717
+ t1 = (t2, t3) => {
11718
+ const { fit, onStart, onSaved } = t2;
11719
+ const replace = t3 === void 0 ? false : t3;
11720
+ setAsking(void 0);
11721
+ onStart?.(fit);
11722
+ if (target === void 0) {
11723
+ saveToTarget(fit);
11724
+ onSaved?.();
11725
+ return;
11726
+ }
11727
+ setSaving(true);
11728
+ saveToTarget(fit, replace).then(() => onSaved?.(), (error) => {
11729
+ console.error(error);
11730
+ setNotice("EVE did not save this fit. Please try again.");
11731
+ }).finally(() => setSaving(false));
11732
+ };
11733
+ $[2] = saveToTarget;
11734
+ $[3] = target;
11735
+ $[4] = t1;
11736
+ } else t1 = $[4];
11737
+ const finish = t1;
11738
+ let t2;
11739
+ if ($[5] !== engine || $[6] !== finish || $[7] !== fits || $[8] !== target) {
11740
+ t2 = (job) => {
11741
+ const existing = fits.find((one) => one.ship.type_id === job.fit.ship.type_id && one.name === job.fit.name);
11742
+ if (existing === void 0) return finish(job);
11743
+ if (target === void 0) {
11744
+ if (JSON.stringify(existing) === JSON.stringify(job.fit)) return finish(job);
11745
+ } else if (JSON.stringify(engine.saveEsiFitting(existing)) === JSON.stringify(engine.saveEsiFitting(job.fit))) {
11746
+ setAsking(void 0);
11747
+ job.onStart?.(job.fit);
11748
+ job.onSaved?.();
11749
+ return;
11750
+ }
11751
+ setAsking({
11752
+ kind: "replace",
11753
+ job
11754
+ });
11755
+ };
11756
+ $[5] = engine;
11757
+ $[6] = finish;
11758
+ $[7] = fits;
11759
+ $[8] = target;
11760
+ $[9] = t2;
11761
+ } else t2 = $[9];
11762
+ const askReplace = t2;
11763
+ let t3;
11764
+ if ($[10] !== askReplace || $[11] !== target || $[12] !== typeName) {
11765
+ t3 = (job_0) => {
11766
+ const modules = target === void 0 ? [] : job_0.fit.items.flatMap((t4) => {
11767
+ const { type_id, mutation } = t4;
11768
+ return mutation === void 0 ? [] : [`${typeName(type_id)} → ${typeName(mutation.base)}`];
11769
+ });
11770
+ if (modules.length > 0) setAsking({
11771
+ kind: "mutated",
11772
+ job: job_0,
11773
+ modules
11774
+ });
11775
+ else askReplace(job_0);
11776
+ };
11777
+ $[10] = askReplace;
11778
+ $[11] = target;
11779
+ $[12] = typeName;
11780
+ $[13] = t3;
11781
+ } else t3 = $[13];
11782
+ const askMutated = t3;
11783
+ let t4;
11784
+ if ($[14] !== askMutated || $[15] !== engine || $[16] !== saving || $[17] !== target) {
11785
+ t4 = (fit_0, callbacks) => {
11786
+ if (saving) return;
11787
+ if (target !== void 0 && engine.saveEsiFitting(fit_0).items.length === 0) {
11788
+ setNotice("EVE can't save an empty hull. Fit a module first.");
11789
+ return;
11790
+ }
11791
+ const job_1 = {
11792
+ fit: fit_0,
11793
+ ...callbacks
11794
+ };
11795
+ if (!fit_0.name || target !== void 0 && fit_0.name.length > MAX_ESI_NAME) setAsking({
11796
+ kind: "name",
11797
+ job: job_1
11798
+ });
11799
+ else askMutated(job_1);
11800
+ };
11801
+ $[14] = askMutated;
11802
+ $[15] = engine;
11803
+ $[16] = saving;
11804
+ $[17] = target;
11805
+ $[18] = t4;
11806
+ } else t4 = $[18];
11807
+ const save = t4;
11808
+ let t5;
11809
+ if ($[19] === Symbol.for("react.memo_cache_sentinel")) {
11810
+ t5 = () => setAsking(void 0);
11811
+ $[19] = t5;
11812
+ } else t5 = $[19];
11813
+ const close = t5;
11814
+ const name = asking?.job.fit.name;
11815
+ const t6 = asking?.kind === "name";
11816
+ let t7;
11817
+ if ($[20] !== askMutated || $[21] !== asking || $[22] !== target) {
11818
+ t7 = asking?.kind === "name" && /* @__PURE__ */ jsx(NameForm, {
11819
+ fit: asking.job.fit,
11820
+ maxLength: target === void 0 ? void 0 : MAX_ESI_NAME,
11821
+ onCancel: close,
11822
+ onSave: (named) => askMutated({
11823
+ ...asking.job,
11824
+ fit: named
11825
+ })
11826
+ });
11827
+ $[20] = askMutated;
11828
+ $[21] = asking;
11829
+ $[22] = target;
11830
+ $[23] = t7;
11831
+ } else t7 = $[23];
11832
+ let t8;
11833
+ if ($[24] !== t6 || $[25] !== t7) {
11834
+ t8 = /* @__PURE__ */ jsx(Dialog, {
11835
+ open: t6,
11836
+ title: "Save Fit",
11837
+ onClose: close,
11838
+ children: t7
11839
+ });
11840
+ $[24] = t6;
11841
+ $[25] = t7;
11842
+ $[26] = t8;
11843
+ } else t8 = $[26];
11844
+ const t9 = asking?.kind === "mutated";
11845
+ const t10 = asking?.kind === "mutated" ? asking.modules : void 0;
11846
+ let t11;
11847
+ if ($[27] !== askReplace || $[28] !== asking) {
11848
+ t11 = () => asking && askReplace(asking.job);
11849
+ $[27] = askReplace;
11850
+ $[28] = asking;
11851
+ $[29] = t11;
11852
+ } else t11 = $[29];
11853
+ let t12;
11854
+ if ($[30] !== t10 || $[31] !== t11) {
11855
+ t12 = /* @__PURE__ */ jsx(Confirm, {
11856
+ text: "EVE can't store mutated modules. These will be saved as their normal modules:",
11857
+ list: t10,
11858
+ action: "Save anyway",
11859
+ onCancel: close,
11860
+ onConfirm: t11
11861
+ });
11862
+ $[30] = t10;
11863
+ $[31] = t11;
11864
+ $[32] = t12;
11865
+ } else t12 = $[32];
11866
+ let t13;
11867
+ if ($[33] !== t12 || $[34] !== t9) {
11868
+ t13 = /* @__PURE__ */ jsx(Dialog, {
11869
+ open: t9,
11870
+ title: "Save to EVE?",
11871
+ onClose: close,
11872
+ children: t12
11873
+ });
11874
+ $[33] = t12;
11875
+ $[34] = t9;
11876
+ $[35] = t13;
11877
+ } else t13 = $[35];
11878
+ const t14 = asking?.kind === "replace";
11879
+ const t15 = target === void 0 ? "Overwrite Fit?" : "Replace Fit?";
11880
+ const t16 = target === void 0 ? `A fit named "${name}" is already saved for this hull. Overwrite it?` : `${target.name} already has a fit named "${name}" for this hull. Replace it?`;
11881
+ const t17 = target === void 0 ? "Overwrite" : "Replace";
11882
+ let t18;
11883
+ if ($[36] !== asking || $[37] !== finish) {
11884
+ t18 = () => asking && finish(asking.job, true);
11885
+ $[36] = asking;
11886
+ $[37] = finish;
11887
+ $[38] = t18;
11888
+ } else t18 = $[38];
11889
+ let t19;
11890
+ if ($[39] !== t16 || $[40] !== t17 || $[41] !== t18) {
11891
+ t19 = /* @__PURE__ */ jsx(Confirm, {
11892
+ text: t16,
11893
+ action: t17,
11894
+ onCancel: close,
11895
+ onConfirm: t18
11896
+ });
11897
+ $[39] = t16;
11898
+ $[40] = t17;
11899
+ $[41] = t18;
11900
+ $[42] = t19;
11901
+ } else t19 = $[42];
11902
+ let t20;
11903
+ if ($[43] !== t14 || $[44] !== t15 || $[45] !== t19) {
11904
+ t20 = /* @__PURE__ */ jsx(Dialog, {
11905
+ open: t14,
11906
+ title: t15,
11907
+ onClose: close,
11908
+ children: t19
11909
+ });
11910
+ $[43] = t14;
11911
+ $[44] = t15;
11912
+ $[45] = t19;
11913
+ $[46] = t20;
11914
+ } else t20 = $[46];
11915
+ const t21 = notice !== void 0;
11916
+ let t22;
11917
+ if ($[47] === Symbol.for("react.memo_cache_sentinel")) {
11918
+ t22 = () => setNotice(void 0);
11919
+ $[47] = t22;
11920
+ } else t22 = $[47];
11921
+ let t23;
11922
+ if ($[48] !== notice) {
11923
+ t23 = /* @__PURE__ */ jsx("p", { children: notice });
11924
+ $[48] = notice;
11925
+ $[49] = t23;
11926
+ } else t23 = $[49];
11927
+ let t24;
11928
+ if ($[50] === Symbol.for("react.memo_cache_sentinel")) {
11929
+ t24 = /* @__PURE__ */ jsx("div", {
11930
+ className: ItemBrowser_module_default.dialogButtons,
11931
+ children: /* @__PURE__ */ jsx("button", {
11932
+ type: "button",
11933
+ className: ItemBrowser_module_default.action,
11934
+ onClick: () => setNotice(void 0),
11935
+ children: "Close"
11936
+ })
11937
+ });
11938
+ $[50] = t24;
11939
+ } else t24 = $[50];
11940
+ let t25;
11941
+ if ($[51] !== t23) {
11942
+ t25 = /* @__PURE__ */ jsxs("div", {
11943
+ className: ItemBrowser_module_default.confirm,
11944
+ children: [t23, t24]
11945
+ });
11946
+ $[51] = t23;
11947
+ $[52] = t25;
11948
+ } else t25 = $[52];
11949
+ let t26;
11950
+ if ($[53] !== t21 || $[54] !== t25) {
11951
+ t26 = /* @__PURE__ */ jsx(Dialog, {
11952
+ open: t21,
11953
+ title: "Save to EVE",
11954
+ onClose: t22,
11955
+ children: t25
11956
+ });
11957
+ $[53] = t21;
11958
+ $[54] = t25;
11959
+ $[55] = t26;
11960
+ } else t26 = $[55];
11961
+ let t27;
11962
+ if ($[56] !== t13 || $[57] !== t20 || $[58] !== t26 || $[59] !== t8) {
11963
+ t27 = /* @__PURE__ */ jsxs(Fragment$1, { children: [
11964
+ t8,
11965
+ t13,
11966
+ t20,
11967
+ t26
11968
+ ] });
11969
+ $[56] = t13;
11970
+ $[57] = t20;
11971
+ $[58] = t26;
11972
+ $[59] = t8;
11973
+ $[60] = t27;
11974
+ } else t27 = $[60];
11975
+ let t28;
11976
+ if ($[61] !== characters || $[62] !== pick || $[63] !== save || $[64] !== saving || $[65] !== t27 || $[66] !== target) {
11977
+ t28 = {
11978
+ characters,
11979
+ target,
11980
+ pick,
11981
+ save,
11982
+ saving,
11983
+ dialog: t27
11984
+ };
11985
+ $[61] = characters;
11986
+ $[62] = pick;
11987
+ $[63] = save;
11988
+ $[64] = saving;
11989
+ $[65] = t27;
11990
+ $[66] = target;
11991
+ $[67] = t28;
11992
+ } else t28 = $[67];
11993
+ return t28;
11994
+ }
11995
+ function Confirm(t0) {
11996
+ const $ = c(16);
11997
+ const { text, list, action, onCancel, onConfirm } = t0;
11998
+ let t1;
11999
+ if ($[0] !== text) {
12000
+ t1 = /* @__PURE__ */ jsx("p", { children: text });
12001
+ $[0] = text;
12002
+ $[1] = t1;
12003
+ } else t1 = $[1];
12004
+ let t2;
12005
+ if ($[2] !== list) {
12006
+ t2 = list !== void 0 && /* @__PURE__ */ jsx("ul", { children: list.map(_temp$6) });
12007
+ $[2] = list;
12008
+ $[3] = t2;
12009
+ } else t2 = $[3];
12010
+ let t3;
12011
+ if ($[4] !== onCancel) {
12012
+ t3 = /* @__PURE__ */ jsx("button", {
12013
+ type: "button",
12014
+ className: ItemBrowser_module_default.action,
12015
+ onClick: onCancel,
12016
+ children: "Cancel"
12017
+ });
12018
+ $[4] = onCancel;
12019
+ $[5] = t3;
12020
+ } else t3 = $[5];
12021
+ let t4;
12022
+ if ($[6] !== action || $[7] !== onConfirm) {
12023
+ t4 = /* @__PURE__ */ jsx("button", {
12024
+ type: "button",
12025
+ className: ItemBrowser_module_default.action,
12026
+ onClick: onConfirm,
12027
+ children: action
12028
+ });
12029
+ $[6] = action;
12030
+ $[7] = onConfirm;
12031
+ $[8] = t4;
12032
+ } else t4 = $[8];
12033
+ let t5;
12034
+ if ($[9] !== t3 || $[10] !== t4) {
12035
+ t5 = /* @__PURE__ */ jsxs("div", {
12036
+ className: ItemBrowser_module_default.dialogButtons,
12037
+ children: [t3, t4]
12038
+ });
12039
+ $[9] = t3;
12040
+ $[10] = t4;
12041
+ $[11] = t5;
12042
+ } else t5 = $[11];
12043
+ let t6;
12044
+ if ($[12] !== t1 || $[13] !== t2 || $[14] !== t5) {
12045
+ t6 = /* @__PURE__ */ jsxs("div", {
12046
+ className: ItemBrowser_module_default.confirm,
12047
+ children: [
12048
+ t1,
12049
+ t2,
12050
+ t5
12051
+ ]
12052
+ });
12053
+ $[12] = t1;
12054
+ $[13] = t2;
12055
+ $[14] = t5;
12056
+ $[15] = t6;
12057
+ } else t6 = $[15];
12058
+ return t6;
12059
+ }
12060
+ function _temp$6(line, index) {
12061
+ return /* @__PURE__ */ jsx("li", { children: line }, index);
12062
+ }
12063
+ function NameForm(t0) {
12064
+ const $ = c(32);
12065
+ const { fit, maxLength, onCancel, onSave } = t0;
12066
+ const engine = useEngine();
12067
+ const id = useId();
12068
+ let t1;
12069
+ if ($[0] !== engine || $[1] !== fit.name || $[2] !== fit.ship) {
12070
+ t1 = () => fit.name || (engine.sde.type(fit.ship.type_id)?.name ?? "");
12071
+ $[0] = engine;
12072
+ $[1] = fit.name;
12073
+ $[2] = fit.ship;
12074
+ $[3] = t1;
12075
+ } else t1 = $[3];
12076
+ const [name, setName] = useState(t1);
12077
+ let t2;
12078
+ if ($[4] !== name) {
12079
+ t2 = name.trim();
12080
+ $[4] = name;
12081
+ $[5] = t2;
12082
+ } else t2 = $[5];
12083
+ const trimmed = t2;
12084
+ const tooLong = maxLength !== void 0 && trimmed.length > maxLength;
12085
+ let t3;
12086
+ if ($[6] !== fit || $[7] !== onSave || $[8] !== trimmed) {
12087
+ t3 = (event) => {
12088
+ event.preventDefault();
12089
+ onSave({
12090
+ ...fit,
12091
+ name: trimmed
12092
+ });
12093
+ };
12094
+ $[6] = fit;
12095
+ $[7] = onSave;
12096
+ $[8] = trimmed;
12097
+ $[9] = t3;
12098
+ } else t3 = $[9];
12099
+ let t4;
12100
+ if ($[10] !== id) {
12101
+ t4 = /* @__PURE__ */ jsx("label", {
12102
+ htmlFor: id,
12103
+ children: "Name this fit."
12104
+ });
12105
+ $[10] = id;
12106
+ $[11] = t4;
12107
+ } else t4 = $[11];
12108
+ let t5;
12109
+ if ($[12] === Symbol.for("react.memo_cache_sentinel")) {
12110
+ t5 = (event_1) => setName(event_1.target.value);
12111
+ $[12] = t5;
12112
+ } else t5 = $[12];
12113
+ let t6;
12114
+ if ($[13] !== id || $[14] !== name) {
12115
+ t6 = /* @__PURE__ */ jsx("input", {
12116
+ id,
12117
+ value: name,
12118
+ onFocus: _temp2$4,
12119
+ onChange: t5
12120
+ });
12121
+ $[13] = id;
12122
+ $[14] = name;
12123
+ $[15] = t6;
12124
+ } else t6 = $[15];
12125
+ let t7;
12126
+ if ($[16] !== maxLength || $[17] !== tooLong) {
12127
+ t7 = tooLong && /* @__PURE__ */ jsxs("p", {
12128
+ className: ItemBrowser_module_default.importError,
12129
+ role: "alert",
12130
+ children: [
12131
+ "EVE allows ",
12132
+ maxLength,
12133
+ " characters at most."
12134
+ ]
12135
+ });
12136
+ $[16] = maxLength;
12137
+ $[17] = tooLong;
12138
+ $[18] = t7;
12139
+ } else t7 = $[18];
12140
+ let t8;
12141
+ if ($[19] !== onCancel) {
12142
+ t8 = /* @__PURE__ */ jsx("button", {
12143
+ type: "button",
12144
+ className: ItemBrowser_module_default.action,
12145
+ onClick: onCancel,
12146
+ children: "Cancel"
12147
+ });
12148
+ $[19] = onCancel;
12149
+ $[20] = t8;
12150
+ } else t8 = $[20];
12151
+ const t9 = trimmed === "" || tooLong;
12152
+ let t10;
12153
+ if ($[21] !== t9) {
12154
+ t10 = /* @__PURE__ */ jsx("button", {
12155
+ type: "submit",
12156
+ className: ItemBrowser_module_default.action,
12157
+ disabled: t9,
12158
+ children: "Save"
12159
+ });
12160
+ $[21] = t9;
12161
+ $[22] = t10;
12162
+ } else t10 = $[22];
12163
+ let t11;
12164
+ if ($[23] !== t10 || $[24] !== t8) {
12165
+ t11 = /* @__PURE__ */ jsxs("div", {
12166
+ className: ItemBrowser_module_default.dialogButtons,
12167
+ children: [t8, t10]
12168
+ });
12169
+ $[23] = t10;
12170
+ $[24] = t8;
12171
+ $[25] = t11;
12172
+ } else t11 = $[25];
12173
+ let t12;
12174
+ if ($[26] !== t11 || $[27] !== t3 || $[28] !== t4 || $[29] !== t6 || $[30] !== t7) {
12175
+ t12 = /* @__PURE__ */ jsxs("form", {
12176
+ className: ItemBrowser_module_default.form,
12177
+ onSubmit: t3,
12178
+ children: [
12179
+ t4,
12180
+ t6,
12181
+ t7,
12182
+ t11
12183
+ ]
12184
+ });
12185
+ $[26] = t11;
12186
+ $[27] = t3;
12187
+ $[28] = t4;
12188
+ $[29] = t6;
12189
+ $[30] = t7;
12190
+ $[31] = t12;
12191
+ } else t12 = $[31];
12192
+ return t12;
12193
+ }
12194
+ function _temp2$4(event_0) {
12195
+ return event_0.currentTarget.select();
12196
+ }
11689
12197
  // src/components/ItemBrowser/FitActions.tsx
11690
12198
  /** The buttons under the `ItemBrowser`: save the fit in the browser, import one, or copy it out. */
11691
12199
  function FitActions(t0) {
11692
- const $ = c(80);
12200
+ const $ = c(56);
11693
12201
  const { noHullSelected, pasteToOpen } = t0;
11694
12202
  const engine = useEngine();
11695
12203
  const fit = useFit();
11696
12204
  const store = useFitStore();
11697
- const { fits, save } = useLocalFits();
11698
12205
  const menu = useId();
11699
12206
  const [saved, flashSaved] = useFlash();
11700
12207
  const [copied, flashCopied] = useFlash();
11701
12208
  const [importing, setImporting] = useState();
11702
- const [naming, setNaming] = useState(false);
11703
- const [overwriting, setOverwriting] = useState();
11704
12209
  const { copy: copyFit, dialog: copyDialog } = useCopyFit();
12210
+ const saver = useSaveFit();
12211
+ const [savedTo, setSavedTo] = useState("");
11705
12212
  let t1;
11706
- if ($[0] !== flashSaved || $[1] !== save || $[2] !== store) {
11707
- t1 = (named) => {
11708
- setOverwriting(void 0);
11709
- store.setName(named.name ?? "");
11710
- save(named);
11711
- flashSaved();
12213
+ if ($[0] !== fit || $[1] !== flashSaved || $[2] !== saver || $[3] !== store) {
12214
+ t1 = () => {
12215
+ const where = saver.target?.name ?? "browser";
12216
+ saver.save(fit, {
12217
+ onStart: (named) => store.setName(named.name ?? ""),
12218
+ onSaved: () => {
12219
+ setSavedTo(where);
12220
+ flashSaved();
12221
+ }
12222
+ });
11712
12223
  };
11713
- $[0] = flashSaved;
11714
- $[1] = save;
11715
- $[2] = store;
11716
- $[3] = t1;
11717
- } else t1 = $[3];
11718
- const saveNow = t1;
12224
+ $[0] = fit;
12225
+ $[1] = flashSaved;
12226
+ $[2] = saver;
12227
+ $[3] = store;
12228
+ $[4] = t1;
12229
+ } else t1 = $[4];
12230
+ const saveCurrent = t1;
11719
12231
  let t2;
11720
- if ($[4] !== fits || $[5] !== saveNow) {
11721
- t2 = (named_0) => {
11722
- const existing = fits.find((one) => one.ship.type_id === named_0.ship.type_id && one.name === named_0.name);
11723
- if (existing === void 0 || JSON.stringify(existing) === JSON.stringify(named_0)) saveNow(named_0);
11724
- else setOverwriting(named_0);
11725
- };
11726
- $[4] = fits;
11727
- $[5] = saveNow;
11728
- $[6] = t2;
11729
- } else t2 = $[6];
11730
- const trySave = t2;
11731
12232
  let t3;
11732
- let t4;
11733
- if ($[7] !== engine || $[8] !== noHullSelected || $[9] !== pasteToOpen || $[10] !== store) {
11734
- t3 = () => {
12233
+ if ($[5] !== engine || $[6] !== noHullSelected || $[7] !== pasteToOpen || $[8] !== store) {
12234
+ t2 = () => {
11735
12235
  if (!pasteToOpen) return;
11736
12236
  const onPaste = (event) => {
11737
12237
  if (event.defaultPrevented) return;
@@ -11759,8 +12259,8 @@ function FitActions(t0) {
11759
12259
  }
11760
12260
  try {
11761
12261
  store.replace(engine.loadText(text, store.character));
11762
- } catch (t5) {
11763
- const failure_0 = t5;
12262
+ } catch (t4) {
12263
+ const failure_0 = t4;
11764
12264
  setImporting({
11765
12265
  text,
11766
12266
  error: failure_0 instanceof Error ? failure_0.message : String(failure_0)
@@ -11770,416 +12270,427 @@ function FitActions(t0) {
11770
12270
  document.addEventListener("paste", onPaste);
11771
12271
  return () => document.removeEventListener("paste", onPaste);
11772
12272
  };
11773
- t4 = [
12273
+ t3 = [
11774
12274
  engine,
11775
12275
  store,
11776
12276
  pasteToOpen,
11777
12277
  noHullSelected
11778
12278
  ];
11779
- $[7] = engine;
11780
- $[8] = noHullSelected;
11781
- $[9] = pasteToOpen;
11782
- $[10] = store;
11783
- $[11] = t3;
11784
- $[12] = t4;
12279
+ $[5] = engine;
12280
+ $[6] = noHullSelected;
12281
+ $[7] = pasteToOpen;
12282
+ $[8] = store;
12283
+ $[9] = t2;
12284
+ $[10] = t3;
11785
12285
  } else {
11786
- t3 = $[11];
11787
- t4 = $[12];
12286
+ t2 = $[9];
12287
+ t3 = $[10];
11788
12288
  }
11789
- useEffect(t3, t4);
11790
- let t5;
11791
- if ($[13] !== copyFit || $[14] !== fit || $[15] !== flashCopied || $[16] !== menu) {
11792
- t5 = (format) => {
12289
+ useEffect(t2, t3);
12290
+ let t4;
12291
+ if ($[11] !== copyFit || $[12] !== fit || $[13] !== flashCopied || $[14] !== menu) {
12292
+ t4 = (format) => {
11793
12293
  document.getElementById(menu)?.hidePopover();
11794
12294
  copyFit(fit, format, flashCopied);
11795
12295
  };
11796
- $[13] = copyFit;
11797
- $[14] = fit;
11798
- $[15] = flashCopied;
11799
- $[16] = menu;
11800
- $[17] = t5;
11801
- } else t5 = $[17];
11802
- const copy = t5;
11803
- let t6;
11804
- if ($[18] !== fit || $[19] !== trySave) {
11805
- t6 = () => fit.name ? trySave(fit) : setNaming(true);
11806
- $[18] = fit;
11807
- $[19] = trySave;
11808
- $[20] = t6;
11809
- } else t6 = $[20];
11810
- const t7 = saved ? "Saved" : "Save";
11811
- let t8;
11812
- if ($[21] !== noHullSelected || $[22] !== t6 || $[23] !== t7) {
11813
- t8 = /* @__PURE__ */ jsx("button", {
12296
+ $[11] = copyFit;
12297
+ $[12] = fit;
12298
+ $[13] = flashCopied;
12299
+ $[14] = menu;
12300
+ $[15] = t4;
12301
+ } else t4 = $[15];
12302
+ const copy = t4;
12303
+ let t5;
12304
+ if ($[16] !== noHullSelected || $[17] !== saveCurrent || $[18] !== saved || $[19] !== savedTo || $[20] !== saver) {
12305
+ t5 = saver.characters === void 0 ? /* @__PURE__ */ jsx("button", {
11814
12306
  type: "button",
11815
12307
  className: ItemBrowser_module_default.action,
11816
12308
  disabled: noHullSelected,
11817
- onClick: t6,
11818
- children: t7
12309
+ onClick: saveCurrent,
12310
+ children: saved ? "Saved" : "Save"
12311
+ }) : /* @__PURE__ */ jsx(SaveSplit, {
12312
+ saver,
12313
+ savedTo: saved ? savedTo : void 0,
12314
+ disabled: noHullSelected,
12315
+ onSave: saveCurrent
11819
12316
  });
11820
- $[21] = noHullSelected;
11821
- $[22] = t6;
11822
- $[23] = t7;
11823
- $[24] = t8;
11824
- } else t8 = $[24];
11825
- let t9;
11826
- if ($[25] === Symbol.for("react.memo_cache_sentinel")) {
11827
- t9 = /* @__PURE__ */ jsx("button", {
12317
+ $[16] = noHullSelected;
12318
+ $[17] = saveCurrent;
12319
+ $[18] = saved;
12320
+ $[19] = savedTo;
12321
+ $[20] = saver;
12322
+ $[21] = t5;
12323
+ } else t5 = $[21];
12324
+ let t6;
12325
+ if ($[22] === Symbol.for("react.memo_cache_sentinel")) {
12326
+ t6 = /* @__PURE__ */ jsx("button", {
11828
12327
  type: "button",
11829
12328
  className: ItemBrowser_module_default.action,
11830
12329
  onClick: () => setImporting({ text: "" }),
11831
12330
  children: "Import…"
11832
12331
  });
11833
- $[25] = t9;
11834
- } else t9 = $[25];
11835
- const t10 = copied ? "Copied" : "Copy";
11836
- const t11 = copied ? "checkmark" : "export";
11837
- let t12;
11838
- if ($[26] !== t11) {
11839
- t12 = /* @__PURE__ */ jsx(Icon, { name: t11 });
11840
- $[26] = t11;
11841
- $[27] = t12;
11842
- } else t12 = $[27];
11843
- let t13;
11844
- if ($[28] !== menu || $[29] !== noHullSelected || $[30] !== t12) {
11845
- t13 = /* @__PURE__ */ jsx("button", {
12332
+ $[22] = t6;
12333
+ } else t6 = $[22];
12334
+ const t7 = copied ? "Copied" : "Copy";
12335
+ const t8 = copied ? "checkmark" : "export";
12336
+ let t9;
12337
+ if ($[23] !== t8) {
12338
+ t9 = /* @__PURE__ */ jsx(Icon, { name: t8 });
12339
+ $[23] = t8;
12340
+ $[24] = t9;
12341
+ } else t9 = $[24];
12342
+ let t10;
12343
+ if ($[25] !== menu || $[26] !== noHullSelected || $[27] !== t9) {
12344
+ t10 = /* @__PURE__ */ jsx("button", {
11846
12345
  type: "button",
11847
12346
  className: `${ItemBrowser_module_default.action} ${ItemBrowser_module_default.copy}`,
11848
12347
  "aria-label": "Copy",
11849
12348
  popoverTarget: menu,
11850
12349
  disabled: noHullSelected,
11851
- children: t12
12350
+ children: t9
11852
12351
  });
11853
- $[28] = menu;
11854
- $[29] = noHullSelected;
11855
- $[30] = t12;
11856
- $[31] = t13;
11857
- } else t13 = $[31];
11858
- let t14;
11859
- if ($[32] !== t10 || $[33] !== t13) {
11860
- t14 = /* @__PURE__ */ jsx("span", {
12352
+ $[25] = menu;
12353
+ $[26] = noHullSelected;
12354
+ $[27] = t9;
12355
+ $[28] = t10;
12356
+ } else t10 = $[28];
12357
+ let t11;
12358
+ if ($[29] !== t10 || $[30] !== t7) {
12359
+ t11 = /* @__PURE__ */ jsx("span", {
11861
12360
  className: ItemBrowser_module_default.copyAnchor,
11862
12361
  children: /* @__PURE__ */ jsx(Tooltip, {
11863
- label: t10,
11864
- children: t13
12362
+ label: t7,
12363
+ children: t10
11865
12364
  })
11866
12365
  });
11867
- $[32] = t10;
11868
- $[33] = t13;
11869
- $[34] = t14;
11870
- } else t14 = $[34];
11871
- let t15;
11872
- if ($[35] !== copy) {
11873
- t15 = /* @__PURE__ */ jsx("button", {
12366
+ $[29] = t10;
12367
+ $[30] = t7;
12368
+ $[31] = t11;
12369
+ } else t11 = $[31];
12370
+ let t12;
12371
+ if ($[32] !== copy) {
12372
+ t12 = /* @__PURE__ */ jsx("button", {
11874
12373
  type: "button",
11875
12374
  role: "menuitem",
11876
12375
  onClick: () => copy("eft"),
11877
12376
  children: "Copy as EFT"
11878
12377
  });
11879
- $[35] = copy;
11880
- $[36] = t15;
11881
- } else t15 = $[36];
11882
- let t16;
11883
- if ($[37] !== copy) {
11884
- t16 = /* @__PURE__ */ jsx("button", {
12378
+ $[32] = copy;
12379
+ $[33] = t12;
12380
+ } else t12 = $[33];
12381
+ let t13;
12382
+ if ($[34] !== copy) {
12383
+ t13 = /* @__PURE__ */ jsx("button", {
11885
12384
  type: "button",
11886
12385
  role: "menuitem",
11887
12386
  onClick: () => copy("esf"),
11888
12387
  children: "Copy as esf/1"
11889
12388
  });
11890
- $[37] = copy;
11891
- $[38] = t16;
11892
- } else t16 = $[38];
11893
- let t17;
11894
- if ($[39] !== menu || $[40] !== t15 || $[41] !== t16) {
11895
- t17 = /* @__PURE__ */ jsxs("div", {
12389
+ $[34] = copy;
12390
+ $[35] = t13;
12391
+ } else t13 = $[35];
12392
+ let t14;
12393
+ if ($[36] !== menu || $[37] !== t12 || $[38] !== t13) {
12394
+ t14 = /* @__PURE__ */ jsxs("div", {
11896
12395
  id: menu,
11897
12396
  className: ItemBrowser_module_default.menu,
11898
12397
  popover: "auto",
11899
12398
  role: "menu",
11900
- children: [t15, t16]
12399
+ children: [t12, t13]
11901
12400
  });
11902
- $[39] = menu;
11903
- $[40] = t15;
11904
- $[41] = t16;
12401
+ $[36] = menu;
12402
+ $[37] = t12;
12403
+ $[38] = t13;
12404
+ $[39] = t14;
12405
+ } else t14 = $[39];
12406
+ const t15 = importing !== void 0;
12407
+ let t16;
12408
+ if ($[40] === Symbol.for("react.memo_cache_sentinel")) {
12409
+ t16 = () => setImporting(void 0);
12410
+ $[40] = t16;
12411
+ } else t16 = $[40];
12412
+ let t17;
12413
+ if ($[41] !== importing) {
12414
+ t17 = importing ?? { text: "" };
12415
+ $[41] = importing;
11905
12416
  $[42] = t17;
11906
12417
  } else t17 = $[42];
11907
12418
  let t18;
11908
12419
  if ($[43] === Symbol.for("react.memo_cache_sentinel")) {
11909
- t18 = () => setNaming(false);
12420
+ t18 = () => setImporting(void 0);
11910
12421
  $[43] = t18;
11911
12422
  } else t18 = $[43];
11912
12423
  let t19;
11913
- if ($[44] === Symbol.for("react.memo_cache_sentinel")) {
11914
- t19 = () => setNaming(false);
11915
- $[44] = t19;
11916
- } else t19 = $[44];
11917
- let t20;
11918
- if ($[45] !== trySave) {
11919
- t20 = /* @__PURE__ */ jsx(NameForm, {
11920
- onCancel: t19,
11921
- onSave: (named_1) => {
11922
- setNaming(false);
11923
- trySave(named_1);
11924
- }
12424
+ if ($[44] !== t17) {
12425
+ t19 = /* @__PURE__ */ jsx(ImportForm, {
12426
+ draft: t17,
12427
+ onDone: t18
11925
12428
  });
11926
- $[45] = trySave;
11927
- $[46] = t20;
11928
- } else t20 = $[46];
11929
- let t21;
11930
- if ($[47] !== naming || $[48] !== t20) {
11931
- t21 = /* @__PURE__ */ jsx(Dialog, {
11932
- open: naming,
11933
- title: "Save Fit",
11934
- onClose: t18,
11935
- children: t20
11936
- });
11937
- $[47] = naming;
11938
- $[48] = t20;
11939
- $[49] = t21;
11940
- } else t21 = $[49];
11941
- const t22 = overwriting !== void 0;
11942
- let t23;
11943
- if ($[50] === Symbol.for("react.memo_cache_sentinel")) {
11944
- t23 = () => setOverwriting(void 0);
11945
- $[50] = t23;
11946
- } else t23 = $[50];
11947
- const t24 = overwriting?.name;
11948
- let t25;
11949
- if ($[51] !== t24) {
11950
- t25 = /* @__PURE__ */ jsxs("p", { children: [
11951
- "A fit named \"",
11952
- t24,
11953
- "\" is already saved for this hull. Overwrite it?"
11954
- ] });
11955
- $[51] = t24;
11956
- $[52] = t25;
11957
- } else t25 = $[52];
11958
- let t26;
11959
- if ($[53] === Symbol.for("react.memo_cache_sentinel")) {
11960
- t26 = /* @__PURE__ */ jsx("button", {
11961
- type: "button",
11962
- className: ItemBrowser_module_default.action,
11963
- onClick: () => setOverwriting(void 0),
11964
- children: "Cancel"
11965
- });
11966
- $[53] = t26;
11967
- } else t26 = $[53];
11968
- let t27;
11969
- if ($[54] !== overwriting || $[55] !== saveNow) {
11970
- t27 = /* @__PURE__ */ jsxs("div", {
11971
- className: ItemBrowser_module_default.dialogButtons,
11972
- children: [t26, /* @__PURE__ */ jsx("button", {
11973
- type: "button",
11974
- className: ItemBrowser_module_default.action,
11975
- onClick: () => overwriting && saveNow(overwriting),
11976
- children: "Overwrite"
11977
- })]
11978
- });
11979
- $[54] = overwriting;
11980
- $[55] = saveNow;
11981
- $[56] = t27;
11982
- } else t27 = $[56];
11983
- let t28;
11984
- if ($[57] !== t25 || $[58] !== t27) {
11985
- t28 = /* @__PURE__ */ jsxs("div", {
11986
- className: ItemBrowser_module_default.confirm,
11987
- children: [t25, t27]
11988
- });
11989
- $[57] = t25;
11990
- $[58] = t27;
11991
- $[59] = t28;
11992
- } else t28 = $[59];
11993
- let t29;
11994
- if ($[60] !== t22 || $[61] !== t28) {
11995
- t29 = /* @__PURE__ */ jsx(Dialog, {
11996
- open: t22,
11997
- title: "Overwrite Fit?",
11998
- onClose: t23,
11999
- children: t28
12000
- });
12001
- $[60] = t22;
12002
- $[61] = t28;
12003
- $[62] = t29;
12004
- } else t29 = $[62];
12005
- const t30 = importing !== void 0;
12006
- let t31;
12007
- if ($[63] === Symbol.for("react.memo_cache_sentinel")) {
12008
- t31 = () => setImporting(void 0);
12009
- $[63] = t31;
12010
- } else t31 = $[63];
12011
- let t32;
12012
- if ($[64] !== importing) {
12013
- t32 = importing ?? { text: "" };
12014
- $[64] = importing;
12015
- $[65] = t32;
12016
- } else t32 = $[65];
12017
- let t33;
12018
- if ($[66] === Symbol.for("react.memo_cache_sentinel")) {
12019
- t33 = () => setImporting(void 0);
12020
- $[66] = t33;
12021
- } else t33 = $[66];
12022
- let t34;
12023
- if ($[67] !== t32) {
12024
- t34 = /* @__PURE__ */ jsx(ImportForm, {
12025
- draft: t32,
12026
- onDone: t33
12027
- });
12028
- $[67] = t32;
12029
- $[68] = t34;
12030
- } else t34 = $[68];
12031
- let t35;
12032
- if ($[69] !== t30 || $[70] !== t34) {
12033
- t35 = /* @__PURE__ */ jsx(Dialog, {
12034
- open: t30,
12429
+ $[44] = t17;
12430
+ $[45] = t19;
12431
+ } else t19 = $[45];
12432
+ let t20;
12433
+ if ($[46] !== t15 || $[47] !== t19) {
12434
+ t20 = /* @__PURE__ */ jsx(Dialog, {
12435
+ open: t15,
12035
12436
  title: "Import Fit",
12036
- onClose: t31,
12037
- children: t34
12437
+ onClose: t16,
12438
+ children: t19
12038
12439
  });
12039
- $[69] = t30;
12040
- $[70] = t34;
12041
- $[71] = t35;
12042
- } else t35 = $[71];
12043
- let t36;
12044
- if ($[72] !== copyDialog || $[73] !== t14 || $[74] !== t17 || $[75] !== t21 || $[76] !== t29 || $[77] !== t35 || $[78] !== t8) {
12045
- t36 = /* @__PURE__ */ jsxs("div", {
12440
+ $[46] = t15;
12441
+ $[47] = t19;
12442
+ $[48] = t20;
12443
+ } else t20 = $[48];
12444
+ let t21;
12445
+ if ($[49] !== copyDialog || $[50] !== saver.dialog || $[51] !== t11 || $[52] !== t14 || $[53] !== t20 || $[54] !== t5) {
12446
+ t21 = /* @__PURE__ */ jsxs("div", {
12046
12447
  className: ItemBrowser_module_default.actions,
12047
12448
  children: [
12048
- t8,
12049
- t9,
12449
+ t5,
12450
+ t6,
12451
+ t11,
12050
12452
  t14,
12051
- t17,
12052
- t21,
12053
- t29,
12054
- t35,
12055
- copyDialog
12453
+ t20,
12454
+ copyDialog,
12455
+ saver.dialog
12056
12456
  ]
12057
12457
  });
12058
- $[72] = copyDialog;
12059
- $[73] = t14;
12060
- $[74] = t17;
12061
- $[75] = t21;
12062
- $[76] = t29;
12063
- $[77] = t35;
12064
- $[78] = t8;
12065
- $[79] = t36;
12066
- } else t36 = $[79];
12067
- return t36;
12458
+ $[49] = copyDialog;
12459
+ $[50] = saver.dialog;
12460
+ $[51] = t11;
12461
+ $[52] = t14;
12462
+ $[53] = t20;
12463
+ $[54] = t5;
12464
+ $[55] = t21;
12465
+ } else t21 = $[55];
12466
+ return t21;
12068
12467
  }
12069
- function NameForm(t0) {
12070
- const $ = c(27);
12071
- const { onCancel, onSave } = t0;
12072
- const engine = useEngine();
12073
- const fit = useFit();
12074
- const id = useId();
12075
- let t1;
12076
- if ($[0] !== engine.sde || $[1] !== fit.ship.type_id) {
12077
- t1 = () => engine.sde.type(fit.ship.type_id)?.name ?? "";
12078
- $[0] = engine.sde;
12079
- $[1] = fit.ship.type_id;
12080
- $[2] = t1;
12081
- } else t1 = $[2];
12082
- const [name, setName] = useState(t1);
12468
+ function SaveSplit(t0) {
12469
+ const $ = c(53);
12470
+ const { saver: t1, savedTo, disabled, onSave } = t0;
12471
+ const { characters, target, pick, saving } = t1;
12472
+ const menu = useId();
12473
+ const { current, login } = useCharacters();
12474
+ const where = target?.name ?? "browser";
12083
12475
  let t2;
12084
- if ($[3] !== fit || $[4] !== name || $[5] !== onSave) {
12085
- t2 = (event) => {
12086
- event.preventDefault();
12087
- onSave({
12088
- ...fit,
12089
- name: name.trim()
12090
- });
12091
- };
12092
- $[3] = fit;
12093
- $[4] = name;
12094
- $[5] = onSave;
12095
- $[6] = t2;
12096
- } else t2 = $[6];
12476
+ if ($[0] !== menu) {
12477
+ t2 = () => document.getElementById(menu)?.hidePopover();
12478
+ $[0] = menu;
12479
+ $[1] = t2;
12480
+ } else t2 = $[1];
12481
+ const close = t2;
12097
12482
  let t3;
12098
- if ($[7] !== id) {
12099
- t3 = /* @__PURE__ */ jsx("label", {
12100
- htmlFor: id,
12101
- children: "Name this fit."
12102
- });
12103
- $[7] = id;
12104
- $[8] = t3;
12105
- } else t3 = $[8];
12483
+ if ($[2] !== close || $[3] !== pick) {
12484
+ t3 = (owner) => {
12485
+ pick(owner);
12486
+ close();
12487
+ };
12488
+ $[2] = close;
12489
+ $[3] = pick;
12490
+ $[4] = t3;
12491
+ } else t3 = $[4];
12492
+ const choose = t3;
12106
12493
  let t4;
12107
- if ($[9] === Symbol.for("react.memo_cache_sentinel")) {
12108
- t4 = (event_1) => setName(event_1.target.value);
12109
- $[9] = t4;
12110
- } else t4 = $[9];
12494
+ if ($[5] !== close || $[6] !== login) {
12495
+ t4 = (canSave) => {
12496
+ close();
12497
+ login?.(canSave);
12498
+ };
12499
+ $[5] = close;
12500
+ $[6] = login;
12501
+ $[7] = t4;
12502
+ } else t4 = $[7];
12503
+ const logIn = t4;
12111
12504
  let t5;
12112
- if ($[10] !== id || $[11] !== name) {
12113
- t5 = /* @__PURE__ */ jsx("input", {
12114
- id,
12115
- value: name,
12116
- onFocus: _temp$5,
12117
- onChange: t4
12118
- });
12119
- $[10] = id;
12120
- $[11] = name;
12505
+ if ($[8] !== choose || $[9] !== current || $[10] !== logIn || $[11] !== target?.id) {
12506
+ t5 = (character) => {
12507
+ const writable = canSaveFits(character);
12508
+ return /* @__PURE__ */ jsxs("button", {
12509
+ type: "button",
12510
+ role: writable ? "menuitemradio" : "menuitem",
12511
+ "aria-checked": writable ? character.id === target?.id : void 0,
12512
+ "data-off": !writable || void 0,
12513
+ onClick: writable ? () => choose(character.id) : () => logIn(character.status !== "expired" || character.canWriteFits),
12514
+ children: [
12515
+ /* @__PURE__ */ jsx("span", {
12516
+ className: ItemBrowser_module_default.tick,
12517
+ children: character.id === target?.id && "✓"
12518
+ }),
12519
+ /* @__PURE__ */ jsx(Icon, { name: "fits-personal" }),
12520
+ /* @__PURE__ */ jsx("span", {
12521
+ className: ItemBrowser_module_default.saveName,
12522
+ children: character.name
12523
+ }),
12524
+ !writable && /* @__PURE__ */ jsx("span", {
12525
+ className: ItemBrowser_module_default.saveUpgrade,
12526
+ children: character.status === "expired" ? "Log in again" : "Allow saving"
12527
+ }),
12528
+ writable && String(character.id) === current && /* @__PURE__ */ jsx("span", {
12529
+ className: ItemBrowser_module_default.saveNote,
12530
+ children: "flying now"
12531
+ })
12532
+ ]
12533
+ }, character.id);
12534
+ };
12535
+ $[8] = choose;
12536
+ $[9] = current;
12537
+ $[10] = logIn;
12538
+ $[11] = target?.id;
12121
12539
  $[12] = t5;
12122
12540
  } else t5 = $[12];
12123
- let t6;
12124
- if ($[13] !== onCancel) {
12125
- t6 = /* @__PURE__ */ jsx("button", {
12541
+ const row = t5;
12542
+ const t6 = saving || void 0;
12543
+ const t7 = target === void 0 ? "fits-browser" : "fits-personal";
12544
+ let t8;
12545
+ if ($[13] !== t7) {
12546
+ t8 = /* @__PURE__ */ jsx(Icon, { name: t7 });
12547
+ $[13] = t7;
12548
+ $[14] = t8;
12549
+ } else t8 = $[14];
12550
+ const t9 = savedTo === void 0 ? `Save to ${where}` : `Saved to ${savedTo} ✓`;
12551
+ let t10;
12552
+ if ($[15] !== t9) {
12553
+ t10 = /* @__PURE__ */ jsx("span", {
12554
+ className: ItemBrowser_module_default.saveName,
12555
+ children: t9
12556
+ });
12557
+ $[15] = t9;
12558
+ $[16] = t10;
12559
+ } else t10 = $[16];
12560
+ let t11;
12561
+ if ($[17] !== disabled || $[18] !== onSave || $[19] !== t10 || $[20] !== t6 || $[21] !== t8) {
12562
+ t11 = /* @__PURE__ */ jsxs("button", {
12126
12563
  type: "button",
12127
- className: ItemBrowser_module_default.action,
12128
- onClick: onCancel,
12129
- children: "Cancel"
12564
+ className: `${ItemBrowser_module_default.action} ${ItemBrowser_module_default.saveMain}`,
12565
+ disabled,
12566
+ "aria-disabled": t6,
12567
+ onClick: onSave,
12568
+ children: [t8, t10]
12569
+ });
12570
+ $[17] = disabled;
12571
+ $[18] = onSave;
12572
+ $[19] = t10;
12573
+ $[20] = t6;
12574
+ $[21] = t8;
12575
+ $[22] = t11;
12576
+ } else t11 = $[22];
12577
+ let t12;
12578
+ if ($[23] !== menu) {
12579
+ t12 = /* @__PURE__ */ jsx("button", {
12580
+ type: "button",
12581
+ className: `${ItemBrowser_module_default.action} ${ItemBrowser_module_default.saveArrow}`,
12582
+ "aria-label": "Where to save",
12583
+ popoverTarget: menu
12130
12584
  });
12131
- $[13] = onCancel;
12132
- $[14] = t6;
12133
- } else t6 = $[14];
12134
- let t7;
12135
- if ($[15] !== name) {
12136
- t7 = name.trim();
12137
- $[15] = name;
12138
- $[16] = t7;
12139
- } else t7 = $[16];
12140
- const t8 = t7 === "";
12141
- let t9;
12142
- if ($[17] !== t8) {
12143
- t9 = /* @__PURE__ */ jsx("button", {
12144
- type: "submit",
12145
- className: ItemBrowser_module_default.action,
12146
- disabled: t8,
12147
- children: "Save"
12585
+ $[23] = menu;
12586
+ $[24] = t12;
12587
+ } else t12 = $[24];
12588
+ let t13;
12589
+ if ($[25] !== t11 || $[26] !== t12) {
12590
+ t13 = /* @__PURE__ */ jsxs("span", {
12591
+ className: ItemBrowser_module_default.saveAnchor,
12592
+ children: [t11, t12]
12148
12593
  });
12149
- $[17] = t8;
12150
- $[18] = t9;
12151
- } else t9 = $[18];
12152
- let t10;
12153
- if ($[19] !== t6 || $[20] !== t9) {
12154
- t10 = /* @__PURE__ */ jsxs("div", {
12155
- className: ItemBrowser_module_default.dialogButtons,
12156
- children: [t6, t9]
12594
+ $[25] = t11;
12595
+ $[26] = t12;
12596
+ $[27] = t13;
12597
+ } else t13 = $[27];
12598
+ const t14 = target === void 0;
12599
+ let t15;
12600
+ if ($[28] !== choose) {
12601
+ t15 = () => choose("browser");
12602
+ $[28] = choose;
12603
+ $[29] = t15;
12604
+ } else t15 = $[29];
12605
+ const t16 = target === void 0 && "✓";
12606
+ let t17;
12607
+ if ($[30] !== t16) {
12608
+ t17 = /* @__PURE__ */ jsx("span", {
12609
+ className: ItemBrowser_module_default.tick,
12610
+ children: t16
12157
12611
  });
12158
- $[19] = t6;
12159
- $[20] = t9;
12160
- $[21] = t10;
12161
- } else t10 = $[21];
12162
- let t11;
12163
- if ($[22] !== t10 || $[23] !== t2 || $[24] !== t3 || $[25] !== t5) {
12164
- t11 = /* @__PURE__ */ jsxs("form", {
12165
- className: ItemBrowser_module_default.form,
12166
- onSubmit: t2,
12612
+ $[30] = t16;
12613
+ $[31] = t17;
12614
+ } else t17 = $[31];
12615
+ let t18;
12616
+ if ($[32] === Symbol.for("react.memo_cache_sentinel")) {
12617
+ t18 = /* @__PURE__ */ jsx(Icon, { name: "fits-browser" });
12618
+ $[32] = t18;
12619
+ } else t18 = $[32];
12620
+ let t19;
12621
+ if ($[33] !== t14 || $[34] !== t15 || $[35] !== t17) {
12622
+ t19 = /* @__PURE__ */ jsxs("button", {
12623
+ type: "button",
12624
+ role: "menuitemradio",
12625
+ "aria-checked": t14,
12626
+ onClick: t15,
12167
12627
  children: [
12168
- t3,
12169
- t5,
12170
- t10
12628
+ t17,
12629
+ t18,
12630
+ "This browser"
12171
12631
  ]
12172
12632
  });
12173
- $[22] = t10;
12174
- $[23] = t2;
12175
- $[24] = t3;
12176
- $[25] = t5;
12177
- $[26] = t11;
12178
- } else t11 = $[26];
12179
- return t11;
12180
- }
12181
- function _temp$5(event_0) {
12182
- return event_0.currentTarget.select();
12633
+ $[33] = t14;
12634
+ $[34] = t15;
12635
+ $[35] = t17;
12636
+ $[36] = t19;
12637
+ } else t19 = $[36];
12638
+ let t20;
12639
+ if ($[37] === Symbol.for("react.memo_cache_sentinel")) {
12640
+ t20 = /* @__PURE__ */ jsx("hr", { className: ItemBrowser_module_default.menuRule });
12641
+ $[37] = t20;
12642
+ } else t20 = $[37];
12643
+ let t21;
12644
+ if ($[38] !== characters || $[39] !== row) {
12645
+ t21 = characters?.map(row);
12646
+ $[38] = characters;
12647
+ $[39] = row;
12648
+ $[40] = t21;
12649
+ } else t21 = $[40];
12650
+ let t22;
12651
+ if ($[41] !== characters?.length || $[42] !== logIn || $[43] !== login) {
12652
+ t22 = characters?.length === 0 && login && /* @__PURE__ */ jsxs("button", {
12653
+ type: "button",
12654
+ role: "menuitem",
12655
+ onClick: () => logIn(true),
12656
+ children: [/* @__PURE__ */ jsx("span", { className: ItemBrowser_module_default.tick }), /* @__PURE__ */ jsx("span", {
12657
+ className: ItemBrowser_module_default.saveUpgrade,
12658
+ children: "Log in and allow saving"
12659
+ })]
12660
+ });
12661
+ $[41] = characters?.length;
12662
+ $[42] = logIn;
12663
+ $[43] = login;
12664
+ $[44] = t22;
12665
+ } else t22 = $[44];
12666
+ let t23;
12667
+ if ($[45] !== menu || $[46] !== t19 || $[47] !== t21 || $[48] !== t22) {
12668
+ t23 = /* @__PURE__ */ jsxs("div", {
12669
+ id: menu,
12670
+ className: `${ItemBrowser_module_default.menu} ${ItemBrowser_module_default.saveMenu}`,
12671
+ popover: "auto",
12672
+ role: "menu",
12673
+ children: [
12674
+ t19,
12675
+ t20,
12676
+ t21,
12677
+ t22
12678
+ ]
12679
+ });
12680
+ $[45] = menu;
12681
+ $[46] = t19;
12682
+ $[47] = t21;
12683
+ $[48] = t22;
12684
+ $[49] = t23;
12685
+ } else t23 = $[49];
12686
+ let t24;
12687
+ if ($[50] !== t13 || $[51] !== t23) {
12688
+ t24 = /* @__PURE__ */ jsxs(Fragment$1, { children: [t13, t23] });
12689
+ $[50] = t13;
12690
+ $[51] = t23;
12691
+ $[52] = t24;
12692
+ } else t24 = $[52];
12693
+ return t24;
12183
12694
  }
12184
12695
  function ImportForm(t0) {
12185
12696
  const $ = c(33);
@@ -12194,7 +12705,7 @@ function ImportForm(t0) {
12194
12705
  if ($[0] !== draft.text) {
12195
12706
  t1 = () => {
12196
12707
  if (draft.text !== "") return;
12197
- Promise.resolve().then(_temp2$3).then((clipboard) => setText((typed) => typed || clipboard), _temp3$1);
12708
+ Promise.resolve().then(_temp$5).then((clipboard) => setText((typed) => typed || clipboard), _temp2$3);
12198
12709
  };
12199
12710
  t2 = [draft.text];
12200
12711
  $[0] = draft.text;
@@ -12333,8 +12844,8 @@ function ImportForm(t0) {
12333
12844
  return t14;
12334
12845
  }
12335
12846
  /** Fits a mutated item from the game in the first free slot of its rack, rolled as it is. */
12336
- function _temp3$1() {}
12337
- function _temp2$3() {
12847
+ function _temp2$3() {}
12848
+ function _temp$5() {
12338
12849
  return navigator.clipboard.readText();
12339
12850
  }
12340
12851
  async function fitMutated(engine, store, typeId, itemId) {
@@ -12346,7 +12857,7 @@ const noFits = [];
12346
12857
  const SHIPS_MARKET_GROUP_ID = 4;
12347
12858
  /** The Hulls & Fits tab of the `ItemBrowser`: EVE's hulls by group and race, with the fits saved for each. */
12348
12859
  function HullsAndFits(t0) {
12349
- const $ = c(103);
12860
+ const $ = c(115);
12350
12861
  const { noHullSelected } = t0;
12351
12862
  const fitShipId = useFit().ship.type_id;
12352
12863
  const images = useImages();
@@ -12356,7 +12867,9 @@ function HullsAndFits(t0) {
12356
12867
  const { show: showInfo } = useShowInfo();
12357
12868
  const { open, menu } = useContextMenu();
12358
12869
  const { copy, dialog: copyDialog } = useCopyFit();
12870
+ const { target: saveTarget, save: saveFit, dialog: saveDialog } = useSaveFit();
12359
12871
  const [deleting, setDeleting] = useState();
12872
+ const [deleteFailed, setDeleteFailed] = useState(false);
12360
12873
  const personal = usePersonalFits();
12361
12874
  const { start, end } = useDrag();
12362
12875
  const [search, setSearch] = useState("");
@@ -12501,7 +13014,7 @@ function HullsAndFits(t0) {
12501
13014
  } else t10 = $[36];
12502
13015
  const hullMenu = t10;
12503
13016
  let t11;
12504
- if ($[37] !== copy || $[38] !== open || $[39] !== store) {
13017
+ if ($[37] !== copy || $[38] !== open || $[39] !== personal.remove || $[40] !== saveFit || $[41] !== saveTarget || $[42] !== store) {
12505
13018
  t11 = (event_0, t12) => {
12506
13019
  const { fit: fit_6, kind } = t12;
12507
13020
  open(event_0, [
@@ -12510,6 +13023,10 @@ function HullsAndFits(t0) {
12510
13023
  onSelect: () => store.replace(fit_6)
12511
13024
  },
12512
13025
  "separator",
13026
+ kind === "fits-browser" && saveTarget !== void 0 && {
13027
+ label: `Save to ${saveTarget.name}`,
13028
+ onSelect: () => saveFit(fit_6)
13029
+ },
12513
13030
  {
12514
13031
  label: "Copy as EFT",
12515
13032
  onSelect: () => copy(fit_6, "eft")
@@ -12519,61 +13036,67 @@ function HullsAndFits(t0) {
12519
13036
  onSelect: () => copy(fit_6, "esf")
12520
13037
  },
12521
13038
  "separator",
12522
- kind === "fits-browser" && {
13039
+ (kind === "fits-browser" || personal.remove !== void 0) && {
12523
13040
  label: "Delete Fitting",
12524
- onSelect: () => setDeleting(fit_6)
13041
+ onSelect: () => setDeleting({
13042
+ fit: fit_6,
13043
+ kind
13044
+ })
12525
13045
  }
12526
13046
  ]);
12527
13047
  };
12528
13048
  $[37] = copy;
12529
13049
  $[38] = open;
12530
- $[39] = store;
12531
- $[40] = t11;
12532
- } else t11 = $[40];
13050
+ $[39] = personal.remove;
13051
+ $[40] = saveFit;
13052
+ $[41] = saveTarget;
13053
+ $[42] = store;
13054
+ $[43] = t11;
13055
+ } else t11 = $[43];
12533
13056
  const fitMenu = t11;
12534
13057
  let t12;
12535
- if ($[41] !== collapses) {
13058
+ if ($[44] !== collapses) {
12536
13059
  t12 = () => setCollapses(collapses + 1);
12537
- $[41] = collapses;
12538
- $[42] = t12;
12539
- } else t12 = $[42];
13060
+ $[44] = collapses;
13061
+ $[45] = t12;
13062
+ } else t12 = $[45];
12540
13063
  let t13;
12541
- if ($[43] !== search || $[44] !== t12) {
13064
+ if ($[46] !== search || $[47] !== t12) {
12542
13065
  t13 = /* @__PURE__ */ jsx(Search, {
12543
13066
  value: search,
12544
13067
  onChange: setSearch,
12545
13068
  onCollapse: t12
12546
13069
  });
12547
- $[43] = search;
12548
- $[44] = t12;
12549
- $[45] = t13;
12550
- } else t13 = $[45];
13070
+ $[46] = search;
13071
+ $[47] = t12;
13072
+ $[48] = t13;
13073
+ } else t13 = $[48];
12551
13074
  let t14;
12552
- if ($[46] !== browserFits) {
13075
+ if ($[49] !== browserFits) {
12553
13076
  t14 = /* @__PURE__ */ jsx(FilterToggle, {
12554
13077
  icon: "fits-browser",
12555
13078
  label: "Browser Fittings",
12556
13079
  pressed: browserFits,
12557
13080
  onPressedChange: setBrowserFits
12558
13081
  });
12559
- $[46] = browserFits;
12560
- $[47] = t14;
12561
- } else t14 = $[47];
13082
+ $[49] = browserFits;
13083
+ $[50] = t14;
13084
+ } else t14 = $[50];
12562
13085
  let t15;
12563
- if ($[48] !== personalFits) {
13086
+ if ($[51] !== personalFits) {
12564
13087
  t15 = /* @__PURE__ */ jsx(FilterToggle, {
12565
13088
  icon: "fits-personal",
12566
13089
  label: "Personal Fittings",
12567
13090
  pressed: personalFits,
12568
13091
  onPressedChange: setPersonalFits
12569
13092
  });
12570
- $[48] = personalFits;
12571
- $[49] = t15;
12572
- } else t15 = $[49];
13093
+ $[51] = personalFits;
13094
+ $[52] = t15;
13095
+ } else t15 = $[52];
12573
13096
  let t16;
12574
13097
  let t17;
12575
13098
  let t18;
12576
- if ($[50] === Symbol.for("react.memo_cache_sentinel")) {
13099
+ if ($[53] === Symbol.for("react.memo_cache_sentinel")) {
12577
13100
  t16 = /* @__PURE__ */ jsx(FilterToggle, {
12578
13101
  icon: "fits-corporation",
12579
13102
  label: "Corporation Fittings"
@@ -12586,16 +13109,16 @@ function HullsAndFits(t0) {
12586
13109
  icon: "fits-community",
12587
13110
  label: "Community Fittings"
12588
13111
  });
12589
- $[50] = t16;
12590
- $[51] = t17;
12591
- $[52] = t18;
13112
+ $[53] = t16;
13113
+ $[54] = t17;
13114
+ $[55] = t18;
12592
13115
  } else {
12593
- t16 = $[50];
12594
- t17 = $[51];
12595
- t18 = $[52];
13116
+ t16 = $[53];
13117
+ t17 = $[54];
13118
+ t18 = $[55];
12596
13119
  }
12597
13120
  let t19;
12598
- if ($[53] !== currentHull || $[54] !== noHullSelected) {
13121
+ if ($[56] !== currentHull || $[57] !== noHullSelected) {
12599
13122
  t19 = /* @__PURE__ */ jsx(FilterToggle, {
12600
13123
  icon: "current-hull",
12601
13124
  label: "Current Hull",
@@ -12603,23 +13126,23 @@ function HullsAndFits(t0) {
12603
13126
  disabled: noHullSelected,
12604
13127
  onPressedChange: setCurrentHull
12605
13128
  });
12606
- $[53] = currentHull;
12607
- $[54] = noHullSelected;
12608
- $[55] = t19;
12609
- } else t19 = $[55];
13129
+ $[56] = currentHull;
13130
+ $[57] = noHullSelected;
13131
+ $[58] = t19;
13132
+ } else t19 = $[58];
12610
13133
  let t20;
12611
- if ($[56] !== flyable) {
13134
+ if ($[59] !== flyable) {
12612
13135
  t20 = /* @__PURE__ */ jsx(FilterToggle, {
12613
13136
  icon: "skills",
12614
13137
  label: "Skills",
12615
13138
  pressed: flyable,
12616
13139
  onPressedChange: setFlyable
12617
13140
  });
12618
- $[56] = flyable;
12619
- $[57] = t20;
12620
- } else t20 = $[57];
13141
+ $[59] = flyable;
13142
+ $[60] = t20;
13143
+ } else t20 = $[60];
12621
13144
  let t21;
12622
- if ($[58] !== t14 || $[59] !== t15 || $[60] !== t19 || $[61] !== t20) {
13145
+ if ($[61] !== t14 || $[62] !== t15 || $[63] !== t19 || $[64] !== t20) {
12623
13146
  t21 = /* @__PURE__ */ jsxs("fieldset", {
12624
13147
  className: ItemBrowser_module_default.filters,
12625
13148
  "aria-label": "Filters",
@@ -12633,14 +13156,14 @@ function HullsAndFits(t0) {
12633
13156
  t20
12634
13157
  ]
12635
13158
  });
12636
- $[58] = t14;
12637
- $[59] = t15;
12638
- $[60] = t19;
12639
- $[61] = t20;
12640
- $[62] = t21;
12641
- } else t21 = $[62];
13159
+ $[61] = t14;
13160
+ $[62] = t15;
13161
+ $[63] = t19;
13162
+ $[64] = t20;
13163
+ $[65] = t21;
13164
+ } else t21 = $[65];
12642
13165
  let t22;
12643
- if ($[63] !== groups.length || $[64] !== personal.character || $[65] !== personalFits) {
13166
+ if ($[66] !== groups.length || $[67] !== personal.character || $[68] !== personalFits) {
12644
13167
  t22 = personalFits && personal.character?.canReadFits !== true ? /* @__PURE__ */ jsx("p", {
12645
13168
  className: ItemBrowser_module_default.empty,
12646
13169
  children: personal.character === void 0 ? "Log in or pick a character with the Character button" : "Log in again with the Character button to see fittings"
@@ -12648,13 +13171,13 @@ function HullsAndFits(t0) {
12648
13171
  className: ItemBrowser_module_default.empty,
12649
13172
  children: "No hulls found"
12650
13173
  }) : null;
12651
- $[63] = groups.length;
12652
- $[64] = personal.character;
12653
- $[65] = personalFits;
12654
- $[66] = t22;
12655
- } else t22 = $[66];
13174
+ $[66] = groups.length;
13175
+ $[67] = personal.character;
13176
+ $[68] = personalFits;
13177
+ $[69] = t22;
13178
+ } else t22 = $[69];
12656
13179
  let t23;
12657
- if ($[67] !== browserByHull || $[68] !== collapses || $[69] !== end || $[70] !== fitMenu || $[71] !== groups || $[72] !== hullMenu || $[73] !== images || $[74] !== personalByHull || $[75] !== shownFits || $[76] !== simulate || $[77] !== start || $[78] !== store) {
13180
+ if ($[70] !== browserByHull || $[71] !== collapses || $[72] !== end || $[73] !== fitMenu || $[74] !== groups || $[75] !== hullMenu || $[76] !== images || $[77] !== personalByHull || $[78] !== shownFits || $[79] !== simulate || $[80] !== start || $[81] !== store) {
12658
13181
  t23 = groups.length > 0 && /* @__PURE__ */ jsx(TreeList, {
12659
13182
  label: "Hulls",
12660
13183
  children: groups.map((t24) => {
@@ -12720,116 +13243,167 @@ function HullsAndFits(t0) {
12720
13243
  }, group.id);
12721
13244
  })
12722
13245
  }, collapses);
12723
- $[67] = browserByHull;
12724
- $[68] = collapses;
12725
- $[69] = end;
12726
- $[70] = fitMenu;
12727
- $[71] = groups;
12728
- $[72] = hullMenu;
12729
- $[73] = images;
12730
- $[74] = personalByHull;
12731
- $[75] = shownFits;
12732
- $[76] = simulate;
12733
- $[77] = start;
12734
- $[78] = store;
12735
- $[79] = t23;
12736
- } else t23 = $[79];
13246
+ $[70] = browserByHull;
13247
+ $[71] = collapses;
13248
+ $[72] = end;
13249
+ $[73] = fitMenu;
13250
+ $[74] = groups;
13251
+ $[75] = hullMenu;
13252
+ $[76] = images;
13253
+ $[77] = personalByHull;
13254
+ $[78] = shownFits;
13255
+ $[79] = simulate;
13256
+ $[80] = start;
13257
+ $[81] = store;
13258
+ $[82] = t23;
13259
+ } else t23 = $[82];
12737
13260
  let t24;
12738
- if ($[80] !== t22 || $[81] !== t23) {
13261
+ if ($[83] !== t22 || $[84] !== t23) {
12739
13262
  t24 = /* @__PURE__ */ jsxs("div", {
12740
13263
  className: ItemBrowser_module_default.tree,
12741
13264
  children: [t22, t23]
12742
13265
  });
12743
- $[80] = t22;
12744
- $[81] = t23;
12745
- $[82] = t24;
12746
- } else t24 = $[82];
13266
+ $[83] = t22;
13267
+ $[84] = t23;
13268
+ $[85] = t24;
13269
+ } else t24 = $[85];
12747
13270
  const t25 = deleting !== void 0;
12748
13271
  let t26;
12749
- if ($[83] === Symbol.for("react.memo_cache_sentinel")) {
13272
+ if ($[86] === Symbol.for("react.memo_cache_sentinel")) {
12750
13273
  t26 = () => setDeleting(void 0);
12751
- $[83] = t26;
12752
- } else t26 = $[83];
12753
- const t27 = deleting?.name || "Unnamed";
12754
- let t28;
12755
- if ($[84] !== t27) {
12756
- t28 = /* @__PURE__ */ jsxs("p", { children: [
13274
+ $[86] = t26;
13275
+ } else t26 = $[86];
13276
+ const t27 = deleting?.fit.name || "Unnamed";
13277
+ const t28 = deleting?.kind === "fits-personal" ? `${personal.character?.name} in EVE` : "this browser";
13278
+ let t29;
13279
+ if ($[87] !== t27 || $[88] !== t28) {
13280
+ t29 = /* @__PURE__ */ jsxs("p", { children: [
12757
13281
  "Delete the fit \"",
12758
13282
  t27,
12759
- "\" from this browser?"
13283
+ "\" from",
13284
+ " ",
13285
+ t28,
13286
+ "?"
12760
13287
  ] });
12761
- $[84] = t27;
12762
- $[85] = t28;
12763
- } else t28 = $[85];
12764
- let t29;
12765
- if ($[86] === Symbol.for("react.memo_cache_sentinel")) {
12766
- t29 = /* @__PURE__ */ jsx("button", {
13288
+ $[87] = t27;
13289
+ $[88] = t28;
13290
+ $[89] = t29;
13291
+ } else t29 = $[89];
13292
+ let t30;
13293
+ if ($[90] === Symbol.for("react.memo_cache_sentinel")) {
13294
+ t30 = /* @__PURE__ */ jsx("button", {
12767
13295
  type: "button",
12768
13296
  className: ItemBrowser_module_default.action,
12769
13297
  onClick: () => setDeleting(void 0),
12770
13298
  children: "Cancel"
12771
13299
  });
12772
- $[86] = t29;
12773
- } else t29 = $[86];
12774
- let t30;
12775
- if ($[87] !== deleting || $[88] !== remove) {
12776
- t30 = /* @__PURE__ */ jsxs("div", {
13300
+ $[90] = t30;
13301
+ } else t30 = $[90];
13302
+ let t31;
13303
+ if ($[91] !== deleting || $[92] !== personal || $[93] !== remove) {
13304
+ t31 = /* @__PURE__ */ jsxs("div", {
12777
13305
  className: ItemBrowser_module_default.dialogButtons,
12778
- children: [t29, /* @__PURE__ */ jsx("button", {
13306
+ children: [t30, /* @__PURE__ */ jsx("button", {
12779
13307
  type: "button",
12780
13308
  className: ItemBrowser_module_default.action,
12781
13309
  onClick: () => {
12782
- if (deleting) remove(deleting);
13310
+ if (deleting?.kind === "fits-browser") remove(deleting.fit);
13311
+ else if (deleting) personal.remove?.(deleting.fit).catch((error) => {
13312
+ console.error(error);
13313
+ setDeleteFailed(true);
13314
+ });
12783
13315
  setDeleting(void 0);
12784
13316
  },
12785
13317
  children: "Delete"
12786
13318
  })]
12787
13319
  });
12788
- $[87] = deleting;
12789
- $[88] = remove;
12790
- $[89] = t30;
12791
- } else t30 = $[89];
12792
- let t31;
12793
- if ($[90] !== t28 || $[91] !== t30) {
12794
- t31 = /* @__PURE__ */ jsxs("div", {
13320
+ $[91] = deleting;
13321
+ $[92] = personal;
13322
+ $[93] = remove;
13323
+ $[94] = t31;
13324
+ } else t31 = $[94];
13325
+ let t32;
13326
+ if ($[95] !== t29 || $[96] !== t31) {
13327
+ t32 = /* @__PURE__ */ jsxs("div", {
12795
13328
  className: ItemBrowser_module_default.confirm,
12796
- children: [t28, t30]
13329
+ children: [t29, t31]
12797
13330
  });
12798
- $[90] = t28;
12799
- $[91] = t30;
12800
- $[92] = t31;
12801
- } else t31 = $[92];
12802
- let t32;
12803
- if ($[93] !== t25 || $[94] !== t31) {
12804
- t32 = /* @__PURE__ */ jsx(Dialog, {
13331
+ $[95] = t29;
13332
+ $[96] = t31;
13333
+ $[97] = t32;
13334
+ } else t32 = $[97];
13335
+ let t33;
13336
+ if ($[98] !== t25 || $[99] !== t32) {
13337
+ t33 = /* @__PURE__ */ jsx(Dialog, {
12805
13338
  open: t25,
12806
13339
  title: "Delete Fitting?",
12807
13340
  onClose: t26,
12808
- children: t31
13341
+ children: t32
12809
13342
  });
12810
- $[93] = t25;
12811
- $[94] = t31;
12812
- $[95] = t32;
12813
- } else t32 = $[95];
12814
- let t33;
12815
- if ($[96] !== copyDialog || $[97] !== menu || $[98] !== t13 || $[99] !== t21 || $[100] !== t24 || $[101] !== t32) {
12816
- t33 = /* @__PURE__ */ jsxs(Fragment$1, { children: [
13343
+ $[98] = t25;
13344
+ $[99] = t32;
13345
+ $[100] = t33;
13346
+ } else t33 = $[100];
13347
+ let t34;
13348
+ if ($[101] === Symbol.for("react.memo_cache_sentinel")) {
13349
+ t34 = () => setDeleteFailed(false);
13350
+ $[101] = t34;
13351
+ } else t34 = $[101];
13352
+ let t35;
13353
+ if ($[102] === Symbol.for("react.memo_cache_sentinel")) {
13354
+ t35 = /* @__PURE__ */ jsx("p", { children: "EVE did not delete this fit. Please try again." });
13355
+ $[102] = t35;
13356
+ } else t35 = $[102];
13357
+ let t36;
13358
+ if ($[103] === Symbol.for("react.memo_cache_sentinel")) {
13359
+ t36 = /* @__PURE__ */ jsxs("div", {
13360
+ className: ItemBrowser_module_default.confirm,
13361
+ children: [t35, /* @__PURE__ */ jsx("div", {
13362
+ className: ItemBrowser_module_default.dialogButtons,
13363
+ children: /* @__PURE__ */ jsx("button", {
13364
+ type: "button",
13365
+ className: ItemBrowser_module_default.action,
13366
+ onClick: () => setDeleteFailed(false),
13367
+ children: "Close"
13368
+ })
13369
+ })]
13370
+ });
13371
+ $[103] = t36;
13372
+ } else t36 = $[103];
13373
+ let t37;
13374
+ if ($[104] !== deleteFailed) {
13375
+ t37 = /* @__PURE__ */ jsx(Dialog, {
13376
+ open: deleteFailed,
13377
+ title: "Delete Fitting",
13378
+ onClose: t34,
13379
+ children: t36
13380
+ });
13381
+ $[104] = deleteFailed;
13382
+ $[105] = t37;
13383
+ } else t37 = $[105];
13384
+ let t38;
13385
+ if ($[106] !== copyDialog || $[107] !== menu || $[108] !== saveDialog || $[109] !== t13 || $[110] !== t21 || $[111] !== t24 || $[112] !== t33 || $[113] !== t37) {
13386
+ t38 = /* @__PURE__ */ jsxs(Fragment$1, { children: [
12817
13387
  t13,
12818
13388
  t21,
12819
13389
  t24,
12820
13390
  menu,
12821
13391
  copyDialog,
12822
- t32
13392
+ saveDialog,
13393
+ t33,
13394
+ t37
12823
13395
  ] });
12824
- $[96] = copyDialog;
12825
- $[97] = menu;
12826
- $[98] = t13;
12827
- $[99] = t21;
12828
- $[100] = t24;
12829
- $[101] = t32;
12830
- $[102] = t33;
12831
- } else t33 = $[102];
12832
- return t33;
13396
+ $[106] = copyDialog;
13397
+ $[107] = menu;
13398
+ $[108] = saveDialog;
13399
+ $[109] = t13;
13400
+ $[110] = t21;
13401
+ $[111] = t24;
13402
+ $[112] = t33;
13403
+ $[113] = t37;
13404
+ $[114] = t38;
13405
+ } else t38 = $[114];
13406
+ return t38;
12833
13407
  }
12834
13408
  function _temp6(fit_3) {
12835
13409
  return fit_3.ship.type_id;