| 363 | } |
| 364 | |
| 365 | function normalizeItem(it) { |
| 366 | if (it == null) return null; |
| 367 | if (typeof it === 'string') return { name: it, locked: false, hasSubfolders: undefined, nonEmpty: undefined }; |
| 368 | if (typeof it === 'object') { |
| 369 | const nm = String(it.name ?? '').trim(); |
| 370 | if (!nm) return null; |
| 371 | return { |
| 372 | name: nm, |
| 373 | locked: !!it.locked, |
| 374 | hasSubfolders: (typeof it.hasSubfolders === 'boolean') ? it.hasSubfolders : undefined, |
| 375 | nonEmpty: (typeof it.nonEmpty === 'boolean') ? it.nonEmpty : undefined, |
| 376 | encrypted: (typeof it.encrypted === 'boolean') ? it.encrypted : undefined, |
| 377 | }; |
| 378 | } |
| 379 | return null; |
| 380 | } |
| 381 | |
| 382 | /* ---------------------- |
| 383 | Folder Tree State (Save/Load) |