@poe-platform/safe-bash 0.1.816 → 0.1.817

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/dist/pdf-ast/content/evaluator.d.ts +4 -0
  2. package/dist/pdf-ast/cos/value-parser.d.ts +2 -0
  3. package/dist/pdf-ast/fonts/resolve.d.ts +5 -1
  4. package/dist/pdf-ast/index.js +172 -165
  5. package/dist/safe-bash/command-chunks/biff-KLS4T7FP-UO3CXFFF.js +5581 -0
  6. package/dist/safe-bash/command-chunks/chunk-2J4OQT3F.js +153 -0
  7. package/dist/safe-bash/command-chunks/{chunk-K7VDCBXW.js → chunk-ABL2DPJI.js} +20 -20
  8. package/dist/safe-bash/command-chunks/{chunk-RINR7XPR.js → chunk-E64ZI2YB.js} +121 -4
  9. package/dist/safe-bash/command-chunks/{chunk-GEDO5V32.js → chunk-FSG6UC2N.js} +243 -105
  10. package/dist/safe-bash/command-chunks/{chunk-4QEJPP3K.js → chunk-S5X7PBO4.js} +1 -1
  11. package/dist/safe-bash/command-chunks/{chunk-IHLZ6HNQ.js → chunk-TSKJNCKD.js} +3 -2
  12. package/dist/safe-bash/command-chunks/{chunk-DBZCTL7C.js → chunk-UYZ6EFZE.js} +20 -18
  13. package/dist/safe-bash/command-chunks/{chunk-B2C3UPJS.js → chunk-W42SUPD6.js} +13 -1
  14. package/dist/safe-bash/command-chunks/chunk-ZHHALBM7.js +398 -0
  15. package/dist/safe-bash/command-chunks/{command-engine-GHE6QUHU.js → command-engine-2QXVRRH3.js} +8 -4
  16. package/dist/safe-bash/command-chunks/{engine-RG6HQCCB-FXYZS264.js → engine-T4GP6QOK-ECFKMR5V.js} +1 -1
  17. package/dist/safe-bash/command-chunks/odf-SL5TG4B3-XI3FNOTN.js +3041 -0
  18. package/dist/safe-bash/command-chunks/{xlsx-RE54MFCS-IQ6OXXKK.js → xlsx-RE54MFCS-4UZ5W3U7.js} +1 -1
  19. package/dist/safe-bash-command-apply-patch/apply.js +1 -1
  20. package/dist/safe-bash-command-apply-patch/index.js +1 -1
  21. package/dist/safe-bash-command-csvkit/index.js +1 -1
  22. package/dist/safe-bash-command-diff/diff.js +1 -1
  23. package/dist/safe-bash-command-diff/index.js +1 -1
  24. package/dist/safe-bash-command-pptx/engine.js +1 -1
  25. package/dist/safe-bash-command-ssconvert/index.js +5 -5
  26. package/dist/safe-bash-presentation-engine/index.js +1 -1
  27. package/dist/safe-bash-presentation-engine/retained-tags.d.ts +20 -0
  28. package/dist/safe-bash-presentation-engine/tags.d.ts +2 -0
  29. package/dist/safe-bash-presentation-engine/tags.js +11 -3
  30. package/dist/safe-bash-xml-engine/document.js +2 -2
  31. package/dist/safe-bash-xml-engine/index.js +2 -2
  32. package/dist/safe-bash-xml-engine/stored-document.d.ts +2 -0
  33. package/dist/safe-bash-xml-engine/stored-document.js +1 -1
  34. package/dist/safe-bash-xml-engine/stored-evaluate.js +2 -2
  35. package/dist/safe-bash-xml-engine/stored-namespaces.d.ts +21 -0
  36. package/dist/safe-bash-zip-engine/zip/safety.js +1 -1
  37. package/dist/safe-bash-zip-engine/zip/volumes.js +1 -1
  38. package/dist/spreadsheet-format-xls/biff-properties-merge.js +3 -3
  39. package/dist/spreadsheet-format-xls/biff-properties.d.ts +4 -2
  40. package/dist/spreadsheet-format-xls/biff-properties.js +141 -122
  41. package/dist/spreadsheet-format-xls/biff-property-names.d.ts +24 -0
  42. package/dist/spreadsheet-format-xls/biff-property-names.js +167 -0
  43. package/dist/xlsx-ast/comment-geometry.js +1 -1
  44. package/package.json +3 -2
  45. package/dist/safe-bash/command-chunks/biff-UBP2BZLK-JPODPKS3.js +0 -5448
  46. package/dist/safe-bash/command-chunks/chunk-O2HNOQQG.js +0 -161
  47. package/dist/safe-bash/command-chunks/chunk-ZUP5TBRG.js +0 -99
  48. package/dist/safe-bash/command-chunks/odf-3EA3EVSD-7B5GVNTC.js +0 -3097
@@ -1,161 +0,0 @@
1
- import {
2
- attr,
3
- child,
4
- escape,
5
- invalid,
6
- loadShared,
7
- nextRel,
8
- relPart
9
- } from "./chunk-A5SPMSKD.js";
10
- import {
11
- SelectionError,
12
- decodeSelectionToken
13
- } from "./chunk-NCNHJRIY.js";
14
- import {
15
- parseXmlPart
16
- } from "./chunk-7PYDVQPB.js";
17
- import {
18
- relativePartReference
19
- } from "./chunk-MOUCMZZP.js";
20
- import {
21
- OfficeError
22
- } from "./chunk-KM2SMMXZ.js";
23
-
24
- // packages/safe-bash-presentation-engine/src/tags.ts
25
- var relns = "http://schemas.openxmlformats.org/package/2006/relationships";
26
- function validate(options, action) {
27
- if (!options || ![Object.prototype, null].includes(Object.getPrototypeOf(options)) || Object.keys(options).some((key) => !["scope", "selection", "name", "value", "allowEmpty"].includes(key)) || options.scope !== void 0 && !["presentation", "slides"].includes(options.scope) || options.allowEmpty !== void 0 && typeof options.allowEmpty !== "boolean") invalid("Invalid tag options.");
28
- if (options.scope === "presentation" && options.selection && Object.keys(options.selection).some((key) => key !== "all" && key !== "token")) invalid("Presentation tags do not accept slide selectors.");
29
- if (action === "add" && (options.name === void 0 || options.value === void 0)) invalid("New tags require name and value.");
30
- if (action === "set" && options.name === void 0 && options.value === void 0) invalid("A tag edit requires name or value.");
31
- for (const value of [options.name, options.value]) {
32
- if (value === void 0) continue;
33
- if (typeof value !== "string") invalid("Tag fields require strings.");
34
- for (const c of value) {
35
- const n = c.codePointAt(0);
36
- if (n < 32 && ![9, 10, 13].includes(n) || n >= 55296 && n <= 57343 || n === 65534 || n === 65535) invalid("Tag fields require XML characters.");
37
- }
38
- }
39
- if (options.name === "") invalid("Tag names cannot be empty.");
40
- if (!action && (options.name !== void 0 || options.value !== void 0 || options.allowEmpty !== void 0)) invalid("Tag reads accept selection and scope only.");
41
- if (action === "remove" && (options.name !== void 0 || options.value !== void 0)) invalid("Tag removal does not accept edit fields.");
42
- }
43
- function owners(s, options) {
44
- if (options.scope === "presentation") return [{ part: s.main, slide: null }];
45
- const selection = options.selection;
46
- return (selection ? s.index.select({ kind: "slide", ...selection }) : s.index.slides).map((record) => {
47
- if (record.kind !== "slide") throw new SelectionError("invalid-selection");
48
- return { part: record.part, slide: record.position };
49
- });
50
- }
51
- function association(s, owner) {
52
- const doc = s.doc(owner);
53
- const base = owner === s.main ? doc.root : child(doc.root, "cSld");
54
- if (!base) invalid("Tag owner lacks common slide data.");
55
- const list = child(base, "custDataLst");
56
- const tags = list ? child(list, "tags") : void 0;
57
- if (!tags) return void 0;
58
- const id = tags.attributes.find((a) => a.name.namespace === s.r && a.name.localName === "id")?.value;
59
- const edges = s.index.inventory.relationships.filter((e) => e.owner === owner && e.id === id && e.type === `${s.r}/tags` && !e.external);
60
- if (edges.length !== 1 || !edges[0].targetPart) invalid("Invalid tag association.");
61
- return edges[0].targetPart;
62
- }
63
- function records(s, options) {
64
- let token;
65
- if (options.selection?.token) {
66
- if (Object.keys(options.selection).some((key) => key !== "token")) throw new SelectionError("invalid-selection");
67
- token = decodeSelectionToken(options.selection.token);
68
- if (token.fingerprint !== s.index.fingerprint) throw new SelectionError("stale-selection");
69
- if (token.scope !== "slides" && token.scope !== "presentation") throw new SelectionError("invalid-selection");
70
- if (options.scope !== void 0 && options.scope !== token.scope) throw new SelectionError("invalid-selection");
71
- }
72
- const selected = owners(s, token ? { scope: token.scope } : options);
73
- const result = selected.flatMap((owner) => {
74
- const part = association(s, owner.part);
75
- if (!part) return [];
76
- const doc = s.doc(part);
77
- if (doc.root.name.namespace !== s.p || doc.root.name.localName !== "tagLst") invalid("Invalid tag list.");
78
- return doc.root.children.flatMap((node, index) => {
79
- if (node.name.namespace !== s.p || node.name.localName !== "tag") return [];
80
- const name = attr(node, "name"), value = attr(node, "val");
81
- if (name === void 0 || value === void 0) invalid("Tag requires name and value attributes.");
82
- const location = { fingerprint: s.index.fingerprint, scope: owner.slide === null ? "presentation" : "slides", owner: owner.part, objectId: `tag:${part}:${index}`, coordinateSystem: "identity" };
83
- return [{ name, value, part, owner: owner.part, slide: owner.slide, selector: JSON.stringify(location), location }];
84
- });
85
- });
86
- return token ? result.filter((r) => r.selector === options.selection.token) : result;
87
- }
88
- async function readTags(input, options, context) {
89
- validate(options);
90
- return records(await loadShared(input, context, false), options);
91
- }
92
- function createAssociation(s, owner, context) {
93
- let n = 1;
94
- while (s.reader.has(`/ppt/tags/tag${n}.xml`) || s.changes.has(`/ppt/tags/tag${n}.xml`)) n++;
95
- const part = `/ppt/tags/tag${n}.xml`;
96
- s.save(part, parseXmlPart(new TextEncoder().encode(`<p:tagLst xmlns:p="${s.p}"/>`), context.xmlLimits));
97
- const types = s.doc("/[Content_Types].xml");
98
- s.save("/[Content_Types].xml", types.spliceChildren(types.root, types.root.children.length, 0, [`<Override xmlns="${types.root.name.namespace}" PartName="${part}" ContentType="application/vnd.openxmlformats-officedocument.presentationml.tags+xml"/>`]));
99
- const relName = relPart(owner);
100
- const rels = s.reader.has(relName) ? s.doc(relName) : parseXmlPart(new TextEncoder().encode(`<Relationships xmlns="${relns}"/>`), context.xmlLimits);
101
- const id = nextRel(rels);
102
- s.save(relName, rels.spliceChildren(rels.root, rels.root.children.length, 0, [`<Relationship xmlns="${relns}" Id="${id}" Type="${s.r}/tags" Target="${escape(relativePartReference(part, owner.slice(0, owner.lastIndexOf("/"))))}"/>`]));
103
- let doc = s.doc(owner);
104
- let base = owner === s.main ? doc.root : child(doc.root, "cSld");
105
- let list = child(base, "custDataLst");
106
- if (!list) {
107
- const order = owner === s.main ? ["sldMasterIdLst", "notesMasterIdLst", "handoutMasterIdLst", "sldIdLst", "sldSz", "notesSz", "smartTags", "embeddedFontLst", "custShowLst", "photoAlbum", "custDataLst", "kinsoku", "defaultTextStyle", "modifyVerifier", "extLst"] : ["bg", "spTree", "custDataLst", "controls", "extLst"];
108
- doc = doc.merge(base, { children: { sequence: order.map((localName) => ({ namespace: s.p, localName })), upsert: [{ name: { namespace: s.p, localName: "custDataLst" }, merge: {} }] } });
109
- base = owner === s.main ? doc.root : child(doc.root, "cSld");
110
- list = child(base, "custDataLst");
111
- }
112
- s.save(owner, doc.spliceChildren(list, list.children.length, 0, [`<p:tags xmlns:p="${s.p}" xmlns:r="${s.r}" r:id="${id}"/>`]));
113
- return part;
114
- }
115
- async function mutateTags(input, action, options, context) {
116
- if (!["add", "set", "remove"].includes(action)) invalid("Invalid tag action.");
117
- validate(options, action);
118
- if ((options.name?.length ?? 0) + (options.value?.length ?? 0) > context.xmlLimits.maxBytes) throw new OfficeError("resource-limit", "Tag exceeds XML limits.", "usage");
119
- if (!options.selection && options.scope !== "presentation") throw new SelectionError("missing-selection");
120
- const s = await loadShared(input, context);
121
- const existing = records(s, options);
122
- const locations = [];
123
- if (action === "add") {
124
- if (options.selection?.token) throw new SelectionError("invalid-selection");
125
- const selected = owners(s, options);
126
- if (!selected.length && !options.allowEmpty) throw new SelectionError("missing-selection");
127
- for (const owner of selected) {
128
- if (existing.some((r) => r.owner === owner.part && r.name === options.name)) invalid("Duplicate tag name.");
129
- const part = association(s, owner.part) ?? createAssociation(s, owner.part, context);
130
- if (s.index.inventory.relationships.filter((e) => e.targetPart === part).length > 1) throw new OfficeError("unsupported-edit", "Shared tag lists cannot be edited.", "validate-intent");
131
- const doc = s.doc(part);
132
- const location = { fingerprint: s.index.fingerprint, scope: owner.slide === null ? "presentation" : "slides", owner: owner.part, objectId: `tag:${part}:${doc.root.children.length}`, coordinateSystem: "identity" };
133
- s.save(part, doc.spliceChildren(doc.root, doc.root.children.length, 0, [`<p:tag xmlns:p="${s.p}" name="${escape(options.name)}" val="${escape(options.value)}"/>`]));
134
- locations.push(location);
135
- }
136
- } else {
137
- if (!existing.length && !options.allowEmpty) throw new SelectionError("missing-selection");
138
- if (existing.length > 1 && !options.selection?.all) throw new SelectionError("ambiguous-selection");
139
- if (options.name !== void 0) {
140
- const all = records(s, { scope: existing[0]?.location.scope });
141
- for (const record of existing) if (all.some((r) => r.owner === record.owner && r.name === options.name && r.selector !== record.selector)) invalid("Duplicate tag name.");
142
- if (existing.some((r, i) => existing.slice(0, i).some((v) => v.owner === r.owner))) invalid("Duplicate tag name.");
143
- }
144
- for (const record of [...existing].reverse()) {
145
- if (s.index.inventory.relationships.filter((e) => e.targetPart === record.part).length > 1) throw new OfficeError("unsupported-edit", "Shared tag lists cannot be edited.", "validate-intent");
146
- const doc = s.doc(record.part);
147
- const index = Number(record.location.objectId.slice(record.location.objectId.lastIndexOf(":") + 1));
148
- const node = doc.root.children[index];
149
- if (action === "remove" && (node.children.length || node.attributes.some((a) => a.name.namespace !== "" || !["name", "val"].includes(a.name.localName)))) throw new OfficeError("unsupported-edit", "Decorated tags are preserved on removal.", "validate-intent");
150
- s.save(record.part, action === "remove" ? doc.spliceChildren(doc.root, index, 1, []) : doc.merge(doc.root.children[index], { attributes: [...options.name === void 0 ? [] : [{ namespace: "", localName: "name", value: options.name }], ...options.value === void 0 ? [] : [{ namespace: "", localName: "val", value: options.value }]] }));
151
- locations.push(record.location);
152
- }
153
- }
154
- const result = await s.finish(s.main, []);
155
- return { bytes: result.bytes, affected: locations.length, locations };
156
- }
157
-
158
- export {
159
- readTags,
160
- mutateTags
161
- };
@@ -1,99 +0,0 @@
1
- import {
2
- C,
3
- L,
4
- R,
5
- T,
6
- nt,
7
- ot
8
- } from "./chunk-LNWAYODV.js";
9
-
10
- // packages/safe-bash-command-ssconvert/dist/chunks/chunk-J3VB6BSM.js
11
- var l = Uint32Array.from([1732584193, 4023233417, 2562383102, 271733878, 3285377520]);
12
- var a = new Uint32Array(80);
13
- var C2 = class extends L {
14
- A = l[0] | 0;
15
- B = l[1] | 0;
16
- C = l[2] | 0;
17
- D = l[3] | 0;
18
- E = l[4] | 0;
19
- constructor() {
20
- super(64, 20, 8, false);
21
- }
22
- get() {
23
- let { A: i, B: h, C: n, D: t, E: e } = this;
24
- return [i, h, n, t, e];
25
- }
26
- set(i, h, n, t, e) {
27
- this.A = i | 0, this.B = h | 0, this.C = n | 0, this.D = t | 0, this.E = e | 0;
28
- }
29
- _cloneInto(i) {
30
- return (i ||= new this.constructor()).set(...this.get()), this._cloneIntoMeta(i);
31
- }
32
- process(i, h) {
33
- for (let s = 0; s < 16; s++, h += 4) a[s] = i.getUint32(h, false);
34
- for (let s = 16; s < 80; s++) a[s] = R(a[s - 3] ^ a[s - 8] ^ a[s - 14] ^ a[s - 16], 1);
35
- let { A: n, B: t, C: e, D: o, E: r } = this;
36
- for (let s = 0; s < 80; s++) {
37
- let c, f;
38
- s < 20 ? (c = nt(t, e, o), f = 1518500249) : s < 40 ? (c = t ^ e ^ o, f = 1859775393) : s < 60 ? (c = ot(t, e, o), f = 2400959708) : (c = t ^ e ^ o, f = 3395469782);
39
- let D = R(n, 5) + c + r + f + a[s] | 0;
40
- r = o, o = e, e = R(t, 30), t = n, n = D;
41
- }
42
- n = n + this.A | 0, t = t + this.B | 0, e = e + this.C | 0, o = o + this.D | 0, r = r + this.E | 0, this.set(n, t, e, o, r);
43
- }
44
- roundClean() {
45
- T(a);
46
- }
47
- destroy() {
48
- this.destroyed = true, this.set(0, 0, 0, 0, 0), T(this.buffer);
49
- }
50
- };
51
- var L2 = C(() => new C2());
52
- var w = Math.pow(2, 32);
53
- var B = Array.from({ length: 64 }, (x, i) => Math.floor(w * Math.abs(Math.sin(i + 1))));
54
- var m = l.slice(0, 4);
55
- var y = new Uint32Array(16);
56
- var M = (() => {
57
- let x = [[7, 12, 17, 22], [5, 9, 14, 20], [4, 11, 16, 23], [6, 10, 15, 21]];
58
- return Uint8Array.from({ length: 64 }, (i, h) => x[Math.floor(h / 16)][h % 4]);
59
- })();
60
- var U = class extends L {
61
- A = m[0] | 0;
62
- B = m[1] | 0;
63
- C = m[2] | 0;
64
- D = m[3] | 0;
65
- constructor() {
66
- super(64, 16, 8, true);
67
- }
68
- get() {
69
- let { A: i, B: h, C: n, D: t } = this;
70
- return [i, h, n, t];
71
- }
72
- set(i, h, n, t) {
73
- this.A = i | 0, this.B = h | 0, this.C = n | 0, this.D = t | 0;
74
- }
75
- _cloneInto(i) {
76
- return (i ||= new this.constructor()).set(...this.get()), this._cloneIntoMeta(i);
77
- }
78
- process(i, h) {
79
- for (let r = 0; r < 16; r++, h += 4) y[r] = i.getUint32(h, true);
80
- let { A: n, B: t, C: e, D: o } = this;
81
- for (let r = 0; r < 64; r++) {
82
- let s, c;
83
- r < 16 ? (s = nt(t, e, o), c = r) : r < 32 ? (s = nt(o, t, e), c = (5 * r + 1) % 16) : r < 48 ? (s = t ^ e ^ o, c = (3 * r + 5) % 16) : (s = e ^ (t | ~o), c = 7 * r % 16), s = s + n + B[r] + y[c], n = o, o = e, e = t, t = t + R(s, M[r]);
84
- }
85
- n = n + this.A | 0, t = t + this.B | 0, e = e + this.C | 0, o = o + this.D | 0, this.set(n, t, e, o);
86
- }
87
- roundClean() {
88
- T(y);
89
- }
90
- destroy() {
91
- this.destroyed = true, this.set(0, 0, 0, 0), T(this.buffer);
92
- }
93
- };
94
- var R2 = C(() => new U());
95
-
96
- export {
97
- L2 as L,
98
- R2 as R
99
- };