@willwade/aac-processors 0.0.9 → 0.0.11

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 (75) hide show
  1. package/README.md +85 -11
  2. package/dist/cli/index.js +87 -0
  3. package/dist/core/analyze.js +1 -0
  4. package/dist/core/baseProcessor.d.ts +6 -0
  5. package/dist/core/fileProcessor.js +1 -0
  6. package/dist/core/treeStructure.d.ts +3 -1
  7. package/dist/core/treeStructure.js +3 -1
  8. package/dist/index.d.ts +1 -0
  9. package/dist/index.js +3 -0
  10. package/dist/optional/symbolTools.js +4 -2
  11. package/dist/processors/gridset/colorUtils.d.ts +18 -0
  12. package/dist/processors/gridset/colorUtils.js +36 -0
  13. package/dist/processors/gridset/commands.d.ts +103 -0
  14. package/dist/processors/gridset/commands.js +958 -0
  15. package/dist/processors/gridset/helpers.d.ts +1 -1
  16. package/dist/processors/gridset/helpers.js +5 -3
  17. package/dist/processors/gridset/index.d.ts +45 -0
  18. package/dist/processors/gridset/index.js +153 -0
  19. package/dist/processors/gridset/password.d.ts +11 -0
  20. package/dist/processors/gridset/password.js +37 -0
  21. package/dist/processors/gridset/pluginTypes.d.ts +109 -0
  22. package/dist/processors/gridset/pluginTypes.js +285 -0
  23. package/dist/processors/gridset/resolver.d.ts +14 -1
  24. package/dist/processors/gridset/resolver.js +47 -5
  25. package/dist/processors/gridset/styleHelpers.d.ts +22 -0
  26. package/dist/processors/gridset/styleHelpers.js +35 -1
  27. package/dist/processors/gridset/symbolExtractor.d.ts +121 -0
  28. package/dist/processors/gridset/symbolExtractor.js +362 -0
  29. package/dist/processors/gridset/symbolSearch.d.ts +117 -0
  30. package/dist/processors/gridset/symbolSearch.js +280 -0
  31. package/dist/processors/gridset/symbols.d.ts +199 -0
  32. package/dist/processors/gridset/symbols.js +468 -0
  33. package/dist/processors/gridset/wordlistHelpers.d.ts +2 -2
  34. package/dist/processors/gridset/wordlistHelpers.js +7 -4
  35. package/dist/processors/gridsetProcessor.d.ts +15 -1
  36. package/dist/processors/gridsetProcessor.js +98 -22
  37. package/dist/processors/index.d.ts +10 -1
  38. package/dist/processors/index.js +94 -2
  39. package/dist/processors/obfProcessor.d.ts +7 -0
  40. package/dist/processors/obfProcessor.js +9 -0
  41. package/dist/processors/snapProcessor.d.ts +7 -0
  42. package/dist/processors/snapProcessor.js +9 -0
  43. package/dist/processors/touchchatProcessor.d.ts +7 -0
  44. package/dist/processors/touchchatProcessor.js +9 -0
  45. package/dist/types/aac.d.ts +17 -0
  46. package/dist/utilities/screenshotConverter.d.ts +69 -0
  47. package/dist/utilities/screenshotConverter.js +453 -0
  48. package/dist/validation/baseValidator.d.ts +80 -0
  49. package/dist/validation/baseValidator.js +160 -0
  50. package/dist/validation/gridsetValidator.d.ts +36 -0
  51. package/dist/validation/gridsetValidator.js +288 -0
  52. package/dist/validation/index.d.ts +13 -0
  53. package/dist/validation/index.js +69 -0
  54. package/dist/validation/obfValidator.d.ts +44 -0
  55. package/dist/validation/obfValidator.js +530 -0
  56. package/dist/validation/snapValidator.d.ts +33 -0
  57. package/dist/validation/snapValidator.js +237 -0
  58. package/dist/validation/touchChatValidator.d.ts +33 -0
  59. package/dist/validation/touchChatValidator.js +229 -0
  60. package/dist/validation/validationTypes.d.ts +64 -0
  61. package/dist/validation/validationTypes.js +15 -0
  62. package/examples/README.md +7 -0
  63. package/examples/demo.js +143 -0
  64. package/examples/obf/aboutme.json +376 -0
  65. package/examples/obf/array.json +6 -0
  66. package/examples/obf/hash.json +4 -0
  67. package/examples/obf/links.obz +0 -0
  68. package/examples/obf/simple.obf +53 -0
  69. package/examples/package-lock.json +1326 -0
  70. package/examples/package.json +10 -0
  71. package/examples/styling-example.ts +316 -0
  72. package/examples/translate.js +39 -0
  73. package/examples/translate_demo.js +254 -0
  74. package/examples/typescript-demo.ts +251 -0
  75. package/package.json +3 -1
@@ -10,10 +10,47 @@ const adm_zip_1 = __importDefault(require("adm-zip"));
10
10
  const fs_1 = __importDefault(require("fs"));
11
11
  const fast_xml_parser_1 = require("fast-xml-parser");
12
12
  const resolver_1 = require("./gridset/resolver");
13
+ const password_1 = require("./gridset/password");
14
+ const crypto_1 = __importDefault(require("crypto"));
15
+ const zlib_1 = __importDefault(require("zlib"));
16
+ const gridsetValidator_1 = require("../validation/gridsetValidator");
17
+ // New imports for enhanced Grid 3 support
18
+ const pluginTypes_1 = require("./gridset/pluginTypes");
19
+ const commands_1 = require("./gridset/commands");
20
+ const symbols_1 = require("./gridset/symbols");
21
+ const resolver_2 = require("./gridset/resolver");
13
22
  class GridsetProcessor extends baseProcessor_1.BaseProcessor {
14
23
  constructor(options) {
15
24
  super(options);
16
25
  }
26
+ /**
27
+ * Decrypt and inflate a Grid3 encrypted payload (DesktopContentEncrypter).
28
+ * Uses AES-256-CBC with key/IV derived from the password padded with spaces
29
+ * and then Deflate decompression.
30
+ */
31
+ decryptGridsetEntry(buffer, password) {
32
+ const pwd = (password || 'Chocolate').padEnd(32, ' ');
33
+ const key = Buffer.from(pwd.slice(0, 32), 'utf8');
34
+ const iv = Buffer.from(pwd.slice(0, 16), 'utf8');
35
+ try {
36
+ const decipher = crypto_1.default.createDecipheriv('aes-256-cbc', key, iv);
37
+ const decrypted = Buffer.concat([decipher.update(buffer), decipher.final()]);
38
+ try {
39
+ return zlib_1.default.inflateSync(decrypted);
40
+ }
41
+ catch {
42
+ // If data isn't deflated, return raw decrypted bytes
43
+ return decrypted;
44
+ }
45
+ }
46
+ catch {
47
+ return buffer;
48
+ }
49
+ }
50
+ // Determine password to use when opening encrypted gridset archives (.gridsetx)
51
+ getGridsetPassword(source) {
52
+ return (0, password_1.resolveGridsetPassword)(this.options, source);
53
+ }
17
54
  // Helper function to ensure color has alpha channel (Grid3 format)
18
55
  ensureAlphaChannel(color) {
19
56
  if (!color)
@@ -222,6 +259,9 @@ class GridsetProcessor extends baseProcessor_1.BaseProcessor {
222
259
  fontColor: grid3Style.FontColour,
223
260
  fontFamily: grid3Style.FontName,
224
261
  fontSize: grid3Style.FontSize ? parseInt(String(grid3Style.FontSize)) : undefined,
262
+ backgroundShape: grid3Style.BackgroundShape !== undefined
263
+ ? parseInt(String(grid3Style.BackgroundShape))
264
+ : undefined,
225
265
  };
226
266
  }
227
267
  // Helper function to get style by ID or return default
@@ -242,10 +282,7 @@ class GridsetProcessor extends baseProcessor_1.BaseProcessor {
242
282
  return undefined;
243
283
  }
244
284
  extractTexts(filePathOrBuffer) {
245
- const buffer = Buffer.isBuffer(filePathOrBuffer)
246
- ? filePathOrBuffer
247
- : fs_1.default.readFileSync(filePathOrBuffer);
248
- const tree = this.loadIntoTree(buffer);
285
+ const tree = this.loadIntoTree(filePathOrBuffer);
249
286
  const texts = [];
250
287
  for (const pageId in tree.pages) {
251
288
  const page = tree.pages[pageId];
@@ -269,13 +306,23 @@ class GridsetProcessor extends baseProcessor_1.BaseProcessor {
269
306
  catch (error) {
270
307
  throw new Error(`Invalid ZIP file format: ${error.message}`);
271
308
  }
309
+ const password = this.getGridsetPassword(filePathOrBuffer);
310
+ const entries = (0, password_1.getZipEntriesWithPassword)(zip, password);
272
311
  const parser = new fast_xml_parser_1.XMLParser({ ignoreAttributes: false });
312
+ const isEncryptedArchive = typeof filePathOrBuffer === 'string' && filePathOrBuffer.toLowerCase().endsWith('.gridsetx');
313
+ const encryptedContentPassword = this.getGridsetPassword(filePathOrBuffer);
314
+ const readEntryBuffer = (entry) => {
315
+ const raw = entry.getData();
316
+ if (!isEncryptedArchive)
317
+ return raw;
318
+ return this.decryptGridsetEntry(raw, encryptedContentPassword);
319
+ };
273
320
  // Parse FileMap.xml if present to index dynamic files per grid
274
321
  const fileMapIndex = new Map();
275
322
  try {
276
- const fmEntry = zip.getEntries().find((e) => e.entryName.endsWith('FileMap.xml'));
323
+ const fmEntry = entries.find((e) => e.entryName.endsWith('FileMap.xml'));
277
324
  if (fmEntry) {
278
- const fmXml = fmEntry.getData().toString('utf8');
325
+ const fmXml = readEntryBuffer(fmEntry).toString('utf8');
279
326
  const fmData = parser.parse(fmXml);
280
327
  const entries = fmData?.FileMap?.Entries?.Entry || fmData?.fileMap?.entries?.entry;
281
328
  if (entries) {
@@ -307,12 +354,10 @@ class GridsetProcessor extends baseProcessor_1.BaseProcessor {
307
354
  }
308
355
  // First, load styles from Settings0/Styles/styles.xml (Grid3 format)
309
356
  const styles = new Map();
310
- const styleEntry = zip
311
- .getEntries()
312
- .find((entry) => entry.entryName.endsWith('styles.xml') || entry.entryName.endsWith('style.xml'));
357
+ const styleEntry = entries.find((entry) => entry.entryName.endsWith('styles.xml') || entry.entryName.endsWith('style.xml'));
313
358
  if (styleEntry) {
314
359
  try {
315
- const styleXmlContent = styleEntry.getData().toString('utf8');
360
+ const styleXmlContent = readEntryBuffer(styleEntry).toString('utf8');
316
361
  const styleData = parser.parse(styleXmlContent);
317
362
  // Parse styles and store them in the map
318
363
  // Grid3 uses StyleData.Styles.Style with Key attribute
@@ -343,14 +388,14 @@ class GridsetProcessor extends baseProcessor_1.BaseProcessor {
343
388
  }
344
389
  }
345
390
  // Debug: log all entry names
346
- // console.log('Gridset zip entries:', zip.getEntries().map(e => e.entryName));
391
+ // console.log('Gridset zip entries:', entries.map(e => e.entryName));
347
392
  // First pass: collect all grid names and IDs for navigation resolution
348
393
  const gridNameToIdMap = new Map();
349
394
  const gridIdToNameMap = new Map();
350
- zip.getEntries().forEach((entry) => {
395
+ entries.forEach((entry) => {
351
396
  if (entry.entryName.startsWith('Grids/') && entry.entryName.endsWith('grid.xml')) {
352
397
  try {
353
- const xmlContent = entry.getData().toString('utf8');
398
+ const xmlContent = readEntryBuffer(entry).toString('utf8');
354
399
  const data = parser.parse(xmlContent);
355
400
  const grid = data.Grid || data.grid;
356
401
  if (!grid)
@@ -373,12 +418,12 @@ class GridsetProcessor extends baseProcessor_1.BaseProcessor {
373
418
  }
374
419
  });
375
420
  // Second pass: process each grid file in the gridset
376
- zip.getEntries().forEach((entry) => {
421
+ entries.forEach((entry) => {
377
422
  // Only process files named grid.xml under Grids/ (any subdir)
378
423
  if (entry.entryName.startsWith('Grids/') && entry.entryName.endsWith('grid.xml')) {
379
424
  let xmlContent;
380
425
  try {
381
- xmlContent = entry.getData().toString('utf8');
426
+ xmlContent = readEntryBuffer(entry).toString('utf8');
382
427
  }
383
428
  catch (e) {
384
429
  // Skip unreadable files
@@ -459,11 +504,14 @@ class GridsetProcessor extends baseProcessor_1.BaseProcessor {
459
504
  }
460
505
  }
461
506
  const message = label; // Use caption as message
507
+ // Detect plugin cell type (Workspace, LiveCell, AutoContent)
508
+ const pluginMetadata = (0, pluginTypes_1.detectPluginCellType)(content);
462
509
  // Parse all command types from Grid3 and create semantic actions
463
510
  let semanticAction;
464
511
  let legacyAction = null;
465
512
  // infer action type implicitly from commands; no explicit enum needed
466
513
  let navigationTarget;
514
+ let detectedCommands = []; // Store detected command metadata
467
515
  const commands = content.Commands?.Command || content.commands?.command;
468
516
  // Resolve image for this cell using FileMap and coordinate heuristics
469
517
  const imageCandidate = captionAndImage?.Image ||
@@ -482,9 +530,15 @@ class GridsetProcessor extends baseProcessor_1.BaseProcessor {
482
530
  x: cellX + 1,
483
531
  y: cellY + 1,
484
532
  dynamicFiles,
485
- }) || undefined;
533
+ }, entries) || undefined;
534
+ // Check if image is a symbol library reference
535
+ let symbolLibraryRef = null;
536
+ if (declaredImageName && (0, resolver_2.isSymbolLibraryReference)(declaredImageName)) {
537
+ symbolLibraryRef = (0, symbols_1.parseSymbolReference)(declaredImageName);
538
+ }
486
539
  if (commands) {
487
540
  const commandArr = Array.isArray(commands) ? commands : [commands];
541
+ detectedCommands = commandArr.map((cmd) => (0, commands_1.detectCommand)(cmd));
488
542
  for (const command of commandArr) {
489
543
  const commandId = command['@_ID'] || command.ID || command.id;
490
544
  const parameters = command.Parameter || command.parameter;
@@ -874,10 +928,27 @@ class GridsetProcessor extends baseProcessor_1.BaseProcessor {
874
928
  y: cellY,
875
929
  columnSpan: colSpan,
876
930
  rowSpan: rowSpan,
931
+ contentType: pluginMetadata.cellType === pluginTypes_1.Grid3CellType.Regular
932
+ ? 'Normal'
933
+ : pluginMetadata.cellType === pluginTypes_1.Grid3CellType.Workspace
934
+ ? 'Workspace'
935
+ : pluginMetadata.cellType === pluginTypes_1.Grid3CellType.LiveCell
936
+ ? 'LiveCell'
937
+ : 'AutoContent',
938
+ contentSubType: pluginMetadata.subType ||
939
+ pluginMetadata.liveCellType ||
940
+ pluginMetadata.autoContentType,
941
+ symbolLibrary: symbolLibraryRef?.library || undefined,
942
+ symbolPath: symbolLibraryRef?.path || undefined,
877
943
  style: {
878
944
  ...cellStyle,
879
945
  ...inlineStyle, // Inline styles override referenced styles
880
946
  },
947
+ parameters: {
948
+ pluginMetadata: pluginMetadata, // Store full plugin metadata for future use
949
+ grid3Commands: detectedCommands, // Store detected command metadata
950
+ symbolLibraryRef: symbolLibraryRef, // Store full symbol reference
951
+ },
881
952
  });
882
953
  // Add button to page
883
954
  page.addButton(button);
@@ -910,9 +981,9 @@ class GridsetProcessor extends baseProcessor_1.BaseProcessor {
910
981
  }
911
982
  // Read settings.xml to get the StartGrid (home page)
912
983
  try {
913
- const settingsEntry = zip.getEntries().find((e) => e.entryName.endsWith('settings.xml'));
984
+ const settingsEntry = entries.find((e) => e.entryName.endsWith('settings.xml'));
914
985
  if (settingsEntry) {
915
- const settingsXml = settingsEntry.getData().toString('utf8');
986
+ const settingsXml = readEntryBuffer(settingsEntry).toString('utf8');
916
987
  const settingsData = parser.parse(settingsXml);
917
988
  const startGridName = settingsData?.GridSetSettings?.StartGrid ||
918
989
  settingsData?.gridSetSettings?.startGrid ||
@@ -933,10 +1004,7 @@ class GridsetProcessor extends baseProcessor_1.BaseProcessor {
933
1004
  }
934
1005
  processTexts(filePathOrBuffer, translations, outputPath) {
935
1006
  // Load the tree, apply translations, and save to new file
936
- const buffer = Buffer.isBuffer(filePathOrBuffer)
937
- ? filePathOrBuffer
938
- : fs_1.default.readFileSync(filePathOrBuffer);
939
- const tree = this.loadIntoTree(buffer);
1007
+ const tree = this.loadIntoTree(filePathOrBuffer);
940
1008
  // Apply translations to all text content
941
1009
  Object.values(tree.pages).forEach((page) => {
942
1010
  // Translate page names
@@ -1327,5 +1395,13 @@ class GridsetProcessor extends baseProcessor_1.BaseProcessor {
1327
1395
  generateTranslatedDownload(filePath, translatedStrings, sourceStrings) {
1328
1396
  return this.generateTranslatedDownloadGeneric(filePath, translatedStrings, sourceStrings);
1329
1397
  }
1398
+ /**
1399
+ * Validate Gridset file format
1400
+ * @param filePath - Path to the file to validate
1401
+ * @returns Promise with validation result
1402
+ */
1403
+ async validate(filePath) {
1404
+ return gridsetValidator_1.GridsetValidator.validateFile(filePath);
1405
+ }
1330
1406
  }
1331
1407
  exports.GridsetProcessor = GridsetProcessor;
@@ -11,8 +11,17 @@ export { getPageTokenImageMap, getAllowedImageEntries, openImage, generateGrid3G
11
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
+ export { resolveGridsetPassword, resolveGridsetPasswordFromEnv } from './gridset/password';
14
15
  export { getNamedColor, rgbaToHex, channelToHex, clampColorChannel, clampAlpha, toHexColor, darkenColor, normalizeColor, ensureAlphaChannel, } from './gridset/colorUtils';
15
- export { DEFAULT_GRID3_STYLES, CATEGORY_STYLES, createDefaultStylesXml, createCategoryStyle, } from './gridset/styleHelpers';
16
+ export { DEFAULT_GRID3_STYLES, CATEGORY_STYLES, createDefaultStylesXml, createCategoryStyle, CellBackgroundShape, SHAPE_NAMES, } from './gridset/styleHelpers';
16
17
  export { ensureAlphaChannel as ensureAlphaChannelFromStyles } from './gridset/styleHelpers';
18
+ export { detectPluginCellType, type Grid3PluginMetadata, Grid3CellType, WORKSPACE_TYPES, LIVECELL_TYPES, AUTOCONTENT_TYPES, getCellTypeDisplayName, isWorkspaceCell, isLiveCell, isAutoContentCell, isRegularCell, } from './gridset/pluginTypes';
19
+ export { detectCommand, getCommandDefinition, getCommandsByPlugin, getCommandsByCategory, getAllCommandIds, getAllPluginIds, extractCommandParameters, GRID3_COMMANDS, type Grid3CommandDefinition, type CommandParameter, type ExtractedParameters, Grid3CommandCategory, } from './gridset/commands';
20
+ export * from './gridset/index';
21
+ export { parseSymbolReference, isSymbolReference, resolveSymbolReference, getAvailableSymbolLibraries, getSymbolLibraryInfo, extractSymbolReferences, analyzeSymbolUsage, createSymbolReference, getSymbolLibraryName, getSymbolPath, isKnownSymbolLibrary, getSymbolLibraryDisplayName, getDefaultGrid3Path, getSymbolLibrariesDir, getSymbolSearchIndexesDir, symbolReferenceToFilename, SYMBOL_LIBRARIES, } from './gridset/symbols';
22
+ export { isSymbolLibraryReference, parseImageSymbolReference } from './gridset/resolver';
23
+ export { getSymbolsDir, getSymbolSearchDir } from './gridset/symbols';
24
+ export { extractButtonImage, extractSymbolLibraryImage, convertToAstericsImage, analyzeSymbolExtraction, suggestExtractionStrategy, exportSymbolReferencesToCsv, createSymbolManifest, } from './gridset/symbolExtractor';
25
+ export { parsePixFile, loadSearchIndexes, searchSymbols, searchSymbolsWithReferences, getSymbolFilename, getSymbolDisplayName, getAllSearchTerms, getSearchSuggestions, countLibrarySymbols, getSymbolSearchStats, } from './gridset/symbolSearch';
17
26
  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
27
  export { getPageTokenImageMap as getTouchChatPageTokenImageMap, getAllowedImageEntries as getTouchChatAllowedImageEntries, openImage as openTouchChatImage, } from './touchchat/helpers';
@@ -1,7 +1,22 @@
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 __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
2
16
  Object.defineProperty(exports, "__esModule", { value: true });
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;
17
+ exports.rgbaToHex = exports.getNamedColor = exports.resolveGridsetPasswordFromEnv = exports.resolveGridsetPassword = 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;
18
+ exports.SYMBOL_LIBRARIES = exports.symbolReferenceToFilename = exports.getSymbolSearchIndexesDir = exports.getSymbolLibrariesDir = exports.getDefaultGrid3Path = exports.getSymbolLibraryDisplayName = exports.isKnownSymbolLibrary = exports.getSymbolPath = exports.getSymbolLibraryName = exports.createSymbolReference = exports.analyzeSymbolUsage = exports.extractSymbolReferences = exports.getSymbolLibraryInfo = exports.getAvailableSymbolLibraries = exports.resolveSymbolReference = exports.isSymbolReference = exports.parseSymbolReference = exports.Grid3CommandCategory = exports.GRID3_COMMANDS = exports.extractCommandParameters = exports.getAllPluginIds = exports.getAllCommandIds = exports.getCommandsByCategory = exports.getCommandsByPlugin = exports.getCommandDefinition = exports.detectCommand = exports.isRegularCell = exports.isAutoContentCell = exports.isLiveCell = exports.isWorkspaceCell = exports.getCellTypeDisplayName = exports.AUTOCONTENT_TYPES = exports.LIVECELL_TYPES = exports.WORKSPACE_TYPES = exports.Grid3CellType = exports.detectPluginCellType = exports.ensureAlphaChannelFromStyles = exports.SHAPE_NAMES = exports.CellBackgroundShape = 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 = void 0;
19
+ 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.getSymbolSearchStats = exports.countLibrarySymbols = exports.getSearchSuggestions = exports.getAllSearchTerms = exports.getSymbolDisplayName = exports.getSymbolFilename = exports.searchSymbolsWithReferences = exports.searchSymbols = exports.loadSearchIndexes = exports.parsePixFile = exports.createSymbolManifest = exports.exportSymbolReferencesToCsv = exports.suggestExtractionStrategy = exports.analyzeSymbolExtraction = exports.convertToAstericsImage = exports.extractSymbolLibraryImage = exports.extractButtonImage = exports.getSymbolSearchDir = exports.getSymbolsDir = exports.parseImageSymbolReference = exports.isSymbolLibraryReference = void 0;
5
20
  var applePanelsProcessor_1 = require("./applePanelsProcessor");
6
21
  Object.defineProperty(exports, "ApplePanelsProcessor", { enumerable: true, get: function () { return applePanelsProcessor_1.ApplePanelsProcessor; } });
7
22
  var dotProcessor_1 = require("./dotProcessor");
@@ -63,6 +78,9 @@ Object.defineProperty(exports, "createWordlist", { enumerable: true, get: functi
63
78
  Object.defineProperty(exports, "extractWordlists", { enumerable: true, get: function () { return wordlistHelpers_1.extractWordlists; } });
64
79
  Object.defineProperty(exports, "updateWordlist", { enumerable: true, get: function () { return wordlistHelpers_1.updateWordlist; } });
65
80
  Object.defineProperty(exports, "wordlistToXml", { enumerable: true, get: function () { return wordlistHelpers_1.wordlistToXml; } });
81
+ var password_1 = require("./gridset/password");
82
+ Object.defineProperty(exports, "resolveGridsetPassword", { enumerable: true, get: function () { return password_1.resolveGridsetPassword; } });
83
+ Object.defineProperty(exports, "resolveGridsetPasswordFromEnv", { enumerable: true, get: function () { return password_1.resolveGridsetPasswordFromEnv; } });
66
84
  // Gridset (Grid 3) color utilities
67
85
  var colorUtils_1 = require("./gridset/colorUtils");
68
86
  Object.defineProperty(exports, "getNamedColor", { enumerable: true, get: function () { return colorUtils_1.getNamedColor; } });
@@ -80,9 +98,83 @@ Object.defineProperty(exports, "DEFAULT_GRID3_STYLES", { enumerable: true, get:
80
98
  Object.defineProperty(exports, "CATEGORY_STYLES", { enumerable: true, get: function () { return styleHelpers_1.CATEGORY_STYLES; } });
81
99
  Object.defineProperty(exports, "createDefaultStylesXml", { enumerable: true, get: function () { return styleHelpers_1.createDefaultStylesXml; } });
82
100
  Object.defineProperty(exports, "createCategoryStyle", { enumerable: true, get: function () { return styleHelpers_1.createCategoryStyle; } });
101
+ Object.defineProperty(exports, "CellBackgroundShape", { enumerable: true, get: function () { return styleHelpers_1.CellBackgroundShape; } });
102
+ Object.defineProperty(exports, "SHAPE_NAMES", { enumerable: true, get: function () { return styleHelpers_1.SHAPE_NAMES; } });
83
103
  // Re-export ensureAlphaChannel from styleHelpers for backward compatibility
84
104
  var styleHelpers_2 = require("./gridset/styleHelpers");
85
105
  Object.defineProperty(exports, "ensureAlphaChannelFromStyles", { enumerable: true, get: function () { return styleHelpers_2.ensureAlphaChannel; } });
106
+ // Gridset (Grid 3) plugin cell type detection
107
+ var pluginTypes_1 = require("./gridset/pluginTypes");
108
+ Object.defineProperty(exports, "detectPluginCellType", { enumerable: true, get: function () { return pluginTypes_1.detectPluginCellType; } });
109
+ Object.defineProperty(exports, "Grid3CellType", { enumerable: true, get: function () { return pluginTypes_1.Grid3CellType; } });
110
+ Object.defineProperty(exports, "WORKSPACE_TYPES", { enumerable: true, get: function () { return pluginTypes_1.WORKSPACE_TYPES; } });
111
+ Object.defineProperty(exports, "LIVECELL_TYPES", { enumerable: true, get: function () { return pluginTypes_1.LIVECELL_TYPES; } });
112
+ Object.defineProperty(exports, "AUTOCONTENT_TYPES", { enumerable: true, get: function () { return pluginTypes_1.AUTOCONTENT_TYPES; } });
113
+ Object.defineProperty(exports, "getCellTypeDisplayName", { enumerable: true, get: function () { return pluginTypes_1.getCellTypeDisplayName; } });
114
+ Object.defineProperty(exports, "isWorkspaceCell", { enumerable: true, get: function () { return pluginTypes_1.isWorkspaceCell; } });
115
+ Object.defineProperty(exports, "isLiveCell", { enumerable: true, get: function () { return pluginTypes_1.isLiveCell; } });
116
+ Object.defineProperty(exports, "isAutoContentCell", { enumerable: true, get: function () { return pluginTypes_1.isAutoContentCell; } });
117
+ Object.defineProperty(exports, "isRegularCell", { enumerable: true, get: function () { return pluginTypes_1.isRegularCell; } });
118
+ // Gridset (Grid 3) command definitions and detection
119
+ var commands_1 = require("./gridset/commands");
120
+ Object.defineProperty(exports, "detectCommand", { enumerable: true, get: function () { return commands_1.detectCommand; } });
121
+ Object.defineProperty(exports, "getCommandDefinition", { enumerable: true, get: function () { return commands_1.getCommandDefinition; } });
122
+ Object.defineProperty(exports, "getCommandsByPlugin", { enumerable: true, get: function () { return commands_1.getCommandsByPlugin; } });
123
+ Object.defineProperty(exports, "getCommandsByCategory", { enumerable: true, get: function () { return commands_1.getCommandsByCategory; } });
124
+ Object.defineProperty(exports, "getAllCommandIds", { enumerable: true, get: function () { return commands_1.getAllCommandIds; } });
125
+ Object.defineProperty(exports, "getAllPluginIds", { enumerable: true, get: function () { return commands_1.getAllPluginIds; } });
126
+ Object.defineProperty(exports, "extractCommandParameters", { enumerable: true, get: function () { return commands_1.extractCommandParameters; } });
127
+ Object.defineProperty(exports, "GRID3_COMMANDS", { enumerable: true, get: function () { return commands_1.GRID3_COMMANDS; } });
128
+ Object.defineProperty(exports, "Grid3CommandCategory", { enumerable: true, get: function () { return commands_1.Grid3CommandCategory; } });
129
+ // Gridset (Grid 3) enhanced index - re-export everything
130
+ __exportStar(require("./gridset/index"), exports);
131
+ // Gridset (Grid 3) symbol library handling
132
+ var symbols_1 = require("./gridset/symbols");
133
+ Object.defineProperty(exports, "parseSymbolReference", { enumerable: true, get: function () { return symbols_1.parseSymbolReference; } });
134
+ Object.defineProperty(exports, "isSymbolReference", { enumerable: true, get: function () { return symbols_1.isSymbolReference; } });
135
+ Object.defineProperty(exports, "resolveSymbolReference", { enumerable: true, get: function () { return symbols_1.resolveSymbolReference; } });
136
+ Object.defineProperty(exports, "getAvailableSymbolLibraries", { enumerable: true, get: function () { return symbols_1.getAvailableSymbolLibraries; } });
137
+ Object.defineProperty(exports, "getSymbolLibraryInfo", { enumerable: true, get: function () { return symbols_1.getSymbolLibraryInfo; } });
138
+ Object.defineProperty(exports, "extractSymbolReferences", { enumerable: true, get: function () { return symbols_1.extractSymbolReferences; } });
139
+ Object.defineProperty(exports, "analyzeSymbolUsage", { enumerable: true, get: function () { return symbols_1.analyzeSymbolUsage; } });
140
+ Object.defineProperty(exports, "createSymbolReference", { enumerable: true, get: function () { return symbols_1.createSymbolReference; } });
141
+ Object.defineProperty(exports, "getSymbolLibraryName", { enumerable: true, get: function () { return symbols_1.getSymbolLibraryName; } });
142
+ Object.defineProperty(exports, "getSymbolPath", { enumerable: true, get: function () { return symbols_1.getSymbolPath; } });
143
+ Object.defineProperty(exports, "isKnownSymbolLibrary", { enumerable: true, get: function () { return symbols_1.isKnownSymbolLibrary; } });
144
+ Object.defineProperty(exports, "getSymbolLibraryDisplayName", { enumerable: true, get: function () { return symbols_1.getSymbolLibraryDisplayName; } });
145
+ Object.defineProperty(exports, "getDefaultGrid3Path", { enumerable: true, get: function () { return symbols_1.getDefaultGrid3Path; } });
146
+ Object.defineProperty(exports, "getSymbolLibrariesDir", { enumerable: true, get: function () { return symbols_1.getSymbolLibrariesDir; } });
147
+ Object.defineProperty(exports, "getSymbolSearchIndexesDir", { enumerable: true, get: function () { return symbols_1.getSymbolSearchIndexesDir; } });
148
+ Object.defineProperty(exports, "symbolReferenceToFilename", { enumerable: true, get: function () { return symbols_1.symbolReferenceToFilename; } });
149
+ Object.defineProperty(exports, "SYMBOL_LIBRARIES", { enumerable: true, get: function () { return symbols_1.SYMBOL_LIBRARIES; } });
150
+ var resolver_2 = require("./gridset/resolver");
151
+ Object.defineProperty(exports, "isSymbolLibraryReference", { enumerable: true, get: function () { return resolver_2.isSymbolLibraryReference; } });
152
+ Object.defineProperty(exports, "parseImageSymbolReference", { enumerable: true, get: function () { return resolver_2.parseImageSymbolReference; } });
153
+ // Backward compatibility
154
+ var symbols_2 = require("./gridset/symbols");
155
+ Object.defineProperty(exports, "getSymbolsDir", { enumerable: true, get: function () { return symbols_2.getSymbolsDir; } });
156
+ Object.defineProperty(exports, "getSymbolSearchDir", { enumerable: true, get: function () { return symbols_2.getSymbolSearchDir; } });
157
+ // Gridset (Grid 3) symbol extraction for conversion
158
+ var symbolExtractor_1 = require("./gridset/symbolExtractor");
159
+ Object.defineProperty(exports, "extractButtonImage", { enumerable: true, get: function () { return symbolExtractor_1.extractButtonImage; } });
160
+ Object.defineProperty(exports, "extractSymbolLibraryImage", { enumerable: true, get: function () { return symbolExtractor_1.extractSymbolLibraryImage; } });
161
+ Object.defineProperty(exports, "convertToAstericsImage", { enumerable: true, get: function () { return symbolExtractor_1.convertToAstericsImage; } });
162
+ Object.defineProperty(exports, "analyzeSymbolExtraction", { enumerable: true, get: function () { return symbolExtractor_1.analyzeSymbolExtraction; } });
163
+ Object.defineProperty(exports, "suggestExtractionStrategy", { enumerable: true, get: function () { return symbolExtractor_1.suggestExtractionStrategy; } });
164
+ Object.defineProperty(exports, "exportSymbolReferencesToCsv", { enumerable: true, get: function () { return symbolExtractor_1.exportSymbolReferencesToCsv; } });
165
+ Object.defineProperty(exports, "createSymbolManifest", { enumerable: true, get: function () { return symbolExtractor_1.createSymbolManifest; } });
166
+ // Gridset (Grid 3) symbol search
167
+ var symbolSearch_1 = require("./gridset/symbolSearch");
168
+ Object.defineProperty(exports, "parsePixFile", { enumerable: true, get: function () { return symbolSearch_1.parsePixFile; } });
169
+ Object.defineProperty(exports, "loadSearchIndexes", { enumerable: true, get: function () { return symbolSearch_1.loadSearchIndexes; } });
170
+ Object.defineProperty(exports, "searchSymbols", { enumerable: true, get: function () { return symbolSearch_1.searchSymbols; } });
171
+ Object.defineProperty(exports, "searchSymbolsWithReferences", { enumerable: true, get: function () { return symbolSearch_1.searchSymbolsWithReferences; } });
172
+ Object.defineProperty(exports, "getSymbolFilename", { enumerable: true, get: function () { return symbolSearch_1.getSymbolFilename; } });
173
+ Object.defineProperty(exports, "getSymbolDisplayName", { enumerable: true, get: function () { return symbolSearch_1.getSymbolDisplayName; } });
174
+ Object.defineProperty(exports, "getAllSearchTerms", { enumerable: true, get: function () { return symbolSearch_1.getAllSearchTerms; } });
175
+ Object.defineProperty(exports, "getSearchSuggestions", { enumerable: true, get: function () { return symbolSearch_1.getSearchSuggestions; } });
176
+ Object.defineProperty(exports, "countLibrarySymbols", { enumerable: true, get: function () { return symbolSearch_1.countLibrarySymbols; } });
177
+ Object.defineProperty(exports, "getSymbolSearchStats", { enumerable: true, get: function () { return symbolSearch_1.getSymbolSearchStats; } });
86
178
  // Snap helpers
87
179
  var helpers_3 = require("./snap/helpers");
88
180
  Object.defineProperty(exports, "getSnapPageTokenImageMap", { enumerable: true, get: function () { return helpers_3.getPageTokenImageMap; } });
@@ -1,5 +1,6 @@
1
1
  import { BaseProcessor, ProcessorOptions, ExtractStringsResult, TranslatedString, SourceString } from '../core/baseProcessor';
2
2
  import { AACTree } from '../core/treeStructure';
3
+ import { ValidationResult } from '../validation/validationTypes';
3
4
  declare class ObfProcessor extends BaseProcessor {
4
5
  constructor(options?: ProcessorOptions);
5
6
  private processBoard;
@@ -19,5 +20,11 @@ declare class ObfProcessor extends BaseProcessor {
19
20
  * Uses the generic implementation from BaseProcessor
20
21
  */
21
22
  generateTranslatedDownload(filePath: string, translatedStrings: TranslatedString[], sourceStrings: SourceString[]): Promise<string>;
23
+ /**
24
+ * Validate OBF/OBZ file format
25
+ * @param filePath - Path to the file to validate
26
+ * @returns Promise with validation result
27
+ */
28
+ validate(filePath: string): Promise<ValidationResult>;
22
29
  }
23
30
  export { ObfProcessor };
@@ -10,6 +10,7 @@ const treeStructure_1 = require("../core/treeStructure");
10
10
  const adm_zip_1 = __importDefault(require("adm-zip"));
11
11
  const fs_1 = __importDefault(require("fs"));
12
12
  // Removed unused import: path
13
+ const obfValidator_1 = require("../validation/obfValidator");
13
14
  const OBF_FORMAT_VERSION = 'open-board-0.1';
14
15
  class ObfProcessor extends baseProcessor_1.BaseProcessor {
15
16
  constructor(options) {
@@ -359,5 +360,13 @@ class ObfProcessor extends baseProcessor_1.BaseProcessor {
359
360
  async generateTranslatedDownload(filePath, translatedStrings, sourceStrings) {
360
361
  return this.generateTranslatedDownloadGeneric(filePath, translatedStrings, sourceStrings);
361
362
  }
363
+ /**
364
+ * Validate OBF/OBZ file format
365
+ * @param filePath - Path to the file to validate
366
+ * @returns Promise with validation result
367
+ */
368
+ async validate(filePath) {
369
+ return obfValidator_1.ObfValidator.validateFile(filePath);
370
+ }
362
371
  }
363
372
  exports.ObfProcessor = ObfProcessor;
@@ -1,5 +1,6 @@
1
1
  import { BaseProcessor, ProcessorOptions, ExtractStringsResult, TranslatedString, SourceString } from '../core/baseProcessor';
2
2
  import { AACTree } from '../core/treeStructure';
3
+ import { ValidationResult } from '../validation/validationTypes';
3
4
  declare class SnapProcessor extends BaseProcessor {
4
5
  private symbolResolver;
5
6
  private loadAudio;
@@ -40,5 +41,11 @@ declare class SnapProcessor extends BaseProcessor {
40
41
  * Uses the generic implementation from BaseProcessor
41
42
  */
42
43
  generateTranslatedDownload(filePath: string, translatedStrings: TranslatedString[], sourceStrings: SourceString[]): Promise<string>;
44
+ /**
45
+ * Validate Snap file format
46
+ * @param filePath - Path to the file to validate
47
+ * @returns Promise with validation result
48
+ */
49
+ validate(filePath: string): Promise<ValidationResult>;
43
50
  }
44
51
  export { SnapProcessor };
@@ -11,6 +11,7 @@ const better_sqlite3_1 = __importDefault(require("better-sqlite3"));
11
11
  const path_1 = __importDefault(require("path"));
12
12
  const fs_1 = __importDefault(require("fs"));
13
13
  const crypto_1 = __importDefault(require("crypto"));
14
+ const snapValidator_1 = require("../validation/snapValidator");
14
15
  class SnapProcessor extends baseProcessor_1.BaseProcessor {
15
16
  constructor(symbolResolver = null, options = {}) {
16
17
  super(options);
@@ -612,5 +613,13 @@ class SnapProcessor extends baseProcessor_1.BaseProcessor {
612
613
  async generateTranslatedDownload(filePath, translatedStrings, sourceStrings) {
613
614
  return this.generateTranslatedDownloadGeneric(filePath, translatedStrings, sourceStrings);
614
615
  }
616
+ /**
617
+ * Validate Snap file format
618
+ * @param filePath - Path to the file to validate
619
+ * @returns Promise with validation result
620
+ */
621
+ async validate(filePath) {
622
+ return snapValidator_1.SnapValidator.validateFile(filePath);
623
+ }
615
624
  }
616
625
  exports.SnapProcessor = SnapProcessor;
@@ -1,5 +1,6 @@
1
1
  import { BaseProcessor, ProcessorOptions, ExtractStringsResult, TranslatedString, SourceString } from '../core/baseProcessor';
2
2
  import { AACTree } from '../core/treeStructure';
3
+ import { ValidationResult } from '../validation/validationTypes';
3
4
  declare class TouchChatProcessor extends BaseProcessor {
4
5
  private tree;
5
6
  private sourceFile;
@@ -23,5 +24,11 @@ declare class TouchChatProcessor extends BaseProcessor {
23
24
  * @returns Promise with path to the generated translated file
24
25
  */
25
26
  generateTranslatedDownload(filePath: string, translatedStrings: TranslatedString[], sourceStrings: SourceString[]): Promise<string>;
27
+ /**
28
+ * Validate TouchChat file format
29
+ * @param filePath - Path to the file to validate
30
+ * @returns Promise with validation result
31
+ */
32
+ validate(filePath: string): Promise<ValidationResult>;
26
33
  }
27
34
  export { TouchChatProcessor };
@@ -12,6 +12,7 @@ const better_sqlite3_1 = __importDefault(require("better-sqlite3"));
12
12
  const path_1 = __importDefault(require("path"));
13
13
  const fs_1 = __importDefault(require("fs"));
14
14
  const os_1 = __importDefault(require("os"));
15
+ const touchChatValidator_1 = require("../validation/touchChatValidator");
15
16
  const toNumberOrUndefined = (value) => typeof value === 'number' ? value : undefined;
16
17
  const toStringOrUndefined = (value) => typeof value === 'string' && value.length > 0 ? value : undefined;
17
18
  const toBooleanOrUndefined = (value) => typeof value === 'number' ? value !== 0 : undefined;
@@ -787,5 +788,13 @@ class TouchChatProcessor extends baseProcessor_1.BaseProcessor {
787
788
  return Promise.reject(new Error(`Failed to generate translated download: ${error instanceof Error ? error.message : 'Unknown error'}`));
788
789
  }
789
790
  }
791
+ /**
792
+ * Validate TouchChat file format
793
+ * @param filePath - Path to the file to validate
794
+ * @returns Promise with validation result
795
+ */
796
+ async validate(filePath) {
797
+ return touchChatValidator_1.TouchChatValidator.validateFile(filePath);
798
+ }
790
799
  }
791
800
  exports.TouchChatProcessor = TouchChatProcessor;
@@ -25,6 +25,23 @@ export interface AACButton {
25
25
  identifier?: string;
26
26
  metadata?: string;
27
27
  };
28
+ contentType?: 'Normal' | 'AutoContent' | 'Workspace' | 'LiveCell';
29
+ contentSubType?: string;
30
+ image?: string;
31
+ resolvedImageEntry?: string;
32
+ symbolLibrary?: string;
33
+ symbolPath?: string;
34
+ x?: number;
35
+ y?: number;
36
+ columnSpan?: number;
37
+ rowSpan?: number;
38
+ scanBlocks?: number[];
39
+ visibility?: 'Visible' | 'Hidden' | 'Disabled' | 'PointerAndTouchOnly' | 'Empty';
40
+ directActivate?: boolean;
41
+ audioDescription?: string;
42
+ parameters?: {
43
+ [key: string]: any;
44
+ };
28
45
  }
29
46
  export interface AACPage {
30
47
  id: string;
@@ -0,0 +1,69 @@
1
+ import { AACPage, AACTree } from '../core/treeStructure';
2
+ export interface ScreenshotCell {
3
+ text: string;
4
+ row: number;
5
+ col: number;
6
+ isCategory?: boolean;
7
+ isNavigation?: boolean;
8
+ isEmpty?: boolean;
9
+ imageUrl?: string;
10
+ }
11
+ export interface ScreenshotGrid {
12
+ rows: number;
13
+ cols: number;
14
+ cells: ScreenshotCell[];
15
+ categories: string[];
16
+ metadata?: {
17
+ timestamp?: string;
18
+ battery?: string;
19
+ date?: string;
20
+ };
21
+ }
22
+ export interface ScreenshotPage {
23
+ filename: string;
24
+ grid: ScreenshotGrid;
25
+ extractedAt: Date;
26
+ pageName?: string;
27
+ parentPath?: string;
28
+ pageTitle?: string;
29
+ }
30
+ export interface PageHierarchy {
31
+ [pageId: string]: {
32
+ page: ScreenshotPage;
33
+ children: string[];
34
+ parent?: string;
35
+ };
36
+ }
37
+ export interface ScreenshotConversionOptions {
38
+ includeEmptyCells: boolean;
39
+ generateIds: boolean;
40
+ targetPlatform?: 'grid3' | 'asterics' | 'snap' | 'touchchat';
41
+ language: string;
42
+ fallbackCategory: string;
43
+ filenameDelimiter?: string;
44
+ }
45
+ export declare class ScreenshotConverter {
46
+ private static defaultOptions;
47
+ /**
48
+ * Parse filename to extract page hierarchy and names
49
+ * Examples:
50
+ * - "Home.png" → pageName: "Home", parentPath: ""
51
+ * - "Home->Fragen.png" → pageName: "Fragen", parentPath: "Home"
52
+ * - "Home->Settings->Profile.jpg" → pageName: "Profile", parentPath: "Home->Settings"
53
+ */
54
+ static parseFilename(filename: string, delimiter?: string): {
55
+ pageName: string;
56
+ parentPath: string;
57
+ };
58
+ /**
59
+ * Build page hierarchy from an array of screenshots
60
+ */
61
+ static buildPageHierarchy(screenshots: ScreenshotPage[]): PageHierarchy;
62
+ static parseOCRText(ocrResult: string): ScreenshotGrid;
63
+ private static isCategoryToken;
64
+ private static isNavigationToken;
65
+ static convertToAACPage(screenshotPage: ScreenshotPage, pageHierarchy?: PageHierarchy, options?: Partial<ScreenshotConversionOptions>): AACPage;
66
+ private static createSemanticAction;
67
+ static convertToAACTree(screenshotPages: ScreenshotPage[], options?: Partial<ScreenshotConversionOptions>): AACTree;
68
+ private static sanitizePageId;
69
+ }