@btndprojects/loam-ui-native 0.1.1 → 0.3.1

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 (412) hide show
  1. package/dist/accordion/index.js +7 -3
  2. package/dist/adaptive/index.js +16 -2
  3. package/dist/address-block/index.js +23 -0
  4. package/dist/alert/index.js +8 -2
  5. package/dist/analyzer/index.js +17 -6
  6. package/dist/announcement/index.js +18 -5
  7. package/dist/appearance-picker/index.js +15 -0
  8. package/dist/audio-player/index.js +29 -3
  9. package/dist/avatar/index.js +5 -2
  10. package/dist/avatar-group/index.js +9 -3
  11. package/dist/badge/index.js +10 -4
  12. package/dist/banner/index.js +6 -2
  13. package/dist/board/index.js +18 -6
  14. package/dist/button/index.js +9 -3
  15. package/dist/camera-permission/index.js +23 -12
  16. package/dist/capture-result/index.js +30 -17
  17. package/dist/card/index.js +10 -3
  18. package/dist/card-form/index.js +19 -9
  19. package/dist/carousel/index.js +6 -2
  20. package/dist/chart/index.js +18 -5
  21. package/dist/charts/index.js +21 -6
  22. package/dist/chat/index.js +41 -0
  23. package/dist/checkbox/index.js +9 -5
  24. package/dist/checklist/index.js +20 -8
  25. package/dist/checkout/index.js +30 -12
  26. package/dist/chip/index.js +11 -5
  27. package/dist/chunk-2BZD3NAP.js +1110 -0
  28. package/dist/chunk-2YKVID2V.js +35 -0
  29. package/dist/{chunk-JUAMLEHX.js → chunk-36DA3IPO.js} +137 -37
  30. package/dist/chunk-3A56MIAN.js +599 -0
  31. package/dist/chunk-3SCKCWF5.js +298 -0
  32. package/dist/chunk-3TZNDHKO.js +187 -0
  33. package/dist/chunk-43K3BLXV.js +9 -0
  34. package/dist/chunk-46ZJIQ2Z.js +208 -0
  35. package/dist/chunk-4CZMQDQL.js +192 -0
  36. package/dist/chunk-5DTKORLI.js +255 -0
  37. package/dist/{chunk-LOE5YNN3.js → chunk-5J4WFXFA.js} +68 -24
  38. package/dist/chunk-5KJ7TEQ6.js +305 -0
  39. package/dist/chunk-5NU33TXK.js +529 -0
  40. package/dist/chunk-5Z5ZYMOJ.js +1 -0
  41. package/dist/chunk-6KSUS7DF.js +690 -0
  42. package/dist/chunk-6RV6UW2J.js +349 -0
  43. package/dist/chunk-6RZM7RP2.js +520 -0
  44. package/dist/{chunk-4BXMXBJO.js → chunk-75BDCC7K.js} +24 -11
  45. package/dist/{chunk-PZXZJBMP.js → chunk-7CGJBQUA.js} +357 -32
  46. package/dist/{chunk-CJ5EOYZE.js → chunk-7IVF6JLJ.js} +24 -7
  47. package/dist/chunk-7IWCGXYA.js +143 -0
  48. package/dist/chunk-7LM4ASFH.js +172 -0
  49. package/dist/chunk-7MCEJFWV.js +341 -0
  50. package/dist/chunk-7NGMUVNU.js +245 -0
  51. package/dist/chunk-7PBSIXT7.js +355 -0
  52. package/dist/chunk-7QOYGENL.js +443 -0
  53. package/dist/{chunk-H6NIOQHK.js → chunk-A7SWYDE5.js} +66 -15
  54. package/dist/chunk-ADHPJALR.js +3051 -0
  55. package/dist/chunk-ALJYZLNQ.js +509 -0
  56. package/dist/chunk-APCWFOZW.js +28 -0
  57. package/dist/chunk-AQ5FIG74.js +419 -0
  58. package/dist/chunk-AWKQIE5I.js +139 -0
  59. package/dist/chunk-B2MMZZQB.js +426 -0
  60. package/dist/{chunk-ZVFE5QGU.js → chunk-B7JZ3N5G.js} +174 -97
  61. package/dist/chunk-BL37SW6G.js +1314 -0
  62. package/dist/chunk-BTRMA7GC.js +21 -0
  63. package/dist/chunk-C7IUWIUZ.js +643 -0
  64. package/dist/chunk-CA3DUVYD.js +10 -0
  65. package/dist/{chunk-S7F6XLTK.js → chunk-CBCJSO2B.js} +213 -54
  66. package/dist/chunk-CHPX4MFI.js +239 -0
  67. package/dist/chunk-CLGAMIOT.js +648 -0
  68. package/dist/chunk-CUE7VML6.js +1141 -0
  69. package/dist/chunk-CVU6S2E5.js +1587 -0
  70. package/dist/{chunk-AZRX6SAC.js → chunk-CXPQMA6Z.js} +112 -37
  71. package/dist/chunk-D2LN4I7I.js +581 -0
  72. package/dist/{chunk-UWFLYMAR.js → chunk-D34LNBO5.js} +635 -238
  73. package/dist/chunk-D4BCQICM.js +765 -0
  74. package/dist/chunk-EABKIIA4.js +1 -0
  75. package/dist/chunk-EICSYRAG.js +341 -0
  76. package/dist/chunk-EMWAJMAS.js +83 -0
  77. package/dist/chunk-EOLZWRV6.js +149 -0
  78. package/dist/chunk-EOQVTGB6.js +350 -0
  79. package/dist/{chunk-BEDBFJND.js → chunk-ESGUHNB2.js} +119 -43
  80. package/dist/{chunk-Q72LJOVE.js → chunk-F2KNBPKY.js} +74 -18
  81. package/dist/{chunk-O7AE6DAF.js → chunk-G7H3NX3G.js} +57 -24
  82. package/dist/chunk-GM7YIPB7.js +1052 -0
  83. package/dist/chunk-GVQQG435.js +581 -0
  84. package/dist/chunk-HE43OMEL.js +1056 -0
  85. package/dist/chunk-HHOMFQ7R.js +2535 -0
  86. package/dist/chunk-HJFFOOJ4.js +1 -0
  87. package/dist/chunk-HNAKS4Z3.js +207 -0
  88. package/dist/chunk-HP6ST2OW.js +352 -0
  89. package/dist/chunk-HW3OWDTU.js +1 -0
  90. package/dist/{chunk-3ENTMPQY.js → chunk-HZDB44K4.js} +102 -52
  91. package/dist/chunk-I2KLQ2HA.js +19 -0
  92. package/dist/chunk-I6CUP2LW.js +1155 -0
  93. package/dist/chunk-ICV4Y2WY.js +27 -0
  94. package/dist/chunk-IHSIENOE.js +3950 -0
  95. package/dist/{chunk-CUMUNPXY.js → chunk-IMMALLRU.js} +68 -32
  96. package/dist/chunk-J64KGCGX.js +55 -0
  97. package/dist/{chunk-IVNRBPGC.js → chunk-JA6TK7H2.js} +255 -84
  98. package/dist/{chunk-OOPPQH27.js → chunk-JAVZ5JPV.js} +83 -29
  99. package/dist/chunk-JCMTP3E4.js +1251 -0
  100. package/dist/{chunk-U7TFM2JA.js → chunk-JCXFFK64.js} +75 -18
  101. package/dist/chunk-JWCVBFDU.js +236 -0
  102. package/dist/chunk-JXRTD5RI.js +414 -0
  103. package/dist/chunk-JYIUZUIQ.js +1567 -0
  104. package/dist/chunk-K3TK3GIV.js +219 -0
  105. package/dist/chunk-KEVZIHM2.js +1511 -0
  106. package/dist/chunk-KHZDNQQD.js +171 -0
  107. package/dist/chunk-KL4GDV4V.js +131 -0
  108. package/dist/chunk-KNILMM4H.js +225 -0
  109. package/dist/chunk-KRBUZV45.js +25 -0
  110. package/dist/{chunk-ITTYJZWX.js → chunk-KXLDK6HB.js} +161 -45
  111. package/dist/chunk-KZ3X7TSL.js +196 -0
  112. package/dist/chunk-L2WMOA2V.js +474 -0
  113. package/dist/chunk-L4D5LHCH.js +109 -0
  114. package/dist/chunk-LAUJPLDB.js +853 -0
  115. package/dist/{chunk-SBMNWWBV.js → chunk-LGNTP5XA.js} +89 -17
  116. package/dist/chunk-LUZFCCSD.js +271 -0
  117. package/dist/{chunk-HPPW424V.js → chunk-LXJCP4PL.js} +129 -37
  118. package/dist/chunk-MCOZJWPU.js +731 -0
  119. package/dist/chunk-MG4SKWLL.js +2587 -0
  120. package/dist/chunk-MPEPTSER.js +414 -0
  121. package/dist/chunk-MWPJ4YGP.js +1 -0
  122. package/dist/{chunk-TKQYWZ5V.js → chunk-N7AX4OA4.js} +108 -41
  123. package/dist/chunk-NHSLM6SE.js +523 -0
  124. package/dist/chunk-NNCOFLNE.js +24 -0
  125. package/dist/{chunk-J7Q7VCVC.js → chunk-NNJLVA7M.js} +54 -15
  126. package/dist/chunk-NZG75DGA.js +282 -0
  127. package/dist/chunk-O76QXRBV.js +431 -0
  128. package/dist/chunk-OANH27AK.js +223 -0
  129. package/dist/chunk-OCHPK5YV.js +609 -0
  130. package/dist/chunk-OMHVEVX4.js +436 -0
  131. package/dist/{chunk-YF4NSSMT.js → chunk-ONKQUJWD.js} +220 -65
  132. package/dist/chunk-OVTK7A6T.js +615 -0
  133. package/dist/chunk-PCEFCOLN.js +120 -0
  134. package/dist/chunk-PFLNFIVB.js +186 -0
  135. package/dist/chunk-PHSZY37H.js +300 -0
  136. package/dist/chunk-PJLTKDVY.js +18 -0
  137. package/dist/{chunk-4YIP3CWS.js → chunk-PK7BN3MI.js} +89 -19
  138. package/dist/{chunk-KMI5ML5I.js → chunk-PWFRDRGS.js} +155 -29
  139. package/dist/chunk-PYPMD46W.js +707 -0
  140. package/dist/chunk-Q6CCHDI7.js +331 -0
  141. package/dist/chunk-QFA5WS2A.js +750 -0
  142. package/dist/chunk-QJMMM4RC.js +124 -0
  143. package/dist/chunk-QNZII37O.js +10 -0
  144. package/dist/chunk-QYWEVAM6.js +407 -0
  145. package/dist/chunk-R5T4VZ7Z.js +126 -0
  146. package/dist/chunk-R77HFLZD.js +1 -0
  147. package/dist/{chunk-YC6WORFL.js → chunk-RAESDNU5.js} +228 -102
  148. package/dist/chunk-RBYQUXNL.js +1 -0
  149. package/dist/chunk-RCM3DT5E.js +1 -0
  150. package/dist/chunk-RGNY56L7.js +282 -0
  151. package/dist/chunk-RIK6UX2K.js +344 -0
  152. package/dist/{chunk-LAECSR4H.js → chunk-RJA3RXO3.js} +75 -60
  153. package/dist/chunk-RJYRJ3LD.js +1 -0
  154. package/dist/chunk-RMA3NOY4.js +599 -0
  155. package/dist/{chunk-DM5QUKKO.js → chunk-RSWKKAHK.js} +160 -66
  156. package/dist/chunk-RVOIIX3V.js +204 -0
  157. package/dist/chunk-SA2RRBGT.js +1077 -0
  158. package/dist/chunk-SG3J4R45.js +1428 -0
  159. package/dist/chunk-SPUK7JD4.js +238 -0
  160. package/dist/chunk-SWXV2K5N.js +434 -0
  161. package/dist/chunk-SYJEPXP6.js +1303 -0
  162. package/dist/{chunk-N32RGOA5.js → chunk-SZLI34TA.js} +93 -28
  163. package/dist/{chunk-4GBOGOTV.js → chunk-T77WJA74.js} +143 -18
  164. package/dist/chunk-TDWWVJA4.js +630 -0
  165. package/dist/chunk-TFHI5XDR.js +610 -0
  166. package/dist/chunk-TH4PW2WU.js +17 -0
  167. package/dist/chunk-TTQ24HQX.js +12 -0
  168. package/dist/chunk-TUACVJNG.js +12 -0
  169. package/dist/{chunk-CYRBHQQZ.js → chunk-TUL5RUIA.js} +201 -59
  170. package/dist/{chunk-4ZAHCY44.js → chunk-TYOSA7JG.js} +74 -38
  171. package/dist/chunk-TYQTMMEV.js +1 -0
  172. package/dist/chunk-TZO6YDS7.js +346 -0
  173. package/dist/chunk-U3ETF22F.js +328 -0
  174. package/dist/chunk-U6BYHD2N.js +213 -0
  175. package/dist/{chunk-WSW6ZFAQ.js → chunk-UF6EJXPQ.js} +20 -5
  176. package/dist/chunk-UNNQIPGK.js +792 -0
  177. package/dist/chunk-UQEN55EY.js +1 -0
  178. package/dist/chunk-UQVO6AJV.js +171 -0
  179. package/dist/chunk-VFDQAAIW.js +351 -0
  180. package/dist/chunk-VIUE3VQT.js +1 -0
  181. package/dist/chunk-VJLSSSGC.js +438 -0
  182. package/dist/chunk-VLMT6KYT.js +350 -0
  183. package/dist/chunk-VMHGBUGS.js +35 -0
  184. package/dist/{chunk-7O2FMUPT.js → chunk-VQKPBYW6.js} +400 -139
  185. package/dist/{chunk-EJBDRVIH.js → chunk-VSSTWLC5.js} +61 -16
  186. package/dist/chunk-VZYYZRPN.js +1992 -0
  187. package/dist/chunk-W23G6JLF.js +37 -0
  188. package/dist/chunk-WAIJCD2V.js +480 -0
  189. package/dist/chunk-WFMQ3WKM.js +378 -0
  190. package/dist/chunk-WJ2KDRMY.js +66 -0
  191. package/dist/chunk-WKFZJO54.js +437 -0
  192. package/dist/{chunk-SYNOJOQO.js → chunk-WVVD3XOV.js} +189 -93
  193. package/dist/chunk-XAIWMSLB.js +1 -0
  194. package/dist/chunk-XBXUBBJZ.js +98 -0
  195. package/dist/chunk-XCU7MYBJ.js +1 -0
  196. package/dist/chunk-XHE4PGCI.js +717 -0
  197. package/dist/chunk-XRSJ32M3.js +331 -0
  198. package/dist/chunk-XTCVOEAW.js +1 -0
  199. package/dist/chunk-XWGXVQF6.js +58 -0
  200. package/dist/{chunk-35OFI3JG.js → chunk-Y3XKKO5K.js} +258 -123
  201. package/dist/chunk-Y4QNMBLO.js +533 -0
  202. package/dist/chunk-Y5H4CTKO.js +1 -0
  203. package/dist/chunk-YBQIN75A.js +403 -0
  204. package/dist/chunk-YJ5PXOX3.js +158 -0
  205. package/dist/{chunk-AWJOCGFZ.js → chunk-YLRSRUPS.js} +81 -55
  206. package/dist/chunk-YM6MPJ4A.js +1 -0
  207. package/dist/chunk-YV7KZENV.js +200 -0
  208. package/dist/chunk-Z7I4ZSO6.js +316 -0
  209. package/dist/chunk-ZIRMWD2B.js +555 -0
  210. package/dist/chunk-ZPMG3FWU.js +75 -0
  211. package/dist/{chunk-QWCMU5B2.js → chunk-ZTXMK2G7.js} +289 -115
  212. package/dist/chunk-ZVJCWXAL.js +541 -0
  213. package/dist/{chunk-P23EQNRQ.js → chunk-ZYQ23DPT.js} +215 -49
  214. package/dist/coachmark/index.js +10 -3
  215. package/dist/code-block/index.js +6 -3
  216. package/dist/color-field/index.js +15 -5
  217. package/dist/color-picker/index.js +23 -0
  218. package/dist/commerce/index.js +31 -17
  219. package/dist/confirm/index.js +31 -0
  220. package/dist/connection-card/index.js +34 -0
  221. package/dist/connectivity/index.js +6 -2
  222. package/dist/context-menu/index.js +13 -3
  223. package/dist/copy-button/index.js +5 -2
  224. package/dist/data-grid/index.js +35 -17
  225. package/dist/date-range-picker/index.js +22 -9
  226. package/dist/description-list/index.js +6 -1
  227. package/dist/device-frame/index.js +30 -0
  228. package/dist/dialog/index.js +10 -2
  229. package/dist/divider/index.js +2 -0
  230. package/dist/empty-state/index.js +15 -2
  231. package/dist/error-summary/index.js +9 -2
  232. package/dist/fab/index.js +7 -2
  233. package/dist/file-manager/index.js +44 -0
  234. package/dist/file-upload/index.js +16 -7
  235. package/dist/filter-bar/index.js +14 -7
  236. package/dist/flow-run/index.js +23 -13
  237. package/dist/form/index.js +32 -3
  238. package/dist/gallery/index.js +8 -2
  239. package/dist/hold-to-confirm/index.js +6 -2
  240. package/dist/hover-card/index.js +18 -0
  241. package/dist/icon-tile/index.js +10 -0
  242. package/dist/image/index.js +9 -0
  243. package/dist/index.d.ts +30789 -12332
  244. package/dist/index.js +424 -135
  245. package/dist/infinite-list/index.js +6 -2
  246. package/dist/inline-edit/index.js +8 -5
  247. package/dist/input/index.js +7 -4
  248. package/dist/interactions/index.js +5 -1
  249. package/dist/invoice/index.js +22 -9
  250. package/dist/job-row/index.js +22 -0
  251. package/dist/json-inspector/index.js +20 -0
  252. package/dist/kbd/index.js +5 -1
  253. package/dist/keyboard/index.js +9 -2
  254. package/dist/level-meter/index.js +9 -0
  255. package/dist/list-row/index.js +14 -4
  256. package/dist/log-viewer/index.js +11 -2
  257. package/dist/map-view/index.js +16 -3
  258. package/dist/markdown/index.js +12 -6
  259. package/dist/metric/index.js +10 -4
  260. package/dist/metric-strip/index.js +12 -0
  261. package/dist/money/index.js +16 -3
  262. package/dist/nav-drawer/index.js +8 -2
  263. package/dist/nav-header/index.js +15 -0
  264. package/dist/navigation/index.js +32 -2
  265. package/dist/notification-center/index.js +28 -12
  266. package/dist/number-roll/index.js +7 -2
  267. package/dist/onboarding-pager/index.js +22 -0
  268. package/dist/one-handed/index.js +5 -3
  269. package/dist/os-surfaces/index.js +9 -3
  270. package/dist/otp/index.js +9 -5
  271. package/dist/page-header/index.js +3 -1
  272. package/dist/pagination/index.js +8 -0
  273. package/dist/payment-method/index.js +21 -11
  274. package/dist/payment-status/index.js +26 -15
  275. package/dist/permission/index.js +21 -2
  276. package/dist/picker/index.js +22 -6
  277. package/dist/progress/index.js +11 -3
  278. package/dist/provenance/index.js +16 -0
  279. package/dist/pull-to-refresh/index.js +4 -2
  280. package/dist/qr-code/index.js +16 -0
  281. package/dist/query-builder/index.js +30 -0
  282. package/dist/radio-group/index.js +9 -5
  283. package/dist/rating/index.js +10 -2
  284. package/dist/receivables/index.js +35 -17
  285. package/dist/recording-indicator/index.js +21 -0
  286. package/dist/refund/index.js +28 -15
  287. package/dist/repeatable-rows/index.js +19 -0
  288. package/dist/save-status/index.js +7 -3
  289. package/dist/screen/index.js +3 -0
  290. package/dist/scroll-area/index.js +3 -1
  291. package/dist/search-field/index.js +13 -0
  292. package/dist/secret-field/index.js +19 -0
  293. package/dist/section-header/index.js +4 -0
  294. package/dist/segmented-control/index.js +4 -3
  295. package/dist/sheet/index.js +11 -3
  296. package/dist/shortcuts-sheet/index.js +2 -0
  297. package/dist/sign-in-screen/index.js +25 -0
  298. package/dist/skeleton/index.js +5 -1
  299. package/dist/slider/index.js +5 -2
  300. package/dist/sortable/index.js +8 -0
  301. package/dist/spinner/index.js +4 -1
  302. package/dist/split-button/index.js +21 -6
  303. package/dist/spotlight/index.js +9 -1
  304. package/dist/stack/index.js +2 -0
  305. package/dist/stage-timeline/index.js +8 -3
  306. package/dist/status-dot/index.js +8 -2
  307. package/dist/stepper/index.js +11 -4
  308. package/dist/streaming-text/index.js +4 -2
  309. package/dist/survey/index.js +29 -16
  310. package/dist/switch/index.js +9 -3
  311. package/dist/system-state/index.js +15 -4
  312. package/dist/tab-bar/index.js +13 -2
  313. package/dist/tabs/index.js +12 -2
  314. package/dist/tags-input/index.js +13 -0
  315. package/dist/text/index.js +4 -0
  316. package/dist/textarea/index.js +8 -5
  317. package/dist/thinking/index.js +6 -1
  318. package/dist/tile-rail/index.js +10 -0
  319. package/dist/time-field/index.js +20 -0
  320. package/dist/time-range-control/index.js +36 -0
  321. package/dist/timeline/index.js +4 -2
  322. package/dist/toast/index.js +6 -2
  323. package/dist/toolbar/index.js +5 -2
  324. package/dist/tour/index.js +15 -10
  325. package/dist/transcript/index.js +28 -0
  326. package/dist/truncation-notice/index.js +5 -2
  327. package/dist/update-notice/index.js +19 -9
  328. package/dist/video-player/index.js +29 -2
  329. package/dist/viewfinder/index.js +15 -5
  330. package/dist/widget/index.js +14 -4
  331. package/dist/wizard/index.js +10 -4
  332. package/package.json +13 -12
  333. package/dist/chunk-223Q2T2Q.js +0 -229
  334. package/dist/chunk-2A5NIQAK.js +0 -254
  335. package/dist/chunk-2GK6PHGE.js +0 -363
  336. package/dist/chunk-2ZZ7TDJ4.js +0 -324
  337. package/dist/chunk-3ARE4TES.js +0 -195
  338. package/dist/chunk-3NMD74ZU.js +0 -4
  339. package/dist/chunk-3WPW4KUN.js +0 -182
  340. package/dist/chunk-423B7SPN.js +0 -993
  341. package/dist/chunk-47FWHGUN.js +0 -394
  342. package/dist/chunk-4DS5ZWVC.js +0 -83
  343. package/dist/chunk-4SZYY6AN.js +0 -99
  344. package/dist/chunk-4YQOR7JM.js +0 -204
  345. package/dist/chunk-52X2VYTD.js +0 -228
  346. package/dist/chunk-5YNTNN5A.js +0 -177
  347. package/dist/chunk-6HT2LP62.js +0 -504
  348. package/dist/chunk-6N33LFQA.js +0 -35
  349. package/dist/chunk-6X6PQ443.js +0 -432
  350. package/dist/chunk-7CFF4HXS.js +0 -126
  351. package/dist/chunk-AI4DWZCD.js +0 -162
  352. package/dist/chunk-BTTFCMKG.js +0 -166
  353. package/dist/chunk-BV3B2HYZ.js +0 -1635
  354. package/dist/chunk-C2NTXVWM.js +0 -98
  355. package/dist/chunk-CDRZHT42.js +0 -424
  356. package/dist/chunk-DHWADYZX.js +0 -144
  357. package/dist/chunk-F5XNPWS7.js +0 -1024
  358. package/dist/chunk-FMYDDECK.js +0 -1521
  359. package/dist/chunk-GDKZTW34.js +0 -395
  360. package/dist/chunk-GL7B2DOW.js +0 -134
  361. package/dist/chunk-GNNJ4GCC.js +0 -471
  362. package/dist/chunk-HET4LLMX.js +0 -129
  363. package/dist/chunk-HZ6CNMAF.js +0 -870
  364. package/dist/chunk-IIQTAY3J.js +0 -715
  365. package/dist/chunk-JNH2TYIN.js +0 -96
  366. package/dist/chunk-JNY4ZHAR.js +0 -634
  367. package/dist/chunk-JXJB2X6M.js +0 -131
  368. package/dist/chunk-LRJNDEIA.js +0 -302
  369. package/dist/chunk-LSS54GLJ.js +0 -116
  370. package/dist/chunk-LZLHELAG.js +0 -137
  371. package/dist/chunk-MOUJOP55.js +0 -425
  372. package/dist/chunk-NKB7BZYK.js +0 -167
  373. package/dist/chunk-NQYBUO3K.js +0 -1795
  374. package/dist/chunk-O4AEHWII.js +0 -464
  375. package/dist/chunk-OETCUXQP.js +0 -134
  376. package/dist/chunk-OPXFZ4Y5.js +0 -204
  377. package/dist/chunk-PJXUJYS6.js +0 -248
  378. package/dist/chunk-PUPM2YGF.js +0 -376
  379. package/dist/chunk-QCDXZBC5.js +0 -247
  380. package/dist/chunk-QDYDBCFP.js +0 -197
  381. package/dist/chunk-QJJ6MADV.js +0 -274
  382. package/dist/chunk-QKXCPTFS.js +0 -349
  383. package/dist/chunk-RIBDXGUG.js +0 -108
  384. package/dist/chunk-RJQOOHT2.js +0 -214
  385. package/dist/chunk-RNGLIHFA.js +0 -191
  386. package/dist/chunk-RQ3HASCC.js +0 -6
  387. package/dist/chunk-RSOJT5YW.js +0 -124
  388. package/dist/chunk-RUZHTGKB.js +0 -237
  389. package/dist/chunk-RW6ZL2FQ.js +0 -284
  390. package/dist/chunk-TKVFVF5D.js +0 -95
  391. package/dist/chunk-TOXAGRDQ.js +0 -144
  392. package/dist/chunk-TUTI5HOZ.js +0 -112
  393. package/dist/chunk-UC2WGUP3.js +0 -627
  394. package/dist/chunk-UYG5L34B.js +0 -87
  395. package/dist/chunk-VBOXAEPI.js +0 -336
  396. package/dist/chunk-VCDBXW5H.js +0 -188
  397. package/dist/chunk-VEAYTRPX.js +0 -414
  398. package/dist/chunk-VQHPQEUH.js +0 -273
  399. package/dist/chunk-VXDZFJGP.js +0 -874
  400. package/dist/chunk-XNUVB5OL.js +0 -375
  401. package/dist/chunk-XOSCY2CW.js +0 -242
  402. package/dist/chunk-XXXEFXY5.js +0 -99
  403. package/dist/chunk-YDGVJETP.js +0 -60
  404. package/dist/chunk-YG3ZJHGU.js +0 -223
  405. package/dist/chunk-YTFKPRUK.js +0 -845
  406. package/dist/chunk-Z7H7VSFZ.js +0 -323
  407. package/dist/header/index.js +0 -5
  408. package/dist/search-bar/index.js +0 -5
  409. /package/dist/{chunk-3ECPOSKO.js → chunk-3BKLBYPK.js} +0 -0
  410. /package/dist/{chunk-JRLTGLN4.js → chunk-3UG6JUCV.js} +0 -0
  411. /package/dist/{chunk-RTIKSY6A.js → chunk-4QCR3K2J.js} +0 -0
  412. /package/dist/{chunk-VFCUIDRT.js → chunk-5WWRTEPS.js} +0 -0
@@ -0,0 +1,1992 @@
1
+ import { NavHeaderAction, NavHeader } from './chunk-WFMQ3WKM.js';
2
+ import { useDelayedLoading } from './chunk-KRBUZV45.js';
3
+ import { useFileManagerLabels, NameConflictDialog } from './chunk-CHPX4MFI.js';
4
+ import { ListRow } from './chunk-JA6TK7H2.js';
5
+ import { DescriptionList } from './chunk-PFLNFIVB.js';
6
+ import { Checkbox } from './chunk-KNILMM4H.js';
7
+ import { EmptyState } from './chunk-QJMMM4RC.js';
8
+ import { IconTile } from './chunk-XBXUBBJZ.js';
9
+ import { ContextMenu, ContextMenuOverlay } from './chunk-7CGJBQUA.js';
10
+ import { Alert } from './chunk-Z7I4ZSO6.js';
11
+ import { Sheet } from './chunk-B7JZ3N5G.js';
12
+ import { Dialog, DialogFooter } from './chunk-AQ5FIG74.js';
13
+ import { Button } from './chunk-5DTKORLI.js';
14
+ import { Text as Text$1, resolveTextRole } from './chunk-L4D5LHCH.js';
15
+ import { Badge } from './chunk-LGNTP5XA.js';
16
+ import { Skeleton } from './chunk-YJ5PXOX3.js';
17
+ import { softToneSkin } from './chunk-PJLTKDVY.js';
18
+ import { SegmentedControl } from './chunk-NZG75DGA.js';
19
+ import { TextField } from './chunk-KXLDK6HB.js';
20
+ import { haptics } from './chunk-NY2U3PBI.js';
21
+ import { isAndroidIdiom } from './chunk-TH4PW2WU.js';
22
+ import { useLoamLocale } from './chunk-APCWFOZW.js';
23
+ import { Icon } from './chunk-PCEFCOLN.js';
24
+ import * as React3 from 'react';
25
+ import { View, Image, Text, ScrollView, FlatList, Pressable } from 'react-native';
26
+ import { createStyleSheet, useLoamTheme, useStyles } from '@btndprojects/loam-theme-native';
27
+ import { fileCategory, FILE_CATEGORY_ICON, DEFAULT_FILE_SORT, childrenOf, formatFileSize, indexEntries, pathTo, summarize, applyPending, isPlaceholderId, sortEntries, searchEntries, recentFiles, flattenRows, validateFileName, uniqueFileName, newerSide, answerNameConflict, moveRefusal, placeholderId, topLevelIds, findNameConflicts, resolveNameConflicts } from '@btndprojects/loam-file-manager-core';
28
+ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
29
+
30
+ var STEP_DOWN = { sm: "sm", md: "sm", lg: "md", xl: "lg" };
31
+ function FileIcon({
32
+ entry,
33
+ size: sizeProp = "md",
34
+ open = false,
35
+ tone,
36
+ shape,
37
+ status,
38
+ density = "comfortable",
39
+ loading = false
40
+ }) {
41
+ const size = density === "compact" ? STEP_DOWN[sizeProp] : sizeProp;
42
+ const theme = useLoamTheme("file-manager");
43
+ const { styles } = useStyles(sheet, { size });
44
+ const [broken, setBroken] = React3.useState(false);
45
+ const [loaded, setLoaded] = React3.useState(false);
46
+ const thumb = entry.thumbnailUrl;
47
+ React3.useEffect(() => {
48
+ setBroken(false);
49
+ setLoaded(false);
50
+ }, [thumb]);
51
+ const category = fileCategory(entry);
52
+ const showThumb = Boolean(thumb) && !broken && (size === "lg" || size === "xl");
53
+ const glyph = { sm: theme.icon.sm, md: theme.icon.md, lg: theme.space.s6, xl: theme.space.s7 }[size];
54
+ const large = size === "lg" || size === "xl";
55
+ const skin = tone ? softToneSkin(theme, tone) : null;
56
+ const statusColor = status ? theme.color[status] : void 0;
57
+ const radius = shape === "circle" ? theme.radius.full : shape === "rounded" ? theme.radius.md : shape === "square" ? 0 : void 0;
58
+ const frameSize = {
59
+ sm: theme.icon.sm,
60
+ md: theme.icon.md,
61
+ lg: theme.space[48],
62
+ xl: theme.space[64]
63
+ }[size];
64
+ if (loading) {
65
+ return /* @__PURE__ */ jsx(View, { style: styles.frame, accessibilityElementsHidden: true, children: /* @__PURE__ */ jsx(Skeleton, { variant: "rect", width: frameSize, height: frameSize, decorative: true }) });
66
+ }
67
+ return /* @__PURE__ */ jsxs(
68
+ View,
69
+ {
70
+ style: [
71
+ styles.frame,
72
+ showThumb && styles.thumbFrame,
73
+ skin ? { backgroundColor: skin.fill } : null,
74
+ radius !== void 0 ? { borderRadius: radius } : null,
75
+ statusColor ? { overflow: "visible" } : null
76
+ ],
77
+ accessibilityElementsHidden: true,
78
+ importantForAccessibility: "no-hide-descendants",
79
+ children: [
80
+ !showThumb || !loaded ? /* @__PURE__ */ jsx(
81
+ Icon,
82
+ {
83
+ name: category === "folder" && open ? "folder-open" : FILE_CATEGORY_ICON[category],
84
+ size: glyph,
85
+ strokeWidth: large ? 1.25 : 1.5,
86
+ color: skin ? skin.ink : category === "folder" ? theme.color.accentStrong : theme.color.text3
87
+ }
88
+ ) : null,
89
+ showThumb ? /* @__PURE__ */ jsx(
90
+ Image,
91
+ {
92
+ source: { uri: thumb },
93
+ resizeMode: "cover",
94
+ onLoad: () => setLoaded(true),
95
+ onError: () => setBroken(true),
96
+ style: [styles.thumb, { opacity: loaded ? 1 : 0 }]
97
+ }
98
+ ) : null,
99
+ statusColor ? /* @__PURE__ */ jsx(
100
+ View,
101
+ {
102
+ testID: "file-icon-status",
103
+ style: [styles.statusDot, { backgroundColor: statusColor }]
104
+ }
105
+ ) : null
106
+ ]
107
+ }
108
+ );
109
+ }
110
+ var sheet = createStyleSheet((theme) => ({
111
+ frame: {
112
+ alignItems: "center",
113
+ justifyContent: "center",
114
+ overflow: "hidden",
115
+ variants: {
116
+ size: {
117
+ sm: { width: theme.icon.sm, height: theme.icon.sm },
118
+ md: { width: theme.icon.md, height: theme.icon.md },
119
+ lg: { width: theme.space[48], height: theme.space[48], borderRadius: theme.radius.sm },
120
+ xl: { width: theme.space[64], height: theme.space[64], borderRadius: theme.radius.md }
121
+ }
122
+ }
123
+ },
124
+ thumbFrame: {
125
+ backgroundColor: theme.color.surface3,
126
+ borderWidth: theme.borderWidth.hair,
127
+ borderColor: theme.color.border
128
+ },
129
+ statusDot: {
130
+ position: "absolute",
131
+ right: 0,
132
+ bottom: 0,
133
+ width: theme.space[8],
134
+ height: theme.space[8],
135
+ borderRadius: theme.radius.full,
136
+ borderWidth: theme.borderWidth.thin,
137
+ borderColor: theme.color.surface
138
+ },
139
+ thumb: {
140
+ position: "absolute",
141
+ top: 0,
142
+ left: 0,
143
+ right: 0,
144
+ bottom: 0
145
+ }
146
+ }));
147
+ function ChoiceRow({
148
+ icon,
149
+ label,
150
+ detail,
151
+ selected,
152
+ disabled,
153
+ indent = 0,
154
+ onPress
155
+ }) {
156
+ const theme = useLoamTheme("file-manager");
157
+ const { styles } = useStyles(sheet2);
158
+ return /* @__PURE__ */ jsx(View, { style: { paddingStart: indent * theme.space.s5 }, children: /* @__PURE__ */ jsx(
159
+ ListRow,
160
+ {
161
+ density: "compact",
162
+ title: label,
163
+ accessibilityLabel: detail ? `${label}, ${detail}` : label,
164
+ disabled,
165
+ onPress,
166
+ leading: icon ? /* @__PURE__ */ jsx(Icon, { name: icon, size: theme.icon.md, color: theme.color.text2 }) : void 0,
167
+ trailing: detail || selected ? /* @__PURE__ */ jsxs(View, { style: styles.choiceTrail, children: [
168
+ detail ? /* @__PURE__ */ jsx(Text, { style: styles.choiceDetail, children: detail }) : null,
169
+ selected ? /* @__PURE__ */ jsx(Icon, { name: "check", size: theme.icon.md, color: theme.color.accentStrong }) : null
170
+ ] }) : void 0
171
+ }
172
+ ) });
173
+ }
174
+ function GroupLabel({ children }) {
175
+ const theme = useLoamTheme("file-manager");
176
+ const { styles } = useStyles(sheet2);
177
+ return /* @__PURE__ */ jsx(
178
+ Text,
179
+ {
180
+ style: [styles.groupLabel, resolveTextRole(theme, "overline", isAndroidIdiom(theme))],
181
+ accessibilityRole: "header",
182
+ children
183
+ }
184
+ );
185
+ }
186
+ var SORT_KEYS = ["name", "modified", "size", "type"];
187
+ function FileOptionsSheet({
188
+ open,
189
+ onClose,
190
+ view,
191
+ onViewChange,
192
+ sort,
193
+ onSortChange,
194
+ onNewFolder,
195
+ labels,
196
+ safeAreaBottom,
197
+ motion
198
+ }) {
199
+ const { styles } = useStyles(sheet2);
200
+ return /* @__PURE__ */ jsxs(
201
+ Sheet,
202
+ {
203
+ open,
204
+ onClose,
205
+ title: labels.view,
206
+ closeLabel: labels.close,
207
+ safeAreaBottom,
208
+ motion,
209
+ children: [
210
+ /* @__PURE__ */ jsx(View, { style: styles.segment, children: /* @__PURE__ */ jsx(
211
+ SegmentedControl,
212
+ {
213
+ accessibilityLabel: labels.view,
214
+ items: [
215
+ { value: "grid", label: labels.viewGrid, icon: "grid" },
216
+ { value: "list", label: labels.viewList, icon: "list-ul" }
217
+ ],
218
+ value: view,
219
+ onValueChange: (v) => onViewChange(v),
220
+ motion
221
+ }
222
+ ) }),
223
+ /* @__PURE__ */ jsx(GroupLabel, { children: labels.sort }),
224
+ SORT_KEYS.map((key) => {
225
+ const chosen = sort.key === key;
226
+ return /* @__PURE__ */ jsx(
227
+ ChoiceRow,
228
+ {
229
+ icon: chosen ? sort.direction === "asc" ? "arrow-up" : "arrow-down" : void 0,
230
+ label: labels.sortKey[key],
231
+ detail: chosen ? sort.direction === "asc" ? labels.ascending : labels.descending : void 0,
232
+ selected: chosen,
233
+ onPress: () => {
234
+ haptics.selection();
235
+ onSortChange(
236
+ chosen ? { key, direction: sort.direction === "asc" ? "desc" : "asc" } : {
237
+ key,
238
+ direction: key === "modified" || key === "size" ? "desc" : DEFAULT_FILE_SORT.direction
239
+ }
240
+ );
241
+ }
242
+ },
243
+ key
244
+ );
245
+ }),
246
+ onNewFolder ? /* @__PURE__ */ jsxs(Fragment, { children: [
247
+ /* @__PURE__ */ jsx(View, { style: styles.rule }),
248
+ /* @__PURE__ */ jsx(
249
+ ChoiceRow,
250
+ {
251
+ icon: "folder-plus",
252
+ label: labels.newFolder,
253
+ onPress: () => {
254
+ onClose();
255
+ onNewFolder();
256
+ }
257
+ }
258
+ )
259
+ ] }) : null
260
+ ]
261
+ }
262
+ );
263
+ }
264
+ function FileLocations({
265
+ location,
266
+ onLocationChange,
267
+ folders,
268
+ recents,
269
+ favorites,
270
+ labels
271
+ }) {
272
+ const at = (l) => l.kind === location.kind && (l.kind !== "folder" || location.kind === "folder" && location.id === l.id);
273
+ return (
274
+ // A labelled group, not a list: its children are headings and choice rows,
275
+ // and a `list` that owns no `listitem` is an invalid ARIA tree on the web.
276
+ /* @__PURE__ */ jsxs(View, { role: "group", accessibilityLabel: labels.locations, children: [
277
+ /* @__PURE__ */ jsx(GroupLabel, { children: labels.locations }),
278
+ /* @__PURE__ */ jsx(
279
+ ChoiceRow,
280
+ {
281
+ icon: "folder",
282
+ label: labels.root,
283
+ selected: at({ kind: "folder", id: null }),
284
+ onPress: () => onLocationChange({ kind: "folder", id: null })
285
+ }
286
+ ),
287
+ recents ? /* @__PURE__ */ jsx(
288
+ ChoiceRow,
289
+ {
290
+ icon: "clock",
291
+ label: labels.recent,
292
+ selected: at({ kind: "recent" }),
293
+ onPress: () => onLocationChange({ kind: "recent" })
294
+ }
295
+ ) : null,
296
+ favorites ? /* @__PURE__ */ jsx(
297
+ ChoiceRow,
298
+ {
299
+ icon: "star",
300
+ label: labels.favorites,
301
+ selected: at({ kind: "favorites" }),
302
+ onPress: () => onLocationChange({ kind: "favorites" })
303
+ }
304
+ ) : null,
305
+ folders.length > 0 ? /* @__PURE__ */ jsx(GroupLabel, { children: labels.folders }) : null,
306
+ folders.map((f) => /* @__PURE__ */ jsx(
307
+ ChoiceRow,
308
+ {
309
+ icon: "folder",
310
+ label: f.name,
311
+ selected: at({ kind: "folder", id: f.id }),
312
+ onPress: () => onLocationChange({ kind: "folder", id: f.id })
313
+ },
314
+ f.id
315
+ ))
316
+ ] })
317
+ );
318
+ }
319
+ function entryMeta(entry, items, labels, locale) {
320
+ if (entry.type === "folder") return labels.items(childrenOf(items, entry.id).length);
321
+ return [
322
+ labels.category[fileCategory(entry)],
323
+ entry.size !== void 0 ? formatFileSize(entry.size, locale) : ""
324
+ ].filter(Boolean).join(" \xB7 ");
325
+ }
326
+ function formatDate(value, locale) {
327
+ if (value === void 0) return "";
328
+ const d = new Date(value);
329
+ return Number.isNaN(d.getTime()) ? "" : d.toLocaleString(locale, { dateStyle: "medium", timeStyle: "short" });
330
+ }
331
+ function FileInfoSheet({
332
+ entry,
333
+ items,
334
+ onClose,
335
+ labels,
336
+ locale,
337
+ safeAreaBottom,
338
+ motion
339
+ }) {
340
+ const { styles } = useStyles(sheet2);
341
+ const last = React3.useRef(entry);
342
+ if (entry) last.current = entry;
343
+ const shown = last.current;
344
+ const rows = React3.useMemo(() => {
345
+ if (!shown) return [];
346
+ const index = indexEntries(items);
347
+ const where = [labels.root, ...pathTo(index, shown.parentId).map((e) => e.name)].join(" \u203A ");
348
+ const out = [{ term: labels.kind, description: labels.category[fileCategory(shown)] }];
349
+ if (shown.type === "folder") {
350
+ const s = summarize(childrenOf(items, shown.id));
351
+ out.push({ term: labels.contains, description: labels.items(s.files + s.folders) });
352
+ } else if (shown.size !== void 0) {
353
+ out.push({ term: labels.size, description: formatFileSize(shown.size, locale) });
354
+ }
355
+ out.push({ term: labels.location, description: where });
356
+ const date = formatDate(shown.modifiedAt, locale);
357
+ if (date) out.push({ term: labels.modified, description: date });
358
+ if (shown.tags?.length) out.push({ term: labels.tags, description: shown.tags.join(", ") });
359
+ return out;
360
+ }, [shown, items, labels, locale]);
361
+ return /* @__PURE__ */ jsxs(
362
+ Sheet,
363
+ {
364
+ open: entry !== null,
365
+ onClose,
366
+ title: labels.getInfo,
367
+ closeLabel: labels.close,
368
+ safeAreaBottom,
369
+ motion,
370
+ children: [
371
+ shown ? /* @__PURE__ */ jsxs(View, { style: styles.infoHead, children: [
372
+ /* @__PURE__ */ jsx(FileIcon, { entry: shown, size: "lg" }),
373
+ /* @__PURE__ */ jsxs(View, { style: styles.infoTitle, children: [
374
+ /* @__PURE__ */ jsx(Text, { style: styles.infoName, numberOfLines: 2, children: shown.name }),
375
+ /* @__PURE__ */ jsx(Text, { style: styles.infoMeta, numberOfLines: 1, children: entryMeta(shown, items, labels, locale) })
376
+ ] })
377
+ ] }) : null,
378
+ /* @__PURE__ */ jsx(View, { style: styles.infoBody, children: /* @__PURE__ */ jsx(DescriptionList, { items: rows }) })
379
+ ]
380
+ }
381
+ );
382
+ }
383
+ function FilePreviewSheet({
384
+ entry,
385
+ files,
386
+ onEntryChange,
387
+ onClose,
388
+ items,
389
+ renderPreview,
390
+ labels,
391
+ locale,
392
+ safeAreaBottom,
393
+ motion
394
+ }) {
395
+ const { styles } = useStyles(sheet2);
396
+ const last = React3.useRef(entry);
397
+ if (entry) last.current = entry;
398
+ const shown = last.current;
399
+ const [failed, setFailed] = React3.useState(false);
400
+ React3.useEffect(() => setFailed(false), [shown?.id]);
401
+ const at = shown ? files.findIndex((f) => f.id === shown.id) : -1;
402
+ const step = (by) => {
403
+ const next = files[at + by];
404
+ if (next) {
405
+ haptics.selection();
406
+ onEntryChange(next);
407
+ }
408
+ };
409
+ const src = shown?.url ?? shown?.thumbnailUrl;
410
+ const custom = shown ? renderPreview?.(shown) : void 0;
411
+ const isImage = shown ? fileCategory(shown) === "image" && Boolean(src) && !failed : false;
412
+ return /* @__PURE__ */ jsx(
413
+ Sheet,
414
+ {
415
+ open: entry !== null,
416
+ onClose,
417
+ title: shown?.name,
418
+ closeLabel: labels.close,
419
+ detents: ["full"],
420
+ initialDetent: "full",
421
+ safeAreaBottom,
422
+ motion,
423
+ footer: files.length > 1 ? /* @__PURE__ */ jsxs(View, { style: styles.stepper, children: [
424
+ /* @__PURE__ */ jsx(
425
+ Button,
426
+ {
427
+ variant: "ghost",
428
+ size: "sm",
429
+ leadingIcon: "chevron-left",
430
+ disabled: at <= 0,
431
+ onPress: () => step(-1),
432
+ accessibilityLabel: labels.previous,
433
+ children: labels.previous
434
+ }
435
+ ),
436
+ /* @__PURE__ */ jsx(Text, { style: styles.stepperCount, children: at >= 0 ? `${at + 1} / ${files.length}` : "" }),
437
+ /* @__PURE__ */ jsx(
438
+ Button,
439
+ {
440
+ variant: "ghost",
441
+ size: "sm",
442
+ trailingIcon: "chevron-right",
443
+ disabled: at < 0 || at >= files.length - 1,
444
+ onPress: () => step(1),
445
+ accessibilityLabel: labels.next,
446
+ children: labels.next
447
+ }
448
+ )
449
+ ] }) : void 0,
450
+ children: shown ? custom !== void 0 ? /* @__PURE__ */ jsx(View, { style: styles.previewBody, children: custom }) : isImage ? /* @__PURE__ */ jsx(View, { style: styles.previewImageWrap, children: /* @__PURE__ */ jsx(
451
+ Image,
452
+ {
453
+ source: { uri: src },
454
+ resizeMode: "contain",
455
+ onError: () => setFailed(true),
456
+ style: styles.previewImage,
457
+ accessibilityLabel: shown.name
458
+ }
459
+ ) }) : /* @__PURE__ */ jsxs(View, { style: styles.previewEmpty, children: [
460
+ /* @__PURE__ */ jsx(FileIcon, { entry: shown, size: "xl" }),
461
+ /* @__PURE__ */ jsx(Text, { style: styles.previewTitle, children: failed ? labels.previewFailed : labels.previewUnavailable }),
462
+ /* @__PURE__ */ jsx(Text, { style: styles.previewMeta, children: entryMeta(shown, items, labels, locale) })
463
+ ] }) : null
464
+ }
465
+ );
466
+ }
467
+ function FileMoveSheet({
468
+ entries,
469
+ items,
470
+ onMove,
471
+ onClose,
472
+ labels,
473
+ locale,
474
+ safeAreaBottom,
475
+ motion
476
+ }) {
477
+ const last = React3.useRef(entries);
478
+ if (entries.length > 0) last.current = entries;
479
+ const moving = last.current;
480
+ const [target, setTarget] = React3.useState(void 0);
481
+ React3.useEffect(() => {
482
+ if (entries.length > 0) setTarget(void 0);
483
+ }, [entries]);
484
+ const index = React3.useMemo(() => indexEntries(items), [items]);
485
+ const ids = React3.useMemo(() => moving.map((e) => e.id), [moving]);
486
+ const tree = React3.useMemo(() => {
487
+ const out = [];
488
+ const walk = (parentId, depth) => {
489
+ for (const f of sortEntries(childrenOf(items, parentId), DEFAULT_FILE_SORT, locale)) {
490
+ if (f.type !== "folder") continue;
491
+ out.push({ entry: f, depth });
492
+ walk(f.id, depth + 1);
493
+ }
494
+ };
495
+ walk(null, 1);
496
+ return out;
497
+ }, [items, locale]);
498
+ const allowed = (id) => moveRefusal(index, ids, id) === null;
499
+ return /* @__PURE__ */ jsx(
500
+ Sheet,
501
+ {
502
+ open: entries.length > 0,
503
+ onClose,
504
+ title: labels.chooseFolder,
505
+ closeLabel: labels.close,
506
+ detents: ["half", "full"],
507
+ initialDetent: "full",
508
+ safeAreaBottom,
509
+ motion,
510
+ footer: /* @__PURE__ */ jsx(
511
+ Button,
512
+ {
513
+ variant: "primary",
514
+ fullWidth: true,
515
+ disabled: target === void 0,
516
+ onPress: () => {
517
+ if (target !== void 0) onMove(target);
518
+ },
519
+ children: labels.moveHere
520
+ }
521
+ ),
522
+ children: /* @__PURE__ */ jsxs(ScrollView, { children: [
523
+ /* @__PURE__ */ jsx(
524
+ ChoiceRow,
525
+ {
526
+ icon: "folder",
527
+ label: labels.root,
528
+ selected: target === null,
529
+ disabled: !allowed(null),
530
+ onPress: () => setTarget(null)
531
+ }
532
+ ),
533
+ tree.map(({ entry, depth }) => /* @__PURE__ */ jsx(
534
+ ChoiceRow,
535
+ {
536
+ icon: "folder",
537
+ indent: depth,
538
+ label: entry.name,
539
+ selected: target === entry.id,
540
+ disabled: !allowed(entry.id),
541
+ onPress: () => setTarget(entry.id)
542
+ },
543
+ entry.id
544
+ ))
545
+ ] })
546
+ }
547
+ );
548
+ }
549
+ function FileNameDialog({
550
+ open,
551
+ title,
552
+ initialName,
553
+ confirmLabel,
554
+ validate,
555
+ onSubmit,
556
+ onClose,
557
+ labels: labelsProp,
558
+ motion
559
+ }) {
560
+ const labels = useFileManagerLabels(labelsProp);
561
+ const [name, setName] = React3.useState(initialName);
562
+ const [touched, setTouched] = React3.useState(false);
563
+ React3.useEffect(() => {
564
+ if (open) {
565
+ setName(initialName);
566
+ setTouched(false);
567
+ }
568
+ }, [open, initialName]);
569
+ const error = validate(name);
570
+ const submit = () => {
571
+ setTouched(true);
572
+ if (error) {
573
+ haptics.notify("error");
574
+ return;
575
+ }
576
+ onSubmit(name.trim());
577
+ };
578
+ const dot = initialName.lastIndexOf(".");
579
+ const stemEnd = dot > 0 ? dot : initialName.length;
580
+ return /* @__PURE__ */ jsxs(Dialog, { open, onClose, title, motion, children: [
581
+ /* @__PURE__ */ jsx(
582
+ TextField,
583
+ {
584
+ label: labels.nameLabel,
585
+ value: name,
586
+ onChangeText: (t) => {
587
+ setName(t);
588
+ setTouched(true);
589
+ },
590
+ autoFocus: true,
591
+ selectTextOnFocus: false,
592
+ selection: touched ? void 0 : { start: 0, end: stemEnd },
593
+ autoCapitalize: "none",
594
+ autoCorrect: false,
595
+ returnKeyType: "done",
596
+ onSubmitEditing: submit,
597
+ error: touched && error ? labels.nameError[error] : void 0
598
+ }
599
+ ),
600
+ /* @__PURE__ */ jsxs(DialogFooter, { children: [
601
+ /* @__PURE__ */ jsx(Button, { variant: "ghost", onPress: onClose, children: labels.cancel }),
602
+ /* @__PURE__ */ jsx(Button, { variant: "primary", onPress: submit, children: confirmLabel })
603
+ ] })
604
+ ] });
605
+ }
606
+ function FileDeleteDialog({
607
+ open,
608
+ entries,
609
+ onConfirm,
610
+ onClose,
611
+ labels: labelsProp,
612
+ motion
613
+ }) {
614
+ const labels = useFileManagerLabels(labelsProp);
615
+ const last = React3.useRef(entries);
616
+ if (entries.length > 0) last.current = entries;
617
+ const list = last.current;
618
+ const first = list[0];
619
+ return /* @__PURE__ */ jsx(
620
+ Dialog,
621
+ {
622
+ open,
623
+ onClose,
624
+ title: labels.deleteTitle(list.length, first?.name ?? ""),
625
+ description: labels.deleteDescription,
626
+ motion,
627
+ children: /* @__PURE__ */ jsxs(DialogFooter, { children: [
628
+ /* @__PURE__ */ jsx(Button, { variant: "ghost", onPress: onClose, children: labels.keep }),
629
+ /* @__PURE__ */ jsx(Button, { variant: "danger", onPress: onConfirm, children: labels.deleteConfirm(list.length) })
630
+ ] })
631
+ }
632
+ );
633
+ }
634
+ var sheet2 = createStyleSheet((theme) => ({
635
+ choiceTrail: { flexDirection: "row", alignItems: "center", gap: theme.space.s2 },
636
+ choiceDetail: {
637
+ fontFamily: theme.font.sans,
638
+ fontSize: theme.type.footnote.fontSize,
639
+ color: theme.color.text2
640
+ },
641
+ groupLabel: {
642
+ fontFamily: theme.font.sans,
643
+ color: theme.color.text3,
644
+ paddingHorizontal: theme.space.s4,
645
+ paddingTop: theme.space.s4,
646
+ paddingBottom: theme.space.s2
647
+ },
648
+ segment: { paddingHorizontal: theme.space.s4, paddingTop: theme.space.s2 },
649
+ rule: {
650
+ height: theme.borderWidth.hair,
651
+ backgroundColor: theme.color.border,
652
+ marginHorizontal: theme.space.s4,
653
+ marginVertical: theme.space.s2
654
+ },
655
+ infoHead: {
656
+ flexDirection: "row",
657
+ alignItems: "center",
658
+ gap: theme.space.s3,
659
+ paddingHorizontal: theme.space.s4,
660
+ paddingBottom: theme.space.s3
661
+ },
662
+ infoTitle: { flex: 1, minWidth: 0, gap: theme.space.s1 },
663
+ infoName: {
664
+ fontFamily: theme.font.sans,
665
+ fontSize: theme.type.headline.fontSize,
666
+ fontWeight: theme.type.headline.fontWeight,
667
+ lineHeight: theme.type.headline.lineHeight,
668
+ color: theme.color.text
669
+ },
670
+ infoMeta: {
671
+ fontFamily: theme.font.sans,
672
+ fontSize: theme.type.subheadline.fontSize,
673
+ color: theme.color.text2
674
+ },
675
+ infoBody: { paddingHorizontal: theme.space.s4 },
676
+ stepper: {
677
+ flexDirection: "row",
678
+ alignItems: "center",
679
+ justifyContent: "space-between",
680
+ gap: theme.space.s2
681
+ },
682
+ stepperCount: {
683
+ fontFamily: theme.font.sans,
684
+ fontSize: theme.type.footnote.fontSize,
685
+ fontWeight: theme.type.headline.fontWeight,
686
+ color: theme.color.text2,
687
+ fontVariant: ["tabular-nums"]
688
+ },
689
+ previewBody: { flex: 1, paddingHorizontal: theme.space.s4 },
690
+ previewImageWrap: { flex: 1, minHeight: theme.space[256], paddingHorizontal: theme.space.s4 },
691
+ previewImage: { flex: 1, width: "100%", borderRadius: theme.radius.md },
692
+ previewEmpty: {
693
+ flex: 1,
694
+ alignItems: "center",
695
+ justifyContent: "center",
696
+ gap: theme.space.s3,
697
+ paddingVertical: theme.space.s8,
698
+ paddingHorizontal: theme.space.s5
699
+ },
700
+ previewTitle: {
701
+ fontFamily: theme.font.sans,
702
+ fontSize: theme.type.headline.fontSize,
703
+ fontWeight: theme.type.headline.fontWeight,
704
+ color: theme.color.text,
705
+ textAlign: "center"
706
+ },
707
+ previewMeta: {
708
+ fontFamily: theme.font.sans,
709
+ fontSize: theme.type.subheadline.fontSize,
710
+ color: theme.color.text2,
711
+ textAlign: "center"
712
+ }
713
+ }));
714
+ var SIDEBAR_MIN_WIDTH = 768;
715
+ function useControllable(value, initial, onChange) {
716
+ const [inner, setInner] = React3.useState(initial);
717
+ const current = value !== void 0 ? value : inner;
718
+ const set = React3.useCallback(
719
+ (next) => {
720
+ if (value === void 0) setInner(next);
721
+ onChange?.(next);
722
+ },
723
+ [value, onChange]
724
+ );
725
+ return [current, set];
726
+ }
727
+ var seq = 0;
728
+ var nextKey = () => `fm${++seq}`;
729
+ function FileManager({
730
+ items,
731
+ folderId: folderIdProp,
732
+ defaultFolderId = null,
733
+ onFolderChange,
734
+ view: viewProp,
735
+ defaultView = "list",
736
+ onViewChange,
737
+ sort: sortProp,
738
+ defaultSort = DEFAULT_FILE_SORT,
739
+ onSortChange,
740
+ onCreateFolder,
741
+ onRename,
742
+ onDelete,
743
+ confirmDelete = false,
744
+ onMove,
745
+ onOpenFile,
746
+ onShare,
747
+ onFavoriteChange,
748
+ renderPreview,
749
+ onNotify,
750
+ loading = false,
751
+ failed = false,
752
+ onRetry,
753
+ recents = true,
754
+ nested = true,
755
+ defaultExpanded,
756
+ sidebar = "auto",
757
+ density = "comfortable",
758
+ platform,
759
+ safeAreaBottom = 0,
760
+ motion,
761
+ locale: localeProp,
762
+ labels: labelsProp
763
+ }) {
764
+ const theme = useLoamTheme("file-manager");
765
+ const { styles } = useStyles(sheet3);
766
+ const labels = useFileManagerLabels(labelsProp);
767
+ const providerLocale = useLoamLocale();
768
+ const locale = localeProp ?? providerLocale;
769
+ const [folderId, setFolderId] = useControllable(
770
+ folderIdProp,
771
+ defaultFolderId,
772
+ onFolderChange
773
+ );
774
+ const [view, setView] = useControllable(viewProp, defaultView, onViewChange);
775
+ const [sort, setSort] = useControllable(sortProp, defaultSort, onSortChange);
776
+ const [special, setSpecial] = React3.useState(null);
777
+ const [query, setQuery] = React3.useState("");
778
+ const android = isAndroidIdiom(
779
+ theme,
780
+ platform === "android" || platform === "ios" ? platform : void 0
781
+ );
782
+ const [selecting, setSelecting] = React3.useState(false);
783
+ const [selection, setSelection] = React3.useState([]);
784
+ const [expanded, setExpanded] = React3.useState(
785
+ () => new Set(defaultExpanded)
786
+ );
787
+ const [pending, setPending] = React3.useState([]);
788
+ const [width, setWidth] = React3.useState(0);
789
+ const [optionsOpen, setOptionsOpen] = React3.useState(false);
790
+ const [locationsOpen, setLocationsOpen] = React3.useState(false);
791
+ const [info, setInfo] = React3.useState(null);
792
+ const [preview, setPreview] = React3.useState(null);
793
+ const [moving, setMoving] = React3.useState([]);
794
+ const [naming, setNaming] = React3.useState(null);
795
+ const [deleting, setDeleting] = React3.useState(null);
796
+ const { entries: drawn, pendingIds } = React3.useMemo(
797
+ () => applyPending(items, pending),
798
+ [items, pending]
799
+ );
800
+ const index = React3.useMemo(() => indexEntries(drawn), [drawn]);
801
+ const favoritesOn = Boolean(onFavoriteChange) || drawn.some((e) => e.favorite);
802
+ React3.useEffect(() => {
803
+ if (folderId !== null && !index.has(folderId) && !isPlaceholderId(folderId)) setFolderId(null);
804
+ }, [folderId, index, setFolderId]);
805
+ const location = special ? { kind: special } : { kind: "folder", id: folderId };
806
+ const folder = folderId !== null ? index.get(folderId) ?? null : null;
807
+ const crumbs = React3.useMemo(() => pathTo(index, folderId), [index, folderId]);
808
+ const parent = crumbs.length > 1 ? crumbs[crumbs.length - 2] : null;
809
+ const searching = query.trim().length > 0;
810
+ const listed = React3.useMemo(() => {
811
+ if (searching)
812
+ return sortEntries(searchEntries(drawn, query, special ? null : folderId), sort, locale);
813
+ if (special === "recent") return recentFiles(drawn);
814
+ if (special === "favorites")
815
+ return sortEntries(
816
+ drawn.filter((e) => e.favorite),
817
+ sort,
818
+ locale
819
+ );
820
+ return sortEntries(childrenOf(drawn, folderId), sort, locale);
821
+ }, [drawn, query, searching, special, folderId, sort, locale]);
822
+ const rows = React3.useMemo(
823
+ () => nested && view === "list" && !searching && special === null ? flattenRows(listed, expanded, (f) => sortEntries(childrenOf(drawn, f.id), sort, locale)) : listed.map((entry) => ({ kind: "entry", entry, depth: 0 })),
824
+ [nested, view, searching, special, listed, expanded, drawn, sort, locale]
825
+ );
826
+ const files = React3.useMemo(() => listed.filter((e) => e.type === "file"), [listed]);
827
+ const selectedEntries = React3.useMemo(
828
+ () => selection.map((id) => index.get(id)).filter((e) => e !== void 0),
829
+ [selection, index]
830
+ );
831
+ const wide = sidebar === true || sidebar === "auto" && width >= SIDEBAR_MIN_WIDTH;
832
+ const showSkeleton = useDelayedLoading(loading && drawn.length === 0);
833
+ const notify = (title2, result) => {
834
+ if (typeof result === "function") {
835
+ const undo = result;
836
+ onNotify?.({ title: title2, tone: "good", undoable: true, undo: () => void undo() });
837
+ } else onNotify?.({ title: title2, tone: "good" });
838
+ };
839
+ const run = async (action, op, success, optimistic) => {
840
+ const key = optimistic ? nextKey() : null;
841
+ if (key && optimistic) setPending((list) => [...list, { key, op: optimistic }]);
842
+ try {
843
+ notify(success, await op());
844
+ return true;
845
+ } catch {
846
+ haptics.notify("error");
847
+ onNotify?.({ title: labels.failed(action), tone: "danger" });
848
+ return false;
849
+ } finally {
850
+ if (key) setPending((list) => list.filter((p) => p.key !== key));
851
+ }
852
+ };
853
+ const folderName = (id) => id === null ? labels.root : index.get(id)?.name ?? labels.root;
854
+ const topLevel = (entries) => topLevelIds(
855
+ index,
856
+ entries.map((e) => e.id)
857
+ ).map((id) => index.get(id)).filter((e) => e !== void 0);
858
+ const remove = (entries) => {
859
+ if (!onDelete || entries.length === 0) return;
860
+ const list = topLevel(entries);
861
+ setSelection((s) => s.filter((id) => !list.some((e) => e.id === id)));
862
+ haptics.notify("warning");
863
+ void run(labels.delete, () => onDelete(list), labels.deleted(list.length), {
864
+ kind: "delete",
865
+ ids: list.map((e) => e.id)
866
+ });
867
+ };
868
+ const askDelete = (entries) => confirmDelete ? setDeleting([...entries]) : remove(entries);
869
+ const [asking, setAsking] = React3.useState(null);
870
+ const settleConflicts = (entries, targetId, proceed) => {
871
+ const ids = new Set(entries.map((e) => e.id));
872
+ const siblings = childrenOf(drawn, targetId).filter((e) => !ids.has(e.id));
873
+ const conflicts = findNameConflicts(entries, siblings);
874
+ if (conflicts.length === 0) {
875
+ proceed([...entries]);
876
+ return;
877
+ }
878
+ setAsking({
879
+ conflicts,
880
+ choices: [],
881
+ done: (choices) => {
882
+ if (choices) proceed(...resolveNameConflicts(entries, siblings, conflicts, choices));
883
+ }
884
+ });
885
+ };
886
+ const answerConflict = (choice, applyToAll) => {
887
+ if (!asking) return;
888
+ const next = answerNameConflict(asking.conflicts, asking.choices, choice, applyToAll);
889
+ if (next.length >= asking.conflicts.length) {
890
+ setAsking(null);
891
+ asking.done(next);
892
+ } else setAsking({ ...asking, choices: next });
893
+ };
894
+ const move = (entries, targetId) => {
895
+ if (!onMove) return;
896
+ const ids = entries.map((e) => e.id);
897
+ const refusal = moveRefusal(index, ids, targetId);
898
+ if (refusal === "into-itself") onNotify?.({ title: labels.cannotMoveIntoItself, tone: "warn" });
899
+ if (refusal) return;
900
+ settleConflicts(topLevel(entries), targetId, (list, resolution) => {
901
+ if (list.length === 0) return;
902
+ void run(
903
+ labels.moveTo,
904
+ () => resolution ? onMove(list, targetId, resolution) : onMove(list, targetId),
905
+ labels.moved(list.length, folderName(targetId)),
906
+ {
907
+ kind: "move",
908
+ ids: list.map((e) => e.id),
909
+ targetId
910
+ }
911
+ );
912
+ });
913
+ };
914
+ const favorite = (entry) => {
915
+ if (!onFavoriteChange) return;
916
+ const next = !entry.favorite;
917
+ haptics.selection();
918
+ void run(
919
+ next ? labels.favorite : labels.unfavorite,
920
+ () => onFavoriteChange(entry, next),
921
+ next ? labels.favorite : labels.unfavorite,
922
+ {
923
+ kind: "favorite",
924
+ id: entry.id,
925
+ favorite: next
926
+ }
927
+ );
928
+ };
929
+ const submitName = (name) => {
930
+ const target = naming?.entry ?? null;
931
+ setNaming(null);
932
+ if (target) {
933
+ if (!onRename || name === target.name) return;
934
+ void run(labels.rename, () => onRename(target, name), labels.renamed(name), {
935
+ kind: "rename",
936
+ id: target.id,
937
+ name
938
+ });
939
+ } else if (onCreateFolder) {
940
+ const at = special ? null : folderId;
941
+ const draft = {
942
+ id: placeholderId(nextKey()),
943
+ name,
944
+ type: "folder",
945
+ parentId: at,
946
+ modifiedAt: Date.now()
947
+ };
948
+ void run(labels.newFolder, () => onCreateFolder(at, name), labels.created(name), {
949
+ kind: "add",
950
+ entries: [draft]
951
+ });
952
+ }
953
+ };
954
+ const go = (l) => {
955
+ setLocationsOpen(false);
956
+ setQuery("");
957
+ setSelection([]);
958
+ if (l.kind === "folder") {
959
+ setSpecial(null);
960
+ setFolderId(l.id);
961
+ } else setSpecial(l.kind);
962
+ };
963
+ const toggleSelected = (id) => {
964
+ haptics.selection();
965
+ setSelection((s) => s.includes(id) ? s.filter((x) => x !== id) : [...s, id]);
966
+ };
967
+ const startSelecting = (id) => {
968
+ haptics.selection();
969
+ setSelecting(true);
970
+ setSelection((s) => s.includes(id) ? s : [...s, id]);
971
+ };
972
+ const endSelecting = () => {
973
+ setSelecting(false);
974
+ setSelection([]);
975
+ };
976
+ const open = (entry) => {
977
+ if (pendingIds.has(entry.id) && isPlaceholderId(entry.id)) return;
978
+ if (selecting) return toggleSelected(entry.id);
979
+ if (entry.type === "folder") return go({ kind: "folder", id: entry.id });
980
+ if (onOpenFile) return onOpenFile(entry);
981
+ setPreview(entry);
982
+ };
983
+ const toggleExpanded = (id) => {
984
+ haptics.selection();
985
+ setExpanded((s) => {
986
+ const next = new Set(s);
987
+ if (next.has(id)) next.delete(id);
988
+ else next.add(id);
989
+ return next;
990
+ });
991
+ };
992
+ const menuFor = (entry) => {
993
+ const busy = pendingIds.has(entry.id);
994
+ const out = [];
995
+ out.push({
996
+ key: "open",
997
+ label: labels.open,
998
+ icon: entry.type === "folder" ? "folder-open" : "external-link",
999
+ onSelect: () => open(entry)
1000
+ });
1001
+ if (entry.type === "file")
1002
+ out.push({
1003
+ key: "preview",
1004
+ label: labels.preview,
1005
+ icon: "eye",
1006
+ onSelect: () => setPreview(entry)
1007
+ });
1008
+ if (entry.type === "folder" && nested && view === "list" && !searching && special === null) {
1009
+ const isOpen = expanded.has(entry.id);
1010
+ out.push({
1011
+ key: "disclose",
1012
+ label: isOpen ? labels.collapseFolder(entry.name) : labels.expandFolder(entry.name),
1013
+ icon: isOpen ? "chevron-up" : "chevron-down",
1014
+ onSelect: () => toggleExpanded(entry.id)
1015
+ });
1016
+ }
1017
+ out.push({ key: "info", label: labels.getInfo, icon: "info", onSelect: () => setInfo(entry) });
1018
+ if (busy) return out;
1019
+ if (onRename && !entry.locked)
1020
+ out.push({
1021
+ key: "rename",
1022
+ label: labels.rename,
1023
+ icon: "rename",
1024
+ onSelect: () => setNaming({ entry })
1025
+ });
1026
+ if (onMove && !entry.locked)
1027
+ out.push({
1028
+ key: "move",
1029
+ label: labels.moveTo,
1030
+ icon: "folder-input",
1031
+ onSelect: () => setMoving([entry])
1032
+ });
1033
+ if (onFavoriteChange)
1034
+ out.push({
1035
+ key: "favorite",
1036
+ label: entry.favorite ? labels.unfavorite : labels.favorite,
1037
+ icon: "star",
1038
+ onSelect: () => favorite(entry)
1039
+ });
1040
+ if (onShare && entry.type === "file")
1041
+ out.push({
1042
+ key: "share",
1043
+ label: labels.download,
1044
+ icon: "upload",
1045
+ onSelect: () => onShare([entry])
1046
+ });
1047
+ if (onDelete && !entry.locked)
1048
+ out.push({
1049
+ key: "delete",
1050
+ label: labels.delete,
1051
+ icon: "trash",
1052
+ destructive: true,
1053
+ onSelect: () => askDelete([entry])
1054
+ });
1055
+ return out;
1056
+ };
1057
+ const swipesFor = (entry) => {
1058
+ if (selecting || pendingIds.has(entry.id) || entry.locked) return void 0;
1059
+ const star = onFavoriteChange ? {
1060
+ key: "favorite",
1061
+ label: entry.favorite ? labels.swipeUnfavorite : labels.swipeFavorite,
1062
+ icon: "star",
1063
+ fullSwipe: true,
1064
+ onAction: () => favorite(entry)
1065
+ } : null;
1066
+ const relocate = onMove ? {
1067
+ key: "move",
1068
+ label: labels.moveTo,
1069
+ icon: "folder-input",
1070
+ onAction: () => setMoving([entry])
1071
+ } : null;
1072
+ const trash = onDelete ? {
1073
+ key: "delete",
1074
+ label: labels.delete,
1075
+ icon: "trash",
1076
+ destructive: true,
1077
+ fullSwipe: !confirmDelete,
1078
+ collapses: !confirmDelete,
1079
+ onAction: () => askDelete([entry])
1080
+ } : null;
1081
+ const share = onShare && entry.type === "file" ? {
1082
+ key: "share",
1083
+ label: labels.download,
1084
+ icon: "upload",
1085
+ onAction: () => onShare([entry])
1086
+ } : null;
1087
+ if (!star && !relocate && !trash && !share) return void 0;
1088
+ const picked = [share ?? relocate, trash].filter((a) => a !== null);
1089
+ const trailing = picked.length === 2 ? [picked[0], picked[1]] : picked.length === 1 ? [picked[0]] : [];
1090
+ return { leading: star ? [star] : [], trailing };
1091
+ };
1092
+ const pad = theme.space.s4;
1093
+ const gap = theme.space.s3;
1094
+ const tileMin = theme.space[104] ?? theme.space[100];
1095
+ const mainWidth = wide ? width - SIDEBAR_WIDTH(theme) : width;
1096
+ const columns = Math.max(3, Math.floor((mainWidth - 2 * pad + gap) / (tileMin + gap)));
1097
+ const tileWidth = mainWidth > 0 ? (mainWidth - 2 * pad - gap * (columns - 1)) / columns : tileMin;
1098
+ const renderRow = ({ item: row }) => {
1099
+ if (row.kind !== "entry") {
1100
+ return /* @__PURE__ */ jsx(
1101
+ View,
1102
+ {
1103
+ style: [
1104
+ styles.standIn,
1105
+ { paddingStart: pad + indentOf(row.depth, theme) + DISCLOSURE(theme) }
1106
+ ],
1107
+ children: row.kind === "loading" ? /* @__PURE__ */ jsx(Skeleton, { variant: "text", width: theme.space[120] }) : /* @__PURE__ */ jsx(Text, { style: [styles.standInText, row.kind === "error" && styles.standInError], children: row.kind === "error" ? labels.loadFailed : labels.nestedEmpty })
1108
+ }
1109
+ );
1110
+ }
1111
+ const { entry, depth } = row;
1112
+ const busy = pendingIds.has(entry.id);
1113
+ const isOpen = expanded.has(entry.id);
1114
+ const treeable = nested && view === "list" && !searching && special === null;
1115
+ const meta = entryMeta(entry, drawn, labels, locale);
1116
+ const where = searching || special ? folderName(entry.parentId) : null;
1117
+ const hasDisclosure = treeable && entry.type === "folder";
1118
+ const hasOverflow = android && !selecting;
1119
+ return /* @__PURE__ */ jsxs(View, { style: [styles.rowWrap, busy && styles.busy], children: [
1120
+ /* @__PURE__ */ jsx(
1121
+ ListRow,
1122
+ {
1123
+ title: entry.name,
1124
+ subtitle: where ? `${where} \xB7 ${meta}` : meta,
1125
+ density,
1126
+ divider: true,
1127
+ leading: /* @__PURE__ */ jsxs(View, { style: [styles.lead, { paddingStart: indentOf(depth, theme) }], children: [
1128
+ treeable ? entry.type === "folder" ? (
1129
+ // Holds the disclosure's place; the button itself is a sibling of
1130
+ // the row (below) so two buttons are never nested.
1131
+ /* @__PURE__ */ jsx(View, { style: styles.disclosure })
1132
+ ) : /* @__PURE__ */ jsx(View, { style: styles.disclosure }) : null,
1133
+ /* @__PURE__ */ jsx(FileIcon, { entry, size: density === "compact" ? "md" : "lg" })
1134
+ ] }),
1135
+ trailing: android && !selecting ? (
1136
+ // Android: no swipe or press-and-hold menu (that gesture starts a
1137
+ // selection), so the row's actions sit behind a ghost overflow.
1138
+ /* @__PURE__ */ jsxs(View, { style: styles.trailingRow, children: [
1139
+ entry.favorite ? /* @__PURE__ */ jsx(Icon, { name: "star", size: theme.icon.sm, color: theme.color.text3 }) : null,
1140
+ /* @__PURE__ */ jsx(View, { style: styles.overflow })
1141
+ ] })
1142
+ ) : entry.favorite ? /* @__PURE__ */ jsx(Icon, { name: "star", size: theme.icon.sm, color: theme.color.text3 }) : entry.type === "folder" && !selecting && !treeable ? /* @__PURE__ */ jsx(Icon, { name: "chevron-right", size: theme.icon.sm, color: theme.color.text3 }) : void 0,
1143
+ selectable: selecting,
1144
+ selected: selection.includes(entry.id),
1145
+ onSelectedChange: () => toggleSelected(entry.id),
1146
+ onPress: () => open(entry),
1147
+ swipeActions: android ? void 0 : swipesFor(entry),
1148
+ menuItems: selecting || android ? void 0 : menuFor(entry),
1149
+ onLongPress: android && !selecting ? () => startSelecting(entry.id) : void 0,
1150
+ motion
1151
+ }
1152
+ ),
1153
+ hasDisclosure ? /* @__PURE__ */ jsx(
1154
+ View,
1155
+ {
1156
+ pointerEvents: "box-none",
1157
+ style: [styles.slot, { start: theme.space.s4 + indentOf(depth, theme) }],
1158
+ children: /* @__PURE__ */ jsx(
1159
+ Pressable,
1160
+ {
1161
+ accessibilityRole: "button",
1162
+ accessibilityLabel: isOpen ? labels.collapseFolder(entry.name) : labels.expandFolder(entry.name),
1163
+ accessibilityState: { expanded: isOpen },
1164
+ hitSlop: theme.space.s3,
1165
+ onPress: () => toggleExpanded(entry.id),
1166
+ style: styles.disclosure,
1167
+ children: /* @__PURE__ */ jsx(View, { style: isOpen && styles.disclosureOpen, children: /* @__PURE__ */ jsx(
1168
+ Icon,
1169
+ {
1170
+ name: "chevron-right",
1171
+ size: theme.icon.sm,
1172
+ color: theme.color.text3,
1173
+ strokeWidth: 2
1174
+ }
1175
+ ) })
1176
+ }
1177
+ )
1178
+ }
1179
+ ) : null,
1180
+ hasOverflow ? /* @__PURE__ */ jsx(View, { pointerEvents: "box-none", style: [styles.slot, { end: theme.space.s4 }], children: /* @__PURE__ */ jsx(
1181
+ OverflowAction,
1182
+ {
1183
+ label: labels.moreActions(entry.name),
1184
+ items: menuFor(entry),
1185
+ motion
1186
+ }
1187
+ ) }) : null
1188
+ ] });
1189
+ };
1190
+ const renderTile = ({ item: entry }) => {
1191
+ const busy = pendingIds.has(entry.id);
1192
+ const chosen = selection.includes(entry.id);
1193
+ const body = /* @__PURE__ */ jsxs(View, { style: [styles.tile, { width: tileWidth }, busy && styles.busy], children: [
1194
+ /* @__PURE__ */ jsxs(View, { style: [styles.tileArt, chosen && styles.tileArtChosen], children: [
1195
+ /* @__PURE__ */ jsx(FileIcon, { entry, size: "xl" }),
1196
+ selecting ? /* @__PURE__ */ jsx(View, { style: styles.check, pointerEvents: "none", children: /* @__PURE__ */ jsx(Checkbox, { size: "sm", checked: chosen, accessibilityLabel: entry.name }) }) : null
1197
+ ] }),
1198
+ /* @__PURE__ */ jsx(Text, { style: styles.tileName, numberOfLines: 2, children: entry.name }),
1199
+ /* @__PURE__ */ jsx(Text, { style: styles.tileMeta, numberOfLines: 1, children: entryMeta(entry, drawn, labels, locale) })
1200
+ ] });
1201
+ if (selecting) {
1202
+ return /* @__PURE__ */ jsx(
1203
+ Pressable,
1204
+ {
1205
+ accessibilityRole: "checkbox",
1206
+ accessibilityLabel: entry.name,
1207
+ accessibilityState: { checked: chosen },
1208
+ onPress: () => toggleSelected(entry.id),
1209
+ children: body
1210
+ }
1211
+ );
1212
+ }
1213
+ if (android) {
1214
+ return /* @__PURE__ */ jsx(
1215
+ Pressable,
1216
+ {
1217
+ accessibilityRole: "button",
1218
+ accessibilityLabel: entry.name,
1219
+ onPress: () => open(entry),
1220
+ onLongPress: () => startSelecting(entry.id),
1221
+ children: body
1222
+ }
1223
+ );
1224
+ }
1225
+ return /* @__PURE__ */ jsx(
1226
+ ContextMenu,
1227
+ {
1228
+ items: menuFor(entry),
1229
+ onPress: () => open(entry),
1230
+ platform,
1231
+ accessibilityLabel: entry.name,
1232
+ radius: theme.radius.md,
1233
+ motion,
1234
+ children: body
1235
+ }
1236
+ );
1237
+ };
1238
+ const title = searching ? labels.searchResults(special ? labels.root : folderName(folderId)) : special === "recent" ? labels.recent : special === "favorites" ? labels.favorites : folder?.name ?? labels.root;
1239
+ const canBack = special === null && folderId !== null;
1240
+ const hasLocations = recents || favoritesOn || childrenOf(drawn, null).some((e) => e.type === "folder");
1241
+ const empty = (() => {
1242
+ if (failed)
1243
+ return /* @__PURE__ */ jsx(
1244
+ EmptyState,
1245
+ {
1246
+ variant: "error",
1247
+ title: labels.loadFailed,
1248
+ actionLabel: onRetry ? labels.retry : void 0,
1249
+ onAction: onRetry
1250
+ }
1251
+ );
1252
+ if (showSkeleton)
1253
+ return /* @__PURE__ */ jsx(SkeletonRows, { view, columns, tileWidth, label: labels.loading });
1254
+ if (loading) return null;
1255
+ if (searching)
1256
+ return /* @__PURE__ */ jsx(
1257
+ EmptyState,
1258
+ {
1259
+ variant: "no-results",
1260
+ title: labels.noResultsTitle(query.trim()),
1261
+ description: labels.noResultsDescription,
1262
+ actionLabel: labels.clearSearch,
1263
+ onAction: () => setQuery("")
1264
+ }
1265
+ );
1266
+ if (special === "recent") return /* @__PURE__ */ jsx(EmptyState, { icon: "clock", title: labels.noRecent });
1267
+ return /* @__PURE__ */ jsx(
1268
+ EmptyState,
1269
+ {
1270
+ icon: "folder-open",
1271
+ title: labels.emptyFolderTitle,
1272
+ actionLabel: onCreateFolder && special === null ? labels.newFolder : void 0,
1273
+ onAction: () => setNaming({ entry: null })
1274
+ }
1275
+ );
1276
+ })();
1277
+ const locationsList = /* @__PURE__ */ jsx(
1278
+ FileLocations,
1279
+ {
1280
+ location,
1281
+ onLocationChange: go,
1282
+ folders: sortEntries(
1283
+ childrenOf(drawn, null).filter((e) => e.type === "folder"),
1284
+ DEFAULT_FILE_SORT,
1285
+ locale
1286
+ ),
1287
+ recents,
1288
+ favorites: favoritesOn,
1289
+ labels
1290
+ }
1291
+ );
1292
+ return /* @__PURE__ */ jsxs(
1293
+ View,
1294
+ {
1295
+ style: styles.root,
1296
+ onLayout: (e) => setWidth(e.nativeEvent.layout.width),
1297
+ children: [
1298
+ wide ? /* @__PURE__ */ jsx(View, { style: styles.side, children: locationsList }) : null,
1299
+ /* @__PURE__ */ jsxs(View, { style: styles.main, children: [
1300
+ android && selecting ? /* @__PURE__ */ jsxs(View, { style: styles.appBar, accessibilityRole: "toolbar", children: [
1301
+ /* @__PURE__ */ jsx(NavHeaderAction, { icon: "x", accessibilityLabel: labels.done, onPress: endSelecting }),
1302
+ /* @__PURE__ */ jsx(Text, { style: styles.appBarTitle, accessibilityRole: "header", children: labels.selected(selection.length) }),
1303
+ /* @__PURE__ */ jsx(
1304
+ NavHeaderAction,
1305
+ {
1306
+ icon: "folder-input",
1307
+ accessibilityLabel: labels.moveTo,
1308
+ disabled: !onMove || selectedEntries.length === 0,
1309
+ onPress: () => setMoving(selectedEntries)
1310
+ }
1311
+ ),
1312
+ onShare ? /* @__PURE__ */ jsx(
1313
+ NavHeaderAction,
1314
+ {
1315
+ icon: "upload",
1316
+ accessibilityLabel: labels.download,
1317
+ disabled: !selectedEntries.some((e) => e.type === "file"),
1318
+ onPress: () => onShare(selectedEntries.filter((e) => e.type === "file"))
1319
+ }
1320
+ ) : null,
1321
+ /* @__PURE__ */ jsx(
1322
+ NavHeaderAction,
1323
+ {
1324
+ icon: "trash",
1325
+ accessibilityLabel: labels.delete,
1326
+ disabled: !onDelete || selectedEntries.length === 0,
1327
+ onPress: () => {
1328
+ askDelete(selectedEntries);
1329
+ if (!confirmDelete) setSelecting(false);
1330
+ }
1331
+ }
1332
+ )
1333
+ ] }) : /* @__PURE__ */ jsx(
1334
+ NavHeader,
1335
+ {
1336
+ title: selecting ? labels.selected(selection.length) : title,
1337
+ large: !selecting,
1338
+ leading: !selecting && canBack ? "chevron-left" : void 0,
1339
+ leadingLabel: canBack ? parent?.name ?? labels.root : void 0,
1340
+ onLeadingPress: () => go({ kind: "folder", id: folder?.parentId ?? null }),
1341
+ leadingSlot: !selecting && !canBack && !wide && hasLocations ? /* @__PURE__ */ jsx(
1342
+ NavHeaderAction,
1343
+ {
1344
+ icon: "menu",
1345
+ accessibilityLabel: labels.locations,
1346
+ onPress: () => setLocationsOpen(true)
1347
+ }
1348
+ ) : void 0,
1349
+ showSearch: !selecting,
1350
+ searchPlaceholder: labels.searchPlaceholder,
1351
+ searchValue: query,
1352
+ onSearchChangeText: setQuery,
1353
+ onSearchCancel: () => setQuery(""),
1354
+ trailing: /* @__PURE__ */ jsxs(View, { style: styles.headerActions, children: [
1355
+ selecting ? null : /* @__PURE__ */ jsx(
1356
+ NavHeaderAction,
1357
+ {
1358
+ icon: "sliders",
1359
+ accessibilityLabel: labels.view,
1360
+ onPress: () => setOptionsOpen(true)
1361
+ }
1362
+ ),
1363
+ listed.length > 0 || selecting ? /* @__PURE__ */ jsx(
1364
+ Button,
1365
+ {
1366
+ variant: "ghost",
1367
+ size: "sm",
1368
+ onPress: () => selecting ? endSelecting() : setSelecting(true),
1369
+ children: selecting ? labels.done : labels.select
1370
+ }
1371
+ ) : null
1372
+ ] })
1373
+ }
1374
+ ),
1375
+ listed.length === 0 || failed ? /* @__PURE__ */ jsx(View, { style: styles.empty, children: empty }) : view === "grid" ? /* @__PURE__ */ jsx(
1376
+ FlatList,
1377
+ {
1378
+ data: listed,
1379
+ keyExtractor: (e) => e.id,
1380
+ numColumns: columns,
1381
+ renderItem: renderTile,
1382
+ columnWrapperStyle: { gap },
1383
+ contentContainerStyle: [
1384
+ styles.gridContent,
1385
+ { paddingBottom: theme.space.s6 + safeAreaBottom }
1386
+ ],
1387
+ initialNumToRender: columns * 6,
1388
+ windowSize: 7
1389
+ },
1390
+ `grid-${columns}`
1391
+ ) : /* @__PURE__ */ jsx(
1392
+ FlatList,
1393
+ {
1394
+ data: rows,
1395
+ keyExtractor: (r) => r.kind === "entry" ? r.entry.id : `${r.kind}:${r.parent.id}`,
1396
+ renderItem: renderRow,
1397
+ contentContainerStyle: { paddingBottom: theme.space.s6 + safeAreaBottom },
1398
+ initialNumToRender: 16,
1399
+ windowSize: 9
1400
+ },
1401
+ "list"
1402
+ ),
1403
+ selecting && !android ? /* @__PURE__ */ jsxs(View, { style: [styles.bar, { paddingBottom: theme.space.s2 + safeAreaBottom }], children: [
1404
+ /* @__PURE__ */ jsx(
1405
+ Button,
1406
+ {
1407
+ variant: "ghost",
1408
+ leadingIcon: "folder-input",
1409
+ disabled: !onMove || selectedEntries.length === 0,
1410
+ onPress: () => setMoving(selectedEntries),
1411
+ children: labels.moveTo
1412
+ }
1413
+ ),
1414
+ onShare ? /* @__PURE__ */ jsx(
1415
+ Button,
1416
+ {
1417
+ variant: "ghost",
1418
+ leadingIcon: "upload",
1419
+ disabled: !selectedEntries.some((e) => e.type === "file"),
1420
+ onPress: () => onShare(selectedEntries.filter((e) => e.type === "file")),
1421
+ children: labels.download
1422
+ }
1423
+ ) : null,
1424
+ /* @__PURE__ */ jsx(
1425
+ Button,
1426
+ {
1427
+ variant: "ghost",
1428
+ leadingIcon: "trash",
1429
+ disabled: !onDelete || selectedEntries.length === 0,
1430
+ onPress: () => {
1431
+ askDelete(selectedEntries);
1432
+ if (!confirmDelete) setSelecting(false);
1433
+ },
1434
+ accessibilityLabel: labels.delete,
1435
+ children: /* @__PURE__ */ jsx(Text, { style: styles.danger, children: labels.delete })
1436
+ }
1437
+ )
1438
+ ] }) : null
1439
+ ] }),
1440
+ /* @__PURE__ */ jsx(
1441
+ FileOptionsSheet,
1442
+ {
1443
+ open: optionsOpen,
1444
+ onClose: () => setOptionsOpen(false),
1445
+ view,
1446
+ onViewChange: setView,
1447
+ sort,
1448
+ onSortChange: setSort,
1449
+ onNewFolder: onCreateFolder && special === null ? () => setNaming({ entry: null }) : void 0,
1450
+ labels,
1451
+ safeAreaBottom,
1452
+ motion
1453
+ }
1454
+ ),
1455
+ !wide ? /* @__PURE__ */ jsx(
1456
+ SheetLocations,
1457
+ {
1458
+ open: locationsOpen,
1459
+ onClose: () => setLocationsOpen(false),
1460
+ labels,
1461
+ safeAreaBottom,
1462
+ motion,
1463
+ children: locationsList
1464
+ }
1465
+ ) : null,
1466
+ /* @__PURE__ */ jsx(
1467
+ FileInfoSheet,
1468
+ {
1469
+ entry: info,
1470
+ items: drawn,
1471
+ onClose: () => setInfo(null),
1472
+ labels,
1473
+ locale,
1474
+ safeAreaBottom,
1475
+ motion
1476
+ }
1477
+ ),
1478
+ /* @__PURE__ */ jsx(
1479
+ FilePreviewSheet,
1480
+ {
1481
+ entry: preview,
1482
+ files,
1483
+ onEntryChange: setPreview,
1484
+ onClose: () => setPreview(null),
1485
+ items: drawn,
1486
+ renderPreview,
1487
+ labels,
1488
+ locale,
1489
+ safeAreaBottom,
1490
+ motion
1491
+ }
1492
+ ),
1493
+ /* @__PURE__ */ jsx(
1494
+ FileMoveSheet,
1495
+ {
1496
+ entries: moving,
1497
+ items: drawn,
1498
+ onClose: () => setMoving([]),
1499
+ onMove: (target) => {
1500
+ const list = moving;
1501
+ setMoving([]);
1502
+ endSelecting();
1503
+ move(list, target);
1504
+ },
1505
+ labels,
1506
+ locale,
1507
+ safeAreaBottom,
1508
+ motion
1509
+ }
1510
+ ),
1511
+ /* @__PURE__ */ jsx(
1512
+ FileNameDialog,
1513
+ {
1514
+ open: naming !== null,
1515
+ title: naming?.entry ? labels.rename : labels.newFolder,
1516
+ initialName: naming?.entry ? naming.entry.name : uniqueFileName(labels.untitledFolder, childrenOf(drawn, folderId)),
1517
+ confirmLabel: naming?.entry ? labels.save : labels.create,
1518
+ validate: (name) => validateFileName(
1519
+ name,
1520
+ childrenOf(drawn, naming?.entry?.parentId ?? folderId),
1521
+ naming?.entry?.id
1522
+ ),
1523
+ onSubmit: submitName,
1524
+ onClose: () => setNaming(null),
1525
+ labels,
1526
+ motion
1527
+ }
1528
+ ),
1529
+ asking ? /* @__PURE__ */ jsx(
1530
+ NameConflictDialog,
1531
+ {
1532
+ open: true,
1533
+ onClose: () => {
1534
+ setAsking(null);
1535
+ asking.done(null);
1536
+ },
1537
+ existing: asking.conflicts[asking.choices.length].existing,
1538
+ incoming: asking.conflicts[asking.choices.length].incoming,
1539
+ index: asking.choices.length + 1,
1540
+ total: asking.conflicts.length,
1541
+ onResolve: answerConflict,
1542
+ labels,
1543
+ motion
1544
+ }
1545
+ ) : null,
1546
+ /* @__PURE__ */ jsx(
1547
+ FileDeleteDialog,
1548
+ {
1549
+ open: deleting !== null,
1550
+ entries: deleting ?? [],
1551
+ onClose: () => setDeleting(null),
1552
+ onConfirm: () => {
1553
+ const list = deleting ?? [];
1554
+ setDeleting(null);
1555
+ endSelecting();
1556
+ remove(list);
1557
+ },
1558
+ labels,
1559
+ motion
1560
+ }
1561
+ )
1562
+ ]
1563
+ }
1564
+ );
1565
+ }
1566
+ function SheetLocations({
1567
+ open,
1568
+ onClose,
1569
+ labels,
1570
+ safeAreaBottom,
1571
+ motion,
1572
+ children
1573
+ }) {
1574
+ return /* @__PURE__ */ jsx(
1575
+ Sheet,
1576
+ {
1577
+ open,
1578
+ onClose,
1579
+ title: labels.locations,
1580
+ closeLabel: labels.close,
1581
+ safeAreaBottom,
1582
+ motion,
1583
+ children
1584
+ }
1585
+ );
1586
+ }
1587
+ function SkeletonRows({
1588
+ view,
1589
+ columns,
1590
+ tileWidth,
1591
+ label
1592
+ }) {
1593
+ const theme = useLoamTheme("file-manager");
1594
+ const { styles } = useStyles(sheet3);
1595
+ if (view === "grid") {
1596
+ return /* @__PURE__ */ jsx(View, { style: [styles.gridContent, styles.skeletonGrid], accessibilityLabel: label, children: Array.from({ length: columns * 2 }, (_, i) => /* @__PURE__ */ jsxs(View, { style: [styles.tile, { width: tileWidth }], children: [
1597
+ /* @__PURE__ */ jsx(Skeleton, { variant: "rect", width: theme.space[64], height: theme.space[64], radius: "md" }),
1598
+ /* @__PURE__ */ jsx(Skeleton, { variant: "text", width: tileWidth * 0.7 })
1599
+ ] }, i)) });
1600
+ }
1601
+ return /* @__PURE__ */ jsx(View, { accessibilityLabel: label, children: Array.from({ length: 8 }, (_, i) => /* @__PURE__ */ jsxs(View, { style: styles.skeletonRow, children: [
1602
+ /* @__PURE__ */ jsx(Skeleton, { variant: "rect", width: theme.space[48], height: theme.space[48], radius: "sm" }),
1603
+ /* @__PURE__ */ jsxs(View, { style: styles.skeletonText, children: [
1604
+ /* @__PURE__ */ jsx(Skeleton, { variant: "text", width: theme.space[160] * (i % 3 === 0 ? 1 : 0.75) }),
1605
+ /* @__PURE__ */ jsx(Skeleton, { variant: "text", width: theme.space[100] })
1606
+ ] })
1607
+ ] }, i)) });
1608
+ }
1609
+ var SIDEBAR_WIDTH = (theme) => theme.space[256];
1610
+ var DISCLOSURE = (theme) => theme.space.s5;
1611
+ var indentOf = (depth, theme) => depth * theme.space[20];
1612
+ function OverflowAction({
1613
+ label,
1614
+ items,
1615
+ motion
1616
+ }) {
1617
+ const { styles, theme } = useStyles(sheet3);
1618
+ const ref = React3.useRef(null);
1619
+ const [open, setOpen] = React3.useState(false);
1620
+ const [anchor, setAnchor] = React3.useState(null);
1621
+ const show = () => {
1622
+ const node = ref.current;
1623
+ if (node && typeof node.measureInWindow === "function") {
1624
+ node.measureInWindow((x, y, width, height) => setAnchor({ x, y, width, height }));
1625
+ }
1626
+ setOpen(true);
1627
+ };
1628
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
1629
+ /* @__PURE__ */ jsx(
1630
+ Pressable,
1631
+ {
1632
+ ref,
1633
+ testID: "file-manager-overflow",
1634
+ accessibilityRole: "button",
1635
+ accessibilityLabel: label,
1636
+ onPress: show,
1637
+ hitSlop: Math.max(0, (theme.hit.sm - theme.ctl.sm) / 2),
1638
+ android_ripple: { color: theme.state.pressed, borderless: true },
1639
+ style: styles.overflow,
1640
+ children: /* @__PURE__ */ jsx(Icon, { name: "more-horizontal", size: theme.icon.md, color: theme.color.text2 })
1641
+ }
1642
+ ),
1643
+ /* @__PURE__ */ jsx(
1644
+ ContextMenuOverlay,
1645
+ {
1646
+ open,
1647
+ onClose: () => setOpen(false),
1648
+ items,
1649
+ anchor,
1650
+ platform: "android",
1651
+ accessibilityLabel: label,
1652
+ motion
1653
+ }
1654
+ )
1655
+ ] });
1656
+ }
1657
+ var sheet3 = createStyleSheet((theme) => ({
1658
+ root: { flex: 1, flexDirection: "row", backgroundColor: theme.color.bg },
1659
+ side: {
1660
+ width: SIDEBAR_WIDTH(theme),
1661
+ borderEndWidth: theme.borderWidth.hair,
1662
+ borderEndColor: theme.color.border,
1663
+ backgroundColor: theme.color.surface,
1664
+ paddingHorizontal: theme.space.s2,
1665
+ paddingTop: theme.space.s4
1666
+ },
1667
+ main: { flex: 1, minWidth: 0 },
1668
+ headerActions: { flexDirection: "row", alignItems: "center", gap: theme.space.s1 },
1669
+ empty: { flex: 1, justifyContent: "center" },
1670
+ lead: { flexDirection: "row", alignItems: "center", gap: theme.space.s1 },
1671
+ trailingRow: { flexDirection: "row", alignItems: "center", gap: theme.space.s2 },
1672
+ overflow: {
1673
+ width: theme.ctl.sm,
1674
+ height: theme.ctl.sm,
1675
+ borderRadius: theme.radius.full,
1676
+ alignItems: "center",
1677
+ justifyContent: "center"
1678
+ },
1679
+ disclosure: {
1680
+ width: DISCLOSURE(theme),
1681
+ height: DISCLOSURE(theme),
1682
+ alignItems: "center",
1683
+ justifyContent: "center"
1684
+ },
1685
+ disclosureOpen: { transform: [{ rotate: "90deg" }] },
1686
+ rowWrap: { position: "relative" },
1687
+ slot: { position: "absolute", top: 0, bottom: 0, justifyContent: "center" },
1688
+ busy: { opacity: theme.state.disabledOpacity },
1689
+ standIn: {
1690
+ minHeight: theme.ctl.lg,
1691
+ justifyContent: "center",
1692
+ paddingEnd: theme.space.s4
1693
+ },
1694
+ standInText: {
1695
+ fontFamily: theme.font.sans,
1696
+ fontSize: theme.type.footnote.fontSize,
1697
+ color: theme.color.text2
1698
+ },
1699
+ standInError: { color: theme.color.dangerOnSoft },
1700
+ gridContent: {
1701
+ paddingHorizontal: theme.space.s4,
1702
+ paddingTop: theme.space.s2,
1703
+ gap: theme.space.s5
1704
+ },
1705
+ skeletonGrid: { flexDirection: "row", flexWrap: "wrap", columnGap: theme.space.s3 },
1706
+ tile: { alignItems: "center", gap: theme.space.s1, paddingVertical: theme.space.s1 },
1707
+ tileArt: {
1708
+ width: theme.space[76],
1709
+ height: theme.space[76],
1710
+ alignItems: "center",
1711
+ justifyContent: "center",
1712
+ borderRadius: theme.radius.md,
1713
+ marginBottom: theme.space.s1
1714
+ },
1715
+ tileArtChosen: {
1716
+ backgroundColor: theme.state.selected
1717
+ },
1718
+ tileName: {
1719
+ fontFamily: theme.font.sans,
1720
+ fontSize: theme.type.footnote.fontSize,
1721
+ lineHeight: theme.type.footnote.lineHeight,
1722
+ fontWeight: theme.type.headline.fontWeight,
1723
+ color: theme.color.text,
1724
+ textAlign: "center"
1725
+ },
1726
+ tileMeta: {
1727
+ fontFamily: theme.font.sans,
1728
+ fontSize: theme.type.caption1.fontSize,
1729
+ lineHeight: theme.type.caption1.lineHeight,
1730
+ color: theme.color.text3,
1731
+ textAlign: "center"
1732
+ },
1733
+ // Top-start, where web draws it, so it never sits under the status badge.
1734
+ check: { position: "absolute", top: theme.space.s1, start: theme.space.s1 },
1735
+ appBar: {
1736
+ flexDirection: "row",
1737
+ alignItems: "center",
1738
+ gap: theme.space.s1,
1739
+ minHeight: theme.layout.appbarH,
1740
+ paddingHorizontal: theme.space.s2,
1741
+ backgroundColor: theme.color.surface2
1742
+ },
1743
+ appBarTitle: {
1744
+ flex: 1,
1745
+ fontFamily: theme.font.sans,
1746
+ fontSize: theme.type.title3.fontSize,
1747
+ color: theme.color.text
1748
+ },
1749
+ bar: {
1750
+ flexDirection: "row",
1751
+ justifyContent: "space-around",
1752
+ alignItems: "center",
1753
+ paddingTop: theme.space.s2,
1754
+ paddingHorizontal: theme.space.s2,
1755
+ borderTopWidth: theme.borderWidth.hair,
1756
+ borderTopColor: theme.color.border,
1757
+ backgroundColor: theme.color.surface
1758
+ },
1759
+ danger: {
1760
+ color: theme.color.dangerOnSoft,
1761
+ fontFamily: theme.font.sans,
1762
+ fontWeight: theme.type.headline.fontWeight
1763
+ },
1764
+ skeletonRow: {
1765
+ flexDirection: "row",
1766
+ alignItems: "center",
1767
+ gap: theme.space.s3,
1768
+ paddingHorizontal: theme.space.s4,
1769
+ minHeight: theme.layout.listRowH
1770
+ },
1771
+ skeletonText: { gap: theme.space.s2 }
1772
+ }));
1773
+ var isPromise = (value) => typeof value?.then === "function";
1774
+ var DEFAULT_NAME_CONFLICT_LABELS = {
1775
+ counter: (i, n) => `Conflict ${i} of ${n}`,
1776
+ title: (name) => `\u201C${name}\u201D already exists`,
1777
+ description: (folder, destination) => `A ${folder ? "folder" : "file"} with this name is already in ${destination ?? "this folder"}.`,
1778
+ existing: (destination) => `In ${destination ?? "this folder"}`,
1779
+ incoming: "Uploading",
1780
+ newer: "Newer",
1781
+ modified: (date) => `Modified ${date}`,
1782
+ skip: "Skip",
1783
+ keepBoth: "Keep both",
1784
+ replace: "Replace",
1785
+ merge: "Merge",
1786
+ applyToAll: (others) => `Do this for the other ${others} ${others === 1 ? "conflict" : "conflicts"}`,
1787
+ keepBothNote: (newName) => `Keep both saves it as \u201C${newName}\u201D.`,
1788
+ folderConsequence: (items) => items === void 0 ? "Replace removes the existing folder and everything in it." : `Replace removes the ${items.toLocaleString()} ${items === 1 ? "file" : "files"} in the existing folder.`,
1789
+ cannotReplace: "The existing item is locked, so it cannot be replaced.",
1790
+ failed: (action) => `${action} failed.`,
1791
+ tryAgain: "Try again"
1792
+ };
1793
+ function keepBothName(name) {
1794
+ const dot = name.lastIndexOf(".");
1795
+ return dot > 0 ? `${name.slice(0, dot)} (1)${name.slice(dot)}` : `${name} (1)`;
1796
+ }
1797
+ function ConflictRow({
1798
+ kind,
1799
+ name,
1800
+ origin,
1801
+ side,
1802
+ newer,
1803
+ labels
1804
+ }) {
1805
+ const { styles: s } = useStyles(sheet4);
1806
+ const date = side?.modifiedAt === void 0 ? "" : new Date(side.modifiedAt).toLocaleDateString(void 0, { day: "numeric", month: "short" });
1807
+ const meta = [
1808
+ kind === "file" && side?.size !== void 0 ? formatFileSize(side.size) : "",
1809
+ date ? labels.modified(date) : ""
1810
+ ].filter(Boolean).join(" \xB7 ");
1811
+ return /* @__PURE__ */ jsxs(View, { style: s.row, children: [
1812
+ /* @__PURE__ */ jsx(
1813
+ IconTile,
1814
+ {
1815
+ icon: FILE_CATEGORY_ICON[fileCategory({ name, type: kind })],
1816
+ tone: kind === "folder" ? "accent" : "neutral",
1817
+ size: "md"
1818
+ }
1819
+ ),
1820
+ /* @__PURE__ */ jsxs(View, { style: s.rowText, children: [
1821
+ /* @__PURE__ */ jsx(Text$1, { variant: "overline", tone: "secondary", children: origin }),
1822
+ /* @__PURE__ */ jsx(Text$1, { variant: "subheadline", style: s.name, numberOfLines: 1, ellipsizeMode: "middle", children: name }),
1823
+ meta ? /* @__PURE__ */ jsx(Text$1, { variant: "caption1", tone: "secondary", style: s.meta, children: meta }) : null
1824
+ ] }),
1825
+ newer ? /* @__PURE__ */ jsx(Badge, { variant: "good", size: "sm", children: labels.newer }) : null
1826
+ ] });
1827
+ }
1828
+ function NameConflictCard({
1829
+ name,
1830
+ kind = "file",
1831
+ destination,
1832
+ existing,
1833
+ incoming,
1834
+ existingItems,
1835
+ index,
1836
+ total,
1837
+ onResolve,
1838
+ loading,
1839
+ error,
1840
+ cannotReplace,
1841
+ labels: labelsProp
1842
+ }) {
1843
+ const { styles: s } = useStyles(sheet4);
1844
+ const labels = React3.useMemo(() => ({ ...DEFAULT_NAME_CONFLICT_LABELS, ...labelsProp }), [labelsProp]);
1845
+ const [pending, setPending] = React3.useState(null);
1846
+ const [failed, setFailed] = React3.useState(null);
1847
+ const [all, setAll] = React3.useState(false);
1848
+ const mounted = React3.useRef(true);
1849
+ React3.useEffect(
1850
+ () => () => {
1851
+ mounted.current = false;
1852
+ },
1853
+ []
1854
+ );
1855
+ const folder = kind === "folder";
1856
+ const batch = total !== void 0 && total > 1;
1857
+ const busy = loading ?? pending;
1858
+ const newer = newerSide(existing?.modifiedAt, incoming?.modifiedAt);
1859
+ const resolve = (choice) => () => {
1860
+ if (busy) return;
1861
+ setFailed(null);
1862
+ const result = onResolve(choice, batch && all);
1863
+ if (!isPromise(result)) return;
1864
+ setPending(choice);
1865
+ result.then(
1866
+ () => {
1867
+ if (mounted.current) setPending(null);
1868
+ },
1869
+ () => {
1870
+ if (!mounted.current) return;
1871
+ setPending(null);
1872
+ setFailed(choice);
1873
+ }
1874
+ );
1875
+ };
1876
+ const choices = folder ? [
1877
+ { choice: "skip", label: labels.skip },
1878
+ { choice: "replace", label: labels.replace },
1879
+ { choice: "merge", label: labels.merge, primary: true }
1880
+ ] : [
1881
+ { choice: "skip", label: labels.skip },
1882
+ { choice: "keep-both", label: labels.keepBoth },
1883
+ { choice: "replace", label: labels.replace, primary: true }
1884
+ ];
1885
+ const primary = choices.find((c) => c.primary);
1886
+ const retry = failed ?? primary.choice;
1887
+ const showError = error !== void 0 || failed !== null;
1888
+ return /* @__PURE__ */ jsxs(View, { style: s.card, accessibilityRole: "alert", children: [
1889
+ /* @__PURE__ */ jsxs(View, { style: s.header, children: [
1890
+ index !== void 0 && total !== void 0 ? /* @__PURE__ */ jsx(Text$1, { variant: "overline", tone: "secondary", children: labels.counter(index, total) }) : null,
1891
+ /* @__PURE__ */ jsx(Text$1, { variant: "headline", style: s.title, children: labels.title(name) }),
1892
+ /* @__PURE__ */ jsx(Text$1, { variant: "subheadline", tone: "secondary", children: labels.description(folder, destination) })
1893
+ ] }),
1894
+ /* @__PURE__ */ jsxs(View, { style: s.compare, children: [
1895
+ /* @__PURE__ */ jsx(
1896
+ ConflictRow,
1897
+ {
1898
+ kind,
1899
+ name,
1900
+ origin: labels.existing(destination),
1901
+ side: existing,
1902
+ newer: newer === "a",
1903
+ labels
1904
+ }
1905
+ ),
1906
+ /* @__PURE__ */ jsx(
1907
+ ConflictRow,
1908
+ {
1909
+ kind,
1910
+ name,
1911
+ origin: labels.incoming,
1912
+ side: incoming,
1913
+ newer: newer === "b",
1914
+ labels
1915
+ }
1916
+ )
1917
+ ] }),
1918
+ folder ? /* @__PURE__ */ jsx(View, { style: s.consequence, children: /* @__PURE__ */ jsx(Text$1, { variant: "footnote", children: labels.folderConsequence(existingItems) }) }) : null,
1919
+ cannotReplace ? /* @__PURE__ */ jsx(Text$1, { variant: "footnote", tone: "secondary", children: cannotReplace }) : null,
1920
+ batch ? /* @__PURE__ */ jsx(
1921
+ Checkbox,
1922
+ {
1923
+ size: "sm",
1924
+ label: labels.applyToAll((total ?? 1) - 1),
1925
+ checked: all,
1926
+ disabled: !!busy,
1927
+ onCheckedChange: setAll
1928
+ }
1929
+ ) : null,
1930
+ showError ? /* @__PURE__ */ jsx(
1931
+ Alert,
1932
+ {
1933
+ tone: "danger",
1934
+ size: "compact",
1935
+ title: error ?? labels.failed(choices.find((c) => c.choice === retry)?.label ?? ""),
1936
+ action: /* @__PURE__ */ jsx(Button, { variant: "outline", size: "sm", disabled: !!busy, onPress: resolve(retry), children: labels.tryAgain })
1937
+ }
1938
+ ) : null,
1939
+ /* @__PURE__ */ jsx(View, { style: s.actions, children: choices.map((c) => /* @__PURE__ */ jsx(
1940
+ Button,
1941
+ {
1942
+ variant: c.primary ? "primary" : "outline",
1943
+ size: "md",
1944
+ loading: busy === c.choice,
1945
+ disabled: !!busy && busy !== c.choice || c.choice === "replace" && !!cannotReplace,
1946
+ onPress: resolve(c.choice),
1947
+ children: c.label
1948
+ },
1949
+ c.choice
1950
+ )) }),
1951
+ !folder ? /* @__PURE__ */ jsx(Text$1, { variant: "footnote", tone: "secondary", children: labels.keepBothNote(keepBothName(name)) }) : null
1952
+ ] });
1953
+ }
1954
+ var sheet4 = createStyleSheet((theme) => ({
1955
+ card: {
1956
+ width: "100%",
1957
+ maxWidth: theme.panel.xl,
1958
+ backgroundColor: theme.color.surface,
1959
+ borderRadius: theme.radius.xl,
1960
+ borderWidth: theme.borderWidth.base,
1961
+ borderColor: theme.color.border,
1962
+ padding: theme.space.s5,
1963
+ gap: theme.space.s3,
1964
+ ...theme.shadow.lg
1965
+ },
1966
+ header: { gap: theme.space.s1 },
1967
+ title: { color: theme.color.text },
1968
+ compare: {
1969
+ gap: theme.space.s3,
1970
+ padding: theme.space.s3,
1971
+ borderRadius: theme.radius.md,
1972
+ backgroundColor: theme.color.surface2
1973
+ },
1974
+ row: { flexDirection: "row", alignItems: "center", gap: theme.space.s3 },
1975
+ rowText: { flex: 1, minWidth: 0, gap: theme.space[2] },
1976
+ name: { fontWeight: theme.type.headline.fontWeight, color: theme.color.text },
1977
+ meta: { fontVariant: ["tabular-nums"] },
1978
+ consequence: {
1979
+ borderRadius: theme.radius.md,
1980
+ backgroundColor: theme.color.surface2,
1981
+ paddingHorizontal: theme.space.s4,
1982
+ paddingVertical: theme.space.s3
1983
+ },
1984
+ actions: {
1985
+ flexDirection: "row",
1986
+ flexWrap: "wrap",
1987
+ justifyContent: "flex-end",
1988
+ gap: theme.space.s2
1989
+ }
1990
+ }));
1991
+
1992
+ export { DEFAULT_NAME_CONFLICT_LABELS, FileDeleteDialog, FileIcon, FileInfoSheet, FileLocations, FileManager, FileMoveSheet, FileNameDialog, FileOptionsSheet, FilePreviewSheet, NameConflictCard, entryMeta, keepBothName };