@willwade/aac-processors 0.0.7 → 0.0.8

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.
@@ -1,4 +1,27 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
2
25
  var __importDefault = (this && this.__importDefault) || function (mod) {
3
26
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
27
  };
@@ -9,8 +32,23 @@ exports.openImage = openImage;
9
32
  exports.generateGrid3Guid = generateGrid3Guid;
10
33
  exports.createSettingsXml = createSettingsXml;
11
34
  exports.createFileMapXml = createFileMapXml;
35
+ exports.getCommonDocumentsPath = getCommonDocumentsPath;
36
+ exports.findGrid3UserPaths = findGrid3UserPaths;
37
+ exports.findGrid3HistoryDatabases = findGrid3HistoryDatabases;
38
+ exports.findGrid3Users = findGrid3Users;
39
+ exports.findGrid3Vocabularies = findGrid3Vocabularies;
40
+ exports.findGrid3UserHistory = findGrid3UserHistory;
41
+ exports.isGrid3Installed = isGrid3Installed;
42
+ exports.readGrid3History = readGrid3History;
43
+ exports.readGrid3HistoryForUser = readGrid3HistoryForUser;
44
+ exports.readAllGrid3History = readAllGrid3History;
12
45
  const adm_zip_1 = __importDefault(require("adm-zip"));
13
46
  const fast_xml_parser_1 = require("fast-xml-parser");
47
+ const fs = __importStar(require("fs"));
48
+ const path = __importStar(require("path"));
49
+ const child_process_1 = require("child_process");
50
+ const better_sqlite3_1 = __importDefault(require("better-sqlite3"));
51
+ const dotnetTicks_1 = require("../../utils/dotnetTicks");
14
52
  function normalizeZipPath(p) {
15
53
  const unified = p.replace(/\\/g, '/');
16
54
  try {
@@ -20,6 +58,10 @@ function normalizeZipPath(p) {
20
58
  return unified;
21
59
  }
22
60
  }
61
+ /**
62
+ * Build a map of button IDs to resolved image entry paths for a specific page.
63
+ * Helpful when rewriting zip entry names or validating images referenced in a grid.
64
+ */
23
65
  function getPageTokenImageMap(tree, pageId) {
24
66
  const map = new Map();
25
67
  const page = tree.getPage(pageId);
@@ -32,6 +74,10 @@ function getPageTokenImageMap(tree, pageId) {
32
74
  }
33
75
  return map;
34
76
  }
77
+ /**
78
+ * Collect all image entries referenced across every page in a tree.
79
+ * Returns normalized zip entry paths that should be preserved when pruning images.
80
+ */
35
81
  function getAllowedImageEntries(tree) {
36
82
  const out = new Set();
37
83
  Object.values(tree.pages).forEach((page) => {
@@ -42,6 +88,12 @@ function getAllowedImageEntries(tree) {
42
88
  });
43
89
  return out;
44
90
  }
91
+ /**
92
+ * Read an image entry from a gridset zip by path.
93
+ * @param gridsetBuffer Gridset archive contents
94
+ * @param entryPath Entry name inside the zip
95
+ * @returns Image data buffer or null if not found
96
+ */
45
97
  function openImage(gridsetBuffer, entryPath) {
46
98
  const zip = new adm_zip_1.default(gridsetBuffer);
47
99
  const want = normalizeZipPath(entryPath);
@@ -115,3 +167,236 @@ function createFileMapXml(grids) {
115
167
  };
116
168
  return builder.build(fileMapData);
117
169
  }
170
+ /**
171
+ * Get the Windows Common Documents folder path from registry
172
+ * Falls back to default path if registry access fails
173
+ * @returns Path to Common Documents folder
174
+ */
175
+ function getCommonDocumentsPath() {
176
+ // Only works on Windows
177
+ if (process.platform !== 'win32') {
178
+ return '';
179
+ }
180
+ try {
181
+ // Query registry for Common Documents path
182
+ const command = 'REG.EXE QUERY "HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders" /V "Common Documents"';
183
+ const output = (0, child_process_1.execSync)(command, { encoding: 'utf-8', windowsHide: true });
184
+ // Parse the output to extract the path
185
+ const match = output.match(/Common Documents\s+REG_SZ\s+(.+)/);
186
+ if (match && match[1]) {
187
+ return match[1].trim();
188
+ }
189
+ }
190
+ catch (error) {
191
+ // Registry access failed, fall back to default
192
+ }
193
+ // Default fallback path
194
+ return 'C:\\Users\\Public\\Documents';
195
+ }
196
+ /**
197
+ * Find all Grid3 user data paths
198
+ * Searches for users and language codes in the Grid3 directory structure
199
+ * C:\Users\Public\Documents\Smartbox\Grid 3\Users\{UserName}\{langCode}\Phrases\history.sqlite
200
+ * @returns Array of Grid3 user path information
201
+ */
202
+ function findGrid3UserPaths() {
203
+ const results = [];
204
+ // Only works on Windows
205
+ if (process.platform !== 'win32') {
206
+ return results;
207
+ }
208
+ try {
209
+ const commonDocs = getCommonDocumentsPath();
210
+ // Use Windows path joining so tests that mock a Windows platform stay consistent even on POSIX runners
211
+ const grid3BasePath = path.win32.join(commonDocs, 'Smartbox', 'Grid 3', 'Users');
212
+ // Check if Grid3 Users directory exists
213
+ if (!fs.existsSync(grid3BasePath)) {
214
+ return results;
215
+ }
216
+ // Enumerate users
217
+ const users = fs.readdirSync(grid3BasePath, { withFileTypes: true });
218
+ for (const userDir of users) {
219
+ if (!userDir.isDirectory())
220
+ continue;
221
+ const userName = userDir.name;
222
+ const userPath = path.win32.join(grid3BasePath, userName);
223
+ // Enumerate language codes
224
+ const langDirs = fs.readdirSync(userPath, { withFileTypes: true });
225
+ for (const langDir of langDirs) {
226
+ if (!langDir.isDirectory())
227
+ continue;
228
+ const langCode = langDir.name;
229
+ const basePath = path.win32.join(userPath, langCode);
230
+ const historyDbPath = path.win32.join(basePath, 'Phrases', 'history.sqlite');
231
+ // Only include if history database exists
232
+ if (fs.existsSync(historyDbPath)) {
233
+ results.push({
234
+ userName,
235
+ langCode,
236
+ basePath,
237
+ historyDbPath,
238
+ });
239
+ }
240
+ }
241
+ }
242
+ }
243
+ catch (error) {
244
+ // Silently fail if directory access fails
245
+ }
246
+ return results;
247
+ }
248
+ /**
249
+ * Find all Grid3 history database paths
250
+ * Convenience method that returns just the database file paths
251
+ * @returns Array of paths to history.sqlite files
252
+ */
253
+ function findGrid3HistoryDatabases() {
254
+ return findGrid3UserPaths().map((userPath) => userPath.historyDbPath);
255
+ }
256
+ /**
257
+ * Get Grid 3 users (alias of findGrid3UserPaths for clarity)
258
+ */
259
+ function findGrid3Users() {
260
+ return findGrid3UserPaths();
261
+ }
262
+ /**
263
+ * Find Grid 3 gridset/vocabulary files for each user
264
+ * @param userName Optional user filter; matches case-insensitively
265
+ * @returns Array of user/gridset path pairs
266
+ */
267
+ function findGrid3Vocabularies(userName) {
268
+ const results = [];
269
+ if (process.platform !== 'win32') {
270
+ return results;
271
+ }
272
+ const commonDocs = getCommonDocumentsPath();
273
+ const grid3BasePath = path.win32.join(commonDocs, 'Smartbox', 'Grid 3', 'Users');
274
+ if (!fs.existsSync(grid3BasePath)) {
275
+ return results;
276
+ }
277
+ const normalizedUser = userName?.toLowerCase();
278
+ const users = fs.readdirSync(grid3BasePath, { withFileTypes: true });
279
+ for (const userDir of users) {
280
+ if (!userDir.isDirectory())
281
+ continue;
282
+ if (normalizedUser && userDir.name.toLowerCase() !== normalizedUser)
283
+ continue;
284
+ const userRoot = path.win32.join(grid3BasePath, userDir.name);
285
+ const gridSetsDir = path.win32.join(userRoot, 'Grid Sets');
286
+ if (!fs.existsSync(gridSetsDir))
287
+ continue;
288
+ const entries = fs.readdirSync(gridSetsDir, { withFileTypes: true });
289
+ for (const entry of entries) {
290
+ if (!entry.isFile())
291
+ continue;
292
+ const ext = path.extname(entry.name).toLowerCase();
293
+ if (ext === '.gridset' || ext === '.grd' || ext === '.grdl') {
294
+ results.push({
295
+ userName: userDir.name,
296
+ gridsetPath: path.win32.join(gridSetsDir, entry.name),
297
+ });
298
+ }
299
+ }
300
+ }
301
+ return results;
302
+ }
303
+ /**
304
+ * Find a specific user's Grid 3 history database
305
+ * @param userName User name to search for (case-insensitive)
306
+ * @param langCode Optional language code filter (case-insensitive)
307
+ * @returns Path to history.sqlite or null if not found
308
+ */
309
+ function findGrid3UserHistory(userName, langCode) {
310
+ const normalizedUser = userName.toLowerCase();
311
+ const normalizedLang = langCode?.toLowerCase();
312
+ const match = findGrid3UserPaths().find((u) => u.userName.toLowerCase() === normalizedUser &&
313
+ (!normalizedLang || u.langCode.toLowerCase() === normalizedLang));
314
+ return match?.historyDbPath ?? null;
315
+ }
316
+ /**
317
+ * Check whether Grid 3 appears to be installed (Windows only)
318
+ */
319
+ function isGrid3Installed() {
320
+ if (process.platform !== 'win32')
321
+ return false;
322
+ const commonDocs = getCommonDocumentsPath();
323
+ if (!commonDocs)
324
+ return false;
325
+ const grid3BasePath = path.win32.join(commonDocs, 'Smartbox', 'Grid 3', 'Users');
326
+ return fs.existsSync(grid3BasePath);
327
+ }
328
+ function parseGrid3ContentXml(xmlContent) {
329
+ const regex = /<r>(?:<!\[CDATA\[)?(.*?)(?:\]\]>)?<\/r>/gis;
330
+ const parts = [];
331
+ let match;
332
+ while ((match = regex.exec(xmlContent)) !== null) {
333
+ parts.push(match[1]);
334
+ }
335
+ if (parts.length > 0) {
336
+ return parts.join('');
337
+ }
338
+ return xmlContent.replace(/<[^>]+>/g, '').trim();
339
+ }
340
+ /**
341
+ * Read history events from a Grid 3 history.sqlite database.
342
+ * @param historyDbPath Absolute path to the history database
343
+ * @returns Parsed history entries grouped by phrase
344
+ */
345
+ function readGrid3History(historyDbPath) {
346
+ if (!fs.existsSync(historyDbPath))
347
+ return [];
348
+ const db = new better_sqlite3_1.default(historyDbPath, { readonly: true });
349
+ const rows = db
350
+ .prepare(`
351
+ SELECT p.Id as PhraseId,
352
+ p.Text as TextValue,
353
+ p.Content as ContentXml,
354
+ ph.Timestamp as TickValue,
355
+ ph.Latitude as Latitude,
356
+ ph.Longitude as Longitude
357
+ FROM PhraseHistory ph
358
+ INNER JOIN Phrases p ON p.Id = ph.PhraseId
359
+ WHERE ph.Timestamp <> 0
360
+ ORDER BY ph.Timestamp ASC
361
+ `)
362
+ .all();
363
+ const events = new Map();
364
+ for (const row of rows) {
365
+ const phraseId = row.PhraseId;
366
+ const contentText = parseGrid3ContentXml(String(row.ContentXml ?? row.TextValue ?? ''));
367
+ const entry = events.get(phraseId) ??
368
+ {
369
+ id: `grid:${phraseId}`,
370
+ content: contentText,
371
+ occurrences: [],
372
+ rawXml: row.ContentXml,
373
+ };
374
+ entry.occurrences.push({
375
+ timestamp: (0, dotnetTicks_1.dotNetTicksToDate)(BigInt(row.TickValue ?? 0)),
376
+ latitude: row.Latitude ?? null,
377
+ longitude: row.Longitude ?? null,
378
+ });
379
+ events.set(phraseId, entry);
380
+ }
381
+ return Array.from(events.values());
382
+ }
383
+ /**
384
+ * Convenience wrapper to load history for a specific Grid 3 user/lang combination.
385
+ * @param userName Grid 3 user name (case-insensitive)
386
+ * @param langCode Optional language code to narrow selection (case-insensitive)
387
+ * @returns History entries for that user/language, or empty array if none
388
+ */
389
+ function readGrid3HistoryForUser(userName, langCode) {
390
+ const dbPath = findGrid3UserHistory(userName, langCode);
391
+ if (!dbPath)
392
+ return [];
393
+ return readGrid3History(dbPath);
394
+ }
395
+ /**
396
+ * Load all available Grid 3 histories on the machine.
397
+ * @returns Combined history entries from every discovered history.sqlite
398
+ */
399
+ function readAllGrid3History() {
400
+ const paths = findGrid3HistoryDatabases();
401
+ return paths.flatMap((p) => readGrid3History(p));
402
+ }
@@ -7,12 +7,12 @@ export { OpmlProcessor } from './opmlProcessor';
7
7
  export { SnapProcessor } from './snapProcessor';
8
8
  export { TouchChatProcessor } from './touchchatProcessor';
9
9
  export { AstericsGridProcessor } from './astericsGridProcessor';
10
- export { getPageTokenImageMap, getAllowedImageEntries, openImage, generateGrid3Guid, createSettingsXml, createFileMapXml, } from './gridset/helpers';
11
- export { getPageTokenImageMap as getGridsetPageTokenImageMap, getAllowedImageEntries as getGridsetAllowedImageEntries, openImage as openGridsetImage, generateGrid3Guid as generateGridsetGuid, createSettingsXml as createGridsetSettingsXml, createFileMapXml as createGridsetFileMapXml, } from './gridset/helpers';
10
+ export { getPageTokenImageMap, getAllowedImageEntries, openImage, generateGrid3Guid, createSettingsXml, createFileMapXml, getCommonDocumentsPath, findGrid3UserPaths, findGrid3HistoryDatabases, findGrid3Users, findGrid3Vocabularies, findGrid3UserHistory, isGrid3Installed, readGrid3History, readGrid3HistoryForUser, readAllGrid3History, type Grid3UserPath, type Grid3VocabularyPath, type Grid3HistoryEntry, } from './gridset/helpers';
11
+ export { getPageTokenImageMap as getGridsetPageTokenImageMap, getAllowedImageEntries as getGridsetAllowedImageEntries, openImage as openGridsetImage, generateGrid3Guid as generateGridsetGuid, createSettingsXml as createGridsetSettingsXml, createFileMapXml as createGridsetFileMapXml, getCommonDocumentsPath as getGridsetCommonDocumentsPath, findGrid3UserPaths as findGridsetUserPaths, findGrid3HistoryDatabases as findGridsetHistoryDatabases, findGrid3Users as findGridsetUsers, findGrid3Vocabularies as findGridsetVocabularies, findGrid3UserHistory as findGridsetUserHistory, isGrid3Installed as isGridsetInstalled, readGrid3History as readGridsetHistory, readGrid3HistoryForUser as readGridsetHistoryForUser, readAllGrid3History as readAllGridsetHistory, } from './gridset/helpers';
12
12
  export { resolveGrid3CellImage } from './gridset/resolver';
13
13
  export { createWordlist, extractWordlists, updateWordlist, wordlistToXml, type WordList, type WordListItem, } from './gridset/wordlistHelpers';
14
14
  export { getNamedColor, rgbaToHex, channelToHex, clampColorChannel, clampAlpha, toHexColor, darkenColor, normalizeColor, ensureAlphaChannel, } from './gridset/colorUtils';
15
15
  export { DEFAULT_GRID3_STYLES, CATEGORY_STYLES, createDefaultStylesXml, createCategoryStyle, } from './gridset/styleHelpers';
16
16
  export { ensureAlphaChannel as ensureAlphaChannelFromStyles } from './gridset/styleHelpers';
17
- export { getPageTokenImageMap as getSnapPageTokenImageMap, getAllowedImageEntries as getSnapAllowedImageEntries, openImage as openSnapImage, } from './snap/helpers';
17
+ export { getPageTokenImageMap as getSnapPageTokenImageMap, getAllowedImageEntries as getSnapAllowedImageEntries, openImage as openSnapImage, findSnapPackages, findSnapPackagePath, findSnapUsers, findSnapUserVocabularies, findSnapUserHistory, isSnapInstalled, readSnapUsage, readSnapUsageForUser, type SnapPackagePath, type SnapUserInfo, type SnapUsageEntry, } from './snap/helpers';
18
18
  export { getPageTokenImageMap as getTouchChatPageTokenImageMap, getAllowedImageEntries as getTouchChatAllowedImageEntries, openImage as openTouchChatImage, } from './touchchat/helpers';
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.openTouchChatImage = exports.getTouchChatAllowedImageEntries = exports.getTouchChatPageTokenImageMap = exports.openSnapImage = exports.getSnapAllowedImageEntries = exports.getSnapPageTokenImageMap = exports.ensureAlphaChannelFromStyles = exports.createCategoryStyle = exports.createDefaultStylesXml = exports.CATEGORY_STYLES = exports.DEFAULT_GRID3_STYLES = exports.ensureAlphaChannel = exports.normalizeColor = exports.darkenColor = exports.toHexColor = exports.clampAlpha = exports.clampColorChannel = exports.channelToHex = exports.rgbaToHex = exports.getNamedColor = exports.wordlistToXml = exports.updateWordlist = exports.extractWordlists = exports.createWordlist = exports.resolveGrid3CellImage = exports.createGridsetFileMapXml = exports.createGridsetSettingsXml = exports.generateGridsetGuid = exports.openGridsetImage = exports.getGridsetAllowedImageEntries = exports.getGridsetPageTokenImageMap = exports.createFileMapXml = exports.createSettingsXml = exports.generateGrid3Guid = exports.openImage = exports.getAllowedImageEntries = exports.getPageTokenImageMap = exports.AstericsGridProcessor = exports.TouchChatProcessor = exports.SnapProcessor = exports.OpmlProcessor = exports.ObfProcessor = exports.GridsetProcessor = exports.ExcelProcessor = exports.DotProcessor = exports.ApplePanelsProcessor = void 0;
3
+ exports.clampColorChannel = exports.channelToHex = exports.rgbaToHex = exports.getNamedColor = exports.wordlistToXml = exports.updateWordlist = exports.extractWordlists = exports.createWordlist = exports.resolveGrid3CellImage = exports.readAllGridsetHistory = exports.readGridsetHistoryForUser = exports.readGridsetHistory = exports.isGridsetInstalled = exports.findGridsetUserHistory = exports.findGridsetVocabularies = exports.findGridsetUsers = exports.findGridsetHistoryDatabases = exports.findGridsetUserPaths = exports.getGridsetCommonDocumentsPath = exports.createGridsetFileMapXml = exports.createGridsetSettingsXml = exports.generateGridsetGuid = exports.openGridsetImage = exports.getGridsetAllowedImageEntries = exports.getGridsetPageTokenImageMap = exports.readAllGrid3History = exports.readGrid3HistoryForUser = exports.readGrid3History = exports.isGrid3Installed = exports.findGrid3UserHistory = exports.findGrid3Vocabularies = exports.findGrid3Users = exports.findGrid3HistoryDatabases = exports.findGrid3UserPaths = exports.getCommonDocumentsPath = exports.createFileMapXml = exports.createSettingsXml = exports.generateGrid3Guid = exports.openImage = exports.getAllowedImageEntries = exports.getPageTokenImageMap = exports.AstericsGridProcessor = exports.TouchChatProcessor = exports.SnapProcessor = exports.OpmlProcessor = exports.ObfProcessor = exports.GridsetProcessor = exports.ExcelProcessor = exports.DotProcessor = exports.ApplePanelsProcessor = void 0;
4
+ exports.openTouchChatImage = exports.getTouchChatAllowedImageEntries = exports.getTouchChatPageTokenImageMap = exports.readSnapUsageForUser = exports.readSnapUsage = exports.isSnapInstalled = exports.findSnapUserHistory = exports.findSnapUserVocabularies = exports.findSnapUsers = exports.findSnapPackagePath = exports.findSnapPackages = exports.openSnapImage = exports.getSnapAllowedImageEntries = exports.getSnapPageTokenImageMap = exports.ensureAlphaChannelFromStyles = exports.createCategoryStyle = exports.createDefaultStylesXml = exports.CATEGORY_STYLES = exports.DEFAULT_GRID3_STYLES = exports.ensureAlphaChannel = exports.normalizeColor = exports.darkenColor = exports.toHexColor = exports.clampAlpha = void 0;
4
5
  var applePanelsProcessor_1 = require("./applePanelsProcessor");
5
6
  Object.defineProperty(exports, "ApplePanelsProcessor", { enumerable: true, get: function () { return applePanelsProcessor_1.ApplePanelsProcessor; } });
6
7
  var dotProcessor_1 = require("./dotProcessor");
@@ -27,6 +28,16 @@ Object.defineProperty(exports, "openImage", { enumerable: true, get: function ()
27
28
  Object.defineProperty(exports, "generateGrid3Guid", { enumerable: true, get: function () { return helpers_1.generateGrid3Guid; } });
28
29
  Object.defineProperty(exports, "createSettingsXml", { enumerable: true, get: function () { return helpers_1.createSettingsXml; } });
29
30
  Object.defineProperty(exports, "createFileMapXml", { enumerable: true, get: function () { return helpers_1.createFileMapXml; } });
31
+ Object.defineProperty(exports, "getCommonDocumentsPath", { enumerable: true, get: function () { return helpers_1.getCommonDocumentsPath; } });
32
+ Object.defineProperty(exports, "findGrid3UserPaths", { enumerable: true, get: function () { return helpers_1.findGrid3UserPaths; } });
33
+ Object.defineProperty(exports, "findGrid3HistoryDatabases", { enumerable: true, get: function () { return helpers_1.findGrid3HistoryDatabases; } });
34
+ Object.defineProperty(exports, "findGrid3Users", { enumerable: true, get: function () { return helpers_1.findGrid3Users; } });
35
+ Object.defineProperty(exports, "findGrid3Vocabularies", { enumerable: true, get: function () { return helpers_1.findGrid3Vocabularies; } });
36
+ Object.defineProperty(exports, "findGrid3UserHistory", { enumerable: true, get: function () { return helpers_1.findGrid3UserHistory; } });
37
+ Object.defineProperty(exports, "isGrid3Installed", { enumerable: true, get: function () { return helpers_1.isGrid3Installed; } });
38
+ Object.defineProperty(exports, "readGrid3History", { enumerable: true, get: function () { return helpers_1.readGrid3History; } });
39
+ Object.defineProperty(exports, "readGrid3HistoryForUser", { enumerable: true, get: function () { return helpers_1.readGrid3HistoryForUser; } });
40
+ Object.defineProperty(exports, "readAllGrid3History", { enumerable: true, get: function () { return helpers_1.readAllGrid3History; } });
30
41
  var helpers_2 = require("./gridset/helpers");
31
42
  Object.defineProperty(exports, "getGridsetPageTokenImageMap", { enumerable: true, get: function () { return helpers_2.getPageTokenImageMap; } });
32
43
  Object.defineProperty(exports, "getGridsetAllowedImageEntries", { enumerable: true, get: function () { return helpers_2.getAllowedImageEntries; } });
@@ -34,6 +45,16 @@ Object.defineProperty(exports, "openGridsetImage", { enumerable: true, get: func
34
45
  Object.defineProperty(exports, "generateGridsetGuid", { enumerable: true, get: function () { return helpers_2.generateGrid3Guid; } });
35
46
  Object.defineProperty(exports, "createGridsetSettingsXml", { enumerable: true, get: function () { return helpers_2.createSettingsXml; } });
36
47
  Object.defineProperty(exports, "createGridsetFileMapXml", { enumerable: true, get: function () { return helpers_2.createFileMapXml; } });
48
+ Object.defineProperty(exports, "getGridsetCommonDocumentsPath", { enumerable: true, get: function () { return helpers_2.getCommonDocumentsPath; } });
49
+ Object.defineProperty(exports, "findGridsetUserPaths", { enumerable: true, get: function () { return helpers_2.findGrid3UserPaths; } });
50
+ Object.defineProperty(exports, "findGridsetHistoryDatabases", { enumerable: true, get: function () { return helpers_2.findGrid3HistoryDatabases; } });
51
+ Object.defineProperty(exports, "findGridsetUsers", { enumerable: true, get: function () { return helpers_2.findGrid3Users; } });
52
+ Object.defineProperty(exports, "findGridsetVocabularies", { enumerable: true, get: function () { return helpers_2.findGrid3Vocabularies; } });
53
+ Object.defineProperty(exports, "findGridsetUserHistory", { enumerable: true, get: function () { return helpers_2.findGrid3UserHistory; } });
54
+ Object.defineProperty(exports, "isGridsetInstalled", { enumerable: true, get: function () { return helpers_2.isGrid3Installed; } });
55
+ Object.defineProperty(exports, "readGridsetHistory", { enumerable: true, get: function () { return helpers_2.readGrid3History; } });
56
+ Object.defineProperty(exports, "readGridsetHistoryForUser", { enumerable: true, get: function () { return helpers_2.readGrid3HistoryForUser; } });
57
+ Object.defineProperty(exports, "readAllGridsetHistory", { enumerable: true, get: function () { return helpers_2.readAllGrid3History; } });
37
58
  var resolver_1 = require("./gridset/resolver");
38
59
  Object.defineProperty(exports, "resolveGrid3CellImage", { enumerable: true, get: function () { return resolver_1.resolveGrid3CellImage; } });
39
60
  // Gridset (Grid 3) wordlist helpers
@@ -62,11 +83,19 @@ Object.defineProperty(exports, "createCategoryStyle", { enumerable: true, get: f
62
83
  // Re-export ensureAlphaChannel from styleHelpers for backward compatibility
63
84
  var styleHelpers_2 = require("./gridset/styleHelpers");
64
85
  Object.defineProperty(exports, "ensureAlphaChannelFromStyles", { enumerable: true, get: function () { return styleHelpers_2.ensureAlphaChannel; } });
65
- // Snap helpers (stubs)
86
+ // Snap helpers
66
87
  var helpers_3 = require("./snap/helpers");
67
88
  Object.defineProperty(exports, "getSnapPageTokenImageMap", { enumerable: true, get: function () { return helpers_3.getPageTokenImageMap; } });
68
89
  Object.defineProperty(exports, "getSnapAllowedImageEntries", { enumerable: true, get: function () { return helpers_3.getAllowedImageEntries; } });
69
90
  Object.defineProperty(exports, "openSnapImage", { enumerable: true, get: function () { return helpers_3.openImage; } });
91
+ Object.defineProperty(exports, "findSnapPackages", { enumerable: true, get: function () { return helpers_3.findSnapPackages; } });
92
+ Object.defineProperty(exports, "findSnapPackagePath", { enumerable: true, get: function () { return helpers_3.findSnapPackagePath; } });
93
+ Object.defineProperty(exports, "findSnapUsers", { enumerable: true, get: function () { return helpers_3.findSnapUsers; } });
94
+ Object.defineProperty(exports, "findSnapUserVocabularies", { enumerable: true, get: function () { return helpers_3.findSnapUserVocabularies; } });
95
+ Object.defineProperty(exports, "findSnapUserHistory", { enumerable: true, get: function () { return helpers_3.findSnapUserHistory; } });
96
+ Object.defineProperty(exports, "isSnapInstalled", { enumerable: true, get: function () { return helpers_3.isSnapInstalled; } });
97
+ Object.defineProperty(exports, "readSnapUsage", { enumerable: true, get: function () { return helpers_3.readSnapUsage; } });
98
+ Object.defineProperty(exports, "readSnapUsageForUser", { enumerable: true, get: function () { return helpers_3.readSnapUsageForUser; } });
70
99
  // TouchChat helpers (stubs)
71
100
  var helpers_4 = require("./touchchat/helpers");
72
101
  Object.defineProperty(exports, "getTouchChatPageTokenImageMap", { enumerable: true, get: function () { return helpers_4.getPageTokenImageMap; } });
@@ -235,7 +235,12 @@ class ObfProcessor extends baseProcessor_1.BaseProcessor {
235
235
  buttonPositions.set(id, index);
236
236
  return id;
237
237
  });
238
- return { rows: 1, columns: fallbackRow.length, order: [fallbackRow], buttonPositions };
238
+ return {
239
+ rows: 1,
240
+ columns: fallbackRow.length,
241
+ order: [fallbackRow],
242
+ buttonPositions,
243
+ };
239
244
  }
240
245
  const order = [];
241
246
  for (let rowIndex = 0; rowIndex < totalRows; rowIndex++) {
@@ -1,4 +1,89 @@
1
1
  import { AACTree } from '../../core/treeStructure';
2
+ /**
3
+ * Build a map of button IDs to resolved image entries for a specific page.
4
+ * Mirrors the Grid helper for consumers that expect image reference data.
5
+ */
2
6
  export declare function getPageTokenImageMap(tree: AACTree, pageId: string): Map<string, string>;
7
+ /**
8
+ * Collect all image entry paths referenced in a Snap tree.
9
+ * Currently empty until resolvedImageEntry is populated by the processor.
10
+ */
3
11
  export declare function getAllowedImageEntries(_tree: AACTree): Set<string>;
12
+ /**
13
+ * Read a binary asset from a Snap pageset.
14
+ * Not implemented yet; provided for API symmetry with other processors.
15
+ */
4
16
  export declare function openImage(_dbOrFile: string | Buffer, _entryPath: string): Buffer | null;
17
+ /**
18
+ * Snap package path information
19
+ */
20
+ export interface SnapPackagePath {
21
+ packageName: string;
22
+ packagePath: string;
23
+ }
24
+ export interface SnapUserInfo {
25
+ userId: string;
26
+ userPath: string;
27
+ vocabPaths: string[];
28
+ }
29
+ export interface SnapUsageEntry {
30
+ id: string;
31
+ content: string;
32
+ occurrences: Array<{
33
+ timestamp: Date;
34
+ modeling?: boolean;
35
+ accessMethod?: number | null;
36
+ }>;
37
+ platform?: {
38
+ label?: string;
39
+ message?: string;
40
+ buttonId?: string;
41
+ };
42
+ }
43
+ /**
44
+ * Find Tobii Communicator Snap package paths
45
+ * Searches in %LOCALAPPDATA%\Packages for Snap-related packages
46
+ * @param packageNamePattern Optional pattern to filter package names (default: 'TobiiDynavox')
47
+ * @returns Array of Snap package path information
48
+ */
49
+ export declare function findSnapPackages(packageNamePattern?: string): SnapPackagePath[];
50
+ /**
51
+ * Find the first Snap package path matching the pattern
52
+ * Convenience method for when you expect only one Snap installation
53
+ * @param packageNamePattern Optional pattern to filter package names (default: 'TobiiDynavox')
54
+ * @returns Path to the first matching Snap package, or null if not found
55
+ */
56
+ export declare function findSnapPackagePath(packageNamePattern?: string): string | null;
57
+ /**
58
+ * Find Snap user directories and their vocab files (.sps/.spb)
59
+ * @param packageNamePattern Optional package filter (default TobiiDynavox)
60
+ * @returns Array of user info with vocab paths
61
+ */
62
+ export declare function findSnapUsers(packageNamePattern?: string): SnapUserInfo[];
63
+ /**
64
+ * Find vocab files for a specific Snap user (or all users)
65
+ * @param userId Optional user identifier filter (case-sensitive directory name)
66
+ * @param packageNamePattern Optional package filter
67
+ * @returns Array of vocab file paths
68
+ */
69
+ export declare function findSnapUserVocabularies(userId?: string, packageNamePattern?: string): string[];
70
+ /**
71
+ * Attempt to find history/analytics files for a Snap user by name
72
+ * Currently searches for files containing "history" under the user directory
73
+ * @param userId User identifier (directory name)
74
+ * @param packageNamePattern Optional package filter
75
+ * @returns Array of history file paths (may be empty if not found)
76
+ */
77
+ export declare function findSnapUserHistory(userId: string, packageNamePattern?: string): string[];
78
+ /**
79
+ * Check whether TD Snap appears to be installed (Windows only)
80
+ */
81
+ export declare function isSnapInstalled(packageNamePattern?: string): boolean;
82
+ /**
83
+ * Read Snap usage history from a pageset file (.sps/.spb)
84
+ */
85
+ export declare function readSnapUsage(pagesetPath: string): SnapUsageEntry[];
86
+ /**
87
+ * Read Snap usage history for a user (all pagesets)
88
+ */
89
+ export declare function readSnapUsageForUser(userId?: string, packageNamePattern?: string): SnapUsageEntry[];