@sdcorejs/angular 20.2.13 → 20.2.15

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 (42) hide show
  1. package/assets/STYLE-GUIDE.md +138 -10
  2. package/assets/scss/core/form.scss +18 -2
  3. package/assets/scss/core/utilities/_base.scss +3 -3
  4. package/assets/scss/themes/_presets.scss +52 -0
  5. package/assets/scss/themes/default.scss +39 -11
  6. package/assets/scss/themes/material-theme.scss +2 -2
  7. package/components/button/index.d.ts +5 -0
  8. package/components/file-explorer/index.d.ts +500 -0
  9. package/components/index.d.ts +1 -0
  10. package/components/side-drawer/index.d.ts +13 -2
  11. package/components/tab/index.d.ts +8 -2
  12. package/components/table/index.d.ts +220 -6
  13. package/fesm2022/sdcorejs-angular-components-api-contract-builder.mjs +1 -1
  14. package/fesm2022/sdcorejs-angular-components-api-contract-builder.mjs.map +1 -1
  15. package/fesm2022/sdcorejs-angular-components-button.mjs +12 -2
  16. package/fesm2022/sdcorejs-angular-components-button.mjs.map +1 -1
  17. package/fesm2022/sdcorejs-angular-components-file-explorer.mjs +2582 -0
  18. package/fesm2022/sdcorejs-angular-components-file-explorer.mjs.map +1 -0
  19. package/fesm2022/sdcorejs-angular-components-form-generic.mjs +3 -3
  20. package/fesm2022/sdcorejs-angular-components-form-generic.mjs.map +1 -1
  21. package/fesm2022/sdcorejs-angular-components-preview.mjs +2 -2
  22. package/fesm2022/sdcorejs-angular-components-preview.mjs.map +1 -1
  23. package/fesm2022/sdcorejs-angular-components-side-drawer.mjs +92 -7
  24. package/fesm2022/sdcorejs-angular-components-side-drawer.mjs.map +1 -1
  25. package/fesm2022/sdcorejs-angular-components-tab-router.mjs +10 -4
  26. package/fesm2022/sdcorejs-angular-components-tab-router.mjs.map +1 -1
  27. package/fesm2022/sdcorejs-angular-components-tab.mjs +52 -3
  28. package/fesm2022/sdcorejs-angular-components-tab.mjs.map +1 -1
  29. package/fesm2022/sdcorejs-angular-components-table.mjs +502 -79
  30. package/fesm2022/sdcorejs-angular-components-table.mjs.map +1 -1
  31. package/fesm2022/sdcorejs-angular-components.mjs +1 -0
  32. package/fesm2022/sdcorejs-angular-components.mjs.map +1 -1
  33. package/fesm2022/sdcorejs-angular-forms-select.mjs +2 -2
  34. package/fesm2022/sdcorejs-angular-forms-select.mjs.map +1 -1
  35. package/fesm2022/sdcorejs-angular-i18n.mjs +430 -0
  36. package/fesm2022/sdcorejs-angular-i18n.mjs.map +1 -1
  37. package/fesm2022/sdcorejs-angular-modules-icon.mjs +6 -0
  38. package/fesm2022/sdcorejs-angular-modules-icon.mjs.map +1 -1
  39. package/fesm2022/sdcorejs-angular-modules-layout.mjs +2 -2
  40. package/fesm2022/sdcorejs-angular-modules-layout.mjs.map +1 -1
  41. package/i18n/index.d.ts +85 -0
  42. package/package.json +5 -1
@@ -0,0 +1,2582 @@
1
+ import { NgComponentOutlet, DOCUMENT } from '@angular/common';
2
+ import * as i0 from '@angular/core';
3
+ import { input, computed, ChangeDetectionStrategy, Component, inject, ElementRef, output, signal, viewChild, effect, untracked, Injector, NgZone, afterNextRender, DestroyRef } from '@angular/core';
4
+ import { SdBreadcrumb } from '@sdcorejs/angular/components/breadcrumb';
5
+ import { SdButton } from '@sdcorejs/angular/components/button';
6
+ import { SdDataState } from '@sdcorejs/angular/components/data-state';
7
+ import { I18nService, SdTranslatePipe } from '@sdcorejs/angular/i18n';
8
+ import { SdIcon } from '@sdcorejs/angular/modules/icon';
9
+ import { SdSideDrawer } from '@sdcorejs/angular/components/side-drawer';
10
+
11
+ // AUTO-GENERATED by scripts/generate-file-explorer-icons.mjs from ./assets/icons. DO NOT EDIT.
12
+ // Run `npm run generate:file-explorer-icons` at the repo root after changing the SVG files or manifest.json.
13
+ /** Icon markup (64 × 64 viewBox), without title / ARIA / fixed size — rendered decoratively. */
14
+ const SD_FILE_EXPLORER_ICON_SVGS = {
15
+ 'file-3d': '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64"><path d="M16 4h24l13 13v38a5 5 0 0 1-5 5H16a5 5 0 0 1-5-5V9a5 5 0 0 1 5-5Z" fill="#FDFEFF" stroke="#D3DFEC" stroke-width="1.5"/><path d="M40 4v9a4 4 0 0 0 4 4h9Z" fill="#2A8495" opacity=".17"/><g fill="none" stroke="#2A8495" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="m32 20 11 6v11l-11 6-11-6V26zm0 12 11-6m-11 6-11-6m11 6v11"/></g><rect x="16" y="42" width="32" height="14" rx="4" fill="#2A8495"/><g fill="#FFF"><path d="M29.03 47.27Q29.77 47.46 30.15 47.93Q30.53 48.4 30.53 49.13Q30.53 50.21 29.7 50.78Q28.87 51.34 27.28 51.34Q26.72 51.34 26.16 51.25Q25.59 51.16 25.04 50.98V49.53Q25.57 49.79 26.09 49.93Q26.61 50.06 27.11 50.06Q27.86 50.06 28.25 49.8Q28.65 49.54 28.65 49.06Q28.65 48.56 28.25 48.31Q27.84 48.05 27.04 48.05H26.29V46.84H27.08Q27.79 46.84 28.14 46.62Q28.48 46.4 28.48 45.94Q28.48 45.52 28.15 45.29Q27.81 45.06 27.19 45.06Q26.74 45.06 26.27 45.16Q25.81 45.27 25.35 45.47V44.09Q25.91 43.93 26.46 43.86Q27 43.78 27.53 43.78Q28.95 43.78 29.66 44.24Q30.36 44.71 30.36 45.65Q30.36 46.29 30.02 46.7Q29.69 47.1 29.03 47.27Z"/><path d="M34.13 45.33V49.78H34.8Q35.95 49.78 36.56 49.21Q37.17 48.64 37.17 47.55Q37.17 46.46 36.56 45.9Q35.96 45.33 34.8 45.33ZM32.25 43.91H34.23Q35.89 43.91 36.7 44.15Q37.52 44.38 38.1 44.95Q38.61 45.44 38.86 46.09Q39.11 46.73 39.11 47.55Q39.11 48.37 38.86 49.02Q38.61 49.67 38.1 50.16Q37.51 50.73 36.69 50.96Q35.87 51.2 34.23 51.2H32.25Z"/></g></svg>',
16
+ 'file-7z': '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64"><path d="M16 4h24l13 13v38a5 5 0 0 1-5 5H16a5 5 0 0 1-5-5V9a5 5 0 0 1 5-5Z" fill="#FDFEFF" stroke="#D3DFEC" stroke-width="1.5"/><path d="M40 4v9a4 4 0 0 0 4 4h9Z" fill="#926923" opacity=".17"/><g fill="none" stroke="#926923" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="22" y="23" width="20" height="14" rx="2"/><path d="M24 20h16v3M31 23v9m3-7-2 2 2 2-2 2"/></g><rect x="16" y="42" width="32" height="14" rx="4" fill="#926923"/><g fill="#FFF"><path d="M25.56 43.91H31.06V44.97L28.22 51.2H26.38L29.08 45.29H25.56Z"/><path d="M32.42 43.91H38.54V45.05L34.63 49.78H38.66V51.2H32.3V50.06L36.21 45.33H32.42Z"/></g></svg>',
17
+ 'file-ai': '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64"><path d="M16 4h24l13 13v38a5 5 0 0 1-5 5H16a5 5 0 0 1-5-5V9a5 5 0 0 1 5-5Z" fill="#FDFEFF" stroke="#D3DFEC" stroke-width="1.5"/><path d="M40 4v9a4 4 0 0 0 4 4h9Z" fill="#BA622F" opacity=".17"/><g fill="none" stroke="#BA622F" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="m32 20 9 9-9 9-9-9zm0 0v18m-4-4 4-4 4 4"/></g><rect x="16" y="42" width="32" height="14" rx="4" fill="#BA622F"/><g fill="#FFF"><path d="M31.61 49.87H28.67L28.21 51.2H26.32L29.02 43.91H31.26L33.96 51.2H32.07ZM29.14 48.52H31.14L30.14 45.62Z"/><path d="M34.93 43.91H36.81V51.2H34.93Z"/></g></svg>',
18
+ 'file-app': '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64"><path d="M16 4h24l13 13v38a5 5 0 0 1-5 5H16a5 5 0 0 1-5-5V9a5 5 0 0 1 5-5Z" fill="#FDFEFF" stroke="#D3DFEC" stroke-width="1.5"/><path d="M40 4v9a4 4 0 0 0 4 4h9Z" fill="#5E7186" opacity=".17"/><g fill="none" stroke="#5E7186" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="23" y="22" width="18" height="15" rx="3"/><path d="M28 19v3m8-3v3m-8 15v3m8-3v3m-16-13h3m-3 6h3m18-6h3m-3 6h3"/></g><rect x="16" y="42" width="32" height="14" rx="4" fill="#5E7186"/><g fill="#FFF"><path d="M26.14 49.87H23.2L22.74 51.2H20.85L23.55 43.91H25.79L28.49 51.2H26.6ZM23.67 48.52H25.67L24.67 45.62Z"/><path d="M29.46 43.91H32.58Q33.97 43.91 34.71 44.53Q35.46 45.15 35.46 46.29Q35.46 47.44 34.71 48.05Q33.97 48.67 32.58 48.67H31.34V51.2H29.46ZM31.34 45.27V47.31H32.38Q32.93 47.31 33.22 47.04Q33.52 46.78 33.52 46.29Q33.52 45.8 33.22 45.54Q32.93 45.27 32.38 45.27Z"/><path d="M36.79 43.91H39.91Q41.3 43.91 42.04 44.53Q42.79 45.15 42.79 46.29Q42.79 47.44 42.04 48.05Q41.3 48.67 39.91 48.67H38.67V51.2H36.79ZM38.67 45.27V47.31H39.71Q40.25 47.31 40.55 47.04Q40.85 46.78 40.85 46.29Q40.85 45.8 40.55 45.54Q40.25 45.27 39.71 45.27Z"/></g></svg>',
19
+ 'file-archive': '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64"><path d="M16 4h24l13 13v38a5 5 0 0 1-5 5H16a5 5 0 0 1-5-5V9a5 5 0 0 1 5-5Z" fill="#FDFEFF" stroke="#D3DFEC" stroke-width="1.5"/><path d="M40 4v9a4 4 0 0 0 4 4h9Z" fill="#926923" opacity=".17"/><g fill="none" stroke="#926923" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="22" y="23" width="20" height="14" rx="2"/><path d="M24 20h16v3M31 23v9m3-7-2 2 2 2-2 2"/></g><rect x="16" y="42" width="32" height="14" rx="4" fill="#926923"/><g fill="#FFF"><path d="M25.95 49.87H23.01L22.55 51.2H20.66L23.36 43.91H25.6L28.3 51.2H26.41ZM23.48 48.52H25.48L24.48 45.62Z"/><path d="M31.94 47.14Q32.53 47.14 32.79 46.92Q33.04 46.7 33.04 46.2Q33.04 45.7 32.79 45.49Q32.53 45.27 31.94 45.27H31.15V47.14ZM31.15 48.44V51.2H29.27V43.91H32.14Q33.58 43.91 34.25 44.39Q34.92 44.88 34.92 45.92Q34.92 46.64 34.57 47.11Q34.22 47.57 33.52 47.79Q33.91 47.88 34.21 48.19Q34.52 48.5 34.83 49.13L35.85 51.2H33.85L32.96 49.39Q32.69 48.84 32.42 48.64Q32.14 48.44 31.68 48.44Z"/><path d="M42.75 50.8Q42.23 51.07 41.67 51.2Q41.11 51.34 40.5 51.34Q38.68 51.34 37.61 50.32Q36.55 49.31 36.55 47.56Q36.55 45.81 37.61 44.8Q38.68 43.78 40.5 43.78Q41.11 43.78 41.67 43.91Q42.23 44.05 42.75 44.32V45.83Q42.23 45.47 41.72 45.31Q41.21 45.14 40.65 45.14Q39.64 45.14 39.07 45.78Q38.49 46.43 38.49 47.56Q38.49 48.69 39.07 49.33Q39.64 49.98 40.65 49.98Q41.21 49.98 41.72 49.81Q42.23 49.65 42.75 49.29Z"/></g></svg>',
20
+ 'file-audio': '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64"><path d="M16 4h24l13 13v38a5 5 0 0 1-5 5H16a5 5 0 0 1-5-5V9a5 5 0 0 1 5-5Z" fill="#FDFEFF" stroke="#D3DFEC" stroke-width="1.5"/><path d="M40 4v9a4 4 0 0 0 4 4h9Z" fill="#B84C89" opacity=".17"/><g fill="none" stroke="#B84C89" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M31 22v12m0-10 10-3v11M26 36c-3 0-4-3-1-4 2-1 6-1 6 1s-2 3-5 3zm10-2c-3 0-4-3-1-4 2-1 6-1 6 1s-2 3-5 3z"/></g><rect x="16" y="42" width="32" height="14" rx="4" fill="#B84C89"/><g fill="#FFF"><path d="M25.26 49.87H22.32L21.86 51.2H19.97L22.67 43.91H24.91L27.61 51.2H25.72ZM22.79 48.52H24.79L23.79 45.62Z"/><path d="M28.58 43.91H30.46V48.28Q30.46 49.18 30.75 49.57Q31.05 49.96 31.72 49.96Q32.39 49.96 32.69 49.57Q32.98 49.18 32.98 48.28V43.91H34.86V48.28Q34.86 49.83 34.08 50.58Q33.31 51.34 31.72 51.34Q30.13 51.34 29.35 50.58Q28.58 49.83 28.58 48.28Z"/><path d="M38.58 45.33V49.78H39.25Q40.4 49.78 41.01 49.21Q41.62 48.64 41.62 47.55Q41.62 46.46 41.01 45.9Q40.41 45.33 39.25 45.33ZM36.7 43.91H38.68Q40.34 43.91 41.15 44.15Q41.97 44.38 42.55 44.95Q43.06 45.44 43.31 46.09Q43.56 46.73 43.56 47.55Q43.56 48.37 43.31 49.02Q43.06 49.67 42.55 50.16Q41.96 50.73 41.14 50.96Q40.32 51.2 38.68 51.2H36.7Z"/></g></svg>',
21
+ 'file-book': '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64"><path d="M16 4h24l13 13v38a5 5 0 0 1-5 5H16a5 5 0 0 1-5-5V9a5 5 0 0 1 5-5Z" fill="#FDFEFF" stroke="#D3DFEC" stroke-width="1.5"/><path d="M40 4v9a4 4 0 0 0 4 4h9Z" fill="#A15D63" opacity=".17"/><g fill="none" stroke="#A15D63" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M32 24c-4-3-8-3-12-2v14c4-1 8-1 12 2 4-3 8-3 12-2V22c-4-1-8-1-12 2zm0 0v14"/></g><rect x="16" y="42" width="32" height="14" rx="4" fill="#A15D63"/><g fill="#FFF"><path d="M21.13 47.27Q21.52 47.27 21.73 47.1Q21.93 46.92 21.93 46.59Q21.93 46.26 21.73 46.08Q21.52 45.91 21.13 45.91H20.22V47.27ZM21.19 50.07Q21.69 50.07 21.94 49.86Q22.19 49.65 22.19 49.23Q22.19 48.81 21.94 48.6Q21.69 48.39 21.19 48.39H20.22V50.07ZM22.73 47.77Q23.26 47.92 23.55 48.34Q23.84 48.76 23.84 49.36Q23.84 50.29 23.22 50.74Q22.59 51.2 21.31 51.2H18.56V44.78H21.05Q22.38 44.78 22.98 45.19Q23.58 45.59 23.58 46.48Q23.58 46.95 23.36 47.28Q23.14 47.61 22.73 47.77Z"/><path d="M28.2 45.87Q27.45 45.87 27.03 46.43Q26.61 46.98 26.61 48Q26.61 49.01 27.03 49.57Q27.45 50.13 28.2 50.13Q28.96 50.13 29.38 49.57Q29.8 49.01 29.8 48Q29.8 46.98 29.38 46.43Q28.96 45.87 28.2 45.87ZM28.2 44.67Q29.75 44.67 30.62 45.55Q31.5 46.44 31.5 48Q31.5 49.55 30.62 50.44Q29.75 51.32 28.2 51.32Q26.66 51.32 25.78 50.44Q24.9 49.55 24.9 48Q24.9 46.44 25.78 45.55Q26.66 44.67 28.2 44.67Z"/><path d="M35.68 45.87Q34.93 45.87 34.51 46.43Q34.09 46.98 34.09 48Q34.09 49.01 34.51 49.57Q34.93 50.13 35.68 50.13Q36.44 50.13 36.86 49.57Q37.28 49.01 37.28 48Q37.28 46.98 36.86 46.43Q36.44 45.87 35.68 45.87ZM35.68 44.67Q37.23 44.67 38.11 45.55Q38.98 46.44 38.98 48Q38.98 49.55 38.11 50.44Q37.23 51.32 35.68 51.32Q34.14 51.32 33.26 50.44Q32.38 49.55 32.38 48Q32.38 46.44 33.26 45.55Q34.14 44.67 35.68 44.67Z"/><path d="M40.23 44.78H41.89V47.13L44.27 44.78H46.19L43.1 47.82L46.51 51.2H44.44L41.89 48.67V51.2H40.23Z"/></g></svg>',
22
+ 'file-code': '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64"><path d="M16 4h24l13 13v38a5 5 0 0 1-5 5H16a5 5 0 0 1-5-5V9a5 5 0 0 1 5-5Z" fill="#FDFEFF" stroke="#D3DFEC" stroke-width="1.5"/><path d="M40 4v9a4 4 0 0 0 4 4h9Z" fill="#446EAB" opacity=".17"/><g fill="none" stroke="#446EAB" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="m28 23-6 6 6 6m8-12 6 6-6 6m-3-15-3 18"/></g><rect x="16" y="42" width="32" height="14" rx="4" fill="#446EAB"/><g fill="#FFF"><path d="M24.27 50.85Q23.81 51.08 23.32 51.2Q22.82 51.32 22.29 51.32Q20.68 51.32 19.75 50.43Q18.81 49.53 18.81 48Q18.81 46.46 19.75 45.56Q20.68 44.67 22.29 44.67Q22.82 44.67 23.32 44.79Q23.81 44.91 24.27 45.15V46.47Q23.81 46.16 23.36 46.01Q22.91 45.87 22.42 45.87Q21.53 45.87 21.03 46.43Q20.52 47 20.52 48Q20.52 48.99 21.03 49.56Q21.53 50.13 22.42 50.13Q22.91 50.13 23.36 49.98Q23.81 49.83 24.27 49.52Z"/><path d="M28.57 45.87Q27.81 45.87 27.4 46.43Q26.98 46.98 26.98 48Q26.98 49.01 27.4 49.57Q27.81 50.13 28.57 50.13Q29.33 50.13 29.75 49.57Q30.16 49.01 30.16 48Q30.16 46.98 29.75 46.43Q29.33 45.87 28.57 45.87ZM28.57 44.67Q30.12 44.67 30.99 45.55Q31.87 46.44 31.87 48Q31.87 49.55 30.99 50.44Q30.12 51.32 28.57 51.32Q27.03 51.32 26.15 50.44Q25.27 49.55 25.27 48Q25.27 46.44 26.15 45.55Q27.03 44.67 28.57 44.67Z"/><path d="M34.77 46.04V49.95H35.37Q36.38 49.95 36.92 49.45Q37.45 48.94 37.45 47.99Q37.45 47.03 36.92 46.53Q36.38 46.04 35.37 46.04ZM33.12 44.78H34.86Q36.32 44.78 37.04 44.99Q37.76 45.2 38.27 45.7Q38.72 46.13 38.94 46.7Q39.16 47.27 39.16 47.99Q39.16 48.71 38.94 49.28Q38.72 49.85 38.27 50.28Q37.75 50.78 37.03 50.99Q36.31 51.2 34.86 51.2H33.12Z"/><path d="M40.42 44.78H44.89V46.04H42.08V47.23H44.72V48.48H42.08V49.95H44.98V51.2H40.42Z"/></g></svg>',
23
+ 'file-css': '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64"><path d="M16 4h24l13 13v38a5 5 0 0 1-5 5H16a5 5 0 0 1-5-5V9a5 5 0 0 1 5-5Z" fill="#FDFEFF" stroke="#D3DFEC" stroke-width="1.5"/><path d="M40 4v9a4 4 0 0 0 4 4h9Z" fill="#3973BB" opacity=".17"/><g fill="none" stroke="#3973BB" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="m28 23-6 6 6 6m8-12 6 6-6 6m-3-15-3 18"/></g><rect x="16" y="42" width="32" height="14" rx="4" fill="#3973BB"/><g fill="#FFF"><path d="M27.83 50.8Q27.31 51.07 26.75 51.2Q26.19 51.34 25.58 51.34Q23.76 51.34 22.69 50.32Q21.63 49.31 21.63 47.56Q21.63 45.81 22.69 44.8Q23.76 43.78 25.58 43.78Q26.19 43.78 26.75 43.91Q27.31 44.05 27.83 44.32V45.83Q27.31 45.47 26.8 45.31Q26.29 45.14 25.73 45.14Q24.72 45.14 24.15 45.78Q23.57 46.43 23.57 47.56Q23.57 48.69 24.15 49.33Q24.72 49.98 25.73 49.98Q26.29 49.98 26.8 49.81Q27.31 49.65 27.83 49.29Z"/><path d="M34.46 44.14V45.68Q33.86 45.41 33.29 45.28Q32.72 45.14 32.21 45.14Q31.53 45.14 31.21 45.33Q30.89 45.51 30.89 45.9Q30.89 46.2 31.11 46.36Q31.32 46.52 31.9 46.64L32.7 46.8Q33.91 47.04 34.42 47.54Q34.94 48.04 34.94 48.96Q34.94 50.16 34.22 50.75Q33.51 51.34 32.04 51.34Q31.34 51.34 30.65 51.21Q29.95 51.08 29.25 50.82V49.23Q29.95 49.6 30.6 49.79Q31.25 49.98 31.86 49.98Q32.47 49.98 32.8 49.77Q33.13 49.57 33.13 49.19Q33.13 48.85 32.9 48.66Q32.68 48.48 32.02 48.33L31.29 48.17Q30.2 47.93 29.69 47.42Q29.19 46.91 29.19 46.04Q29.19 44.95 29.89 44.36Q30.59 43.78 31.91 43.78Q32.51 43.78 33.15 43.87Q33.78 43.96 34.46 44.14Z"/><path d="M41.66 44.14V45.68Q41.06 45.41 40.49 45.28Q39.92 45.14 39.41 45.14Q38.74 45.14 38.41 45.33Q38.09 45.51 38.09 45.9Q38.09 46.2 38.31 46.36Q38.53 46.52 39.1 46.64L39.9 46.8Q41.11 47.04 41.63 47.54Q42.14 48.04 42.14 48.96Q42.14 50.16 41.42 50.75Q40.71 51.34 39.24 51.34Q38.55 51.34 37.85 51.21Q37.15 51.08 36.45 50.82V49.23Q37.15 49.6 37.8 49.79Q38.45 49.98 39.06 49.98Q39.67 49.98 40 49.77Q40.33 49.57 40.33 49.19Q40.33 48.85 40.11 48.66Q39.88 48.48 39.22 48.33L38.49 48.17Q37.4 47.93 36.89 47.42Q36.39 46.91 36.39 46.04Q36.39 44.95 37.09 44.36Q37.79 43.78 39.11 43.78Q39.71 43.78 40.35 43.87Q40.98 43.96 41.66 44.14Z"/></g></svg>',
24
+ 'file-csv': '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64"><path d="M16 4h24l13 13v38a5 5 0 0 1-5 5H16a5 5 0 0 1-5-5V9a5 5 0 0 1 5-5Z" fill="#FDFEFF" stroke="#D3DFEC" stroke-width="1.5"/><path d="M40 4v9a4 4 0 0 0 4 4h9Z" fill="#198360" opacity=".17"/><g fill="none" stroke="#198360" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="22" y="21" width="20" height="15" rx="1.5"/><path d="M22 26h20M22 31h20M29 21v15M36 21v15"/></g><rect x="16" y="42" width="32" height="14" rx="4" fill="#198360"/><g fill="#FFF"><path d="M27.56 50.8Q27.04 51.07 26.48 51.2Q25.92 51.34 25.31 51.34Q23.49 51.34 22.42 50.32Q21.36 49.31 21.36 47.56Q21.36 45.81 22.42 44.8Q23.49 43.78 25.31 43.78Q25.92 43.78 26.48 43.91Q27.04 44.05 27.56 44.32V45.83Q27.04 45.47 26.53 45.31Q26.02 45.14 25.46 45.14Q24.45 45.14 23.88 45.78Q23.3 46.43 23.3 47.56Q23.3 48.69 23.88 49.33Q24.45 49.98 25.46 49.98Q26.02 49.98 26.53 49.81Q27.04 49.65 27.56 49.29Z"/><path d="M34.19 44.14V45.68Q33.59 45.41 33.02 45.28Q32.45 45.14 31.94 45.14Q31.27 45.14 30.94 45.33Q30.62 45.51 30.62 45.9Q30.62 46.2 30.84 46.36Q31.06 46.52 31.63 46.64L32.43 46.8Q33.64 47.04 34.16 47.54Q34.67 48.04 34.67 48.96Q34.67 50.16 33.95 50.75Q33.24 51.34 31.77 51.34Q31.07 51.34 30.38 51.21Q29.68 51.08 28.98 50.82V49.23Q29.68 49.6 30.33 49.79Q30.98 49.98 31.59 49.98Q32.2 49.98 32.53 49.77Q32.86 49.57 32.86 49.19Q32.86 48.85 32.63 48.66Q32.41 48.48 31.75 48.33L31.02 48.17Q29.93 47.93 29.42 47.42Q28.92 46.91 28.92 46.04Q28.92 44.95 29.62 44.36Q30.32 43.78 31.64 43.78Q32.24 43.78 32.88 43.87Q33.51 43.96 34.19 44.14Z"/><path d="M35.45 43.91H37.34L39.27 49.29L41.2 43.91H43.09L40.39 51.2H38.15Z"/></g></svg>',
25
+ 'file-design': '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64"><path d="M16 4h24l13 13v38a5 5 0 0 1-5 5H16a5 5 0 0 1-5-5V9a5 5 0 0 1 5-5Z" fill="#FDFEFF" stroke="#D3DFEC" stroke-width="1.5"/><path d="M40 4v9a4 4 0 0 0 4 4h9Z" fill="#805AB9" opacity=".17"/><g fill="none" stroke="#805AB9" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="m32 21 11 6-11 6-11-6zm-11 11 11 6 11-6"/></g><rect x="16" y="42" width="32" height="14" rx="4" fill="#805AB9"/><g fill="#FFF"><path d="M23.63 45.33V49.78H24.3Q25.46 49.78 26.06 49.21Q26.67 48.64 26.67 47.55Q26.67 46.46 26.07 45.9Q25.46 45.33 24.3 45.33ZM21.75 43.91H23.73Q25.39 43.91 26.21 44.15Q27.02 44.38 27.6 44.95Q28.11 45.44 28.36 46.09Q28.61 46.73 28.61 47.55Q28.61 48.37 28.36 49.02Q28.11 49.67 27.6 50.16Q27.01 50.73 26.19 50.96Q25.37 51.2 23.73 51.2H21.75Z"/><path d="M30.05 43.91H35.12V45.33H31.93V46.69H34.93V48.11H31.93V49.78H35.23V51.2H30.05Z"/><path d="M41.96 44.14V45.68Q41.36 45.41 40.78 45.28Q40.21 45.14 39.71 45.14Q39.03 45.14 38.71 45.33Q38.39 45.51 38.39 45.9Q38.39 46.2 38.6 46.36Q38.82 46.52 39.39 46.64L40.19 46.8Q41.41 47.04 41.92 47.54Q42.43 48.04 42.43 48.96Q42.43 50.16 41.72 50.75Q41 51.34 39.53 51.34Q38.84 51.34 38.14 51.21Q37.44 51.08 36.75 50.82V49.23Q37.44 49.6 38.1 49.79Q38.75 49.98 39.35 49.98Q39.97 49.98 40.3 49.77Q40.62 49.57 40.62 49.19Q40.62 48.85 40.4 48.66Q40.18 48.48 39.51 48.33L38.79 48.17Q37.69 47.93 37.19 47.42Q36.68 46.91 36.68 46.04Q36.68 44.95 37.39 44.36Q38.09 43.78 39.41 43.78Q40.01 43.78 40.64 43.87Q41.28 43.96 41.96 44.14Z"/></g></svg>',
26
+ 'file-document': '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64"><path d="M16 4h24l13 13v38a5 5 0 0 1-5 5H16a5 5 0 0 1-5-5V9a5 5 0 0 1 5-5Z" fill="#FDFEFF" stroke="#D3DFEC" stroke-width="1.5"/><path d="M40 4v9a4 4 0 0 0 4 4h9Z" fill="#3477BE" opacity=".17"/><g fill="none" stroke="#3477BE" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M23 21h17M23 26h17M23 31h12M23 36h16"/></g><rect x="16" y="42" width="32" height="14" rx="4" fill="#3477BE"/><g fill="#FFF"><path d="M22.73 45.33V49.78H23.4Q24.55 49.78 25.16 49.21Q25.77 48.64 25.77 47.55Q25.77 46.46 25.16 45.9Q24.56 45.33 23.4 45.33ZM20.85 43.91H22.83Q24.49 43.91 25.3 44.15Q26.12 44.38 26.7 44.95Q27.21 45.44 27.46 46.09Q27.71 46.73 27.71 47.55Q27.71 48.37 27.46 49.02Q27.21 49.67 26.7 50.16Q26.11 50.73 25.29 50.96Q24.47 51.2 22.83 51.2H20.85Z"/><path d="M32.48 45.14Q31.62 45.14 31.15 45.78Q30.67 46.41 30.67 47.56Q30.67 48.71 31.15 49.34Q31.62 49.98 32.48 49.98Q33.34 49.98 33.82 49.34Q34.29 48.71 34.29 47.56Q34.29 46.41 33.82 45.78Q33.34 45.14 32.48 45.14ZM32.48 43.78Q34.24 43.78 35.23 44.78Q36.23 45.79 36.23 47.56Q36.23 49.33 35.23 50.34Q34.24 51.34 32.48 51.34Q30.73 51.34 29.73 50.34Q28.73 49.33 28.73 47.56Q28.73 45.79 29.73 44.78Q30.73 43.78 32.48 43.78Z"/><path d="M43.43 50.8Q42.91 51.07 42.35 51.2Q41.79 51.34 41.18 51.34Q39.36 51.34 38.29 50.32Q37.23 49.31 37.23 47.56Q37.23 45.81 38.29 44.8Q39.36 43.78 41.18 43.78Q41.79 43.78 42.35 43.91Q42.91 44.05 43.43 44.32V45.83Q42.91 45.47 42.4 45.31Q41.89 45.14 41.33 45.14Q40.33 45.14 39.75 45.78Q39.17 46.43 39.17 47.56Q39.17 48.69 39.75 49.33Q40.33 49.98 41.33 49.98Q41.89 49.98 42.4 49.81Q42.91 49.65 43.43 49.29Z"/></g></svg>',
27
+ 'file-figma': '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64"><path d="M16 4h24l13 13v38a5 5 0 0 1-5 5H16a5 5 0 0 1-5-5V9a5 5 0 0 1 5-5Z" fill="#FDFEFF" stroke="#D3DFEC" stroke-width="1.5"/><path d="M40 4v9a4 4 0 0 0 4 4h9Z" fill="#805AB9" opacity=".17"/><g fill="none" stroke="#805AB9" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="28" cy="24" r="3"/><circle cx="35" cy="24" r="3"/><circle cx="28" cy="31" r="3"/><circle cx="35" cy="31" r="3"/><circle cx="28" cy="38" r="3"/></g><rect x="16" y="42" width="32" height="14" rx="4" fill="#805AB9"/><g fill="#FFF"><path d="M23.54 43.91H28.61V45.33H25.42V46.69H28.42V48.11H25.42V51.2H23.54Z"/><path d="M30.37 43.91H32.25V51.2H30.37Z"/><path d="M40.64 50.66Q39.94 51 39.18 51.17Q38.43 51.34 37.62 51.34Q35.8 51.34 34.73 50.32Q33.67 49.31 33.67 47.56Q33.67 45.8 34.75 44.79Q35.84 43.78 37.72 43.78Q38.45 43.78 39.12 43.91Q39.78 44.05 40.37 44.32V45.83Q39.76 45.48 39.16 45.31Q38.56 45.14 37.95 45.14Q36.83 45.14 36.22 45.77Q35.61 46.4 35.61 47.56Q35.61 48.72 36.2 49.35Q36.79 49.98 37.86 49.98Q38.16 49.98 38.41 49.94Q38.66 49.91 38.86 49.83V48.41H37.71V47.15H40.64Z"/></g></svg>',
28
+ 'file-font': '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64"><path d="M16 4h24l13 13v38a5 5 0 0 1-5 5H16a5 5 0 0 1-5-5V9a5 5 0 0 1 5-5Z" fill="#FDFEFF" stroke="#D3DFEC" stroke-width="1.5"/><path d="M40 4v9a4 4 0 0 0 4 4h9Z" fill="#5E7186" opacity=".17"/><g fill="none" stroke="#5E7186" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="m24 37 8-16 8 16m-13-6h10"/></g><rect x="16" y="42" width="32" height="14" rx="4" fill="#5E7186"/><g fill="#FFF"><path d="M19.38 44.78H23.84V46.04H21.03V47.23H23.67V48.48H21.03V51.2H19.38Z"/><path d="M28.32 45.87Q27.56 45.87 27.15 46.43Q26.73 46.98 26.73 48Q26.73 49.01 27.15 49.57Q27.56 50.13 28.32 50.13Q29.08 50.13 29.5 49.57Q29.91 49.01 29.91 48Q29.91 46.98 29.5 46.43Q29.08 45.87 28.32 45.87ZM28.32 44.67Q29.87 44.67 30.74 45.55Q31.62 46.44 31.62 48Q31.62 49.55 30.74 50.44Q29.87 51.32 28.32 51.32Q26.78 51.32 25.9 50.44Q25.02 49.55 25.02 48Q25.02 46.44 25.9 45.55Q26.78 44.67 28.32 44.67Z"/><path d="M32.87 44.78H34.72L37.05 49.18V44.78H38.62V51.2H36.77L34.44 46.8V51.2H32.87Z"/><path d="M39.47 44.78H45.38V46.04H43.26V51.2H41.6V46.04H39.47Z"/></g></svg>',
29
+ 'file-generic': '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64"><path d="M16 4h24l13 13v38a5 5 0 0 1-5 5H16a5 5 0 0 1-5-5V9a5 5 0 0 1 5-5Z" fill="#FDFEFF" stroke="#D3DFEC" stroke-width="1.5"/><path d="M40 4v9a4 4 0 0 0 4 4h9Z" fill="#61758F" opacity=".17"/><g fill="none" stroke="#61758F" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M23 23h18M23 28h18M23 33h11"/></g><rect x="16" y="42" width="32" height="14" rx="4" fill="#61758F"/><g fill="#FFF"><path d="M22.36 44.78H26.82V46.04H24.01V47.23H26.65V48.48H24.01V51.2H22.36Z"/><path d="M28.37 44.78H30.02V51.2H28.37Z"/><path d="M31.64 44.78H33.3V49.95H36.2V51.2H31.64Z"/><path d="M37.25 44.78H41.71V46.04H38.9V47.23H41.55V48.48H38.9V49.95H41.81V51.2H37.25Z"/></g></svg>',
30
+ 'file-gif': '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64"><path d="M16 4h24l13 13v38a5 5 0 0 1-5 5H16a5 5 0 0 1-5-5V9a5 5 0 0 1 5-5Z" fill="#FDFEFF" stroke="#D3DFEC" stroke-width="1.5"/><path d="M40 4v9a4 4 0 0 0 4 4h9Z" fill="#8255AD" opacity=".17"/><g fill="none" stroke="#8255AD" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="21" y="21" width="22" height="16" rx="2"/><circle cx="36" cy="26" r="1.6"/><path d="m23 34 6-6 4 4 3-3 5 5"/></g><rect x="16" y="42" width="32" height="14" rx="4" fill="#8255AD"/><g fill="#FFF"><path d="M30.09 50.66Q29.39 51 28.63 51.17Q27.87 51.34 27.07 51.34Q25.25 51.34 24.18 50.32Q23.12 49.31 23.12 47.56Q23.12 45.8 24.2 44.79Q25.29 43.78 27.17 43.78Q27.9 43.78 28.56 43.91Q29.23 44.05 29.82 44.32V45.83Q29.21 45.48 28.61 45.31Q28.01 45.14 27.4 45.14Q26.28 45.14 25.67 45.77Q25.06 46.4 25.06 47.56Q25.06 48.72 25.65 49.35Q26.23 49.98 27.31 49.98Q27.61 49.98 27.86 49.94Q28.11 49.91 28.31 49.83V48.41H27.16V47.15H30.09Z"/><path d="M31.75 43.91H33.63V51.2H31.75Z"/><path d="M35.47 43.91H40.54V45.33H37.35V46.69H40.35V48.11H37.35V51.2H35.47Z"/></g></svg>',
31
+ 'file-html': '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64"><path d="M16 4h24l13 13v38a5 5 0 0 1-5 5H16a5 5 0 0 1-5-5V9a5 5 0 0 1 5-5Z" fill="#FDFEFF" stroke="#D3DFEC" stroke-width="1.5"/><path d="M40 4v9a4 4 0 0 0 4 4h9Z" fill="#B35A32" opacity=".17"/><g fill="none" stroke="#B35A32" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="m28 23-6 6 6 6m8-12 6 6-6 6m-3-15-3 18"/></g><rect x="16" y="42" width="32" height="14" rx="4" fill="#B35A32"/><g fill="#FFF"><path d="M18.94 44.78H20.6V47.23H23.04V44.78H24.69V51.2H23.04V48.48H20.6V51.2H18.94Z"/><path d="M25.54 44.78H31.45V46.04H29.33V51.2H27.67V46.04H25.54Z"/><path d="M32.31 44.78H34.41L35.88 48.22L37.35 44.78H39.45V51.2H37.88V46.51L36.4 49.97H35.36L33.88 46.51V51.2H32.31Z"/><path d="M41.07 44.78H42.72V49.95H45.63V51.2H41.07Z"/></g></svg>',
32
+ 'file-image': '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64"><path d="M16 4h24l13 13v38a5 5 0 0 1-5 5H16a5 5 0 0 1-5-5V9a5 5 0 0 1 5-5Z" fill="#FDFEFF" stroke="#D3DFEC" stroke-width="1.5"/><path d="M40 4v9a4 4 0 0 0 4 4h9Z" fill="#8255AD" opacity=".17"/><g fill="none" stroke="#8255AD" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="21" y="21" width="22" height="16" rx="2"/><circle cx="36" cy="26" r="1.6"/><path d="m23 34 6-6 4 4 3-3 5 5"/></g><rect x="16" y="42" width="32" height="14" rx="4" fill="#8255AD"/><g fill="#FFF"><path d="M21.98 43.91H23.86V51.2H21.98Z"/><path d="M25.7 43.91H28.09L29.75 47.81L31.42 43.91H33.81V51.2H32.03V45.87L30.35 49.8H29.16L27.48 45.87V51.2H25.7Z"/><path d="M42.2 50.66Q41.5 51 40.74 51.17Q39.99 51.34 39.18 51.34Q37.36 51.34 36.29 50.32Q35.23 49.31 35.23 47.56Q35.23 45.8 36.31 44.79Q37.4 43.78 39.28 43.78Q40.01 43.78 40.68 43.91Q41.34 44.05 41.93 44.32V45.83Q41.32 45.48 40.72 45.31Q40.12 45.14 39.51 45.14Q38.39 45.14 37.78 45.77Q37.17 46.4 37.17 47.56Q37.17 48.72 37.76 49.35Q38.35 49.98 39.42 49.98Q39.72 49.98 39.97 49.94Q40.22 49.91 40.42 49.83V48.41H39.27V47.15H42.2Z"/></g></svg>',
33
+ 'file-jpg': '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64"><path d="M16 4h24l13 13v38a5 5 0 0 1-5 5H16a5 5 0 0 1-5-5V9a5 5 0 0 1 5-5Z" fill="#FDFEFF" stroke="#D3DFEC" stroke-width="1.5"/><path d="M40 4v9a4 4 0 0 0 4 4h9Z" fill="#8255AD" opacity=".17"/><g fill="none" stroke="#8255AD" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="21" y="21" width="22" height="16" rx="2"/><circle cx="36" cy="26" r="1.6"/><path d="m23 34 6-6 4 4 3-3 5 5"/></g><rect x="16" y="42" width="32" height="14" rx="4" fill="#8255AD"/><g fill="#FFF"><path d="M23.29 43.91H25.17V50.49Q25.17 51.85 24.43 52.53Q23.69 53.2 22.19 53.2H21.81V51.78H22.1Q22.69 51.78 22.99 51.45Q23.29 51.13 23.29 50.49Z"/><path d="M27.01 43.91H30.13Q31.52 43.91 32.27 44.53Q33.01 45.15 33.01 46.29Q33.01 47.44 32.27 48.05Q31.52 48.67 30.13 48.67H28.89V51.2H27.01ZM28.89 45.27V47.31H29.93Q30.48 47.31 30.77 47.04Q31.07 46.78 31.07 46.29Q31.07 45.8 30.77 45.54Q30.48 45.27 29.93 45.27Z"/><path d="M40.89 50.66Q40.19 51 39.43 51.17Q38.67 51.34 37.87 51.34Q36.05 51.34 34.98 50.32Q33.92 49.31 33.92 47.56Q33.92 45.8 35 44.79Q36.09 43.78 37.97 43.78Q38.7 43.78 39.37 43.91Q40.03 44.05 40.62 44.32V45.83Q40.01 45.48 39.41 45.31Q38.81 45.14 38.2 45.14Q37.08 45.14 36.47 45.77Q35.86 46.4 35.86 47.56Q35.86 48.72 36.45 49.35Q37.03 49.98 38.11 49.98Q38.41 49.98 38.66 49.94Q38.91 49.91 39.11 49.83V48.41H37.96V47.15H40.89Z"/></g></svg>',
34
+ 'file-js': '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64"><path d="M16 4h24l13 13v38a5 5 0 0 1-5 5H16a5 5 0 0 1-5-5V9a5 5 0 0 1 5-5Z" fill="#FDFEFF" stroke="#D3DFEC" stroke-width="1.5"/><path d="M40 4v9a4 4 0 0 0 4 4h9Z" fill="#92731D" opacity=".17"/><g fill="none" stroke="#92731D" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="m28 23-6 6 6 6m8-12 6 6-6 6m-3-15-3 18"/></g><rect x="16" y="42" width="32" height="14" rx="4" fill="#92731D"/><g fill="#FFF"><path d="M27.46 43.91H29.34V50.49Q29.34 51.85 28.6 52.53Q27.86 53.2 26.36 53.2H25.98V51.78H26.27Q26.86 51.78 27.16 51.45Q27.46 51.13 27.46 50.49Z"/><path d="M36.25 44.14V45.68Q35.65 45.41 35.08 45.28Q34.51 45.14 34 45.14Q33.33 45.14 33 45.33Q32.68 45.51 32.68 45.9Q32.68 46.2 32.9 46.36Q33.12 46.52 33.69 46.64L34.49 46.8Q35.7 47.04 36.22 47.54Q36.73 48.04 36.73 48.96Q36.73 50.16 36.01 50.75Q35.3 51.34 33.83 51.34Q33.14 51.34 32.44 51.21Q31.74 51.08 31.04 50.82V49.23Q31.74 49.6 32.39 49.79Q33.04 49.98 33.65 49.98Q34.26 49.98 34.59 49.77Q34.92 49.57 34.92 49.19Q34.92 48.85 34.7 48.66Q34.47 48.48 33.81 48.33L33.08 48.17Q31.99 47.93 31.48 47.42Q30.98 46.91 30.98 46.04Q30.98 44.95 31.68 44.36Q32.38 43.78 33.7 43.78Q34.3 43.78 34.94 43.87Q35.57 43.96 36.25 44.14Z"/></g></svg>',
35
+ 'file-json': '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64"><path d="M16 4h24l13 13v38a5 5 0 0 1-5 5H16a5 5 0 0 1-5-5V9a5 5 0 0 1 5-5Z" fill="#FDFEFF" stroke="#D3DFEC" stroke-width="1.5"/><path d="M40 4v9a4 4 0 0 0 4 4h9Z" fill="#446EAB" opacity=".17"/><g fill="none" stroke="#446EAB" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M27 21c-3 0-3 2-3 4v2c0 2-1 2-3 2 2 0 3 1 3 3v2c0 3 0 4 3 4m10-17c3 0 3 2 3 4v2c0 2 1 2 3 2-2 0-3 1-3 3v2c0 3 0 4-3 4"/></g><rect x="16" y="42" width="32" height="14" rx="4" fill="#446EAB"/><g fill="#FFF"><path d="M20.58 44.78H22.23V50.58Q22.23 51.78 21.58 52.37Q20.93 52.96 19.61 52.96H19.28V51.71H19.53Q20.05 51.71 20.31 51.42Q20.58 51.14 20.58 50.58Z"/><path d="M28.32 44.99V46.34Q27.79 46.11 27.29 45.99Q26.78 45.87 26.34 45.87Q25.74 45.87 25.46 46.03Q25.18 46.19 25.18 46.54Q25.18 46.8 25.37 46.94Q25.56 47.08 26.06 47.19L26.77 47.33Q27.84 47.54 28.29 47.98Q28.74 48.42 28.74 49.23Q28.74 50.29 28.11 50.81Q27.48 51.32 26.19 51.32Q25.58 51.32 24.96 51.21Q24.35 51.09 23.73 50.86V49.47Q24.35 49.79 24.92 49.96Q25.49 50.13 26.03 50.13Q26.57 50.13 26.86 49.95Q27.14 49.76 27.14 49.43Q27.14 49.13 26.95 48.97Q26.75 48.8 26.17 48.67L25.53 48.53Q24.57 48.33 24.12 47.87Q23.68 47.42 23.68 46.66Q23.68 45.7 24.3 45.18Q24.91 44.67 26.07 44.67Q26.6 44.67 27.16 44.75Q27.72 44.83 28.32 44.99Z"/><path d="M33.12 45.87Q32.37 45.87 31.95 46.43Q31.53 46.98 31.53 48Q31.53 49.01 31.95 49.57Q32.37 50.13 33.12 50.13Q33.88 50.13 34.3 49.57Q34.72 49.01 34.72 48Q34.72 46.98 34.3 46.43Q33.88 45.87 33.12 45.87ZM33.12 44.67Q34.67 44.67 35.54 45.55Q36.42 46.44 36.42 48Q36.42 49.55 35.54 50.44Q34.67 51.32 33.12 51.32Q31.58 51.32 30.7 50.44Q29.82 49.55 29.82 48Q29.82 46.44 30.7 45.55Q31.58 44.67 33.12 44.67Z"/><path d="M37.67 44.78H39.52L41.85 49.18V44.78H43.42V51.2H41.57L39.24 46.8V51.2H37.67Z"/></g></svg>',
36
+ 'file-markdown': '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64"><path d="M16 4h24l13 13v38a5 5 0 0 1-5 5H16a5 5 0 0 1-5-5V9a5 5 0 0 1 5-5Z" fill="#FDFEFF" stroke="#D3DFEC" stroke-width="1.5"/><path d="M40 4v9a4 4 0 0 0 4 4h9Z" fill="#3477BE" opacity=".17"/><g fill="none" stroke="#3477BE" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21 23v12m0-12 5 7 5-7v12m5-11v10m0 0 4-4m-4 4-4-4"/></g><rect x="16" y="42" width="32" height="14" rx="4" fill="#3477BE"/><g fill="#FFF"><path d="M23.79 43.91H26.18L27.84 47.81L29.51 43.91H31.9V51.2H30.12V45.87L28.45 49.8H27.25L25.57 45.87V51.2H23.79Z"/><path d="M35.62 45.33V49.78H36.3Q37.45 49.78 38.06 49.21Q38.67 48.64 38.67 47.55Q38.67 46.46 38.06 45.9Q37.45 45.33 36.3 45.33ZM33.74 43.91H35.73Q37.39 43.91 38.2 44.15Q39.01 44.38 39.59 44.95Q40.11 45.44 40.35 46.09Q40.6 46.73 40.6 47.55Q40.6 48.37 40.35 49.02Q40.11 49.67 39.59 50.16Q39.01 50.73 38.19 50.96Q37.37 51.2 35.73 51.2H33.74Z"/></g></svg>',
37
+ 'file-mov': '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64"><path d="M16 4h24l13 13v38a5 5 0 0 1-5 5H16a5 5 0 0 1-5-5V9a5 5 0 0 1 5-5Z" fill="#FDFEFF" stroke="#D3DFEC" stroke-width="1.5"/><path d="M40 4v9a4 4 0 0 0 4 4h9Z" fill="#B74068" opacity=".17"/><g fill="none" stroke="#B74068" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="21" y="21" width="22" height="16" rx="3"/><path d="m29 25 8 4-8 4z"/></g><rect x="16" y="42" width="32" height="14" rx="4" fill="#B74068"/><g fill="#FFF"><path d="M19.82 43.91H22.21L23.88 47.81L25.54 43.91H27.93V51.2H26.16V45.87L24.48 49.8H23.28L21.6 45.87V51.2H19.82Z"/><path d="M33.1 45.14Q32.24 45.14 31.77 45.78Q31.3 46.41 31.3 47.56Q31.3 48.71 31.77 49.34Q32.24 49.98 33.1 49.98Q33.97 49.98 34.44 49.34Q34.92 48.71 34.92 47.56Q34.92 46.41 34.44 45.78Q33.97 45.14 33.1 45.14ZM33.1 43.78Q34.86 43.78 35.86 44.78Q36.85 45.79 36.85 47.56Q36.85 49.33 35.86 50.34Q34.86 51.34 33.1 51.34Q31.35 51.34 30.35 50.34Q29.35 49.33 29.35 47.56Q29.35 45.79 30.35 44.78Q31.35 43.78 33.1 43.78Z"/><path d="M37.41 43.91H39.29L41.23 49.29L43.16 43.91H45.05L42.35 51.2H40.11Z"/></g></svg>',
38
+ 'file-mp3': '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64"><path d="M16 4h24l13 13v38a5 5 0 0 1-5 5H16a5 5 0 0 1-5-5V9a5 5 0 0 1 5-5Z" fill="#FDFEFF" stroke="#D3DFEC" stroke-width="1.5"/><path d="M40 4v9a4 4 0 0 0 4 4h9Z" fill="#B84C89" opacity=".17"/><g fill="none" stroke="#B84C89" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M31 22v12m0-10 10-3v11M26 36c-3 0-4-3-1-4 2-1 6-1 6 1s-2 3-5 3zm10-2c-3 0-4-3-1-4 2-1 6-1 6 1s-2 3-5 3z"/></g><rect x="16" y="42" width="32" height="14" rx="4" fill="#B84C89"/><g fill="#FFF"><path d="M20.8 43.91H23.19L24.85 47.81L26.52 43.91H28.91V51.2H27.13V45.87L25.45 49.8H24.26L22.58 45.87V51.2H20.8Z"/><path d="M30.75 43.91H33.87Q35.26 43.91 36.01 44.53Q36.75 45.15 36.75 46.29Q36.75 47.44 36.01 48.05Q35.26 48.67 33.87 48.67H32.63V51.2H30.75ZM32.63 45.27V47.31H33.67Q34.22 47.31 34.51 47.04Q34.81 46.78 34.81 46.29Q34.81 45.8 34.51 45.54Q34.22 45.27 33.67 45.27Z"/><path d="M41.82 47.27Q42.56 47.46 42.94 47.93Q43.32 48.4 43.32 49.13Q43.32 50.21 42.49 50.78Q41.66 51.34 40.07 51.34Q39.51 51.34 38.95 51.25Q38.38 51.16 37.83 50.98V49.53Q38.36 49.79 38.88 49.93Q39.4 50.06 39.9 50.06Q40.65 50.06 41.05 49.8Q41.44 49.54 41.44 49.06Q41.44 48.56 41.04 48.31Q40.63 48.05 39.83 48.05H39.08V46.84H39.87Q40.58 46.84 40.93 46.62Q41.27 46.4 41.27 45.94Q41.27 45.52 40.94 45.29Q40.6 45.06 39.98 45.06Q39.53 45.06 39.07 45.16Q38.6 45.27 38.14 45.47V44.09Q38.7 43.93 39.25 43.86Q39.79 43.78 40.32 43.78Q41.74 43.78 42.45 44.24Q43.15 44.71 43.15 45.65Q43.15 46.29 42.82 46.7Q42.48 47.1 41.82 47.27Z"/></g></svg>',
39
+ 'file-mp4': '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64"><path d="M16 4h24l13 13v38a5 5 0 0 1-5 5H16a5 5 0 0 1-5-5V9a5 5 0 0 1 5-5Z" fill="#FDFEFF" stroke="#D3DFEC" stroke-width="1.5"/><path d="M40 4v9a4 4 0 0 0 4 4h9Z" fill="#B74068" opacity=".17"/><g fill="none" stroke="#B74068" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="21" y="21" width="22" height="16" rx="3"/><path d="m29 25 8 4-8 4z"/></g><rect x="16" y="42" width="32" height="14" rx="4" fill="#B74068"/><g fill="#FFF"><path d="M20.8 43.91H23.19L24.85 47.81L26.52 43.91H28.91V51.2H27.13V45.87L25.45 49.8H24.26L22.58 45.87V51.2H20.8Z"/><path d="M30.75 43.91H33.87Q35.26 43.91 36.01 44.53Q36.75 45.15 36.75 46.29Q36.75 47.44 36.01 48.05Q35.26 48.67 33.87 48.67H32.63V51.2H30.75ZM32.63 45.27V47.31H33.67Q34.22 47.31 34.51 47.04Q34.81 46.78 34.81 46.29Q34.81 45.8 34.51 45.54Q34.22 45.27 33.67 45.27Z"/><path d="M40.84 45.46 38.78 48.51H40.84ZM40.53 43.91H42.62V48.51H43.66V49.87H42.62V51.2H40.84V49.87H37.61V48.26Z"/></g></svg>',
40
+ 'file-pdf': '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64"><path d="M16 4h24l13 13v38a5 5 0 0 1-5 5H16a5 5 0 0 1-5-5V9a5 5 0 0 1 5-5Z" fill="#FDFEFF" stroke="#D3DFEC" stroke-width="1.5"/><path d="M40 4v9a4 4 0 0 0 4 4h9Z" fill="#C7494A" opacity=".17"/><g fill="none" stroke="#C7494A" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="m26 35 6-15 6 15m-10-5h8"/></g><rect x="16" y="42" width="32" height="14" rx="4" fill="#C7494A"/><g fill="#FFF"><path d="M21.69 43.91H24.81Q26.2 43.91 26.94 44.53Q27.69 45.15 27.69 46.29Q27.69 47.44 26.94 48.05Q26.2 48.67 24.81 48.67H23.57V51.2H21.69ZM23.57 45.27V47.31H24.61Q25.15 47.31 25.45 47.04Q25.75 46.78 25.75 46.29Q25.75 45.8 25.45 45.54Q25.15 45.27 24.61 45.27Z"/><path d="M30.9 45.33V49.78H31.57Q32.72 49.78 33.33 49.21Q33.94 48.64 33.94 47.55Q33.94 46.46 33.33 45.9Q32.73 45.33 31.57 45.33ZM29.02 43.91H31Q32.66 43.91 33.47 44.15Q34.29 44.38 34.87 44.95Q35.38 45.44 35.63 46.09Q35.88 46.73 35.88 47.55Q35.88 48.37 35.63 49.02Q35.38 49.67 34.87 50.16Q34.28 50.73 33.46 50.96Q32.64 51.2 31 51.2H29.02Z"/><path d="M37.32 43.91H42.39V45.33H39.2V46.69H42.2V48.11H39.2V51.2H37.32Z"/></g></svg>',
41
+ 'file-png': '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64"><path d="M16 4h24l13 13v38a5 5 0 0 1-5 5H16a5 5 0 0 1-5-5V9a5 5 0 0 1 5-5Z" fill="#FDFEFF" stroke="#D3DFEC" stroke-width="1.5"/><path d="M40 4v9a4 4 0 0 0 4 4h9Z" fill="#8255AD" opacity=".17"/><g fill="none" stroke="#8255AD" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="21" y="21" width="22" height="16" rx="2"/><circle cx="36" cy="26" r="1.6"/><path d="m23 34 6-6 4 4 3-3 5 5"/></g><rect x="16" y="42" width="32" height="14" rx="4" fill="#8255AD"/><g fill="#FFF"><path d="M20.96 43.91H24.08Q25.48 43.91 26.22 44.53Q26.97 45.15 26.97 46.29Q26.97 47.44 26.22 48.05Q25.48 48.67 24.08 48.67H22.84V51.2H20.96ZM22.84 45.27V47.31H23.88Q24.43 47.31 24.73 47.04Q25.03 46.78 25.03 46.29Q25.03 45.8 24.73 45.54Q24.43 45.27 23.88 45.27Z"/><path d="M28.29 43.91H30.39L33.04 48.91V43.91H34.83V51.2H32.73L30.08 46.2V51.2H28.29Z"/><path d="M43.22 50.66Q42.51 51 41.76 51.17Q41 51.34 40.19 51.34Q38.37 51.34 37.31 50.32Q36.24 49.31 36.24 47.56Q36.24 45.8 37.33 44.79Q38.41 43.78 40.3 43.78Q41.02 43.78 41.69 43.91Q42.36 44.05 42.95 44.32V45.83Q42.34 45.48 41.73 45.31Q41.13 45.14 40.53 45.14Q39.4 45.14 38.79 45.77Q38.19 46.4 38.19 47.56Q38.19 48.72 38.77 49.35Q39.36 49.98 40.44 49.98Q40.73 49.98 40.98 49.94Q41.23 49.91 41.43 49.83V48.41H40.29V47.15H43.22Z"/></g></svg>',
42
+ 'file-presentation': '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64"><path d="M16 4h24l13 13v38a5 5 0 0 1-5 5H16a5 5 0 0 1-5-5V9a5 5 0 0 1 5-5Z" fill="#FDFEFF" stroke="#D3DFEC" stroke-width="1.5"/><path d="M40 4v9a4 4 0 0 0 4 4h9Z" fill="#BA622F" opacity=".17"/><g fill="none" stroke="#BA622F" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="21" y="21" width="22" height="14" rx="2"/><path d="m29 24 7 4-7 4zM32 35v3m-6 0h12"/></g><rect x="16" y="42" width="32" height="14" rx="4" fill="#BA622F"/><g fill="#FFF"><path d="M22.18 43.91H25.3Q26.69 43.91 27.43 44.53Q28.18 45.15 28.18 46.29Q28.18 47.44 27.43 48.05Q26.69 48.67 25.3 48.67H24.06V51.2H22.18ZM24.06 45.27V47.31H25.1Q25.65 47.31 25.94 47.04Q26.24 46.78 26.24 46.29Q26.24 45.8 25.94 45.54Q25.65 45.27 25.1 45.27Z"/><path d="M29.51 43.91H32.63Q34.02 43.91 34.76 44.53Q35.51 45.15 35.51 46.29Q35.51 47.44 34.76 48.05Q34.02 48.67 32.63 48.67H31.39V51.2H29.51ZM31.39 45.27V47.31H32.43Q32.97 47.31 33.27 47.04Q33.57 46.78 33.57 46.29Q33.57 45.8 33.27 45.54Q32.97 45.27 32.43 45.27Z"/><path d="M35.97 43.91H42.69V45.33H40.27V51.2H38.39V45.33H35.97Z"/></g></svg>',
43
+ 'file-psd': '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64"><path d="M16 4h24l13 13v38a5 5 0 0 1-5 5H16a5 5 0 0 1-5-5V9a5 5 0 0 1 5-5Z" fill="#FDFEFF" stroke="#D3DFEC" stroke-width="1.5"/><path d="M40 4v9a4 4 0 0 0 4 4h9Z" fill="#805AB9" opacity=".17"/><g fill="none" stroke="#805AB9" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="m32 21 11 6-11 6-11-6zm-11 11 11 6 11-6"/></g><rect x="16" y="42" width="32" height="14" rx="4" fill="#805AB9"/><g fill="#FFF"><path d="M21.5 43.91H24.62Q26.01 43.91 26.76 44.53Q27.5 45.15 27.5 46.29Q27.5 47.44 26.76 48.05Q26.01 48.67 24.62 48.67H23.38V51.2H21.5ZM23.38 45.27V47.31H24.42Q24.97 47.31 25.27 47.04Q25.56 46.78 25.56 46.29Q25.56 45.8 25.27 45.54Q24.97 45.27 24.42 45.27Z"/><path d="M33.9 44.14V45.68Q33.3 45.41 32.73 45.28Q32.16 45.14 31.65 45.14Q30.98 45.14 30.66 45.33Q30.33 45.51 30.33 45.9Q30.33 46.2 30.55 46.36Q30.77 46.52 31.34 46.64L32.14 46.8Q33.36 47.04 33.87 47.54Q34.38 48.04 34.38 48.96Q34.38 50.16 33.67 50.75Q32.95 51.34 31.48 51.34Q30.79 51.34 30.09 51.21Q29.39 51.08 28.69 50.82V49.23Q29.39 49.6 30.04 49.79Q30.7 49.98 31.3 49.98Q31.92 49.98 32.24 49.77Q32.57 49.57 32.57 49.19Q32.57 48.85 32.35 48.66Q32.13 48.48 31.46 48.33L30.74 48.17Q29.64 47.93 29.14 47.42Q28.63 46.91 28.63 46.04Q28.63 44.95 29.33 44.36Q30.04 43.78 31.36 43.78Q31.96 43.78 32.59 43.87Q33.23 43.96 33.9 44.14Z"/><path d="M37.91 45.33V49.78H38.59Q39.74 49.78 40.35 49.21Q40.96 48.64 40.96 47.55Q40.96 46.46 40.35 45.9Q39.74 45.33 38.59 45.33ZM36.03 43.91H38.02Q39.68 43.91 40.49 44.15Q41.3 44.38 41.88 44.95Q42.4 45.44 42.64 46.09Q42.89 46.73 42.89 47.55Q42.89 48.37 42.64 49.02Q42.4 49.67 41.88 50.16Q41.3 50.73 40.48 50.96Q39.66 51.2 38.02 51.2H36.03Z"/></g></svg>',
44
+ 'file-python': '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64"><path d="M16 4h24l13 13v38a5 5 0 0 1-5 5H16a5 5 0 0 1-5-5V9a5 5 0 0 1 5-5Z" fill="#FDFEFF" stroke="#D3DFEC" stroke-width="1.5"/><path d="M40 4v9a4 4 0 0 0 4 4h9Z" fill="#446EAB" opacity=".17"/><g fill="none" stroke="#446EAB" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M27 21c-3 0-3 2-3 4v2c0 2-1 2-3 2 2 0 3 1 3 3v2c0 3 0 4 3 4m10-17c3 0 3 2 3 4v2c0 2 1 2 3 2-2 0-3 1-3 3v2c0 3 0 4-3 4"/></g><rect x="16" y="42" width="32" height="14" rx="4" fill="#446EAB"/><g fill="#FFF"><path d="M25.63 43.91H28.75Q30.14 43.91 30.89 44.53Q31.63 45.15 31.63 46.29Q31.63 47.44 30.89 48.05Q30.14 48.67 28.75 48.67H27.51V51.2H25.63ZM27.51 45.27V47.31H28.55Q29.1 47.31 29.4 47.04Q29.7 46.78 29.7 46.29Q29.7 45.8 29.4 45.54Q29.1 45.27 28.55 45.27Z"/><path d="M31.95 43.91H34L35.66 46.51L37.32 43.91H39.38L36.6 48.13V51.2H34.72V48.13Z"/></g></svg>',
45
+ 'file-rar': '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64"><path d="M16 4h24l13 13v38a5 5 0 0 1-5 5H16a5 5 0 0 1-5-5V9a5 5 0 0 1 5-5Z" fill="#FDFEFF" stroke="#D3DFEC" stroke-width="1.5"/><path d="M40 4v9a4 4 0 0 0 4 4h9Z" fill="#926923" opacity=".17"/><g fill="none" stroke="#926923" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="22" y="23" width="20" height="14" rx="2"/><path d="M24 20h16v3M31 23v9m3-7-2 2 2 2-2 2"/></g><rect x="16" y="42" width="32" height="14" rx="4" fill="#926923"/><g fill="#FFF"><path d="M24.02 47.14Q24.61 47.14 24.87 46.92Q25.12 46.7 25.12 46.2Q25.12 45.7 24.87 45.49Q24.61 45.27 24.02 45.27H23.23V47.14ZM23.23 48.44V51.2H21.35V43.91H24.22Q25.66 43.91 26.33 44.39Q27 44.88 27 45.92Q27 46.64 26.65 47.11Q26.3 47.57 25.6 47.79Q25.99 47.88 26.29 48.19Q26.6 48.5 26.91 49.13L27.93 51.2H25.93L25.04 49.39Q24.77 48.84 24.5 48.64Q24.22 48.44 23.76 48.44Z"/><path d="M33.47 49.87H30.53L30.07 51.2H28.18L30.88 43.91H33.12L35.82 51.2H33.93ZM31 48.52H33L32 45.62Z"/><path d="M39.46 47.14Q40.05 47.14 40.31 46.92Q40.56 46.7 40.56 46.2Q40.56 45.7 40.31 45.49Q40.05 45.27 39.46 45.27H38.67V47.14ZM38.67 48.44V51.2H36.79V43.91H39.66Q41.1 43.91 41.77 44.39Q42.44 44.88 42.44 45.92Q42.44 46.64 42.09 47.11Q41.74 47.57 41.04 47.79Q41.43 47.88 41.73 48.19Q42.04 48.5 42.35 49.13L43.37 51.2H41.37L40.48 49.39Q40.21 48.84 39.93 48.64Q39.66 48.44 39.2 48.44Z"/></g></svg>',
46
+ 'file-spreadsheet': '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64"><path d="M16 4h24l13 13v38a5 5 0 0 1-5 5H16a5 5 0 0 1-5-5V9a5 5 0 0 1 5-5Z" fill="#FDFEFF" stroke="#D3DFEC" stroke-width="1.5"/><path d="M40 4v9a4 4 0 0 0 4 4h9Z" fill="#198360" opacity=".17"/><g fill="none" stroke="#198360" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="22" y="21" width="20" height="15" rx="1.5"/><path d="M22 26h20M22 31h20M29 21v15M36 21v15"/></g><rect x="16" y="42" width="32" height="14" rx="4" fill="#198360"/><g fill="#FFF"><path d="M26.34 47.48 28.87 51.2H26.91L25.21 48.71L23.52 51.2H21.55L24.08 47.48L21.65 43.91H23.61L25.21 46.26L26.8 43.91H28.77Z"/><path d="M29.99 43.91H31.87V49.78H35.17V51.2H29.99Z"/><path d="M41.43 44.14V45.68Q40.83 45.41 40.26 45.28Q39.69 45.14 39.18 45.14Q38.51 45.14 38.18 45.33Q37.86 45.51 37.86 45.9Q37.86 46.2 38.08 46.36Q38.3 46.52 38.87 46.64L39.67 46.8Q40.88 47.04 41.4 47.54Q41.91 48.04 41.91 48.96Q41.91 50.16 41.19 50.75Q40.48 51.34 39.01 51.34Q38.32 51.34 37.62 51.21Q36.92 51.08 36.22 50.82V49.23Q36.92 49.6 37.57 49.79Q38.22 49.98 38.83 49.98Q39.44 49.98 39.77 49.77Q40.1 49.57 40.1 49.19Q40.1 48.85 39.88 48.66Q39.65 48.48 38.99 48.33L38.26 48.17Q37.17 47.93 36.66 47.42Q36.16 46.91 36.16 46.04Q36.16 44.95 36.86 44.36Q37.56 43.78 38.88 43.78Q39.48 43.78 40.12 43.87Q40.75 43.96 41.43 44.14Z"/></g></svg>',
47
+ 'file-sql': '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64"><path d="M16 4h24l13 13v38a5 5 0 0 1-5 5H16a5 5 0 0 1-5-5V9a5 5 0 0 1 5-5Z" fill="#FDFEFF" stroke="#D3DFEC" stroke-width="1.5"/><path d="M40 4v9a4 4 0 0 0 4 4h9Z" fill="#397994" opacity=".17"/><g fill="none" stroke="#397994" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><ellipse cx="32" cy="23" rx="10" ry="3.5"/><path d="M22 23v11c0 5 20 5 20 0V23m-20 6c0 5 20 5 20 0"/></g><rect x="16" y="42" width="32" height="14" rx="4" fill="#397994"/><g fill="#FFF"><path d="M26.95 44.14V45.68Q26.35 45.41 25.78 45.28Q25.21 45.14 24.7 45.14Q24.03 45.14 23.71 45.33Q23.38 45.51 23.38 45.9Q23.38 46.2 23.6 46.36Q23.82 46.52 24.39 46.64L25.19 46.8Q26.41 47.04 26.92 47.54Q27.43 48.04 27.43 48.96Q27.43 50.16 26.72 50.75Q26 51.34 24.53 51.34Q23.84 51.34 23.14 51.21Q22.44 51.08 21.74 50.82V49.23Q22.44 49.6 23.09 49.79Q23.75 49.98 24.35 49.98Q24.97 49.98 25.29 49.77Q25.62 49.57 25.62 49.19Q25.62 48.85 25.4 48.66Q25.18 48.48 24.51 48.33L23.78 48.17Q22.69 47.93 22.19 47.42Q21.68 46.91 21.68 46.04Q21.68 44.95 22.38 44.36Q23.09 43.78 24.4 43.78Q25.01 43.78 25.64 43.87Q26.27 43.96 26.95 44.14Z"/><path d="M32.61 51.33H32.47Q30.66 51.33 29.66 50.34Q28.66 49.34 28.66 47.56Q28.66 45.79 29.66 44.78Q30.66 43.78 32.41 43.78Q34.19 43.78 35.17 44.77Q36.16 45.77 36.16 47.56Q36.16 48.79 35.64 49.68Q35.11 50.57 34.13 51.02L35.6 52.66H33.8ZM32.41 45.14Q31.55 45.14 31.08 45.78Q30.61 46.41 30.61 47.56Q30.61 48.73 31.07 49.36Q31.53 49.98 32.41 49.98Q33.28 49.98 33.75 49.34Q34.22 48.71 34.22 47.56Q34.22 46.41 33.75 45.78Q33.28 45.14 32.41 45.14Z"/><path d="M37.58 43.91H39.46V49.78H42.76V51.2H37.58Z"/></g></svg>',
48
+ 'file-svg': '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64"><path d="M16 4h24l13 13v38a5 5 0 0 1-5 5H16a5 5 0 0 1-5-5V9a5 5 0 0 1 5-5Z" fill="#FDFEFF" stroke="#D3DFEC" stroke-width="1.5"/><path d="M40 4v9a4 4 0 0 0 4 4h9Z" fill="#805AB9" opacity=".17"/><g fill="none" stroke="#805AB9" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M23 35c4-13 14-13 18 0M24 35h16"/><rect x="20" y="32" width="5" height="5" rx=".8"/><rect x="39" y="32" width="5" height="5" rx=".8"/><circle cx="32" cy="24" r="2"/></g><rect x="16" y="42" width="32" height="14" rx="4" fill="#805AB9"/><g fill="#FFF"><path d="M26.42 44.14V45.68Q25.82 45.41 25.24 45.28Q24.67 45.14 24.17 45.14Q23.49 45.14 23.17 45.33Q22.85 45.51 22.85 45.9Q22.85 46.2 23.06 46.36Q23.28 46.52 23.85 46.64L24.65 46.8Q25.87 47.04 26.38 47.54Q26.9 48.04 26.9 48.96Q26.9 50.16 26.18 50.75Q25.46 51.34 23.99 51.34Q23.3 51.34 22.6 51.21Q21.9 51.08 21.21 50.82V49.23Q21.9 49.6 22.56 49.79Q23.21 49.98 23.81 49.98Q24.43 49.98 24.76 49.77Q25.08 49.57 25.08 49.19Q25.08 48.85 24.86 48.66Q24.64 48.48 23.98 48.33L23.25 48.17Q22.15 47.93 21.65 47.42Q21.14 46.91 21.14 46.04Q21.14 44.95 21.85 44.36Q22.55 43.78 23.87 43.78Q24.47 43.78 25.1 43.87Q25.74 43.96 26.42 44.14Z"/><path d="M27.68 43.91H29.57L31.5 49.29L33.43 43.91H35.32L32.62 51.2H30.38Z"/><path d="M42.84 50.66Q42.13 51 41.38 51.17Q40.62 51.34 39.81 51.34Q37.99 51.34 36.93 50.32Q35.86 49.31 35.86 47.56Q35.86 45.8 36.95 44.79Q38.03 43.78 39.92 43.78Q40.65 43.78 41.31 43.91Q41.98 44.05 42.57 44.32V45.83Q41.96 45.48 41.36 45.31Q40.75 45.14 40.15 45.14Q39.02 45.14 38.42 45.77Q37.81 46.4 37.81 47.56Q37.81 48.72 38.39 49.35Q38.98 49.98 40.06 49.98Q40.35 49.98 40.6 49.94Q40.85 49.91 41.06 49.83V48.41H39.91V47.15H42.84Z"/></g></svg>',
49
+ 'file-tar': '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64"><path d="M16 4h24l13 13v38a5 5 0 0 1-5 5H16a5 5 0 0 1-5-5V9a5 5 0 0 1 5-5Z" fill="#FDFEFF" stroke="#D3DFEC" stroke-width="1.5"/><path d="M40 4v9a4 4 0 0 0 4 4h9Z" fill="#926923" opacity=".17"/><g fill="none" stroke="#926923" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="22" y="23" width="20" height="14" rx="2"/><path d="M24 20h16v3M31 23v9m3-7-2 2 2 2-2 2"/></g><rect x="16" y="42" width="32" height="14" rx="4" fill="#926923"/><g fill="#FFF"><path d="M20.92 43.91H27.64V45.33H25.22V51.2H23.34V45.33H20.92Z"/><path d="M33.03 49.87H30.09L29.63 51.2H27.74L30.44 43.91H32.68L35.38 51.2H33.49ZM30.56 48.52H32.56L31.56 45.62Z"/><path d="M39.02 47.14Q39.61 47.14 39.87 46.92Q40.12 46.7 40.12 46.2Q40.12 45.7 39.87 45.49Q39.61 45.27 39.02 45.27H38.23V47.14ZM38.23 48.44V51.2H36.35V43.91H39.22Q40.66 43.91 41.33 44.39Q42 44.88 42 45.92Q42 46.64 41.65 47.11Q41.3 47.57 40.6 47.79Q40.99 47.88 41.29 48.19Q41.6 48.5 41.91 49.13L42.93 51.2H40.93L40.04 49.39Q39.77 48.84 39.5 48.64Q39.22 48.44 38.76 48.44Z"/></g></svg>',
50
+ 'file-text': '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64"><path d="M16 4h24l13 13v38a5 5 0 0 1-5 5H16a5 5 0 0 1-5-5V9a5 5 0 0 1 5-5Z" fill="#FDFEFF" stroke="#D3DFEC" stroke-width="1.5"/><path d="M40 4v9a4 4 0 0 0 4 4h9Z" fill="#61758F" opacity=".17"/><g fill="none" stroke="#61758F" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M23 21h17M23 26h17M23 31h12M23 36h16"/></g><rect x="16" y="42" width="32" height="14" rx="4" fill="#61758F"/><g fill="#FFF"><path d="M21.37 43.91H28.09V45.33H25.67V51.2H23.79V45.33H21.37Z"/><path d="M33.13 47.48 35.65 51.2H33.7L31.99 48.71L30.3 51.2H28.34L30.86 47.48L28.43 43.91H30.4L31.99 46.26L33.58 43.91H35.56Z"/><path d="M35.9 43.91H42.62V45.33H40.21V51.2H38.33V45.33H35.9Z"/></g></svg>',
51
+ 'file-ts': '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64"><path d="M16 4h24l13 13v38a5 5 0 0 1-5 5H16a5 5 0 0 1-5-5V9a5 5 0 0 1 5-5Z" fill="#FDFEFF" stroke="#D3DFEC" stroke-width="1.5"/><path d="M40 4v9a4 4 0 0 0 4 4h9Z" fill="#446EAB" opacity=".17"/><g fill="none" stroke="#446EAB" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="m28 23-6 6 6 6m8-12 6 6-6 6m-3-15-3 18"/></g><rect x="16" y="42" width="32" height="14" rx="4" fill="#446EAB"/><g fill="#FFF"><path d="M25.04 43.91H31.76V45.33H29.34V51.2H27.46V45.33H25.04Z"/><path d="M37.8 44.14V45.68Q37.2 45.41 36.63 45.28Q36.06 45.14 35.55 45.14Q34.88 45.14 34.55 45.33Q34.23 45.51 34.23 45.9Q34.23 46.2 34.45 46.36Q34.67 46.52 35.24 46.64L36.04 46.8Q37.25 47.04 37.77 47.54Q38.28 48.04 38.28 48.96Q38.28 50.16 37.56 50.75Q36.85 51.34 35.38 51.34Q34.69 51.34 33.99 51.21Q33.29 51.08 32.59 50.82V49.23Q33.29 49.6 33.94 49.79Q34.59 49.98 35.2 49.98Q35.81 49.98 36.14 49.77Q36.47 49.57 36.47 49.19Q36.47 48.85 36.25 48.66Q36.02 48.48 35.36 48.33L34.63 48.17Q33.54 47.93 33.03 47.42Q32.53 46.91 32.53 46.04Q32.53 44.95 33.23 44.36Q33.93 43.78 35.25 43.78Q35.85 43.78 36.49 43.87Q37.12 43.96 37.8 44.14Z"/></g></svg>',
52
+ 'file-video': '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64"><path d="M16 4h24l13 13v38a5 5 0 0 1-5 5H16a5 5 0 0 1-5-5V9a5 5 0 0 1 5-5Z" fill="#FDFEFF" stroke="#D3DFEC" stroke-width="1.5"/><path d="M40 4v9a4 4 0 0 0 4 4h9Z" fill="#B74068" opacity=".17"/><g fill="none" stroke="#B74068" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="21" y="21" width="22" height="16" rx="3"/><path d="m29 25 8 4-8 4z"/></g><rect x="16" y="42" width="32" height="14" rx="4" fill="#B74068"/><g fill="#FFF"><path d="M22.17 43.91H24.06L25.99 49.29L27.92 43.91H29.81L27.11 51.2H24.87Z"/><path d="M30.78 43.91H32.66V51.2H30.78Z"/><path d="M36.38 45.33V49.78H37.05Q38.2 49.78 38.81 49.21Q39.42 48.64 39.42 47.55Q39.42 46.46 38.81 45.9Q38.21 45.33 37.05 45.33ZM34.5 43.91H36.48Q38.14 43.91 38.95 44.15Q39.77 44.38 40.35 44.95Q40.86 45.44 41.11 46.09Q41.36 46.73 41.36 47.55Q41.36 48.37 41.11 49.02Q40.86 49.67 40.35 50.16Q39.76 50.73 38.94 50.96Q38.12 51.2 36.48 51.2H34.5Z"/></g></svg>',
53
+ 'file-wav': '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64"><path d="M16 4h24l13 13v38a5 5 0 0 1-5 5H16a5 5 0 0 1-5-5V9a5 5 0 0 1 5-5Z" fill="#FDFEFF" stroke="#D3DFEC" stroke-width="1.5"/><path d="M40 4v9a4 4 0 0 0 4 4h9Z" fill="#B84C89" opacity=".17"/><g fill="none" stroke="#B84C89" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M22 30v-4m4 9V22m4 15V21m4 12v-7m4 9V23m4 7v-5"/></g><rect x="16" y="42" width="32" height="14" rx="4" fill="#B84C89"/><g fill="#FFF"><path d="M19.04 43.91H20.85L22.1 49.21L23.35 43.91H25.17L26.42 49.21L27.68 43.91H29.46L27.74 51.2H25.58L24.25 45.66L22.94 51.2H20.78Z"/><path d="M35.12 49.87H32.18L31.71 51.2H29.82L32.52 43.91H34.77L37.47 51.2H35.58ZM32.65 48.52H34.64L33.65 45.62Z"/><path d="M37.56 43.91H39.45L41.39 49.29L43.32 43.91H45.21L42.51 51.2H40.26Z"/></g></svg>',
54
+ 'file-webp': '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64"><path d="M16 4h24l13 13v38a5 5 0 0 1-5 5H16a5 5 0 0 1-5-5V9a5 5 0 0 1 5-5Z" fill="#FDFEFF" stroke="#D3DFEC" stroke-width="1.5"/><path d="M40 4v9a4 4 0 0 0 4 4h9Z" fill="#8255AD" opacity=".17"/><g fill="none" stroke="#8255AD" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="21" y="21" width="22" height="16" rx="2"/><circle cx="36" cy="26" r="1.6"/><path d="m23 34 6-6 4 4 3-3 5 5"/></g><rect x="16" y="42" width="32" height="14" rx="4" fill="#8255AD"/><g fill="#FFF"><path d="M17.82 44.78H19.41L20.52 49.45L21.62 44.78H23.21L24.31 49.45L25.42 44.78H26.99L25.48 51.2H23.57L22.41 46.32L21.26 51.2H19.35Z"/><path d="M28.08 44.78H32.54V46.04H29.73V47.23H32.37V48.48H29.73V49.95H32.64V51.2H28.08Z"/><path d="M36.66 47.27Q37.05 47.27 37.25 47.1Q37.45 46.92 37.45 46.59Q37.45 46.26 37.25 46.08Q37.05 45.91 36.66 45.91H35.74V47.27ZM36.71 50.07Q37.21 50.07 37.46 49.86Q37.71 49.65 37.71 49.23Q37.71 48.81 37.47 48.6Q37.22 48.39 36.71 48.39H35.74V50.07ZM38.25 47.77Q38.78 47.92 39.08 48.34Q39.37 48.76 39.37 49.36Q39.37 50.29 38.74 50.74Q38.11 51.2 36.83 51.2H34.09V44.78H36.57Q37.91 44.78 38.51 45.19Q39.11 45.59 39.11 46.48Q39.11 46.95 38.89 47.28Q38.67 47.61 38.25 47.77Z"/><path d="M40.8 44.78H43.54Q44.77 44.78 45.42 45.33Q46.08 45.87 46.08 46.88Q46.08 47.89 45.42 48.43Q44.77 48.97 43.54 48.97H42.45V51.2H40.8ZM42.45 45.98V47.78H43.37Q43.85 47.78 44.11 47.54Q44.37 47.31 44.37 46.88Q44.37 46.45 44.11 46.22Q43.85 45.98 43.37 45.98Z"/></g></svg>',
55
+ 'file-xml': '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64"><path d="M16 4h24l13 13v38a5 5 0 0 1-5 5H16a5 5 0 0 1-5-5V9a5 5 0 0 1 5-5Z" fill="#FDFEFF" stroke="#D3DFEC" stroke-width="1.5"/><path d="M40 4v9a4 4 0 0 0 4 4h9Z" fill="#446EAB" opacity=".17"/><g fill="none" stroke="#446EAB" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="m28 23-6 6 6 6m8-12 6 6-6 6m-3-15-3 18"/></g><rect x="16" y="42" width="32" height="14" rx="4" fill="#446EAB"/><g fill="#FFF"><path d="M24.96 47.48 27.49 51.2H25.54L23.83 48.71L22.14 51.2H20.17L22.7 47.48L20.27 43.91H22.23L23.83 46.26L25.42 43.91H27.4Z"/><path d="M28.61 43.91H31L32.66 47.81L34.33 43.91H36.72V51.2H34.94V45.87L33.26 49.8H32.07L30.39 45.87V51.2H28.61Z"/><path d="M38.56 43.91H40.44V49.78H43.74V51.2H38.56Z"/></g></svg>',
56
+ 'file-yaml': '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64"><path d="M16 4h24l13 13v38a5 5 0 0 1-5 5H16a5 5 0 0 1-5-5V9a5 5 0 0 1 5-5Z" fill="#FDFEFF" stroke="#D3DFEC" stroke-width="1.5"/><path d="M40 4v9a4 4 0 0 0 4 4h9Z" fill="#805AB9" opacity=".17"/><g fill="none" stroke="#805AB9" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M27 21c-3 0-3 2-3 4v2c0 2-1 2-3 2 2 0 3 1 3 3v2c0 3 0 4 3 4m10-17c3 0 3 2 3 4v2c0 2 1 2 3 2-2 0-3 1-3 3v2c0 3 0 4-3 4"/></g><rect x="16" y="42" width="32" height="14" rx="4" fill="#805AB9"/><g fill="#FFF"><path d="M18.14 44.78H19.95L21.41 47.07L22.87 44.78H24.68L22.24 48.5V51.2H20.59V48.5Z"/><path d="M29.3 50.03H26.71L26.3 51.2H24.64L27.02 44.78H28.99L31.37 51.2H29.7ZM27.13 48.84H28.88L28.01 46.29Z"/><path d="M32.22 44.78H34.32L35.78 48.22L37.25 44.78H39.35V51.2H37.79V46.51L36.31 49.97H35.26L33.79 46.51V51.2H32.22Z"/><path d="M40.97 44.78H42.63V49.95H45.53V51.2H40.97Z"/></g></svg>',
57
+ 'file-zip': '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64"><path d="M16 4h24l13 13v38a5 5 0 0 1-5 5H16a5 5 0 0 1-5-5V9a5 5 0 0 1 5-5Z" fill="#FDFEFF" stroke="#D3DFEC" stroke-width="1.5"/><path d="M40 4v9a4 4 0 0 0 4 4h9Z" fill="#926923" opacity=".17"/><g fill="none" stroke="#926923" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="22" y="23" width="20" height="14" rx="2"/><path d="M24 20h16v3M31 23v9m3-7-2 2 2 2-2 2"/></g><rect x="16" y="42" width="32" height="14" rx="4" fill="#926923"/><g fill="#FFF"><path d="M23.41 43.91H29.54V45.05L25.63 49.78H29.65V51.2H23.3V50.06L27.21 45.33H23.41Z"/><path d="M31.02 43.91H32.9V51.2H31.02Z"/><path d="M34.74 43.91H37.86Q39.25 43.91 40 44.53Q40.74 45.15 40.74 46.29Q40.74 47.44 40 48.05Q39.25 48.67 37.86 48.67H36.62V51.2H34.74ZM36.62 45.27V47.31H37.66Q38.21 47.31 38.5 47.04Q38.8 46.78 38.8 46.29Q38.8 45.8 38.5 45.54Q38.21 45.27 37.66 45.27Z"/></g></svg>',
58
+ 'folder-closed': '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64"><path d="M7 20a5 5 0 0 1 5-5h14l6 6h20a5 5 0 0 1 5 5v26a5 5 0 0 1-5 5H12a5 5 0 0 1-5-5Z" fill="#DFA041" stroke="#B87E28" stroke-width="1.5"/><path d="M8 30a4 4 0 0 1 4-4h40a4 4 0 0 1 4 4v22a4 4 0 0 1-4 4H12a4 4 0 0 1-4-4Z" fill="#F3C36B"/><path d="M12 29h39" stroke="#FFE5A8" stroke-width="1.5" stroke-linecap="round"/></svg>',
59
+ 'folder-open': '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64"><path d="M7 23a5 5 0 0 1 5-5h13l6 6h21a5 5 0 0 1 5 5v23H7Z" fill="#DCA044" stroke="#B87E28" stroke-width="1.5"/><path d="M10 29h40v22H10Z" fill="#FFE2A2"/><path d="M5 35a5 5 0 0 1 5-5h14l5-5h26c4 0 5 2 4 5l-6 22a6 6 0 0 1-6 5H12a6 6 0 0 1-6-5Z" fill="#F3C36B" stroke="#B87E28" stroke-width="1.5"/><path d="M12 34h38" stroke="#FFE7AE" stroke-width="1.5" stroke-linecap="round"/></svg>',
60
+ };
61
+ /** Lower-case extension (including compound ones such as `tar.gz`) → icon. */
62
+ const SD_FILE_EXPLORER_ICON_EXTENSIONS = {
63
+ '7z': 'file-7z',
64
+ aac: 'file-audio',
65
+ ai: 'file-ai',
66
+ aiff: 'file-audio',
67
+ apk: 'file-app',
68
+ apng: 'file-png',
69
+ avi: 'file-video',
70
+ avif: 'file-image',
71
+ azw3: 'file-book',
72
+ blend: 'file-3d',
73
+ bmp: 'file-image',
74
+ bz2: 'file-archive',
75
+ c: 'file-code',
76
+ cjs: 'file-js',
77
+ cpp: 'file-code',
78
+ cs: 'file-code',
79
+ css: 'file-css',
80
+ csv: 'file-csv',
81
+ cts: 'file-ts',
82
+ 'd.ts': 'file-ts',
83
+ db: 'file-sql',
84
+ deb: 'file-app',
85
+ dmg: 'file-app',
86
+ doc: 'file-document',
87
+ docx: 'file-document',
88
+ dwg: 'file-3d',
89
+ dxf: 'file-3d',
90
+ env: 'file-code',
91
+ eps: 'file-design',
92
+ epub: 'file-book',
93
+ exe: 'file-app',
94
+ fbx: 'file-3d',
95
+ fig: 'file-figma',
96
+ flac: 'file-audio',
97
+ gif: 'file-gif',
98
+ gitignore: 'file-code',
99
+ glb: 'file-3d',
100
+ gltf: 'file-3d',
101
+ go: 'file-code',
102
+ gz: 'file-archive',
103
+ h: 'file-code',
104
+ heic: 'file-image',
105
+ heif: 'file-image',
106
+ htm: 'file-html',
107
+ html: 'file-html',
108
+ ico: 'file-image',
109
+ indd: 'file-design',
110
+ ipa: 'file-app',
111
+ ipynb: 'file-python',
112
+ java: 'file-code',
113
+ jpe: 'file-jpg',
114
+ jpeg: 'file-jpg',
115
+ jpg: 'file-jpg',
116
+ js: 'file-js',
117
+ json: 'file-json',
118
+ json5: 'file-json',
119
+ jsonl: 'file-json',
120
+ jsx: 'file-js',
121
+ key: 'file-presentation',
122
+ kt: 'file-code',
123
+ less: 'file-css',
124
+ log: 'file-text',
125
+ m4a: 'file-audio',
126
+ m4v: 'file-mp4',
127
+ markdown: 'file-markdown',
128
+ md: 'file-markdown',
129
+ mjs: 'file-js',
130
+ mkv: 'file-video',
131
+ mobi: 'file-book',
132
+ mov: 'file-mov',
133
+ mp3: 'file-mp3',
134
+ mp4: 'file-mp4',
135
+ mpeg: 'file-video',
136
+ mpg: 'file-video',
137
+ msi: 'file-app',
138
+ mts: 'file-ts',
139
+ numbers: 'file-spreadsheet',
140
+ obj: 'file-3d',
141
+ odp: 'file-presentation',
142
+ ods: 'file-spreadsheet',
143
+ odt: 'file-document',
144
+ ogg: 'file-audio',
145
+ opus: 'file-audio',
146
+ otf: 'file-font',
147
+ pages: 'file-document',
148
+ pdf: 'file-pdf',
149
+ php: 'file-code',
150
+ png: 'file-png',
151
+ ppt: 'file-presentation',
152
+ pptx: 'file-presentation',
153
+ psd: 'file-psd',
154
+ py: 'file-python',
155
+ rar: 'file-rar',
156
+ raw: 'file-image',
157
+ rb: 'file-code',
158
+ rpm: 'file-app',
159
+ rs: 'file-code',
160
+ rtf: 'file-document',
161
+ scss: 'file-css',
162
+ sh: 'file-code',
163
+ sketch: 'file-design',
164
+ sql: 'file-sql',
165
+ sqlite: 'file-sql',
166
+ stl: 'file-3d',
167
+ svelte: 'file-code',
168
+ svg: 'file-svg',
169
+ swift: 'file-code',
170
+ tar: 'file-tar',
171
+ 'tar.bz2': 'file-tar',
172
+ 'tar.gz': 'file-tar',
173
+ 'tar.xz': 'file-tar',
174
+ tgz: 'file-tar',
175
+ tif: 'file-image',
176
+ tiff: 'file-image',
177
+ ts: 'file-ts',
178
+ tsv: 'file-csv',
179
+ tsx: 'file-ts',
180
+ ttf: 'file-font',
181
+ txt: 'file-text',
182
+ vue: 'file-code',
183
+ wav: 'file-wav',
184
+ webm: 'file-video',
185
+ webp: 'file-webp',
186
+ wmv: 'file-video',
187
+ woff: 'file-font',
188
+ woff2: 'file-font',
189
+ xd: 'file-design',
190
+ xls: 'file-spreadsheet',
191
+ xlsx: 'file-spreadsheet',
192
+ xml: 'file-xml',
193
+ xsd: 'file-xml',
194
+ xz: 'file-archive',
195
+ yaml: 'file-yaml',
196
+ yml: 'file-yaml',
197
+ zip: 'file-zip',
198
+ zst: 'file-archive',
199
+ };
200
+ /** Exact MIME type, or a family prefix ending with `/`, → icon. Used when the extension is unknown. */
201
+ const SD_FILE_EXPLORER_ICON_MIME = {
202
+ 'application/epub+zip': 'file-book',
203
+ 'application/json': 'file-json',
204
+ 'application/msword': 'file-document',
205
+ 'application/pdf': 'file-pdf',
206
+ 'application/vnd.ms-excel': 'file-spreadsheet',
207
+ 'application/vnd.ms-powerpoint': 'file-presentation',
208
+ 'application/vnd.openxmlformats-officedocument.presentationml.presentation': 'file-presentation',
209
+ 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet': 'file-spreadsheet',
210
+ 'application/vnd.openxmlformats-officedocument.wordprocessingml.document': 'file-document',
211
+ 'application/x-7z-compressed': 'file-7z',
212
+ 'application/x-rar-compressed': 'file-rar',
213
+ 'application/xml': 'file-xml',
214
+ 'application/zip': 'file-archive',
215
+ 'audio/': 'file-audio',
216
+ 'font/': 'file-font',
217
+ 'image/': 'file-image',
218
+ 'model/': 'file-3d',
219
+ 'text/': 'file-text',
220
+ 'text/css': 'file-css',
221
+ 'text/csv': 'file-csv',
222
+ 'text/html': 'file-html',
223
+ 'text/javascript': 'file-js',
224
+ 'video/': 'file-video',
225
+ };
226
+
227
+ const EXTENSIONS = {
228
+ image: ['png', 'jpg', 'jpeg', 'gif', 'webp', 'svg', 'bmp', 'avif', 'ico', 'heic'],
229
+ pdf: ['pdf'],
230
+ spreadsheet: ['xls', 'xlsx', 'xlsm', 'csv', 'ods', 'numbers'],
231
+ document: ['doc', 'docx', 'odt', 'rtf', 'pages'],
232
+ presentation: ['ppt', 'pptx', 'odp', 'key'],
233
+ video: ['mp4', 'mov', 'avi', 'mkv', 'webm', 'm4v'],
234
+ audio: ['mp3', 'wav', 'ogg', 'flac', 'm4a', 'aac'],
235
+ archive: ['zip', 'rar', '7z', 'tar', 'gz', 'tgz', 'bz2'],
236
+ text: ['txt', 'md', 'json', 'xml', 'log', 'yml', 'yaml', 'html', 'css', 'js', 'ts'],
237
+ };
238
+ const LOCALES = { vi: 'vi-VN', en: 'en-US', ja: 'ja-JP', ko: 'ko-KR', zh: 'zh-CN' };
239
+ /** Maps a Core UI language code to the locale used by `Intl` formatters. */
240
+ function sdFileExplorerLocale(language) {
241
+ return LOCALES[language] ?? 'vi-VN';
242
+ }
243
+ /** Lower-cased extension of a file name, without the dot; empty when there is none. */
244
+ function sdFileExplorerExtension(name) {
245
+ const dot = name.lastIndexOf('.');
246
+ return dot > 0 && dot < name.length - 1 ? name.slice(dot + 1).toLowerCase() : '';
247
+ }
248
+ /** Resolves the visual family of an item from its MIME type, falling back to the extension of its name. */
249
+ function sdFileExplorerFileType(item) {
250
+ if (item.kind === 'folder')
251
+ return 'folder';
252
+ const mime = (item.mimeType ?? '').toLowerCase();
253
+ if (mime) {
254
+ if (mime.startsWith('image/'))
255
+ return 'image';
256
+ if (mime === 'application/pdf')
257
+ return 'pdf';
258
+ if (mime.includes('spreadsheet') || mime.includes('excel') || mime === 'text/csv')
259
+ return 'spreadsheet';
260
+ if (mime.includes('presentation') || mime.includes('powerpoint'))
261
+ return 'presentation';
262
+ if (mime.includes('wordprocessing') || mime.includes('msword') || mime.includes('opendocument.text') || mime === 'application/rtf') {
263
+ return 'document';
264
+ }
265
+ if (mime.startsWith('video/'))
266
+ return 'video';
267
+ if (mime.startsWith('audio/'))
268
+ return 'audio';
269
+ if (/(zip|rar|7z|tar|gzip|compressed)/.test(mime))
270
+ return 'archive';
271
+ if (mime.startsWith('text/') || mime.endsWith('json') || mime.endsWith('xml'))
272
+ return 'text';
273
+ }
274
+ const ext = sdFileExplorerExtension(item.name);
275
+ for (const [type, extensions] of Object.entries(EXTENSIONS)) {
276
+ if (extensions.includes(ext))
277
+ return type;
278
+ }
279
+ return 'other';
280
+ }
281
+ function lookup(map, key) {
282
+ // why: tra bằng hasOwnProperty — tên như "x.constructor" không được trả về hàm của Object.prototype.
283
+ return Object.prototype.hasOwnProperty.call(map, key) ? map[key] : undefined;
284
+ }
285
+ /**
286
+ * Built-in icon for an item. Folders use `folder-open` / `folder-closed`. Files resolve the longest known
287
+ * extension first (`report.tar.gz`, `types.d.ts`), then dot-files (`.env`), then the MIME type (exact match,
288
+ * then family such as `image/`), and finally `file-generic`.
289
+ */
290
+ function sdFileExplorerIconName(item, options = {}) {
291
+ if (item.kind === 'folder')
292
+ return options.open ? 'folder-open' : 'folder-closed';
293
+ const basename = (item.name.split(/[\\/]/).pop() ?? '').toLowerCase();
294
+ const suffixes = basename.split('.').slice(1);
295
+ for (let i = 0; i < suffixes.length; i++) {
296
+ const icon = lookup(SD_FILE_EXPLORER_ICON_EXTENSIONS, suffixes.slice(i).join('.'));
297
+ if (icon)
298
+ return icon;
299
+ }
300
+ const dotfile = basename.startsWith('.') ? lookup(SD_FILE_EXPLORER_ICON_EXTENSIONS, basename.slice(1)) : undefined;
301
+ if (dotfile)
302
+ return dotfile;
303
+ if (basename.startsWith('.env.'))
304
+ return 'file-code';
305
+ const mime = (item.mimeType ?? '').toLowerCase().split(';', 1)[0].trim();
306
+ const exact = mime ? lookup(SD_FILE_EXPLORER_ICON_MIME, mime) : undefined;
307
+ if (exact)
308
+ return exact;
309
+ const family = Object.keys(SD_FILE_EXPLORER_ICON_MIME).find(prefix => prefix.endsWith('/') && mime.startsWith(prefix));
310
+ return (family && SD_FILE_EXPLORER_ICON_MIME[family]) || 'file-generic';
311
+ }
312
+ const ICON_URLS = new Map();
313
+ /** `data:` URL of a built-in icon, encoded once and cached (the SVGs keep their own colours, so `<img>` is enough). */
314
+ function sdFileExplorerIconUrl(name) {
315
+ let url = ICON_URLS.get(name);
316
+ if (!url) {
317
+ const svg = SD_FILE_EXPLORER_ICON_SVGS[name] ?? SD_FILE_EXPLORER_ICON_SVGS['file-generic'];
318
+ url = `data:image/svg+xml;charset=utf-8,${encodeURIComponent(svg)}`;
319
+ ICON_URLS.set(name, url);
320
+ }
321
+ return url;
322
+ }
323
+ /** Preview renderer for a file type. */
324
+ function sdFileExplorerPreviewKind(type) {
325
+ if (type === 'image')
326
+ return 'image';
327
+ if (type === 'pdf')
328
+ return 'pdf';
329
+ return 'none';
330
+ }
331
+ /**
332
+ * Human-readable size: `846 KB`, `2,4 MB` (vi) / `2.4 MB` (en).
333
+ * One decimal below 10 units, none above — the precision users expect from file managers.
334
+ */
335
+ function sdFileExplorerFormatSize(bytes, locale) {
336
+ if (typeof bytes !== 'number' || !Number.isFinite(bytes) || bytes < 0)
337
+ return '';
338
+ if (bytes < 1024)
339
+ return `${bytes} B`;
340
+ const units = ['KB', 'MB', 'GB', 'TB'];
341
+ let value = bytes / 1024;
342
+ let unit = 0;
343
+ while (value >= 1024 && unit < units.length - 1) {
344
+ value /= 1024;
345
+ unit++;
346
+ }
347
+ const digits = value < 10 ? 1 : 0;
348
+ return `${new Intl.NumberFormat(locale, { maximumFractionDigits: digits }).format(value)} ${units[unit]}`;
349
+ }
350
+ /** Parses `SdFileExplorerItem.modifiedAt`; `null` when missing or invalid. */
351
+ function sdFileExplorerParseDate(value) {
352
+ if (value === null || value === undefined || value === '')
353
+ return null;
354
+ const date = value instanceof Date ? value : new Date(value);
355
+ return Number.isNaN(date.getTime()) ? null : date;
356
+ }
357
+ /**
358
+ * Compact modification date: "today" / "yesterday" labels, day + month within the current year,
359
+ * full date otherwise. Order of day and month follows the locale.
360
+ */
361
+ function sdFileExplorerFormatDate(value, now, locale, labels) {
362
+ const date = sdFileExplorerParseDate(value);
363
+ if (!date)
364
+ return '';
365
+ const startOfToday = new Date(now.getFullYear(), now.getMonth(), now.getDate()).getTime();
366
+ const day = new Date(date.getFullYear(), date.getMonth(), date.getDate()).getTime();
367
+ // why: so sánh theo mốc 0h local (không trừ 86 400 000 ms) để ngày chuyển giờ DST vẫn đúng "hôm qua".
368
+ if (day === startOfToday)
369
+ return labels.today;
370
+ if (day === new Date(now.getFullYear(), now.getMonth(), now.getDate() - 1).getTime())
371
+ return labels.yesterday;
372
+ const options = date.getFullYear() === now.getFullYear() ? { day: '2-digit', month: '2-digit' } : { day: '2-digit', month: '2-digit', year: 'numeric' };
373
+ // why: lấy THỨ TỰ ngày/tháng theo locale nhưng luôn nối bằng "/" — Chrome format vi-VN ngày+tháng thành "21-09".
374
+ return new Intl.DateTimeFormat(locale, options)
375
+ .formatToParts(date)
376
+ .filter(part => part.type === 'day' || part.type === 'month' || part.type === 'year')
377
+ .map(part => part.value)
378
+ .join('/');
379
+ }
380
+ /** Full date and time, used as tooltip and in the preview metadata. */
381
+ function sdFileExplorerFormatDateTime(value, locale) {
382
+ const date = sdFileExplorerParseDate(value);
383
+ if (!date)
384
+ return '';
385
+ return new Intl.DateTimeFormat(locale, {
386
+ day: '2-digit',
387
+ month: '2-digit',
388
+ year: 'numeric',
389
+ hour: '2-digit',
390
+ minute: '2-digit',
391
+ }).format(date);
392
+ }
393
+ /** Lower-cases and strips Vietnamese accents so "tai lieu" matches "Tài liệu". */
394
+ function sdFileExplorerNormalize(value) {
395
+ return value
396
+ .normalize('NFD')
397
+ .replace(/[\u0300-\u036f]/g, '')
398
+ .replace(/[\u0111\u0110]/g, match => (match === '\u0110' ? 'D' : 'd'))
399
+ .toLowerCase()
400
+ .trim();
401
+ }
402
+ /** Readable reason from whatever a callback threw. */
403
+ function sdFileExplorerErrorMessage(error) {
404
+ if (typeof error === 'string')
405
+ return error;
406
+ if (error && typeof error === 'object' && 'message' in error && typeof error.message === 'string')
407
+ return error.message;
408
+ return '';
409
+ }
410
+ /** `true` for errors produced by an aborted `AbortSignal`. */
411
+ function sdFileExplorerIsAbort(error) {
412
+ return !!error && typeof error === 'object' && 'name' in error && error.name === 'AbortError';
413
+ }
414
+ /**
415
+ * Folders first, then files. Within each group the order returned by the callback is kept, so the
416
+ * consumer (or its API) decides how items are sorted.
417
+ */
418
+ function sdFileExplorerFoldersFirst(items) {
419
+ return [...items.filter(item => item.kind === 'folder'), ...items.filter(item => item.kind !== 'folder')];
420
+ }
421
+ /** Element-safe id fragment for `autoId` / DOM ids. */
422
+ function sdFileExplorerSafeId(value) {
423
+ return value.replace(/[^a-zA-Z0-9_-]/g, '-');
424
+ }
425
+
426
+ /**
427
+ * Built-in file-type icon (folder, PDF, spreadsheet, image, code…), drawn from the embedded SVG set.
428
+ * Decorative: always `aria-hidden` with an empty `alt`, the item name next to it carries the meaning.
429
+ */
430
+ class SdFileExplorerFileIcon {
431
+ /** Icon to draw. */
432
+ icon = input.required(...(ngDevMode ? [{ debugName: "icon" }] : []));
433
+ /** Rendered size in pixels (the SVGs use a 64 × 64 canvas with built-in padding). */
434
+ size = input(32, ...(ngDevMode ? [{ debugName: "size" }] : []));
435
+ src = computed(() => sdFileExplorerIconUrl(this.icon()), ...(ngDevMode ? [{ debugName: "src" }] : []));
436
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: SdFileExplorerFileIcon, deps: [], target: i0.ɵɵFactoryTarget.Component });
437
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "20.3.25", type: SdFileExplorerFileIcon, isStandalone: true, selector: "sd-file-explorer-file-icon", inputs: { icon: { classPropertyName: "icon", publicName: "icon", isSignal: true, isRequired: true, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "aria-hidden": "true" }, properties: { "attr.data-icon": "icon()", "style.--sd-file-explorer-icon-size": "size() + \"px\"" }, classAttribute: "sd-file-explorer-file-icon" }, ngImport: i0, template: `<img [src]="src()" alt="" draggable="false" />`, isInline: true, styles: [":host{display:inline-flex;flex:none;width:var(--sd-file-explorer-icon-size, 32px);height:var(--sd-file-explorer-icon-size, 32px)}img{display:block;width:100%;height:100%;pointer-events:none;-webkit-user-select:none;user-select:none}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
438
+ }
439
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: SdFileExplorerFileIcon, decorators: [{
440
+ type: Component,
441
+ args: [{ selector: 'sd-file-explorer-file-icon', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, host: {
442
+ class: 'sd-file-explorer-file-icon',
443
+ 'aria-hidden': 'true',
444
+ '[attr.data-icon]': 'icon()',
445
+ '[style.--sd-file-explorer-icon-size]': 'size() + "px"',
446
+ }, template: `<img [src]="src()" alt="" draggable="false" />`, styles: [":host{display:inline-flex;flex:none;width:var(--sd-file-explorer-icon-size, 32px);height:var(--sd-file-explorer-icon-size, 32px)}img{display:block;width:100%;height:100%;pointer-events:none;-webkit-user-select:none;user-select:none}\n"] }]
447
+ }], propDecorators: { icon: [{ type: i0.Input, args: [{ isSignal: true, alias: "icon", required: true }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }] } });
448
+
449
+ /**
450
+ * Folder tree of the explorer (internal). Rendered as a flat `role="tree"` list whose depth is carried by
451
+ * `aria-level`, with a roving tabindex and the WAI-ARIA tree keyboard model.
452
+ */
453
+ class SdFileExplorerFolderTree {
454
+ #host = inject(ElementRef);
455
+ #i18n = inject(I18nService);
456
+ /** Visible nodes in display order. */
457
+ nodes = input.required(...(ngDevMode ? [{ debugName: "nodes" }] : []));
458
+ /** Accessible name of the tree. */
459
+ label = input('', ...(ngDevMode ? [{ debugName: "label" }] : []));
460
+ /** A node was activated (click, Enter, Space). */
461
+ select = output();
462
+ /** Expand / collapse requested. */
463
+ toggle = output();
464
+ /** Retry loading the children of a node whose listing failed. */
465
+ retry = output();
466
+ focusedKey = signal(null, ...(ngDevMode ? [{ debugName: "focusedKey" }] : []));
467
+ retryLabel = computed(() => this.#i18n.t('core.component.file-explorer.retry'), ...(ngDevMode ? [{ debugName: "retryLabel" }] : []));
468
+ /** Node owning the roving tabindex: the focused node if still visible, else the selected one. */
469
+ activeKey = computed(() => {
470
+ const nodes = this.nodes();
471
+ const focused = this.focusedKey();
472
+ if (focused && nodes.some(node => node.key === focused))
473
+ return focused;
474
+ return nodes.find(node => node.selected)?.key ?? nodes[0]?.key ?? null;
475
+ }, ...(ngDevMode ? [{ debugName: "activeKey" }] : []));
476
+ toggleLabel(node) {
477
+ const key = node.expanded ? 'core.component.file-explorer.collapse' : 'core.component.file-explorer.expand';
478
+ return this.#i18n.t(key, { name: node.name });
479
+ }
480
+ onToggle(event, node) {
481
+ // why: nút toggle nằm trong treeitem — chặn bubble để bấm mũi tên không đồng thời điều hướng vào thư mục.
482
+ event.stopPropagation();
483
+ this.toggle.emit(node);
484
+ }
485
+ onRetry(event, node) {
486
+ event.stopPropagation();
487
+ this.retry.emit(node);
488
+ }
489
+ onKeydown(event, index) {
490
+ const nodes = this.nodes();
491
+ const node = nodes[index];
492
+ if (!node)
493
+ return;
494
+ switch (event.key) {
495
+ case 'ArrowDown':
496
+ this.#focusIndex(Math.min(index + 1, nodes.length - 1));
497
+ break;
498
+ case 'ArrowUp':
499
+ this.#focusIndex(Math.max(index - 1, 0));
500
+ break;
501
+ case 'Home':
502
+ this.#focusIndex(0);
503
+ break;
504
+ case 'End':
505
+ this.#focusIndex(nodes.length - 1);
506
+ break;
507
+ case 'ArrowRight':
508
+ if (node.expandable && !node.expanded)
509
+ this.toggle.emit(node);
510
+ else if (node.expanded || node.level === 1)
511
+ this.#focusIndex(Math.min(index + 1, nodes.length - 1));
512
+ break;
513
+ case 'ArrowLeft':
514
+ if (node.expandable && node.expanded) {
515
+ this.toggle.emit(node);
516
+ }
517
+ else {
518
+ for (let i = index - 1; i >= 0; i--) {
519
+ if (nodes[i].level < node.level) {
520
+ this.#focusIndex(i);
521
+ break;
522
+ }
523
+ }
524
+ }
525
+ break;
526
+ case 'Enter':
527
+ case ' ':
528
+ this.select.emit(node);
529
+ break;
530
+ default:
531
+ return;
532
+ }
533
+ event.preventDefault();
534
+ }
535
+ #focusIndex(index) {
536
+ const node = this.nodes()[index];
537
+ if (!node)
538
+ return;
539
+ this.focusedKey.set(node.key);
540
+ const element = this.#host.nativeElement.querySelectorAll('[role="treeitem"]')[index];
541
+ element?.focus();
542
+ }
543
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: SdFileExplorerFolderTree, deps: [], target: i0.ɵɵFactoryTarget.Component });
544
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.25", type: SdFileExplorerFolderTree, isStandalone: true, selector: "sd-file-explorer-folder-tree", inputs: { nodes: { classPropertyName: "nodes", publicName: "nodes", isSignal: true, isRequired: true, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { select: "select", toggle: "toggle", retry: "retry" }, host: { classAttribute: "sd-file-explorer-folder-tree" }, ngImport: i0, template: `
545
+ @let _nodes = nodes();
546
+ @let _active = activeKey();
547
+ <ul class="tree" role="tree" [attr.aria-label]="label()">
548
+ @for (node of _nodes; track node.key; let i = $index) {
549
+ <li
550
+ class="node"
551
+ role="treeitem"
552
+ [class.node--selected]="node.selected"
553
+ [attr.aria-level]="node.level"
554
+ [attr.aria-selected]="node.selected"
555
+ [attr.aria-expanded]="node.expandable ? node.expanded : null"
556
+ [attr.aria-busy]="node.status === 'loading' ? true : null"
557
+ [attr.tabindex]="node.key === _active ? 0 : -1"
558
+ [attr.data-autoid]="node.autoId"
559
+ [style.--sd-file-explorer-tree-indent]="(node.level > 1 ? node.level - 2 : 0) * 22 + 'px'"
560
+ (click)="select.emit(node)"
561
+ (keydown)="onKeydown($event, i)"
562
+ (focus)="focusedKey.set(node.key)">
563
+ @if (node.level > 1) {
564
+ <span class="indent"></span>
565
+ @if (node.expandable) {
566
+ <button
567
+ type="button"
568
+ class="toggle"
569
+ tabindex="-1"
570
+ [attr.aria-label]="toggleLabel(node)"
571
+ [attr.data-autoid]="node.autoId ? node.autoId + '-toggle' : null"
572
+ (click)="onToggle($event, node)">
573
+ <sd-icon [name]="node.expanded ? 'expand_more' : 'chevron_right'" size="16px" />
574
+ </button>
575
+ } @else {
576
+ <span class="toggle toggle--placeholder"></span>
577
+ }
578
+ }
579
+ <sd-file-explorer-file-icon [icon]="node.expanded ? 'folder-open' : 'folder-closed'" [size]="28" />
580
+ <span class="label" [title]="node.name">{{ node.name }}</span>
581
+ @if (node.status === 'loading') {
582
+ <span class="spinner" aria-hidden="true"></span>
583
+ } @else if (node.status === 'error') {
584
+ <button
585
+ type="button"
586
+ class="retry"
587
+ tabindex="-1"
588
+ [attr.aria-label]="retryLabel()"
589
+ [title]="retryLabel()"
590
+ (click)="onRetry($event, node)">
591
+ <sd-icon name="refresh" size="16px" />
592
+ </button>
593
+ }
594
+ </li>
595
+ }
596
+ </ul>
597
+ `, isInline: true, styles: [":host{display:block}.tree{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:8px}.node{display:flex;align-items:center;gap:8px;min-height:40px;padding:0 10px;border-radius:8px;color:var(--sd-fe-text);font-size:15px;line-height:20px;cursor:pointer;-webkit-user-select:none;user-select:none;outline:none}.node:hover{background:var(--sd-fe-hover)}.node:focus-visible{box-shadow:inset 0 0 0 2px var(--sd-fe-accent)}.node--selected{background:var(--sd-fe-accent-soft);color:var(--sd-fe-accent);font-weight:600}.node--selected:hover{background:var(--sd-fe-accent-soft)}.indent{flex:none;width:var(--sd-file-explorer-tree-indent, 0);margin-right:-8px}.toggle{flex:none;display:inline-flex;align-items:center;justify-content:center;width:16px;height:24px;margin-right:-1px;padding:0;border:0;border-radius:4px;background:transparent;color:var(--sd-fe-text-secondary);cursor:pointer}.toggle:hover{color:var(--sd-fe-text)}.label{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.retry{flex:none;display:inline-flex;align-items:center;justify-content:center;width:24px;height:24px;padding:0;border:0;border-radius:6px;background:transparent;color:var(--sd-fe-error);cursor:pointer}.retry:hover{background:color-mix(in srgb,var(--sd-fe-error) 10%,transparent)}.spinner{flex:none;width:14px;height:14px;border:2px solid color-mix(in srgb,var(--sd-fe-accent) 25%,transparent);border-top-color:var(--sd-fe-accent);border-radius:50%;animation:sd-file-explorer-tree-spin .8s linear infinite}@keyframes sd-file-explorer-tree-spin{to{transform:rotate(360deg)}}@media(prefers-reduced-motion:reduce){.spinner{animation-duration:2.4s}}\n"], dependencies: [{ kind: "component", type: SdIcon, selector: "sd-icon", inputs: ["name", "fontIcon", "color", "set", "fontSet", "size", "strokeWidth", "absoluteStrokeWidth", "ariaLabel"] }, { kind: "component", type: SdFileExplorerFileIcon, selector: "sd-file-explorer-file-icon", inputs: ["icon", "size"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
598
+ }
599
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: SdFileExplorerFolderTree, decorators: [{
600
+ type: Component,
601
+ args: [{ selector: 'sd-file-explorer-folder-tree', standalone: true, imports: [SdIcon, SdFileExplorerFileIcon], changeDetection: ChangeDetectionStrategy.OnPush, host: { class: 'sd-file-explorer-folder-tree' }, template: `
602
+ @let _nodes = nodes();
603
+ @let _active = activeKey();
604
+ <ul class="tree" role="tree" [attr.aria-label]="label()">
605
+ @for (node of _nodes; track node.key; let i = $index) {
606
+ <li
607
+ class="node"
608
+ role="treeitem"
609
+ [class.node--selected]="node.selected"
610
+ [attr.aria-level]="node.level"
611
+ [attr.aria-selected]="node.selected"
612
+ [attr.aria-expanded]="node.expandable ? node.expanded : null"
613
+ [attr.aria-busy]="node.status === 'loading' ? true : null"
614
+ [attr.tabindex]="node.key === _active ? 0 : -1"
615
+ [attr.data-autoid]="node.autoId"
616
+ [style.--sd-file-explorer-tree-indent]="(node.level > 1 ? node.level - 2 : 0) * 22 + 'px'"
617
+ (click)="select.emit(node)"
618
+ (keydown)="onKeydown($event, i)"
619
+ (focus)="focusedKey.set(node.key)">
620
+ @if (node.level > 1) {
621
+ <span class="indent"></span>
622
+ @if (node.expandable) {
623
+ <button
624
+ type="button"
625
+ class="toggle"
626
+ tabindex="-1"
627
+ [attr.aria-label]="toggleLabel(node)"
628
+ [attr.data-autoid]="node.autoId ? node.autoId + '-toggle' : null"
629
+ (click)="onToggle($event, node)">
630
+ <sd-icon [name]="node.expanded ? 'expand_more' : 'chevron_right'" size="16px" />
631
+ </button>
632
+ } @else {
633
+ <span class="toggle toggle--placeholder"></span>
634
+ }
635
+ }
636
+ <sd-file-explorer-file-icon [icon]="node.expanded ? 'folder-open' : 'folder-closed'" [size]="28" />
637
+ <span class="label" [title]="node.name">{{ node.name }}</span>
638
+ @if (node.status === 'loading') {
639
+ <span class="spinner" aria-hidden="true"></span>
640
+ } @else if (node.status === 'error') {
641
+ <button
642
+ type="button"
643
+ class="retry"
644
+ tabindex="-1"
645
+ [attr.aria-label]="retryLabel()"
646
+ [title]="retryLabel()"
647
+ (click)="onRetry($event, node)">
648
+ <sd-icon name="refresh" size="16px" />
649
+ </button>
650
+ }
651
+ </li>
652
+ }
653
+ </ul>
654
+ `, styles: [":host{display:block}.tree{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:8px}.node{display:flex;align-items:center;gap:8px;min-height:40px;padding:0 10px;border-radius:8px;color:var(--sd-fe-text);font-size:15px;line-height:20px;cursor:pointer;-webkit-user-select:none;user-select:none;outline:none}.node:hover{background:var(--sd-fe-hover)}.node:focus-visible{box-shadow:inset 0 0 0 2px var(--sd-fe-accent)}.node--selected{background:var(--sd-fe-accent-soft);color:var(--sd-fe-accent);font-weight:600}.node--selected:hover{background:var(--sd-fe-accent-soft)}.indent{flex:none;width:var(--sd-file-explorer-tree-indent, 0);margin-right:-8px}.toggle{flex:none;display:inline-flex;align-items:center;justify-content:center;width:16px;height:24px;margin-right:-1px;padding:0;border:0;border-radius:4px;background:transparent;color:var(--sd-fe-text-secondary);cursor:pointer}.toggle:hover{color:var(--sd-fe-text)}.label{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.retry{flex:none;display:inline-flex;align-items:center;justify-content:center;width:24px;height:24px;padding:0;border:0;border-radius:6px;background:transparent;color:var(--sd-fe-error);cursor:pointer}.retry:hover{background:color-mix(in srgb,var(--sd-fe-error) 10%,transparent)}.spinner{flex:none;width:14px;height:14px;border:2px solid color-mix(in srgb,var(--sd-fe-accent) 25%,transparent);border-top-color:var(--sd-fe-accent);border-radius:50%;animation:sd-file-explorer-tree-spin .8s linear infinite}@keyframes sd-file-explorer-tree-spin{to{transform:rotate(360deg)}}@media(prefers-reduced-motion:reduce){.spinner{animation-duration:2.4s}}\n"] }]
655
+ }], propDecorators: { nodes: [{ type: i0.Input, args: [{ isSignal: true, alias: "nodes", required: true }] }], label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], select: [{ type: i0.Output, args: ["select"] }], toggle: [{ type: i0.Output, args: ["toggle"] }], retry: [{ type: i0.Output, args: ["retry"] }] } });
656
+
657
+ /**
658
+ * Items of the current folder (or search results) as a list or a grid (internal).
659
+ * Rows and cards are focusable; `Enter` / `Space` activate them like a click.
660
+ */
661
+ class SdFileExplorerItemList {
662
+ /** Items to render, already formatted. */
663
+ items = input.required(...(ngDevMode ? [{ debugName: "items" }] : []));
664
+ /** `list` or `grid`. */
665
+ view = input('list', ...(ngDevMode ? [{ debugName: "view" }] : []));
666
+ /** Show download buttons for files. */
667
+ canDownload = input(false, ...(ngDevMode ? [{ debugName: "canDownload" }] : []));
668
+ /** Show share buttons for files. */
669
+ canShare = input(false, ...(ngDevMode ? [{ debugName: "canShare" }] : []));
670
+ /** Narrow layout: hides the modified column. */
671
+ compact = input(false, ...(ngDevMode ? [{ debugName: "compact" }] : []));
672
+ /** Id of the file currently shown in the preview panel. */
673
+ activeId = input(null, ...(ngDevMode ? [{ debugName: "activeId" }] : []));
674
+ /** Accessible name of the list. */
675
+ label = input('', ...(ngDevMode ? [{ debugName: "label" }] : []));
676
+ /** Row / card activated. */
677
+ activate = output();
678
+ /** Download button pressed. */
679
+ download = output();
680
+ /** Share button pressed. */
681
+ share = output();
682
+ /** Width of the row action column: one 32 px icon button per enabled action. */
683
+ actionsWidth = computed(() => {
684
+ const count = (this.canDownload() ? 1 : 0) + (this.canShare() ? 1 : 0);
685
+ if (!count)
686
+ return null;
687
+ return `${count * 32 + (count - 1) * 2 + (this.compact() ? 4 : 12)}px`;
688
+ }, ...(ngDevMode ? [{ debugName: "actionsWidth" }] : []));
689
+ onKeydown(event, view) {
690
+ if (event.key !== 'Enter' && event.key !== ' ')
691
+ return;
692
+ event.preventDefault();
693
+ this.activate.emit(view);
694
+ }
695
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: SdFileExplorerItemList, deps: [], target: i0.ɵɵFactoryTarget.Component });
696
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.25", type: SdFileExplorerItemList, isStandalone: true, selector: "sd-file-explorer-item-list", inputs: { items: { classPropertyName: "items", publicName: "items", isSignal: true, isRequired: true, transformFunction: null }, view: { classPropertyName: "view", publicName: "view", isSignal: true, isRequired: false, transformFunction: null }, canDownload: { classPropertyName: "canDownload", publicName: "canDownload", isSignal: true, isRequired: false, transformFunction: null }, canShare: { classPropertyName: "canShare", publicName: "canShare", isSignal: true, isRequired: false, transformFunction: null }, compact: { classPropertyName: "compact", publicName: "compact", isSignal: true, isRequired: false, transformFunction: null }, activeId: { classPropertyName: "activeId", publicName: "activeId", isSignal: true, isRequired: false, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { activate: "activate", download: "download", share: "share" }, host: { properties: { "class.sd-file-explorer-item-list--compact": "compact()", "style.--sd-fe-actions-width": "actionsWidth()" }, classAttribute: "sd-file-explorer-item-list" }, ngImport: i0, template: `
697
+ @let _items = items();
698
+ @let _canDownload = canDownload();
699
+ @let _canShare = canShare();
700
+ @let _hasActions = _canDownload || _canShare;
701
+ @let _compact = compact();
702
+ @let _activeId = activeId();
703
+ @if (view() === 'list') {
704
+ <div class="list" role="table" [attr.aria-label]="label()">
705
+ <div class="list-head" role="rowgroup">
706
+ <div class="row row--head" role="row">
707
+ <span class="cell cell--name" role="columnheader">{{ 'core.component.file-explorer.column.name' | sdTranslate }}</span>
708
+ @if (!_compact) {
709
+ <span class="cell cell--modified" role="columnheader">{{
710
+ 'core.component.file-explorer.column.modified' | sdTranslate
711
+ }}</span>
712
+ }
713
+ <span class="cell cell--size" role="columnheader">{{ 'core.component.file-explorer.column.size' | sdTranslate }}</span>
714
+ @if (_hasActions) {
715
+ <span class="cell cell--action" role="columnheader"></span>
716
+ }
717
+ </div>
718
+ </div>
719
+ <div role="rowgroup">
720
+ @for (view of _items; track view.item.id) {
721
+ <div
722
+ class="row"
723
+ role="row"
724
+ tabindex="0"
725
+ [class.row--active]="view.item.id === _activeId"
726
+ [attr.data-item-id]="view.item.id"
727
+ [attr.data-autoid]="view.autoId"
728
+ (click)="activate.emit(view)"
729
+ (keydown)="onKeydown($event, view)">
730
+ <span class="cell cell--name" role="cell">
731
+ <sd-file-explorer-file-icon [icon]="view.icon" [size]="32" />
732
+ <span class="name" [title]="view.item.name">{{ view.item.name }}</span>
733
+ </span>
734
+ @if (!_compact) {
735
+ <span class="cell cell--modified" role="cell" [title]="view.modifiedTitle">{{ view.modifiedLabel || '—' }}</span>
736
+ }
737
+ <span class="cell cell--size" role="cell">{{ view.sizeLabel || '—' }}</span>
738
+ @if (_hasActions) {
739
+ <!-- why: sd-button already keeps its click from reaching the row; Enter/Space are stopped here so the key does not open the file too. -->
740
+ <span class="cell cell--action" role="cell">
741
+ @if (view.item.kind === 'file') {
742
+ @if (_canShare) {
743
+ <sd-button
744
+ class="row-action row-share"
745
+ type="text"
746
+ color="secondary"
747
+ size="sm"
748
+ prefixIcon="share"
749
+ [tooltip]="view.shareLabel"
750
+ [attr.data-autoid]="view.autoId ? view.autoId + '-share' : null"
751
+ (click)="share.emit(view)"
752
+ (keydown.enter)="$event.stopPropagation()"
753
+ (keydown.space)="$event.stopPropagation()" />
754
+ }
755
+ @if (_canDownload) {
756
+ <sd-button
757
+ class="row-action row-download"
758
+ type="text"
759
+ color="secondary"
760
+ size="sm"
761
+ prefixIcon="file_download"
762
+ [tooltip]="view.downloadLabel"
763
+ [attr.data-autoid]="view.autoId ? view.autoId + '-download' : null"
764
+ (click)="download.emit(view)"
765
+ (keydown.enter)="$event.stopPropagation()"
766
+ (keydown.space)="$event.stopPropagation()" />
767
+ }
768
+ }
769
+ </span>
770
+ }
771
+ </div>
772
+ }
773
+ </div>
774
+ </div>
775
+ } @else {
776
+ <ul class="grid" [attr.aria-label]="label()">
777
+ @for (view of _items; track view.item.id) {
778
+ <li
779
+ class="card"
780
+ tabindex="0"
781
+ [class.card--active]="view.item.id === _activeId"
782
+ [attr.data-item-id]="view.item.id"
783
+ [attr.data-autoid]="view.autoId"
784
+ [attr.aria-label]="view.item.name + ', ' + view.typeLabel"
785
+ (click)="activate.emit(view)"
786
+ (keydown)="onKeydown($event, view)">
787
+ <span class="thumb">
788
+ @if (view.item.thumbnailUrl) {
789
+ <img [src]="view.item.thumbnailUrl" alt="" loading="lazy" />
790
+ } @else {
791
+ <sd-file-explorer-file-icon [icon]="view.icon" [size]="48" />
792
+ }
793
+ </span>
794
+ <span class="card-name" [title]="view.item.name">{{ view.item.name }}</span>
795
+ </li>
796
+ }
797
+ </ul>
798
+ }
799
+ `, isInline: true, styles: [":host{display:block}.list{width:100%}.row{display:grid;grid-template-columns:minmax(0,1fr) 128px 88px var(--sd-fe-actions-width, 44px);align-items:center;min-height:62px;border-bottom:1px solid var(--sd-fe-border);color:var(--sd-fe-text);font-size:15px;cursor:pointer;outline:none;transition:background-color .12s ease}.row:hover{background:var(--sd-fe-hover)}.row:focus-visible{box-shadow:inset 0 0 0 2px var(--sd-fe-accent)}.list:not(:has(.cell--action)) .row{grid-template-columns:minmax(0,1fr) 128px 88px}.row--head{min-height:34px;color:var(--sd-fe-text-secondary);font-size:13px;cursor:default}.row--head:hover{background:transparent}.row--active,.row--active:hover{background:var(--sd-fe-accent-soft)}.cell{min-width:0;padding:0 8px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.cell--name{display:flex;align-items:center;gap:16px}.row:not(.row--head) .cell--modified,.row:not(.row--head) .cell--size{color:var(--sd-fe-text-secondary);font-size:13px}.cell--action{display:flex;align-items:center;justify-content:flex-end;gap:2px;padding:0 4px 0 0;overflow:visible}.name{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}:host(.sd-file-explorer-item-list--compact) .row{grid-template-columns:minmax(0,1fr) 66px var(--sd-fe-actions-width, 36px);min-height:55px;font-size:14px}:host(.sd-file-explorer-item-list--compact) .list:not(:has(.cell--action)) .row{grid-template-columns:minmax(0,1fr) 66px}:host(.sd-file-explorer-item-list--compact) .row--head{min-height:30px;font-size:12px}:host(.sd-file-explorer-item-list--compact) .cell--name{gap:12px}:host(.sd-file-explorer-item-list--compact) .cell{padding:0 4px}:host(.sd-file-explorer-item-list--compact) .cell--action{padding:0}.grid{list-style:none;margin:0;padding:4px 0 0;display:grid;grid-template-columns:repeat(auto-fill,minmax(248px,1fr));gap:18px 20px}.card{display:flex;flex-direction:column;gap:12px;min-width:0;padding:12px 12px 14px;border:1px solid var(--sd-fe-border);border-radius:12px;background:var(--sd-fe-surface);color:var(--sd-fe-text);cursor:pointer;outline:none;transition:border-color .12s ease,box-shadow .12s ease}.card:hover{border-color:var(--sd-fe-border-strong);box-shadow:0 2px 8px #0f172a0f}.card:focus-visible{box-shadow:0 0 0 2px var(--sd-fe-accent)}.card--active{border-color:var(--sd-fe-accent)}.thumb{display:flex;align-items:center;justify-content:center;height:104px;overflow:hidden;border-radius:8px;background:var(--sd-fe-muted-surface)}.thumb img{width:100%;height:100%;object-fit:cover}.card-name{padding:0 2px;overflow:hidden;font-size:14px;font-weight:600;text-overflow:ellipsis;white-space:nowrap}:host(.sd-file-explorer-item-list--compact) .grid{grid-template-columns:repeat(auto-fill,minmax(148px,1fr));gap:12px}@media(prefers-reduced-motion:reduce){.row,.card{transition:none}}\n"], dependencies: [{ kind: "component", type: SdButton, selector: "sd-button", inputs: ["autoId", "type", "color", "size", "fontSet", "title", "width", "tooltip", "prefixIcon", "suffixIcon", "disabled", "openOnHover", "loading", "block", "htmlType"], outputs: ["click"] }, { kind: "component", type: SdFileExplorerFileIcon, selector: "sd-file-explorer-file-icon", inputs: ["icon", "size"] }, { kind: "pipe", type: SdTranslatePipe, name: "sdTranslate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
800
+ }
801
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: SdFileExplorerItemList, decorators: [{
802
+ type: Component,
803
+ args: [{ selector: 'sd-file-explorer-item-list', standalone: true, imports: [SdButton, SdTranslatePipe, SdFileExplorerFileIcon], changeDetection: ChangeDetectionStrategy.OnPush, host: {
804
+ class: 'sd-file-explorer-item-list',
805
+ '[class.sd-file-explorer-item-list--compact]': 'compact()',
806
+ '[style.--sd-fe-actions-width]': 'actionsWidth()',
807
+ }, template: `
808
+ @let _items = items();
809
+ @let _canDownload = canDownload();
810
+ @let _canShare = canShare();
811
+ @let _hasActions = _canDownload || _canShare;
812
+ @let _compact = compact();
813
+ @let _activeId = activeId();
814
+ @if (view() === 'list') {
815
+ <div class="list" role="table" [attr.aria-label]="label()">
816
+ <div class="list-head" role="rowgroup">
817
+ <div class="row row--head" role="row">
818
+ <span class="cell cell--name" role="columnheader">{{ 'core.component.file-explorer.column.name' | sdTranslate }}</span>
819
+ @if (!_compact) {
820
+ <span class="cell cell--modified" role="columnheader">{{
821
+ 'core.component.file-explorer.column.modified' | sdTranslate
822
+ }}</span>
823
+ }
824
+ <span class="cell cell--size" role="columnheader">{{ 'core.component.file-explorer.column.size' | sdTranslate }}</span>
825
+ @if (_hasActions) {
826
+ <span class="cell cell--action" role="columnheader"></span>
827
+ }
828
+ </div>
829
+ </div>
830
+ <div role="rowgroup">
831
+ @for (view of _items; track view.item.id) {
832
+ <div
833
+ class="row"
834
+ role="row"
835
+ tabindex="0"
836
+ [class.row--active]="view.item.id === _activeId"
837
+ [attr.data-item-id]="view.item.id"
838
+ [attr.data-autoid]="view.autoId"
839
+ (click)="activate.emit(view)"
840
+ (keydown)="onKeydown($event, view)">
841
+ <span class="cell cell--name" role="cell">
842
+ <sd-file-explorer-file-icon [icon]="view.icon" [size]="32" />
843
+ <span class="name" [title]="view.item.name">{{ view.item.name }}</span>
844
+ </span>
845
+ @if (!_compact) {
846
+ <span class="cell cell--modified" role="cell" [title]="view.modifiedTitle">{{ view.modifiedLabel || '—' }}</span>
847
+ }
848
+ <span class="cell cell--size" role="cell">{{ view.sizeLabel || '—' }}</span>
849
+ @if (_hasActions) {
850
+ <!-- why: sd-button already keeps its click from reaching the row; Enter/Space are stopped here so the key does not open the file too. -->
851
+ <span class="cell cell--action" role="cell">
852
+ @if (view.item.kind === 'file') {
853
+ @if (_canShare) {
854
+ <sd-button
855
+ class="row-action row-share"
856
+ type="text"
857
+ color="secondary"
858
+ size="sm"
859
+ prefixIcon="share"
860
+ [tooltip]="view.shareLabel"
861
+ [attr.data-autoid]="view.autoId ? view.autoId + '-share' : null"
862
+ (click)="share.emit(view)"
863
+ (keydown.enter)="$event.stopPropagation()"
864
+ (keydown.space)="$event.stopPropagation()" />
865
+ }
866
+ @if (_canDownload) {
867
+ <sd-button
868
+ class="row-action row-download"
869
+ type="text"
870
+ color="secondary"
871
+ size="sm"
872
+ prefixIcon="file_download"
873
+ [tooltip]="view.downloadLabel"
874
+ [attr.data-autoid]="view.autoId ? view.autoId + '-download' : null"
875
+ (click)="download.emit(view)"
876
+ (keydown.enter)="$event.stopPropagation()"
877
+ (keydown.space)="$event.stopPropagation()" />
878
+ }
879
+ }
880
+ </span>
881
+ }
882
+ </div>
883
+ }
884
+ </div>
885
+ </div>
886
+ } @else {
887
+ <ul class="grid" [attr.aria-label]="label()">
888
+ @for (view of _items; track view.item.id) {
889
+ <li
890
+ class="card"
891
+ tabindex="0"
892
+ [class.card--active]="view.item.id === _activeId"
893
+ [attr.data-item-id]="view.item.id"
894
+ [attr.data-autoid]="view.autoId"
895
+ [attr.aria-label]="view.item.name + ', ' + view.typeLabel"
896
+ (click)="activate.emit(view)"
897
+ (keydown)="onKeydown($event, view)">
898
+ <span class="thumb">
899
+ @if (view.item.thumbnailUrl) {
900
+ <img [src]="view.item.thumbnailUrl" alt="" loading="lazy" />
901
+ } @else {
902
+ <sd-file-explorer-file-icon [icon]="view.icon" [size]="48" />
903
+ }
904
+ </span>
905
+ <span class="card-name" [title]="view.item.name">{{ view.item.name }}</span>
906
+ </li>
907
+ }
908
+ </ul>
909
+ }
910
+ `, styles: [":host{display:block}.list{width:100%}.row{display:grid;grid-template-columns:minmax(0,1fr) 128px 88px var(--sd-fe-actions-width, 44px);align-items:center;min-height:62px;border-bottom:1px solid var(--sd-fe-border);color:var(--sd-fe-text);font-size:15px;cursor:pointer;outline:none;transition:background-color .12s ease}.row:hover{background:var(--sd-fe-hover)}.row:focus-visible{box-shadow:inset 0 0 0 2px var(--sd-fe-accent)}.list:not(:has(.cell--action)) .row{grid-template-columns:minmax(0,1fr) 128px 88px}.row--head{min-height:34px;color:var(--sd-fe-text-secondary);font-size:13px;cursor:default}.row--head:hover{background:transparent}.row--active,.row--active:hover{background:var(--sd-fe-accent-soft)}.cell{min-width:0;padding:0 8px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.cell--name{display:flex;align-items:center;gap:16px}.row:not(.row--head) .cell--modified,.row:not(.row--head) .cell--size{color:var(--sd-fe-text-secondary);font-size:13px}.cell--action{display:flex;align-items:center;justify-content:flex-end;gap:2px;padding:0 4px 0 0;overflow:visible}.name{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}:host(.sd-file-explorer-item-list--compact) .row{grid-template-columns:minmax(0,1fr) 66px var(--sd-fe-actions-width, 36px);min-height:55px;font-size:14px}:host(.sd-file-explorer-item-list--compact) .list:not(:has(.cell--action)) .row{grid-template-columns:minmax(0,1fr) 66px}:host(.sd-file-explorer-item-list--compact) .row--head{min-height:30px;font-size:12px}:host(.sd-file-explorer-item-list--compact) .cell--name{gap:12px}:host(.sd-file-explorer-item-list--compact) .cell{padding:0 4px}:host(.sd-file-explorer-item-list--compact) .cell--action{padding:0}.grid{list-style:none;margin:0;padding:4px 0 0;display:grid;grid-template-columns:repeat(auto-fill,minmax(248px,1fr));gap:18px 20px}.card{display:flex;flex-direction:column;gap:12px;min-width:0;padding:12px 12px 14px;border:1px solid var(--sd-fe-border);border-radius:12px;background:var(--sd-fe-surface);color:var(--sd-fe-text);cursor:pointer;outline:none;transition:border-color .12s ease,box-shadow .12s ease}.card:hover{border-color:var(--sd-fe-border-strong);box-shadow:0 2px 8px #0f172a0f}.card:focus-visible{box-shadow:0 0 0 2px var(--sd-fe-accent)}.card--active{border-color:var(--sd-fe-accent)}.thumb{display:flex;align-items:center;justify-content:center;height:104px;overflow:hidden;border-radius:8px;background:var(--sd-fe-muted-surface)}.thumb img{width:100%;height:100%;object-fit:cover}.card-name{padding:0 2px;overflow:hidden;font-size:14px;font-weight:600;text-overflow:ellipsis;white-space:nowrap}:host(.sd-file-explorer-item-list--compact) .grid{grid-template-columns:repeat(auto-fill,minmax(148px,1fr));gap:12px}@media(prefers-reduced-motion:reduce){.row,.card{transition:none}}\n"] }]
911
+ }], propDecorators: { items: [{ type: i0.Input, args: [{ isSignal: true, alias: "items", required: true }] }], view: [{ type: i0.Input, args: [{ isSignal: true, alias: "view", required: false }] }], canDownload: [{ type: i0.Input, args: [{ isSignal: true, alias: "canDownload", required: false }] }], canShare: [{ type: i0.Input, args: [{ isSignal: true, alias: "canShare", required: false }] }], compact: [{ type: i0.Input, args: [{ isSignal: true, alias: "compact", required: false }] }], activeId: [{ type: i0.Input, args: [{ isSignal: true, alias: "activeId", required: false }] }], label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], activate: [{ type: i0.Output, args: ["activate"] }], download: [{ type: i0.Output, args: ["download"] }], share: [{ type: i0.Output, args: ["share"] }] } });
912
+
913
+ /**
914
+ * File detail of the explorer (internal): an `<sd-side-drawer>` opened in the explorer's item area (right of the
915
+ * folder tree, below the header) through the drawer's `container` input, with the preview stage and metadata in its
916
+ * body and share / download in its footer.
917
+ *
918
+ * The explorer owns the open file: a non-null `view` opens the drawer, `null` closes it. When the user closes
919
+ * the drawer (close button, `Escape`, backdrop) the panel emits `close`.
920
+ *
921
+ * PDFs render with `<sd-preview-pdf>`, imported on demand so the PDF.js bundle is only fetched the first
922
+ * time a PDF is previewed.
923
+ */
924
+ class SdFileExplorerPreviewPanel {
925
+ /** File shown in the drawer; `null` closes the drawer. */
926
+ view = input(null, ...(ngDevMode ? [{ debugName: "view" }] : []));
927
+ /** What the stage renders. */
928
+ state = input.required(...(ngDevMode ? [{ debugName: "state" }] : []));
929
+ /** Metadata rows (name, type, size, modified). */
930
+ meta = input([], ...(ngDevMode ? [{ debugName: "meta" }] : []));
931
+ /** Show the download button. */
932
+ canDownload = input(false, ...(ngDevMode ? [{ debugName: "canDownload" }] : []));
933
+ /** Show the share button. */
934
+ canShare = input(false, ...(ngDevMode ? [{ debugName: "canShare" }] : []));
935
+ /** Element the drawer opens inside: the explorer's item area, right of the folder tree. */
936
+ container = input(null, ...(ngDevMode ? [{ debugName: "container" }] : []));
937
+ /** E2E scope of the detail content and its buttons. */
938
+ autoId = input(undefined, ...(ngDevMode ? [{ debugName: "autoId" }] : []));
939
+ /** The user closed the drawer (close button, `Escape` or backdrop). */
940
+ close = output();
941
+ /** Download button pressed. */
942
+ download = output();
943
+ /** Share button pressed. */
944
+ share = output();
945
+ /** Retry button of the error state pressed. */
946
+ retry = output();
947
+ /** The `<img>` failed to load. */
948
+ imageError = output();
949
+ drawer = viewChild(SdSideDrawer, ...(ngDevMode ? [{ debugName: "drawer" }] : []));
950
+ drawerTitle = computed(() => this.view()?.item.name ?? '', ...(ngDevMode ? [{ debugName: "drawerTitle" }] : []));
951
+ // why: sd-side-drawer tự thêm tiền tố `components-side-drawer-`; bỏ `components-` của autoId explorer cho khỏi lặp.
952
+ drawerAutoId = computed(() => this.autoId()?.replace(/^components-/, ''), ...(ngDevMode ? [{ debugName: "drawerAutoId" }] : []));
953
+ pdfComponent = signal(null, ...(ngDevMode ? [{ debugName: "pdfComponent" }] : []));
954
+ pdfFailed = signal(false, ...(ngDevMode ? [{ debugName: "pdfFailed" }] : []));
955
+ #pdfRequested = false;
956
+ pdfInputs = computed(() => {
957
+ const state = this.state();
958
+ if (state.status !== 'pdf')
959
+ return {};
960
+ return {
961
+ source: state.source,
962
+ title: this.view()?.item.name ?? '',
963
+ theme: 'light',
964
+ sidebar: 'none',
965
+ sidebarOpen: false,
966
+ // why: toolbar nổi (trang/zoom) tràn ngang trong panel ~350px; header của viewer vẫn giữ tìm kiếm/in/toàn màn hình.
967
+ showToolbar: false,
968
+ downloadable: false,
969
+ initialZoom: 'page-width',
970
+ };
971
+ }, ...(ngDevMode ? [{ debugName: "pdfInputs" }] : []));
972
+ constructor() {
973
+ effect(() => {
974
+ const drawer = this.drawer();
975
+ const open = this.view() !== null;
976
+ if (!drawer)
977
+ return;
978
+ untracked(() => {
979
+ if (open && !drawer.isOpened())
980
+ drawer.open();
981
+ else if (!open && drawer.isOpened())
982
+ drawer.forceClose();
983
+ });
984
+ });
985
+ effect(() => {
986
+ if (this.state().status !== 'pdf')
987
+ return;
988
+ untracked(() => this.#loadPdfViewer());
989
+ });
990
+ }
991
+ onDrawerClosed() {
992
+ // Explorer tự đóng (view đã là null) thì không báo lại; chỉ báo khi người dùng đóng drawer.
993
+ if (this.view())
994
+ this.close.emit();
995
+ }
996
+ async #loadPdfViewer() {
997
+ if (this.#pdfRequested)
998
+ return;
999
+ this.#pdfRequested = true;
1000
+ try {
1001
+ // why: import động để PDF.js (+ worker inline ~1.4 MB) tách chunk riêng — consumer không xem PDF thì không tải.
1002
+ const module = await import('@sdcorejs/angular/components/preview');
1003
+ this.pdfComponent.set(module.SdPreviewPdf);
1004
+ }
1005
+ catch {
1006
+ this.#pdfRequested = false;
1007
+ this.pdfFailed.set(true);
1008
+ }
1009
+ }
1010
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: SdFileExplorerPreviewPanel, deps: [], target: i0.ɵɵFactoryTarget.Component });
1011
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.25", type: SdFileExplorerPreviewPanel, isStandalone: true, selector: "sd-file-explorer-preview-panel", inputs: { view: { classPropertyName: "view", publicName: "view", isSignal: true, isRequired: false, transformFunction: null }, state: { classPropertyName: "state", publicName: "state", isSignal: true, isRequired: true, transformFunction: null }, meta: { classPropertyName: "meta", publicName: "meta", isSignal: true, isRequired: false, transformFunction: null }, canDownload: { classPropertyName: "canDownload", publicName: "canDownload", isSignal: true, isRequired: false, transformFunction: null }, canShare: { classPropertyName: "canShare", publicName: "canShare", isSignal: true, isRequired: false, transformFunction: null }, container: { classPropertyName: "container", publicName: "container", isSignal: true, isRequired: false, transformFunction: null }, autoId: { classPropertyName: "autoId", publicName: "autoId", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { close: "close", download: "download", share: "share", retry: "retry", imageError: "imageError" }, host: { classAttribute: "sd-file-explorer-preview-panel" }, viewQueries: [{ propertyName: "drawer", first: true, predicate: SdSideDrawer, descendants: true, isSignal: true }], ngImport: i0, template: `
1012
+ @let _view = view();
1013
+ @let _state = state();
1014
+ @let _autoId = autoId();
1015
+ @let _canDownload = canDownload();
1016
+ @let _canShare = canShare();
1017
+ <sd-side-drawer width="420px" [container]="container()" [title]="drawerTitle()" [autoId]="drawerAutoId()" (sdClosed)="onDrawerClosed()">
1018
+ @if (_view) {
1019
+ <div class="detail" [attr.data-autoid]="_autoId ?? null">
1020
+ <div class="stage" [class.stage--pdf]="_state.status === 'pdf'" [attr.aria-busy]="_state.status === 'loading' ? true : null">
1021
+ @switch (_state.status) {
1022
+ @case ('image') {
1023
+ <img class="image" [src]="_state.url" [alt]="_view.item.name" (error)="imageError.emit()" />
1024
+ }
1025
+ @case ('pdf') {
1026
+ @let _pdf = pdfComponent();
1027
+ @if (_pdf) {
1028
+ <ng-container *ngComponentOutlet="_pdf; inputs: pdfInputs()" />
1029
+ } @else if (pdfFailed()) {
1030
+ <div class="placeholder placeholder--error">
1031
+ <sd-icon name="error_outline" size="32px" />
1032
+ <p class="placeholder-title">{{ 'core.component.file-explorer.preview.error' | sdTranslate }}</p>
1033
+ </div>
1034
+ } @else {
1035
+ <div class="placeholder">
1036
+ <span class="spinner" aria-hidden="true"></span>
1037
+ <p class="placeholder-hint">{{ 'core.component.file-explorer.preview.loading' | sdTranslate }}</p>
1038
+ </div>
1039
+ }
1040
+ }
1041
+ @case ('loading') {
1042
+ <div class="placeholder">
1043
+ <span class="spinner" aria-hidden="true"></span>
1044
+ <p class="placeholder-hint">{{ 'core.component.file-explorer.preview.loading' | sdTranslate }}</p>
1045
+ </div>
1046
+ }
1047
+ @case ('error') {
1048
+ <div class="placeholder placeholder--error" role="alert">
1049
+ <sd-icon name="error_outline" size="32px" />
1050
+ <p class="placeholder-title">{{ 'core.component.file-explorer.preview.error' | sdTranslate }}</p>
1051
+ @if (_state.message) {
1052
+ <p class="placeholder-hint">{{ _state.message }}</p>
1053
+ }
1054
+ <sd-button
1055
+ class="retry-button"
1056
+ type="outline"
1057
+ color="secondary"
1058
+ size="sm"
1059
+ prefixIcon="refresh"
1060
+ [title]="'core.component.file-explorer.retry' | sdTranslate"
1061
+ [attr.data-autoid]="_autoId ? _autoId + '-retry' : null"
1062
+ (click)="retry.emit()" />
1063
+ </div>
1064
+ }
1065
+ @default {
1066
+ <div class="placeholder">
1067
+ <sd-file-explorer-file-icon [icon]="_view.icon" [size]="64" />
1068
+ <p class="placeholder-title">{{ 'core.component.file-explorer.preview.unavailable' | sdTranslate }}</p>
1069
+ @if (_canDownload) {
1070
+ <p class="placeholder-hint">{{ 'core.component.file-explorer.preview.unavailable-hint' | sdTranslate }}</p>
1071
+ }
1072
+ </div>
1073
+ }
1074
+ }
1075
+ </div>
1076
+
1077
+ <dl class="meta">
1078
+ @for (row of meta(); track row.label) {
1079
+ <div class="meta-row">
1080
+ <dt>{{ row.label }}</dt>
1081
+ <dd [title]="row.value">{{ row.value }}</dd>
1082
+ </div>
1083
+ }
1084
+ </dl>
1085
+ </div>
1086
+ }
1087
+ <!-- why: each @if has a single root element carrying sdFooterRight, so Angular projects it into the drawer right footer slot. -->
1088
+ @if (_view && _canShare) {
1089
+ <sd-button
1090
+ sdFooterRight
1091
+ class="share-button"
1092
+ [type]="_canDownload ? 'outline' : 'fill'"
1093
+ [color]="_canDownload ? 'secondary' : 'primary'"
1094
+ prefixIcon="share"
1095
+ [title]="'core.component.file-explorer.share' | sdTranslate"
1096
+ [attr.data-autoid]="_autoId ? _autoId + '-share' : null"
1097
+ (click)="share.emit()" />
1098
+ }
1099
+ @if (_view && _canDownload) {
1100
+ <sd-button
1101
+ sdFooterRight
1102
+ class="download-button"
1103
+ type="fill"
1104
+ color="primary"
1105
+ prefixIcon="file_download"
1106
+ [title]="'core.component.file-explorer.download' | sdTranslate"
1107
+ [attr.data-autoid]="_autoId ? _autoId + '-download' : null"
1108
+ (click)="download.emit()" />
1109
+ }
1110
+ </sd-side-drawer>
1111
+ `, isInline: true, styles: [":host{display:none}.stage{display:flex;align-items:center;justify-content:center;height:216px;padding:14px;overflow:hidden;border-radius:12px;background:var(--sd-fe-preview-bg)}.stage--pdf{height:380px;padding:0;background:var(--sd-fe-muted-surface)}.stage--pdf>*{width:100%;height:100%;min-height:0}.image{display:block;max-width:100%;max-height:100%;border-radius:6px;object-fit:contain}.placeholder{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:8px;padding:16px;text-align:center;color:var(--sd-fe-text-secondary)}.placeholder--error{color:var(--sd-fe-error)}.placeholder--error sd-button{margin-top:4px}.placeholder-title{margin:4px 0 0;color:var(--sd-fe-text);font-size:14px;font-weight:600}.placeholder-hint{margin:0;font-size:13px;line-height:18px;color:var(--sd-fe-text-secondary)}.spinner{width:28px;height:28px;border:3px solid color-mix(in srgb,var(--sd-fe-accent) 20%,transparent);border-top-color:var(--sd-fe-accent);border-radius:50%;animation:sd-file-explorer-preview-spin .8s linear infinite}.meta{margin:20px 0 0;padding:4px 0 0;border-top:1px solid var(--sd-fe-border)}.meta-row{display:grid;grid-template-columns:84px minmax(0,1fr);align-items:baseline;gap:12px;padding:10px 0;font-size:13px;line-height:18px}.meta-row dt{color:var(--sd-fe-text-secondary)}.meta-row dd{margin:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}@keyframes sd-file-explorer-preview-spin{to{transform:rotate(360deg)}}@media(prefers-reduced-motion:reduce){.spinner{animation-duration:2.4s}}\n"], dependencies: [{ kind: "directive", type: NgComponentOutlet, selector: "[ngComponentOutlet]", inputs: ["ngComponentOutlet", "ngComponentOutletInputs", "ngComponentOutletInjector", "ngComponentOutletEnvironmentInjector", "ngComponentOutletContent", "ngComponentOutletNgModule", "ngComponentOutletNgModuleFactory"], exportAs: ["ngComponentOutlet"] }, { kind: "component", type: SdButton, selector: "sd-button", inputs: ["autoId", "type", "color", "size", "fontSet", "title", "width", "tooltip", "prefixIcon", "suffixIcon", "disabled", "openOnHover", "loading", "block", "htmlType"], outputs: ["click"] }, { kind: "component", type: SdIcon, selector: "sd-icon", inputs: ["name", "fontIcon", "color", "set", "fontSet", "size", "strokeWidth", "absoluteStrokeWidth", "ariaLabel"] }, { kind: "component", type: SdSideDrawer, selector: "sd-side-drawer", inputs: ["title", "width", "hideClose", "disableBackdropClose", "beforeClose", "container", "drawerClass", "autoId"], outputs: ["sdClosed", "sdCloseError"] }, { kind: "component", type: SdFileExplorerFileIcon, selector: "sd-file-explorer-file-icon", inputs: ["icon", "size"] }, { kind: "pipe", type: SdTranslatePipe, name: "sdTranslate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
1112
+ }
1113
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: SdFileExplorerPreviewPanel, decorators: [{
1114
+ type: Component,
1115
+ args: [{ selector: 'sd-file-explorer-preview-panel', standalone: true, imports: [NgComponentOutlet, SdButton, SdIcon, SdSideDrawer, SdTranslatePipe, SdFileExplorerFileIcon], changeDetection: ChangeDetectionStrategy.OnPush, host: {
1116
+ class: 'sd-file-explorer-preview-panel',
1117
+ }, template: `
1118
+ @let _view = view();
1119
+ @let _state = state();
1120
+ @let _autoId = autoId();
1121
+ @let _canDownload = canDownload();
1122
+ @let _canShare = canShare();
1123
+ <sd-side-drawer width="420px" [container]="container()" [title]="drawerTitle()" [autoId]="drawerAutoId()" (sdClosed)="onDrawerClosed()">
1124
+ @if (_view) {
1125
+ <div class="detail" [attr.data-autoid]="_autoId ?? null">
1126
+ <div class="stage" [class.stage--pdf]="_state.status === 'pdf'" [attr.aria-busy]="_state.status === 'loading' ? true : null">
1127
+ @switch (_state.status) {
1128
+ @case ('image') {
1129
+ <img class="image" [src]="_state.url" [alt]="_view.item.name" (error)="imageError.emit()" />
1130
+ }
1131
+ @case ('pdf') {
1132
+ @let _pdf = pdfComponent();
1133
+ @if (_pdf) {
1134
+ <ng-container *ngComponentOutlet="_pdf; inputs: pdfInputs()" />
1135
+ } @else if (pdfFailed()) {
1136
+ <div class="placeholder placeholder--error">
1137
+ <sd-icon name="error_outline" size="32px" />
1138
+ <p class="placeholder-title">{{ 'core.component.file-explorer.preview.error' | sdTranslate }}</p>
1139
+ </div>
1140
+ } @else {
1141
+ <div class="placeholder">
1142
+ <span class="spinner" aria-hidden="true"></span>
1143
+ <p class="placeholder-hint">{{ 'core.component.file-explorer.preview.loading' | sdTranslate }}</p>
1144
+ </div>
1145
+ }
1146
+ }
1147
+ @case ('loading') {
1148
+ <div class="placeholder">
1149
+ <span class="spinner" aria-hidden="true"></span>
1150
+ <p class="placeholder-hint">{{ 'core.component.file-explorer.preview.loading' | sdTranslate }}</p>
1151
+ </div>
1152
+ }
1153
+ @case ('error') {
1154
+ <div class="placeholder placeholder--error" role="alert">
1155
+ <sd-icon name="error_outline" size="32px" />
1156
+ <p class="placeholder-title">{{ 'core.component.file-explorer.preview.error' | sdTranslate }}</p>
1157
+ @if (_state.message) {
1158
+ <p class="placeholder-hint">{{ _state.message }}</p>
1159
+ }
1160
+ <sd-button
1161
+ class="retry-button"
1162
+ type="outline"
1163
+ color="secondary"
1164
+ size="sm"
1165
+ prefixIcon="refresh"
1166
+ [title]="'core.component.file-explorer.retry' | sdTranslate"
1167
+ [attr.data-autoid]="_autoId ? _autoId + '-retry' : null"
1168
+ (click)="retry.emit()" />
1169
+ </div>
1170
+ }
1171
+ @default {
1172
+ <div class="placeholder">
1173
+ <sd-file-explorer-file-icon [icon]="_view.icon" [size]="64" />
1174
+ <p class="placeholder-title">{{ 'core.component.file-explorer.preview.unavailable' | sdTranslate }}</p>
1175
+ @if (_canDownload) {
1176
+ <p class="placeholder-hint">{{ 'core.component.file-explorer.preview.unavailable-hint' | sdTranslate }}</p>
1177
+ }
1178
+ </div>
1179
+ }
1180
+ }
1181
+ </div>
1182
+
1183
+ <dl class="meta">
1184
+ @for (row of meta(); track row.label) {
1185
+ <div class="meta-row">
1186
+ <dt>{{ row.label }}</dt>
1187
+ <dd [title]="row.value">{{ row.value }}</dd>
1188
+ </div>
1189
+ }
1190
+ </dl>
1191
+ </div>
1192
+ }
1193
+ <!-- why: each @if has a single root element carrying sdFooterRight, so Angular projects it into the drawer right footer slot. -->
1194
+ @if (_view && _canShare) {
1195
+ <sd-button
1196
+ sdFooterRight
1197
+ class="share-button"
1198
+ [type]="_canDownload ? 'outline' : 'fill'"
1199
+ [color]="_canDownload ? 'secondary' : 'primary'"
1200
+ prefixIcon="share"
1201
+ [title]="'core.component.file-explorer.share' | sdTranslate"
1202
+ [attr.data-autoid]="_autoId ? _autoId + '-share' : null"
1203
+ (click)="share.emit()" />
1204
+ }
1205
+ @if (_view && _canDownload) {
1206
+ <sd-button
1207
+ sdFooterRight
1208
+ class="download-button"
1209
+ type="fill"
1210
+ color="primary"
1211
+ prefixIcon="file_download"
1212
+ [title]="'core.component.file-explorer.download' | sdTranslate"
1213
+ [attr.data-autoid]="_autoId ? _autoId + '-download' : null"
1214
+ (click)="download.emit()" />
1215
+ }
1216
+ </sd-side-drawer>
1217
+ `, styles: [":host{display:none}.stage{display:flex;align-items:center;justify-content:center;height:216px;padding:14px;overflow:hidden;border-radius:12px;background:var(--sd-fe-preview-bg)}.stage--pdf{height:380px;padding:0;background:var(--sd-fe-muted-surface)}.stage--pdf>*{width:100%;height:100%;min-height:0}.image{display:block;max-width:100%;max-height:100%;border-radius:6px;object-fit:contain}.placeholder{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:8px;padding:16px;text-align:center;color:var(--sd-fe-text-secondary)}.placeholder--error{color:var(--sd-fe-error)}.placeholder--error sd-button{margin-top:4px}.placeholder-title{margin:4px 0 0;color:var(--sd-fe-text);font-size:14px;font-weight:600}.placeholder-hint{margin:0;font-size:13px;line-height:18px;color:var(--sd-fe-text-secondary)}.spinner{width:28px;height:28px;border:3px solid color-mix(in srgb,var(--sd-fe-accent) 20%,transparent);border-top-color:var(--sd-fe-accent);border-radius:50%;animation:sd-file-explorer-preview-spin .8s linear infinite}.meta{margin:20px 0 0;padding:4px 0 0;border-top:1px solid var(--sd-fe-border)}.meta-row{display:grid;grid-template-columns:84px minmax(0,1fr);align-items:baseline;gap:12px;padding:10px 0;font-size:13px;line-height:18px}.meta-row dt{color:var(--sd-fe-text-secondary)}.meta-row dd{margin:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}@keyframes sd-file-explorer-preview-spin{to{transform:rotate(360deg)}}@media(prefers-reduced-motion:reduce){.spinner{animation-duration:2.4s}}\n"] }]
1218
+ }], ctorParameters: () => [], propDecorators: { view: [{ type: i0.Input, args: [{ isSignal: true, alias: "view", required: false }] }], state: [{ type: i0.Input, args: [{ isSignal: true, alias: "state", required: true }] }], meta: [{ type: i0.Input, args: [{ isSignal: true, alias: "meta", required: false }] }], canDownload: [{ type: i0.Input, args: [{ isSignal: true, alias: "canDownload", required: false }] }], canShare: [{ type: i0.Input, args: [{ isSignal: true, alias: "canShare", required: false }] }], container: [{ type: i0.Input, args: [{ isSignal: true, alias: "container", required: false }] }], autoId: [{ type: i0.Input, args: [{ isSignal: true, alias: "autoId", required: false }] }], close: [{ type: i0.Output, args: ["close"] }], download: [{ type: i0.Output, args: ["download"] }], share: [{ type: i0.Output, args: ["share"] }], retry: [{ type: i0.Output, args: ["retry"] }], imageError: [{ type: i0.Output, args: ["imageError"] }], drawer: [{ type: i0.ViewChild, args: [i0.forwardRef(() => SdSideDrawer), { isSignal: true }] }] } });
1219
+
1220
+ let nextTransferPanelId = 0;
1221
+ /**
1222
+ * Transfer queue docked at the bottom of the explorer (internal). Shows one card per upload / download with
1223
+ * its status, a progress bar and the cancel / retry / dismiss actions allowed by its state.
1224
+ */
1225
+ class SdFileExplorerTransferPanel {
1226
+ /** Cards to render, newest last. */
1227
+ transfers = input.required(...(ngDevMode ? [{ debugName: "transfers" }] : []));
1228
+ /** Header text ("Transfers · 2 items"). */
1229
+ title = input('', ...(ngDevMode ? [{ debugName: "title" }] : []));
1230
+ /** Hide the cards, keep the header. */
1231
+ collapsed = input(false, ...(ngDevMode ? [{ debugName: "collapsed" }] : []));
1232
+ /** Show the "Clear finished" button. */
1233
+ canClear = input(false, ...(ngDevMode ? [{ debugName: "canClear" }] : []));
1234
+ /** Narrow layout: "Clear finished" becomes an icon button so the header stays on one line. */
1235
+ compact = input(false, ...(ngDevMode ? [{ debugName: "compact" }] : []));
1236
+ /** E2E scope of the panel. */
1237
+ autoId = input(undefined, ...(ngDevMode ? [{ debugName: "autoId" }] : []));
1238
+ toggleCollapsed = output();
1239
+ clear = output();
1240
+ cancel = output();
1241
+ retry = output();
1242
+ dismiss = output();
1243
+ titleId = `sd-file-explorer-transfers-title-${nextTransferPanelId}`;
1244
+ listId = `sd-file-explorer-transfers-list-${nextTransferPanelId++}`;
1245
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: SdFileExplorerTransferPanel, deps: [], target: i0.ɵɵFactoryTarget.Component });
1246
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.25", type: SdFileExplorerTransferPanel, isStandalone: true, selector: "sd-file-explorer-transfer-panel", inputs: { transfers: { classPropertyName: "transfers", publicName: "transfers", isSignal: true, isRequired: true, transformFunction: null }, title: { classPropertyName: "title", publicName: "title", isSignal: true, isRequired: false, transformFunction: null }, collapsed: { classPropertyName: "collapsed", publicName: "collapsed", isSignal: true, isRequired: false, transformFunction: null }, canClear: { classPropertyName: "canClear", publicName: "canClear", isSignal: true, isRequired: false, transformFunction: null }, compact: { classPropertyName: "compact", publicName: "compact", isSignal: true, isRequired: false, transformFunction: null }, autoId: { classPropertyName: "autoId", publicName: "autoId", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { toggleCollapsed: "toggleCollapsed", clear: "clear", cancel: "cancel", retry: "retry", dismiss: "dismiss" }, host: { properties: { "class.sd-file-explorer-transfer-panel--compact": "compact()" }, classAttribute: "sd-file-explorer-transfer-panel" }, ngImport: i0, template: `
1247
+ @let _collapsed = collapsed();
1248
+ @let _autoId = autoId();
1249
+ @let _compact = compact();
1250
+ @let _clearLabel = 'core.component.file-explorer.transfers.clear' | sdTranslate;
1251
+ <section class="panel" [attr.aria-labelledby]="titleId">
1252
+ <header class="head">
1253
+ <svg class="head-icon" viewBox="0 0 24 24" focusable="false" aria-hidden="true" xmlns="http://www.w3.org/2000/svg">
1254
+ <path
1255
+ d="M12 4v16M7.5 8.5 12 4l4.5 4.5M7.5 15.5 12 20l4.5-4.5"
1256
+ fill="none"
1257
+ stroke="currentColor"
1258
+ stroke-width="2"
1259
+ stroke-linecap="round"
1260
+ stroke-linejoin="round" />
1261
+ </svg>
1262
+ <h3 class="title" [id]="titleId" [title]="title()">{{ title() }}</h3>
1263
+ @if (canClear()) {
1264
+ <sd-button
1265
+ class="clear-button"
1266
+ type="text"
1267
+ color="primary"
1268
+ size="sm"
1269
+ [prefixIcon]="_compact ? 'delete_sweep' : undefined"
1270
+ [title]="_compact ? undefined : _clearLabel"
1271
+ [tooltip]="_compact ? _clearLabel : undefined"
1272
+ [attr.data-autoid]="_autoId ? _autoId + '-clear' : null"
1273
+ (click)="clear.emit()" />
1274
+ }
1275
+ <button
1276
+ type="button"
1277
+ class="icon-button"
1278
+ [attr.aria-expanded]="!_collapsed"
1279
+ [attr.aria-controls]="listId"
1280
+ [attr.aria-label]="
1281
+ (_collapsed ? 'core.component.file-explorer.transfers.expand' : 'core.component.file-explorer.transfers.collapse') | sdTranslate
1282
+ "
1283
+ [attr.data-autoid]="_autoId ? _autoId + '-toggle' : null"
1284
+ (click)="toggleCollapsed.emit()">
1285
+ <sd-icon [name]="_collapsed ? 'expand_less' : 'expand_more'" size="22px" />
1286
+ </button>
1287
+ </header>
1288
+ <ul class="cards" [id]="listId" [hidden]="_collapsed" [attr.aria-label]="'core.component.file-explorer.transfers.list' | sdTranslate">
1289
+ @for (view of transfers(); track view.transfer.id) {
1290
+ <li class="card" [class]="'card--' + view.tone" [attr.data-autoid]="view.autoId">
1291
+ <div class="card-row">
1292
+ <sd-icon
1293
+ class="direction"
1294
+ [name]="view.transfer.direction === 'upload' ? 'file_upload' : 'file_download'"
1295
+ size="22px"
1296
+ [ariaLabel]="view.directionLabel" />
1297
+ <span class="name" [title]="view.transfer.name">{{ view.transfer.name }}</span>
1298
+ <span class="status">{{ view.statusLabel }}</span>
1299
+ @if (view.canCancel) {
1300
+ <sd-button
1301
+ class="card-action"
1302
+ type="text"
1303
+ color="secondary"
1304
+ size="sm"
1305
+ prefixIcon="close"
1306
+ [tooltip]="view.cancelLabel"
1307
+ [attr.data-autoid]="view.autoId ? view.autoId + '-cancel' : null"
1308
+ (click)="cancel.emit(view.transfer.id)" />
1309
+ }
1310
+ @if (view.canRetry) {
1311
+ <sd-button
1312
+ class="card-action"
1313
+ type="text"
1314
+ color="secondary"
1315
+ size="sm"
1316
+ prefixIcon="refresh"
1317
+ [tooltip]="view.retryLabel"
1318
+ [attr.data-autoid]="view.autoId ? view.autoId + '-retry' : null"
1319
+ (click)="retry.emit(view.transfer.id)" />
1320
+ }
1321
+ @if (view.canDismiss) {
1322
+ <sd-button
1323
+ class="card-action"
1324
+ type="text"
1325
+ color="secondary"
1326
+ size="sm"
1327
+ prefixIcon="close"
1328
+ [tooltip]="view.dismissLabel"
1329
+ [attr.data-autoid]="view.autoId ? view.autoId + '-dismiss' : null"
1330
+ (click)="dismiss.emit(view.transfer.id)" />
1331
+ }
1332
+ </div>
1333
+ <div
1334
+ class="bar"
1335
+ role="progressbar"
1336
+ aria-valuemin="0"
1337
+ aria-valuemax="100"
1338
+ [class.bar--indeterminate]="view.progress === 'indeterminate'"
1339
+ [attr.aria-valuenow]="view.progress === 'determinate' ? view.percent : view.progress === 'full' ? 100 : null"
1340
+ [attr.aria-label]="view.transfer.name + ': ' + view.statusLabel">
1341
+ <span
1342
+ class="bar-fill"
1343
+ [style.width.%]="view.progress === 'determinate' ? view.percent : view.progress === 'none' ? 0 : 100"></span>
1344
+ </div>
1345
+ @if (view.errorMessage) {
1346
+ <p class="error" [title]="view.errorMessage">{{ view.errorMessage }}</p>
1347
+ }
1348
+ </li>
1349
+ }
1350
+ </ul>
1351
+ </section>
1352
+ `, isInline: true, styles: [":host{display:block}.panel{padding:12px 20px 18px}:host(.sd-file-explorer-transfer-panel--compact) .panel{padding:10px 14px 14px}.head{display:flex;align-items:center;gap:10px;min-height:32px}.head-icon{flex:none;width:22px;height:22px;color:var(--sd-fe-accent)}.title{flex:1;min-width:0;margin:0;overflow:hidden;font-size:16px;font-weight:600;line-height:22px;color:var(--sd-fe-text);text-overflow:ellipsis;white-space:nowrap}.cards{list-style:none;margin:12px 0 0;padding:0;display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,320px),1fr));gap:12px 20px;max-height:188px;overflow-y:auto}.cards[hidden]{display:none}.card{display:flex;flex-direction:column;gap:11px;min-width:0;padding:12px 14px;border:1px solid var(--sd-fe-border);border-radius:10px;background:var(--sd-fe-surface)}.card-row{display:flex;align-items:center;gap:10px;min-height:22px}.direction{flex:none;color:var(--sd-fe-accent)}.name{flex:1;min-width:0;overflow:hidden;font-size:14px;font-weight:600;color:var(--sd-fe-text);text-overflow:ellipsis;white-space:nowrap}.status{flex:none;font-size:13px;color:var(--sd-fe-text-secondary);font-variant-numeric:tabular-nums}.bar{position:relative;height:6px;overflow:hidden;border-radius:999px;background:var(--sd-fe-track)}.bar-fill{position:absolute;inset:0 auto 0 0;border-radius:inherit;background:var(--sd-fe-accent);transition:width .2s ease}.bar--indeterminate .bar-fill{width:36%!important;animation:sd-file-explorer-indeterminate 1.3s ease-in-out infinite}.card--success .bar-fill{background:var(--sd-fe-success)}.card--error{border-color:color-mix(in srgb,var(--sd-fe-error) 35%,var(--sd-fe-border))}.card--error .bar-fill{background:var(--sd-fe-error)}.card--error .status{color:var(--sd-fe-error);font-weight:600}.card--muted .bar-fill{background:var(--sd-fe-border-strong)}.error{margin:-4px 0 0;overflow:hidden;font-size:12px;color:var(--sd-fe-error);text-overflow:ellipsis;white-space:nowrap}.icon-button{flex:none;display:inline-flex;align-items:center;justify-content:center;width:32px;height:32px;padding:0;border:0;border-radius:999px;background:transparent;color:var(--sd-fe-text-secondary);cursor:pointer}.icon-button:hover{background:var(--sd-fe-hover-strong);color:var(--sd-fe-text)}.icon-button:focus-visible{outline:2px solid var(--sd-fe-accent);outline-offset:1px}.card-action{flex:none;margin:-5px -6px -5px -2px}.clear-button{flex:none}@keyframes sd-file-explorer-indeterminate{0%{left:-36%}to{left:100%}}@media(prefers-reduced-motion:reduce){.bar--indeterminate .bar-fill{animation-duration:3s}.bar-fill{transition:none}}\n"], dependencies: [{ kind: "component", type: SdButton, selector: "sd-button", inputs: ["autoId", "type", "color", "size", "fontSet", "title", "width", "tooltip", "prefixIcon", "suffixIcon", "disabled", "openOnHover", "loading", "block", "htmlType"], outputs: ["click"] }, { kind: "component", type: SdIcon, selector: "sd-icon", inputs: ["name", "fontIcon", "color", "set", "fontSet", "size", "strokeWidth", "absoluteStrokeWidth", "ariaLabel"] }, { kind: "pipe", type: SdTranslatePipe, name: "sdTranslate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
1353
+ }
1354
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: SdFileExplorerTransferPanel, decorators: [{
1355
+ type: Component,
1356
+ args: [{ selector: 'sd-file-explorer-transfer-panel', standalone: true, imports: [SdButton, SdIcon, SdTranslatePipe], changeDetection: ChangeDetectionStrategy.OnPush, host: { class: 'sd-file-explorer-transfer-panel', '[class.sd-file-explorer-transfer-panel--compact]': 'compact()' }, template: `
1357
+ @let _collapsed = collapsed();
1358
+ @let _autoId = autoId();
1359
+ @let _compact = compact();
1360
+ @let _clearLabel = 'core.component.file-explorer.transfers.clear' | sdTranslate;
1361
+ <section class="panel" [attr.aria-labelledby]="titleId">
1362
+ <header class="head">
1363
+ <svg class="head-icon" viewBox="0 0 24 24" focusable="false" aria-hidden="true" xmlns="http://www.w3.org/2000/svg">
1364
+ <path
1365
+ d="M12 4v16M7.5 8.5 12 4l4.5 4.5M7.5 15.5 12 20l4.5-4.5"
1366
+ fill="none"
1367
+ stroke="currentColor"
1368
+ stroke-width="2"
1369
+ stroke-linecap="round"
1370
+ stroke-linejoin="round" />
1371
+ </svg>
1372
+ <h3 class="title" [id]="titleId" [title]="title()">{{ title() }}</h3>
1373
+ @if (canClear()) {
1374
+ <sd-button
1375
+ class="clear-button"
1376
+ type="text"
1377
+ color="primary"
1378
+ size="sm"
1379
+ [prefixIcon]="_compact ? 'delete_sweep' : undefined"
1380
+ [title]="_compact ? undefined : _clearLabel"
1381
+ [tooltip]="_compact ? _clearLabel : undefined"
1382
+ [attr.data-autoid]="_autoId ? _autoId + '-clear' : null"
1383
+ (click)="clear.emit()" />
1384
+ }
1385
+ <button
1386
+ type="button"
1387
+ class="icon-button"
1388
+ [attr.aria-expanded]="!_collapsed"
1389
+ [attr.aria-controls]="listId"
1390
+ [attr.aria-label]="
1391
+ (_collapsed ? 'core.component.file-explorer.transfers.expand' : 'core.component.file-explorer.transfers.collapse') | sdTranslate
1392
+ "
1393
+ [attr.data-autoid]="_autoId ? _autoId + '-toggle' : null"
1394
+ (click)="toggleCollapsed.emit()">
1395
+ <sd-icon [name]="_collapsed ? 'expand_less' : 'expand_more'" size="22px" />
1396
+ </button>
1397
+ </header>
1398
+ <ul class="cards" [id]="listId" [hidden]="_collapsed" [attr.aria-label]="'core.component.file-explorer.transfers.list' | sdTranslate">
1399
+ @for (view of transfers(); track view.transfer.id) {
1400
+ <li class="card" [class]="'card--' + view.tone" [attr.data-autoid]="view.autoId">
1401
+ <div class="card-row">
1402
+ <sd-icon
1403
+ class="direction"
1404
+ [name]="view.transfer.direction === 'upload' ? 'file_upload' : 'file_download'"
1405
+ size="22px"
1406
+ [ariaLabel]="view.directionLabel" />
1407
+ <span class="name" [title]="view.transfer.name">{{ view.transfer.name }}</span>
1408
+ <span class="status">{{ view.statusLabel }}</span>
1409
+ @if (view.canCancel) {
1410
+ <sd-button
1411
+ class="card-action"
1412
+ type="text"
1413
+ color="secondary"
1414
+ size="sm"
1415
+ prefixIcon="close"
1416
+ [tooltip]="view.cancelLabel"
1417
+ [attr.data-autoid]="view.autoId ? view.autoId + '-cancel' : null"
1418
+ (click)="cancel.emit(view.transfer.id)" />
1419
+ }
1420
+ @if (view.canRetry) {
1421
+ <sd-button
1422
+ class="card-action"
1423
+ type="text"
1424
+ color="secondary"
1425
+ size="sm"
1426
+ prefixIcon="refresh"
1427
+ [tooltip]="view.retryLabel"
1428
+ [attr.data-autoid]="view.autoId ? view.autoId + '-retry' : null"
1429
+ (click)="retry.emit(view.transfer.id)" />
1430
+ }
1431
+ @if (view.canDismiss) {
1432
+ <sd-button
1433
+ class="card-action"
1434
+ type="text"
1435
+ color="secondary"
1436
+ size="sm"
1437
+ prefixIcon="close"
1438
+ [tooltip]="view.dismissLabel"
1439
+ [attr.data-autoid]="view.autoId ? view.autoId + '-dismiss' : null"
1440
+ (click)="dismiss.emit(view.transfer.id)" />
1441
+ }
1442
+ </div>
1443
+ <div
1444
+ class="bar"
1445
+ role="progressbar"
1446
+ aria-valuemin="0"
1447
+ aria-valuemax="100"
1448
+ [class.bar--indeterminate]="view.progress === 'indeterminate'"
1449
+ [attr.aria-valuenow]="view.progress === 'determinate' ? view.percent : view.progress === 'full' ? 100 : null"
1450
+ [attr.aria-label]="view.transfer.name + ': ' + view.statusLabel">
1451
+ <span
1452
+ class="bar-fill"
1453
+ [style.width.%]="view.progress === 'determinate' ? view.percent : view.progress === 'none' ? 0 : 100"></span>
1454
+ </div>
1455
+ @if (view.errorMessage) {
1456
+ <p class="error" [title]="view.errorMessage">{{ view.errorMessage }}</p>
1457
+ }
1458
+ </li>
1459
+ }
1460
+ </ul>
1461
+ </section>
1462
+ `, styles: [":host{display:block}.panel{padding:12px 20px 18px}:host(.sd-file-explorer-transfer-panel--compact) .panel{padding:10px 14px 14px}.head{display:flex;align-items:center;gap:10px;min-height:32px}.head-icon{flex:none;width:22px;height:22px;color:var(--sd-fe-accent)}.title{flex:1;min-width:0;margin:0;overflow:hidden;font-size:16px;font-weight:600;line-height:22px;color:var(--sd-fe-text);text-overflow:ellipsis;white-space:nowrap}.cards{list-style:none;margin:12px 0 0;padding:0;display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,320px),1fr));gap:12px 20px;max-height:188px;overflow-y:auto}.cards[hidden]{display:none}.card{display:flex;flex-direction:column;gap:11px;min-width:0;padding:12px 14px;border:1px solid var(--sd-fe-border);border-radius:10px;background:var(--sd-fe-surface)}.card-row{display:flex;align-items:center;gap:10px;min-height:22px}.direction{flex:none;color:var(--sd-fe-accent)}.name{flex:1;min-width:0;overflow:hidden;font-size:14px;font-weight:600;color:var(--sd-fe-text);text-overflow:ellipsis;white-space:nowrap}.status{flex:none;font-size:13px;color:var(--sd-fe-text-secondary);font-variant-numeric:tabular-nums}.bar{position:relative;height:6px;overflow:hidden;border-radius:999px;background:var(--sd-fe-track)}.bar-fill{position:absolute;inset:0 auto 0 0;border-radius:inherit;background:var(--sd-fe-accent);transition:width .2s ease}.bar--indeterminate .bar-fill{width:36%!important;animation:sd-file-explorer-indeterminate 1.3s ease-in-out infinite}.card--success .bar-fill{background:var(--sd-fe-success)}.card--error{border-color:color-mix(in srgb,var(--sd-fe-error) 35%,var(--sd-fe-border))}.card--error .bar-fill{background:var(--sd-fe-error)}.card--error .status{color:var(--sd-fe-error);font-weight:600}.card--muted .bar-fill{background:var(--sd-fe-border-strong)}.error{margin:-4px 0 0;overflow:hidden;font-size:12px;color:var(--sd-fe-error);text-overflow:ellipsis;white-space:nowrap}.icon-button{flex:none;display:inline-flex;align-items:center;justify-content:center;width:32px;height:32px;padding:0;border:0;border-radius:999px;background:transparent;color:var(--sd-fe-text-secondary);cursor:pointer}.icon-button:hover{background:var(--sd-fe-hover-strong);color:var(--sd-fe-text)}.icon-button:focus-visible{outline:2px solid var(--sd-fe-accent);outline-offset:1px}.card-action{flex:none;margin:-5px -6px -5px -2px}.clear-button{flex:none}@keyframes sd-file-explorer-indeterminate{0%{left:-36%}to{left:100%}}@media(prefers-reduced-motion:reduce){.bar--indeterminate .bar-fill{animation-duration:3s}.bar-fill{transition:none}}\n"] }]
1463
+ }], propDecorators: { transfers: [{ type: i0.Input, args: [{ isSignal: true, alias: "transfers", required: true }] }], title: [{ type: i0.Input, args: [{ isSignal: true, alias: "title", required: false }] }], collapsed: [{ type: i0.Input, args: [{ isSignal: true, alias: "collapsed", required: false }] }], canClear: [{ type: i0.Input, args: [{ isSignal: true, alias: "canClear", required: false }] }], compact: [{ type: i0.Input, args: [{ isSignal: true, alias: "compact", required: false }] }], autoId: [{ type: i0.Input, args: [{ isSignal: true, alias: "autoId", required: false }] }], toggleCollapsed: [{ type: i0.Output, args: ["toggleCollapsed"] }], clear: [{ type: i0.Output, args: ["clear"] }], cancel: [{ type: i0.Output, args: ["cancel"] }], retry: [{ type: i0.Output, args: ["retry"] }], dismiss: [{ type: i0.Output, args: ["dismiss"] }] } });
1464
+
1465
+ /** Delay between the last keystroke and the `search` callback. */
1466
+ const SEARCH_DEBOUNCE_MS = 300;
1467
+ /** Uploads running at the same time; extra files wait as `queued`. */
1468
+ const MAX_PARALLEL_UPLOADS = 3;
1469
+ /** Below this host width the explorer switches to the compact (mobile) layout. */
1470
+ const COMPACT_MAX_WIDTH = 720;
1471
+ /** How long a saved download's object URL stays alive before it is revoked. */
1472
+ const DOWNLOAD_URL_TTL_MS = 40_000;
1473
+ const ACTIVE_STATUSES = new Set(['queued', 'preparing', 'transferring']);
1474
+ const FINISHED_STATUSES = new Set(['done', 'error', 'cancelled']);
1475
+ let nextExplorerId = 0;
1476
+ /**
1477
+ * Google-Drive-like file browser: folder tree, breadcrumb, list / grid, search, file detail drawer, uploads with
1478
+ * drag-and-drop, downloads and a transfer queue — all inside one element.
1479
+ *
1480
+ * Storage-agnostic: every read and write goes through the callbacks of `SdFileExplorerOption`.
1481
+ *
1482
+ * @example
1483
+ * ```html
1484
+ * <sd-file-explorer [option]="option" (open)="onOpen($event)" />
1485
+ * ```
1486
+ */
1487
+ class SdFileExplorer {
1488
+ #i18n = inject(I18nService);
1489
+ #host = inject(ElementRef);
1490
+ #document = inject(DOCUMENT);
1491
+ #injector = inject(Injector);
1492
+ #zone = inject(NgZone);
1493
+ /** Data callbacks and display settings. See `SdFileExplorerOption`. */
1494
+ option = input.required(...(ngDevMode ? [{ debugName: "option" }] : []));
1495
+ /**
1496
+ * Emitted exactly once each time the user opens a file (click, `Enter` or `Space` on a file in the list,
1497
+ * grid or search results), right before the detail drawer starts loading. Never emitted for folders.
1498
+ */
1499
+ open = output();
1500
+ // ---- State ----
1501
+ #folders = signal(new Map(), ...(ngDevMode ? [{ debugName: "#folders" }] : []));
1502
+ #currentId = signal(null, ...(ngDevMode ? [{ debugName: "#currentId" }] : []));
1503
+ #path = signal([], ...(ngDevMode ? [{ debugName: "#path" }] : []));
1504
+ #expanded = signal(new Set(), ...(ngDevMode ? [{ debugName: "#expanded" }] : []));
1505
+ #search = signal(null, ...(ngDevMode ? [{ debugName: "#search" }] : []));
1506
+ #previewItem = signal(null, ...(ngDevMode ? [{ debugName: "#previewItem" }] : []));
1507
+ #transfers = signal([], ...(ngDevMode ? [{ debugName: "#transfers" }] : []));
1508
+ #width = signal(0, ...(ngDevMode ? [{ debugName: "#width" }] : []));
1509
+ view = signal('list', ...(ngDevMode ? [{ debugName: "view" }] : []));
1510
+ keyword = signal('', ...(ngDevMode ? [{ debugName: "keyword" }] : []));
1511
+ previewState = signal({ status: 'idle' }, ...(ngDevMode ? [{ debugName: "previewState" }] : []));
1512
+ transfersCollapsed = signal(false, ...(ngDevMode ? [{ debugName: "transfersCollapsed" }] : []));
1513
+ sidebarOpen = signal(false, ...(ngDevMode ? [{ debugName: "sidebarOpen" }] : []));
1514
+ dragActive = signal(false, ...(ngDevMode ? [{ debugName: "dragActive" }] : []));
1515
+ folderDialogOpen = signal(false, ...(ngDevMode ? [{ debugName: "folderDialogOpen" }] : []));
1516
+ folderName = signal('', ...(ngDevMode ? [{ debugName: "folderName" }] : []));
1517
+ folderSubmitting = signal(false, ...(ngDevMode ? [{ debugName: "folderSubmitting" }] : []));
1518
+ folderError = signal('', ...(ngDevMode ? [{ debugName: "folderError" }] : []));
1519
+ /** File whose share dialog is open. */
1520
+ shareItem = signal(null, ...(ngDevMode ? [{ debugName: "shareItem" }] : []));
1521
+ shareState = signal({ status: 'loading' }, ...(ngDevMode ? [{ debugName: "shareState" }] : []));
1522
+ /** Result of the last copy attempt: copied to the clipboard, or selected for a manual Ctrl+C. */
1523
+ // why: kiểu khai báo tường minh bằng alias — union tự suy ra được in vào d.ts theo thứ tự nội bộ của TypeScript,
1524
+ // thứ tự này đổi theo máy build (v22/TS 6 in khác nhau giữa checkout LF và CRLF) làm lệch snapshot release.
1525
+ shareFeedback = signal('', ...(ngDevMode ? [{ debugName: "shareFeedback" }] : []));
1526
+ /**
1527
+ * Uploads and downloads started in this explorer, oldest first. Read-only; use it for example to warn
1528
+ * before leaving the page while `status` is `queued`, `preparing` or `transferring`.
1529
+ */
1530
+ transfers = this.#transfers.asReadonly();
1531
+ searchInput = viewChild('searchInput', ...(ngDevMode ? [{ debugName: "searchInput" }] : []));
1532
+ folderInput = viewChild('folderInput', ...(ngDevMode ? [{ debugName: "folderInput" }] : []));
1533
+ // why: đọc ElementRef của host <sd-button> — focus phải đặt vào <button> bên trong, không phải host.
1534
+ newFolderButton = viewChild('newFolderButton', ...(ngDevMode ? [{ debugName: "newFolderButton", read: ElementRef }] : [{ read: ElementRef }]));
1535
+ copyButton = viewChild('copyButton', ...(ngDevMode ? [{ debugName: "copyButton", read: ElementRef }] : [{ read: ElementRef }]));
1536
+ shareInput = viewChild('shareInput', ...(ngDevMode ? [{ debugName: "shareInput" }] : []));
1537
+ shareDialog = viewChild('shareDialog', ...(ngDevMode ? [{ debugName: "shareDialog" }] : []));
1538
+ sidebar = viewChild('sidebar', ...(ngDevMode ? [{ debugName: "sidebar" }] : []));
1539
+ // ---- Non-reactive bookkeeping ----
1540
+ #listControllers = new Map();
1541
+ #jobs = new Map();
1542
+ #uploadQueue = [];
1543
+ #downloadUrls = new Map();
1544
+ #activeUploads = 0;
1545
+ #transferSeq = 0;
1546
+ #searchTimer = null;
1547
+ #searchController = null;
1548
+ #previewController = null;
1549
+ #previewObjectUrl = null;
1550
+ #shareController = null;
1551
+ #shareReturnFocus = null;
1552
+ #dragDepth = 0;
1553
+ #listFn = null;
1554
+ #resizeObserver = null;
1555
+ #destroyed = false;
1556
+ instanceId = `sd-file-explorer-${nextExplorerId++}`;
1557
+ // ---- Derived ----
1558
+ compact = computed(() => {
1559
+ const width = this.#width();
1560
+ return width > 0 && width < COMPACT_MAX_WIDTH;
1561
+ }, ...(ngDevMode ? [{ debugName: "compact" }] : []));
1562
+ autoId = computed(() => {
1563
+ const scope = this.option().autoId;
1564
+ return scope ? `components-file-explorer-${scope}` : undefined;
1565
+ }, ...(ngDevMode ? [{ debugName: "autoId" }] : []));
1566
+ locale = computed(() => sdFileExplorerLocale(this.#i18n.language()), ...(ngDevMode ? [{ debugName: "locale" }] : []));
1567
+ rootLabel = computed(() => this.option().rootLabel || this.#i18n.t('core.component.file-explorer.root'), ...(ngDevMode ? [{ debugName: "rootLabel" }] : []));
1568
+ canUpload = computed(() => typeof this.option().upload === 'function', ...(ngDevMode ? [{ debugName: "canUpload" }] : []));
1569
+ canDownload = computed(() => typeof this.option().download === 'function', ...(ngDevMode ? [{ debugName: "canDownload" }] : []));
1570
+ canCreateFolder = computed(() => typeof this.option().createFolder === 'function', ...(ngDevMode ? [{ debugName: "canCreateFolder" }] : []));
1571
+ canShare = computed(() => typeof this.option().share === 'function', ...(ngDevMode ? [{ debugName: "canShare" }] : []));
1572
+ #serverSearch = computed(() => typeof this.option().search === 'function', ...(ngDevMode ? [{ debugName: "#serverSearch" }] : []));
1573
+ currentName = computed(() => {
1574
+ const path = this.#path();
1575
+ return path.length ? path[path.length - 1].name : this.rootLabel();
1576
+ }, ...(ngDevMode ? [{ debugName: "currentName" }] : []));
1577
+ #itemById = computed(() => {
1578
+ const map = new Map();
1579
+ for (const state of this.#folders().values()) {
1580
+ for (const item of state.items)
1581
+ map.set(item.id, item);
1582
+ }
1583
+ for (const folder of this.#path())
1584
+ if (!map.has(folder.id))
1585
+ map.set(folder.id, folder);
1586
+ return map;
1587
+ }, ...(ngDevMode ? [{ debugName: "#itemById" }] : []));
1588
+ #currentFolder = computed(() => this.#folders().get(this.#currentId()), ...(ngDevMode ? [{ debugName: "#currentFolder" }] : []));
1589
+ #trimmedKeyword = computed(() => this.keyword().trim(), ...(ngDevMode ? [{ debugName: "#trimmedKeyword" }] : []));
1590
+ searching = computed(() => this.#trimmedKeyword().length > 0, ...(ngDevMode ? [{ debugName: "searching" }] : []));
1591
+ #visibleItems = computed(() => {
1592
+ const keyword = this.#trimmedKeyword();
1593
+ const items = this.#currentFolder()?.items ?? [];
1594
+ if (!keyword)
1595
+ return items;
1596
+ if (this.#serverSearch()) {
1597
+ const search = this.#search();
1598
+ return search && search.keyword === keyword && search.status === 'loaded' ? search.items : [];
1599
+ }
1600
+ const needle = sdFileExplorerNormalize(keyword);
1601
+ return items.filter(item => sdFileExplorerNormalize(item.name).includes(needle));
1602
+ }, ...(ngDevMode ? [{ debugName: "#visibleItems" }] : []));
1603
+ itemViews = computed(() => {
1604
+ const format = this.#itemFormatter();
1605
+ return sdFileExplorerFoldersFirst(this.#visibleItems()).map(format);
1606
+ }, ...(ngDevMode ? [{ debugName: "itemViews" }] : []));
1607
+ // why: như shareFeedback — kiểu tường minh để d.ts ổn định giữa các máy build.
1608
+ contentState = computed(() => {
1609
+ const keyword = this.#trimmedKeyword();
1610
+ if (keyword && this.#serverSearch()) {
1611
+ const search = this.#search();
1612
+ if (!search || search.keyword !== keyword || search.status === 'loading')
1613
+ return 'loading';
1614
+ if (search.status === 'error')
1615
+ return 'error';
1616
+ return search.items.length ? 'items' : 'empty';
1617
+ }
1618
+ const folder = this.#currentFolder();
1619
+ if (!folder || (folder.status === 'loading' && !folder.loaded))
1620
+ return 'loading';
1621
+ if (folder.status === 'error')
1622
+ return 'error';
1623
+ return this.#visibleItems().length ? 'items' : 'empty';
1624
+ }, ...(ngDevMode ? [{ debugName: "contentState" }] : []));
1625
+ refreshing = computed(() => {
1626
+ const folder = this.#currentFolder();
1627
+ return !!folder && folder.status === 'loading' && folder.loaded && !this.searching();
1628
+ }, ...(ngDevMode ? [{ debugName: "refreshing" }] : []));
1629
+ errorMessage = computed(() => {
1630
+ const error = this.searching() && this.#serverSearch() ? this.#search()?.error : this.#currentFolder()?.error;
1631
+ return sdFileExplorerErrorMessage(error);
1632
+ }, ...(ngDevMode ? [{ debugName: "errorMessage" }] : []));
1633
+ heading = computed(() => this.searching() ? this.#i18n.t('core.component.file-explorer.search-results') : this.currentName(), ...(ngDevMode ? [{ debugName: "heading" }] : []));
1634
+ itemCountLabel = computed(() => this.#i18n.t('core.component.file-explorer.item-count', { count: this.#visibleItems().length }), ...(ngDevMode ? [{ debugName: "itemCountLabel" }] : []));
1635
+ emptyTitle = computed(() => this.searching()
1636
+ ? this.#i18n.t('core.component.file-explorer.search-empty', { keyword: this.#trimmedKeyword() })
1637
+ : this.#i18n.t('core.component.file-explorer.empty'), ...(ngDevMode ? [{ debugName: "emptyTitle" }] : []));
1638
+ emptyMessage = computed(() => !this.searching() && this.canUpload() ? this.#i18n.t('core.component.file-explorer.empty-upload-hint') : '', ...(ngDevMode ? [{ debugName: "emptyMessage" }] : []));
1639
+ dropTitle = computed(() => this.#i18n.t('core.component.file-explorer.drop-title', { folder: this.currentName() }), ...(ngDevMode ? [{ debugName: "dropTitle" }] : []));
1640
+ shareTitle = computed(() => this.#i18n.t('core.component.file-explorer.share.title', { name: this.shareItem()?.name ?? '' }), ...(ngDevMode ? [{ debugName: "shareTitle" }] : []));
1641
+ shareFeedbackLabel = computed(() => {
1642
+ const feedback = this.shareFeedback();
1643
+ if (feedback === 'copied')
1644
+ return this.#i18n.t('core.component.file-explorer.share.copied');
1645
+ if (feedback === 'manual')
1646
+ return this.#i18n.t('core.component.file-explorer.share.copy-manual');
1647
+ return '';
1648
+ }, ...(ngDevMode ? [{ debugName: "shareFeedbackLabel" }] : []));
1649
+ folderDialogTitle = computed(() => this.#i18n.t('core.component.file-explorer.new-folder-title', { folder: this.currentName() }), ...(ngDevMode ? [{ debugName: "folderDialogTitle" }] : []));
1650
+ /** Breadcrumb trail plus the folder each entry navigates to. */
1651
+ breadcrumb = computed(() => {
1652
+ const targets = new Map();
1653
+ const items = [];
1654
+ const root = { label: this.rootLabel(), clickable: true };
1655
+ targets.set(root, null);
1656
+ items.push(root);
1657
+ for (const folder of this.#path()) {
1658
+ const entry = { label: folder.name, clickable: true };
1659
+ targets.set(entry, folder);
1660
+ items.push(entry);
1661
+ }
1662
+ return { items, targets };
1663
+ }, ...(ngDevMode ? [{ debugName: "breadcrumb" }] : []));
1664
+ treeNodes = computed(() => {
1665
+ const folders = this.#folders();
1666
+ const expanded = this.#expanded();
1667
+ const current = this.#currentId();
1668
+ const autoId = this.autoId();
1669
+ const rootState = folders.get(null);
1670
+ const nodes = [
1671
+ {
1672
+ key: 'root',
1673
+ id: null,
1674
+ item: null,
1675
+ name: this.rootLabel(),
1676
+ level: 1,
1677
+ expandable: false,
1678
+ expanded: true,
1679
+ status: rootState?.status === 'error' ? 'error' : rootState?.status === 'loading' && !rootState.loaded ? 'loading' : 'idle',
1680
+ selected: current === null,
1681
+ autoId: autoId ? `${autoId}-tree-root` : undefined,
1682
+ },
1683
+ ];
1684
+ const visit = (parentId, level, ancestors) => {
1685
+ const state = folders.get(parentId);
1686
+ if (!state)
1687
+ return;
1688
+ const children = state.items.filter(item => item.kind === 'folder');
1689
+ for (const folder of children) {
1690
+ // why: dữ liệu consumer có thể lỗi (thư mục là con của chính nó) — chặn vòng lặp vô hạn khi dựng cây.
1691
+ if (ancestors.has(folder.id))
1692
+ continue;
1693
+ const childState = folders.get(folder.id);
1694
+ const isExpanded = expanded.has(folder.id);
1695
+ const hasSubfolders = childState?.loaded ? childState.items.some(item => item.kind === 'folder') : folder.hasChildren !== false;
1696
+ const open = isExpanded && hasSubfolders;
1697
+ let status = 'idle';
1698
+ if (isExpanded && childState?.status === 'error')
1699
+ status = 'error';
1700
+ else if (isExpanded && childState?.status === 'loading' && !childState.loaded)
1701
+ status = 'loading';
1702
+ nodes.push({
1703
+ key: `f:${folder.id}`,
1704
+ id: folder.id,
1705
+ item: folder,
1706
+ name: folder.name,
1707
+ level,
1708
+ expandable: hasSubfolders,
1709
+ expanded: open,
1710
+ status,
1711
+ selected: current === folder.id,
1712
+ autoId: autoId ? `${autoId}-tree-${sdFileExplorerSafeId(folder.id)}` : undefined,
1713
+ });
1714
+ if (open)
1715
+ visit(folder.id, level + 1, new Set([...ancestors, folder.id]));
1716
+ }
1717
+ };
1718
+ visit(null, 2, new Set());
1719
+ return nodes;
1720
+ }, ...(ngDevMode ? [{ debugName: "treeNodes" }] : []));
1721
+ previewView = computed(() => {
1722
+ const item = this.#previewItem();
1723
+ return item ? this.#itemFormatter()(item) : null;
1724
+ }, ...(ngDevMode ? [{ debugName: "previewView" }] : []));
1725
+ previewMeta = computed(() => {
1726
+ const view = this.previewView();
1727
+ if (!view)
1728
+ return [];
1729
+ const t = (key) => this.#i18n.t(`core.component.file-explorer.meta.${key}`);
1730
+ const rows = [
1731
+ { label: t('name'), value: view.item.name },
1732
+ { label: t('type'), value: view.typeLabel },
1733
+ ];
1734
+ if (view.sizeLabel)
1735
+ rows.push({ label: t('size'), value: view.sizeLabel });
1736
+ if (view.modifiedLabel)
1737
+ rows.push({ label: t('modified'), value: view.modifiedLabel });
1738
+ return rows;
1739
+ }, ...(ngDevMode ? [{ debugName: "previewMeta" }] : []));
1740
+ transferViews = computed(() => {
1741
+ const t = (key, params) => this.#i18n.t(`core.component.file-explorer.${key}`, params);
1742
+ const autoId = this.autoId();
1743
+ return this.#transfers().map(transfer => {
1744
+ const known = transfer.percent !== undefined;
1745
+ let statusLabel;
1746
+ let progress;
1747
+ let tone;
1748
+ switch (transfer.status) {
1749
+ case 'queued':
1750
+ statusLabel = t('transfers.status.queued');
1751
+ progress = 'none';
1752
+ tone = 'muted';
1753
+ break;
1754
+ case 'preparing':
1755
+ statusLabel = t('transfers.status.preparing');
1756
+ progress = 'indeterminate';
1757
+ tone = 'active';
1758
+ break;
1759
+ case 'transferring':
1760
+ statusLabel = known
1761
+ ? `${transfer.percent}%`
1762
+ : t(transfer.direction === 'upload' ? 'transfers.status.uploading' : 'transfers.status.downloading');
1763
+ progress = known ? 'determinate' : 'indeterminate';
1764
+ tone = 'active';
1765
+ break;
1766
+ case 'done':
1767
+ statusLabel = t(transfer.handedOff ? 'transfers.status.handed-off' : 'transfers.status.done');
1768
+ progress = 'full';
1769
+ tone = 'success';
1770
+ break;
1771
+ case 'error':
1772
+ statusLabel = t('transfers.status.error');
1773
+ progress = known ? 'determinate' : 'full';
1774
+ tone = 'error';
1775
+ break;
1776
+ default:
1777
+ statusLabel = t('transfers.status.cancelled');
1778
+ progress = known ? 'determinate' : 'none';
1779
+ tone = 'muted';
1780
+ }
1781
+ const name = transfer.name;
1782
+ return {
1783
+ transfer,
1784
+ statusLabel,
1785
+ progress,
1786
+ percent: transfer.percent ?? 0,
1787
+ tone,
1788
+ canCancel: ACTIVE_STATUSES.has(transfer.status),
1789
+ canRetry: transfer.status === 'error' || transfer.status === 'cancelled',
1790
+ canDismiss: FINISHED_STATUSES.has(transfer.status),
1791
+ cancelLabel: t('transfers.cancel', { name }),
1792
+ retryLabel: t('transfers.retry', { name }),
1793
+ dismissLabel: t('transfers.dismiss', { name }),
1794
+ directionLabel: t(`transfers.direction.${transfer.direction}`),
1795
+ errorMessage: transfer.status === 'error' ? sdFileExplorerErrorMessage(transfer.error) : '',
1796
+ autoId: autoId ? `${autoId}-transfer-${transfer.id}` : undefined,
1797
+ };
1798
+ });
1799
+ }, ...(ngDevMode ? [{ debugName: "transferViews" }] : []));
1800
+ transfersTitle = computed(() => this.#i18n.t('core.component.file-explorer.transfers.title', { count: this.#transfers().length }), ...(ngDevMode ? [{ debugName: "transfersTitle" }] : []));
1801
+ canClearTransfers = computed(() => this.#transfers().some(transfer => FINISHED_STATUSES.has(transfer.status)), ...(ngDevMode ? [{ debugName: "canClearTransfers" }] : []));
1802
+ /** Formats items with the current language; rebuilt when the language changes. */
1803
+ #itemFormatter = computed(() => {
1804
+ const locale = this.locale();
1805
+ const autoId = this.autoId();
1806
+ const t = (key, params) => this.#i18n.t(`core.component.file-explorer.${key}`, params);
1807
+ const labels = { today: t('today'), yesterday: t('yesterday') };
1808
+ const now = new Date();
1809
+ return (item) => {
1810
+ const type = sdFileExplorerFileType(item);
1811
+ return {
1812
+ item,
1813
+ type,
1814
+ icon: sdFileExplorerIconName(item),
1815
+ typeLabel: t(`type.${type}`),
1816
+ sizeLabel: item.kind === 'file' ? sdFileExplorerFormatSize(item.size, locale) : '',
1817
+ modifiedLabel: sdFileExplorerFormatDate(item.modifiedAt, now, locale, labels),
1818
+ modifiedTitle: sdFileExplorerFormatDateTime(item.modifiedAt, locale),
1819
+ downloadLabel: t('download-item', { name: item.name }),
1820
+ shareLabel: t('share-item', { name: item.name }),
1821
+ autoId: autoId ? `${autoId}-item-${sdFileExplorerSafeId(item.id)}` : undefined,
1822
+ };
1823
+ };
1824
+ }, ...(ngDevMode ? [{ debugName: "#itemFormatter" }] : []));
1825
+ constructor() {
1826
+ // why: chỉ reset khi hàm `list` đổi (đổi nguồn lưu trữ). Consumer tạo lại object option với cùng callback
1827
+ // (ví dụ đổi title) không được xoá cache/điều hướng của người dùng.
1828
+ effect(() => {
1829
+ const option = this.option();
1830
+ untracked(() => {
1831
+ if (this.#listFn === option.list)
1832
+ return;
1833
+ const firstRun = this.#listFn === null;
1834
+ this.#listFn = option.list;
1835
+ if (firstRun)
1836
+ this.view.set(option.defaultView ?? 'list');
1837
+ this.#resetNavigation();
1838
+ this.#ensureLoaded(null);
1839
+ });
1840
+ });
1841
+ afterNextRender(() => {
1842
+ const host = this.#host.nativeElement;
1843
+ this.#width.set(host.getBoundingClientRect().width);
1844
+ if (typeof ResizeObserver === 'undefined')
1845
+ return;
1846
+ this.#resizeObserver = new ResizeObserver(entries => {
1847
+ const width = entries[entries.length - 1]?.contentRect.width;
1848
+ if (typeof width === 'number')
1849
+ this.#width.set(width);
1850
+ });
1851
+ this.#resizeObserver.observe(host);
1852
+ });
1853
+ // why: rời khỏi layout compact thì drawer không còn ý nghĩa — đóng để lần thu nhỏ sau không bật lại scrim.
1854
+ effect(() => {
1855
+ if (!this.compact())
1856
+ untracked(() => this.sidebarOpen.set(false));
1857
+ });
1858
+ inject(DestroyRef).onDestroy(() => this.#teardown());
1859
+ }
1860
+ // ---- Public API ----
1861
+ /**
1862
+ * Lists the current folder again and drops the cached children of folders that are neither open in the
1863
+ * tree nor on the current path. Re-runs the active search, if any.
1864
+ */
1865
+ reload() {
1866
+ const keep = new Set([null, this.#currentId(), ...this.#expanded(), ...this.#path().map(folder => folder.id)]);
1867
+ const folders = new Map(this.#folders());
1868
+ for (const key of [...folders.keys()]) {
1869
+ if (!keep.has(key)) {
1870
+ this.#listControllers.get(key)?.abort();
1871
+ this.#listControllers.delete(key);
1872
+ folders.delete(key);
1873
+ }
1874
+ }
1875
+ this.#folders.set(folders);
1876
+ for (const key of folders.keys())
1877
+ this.#load(key);
1878
+ this.#ensureLoaded(this.#currentId());
1879
+ if (this.searching())
1880
+ this.#scheduleSearch(true);
1881
+ }
1882
+ // ---- Navigation ----
1883
+ navigate(folder) {
1884
+ const id = folder?.id ?? null;
1885
+ const path = folder ? this.#buildPath(folder) : [];
1886
+ this.#currentId.set(id);
1887
+ this.#path.set(path);
1888
+ this.#expanded.update(expanded => {
1889
+ const next = new Set(expanded);
1890
+ for (const entry of path)
1891
+ next.add(entry.id);
1892
+ return next;
1893
+ });
1894
+ this.#clearSearch();
1895
+ this.closePreview();
1896
+ if (this.compact())
1897
+ this.sidebarOpen.set(false);
1898
+ this.#ensureLoaded(null);
1899
+ for (const entry of path)
1900
+ this.#ensureLoaded(entry.parentId);
1901
+ this.#ensureLoaded(id);
1902
+ }
1903
+ onBreadcrumb(entry) {
1904
+ const { targets } = this.breadcrumb();
1905
+ if (targets.has(entry))
1906
+ this.navigate(targets.get(entry) ?? null);
1907
+ }
1908
+ onTreeSelect(node) {
1909
+ this.navigate(node.item);
1910
+ }
1911
+ onTreeToggle(node) {
1912
+ if (node.id === null)
1913
+ return;
1914
+ const id = node.id;
1915
+ const expand = !this.#expanded().has(id);
1916
+ this.#expanded.update(expanded => {
1917
+ const next = new Set(expanded);
1918
+ if (expand)
1919
+ next.add(id);
1920
+ else
1921
+ next.delete(id);
1922
+ return next;
1923
+ });
1924
+ if (expand)
1925
+ this.#ensureLoaded(id);
1926
+ }
1927
+ onTreeRetry(node) {
1928
+ this.#load(node.id);
1929
+ }
1930
+ retryContent() {
1931
+ if (this.searching() && this.#serverSearch())
1932
+ this.#scheduleSearch(true);
1933
+ else
1934
+ this.#load(this.#currentId());
1935
+ }
1936
+ toggleSidebar() {
1937
+ const open = !this.sidebarOpen();
1938
+ this.sidebarOpen.set(open);
1939
+ if (open) {
1940
+ afterNextRender(() => this.sidebar()?.nativeElement.querySelector('[tabindex="0"]')?.focus(), {
1941
+ injector: this.#injector,
1942
+ });
1943
+ }
1944
+ }
1945
+ setView(view) {
1946
+ this.view.set(view);
1947
+ }
1948
+ // ---- Items / preview ----
1949
+ onActivate(view) {
1950
+ if (view.item.kind === 'folder')
1951
+ this.navigate(view.item);
1952
+ else
1953
+ this.openFile(view.item);
1954
+ }
1955
+ openFile(item) {
1956
+ this.open.emit({ item, path: this.#path() });
1957
+ this.#previewItem.set(item);
1958
+ void this.#loadPreview(item);
1959
+ }
1960
+ /**
1961
+ * Closes the detail drawer. Focus goes back to the row / card that opened it: `sd-side-drawer` restores the
1962
+ * previously focused element when its focus trap closes.
1963
+ */
1964
+ closePreview() {
1965
+ if (!this.#previewItem())
1966
+ return;
1967
+ this.#releasePreview();
1968
+ this.#previewItem.set(null);
1969
+ this.previewState.set({ status: 'idle' });
1970
+ }
1971
+ retryPreview() {
1972
+ const item = this.#previewItem();
1973
+ if (item)
1974
+ void this.#loadPreview(item);
1975
+ }
1976
+ onPreviewImageError() {
1977
+ this.previewState.set({ status: 'error', message: '' });
1978
+ }
1979
+ downloadItem(item) {
1980
+ const download = this.option().download;
1981
+ if (!download)
1982
+ return;
1983
+ this.#enqueue('download', item.name, item.parentId, args => download({ item, ...args }));
1984
+ this.transfersCollapsed.set(false);
1985
+ }
1986
+ downloadPreview() {
1987
+ const item = this.#previewItem();
1988
+ if (item)
1989
+ this.downloadItem(item);
1990
+ }
1991
+ sharePreview() {
1992
+ const item = this.#previewItem();
1993
+ if (item)
1994
+ this.openShare(item);
1995
+ }
1996
+ // ---- Search ----
1997
+ onKeywordInput(value) {
1998
+ this.keyword.set(value);
1999
+ this.#scheduleSearch(false);
2000
+ }
2001
+ clearSearch() {
2002
+ this.#clearSearch();
2003
+ this.searchInput()?.nativeElement.focus();
2004
+ }
2005
+ // ---- Upload ----
2006
+ onFilesPicked(input) {
2007
+ const files = Array.from(input.files ?? []);
2008
+ // why: reset value để chọn lại đúng file đó lần nữa vẫn bắn sự kiện change.
2009
+ input.value = '';
2010
+ this.uploadFiles(files);
2011
+ }
2012
+ uploadFiles(files) {
2013
+ const upload = this.option().upload;
2014
+ if (!upload || files.length === 0)
2015
+ return;
2016
+ const parentId = this.#currentId();
2017
+ for (const file of files) {
2018
+ this.#enqueue('upload', file.name, parentId, args => upload({ file, parentId, ...args }));
2019
+ }
2020
+ this.transfersCollapsed.set(false);
2021
+ }
2022
+ onDragEnter(event) {
2023
+ if (!this.#acceptsDrag(event))
2024
+ return;
2025
+ event.preventDefault();
2026
+ this.#dragDepth++;
2027
+ this.dragActive.set(true);
2028
+ }
2029
+ onDragOver(event) {
2030
+ if (!this.#acceptsDrag(event))
2031
+ return;
2032
+ event.preventDefault();
2033
+ if (event.dataTransfer)
2034
+ event.dataTransfer.dropEffect = 'copy';
2035
+ }
2036
+ onDragLeave() {
2037
+ if (!this.dragActive())
2038
+ return;
2039
+ // why: dragenter/dragleave bắn cho từng phần tử con — đếm độ sâu để overlay không nhấp nháy khi rê qua con.
2040
+ this.#dragDepth = Math.max(0, this.#dragDepth - 1);
2041
+ if (this.#dragDepth === 0)
2042
+ this.dragActive.set(false);
2043
+ }
2044
+ onDrop(event) {
2045
+ if (!this.#acceptsDrag(event))
2046
+ return;
2047
+ event.preventDefault();
2048
+ this.#dragDepth = 0;
2049
+ this.dragActive.set(false);
2050
+ this.uploadFiles(this.#droppedFiles(event.dataTransfer));
2051
+ }
2052
+ // ---- Transfers ----
2053
+ cancelTransfer(id) {
2054
+ const job = this.#jobs.get(id);
2055
+ const status = this.#statusOf(id);
2056
+ if (!job || !status || !ACTIVE_STATUSES.has(status))
2057
+ return;
2058
+ if (status !== 'queued' && job.attempt) {
2059
+ job.attempt.controller.abort();
2060
+ this.#releaseSlot(job.attempt);
2061
+ }
2062
+ this.#patch(id, { status: 'cancelled' });
2063
+ }
2064
+ retryTransfer(id) {
2065
+ const job = this.#jobs.get(id);
2066
+ const status = this.#statusOf(id);
2067
+ if (!job || (status !== 'error' && status !== 'cancelled'))
2068
+ return;
2069
+ this.#patch(id, { status: 'queued', loaded: undefined, total: undefined, percent: undefined, error: undefined, handedOff: undefined });
2070
+ this.#schedule(job);
2071
+ }
2072
+ dismissTransfer(id) {
2073
+ const status = this.#statusOf(id);
2074
+ if (!status || !FINISHED_STATUSES.has(status))
2075
+ return;
2076
+ this.#jobs.delete(id);
2077
+ this.#transfers.update(list => list.filter(transfer => transfer.id !== id));
2078
+ }
2079
+ clearFinishedTransfers() {
2080
+ const finished = new Set(this.#transfers()
2081
+ .filter(transfer => FINISHED_STATUSES.has(transfer.status))
2082
+ .map(transfer => transfer.id));
2083
+ for (const id of finished)
2084
+ this.#jobs.delete(id);
2085
+ this.#transfers.update(list => list.filter(transfer => !finished.has(transfer.id)));
2086
+ }
2087
+ // ---- New folder ----
2088
+ openFolderDialog() {
2089
+ this.folderName.set('');
2090
+ this.folderError.set('');
2091
+ this.folderDialogOpen.set(true);
2092
+ afterNextRender(() => this.folderInput()?.nativeElement.focus(), { injector: this.#injector });
2093
+ }
2094
+ closeFolderDialog() {
2095
+ if (!this.folderDialogOpen())
2096
+ return;
2097
+ this.folderDialogOpen.set(false);
2098
+ afterNextRender(() => this.newFolderButton()?.nativeElement.querySelector('button')?.focus(), { injector: this.#injector });
2099
+ }
2100
+ // ---- Share ----
2101
+ openShare(item) {
2102
+ if (!this.option().share)
2103
+ return;
2104
+ const active = this.#document.activeElement;
2105
+ this.#shareReturnFocus = active instanceof HTMLElement && this.#host.nativeElement.contains(active) ? active : null;
2106
+ this.shareItem.set(item);
2107
+ void this.#loadShareLink(item);
2108
+ // why: trong lúc tạo link, focus vào chính dialog để trình đọc màn hình đọc tiêu đề; link xong thì chuyển sang nút Sao chép.
2109
+ afterNextRender(() => {
2110
+ if (this.shareState().status !== 'ready')
2111
+ this.shareDialog()?.nativeElement.focus();
2112
+ }, { injector: this.#injector });
2113
+ }
2114
+ retryShare() {
2115
+ const item = this.shareItem();
2116
+ if (item)
2117
+ void this.#loadShareLink(item);
2118
+ }
2119
+ closeShare() {
2120
+ if (!this.shareItem())
2121
+ return;
2122
+ this.#shareController?.abort();
2123
+ this.#shareController = null;
2124
+ this.shareItem.set(null);
2125
+ this.shareFeedback.set('');
2126
+ const target = this.#shareReturnFocus;
2127
+ this.#shareReturnFocus = null;
2128
+ if (target?.isConnected)
2129
+ afterNextRender(() => target.focus({ preventScroll: true }), { injector: this.#injector });
2130
+ }
2131
+ async copyShareLink() {
2132
+ const state = this.shareState();
2133
+ if (state.status !== 'ready')
2134
+ return;
2135
+ const clipboard = this.#document.defaultView?.navigator?.clipboard;
2136
+ try {
2137
+ if (typeof clipboard?.writeText !== 'function')
2138
+ throw new Error('Clipboard API unavailable');
2139
+ await clipboard.writeText(state.url);
2140
+ this.shareFeedback.set('copied');
2141
+ }
2142
+ catch {
2143
+ // why: Clipboard API bị chặn (không phải secure context, thiếu quyền, iframe) → chọn sẵn link rồi thử
2144
+ // execCommand; nếu vẫn không được thì hướng dẫn người dùng tự bấm Ctrl+C.
2145
+ const input = this.shareInput()?.nativeElement;
2146
+ input?.focus();
2147
+ input?.select();
2148
+ this.shareFeedback.set(this.#execCopy() ? 'copied' : 'manual');
2149
+ }
2150
+ }
2151
+ async #loadShareLink(item) {
2152
+ const share = this.option().share;
2153
+ if (!share)
2154
+ return;
2155
+ this.#shareController?.abort();
2156
+ const controller = new AbortController();
2157
+ this.#shareController = controller;
2158
+ this.shareFeedback.set('');
2159
+ this.shareState.set({ status: 'loading' });
2160
+ const fallbackError = () => this.#i18n.t('core.component.file-explorer.share.error');
2161
+ try {
2162
+ const url = await share({ item, signal: controller.signal });
2163
+ if (controller.signal.aborted || this.#destroyed)
2164
+ return;
2165
+ if (typeof url !== 'string' || !url.trim()) {
2166
+ this.shareState.set({ status: 'error', message: fallbackError() });
2167
+ return;
2168
+ }
2169
+ this.shareState.set({ status: 'ready', url: url.trim() });
2170
+ afterNextRender(() => this.copyButton()?.nativeElement.querySelector('button')?.focus(), { injector: this.#injector });
2171
+ }
2172
+ catch (error) {
2173
+ if (controller.signal.aborted || this.#destroyed)
2174
+ return;
2175
+ this.shareState.set({ status: 'error', message: sdFileExplorerErrorMessage(error) || fallbackError() });
2176
+ }
2177
+ finally {
2178
+ if (this.#shareController === controller)
2179
+ this.#shareController = null;
2180
+ }
2181
+ }
2182
+ #execCopy() {
2183
+ try {
2184
+ return this.#document.execCommand('copy');
2185
+ }
2186
+ catch {
2187
+ return false;
2188
+ }
2189
+ }
2190
+ async submitFolder(event) {
2191
+ event.preventDefault();
2192
+ const create = this.option().createFolder;
2193
+ const name = this.folderName().trim();
2194
+ if (!create || !name || this.folderSubmitting())
2195
+ return;
2196
+ const parentId = this.#currentId();
2197
+ this.folderSubmitting.set(true);
2198
+ this.folderError.set('');
2199
+ try {
2200
+ await create({ parentId, name });
2201
+ if (this.#destroyed)
2202
+ return;
2203
+ this.closeFolderDialog();
2204
+ if (parentId !== null)
2205
+ this.#expanded.update(expanded => new Set([...expanded, parentId]));
2206
+ this.#refresh(parentId);
2207
+ }
2208
+ catch (error) {
2209
+ if (this.#destroyed)
2210
+ return;
2211
+ this.folderError.set(sdFileExplorerErrorMessage(error) || this.#i18n.t('core.component.file-explorer.create-folder-error'));
2212
+ }
2213
+ finally {
2214
+ this.folderSubmitting.set(false);
2215
+ }
2216
+ }
2217
+ // ---- Keyboard ----
2218
+ onEscape(event) {
2219
+ if (event.defaultPrevented)
2220
+ return;
2221
+ if (this.folderDialogOpen())
2222
+ this.closeFolderDialog();
2223
+ else if (this.shareItem())
2224
+ this.closeShare();
2225
+ // why: header vẫn dùng được khi drawer chi tiết mở — Esc trong ô tìm kiếm xoá từ khoá trước, chưa đóng drawer.
2226
+ else if (this.keyword() && event.target === this.searchInput()?.nativeElement)
2227
+ this.clearSearch();
2228
+ else if (this.#previewItem())
2229
+ this.closePreview();
2230
+ else if (this.sidebarOpen())
2231
+ this.sidebarOpen.set(false);
2232
+ else if (this.keyword())
2233
+ this.clearSearch();
2234
+ else
2235
+ return;
2236
+ event.preventDefault();
2237
+ }
2238
+ // ---- Internals: folders ----
2239
+ #resetNavigation() {
2240
+ for (const controller of this.#listControllers.values())
2241
+ controller.abort();
2242
+ this.#listControllers.clear();
2243
+ this.#folders.set(new Map());
2244
+ this.#currentId.set(null);
2245
+ this.#path.set([]);
2246
+ this.#expanded.set(new Set());
2247
+ this.#clearSearch();
2248
+ this.closePreview();
2249
+ }
2250
+ #ensureLoaded(parentId) {
2251
+ const state = this.#folders().get(parentId);
2252
+ if (state && state.status !== 'error')
2253
+ return;
2254
+ void this.#load(parentId);
2255
+ }
2256
+ /** Re-lists a folder only if it is cached (someone has seen it); otherwise the next visit lists it anyway. */
2257
+ #refresh(parentId) {
2258
+ if (this.#folders().has(parentId))
2259
+ void this.#load(parentId);
2260
+ }
2261
+ async #load(parentId) {
2262
+ this.#listControllers.get(parentId)?.abort();
2263
+ const controller = new AbortController();
2264
+ this.#listControllers.set(parentId, controller);
2265
+ const previous = this.#folders().get(parentId);
2266
+ this.#setFolder(parentId, { status: 'loading', items: previous?.loaded ? previous.items : [], loaded: !!previous?.loaded });
2267
+ try {
2268
+ const items = await this.option().list({ parentId, signal: controller.signal });
2269
+ if (controller.signal.aborted || this.#destroyed)
2270
+ return;
2271
+ this.#setFolder(parentId, { status: 'loaded', items: Array.isArray(items) ? items : [], loaded: true });
2272
+ }
2273
+ catch (error) {
2274
+ if (controller.signal.aborted || this.#destroyed)
2275
+ return;
2276
+ this.#setFolder(parentId, { status: 'error', items: [], loaded: false, error });
2277
+ }
2278
+ finally {
2279
+ if (this.#listControllers.get(parentId) === controller)
2280
+ this.#listControllers.delete(parentId);
2281
+ }
2282
+ }
2283
+ #setFolder(parentId, state) {
2284
+ this.#folders.update(folders => new Map(folders).set(parentId, state));
2285
+ }
2286
+ #buildPath(folder) {
2287
+ const byId = this.#itemById();
2288
+ const chain = [folder];
2289
+ const seen = new Set([folder.id]);
2290
+ let parentId = folder.parentId;
2291
+ while (parentId !== null) {
2292
+ const parent = byId.get(parentId);
2293
+ if (!parent || seen.has(parent.id)) {
2294
+ // why: chuỗi cha bị đứt (kết quả search nằm sâu, cha chưa từng được list) — nối vào đường dẫn hiện tại
2295
+ // để breadcrumb vẫn quay về được thư mục đang xem.
2296
+ const current = this.#path().filter(entry => !seen.has(entry.id));
2297
+ return [...current, folder];
2298
+ }
2299
+ chain.push(parent);
2300
+ seen.add(parent.id);
2301
+ parentId = parent.parentId;
2302
+ }
2303
+ return chain.reverse();
2304
+ }
2305
+ // ---- Internals: search ----
2306
+ #scheduleSearch(immediate) {
2307
+ if (this.#searchTimer)
2308
+ clearTimeout(this.#searchTimer);
2309
+ this.#searchTimer = null;
2310
+ this.#searchController?.abort();
2311
+ this.#searchController = null;
2312
+ const keyword = this.#trimmedKeyword();
2313
+ const search = this.option().search;
2314
+ if (!keyword || !search) {
2315
+ this.#search.set(null);
2316
+ return;
2317
+ }
2318
+ const parentId = this.#currentId();
2319
+ this.#search.set({ keyword, parentId, status: 'loading', items: [] });
2320
+ if (immediate)
2321
+ void this.#runSearch(keyword, parentId);
2322
+ else
2323
+ this.#searchTimer = setTimeout(() => void this.#runSearch(keyword, parentId), SEARCH_DEBOUNCE_MS);
2324
+ }
2325
+ async #runSearch(keyword, parentId) {
2326
+ this.#searchTimer = null;
2327
+ const search = this.option().search;
2328
+ if (!search)
2329
+ return;
2330
+ const controller = new AbortController();
2331
+ this.#searchController = controller;
2332
+ try {
2333
+ const items = await search({ parentId, keyword, signal: controller.signal });
2334
+ if (controller.signal.aborted || this.#destroyed)
2335
+ return;
2336
+ this.#search.set({ keyword, parentId, status: 'loaded', items: Array.isArray(items) ? items : [] });
2337
+ }
2338
+ catch (error) {
2339
+ if (controller.signal.aborted || this.#destroyed)
2340
+ return;
2341
+ this.#search.set({ keyword, parentId, status: 'error', items: [], error });
2342
+ }
2343
+ finally {
2344
+ if (this.#searchController === controller)
2345
+ this.#searchController = null;
2346
+ }
2347
+ }
2348
+ #clearSearch() {
2349
+ this.keyword.set('');
2350
+ this.#scheduleSearch(false);
2351
+ }
2352
+ // ---- Internals: preview ----
2353
+ async #loadPreview(item) {
2354
+ this.#releasePreview();
2355
+ const kind = sdFileExplorerPreviewKind(sdFileExplorerFileType(item));
2356
+ const fallback = () => kind === 'image' && item.thumbnailUrl ? { status: 'image', url: item.thumbnailUrl } : { status: 'unavailable' };
2357
+ const preview = this.option().preview;
2358
+ // why: định dạng không có renderer thì KHÔNG gọi callback — tránh tải cả file chỉ để hiện fallback.
2359
+ if (kind === 'none' || !preview) {
2360
+ this.previewState.set(kind === 'none' ? { status: 'unavailable' } : fallback());
2361
+ return;
2362
+ }
2363
+ const controller = new AbortController();
2364
+ this.#previewController = controller;
2365
+ this.previewState.set({ status: 'loading' });
2366
+ try {
2367
+ const source = await preview({ item, signal: controller.signal });
2368
+ if (controller.signal.aborted || this.#destroyed)
2369
+ return;
2370
+ if (source === null || source === undefined || source === '') {
2371
+ this.previewState.set(fallback());
2372
+ }
2373
+ else if (kind === 'pdf') {
2374
+ this.previewState.set({ status: 'pdf', source });
2375
+ }
2376
+ else if (typeof source === 'string') {
2377
+ this.previewState.set({ status: 'image', url: source });
2378
+ }
2379
+ else {
2380
+ const url = this.#createObjectUrl(source);
2381
+ this.#previewObjectUrl = url;
2382
+ this.previewState.set(url ? { status: 'image', url } : { status: 'unavailable' });
2383
+ }
2384
+ }
2385
+ catch (error) {
2386
+ if (controller.signal.aborted || this.#destroyed)
2387
+ return;
2388
+ this.previewState.set({ status: 'error', message: sdFileExplorerErrorMessage(error) });
2389
+ }
2390
+ finally {
2391
+ if (this.#previewController === controller)
2392
+ this.#previewController = null;
2393
+ }
2394
+ }
2395
+ #releasePreview() {
2396
+ this.#previewController?.abort();
2397
+ this.#previewController = null;
2398
+ if (this.#previewObjectUrl)
2399
+ this.#revokeObjectUrl(this.#previewObjectUrl);
2400
+ this.#previewObjectUrl = null;
2401
+ }
2402
+ // ---- Internals: transfers ----
2403
+ #enqueue(direction, name, parentId, run) {
2404
+ const id = `t${++this.#transferSeq}`;
2405
+ const job = { id, direction, name, parentId, run, attempt: null };
2406
+ this.#jobs.set(id, job);
2407
+ this.#transfers.update(list => [...list, { id, direction, name, status: 'queued' }]);
2408
+ this.#schedule(job);
2409
+ }
2410
+ #schedule(job) {
2411
+ if (job.direction === 'upload') {
2412
+ this.#uploadQueue.push(job.id);
2413
+ this.#pumpUploads();
2414
+ }
2415
+ else {
2416
+ void this.#start(job, false);
2417
+ }
2418
+ }
2419
+ #pumpUploads() {
2420
+ while (this.#activeUploads < MAX_PARALLEL_UPLOADS && this.#uploadQueue.length > 0) {
2421
+ const job = this.#jobs.get(this.#uploadQueue.shift());
2422
+ if (!job || this.#statusOf(job.id) !== 'queued')
2423
+ continue;
2424
+ this.#activeUploads++;
2425
+ void this.#start(job, true);
2426
+ }
2427
+ }
2428
+ #releaseSlot(attempt) {
2429
+ if (!attempt.holdsSlot)
2430
+ return;
2431
+ attempt.holdsSlot = false;
2432
+ this.#activeUploads = Math.max(0, this.#activeUploads - 1);
2433
+ if (!this.#destroyed)
2434
+ this.#pumpUploads();
2435
+ }
2436
+ async #start(job, holdsSlot) {
2437
+ const attempt = { controller: new AbortController(), holdsSlot };
2438
+ job.attempt = attempt;
2439
+ const { signal } = attempt.controller;
2440
+ const current = () => job.attempt === attempt && !signal.aborted && !this.#destroyed;
2441
+ this.#patch(job.id, { status: 'preparing' });
2442
+ const progress = (loaded, total) => {
2443
+ if (!current())
2444
+ return;
2445
+ const safeLoaded = Number.isFinite(loaded) && loaded > 0 ? loaded : 0;
2446
+ const safeTotal = typeof total === 'number' && Number.isFinite(total) && total > 0 ? total : undefined;
2447
+ const percent = safeTotal ? Math.min(100, Math.round((safeLoaded / safeTotal) * 100)) : undefined;
2448
+ this.#patch(job.id, { status: 'transferring', loaded: safeLoaded, total: safeTotal, percent });
2449
+ };
2450
+ try {
2451
+ const result = await job.run({ progress, signal });
2452
+ if (!current())
2453
+ return;
2454
+ const known = this.#transfers().find(transfer => transfer.id === job.id)?.total !== undefined;
2455
+ if (job.direction === 'download') {
2456
+ const blob = this.#isBlob(result) ? result : null;
2457
+ if (blob)
2458
+ this.#saveBlob(blob, job.name);
2459
+ this.#patch(job.id, { status: 'done', handedOff: !blob, percent: known ? 100 : undefined });
2460
+ }
2461
+ else {
2462
+ this.#patch(job.id, { status: 'done', percent: known ? 100 : undefined });
2463
+ this.#refresh(job.parentId);
2464
+ }
2465
+ }
2466
+ catch (error) {
2467
+ if (!current())
2468
+ return;
2469
+ this.#patch(job.id, { status: 'error', error });
2470
+ }
2471
+ finally {
2472
+ this.#releaseSlot(attempt);
2473
+ }
2474
+ }
2475
+ #statusOf(id) {
2476
+ return this.#transfers().find(transfer => transfer.id === id)?.status;
2477
+ }
2478
+ #patch(id, changes) {
2479
+ this.#transfers.update(list => list.map(transfer => (transfer.id === id ? { ...transfer, ...changes } : transfer)));
2480
+ }
2481
+ #saveBlob(blob, name) {
2482
+ const url = this.#createObjectUrl(blob);
2483
+ const body = this.#document.body;
2484
+ if (!url || !body)
2485
+ return;
2486
+ const anchor = this.#document.createElement('a');
2487
+ anchor.href = url;
2488
+ anchor.download = name;
2489
+ anchor.rel = 'noopener';
2490
+ anchor.hidden = true;
2491
+ body.appendChild(anchor);
2492
+ anchor.click();
2493
+ anchor.remove();
2494
+ // why: thu hồi URL ngay sau click có thể cắt ngang việc trình duyệt đọc blob (Firefox/Safari) — giữ một lúc rồi mới revoke.
2495
+ // Timer chạy ngoài zone để 40 giây chờ không giữ ứng dụng ở trạng thái "chưa ổn định" (whenStable, SSR, e2e).
2496
+ const timer = this.#zone.runOutsideAngular(() => setTimeout(() => {
2497
+ this.#downloadUrls.delete(url);
2498
+ this.#revokeObjectUrl(url);
2499
+ }, DOWNLOAD_URL_TTL_MS));
2500
+ this.#downloadUrls.set(url, timer);
2501
+ }
2502
+ // ---- Internals: DOM helpers ----
2503
+ #acceptsDrag(event) {
2504
+ const types = event.dataTransfer?.types;
2505
+ return this.canUpload() && !!types && Array.from(types).includes('Files');
2506
+ }
2507
+ #droppedFiles(transfer) {
2508
+ if (!transfer)
2509
+ return [];
2510
+ const items = transfer.items ? Array.from(transfer.items) : [];
2511
+ if (items.length > 0 && typeof items[0].webkitGetAsEntry === 'function') {
2512
+ // why: thả một thư mục cho ra File rỗng không đọc được — bỏ qua thư mục thay vì tạo transfer chắc chắn lỗi.
2513
+ return items
2514
+ .filter(item => item.kind === 'file' && !item.webkitGetAsEntry()?.isDirectory)
2515
+ .map(item => item.getAsFile())
2516
+ .filter((file) => !!file);
2517
+ }
2518
+ return Array.from(transfer.files ?? []);
2519
+ }
2520
+ #isBlob(value) {
2521
+ return typeof Blob !== 'undefined' && value instanceof Blob;
2522
+ }
2523
+ #createObjectUrl(blob) {
2524
+ const urlApi = this.#document.defaultView?.URL;
2525
+ return typeof urlApi?.createObjectURL === 'function' ? urlApi.createObjectURL(blob) : null;
2526
+ }
2527
+ #revokeObjectUrl(url) {
2528
+ this.#document.defaultView?.URL?.revokeObjectURL?.(url);
2529
+ }
2530
+ #teardown() {
2531
+ this.#destroyed = true;
2532
+ this.#resizeObserver?.disconnect();
2533
+ for (const controller of this.#listControllers.values())
2534
+ controller.abort();
2535
+ this.#listControllers.clear();
2536
+ if (this.#searchTimer)
2537
+ clearTimeout(this.#searchTimer);
2538
+ this.#searchController?.abort();
2539
+ this.#releasePreview();
2540
+ for (const job of this.#jobs.values())
2541
+ job.attempt?.controller.abort();
2542
+ for (const [url, timer] of this.#downloadUrls) {
2543
+ clearTimeout(timer);
2544
+ this.#revokeObjectUrl(url);
2545
+ }
2546
+ this.#downloadUrls.clear();
2547
+ this.#shareController?.abort();
2548
+ }
2549
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: SdFileExplorer, deps: [], target: i0.ɵɵFactoryTarget.Component });
2550
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.25", type: SdFileExplorer, isStandalone: true, selector: "sd-file-explorer", inputs: { option: { classPropertyName: "option", publicName: "option", isSignal: true, isRequired: true, transformFunction: null } }, outputs: { open: "open" }, host: { listeners: { "dragenter": "onDragEnter($event)", "dragover": "onDragOver($event)", "dragleave": "onDragLeave()", "drop": "onDrop($event)", "keydown.escape": "onEscape($event)" }, properties: { "class.sd-file-explorer--compact": "compact()", "class.sd-file-explorer--dragging": "dragActive()", "attr.data-autoid": "autoId()" }, classAttribute: "sd-file-explorer" }, viewQueries: [{ propertyName: "searchInput", first: true, predicate: ["searchInput"], descendants: true, isSignal: true }, { propertyName: "folderInput", first: true, predicate: ["folderInput"], descendants: true, isSignal: true }, { propertyName: "newFolderButton", first: true, predicate: ["newFolderButton"], descendants: true, read: ElementRef, isSignal: true }, { propertyName: "copyButton", first: true, predicate: ["copyButton"], descendants: true, read: ElementRef, isSignal: true }, { propertyName: "shareInput", first: true, predicate: ["shareInput"], descendants: true, isSignal: true }, { propertyName: "shareDialog", first: true, predicate: ["shareDialog"], descendants: true, isSignal: true }, { propertyName: "sidebar", first: true, predicate: ["sidebar"], descendants: true, isSignal: true }], ngImport: i0, template: "@let _option = option();\n@let _compact = compact();\n@let _autoId = autoId();\n@let _canUpload = canUpload();\n@let _canDownload = canDownload();\n@let _view = view();\n@let _state = contentState();\n@let _keyword = keyword();\n@let _sidebarOpen = sidebarOpen();\n@let _preview = previewView();\n@let _transfers = transferViews();\n@let _heading = heading();\n@let _searching = searching();\n@let _collapsed = transfersCollapsed();\n@let _dialogOpen = folderDialogOpen();\n@let _shareItem = shareItem();\n@let _canShare = canShare();\n@let _modalOpen = _dialogOpen || !!_shareItem;\n\n<header class=\"header\" [attr.inert]=\"_modalOpen ? '' : null\">\n @if (_option.title) {\n <div class=\"brand\">\n <span class=\"brand-icon\" aria-hidden=\"true\">\n <sd-icon name=\"folder\" size=\"20px\" />\n </span>\n <div class=\"brand-text\">\n <h2 class=\"brand-title\" [title]=\"_option.title\">{{ _option.title }}</h2>\n @if (_option.description) {\n <p class=\"brand-description\">{{ _option.description }}</p>\n }\n </div>\n </div>\n }\n\n <div class=\"search\" role=\"search\">\n <sd-icon class=\"search-icon\" name=\"search\" size=\"20px\" />\n <input\n #searchInput\n type=\"search\"\n class=\"search-input\"\n autocomplete=\"off\"\n [value]=\"_keyword\"\n [placeholder]=\"'core.component.file-explorer.search-placeholder' | sdTranslate\"\n [attr.aria-label]=\"'core.component.file-explorer.search-placeholder' | sdTranslate\"\n [attr.data-autoid]=\"_autoId ? _autoId + '-search' : null\"\n (input)=\"onKeywordInput(searchInput.value)\" />\n @if (_keyword) {\n <button\n type=\"button\"\n class=\"search-clear\"\n [attr.aria-label]=\"'core.component.file-explorer.search-clear' | sdTranslate\"\n [title]=\"'core.component.file-explorer.search-clear' | sdTranslate\"\n (click)=\"clearSearch()\">\n <sd-icon name=\"close\" size=\"18px\" />\n </button>\n }\n </div>\n\n @if (_canUpload) {\n <sd-button\n class=\"upload-button\"\n type=\"fill\"\n color=\"primary\"\n size=\"md\"\n prefixIcon=\"file_upload\"\n [title]=\"_compact ? undefined : ('core.component.file-explorer.upload' | sdTranslate)\"\n [tooltip]=\"_compact ? ('core.component.file-explorer.upload' | sdTranslate) : undefined\"\n [attr.data-autoid]=\"_autoId ? _autoId + '-upload' : null\"\n (click)=\"fileInput.click()\" />\n <input\n #fileInput\n type=\"file\"\n class=\"file-input\"\n multiple\n tabindex=\"-1\"\n aria-hidden=\"true\"\n [attr.data-autoid]=\"_autoId ? _autoId + '-file-input' : null\"\n (change)=\"onFilesPicked(fileInput)\" />\n }\n</header>\n\n<!-- why: dialog ph\u1EE7 c\u1EA3 explorer n\u00EAn l\u00E0m inert c\u1EA3 v\u00F9ng n\u00E0y, k\u1EC3 c\u1EA3 drawer chi ti\u1EBFt \u0111ang n\u1EB1m trong .main. -->\n<div class=\"body\" [attr.inert]=\"_modalOpen ? '' : null\">\n @if (_compact && _sidebarOpen) {\n <div class=\"scrim scrim--sidebar\" aria-hidden=\"true\" (click)=\"sidebarOpen.set(false)\"></div>\n }\n <aside\n #sidebar\n class=\"sidebar\"\n [class.sidebar--open]=\"_sidebarOpen\"\n [id]=\"instanceId + '-sidebar'\"\n [attr.aria-label]=\"'core.component.file-explorer.folders' | sdTranslate\"\n [attr.inert]=\"_compact && !_sidebarOpen ? '' : null\">\n <p class=\"sidebar-label\">{{ 'core.component.file-explorer.folders' | sdTranslate }}</p>\n <div class=\"sidebar-tree\">\n <sd-file-explorer-folder-tree\n [nodes]=\"treeNodes()\"\n [label]=\"'core.component.file-explorer.tree-label' | sdTranslate\"\n (select)=\"onTreeSelect($event)\"\n (toggle)=\"onTreeToggle($event)\"\n (retry)=\"onTreeRetry($event)\" />\n </div>\n @if (canCreateFolder()) {\n <div class=\"sidebar-footer\">\n <sd-button\n #newFolderButton\n class=\"new-folder-button\"\n type=\"outline\"\n color=\"secondary\"\n size=\"md\"\n prefixIcon=\"add\"\n block\n [title]=\"'core.component.file-explorer.new-folder' | sdTranslate\"\n [attr.data-autoid]=\"_autoId ? _autoId + '-new-folder' : null\"\n (click)=\"openFolderDialog()\" />\n </div>\n }\n </aside>\n\n <!-- why: .main l\u00E0 [container] c\u1EE7a drawer chi ti\u1EBFt \u2014 backdrop ch\u1EC9 ph\u1EE7 v\u00F9ng b\u00EAn ph\u1EA3i, c\u00E2y th\u01B0 m\u1EE5c v\u1EABn d\u00F9ng \u0111\u01B0\u1EE3c.\n Drawer n\u1EB1m TRONG ph\u1EA7n t\u1EED n\u00E0y n\u00EAn inert \u0111\u1EB7t tr\u00EAn t\u1EEBng kh\u1ED1i con, kh\u00F4ng \u0111\u1EB7t tr\u00EAn .main. -->\n <section #mainRegion class=\"main\" [attr.aria-label]=\"_heading\">\n @if (refreshing()) {\n <div class=\"refresh-bar\" aria-hidden=\"true\"></div>\n }\n <div class=\"toolbar\" [attr.inert]=\"_preview ? '' : null\">\n @if (_compact) {\n <button\n type=\"button\"\n class=\"icon-button\"\n [attr.aria-expanded]=\"_sidebarOpen\"\n [attr.aria-controls]=\"instanceId + '-sidebar'\"\n [attr.aria-label]=\"\n (_sidebarOpen ? 'core.component.file-explorer.close-folders' : 'core.component.file-explorer.open-folders') | sdTranslate\n \"\n [attr.data-autoid]=\"_autoId ? _autoId + '-menu' : null\"\n (click)=\"toggleSidebar()\">\n <sd-icon name=\"menu\" size=\"24px\" />\n </button>\n }\n <sd-breadcrumb\n class=\"breadcrumb\"\n [items]=\"breadcrumb().items\"\n [maxItems]=\"_compact ? 3 : 5\"\n [ariaLabel]=\"'core.component.file-explorer.breadcrumb' | sdTranslate\"\n (sdItemActivate)=\"onBreadcrumb($event)\" />\n <div class=\"view-toggle\" role=\"group\" [attr.aria-label]=\"'core.component.file-explorer.view' | sdTranslate\">\n <button\n type=\"button\"\n class=\"icon-button icon-button--toggle\"\n [class.icon-button--active]=\"_view === 'list'\"\n [attr.aria-pressed]=\"_view === 'list'\"\n [attr.aria-label]=\"'core.component.file-explorer.view-list' | sdTranslate\"\n [title]=\"'core.component.file-explorer.view-list' | sdTranslate\"\n [attr.data-autoid]=\"_autoId ? _autoId + '-view-list' : null\"\n (click)=\"setView('list')\">\n <sd-icon name=\"format_list_bulleted\" size=\"24px\" />\n </button>\n <button\n type=\"button\"\n class=\"icon-button icon-button--toggle\"\n [class.icon-button--active]=\"_view === 'grid'\"\n [attr.aria-pressed]=\"_view === 'grid'\"\n [attr.aria-label]=\"'core.component.file-explorer.view-grid' | sdTranslate\"\n [title]=\"'core.component.file-explorer.view-grid' | sdTranslate\"\n [attr.data-autoid]=\"_autoId ? _autoId + '-view-grid' : null\"\n (click)=\"setView('grid')\">\n <sd-icon name=\"grid_view\" size=\"24px\" />\n </button>\n </div>\n </div>\n\n <div class=\"heading-row\" [attr.inert]=\"_preview ? '' : null\">\n <h3 class=\"heading\" [title]=\"_heading\">{{ _heading }}</h3>\n @if (_state === 'items') {\n <span class=\"count\">{{ itemCountLabel() }}</span>\n }\n </div>\n\n <div class=\"scroller\" [attr.inert]=\"_preview ? '' : null\">\n @switch (_state) {\n @case ('loading') {\n <sd-data-state\n state=\"loading\"\n compact\n [title]=\"(_searching ? 'core.component.file-explorer.search-loading' : 'core.component.file-explorer.loading') | sdTranslate\" />\n }\n @case ('error') {\n <sd-data-state\n state=\"error\"\n retryable\n [title]=\"(_searching ? 'core.component.file-explorer.search-error' : 'core.component.file-explorer.load-error') | sdTranslate\"\n [message]=\"errorMessage()\"\n [retryLabel]=\"'core.component.file-explorer.retry' | sdTranslate\"\n (sdRetry)=\"retryContent()\" />\n }\n @case ('empty') {\n <sd-data-state\n state=\"empty\"\n [icon]=\"_searching ? 'search_off' : 'folder_open'\"\n [title]=\"emptyTitle()\"\n [message]=\"emptyMessage()\" />\n }\n @default {\n <sd-file-explorer-item-list\n [items]=\"itemViews()\"\n [view]=\"_view\"\n [canDownload]=\"_canDownload\"\n [canShare]=\"_canShare\"\n [compact]=\"_compact\"\n [activeId]=\"_preview ? _preview.item.id : null\"\n [label]=\"_heading\"\n (activate)=\"onActivate($event)\"\n (download)=\"downloadItem($event.item)\"\n (share)=\"openShare($event.item)\" />\n }\n }\n </div>\n </section>\n</div>\n\n@if (_transfers.length) {\n <sd-file-explorer-transfer-panel\n class=\"transfers\"\n [attr.inert]=\"_modalOpen ? '' : null\"\n [transfers]=\"_transfers\"\n [title]=\"transfersTitle()\"\n [collapsed]=\"_collapsed\"\n [canClear]=\"canClearTransfers()\"\n [compact]=\"_compact\"\n [autoId]=\"_autoId ? _autoId + '-transfers' : undefined\"\n (toggleCollapsed)=\"transfersCollapsed.set(!_collapsed)\"\n (clear)=\"clearFinishedTransfers()\"\n (cancel)=\"cancelTransfer($event)\"\n (retry)=\"retryTransfer($event)\"\n (dismiss)=\"dismissTransfer($event)\" />\n}\n\n<!-- why: chi ti\u1EBFt file l\u00E0 sd-side-drawer th\u1EADt, m\u1EDF g\u1ECDn trong v\u00F9ng danh s\u00E1ch b\u00EAn ph\u1EA3i nh\u1EDD [container]:\n header (t\u00ECm ki\u1EBFm, t\u1EA3i l\u00EAn), c\u00E2y th\u01B0 m\u1EE5c v\u00E0 h\u00E0ng ch\u1EDD truy\u1EC1n t\u1EA3i v\u1EABn d\u00F9ng \u0111\u01B0\u1EE3c khi drawer m\u1EDF. -->\n<sd-file-explorer-preview-panel\n [view]=\"_preview\"\n [state]=\"previewState()\"\n [meta]=\"previewMeta()\"\n [canDownload]=\"_canDownload\"\n [canShare]=\"_canShare\"\n [container]=\"mainRegion\"\n [autoId]=\"_autoId ? _autoId + '-preview' : undefined\"\n (close)=\"closePreview()\"\n (download)=\"downloadPreview()\"\n (share)=\"sharePreview()\"\n (retry)=\"retryPreview()\"\n (imageError)=\"onPreviewImageError()\" />\n\n@if (dragActive()) {\n <div class=\"drop-overlay\" aria-hidden=\"true\">\n <div class=\"drop-card\">\n <sd-icon name=\"file_upload\" size=\"40px\" />\n <p class=\"drop-title\">{{ dropTitle() }}</p>\n </div>\n </div>\n}\n\n@if (_dialogOpen) {\n @let _folderName = folderName();\n @let _folderError = folderError();\n <div class=\"dialog-backdrop\" aria-hidden=\"true\" (click)=\"closeFolderDialog()\"></div>\n <form\n class=\"dialog\"\n role=\"dialog\"\n aria-modal=\"true\"\n novalidate\n [attr.aria-labelledby]=\"instanceId + '-folder-title'\"\n [attr.data-autoid]=\"_autoId ? _autoId + '-folder-dialog' : null\"\n (submit)=\"submitFolder($event)\">\n <h3 class=\"dialog-title\" [id]=\"instanceId + '-folder-title'\">{{ folderDialogTitle() }}</h3>\n <label class=\"field-label\" [for]=\"instanceId + '-folder-name'\">{{\n 'core.component.file-explorer.new-folder-name' | sdTranslate\n }}</label>\n <input\n #folderInput\n class=\"field-input\"\n autocomplete=\"off\"\n maxlength=\"255\"\n [id]=\"instanceId + '-folder-name'\"\n [value]=\"_folderName\"\n [attr.aria-invalid]=\"_folderError ? true : null\"\n [attr.aria-describedby]=\"_folderError ? instanceId + '-folder-error' : null\"\n [attr.data-autoid]=\"_autoId ? _autoId + '-folder-name' : null\"\n (input)=\"folderName.set(folderInput.value)\" />\n @if (_folderError) {\n <p class=\"field-error\" role=\"alert\" [id]=\"instanceId + '-folder-error'\">{{ _folderError }}</p>\n }\n <div class=\"dialog-actions\">\n <sd-button\n class=\"cancel-button\"\n type=\"text\"\n color=\"secondary\"\n size=\"md\"\n [title]=\"'core.component.file-explorer.cancel' | sdTranslate\"\n (click)=\"closeFolderDialog()\" />\n <sd-button\n class=\"submit-button\"\n type=\"fill\"\n color=\"primary\"\n size=\"md\"\n htmlType=\"submit\"\n [title]=\"'core.component.file-explorer.create' | sdTranslate\"\n [disabled]=\"!_folderName.trim()\"\n [loading]=\"folderSubmitting()\"\n [attr.data-autoid]=\"_autoId ? _autoId + '-folder-submit' : null\" />\n </div>\n </form>\n}\n\n@if (_shareItem) {\n @let _shareState = shareState();\n <div class=\"dialog-backdrop\" aria-hidden=\"true\" (click)=\"closeShare()\"></div>\n <div\n #shareDialog\n class=\"dialog\"\n role=\"dialog\"\n aria-modal=\"true\"\n tabindex=\"-1\"\n [attr.aria-labelledby]=\"instanceId + '-share-title'\"\n [attr.aria-busy]=\"_shareState.status === 'loading' ? true : null\"\n [attr.data-autoid]=\"_autoId ? _autoId + '-share-dialog' : null\">\n <h3 class=\"dialog-title\" [id]=\"instanceId + '-share-title'\" [title]=\"_shareItem.name\">{{ shareTitle() }}</h3>\n @switch (_shareState.status) {\n @case ('loading') {\n <p class=\"share-status\" role=\"status\">\n <span class=\"spinner\" aria-hidden=\"true\"></span>\n {{ 'core.component.file-explorer.share.loading' | sdTranslate }}\n </p>\n }\n @case ('error') {\n <p class=\"field-error\" role=\"alert\">{{ _shareState.message }}</p>\n }\n @case ('ready') {\n <label class=\"field-label\" [for]=\"instanceId + '-share-link'\">{{ 'core.component.file-explorer.share.link' | sdTranslate }}</label>\n <input\n #shareInput\n class=\"field-input\"\n readonly\n [id]=\"instanceId + '-share-link'\"\n [value]=\"_shareState.url\"\n [attr.aria-describedby]=\"instanceId + '-share-feedback'\"\n [attr.data-autoid]=\"_autoId ? _autoId + '-share-link' : null\"\n (focus)=\"shareInput.select()\" />\n <p class=\"share-feedback\" role=\"status\" aria-live=\"polite\" [id]=\"instanceId + '-share-feedback'\">{{ shareFeedbackLabel() }}</p>\n }\n }\n <div class=\"dialog-actions\">\n <sd-button\n class=\"close-button\"\n type=\"text\"\n color=\"secondary\"\n size=\"md\"\n [title]=\"'core.component.file-explorer.close' | sdTranslate\"\n (click)=\"closeShare()\" />\n @if (_shareState.status === 'error') {\n <sd-button\n class=\"retry-button\"\n type=\"outline\"\n color=\"primary\"\n size=\"md\"\n prefixIcon=\"refresh\"\n [title]=\"'core.component.file-explorer.retry' | sdTranslate\"\n (click)=\"retryShare()\" />\n } @else {\n <sd-button\n #copyButton\n class=\"copy-button\"\n type=\"fill\"\n color=\"primary\"\n size=\"md\"\n prefixIcon=\"content_copy\"\n [title]=\"\n (shareFeedback() === 'copied' ? 'core.component.file-explorer.share.copied' : 'core.component.file-explorer.share.copy')\n | sdTranslate\n \"\n [disabled]=\"_shareState.status !== 'ready'\"\n [attr.data-autoid]=\"_autoId ? _autoId + '-share-copy' : null\"\n (click)=\"copyShareLink()\" />\n }\n </div>\n </div>\n}\n", styles: [":host{--sd-fe-accent: var(--sd-file-explorer-accent, var(--sd-primary, #005cbb));--sd-fe-accent-strong: var(--sd-file-explorer-accent-strong, color-mix(in srgb, var(--sd-fe-accent) 84%, #000000));--sd-fe-accent-contrast: var(--sd-file-explorer-accent-contrast, var(--sd-primary-contrast, #ffffff));--sd-fe-accent-soft: var(--sd-file-explorer-accent-soft, color-mix(in srgb, var(--sd-fe-accent) 10%, #ffffff));--sd-fe-surface: var(--sd-file-explorer-surface, #ffffff);--sd-fe-sidebar-bg: var(--sd-file-explorer-sidebar-bg, color-mix(in srgb, var(--sd-surface-muted, #e7e8ed) 26%, var(--sd-fe-surface)));--sd-fe-muted-surface: var( --sd-file-explorer-muted-surface, color-mix(in srgb, var(--sd-surface-muted, #e7e8ed) 50%, var(--sd-fe-surface)) );--sd-fe-preview-bg: var(--sd-file-explorer-preview-bg, color-mix(in srgb, var(--sd-fe-accent) 9%, #ffffff));--sd-fe-border: var(--sd-file-explorer-border, color-mix(in srgb, var(--sd-border, #c4c6d0) 55%, #ffffff));--sd-fe-border-strong: var(--sd-file-explorer-border-strong, var(--sd-border, #c4c6d0));--sd-fe-text: var(--sd-file-explorer-text, var(--sd-text, #1a1b1f));--sd-fe-text-secondary: var(--sd-file-explorer-text-secondary, color-mix(in srgb, var(--sd-text-secondary, #44474f) 84%, #ffffff));--sd-fe-hover: color-mix(in srgb, var(--sd-fe-text) 4%, transparent);--sd-fe-hover-strong: color-mix(in srgb, var(--sd-fe-text) 8%, transparent);--sd-fe-track: color-mix(in srgb, var(--sd-fe-text) 7%, var(--sd-fe-surface));--sd-fe-success: var(--sd-file-explorer-success, var(--sd-success, #2e7d32));--sd-fe-error: var(--sd-file-explorer-error, var(--sd-error, #ba1a1a));--sd-fe-radius: var(--sd-file-explorer-radius, 16px);--sd-fe-scrim: var(--sd-file-explorer-scrim, rgba(0, 0, 0, .4));--sd-side-drawer-contained-z-index: 9;position:relative;display:flex;flex-direction:column;height:100%;min-height:480px;overflow:hidden;border:1px solid var(--sd-fe-border);border-radius:var(--sd-fe-radius);background:var(--sd-fe-surface);color:var(--sd-fe-text);font-size:14px;line-height:20px}.header{display:grid;grid-template-columns:fit-content(320px) minmax(0,1fr) auto;align-items:center;gap:12px 20px;padding:16px 20px;border-bottom:1px solid var(--sd-fe-border)}.brand{grid-column:1;display:flex;align-items:center;gap:10px;min-width:0}.brand-icon{flex:none;display:grid;place-items:center;width:32px;height:32px;border-radius:50%;background:color-mix(in srgb,var(--sd-fe-accent) 14%,#ffffff);color:var(--sd-fe-accent)}.brand-text{min-width:0}.brand-title{margin:0;overflow:hidden;font-size:16px;font-weight:600;line-height:22px;text-overflow:ellipsis;white-space:nowrap}.brand-description{margin:0;overflow:hidden;font-size:12px;line-height:16px;color:var(--sd-fe-text-secondary);text-overflow:ellipsis;white-space:nowrap}.search{grid-column:2;justify-self:center;display:flex;align-items:center;gap:8px;width:100%;max-width:520px;height:36px;padding:0 6px 0 12px;border:1px solid var(--sd-fe-border);border-radius:999px;background:var(--sd-fe-muted-surface);transition:border-color .12s ease,box-shadow .12s ease}.search:focus-within{border-color:var(--sd-fe-accent);background:var(--sd-fe-surface);box-shadow:0 0 0 3px var(--sd-fe-accent-soft)}.search-icon{flex:none;color:var(--sd-fe-text-secondary)}.search-input{flex:1;min-width:0;height:100%;padding:0;border:0;outline:none;background:transparent;color:var(--sd-fe-text);font:inherit;font-size:14px}.search-input::placeholder{color:var(--sd-fe-text-secondary)}.search-input::-webkit-search-cancel-button{display:none}.search-clear{flex:none;display:inline-flex;align-items:center;justify-content:center;width:26px;height:26px;padding:0;border:0;border-radius:999px;background:transparent;color:var(--sd-fe-text-secondary);cursor:pointer}.search-clear:hover{background:var(--sd-fe-hover-strong)}.upload-button{grid-column:3;justify-self:end}.file-input{display:none}.body{position:relative;flex:1;min-height:0;display:grid;grid-template-columns:238px minmax(0,1fr)}.sidebar{display:flex;flex-direction:column;min-height:0;padding:22px 14px 32px 12px;border-right:1px solid var(--sd-fe-border);background:var(--sd-fe-sidebar-bg)}.sidebar-label{margin:0 0 6px 10px;font-size:12px;font-weight:700;line-height:16px;letter-spacing:.04em;text-transform:uppercase;color:var(--sd-fe-text-secondary)}.sidebar-tree{flex:1;min-height:0;margin:0 -4px;padding:2px 4px;overflow-y:auto}.sidebar-footer{margin:12px 4px 0;padding-top:18px;border-top:1px solid var(--sd-fe-border)}.new-folder-button{display:block}.main{position:relative;display:flex;flex-direction:column;min-width:0;min-height:0;padding-top:14px}.refresh-bar{position:absolute;top:0;left:0;right:0;height:2px;overflow:hidden;background:var(--sd-fe-accent-soft)}.refresh-bar:after{content:\"\";position:absolute;top:0;bottom:0;width:30%;background:var(--sd-fe-accent);animation:sd-file-explorer-refresh 1.2s ease-in-out infinite}.toolbar{display:flex;align-items:center;gap:12px;min-height:40px;padding:0 32px}.breadcrumb{flex:1;min-width:0;margin-left:-4px;font-size:15px;font-weight:600}.view-toggle{flex:none;display:flex;gap:2px;padding:2px;border:1px solid var(--sd-fe-border);border-radius:999px;background:var(--sd-fe-surface)}.icon-button{flex:none;display:inline-flex;align-items:center;justify-content:center;width:36px;height:36px;padding:0;border:0;border-radius:999px;background:transparent;color:var(--sd-fe-text-secondary);cursor:pointer}.icon-button:hover{background:var(--sd-fe-hover-strong);color:var(--sd-fe-text)}.icon-button:focus-visible{outline:2px solid var(--sd-fe-accent);outline-offset:1px}.icon-button--toggle{width:40px;height:32px}.icon-button--active,.icon-button--active:hover{background:var(--sd-fe-accent-soft);color:var(--sd-fe-accent)}.heading-row{display:flex;align-items:flex-end;justify-content:space-between;gap:12px;margin-top:10px;padding:0 32px}.heading{min-width:0;margin:0;overflow:hidden;font-size:18px;font-weight:700;line-height:26px;text-overflow:ellipsis;white-space:nowrap}.count{flex:none;padding-bottom:12px;font-size:13px;color:var(--sd-fe-text-secondary)}.scroller{flex:1;min-height:0;padding:8px 28px 16px;overflow-y:auto}.scrim{position:absolute;inset:0;background:var(--sd-fe-scrim);animation:sd-file-explorer-fade .18s ease}.transfers{flex:none;border-top:1px solid var(--sd-fe-border);background:var(--sd-fe-surface)}.drop-overlay{position:absolute;inset:0;z-index:10;display:flex;align-items:center;justify-content:center;padding:16px;border:2px dashed var(--sd-fe-accent);border-radius:var(--sd-fe-radius);background:color-mix(in srgb,var(--sd-fe-accent) 8%,rgba(255,255,255,.86));pointer-events:none}.drop-card{display:flex;flex-direction:column;align-items:center;gap:10px;color:var(--sd-fe-accent);text-align:center}.drop-title{margin:0;font-size:16px;font-weight:600}.dialog-backdrop{position:absolute;inset:0;z-index:20;background:var(--sd-fe-scrim)}.dialog{position:absolute;top:50%;left:50%;z-index:21;display:flex;flex-direction:column;gap:8px;width:min(400px,100% - 32px);padding:20px;border-radius:14px;background:var(--sd-fe-surface);box-shadow:0 18px 48px #0f172a2e;transform:translate(-50%,-50%)}.dialog:focus{outline:none}.dialog-title{margin:0 0 8px;font-size:17px;font-weight:600;line-height:24px}.field-label{font-size:13px;color:var(--sd-fe-text-secondary)}.field-input{height:40px;padding:0 12px;border:1px solid var(--sd-fe-border-strong);border-radius:8px;background:var(--sd-fe-surface);color:var(--sd-fe-text);font:inherit;font-size:15px;outline:none}.field-input:focus{border-color:var(--sd-fe-accent);box-shadow:0 0 0 3px var(--sd-fe-accent-soft)}.field-input[aria-invalid=true]{border-color:var(--sd-fe-error)}.field-error{margin:0;font-size:13px;color:var(--sd-fe-error)}.dialog-actions{display:flex;justify-content:flex-end;gap:8px;margin-top:12px}.share-status{display:flex;align-items:center;gap:10px;margin:4px 0;font-size:14px;color:var(--sd-fe-text-secondary)}.share-feedback{min-height:18px;margin:0;font-size:13px;line-height:18px;color:var(--sd-fe-success)}.spinner{flex:none;width:18px;height:18px;border:2px solid color-mix(in srgb,var(--sd-fe-accent) 20%,transparent);border-top-color:var(--sd-fe-accent);border-radius:50%;animation:sd-file-explorer-spin .8s linear infinite}:host(.sd-file-explorer--compact) .header{grid-template-columns:minmax(0,1fr) auto;gap:10px 12px;padding:12px 14px}:host(.sd-file-explorer--compact) .brand{grid-row:1;gap:10px}:host(.sd-file-explorer--compact) .upload-button{grid-column:2;grid-row:1}:host(.sd-file-explorer--compact) .search{grid-column:1/-1;grid-row:2;max-width:none}:host(.sd-file-explorer--compact) .header:not(:has(.brand)) .search{grid-column:1;grid-row:1}:host(.sd-file-explorer--compact) .body{grid-template-columns:minmax(0,1fr)}:host(.sd-file-explorer--compact) .sidebar{position:absolute;top:0;bottom:0;left:0;z-index:5;width:min(300px,86%);border-right:1px solid var(--sd-fe-border);box-shadow:12px 0 32px #0f172a1f;visibility:hidden;transform:translate(-100%);transition:transform .2s ease,visibility .2s}:host(.sd-file-explorer--compact) .sidebar--open{visibility:visible;transform:none}:host(.sd-file-explorer--compact) .scrim--sidebar{z-index:4}:host(.sd-file-explorer--compact) .main{padding-top:8px}:host(.sd-file-explorer--compact) .toolbar{gap:6px;min-height:36px;padding:0 12px 0 10px}:host(.sd-file-explorer--compact) .breadcrumb{margin-left:0}:host(.sd-file-explorer--compact) .icon-button--toggle{width:36px}:host(.sd-file-explorer--compact) .heading-row{margin-top:13px;padding:0 14px}:host(.sd-file-explorer--compact) .count{padding-bottom:8px}:host(.sd-file-explorer--compact) .scroller{padding:0 12px 12px}@keyframes sd-file-explorer-spin{to{transform:rotate(360deg)}}@keyframes sd-file-explorer-fade{0%{opacity:0}}@keyframes sd-file-explorer-refresh{0%{left:-30%}to{left:100%}}@media(prefers-reduced-motion:reduce){.scrim{animation:none}.search,:host(.sd-file-explorer--compact) .sidebar{transition:none}}\n"], dependencies: [{ kind: "component", type: SdIcon, selector: "sd-icon", inputs: ["name", "fontIcon", "color", "set", "fontSet", "size", "strokeWidth", "absoluteStrokeWidth", "ariaLabel"] }, { kind: "component", type: SdBreadcrumb, selector: "sd-breadcrumb", inputs: ["items", "maxItems", "ariaLabel", "separator"], outputs: ["sdItemActivate"] }, { kind: "component", type: SdButton, selector: "sd-button", inputs: ["autoId", "type", "color", "size", "fontSet", "title", "width", "tooltip", "prefixIcon", "suffixIcon", "disabled", "openOnHover", "loading", "block", "htmlType"], outputs: ["click"] }, { kind: "component", type: SdDataState, selector: "sd-data-state", inputs: ["state", "title", "message", "icon", "fontSet", "retryable", "retryLabel", "actionLabel", "compact", "fullPage"], outputs: ["sdRetry", "sdAction"] }, { kind: "component", type: SdFileExplorerFolderTree, selector: "sd-file-explorer-folder-tree", inputs: ["nodes", "label"], outputs: ["select", "toggle", "retry"] }, { kind: "component", type: SdFileExplorerItemList, selector: "sd-file-explorer-item-list", inputs: ["items", "view", "canDownload", "canShare", "compact", "activeId", "label"], outputs: ["activate", "download", "share"] }, { kind: "component", type: SdFileExplorerPreviewPanel, selector: "sd-file-explorer-preview-panel", inputs: ["view", "state", "meta", "canDownload", "canShare", "container", "autoId"], outputs: ["close", "download", "share", "retry", "imageError"] }, { kind: "component", type: SdFileExplorerTransferPanel, selector: "sd-file-explorer-transfer-panel", inputs: ["transfers", "title", "collapsed", "canClear", "compact", "autoId"], outputs: ["toggleCollapsed", "clear", "cancel", "retry", "dismiss"] }, { kind: "pipe", type: SdTranslatePipe, name: "sdTranslate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
2551
+ }
2552
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: SdFileExplorer, decorators: [{
2553
+ type: Component,
2554
+ args: [{ selector: 'sd-file-explorer', standalone: true, imports: [
2555
+ SdIcon,
2556
+ SdTranslatePipe,
2557
+ SdBreadcrumb,
2558
+ SdButton,
2559
+ SdDataState,
2560
+ SdFileExplorerFolderTree,
2561
+ SdFileExplorerItemList,
2562
+ SdFileExplorerPreviewPanel,
2563
+ SdFileExplorerTransferPanel,
2564
+ ], changeDetection: ChangeDetectionStrategy.OnPush, host: {
2565
+ class: 'sd-file-explorer',
2566
+ '[class.sd-file-explorer--compact]': 'compact()',
2567
+ '[class.sd-file-explorer--dragging]': 'dragActive()',
2568
+ '[attr.data-autoid]': 'autoId()',
2569
+ '(dragenter)': 'onDragEnter($event)',
2570
+ '(dragover)': 'onDragOver($event)',
2571
+ '(dragleave)': 'onDragLeave()',
2572
+ '(drop)': 'onDrop($event)',
2573
+ '(keydown.escape)': 'onEscape($event)',
2574
+ }, template: "@let _option = option();\n@let _compact = compact();\n@let _autoId = autoId();\n@let _canUpload = canUpload();\n@let _canDownload = canDownload();\n@let _view = view();\n@let _state = contentState();\n@let _keyword = keyword();\n@let _sidebarOpen = sidebarOpen();\n@let _preview = previewView();\n@let _transfers = transferViews();\n@let _heading = heading();\n@let _searching = searching();\n@let _collapsed = transfersCollapsed();\n@let _dialogOpen = folderDialogOpen();\n@let _shareItem = shareItem();\n@let _canShare = canShare();\n@let _modalOpen = _dialogOpen || !!_shareItem;\n\n<header class=\"header\" [attr.inert]=\"_modalOpen ? '' : null\">\n @if (_option.title) {\n <div class=\"brand\">\n <span class=\"brand-icon\" aria-hidden=\"true\">\n <sd-icon name=\"folder\" size=\"20px\" />\n </span>\n <div class=\"brand-text\">\n <h2 class=\"brand-title\" [title]=\"_option.title\">{{ _option.title }}</h2>\n @if (_option.description) {\n <p class=\"brand-description\">{{ _option.description }}</p>\n }\n </div>\n </div>\n }\n\n <div class=\"search\" role=\"search\">\n <sd-icon class=\"search-icon\" name=\"search\" size=\"20px\" />\n <input\n #searchInput\n type=\"search\"\n class=\"search-input\"\n autocomplete=\"off\"\n [value]=\"_keyword\"\n [placeholder]=\"'core.component.file-explorer.search-placeholder' | sdTranslate\"\n [attr.aria-label]=\"'core.component.file-explorer.search-placeholder' | sdTranslate\"\n [attr.data-autoid]=\"_autoId ? _autoId + '-search' : null\"\n (input)=\"onKeywordInput(searchInput.value)\" />\n @if (_keyword) {\n <button\n type=\"button\"\n class=\"search-clear\"\n [attr.aria-label]=\"'core.component.file-explorer.search-clear' | sdTranslate\"\n [title]=\"'core.component.file-explorer.search-clear' | sdTranslate\"\n (click)=\"clearSearch()\">\n <sd-icon name=\"close\" size=\"18px\" />\n </button>\n }\n </div>\n\n @if (_canUpload) {\n <sd-button\n class=\"upload-button\"\n type=\"fill\"\n color=\"primary\"\n size=\"md\"\n prefixIcon=\"file_upload\"\n [title]=\"_compact ? undefined : ('core.component.file-explorer.upload' | sdTranslate)\"\n [tooltip]=\"_compact ? ('core.component.file-explorer.upload' | sdTranslate) : undefined\"\n [attr.data-autoid]=\"_autoId ? _autoId + '-upload' : null\"\n (click)=\"fileInput.click()\" />\n <input\n #fileInput\n type=\"file\"\n class=\"file-input\"\n multiple\n tabindex=\"-1\"\n aria-hidden=\"true\"\n [attr.data-autoid]=\"_autoId ? _autoId + '-file-input' : null\"\n (change)=\"onFilesPicked(fileInput)\" />\n }\n</header>\n\n<!-- why: dialog ph\u1EE7 c\u1EA3 explorer n\u00EAn l\u00E0m inert c\u1EA3 v\u00F9ng n\u00E0y, k\u1EC3 c\u1EA3 drawer chi ti\u1EBFt \u0111ang n\u1EB1m trong .main. -->\n<div class=\"body\" [attr.inert]=\"_modalOpen ? '' : null\">\n @if (_compact && _sidebarOpen) {\n <div class=\"scrim scrim--sidebar\" aria-hidden=\"true\" (click)=\"sidebarOpen.set(false)\"></div>\n }\n <aside\n #sidebar\n class=\"sidebar\"\n [class.sidebar--open]=\"_sidebarOpen\"\n [id]=\"instanceId + '-sidebar'\"\n [attr.aria-label]=\"'core.component.file-explorer.folders' | sdTranslate\"\n [attr.inert]=\"_compact && !_sidebarOpen ? '' : null\">\n <p class=\"sidebar-label\">{{ 'core.component.file-explorer.folders' | sdTranslate }}</p>\n <div class=\"sidebar-tree\">\n <sd-file-explorer-folder-tree\n [nodes]=\"treeNodes()\"\n [label]=\"'core.component.file-explorer.tree-label' | sdTranslate\"\n (select)=\"onTreeSelect($event)\"\n (toggle)=\"onTreeToggle($event)\"\n (retry)=\"onTreeRetry($event)\" />\n </div>\n @if (canCreateFolder()) {\n <div class=\"sidebar-footer\">\n <sd-button\n #newFolderButton\n class=\"new-folder-button\"\n type=\"outline\"\n color=\"secondary\"\n size=\"md\"\n prefixIcon=\"add\"\n block\n [title]=\"'core.component.file-explorer.new-folder' | sdTranslate\"\n [attr.data-autoid]=\"_autoId ? _autoId + '-new-folder' : null\"\n (click)=\"openFolderDialog()\" />\n </div>\n }\n </aside>\n\n <!-- why: .main l\u00E0 [container] c\u1EE7a drawer chi ti\u1EBFt \u2014 backdrop ch\u1EC9 ph\u1EE7 v\u00F9ng b\u00EAn ph\u1EA3i, c\u00E2y th\u01B0 m\u1EE5c v\u1EABn d\u00F9ng \u0111\u01B0\u1EE3c.\n Drawer n\u1EB1m TRONG ph\u1EA7n t\u1EED n\u00E0y n\u00EAn inert \u0111\u1EB7t tr\u00EAn t\u1EEBng kh\u1ED1i con, kh\u00F4ng \u0111\u1EB7t tr\u00EAn .main. -->\n <section #mainRegion class=\"main\" [attr.aria-label]=\"_heading\">\n @if (refreshing()) {\n <div class=\"refresh-bar\" aria-hidden=\"true\"></div>\n }\n <div class=\"toolbar\" [attr.inert]=\"_preview ? '' : null\">\n @if (_compact) {\n <button\n type=\"button\"\n class=\"icon-button\"\n [attr.aria-expanded]=\"_sidebarOpen\"\n [attr.aria-controls]=\"instanceId + '-sidebar'\"\n [attr.aria-label]=\"\n (_sidebarOpen ? 'core.component.file-explorer.close-folders' : 'core.component.file-explorer.open-folders') | sdTranslate\n \"\n [attr.data-autoid]=\"_autoId ? _autoId + '-menu' : null\"\n (click)=\"toggleSidebar()\">\n <sd-icon name=\"menu\" size=\"24px\" />\n </button>\n }\n <sd-breadcrumb\n class=\"breadcrumb\"\n [items]=\"breadcrumb().items\"\n [maxItems]=\"_compact ? 3 : 5\"\n [ariaLabel]=\"'core.component.file-explorer.breadcrumb' | sdTranslate\"\n (sdItemActivate)=\"onBreadcrumb($event)\" />\n <div class=\"view-toggle\" role=\"group\" [attr.aria-label]=\"'core.component.file-explorer.view' | sdTranslate\">\n <button\n type=\"button\"\n class=\"icon-button icon-button--toggle\"\n [class.icon-button--active]=\"_view === 'list'\"\n [attr.aria-pressed]=\"_view === 'list'\"\n [attr.aria-label]=\"'core.component.file-explorer.view-list' | sdTranslate\"\n [title]=\"'core.component.file-explorer.view-list' | sdTranslate\"\n [attr.data-autoid]=\"_autoId ? _autoId + '-view-list' : null\"\n (click)=\"setView('list')\">\n <sd-icon name=\"format_list_bulleted\" size=\"24px\" />\n </button>\n <button\n type=\"button\"\n class=\"icon-button icon-button--toggle\"\n [class.icon-button--active]=\"_view === 'grid'\"\n [attr.aria-pressed]=\"_view === 'grid'\"\n [attr.aria-label]=\"'core.component.file-explorer.view-grid' | sdTranslate\"\n [title]=\"'core.component.file-explorer.view-grid' | sdTranslate\"\n [attr.data-autoid]=\"_autoId ? _autoId + '-view-grid' : null\"\n (click)=\"setView('grid')\">\n <sd-icon name=\"grid_view\" size=\"24px\" />\n </button>\n </div>\n </div>\n\n <div class=\"heading-row\" [attr.inert]=\"_preview ? '' : null\">\n <h3 class=\"heading\" [title]=\"_heading\">{{ _heading }}</h3>\n @if (_state === 'items') {\n <span class=\"count\">{{ itemCountLabel() }}</span>\n }\n </div>\n\n <div class=\"scroller\" [attr.inert]=\"_preview ? '' : null\">\n @switch (_state) {\n @case ('loading') {\n <sd-data-state\n state=\"loading\"\n compact\n [title]=\"(_searching ? 'core.component.file-explorer.search-loading' : 'core.component.file-explorer.loading') | sdTranslate\" />\n }\n @case ('error') {\n <sd-data-state\n state=\"error\"\n retryable\n [title]=\"(_searching ? 'core.component.file-explorer.search-error' : 'core.component.file-explorer.load-error') | sdTranslate\"\n [message]=\"errorMessage()\"\n [retryLabel]=\"'core.component.file-explorer.retry' | sdTranslate\"\n (sdRetry)=\"retryContent()\" />\n }\n @case ('empty') {\n <sd-data-state\n state=\"empty\"\n [icon]=\"_searching ? 'search_off' : 'folder_open'\"\n [title]=\"emptyTitle()\"\n [message]=\"emptyMessage()\" />\n }\n @default {\n <sd-file-explorer-item-list\n [items]=\"itemViews()\"\n [view]=\"_view\"\n [canDownload]=\"_canDownload\"\n [canShare]=\"_canShare\"\n [compact]=\"_compact\"\n [activeId]=\"_preview ? _preview.item.id : null\"\n [label]=\"_heading\"\n (activate)=\"onActivate($event)\"\n (download)=\"downloadItem($event.item)\"\n (share)=\"openShare($event.item)\" />\n }\n }\n </div>\n </section>\n</div>\n\n@if (_transfers.length) {\n <sd-file-explorer-transfer-panel\n class=\"transfers\"\n [attr.inert]=\"_modalOpen ? '' : null\"\n [transfers]=\"_transfers\"\n [title]=\"transfersTitle()\"\n [collapsed]=\"_collapsed\"\n [canClear]=\"canClearTransfers()\"\n [compact]=\"_compact\"\n [autoId]=\"_autoId ? _autoId + '-transfers' : undefined\"\n (toggleCollapsed)=\"transfersCollapsed.set(!_collapsed)\"\n (clear)=\"clearFinishedTransfers()\"\n (cancel)=\"cancelTransfer($event)\"\n (retry)=\"retryTransfer($event)\"\n (dismiss)=\"dismissTransfer($event)\" />\n}\n\n<!-- why: chi ti\u1EBFt file l\u00E0 sd-side-drawer th\u1EADt, m\u1EDF g\u1ECDn trong v\u00F9ng danh s\u00E1ch b\u00EAn ph\u1EA3i nh\u1EDD [container]:\n header (t\u00ECm ki\u1EBFm, t\u1EA3i l\u00EAn), c\u00E2y th\u01B0 m\u1EE5c v\u00E0 h\u00E0ng ch\u1EDD truy\u1EC1n t\u1EA3i v\u1EABn d\u00F9ng \u0111\u01B0\u1EE3c khi drawer m\u1EDF. -->\n<sd-file-explorer-preview-panel\n [view]=\"_preview\"\n [state]=\"previewState()\"\n [meta]=\"previewMeta()\"\n [canDownload]=\"_canDownload\"\n [canShare]=\"_canShare\"\n [container]=\"mainRegion\"\n [autoId]=\"_autoId ? _autoId + '-preview' : undefined\"\n (close)=\"closePreview()\"\n (download)=\"downloadPreview()\"\n (share)=\"sharePreview()\"\n (retry)=\"retryPreview()\"\n (imageError)=\"onPreviewImageError()\" />\n\n@if (dragActive()) {\n <div class=\"drop-overlay\" aria-hidden=\"true\">\n <div class=\"drop-card\">\n <sd-icon name=\"file_upload\" size=\"40px\" />\n <p class=\"drop-title\">{{ dropTitle() }}</p>\n </div>\n </div>\n}\n\n@if (_dialogOpen) {\n @let _folderName = folderName();\n @let _folderError = folderError();\n <div class=\"dialog-backdrop\" aria-hidden=\"true\" (click)=\"closeFolderDialog()\"></div>\n <form\n class=\"dialog\"\n role=\"dialog\"\n aria-modal=\"true\"\n novalidate\n [attr.aria-labelledby]=\"instanceId + '-folder-title'\"\n [attr.data-autoid]=\"_autoId ? _autoId + '-folder-dialog' : null\"\n (submit)=\"submitFolder($event)\">\n <h3 class=\"dialog-title\" [id]=\"instanceId + '-folder-title'\">{{ folderDialogTitle() }}</h3>\n <label class=\"field-label\" [for]=\"instanceId + '-folder-name'\">{{\n 'core.component.file-explorer.new-folder-name' | sdTranslate\n }}</label>\n <input\n #folderInput\n class=\"field-input\"\n autocomplete=\"off\"\n maxlength=\"255\"\n [id]=\"instanceId + '-folder-name'\"\n [value]=\"_folderName\"\n [attr.aria-invalid]=\"_folderError ? true : null\"\n [attr.aria-describedby]=\"_folderError ? instanceId + '-folder-error' : null\"\n [attr.data-autoid]=\"_autoId ? _autoId + '-folder-name' : null\"\n (input)=\"folderName.set(folderInput.value)\" />\n @if (_folderError) {\n <p class=\"field-error\" role=\"alert\" [id]=\"instanceId + '-folder-error'\">{{ _folderError }}</p>\n }\n <div class=\"dialog-actions\">\n <sd-button\n class=\"cancel-button\"\n type=\"text\"\n color=\"secondary\"\n size=\"md\"\n [title]=\"'core.component.file-explorer.cancel' | sdTranslate\"\n (click)=\"closeFolderDialog()\" />\n <sd-button\n class=\"submit-button\"\n type=\"fill\"\n color=\"primary\"\n size=\"md\"\n htmlType=\"submit\"\n [title]=\"'core.component.file-explorer.create' | sdTranslate\"\n [disabled]=\"!_folderName.trim()\"\n [loading]=\"folderSubmitting()\"\n [attr.data-autoid]=\"_autoId ? _autoId + '-folder-submit' : null\" />\n </div>\n </form>\n}\n\n@if (_shareItem) {\n @let _shareState = shareState();\n <div class=\"dialog-backdrop\" aria-hidden=\"true\" (click)=\"closeShare()\"></div>\n <div\n #shareDialog\n class=\"dialog\"\n role=\"dialog\"\n aria-modal=\"true\"\n tabindex=\"-1\"\n [attr.aria-labelledby]=\"instanceId + '-share-title'\"\n [attr.aria-busy]=\"_shareState.status === 'loading' ? true : null\"\n [attr.data-autoid]=\"_autoId ? _autoId + '-share-dialog' : null\">\n <h3 class=\"dialog-title\" [id]=\"instanceId + '-share-title'\" [title]=\"_shareItem.name\">{{ shareTitle() }}</h3>\n @switch (_shareState.status) {\n @case ('loading') {\n <p class=\"share-status\" role=\"status\">\n <span class=\"spinner\" aria-hidden=\"true\"></span>\n {{ 'core.component.file-explorer.share.loading' | sdTranslate }}\n </p>\n }\n @case ('error') {\n <p class=\"field-error\" role=\"alert\">{{ _shareState.message }}</p>\n }\n @case ('ready') {\n <label class=\"field-label\" [for]=\"instanceId + '-share-link'\">{{ 'core.component.file-explorer.share.link' | sdTranslate }}</label>\n <input\n #shareInput\n class=\"field-input\"\n readonly\n [id]=\"instanceId + '-share-link'\"\n [value]=\"_shareState.url\"\n [attr.aria-describedby]=\"instanceId + '-share-feedback'\"\n [attr.data-autoid]=\"_autoId ? _autoId + '-share-link' : null\"\n (focus)=\"shareInput.select()\" />\n <p class=\"share-feedback\" role=\"status\" aria-live=\"polite\" [id]=\"instanceId + '-share-feedback'\">{{ shareFeedbackLabel() }}</p>\n }\n }\n <div class=\"dialog-actions\">\n <sd-button\n class=\"close-button\"\n type=\"text\"\n color=\"secondary\"\n size=\"md\"\n [title]=\"'core.component.file-explorer.close' | sdTranslate\"\n (click)=\"closeShare()\" />\n @if (_shareState.status === 'error') {\n <sd-button\n class=\"retry-button\"\n type=\"outline\"\n color=\"primary\"\n size=\"md\"\n prefixIcon=\"refresh\"\n [title]=\"'core.component.file-explorer.retry' | sdTranslate\"\n (click)=\"retryShare()\" />\n } @else {\n <sd-button\n #copyButton\n class=\"copy-button\"\n type=\"fill\"\n color=\"primary\"\n size=\"md\"\n prefixIcon=\"content_copy\"\n [title]=\"\n (shareFeedback() === 'copied' ? 'core.component.file-explorer.share.copied' : 'core.component.file-explorer.share.copy')\n | sdTranslate\n \"\n [disabled]=\"_shareState.status !== 'ready'\"\n [attr.data-autoid]=\"_autoId ? _autoId + '-share-copy' : null\"\n (click)=\"copyShareLink()\" />\n }\n </div>\n </div>\n}\n", styles: [":host{--sd-fe-accent: var(--sd-file-explorer-accent, var(--sd-primary, #005cbb));--sd-fe-accent-strong: var(--sd-file-explorer-accent-strong, color-mix(in srgb, var(--sd-fe-accent) 84%, #000000));--sd-fe-accent-contrast: var(--sd-file-explorer-accent-contrast, var(--sd-primary-contrast, #ffffff));--sd-fe-accent-soft: var(--sd-file-explorer-accent-soft, color-mix(in srgb, var(--sd-fe-accent) 10%, #ffffff));--sd-fe-surface: var(--sd-file-explorer-surface, #ffffff);--sd-fe-sidebar-bg: var(--sd-file-explorer-sidebar-bg, color-mix(in srgb, var(--sd-surface-muted, #e7e8ed) 26%, var(--sd-fe-surface)));--sd-fe-muted-surface: var( --sd-file-explorer-muted-surface, color-mix(in srgb, var(--sd-surface-muted, #e7e8ed) 50%, var(--sd-fe-surface)) );--sd-fe-preview-bg: var(--sd-file-explorer-preview-bg, color-mix(in srgb, var(--sd-fe-accent) 9%, #ffffff));--sd-fe-border: var(--sd-file-explorer-border, color-mix(in srgb, var(--sd-border, #c4c6d0) 55%, #ffffff));--sd-fe-border-strong: var(--sd-file-explorer-border-strong, var(--sd-border, #c4c6d0));--sd-fe-text: var(--sd-file-explorer-text, var(--sd-text, #1a1b1f));--sd-fe-text-secondary: var(--sd-file-explorer-text-secondary, color-mix(in srgb, var(--sd-text-secondary, #44474f) 84%, #ffffff));--sd-fe-hover: color-mix(in srgb, var(--sd-fe-text) 4%, transparent);--sd-fe-hover-strong: color-mix(in srgb, var(--sd-fe-text) 8%, transparent);--sd-fe-track: color-mix(in srgb, var(--sd-fe-text) 7%, var(--sd-fe-surface));--sd-fe-success: var(--sd-file-explorer-success, var(--sd-success, #2e7d32));--sd-fe-error: var(--sd-file-explorer-error, var(--sd-error, #ba1a1a));--sd-fe-radius: var(--sd-file-explorer-radius, 16px);--sd-fe-scrim: var(--sd-file-explorer-scrim, rgba(0, 0, 0, .4));--sd-side-drawer-contained-z-index: 9;position:relative;display:flex;flex-direction:column;height:100%;min-height:480px;overflow:hidden;border:1px solid var(--sd-fe-border);border-radius:var(--sd-fe-radius);background:var(--sd-fe-surface);color:var(--sd-fe-text);font-size:14px;line-height:20px}.header{display:grid;grid-template-columns:fit-content(320px) minmax(0,1fr) auto;align-items:center;gap:12px 20px;padding:16px 20px;border-bottom:1px solid var(--sd-fe-border)}.brand{grid-column:1;display:flex;align-items:center;gap:10px;min-width:0}.brand-icon{flex:none;display:grid;place-items:center;width:32px;height:32px;border-radius:50%;background:color-mix(in srgb,var(--sd-fe-accent) 14%,#ffffff);color:var(--sd-fe-accent)}.brand-text{min-width:0}.brand-title{margin:0;overflow:hidden;font-size:16px;font-weight:600;line-height:22px;text-overflow:ellipsis;white-space:nowrap}.brand-description{margin:0;overflow:hidden;font-size:12px;line-height:16px;color:var(--sd-fe-text-secondary);text-overflow:ellipsis;white-space:nowrap}.search{grid-column:2;justify-self:center;display:flex;align-items:center;gap:8px;width:100%;max-width:520px;height:36px;padding:0 6px 0 12px;border:1px solid var(--sd-fe-border);border-radius:999px;background:var(--sd-fe-muted-surface);transition:border-color .12s ease,box-shadow .12s ease}.search:focus-within{border-color:var(--sd-fe-accent);background:var(--sd-fe-surface);box-shadow:0 0 0 3px var(--sd-fe-accent-soft)}.search-icon{flex:none;color:var(--sd-fe-text-secondary)}.search-input{flex:1;min-width:0;height:100%;padding:0;border:0;outline:none;background:transparent;color:var(--sd-fe-text);font:inherit;font-size:14px}.search-input::placeholder{color:var(--sd-fe-text-secondary)}.search-input::-webkit-search-cancel-button{display:none}.search-clear{flex:none;display:inline-flex;align-items:center;justify-content:center;width:26px;height:26px;padding:0;border:0;border-radius:999px;background:transparent;color:var(--sd-fe-text-secondary);cursor:pointer}.search-clear:hover{background:var(--sd-fe-hover-strong)}.upload-button{grid-column:3;justify-self:end}.file-input{display:none}.body{position:relative;flex:1;min-height:0;display:grid;grid-template-columns:238px minmax(0,1fr)}.sidebar{display:flex;flex-direction:column;min-height:0;padding:22px 14px 32px 12px;border-right:1px solid var(--sd-fe-border);background:var(--sd-fe-sidebar-bg)}.sidebar-label{margin:0 0 6px 10px;font-size:12px;font-weight:700;line-height:16px;letter-spacing:.04em;text-transform:uppercase;color:var(--sd-fe-text-secondary)}.sidebar-tree{flex:1;min-height:0;margin:0 -4px;padding:2px 4px;overflow-y:auto}.sidebar-footer{margin:12px 4px 0;padding-top:18px;border-top:1px solid var(--sd-fe-border)}.new-folder-button{display:block}.main{position:relative;display:flex;flex-direction:column;min-width:0;min-height:0;padding-top:14px}.refresh-bar{position:absolute;top:0;left:0;right:0;height:2px;overflow:hidden;background:var(--sd-fe-accent-soft)}.refresh-bar:after{content:\"\";position:absolute;top:0;bottom:0;width:30%;background:var(--sd-fe-accent);animation:sd-file-explorer-refresh 1.2s ease-in-out infinite}.toolbar{display:flex;align-items:center;gap:12px;min-height:40px;padding:0 32px}.breadcrumb{flex:1;min-width:0;margin-left:-4px;font-size:15px;font-weight:600}.view-toggle{flex:none;display:flex;gap:2px;padding:2px;border:1px solid var(--sd-fe-border);border-radius:999px;background:var(--sd-fe-surface)}.icon-button{flex:none;display:inline-flex;align-items:center;justify-content:center;width:36px;height:36px;padding:0;border:0;border-radius:999px;background:transparent;color:var(--sd-fe-text-secondary);cursor:pointer}.icon-button:hover{background:var(--sd-fe-hover-strong);color:var(--sd-fe-text)}.icon-button:focus-visible{outline:2px solid var(--sd-fe-accent);outline-offset:1px}.icon-button--toggle{width:40px;height:32px}.icon-button--active,.icon-button--active:hover{background:var(--sd-fe-accent-soft);color:var(--sd-fe-accent)}.heading-row{display:flex;align-items:flex-end;justify-content:space-between;gap:12px;margin-top:10px;padding:0 32px}.heading{min-width:0;margin:0;overflow:hidden;font-size:18px;font-weight:700;line-height:26px;text-overflow:ellipsis;white-space:nowrap}.count{flex:none;padding-bottom:12px;font-size:13px;color:var(--sd-fe-text-secondary)}.scroller{flex:1;min-height:0;padding:8px 28px 16px;overflow-y:auto}.scrim{position:absolute;inset:0;background:var(--sd-fe-scrim);animation:sd-file-explorer-fade .18s ease}.transfers{flex:none;border-top:1px solid var(--sd-fe-border);background:var(--sd-fe-surface)}.drop-overlay{position:absolute;inset:0;z-index:10;display:flex;align-items:center;justify-content:center;padding:16px;border:2px dashed var(--sd-fe-accent);border-radius:var(--sd-fe-radius);background:color-mix(in srgb,var(--sd-fe-accent) 8%,rgba(255,255,255,.86));pointer-events:none}.drop-card{display:flex;flex-direction:column;align-items:center;gap:10px;color:var(--sd-fe-accent);text-align:center}.drop-title{margin:0;font-size:16px;font-weight:600}.dialog-backdrop{position:absolute;inset:0;z-index:20;background:var(--sd-fe-scrim)}.dialog{position:absolute;top:50%;left:50%;z-index:21;display:flex;flex-direction:column;gap:8px;width:min(400px,100% - 32px);padding:20px;border-radius:14px;background:var(--sd-fe-surface);box-shadow:0 18px 48px #0f172a2e;transform:translate(-50%,-50%)}.dialog:focus{outline:none}.dialog-title{margin:0 0 8px;font-size:17px;font-weight:600;line-height:24px}.field-label{font-size:13px;color:var(--sd-fe-text-secondary)}.field-input{height:40px;padding:0 12px;border:1px solid var(--sd-fe-border-strong);border-radius:8px;background:var(--sd-fe-surface);color:var(--sd-fe-text);font:inherit;font-size:15px;outline:none}.field-input:focus{border-color:var(--sd-fe-accent);box-shadow:0 0 0 3px var(--sd-fe-accent-soft)}.field-input[aria-invalid=true]{border-color:var(--sd-fe-error)}.field-error{margin:0;font-size:13px;color:var(--sd-fe-error)}.dialog-actions{display:flex;justify-content:flex-end;gap:8px;margin-top:12px}.share-status{display:flex;align-items:center;gap:10px;margin:4px 0;font-size:14px;color:var(--sd-fe-text-secondary)}.share-feedback{min-height:18px;margin:0;font-size:13px;line-height:18px;color:var(--sd-fe-success)}.spinner{flex:none;width:18px;height:18px;border:2px solid color-mix(in srgb,var(--sd-fe-accent) 20%,transparent);border-top-color:var(--sd-fe-accent);border-radius:50%;animation:sd-file-explorer-spin .8s linear infinite}:host(.sd-file-explorer--compact) .header{grid-template-columns:minmax(0,1fr) auto;gap:10px 12px;padding:12px 14px}:host(.sd-file-explorer--compact) .brand{grid-row:1;gap:10px}:host(.sd-file-explorer--compact) .upload-button{grid-column:2;grid-row:1}:host(.sd-file-explorer--compact) .search{grid-column:1/-1;grid-row:2;max-width:none}:host(.sd-file-explorer--compact) .header:not(:has(.brand)) .search{grid-column:1;grid-row:1}:host(.sd-file-explorer--compact) .body{grid-template-columns:minmax(0,1fr)}:host(.sd-file-explorer--compact) .sidebar{position:absolute;top:0;bottom:0;left:0;z-index:5;width:min(300px,86%);border-right:1px solid var(--sd-fe-border);box-shadow:12px 0 32px #0f172a1f;visibility:hidden;transform:translate(-100%);transition:transform .2s ease,visibility .2s}:host(.sd-file-explorer--compact) .sidebar--open{visibility:visible;transform:none}:host(.sd-file-explorer--compact) .scrim--sidebar{z-index:4}:host(.sd-file-explorer--compact) .main{padding-top:8px}:host(.sd-file-explorer--compact) .toolbar{gap:6px;min-height:36px;padding:0 12px 0 10px}:host(.sd-file-explorer--compact) .breadcrumb{margin-left:0}:host(.sd-file-explorer--compact) .icon-button--toggle{width:36px}:host(.sd-file-explorer--compact) .heading-row{margin-top:13px;padding:0 14px}:host(.sd-file-explorer--compact) .count{padding-bottom:8px}:host(.sd-file-explorer--compact) .scroller{padding:0 12px 12px}@keyframes sd-file-explorer-spin{to{transform:rotate(360deg)}}@keyframes sd-file-explorer-fade{0%{opacity:0}}@keyframes sd-file-explorer-refresh{0%{left:-30%}to{left:100%}}@media(prefers-reduced-motion:reduce){.scrim{animation:none}.search,:host(.sd-file-explorer--compact) .sidebar{transition:none}}\n"] }]
2575
+ }], ctorParameters: () => [], propDecorators: { option: [{ type: i0.Input, args: [{ isSignal: true, alias: "option", required: true }] }], open: [{ type: i0.Output, args: ["open"] }], searchInput: [{ type: i0.ViewChild, args: ['searchInput', { isSignal: true }] }], folderInput: [{ type: i0.ViewChild, args: ['folderInput', { isSignal: true }] }], newFolderButton: [{ type: i0.ViewChild, args: ['newFolderButton', { ...{ read: ElementRef }, isSignal: true }] }], copyButton: [{ type: i0.ViewChild, args: ['copyButton', { ...{ read: ElementRef }, isSignal: true }] }], shareInput: [{ type: i0.ViewChild, args: ['shareInput', { isSignal: true }] }], shareDialog: [{ type: i0.ViewChild, args: ['shareDialog', { isSignal: true }] }], sidebar: [{ type: i0.ViewChild, args: ['sidebar', { isSignal: true }] }] } });
2576
+
2577
+ /**
2578
+ * Generated bundle index. Do not edit.
2579
+ */
2580
+
2581
+ export { SdFileExplorer };
2582
+ //# sourceMappingURL=sdcorejs-angular-components-file-explorer.mjs.map