@onlyworlds/sdk 4.186.2 → 4.187.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.
- package/AGENTS.md +4 -2
- package/README.md +19 -0
- package/SCHEMA.md +1 -1
- package/dist/{chunk-EFH2PAJN.js → chunk-5XUVYQ5Q.js} +2 -650
- package/dist/chunk-EU4B5WYE.js +662 -0
- package/dist/chunk-OCPNZOFN.js +938 -0
- package/dist/convert.d.ts +200 -0
- package/dist/convert.js +2395 -0
- package/dist/index.js +110 -978
- package/dist/waymark.js +4 -2
- package/package.json +12 -5
package/dist/index.js
CHANGED
|
@@ -1,5 +1,51 @@
|
|
|
1
1
|
import {
|
|
2
2
|
AGENT_DOORS,
|
|
3
|
+
MAP_SPACE,
|
|
4
|
+
OwAddressError,
|
|
5
|
+
SPATIAL_TYPES,
|
|
6
|
+
TOOLS,
|
|
7
|
+
doorWhere,
|
|
8
|
+
doorsOf,
|
|
9
|
+
elementAddress,
|
|
10
|
+
findOwLinks,
|
|
11
|
+
isAgentDoor,
|
|
12
|
+
isHiddenMark,
|
|
13
|
+
isKnownOf,
|
|
14
|
+
openersFor,
|
|
15
|
+
parseOwLink,
|
|
16
|
+
readOwLinkAt,
|
|
17
|
+
typeWord
|
|
18
|
+
} from "./chunk-EU4B5WYE.js";
|
|
19
|
+
import {
|
|
20
|
+
OwWorldFileError,
|
|
21
|
+
WORLD_FILE_MAX_BYTES,
|
|
22
|
+
WORLD_FILE_MAX_ENTRIES,
|
|
23
|
+
WORLD_FILE_MEDIA_TYPE,
|
|
24
|
+
byCodePoint,
|
|
25
|
+
compareInstants,
|
|
26
|
+
compareKeys,
|
|
27
|
+
editedBy,
|
|
28
|
+
hasUnseenRecipients,
|
|
29
|
+
inCreatedOrder,
|
|
30
|
+
instantOf,
|
|
31
|
+
isAddressedTo,
|
|
32
|
+
isMessage,
|
|
33
|
+
isNote,
|
|
34
|
+
isSentBy,
|
|
35
|
+
isToEveryone,
|
|
36
|
+
keyedId,
|
|
37
|
+
nfc,
|
|
38
|
+
noteOf,
|
|
39
|
+
readMarkOf,
|
|
40
|
+
readWorldFile,
|
|
41
|
+
recipientsOf,
|
|
42
|
+
senderStatus,
|
|
43
|
+
threadOf,
|
|
44
|
+
timeKey,
|
|
45
|
+
unreadFor,
|
|
46
|
+
writeWorldFile
|
|
47
|
+
} from "./chunk-OCPNZOFN.js";
|
|
48
|
+
import {
|
|
3
49
|
CHARTER_PAIRS,
|
|
4
50
|
DRAG_PAIRS,
|
|
5
51
|
ELEMENT_GROUPS,
|
|
@@ -10,38 +56,23 @@ import {
|
|
|
10
56
|
GENERIC_LINKS,
|
|
11
57
|
GROUP_COLORS,
|
|
12
58
|
GROUP_ORDER,
|
|
13
|
-
MAP_SPACE,
|
|
14
59
|
MESSAGE_PAIR,
|
|
15
|
-
MESSAGE_READ_MARK,
|
|
16
60
|
NOTE_PAIR,
|
|
17
61
|
ONLYWORLDS_VERSION,
|
|
18
|
-
OwAddressError,
|
|
19
62
|
PROPOSED_MARK,
|
|
20
63
|
PUBLIC_FIELDS,
|
|
21
64
|
READING_AID_KEYS,
|
|
22
65
|
REVIEW_PROPOSED_LABEL,
|
|
23
66
|
ROOM_PAIRS,
|
|
24
|
-
SPATIAL_TYPES,
|
|
25
|
-
TOOLS,
|
|
26
67
|
VIEWS_TABLE,
|
|
27
|
-
doorWhere,
|
|
28
|
-
doorsOf,
|
|
29
|
-
elementAddress,
|
|
30
|
-
findOwLinks,
|
|
31
68
|
fold,
|
|
32
69
|
handsOnAsProposed,
|
|
33
70
|
hasMark,
|
|
34
|
-
isAgentDoor,
|
|
35
71
|
isCharterElement,
|
|
36
|
-
isHiddenMark,
|
|
37
|
-
isKnownOf,
|
|
38
72
|
isRoomElement,
|
|
39
73
|
isWhiteSpaceAt,
|
|
40
74
|
namedTalks,
|
|
41
|
-
openersFor,
|
|
42
|
-
parseOwLink,
|
|
43
75
|
proposedMarkOf,
|
|
44
|
-
readOwLinkAt,
|
|
45
76
|
readingAidKey,
|
|
46
77
|
readingAidOf,
|
|
47
78
|
refuseUnknownOptions,
|
|
@@ -49,67 +80,8 @@ import {
|
|
|
49
80
|
talksOf,
|
|
50
81
|
trimAndFold,
|
|
51
82
|
trimWhiteSpace,
|
|
52
|
-
typeWord,
|
|
53
83
|
unknownKey
|
|
54
|
-
} from "./chunk-
|
|
55
|
-
|
|
56
|
-
// src/v2/keyed-id.ts
|
|
57
|
-
var KEYED_IDS = "0199b6a0-6f0e-7c2a-9d1e-3b5c7a8e4f21";
|
|
58
|
-
function sha1(msg) {
|
|
59
|
-
const ml = msg.length;
|
|
60
|
-
const total = (ml + 8 >> 6) + 1 << 6;
|
|
61
|
-
const buf = new Uint8Array(total);
|
|
62
|
-
buf.set(msg);
|
|
63
|
-
buf[ml] = 128;
|
|
64
|
-
const bits = ml * 8;
|
|
65
|
-
const view = new DataView(buf.buffer);
|
|
66
|
-
view.setUint32(total - 8, Math.floor(bits / 2 ** 32));
|
|
67
|
-
view.setUint32(total - 4, bits >>> 0);
|
|
68
|
-
let h0 = 1732584193, h1 = 4023233417, h2 = 2562383102, h3 = 271733878, h4 = 3285377520;
|
|
69
|
-
const w = new Uint32Array(80);
|
|
70
|
-
for (let off = 0; off < total; off += 64) {
|
|
71
|
-
for (let i = 0; i < 16; i++) w[i] = view.getUint32(off + i * 4);
|
|
72
|
-
for (let i = 16; i < 80; i++) {
|
|
73
|
-
const x = w[i - 3] ^ w[i - 8] ^ w[i - 14] ^ w[i - 16];
|
|
74
|
-
w[i] = x << 1 | x >>> 31;
|
|
75
|
-
}
|
|
76
|
-
let a = h0, b = h1, c = h2, d = h3, e = h4;
|
|
77
|
-
for (let i = 0; i < 80; i++) {
|
|
78
|
-
const [f, k] = i < 20 ? [b & c | ~b & d, 1518500249] : i < 40 ? [b ^ c ^ d, 1859775393] : i < 60 ? [b & c | b & d | c & d, 2400959708] : [b ^ c ^ d, 3395469782];
|
|
79
|
-
const t = (a << 5 | a >>> 27) + f + e + k + w[i] >>> 0;
|
|
80
|
-
e = d;
|
|
81
|
-
d = c;
|
|
82
|
-
c = b << 30 | b >>> 2;
|
|
83
|
-
b = a;
|
|
84
|
-
a = t;
|
|
85
|
-
}
|
|
86
|
-
h0 = h0 + a >>> 0;
|
|
87
|
-
h1 = h1 + b >>> 0;
|
|
88
|
-
h2 = h2 + c >>> 0;
|
|
89
|
-
h3 = h3 + d >>> 0;
|
|
90
|
-
h4 = h4 + e >>> 0;
|
|
91
|
-
}
|
|
92
|
-
const out = new Uint8Array(20);
|
|
93
|
-
const ov = new DataView(out.buffer);
|
|
94
|
-
[h0, h1, h2, h3, h4].forEach((h, i) => ov.setUint32(i * 4, h));
|
|
95
|
-
return out;
|
|
96
|
-
}
|
|
97
|
-
var hexBytes = (hex) => Uint8Array.from(hex.replace(/-/g, "").match(/../g).map((b) => parseInt(b, 16)));
|
|
98
|
-
function uuid5(ns, name) {
|
|
99
|
-
const nameBytes = new TextEncoder().encode(name);
|
|
100
|
-
const input = new Uint8Array(16 + nameBytes.length);
|
|
101
|
-
input.set(hexBytes(ns));
|
|
102
|
-
input.set(nameBytes, 16);
|
|
103
|
-
const b = sha1(input).slice(0, 16);
|
|
104
|
-
b[6] = b[6] & 15 | 80;
|
|
105
|
-
b[8] = b[8] & 63 | 128;
|
|
106
|
-
const h = [...b].map((x) => x.toString(16).padStart(2, "0")).join("");
|
|
107
|
-
return `${h.slice(0, 8)}-${h.slice(8, 12)}-${h.slice(12, 16)}-${h.slice(16, 20)}-${h.slice(20)}`;
|
|
108
|
-
}
|
|
109
|
-
function keyedId(idempotencyKey, index) {
|
|
110
|
-
return uuid5(KEYED_IDS, `${idempotencyKey}
|
|
111
|
-
${index}`);
|
|
112
|
-
}
|
|
84
|
+
} from "./chunk-5XUVYQ5Q.js";
|
|
113
85
|
|
|
114
86
|
// src/v2/errors.ts
|
|
115
87
|
var OwApiError = class extends Error {
|
|
@@ -2848,213 +2820,6 @@ function getElementLabel(elementType) {
|
|
|
2848
2820
|
return ELEMENT_LABELS[elementType];
|
|
2849
2821
|
}
|
|
2850
2822
|
|
|
2851
|
-
// src/message.ts
|
|
2852
|
-
var ADDRESSING_KEYS = ["keyless"];
|
|
2853
|
-
var isBody = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
|
|
2854
|
-
var idOf = (v) => v.id;
|
|
2855
|
-
var carries = (v, key3) => Object.prototype.hasOwnProperty.call(v, key3) && v[key3] !== void 0;
|
|
2856
|
-
function matchesPair(el, pair) {
|
|
2857
|
-
if (!isBody(el) || typeof el.type !== "string" || typeof el.supertype !== "string") return false;
|
|
2858
|
-
return fold(el.type) === fold(pair.type) && fold(el.supertype) === fold(pair.supertype);
|
|
2859
|
-
}
|
|
2860
|
-
function keylessOf(fn, options) {
|
|
2861
|
-
if (options !== void 0 && options !== null && !isBody(options)) {
|
|
2862
|
-
throw new TypeError(`${fn}: options is an object, such as { keyless: true }; got ${JSON.stringify(options) ?? typeof options}.`);
|
|
2863
|
-
}
|
|
2864
|
-
refuseUnknownOptions(fn, options, ADDRESSING_KEYS);
|
|
2865
|
-
const keyless = isBody(options) ? options.keyless : void 0;
|
|
2866
|
-
if (keyless !== void 0 && typeof keyless !== "boolean") {
|
|
2867
|
-
throw new TypeError(`${fn}: keyless is true or false; got ${JSON.stringify(keyless) ?? typeof keyless}.`);
|
|
2868
|
-
}
|
|
2869
|
-
return keyless === true;
|
|
2870
|
-
}
|
|
2871
|
-
function characterOf(membership, members) {
|
|
2872
|
-
if (!Array.isArray(members)) return void 0;
|
|
2873
|
-
const row = members.find((m) => isBody(m) && m.id === membership);
|
|
2874
|
-
return row !== void 0 && typeof row.character === "string" && row.character !== "" ? row.character : void 0;
|
|
2875
|
-
}
|
|
2876
|
-
function handOf(body, members) {
|
|
2877
|
-
return carries(body, "created_by") ? characterOf(body.created_by, members) : void 0;
|
|
2878
|
-
}
|
|
2879
|
-
var DATE_TIME = /^([0-9]{4})-([0-9]{2})-([0-9]{2})[Tt]([0-9]{2}):([0-9]{2}):([0-9]{2})(?:\.([0-9]+))?(?:[Zz]|([+-])([0-9]{2}):([0-9]{2}))?$/;
|
|
2880
|
-
var floorDiv = (a, b) => Math.floor(a / b);
|
|
2881
|
-
var isLeap = (y) => y % 4 === 0 && (y % 100 !== 0 || y % 400 === 0);
|
|
2882
|
-
var DAYS_IN = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
|
|
2883
|
-
function daysFromCivil(y, m, d) {
|
|
2884
|
-
const yy = m <= 2 ? y - 1 : y;
|
|
2885
|
-
const era = floorDiv(yy, 400);
|
|
2886
|
-
const yoe = yy - era * 400;
|
|
2887
|
-
const doy = floorDiv(153 * (m + (m > 2 ? -3 : 9)) + 2, 5) + d - 1;
|
|
2888
|
-
const doe = yoe * 365 + floorDiv(yoe, 4) - floorDiv(yoe, 100) + doy;
|
|
2889
|
-
return era * 146097 + doe - 719468;
|
|
2890
|
-
}
|
|
2891
|
-
function timeKey(value) {
|
|
2892
|
-
if (typeof value !== "string") return null;
|
|
2893
|
-
const m = DATE_TIME.exec(value);
|
|
2894
|
-
if (m === null) return null;
|
|
2895
|
-
const [y, mo, d, h, mi, s] = m.slice(1, 7).map(Number);
|
|
2896
|
-
if (mo < 1 || mo > 12 || d < 1 || d > (mo === 2 && isLeap(y) ? 29 : DAYS_IN[mo - 1]) || h > 23 || mi > 59 || s > 59) return null;
|
|
2897
|
-
let offset = 0;
|
|
2898
|
-
if (m[8] !== void 0) {
|
|
2899
|
-
const oh = Number(m[9]), om = Number(m[10]);
|
|
2900
|
-
if (oh > 23 || om > 59) return null;
|
|
2901
|
-
offset = (oh * 3600 + om * 60) * (m[8] === "-" ? -1 : 1);
|
|
2902
|
-
}
|
|
2903
|
-
const seconds = daysFromCivil(y, mo, d) * 86400 + h * 3600 + mi * 60 + s - offset;
|
|
2904
|
-
return [seconds, Number(((m[7] ?? "") + "000000").slice(0, 6))];
|
|
2905
|
-
}
|
|
2906
|
-
function instantOf(value) {
|
|
2907
|
-
const key3 = timeKey(value);
|
|
2908
|
-
return key3 === null ? null : { seconds: key3[0], microseconds: key3[1] };
|
|
2909
|
-
}
|
|
2910
|
-
function compareInstants(a, b) {
|
|
2911
|
-
if (a === null || b === null) return a === null ? b === null ? 0 : 1 : -1;
|
|
2912
|
-
return a.seconds - b.seconds || a.microseconds - b.microseconds;
|
|
2913
|
-
}
|
|
2914
|
-
var compareKeys = (a, b) => a[0] - b[0] || a[1] - b[1];
|
|
2915
|
-
function byCodePoint(a, b) {
|
|
2916
|
-
const x = Array.from(a);
|
|
2917
|
-
const y = Array.from(b);
|
|
2918
|
-
const n = Math.min(x.length, y.length);
|
|
2919
|
-
for (let i = 0; i < n; i++) {
|
|
2920
|
-
const d = x[i].codePointAt(0) - y[i].codePointAt(0);
|
|
2921
|
-
if (d !== 0) return d;
|
|
2922
|
-
}
|
|
2923
|
-
return x.length - y.length;
|
|
2924
|
-
}
|
|
2925
|
-
function inCreatedOrder(items) {
|
|
2926
|
-
return items.map((item, index) => ({ item, index, key: timeKey(item.created_at) })).sort((a, b) => {
|
|
2927
|
-
if (a.key && b.key) return compareKeys(a.key, b.key) || a.index - b.index;
|
|
2928
|
-
if (a.key) return -1;
|
|
2929
|
-
if (b.key) return 1;
|
|
2930
|
-
return a.index - b.index;
|
|
2931
|
-
}).map((e) => e.item);
|
|
2932
|
-
}
|
|
2933
|
-
function isMessage(element) {
|
|
2934
|
-
return matchesPair(element, MESSAGE_PAIR);
|
|
2935
|
-
}
|
|
2936
|
-
function isNote(element) {
|
|
2937
|
-
return matchesPair(element, NOTE_PAIR);
|
|
2938
|
-
}
|
|
2939
|
-
function recipientsOf(message) {
|
|
2940
|
-
const list2 = isBody(message) && isMessage(message) ? message.characters : void 0;
|
|
2941
|
-
if (!Array.isArray(list2)) return [];
|
|
2942
|
-
return [...new Set(list2.filter((c) => typeof c === "string" && c !== ""))];
|
|
2943
|
-
}
|
|
2944
|
-
function isAddressedTo(message, characterId) {
|
|
2945
|
-
if (!isBody(message) || !isMessage(message) || typeof characterId !== "string" || characterId === "") return false;
|
|
2946
|
-
if (isToEveryone(message)) return true;
|
|
2947
|
-
const list2 = message.characters;
|
|
2948
|
-
return Array.isArray(list2) && list2.includes(characterId);
|
|
2949
|
-
}
|
|
2950
|
-
function isToEveryone(message, options) {
|
|
2951
|
-
const keyless = keylessOf("isToEveryone", options);
|
|
2952
|
-
if (!isBody(message) || !isMessage(message) || keyless || hasUnseenRecipients(message) === true) return false;
|
|
2953
|
-
const list2 = message.characters;
|
|
2954
|
-
return list2 === void 0 || list2 === null || Array.isArray(list2) && list2.length === 0;
|
|
2955
|
-
}
|
|
2956
|
-
function hasUnseenRecipients(message, options) {
|
|
2957
|
-
const keyless = keylessOf("hasUnseenRecipients", options);
|
|
2958
|
-
if (!isBody(message) || !isMessage(message)) return false;
|
|
2959
|
-
if (keyless) return null;
|
|
2960
|
-
const mark = message.x_served_trimmed;
|
|
2961
|
-
return Array.isArray(mark) && mark.includes("characters");
|
|
2962
|
-
}
|
|
2963
|
-
function isSentBy(message, characterId) {
|
|
2964
|
-
return isBody(message) && typeof characterId === "string" && characterId !== "" && message.narrator === characterId;
|
|
2965
|
-
}
|
|
2966
|
-
function senderStatus(message, members) {
|
|
2967
|
-
const narrator = isBody(message) ? message.narrator : void 0;
|
|
2968
|
-
const claimed = typeof narrator === "string" && narrator !== "" ? narrator : null;
|
|
2969
|
-
const mark = isBody(message) ? message.x_served_trimmed : void 0;
|
|
2970
|
-
if (claimed === null && Array.isArray(mark) && mark.includes("narrator")) return { status: "unseen", claimed, writtenBy: null };
|
|
2971
|
-
if (claimed === null || !isBody(message)) return { status: "unverifiable", claimed, writtenBy: null };
|
|
2972
|
-
const hand = handOf(message, members);
|
|
2973
|
-
if (hand === void 0) return { status: "unverifiable", claimed, writtenBy: null };
|
|
2974
|
-
return hand === claimed ? { status: "verified", claimed, writtenBy: null } : { status: "mismatch", claimed, writtenBy: hand };
|
|
2975
|
-
}
|
|
2976
|
-
function editedBy(message, members) {
|
|
2977
|
-
if (!isBody(message) || !carries(message, "changed_by")) return { edited: false, by: null };
|
|
2978
|
-
if (carries(message, "created_by") && message.changed_by === message.created_by) return { edited: false, by: null };
|
|
2979
|
-
return { edited: true, by: characterOf(message.changed_by, members) ?? null };
|
|
2980
|
-
}
|
|
2981
|
-
var tieId = (body) => typeof body.id === "string" ? body.id : "";
|
|
2982
|
-
function readMarkOf(relations, characterId, members, options) {
|
|
2983
|
-
const keyless = keylessOf("readMarkOf", options);
|
|
2984
|
-
if (keyless || !Array.isArray(relations) || typeof characterId !== "string" || characterId === "") return null;
|
|
2985
|
-
let mark = null;
|
|
2986
|
-
let markKey = null;
|
|
2987
|
-
for (const rel of relations) {
|
|
2988
|
-
if (!matchesPair(rel, MESSAGE_READ_MARK) || rel[MESSAGE_READ_MARK.readerField] !== characterId) continue;
|
|
2989
|
-
const hasAuthor = carries(rel, "created_by");
|
|
2990
|
-
if (carries(rel, "changed_by") && (!hasAuthor || rel.changed_by !== rel.created_by)) continue;
|
|
2991
|
-
if (hasAuthor && handOf(rel, members) !== characterId) continue;
|
|
2992
|
-
const key3 = timeKey(rel.updated_at);
|
|
2993
|
-
const c = key3 !== null && markKey !== null ? compareKeys(key3, markKey) : key3 !== null ? 1 : markKey !== null ? -1 : 0;
|
|
2994
|
-
if (mark === null || c > 0 || c === 0 && byCodePoint(tieId(rel), tieId(mark)) > 0) {
|
|
2995
|
-
mark = rel;
|
|
2996
|
-
markKey = key3;
|
|
2997
|
-
}
|
|
2998
|
-
}
|
|
2999
|
-
return mark;
|
|
3000
|
-
}
|
|
3001
|
-
function isOwnHand(body, characterId, members) {
|
|
3002
|
-
if (!carries(body, "created_by")) return body.narrator === characterId;
|
|
3003
|
-
const sender = senderStatus(body, members);
|
|
3004
|
-
return sender.status === "verified" && sender.claimed === characterId;
|
|
3005
|
-
}
|
|
3006
|
-
function unreadFor(messages, characterId, readMark, members) {
|
|
3007
|
-
if (!Array.isArray(messages)) return [];
|
|
3008
|
-
const onMark = isBody(readMark) ? readMark[MESSAGE_READ_MARK.messagesField] : void 0;
|
|
3009
|
-
const read = new Set(Array.isArray(onMark) ? onMark.filter((id) => typeof id === "string") : []);
|
|
3010
|
-
return inCreatedOrder(messages.filter((m) => {
|
|
3011
|
-
if (!isBody(m) || !isAddressedTo(m, characterId)) return false;
|
|
3012
|
-
return !isOwnHand(m, characterId, members) && !read.has(idOf(m));
|
|
3013
|
-
}));
|
|
3014
|
-
}
|
|
3015
|
-
function threadOf(messages, rootId) {
|
|
3016
|
-
if (!Array.isArray(messages) || typeof rootId !== "string" || rootId === "") return [];
|
|
3017
|
-
const byId2 = /* @__PURE__ */ new Map();
|
|
3018
|
-
for (const m of messages) {
|
|
3019
|
-
const id = isBody(m) ? idOf(m) : void 0;
|
|
3020
|
-
if (typeof id === "string" && !byId2.has(id)) byId2.set(id, m);
|
|
3021
|
-
}
|
|
3022
|
-
const reaches = (start) => {
|
|
3023
|
-
const seen = /* @__PURE__ */ new Set();
|
|
3024
|
-
let at = start;
|
|
3025
|
-
while (at !== void 0) {
|
|
3026
|
-
const id = idOf(at);
|
|
3027
|
-
if (id === rootId) return true;
|
|
3028
|
-
if (typeof id !== "string" || seen.has(id)) return false;
|
|
3029
|
-
seen.add(id);
|
|
3030
|
-
const parent = at.parent_narrative;
|
|
3031
|
-
if (parent === rootId) return true;
|
|
3032
|
-
at = typeof parent === "string" ? byId2.get(parent) : void 0;
|
|
3033
|
-
}
|
|
3034
|
-
return false;
|
|
3035
|
-
};
|
|
3036
|
-
return inCreatedOrder(messages.filter((m) => isBody(m) && !isNote(m) && reaches(m)));
|
|
3037
|
-
}
|
|
3038
|
-
var isHiddenMark2 = (value) => value !== void 0 && value !== null && value !== false;
|
|
3039
|
-
function noteOf(narratives, characterId, members) {
|
|
3040
|
-
if (!Array.isArray(narratives) || typeof characterId !== "string" || characterId === "") return null;
|
|
3041
|
-
let line = null;
|
|
3042
|
-
let lineKey = null;
|
|
3043
|
-
for (const el of narratives) {
|
|
3044
|
-
if (!isNote(el)) continue;
|
|
3045
|
-
const note = el;
|
|
3046
|
-
const id = idOf(note);
|
|
3047
|
-
if (typeof id !== "string" || id === "" || note.narrator !== characterId) continue;
|
|
3048
|
-
if (isHiddenMark2(note.hidden) || proposedMarkOf(note) !== null || !isOwnHand(note, characterId, members)) continue;
|
|
3049
|
-
const key3 = timeKey(note.created_at);
|
|
3050
|
-
if (line === null || (key3 !== null ? lineKey === null || compareKeys(key3, lineKey) >= 0 : lineKey === null)) {
|
|
3051
|
-
line = id;
|
|
3052
|
-
lineKey = key3;
|
|
3053
|
-
}
|
|
3054
|
-
}
|
|
3055
|
-
return line;
|
|
3056
|
-
}
|
|
3057
|
-
|
|
3058
2823
|
// src/lens.ts
|
|
3059
2824
|
var LENS_OPTION_KEYS = ["asOf", "clock"];
|
|
3060
2825
|
var ANCHOR_FIELDS = [
|
|
@@ -3145,12 +2910,12 @@ function linkTarget(el, field, target) {
|
|
|
3145
2910
|
const key3 = el[`${field.slice(0, -3)}_type`];
|
|
3146
2911
|
return typeof key3 === "string" && TYPE_RANK.has(key3) ? key3 : "";
|
|
3147
2912
|
}
|
|
3148
|
-
var
|
|
2913
|
+
var isBody = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
|
|
3149
2914
|
var own = (v, key3) => Object.prototype.hasOwnProperty.call(v, key3);
|
|
3150
2915
|
var valueOf = (v, key3) => own(v, key3) && v[key3] !== void 0 ? v[key3] : null;
|
|
3151
2916
|
var whole = (v) => typeof v === "number" && Number.isInteger(v) ? v : null;
|
|
3152
2917
|
function dateOf(element) {
|
|
3153
|
-
if (!
|
|
2918
|
+
if (!isBody(element)) return null;
|
|
3154
2919
|
const type = typeof element.type === "string" ? fold(element.type) : "";
|
|
3155
2920
|
if (!own(DATE_FIELD, type)) return null;
|
|
3156
2921
|
return whole(valueOf(element, DATE_FIELD[type]));
|
|
@@ -3162,7 +2927,7 @@ function changedAt(el) {
|
|
|
3162
2927
|
}
|
|
3163
2928
|
function copy(v) {
|
|
3164
2929
|
if (Array.isArray(v)) return v.map(copy);
|
|
3165
|
-
if (
|
|
2930
|
+
if (isBody(v)) {
|
|
3166
2931
|
const out = {};
|
|
3167
2932
|
for (const k of Object.keys(v)) out[k] = copy(v[k]);
|
|
3168
2933
|
return out;
|
|
@@ -3170,7 +2935,7 @@ function copy(v) {
|
|
|
3170
2935
|
return v;
|
|
3171
2936
|
}
|
|
3172
2937
|
function isLens(element) {
|
|
3173
|
-
if (!
|
|
2938
|
+
if (!isBody(element) || typeof element.type !== "string" || typeof element.supertype !== "string") return false;
|
|
3174
2939
|
return fold(element.type) === "construct" && fold(element.supertype) === fold("Lens");
|
|
3175
2940
|
}
|
|
3176
2941
|
function isTemplate(element) {
|
|
@@ -3185,7 +2950,7 @@ function lensesInUse(membership, xLensUses) {
|
|
|
3185
2950
|
}
|
|
3186
2951
|
function readRecipe(raw) {
|
|
3187
2952
|
if (raw === void 0 || raw === null) raw = {};
|
|
3188
|
-
if (!
|
|
2953
|
+
if (!isBody(raw)) return { bad: "x_lens" };
|
|
3189
2954
|
const x = raw;
|
|
3190
2955
|
const depthV = valueOf(x, "depth");
|
|
3191
2956
|
const depth = depthV === null ? 1 : whole(depthV);
|
|
@@ -3225,7 +2990,7 @@ function readRecipe(raw) {
|
|
|
3225
2990
|
const mailV = valueOf(x, "mail");
|
|
3226
2991
|
if (mailV !== null && mailV !== "unread_full_read_titles" && mailV !== "all" && mailV !== "none") return { bad: "mail" };
|
|
3227
2992
|
const notesV = valueOf(x, "notes");
|
|
3228
|
-
if (notesV !== null && (!
|
|
2993
|
+
if (notesV !== null && (!isBody(notesV) || Object.keys(notesV).some((k) => typeof notesV[k] !== "string"))) return { bad: "notes" };
|
|
3229
2994
|
return {
|
|
3230
2995
|
recipe: {
|
|
3231
2996
|
depth,
|
|
@@ -3267,7 +3032,7 @@ var Reading = class {
|
|
|
3267
3032
|
for (const id of world.hidden) if (typeof id === "string") hidden.add(id);
|
|
3268
3033
|
}
|
|
3269
3034
|
for (const el of world.elements) {
|
|
3270
|
-
if (!
|
|
3035
|
+
if (!isBody(el) || typeof el.id !== "string" || el.id === "" || this.byId.has(el.id)) continue;
|
|
3271
3036
|
const type = typeof el.type === "string" ? fold(el.type) : "";
|
|
3272
3037
|
if (!TYPE_RANK.has(type)) continue;
|
|
3273
3038
|
this.byId.set(el.id, el);
|
|
@@ -3430,7 +3195,7 @@ var Reading = class {
|
|
|
3430
3195
|
}
|
|
3431
3196
|
}
|
|
3432
3197
|
let notesGone = false;
|
|
3433
|
-
if (anchorsBefore !== null &&
|
|
3198
|
+
if (anchorsBefore !== null && isBody(b.x_lens) && isBody(b.x_lens.notes)) {
|
|
3434
3199
|
const notes = b.x_lens.notes;
|
|
3435
3200
|
const served = new Set(ANCHOR_FIELDS.flatMap((f) => Array.isArray(b[f]) ? b[f] : []));
|
|
3436
3201
|
const kept = {};
|
|
@@ -3681,23 +3446,23 @@ function mailPart(r, mode, budget, clock) {
|
|
|
3681
3446
|
}
|
|
3682
3447
|
var NOTHING = () => ({ kept: [], rows: [], cut: {}, notesIgnored: 0, mail: null, unreadable: null });
|
|
3683
3448
|
function checkReader(reader, where) {
|
|
3684
|
-
if (!
|
|
3449
|
+
if (!isBody(reader) || !["owner", "co-builder", "contributor", "guest", "public"].includes(reader.rung)) {
|
|
3685
3450
|
throw new TypeError(`${where}: a reader is an object whose rung is owner, co-builder, contributor, guest or public; got ${JSON.stringify(reader) ?? String(reader)}.`);
|
|
3686
3451
|
}
|
|
3687
3452
|
if (reader.as !== void 0 && reader.as !== null) checkReader(reader.as, `${where}.as`);
|
|
3688
3453
|
}
|
|
3689
3454
|
function resolveLens(world, lens, reader, options) {
|
|
3690
|
-
if (options !== void 0 && options !== null && !
|
|
3455
|
+
if (options !== void 0 && options !== null && !isBody(options)) {
|
|
3691
3456
|
throw new TypeError(`resolveLens: options is an object, such as { asOf: 1200 }; got ${JSON.stringify(options) ?? typeof options}.`);
|
|
3692
3457
|
}
|
|
3693
3458
|
refuseUnknownOptions("resolveLens", options, LENS_OPTION_KEYS);
|
|
3694
|
-
const opts =
|
|
3695
|
-
if (!
|
|
3459
|
+
const opts = isBody(options) ? options : {};
|
|
3460
|
+
if (!isBody(world) || !Array.isArray(world.elements)) {
|
|
3696
3461
|
throw new TypeError("resolveLens: world is an object with an elements list.");
|
|
3697
3462
|
}
|
|
3698
3463
|
checkReader(reader, "resolveLens: reader");
|
|
3699
3464
|
const { asOf, clock } = readingDate("resolveLens", world, opts);
|
|
3700
|
-
if (typeof lens !== "string" && !
|
|
3465
|
+
if (typeof lens !== "string" && !isBody(lens)) throw new TypeError("resolveLens: lens is a lens body or its id.");
|
|
3701
3466
|
return lensReading(new Reading(world, reader, asOf), lens, clock).reading;
|
|
3702
3467
|
}
|
|
3703
3468
|
function readingDate(fn, world, opts) {
|
|
@@ -3786,7 +3551,7 @@ function hubsOf(id, r) {
|
|
|
3786
3551
|
}
|
|
3787
3552
|
var NONE = () => ({ charter: null, guide: null, domains: [] });
|
|
3788
3553
|
function readAids(world, reader, fn) {
|
|
3789
|
-
if (!
|
|
3554
|
+
if (!isBody(world) || !Array.isArray(world.elements)) {
|
|
3790
3555
|
throw new TypeError(`${fn}: world is an object with an elements list.`);
|
|
3791
3556
|
}
|
|
3792
3557
|
checkReader(reader, `${fn}: reader`);
|
|
@@ -3866,7 +3631,7 @@ function optionalId(value) {
|
|
|
3866
3631
|
return typeof value === "string" && value !== "" ? value : void 0;
|
|
3867
3632
|
}
|
|
3868
3633
|
function markOf(value) {
|
|
3869
|
-
if (!
|
|
3634
|
+
if (!isBody(value)) return null;
|
|
3870
3635
|
const v = value;
|
|
3871
3636
|
if (typeof v.narrative !== "string" || v.narrative === "") return null;
|
|
3872
3637
|
const event = optionalId(v.event);
|
|
@@ -3875,7 +3640,7 @@ function markOf(value) {
|
|
|
3875
3640
|
return { narrative: v.narrative, event, location };
|
|
3876
3641
|
}
|
|
3877
3642
|
function strandOf(world, reader) {
|
|
3878
|
-
if (!
|
|
3643
|
+
if (!isBody(world) || !Array.isArray(world.elements)) {
|
|
3879
3644
|
throw new TypeError("strandOf: world is an object with an elements list.");
|
|
3880
3645
|
}
|
|
3881
3646
|
checkReader(reader, "strandOf: reader");
|
|
@@ -3986,7 +3751,7 @@ function recordsOf(characterId, elements) {
|
|
|
3986
3751
|
// src/report.ts
|
|
3987
3752
|
var REPORT_PAIR = { type: "narrative", supertype: "Report" };
|
|
3988
3753
|
var BOARD_PAIR = { type: "narrative", supertype: "Board" };
|
|
3989
|
-
var
|
|
3754
|
+
var isBody2 = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
|
|
3990
3755
|
function roomKindOf(el) {
|
|
3991
3756
|
if (el === void 0 || !isRoomElement(el)) return null;
|
|
3992
3757
|
const type = fold(el.type);
|
|
@@ -4006,7 +3771,7 @@ function reportThreadsOf(narratives) {
|
|
|
4006
3771
|
if (!Array.isArray(narratives)) return { parents, groups, lints };
|
|
4007
3772
|
const byId2 = /* @__PURE__ */ new Map();
|
|
4008
3773
|
for (const el of narratives) {
|
|
4009
|
-
if (
|
|
3774
|
+
if (isBody2(el) && typeof el.id === "string" && el.id !== "" && !byId2.has(el.id)) byId2.set(el.id, el);
|
|
4010
3775
|
}
|
|
4011
3776
|
const reports = [...byId2.values()].filter((el) => roomKindOf(el) === "report");
|
|
4012
3777
|
const kindOf2 = (report) => {
|
|
@@ -4043,7 +3808,7 @@ function reportThreadsOf(narratives) {
|
|
|
4043
3808
|
return { parents, groups, lints };
|
|
4044
3809
|
}
|
|
4045
3810
|
function reportTalksOf(narrative) {
|
|
4046
|
-
if (!
|
|
3811
|
+
if (!isBody2(narrative) || roomKindOf(narrative) !== "report") return [];
|
|
4047
3812
|
return namedTalks(narrative);
|
|
4048
3813
|
}
|
|
4049
3814
|
var REPORT_LINE_KEYS = ["world"];
|
|
@@ -4103,9 +3868,9 @@ function readReportLines(text2, options) {
|
|
|
4103
3868
|
// src/packet.ts
|
|
4104
3869
|
var WORK_ITEM_PAIR = { type: "relation", supertype: "Work item" };
|
|
4105
3870
|
var STATES = /* @__PURE__ */ new Set(["open", "taken", "done", "standing"]);
|
|
4106
|
-
var
|
|
3871
|
+
var isBody3 = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
|
|
4107
3872
|
function isWorkItem(item) {
|
|
4108
|
-
if (!
|
|
3873
|
+
if (!isBody3(item) || typeof item.type !== "string" || typeof item.supertype !== "string") return false;
|
|
4109
3874
|
return fold(item.type) === WORK_ITEM_PAIR.type && fold(item.supertype) === fold(WORK_ITEM_PAIR.supertype);
|
|
4110
3875
|
}
|
|
4111
3876
|
function put(map, key3, value) {
|
|
@@ -4135,14 +3900,14 @@ function askerOf(item, world) {
|
|
|
4135
3900
|
const key3 = askerKey(item);
|
|
4136
3901
|
if (key3 === "absent" || key3 === "bad") return null;
|
|
4137
3902
|
if (world === void 0) return key3;
|
|
4138
|
-
if (!
|
|
3903
|
+
if (!isBody3(world)) throw new TypeError("askerOf: world is an object with its characters and others.");
|
|
4139
3904
|
return idsOf(world.characters).has(key3) ? key3 : null;
|
|
4140
3905
|
}
|
|
4141
3906
|
function elementsOf(item) {
|
|
4142
3907
|
const list2 = item.x_packet_elements;
|
|
4143
3908
|
const out = [];
|
|
4144
3909
|
for (const e of Array.isArray(list2) ? list2 : []) {
|
|
4145
|
-
if (!
|
|
3910
|
+
if (!isBody3(e) || typeof e.type !== "string" || typeof e.id !== "string" || typeof e.reason !== "string") continue;
|
|
4146
3911
|
if (trimWhiteSpace(e.id) === "") continue;
|
|
4147
3912
|
out.push({ type: e.type, id: e.id, reason: e.reason });
|
|
4148
3913
|
}
|
|
@@ -4150,13 +3915,13 @@ function elementsOf(item) {
|
|
|
4150
3915
|
}
|
|
4151
3916
|
function workOf(items, world, sourceWorld) {
|
|
4152
3917
|
if (!Array.isArray(items)) throw new TypeError("workOf: items is a list of work items.");
|
|
4153
|
-
if (!
|
|
4154
|
-
if (sourceWorld !== void 0 && sourceWorld !== null && !
|
|
3918
|
+
if (!isBody3(world)) throw new TypeError("workOf: world is an object with its characters and others.");
|
|
3919
|
+
if (sourceWorld !== void 0 && sourceWorld !== null && !isBody3(sourceWorld)) {
|
|
4155
3920
|
throw new TypeError("workOf: sourceWorld is an object with its characters and others, or left out.");
|
|
4156
3921
|
}
|
|
4157
3922
|
const characters = idsOf(world.characters);
|
|
4158
3923
|
const held = /* @__PURE__ */ new Set([...idsOf(world.others)]);
|
|
4159
|
-
if (
|
|
3924
|
+
if (isBody3(sourceWorld)) for (const id of [...idsOf(sourceWorld.characters), ...idsOf(sourceWorld.others)]) held.add(id);
|
|
4160
3925
|
const read = [];
|
|
4161
3926
|
const seen = /* @__PURE__ */ new Set();
|
|
4162
3927
|
for (const item of items) {
|
|
@@ -4203,12 +3968,12 @@ function flag(opts, key3) {
|
|
|
4203
3968
|
return v === true;
|
|
4204
3969
|
}
|
|
4205
3970
|
function worldGraph(world, reader, options) {
|
|
4206
|
-
if (options !== void 0 && options !== null && !
|
|
3971
|
+
if (options !== void 0 && options !== null && !isBody(options)) {
|
|
4207
3972
|
throw new TypeError(`worldGraph: options is an object, such as { rooms: true }; got ${JSON.stringify(options) ?? typeof options}.`);
|
|
4208
3973
|
}
|
|
4209
3974
|
refuseUnknownOptions("worldGraph", options, GRAPH_OPTION_KEYS);
|
|
4210
|
-
const opts =
|
|
4211
|
-
if (!
|
|
3975
|
+
const opts = isBody(options) ? options : {};
|
|
3976
|
+
if (!isBody(world) || !Array.isArray(world.elements)) {
|
|
4212
3977
|
throw new TypeError("worldGraph: world is an object with an elements list.");
|
|
4213
3978
|
}
|
|
4214
3979
|
checkReader(reader, "worldGraph: reader");
|
|
@@ -4232,7 +3997,7 @@ function worldGraph(world, reader, options) {
|
|
|
4232
3997
|
}
|
|
4233
3998
|
const { asOf, clock } = readingDate("worldGraph", world, opts);
|
|
4234
3999
|
const lens = valueOf(opts, "lens");
|
|
4235
|
-
if (lens !== null && typeof lens !== "string" && !
|
|
4000
|
+
if (lens !== null && typeof lens !== "string" && !isBody(lens)) throw new TypeError("worldGraph: lens is a lens body or its id.");
|
|
4236
4001
|
const r = new Reading(world, reader, asOf);
|
|
4237
4002
|
const seenKeeper = r.seenRung === "owner" || r.seenRung === "co-builder";
|
|
4238
4003
|
const keeperCounts = seenKeeper || r.owner;
|
|
@@ -4341,7 +4106,7 @@ function tally(counts, owner, keeper) {
|
|
|
4341
4106
|
return out;
|
|
4342
4107
|
}
|
|
4343
4108
|
function degreeOf(graph) {
|
|
4344
|
-
if (!
|
|
4109
|
+
if (!isBody(graph) || !Array.isArray(graph.nodes) || !Array.isArray(graph.edges)) {
|
|
4345
4110
|
throw new TypeError("degreeOf: graph is what worldGraph answers, an object with nodes and edges lists.");
|
|
4346
4111
|
}
|
|
4347
4112
|
const count2 = new Map(graph.nodes.map((n) => [n.id, 0]));
|
|
@@ -4356,7 +4121,7 @@ function degreeOf(graph) {
|
|
|
4356
4121
|
return Object.fromEntries(count2);
|
|
4357
4122
|
}
|
|
4358
4123
|
function outDegreeOf(graph) {
|
|
4359
|
-
if (!
|
|
4124
|
+
if (!isBody(graph) || !Array.isArray(graph.nodes) || !Array.isArray(graph.edges)) {
|
|
4360
4125
|
throw new TypeError("outDegreeOf: graph is what worldGraph answers, an object with nodes and edges lists.");
|
|
4361
4126
|
}
|
|
4362
4127
|
const targets = new Map(graph.nodes.map((n) => [n.id, /* @__PURE__ */ new Set()]));
|
|
@@ -4378,14 +4143,14 @@ function whole2(opts, key3, fallback) {
|
|
|
4378
4143
|
return v;
|
|
4379
4144
|
}
|
|
4380
4145
|
function landingOf(graph, options) {
|
|
4381
|
-
if (!
|
|
4146
|
+
if (!isBody(graph) || !Array.isArray(graph.nodes) || !Array.isArray(graph.edges)) {
|
|
4382
4147
|
throw new TypeError("landingOf: graph is what worldGraph answers, an object with nodes and edges lists.");
|
|
4383
4148
|
}
|
|
4384
|
-
if (options !== void 0 && options !== null && !
|
|
4149
|
+
if (options !== void 0 && options !== null && !isBody(options)) {
|
|
4385
4150
|
throw new TypeError(`landingOf: options is an object, such as { heads: 5 }; got ${JSON.stringify(options) ?? typeof options}.`);
|
|
4386
4151
|
}
|
|
4387
4152
|
refuseUnknownOptions("landingOf", options, OPTION_KEYS);
|
|
4388
|
-
const opts =
|
|
4153
|
+
const opts = isBody(options) ? options : {};
|
|
4389
4154
|
const k = whole2(opts, "heads", 5);
|
|
4390
4155
|
const reach2 = whole2(opts, "hops", 1);
|
|
4391
4156
|
const size = whole2(opts, "size", 24);
|
|
@@ -4457,7 +4222,7 @@ function landingOf(graph, options) {
|
|
|
4457
4222
|
// src/mapspace.ts
|
|
4458
4223
|
var isRow = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
|
|
4459
4224
|
var whole3 = (v) => typeof v === "number" && Number.isSafeInteger(v);
|
|
4460
|
-
var
|
|
4225
|
+
var idOf = (v) => typeof v === "string" && v !== "" ? v : null;
|
|
4461
4226
|
var byId = (a, b) => byCodePoint(a, b);
|
|
4462
4227
|
function point(e) {
|
|
4463
4228
|
return [e.x, e.y, whole3(e.z) ? e.z : 0];
|
|
@@ -4472,7 +4237,7 @@ function mapSpace(elements) {
|
|
|
4472
4237
|
const byType = /* @__PURE__ */ new Map();
|
|
4473
4238
|
for (const e of elements) {
|
|
4474
4239
|
if (!isRow(e) || typeof e.type !== "string") continue;
|
|
4475
|
-
const id =
|
|
4240
|
+
const id = idOf(e.id);
|
|
4476
4241
|
if (id === null) continue;
|
|
4477
4242
|
const rows2 = byType.get(e.type);
|
|
4478
4243
|
if (rows2) rows2.set(id, e);
|
|
@@ -4485,8 +4250,8 @@ function mapSpace(elements) {
|
|
|
4485
4250
|
const out = { no_point: 0, no_markers: 0, dangling: 0, no_map: 0 };
|
|
4486
4251
|
const placed = /* @__PURE__ */ new Map();
|
|
4487
4252
|
for (const mk of rowsOf2("marker")) {
|
|
4488
|
-
const z =
|
|
4489
|
-
const m =
|
|
4253
|
+
const z = idOf(mk.zone);
|
|
4254
|
+
const m = idOf(mk.map);
|
|
4490
4255
|
if (z === null || m === null || !zones.has(z) || !maps.has(m)) {
|
|
4491
4256
|
out.dangling++;
|
|
4492
4257
|
continue;
|
|
@@ -4523,7 +4288,7 @@ function mapSpace(elements) {
|
|
|
4523
4288
|
}
|
|
4524
4289
|
const pins = [];
|
|
4525
4290
|
for (const p of [...rowsOf2("pin")].sort((a, b) => byId(rowId(a), rowId(b)))) {
|
|
4526
|
-
const m =
|
|
4291
|
+
const m = idOf(p.map);
|
|
4527
4292
|
if (m === null || !maps.has(m)) {
|
|
4528
4293
|
out.no_map++;
|
|
4529
4294
|
continue;
|
|
@@ -4532,8 +4297,8 @@ function mapSpace(elements) {
|
|
|
4532
4297
|
out.no_point++;
|
|
4533
4298
|
continue;
|
|
4534
4299
|
}
|
|
4535
|
-
let et =
|
|
4536
|
-
let ei =
|
|
4300
|
+
let et = idOf(p.element_type);
|
|
4301
|
+
let ei = idOf(p.element_id);
|
|
4537
4302
|
if (et === null || ei === null) et = ei = null;
|
|
4538
4303
|
const [x, y, z] = point(p);
|
|
4539
4304
|
pins.push({ pin: rowId(p), map: m, element_type: et, element_id: ei, x, y, z });
|
|
@@ -4561,8 +4326,8 @@ function mapSpace(elements) {
|
|
|
4561
4326
|
depth: whole3(mp.depth) ? mp.depth : null,
|
|
4562
4327
|
z_max: largest(own4, 2),
|
|
4563
4328
|
scale: typeof sc === "number" && sc > 0 ? sc : null,
|
|
4564
|
-
location:
|
|
4565
|
-
parent_map:
|
|
4329
|
+
location: idOf(mp.location),
|
|
4330
|
+
parent_map: idOf(mp.parent_map)
|
|
4566
4331
|
};
|
|
4567
4332
|
if (measured) row.extent = "points";
|
|
4568
4333
|
mapRows.push(row);
|
|
@@ -4574,13 +4339,13 @@ function mapSpace(elements) {
|
|
|
4574
4339
|
|
|
4575
4340
|
// src/layout-of.ts
|
|
4576
4341
|
var isRow2 = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
|
|
4577
|
-
var
|
|
4342
|
+
var idOf2 = (v) => typeof v === "string" && v !== "" ? v : null;
|
|
4578
4343
|
function layoutOf(map, maps, pins) {
|
|
4579
4344
|
if (!isRow2(map)) throw new TypeError("layoutOf: map is one Map element.");
|
|
4580
4345
|
if (!Array.isArray(maps)) throw new TypeError("layoutOf: maps is a list of Map elements.");
|
|
4581
4346
|
if (!Array.isArray(pins)) throw new TypeError("layoutOf: pins is a list of Pin elements.");
|
|
4582
4347
|
const none = { layout: null, ground: null, hand: [] };
|
|
4583
|
-
const id =
|
|
4348
|
+
const id = idOf2(map.id);
|
|
4584
4349
|
if (id === null) return none;
|
|
4585
4350
|
const recipe = map.x_layout;
|
|
4586
4351
|
if (!isRow2(recipe)) return none;
|
|
@@ -4588,18 +4353,18 @@ function layoutOf(map, maps, pins) {
|
|
|
4588
4353
|
if (typeof method !== "string" || method === "") return none;
|
|
4589
4354
|
let ground = null;
|
|
4590
4355
|
const settings = recipe.settings;
|
|
4591
|
-
const g = isRow2(settings) && isRow2(settings.ground) ?
|
|
4592
|
-
if (g !== null && g !== id && maps.some((m) => isRow2(m) &&
|
|
4356
|
+
const g = isRow2(settings) && isRow2(settings.ground) ? idOf2(settings.ground.map) : null;
|
|
4357
|
+
if (g !== null && g !== id && maps.some((m) => isRow2(m) && idOf2(m.id) === g)) ground = g;
|
|
4593
4358
|
const held = /* @__PURE__ */ new Map();
|
|
4594
4359
|
for (const p of pins) {
|
|
4595
4360
|
if (!isRow2(p)) continue;
|
|
4596
|
-
const pid =
|
|
4361
|
+
const pid = idOf2(p.id);
|
|
4597
4362
|
if (pid !== null) held.set(pid, p);
|
|
4598
4363
|
}
|
|
4599
4364
|
const board = method === "hand";
|
|
4600
4365
|
const hand = [];
|
|
4601
4366
|
for (const [pid, p] of held) {
|
|
4602
|
-
if (
|
|
4367
|
+
if (idOf2(p.map) !== id) continue;
|
|
4603
4368
|
if (board || p.x_hand === true) hand.push(pid);
|
|
4604
4369
|
}
|
|
4605
4370
|
hand.sort(byCodePoint);
|
|
@@ -4608,14 +4373,14 @@ function layoutOf(map, maps, pins) {
|
|
|
4608
4373
|
|
|
4609
4374
|
// src/carry-of.ts
|
|
4610
4375
|
var isRow3 = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
|
|
4611
|
-
var
|
|
4612
|
-
var mapId = (v) => isRow3(v) && v.type === "map" ?
|
|
4376
|
+
var idOf3 = (v) => typeof v === "string" && v !== "" ? v : null;
|
|
4377
|
+
var mapId = (v) => isRow3(v) && v.type === "map" ? idOf3(v.id) : null;
|
|
4613
4378
|
var isNumber = (v) => typeof v === "number" && Number.isFinite(v);
|
|
4614
4379
|
var isCarrySize = (v) => isNumber(v) && Number.isInteger(v) && v > 0;
|
|
4615
4380
|
function frameOf(map) {
|
|
4616
4381
|
const key3 = map.x_parent_frame;
|
|
4617
4382
|
const present = key3 !== void 0 && key3 !== null;
|
|
4618
|
-
if (
|
|
4383
|
+
if (idOf3(map.parent_map) === null) return { frame: null, lint: present ? "no_parent" : null };
|
|
4619
4384
|
if (!present) return { frame: null, lint: null };
|
|
4620
4385
|
if (!Array.isArray(key3) || key3.length !== 4 || !key3.every(isNumber)) return { frame: null, lint: "not_four_numbers" };
|
|
4621
4386
|
const [x0, y0, x1, y1] = key3;
|
|
@@ -4644,7 +4409,7 @@ function carryOf(map, point2, maps) {
|
|
|
4644
4409
|
let frame = own4.frame;
|
|
4645
4410
|
let stop;
|
|
4646
4411
|
for (; ; ) {
|
|
4647
|
-
const parentId =
|
|
4412
|
+
const parentId = idOf3(at.parent_map);
|
|
4648
4413
|
if (parentId === null) {
|
|
4649
4414
|
stop = "top";
|
|
4650
4415
|
break;
|
|
@@ -7504,14 +7269,14 @@ function layoutPieces(nodes, edges, rows2, table, opts = {}) {
|
|
|
7504
7269
|
|
|
7505
7270
|
// src/layout3d/space.ts
|
|
7506
7271
|
var isRow4 = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
|
|
7507
|
-
var
|
|
7272
|
+
var idOf4 = (v) => typeof v === "string" && v !== "" ? v : null;
|
|
7508
7273
|
function spaceRows(elements) {
|
|
7509
7274
|
if (elements === null || elements === void 0) return null;
|
|
7510
7275
|
const space = mapSpace(elements);
|
|
7511
7276
|
const rawMaps = /* @__PURE__ */ new Map(), rawPins = /* @__PURE__ */ new Map();
|
|
7512
7277
|
for (const e of elements) {
|
|
7513
7278
|
if (!isRow4(e) || typeof e.type !== "string") continue;
|
|
7514
|
-
const id =
|
|
7279
|
+
const id = idOf4(e.id);
|
|
7515
7280
|
if (id === null) continue;
|
|
7516
7281
|
if (e.type === "map") rawMaps.set(id, e);
|
|
7517
7282
|
else if (e.type === "pin") rawPins.set(id, e);
|
|
@@ -7591,7 +7356,7 @@ function score(row, el) {
|
|
|
7591
7356
|
if (kind.supertype === void 0) return 1;
|
|
7592
7357
|
return sameSupertype(kind.supertype) ? 2 : 0;
|
|
7593
7358
|
}
|
|
7594
|
-
function
|
|
7359
|
+
function carries(el, mark) {
|
|
7595
7360
|
const v = own2(el, mark);
|
|
7596
7361
|
if (mark === "hidden" || mark === "known_of") return v === true;
|
|
7597
7362
|
if (mark === "x_served_trimmed") return Array.isArray(v) && v.some((x) => typeof x === "string" && trimWhiteSpace(x) !== "");
|
|
@@ -7645,9 +7410,9 @@ function viewIn(table, element) {
|
|
|
7645
7410
|
row = r;
|
|
7646
7411
|
}
|
|
7647
7412
|
}
|
|
7648
|
-
const banners = table.banners.map((b) => b.mark).filter((m) =>
|
|
7413
|
+
const banners = table.banners.map((b) => b.mark).filter((m) => carries(el, m));
|
|
7649
7414
|
if (!row) return { row: null, sentence: null, banners, order: drawOrder(null, el) };
|
|
7650
|
-
for (const m of row.banner ?? []) if (
|
|
7415
|
+
for (const m of row.banner ?? []) if (carries(el, m)) banners.push(m);
|
|
7651
7416
|
let sentence = null;
|
|
7652
7417
|
for (const f of row.sentence ?? []) {
|
|
7653
7418
|
const v = own2(el, f);
|
|
@@ -7661,639 +7426,6 @@ function viewIn(table, element) {
|
|
|
7661
7426
|
return { row, sentence, banners, order: drawOrder(row, el) };
|
|
7662
7427
|
}
|
|
7663
7428
|
|
|
7664
|
-
// src/world-file.ts
|
|
7665
|
-
import { Inflate, inflateSync, zipSync } from "fflate";
|
|
7666
|
-
|
|
7667
|
-
// src/nfc-tables.generated.ts
|
|
7668
|
-
var NFC_CLASS_RUNS = "lc.l.6e,lx..6g,ly.4.64,m2..6g,m3..60,m4.5.64,m9.2.5m,mb.4.64,mf.2.5m,mh.b.64,ms.5.1,mx.4.64,n1.8.6e,n9..6o,na..6e,nb.3.64,ne.3.6e,nh.2.64,nk.3.6e,nn.4.64,nr..6e,ns..6g,nt.2.64,nv..6e,nw..6h,nx.2.6i,nz..6h,o0.2.6i,o2..6h,o3.d.6e,w3.5.6e,13l..64,13m.4.6e,13q..64,13r.3.6e,13u..66,13v..64,13w.6.6e,142.6.64,148.2.6e,14a..64,14b.2.6e,14d..66,14e..6c,14f..6e,14g..a,14h..b,14i..c,14j..d,14k..e,14l..f,14m..g,14n..h,14o..i,14p.2.j,14r..k,14s..l,14t..m,14v..n,14x..o,14y..p,150..6e,151..64,153..i,174.8.6e,17c..u,17d..v,17e..w,18r..r,18s..s,18t..t,18u..u,18v..v,18w..w,18x..x,18y..y,18z.2.6e,191.2.64,193.5.6e,198..64,199.2.6e,19b..64,19s..z,1cm.7.6e,1cv.4.6e,1cz..64,1d0..6e,1d3.2.6e,1d6..64,1d7.2.6e,1d9..64,1e9..10,1f4..6e,1f5..64,1f6.2.6e,1f8..64,1f9.2.6e,1fb.3.64,1fe..6e,1ff.2.64,1fh..6e,1fi..64,1fj.3.6e,1fm..64,1fn..6e,1fo..64,1fp..6e,1fq..64,1fr..6e,1fs..64,1ft.2.6e,1kb.7.6e,1ki..64,1kj..6e,1kt..64,1li.4.6e,1ln.9.6e,1lx.3.6e,1m1.5.6e,1nd.3.64,1p4..6e,1p5.3.64,1p8.4.6e,1qi.5.6e,1qn.5.64,1qs.e.6e,1r7..64,1r8.2.6e,1ra..64,1rb.2.6e,1rd..64,1re.3.6e,1rh.3.64,1rk..r,1rl..s,1rm..t,1rn.3.6e,1rq..64,1rr.2.6e,1rt.2.64,1rv.5.6e,1to..7,1u5..9,1u9..6e,1ua..64,1ub.2.6e,1x8..7,1xp..9,1z2..6e,20s..7,219..9,24c..7,24t..9,27w..7,28d..9,2bx..9,2f0..7,2fh..9,2fp..2c,2fq..2j,2ik..7,2j1..9,2m3.2.9,2ml..9,2q2..9,2t4.2.2v,2t6..9,2tk.4.2z,2wo.2.3a,2wq..9,2x4.4.3e,2zc.2.64,305..64,307..64,309..60,31t..3l,31u..3m,31w..3o,322.4.3m,328..3m,32a.2.6e,32c..9,32e.2.6e,346..64,37b..7,37d.2.9,39p..64,3tp.3.6e,4k4.2.9,4l0..9,4pe..9,4pp..6e,4vd..6c,4zd..66,4ze..6e,4zf..64,55j..6e,55k..64,57k..9,585.8.6e,58f..64,59s.5.6e,59x.6.64,5a3.2.6e,5a5..64,5a7.2.64,5a9.2.6e,5ab.2.64,5ad.5.6e,5ai..64,5aj.4.6e,5dg..7,5dw..9,5ez..6e,5f0..64,5f1.7.6e,5gq.2.9,5ie..7,5iq.2.9,5kn..7,5ow.3.6e,5p0..1,5p1.5.64,5p6.2.6e,5p8.4.64,5pc..6e,5pe.7.1,5pp..64,5pw..6e,5q0.2.6e,5vk.2.6e,5vm..64,5vn.7.6e,5vu..64,5vv.2.6e,5vx..6i,5vy..5y,5vz..64,5w0..5m,5w1.11.6e,5x2..6g,5x3.2.6c,5x5..64,5x6..62,5x7..6e,5x8..6h,5x9..64,5xa..6e,5xb..64,6hc.2.6e,6he.2.1,6hg.4.6e,6hk.3.1,6hn.2.6e,6ht..6e,6hx.2.1,6hz..6e,6i0..64,6i1..6e,6i2.2.1,6i4.4.64,6i8..6e,8vj.3.6e,8zj..9,928.w.6e,9ii..62,9ij..6c,9ik..6g,9il..66,9im.2.68,9ll.2.8,wvj..6e,wvo.a.6e,wwu.2.6e,wz4.2.6e,x6u..9,x7w..9,xc4..9,xcw.i.6e,xez.3.64,xg3..9,xir..7,xj4..9,xps..6e,xpu.2.6e,xpw..64,xpz.2.6e,xq6.2.6e,xq9..6e,xrq..9,xyl..9,1dlq..q,1e74.7.6e,1e7b.7.64,1e7i.2.6e,1eyl..64,1f4w..64,1f92.5.6e,1gjx..64,1gjz..6e,1gl4..6e,1gl5..1,1gl6..64,1glb..9,1gpx..6e,1gpy..64,1h5w.4.6e,1hgr.2.6e,1hj1.3.64,1hl2.2.64,1hl4.3.6e,1hl7..64,1hl8..6e,1hl9.4.64,1hmq..6e,1hmr..64,1hms..6e,1hmt..64,1hs6..9,1htc..9,1htr..9,1hvd..9,1hve..7,1hxc.3.6e,1hyr.2.9,1i0j..7,1i2o..9,1i2y..7,1i5x..9,1i5y..7,1iax..7,1iay..9,1id7.2.7,1idp..9,1iee.7.6e,1ieo.5.6e,1iki..9,1ikm..7,1ila..6e,1io2..9,1io3..7,1iv3..9,1iv4..7,1iyn..9,1j1y..9,1j1z..7,1j57..9,1jcp..9,1jcq..7,1jjx.2.9,1jk3..7,1jog..9,1jqs..9,1jrb..9,1jtl..9,1k5b..9,1kci..7,1kck.2.9,1kev..9,1kqp.2.9,1zow.5.1,1zqo.7.6e,20og.2.6,2ftq..1,2jxh.2.60,2jxj.3.1,2jxp..6a,2jxq.5.60,2jy3.8.64,2jyd.5.6e,2jyi.2.64,2jze.4.6e,2k3m.3.6e,2mtc.7.6e,2mtk.h.6e,2mu3.7.6e,2mub.2.6e,2mue.5.6e,2mxb..6e,2n1s.7.6e,2nce..6e,2ne4.4.6e,2nsc.2.6g,2nse..64,2nsf..6e,2ok0.7.64,2on8.6.6e,2one..7";
|
|
7669
|
-
var NFC_DECOMP = "5c.1t.lc,1.1t.ld,1.1t.le,1.1t.lf,1.1t.lk,1.1t.lm,2.1v.mf,1.1x.lc,1.1x.ld,1.1x.le,1.1x.lk,1.21.lc,1.21.ld,1.21.le,1.21.lk,2.26.lf,1.27.lc,1.27.ld,1.27.le,1.27.lf,1.27.lk,3.2d.lc,1.2d.ld,1.2d.le,1.2d.lk,1.2h.ld,3.2p.lc,1.2p.ld,1.2p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1.ts.li,1.sw.lk,1.ts.lk,3.t1.li,1.tx.li,3.yg.lk,1.yh.lk,1.t2.lk,1.ty.lk,1.t3.lk,1.tz.lk,3.t4.lg,1.u0.lg,1.t4.lk,1.u0.lk,1.ta.lk,1.u6.lk,3.yw.lk,1.yx.lk,1.tp.lk,1.ul.lk,1.tf.lg,1.ub.lg,1.tf.lk,1.ub.lk,1.tf.ln,1.ub.ln,1.tj.lk,1.uf.lk,3.tn.lk,1.uj.lk,89.17r.18z,1.17r.190,1.18o.190,1.17r.191,1.18q.190,4a.1cl.190,2.1c1.190,h.1ci.190,gm.1t4.1to,8.1tc.1to,3.1tf.1to,10.1sl.1to,1.1sm.1to,1.1sn.1to,1.1ss.1to,1.1sx.1to,1.1sy.1to,1.1t7.1to,1.1tb.1to,30.1xj.1xa,1.1xj.1xz,g.1wh.1x8,1.1wi.1x8,2.1wv.1x8,2c.20i.20s,3.20o.20s,z.1zq.20s,1.1zr.20s,1.1zw.20s,3.20b.20s,6i.287.28m,3.287.27y,1.287.28n,g.275.27w,1.276.27w,1j.2aa.2c7,1i.2bq.2bi,1.2br.2bi,1.2bq.2c7,3g.2fa.2fq,3c.2in.2j9,7.2iu.2j9,1.2iu.2ja,2.2iu.2iq,1.2iy.2j9,3j.2me.2m6,1.2mf.2m6,1.2me.2mv,3y.2qh.2q2,2.2qh.2q7,1.2qk.2q2,1.2qh.2qn,9x.30i.33r,a.30s.33r,5.30x.33r,5.312.33r,5.317.33r,d.30g.33p,a.31t.31u,2.31t.31w,1.33m.328,2.33n.328,9.31t.328,i.32q.33r,a.330.33r,5.335.33r,5.33a.33r,5.33f.33r,d.32o.33p,31.36t.372,25c.5c5.5dh,2.5c7.5dh,2.5c9.5dh,2.5cb.5dh,2.5cd.5dh,4.5ch.5dh,15.5dm.5dh,2.5do.5dh,3.5dq.5dh,1.5dr.5dh,2.5du.5dh,jh.1t.md,1.2p.md,1.1u.lj,1.2q.lj,1.1u.mb,1.2q.mb,1.1u.mp,1.2q.mp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qf.lw,1.65c.lc,1.65d.lc,1.65c.ld,1.65d.ld,1.65c.n6,1.65d.n6,1.pj.lv,1.pj.lw,1.65k.lc,1.65l.lc,1.65k.ld,1.65l.ld,1.65k.n6,1.65l.n6,1.qh.lv,1.qh.lw,1.65s.lc,1.65t.lc,1.65s.ld,1.65t.ld,1.65s.n6,1.65t.n6,1.pl.lv,1.pl.lw,1.660.lc,1.661.lc,1.660.ld,1.661.ld,1.660.n6,1.661.n6,1.qn.lv,1.qn.lw,1.668.lc,1.669.lc,1.668.ld,1.669.ld,3.pr.lv,1.pr.lw,1.66g.lc,1.66h.lc,1.66g.ld,1.66h.ld,3.qt.lv,1.qt.lw,1.66o.lc,1.66p.lc,1.66o.ld,1.66p.ld,1.66o.n6,1.66p.n6,2.px.lw,2.66x.lc,2.66x.ld,2.66x.n6,1.qx.lv,1.qx.lw,1.674.lc,1.675.lc,1.674.ld,1.675.ld,1.674.n6,1.675.n6,1.q1.lv,1.q1.lw,1.67c.lc,1.67d.lc,1.67c.ld,1.67d.ld,1.67c.n6,1.67d.n6,1.q9.lc,1.q4,1.qd.lc,1.q5,1.qf.lc,1.q6,1.qh.lc,1.q7,1.qn.lc,1.r0,1.qt.lc,1.r1,1.qx.lc,1.r2,3.64g.n9,1.64h.n9,1.64i.n9,1.64j.n9,1.64k.n9,1.64l.n9,1.64m.n9,1.64n.n9,1.64o.n9,1.64p.n9,1.64q.n9,1.64r.n9,1.64s.n9,1.64t.n9,1.64u.n9,1.64v.n9,1.65c.n9,1.65d.n9,1.65e.n9,1.65f.n9,1.65g.n9,1.65h.n9,1.65i.n9,1.65j.n9,1.65k.n9,1.65l.n9,1.65m.n9,1.65n.n9,1.65o.n9,1.65p.n9,1.65q.n9,1.65r.n9,1.674.n9,1.675.n9,1.676.n9,1.677.n9,1.678.n9,1.679.n9,1.67a.n9,1.67b.n9,1.67c.n9,1.67d.n9,1.67e.n9,1.67f.n9,1.67g.n9,1.67h.n9,1.67i.n9,1.67j.n9,1.q9.li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.cop,1.39e1,1.3bgw,1.3i6r,1.vgj,1.vim,1w.15l.14k,2.16a.14n,b.161.14x,1.161.14y,1.1dmx.14x,1.1dmx.14y,1.15c.14n,1.15c.14o,1.15c.14s,1.15d.14s,1.15e.14s,1.15f.14s,1.15g.14s,1.15h.14s,1.15i.14s,2.15k.14s,1.15l.14s,1.15m.14s,1.15n.14s,1.15o.14s,2.15q.14s,2.15s.14s,1.15t.14s,2.15v.14s,1.15w.14s,2.15y.14s,1.15z.14s,1.160.14s,1.161.14s,1.162.14s,1.15h.14p,1.15d.14v,1.15n.14v,1.15w.14v,47g.1huh.1hve,2.1huj.1hve,f.1hut.1hve,3n.1hyp.1hyf,1.1hyq.1hyf,f0.1idj.1ida,1.1idj.1idz,a7.1int.1inu,1.1int.1ink,2.1int.1inx,70.1iuw.1iun,1.1iux.1iun,ot.1jjp.1jjk,10di.2jx3.2jxh,1.2jx4.2jxh,1.2jxb.2jxq,1.2jxb.2jxr,1.2jxb.2jxs,1.2jxb.2jxt,1.2jxb.2jxu,2f.2jzt.2jxh,1.2jzu.2jxh,1.2jzv.2jxq,1.2jzw.2jxq,1.2jzv.2jxr,1.2jzw.2jxr,1m4g.fgd,1.fg8,1.fgh,1.2tcy,1.fog,1.fqm,1.fqz,1.fsy,1.fwa,1.fx5,1.fzb,1.fyn,1.ae6,1.2ud6,1.g25,1.g2c,1.g2s,1.g3b,1.2u58,1.aex,1.g2v,1.g3x,1.2u6j,1.g47,1.g4k,1.fkc,1.g4s,1.g51,1.3ly7,1.g6t,1.g77,1.afz,1.g8r,1.g92,1.gaa,1.gaf,1.ahh,1.gcn,1.gcp,1.gdg,1.ge2,1.ged,1.gee,1.gev,1.gg9,1.ggh,1.ggq,1.ghf,1.ghp,1.ghr,1.ghr,1.ghr,1.2v58,1.m7k,1.gju,1.gkf,1.2vdv,1.gkr,1.gkx,1.gli,1.gpq,1.gmw,1.gnc,1.go8,1.gpu,1.gs6,1.gsw,1.gur,1.gv7,1.gw4,1.gw4,1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jzx,2jzy,2jzz,2k00";
|
|
7671
|
-
|
|
7672
|
-
// src/nfc.ts
|
|
7673
|
-
var S_BASE = 44032;
|
|
7674
|
-
var L_BASE = 4352;
|
|
7675
|
-
var V_BASE = 4449;
|
|
7676
|
-
var T_BASE = 4519;
|
|
7677
|
-
var L_COUNT = 19;
|
|
7678
|
-
var V_COUNT = 21;
|
|
7679
|
-
var T_COUNT = 28;
|
|
7680
|
-
var N_COUNT = V_COUNT * T_COUNT;
|
|
7681
|
-
var S_COUNT = L_COUNT * N_COUNT;
|
|
7682
|
-
var tables = null;
|
|
7683
|
-
function load() {
|
|
7684
|
-
const ccc = /* @__PURE__ */ new Map();
|
|
7685
|
-
for (const run of NFC_CLASS_RUNS.split(",")) {
|
|
7686
|
-
const [start, count2, cls] = run.split(".");
|
|
7687
|
-
const s = parseInt(start, 36);
|
|
7688
|
-
const n = count2 ? parseInt(count2, 36) : 1;
|
|
7689
|
-
const c = parseInt(cls, 36);
|
|
7690
|
-
for (let k = 0; k < n; k++) ccc.set(s + k, c);
|
|
7691
|
-
}
|
|
7692
|
-
const raw = /* @__PURE__ */ new Map();
|
|
7693
|
-
let cp2 = 0;
|
|
7694
|
-
for (const entry of NFC_DECOMP.split(",")) {
|
|
7695
|
-
const [gap, ...to] = entry.split(".");
|
|
7696
|
-
cp2 += parseInt(gap, 36);
|
|
7697
|
-
raw.set(cp2, to.map((t) => parseInt(t, 36)));
|
|
7698
|
-
}
|
|
7699
|
-
const excluded = new Set(NFC_EXCLUDED.split(",").map((t) => parseInt(t, 36)));
|
|
7700
|
-
const compose = /* @__PURE__ */ new Map();
|
|
7701
|
-
for (const [c, to] of raw) {
|
|
7702
|
-
if (to.length !== 2 || excluded.has(c) || ccc.has(c) || ccc.has(to[0])) continue;
|
|
7703
|
-
compose.set(to[0] * 1114112 + to[1], c);
|
|
7704
|
-
}
|
|
7705
|
-
const decomp = /* @__PURE__ */ new Map();
|
|
7706
|
-
const full = (c) => {
|
|
7707
|
-
const done = decomp.get(c);
|
|
7708
|
-
if (done) return done;
|
|
7709
|
-
const to = raw.get(c);
|
|
7710
|
-
if (!to) return [c];
|
|
7711
|
-
const out = to.flatMap(full);
|
|
7712
|
-
decomp.set(c, out);
|
|
7713
|
-
return out;
|
|
7714
|
-
};
|
|
7715
|
-
for (const c of raw.keys()) full(c);
|
|
7716
|
-
return { ccc, decomp, compose };
|
|
7717
|
-
}
|
|
7718
|
-
function nfc(text2) {
|
|
7719
|
-
let plain = true;
|
|
7720
|
-
for (let i = 0; i < text2.length; i++) if (text2.charCodeAt(i) >= 192) {
|
|
7721
|
-
plain = false;
|
|
7722
|
-
break;
|
|
7723
|
-
}
|
|
7724
|
-
if (plain) return text2;
|
|
7725
|
-
const t = tables ?? (tables = load());
|
|
7726
|
-
const cls = (c) => t.ccc.get(c) ?? 0;
|
|
7727
|
-
const cps = [];
|
|
7728
|
-
for (const ch of text2) {
|
|
7729
|
-
const c = ch.codePointAt(0);
|
|
7730
|
-
const s = c - S_BASE;
|
|
7731
|
-
if (s >= 0 && s < S_COUNT) {
|
|
7732
|
-
cps.push(L_BASE + Math.floor(s / N_COUNT), V_BASE + Math.floor(s % N_COUNT / T_COUNT));
|
|
7733
|
-
if (s % T_COUNT) cps.push(T_BASE + s % T_COUNT);
|
|
7734
|
-
} else {
|
|
7735
|
-
const d = t.decomp.get(c);
|
|
7736
|
-
if (d) cps.push(...d);
|
|
7737
|
-
else cps.push(c);
|
|
7738
|
-
}
|
|
7739
|
-
}
|
|
7740
|
-
for (let i = 1; i < cps.length; i++) {
|
|
7741
|
-
const c = cps[i];
|
|
7742
|
-
const k = cls(c);
|
|
7743
|
-
if (!k) continue;
|
|
7744
|
-
let j = i;
|
|
7745
|
-
while (j > 0 && cls(cps[j - 1]) > k) {
|
|
7746
|
-
cps[j] = cps[j - 1];
|
|
7747
|
-
j--;
|
|
7748
|
-
}
|
|
7749
|
-
cps[j] = c;
|
|
7750
|
-
}
|
|
7751
|
-
const out = [];
|
|
7752
|
-
let starter = -1;
|
|
7753
|
-
let last = 0;
|
|
7754
|
-
for (const c of cps) {
|
|
7755
|
-
const k = cls(c);
|
|
7756
|
-
if (starter >= 0 && (out.length - 1 === starter || last !== 0 && last < k)) {
|
|
7757
|
-
const a = out[starter];
|
|
7758
|
-
let composed;
|
|
7759
|
-
const l = a - L_BASE, v = c - V_BASE, s = a - S_BASE, tt = c - T_BASE;
|
|
7760
|
-
if (l >= 0 && l < L_COUNT && v >= 0 && v < V_COUNT) composed = S_BASE + (l * V_COUNT + v) * T_COUNT;
|
|
7761
|
-
else if (s >= 0 && s < S_COUNT && s % T_COUNT === 0 && tt > 0 && tt < T_COUNT) composed = a + tt;
|
|
7762
|
-
else composed = t.compose.get(a * 1114112 + c);
|
|
7763
|
-
if (composed !== void 0) {
|
|
7764
|
-
out[starter] = composed;
|
|
7765
|
-
continue;
|
|
7766
|
-
}
|
|
7767
|
-
}
|
|
7768
|
-
if (k === 0) starter = out.length;
|
|
7769
|
-
last = k;
|
|
7770
|
-
out.push(c);
|
|
7771
|
-
}
|
|
7772
|
-
let r = "";
|
|
7773
|
-
for (const c of out) r += String.fromCodePoint(c);
|
|
7774
|
-
return r;
|
|
7775
|
-
}
|
|
7776
|
-
|
|
7777
|
-
// src/world-file.ts
|
|
7778
|
-
var WORLD_FILE = "world.json";
|
|
7779
|
-
var MARKER_NAME = "mimetype";
|
|
7780
|
-
var WORLD_FILE_MEDIA_TYPE = "application/vnd.onlyworlds.world+zip";
|
|
7781
|
-
var WORLD_FILE_MAX_BYTES = 2 * 1024 ** 3;
|
|
7782
|
-
var WORLD_FILE_MAX_ENTRIES = 5e5;
|
|
7783
|
-
var MESSAGES = {
|
|
7784
|
-
unsafe_path: "The world file holds a path that cannot be written safely.",
|
|
7785
|
-
too_big: "The world file is bigger than the budget allows, or a file in it is bigger than it says.",
|
|
7786
|
-
too_many: "The world file holds more files than the budget allows.",
|
|
7787
|
-
not_a_world: "The file is not a world: it has no readable world.json with an id.",
|
|
7788
|
-
more_than_one: "The file holds more than one world.",
|
|
7789
|
-
not_openable: "The file is not a zip that can be read.",
|
|
7790
|
-
duplicate: "The world file holds two entries with the same name.",
|
|
7791
|
-
collision: "The world file holds two names that differ only in case or in how an accent is written.",
|
|
7792
|
-
link: "The world file holds a link or a special file.",
|
|
7793
|
-
method: "The world file holds an encrypted entry, or one compressed other than stored or deflate.",
|
|
7794
|
-
name: "The world file holds a name that some disk cannot hold.",
|
|
7795
|
-
marker: "The world file's mimetype entry is not the OnlyWorlds media type."
|
|
7796
|
-
};
|
|
7797
|
-
var OwWorldFileError = class extends Error {
|
|
7798
|
-
constructor(reason, message = MESSAGES[reason]) {
|
|
7799
|
-
super(message);
|
|
7800
|
-
this.name = "OwWorldFileError";
|
|
7801
|
-
this.reason = reason;
|
|
7802
|
-
}
|
|
7803
|
-
};
|
|
7804
|
-
var READ_OPTION_KEYS = ["maxBytes", "maxEntries", "skip"];
|
|
7805
|
-
var refuse2 = (reason, message) => {
|
|
7806
|
-
throw new OwWorldFileError(reason, message);
|
|
7807
|
-
};
|
|
7808
|
-
function pathFault(name) {
|
|
7809
|
-
if (name.includes("\\")) return "holds a backslash";
|
|
7810
|
-
if (name.startsWith("/")) return "is absolute";
|
|
7811
|
-
if (/^[A-Za-z]:/.test(name)) return "names a drive";
|
|
7812
|
-
if (name.split("/").some((seg2) => seg2 === "" || seg2 === "." || seg2 === "..")) return "has an empty, . or .. segment";
|
|
7813
|
-
return null;
|
|
7814
|
-
}
|
|
7815
|
-
var RESERVED = /* @__PURE__ */ new Set([
|
|
7816
|
-
"CON",
|
|
7817
|
-
"PRN",
|
|
7818
|
-
"AUX",
|
|
7819
|
-
"NUL",
|
|
7820
|
-
...[1, 2, 3, 4, 5, 6, 7, 8, 9].flatMap((i) => [`COM${i}`, `LPT${i}`])
|
|
7821
|
-
]);
|
|
7822
|
-
var BAD_CHAR = /[<>:"|?*\p{Cc}]/u;
|
|
7823
|
-
function nameFault(name) {
|
|
7824
|
-
for (const seg2 of name.split("/")) {
|
|
7825
|
-
if (BAD_CHAR.test(seg2)) return `segment ${JSON.stringify(seg2)} holds a reserved or control character`;
|
|
7826
|
-
if (seg2.endsWith(".") || seg2.endsWith(" ")) return `segment ${JSON.stringify(seg2)} ends in a dot or a space`;
|
|
7827
|
-
if (RESERVED.has(seg2.split(".")[0].toUpperCase())) return `segment ${JSON.stringify(seg2)} is a Windows device name`;
|
|
7828
|
-
}
|
|
7829
|
-
return null;
|
|
7830
|
-
}
|
|
7831
|
-
function isJunk(path) {
|
|
7832
|
-
return path.split("/").some((seg2) => seg2 === "__MACOSX" || seg2 === ".DS_Store" || seg2 === "Thumbs.db");
|
|
7833
|
-
}
|
|
7834
|
-
function foldName(name) {
|
|
7835
|
-
return simpleCaseFold(nfc(name));
|
|
7836
|
-
}
|
|
7837
|
-
function byCodePoint3(a, b) {
|
|
7838
|
-
const n = Math.min(a.length, b.length);
|
|
7839
|
-
for (let i = 0; i < n; i++) {
|
|
7840
|
-
const x = a.codePointAt(i);
|
|
7841
|
-
const y = b.codePointAt(i);
|
|
7842
|
-
if (x !== y) return x - y;
|
|
7843
|
-
if (x > 65535) i++;
|
|
7844
|
-
}
|
|
7845
|
-
return a.length - b.length;
|
|
7846
|
-
}
|
|
7847
|
-
var u16 = (b, o) => b[o] | b[o + 1] << 8;
|
|
7848
|
-
var u32 = (b, o) => (b[o] | b[o + 1] << 8 | b[o + 2] << 16) + b[o + 3] * 16777216;
|
|
7849
|
-
var u64 = (b, o) => u32(b, o) + u32(b, o + 4) * 4294967296;
|
|
7850
|
-
var SIG_LOCAL = 67324752;
|
|
7851
|
-
var SIG_CENTRAL = 33639248;
|
|
7852
|
-
var SIG_END = 101010256;
|
|
7853
|
-
var SIG_END64 = 101075792;
|
|
7854
|
-
var SIG_LOCATOR64 = 117853008;
|
|
7855
|
-
var MAX32 = 4294967295;
|
|
7856
|
-
var utf8 = new TextDecoder("utf-8", { fatal: true });
|
|
7857
|
-
var latin1 = (b) => {
|
|
7858
|
-
let s = "";
|
|
7859
|
-
for (const x of b) s += String.fromCharCode(x);
|
|
7860
|
-
return s;
|
|
7861
|
-
};
|
|
7862
|
-
function centralDirectory(bytes) {
|
|
7863
|
-
const len = bytes.length;
|
|
7864
|
-
let end = -1;
|
|
7865
|
-
for (let i = len - 22; i >= Math.max(0, len - 22 - 65535); i--) {
|
|
7866
|
-
if (u32(bytes, i) === SIG_END) {
|
|
7867
|
-
end = i;
|
|
7868
|
-
break;
|
|
7869
|
-
}
|
|
7870
|
-
}
|
|
7871
|
-
if (end < 0) refuse2("not_openable", "The file is not a zip: it has no end of central directory.");
|
|
7872
|
-
const thisDisk = u16(bytes, end + 4);
|
|
7873
|
-
const cdDisk = u16(bytes, end + 6);
|
|
7874
|
-
if (!(thisDisk === 0 && cdDisk === 0 || thisDisk === 65535 && cdDisk === 65535)) {
|
|
7875
|
-
refuse2("not_openable", `The zip spans disks (its end record says disk ${thisDisk}, the directory on disk ${cdDisk}).`);
|
|
7876
|
-
}
|
|
7877
|
-
let cdSize = u32(bytes, end + 12);
|
|
7878
|
-
let cdOffset = u32(bytes, end + 16);
|
|
7879
|
-
const loc = end - 20;
|
|
7880
|
-
if (loc >= 0 && u32(bytes, loc) === SIG_LOCATOR64) {
|
|
7881
|
-
if (u32(bytes, loc + 4) !== 0 || u32(bytes, loc + 16) > 1) refuse2("not_openable", "The zip spans disks (zip64).");
|
|
7882
|
-
const rec = u64(bytes, loc + 8);
|
|
7883
|
-
if (rec + 56 > len || u32(bytes, rec) !== SIG_END64) refuse2("not_openable", "The zip64 end record is missing.");
|
|
7884
|
-
if (u32(bytes, rec + 16) !== 0 || u32(bytes, rec + 20) !== 0) refuse2("not_openable", "The zip spans disks (zip64).");
|
|
7885
|
-
cdSize = u64(bytes, rec + 40);
|
|
7886
|
-
cdOffset = u64(bytes, rec + 48);
|
|
7887
|
-
}
|
|
7888
|
-
const cdEnd = cdOffset + cdSize;
|
|
7889
|
-
if (cdEnd > len) refuse2("not_openable", "The central directory lies past the end of the file.");
|
|
7890
|
-
const out = [];
|
|
7891
|
-
let p = cdOffset;
|
|
7892
|
-
while (p < cdEnd) {
|
|
7893
|
-
if (p + 46 > cdEnd || u32(bytes, p) !== SIG_CENTRAL) refuse2("not_openable", "The central directory is broken.");
|
|
7894
|
-
const flags = u16(bytes, p + 8);
|
|
7895
|
-
const nlen = u16(bytes, p + 28);
|
|
7896
|
-
const elen = u16(bytes, p + 30);
|
|
7897
|
-
const clen = u16(bytes, p + 32);
|
|
7898
|
-
const nameBytes = bytes.subarray(p + 46, p + 46 + nlen);
|
|
7899
|
-
const extra = bytes.subarray(p + 46 + nlen, p + 46 + nlen + elen);
|
|
7900
|
-
let usize = u32(bytes, p + 24);
|
|
7901
|
-
let csize = u32(bytes, p + 20);
|
|
7902
|
-
let offset = u32(bytes, p + 42);
|
|
7903
|
-
if (usize === MAX32 || csize === MAX32 || offset === MAX32) {
|
|
7904
|
-
for (let q = 0; q + 4 <= extra.length; q += 4 + u16(extra, q + 2)) {
|
|
7905
|
-
if (u16(extra, q) !== 1) continue;
|
|
7906
|
-
let r = q + 4;
|
|
7907
|
-
const stop = r + u16(extra, q + 2);
|
|
7908
|
-
const next = () => {
|
|
7909
|
-
if (r + 8 > stop) refuse2("not_openable", "A zip64 extra field is short.");
|
|
7910
|
-
const v = u64(extra, r);
|
|
7911
|
-
r += 8;
|
|
7912
|
-
return v;
|
|
7913
|
-
};
|
|
7914
|
-
if (usize === MAX32) usize = next();
|
|
7915
|
-
if (csize === MAX32) csize = next();
|
|
7916
|
-
if (offset === MAX32) offset = next();
|
|
7917
|
-
break;
|
|
7918
|
-
}
|
|
7919
|
-
}
|
|
7920
|
-
const nonAscii = nameBytes.some((x) => x > 127);
|
|
7921
|
-
let name;
|
|
7922
|
-
let badUtf8 = false;
|
|
7923
|
-
if (flags & 2048) {
|
|
7924
|
-
try {
|
|
7925
|
-
name = utf8.decode(nameBytes);
|
|
7926
|
-
} catch {
|
|
7927
|
-
name = latin1(nameBytes);
|
|
7928
|
-
badUtf8 = true;
|
|
7929
|
-
}
|
|
7930
|
-
} else {
|
|
7931
|
-
name = latin1(nameBytes);
|
|
7932
|
-
}
|
|
7933
|
-
out.push({
|
|
7934
|
-
name,
|
|
7935
|
-
flags,
|
|
7936
|
-
method: u16(bytes, p + 10),
|
|
7937
|
-
crc: u32(bytes, p + 16),
|
|
7938
|
-
csize,
|
|
7939
|
-
usize,
|
|
7940
|
-
offset,
|
|
7941
|
-
external: u32(bytes, p + 38),
|
|
7942
|
-
nonAscii,
|
|
7943
|
-
badUtf8
|
|
7944
|
-
});
|
|
7945
|
-
p += 46 + nlen + elen + clen;
|
|
7946
|
-
}
|
|
7947
|
-
if (p !== cdEnd) refuse2("not_openable", "The central directory is broken.");
|
|
7948
|
-
return out;
|
|
7949
|
-
}
|
|
7950
|
-
var crcTable = null;
|
|
7951
|
-
function crc32(data) {
|
|
7952
|
-
if (!crcTable) {
|
|
7953
|
-
crcTable = new Int32Array(256);
|
|
7954
|
-
for (let n = 0; n < 256; n++) {
|
|
7955
|
-
let c2 = n;
|
|
7956
|
-
for (let k = 0; k < 8; k++) c2 = c2 & 1 ? 3988292384 ^ c2 >>> 1 : c2 >>> 1;
|
|
7957
|
-
crcTable[n] = c2;
|
|
7958
|
-
}
|
|
7959
|
-
}
|
|
7960
|
-
let c = -1;
|
|
7961
|
-
for (let i = 0; i < data.length; i++) c = crcTable[(c ^ data[i]) & 255] ^ c >>> 8;
|
|
7962
|
-
return (c ^ -1) >>> 0;
|
|
7963
|
-
}
|
|
7964
|
-
var CHUNK = 64 * 1024;
|
|
7965
|
-
function endsEarly(payload) {
|
|
7966
|
-
const short = payload.subarray(0, payload.length - 1);
|
|
7967
|
-
try {
|
|
7968
|
-
if (short.length <= CHUNK) {
|
|
7969
|
-
inflateSync(short);
|
|
7970
|
-
} else {
|
|
7971
|
-
const inf = new Inflate(() => {
|
|
7972
|
-
});
|
|
7973
|
-
for (let i = 0; i < short.length; i += CHUNK) {
|
|
7974
|
-
const stop = Math.min(i + CHUNK, short.length);
|
|
7975
|
-
inf.push(short.subarray(i, stop), stop === short.length);
|
|
7976
|
-
}
|
|
7977
|
-
}
|
|
7978
|
-
} catch {
|
|
7979
|
-
return false;
|
|
7980
|
-
}
|
|
7981
|
-
return true;
|
|
7982
|
-
}
|
|
7983
|
-
function inflateEntry(bytes, e) {
|
|
7984
|
-
const off = e.offset;
|
|
7985
|
-
if (off + 30 > bytes.length || u32(bytes, off) !== SIG_LOCAL) refuse2("not_openable", `${e.name}: no local header at its offset.`);
|
|
7986
|
-
const start = off + 30 + u16(bytes, off + 26) + u16(bytes, off + 28);
|
|
7987
|
-
const payload = bytes.subarray(start, start + e.csize);
|
|
7988
|
-
let data;
|
|
7989
|
-
if (e.method === 0) {
|
|
7990
|
-
data = payload;
|
|
7991
|
-
} else if (payload.length <= CHUNK) {
|
|
7992
|
-
try {
|
|
7993
|
-
data = inflateSync(payload);
|
|
7994
|
-
} catch {
|
|
7995
|
-
return refuse2("not_openable", `${e.name}: its deflate stream is broken.`);
|
|
7996
|
-
}
|
|
7997
|
-
} else {
|
|
7998
|
-
const out = new Uint8Array(e.usize);
|
|
7999
|
-
let n = 0;
|
|
8000
|
-
let over = false;
|
|
8001
|
-
const inf = new Inflate((chunk) => {
|
|
8002
|
-
if (n + chunk.length > e.usize) {
|
|
8003
|
-
over = true;
|
|
8004
|
-
throw new Error("past its size");
|
|
8005
|
-
}
|
|
8006
|
-
out.set(chunk, n);
|
|
8007
|
-
n += chunk.length;
|
|
8008
|
-
});
|
|
8009
|
-
try {
|
|
8010
|
-
for (let i = 0; i < payload.length; i += CHUNK) {
|
|
8011
|
-
const stop = Math.min(i + CHUNK, payload.length);
|
|
8012
|
-
inf.push(payload.subarray(i, stop), stop === payload.length);
|
|
8013
|
-
}
|
|
8014
|
-
} catch {
|
|
8015
|
-
if (!over) refuse2("not_openable", `${e.name}: its deflate stream is broken.`);
|
|
8016
|
-
}
|
|
8017
|
-
data = over ? new Uint8Array(e.usize + 1) : out.subarray(0, n);
|
|
8018
|
-
}
|
|
8019
|
-
if (data.length > e.usize) refuse2("too_big", `${e.name} holds more than the ${e.usize} bytes it declares.`);
|
|
8020
|
-
if (data.length !== e.usize) refuse2("not_openable", `${e.name} holds ${data.length} bytes and declares ${e.usize}.`);
|
|
8021
|
-
if (e.method !== 0 && payload.length > 0 && endsEarly(payload)) {
|
|
8022
|
-
refuse2("not_openable", `${e.name}: its deflate stream ends before its declared compressed size.`);
|
|
8023
|
-
}
|
|
8024
|
-
if (crc32(data) !== e.crc) refuse2("not_openable", `${e.name} fails its CRC.`);
|
|
8025
|
-
return e.method === 0 ? data.slice() : data;
|
|
8026
|
-
}
|
|
8027
|
-
function parseWorld(data) {
|
|
8028
|
-
let meta;
|
|
8029
|
-
try {
|
|
8030
|
-
meta = JSON.parse(new TextDecoder().decode(data));
|
|
8031
|
-
} catch {
|
|
8032
|
-
throw new OwWorldFileError("not_a_world");
|
|
8033
|
-
}
|
|
8034
|
-
if (!meta || typeof meta !== "object" || Array.isArray(meta)) throw new OwWorldFileError("not_a_world");
|
|
8035
|
-
const id = meta.id;
|
|
8036
|
-
if (typeof id !== "string" || !id.trim()) throw new OwWorldFileError("not_a_world");
|
|
8037
|
-
return meta;
|
|
8038
|
-
}
|
|
8039
|
-
function withoutLink(data, meta) {
|
|
8040
|
-
if (!("api" in meta)) return { data, world: meta };
|
|
8041
|
-
const { api: _link, ...rest } = meta;
|
|
8042
|
-
return { data: new TextEncoder().encode(JSON.stringify(rest, null, 2) + "\n"), world: rest };
|
|
8043
|
-
}
|
|
8044
|
-
function checkCollisions(names) {
|
|
8045
|
-
const byFold = /* @__PURE__ */ new Map();
|
|
8046
|
-
const segFold = /* @__PURE__ */ new Map();
|
|
8047
|
-
const done = /* @__PURE__ */ new Set();
|
|
8048
|
-
for (const raw of names) {
|
|
8049
|
-
const segs = (raw.endsWith("/") ? raw.slice(0, -1) : raw).split("/");
|
|
8050
|
-
let prefix = "";
|
|
8051
|
-
let folded = "";
|
|
8052
|
-
for (let i = 0; i < segs.length; i++) {
|
|
8053
|
-
let f = segFold.get(segs[i]);
|
|
8054
|
-
if (f === void 0) {
|
|
8055
|
-
f = foldName(segs[i]);
|
|
8056
|
-
segFold.set(segs[i], f);
|
|
8057
|
-
}
|
|
8058
|
-
prefix = i ? `${prefix}/${segs[i]}` : segs[i];
|
|
8059
|
-
folded = i ? `${folded}/${f}` : f;
|
|
8060
|
-
if (done.has(prefix)) continue;
|
|
8061
|
-
done.add(prefix);
|
|
8062
|
-
const other = byFold.get(folded);
|
|
8063
|
-
if (other !== void 0) {
|
|
8064
|
-
refuse2("collision", `The names ${JSON.stringify(other)} and ${JSON.stringify(prefix)} are one name after NFC and case folding.`);
|
|
8065
|
-
}
|
|
8066
|
-
byFold.set(folded, prefix);
|
|
8067
|
-
}
|
|
8068
|
-
}
|
|
8069
|
-
}
|
|
8070
|
-
function checkFileAndFolder(files) {
|
|
8071
|
-
const seen = /* @__PURE__ */ new Set();
|
|
8072
|
-
for (const n of files) {
|
|
8073
|
-
const segs = n.split("/");
|
|
8074
|
-
let prefix = "";
|
|
8075
|
-
for (let i = 0; i < segs.length - 1; i++) {
|
|
8076
|
-
prefix = i ? `${prefix}/${segs[i]}` : segs[i];
|
|
8077
|
-
if (seen.has(prefix)) continue;
|
|
8078
|
-
seen.add(prefix);
|
|
8079
|
-
if (files.has(prefix)) refuse2("unsafe_path", `${JSON.stringify(prefix)} is a file and a folder.`);
|
|
8080
|
-
}
|
|
8081
|
-
}
|
|
8082
|
-
}
|
|
8083
|
-
function readWorldFile(bytes, opts = {}) {
|
|
8084
|
-
refuseUnknownOptions("readWorldFile", opts, READ_OPTION_KEYS, "Nothing was read.");
|
|
8085
|
-
const maxBytes = opts.maxBytes ?? WORLD_FILE_MAX_BYTES;
|
|
8086
|
-
const maxEntries = opts.maxEntries ?? WORLD_FILE_MAX_ENTRIES;
|
|
8087
|
-
const entries = centralDirectory(bytes);
|
|
8088
|
-
const seen = /* @__PURE__ */ new Set();
|
|
8089
|
-
const files = [];
|
|
8090
|
-
let declared = 0;
|
|
8091
|
-
for (const e of entries) {
|
|
8092
|
-
const name2 = e.name;
|
|
8093
|
-
const isDir = name2.endsWith("/");
|
|
8094
|
-
const bare = isDir ? name2.slice(0, -1) : name2;
|
|
8095
|
-
const quoted = JSON.stringify(name2);
|
|
8096
|
-
const fault = pathFault(bare);
|
|
8097
|
-
if (fault) refuse2("unsafe_path", `The entry ${quoted} ${fault}.`);
|
|
8098
|
-
const kind = e.external >>> 16 & 61440;
|
|
8099
|
-
if (kind !== 0 && kind !== 32768 && kind !== 16384) refuse2("link", `The entry ${quoted} is a link or a special file.`);
|
|
8100
|
-
if (e.flags & 65) refuse2("method", `The entry ${quoted} is encrypted.`);
|
|
8101
|
-
if (e.method !== 0 && e.method !== 8) refuse2("method", `The entry ${quoted} uses method ${e.method} (only stored and deflate).`);
|
|
8102
|
-
if (e.badUtf8) refuse2("name", `The entry ${quoted} is flagged UTF-8 and is not.`);
|
|
8103
|
-
if (e.nonAscii && !(e.flags & 2048)) refuse2("name", `The entry ${quoted} is not ASCII and lacks the UTF-8 flag.`);
|
|
8104
|
-
const bad = nameFault(bare);
|
|
8105
|
-
if (bad) refuse2("name", `The entry ${quoted}: ${bad}.`);
|
|
8106
|
-
if (seen.has(name2)) refuse2("duplicate", `The entry ${quoted} appears twice.`);
|
|
8107
|
-
seen.add(name2);
|
|
8108
|
-
if (isDir) continue;
|
|
8109
|
-
files.push(e);
|
|
8110
|
-
if (files.length > maxEntries) refuse2("too_many", `The world file holds more than ${maxEntries} files.`);
|
|
8111
|
-
declared += e.usize;
|
|
8112
|
-
if (declared > maxBytes) refuse2("too_big", `The world file declares more than ${maxBytes} bytes.`);
|
|
8113
|
-
}
|
|
8114
|
-
checkCollisions(seen);
|
|
8115
|
-
const names = new Set(files.map((e) => e.name));
|
|
8116
|
-
checkFileAndFolder(names);
|
|
8117
|
-
const marker = files.find((e) => e.name === MARKER_NAME);
|
|
8118
|
-
if (marker && new TextDecoder("utf-8", { ignoreBOM: true }).decode(inflateEntry(bytes, marker)) !== WORLD_FILE_MEDIA_TYPE) {
|
|
8119
|
-
refuse2("marker", "The mimetype entry holds other bytes than the OnlyWorlds media type.");
|
|
8120
|
-
}
|
|
8121
|
-
const candidates = [...names].filter((n) => n !== MARKER_NAME && !isJunk(n));
|
|
8122
|
-
let prefix;
|
|
8123
|
-
if (candidates.includes(WORLD_FILE)) {
|
|
8124
|
-
prefix = "";
|
|
8125
|
-
} else {
|
|
8126
|
-
const roots = new Set(candidates.filter((n) => n.split("/").length === 2 && n.endsWith(`/${WORLD_FILE}`) && !n.startsWith(".")).map((n) => n.slice(0, -WORLD_FILE.length)));
|
|
8127
|
-
if (roots.size === 0) refuse2("not_a_world", "There is no world.json at the root or in one top-level folder.");
|
|
8128
|
-
if (roots.size > 1) refuse2("more_than_one", `The file holds worlds in ${[...roots].join(", ")}.`);
|
|
8129
|
-
prefix = [...roots][0];
|
|
8130
|
-
}
|
|
8131
|
-
const inside = new Set(candidates.filter((n) => n.startsWith(prefix)));
|
|
8132
|
-
for (const n of inside) {
|
|
8133
|
-
const rel = n.slice(prefix.length);
|
|
8134
|
-
if (rel !== WORLD_FILE && rel.endsWith(`/${WORLD_FILE}`) && !rel.startsWith("records/")) {
|
|
8135
|
-
refuse2("more_than_one", `A second world.json sits inside the world: ${n}.`);
|
|
8136
|
-
}
|
|
8137
|
-
}
|
|
8138
|
-
const content = /* @__PURE__ */ new Map();
|
|
8139
|
-
for (const e of files) {
|
|
8140
|
-
const data = inflateEntry(bytes, e);
|
|
8141
|
-
if (inside.has(e.name)) content.set(e.name, data);
|
|
8142
|
-
}
|
|
8143
|
-
const worldName = `${prefix}${WORLD_FILE}`;
|
|
8144
|
-
const parsed = withoutLink(content.get(worldName), parseWorld(content.get(worldName)));
|
|
8145
|
-
const out = [];
|
|
8146
|
-
for (const [n, data] of content) {
|
|
8147
|
-
const path = n.slice(prefix.length);
|
|
8148
|
-
if (opts.skip?.(path)) continue;
|
|
8149
|
-
out.push({ path, data: n === worldName ? parsed.data : data });
|
|
8150
|
-
}
|
|
8151
|
-
out.sort((a, b) => byCodePoint3(a.path, b.path));
|
|
8152
|
-
const name = parsed.world.name;
|
|
8153
|
-
return {
|
|
8154
|
-
worldId: parsed.world.id,
|
|
8155
|
-
name: typeof name === "string" ? name : "",
|
|
8156
|
-
world: parsed.world,
|
|
8157
|
-
files: out
|
|
8158
|
-
};
|
|
8159
|
-
}
|
|
8160
|
-
var PARTS = /* @__PURE__ */ new Set(["elements", "spatial", "media", "records"]);
|
|
8161
|
-
function carried(path) {
|
|
8162
|
-
if (path === WORLD_FILE) return true;
|
|
8163
|
-
const segs = path.split("/");
|
|
8164
|
-
if (segs.length < 2) return false;
|
|
8165
|
-
if (segs[0].startsWith(".")) return true;
|
|
8166
|
-
if (!PARTS.has(segs[0])) return false;
|
|
8167
|
-
if (segs[0] === "records") return true;
|
|
8168
|
-
return !segs.some((s) => s.startsWith(".")) && !path.endsWith(".meta");
|
|
8169
|
-
}
|
|
8170
|
-
var STAMP = new Date(1980, 0, 1, 0, 0, 0);
|
|
8171
|
-
var WRITE_OPTION_KEYS = ["includePrivateRecords", "includeHidden", "includeAuthorFields", "report"];
|
|
8172
|
-
var RECORDS_MANIFEST = "records/RECORDS.json";
|
|
8173
|
-
var AUTHOR_FIELDS = ["created_by", "changed_by", "changed_via", "changed_client", "doors"];
|
|
8174
|
-
function writeOptions(opts) {
|
|
8175
|
-
if (opts === void 0 || opts === null) return { includePrivate: false, includeHidden: true, includeAuthorFields: false };
|
|
8176
|
-
if (typeof opts !== "object") throw new TypeError(`writeWorldFile: options must be an object, such as { includePrivateRecords: true }. Nothing was written.`);
|
|
8177
|
-
refuseUnknownOptions("writeWorldFile", opts, WRITE_OPTION_KEYS, "Nothing was written.");
|
|
8178
|
-
const o = opts;
|
|
8179
|
-
for (const key3 of ["includePrivateRecords", "includeHidden", "includeAuthorFields"]) {
|
|
8180
|
-
const asked = o[key3];
|
|
8181
|
-
if (asked !== void 0 && typeof asked !== "boolean") {
|
|
8182
|
-
throw new TypeError(`writeWorldFile: ${key3} must be true or false; got ${JSON.stringify(asked) ?? String(asked)}. Nothing was written.`);
|
|
8183
|
-
}
|
|
8184
|
-
}
|
|
8185
|
-
if (o.report !== void 0 && typeof o.report !== "function") {
|
|
8186
|
-
throw new TypeError(`writeWorldFile: report must be a function; got ${JSON.stringify(o.report) ?? String(o.report)}. Nothing was written.`);
|
|
8187
|
-
}
|
|
8188
|
-
return {
|
|
8189
|
-
includePrivate: o.includePrivateRecords === true,
|
|
8190
|
-
includeHidden: o.includeHidden !== false,
|
|
8191
|
-
includeAuthorFields: o.includeAuthorFields === true,
|
|
8192
|
-
report: o.report
|
|
8193
|
-
};
|
|
8194
|
-
}
|
|
8195
|
-
function elementObject(f) {
|
|
8196
|
-
const segs = f.path.split("/");
|
|
8197
|
-
if (segs.length !== 3 || segs[0] !== "elements" && segs[0] !== "spatial" || !/\.json$/i.test(segs[2])) return null;
|
|
8198
|
-
let doc;
|
|
8199
|
-
try {
|
|
8200
|
-
doc = JSON.parse(new TextDecoder("utf-8", { fatal: true }).decode(f.data));
|
|
8201
|
-
} catch {
|
|
8202
|
-
return null;
|
|
8203
|
-
}
|
|
8204
|
-
if (doc === null || typeof doc !== "object" || Array.isArray(doc)) return null;
|
|
8205
|
-
return doc;
|
|
8206
|
-
}
|
|
8207
|
-
function isHiddenElement(f) {
|
|
8208
|
-
const doc = elementObject(f);
|
|
8209
|
-
if (!doc) return false;
|
|
8210
|
-
const mark = doc.hidden;
|
|
8211
|
-
return mark !== void 0 && mark !== null && mark !== false;
|
|
8212
|
-
}
|
|
8213
|
-
function withoutAuthorFields(f) {
|
|
8214
|
-
const doc = elementObject(f);
|
|
8215
|
-
if (!doc) return null;
|
|
8216
|
-
const present = AUTHOR_FIELDS.filter((k) => k in doc);
|
|
8217
|
-
if (!present.length) return null;
|
|
8218
|
-
for (const k of present) delete doc[k];
|
|
8219
|
-
return new TextEncoder().encode(JSON.stringify(doc, null, 2) + "\n");
|
|
8220
|
-
}
|
|
8221
|
-
function privateProducers(files) {
|
|
8222
|
-
const manifest = files.find((f) => f.path === RECORDS_MANIFEST);
|
|
8223
|
-
if (!manifest) return [];
|
|
8224
|
-
const unreadable = (why) => {
|
|
8225
|
-
throw new TypeError(`writeWorldFile: ${RECORDS_MANIFEST} ${why}, so which records are private cannot be read and none is left out by guess (spec \xA74.7, OW-8). Fix the manifest, or pass { includePrivateRecords: true } to carry every record. Nothing was written.`);
|
|
8226
|
-
};
|
|
8227
|
-
let doc;
|
|
8228
|
-
try {
|
|
8229
|
-
doc = JSON.parse(new TextDecoder("utf-8", { fatal: true }).decode(manifest.data));
|
|
8230
|
-
} catch {
|
|
8231
|
-
unreadable("is not JSON");
|
|
8232
|
-
}
|
|
8233
|
-
if (!Array.isArray(doc)) unreadable("is not a JSON array of entries");
|
|
8234
|
-
const out = [];
|
|
8235
|
-
for (const entry of doc) {
|
|
8236
|
-
if (entry === null || typeof entry !== "object" || Array.isArray(entry)) unreadable("holds an entry that is not an object");
|
|
8237
|
-
const { producer, private: isPrivate } = entry;
|
|
8238
|
-
if (isPrivate !== true) continue;
|
|
8239
|
-
if (typeof producer !== "string" || producer === "") unreadable("marks an entry private without a producer name");
|
|
8240
|
-
out.push(producer);
|
|
8241
|
-
}
|
|
8242
|
-
return out;
|
|
8243
|
-
}
|
|
8244
|
-
function writeWorldFile(files, topDir, opts = {}) {
|
|
8245
|
-
const { includePrivate, includeHidden, includeAuthorFields, report } = writeOptions(opts);
|
|
8246
|
-
if (pathFault(topDir) || topDir.includes("/")) throw new OwWorldFileError("unsafe_path");
|
|
8247
|
-
const seen = /* @__PURE__ */ new Set();
|
|
8248
|
-
for (const f of files) {
|
|
8249
|
-
if (pathFault(f.path)) throw new OwWorldFileError("unsafe_path");
|
|
8250
|
-
if (seen.has(f.path)) throw new OwWorldFileError("unsafe_path", `The path ${f.path} is listed twice.`);
|
|
8251
|
-
seen.add(f.path);
|
|
8252
|
-
}
|
|
8253
|
-
const left = new Set(includePrivate ? [] : privateProducers(files).map(foldName));
|
|
8254
|
-
const inPrivate = (path) => {
|
|
8255
|
-
const segs = path.split("/");
|
|
8256
|
-
return segs.length > 2 && segs[0] === "records" && left.has(foldName(segs[1]));
|
|
8257
|
-
};
|
|
8258
|
-
let hiddenLeftOut = 0;
|
|
8259
|
-
const kept = files.filter((f) => {
|
|
8260
|
-
if (!carried(f.path) || inPrivate(f.path)) return false;
|
|
8261
|
-
if (!includeHidden && isHiddenElement(f)) {
|
|
8262
|
-
hiddenLeftOut++;
|
|
8263
|
-
return false;
|
|
8264
|
-
}
|
|
8265
|
-
return true;
|
|
8266
|
-
});
|
|
8267
|
-
if (!kept.some((f) => f.path === WORLD_FILE)) throw new OwWorldFileError("not_a_world");
|
|
8268
|
-
const keys = kept.map((f) => `${topDir}/${f.path}`);
|
|
8269
|
-
for (const key3 of keys) {
|
|
8270
|
-
const bad = nameFault(key3);
|
|
8271
|
-
if (bad) throw new OwWorldFileError("name", `The path ${key3}: ${bad}.`);
|
|
8272
|
-
}
|
|
8273
|
-
checkCollisions([MARKER_NAME, ...keys]);
|
|
8274
|
-
checkFileAndFolder(/* @__PURE__ */ new Set([MARKER_NAME, ...keys]));
|
|
8275
|
-
const input = {
|
|
8276
|
-
[MARKER_NAME]: [new TextEncoder().encode(WORLD_FILE_MEDIA_TYPE), { level: 0, mtime: STAMP }]
|
|
8277
|
-
};
|
|
8278
|
-
let authorFieldsLeftOut = 0;
|
|
8279
|
-
for (const f of [...kept].sort((a, b) => byCodePoint3(a.path, b.path))) {
|
|
8280
|
-
let data = f.data;
|
|
8281
|
-
if (f.path === WORLD_FILE) {
|
|
8282
|
-
data = withoutLink(data, parseWorld(data)).data;
|
|
8283
|
-
} else if (!includeAuthorFields) {
|
|
8284
|
-
const bare = withoutAuthorFields(f);
|
|
8285
|
-
if (bare) {
|
|
8286
|
-
data = bare;
|
|
8287
|
-
authorFieldsLeftOut++;
|
|
8288
|
-
}
|
|
8289
|
-
}
|
|
8290
|
-
input[`${topDir}/${f.path}`] = [data, { level: /\.json$/i.test(f.path) ? 6 : 0, mtime: STAMP }];
|
|
8291
|
-
}
|
|
8292
|
-
const zip = zipSync(input);
|
|
8293
|
-
report?.({ hiddenLeftOut, authorFieldsLeftOut });
|
|
8294
|
-
return zip;
|
|
8295
|
-
}
|
|
8296
|
-
|
|
8297
7429
|
// src/lookup.ts
|
|
8298
7430
|
var LOOKUP_OPTION_KEYS = ["limit"];
|
|
8299
7431
|
var RENDER_OPTION_KEYS = ["descMax", "linkMax", "incomingMax"];
|
|
@@ -9141,7 +8273,7 @@ async function preparePhoto(input, opts = {}) {
|
|
|
9141
8273
|
}
|
|
9142
8274
|
|
|
9143
8275
|
// src/calendar/calendar.ts
|
|
9144
|
-
function
|
|
8276
|
+
function floorDiv(a, b) {
|
|
9145
8277
|
return Math.floor(a / b);
|
|
9146
8278
|
}
|
|
9147
8279
|
function floorMod(a, b) {
|
|
@@ -9281,7 +8413,7 @@ function ruleHolds(r, y) {
|
|
|
9281
8413
|
return on;
|
|
9282
8414
|
}
|
|
9283
8415
|
function multiplesIn(a, b, m, offset) {
|
|
9284
|
-
return
|
|
8416
|
+
return floorDiv(b - 1 + offset, m) - floorDiv(a - 1 + offset, m);
|
|
9285
8417
|
}
|
|
9286
8418
|
function leapYearsBefore(y, r) {
|
|
9287
8419
|
const [a, b, sign] = y >= 0 ? [0, y, 1] : [y, 0, -1];
|
|
@@ -9324,7 +8456,7 @@ var MAX_YEAR_CORRECTION = 1e4;
|
|
|
9324
8456
|
function absoluteYear(cfg, step) {
|
|
9325
8457
|
const shape = yearShape(cfg);
|
|
9326
8458
|
const meanLen = shape.rules.reduce((a, r) => a + meanLeap(r), shape.baseLen);
|
|
9327
|
-
let y =
|
|
8459
|
+
let y = floorDiv(step, meanLen);
|
|
9328
8460
|
if (!Number.isFinite(y)) return y;
|
|
9329
8461
|
for (let i = 0; i < MAX_YEAR_CORRECTION && step < yearStartStep(cfg, y); i++) y -= 1;
|
|
9330
8462
|
for (let i = 0; i < MAX_YEAR_CORRECTION && step >= yearStartStep(cfg, y + 1); i++) y += 1;
|
|
@@ -9937,7 +9069,7 @@ export {
|
|
|
9937
9069
|
fieldLabel,
|
|
9938
9070
|
fileKindOf,
|
|
9939
9071
|
findOwLinks,
|
|
9940
|
-
|
|
9072
|
+
floorDiv,
|
|
9941
9073
|
floorMod,
|
|
9942
9074
|
formatDuration,
|
|
9943
9075
|
formatMidLabel,
|