jaml-ui 0.26.3 → 0.26.5
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.
- package/README.md +22 -7
- package/dist/assets/searchPoolWorker-CejAnH4a.js +35 -0
- package/dist/assets/searchPoolWorker-CejAnH4a.js.map +1 -0
- package/dist/chunks/motelyItemDecoder-Bg12hhB2.js +248 -0
- package/dist/chunks/motelyItemDecoder-Bg12hhB2.js.map +1 -0
- package/dist/chunks/searchPoolWorker-CTtPOuxF.js +8 -0
- package/dist/chunks/searchPoolWorker-CTtPOuxF.js.map +1 -0
- package/dist/chunks/{ui-BRMCKSX4.js → ui-0liG4zOw.js} +2 -2
- package/dist/chunks/{ui-BRMCKSX4.js.map → ui-0liG4zOw.js.map} +1 -1
- package/dist/components/JamlIde.d.ts +8 -1
- package/dist/components/JamlIdeToolbar.d.ts +3 -1
- package/dist/components/jamlMap/CategoryPicker.d.ts +1 -0
- package/dist/components/jamlMap/JokerPicker.d.ts +1 -0
- package/dist/config.d.ts +7 -0
- package/dist/hooks/searchPoolWorker.d.ts +60 -0
- package/dist/hooks/searchWorker.d.ts +1 -0
- package/dist/hooks/useAnalyzer.d.ts +17 -16
- package/dist/hooks/useJamlLibrary.d.ts +13 -0
- package/dist/hooks/useMotelyRuntime.d.ts +11 -0
- package/dist/hooks/useSearch.d.ts +5 -6
- package/dist/hooks/useSearchPool.d.ts +42 -0
- package/dist/index.d.ts +6 -4
- package/dist/index.js +3320 -3989
- package/dist/index.js.map +1 -1
- package/dist/lib/hooks/useSeedAnalyzer.d.ts +10 -3
- package/dist/motely.d.ts +3 -1
- package/dist/motely.js +42 -5
- package/dist/motely.js.map +1 -1
- package/dist/motelyBoot.d.ts +13 -0
- package/dist/ui/jimbo.css +1 -1
- package/dist/ui/mascot/SeedMascot.d.ts +1 -1
- package/dist/ui/mascot/index.d.ts +3 -3
- package/dist/ui/radial/RadialBadge.d.ts +1 -1
- package/dist/ui/radial/RadialMenu.d.ts +1 -1
- package/dist/ui/radial/index.d.ts +16 -16
- package/dist/ui.js +1 -1
- package/package.json +18 -13
- package/assets/WeeJokerExampleDAilyGame.png +0 -0
- package/dist/chunks/motelyItemDecoder-HsR2riGq.js +0 -149
- package/dist/chunks/motelyItemDecoder-HsR2riGq.js.map +0 -1
- package/dist/components/JamlAnalyzerFullscreen.d.ts +0 -30
- package/dist/hooks/analyzerStreamRegistry.d.ts +0 -35
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
import { useCallback as e, useEffect as t, useMemo as n, useState as r, useSyncExternalStore as i } from "react";
|
|
2
|
+
import a, { Motely as o } from "motely-wasm";
|
|
3
|
+
import { IFileMounter as s, PermissionMode as c } from "motely-wasm/bootsharp/file-system";
|
|
4
|
+
//#region src/motelyBoot.ts
|
|
5
|
+
var l = null, u = null;
|
|
6
|
+
try {
|
|
7
|
+
l = await import("@rewaffle/bootsharp-file-system"), l.init(s);
|
|
8
|
+
} catch (e) {
|
|
9
|
+
u = e;
|
|
10
|
+
}
|
|
11
|
+
var d = [
|
|
12
|
+
"/motely-wasm/bin",
|
|
13
|
+
"/node_modules/motely-wasm/bin",
|
|
14
|
+
"/bin"
|
|
15
|
+
], f = {
|
|
16
|
+
status: "idle",
|
|
17
|
+
error: null,
|
|
18
|
+
isFileSystemReady: l !== null,
|
|
19
|
+
fileSystemError: u
|
|
20
|
+
}, p = /* @__PURE__ */ new Set();
|
|
21
|
+
function m(e) {
|
|
22
|
+
f = {
|
|
23
|
+
...f,
|
|
24
|
+
...e
|
|
25
|
+
};
|
|
26
|
+
for (let e of p) e();
|
|
27
|
+
}
|
|
28
|
+
async function h() {
|
|
29
|
+
m({
|
|
30
|
+
status: "booting",
|
|
31
|
+
error: null
|
|
32
|
+
});
|
|
33
|
+
try {
|
|
34
|
+
if (a.getStatus() === a.BootStatus.Standby) {
|
|
35
|
+
let e = null;
|
|
36
|
+
for (let t of d) try {
|
|
37
|
+
await a.boot(t), e = null;
|
|
38
|
+
break;
|
|
39
|
+
} catch (t) {
|
|
40
|
+
e = t;
|
|
41
|
+
}
|
|
42
|
+
if (e) throw e;
|
|
43
|
+
}
|
|
44
|
+
m({
|
|
45
|
+
status: "ready",
|
|
46
|
+
error: null
|
|
47
|
+
});
|
|
48
|
+
} catch (e) {
|
|
49
|
+
throw m({
|
|
50
|
+
status: "error",
|
|
51
|
+
error: e
|
|
52
|
+
}), e;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
var g = null;
|
|
56
|
+
function _() {
|
|
57
|
+
return g ||= h(), g;
|
|
58
|
+
}
|
|
59
|
+
function v() {
|
|
60
|
+
return f;
|
|
61
|
+
}
|
|
62
|
+
function y(e) {
|
|
63
|
+
return p.add(e), () => {
|
|
64
|
+
p.delete(e);
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
var b = l, x = u, S = l !== null;
|
|
68
|
+
//#endregion
|
|
69
|
+
//#region src/hooks/useJamlLibrary.ts
|
|
70
|
+
function C(e) {
|
|
71
|
+
return e instanceof Error ? e.message : String(e);
|
|
72
|
+
}
|
|
73
|
+
function w() {
|
|
74
|
+
let [t, n] = r(() => S ? "idle" : "unsupported"), [i, a] = r(null), [s, l] = r([]), [u, d] = r(() => S ? null : C(x ?? "Bootsharp FileSystem package is not available.")), f = e(() => {
|
|
75
|
+
i && l((e) => [...e]);
|
|
76
|
+
}, [i]);
|
|
77
|
+
return {
|
|
78
|
+
status: t,
|
|
79
|
+
rootId: i,
|
|
80
|
+
files: s,
|
|
81
|
+
error: u,
|
|
82
|
+
mount: e(async () => {
|
|
83
|
+
if (!S) {
|
|
84
|
+
n("unsupported"), d(C(x ?? "Bootsharp FileSystem package is not available."));
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
n("mounting"), d(null);
|
|
88
|
+
try {
|
|
89
|
+
await _();
|
|
90
|
+
let e = await o.pickRoot({
|
|
91
|
+
mode: c.ReadWrite,
|
|
92
|
+
id: "jaml-library"
|
|
93
|
+
});
|
|
94
|
+
if (!e) {
|
|
95
|
+
n("idle");
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
a(await o.mountRoot(e, { mode: c.ReadWrite })), l([]), n("ready");
|
|
99
|
+
} catch (e) {
|
|
100
|
+
n("error"), d(C(e));
|
|
101
|
+
}
|
|
102
|
+
}, []),
|
|
103
|
+
unmount: e(async () => {
|
|
104
|
+
i && (await _(), await o.unmountRoot(i), a(null), l([]), n(S ? "idle" : "unsupported"));
|
|
105
|
+
}, [i]),
|
|
106
|
+
loadFile: e(async (e) => {
|
|
107
|
+
if (!i) throw Error("JAML library is not mounted.");
|
|
108
|
+
return await _(), await o.readTextFile(i, e);
|
|
109
|
+
}, [i]),
|
|
110
|
+
saveFile: e(async (e, t) => {
|
|
111
|
+
if (!i) throw Error("JAML library is not mounted.");
|
|
112
|
+
await _(), await o.writeTextFile(i, e, t), l((t) => (t.includes(e) ? t : [...t, e]).sort((e, t) => e.localeCompare(t)));
|
|
113
|
+
}, [i]),
|
|
114
|
+
refresh: f
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
//#endregion
|
|
118
|
+
//#region src/hooks/useMotelyRuntime.ts
|
|
119
|
+
function T(e) {
|
|
120
|
+
return e ? e instanceof Error ? e.message : String(e) : null;
|
|
121
|
+
}
|
|
122
|
+
function E() {
|
|
123
|
+
let t = i(y, v, v), r = e(() => _(), []);
|
|
124
|
+
return n(() => ({
|
|
125
|
+
status: t.status,
|
|
126
|
+
ready: t.status === "ready",
|
|
127
|
+
error: T(t.error),
|
|
128
|
+
fsReady: t.isFileSystemReady,
|
|
129
|
+
fsError: T(t.fileSystemError),
|
|
130
|
+
ensureReady: r
|
|
131
|
+
}), [t, r]);
|
|
132
|
+
}
|
|
133
|
+
function D() {
|
|
134
|
+
let n = e(() => _(), []);
|
|
135
|
+
t(() => {
|
|
136
|
+
n();
|
|
137
|
+
}, [n]);
|
|
138
|
+
}
|
|
139
|
+
//#endregion
|
|
140
|
+
//#region src/decode/motelyItemDecoder.ts
|
|
141
|
+
var O = o, k = {
|
|
142
|
+
[O.MotelyItemTypeCategory.Standardcard]: "playing",
|
|
143
|
+
[O.MotelyItemTypeCategory.SpectralCard]: "spectral",
|
|
144
|
+
[O.MotelyItemTypeCategory.TarotCard]: "tarot",
|
|
145
|
+
[O.MotelyItemTypeCategory.PlanetCard]: "planet",
|
|
146
|
+
[O.MotelyItemTypeCategory.Joker]: "joker"
|
|
147
|
+
};
|
|
148
|
+
function A(e, t) {
|
|
149
|
+
let n = e[String(t)];
|
|
150
|
+
return typeof n == "string" ? n : null;
|
|
151
|
+
}
|
|
152
|
+
function j(e) {
|
|
153
|
+
return e.replace(/([a-z])([A-Z])/g, "$1 $2").replace(/([A-Z]+)([A-Z][a-z])/g, "$1 $2");
|
|
154
|
+
}
|
|
155
|
+
function M(e) {
|
|
156
|
+
return e == null ? null : typeof e == "number" ? Number.isFinite(e) ? e : null : e.value ?? e.type ?? null;
|
|
157
|
+
}
|
|
158
|
+
function N(e) {
|
|
159
|
+
let t = M(e);
|
|
160
|
+
return t === null ? null : t & 65535;
|
|
161
|
+
}
|
|
162
|
+
function P(e) {
|
|
163
|
+
let t = N(e);
|
|
164
|
+
return t === null ? "Unknown" : A(O.MotelyItemType, t) ?? `item#${t}`;
|
|
165
|
+
}
|
|
166
|
+
function F(e) {
|
|
167
|
+
return k[e >> 12 & 15] ?? "unknown";
|
|
168
|
+
}
|
|
169
|
+
function I(e) {
|
|
170
|
+
let t = N(e);
|
|
171
|
+
return t === null ? "unknown" : F(t);
|
|
172
|
+
}
|
|
173
|
+
function L(e) {
|
|
174
|
+
return j(P(e));
|
|
175
|
+
}
|
|
176
|
+
function R(e) {
|
|
177
|
+
if (e == null) return null;
|
|
178
|
+
let t = typeof e == "number" ? e : e.edition;
|
|
179
|
+
if (t == null) return null;
|
|
180
|
+
let n = A(O.MotelyItemEdition, t);
|
|
181
|
+
return !n || n === "None" ? null : n;
|
|
182
|
+
}
|
|
183
|
+
function z(e) {
|
|
184
|
+
if (e == null) return null;
|
|
185
|
+
let t = typeof e == "number" ? null : e.seal;
|
|
186
|
+
if (t == null) return null;
|
|
187
|
+
let n = A(O.MotelyItemSeal, t);
|
|
188
|
+
return !n || n === "None" ? null : n;
|
|
189
|
+
}
|
|
190
|
+
function B(e) {
|
|
191
|
+
if (e == null) return null;
|
|
192
|
+
let t = typeof e == "number" ? null : e.enhancement;
|
|
193
|
+
if (t == null) return null;
|
|
194
|
+
let n = A(O.MotelyItemEnhancement, t);
|
|
195
|
+
return !n || n === "None" ? null : n;
|
|
196
|
+
}
|
|
197
|
+
function V(e) {
|
|
198
|
+
if (e == null) return null;
|
|
199
|
+
let t = typeof e == "number" ? null : e.rank;
|
|
200
|
+
return t == null ? null : A(O.MotelyStandardcardRank, t);
|
|
201
|
+
}
|
|
202
|
+
function H(e) {
|
|
203
|
+
if (e == null) return null;
|
|
204
|
+
let t = typeof e == "number" ? null : e.suit;
|
|
205
|
+
return t == null ? null : A(O.MotelyStandardcardSuit, t);
|
|
206
|
+
}
|
|
207
|
+
function U(e) {
|
|
208
|
+
return P(e);
|
|
209
|
+
}
|
|
210
|
+
function W(e) {
|
|
211
|
+
let t = N(e);
|
|
212
|
+
if (t === null) return null;
|
|
213
|
+
let n = A(O.MotelyItemType, t) ?? `Unknown_${t}`, r = F(t);
|
|
214
|
+
return {
|
|
215
|
+
itemType: t,
|
|
216
|
+
enumKey: n,
|
|
217
|
+
displayName: j(n),
|
|
218
|
+
category: r,
|
|
219
|
+
edition: R(e),
|
|
220
|
+
seal: z(e),
|
|
221
|
+
enhancement: B(e),
|
|
222
|
+
rank: V(e),
|
|
223
|
+
suit: H(e)
|
|
224
|
+
};
|
|
225
|
+
}
|
|
226
|
+
function G(e, t) {
|
|
227
|
+
let n = W(e);
|
|
228
|
+
return n ? {
|
|
229
|
+
type: n.category === "joker" ? "joker" : n.category === "playing" ? "playing" : "consumable",
|
|
230
|
+
card: {
|
|
231
|
+
name: n.displayName,
|
|
232
|
+
edition: n.edition ?? void 0,
|
|
233
|
+
seal: n.seal ?? void 0,
|
|
234
|
+
enhancements: n.enhancement ? [n.enhancement] : void 0,
|
|
235
|
+
rank: n.rank ?? void 0,
|
|
236
|
+
suit: n.suit ?? void 0,
|
|
237
|
+
scale: t
|
|
238
|
+
}
|
|
239
|
+
} : null;
|
|
240
|
+
}
|
|
241
|
+
function K() {}
|
|
242
|
+
function q() {
|
|
243
|
+
return 0;
|
|
244
|
+
}
|
|
245
|
+
//#endregion
|
|
246
|
+
export { S as C, v as S, y as T, D as _, F as a, b, B as c, P as d, V as f, E as g, K as h, q as i, I as l, N as m, U as n, L as o, H as p, G as r, R as s, W as t, z as u, w as v, x as w, _ as x, o as y };
|
|
247
|
+
|
|
248
|
+
//# sourceMappingURL=motelyItemDecoder-Bg12hhB2.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"motelyItemDecoder-Bg12hhB2.js","names":[],"sources":["../../src/motelyBoot.ts","../../src/hooks/useJamlLibrary.ts","../../src/hooks/useMotelyRuntime.ts","../../src/decode/motelyItemDecoder.ts"],"sourcesContent":["import bootsharp, { Motely } from \"motely-wasm\";\nimport { IFileMounter } from \"motely-wasm/bootsharp/file-system\";\n\ntype FileSystemPackage = typeof import(\"@rewaffle/bootsharp-file-system\");\n\nlet fileSystemPackage: FileSystemPackage | null = null;\nlet fileSystemInitError: unknown = null;\n\ntry {\n fileSystemPackage = await import(\"@rewaffle/bootsharp-file-system\");\n fileSystemPackage.init(IFileMounter);\n} catch (error) {\n // The FileSystem package is private/registry-scoped. Search and analysis\n // still work without it; library mount APIs will fail until it is installed.\n fileSystemInitError = error;\n}\n\nconst BOOT_ROOT_CANDIDATES = [\"/motely-wasm/bin\", \"/node_modules/motely-wasm/bin\", \"/bin\"];\n\nexport type MotelyRuntimeStatus = \"idle\" | \"booting\" | \"ready\" | \"error\";\n\nexport interface MotelyRuntimeSnapshot {\n status: MotelyRuntimeStatus;\n error: unknown;\n isFileSystemReady: boolean;\n fileSystemError: unknown;\n}\n\nlet runtimeSnapshot: MotelyRuntimeSnapshot = {\n status: \"idle\",\n error: null,\n isFileSystemReady: fileSystemPackage !== null,\n fileSystemError: fileSystemInitError,\n};\n\nconst runtimeListeners = new Set<() => void>();\n\nfunction updateRuntimeSnapshot(next: Partial<MotelyRuntimeSnapshot>): void {\n runtimeSnapshot = { ...runtimeSnapshot, ...next };\n for (const listener of runtimeListeners) {\n listener();\n }\n}\n\nasync function bootMotelyRuntime(): Promise<void> {\n updateRuntimeSnapshot({ status: \"booting\", error: null });\n try {\n if (bootsharp.getStatus() === bootsharp.BootStatus.Standby) {\n let lastError: unknown = null;\n for (const root of BOOT_ROOT_CANDIDATES) {\n try {\n await bootsharp.boot(root);\n lastError = null;\n break;\n } catch (error) {\n lastError = error;\n }\n }\n if (lastError) throw lastError;\n }\n updateRuntimeSnapshot({ status: \"ready\", error: null });\n } catch (error) {\n updateRuntimeSnapshot({ status: \"error\", error });\n throw error;\n }\n}\n\nlet runtimeReadyPromise: Promise<void> | null = null;\n\nexport function ensureMotelyReady(): Promise<void> {\n if (!runtimeReadyPromise) {\n runtimeReadyPromise = bootMotelyRuntime();\n }\n return runtimeReadyPromise;\n}\n\nexport function getMotelyRuntimeSnapshot(): MotelyRuntimeSnapshot {\n return runtimeSnapshot;\n}\n\nexport function subscribeMotelyRuntime(listener: () => void): () => void {\n runtimeListeners.add(listener);\n return () => {\n runtimeListeners.delete(listener);\n };\n}\n\nexport const MotelyFileSystem = fileSystemPackage;\nexport const motelyFileSystemInitError = fileSystemInitError;\nexport const isMotelyFileSystemReady = fileSystemPackage !== null;\n\nexport { Motely };\n","\"use client\";\n\nimport { useCallback, useState } from \"react\";\nimport { Motely, ensureMotelyReady, isMotelyFileSystemReady, motelyFileSystemInitError } from \"../motelyBoot.js\";\nimport { PermissionMode } from \"motely-wasm/bootsharp/file-system\";\n\nexport type JamlLibraryStatus = \"idle\" | \"unsupported\" | \"mounting\" | \"ready\" | \"error\";\n\nexport interface UseJamlLibraryState {\n status: JamlLibraryStatus;\n rootId: string | null;\n files: string[];\n error: string | null;\n mount: () => Promise<void>;\n unmount: () => Promise<void>;\n loadFile: (uri: string) => Promise<string>;\n saveFile: (uri: string, content: string) => Promise<void>;\n refresh: () => void;\n}\n\nfunction errorMessage(error: unknown): string {\n return error instanceof Error ? error.message : String(error);\n}\n\nexport function useJamlLibrary(): UseJamlLibraryState {\n const [status, setStatus] = useState<JamlLibraryStatus>(() => isMotelyFileSystemReady ? \"idle\" : \"unsupported\");\n const [rootId, setRootId] = useState<string | null>(null);\n const [files, setFiles] = useState<string[]>([]);\n const [error, setError] = useState<string | null>(() =>\n isMotelyFileSystemReady ? null : errorMessage(motelyFileSystemInitError ?? \"Bootsharp FileSystem package is not available.\"),\n );\n\n const refresh = useCallback(() => {\n if (!rootId) return;\n setFiles((prev) => [...prev]);\n }, [rootId]);\n\n const mount = useCallback(async () => {\n if (!isMotelyFileSystemReady) {\n setStatus(\"unsupported\");\n setError(errorMessage(motelyFileSystemInitError ?? \"Bootsharp FileSystem package is not available.\"));\n return;\n }\n\n setStatus(\"mounting\");\n setError(null);\n\n try {\n await ensureMotelyReady();\n const pickedRoot = await Motely.pickRoot({ mode: PermissionMode.ReadWrite, id: \"jaml-library\" });\n if (!pickedRoot) {\n setStatus(\"idle\");\n return;\n }\n\n const mountedRoot = await Motely.mountRoot(pickedRoot, { mode: PermissionMode.ReadWrite });\n setRootId(mountedRoot);\n setFiles([]);\n setStatus(\"ready\");\n } catch (err) {\n setStatus(\"error\");\n setError(errorMessage(err));\n }\n }, []);\n\n const unmount = useCallback(async () => {\n if (!rootId) return;\n await ensureMotelyReady();\n await Motely.unmountRoot(rootId);\n setRootId(null);\n setFiles([]);\n setStatus(isMotelyFileSystemReady ? \"idle\" : \"unsupported\");\n }, [rootId]);\n\n const loadFile = useCallback(async (uri: string) => {\n if (!rootId) throw new Error(\"JAML library is not mounted.\");\n await ensureMotelyReady();\n return await Motely.readTextFile(rootId, uri);\n }, [rootId]);\n\n const saveFile = useCallback(async (uri: string, content: string) => {\n if (!rootId) throw new Error(\"JAML library is not mounted.\");\n await ensureMotelyReady();\n await Motely.writeTextFile(rootId, uri, content);\n setFiles((prev) => (prev.includes(uri) ? prev : [...prev, uri]).sort((a, b) => a.localeCompare(b)));\n }, [rootId]);\n\n return { status, rootId, files, error, mount, unmount, loadFile, saveFile, refresh };\n}\n","\"use client\";\r\n\r\nimport { useCallback, useEffect, useMemo, useSyncExternalStore } from \"react\";\r\nimport {\r\n ensureMotelyReady,\r\n getMotelyRuntimeSnapshot,\r\n subscribeMotelyRuntime,\r\n type MotelyRuntimeStatus,\r\n} from \"../motelyBoot.js\";\r\n\r\nexport interface UseMotelyRuntimeState {\r\n status: MotelyRuntimeStatus;\r\n ready: boolean;\r\n error: string | null;\r\n fsReady: boolean;\r\n fsError: string | null;\r\n ensureReady: () => Promise<void>;\r\n}\r\n\r\nfunction formatError(error: unknown): string | null {\r\n if (!error) return null;\r\n return error instanceof Error ? error.message : String(error);\r\n}\r\n\r\nexport function useMotelyRuntime(): UseMotelyRuntimeState {\r\n const snapshot = useSyncExternalStore(subscribeMotelyRuntime, getMotelyRuntimeSnapshot, getMotelyRuntimeSnapshot);\r\n const ensureReady = useCallback(() => ensureMotelyReady(), []);\r\n\r\n return useMemo(\r\n () => ({\r\n status: snapshot.status,\r\n ready: snapshot.status === \"ready\",\r\n error: formatError(snapshot.error),\r\n fsReady: snapshot.isFileSystemReady,\r\n fsError: formatError(snapshot.fileSystemError),\r\n ensureReady,\r\n }),\r\n [snapshot, ensureReady],\r\n );\r\n}\r\n\r\nexport function useMotelyRuntimeOwner(): void {\r\n const ensureReady = useCallback(() => ensureMotelyReady(), []);\r\n\r\n useEffect(() => {\r\n void ensureReady();\r\n }, [ensureReady]);\r\n}\r\n","import { Motely } from \"../motelyBoot.js\";\n\ntype RuntimeEnum = Record<string, string | number>;\ntype MotelyRuntimeEnums = typeof Motely & Record<string, RuntimeEnum>;\n\nconst MotelyEnums = Motely as MotelyRuntimeEnums;\n\nconst CATEGORY_MAP: Record<number, MotelyRenderableCategory> = {\n [MotelyEnums.MotelyItemTypeCategory.Standardcard as number]: \"playing\",\n [MotelyEnums.MotelyItemTypeCategory.SpectralCard as number]: \"spectral\",\n [MotelyEnums.MotelyItemTypeCategory.TarotCard as number]: \"tarot\",\n [MotelyEnums.MotelyItemTypeCategory.PlanetCard as number]: \"planet\",\n [MotelyEnums.MotelyItemTypeCategory.Joker as number]: \"joker\",\n};\n\nexport type CardCategory = \"joker\" | \"consumable\" | \"playing\" | \"spectral\" | \"tarot\" | \"planet\";\nexport type MotelyRenderableCategory = CardCategory | \"unknown\";\n\nexport type MotelyItemInput = number | MotelyRuntimeItem | null | undefined;\n\nexport interface MotelyRuntimeItem {\n type?: number;\n value?: number;\n edition?: number;\n seal?: number;\n enhancement?: number;\n suit?: number;\n rank?: number;\n}\n\nexport interface DecodedMotelyItem {\n itemType: number;\n enumKey: string;\n displayName: string;\n category: MotelyRenderableCategory;\n edition: \"Foil\" | \"Holographic\" | \"Polychrome\" | \"Negative\" | null;\n seal: \"Gold\" | \"Red\" | \"Blue\" | \"Purple\" | null;\n enhancement: string | null;\n rank: string | null;\n suit: \"Clubs\" | \"Diamonds\" | \"Hearts\" | \"Spades\" | null;\n}\n\nexport interface MotelyJamlCard {\n type: \"joker\" | \"consumable\" | \"playing\";\n card: {\n name: string;\n edition?: \"Foil\" | \"Holographic\" | \"Polychrome\" | \"Negative\";\n seal?: string;\n enhancements?: string[];\n rank?: string;\n suit?: string;\n scale?: number;\n };\n}\n\nfunction enumKey<T extends Record<string, unknown>>(e: T, value: number): string | null {\n const k = e[String(value)];\n return typeof k === \"string\" ? k : null;\n}\n\nfunction spaceSplit(value: string): string {\n return value.replace(/([a-z])([A-Z])/g, \"$1 $2\").replace(/([A-Z]+)([A-Z][a-z])/g, \"$1 $2\");\n}\n\nfunction resolvePackedValue(input: MotelyItemInput): number | null {\n if (input == null) return null;\n if (typeof input === \"number\") return Number.isFinite(input) ? input : null;\n return input.value ?? input.type ?? null;\n}\n\nexport function resolveMotelyItemType(input: MotelyItemInput): number | null {\n const val = resolvePackedValue(input);\n return val !== null ? val & 0xffff : null;\n}\n\nexport function motelyItemTypeName(input: MotelyItemInput): string {\n const itemType = resolveMotelyItemType(input);\n if (itemType === null) return \"Unknown\";\n return enumKey(MotelyEnums.MotelyItemType, itemType) ?? `item#${itemType}`;\n}\n\nexport function motelyItemCategory(itemType: number): MotelyRenderableCategory {\n const catValue = (itemType >> 12) & 0xf;\n return CATEGORY_MAP[catValue] ?? \"unknown\";\n}\n\nexport function motelyItemRenderCategory(input: MotelyItemInput): MotelyRenderableCategory {\n const itemType = resolveMotelyItemType(input);\n if (itemType === null) return \"unknown\";\n return motelyItemCategory(itemType);\n}\n\nexport function motelyItemDisplayName(input: MotelyItemInput): string {\n return spaceSplit(motelyItemTypeName(input));\n}\n\nexport function motelyItemEditionName(input: MotelyItemInput): \"Foil\" | \"Holographic\" | \"Polychrome\" | \"Negative\" | null {\n if (input == null) return null;\n const val = typeof input === \"number\" ? input : input.edition;\n if (val == null) return null;\n const key = enumKey(MotelyEnums.MotelyItemEdition, val);\n if (!key || key === \"None\") return null;\n return key as \"Foil\" | \"Holographic\" | \"Polychrome\" | \"Negative\";\n}\n\nexport function motelyItemSealName(input: MotelyItemInput): \"Gold\" | \"Red\" | \"Blue\" | \"Purple\" | null {\n if (input == null) return null;\n const val = typeof input === \"number\" ? null : input.seal;\n if (val == null) return null;\n const key = enumKey(MotelyEnums.MotelyItemSeal, val);\n if (!key || key === \"None\") return null;\n return key as \"Gold\" | \"Red\" | \"Blue\" | \"Purple\";\n}\n\nexport function motelyItemEnhancementName(input: MotelyItemInput): string | null {\n if (input == null) return null;\n const val = typeof input === \"number\" ? null : input.enhancement;\n if (val == null) return null;\n const key = enumKey(MotelyEnums.MotelyItemEnhancement, val);\n if (!key || key === \"None\") return null;\n return key;\n}\n\nexport function motelyStandardcardRankName(input: MotelyItemInput): string | null {\n if (input == null) return null;\n const val = typeof input === \"number\" ? null : input.rank;\n if (val == null) return null;\n return enumKey(MotelyEnums.MotelyStandardcardRank, val);\n}\n\nexport function motelyStandardcardSuitName(input: MotelyItemInput): \"Clubs\" | \"Diamonds\" | \"Hearts\" | \"Spades\" | null {\n if (input == null) return null;\n const val = typeof input === \"number\" ? null : input.suit;\n if (val == null) return null;\n return enumKey(MotelyEnums.MotelyStandardcardSuit, val) as \"Clubs\" | \"Diamonds\" | \"Hearts\" | \"Spades\" | null;\n}\n\nexport function decodeMotelyItemName(input: MotelyItemInput): string {\n return motelyItemTypeName(input);\n}\n\nexport function decodeMotelyItem(input: MotelyItemInput): DecodedMotelyItem | null {\n const itemType = resolveMotelyItemType(input);\n if (itemType === null) return null;\n\n const enumKeyStr = enumKey(MotelyEnums.MotelyItemType, itemType) ?? `Unknown_${itemType}`;\n const category = motelyItemCategory(itemType);\n const displayName = spaceSplit(enumKeyStr);\n\n return {\n itemType,\n enumKey: enumKeyStr,\n displayName,\n category,\n edition: motelyItemEditionName(input),\n seal: motelyItemSealName(input),\n enhancement: motelyItemEnhancementName(input),\n rank: motelyStandardcardRankName(input),\n suit: motelyStandardcardSuitName(input),\n };\n}\n\nexport function decodeMotelyItemToJamlCard(input: MotelyItemInput, scale?: number): MotelyJamlCard | null {\n const decoded = decodeMotelyItem(input);\n if (!decoded) return null;\n\n const type: \"joker\" | \"consumable\" | \"playing\" =\n decoded.category === \"joker\" ? \"joker\"\n : decoded.category === \"playing\" ? \"playing\"\n : \"consumable\";\n\n return {\n type,\n card: {\n name: decoded.displayName,\n edition: decoded.edition ?? undefined,\n seal: decoded.seal ?? undefined,\n enhancements: decoded.enhancement ? [decoded.enhancement] : undefined,\n rank: decoded.rank ?? undefined,\n suit: decoded.suit ?? undefined,\n scale,\n },\n };\n}\n\nexport function warmMotelyItemCache(): void { /* no-op */ }\nexport function motelyItemCacheSize(): number { return 0; }\n"],"mappings":";;;;AAKA,IAAI,IAA8C,MAC9C,IA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tPOuxF.js","names":[],"sources":[],"mappings":""}
|
|
@@ -1234,7 +1234,7 @@ function ye({ open: e, title: t, message: n, placeholder: r, initialValue: i = "
|
|
|
1234
1234
|
children: n
|
|
1235
1235
|
}),
|
|
1236
1236
|
/* @__PURE__ */ h("input", {
|
|
1237
|
-
"aria-invalid": _
|
|
1237
|
+
"aria-invalid": !!_,
|
|
1238
1238
|
onChange: (e) => {
|
|
1239
1239
|
m(e.target.value), _ && v(null);
|
|
1240
1240
|
},
|
|
@@ -1384,4 +1384,4 @@ function xe({ orientation: e = "vertical", onDrag: t, onKeyAdjust: n, "aria-labe
|
|
|
1384
1384
|
//#endregion
|
|
1385
1385
|
export { k as A, S as B, M as C, ce as D, ue as E, T as F, ie as I, w as L, D as M, A as N, ae as O, E as P, ne as R, I as S, de as T, ee as V, H as _, Y as a, z as b, he as c, J as d, G as f, V as g, U as h, ve as i, O as j, se as k, me as l, K as m, be as n, _e as o, q as p, ye as r, ge as s, xe as t, W as u, pe as v, fe as w, L as x, B as y, C as z };
|
|
1386
1386
|
|
|
1387
|
-
//# sourceMappingURL=ui-
|
|
1387
|
+
//# sourceMappingURL=ui-0liG4zOw.js.map
|