@willwade/aac-processors 0.0.7 → 0.0.9

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,253 @@ 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
+ * Grid set/vocabulary archives live alongside users at:
201
+ * C:\Users\Public\Documents\Smartbox\Grid 3\Users\{UserName}\Grid Sets\
202
+ * @returns Array of Grid3 user path information
203
+ */
204
+ function findGrid3UserPaths() {
205
+ const results = [];
206
+ // Only works on Windows
207
+ if (process.platform !== 'win32') {
208
+ return results;
209
+ }
210
+ try {
211
+ const commonDocs = getCommonDocumentsPath();
212
+ // Use Windows path joining so tests that mock a Windows platform stay consistent even on POSIX runners
213
+ const grid3BasePath = path.win32.join(commonDocs, 'Smartbox', 'Grid 3', 'Users');
214
+ // Check if Grid3 Users directory exists
215
+ if (!fs.existsSync(grid3BasePath)) {
216
+ return results;
217
+ }
218
+ // Enumerate users
219
+ const users = fs.readdirSync(grid3BasePath, { withFileTypes: true });
220
+ for (const userDir of users) {
221
+ if (!userDir.isDirectory())
222
+ continue;
223
+ const userName = userDir.name;
224
+ const userPath = path.win32.join(grid3BasePath, userName);
225
+ // Enumerate language codes
226
+ const langDirs = fs.readdirSync(userPath, { withFileTypes: true });
227
+ for (const langDir of langDirs) {
228
+ if (!langDir.isDirectory())
229
+ continue;
230
+ const langCode = langDir.name;
231
+ const basePath = path.win32.join(userPath, langCode);
232
+ const historyDbPath = path.win32.join(basePath, 'Phrases', 'history.sqlite');
233
+ // Only include if history database exists
234
+ if (fs.existsSync(historyDbPath)) {
235
+ results.push({
236
+ userName,
237
+ langCode,
238
+ basePath,
239
+ historyDbPath,
240
+ });
241
+ }
242
+ }
243
+ }
244
+ }
245
+ catch (error) {
246
+ // Silently fail if directory access fails
247
+ }
248
+ return results;
249
+ }
250
+ /**
251
+ * Find all Grid3 history database paths
252
+ * Convenience method that returns just the database file paths
253
+ * @returns Array of paths to history.sqlite files
254
+ */
255
+ function findGrid3HistoryDatabases() {
256
+ return findGrid3UserPaths().map((userPath) => userPath.historyDbPath);
257
+ }
258
+ /**
259
+ * Get Grid 3 users (alias of findGrid3UserPaths for clarity)
260
+ */
261
+ function findGrid3Users() {
262
+ return findGrid3UserPaths();
263
+ }
264
+ /**
265
+ * Find Grid 3 gridset/vocabulary files for each user
266
+ * @param userName Optional user filter; matches case-insensitively
267
+ * @returns Array of user/gridset path pairs
268
+ */
269
+ function findGrid3Vocabularies(userName) {
270
+ const results = [];
271
+ if (process.platform !== 'win32') {
272
+ return results;
273
+ }
274
+ const commonDocs = getCommonDocumentsPath();
275
+ const grid3BasePath = path.win32.join(commonDocs, 'Smartbox', 'Grid 3', 'Users');
276
+ if (!fs.existsSync(grid3BasePath)) {
277
+ return results;
278
+ }
279
+ const normalizedUser = userName?.toLowerCase();
280
+ const users = fs.readdirSync(grid3BasePath, { withFileTypes: true });
281
+ for (const userDir of users) {
282
+ if (!userDir.isDirectory())
283
+ continue;
284
+ if (normalizedUser && userDir.name.toLowerCase() !== normalizedUser)
285
+ continue;
286
+ const userRoot = path.win32.join(grid3BasePath, userDir.name);
287
+ const gridSetsDir = path.win32.join(userRoot, 'Grid Sets');
288
+ if (!fs.existsSync(gridSetsDir))
289
+ continue;
290
+ const entries = fs.readdirSync(gridSetsDir, { withFileTypes: true });
291
+ for (const entry of entries) {
292
+ if (!entry.isFile())
293
+ continue;
294
+ const ext = path.extname(entry.name).toLowerCase();
295
+ if (ext === '.gridset' || ext === '.grd' || ext === '.grdl') {
296
+ results.push({
297
+ userName: userDir.name,
298
+ gridsetPath: path.win32.join(gridSetsDir, entry.name),
299
+ });
300
+ }
301
+ }
302
+ }
303
+ return results;
304
+ }
305
+ /**
306
+ * Find a specific user's Grid 3 history database
307
+ * @param userName User name to search for (case-insensitive)
308
+ * @param langCode Optional language code filter (case-insensitive)
309
+ * @returns Path to history.sqlite or null if not found
310
+ */
311
+ function findGrid3UserHistory(userName, langCode) {
312
+ if (!userName)
313
+ return null;
314
+ const normalizedUser = userName.toLowerCase();
315
+ const normalizedLang = langCode?.toLowerCase();
316
+ const match = findGrid3UserPaths().find((u) => u.userName.toLowerCase() === normalizedUser &&
317
+ (!normalizedLang || u.langCode.toLowerCase() === normalizedLang));
318
+ return match?.historyDbPath ?? null;
319
+ }
320
+ /**
321
+ * Check whether Grid 3 appears to be installed (Windows only)
322
+ */
323
+ function isGrid3Installed() {
324
+ if (process.platform !== 'win32')
325
+ return false;
326
+ const commonDocs = getCommonDocumentsPath();
327
+ if (!commonDocs)
328
+ return false;
329
+ const grid3BasePath = path.win32.join(commonDocs, 'Smartbox', 'Grid 3', 'Users');
330
+ return fs.existsSync(grid3BasePath);
331
+ }
332
+ function parseGrid3ContentXml(xmlContent) {
333
+ const regex = /<r>(?:<!\[CDATA\[)?(.*?)(?:\]\]>)?<\/r>/gis;
334
+ const parts = [];
335
+ let match;
336
+ while ((match = regex.exec(xmlContent)) !== null) {
337
+ parts.push(match[1]);
338
+ }
339
+ if (parts.length > 0) {
340
+ return parts.join('');
341
+ }
342
+ return xmlContent.replace(/<[^>]+>/g, '').trim();
343
+ }
344
+ /**
345
+ * Read history events from a Grid 3 history.sqlite database.
346
+ * @param historyDbPath Absolute path to the history database
347
+ * @returns Parsed history entries grouped by phrase
348
+ */
349
+ function readGrid3History(historyDbPath) {
350
+ if (!fs.existsSync(historyDbPath))
351
+ return [];
352
+ const db = new better_sqlite3_1.default(historyDbPath, { readonly: true });
353
+ const rows = db
354
+ .prepare(`
355
+ SELECT p.Id as PhraseId,
356
+ p.Text as TextValue,
357
+ p.Content as ContentXml,
358
+ ph.Timestamp as TickValue,
359
+ ph.Latitude as Latitude,
360
+ ph.Longitude as Longitude
361
+ FROM PhraseHistory ph
362
+ INNER JOIN Phrases p ON p.Id = ph.PhraseId
363
+ WHERE ph.Timestamp <> 0
364
+ ORDER BY ph.Timestamp ASC
365
+ `)
366
+ .all();
367
+ const events = new Map();
368
+ for (const row of rows) {
369
+ const phraseId = row.PhraseId;
370
+ const rawContentSource = [row.ContentXml, row.TextValue].find((candidate) => {
371
+ if (candidate === null || candidate === undefined)
372
+ return false;
373
+ const asString = String(candidate);
374
+ return asString.trim().length > 0;
375
+ });
376
+ if (rawContentSource === undefined) {
377
+ continue; // Skip history rows with no usable text content
378
+ }
379
+ const rawContentText = String(rawContentSource);
380
+ const contentText = parseGrid3ContentXml(rawContentText);
381
+ const rawXml = typeof row.ContentXml === 'string' && row.ContentXml.trim().length > 0
382
+ ? row.ContentXml
383
+ : undefined;
384
+ const entry = events.get(phraseId) ??
385
+ {
386
+ id: `grid:${phraseId}`,
387
+ content: contentText,
388
+ occurrences: [],
389
+ rawXml,
390
+ };
391
+ entry.occurrences.push({
392
+ timestamp: (0, dotnetTicks_1.dotNetTicksToDate)(BigInt(row.TickValue ?? 0)),
393
+ latitude: row.Latitude ?? null,
394
+ longitude: row.Longitude ?? null,
395
+ });
396
+ events.set(phraseId, entry);
397
+ }
398
+ return Array.from(events.values());
399
+ }
400
+ /**
401
+ * Convenience wrapper to load history for a specific Grid 3 user/lang combination.
402
+ * @param userName Grid 3 user name (case-insensitive)
403
+ * @param langCode Optional language code to narrow selection (case-insensitive)
404
+ * @returns History entries for that user/language, or empty array if none
405
+ */
406
+ function readGrid3HistoryForUser(userName, langCode) {
407
+ const dbPath = findGrid3UserHistory(userName, langCode);
408
+ if (!dbPath)
409
+ return [];
410
+ return readGrid3History(dbPath);
411
+ }
412
+ /**
413
+ * Load all available Grid 3 histories on the machine.
414
+ * @returns Combined history entries from every discovered history.sqlite
415
+ */
416
+ function readAllGrid3History() {
417
+ const paths = findGrid3HistoryDatabases();
418
+ return paths.flatMap((p) => readGrid3History(p));
419
+ }
@@ -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,91 @@
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
+ * Typical path:
60
+ * C:\Users\{username}\AppData\Roaming\Tobii Dynavox\Snap Scene\Users\{userId}\
61
+ * @param packageNamePattern Optional package filter (default TobiiDynavox)
62
+ * @returns Array of user info with vocab paths
63
+ */
64
+ export declare function findSnapUsers(packageNamePattern?: string): SnapUserInfo[];
65
+ /**
66
+ * Find vocab files for a specific Snap user (or all users)
67
+ * @param userId Optional user identifier filter (case-sensitive directory name)
68
+ * @param packageNamePattern Optional package filter
69
+ * @returns Array of vocab file paths
70
+ */
71
+ export declare function findSnapUserVocabularies(userId?: string, packageNamePattern?: string): string[];
72
+ /**
73
+ * Attempt to find history/analytics files for a Snap user by name
74
+ * Currently searches for files containing "history" under the user directory
75
+ * @param userId User identifier (directory name)
76
+ * @param packageNamePattern Optional package filter
77
+ * @returns Array of history file paths (may be empty if not found)
78
+ */
79
+ export declare function findSnapUserHistory(userId: string, packageNamePattern?: string): string[];
80
+ /**
81
+ * Check whether TD Snap appears to be installed (Windows only)
82
+ */
83
+ export declare function isSnapInstalled(packageNamePattern?: string): boolean;
84
+ /**
85
+ * Read Snap usage history from a pageset file (.sps/.spb)
86
+ */
87
+ export declare function readSnapUsage(pagesetPath: string): SnapUsageEntry[];
88
+ /**
89
+ * Read Snap usage history for a user (all pagesets)
90
+ */
91
+ export declare function readSnapUsageForUser(userId?: string, packageNamePattern?: string): SnapUsageEntry[];