libre-webui 0.21.3 → 0.22.0

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 (945) hide show
  1. package/README.md +308 -328
  2. package/backend/dist/cli/migrateSqliteToPostgres.d.ts +2 -0
  3. package/backend/dist/cli/migrateSqliteToPostgres.d.ts.map +1 -0
  4. package/backend/dist/cli/migrateSqliteToPostgres.js +113 -0
  5. package/backend/dist/cli/migrateSqliteToPostgres.js.map +1 -0
  6. package/backend/dist/cli/recoveryBackup.d.ts +3 -0
  7. package/backend/dist/cli/recoveryBackup.d.ts.map +1 -0
  8. package/backend/dist/cli/recoveryBackup.js +251 -0
  9. package/backend/dist/cli/recoveryBackup.js.map +1 -0
  10. package/backend/dist/cli/recoveryInventory.d.ts +2 -0
  11. package/backend/dist/cli/recoveryInventory.d.ts.map +1 -0
  12. package/backend/dist/cli/recoveryInventory.js +109 -0
  13. package/backend/dist/cli/recoveryInventory.js.map +1 -0
  14. package/backend/dist/db.d.ts +27 -0
  15. package/backend/dist/db.d.ts.map +1 -1
  16. package/backend/dist/db.js +333 -16
  17. package/backend/dist/db.js.map +1 -1
  18. package/backend/dist/env.d.ts.map +1 -1
  19. package/backend/dist/env.js +12 -2
  20. package/backend/dist/env.js.map +1 -1
  21. package/backend/dist/index.d.ts.map +1 -1
  22. package/backend/dist/index.js +235 -47
  23. package/backend/dist/index.js.map +1 -1
  24. package/backend/dist/main.d.ts +2 -0
  25. package/backend/dist/main.d.ts.map +1 -0
  26. package/backend/dist/main.js +137 -0
  27. package/backend/dist/main.js.map +1 -0
  28. package/backend/dist/middleware/auth.d.ts.map +1 -1
  29. package/backend/dist/middleware/auth.js +7 -3
  30. package/backend/dist/middleware/auth.js.map +1 -1
  31. package/backend/dist/middleware/chatCancellationAdmission.d.ts +7 -0
  32. package/backend/dist/middleware/chatCancellationAdmission.d.ts.map +1 -0
  33. package/backend/dist/middleware/chatCancellationAdmission.js +17 -0
  34. package/backend/dist/middleware/chatCancellationAdmission.js.map +1 -0
  35. package/backend/dist/middleware/coordinatedRateLimit.d.ts +18 -0
  36. package/backend/dist/middleware/coordinatedRateLimit.d.ts.map +1 -0
  37. package/backend/dist/middleware/coordinatedRateLimit.js +52 -0
  38. package/backend/dist/middleware/coordinatedRateLimit.js.map +1 -0
  39. package/backend/dist/middleware/sharedRateLimit.d.ts +26 -0
  40. package/backend/dist/middleware/sharedRateLimit.d.ts.map +1 -0
  41. package/backend/dist/middleware/sharedRateLimit.js +99 -0
  42. package/backend/dist/middleware/sharedRateLimit.js.map +1 -0
  43. package/backend/dist/models/personaModel.d.ts +1 -26
  44. package/backend/dist/models/personaModel.d.ts.map +1 -1
  45. package/backend/dist/models/personaModel.js +54 -247
  46. package/backend/dist/models/personaModel.js.map +1 -1
  47. package/backend/dist/models/userModel.d.ts +23 -66
  48. package/backend/dist/models/userModel.d.ts.map +1 -1
  49. package/backend/dist/models/userModel.js +110 -187
  50. package/backend/dist/models/userModel.js.map +1 -1
  51. package/backend/dist/persistence/chatGenerationTypes.d.ts +24 -0
  52. package/backend/dist/persistence/chatGenerationTypes.d.ts.map +1 -0
  53. package/backend/dist/persistence/chatGenerationTypes.js +7 -0
  54. package/backend/dist/persistence/chatGenerationTypes.js.map +1 -0
  55. package/backend/dist/persistence/extensionTypes.d.ts +185 -0
  56. package/backend/dist/persistence/extensionTypes.d.ts.map +1 -0
  57. package/backend/dist/persistence/extensionTypes.js +13 -0
  58. package/backend/dist/persistence/extensionTypes.js.map +1 -0
  59. package/backend/dist/persistence/identityDeletionTypes.d.ts +16 -0
  60. package/backend/dist/persistence/identityDeletionTypes.d.ts.map +1 -0
  61. package/backend/dist/persistence/identityDeletionTypes.js +7 -0
  62. package/backend/dist/persistence/identityDeletionTypes.js.map +1 -0
  63. package/backend/dist/persistence/index.d.ts +48 -0
  64. package/backend/dist/persistence/index.d.ts.map +1 -0
  65. package/backend/dist/persistence/index.js +159 -0
  66. package/backend/dist/persistence/index.js.map +1 -0
  67. package/backend/dist/persistence/postgresConfig.d.ts +32 -0
  68. package/backend/dist/persistence/postgresConfig.d.ts.map +1 -0
  69. package/backend/dist/persistence/postgresConfig.js +91 -0
  70. package/backend/dist/persistence/postgresConfig.js.map +1 -0
  71. package/backend/dist/persistence/postgresCoreMigration.d.ts +8 -0
  72. package/backend/dist/persistence/postgresCoreMigration.d.ts.map +1 -0
  73. package/backend/dist/persistence/postgresCoreMigration.js +179 -0
  74. package/backend/dist/persistence/postgresCoreMigration.js.map +1 -0
  75. package/backend/dist/persistence/postgresDatabase.d.ts +40 -0
  76. package/backend/dist/persistence/postgresDatabase.d.ts.map +1 -0
  77. package/backend/dist/persistence/postgresDatabase.js +148 -0
  78. package/backend/dist/persistence/postgresDatabase.js.map +1 -0
  79. package/backend/dist/persistence/postgresExtensionMigration.d.ts +4 -0
  80. package/backend/dist/persistence/postgresExtensionMigration.d.ts.map +1 -0
  81. package/backend/dist/persistence/postgresExtensionMigration.js +143 -0
  82. package/backend/dist/persistence/postgresExtensionMigration.js.map +1 -0
  83. package/backend/dist/persistence/postgresExtensionRepositories.d.ts +6 -0
  84. package/backend/dist/persistence/postgresExtensionRepositories.d.ts.map +1 -0
  85. package/backend/dist/persistence/postgresExtensionRepositories.js +550 -0
  86. package/backend/dist/persistence/postgresExtensionRepositories.js.map +1 -0
  87. package/backend/dist/persistence/postgresImportState.d.ts +9 -0
  88. package/backend/dist/persistence/postgresImportState.d.ts.map +1 -0
  89. package/backend/dist/persistence/postgresImportState.js +64 -0
  90. package/backend/dist/persistence/postgresImportState.js.map +1 -0
  91. package/backend/dist/persistence/postgresMigrationRegistry.d.ts +4 -0
  92. package/backend/dist/persistence/postgresMigrationRegistry.d.ts.map +1 -0
  93. package/backend/dist/persistence/postgresMigrationRegistry.js +33 -0
  94. package/backend/dist/persistence/postgresMigrationRegistry.js.map +1 -0
  95. package/backend/dist/persistence/postgresMigrationTypes.d.ts +24 -0
  96. package/backend/dist/persistence/postgresMigrationTypes.d.ts.map +1 -0
  97. package/backend/dist/persistence/postgresMigrationTypes.js +7 -0
  98. package/backend/dist/persistence/postgresMigrationTypes.js.map +1 -0
  99. package/backend/dist/persistence/postgresMigrations.d.ts +15 -0
  100. package/backend/dist/persistence/postgresMigrations.d.ts.map +1 -0
  101. package/backend/dist/persistence/postgresMigrations.js +333 -0
  102. package/backend/dist/persistence/postgresMigrations.js.map +1 -0
  103. package/backend/dist/persistence/postgresPersistence.d.ts +17 -0
  104. package/backend/dist/persistence/postgresPersistence.d.ts.map +1 -0
  105. package/backend/dist/persistence/postgresPersistence.js +332 -0
  106. package/backend/dist/persistence/postgresPersistence.js.map +1 -0
  107. package/backend/dist/persistence/postgresPluginDefinitionMigration.d.ts +4 -0
  108. package/backend/dist/persistence/postgresPluginDefinitionMigration.d.ts.map +1 -0
  109. package/backend/dist/persistence/postgresPluginDefinitionMigration.js +40 -0
  110. package/backend/dist/persistence/postgresPluginDefinitionMigration.js.map +1 -0
  111. package/backend/dist/persistence/postgresResourceRepositories.d.ts +7 -0
  112. package/backend/dist/persistence/postgresResourceRepositories.d.ts.map +1 -0
  113. package/backend/dist/persistence/postgresResourceRepositories.js +776 -0
  114. package/backend/dist/persistence/postgresResourceRepositories.js.map +1 -0
  115. package/backend/dist/persistence/postgresSchemaInspector.d.ts +14 -0
  116. package/backend/dist/persistence/postgresSchemaInspector.d.ts.map +1 -0
  117. package/backend/dist/persistence/postgresSchemaInspector.js +817 -0
  118. package/backend/dist/persistence/postgresSchemaInspector.js.map +1 -0
  119. package/backend/dist/persistence/resourceTypes.d.ts +207 -0
  120. package/backend/dist/persistence/resourceTypes.d.ts.map +1 -0
  121. package/backend/dist/persistence/resourceTypes.js +38 -0
  122. package/backend/dist/persistence/resourceTypes.js.map +1 -0
  123. package/backend/dist/persistence/sqliteExtensionRepositories.d.ts +4 -0
  124. package/backend/dist/persistence/sqliteExtensionRepositories.d.ts.map +1 -0
  125. package/backend/dist/persistence/sqliteExtensionRepositories.js +494 -0
  126. package/backend/dist/persistence/sqliteExtensionRepositories.js.map +1 -0
  127. package/backend/dist/persistence/sqliteMigrations.d.ts +93 -0
  128. package/backend/dist/persistence/sqliteMigrations.d.ts.map +1 -0
  129. package/backend/dist/persistence/sqliteMigrations.js +2232 -0
  130. package/backend/dist/persistence/sqliteMigrations.js.map +1 -0
  131. package/backend/dist/persistence/sqlitePersistence.d.ts +23 -0
  132. package/backend/dist/persistence/sqlitePersistence.d.ts.map +1 -0
  133. package/backend/dist/persistence/sqlitePersistence.js +596 -0
  134. package/backend/dist/persistence/sqlitePersistence.js.map +1 -0
  135. package/backend/dist/persistence/sqliteResourceRepositories.d.ts +4 -0
  136. package/backend/dist/persistence/sqliteResourceRepositories.d.ts.map +1 -0
  137. package/backend/dist/persistence/sqliteResourceRepositories.js +663 -0
  138. package/backend/dist/persistence/sqliteResourceRepositories.js.map +1 -0
  139. package/backend/dist/persistence/sqliteSyncExecutor.d.ts +5 -0
  140. package/backend/dist/persistence/sqliteSyncExecutor.d.ts.map +1 -0
  141. package/backend/dist/persistence/sqliteSyncExecutor.js +19 -0
  142. package/backend/dist/persistence/sqliteSyncExecutor.js.map +1 -0
  143. package/backend/dist/persistence/sqliteToPostgresMigration.d.ts +80 -0
  144. package/backend/dist/persistence/sqliteToPostgresMigration.d.ts.map +1 -0
  145. package/backend/dist/persistence/sqliteToPostgresMigration.js +1543 -0
  146. package/backend/dist/persistence/sqliteToPostgresMigration.js.map +1 -0
  147. package/backend/dist/persistence/types.d.ts +131 -0
  148. package/backend/dist/persistence/types.d.ts.map +1 -0
  149. package/backend/dist/persistence/types.js +18 -0
  150. package/backend/dist/persistence/types.js.map +1 -0
  151. package/backend/dist/persistence/voiceProfileNameLookup.d.ts +9 -0
  152. package/backend/dist/persistence/voiceProfileNameLookup.d.ts.map +1 -0
  153. package/backend/dist/persistence/voiceProfileNameLookup.js +15 -0
  154. package/backend/dist/persistence/voiceProfileNameLookup.js.map +1 -0
  155. package/backend/dist/platform/coordination/index.d.ts +7 -0
  156. package/backend/dist/platform/coordination/index.d.ts.map +1 -0
  157. package/backend/dist/platform/coordination/index.js +24 -0
  158. package/backend/dist/platform/coordination/index.js.map +1 -0
  159. package/backend/dist/platform/coordination/localCoordinator.d.ts +49 -0
  160. package/backend/dist/platform/coordination/localCoordinator.d.ts.map +1 -0
  161. package/backend/dist/platform/coordination/localCoordinator.js +380 -0
  162. package/backend/dist/platform/coordination/localCoordinator.js.map +1 -0
  163. package/backend/dist/platform/coordination/redisCoordinator.d.ts +83 -0
  164. package/backend/dist/platform/coordination/redisCoordinator.d.ts.map +1 -0
  165. package/backend/dist/platform/coordination/redisCoordinator.js +726 -0
  166. package/backend/dist/platform/coordination/redisCoordinator.js.map +1 -0
  167. package/backend/dist/platform/coordination/service.d.ts +11 -0
  168. package/backend/dist/platform/coordination/service.d.ts.map +1 -0
  169. package/backend/dist/platform/coordination/service.js +55 -0
  170. package/backend/dist/platform/coordination/service.js.map +1 -0
  171. package/backend/dist/platform/coordination/sharedAdmission.d.ts +53 -0
  172. package/backend/dist/platform/coordination/sharedAdmission.d.ts.map +1 -0
  173. package/backend/dist/platform/coordination/sharedAdmission.js +194 -0
  174. package/backend/dist/platform/coordination/sharedAdmission.js.map +1 -0
  175. package/backend/dist/platform/coordination/types.d.ts +76 -0
  176. package/backend/dist/platform/coordination/types.d.ts.map +1 -0
  177. package/backend/dist/platform/coordination/types.js +32 -0
  178. package/backend/dist/platform/coordination/types.js.map +1 -0
  179. package/backend/dist/platform/events/durableEventGateway.d.ts +54 -0
  180. package/backend/dist/platform/events/durableEventGateway.d.ts.map +1 -0
  181. package/backend/dist/platform/events/durableEventGateway.js +262 -0
  182. package/backend/dist/platform/events/durableEventGateway.js.map +1 -0
  183. package/backend/dist/platform/events/index.d.ts +3 -0
  184. package/backend/dist/platform/events/index.d.ts.map +1 -0
  185. package/backend/dist/platform/events/index.js +8 -0
  186. package/backend/dist/platform/events/index.js.map +1 -0
  187. package/backend/dist/platform/events/service.d.ts +8 -0
  188. package/backend/dist/platform/events/service.d.ts.map +1 -0
  189. package/backend/dist/platform/events/service.js +25 -0
  190. package/backend/dist/platform/events/service.js.map +1 -0
  191. package/backend/dist/platform/jobs/chatGenerationEnqueuer.d.ts +3 -0
  192. package/backend/dist/platform/jobs/chatGenerationEnqueuer.d.ts.map +1 -0
  193. package/backend/dist/platform/jobs/chatGenerationEnqueuer.js +55 -0
  194. package/backend/dist/platform/jobs/chatGenerationEnqueuer.js.map +1 -0
  195. package/backend/dist/platform/jobs/documentIngestionEnqueuer.d.ts +3 -0
  196. package/backend/dist/platform/jobs/documentIngestionEnqueuer.d.ts.map +1 -0
  197. package/backend/dist/platform/jobs/documentIngestionEnqueuer.js +38 -0
  198. package/backend/dist/platform/jobs/documentIngestionEnqueuer.js.map +1 -0
  199. package/backend/dist/platform/jobs/domainJobContracts.d.ts +30 -0
  200. package/backend/dist/platform/jobs/domainJobContracts.d.ts.map +1 -0
  201. package/backend/dist/platform/jobs/domainJobContracts.js +53 -0
  202. package/backend/dist/platform/jobs/domainJobContracts.js.map +1 -0
  203. package/backend/dist/platform/jobs/domainJobHandlers.d.ts +11 -0
  204. package/backend/dist/platform/jobs/domainJobHandlers.d.ts.map +1 -0
  205. package/backend/dist/platform/jobs/domainJobHandlers.js +612 -0
  206. package/backend/dist/platform/jobs/domainJobHandlers.js.map +1 -0
  207. package/backend/dist/platform/jobs/durableEventIdentity.d.ts +8 -0
  208. package/backend/dist/platform/jobs/durableEventIdentity.d.ts.map +1 -0
  209. package/backend/dist/platform/jobs/durableEventIdentity.js +33 -0
  210. package/backend/dist/platform/jobs/durableEventIdentity.js.map +1 -0
  211. package/backend/dist/platform/jobs/durableJobRuntime.d.ts +57 -0
  212. package/backend/dist/platform/jobs/durableJobRuntime.d.ts.map +1 -0
  213. package/backend/dist/platform/jobs/durableJobRuntime.js +131 -0
  214. package/backend/dist/platform/jobs/durableJobRuntime.js.map +1 -0
  215. package/backend/dist/platform/jobs/durableJobRuntimeBackend.d.ts +28 -0
  216. package/backend/dist/platform/jobs/durableJobRuntimeBackend.d.ts.map +1 -0
  217. package/backend/dist/platform/jobs/durableJobRuntimeBackend.js +62 -0
  218. package/backend/dist/platform/jobs/durableJobRuntimeBackend.js.map +1 -0
  219. package/backend/dist/platform/jobs/durableJobService.d.ts +85 -0
  220. package/backend/dist/platform/jobs/durableJobService.d.ts.map +1 -0
  221. package/backend/dist/platform/jobs/durableJobService.js +726 -0
  222. package/backend/dist/platform/jobs/durableJobService.js.map +1 -0
  223. package/backend/dist/platform/jobs/durableJobTypes.d.ts +195 -0
  224. package/backend/dist/platform/jobs/durableJobTypes.d.ts.map +1 -0
  225. package/backend/dist/platform/jobs/durableJobTypes.js +72 -0
  226. package/backend/dist/platform/jobs/durableJobTypes.js.map +1 -0
  227. package/backend/dist/platform/jobs/embeddedDurableJobWorker.d.ts +87 -0
  228. package/backend/dist/platform/jobs/embeddedDurableJobWorker.d.ts.map +1 -0
  229. package/backend/dist/platform/jobs/embeddedDurableJobWorker.js +429 -0
  230. package/backend/dist/platform/jobs/embeddedDurableJobWorker.js.map +1 -0
  231. package/backend/dist/platform/jobs/identityDeletionEnqueuer.d.ts +3 -0
  232. package/backend/dist/platform/jobs/identityDeletionEnqueuer.d.ts.map +1 -0
  233. package/backend/dist/platform/jobs/identityDeletionEnqueuer.js +36 -0
  234. package/backend/dist/platform/jobs/identityDeletionEnqueuer.js.map +1 -0
  235. package/backend/dist/platform/jobs/index.d.ts +18 -0
  236. package/backend/dist/platform/jobs/index.d.ts.map +1 -0
  237. package/backend/dist/platform/jobs/index.js +34 -0
  238. package/backend/dist/platform/jobs/index.js.map +1 -0
  239. package/backend/dist/platform/jobs/postgresDurableEventIdempotencyMigration.d.ts +4 -0
  240. package/backend/dist/platform/jobs/postgresDurableEventIdempotencyMigration.d.ts.map +1 -0
  241. package/backend/dist/platform/jobs/postgresDurableEventIdempotencyMigration.js +25 -0
  242. package/backend/dist/platform/jobs/postgresDurableEventIdempotencyMigration.js.map +1 -0
  243. package/backend/dist/platform/jobs/postgresDurableEventReplayIndexMigration.d.ts +4 -0
  244. package/backend/dist/platform/jobs/postgresDurableEventReplayIndexMigration.d.ts.map +1 -0
  245. package/backend/dist/platform/jobs/postgresDurableEventReplayIndexMigration.js +23 -0
  246. package/backend/dist/platform/jobs/postgresDurableEventReplayIndexMigration.js.map +1 -0
  247. package/backend/dist/platform/jobs/postgresDurableJobMigration.d.ts +11 -0
  248. package/backend/dist/platform/jobs/postgresDurableJobMigration.d.ts.map +1 -0
  249. package/backend/dist/platform/jobs/postgresDurableJobMigration.js +106 -0
  250. package/backend/dist/platform/jobs/postgresDurableJobMigration.js.map +1 -0
  251. package/backend/dist/platform/jobs/postgresDurableJobRepository.d.ts +88 -0
  252. package/backend/dist/platform/jobs/postgresDurableJobRepository.d.ts.map +1 -0
  253. package/backend/dist/platform/jobs/postgresDurableJobRepository.js +1185 -0
  254. package/backend/dist/platform/jobs/postgresDurableJobRepository.js.map +1 -0
  255. package/backend/dist/platform/jobs/postgresDurableJobService.d.ts +86 -0
  256. package/backend/dist/platform/jobs/postgresDurableJobService.d.ts.map +1 -0
  257. package/backend/dist/platform/jobs/postgresDurableJobService.js +696 -0
  258. package/backend/dist/platform/jobs/postgresDurableJobService.js.map +1 -0
  259. package/backend/dist/platform/jobs/postgresDurableJobWorker.d.ts +53 -0
  260. package/backend/dist/platform/jobs/postgresDurableJobWorker.d.ts.map +1 -0
  261. package/backend/dist/platform/jobs/postgresDurableJobWorker.js +393 -0
  262. package/backend/dist/platform/jobs/postgresDurableJobWorker.js.map +1 -0
  263. package/backend/dist/platform/jobs/resourceDeletionEnqueuer.d.ts +3 -0
  264. package/backend/dist/platform/jobs/resourceDeletionEnqueuer.d.ts.map +1 -0
  265. package/backend/dist/platform/jobs/resourceDeletionEnqueuer.js +43 -0
  266. package/backend/dist/platform/jobs/resourceDeletionEnqueuer.js.map +1 -0
  267. package/backend/dist/platform/jobs/sqliteDurableJobRepository.d.ts +166 -0
  268. package/backend/dist/platform/jobs/sqliteDurableJobRepository.d.ts.map +1 -0
  269. package/backend/dist/platform/jobs/sqliteDurableJobRepository.js +1008 -0
  270. package/backend/dist/platform/jobs/sqliteDurableJobRepository.js.map +1 -0
  271. package/backend/dist/platform/jobs/videoGenerationEnqueuer.d.ts +4 -0
  272. package/backend/dist/platform/jobs/videoGenerationEnqueuer.d.ts.map +1 -0
  273. package/backend/dist/platform/jobs/videoGenerationEnqueuer.js +46 -0
  274. package/backend/dist/platform/jobs/videoGenerationEnqueuer.js.map +1 -0
  275. package/backend/dist/platform/jobs/workExecutionEnqueuer.d.ts +3 -0
  276. package/backend/dist/platform/jobs/workExecutionEnqueuer.d.ts.map +1 -0
  277. package/backend/dist/platform/jobs/workExecutionEnqueuer.js +38 -0
  278. package/backend/dist/platform/jobs/workExecutionEnqueuer.js.map +1 -0
  279. package/backend/dist/platform/ollamaRuntimeConfig.d.ts +40 -0
  280. package/backend/dist/platform/ollamaRuntimeConfig.d.ts.map +1 -0
  281. package/backend/dist/platform/ollamaRuntimeConfig.js +72 -0
  282. package/backend/dist/platform/ollamaRuntimeConfig.js.map +1 -0
  283. package/backend/dist/platform/recovery/backupArchive.d.ts +120 -0
  284. package/backend/dist/platform/recovery/backupArchive.d.ts.map +1 -0
  285. package/backend/dist/platform/recovery/backupArchive.js +842 -0
  286. package/backend/dist/platform/recovery/backupArchive.js.map +1 -0
  287. package/backend/dist/platform/recovery/index.d.ts +3 -0
  288. package/backend/dist/platform/recovery/index.d.ts.map +1 -0
  289. package/backend/dist/platform/recovery/index.js +8 -0
  290. package/backend/dist/platform/recovery/index.js.map +1 -0
  291. package/backend/dist/platform/recovery/teamBackupArchive.d.ts +98 -0
  292. package/backend/dist/platform/recovery/teamBackupArchive.d.ts.map +1 -0
  293. package/backend/dist/platform/recovery/teamBackupArchive.js +1203 -0
  294. package/backend/dist/platform/recovery/teamBackupArchive.js.map +1 -0
  295. package/backend/dist/platform/runtimeConfig.d.ts +70 -0
  296. package/backend/dist/platform/runtimeConfig.d.ts.map +1 -0
  297. package/backend/dist/platform/runtimeConfig.js +205 -0
  298. package/backend/dist/platform/runtimeConfig.js.map +1 -0
  299. package/backend/dist/platform/storage/aesGcmKeyring.d.ts +26 -0
  300. package/backend/dist/platform/storage/aesGcmKeyring.d.ts.map +1 -0
  301. package/backend/dist/platform/storage/aesGcmKeyring.js +135 -0
  302. package/backend/dist/platform/storage/aesGcmKeyring.js.map +1 -0
  303. package/backend/dist/platform/storage/blobReferenceRepository.d.ts +36 -0
  304. package/backend/dist/platform/storage/blobReferenceRepository.d.ts.map +1 -0
  305. package/backend/dist/platform/storage/blobReferenceRepository.js +117 -0
  306. package/backend/dist/platform/storage/blobReferenceRepository.js.map +1 -0
  307. package/backend/dist/platform/storage/blobStore.d.ts +111 -0
  308. package/backend/dist/platform/storage/blobStore.d.ts.map +1 -0
  309. package/backend/dist/platform/storage/blobStore.js +46 -0
  310. package/backend/dist/platform/storage/blobStore.js.map +1 -0
  311. package/backend/dist/platform/storage/documentVectorIndex.d.ts +44 -0
  312. package/backend/dist/platform/storage/documentVectorIndex.d.ts.map +1 -0
  313. package/backend/dist/platform/storage/documentVectorIndex.js +110 -0
  314. package/backend/dist/platform/storage/documentVectorIndex.js.map +1 -0
  315. package/backend/dist/platform/storage/durableBlobQuotaPolicy.d.ts +82 -0
  316. package/backend/dist/platform/storage/durableBlobQuotaPolicy.d.ts.map +1 -0
  317. package/backend/dist/platform/storage/durableBlobQuotaPolicy.js +583 -0
  318. package/backend/dist/platform/storage/durableBlobQuotaPolicy.js.map +1 -0
  319. package/backend/dist/platform/storage/index.d.ts +19 -0
  320. package/backend/dist/platform/storage/index.d.ts.map +1 -0
  321. package/backend/dist/platform/storage/index.js +35 -0
  322. package/backend/dist/platform/storage/index.js.map +1 -0
  323. package/backend/dist/platform/storage/localEncryptedBlobStore.d.ts +120 -0
  324. package/backend/dist/platform/storage/localEncryptedBlobStore.d.ts.map +1 -0
  325. package/backend/dist/platform/storage/localEncryptedBlobStore.js +1205 -0
  326. package/backend/dist/platform/storage/localEncryptedBlobStore.js.map +1 -0
  327. package/backend/dist/platform/storage/personaMemoryIndexing.d.ts +12 -0
  328. package/backend/dist/platform/storage/personaMemoryIndexing.d.ts.map +1 -0
  329. package/backend/dist/platform/storage/personaMemoryIndexing.js +25 -0
  330. package/backend/dist/platform/storage/personaMemoryIndexing.js.map +1 -0
  331. package/backend/dist/platform/storage/pgVectorStore.d.ts +37 -0
  332. package/backend/dist/platform/storage/pgVectorStore.d.ts.map +1 -0
  333. package/backend/dist/platform/storage/pgVectorStore.js +493 -0
  334. package/backend/dist/platform/storage/pgVectorStore.js.map +1 -0
  335. package/backend/dist/platform/storage/platformDomainRepositories.d.ts +244 -0
  336. package/backend/dist/platform/storage/platformDomainRepositories.d.ts.map +1 -0
  337. package/backend/dist/platform/storage/platformDomainRepositories.js +7 -0
  338. package/backend/dist/platform/storage/platformDomainRepositories.js.map +1 -0
  339. package/backend/dist/platform/storage/platformStorageRuntime.d.ts +35 -0
  340. package/backend/dist/platform/storage/platformStorageRuntime.d.ts.map +1 -0
  341. package/backend/dist/platform/storage/platformStorageRuntime.js +299 -0
  342. package/backend/dist/platform/storage/platformStorageRuntime.js.map +1 -0
  343. package/backend/dist/platform/storage/postgresPlatformDomainRepositories.d.ts +4 -0
  344. package/backend/dist/platform/storage/postgresPlatformDomainRepositories.d.ts.map +1 -0
  345. package/backend/dist/platform/storage/postgresPlatformDomainRepositories.js +1017 -0
  346. package/backend/dist/platform/storage/postgresPlatformDomainRepositories.js.map +1 -0
  347. package/backend/dist/platform/storage/postgresResourceDeletionLifecycleMigration.d.ts +4 -0
  348. package/backend/dist/platform/storage/postgresResourceDeletionLifecycleMigration.d.ts.map +1 -0
  349. package/backend/dist/platform/storage/postgresResourceDeletionLifecycleMigration.js +40 -0
  350. package/backend/dist/platform/storage/postgresResourceDeletionLifecycleMigration.js.map +1 -0
  351. package/backend/dist/platform/storage/resourceContentCleanup.d.ts +29 -0
  352. package/backend/dist/platform/storage/resourceContentCleanup.d.ts.map +1 -0
  353. package/backend/dist/platform/storage/resourceContentCleanup.js +100 -0
  354. package/backend/dist/platform/storage/resourceContentCleanup.js.map +1 -0
  355. package/backend/dist/platform/storage/resourceDeletionLifecycle.d.ts +14 -0
  356. package/backend/dist/platform/storage/resourceDeletionLifecycle.d.ts.map +1 -0
  357. package/backend/dist/platform/storage/resourceDeletionLifecycle.js +31 -0
  358. package/backend/dist/platform/storage/resourceDeletionLifecycle.js.map +1 -0
  359. package/backend/dist/platform/storage/s3EncryptedBlobStore.d.ts +140 -0
  360. package/backend/dist/platform/storage/s3EncryptedBlobStore.d.ts.map +1 -0
  361. package/backend/dist/platform/storage/s3EncryptedBlobStore.js +1309 -0
  362. package/backend/dist/platform/storage/s3EncryptedBlobStore.js.map +1 -0
  363. package/backend/dist/platform/storage/sqliteEncryptedVectorStore.d.ts +71 -0
  364. package/backend/dist/platform/storage/sqliteEncryptedVectorStore.d.ts.map +1 -0
  365. package/backend/dist/platform/storage/sqliteEncryptedVectorStore.js +766 -0
  366. package/backend/dist/platform/storage/sqliteEncryptedVectorStore.js.map +1 -0
  367. package/backend/dist/platform/storage/sqlitePlatformDomainRepositories.d.ts +4 -0
  368. package/backend/dist/platform/storage/sqlitePlatformDomainRepositories.d.ts.map +1 -0
  369. package/backend/dist/platform/storage/sqlitePlatformDomainRepositories.js +1037 -0
  370. package/backend/dist/platform/storage/sqlitePlatformDomainRepositories.js.map +1 -0
  371. package/backend/dist/platform/storage/sqliteToTeamStorageMigration.d.ts +25 -0
  372. package/backend/dist/platform/storage/sqliteToTeamStorageMigration.d.ts.map +1 -0
  373. package/backend/dist/platform/storage/sqliteToTeamStorageMigration.js +1292 -0
  374. package/backend/dist/platform/storage/sqliteToTeamStorageMigration.js.map +1 -0
  375. package/backend/dist/platform/storage/storageFactory.d.ts +81 -0
  376. package/backend/dist/platform/storage/storageFactory.d.ts.map +1 -0
  377. package/backend/dist/platform/storage/storageFactory.js +518 -0
  378. package/backend/dist/platform/storage/storageFactory.js.map +1 -0
  379. package/backend/dist/platform/storage/storageSchemaContracts.d.ts +22 -0
  380. package/backend/dist/platform/storage/storageSchemaContracts.d.ts.map +1 -0
  381. package/backend/dist/platform/storage/storageSchemaContracts.js +299 -0
  382. package/backend/dist/platform/storage/storageSchemaContracts.js.map +1 -0
  383. package/backend/dist/platform/storage/vectorStore.d.ts +117 -0
  384. package/backend/dist/platform/storage/vectorStore.d.ts.map +1 -0
  385. package/backend/dist/platform/storage/vectorStore.js +40 -0
  386. package/backend/dist/platform/storage/vectorStore.js.map +1 -0
  387. package/backend/dist/platform/workPersistence/index.d.ts +9 -0
  388. package/backend/dist/platform/workPersistence/index.d.ts.map +1 -0
  389. package/backend/dist/platform/workPersistence/index.js +14 -0
  390. package/backend/dist/platform/workPersistence/index.js.map +1 -0
  391. package/backend/dist/platform/workPersistence/postgresWorkLifecycleMigration.d.ts +9 -0
  392. package/backend/dist/platform/workPersistence/postgresWorkLifecycleMigration.d.ts.map +1 -0
  393. package/backend/dist/platform/workPersistence/postgresWorkLifecycleMigration.js +47 -0
  394. package/backend/dist/platform/workPersistence/postgresWorkLifecycleMigration.js.map +1 -0
  395. package/backend/dist/platform/workPersistence/postgresWorkMessageContentMigration.d.ts +3 -0
  396. package/backend/dist/platform/workPersistence/postgresWorkMessageContentMigration.d.ts.map +1 -0
  397. package/backend/dist/platform/workPersistence/postgresWorkMessageContentMigration.js +28 -0
  398. package/backend/dist/platform/workPersistence/postgresWorkMessageContentMigration.js.map +1 -0
  399. package/backend/dist/platform/workPersistence/postgresWorkMigration.d.ts +3 -0
  400. package/backend/dist/platform/workPersistence/postgresWorkMigration.d.ts.map +1 -0
  401. package/backend/dist/platform/workPersistence/postgresWorkMigration.js +101 -0
  402. package/backend/dist/platform/workPersistence/postgresWorkMigration.js.map +1 -0
  403. package/backend/dist/platform/workPersistence/postgresWorkPersistence.d.ts +79 -0
  404. package/backend/dist/platform/workPersistence/postgresWorkPersistence.d.ts.map +1 -0
  405. package/backend/dist/platform/workPersistence/postgresWorkPersistence.js +521 -0
  406. package/backend/dist/platform/workPersistence/postgresWorkPersistence.js.map +1 -0
  407. package/backend/dist/platform/workPersistence/service.d.ts +6 -0
  408. package/backend/dist/platform/workPersistence/service.d.ts.map +1 -0
  409. package/backend/dist/platform/workPersistence/service.js +27 -0
  410. package/backend/dist/platform/workPersistence/service.js.map +1 -0
  411. package/backend/dist/platform/workPersistence/sqliteWorkPersistence.d.ts +77 -0
  412. package/backend/dist/platform/workPersistence/sqliteWorkPersistence.d.ts.map +1 -0
  413. package/backend/dist/platform/workPersistence/sqliteWorkPersistence.js +463 -0
  414. package/backend/dist/platform/workPersistence/sqliteWorkPersistence.js.map +1 -0
  415. package/backend/dist/platform/workPersistence/types.d.ts +159 -0
  416. package/backend/dist/platform/workPersistence/types.d.ts.map +1 -0
  417. package/backend/dist/platform/workPersistence/types.js +13 -0
  418. package/backend/dist/platform/workPersistence/types.js.map +1 -0
  419. package/backend/dist/platform/workPersistence/workExecutionTypes.d.ts +13 -0
  420. package/backend/dist/platform/workPersistence/workExecutionTypes.d.ts.map +1 -0
  421. package/backend/dist/platform/workPersistence/workExecutionTypes.js +7 -0
  422. package/backend/dist/platform/workPersistence/workExecutionTypes.js.map +1 -0
  423. package/backend/dist/platform/workPersistence/workMessageContentCodec.d.ts +8 -0
  424. package/backend/dist/platform/workPersistence/workMessageContentCodec.d.ts.map +1 -0
  425. package/backend/dist/platform/workPersistence/workMessageContentCodec.js +25 -0
  426. package/backend/dist/platform/workPersistence/workMessageContentCodec.js.map +1 -0
  427. package/backend/dist/platform/workPersistence/workTextSafety.d.ts +3 -0
  428. package/backend/dist/platform/workPersistence/workTextSafety.d.ts.map +1 -0
  429. package/backend/dist/platform/workPersistence/workTextSafety.js +8 -0
  430. package/backend/dist/platform/workPersistence/workTextSafety.js.map +1 -0
  431. package/backend/dist/routes/agentCli.js +1 -1
  432. package/backend/dist/routes/agentCli.js.map +1 -1
  433. package/backend/dist/routes/artifacts.d.ts.map +1 -1
  434. package/backend/dist/routes/artifacts.js +2 -1
  435. package/backend/dist/routes/artifacts.js.map +1 -1
  436. package/backend/dist/routes/auth.d.ts.map +1 -1
  437. package/backend/dist/routes/auth.js +64 -18
  438. package/backend/dist/routes/auth.js.map +1 -1
  439. package/backend/dist/routes/chat.d.ts.map +1 -1
  440. package/backend/dist/routes/chat.js +519 -85
  441. package/backend/dist/routes/chat.js.map +1 -1
  442. package/backend/dist/routes/documents.d.ts.map +1 -1
  443. package/backend/dist/routes/documents.js +134 -28
  444. package/backend/dist/routes/documents.js.map +1 -1
  445. package/backend/dist/routes/embeddings.d.ts.map +1 -1
  446. package/backend/dist/routes/embeddings.js +2 -1
  447. package/backend/dist/routes/embeddings.js.map +1 -1
  448. package/backend/dist/routes/health.d.ts +3 -0
  449. package/backend/dist/routes/health.d.ts.map +1 -0
  450. package/backend/dist/routes/health.js +52 -0
  451. package/backend/dist/routes/health.js.map +1 -0
  452. package/backend/dist/routes/huggingfaceHub.d.ts.map +1 -1
  453. package/backend/dist/routes/huggingfaceHub.js +2 -1
  454. package/backend/dist/routes/huggingfaceHub.js.map +1 -1
  455. package/backend/dist/routes/imageGen.d.ts.map +1 -1
  456. package/backend/dist/routes/imageGen.js +42 -10
  457. package/backend/dist/routes/imageGen.js.map +1 -1
  458. package/backend/dist/routes/jobs.d.ts +3 -0
  459. package/backend/dist/routes/jobs.d.ts.map +1 -0
  460. package/backend/dist/routes/jobs.js +117 -0
  461. package/backend/dist/routes/jobs.js.map +1 -0
  462. package/backend/dist/routes/libreClaw.d.ts.map +1 -1
  463. package/backend/dist/routes/libreClaw.js +10 -7
  464. package/backend/dist/routes/libreClaw.js.map +1 -1
  465. package/backend/dist/routes/media.d.ts.map +1 -1
  466. package/backend/dist/routes/media.js +523 -77
  467. package/backend/dist/routes/media.js.map +1 -1
  468. package/backend/dist/routes/notes.d.ts.map +1 -1
  469. package/backend/dist/routes/notes.js +21 -21
  470. package/backend/dist/routes/notes.js.map +1 -1
  471. package/backend/dist/routes/ollama.d.ts.map +1 -1
  472. package/backend/dist/routes/ollama.js +40 -12
  473. package/backend/dist/routes/ollama.js.map +1 -1
  474. package/backend/dist/routes/personas.d.ts.map +1 -1
  475. package/backend/dist/routes/personas.js +4 -2
  476. package/backend/dist/routes/personas.js.map +1 -1
  477. package/backend/dist/routes/plugins.d.ts.map +1 -1
  478. package/backend/dist/routes/plugins.js +79 -51
  479. package/backend/dist/routes/plugins.js.map +1 -1
  480. package/backend/dist/routes/preferences.d.ts.map +1 -1
  481. package/backend/dist/routes/preferences.js +290 -25
  482. package/backend/dist/routes/preferences.js.map +1 -1
  483. package/backend/dist/routes/search.d.ts.map +1 -1
  484. package/backend/dist/routes/search.js +23 -14
  485. package/backend/dist/routes/search.js.map +1 -1
  486. package/backend/dist/routes/stt.d.ts +9 -0
  487. package/backend/dist/routes/stt.d.ts.map +1 -0
  488. package/backend/dist/routes/stt.js +217 -0
  489. package/backend/dist/routes/stt.js.map +1 -0
  490. package/backend/dist/routes/systemDiagnostics.d.ts.map +1 -1
  491. package/backend/dist/routes/systemDiagnostics.js +2 -1
  492. package/backend/dist/routes/systemDiagnostics.js.map +1 -1
  493. package/backend/dist/routes/tts.d.ts.map +1 -1
  494. package/backend/dist/routes/tts.js +577 -28
  495. package/backend/dist/routes/tts.js.map +1 -1
  496. package/backend/dist/routes/users.d.ts.map +1 -1
  497. package/backend/dist/routes/users.js +16 -25
  498. package/backend/dist/routes/users.js.map +1 -1
  499. package/backend/dist/routes/work.d.ts.map +1 -1
  500. package/backend/dist/routes/work.js +167 -113
  501. package/backend/dist/routes/work.js.map +1 -1
  502. package/backend/dist/services/agentAccessService.d.ts +2 -2
  503. package/backend/dist/services/agentAccessService.d.ts.map +1 -1
  504. package/backend/dist/services/agentAccessService.js +5 -14
  505. package/backend/dist/services/agentAccessService.js.map +1 -1
  506. package/backend/dist/services/agentCliService.d.ts +3 -2
  507. package/backend/dist/services/agentCliService.d.ts.map +1 -1
  508. package/backend/dist/services/agentCliService.js +44 -16
  509. package/backend/dist/services/agentCliService.js.map +1 -1
  510. package/backend/dist/services/assistantCompletionService.d.ts +2 -1
  511. package/backend/dist/services/assistantCompletionService.d.ts.map +1 -1
  512. package/backend/dist/services/assistantCompletionService.js +7 -3
  513. package/backend/dist/services/assistantCompletionService.js.map +1 -1
  514. package/backend/dist/services/authService.d.ts +7 -2
  515. package/backend/dist/services/authService.d.ts.map +1 -1
  516. package/backend/dist/services/authService.js +23 -10
  517. package/backend/dist/services/authService.js.map +1 -1
  518. package/backend/dist/services/chatGenerationService.d.ts +5 -4
  519. package/backend/dist/services/chatGenerationService.d.ts.map +1 -1
  520. package/backend/dist/services/chatGenerationService.js +23 -17
  521. package/backend/dist/services/chatGenerationService.js.map +1 -1
  522. package/backend/dist/services/chatRequestService.d.ts +4 -3
  523. package/backend/dist/services/chatRequestService.d.ts.map +1 -1
  524. package/backend/dist/services/chatRequestService.js +3 -3
  525. package/backend/dist/services/chatRequestService.js.map +1 -1
  526. package/backend/dist/services/chatService.d.ts +66 -16
  527. package/backend/dist/services/chatService.d.ts.map +1 -1
  528. package/backend/dist/services/chatService.js +402 -111
  529. package/backend/dist/services/chatService.js.map +1 -1
  530. package/backend/dist/services/codexOAuthService.d.ts +2 -2
  531. package/backend/dist/services/codexOAuthService.d.ts.map +1 -1
  532. package/backend/dist/services/codexOAuthService.js +63 -7
  533. package/backend/dist/services/codexOAuthService.js.map +1 -1
  534. package/backend/dist/services/dataArchiveService.d.ts +88 -0
  535. package/backend/dist/services/dataArchiveService.d.ts.map +1 -0
  536. package/backend/dist/services/dataArchiveService.js +1027 -0
  537. package/backend/dist/services/dataArchiveService.js.map +1 -0
  538. package/backend/dist/services/documentService.d.ts +67 -14
  539. package/backend/dist/services/documentService.d.ts.map +1 -1
  540. package/backend/dist/services/documentService.js +938 -193
  541. package/backend/dist/services/documentService.js.map +1 -1
  542. package/backend/dist/services/durableChatCompletion.d.ts +16 -0
  543. package/backend/dist/services/durableChatCompletion.d.ts.map +1 -0
  544. package/backend/dist/services/durableChatCompletion.js +34 -0
  545. package/backend/dist/services/durableChatCompletion.js.map +1 -0
  546. package/backend/dist/services/durableChatGenerationService.d.ts +19 -0
  547. package/backend/dist/services/durableChatGenerationService.d.ts.map +1 -0
  548. package/backend/dist/services/durableChatGenerationService.js +341 -0
  549. package/backend/dist/services/durableChatGenerationService.js.map +1 -0
  550. package/backend/dist/services/embeddingService.d.ts +1 -1
  551. package/backend/dist/services/embeddingService.d.ts.map +1 -1
  552. package/backend/dist/services/embeddingService.js +16 -13
  553. package/backend/dist/services/embeddingService.js.map +1 -1
  554. package/backend/dist/services/encryptionService.d.ts +28 -1
  555. package/backend/dist/services/encryptionService.d.ts.map +1 -1
  556. package/backend/dist/services/encryptionService.js +131 -51
  557. package/backend/dist/services/encryptionService.js.map +1 -1
  558. package/backend/dist/services/followUpService.d.ts +1 -1
  559. package/backend/dist/services/followUpService.d.ts.map +1 -1
  560. package/backend/dist/services/followUpService.js +1 -1
  561. package/backend/dist/services/followUpService.js.map +1 -1
  562. package/backend/dist/services/galleryService.d.ts +38 -37
  563. package/backend/dist/services/galleryService.d.ts.map +1 -1
  564. package/backend/dist/services/galleryService.js +356 -251
  565. package/backend/dist/services/galleryService.js.map +1 -1
  566. package/backend/dist/services/healthService.d.ts +65 -0
  567. package/backend/dist/services/healthService.d.ts.map +1 -0
  568. package/backend/dist/services/healthService.js +379 -0
  569. package/backend/dist/services/healthService.js.map +1 -0
  570. package/backend/dist/services/legacyCiphertextIntegrity.d.ts +40 -0
  571. package/backend/dist/services/legacyCiphertextIntegrity.d.ts.map +1 -0
  572. package/backend/dist/services/legacyCiphertextIntegrity.js +406 -0
  573. package/backend/dist/services/legacyCiphertextIntegrity.js.map +1 -0
  574. package/backend/dist/services/mediaGenerationJobService.d.ts +27 -5
  575. package/backend/dist/services/mediaGenerationJobService.d.ts.map +1 -1
  576. package/backend/dist/services/mediaGenerationJobService.js +185 -55
  577. package/backend/dist/services/mediaGenerationJobService.js.map +1 -1
  578. package/backend/dist/services/memoryService.d.ts +7 -83
  579. package/backend/dist/services/memoryService.d.ts.map +1 -1
  580. package/backend/dist/services/memoryService.js +428 -573
  581. package/backend/dist/services/memoryService.js.map +1 -1
  582. package/backend/dist/services/memoryUtils.d.ts.map +1 -1
  583. package/backend/dist/services/memoryUtils.js +8 -1
  584. package/backend/dist/services/memoryUtils.js.map +1 -1
  585. package/backend/dist/services/modelAccessService.d.ts +3 -3
  586. package/backend/dist/services/modelAccessService.d.ts.map +1 -1
  587. package/backend/dist/services/modelAccessService.js +8 -16
  588. package/backend/dist/services/modelAccessService.js.map +1 -1
  589. package/backend/dist/services/mutationEngineService.d.ts +0 -7
  590. package/backend/dist/services/mutationEngineService.d.ts.map +1 -1
  591. package/backend/dist/services/mutationEngineService.js +7 -78
  592. package/backend/dist/services/mutationEngineService.js.map +1 -1
  593. package/backend/dist/services/ollamaService.d.ts +4 -4
  594. package/backend/dist/services/ollamaService.d.ts.map +1 -1
  595. package/backend/dist/services/ollamaService.js +62 -31
  596. package/backend/dist/services/ollamaService.js.map +1 -1
  597. package/backend/dist/services/personaService.d.ts.map +1 -1
  598. package/backend/dist/services/personaService.js +19 -54
  599. package/backend/dist/services/personaService.js.map +1 -1
  600. package/backend/dist/services/pluginActivationService.d.ts +6 -5
  601. package/backend/dist/services/pluginActivationService.d.ts.map +1 -1
  602. package/backend/dist/services/pluginActivationService.js +36 -76
  603. package/backend/dist/services/pluginActivationService.js.map +1 -1
  604. package/backend/dist/services/pluginAudioGenerationService.d.ts +11 -6
  605. package/backend/dist/services/pluginAudioGenerationService.d.ts.map +1 -1
  606. package/backend/dist/services/pluginAudioGenerationService.js +74 -16
  607. package/backend/dist/services/pluginAudioGenerationService.js.map +1 -1
  608. package/backend/dist/services/pluginCacheInvalidation.d.ts +38 -0
  609. package/backend/dist/services/pluginCacheInvalidation.d.ts.map +1 -0
  610. package/backend/dist/services/pluginCacheInvalidation.js +198 -0
  611. package/backend/dist/services/pluginCacheInvalidation.js.map +1 -0
  612. package/backend/dist/services/pluginCapabilityRegistryService.d.ts +3 -3
  613. package/backend/dist/services/pluginCapabilityRegistryService.d.ts.map +1 -1
  614. package/backend/dist/services/pluginCapabilityRegistryService.js +11 -7
  615. package/backend/dist/services/pluginCapabilityRegistryService.js.map +1 -1
  616. package/backend/dist/services/pluginCredentialsService.d.ts +9 -8
  617. package/backend/dist/services/pluginCredentialsService.d.ts.map +1 -1
  618. package/backend/dist/services/pluginCredentialsService.js +48 -89
  619. package/backend/dist/services/pluginCredentialsService.js.map +1 -1
  620. package/backend/dist/services/pluginEmbeddingService.d.ts +8 -7
  621. package/backend/dist/services/pluginEmbeddingService.d.ts.map +1 -1
  622. package/backend/dist/services/pluginEmbeddingService.js +13 -11
  623. package/backend/dist/services/pluginEmbeddingService.js.map +1 -1
  624. package/backend/dist/services/pluginImageGenerationService.d.ts +10 -8
  625. package/backend/dist/services/pluginImageGenerationService.d.ts.map +1 -1
  626. package/backend/dist/services/pluginImageGenerationService.js +119 -14
  627. package/backend/dist/services/pluginImageGenerationService.js.map +1 -1
  628. package/backend/dist/services/pluginSTTService.d.ts +47 -0
  629. package/backend/dist/services/pluginSTTService.d.ts.map +1 -0
  630. package/backend/dist/services/pluginSTTService.js +199 -0
  631. package/backend/dist/services/pluginSTTService.js.map +1 -0
  632. package/backend/dist/services/pluginService.d.ts +94 -40
  633. package/backend/dist/services/pluginService.d.ts.map +1 -1
  634. package/backend/dist/services/pluginService.js +799 -274
  635. package/backend/dist/services/pluginService.js.map +1 -1
  636. package/backend/dist/services/pluginTTSService.d.ts +26 -8
  637. package/backend/dist/services/pluginTTSService.d.ts.map +1 -1
  638. package/backend/dist/services/pluginTTSService.js +277 -25
  639. package/backend/dist/services/pluginTTSService.js.map +1 -1
  640. package/backend/dist/services/pluginUsageService.d.ts +4 -4
  641. package/backend/dist/services/pluginUsageService.d.ts.map +1 -1
  642. package/backend/dist/services/pluginUsageService.js +44 -93
  643. package/backend/dist/services/pluginUsageService.js.map +1 -1
  644. package/backend/dist/services/pluginVariablesService.d.ts +14 -7
  645. package/backend/dist/services/pluginVariablesService.d.ts.map +1 -1
  646. package/backend/dist/services/pluginVariablesService.js +116 -81
  647. package/backend/dist/services/pluginVariablesService.js.map +1 -1
  648. package/backend/dist/services/pluginVideoGenerationService.d.ts +19 -8
  649. package/backend/dist/services/pluginVideoGenerationService.d.ts.map +1 -1
  650. package/backend/dist/services/pluginVideoGenerationService.js +116 -20
  651. package/backend/dist/services/pluginVideoGenerationService.js.map +1 -1
  652. package/backend/dist/services/preferencesService.d.ts +31 -21
  653. package/backend/dist/services/preferencesService.d.ts.map +1 -1
  654. package/backend/dist/services/preferencesService.js +104 -102
  655. package/backend/dist/services/preferencesService.js.map +1 -1
  656. package/backend/dist/services/recoveryInventoryService.d.ts +244 -0
  657. package/backend/dist/services/recoveryInventoryService.d.ts.map +1 -0
  658. package/backend/dist/services/recoveryInventoryService.js +1436 -0
  659. package/backend/dist/services/recoveryInventoryService.js.map +1 -0
  660. package/backend/dist/services/simpleGitHubOAuth.js +3 -3
  661. package/backend/dist/services/simpleGitHubOAuth.js.map +1 -1
  662. package/backend/dist/services/simpleHuggingFaceOAuth.d.ts.map +1 -1
  663. package/backend/dist/services/simpleHuggingFaceOAuth.js +3 -3
  664. package/backend/dist/services/simpleHuggingFaceOAuth.js.map +1 -1
  665. package/backend/dist/services/systemDiagnosticsService.d.ts.map +1 -1
  666. package/backend/dist/services/systemDiagnosticsService.js +2 -2
  667. package/backend/dist/services/systemDiagnosticsService.js.map +1 -1
  668. package/backend/dist/services/systemSettingsService.d.ts +5 -0
  669. package/backend/dist/services/systemSettingsService.d.ts.map +1 -0
  670. package/backend/dist/services/systemSettingsService.js +24 -0
  671. package/backend/dist/services/systemSettingsService.js.map +1 -0
  672. package/backend/dist/services/titleGenerationService.d.ts +1 -1
  673. package/backend/dist/services/titleGenerationService.d.ts.map +1 -1
  674. package/backend/dist/services/titleGenerationService.js +1 -1
  675. package/backend/dist/services/titleGenerationService.js.map +1 -1
  676. package/backend/dist/services/voiceProfileService.d.ts +44 -0
  677. package/backend/dist/services/voiceProfileService.d.ts.map +1 -0
  678. package/backend/dist/services/voiceProfileService.js +195 -0
  679. package/backend/dist/services/voiceProfileService.js.map +1 -0
  680. package/backend/dist/services/webSearchService.d.ts +7 -7
  681. package/backend/dist/services/webSearchService.d.ts.map +1 -1
  682. package/backend/dist/services/webSearchService.js +40 -35
  683. package/backend/dist/services/webSearchService.js.map +1 -1
  684. package/backend/dist/services/websocketTicketService.d.ts +39 -0
  685. package/backend/dist/services/websocketTicketService.d.ts.map +1 -0
  686. package/backend/dist/services/websocketTicketService.js +183 -0
  687. package/backend/dist/services/websocketTicketService.js.map +1 -0
  688. package/backend/dist/services/workAccessService.d.ts +3 -3
  689. package/backend/dist/services/workAccessService.d.ts.map +1 -1
  690. package/backend/dist/services/workAccessService.js +8 -16
  691. package/backend/dist/services/workAccessService.js.map +1 -1
  692. package/backend/dist/services/workAdminService.d.ts +3 -3
  693. package/backend/dist/services/workAdminService.d.ts.map +1 -1
  694. package/backend/dist/services/workAdminService.js +4 -4
  695. package/backend/dist/services/workAdminService.js.map +1 -1
  696. package/backend/dist/services/workAgentService.d.ts +25 -1
  697. package/backend/dist/services/workAgentService.d.ts.map +1 -1
  698. package/backend/dist/services/workAgentService.js +294 -126
  699. package/backend/dist/services/workAgentService.js.map +1 -1
  700. package/backend/dist/services/workEventService.d.ts +15 -2
  701. package/backend/dist/services/workEventService.d.ts.map +1 -1
  702. package/backend/dist/services/workEventService.js +201 -3
  703. package/backend/dist/services/workEventService.js.map +1 -1
  704. package/backend/dist/services/workKubernetesDriver.d.ts +8 -7
  705. package/backend/dist/services/workKubernetesDriver.d.ts.map +1 -1
  706. package/backend/dist/services/workKubernetesDriver.js +65 -21
  707. package/backend/dist/services/workKubernetesDriver.js.map +1 -1
  708. package/backend/dist/services/workModelProviderService.d.ts +2 -2
  709. package/backend/dist/services/workModelProviderService.d.ts.map +1 -1
  710. package/backend/dist/services/workModelProviderService.js +38 -34
  711. package/backend/dist/services/workModelProviderService.js.map +1 -1
  712. package/backend/dist/services/workPolicyService.d.ts +7 -7
  713. package/backend/dist/services/workPolicyService.d.ts.map +1 -1
  714. package/backend/dist/services/workPolicyService.js +50 -51
  715. package/backend/dist/services/workPolicyService.js.map +1 -1
  716. package/backend/dist/services/workPreviewProxyService.d.ts +8 -8
  717. package/backend/dist/services/workPreviewProxyService.d.ts.map +1 -1
  718. package/backend/dist/services/workPreviewProxyService.js +47 -44
  719. package/backend/dist/services/workPreviewProxyService.js.map +1 -1
  720. package/backend/dist/services/workRuntimeDriver.d.ts +21 -18
  721. package/backend/dist/services/workRuntimeDriver.d.ts.map +1 -1
  722. package/backend/dist/services/workRuntimeDriver.js +69 -20
  723. package/backend/dist/services/workRuntimeDriver.js.map +1 -1
  724. package/backend/dist/services/workRuntimeService.d.ts +18 -13
  725. package/backend/dist/services/workRuntimeService.d.ts.map +1 -1
  726. package/backend/dist/services/workRuntimeService.js +438 -194
  727. package/backend/dist/services/workRuntimeService.js.map +1 -1
  728. package/backend/dist/services/workRuntimeShared.d.ts +2 -0
  729. package/backend/dist/services/workRuntimeShared.d.ts.map +1 -1
  730. package/backend/dist/services/workRuntimeShared.js.map +1 -1
  731. package/backend/dist/services/workTaskService.d.ts +42 -36
  732. package/backend/dist/services/workTaskService.d.ts.map +1 -1
  733. package/backend/dist/services/workTaskService.js +445 -350
  734. package/backend/dist/services/workTaskService.js.map +1 -1
  735. package/backend/dist/services/workTerminalService.d.ts +1 -1
  736. package/backend/dist/services/workTerminalService.d.ts.map +1 -1
  737. package/backend/dist/services/workTerminalService.js +33 -6
  738. package/backend/dist/services/workTerminalService.js.map +1 -1
  739. package/backend/dist/storage.d.ts +72 -40
  740. package/backend/dist/storage.d.ts.map +1 -1
  741. package/backend/dist/storage.js +312 -660
  742. package/backend/dist/storage.js.map +1 -1
  743. package/backend/dist/types/index.d.ts +28 -0
  744. package/backend/dist/types/index.d.ts.map +1 -1
  745. package/backend/dist/types/index.js.map +1 -1
  746. package/backend/dist/types/work.d.ts +7 -2
  747. package/backend/dist/types/work.d.ts.map +1 -1
  748. package/backend/dist/utils/chatCancellation.d.ts +48 -0
  749. package/backend/dist/utils/chatCancellation.d.ts.map +1 -0
  750. package/backend/dist/utils/chatCancellation.js +152 -0
  751. package/backend/dist/utils/chatCancellation.js.map +1 -0
  752. package/backend/dist/utils/chatDocumentContext.d.ts +1 -1
  753. package/backend/dist/utils/chatDocumentContext.d.ts.map +1 -1
  754. package/backend/dist/utils/chatDocumentContext.js +11 -5
  755. package/backend/dist/utils/chatDocumentContext.js.map +1 -1
  756. package/backend/dist/utils/chatStreamCoalescer.d.ts +15 -0
  757. package/backend/dist/utils/chatStreamCoalescer.d.ts.map +1 -0
  758. package/backend/dist/utils/chatStreamCoalescer.js +59 -0
  759. package/backend/dist/utils/chatStreamCoalescer.js.map +1 -0
  760. package/backend/dist/utils/dataDirectory.d.ts +49 -0
  761. package/backend/dist/utils/dataDirectory.d.ts.map +1 -0
  762. package/backend/dist/utils/dataDirectory.js +291 -0
  763. package/backend/dist/utils/dataDirectory.js.map +1 -0
  764. package/backend/dist/utils/generationUtils.d.ts.map +1 -1
  765. package/backend/dist/utils/generationUtils.js +18 -6
  766. package/backend/dist/utils/generationUtils.js.map +1 -1
  767. package/backend/dist/utils/jwt.d.ts.map +1 -1
  768. package/backend/dist/utils/jwt.js +2 -3
  769. package/backend/dist/utils/jwt.js.map +1 -1
  770. package/backend/dist/utils/ollamaModelDefaults.d.ts.map +1 -1
  771. package/backend/dist/utils/ollamaModelDefaults.js +2 -7
  772. package/backend/dist/utils/ollamaModelDefaults.js.map +1 -1
  773. package/backend/dist/utils/ollamaStreaming.d.ts +2 -1
  774. package/backend/dist/utils/ollamaStreaming.d.ts.map +1 -1
  775. package/backend/dist/utils/ollamaStreaming.js +49 -11
  776. package/backend/dist/utils/ollamaStreaming.js.map +1 -1
  777. package/backend/dist/utils/pluginConnectionVariables.d.ts.map +1 -1
  778. package/backend/dist/utils/pluginConnectionVariables.js +11 -3
  779. package/backend/dist/utils/pluginConnectionVariables.js.map +1 -1
  780. package/backend/dist/utils/pluginDefinitionTrust.d.ts.map +1 -1
  781. package/backend/dist/utils/pluginDefinitionTrust.js +4 -3
  782. package/backend/dist/utils/pluginDefinitionTrust.js.map +1 -1
  783. package/backend/dist/utils/pluginStreaming.d.ts +2 -1
  784. package/backend/dist/utils/pluginStreaming.d.ts.map +1 -1
  785. package/backend/dist/utils/pluginStreaming.js +5 -1
  786. package/backend/dist/utils/pluginStreaming.js.map +1 -1
  787. package/backend/dist/utils/pluginUpload.d.ts +1 -0
  788. package/backend/dist/utils/pluginUpload.d.ts.map +1 -1
  789. package/backend/dist/utils/pluginUpload.js +9 -2
  790. package/backend/dist/utils/pluginUpload.js.map +1 -1
  791. package/backend/dist/utils/pluginValidation.d.ts.map +1 -1
  792. package/backend/dist/utils/pluginValidation.js +29 -1
  793. package/backend/dist/utils/pluginValidation.js.map +1 -1
  794. package/backend/dist/utils/sttAudioUpload.d.ts +24 -0
  795. package/backend/dist/utils/sttAudioUpload.d.ts.map +1 -0
  796. package/backend/dist/utils/sttAudioUpload.js +500 -0
  797. package/backend/dist/utils/sttAudioUpload.js.map +1 -0
  798. package/backend/dist/utils/ttsVoiceCloneUpload.d.ts +34 -0
  799. package/backend/dist/utils/ttsVoiceCloneUpload.d.ts.map +1 -0
  800. package/backend/dist/utils/ttsVoiceCloneUpload.js +224 -0
  801. package/backend/dist/utils/ttsVoiceCloneUpload.js.map +1 -0
  802. package/backend/dist/utils/websocketMessages.d.ts +2 -1
  803. package/backend/dist/utils/websocketMessages.d.ts.map +1 -1
  804. package/backend/dist/utils/websocketMessages.js +16 -2
  805. package/backend/dist/utils/websocketMessages.js.map +1 -1
  806. package/backend/dist/websocketServer.d.ts +4 -1
  807. package/backend/dist/websocketServer.d.ts.map +1 -1
  808. package/backend/dist/websocketServer.js +290 -44
  809. package/backend/dist/websocketServer.js.map +1 -1
  810. package/backend/dist/workTerminalServer.d.ts +9 -0
  811. package/backend/dist/workTerminalServer.d.ts.map +1 -1
  812. package/backend/dist/workTerminalServer.js +221 -52
  813. package/backend/dist/workTerminalServer.js.map +1 -1
  814. package/backend/dist/worker.d.ts +2 -0
  815. package/backend/dist/worker.d.ts.map +1 -0
  816. package/backend/dist/worker.js +250 -0
  817. package/backend/dist/worker.js.map +1 -0
  818. package/backend/package.json +19 -9
  819. package/bin/cli.js +126 -99
  820. package/bin/runtime-paths.js +108 -0
  821. package/frontend/dist/artifact-runtime/.build-fingerprint +1 -1
  822. package/frontend/dist/artifact-runtime/framer-motion.js +5 -5
  823. package/frontend/dist/artifact-runtime/lucide-react.js +1 -1
  824. package/frontend/dist/assets/index-CUhEG7E2.js +33 -0
  825. package/frontend/dist/assets/index-kxtZQLV6.css +1 -0
  826. package/frontend/dist/assets/{markdown-math-ClQbWekD.css → markdown-math-ClTedVi7.css} +1 -1
  827. package/frontend/dist/index.html +18 -18
  828. package/frontend/dist/js/{ArtifactContainer-Dy2Q0iIL.js → ArtifactContainer-BTEDhBnv.js} +1 -1
  829. package/frontend/dist/js/{ArtifactDemoPage-K79dWshB.js → ArtifactDemoPage-B0gN3YTl.js} +1 -1
  830. package/frontend/dist/js/{ArtifactSandboxFrame-DhqLNUtY.js → ArtifactSandboxFrame-CLBXQkZs.js} +3 -3
  831. package/frontend/dist/js/{ArtifactSlideOutPanel-Cl8JG7bz.js → ArtifactSlideOutPanel-CfqHPFdE.js} +1 -1
  832. package/frontend/dist/js/{Button-CTXHujOd.js → Button-BV44cTnj.js} +1 -1
  833. package/frontend/dist/js/ChatPage-DIkAXZWA.js +23 -0
  834. package/frontend/dist/js/{FirstTimeSetup-kHhRzGJ8.js → FirstTimeSetup-B8phXGNA.js} +1 -1
  835. package/frontend/dist/js/GalleryPage-W4uI043I.js +1 -0
  836. package/frontend/dist/js/{HomePage-C1L8WAXL.js → HomePage-DlxehbyO.js} +1 -1
  837. package/frontend/dist/js/{LibreClawPage-Dyua8IUu.js → LibreClawPage-CgD0_G_F.js} +1 -1
  838. package/frontend/dist/js/{ModelManagerModals-CuMRGUd-.js → ModelManagerModals-D7jIT3v1.js} +1 -1
  839. package/frontend/dist/js/{ModelSelector-CqHc-Ln4.js → ModelSelector-BYxJU1UV.js} +1 -1
  840. package/frontend/dist/js/ModelsPage-C4XdCKP5.js +2 -0
  841. package/frontend/dist/js/NotesPage-CDECOl4V.js +1 -0
  842. package/frontend/dist/js/{OptimizedSyntaxHighlighter-CWYUn9Oe.js → OptimizedSyntaxHighlighter-XwqZEoTf.js} +1 -1
  843. package/frontend/dist/js/{PersonasPage-D_6WBCH5.js → PersonasPage-CjSLPrgS.js} +2 -2
  844. package/frontend/dist/js/PluginUsagePage-DJOXJuH4.js +1 -0
  845. package/frontend/dist/js/RichMessageContent-Debeh6bi.js +3 -0
  846. package/frontend/dist/js/SettingsModal-cUqAeYUP.js +1 -0
  847. package/frontend/dist/js/{SettingsToggle-DLHlCDBl.js → SettingsToggle-WTa0rgvY.js} +1 -1
  848. package/frontend/dist/js/{SystemPage-BMWEet9e.js → SystemPage-DxPw0GS7.js} +1 -1
  849. package/frontend/dist/js/UserManagementPage-CEdYFe_Z.js +1 -0
  850. package/frontend/dist/js/WorkPage-DDVeuG_9.js +6 -0
  851. package/frontend/dist/js/api-IzobHGND.js +14 -0
  852. package/frontend/dist/js/appStore-DKwC2vgn.js +2 -0
  853. package/frontend/dist/js/ar-xTSvTq05.js +2 -0
  854. package/frontend/dist/js/authStore-OaTuapL7.js +4 -0
  855. package/frontend/dist/js/{babel-CmENXdZw.js → babel-D24oDI9y.js} +1 -1
  856. package/frontend/dist/js/bn-iYAsohEA.js +2 -0
  857. package/frontend/dist/js/chatStore-DXGUVLXD.js +3 -0
  858. package/frontend/dist/js/{config-DkV1ka7I.js → config-DPEEuTAe.js} +1 -1
  859. package/frontend/dist/js/cs-YBHN88Hb.js +2 -0
  860. package/frontend/dist/js/da-D7qlLy_k.js +2 -0
  861. package/frontend/dist/js/de-DV671k2c.js +2 -0
  862. package/frontend/dist/js/es-kyBgzNq-.js +2 -0
  863. package/frontend/dist/js/{estree-D5KP-qbw.js → estree-ChwJsD2w.js} +1 -1
  864. package/frontend/dist/js/fr-Cw1vut7I.js +2 -0
  865. package/frontend/dist/js/hi-DWEFC024.js +2 -0
  866. package/frontend/dist/js/{html-Cm9c2akd.js → html-DFrVjciF.js} +1 -1
  867. package/frontend/dist/js/id-DlMHjjy0.js +2 -0
  868. package/frontend/dist/js/is-B9E_a7dG.js +2 -0
  869. package/frontend/dist/js/it-DawmVbLC.js +2 -0
  870. package/frontend/dist/js/ja-DmVvwY3W.js +2 -0
  871. package/frontend/dist/js/ko-DzOPpkVs.js +2 -0
  872. package/frontend/dist/js/{markdown-B2u7CnKN.js → markdown-FLLx7b67.js} +1 -1
  873. package/frontend/dist/js/markdown-core-BmPPZiuD.js +31 -0
  874. package/frontend/dist/js/{markdown-math-B7FlYsmr.js → markdown-math-mH7AZ_mb.js} +6 -6
  875. package/frontend/dist/js/{messageCodeStyles-DalG2j6U.js → messageCodeStyles-CBkkZY4n.js} +1 -1
  876. package/frontend/dist/js/ms-DpsaOPht.js +2 -0
  877. package/frontend/dist/js/nl-B1d8W22n.js +2 -0
  878. package/frontend/dist/js/pl-nCncRVgt.js +2 -0
  879. package/frontend/dist/js/{postcss-B5WIGhAY.js → postcss-Bx9CTcIc.js} +1 -1
  880. package/frontend/dist/js/pt-DHw8fGuu.js +2 -0
  881. package/frontend/dist/js/{react-vendor-DPNXrO-8.js → react-vendor-C5yShNlM.js} +1 -1
  882. package/frontend/dist/js/{router-vendor-Ca9zqOqT.js → router-vendor-CbPDks39.js} +1 -1
  883. package/frontend/dist/js/ru-Derl_YP_.js +2 -0
  884. package/frontend/dist/js/{standalone-Dwm1daef.js → standalone-i8-5bg5p.js} +1 -1
  885. package/frontend/dist/js/sv-pJAfBVo0.js +2 -0
  886. package/frontend/dist/js/{syntax-highlight-Ca9bHsaz.js → syntax-highlight-3EEX6CGL.js} +3 -3
  887. package/frontend/dist/js/th-C_7fIGnk.js +2 -0
  888. package/frontend/dist/js/tr-CPqsJvaP.js +2 -0
  889. package/frontend/dist/js/{typescript-CwieSptM.js → typescript-CQ3x-Uni.js} +1 -1
  890. package/frontend/dist/js/{ui-BnDZpjfc.js → ui-BHhR3Vok.js} +2 -2
  891. package/frontend/dist/js/ui-vendor-D3Ahl1x5.js +177 -0
  892. package/frontend/dist/js/uk-3o8P_kFi.js +2 -0
  893. package/frontend/dist/js/{useTranslation-CXY69qNk.js → useTranslation-C3ei3mJq.js} +1 -1
  894. package/frontend/dist/js/{utils-BM0_0iFj.js → utils-CuC1beTY.js} +1 -1
  895. package/frontend/dist/js/{utils-vendor-1zob7nK9.js → utils-vendor-BBa8OxtB.js} +1 -1
  896. package/frontend/dist/js/vi-Dv6N7OVD.js +2 -0
  897. package/frontend/dist/js/{workApi-BOS7crs9.js → workApi-Czu69yWS.js} +2 -2
  898. package/frontend/dist/js/{yaml-QD4znPfZ.js → yaml-DioTxVLA.js} +1 -1
  899. package/frontend/dist/js/zh-qg5iqtPi.js +2 -0
  900. package/package.json +16 -5
  901. package/plugins/huggingface.json +12 -3
  902. package/plugins/llama-cpp.json +18 -6
  903. package/plugins/longcat-audiodit.json +114 -0
  904. package/plugins/openai.json +18 -0
  905. package/frontend/dist/assets/index-BBpNbfKW.js +0 -16
  906. package/frontend/dist/assets/index-BLATyFmD.css +0 -1
  907. package/frontend/dist/js/ChatPage-BBayfMLS.js +0 -16
  908. package/frontend/dist/js/GalleryPage-By8VI39Q.js +0 -1
  909. package/frontend/dist/js/ModelsPage-ODeXhDDk.js +0 -2
  910. package/frontend/dist/js/NotesPage-CApzDjOq.js +0 -1
  911. package/frontend/dist/js/PluginUsagePage-kutS6SOd.js +0 -1
  912. package/frontend/dist/js/RichMessageContent-g6WT75Te.js +0 -3
  913. package/frontend/dist/js/SettingsModal-B7z51BCx.js +0 -1
  914. package/frontend/dist/js/UserManagementPage-D08lM51c.js +0 -1
  915. package/frontend/dist/js/WorkPage-DdVLefsK.js +0 -6
  916. package/frontend/dist/js/api-CLEmGcEh.js +0 -14
  917. package/frontend/dist/js/appStore-CGdhvp9P.js +0 -2
  918. package/frontend/dist/js/ar-BTmB2WVm.js +0 -2
  919. package/frontend/dist/js/authStore-Dh3beEOq.js +0 -4
  920. package/frontend/dist/js/bn-CQnH7YVT.js +0 -2
  921. package/frontend/dist/js/chatStore-CDeYWL_q.js +0 -3
  922. package/frontend/dist/js/cs-oTTZkQXr.js +0 -2
  923. package/frontend/dist/js/da-Br0gB6J6.js +0 -2
  924. package/frontend/dist/js/de-DE2iztTF.js +0 -2
  925. package/frontend/dist/js/es-DgthfVtl.js +0 -2
  926. package/frontend/dist/js/fr-BjxjFwPh.js +0 -2
  927. package/frontend/dist/js/hi-D1q7E-9N.js +0 -2
  928. package/frontend/dist/js/id-CDJZqLTF.js +0 -2
  929. package/frontend/dist/js/is-BU7Um_Tq.js +0 -2
  930. package/frontend/dist/js/it-CdAxr8P_.js +0 -2
  931. package/frontend/dist/js/ja-BLbQwz9u.js +0 -2
  932. package/frontend/dist/js/ko-CY5lpkAe.js +0 -2
  933. package/frontend/dist/js/markdown-core-DHnR5Hw8.js +0 -16
  934. package/frontend/dist/js/ms-tQ8AYXEQ.js +0 -2
  935. package/frontend/dist/js/nl-CRNi2oWT.js +0 -2
  936. package/frontend/dist/js/pl-CWtFRS_W.js +0 -2
  937. package/frontend/dist/js/pt-C7SPoLF8.js +0 -2
  938. package/frontend/dist/js/ru-Dz4AX8xc.js +0 -2
  939. package/frontend/dist/js/sv-ETy5-boa.js +0 -2
  940. package/frontend/dist/js/th-DpuMqvxU.js +0 -2
  941. package/frontend/dist/js/tr-C-1AYAqg.js +0 -2
  942. package/frontend/dist/js/ui-vendor-xUzKqAXI.js +0 -177
  943. package/frontend/dist/js/uk-CyS680gr.js +0 -2
  944. package/frontend/dist/js/vi-BG8HuiTz.js +0 -2
  945. package/frontend/dist/js/zh-NCs2mkHj.js +0 -2
@@ -0,0 +1,6 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["js/babel-D24oDI9y.js","js/router-vendor-CbPDks39.js","js/rolldown-runtime-hePW80VL.js","js/markdown-core-BmPPZiuD.js","js/estree-ChwJsD2w.js","assets/index-CUhEG7E2.js","js/react-vendor-C5yShNlM.js","js/useTranslation-C3ei3mJq.js","js/utils-CuC1beTY.js","js/utils-vendor-BBa8OxtB.js","js/chatStore-DXGUVLXD.js","js/i18next-DgmgtwsV.js","js/ui-vendor-D3Ahl1x5.js","js/logger-DSXjF4ye.js","js/api-IzobHGND.js","js/config-DPEEuTAe.js","js/workApi-Czu69yWS.js","js/authStore-OaTuapL7.js","js/appStore-DKwC2vgn.js","js/welcomePrompts-to5mv_gx.js","js/messageCodeStyles-CBkkZY4n.js","js/Button-BV44cTnj.js","js/ui-BHhR3Vok.js","assets/index-kxtZQLV6.css","js/typescript-CQ3x-Uni.js","js/postcss-Bx9CTcIc.js","js/html-DFrVjciF.js","js/markdown-FLLx7b67.js","js/yaml-DioTxVLA.js","js/standalone-i8-5bg5p.js","js/OptimizedSyntaxHighlighter-XwqZEoTf.js","js/syntax-highlight-3EEX6CGL.js","assets/xterm-DHcfr8qj.css"])))=>i.map(i=>d[i]);
2
+ import{r as e}from"./rolldown-runtime-hePW80VL.js";import{m as t,p as n}from"./markdown-core-BmPPZiuD.js";import{d as r,f as i,i as a,l as o,u as s}from"./router-vendor-CbPDks39.js";import{t as c}from"./useTranslation-C3ei3mJq.js";import{t as l}from"./utils-CuC1beTY.js";import{_ as u,t as d}from"./chatStore-DXGUVLXD.js";import{B as f,C as p,Dn as m,Ht as h,I as g,L as _,Lt as v,N as y,Nt as b,P as x,Pt as S,T as C,Tt as w,Vt as T,an as E,bn as D,bt as ee,c as O,en as k,et as te,fn as A,i as j,jt as M,kt as ne,lt as N,m as re,mn as P,n as F,on as I,rt as ie,sn as ae,tn as oe,vn as L,wn as se,wt as R,x as ce,xn as le,z as ue}from"./ui-vendor-D3Ahl1x5.js";import{t as de}from"./config-DPEEuTAe.js";import{r as fe,t as z}from"./workApi-Czu69yWS.js";import{c as pe}from"./api-IzobHGND.js";import{a as me,c as he,i as ge,n as _e,o as ve,s as ye,u as be}from"./authStore-OaTuapL7.js";import{t as xe}from"./appStore-DKwC2vgn.js";import{t as B}from"./Button-BV44cTnj.js";import{u as Se}from"./ui-BHhR3Vok.js";import{h as Ce,m as V}from"../assets/index-CUhEG7E2.js";import{t as H}from"./RichMessageContent-Debeh6bi.js";import{t as U}from"./ModelSelector-BYxJU1UV.js";import{n as W,t as we}from"./work-DVgm81bJ.js";var G=e(t(),1),K=n(),Te=e=>W({model:e.name,providerType:e.isPlugin?`plugin`:`ollama`,providerId:e.isPlugin?e.pluginId:void 0}),Ee=e=>{let t=e.name.split(`/`).filter(Boolean),n=t[t.length-1]||e.name;return t.length>1?n.replace(/[-_]+/g,` `):n},De=e=>{let t=`${e.model} · `;return{name:e.model,model:e.model,size:0,digest:``,modified_at:``,details:{},isPlugin:e.providerType===`plugin`,pluginId:e.providerId,pluginName:e.providerType===`plugin`?e.label.startsWith(t)?e.label.slice(t.length):e.providerId:void 0}};function Oe({models:e,selectorModels:t,modelKey:n,running:r,loading:i,variant:a=`task`,disabled:o=!1,remoteDisclosureDismissed:s,remoteDisclosureSaving:u,onModelChange:d,onDismissRemoteDisclosure:f,onModelsRefresh:p,onSubmit:m,onCancel:h}){let{t:g}=c(),[_,v]=(0,G.useState)(``),y=(0,G.useRef)(null),b=(0,G.useRef)(null),x=(0,G.useRef)(null),S=e.find(e=>e.key===n),C=S?.remote===!0,w=a===`landing`,T=(0,G.useMemo)(()=>{let n=new Set(t.map(Te)),r=e.filter(e=>!n.has(e.key)).map(De);return[...t,...r]},[e,t]);(0,G.useEffect)(()=>{let e=y.current;e&&(e.style.height=`auto`,e.style.height=`${Math.min(e.scrollHeight,160)}px`)},[_]);let E=async()=>{await f()&&([b.current,x.current].find(e=>e&&e.offsetParent!==null)||b.current)?.focus()},D=t=>{let n=e.find(e=>e.key===t)||e.find(e=>e.providerType===`ollama`&&e.model===t);n&&d(n.key)},ee=async()=>{let e=_.trim();!e||i||r||o||!S||await m(e)&&v(``)};return(0,K.jsxs)(`div`,{"data-testid":w?`work-landing-composer`:`work-task-composer`,"data-variant":a,className:l(`relative shrink-0`,w?`mt-10 w-full`:`border-t border-line bg-surface/95 px-3 py-3 backdrop-blur md:px-5`),children:[C&&!s&&(0,K.jsx)(`div`,{className:l(`absolute inset-x-3 z-30 mx-auto max-w-3xl md:inset-x-5`,`bottom-full mb-3`),children:(0,K.jsxs)(`aside`,{"data-testid":`work-provider-disclosure-popover`,"aria-labelledby":`work-provider-disclosure-title`,"aria-live":`polite`,className:`relative rounded-2xl border border-warning-500/40 bg-surface-overlay p-3 pe-10 shadow-overlay backdrop-blur dark:border-warning-500/45`,children:[(0,K.jsx)(`button`,{type:`button`,onClick:()=>void E(),disabled:u,className:`absolute end-2 top-2 inline-flex h-7 w-7 items-center justify-center rounded-lg text-ink-muted transition-colors hover:bg-warning-500/20 hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-warning-500 disabled:cursor-wait disabled:opacity-50`,"aria-label":g(`work.composer.remoteDismissLabel`,{defaultValue:`Dismiss remote provider notice`}),children:(0,K.jsx)(F,{className:`h-4 w-4`})}),(0,K.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,K.jsx)(`div`,{className:`mt-0.5 flex h-8 w-8 shrink-0 items-center justify-center rounded-xl bg-warning-500/20`,children:(0,K.jsx)(k,{"data-testid":`work-provider-disclosure-accent`,className:`h-4 w-4 text-warning-500`,"aria-hidden":`true`})}),(0,K.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,K.jsx)(`p`,{id:`work-provider-disclosure-title`,className:`text-sm font-semibold text-ink`,children:g(`work.composer.remoteTitle`,{defaultValue:`Remote provider`})}),(0,K.jsx)(`p`,{className:`mt-0.5 text-xs leading-relaxed text-ink-muted`,children:g(`work.composer.remoteHint`,{defaultValue:`Conversation and tool output are sent to the configured service. One autonomous run can make multiple provider calls and may incur charges. Workspace files stay local unless a tool returns their contents.`})}),(0,K.jsx)(`div`,{className:`mt-2.5 flex justify-end`,children:(0,K.jsx)(B,{"data-testid":`work-provider-disclosure-dismiss`,type:`button`,variant:`ghost`,size:`sm`,loading:u,className:`h-7 border-warning-500 bg-warning-500 px-2.5 text-xs text-[#3d120c] hover:bg-warning-500/90 hover:text-[#3d120c]`,onClick:()=>void E(),children:g(`work.composer.remoteDismiss`,{defaultValue:`Dismiss`})})})]})]})]})}),(0,K.jsx)(`form`,{className:`mx-auto w-full max-w-3xl`,onSubmit:e=>{e.preventDefault(),ee()},children:(0,K.jsxs)(`div`,{"data-testid":`work-composer-surface`,className:l(`rounded-[24px] border p-2.5 transition-[border-color,box-shadow,background-color] duration-200`,`border-black/[0.08] bg-surface dark:border-white/[0.09] dark:bg-surface-subtle`,`shadow-lv2 focus-within:shadow-lv3`),children:[(0,K.jsx)(`textarea`,{ref:y,"data-testid":`work-composer-input`,dir:`auto`,value:_,onChange:e=>v(e.target.value),onKeyDown:e=>{e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),ee())},disabled:o||r,rows:1,className:`m-0 block max-h-[160px] min-h-9 w-full resize-none overflow-y-auto rounded-none border-0 bg-transparent px-2 pt-1.5 pb-2 text-[0.9375rem] leading-relaxed text-ink shadow-none outline-none placeholder:text-ink-subtle focus:border-0 focus:bg-transparent focus:ring-0 disabled:cursor-not-allowed disabled:opacity-60`,placeholder:g(`work.composer.placeholder`,{defaultValue:`Describe what you want to build or change…`})}),(0,K.jsxs)(`div`,{className:`flex items-center justify-end gap-1.5`,children:[(0,K.jsx)(`div`,{className:`hidden shrink-0 sm:block`,children:(0,K.jsx)(U,{models:T,selectedModel:n,onModelChange:e=>D(e.target.value),onModelsRefresh:()=>void p(),getModelValue:Te,getModelLabel:Ee,getModelTitle:e=>e.name,triggerRef:b,triggerTestId:`work-model-selector-trigger`,selectTestId:`work-model-select`,ariaLabel:g(`work.composer.model`,{defaultValue:`Work model`}),disabled:r||e.length===0,className:`min-w-[150px] max-w-[230px]`,compact:!0})}),r?(0,K.jsx)(B,{"data-testid":`work-cancel-button`,type:`button`,variant:`ghost`,size:`sm`,disabled:i,className:`flex h-9 w-9 shrink-0 touch-manipulation items-center justify-center rounded-full bg-error-500/15 p-0 text-error-600 transition-colors duration-150 hover:bg-error-500/25 dark:text-error-400 sm:h-10 sm:w-10`,title:g(`work.composer.cancel`,{defaultValue:`Stop`}),"aria-label":g(`work.composer.cancel`,{defaultValue:`Stop`}),onClick:()=>void h(),children:i?(0,K.jsx)(N,{className:`h-4 w-4 animate-spin`}):(0,K.jsx)(ce,{className:`h-4 w-4 fill-current`})}):(0,K.jsx)(B,{"data-testid":`work-submit-button`,type:`submit`,variant:`ghost`,size:`sm`,disabled:i||o||!_.trim()||!S,className:l(`flex h-9 w-9 shrink-0 touch-manipulation items-center justify-center rounded-full p-0 transition-colors duration-150`,`bg-primary-500 text-white hover:bg-primary-400`,`disabled:bg-primary-300/50 disabled:text-white/80 dark:disabled:bg-primary-800/60 dark:disabled:text-white/40 disabled:hover:bg-primary-300/50 dark:disabled:hover:bg-primary-800/60`),title:g(`work.composer.send`,{defaultValue:`Run`}),"aria-label":g(`work.composer.send`,{defaultValue:`Run`}),children:i?(0,K.jsx)(N,{className:`h-4 w-4 animate-spin`}):(0,K.jsx)(L,{className:`h-4 w-4`})})]})]})}),(0,K.jsx)(`div`,{className:`mx-auto mt-3 w-full max-w-3xl sm:hidden`,children:(0,K.jsx)(U,{models:T,selectedModel:n,onModelChange:e=>D(e.target.value),onModelsRefresh:()=>void p(),getModelValue:Te,getModelLabel:Ee,getModelTitle:e=>e.name,triggerRef:x,triggerTestId:`work-model-selector-trigger-mobile`,selectTestId:`work-model-select-mobile`,ariaLabel:g(`work.composer.model`,{defaultValue:`Work model`}),disabled:r||e.length===0,className:`w-full`,compact:!0})})]})}var ke=e=>{if(e==null||e===``)return null;if(typeof e==`string`)return e;try{return JSON.stringify(e,null,2)}catch{return String(e)}},q=e=>{if(e<1e3)return`${Math.max(0,Math.round(e))}ms`;let t=Math.max(0,Math.round(e/1e3)),n=Math.floor(t/60),r=t%60;return n>0?`${n}:${String(r).padStart(2,`0`)}`:`${r}s`},Ae=e=>{if(!e)return 0;let t=Array.from(e).length,n=e.trim()?e.trim().split(/\s+/u).length:0;return Math.max(n,Math.ceil(t/4))};function J({run:e}){let[t,n]=(0,G.useState)();if((0,G.useEffect)(()=>{if(e.terminal||!e.startedAt)return;let t=window.setInterval(()=>n(Date.now()),1e3);return()=>window.clearInterval(t)},[e.startedAt,e.terminal]),!e.startedAt)return null;let r=e.finishedAt||t;return r?(0,K.jsx)(`span`,{dir:`ltr`,className:`tabular-nums text-ink-subtle`,"aria-hidden":`true`,children:q(r-e.startedAt)}):null}function je({tool:e,expandedByDefault:t}){let{t:n}=c(),[r]=(0,G.useState)(e.status),[i,a]=(0,G.useState)(null),o=(0,G.useMemo)(()=>ke(e.arguments),[e.arguments]),s=e.output||null,u=!!(o||s),d=e.status===`error`,f=e.status===`running`,p=(0,G.useId)(),m=d?n(`work.activity.kinds.error`,{defaultValue:`Error`}):f?n(`work.activity.kinds.toolCall`,{defaultValue:`Tool call`}):n(`work.activity.kinds.toolResult`,{defaultValue:`Tool result`}),h=i??(e.status===r?t:e.status===`error`);return(0,K.jsxs)(`div`,{"data-testid":`work-live-tool`,"data-tool-id":e.id,className:l(`overflow-hidden rounded-xl border bg-surface-raised transition-colors`,d?`border-error-500/30`:`border-line`),children:[(0,K.jsxs)(`button`,{type:`button`,disabled:!u,onClick:()=>{a(!h)},"aria-expanded":u?h:void 0,"aria-controls":u?p:void 0,"aria-label":`${m}: ${e.name}`,className:`flex min-h-10 w-full items-center gap-2 px-3 py-2 text-start outline-none hover:bg-surface-subtle focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-[#ff7b52] disabled:cursor-default disabled:hover:bg-transparent`,children:[(0,K.jsx)(`span`,{className:`flex h-5 w-5 shrink-0 items-center justify-center`,children:d?(0,K.jsx)(k,{className:`h-3.5 w-3.5 text-error-500`}):f?(0,K.jsx)(N,{className:`h-3.5 w-3.5 animate-spin text-[rgb(48,121,255)] motion-reduce:animate-none`}):(0,K.jsx)(ae,{className:`h-3.5 w-3.5 text-[rgb(76,212,117)]`})}),(0,K.jsx)(`span`,{dir:`ltr`,className:`min-w-0 flex-1 truncate font-mono text-xs text-ink`,children:e.name}),e.durationMs!==void 0&&(0,K.jsx)(`span`,{className:`shrink-0 text-[10px] tabular-nums text-ink-subtle`,children:q(e.durationMs)}),u&&(0,K.jsx)(I,{"aria-hidden":`true`,className:l(`h-3.5 w-3.5 shrink-0 text-ink-subtle transition-transform`,h&&`rotate-180`)})]}),u&&h&&(0,K.jsxs)(`div`,{id:p,className:`border-t border-line bg-surface-subtle/50`,children:[o&&(0,K.jsx)(`pre`,{dir:`ltr`,className:`max-h-48 overflow-auto whitespace-pre-wrap break-words px-3 py-2.5 text-left font-mono text-[11px] leading-relaxed text-ink-muted`,children:o}),s&&(0,K.jsx)(`pre`,{dir:`ltr`,className:l(`max-h-64 overflow-auto whitespace-pre-wrap break-words border-t border-line px-3 py-2.5 text-left font-mono text-[11px] leading-relaxed`,d?`text-error-600`:`text-ink-muted`),children:s})]})]})}var Me=e=>{let t=e.split(`
3
+ `);for(let e=t.length-1;e>=0;--e){let n=t[e].trim();if(n)return n}return``};function Ne({content:e,streaming:t}){let{t:n}=c(),[r,i]=(0,G.useState)(!1),a=t&&!r?Me(e):``;return(0,K.jsxs)(`details`,{"data-testid":`work-live-reasoning`,open:r,onToggle:e=>i(e.currentTarget.open),className:`group overflow-hidden rounded-xl border border-line bg-surface-subtle/70`,children:[(0,K.jsxs)(`summary`,{className:`flex cursor-pointer list-none flex-col gap-1 px-3 py-2 marker:hidden [&::-webkit-details-marker]:hidden`,children:[(0,K.jsxs)(`span`,{className:`flex items-center justify-between gap-3 text-xs font-medium text-ink-muted`,children:[(0,K.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,K.jsx)(A,{className:l(`h-3.5 w-3.5 shrink-0 text-[rgb(48,121,255)]`,t&&`animate-pulse-subtle motion-reduce:animate-none`)}),t?(0,K.jsxs)(`span`,{className:`animate-shimmer truncate bg-gradient-to-r from-ink-subtle via-ink to-ink-subtle bg-[length:200%_100%] bg-clip-text text-transparent motion-reduce:animate-none motion-reduce:bg-none motion-reduce:text-ink-muted`,children:[n(`work.statusLabels.thinking`,{defaultValue:`Thinking`}),`…`]}):(0,K.jsx)(`span`,{className:`truncate`,children:n(`libreClaw.metrics.reasoning`,{defaultValue:`Reasoning`})})]}),(0,K.jsx)(I,{className:`h-3.5 w-3.5 shrink-0 transition-transform group-open:rotate-180`})]}),a&&(0,K.jsx)(`span`,{dir:`auto`,"data-testid":`work-live-reasoning-preview`,className:`block truncate text-[11px] leading-relaxed text-ink-subtle`,children:a})]}),(0,K.jsx)(`div`,{className:`border-t border-line px-3 py-2.5`,children:(0,K.jsx)(Se,{content:e,isStreaming:t,className:`text-xs text-ink-muted`})})]})}var Pe=(e,t,n)=>e===`queued`||e===`preparing`?t(`work.status.preparing`,{defaultValue:`Preparing isolated workspace…`}):e===`using_tool`?n?.name?`${t(`work.activity.toolActivity`,{defaultValue:`Tool activity`})} · ${n.name}`:t(`work.activity.toolActivity`,{defaultValue:`Tool activity`}):e===`completed`?t(`work.statusLabels.complete`,{defaultValue:`Complete`}):e===`needs_input`?t(`work.statusLabels.needsInput`,{defaultValue:`Needs input`}):e===`failed`?t(`work.statusLabels.error`,{defaultValue:`Error`}):e===`cancelled`?t(`work.statusLabels.needsInput`,{defaultValue:`Needs input`}):e===`responding`?t(`work.status.running`,{defaultValue:`Working in the local workspace…`}):t(`work.statusLabels.thinking`,{defaultValue:`Thinking`}),Fe=(e,t)=>{if(e===`connecting`)return t(`work.live.connecting`,{defaultValue:`Connecting to live updates…`});if(e===`reconnecting`)return t(`work.live.reconnecting`,{defaultValue:`Reconnecting to live updates…`});if(e===`error`)return t(`work.live.unavailable`,{defaultValue:`Live updates unavailable`})};function Ie({run:e,variant:t=`conversation`}){let{t:n}=c(),r=[...e.tools].reverse().find(e=>e.status===`running`),i=Fe(e.connection,n)||Pe(e.phase,n,r),a=!e.terminal,o=e.usage?.outputTokens,s=e.reasoning+e.response,u=o!==void 0&&o>0?o:s?Ae(s):o,d=(o===void 0||o===0)&&!!s&&u!==void 0,f=e.usage?.tokensPerSecond;return(0,K.jsxs)(`section`,{"data-testid":`work-live-run`,"data-run-id":e.runId,"data-phase":e.phase,"aria-busy":a||void 0,className:l(`min-w-0`,t===`activity`&&`rounded-2xl border border-line bg-surface p-3 shadow-subtle`),children:[(0,K.jsxs)(`div`,{className:`mb-3 flex min-h-6 items-center gap-2 text-xs`,children:[(0,K.jsx)(`span`,{"aria-hidden":`true`,className:l(`h-2 w-2 shrink-0 rounded-full`,e.phase===`failed`?`bg-[rgb(255,61,129)]`:e.phase===`completed`?`bg-[rgb(76,212,117)]`:e.phase===`needs_input`||e.phase===`cancelled`?`bg-[rgb(255,204,0)]`:e.connection===`error`?`bg-[rgb(255,61,129)]`:`bg-[rgb(48,121,255)]`,a&&`animate-pulse motion-reduce:animate-none`)}),(0,K.jsx)(`span`,{dir:`auto`,title:e.connectionError,className:`min-w-0 flex-1 truncate font-medium text-ink-muted`,children:i}),e.round!==void 0&&(0,K.jsx)(`span`,{dir:`ltr`,className:`shrink-0 tabular-nums text-ink-subtle`,children:e.roundLimit===void 0?`#${e.round}`:`${e.round}/${e.roundLimit}`}),(0,K.jsx)(J,{run:e})]}),t===`conversation`&&(0,K.jsx)(`span`,{className:`sr-only`,role:`status`,"aria-live":`polite`,"aria-atomic":`true`,children:i}),e.skills.length>0&&(0,K.jsx)(`div`,{className:`mb-3 flex flex-wrap gap-1.5`,children:(0,K.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-full border border-line bg-surface-raised px-2 py-1 text-[10px] text-ink-muted`,children:[(0,K.jsx)(C,{className:`h-3 w-3 text-[#ff7b52]`,"aria-hidden":`true`}),(0,K.jsx)(`span`,{dir:`auto`,children:n(`work.live.skillsLoaded`,{count:e.skills.length,defaultValue:`Workspace skills · {{count}}`})})]})}),t===`conversation`?e.timeline.length>0&&(0,K.jsx)(`div`,{"data-testid":`work-live-timeline`,className:`space-y-2`,children:e.timeline.map((t,n)=>{let r=n===e.timeline.length-1;if(t.kind===`reasoning`)return(0,K.jsx)(Ne,{content:t.text,streaming:a&&r},`segment-${n}`);if(t.kind===`tool`){let n=e.tools.find(e=>e.id===t.toolId);return n?(0,K.jsx)(je,{tool:n,expandedByDefault:n.status===`error`},n.id):null}return(0,K.jsx)(Se,{content:t.text,isStreaming:a&&r,className:`text-ink`},`segment-${n}`)})}):e.tools.length>0&&(0,K.jsx)(`div`,{"data-testid":`work-live-tools`,className:`space-y-1.5`,children:e.tools.map(e=>(0,K.jsx)(je,{tool:e,expandedByDefault:e.status===`running`||e.status===`error`},e.id))}),e.error&&(0,K.jsxs)(`div`,{role:`alert`,dir:`auto`,className:`mt-3 flex items-start gap-2 rounded-xl border border-error-500/30 bg-error-500/10 px-3 py-2.5 text-xs leading-relaxed text-error-600`,children:[(0,K.jsx)(k,{className:`mt-0.5 h-3.5 w-3.5 shrink-0`}),(0,K.jsx)(`span`,{children:e.error})]}),(u!==void 0||f!==void 0)&&(0,K.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-x-3 gap-y-1 border-t border-line pt-2 text-[10px] tabular-nums text-ink-subtle`,children:[u!==void 0&&(0,K.jsxs)(`span`,{dir:`auto`,children:[n(`generationStats.generatedTokens`,{defaultValue:`Generated tokens:`}),` `,(0,K.jsxs)(`bdi`,{dir:`ltr`,children:[d&&`≈`,u.toLocaleString()]})]}),f!==void 0&&(0,K.jsxs)(`span`,{dir:`auto`,children:[n(`generationStats.speed`,{defaultValue:`Speed:`}),` `,(0,K.jsxs)(`bdi`,{dir:`ltr`,children:[f.toFixed(1),` t/s`]})]})]}),a&&!e.reasoning&&!e.response&&e.tools.length===0&&(0,K.jsxs)(`div`,{"aria-hidden":`true`,className:`flex h-5 items-center gap-1 text-[rgb(48,121,255)]`,children:[(0,K.jsx)(`span`,{className:`h-1.5 w-1.5 animate-pulse rounded-full bg-current motion-reduce:animate-none`}),(0,K.jsx)(`span`,{className:`h-1.5 w-1.5 animate-pulse rounded-full bg-current [animation-delay:160ms] motion-reduce:animate-none`}),(0,K.jsx)(`span`,{className:`h-1.5 w-1.5 animate-pulse rounded-full bg-current [animation-delay:320ms] motion-reduce:animate-none`})]}),t===`activity`&&e.tools.length===0&&(0,K.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-ink-muted`,children:[(0,K.jsx)(p,{className:`h-3.5 w-3.5`}),n(`work.activity.empty`,{defaultValue:`Commands, file operations, and tool results will appear here.`})]})]})}function Y({role:e,user:t,size:n=`message`}){let[r,i]=(0,G.useState)(null);if(e===`assistant`)return(0,K.jsx)(`div`,{role:`img`,"aria-label":`Libre WebUI`,"data-testid":`work-assistant-avatar`,className:l(`flex shrink-0 items-center justify-center rounded-full border border-line bg-surface-raised text-ink shadow-subtle`,n===`empty`?`mx-auto mb-4 h-12 w-12`:`mt-0.5 h-8 w-8`),children:(0,K.jsx)(Ce,{label:null,className:l(n===`empty`?`h-6 w-6`:`h-4 w-4`)})});let a=t?.username||`User`,o=t?.avatar?.trim()||``,s=!!o&&o!==r;return(0,K.jsx)(`div`,{role:s?void 0:`img`,"aria-label":s?void 0:a,"data-testid":`work-user-avatar`,className:l(`mt-0.5 flex h-8 w-8 shrink-0 items-center justify-center overflow-hidden rounded-full`,s?`border border-line bg-surface-raised`:`bg-ink text-ink-inverse`),title:a,children:s?(0,K.jsx)(`img`,{src:o,alt:a,className:`h-full w-full object-cover`,onError:()=>i(o)}):t?(0,K.jsx)(`span`,{"aria-hidden":`true`,className:`text-xs font-medium uppercase leading-none`,children:t.username.charAt(0)}):(0,K.jsx)(O,{"aria-hidden":`true`,className:`h-4 w-4`})})}var Le=(e,t)=>{let n=e.metadata,r=n?.name??n?.toolName??n?.tool??n?.command;return typeof r==`string`&&r?r:t},Re=e=>{let t=e.metadata?.toolCallId;return typeof t==`string`&&t?t:null},ze=(e,t,n)=>{let r=e??t,i=t?.kind===`error`||t?.metadata?.isError===!0||!t&&r?.kind===`error`,a=t?.metadata?.durationMs;return{id:(e??t)?.id??`tool`,name:r?Le(r,n):n,status:i?`error`:`completed`,arguments:e?.metadata,output:t?.content||(!t&&e?e.content:void 0),durationMs:typeof a==`number`?a:void 0}},Be=(e,t)=>{let n=[],r=new Map,i=(e,t)=>{let r=n[n.length-1];return r?.item.type===`tools`?(r.item.tools.push(e),r.item.tools.length-1):(n.push({key:t,item:{type:`tools`,tools:[e]}}),0)};for(let a of e){if(a.kind===`reasoning`){n.push({key:a.id,item:{type:`reasoning`,message:a}});continue}if(a.role!==`tool`&&a.kind===`message`){n.push({key:a.id,item:{type:`message`,message:a}});continue}let e=Re(a);if(a.kind===`tool_call`&&e){let o=i(ze(a,void 0,t),a.id);r.set(e,{itemIndex:n.length-1,toolIndex:o,call:a});continue}if(a.kind===`tool_result`&&e){let i=r.get(e);if(i){let o=n[i.itemIndex];if(o.item.type===`tools`){o.item.tools[i.toolIndex]=ze(i.call,a,t),r.delete(e);continue}}}i(ze(a.kind===`tool_call`?a:void 0,a.kind===`tool_call`?void 0:a,t),a.id)}return n};function Ve({message:e}){let{t}=c();return(0,K.jsxs)(`details`,{"data-testid":`work-provider-reasoning`,className:`group ms-14 overflow-hidden rounded-xl border border-line bg-surface-subtle/70`,children:[(0,K.jsxs)(`summary`,{className:`flex cursor-pointer list-none items-center justify-between gap-3 px-3 py-2 text-xs font-medium text-ink-muted marker:hidden [&::-webkit-details-marker]:hidden`,children:[(0,K.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,K.jsx)(A,{className:`h-3.5 w-3.5 shrink-0 text-[rgb(48,121,255)]`}),(0,K.jsx)(`span`,{className:`truncate`,children:t(`libreClaw.metrics.reasoning`,{defaultValue:`Reasoning`})})]}),(0,K.jsx)(I,{className:`h-3.5 w-3.5 shrink-0 transition-transform group-open:rotate-180`})]}),(0,K.jsx)(`p`,{dir:`auto`,className:`whitespace-pre-wrap break-words border-t border-line px-3 py-2.5 text-xs leading-relaxed text-ink-muted`,children:e.content})]})}function He({task:e,user:t,loading:n,loadingOlder:r,liveRun:i,onLoadOlder:a}){let{t:o}=c(),s=(0,G.useRef)(null),u=(0,G.useRef)(!0),[d,f]=(0,G.useState)(!1),p=(0,G.useMemo)(()=>[...e.messages||[]].sort((e,t)=>e.messageIndex-t.messageIndex||e.createdAt-t.createdAt||e.id.localeCompare(t.id)),[e.messages]),m=i?.runId,h=(0,G.useMemo)(()=>Be(p.filter(e=>!(m&&e.runId===m&&e.role!==`user`)),o(`work.activity.toolActivity`,{defaultValue:`Tool activity`})),[m,p,o]),g=[...p].reverse().find(e=>e.role===`assistant`&&e.kind===`message`)?.id;(0,G.useEffect)(()=>{u.current=!0;let e=s.current;e&&(e.scrollTop=e.scrollHeight);let t=window.requestAnimationFrame(()=>f(!1));return()=>window.cancelAnimationFrame(t)},[e.id]),(0,G.useEffect)(()=>{let e=s.current,t;return e&&u.current?(e.scrollTop=e.scrollHeight,t=window.requestAnimationFrame(()=>f(!1))):e&&i&&(t=window.requestAnimationFrame(()=>f(!0))),()=>{t!==void 0&&window.cancelAnimationFrame(t)}},[i,p,e.status]);let _=async()=>{let e=s.current,t=e?.scrollHeight??0,n=e?.scrollTop??0;u.current=!1;try{await a(),requestAnimationFrame(()=>{let e=s.current;e&&(e.scrollTop=n+e.scrollHeight-t)})}catch{}};return n&&p.length===0?(0,K.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center text-ink-muted`,children:(0,K.jsx)(N,{className:`h-6 w-6 animate-spin`})}):(0,K.jsxs)(`div`,{className:`relative flex min-h-0 flex-1`,children:[(0,K.jsx)(`div`,{ref:s,onScroll:e=>{let t=e.currentTarget;u.current=t.scrollHeight-t.scrollTop-t.clientHeight<80,u.current&&f(!1)},className:`min-h-0 flex-1 overflow-y-auto`,children:(0,K.jsx)(`div`,{className:`mx-auto flex min-h-full max-w-3xl flex-col px-4 py-6 md:px-6`,children:p.length===0&&!i?(0,K.jsxs)(`div`,{className:`m-auto max-w-md text-center`,children:[(0,K.jsx)(Y,{role:`assistant`,size:`empty`}),(0,K.jsx)(`h2`,{className:`text-lg font-semibold tracking-tight text-ink`,children:o(`work.conversation.ready`,{defaultValue:`Workspace ready`})}),(0,K.jsx)(`p`,{className:`mt-2 text-sm leading-relaxed text-ink-muted`,children:o(`work.conversation.empty`,{defaultValue:`Continue the task below. This conversation and its files stay attached to this workspace.`})})]}):(0,K.jsxs)(`div`,{className:`space-y-6`,children:[e.hasMoreMessages&&(0,K.jsx)(`div`,{className:`flex justify-center`,children:(0,K.jsxs)(`button`,{type:`button`,"data-testid":`work-load-older-messages`,disabled:r,onClick:()=>void _(),className:`inline-flex items-center gap-2 rounded-lg border border-line bg-surface-raised px-3 py-1.5 text-xs font-medium text-ink-muted transition-colors hover:bg-surface-subtle hover:text-ink disabled:cursor-not-allowed disabled:opacity-60`,children:[r&&(0,K.jsx)(N,{className:`h-3.5 w-3.5 animate-spin`}),o(`work.conversation.loadOlder`,{defaultValue:`Load older messages`})]})}),h.map(({key:n,item:r})=>{if(r.type===`reasoning`)return(0,K.jsx)(Ve,{message:r.message},n);if(r.type===`tools`)return(0,K.jsx)(`div`,{className:`ms-14 space-y-1.5`,children:r.tools.map(e=>(0,K.jsx)(je,{tool:e,expandedByDefault:!1},e.id))},n);let i=r.message,a=i.role===`user`,o=!a&&e.status===`running`&&i.id===g&&i.runId===e.activeRun?.id;return(0,K.jsxs)(`article`,{className:l(`flex gap-3`,a&&`flex-row-reverse`),children:[(0,K.jsx)(Y,{role:a?`user`:`assistant`,user:a?t:void 0}),(0,K.jsx)(`div`,{className:l(`min-w-0 max-w-[88%]`,a&&`rounded-2xl rounded-se-md bg-ink px-4 py-2.5 text-ink-inverse`),children:a?(0,K.jsx)(`p`,{dir:`auto`,className:`whitespace-pre-wrap break-words text-sm leading-relaxed`,children:i.content}):o?(0,K.jsx)(Se,{content:i.content,className:`text-ink`}):(0,K.jsx)(H,{content:i.content,className:`text-sm text-ink`})})]},i.id)}),i&&(0,K.jsxs)(`article`,{className:`flex gap-3`,"data-testid":`work-live-run-message`,children:[(0,K.jsx)(Y,{role:`assistant`}),(0,K.jsx)(`div`,{className:`min-w-0 max-w-[92%] flex-1`,children:(0,K.jsx)(Ie,{run:i})})]}),!i&&(e.status===`preparing`||e.status===`running`)&&(0,K.jsxs)(`div`,{className:`flex items-center gap-2 ps-14 text-xs text-ink-muted`,children:[(0,K.jsx)(N,{className:`h-3.5 w-3.5 animate-spin`}),e.status===`preparing`?o(`work.status.preparing`,{defaultValue:`Preparing isolated workspace…`}):o(`work.status.running`,{defaultValue:`Working in the local workspace…`})]})]})})}),d&&(0,K.jsxs)(`button`,{type:`button`,"data-testid":`work-new-activity-button`,onClick:()=>{let e=s.current;e&&(e.scrollTop=e.scrollHeight),u.current=!0,f(!1)},className:`absolute bottom-4 left-1/2 z-10 inline-flex -translate-x-1/2 items-center gap-1.5 rounded-full border border-line bg-surface-overlay/95 px-3 py-2 text-xs font-medium text-ink shadow-overlay backdrop-blur transition-colors hover:bg-surface-raised`,children:[(0,K.jsx)(le,{className:`h-3.5 w-3.5`}),o(`work.live.newActivity`,{defaultValue:`New activity`})]})]})}var Ue=45,X=30,We=70,Ge=360,Ke=480,qe=9,Je=2,Ye=10,Xe=`libre-webui-work-split:`,Ze=(e,t,n)=>Math.min(n,Math.max(t,e)),Qe=e=>`${Xe}${encodeURIComponent(e||`local`)}`,$e=e=>{if(typeof window>`u`)return Ue;try{let t=window.localStorage.getItem(e);if(t===null||t.trim()===``)return Ue;let n=Number(t);return Number.isFinite(n)?Ze(n,X,We):Ue}catch{return Ue}},et=(e,t)=>{if(!(typeof window>`u`))try{window.localStorage.setItem(e,t.toFixed(2))}catch{}},tt=e=>{let t=Math.max(0,e-qe);if(t===0)return{min:X,max:We};let n=Math.max(X,Ge/t*100),r=Math.min(We,(t-Ke)/t*100);if(n<=r)return{min:n,max:r};let i=Ze(Ge/840*100,X,We);return{min:i,max:i}},nt=(e,t)=>Ze(e,t.min,t.max);function rt({conversation:e,workspace:t,userId:n,mobileSurface:r=`conversation`,className:i}){let{t:a,i18n:o}=c(),s=u(o.language),d=Qe(n),[f,p]=(0,G.useState)(()=>({storageKey:d,percent:$e(d)})),[m,h]=(0,G.useState)(0),[g,_]=(0,G.useState)(!1),v=(0,G.useRef)(null),y=(0,G.useRef)(null),b=(0,G.useRef)(null),x=(0,G.useRef)(d),S=(0,G.useRef)(f.percent),C=(0,G.useRef)(null),w=f.storageKey===d?f.percent:$e(d),T=(0,G.useMemo)(()=>tt(m),[m]),E=nt(w,T),D=Math.round(E),ee=100-D,O=(0,G.useCallback)(e=>{p({storageKey:d,percent:e})},[d]),k=(0,G.useCallback)(e=>{let t=nt(e,tt(v.current?.getBoundingClientRect().width??0));S.current=t,C.current===null&&(C.current=window.requestAnimationFrame(()=>{C.current=null,O(S.current)}))},[O]),te=(0,G.useCallback)(()=>{if(b.current===null&&!g)return;C.current!==null&&(window.cancelAnimationFrame(C.current),C.current=null);let e=v.current?.getBoundingClientRect().width??0,t=nt(S.current,tt(e));S.current=t,O(t),et(x.current,t);let n=b.current;b.current=null,n!==null&&y.current?.hasPointerCapture(n)&&y.current.releasePointerCapture(n),_(!1)},[g,O]),A=(0,G.useCallback)(e=>{let t=v.current?.getBoundingClientRect();if(!t)return S.current;let n=Math.max(1,t.width-qe);return((s?t.right-e:e-t.left)-qe/2)/n*100},[s]),j=e=>{e.button!==0||!e.isPrimary||(e.preventDefault(),e.stopPropagation(),b.current=e.pointerId,x.current=d,S.current=E,e.currentTarget.setPointerCapture(e.pointerId),_(!0))},M=(0,G.useCallback)(e=>{let t=nt(e,T);S.current=t,O(t),et(d,t)},[T,O,d]),ne=(0,G.useCallback)(()=>{M(Ue)},[M]),N=e=>{let t=e.shiftKey?Ye:Je,n=null;e.key===`ArrowLeft`?n=E+(s?t:-t):e.key===`ArrowRight`?n=E+(s?-t:t):e.key===`Home`?n=T.min:e.key===`End`?n=T.max:e.key===`Enter`&&(n=Ue),n!==null&&(e.preventDefault(),M(n))};(0,G.useEffect)(()=>{let e=v.current;if(!e)return;if(typeof ResizeObserver>`u`){let t=()=>h(e.getBoundingClientRect().width);return t(),window.addEventListener(`resize`,t),()=>window.removeEventListener(`resize`,t)}let t=new ResizeObserver(e=>{let t=e[0];t&&h(t.contentRect.width)});return t.observe(e),()=>t.disconnect()},[]),(0,G.useEffect)(()=>{if(!g)return;let e=document.body.style.cursor,t=document.body.style.userSelect;document.body.style.cursor=`col-resize`,document.body.style.userSelect=`none`;let n=e=>{e.pointerId===b.current&&(e.preventDefault(),k(A(e.clientX)))},r=e=>{e.pointerId===b.current&&te()};return window.addEventListener(`pointermove`,n,{passive:!1}),window.addEventListener(`pointerup`,r),window.addEventListener(`pointercancel`,r),window.addEventListener(`blur`,te),()=>{window.removeEventListener(`pointermove`,n),window.removeEventListener(`pointerup`,r),window.removeEventListener(`pointercancel`,r),window.removeEventListener(`blur`,te),document.body.style.cursor=e,document.body.style.userSelect=t}},[te,g,A,k]),(0,G.useEffect)(()=>()=>{C.current!==null&&window.cancelAnimationFrame(C.current),b.current!==null&&et(x.current,S.current)},[]);let re={gridTemplateColumns:`minmax(0, ${E}fr) ${qe}px minmax(0, ${100-E}fr)`};return(0,K.jsxs)(`div`,{ref:v,"data-testid":`work-split-pane`,"data-split-percent":E.toFixed(2),"data-resizing":g?`true`:`false`,className:l(`relative flex min-h-0 min-w-0 flex-1 overflow-hidden xl:grid`,i),style:re,children:[(0,K.jsx)(`section`,{id:`work-conversation-panel`,"data-testid":`work-conversation-panel`,className:l(`min-h-0 min-w-0 flex-1 flex-col bg-transparent xl:flex`,r===`conversation`?`flex`:`hidden`),children:e}),(0,K.jsxs)(`div`,{ref:y,role:`separator`,"aria-orientation":`vertical`,"aria-controls":`work-conversation-panel work-workspace-panel`,"aria-label":a(`work.workspace.resize`,{defaultValue:`Resize conversation and workspace`}),"aria-valuemin":Math.round(T.min),"aria-valuemax":Math.round(T.max),"aria-valuenow":D,"aria-valuetext":a(`work.workspace.splitSize`,{conversation:D,workspace:ee,defaultValue:`Conversation {{conversation}}%, workspace {{workspace}}%`}),title:a(`work.workspace.resizeHint`,{defaultValue:`Drag to resize. Use arrow keys for precise control. Double-click or press Enter to reset.`}),tabIndex:0,"data-testid":`work-split-resizer`,onPointerDown:j,onDoubleClick:ne,onKeyDown:N,className:l(`group relative z-40 hidden h-full cursor-col-resize touch-none select-none items-center justify-center outline-none xl:flex`,`focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-[#ff7b52]`),children:[(0,K.jsx)(`span`,{"aria-hidden":`true`,className:l(`pointer-events-none absolute inset-y-0 left-1/2 w-px -translate-x-1/2 bg-line transition-colors`,`group-hover:bg-[#ff7b52] group-focus-visible:bg-[#ff7b52]`,g&&`bg-[#ff7b52]`)}),(0,K.jsx)(`span`,{"aria-hidden":`true`,className:l(`pointer-events-none relative h-14 w-1 rounded-full bg-ink-subtle/50 opacity-60 transition-[height,background-color,opacity]`,`group-hover:h-20 group-hover:bg-[#ff7b52] group-hover:opacity-100`,`group-focus-visible:h-20 group-focus-visible:bg-[#ff7b52] group-focus-visible:opacity-100`,g&&`h-20 bg-[#ff7b52] opacity-100`)})]}),(0,K.jsx)(`section`,{id:`work-workspace-panel`,"data-testid":`work-workspace-panel`,className:l(`min-h-0 min-w-0 flex-1 flex-col bg-surface-raised/85 backdrop-blur-xl xl:flex`,r===`workspace`?`flex`:`hidden`),children:t}),g&&(0,K.jsx)(`div`,{"data-testid":`work-split-drag-shield`,"aria-hidden":`true`,className:`absolute inset-0 z-30 hidden cursor-col-resize select-none xl:block`})]})}var it=1e5,at=4e3,ot={bash:`bash`,c:`c`,cc:`cpp`,cjs:`javascript`,cpp:`cpp`,cs:`csharp`,csh:`bash`,css:`css`,cts:`typescript`,cxx:`cpp`,diff:`diff`,go:`go`,h:`c`,hpp:`cpp`,htm:`markup`,html:`markup`,java:`java`,js:`javascript`,json:`json`,json5:`json`,jsonc:`json`,jsx:`jsx`,kt:`kotlin`,kts:`kotlin`,less:`css`,md:`markdown`,mdx:`markdown`,mjs:`javascript`,mts:`typescript`,patch:`diff`,php:`php`,py:`python`,rb:`ruby`,rs:`rust`,scss:`css`,sh:`bash`,sql:`sql`,svg:`markup`,swift:`swift`,ts:`typescript`,tsx:`tsx`,xml:`markup`,yaml:`yaml`,yml:`yaml`,zsh:`bash`},st={".bashrc":`bash`,".zshrc":`bash`},Z={cjs:{family:`babel`,parser:`babel`},css:{family:`postcss`,parser:`css`},cts:{family:`typescript`,parser:`typescript`},htm:{family:`html`,parser:`html`},html:{family:`html`,parser:`html`},js:{family:`babel`,parser:`babel`},json:{family:`babel`,parser:`json`},json5:{family:`babel`,parser:`json5`},jsonc:{family:`babel`,parser:`json`},jsx:{family:`babel`,parser:`babel`},less:{family:`postcss`,parser:`less`},md:{family:`markdown`,parser:`markdown`},mdx:{family:`markdown`,parser:`mdx`},mjs:{family:`babel`,parser:`babel`},mts:{family:`typescript`,parser:`typescript`},scss:{family:`postcss`,parser:`scss`},ts:{family:`typescript`,parser:`typescript`},tsx:{family:`typescript`,parser:`typescript`},yaml:{family:`yaml`,parser:`yaml`},yml:{family:`yaml`,parser:`yaml`}},ct=e=>e.split(/[\\/]/).pop()?.toLowerCase()??``,lt=e=>{let t=ct(e),n=t.lastIndexOf(`.`);return n>-1?t.slice(n+1):``},ut=e=>st[ct(e)]??ot[lt(e)]??`text`,dt=e=>Z[lt(e)],ft=e=>dt(e)!==void 0,pt=e=>{if(e.length>1e5)return!1;let t=1;for(let n=0;n<e.length;n+=1)if(e.charCodeAt(n)===10&&(t+=1,t>4e3))return!1;return!0},Q=async e=>(await e).default,mt=async(e,t)=>{switch(e.family){case`babel`:return Promise.all([Q(a(()=>import(`./babel-D24oDI9y.js`),__vite__mapDeps([0,1,2,3]))),Q(a(()=>import(`./estree-ChwJsD2w.js`),__vite__mapDeps([4,1,2,3,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23])))]);case`typescript`:return Promise.all([Q(a(()=>import(`./typescript-CQ3x-Uni.js`),__vite__mapDeps([24,1,2,3,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23]))),Q(a(()=>import(`./estree-ChwJsD2w.js`),__vite__mapDeps([4,1,2,3,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23])))]);case`postcss`:return[await Q(a(()=>import(`./postcss-Bx9CTcIc.js`),__vite__mapDeps([25,1,2,3])))];case`html`:{let e=[await Q(a(()=>import(`./html-DFrVjciF.js`),__vite__mapDeps([26,1,2,3,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23])))];return/<script\b/i.test(t)&&e.push(await Q(a(()=>import(`./babel-D24oDI9y.js`),__vite__mapDeps([0,1,2,3]))),await Q(a(()=>import(`./estree-ChwJsD2w.js`),__vite__mapDeps([4,1,2,3,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23])))),/<script\b[^>]*\blang\s*=\s*["']?(?:ts|typescript)/i.test(t)&&e.push(await Q(a(()=>import(`./typescript-CQ3x-Uni.js`),__vite__mapDeps([24,1,2,3,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23])))),/<style\b/i.test(t)&&e.push(await Q(a(()=>import(`./postcss-Bx9CTcIc.js`),__vite__mapDeps([25,1,2,3])))),[...new Set(e)]}case`markdown`:{let n=[await Q(a(()=>import(`./markdown-FLLx7b67.js`),__vite__mapDeps([27,1,2,3,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23])))],r=e=>RegExp(`^(?: {0,3})(?:\`{3,}|~{3,})\\s*(?:${e})(?:\\s|$)`,`im`).test(t);return e.parser===`mdx`&&n.push(await Q(a(()=>import(`./babel-D24oDI9y.js`),__vite__mapDeps([0,1,2,3]))),await Q(a(()=>import(`./estree-ChwJsD2w.js`),__vite__mapDeps([4,1,2,3,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23])))),r(`js|jsx|javascript|json|json5|jsonc`)&&n.push(await Q(a(()=>import(`./babel-D24oDI9y.js`),__vite__mapDeps([0,1,2,3]))),await Q(a(()=>import(`./estree-ChwJsD2w.js`),__vite__mapDeps([4,1,2,3,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23])))),r(`ts|tsx|typescript`)&&n.push(await Q(a(()=>import(`./typescript-CQ3x-Uni.js`),__vite__mapDeps([24,1,2,3,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23]))),await Q(a(()=>import(`./estree-ChwJsD2w.js`),__vite__mapDeps([4,1,2,3,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23])))),r(`css|scss|less`)&&n.push(await Q(a(()=>import(`./postcss-Bx9CTcIc.js`),__vite__mapDeps([25,1,2,3])))),r(`html`)&&n.push(await Q(a(()=>import(`./html-DFrVjciF.js`),__vite__mapDeps([26,1,2,3,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23]))),await Q(a(()=>import(`./babel-D24oDI9y.js`),__vite__mapDeps([0,1,2,3]))),await Q(a(()=>import(`./estree-ChwJsD2w.js`),__vite__mapDeps([4,1,2,3,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23]))),await Q(a(()=>import(`./typescript-CQ3x-Uni.js`),__vite__mapDeps([24,1,2,3,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23]))),await Q(a(()=>import(`./postcss-Bx9CTcIc.js`),__vite__mapDeps([25,1,2,3])))),r(`yaml|yml`)&&n.push(await Q(a(()=>import(`./yaml-DioTxVLA.js`),__vite__mapDeps([28,1,2,3])))),[...new Set(n)]}case`yaml`:return[await Q(a(()=>import(`./yaml-DioTxVLA.js`),__vite__mapDeps([28,1,2,3])))]}},ht=async(e,t)=>{let n=dt(e);if(!n)throw Error(`Formatting is not supported for “${ct(e)||e}”.`);if(!pt(t))throw Error(`Could not format “${ct(e)||e}”: files are limited to ${it.toLocaleString()} characters and ${at.toLocaleString()} lines.`);try{let[{format:e},r]=await Promise.all([a(()=>import(`./standalone-i8-5bg5p.js`),__vite__mapDeps([29,1,2,3,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23])),mt(n,t)]);return await e(t,{parser:n.parser,plugins:r,tabWidth:2,useTabs:!1})}catch(t){let n=t instanceof Error?t.message:String(t);throw Error(`Could not format “${ct(e)||e}”: ${n}`)}},gt=(0,G.lazy)(async()=>({default:(await a(()=>import(`./OptimizedSyntaxHighlighter-XwqZEoTf.js`).then(e=>e.n),__vite__mapDeps([30,2,3,31]))).OptimizedSyntaxHighlighter})),_t=8e3,vt=400,yt=500;function bt({path:e,value:t,ariaLabel:n,disabled:r=!1,onChange:i,onSaveShortcut:a,onFormatShortcut:o}){let{t:s}=c(),u=xe(e=>e.theme.mode===`dark`),d=(0,G.useRef)(null),f=(0,G.useRef)(null),[p,m]=(0,G.useState)(``),h=(0,G.useMemo)(()=>ut(e),[e]),g=(0,G.useMemo)(()=>{if(t.length>_t)return 401;let e=1;for(let n=0;n<t.length&&!(t.charCodeAt(n)===10&&(e+=1,e>vt));n+=1);return e},[t]),_=t.length>_t||g>vt,v=h!==`text`&&!_,y=v&&p===t;return(0,G.useEffect)(()=>{if(!v)return;let e=window.setTimeout(()=>m(t),yt);return()=>window.clearTimeout(e)},[v,e,t]),(0,G.useLayoutEffect)(()=>{!y||!d.current||!f.current||(d.current.style.transform=`translate3d(${-f.current.scrollLeft}px, ${-f.current.scrollTop}px, 0)`)},[y,e]),(0,K.jsxs)(`div`,{dir:`ltr`,className:l(`relative min-h-0 flex-1 overflow-hidden bg-surface focus-within:ring-1 focus-within:ring-inset focus-within:ring-primary-500/60`,r&&`opacity-60`),"data-language":h,"data-highlighted":y?`true`:`false`,children:[y&&(0,K.jsx)(`div`,{"aria-hidden":`true`,"data-testid":`work-file-highlight`,className:`pointer-events-none absolute inset-0 z-0 overflow-hidden`,children:(0,K.jsx)(`div`,{ref:d,"data-testid":`work-file-highlight-content`,className:`min-h-full min-w-full origin-top-left will-change-transform`,children:(0,K.jsx)(G.Suspense,{fallback:(0,K.jsx)(`pre`,{className:`m-0 min-h-full min-w-full whitespace-pre p-4 text-left font-mono text-[12px] leading-5 text-ink`,children:t||`​`}),children:(0,K.jsx)(gt,{language:h,isDark:u,backgroundColor:`transparent`,borderRadius:0,customStyle:{margin:0,minHeight:`100%`,minWidth:`100%`,width:`max-content`,overflow:`visible`,padding:`1rem`,fontSize:`12px`,lineHeight:`20px`,tabSize:2,whiteSpace:`pre`},children:p||`​`})})})}),(0,K.jsx)(`textarea`,{ref:f,"data-testid":`work-file-editor`,"data-language":h,"aria-label":n,value:t,onChange:e=>i(e.target.value),onScroll:e=>{d.current&&(d.current.style.transform=`translate3d(${-e.currentTarget.scrollLeft}px, ${-e.currentTarget.scrollTop}px, 0)`)},onKeyDown:e=>{let t=e.key.toLowerCase();if((e.metaKey||e.ctrlKey)&&t===`s`){e.preventDefault(),a();return}e.altKey&&e.shiftKey&&t===`f`&&(e.preventDefault(),o())},disabled:r,spellCheck:!1,wrap:`off`,className:l(`absolute inset-0 z-10 h-full w-full resize-none overflow-auto whitespace-pre border-0 bg-transparent p-4 text-left font-mono text-[12px] leading-5 outline-none selection:bg-primary-500/25 disabled:cursor-not-allowed`,y?`text-transparent caret-ink`:`text-ink`),style:y?{WebkitTextFillColor:`transparent`,caretColor:`rgb(var(--color-ink))`,tabSize:2}:{tabSize:2}}),_&&(0,K.jsx)(`span`,{dir:`auto`,className:`pointer-events-none absolute bottom-2 end-3 z-20 rounded-md border border-line bg-surface-overlay/90 px-2 py-1 text-[10px] text-ink-muted shadow-subtle`,title:s(`work.files.highlightPaused`,{defaultValue:`Live highlighting is paused for large files to keep editing responsive.`}),children:s(`work.files.plainTextLarge`,{defaultValue:`Plain text · large file`})})]})}var xt=4e6,St=e=>{if(e===``)return[];let t=e.split(`
4
+ `);return t[t.length-1]===``&&t.pop(),t},$=(e,t)=>{let n=St(e),r=St(t),i=0;for(;i<n.length&&i<r.length&&n[i]===r[i];)i+=1;let a=0;for(;a<n.length-i&&a<r.length-i&&n[n.length-1-a]===r[r.length-1-a];)a+=1;let o=n.slice(i,n.length-a),s=r.slice(i,r.length-a),c=[];for(let e=0;e<i;e+=1)c.push({type:`context`,text:n[e],beforeLine:e+1,afterLine:e+1});let l=Ct(o,s);for(let e of l){let t={type:e.type,text:e.text};e.beforeLine!==void 0&&(t.beforeLine=e.beforeLine+i),e.afterLine!==void 0&&(t.afterLine=e.afterLine+i),c.push(t)}for(let e=0;e<a;e+=1){let t=n.length-a+e,i=r.length-a+e;c.push({type:`context`,text:n[t],beforeLine:t+1,afterLine:i+1})}return c},Ct=(e,t)=>{if(e.length===0&&t.length===0)return[];if(e.length>0&&t.length>0&&e.length*t.length>xt)return[...e.map((e,t)=>({type:`removed`,text:e,beforeLine:t+1})),...t.map((e,t)=>({type:`added`,text:e,afterLine:t+1}))];let n=e.length+1,r=t.length+1,i=new Uint32Array(n*r);for(let n=e.length-1;n>=0;--n)for(let a=t.length-1;a>=0;--a)i[n*r+a]=e[n]===t[a]?i[(n+1)*r+a+1]+1:Math.max(i[(n+1)*r+a],i[n*r+a+1]);let a=[],o=0,s=0;for(;o<e.length&&s<t.length;)e[o]===t[s]?(a.push({type:`context`,text:e[o],beforeLine:o+1,afterLine:s+1}),o+=1,s+=1):i[(o+1)*r+s]>=i[o*r+s+1]?(a.push({type:`removed`,text:e[o],beforeLine:o+1}),o+=1):(a.push({type:`added`,text:t[s],afterLine:s+1}),s+=1);for(;o<e.length;)a.push({type:`removed`,text:e[o],beforeLine:o+1}),o+=1;for(;s<t.length;)a.push({type:`added`,text:t[s],afterLine:s+1}),s+=1;return a},wt=e=>{let t=0,n=0;for(let r of e)r.type===`added`&&(t+=1),r.type===`removed`&&(n+=1);return{added:t,removed:n}},Tt=3,Et=e=>{let t=Array(e.length).fill(!1);for(let n=0;n<e.length;n+=1){if(e[n].type===`context`)continue;let r=Math.max(0,n-Tt),i=Math.min(e.length-1,n+Tt);for(let e=r;e<=i;e+=1)t[e]=!0}let n=[],r=[];for(let i=0;i<e.length;i+=1){if(!t[i]){r.push(e[i]);continue}r.length>0&&(n.push({type:`fold`,count:r.length,lines:r}),r=[]),n.push({type:`line`,line:e[i]})}return r.length>0&&n.push({type:`fold`,count:r.length,lines:r}),n};function Dt({line:e}){return(0,K.jsxs)(`tr`,{className:l(e.type===`added`&&`bg-[rgb(76,212,117)]/[0.12] text-ink`,e.type===`removed`&&`bg-[rgb(255,61,129)]/[0.10] text-ink-muted`,e.type===`context`&&`text-ink-muted`),children:[(0,K.jsx)(`td`,{className:`w-10 select-none px-2 text-right align-top text-[10px] tabular-nums text-ink-subtle`,children:e.beforeLine??``}),(0,K.jsx)(`td`,{className:`w-10 select-none px-2 text-right align-top text-[10px] tabular-nums text-ink-subtle`,children:e.afterLine??``}),(0,K.jsxs)(`td`,{className:`w-full whitespace-pre-wrap break-all px-3 align-top`,children:[(0,K.jsx)(`span`,{"aria-hidden":`true`,className:l(`me-2 inline-block w-3 select-none text-center`,e.type===`added`&&`text-[rgb(46,164,79)]`,e.type===`removed`&&`text-[rgb(255,61,129)]`),children:e.type===`added`?`+`:e.type===`removed`?`−`:``}),e.text||`​`]})]})}var Ot=new Set,kt=e=>{let t=null;return e.map(e=>{let n=e.type===`line`?e.line:e.lines[0],r=t;return t=e.type===`line`?e.line:e.lines[e.lines.length-1],!r||!n?0:n.beforeLine!==void 0&&r.beforeLine!==void 0?n.beforeLine-r.beforeLine-1:n.afterLine!==void 0&&r.afterLine!==void 0?n.afterLine-r.afterLine-1:0})};function At({lines:e}){let{t}=c(),n=(0,G.useMemo)(()=>Et(e),[e]),r=(0,G.useMemo)(()=>kt(n),[n]),[i,a]=(0,G.useState)({rows:null,set:Ot}),o=i.rows===n?i.set:Ot,s=e=>a({rows:n,set:new Set(o).add(e)});return(0,K.jsx)(`table`,{className:`w-full border-collapse`,children:(0,K.jsx)(`tbody`,{children:n.map((e,n)=>{let i=r[n];return(0,K.jsxs)(G.Fragment,{children:[i>0&&(0,K.jsx)(`tr`,{"data-testid":`work-diff-gap`,children:(0,K.jsx)(`td`,{colSpan:3,className:`select-none border-y border-line bg-surface-subtle/70 px-4 py-1 text-center text-[11px] text-ink-subtle`,children:t(`work.files.diffFolded`,{count:i,defaultValue:`{{count}} unchanged lines`})})}),l(e,n)]},`row-${n}`)})})});function l(e,n){return e.type===`fold`?o.has(n)?(0,K.jsx)(G.Fragment,{children:e.lines.map((e,t)=>(0,K.jsx)(Dt,{line:e},t))},`fold-${n}`):(0,K.jsx)(`tr`,{children:(0,K.jsx)(`td`,{colSpan:3,className:`p-0`,children:(0,K.jsxs)(`button`,{type:`button`,"data-testid":`work-diff-fold`,onClick:()=>s(n),className:`flex w-full select-none items-center justify-center gap-1.5 border-y border-line bg-surface-subtle/70 px-4 py-1 text-[11px] text-ink-subtle transition-colors hover:bg-surface-subtle hover:text-ink`,children:[(0,K.jsx)(oe,{className:`h-3 w-3 shrink-0`}),t(`work.files.diffFolded`,{count:e.count,defaultValue:`{{count}} unchanged lines`})]})})},`fold-${n}`):(0,K.jsx)(Dt,{line:e.line},`line-${n}`)}}function jt({lines:e,ariaLabel:t}){return(0,K.jsx)(`div`,{dir:`ltr`,role:`region`,"aria-label":t,"data-testid":`work-file-diff`,className:`min-h-0 flex-1 overflow-auto bg-surface font-mono text-[12px] leading-5`,children:(0,K.jsx)(At,{lines:e})})}var Mt=e=>{if(!e.startsWith(`"`)||!e.endsWith(`"`)||e.length<2)return e;let t=e.slice(1,-1),n=``;for(let e=0;e<t.length;e+=1){let r=t[e];if(r!==`\\`||e===t.length-1){n+=r;continue}e+=1;let i=t[e];if(i===`n`)n+=`
5
+ `;else if(i===`t`)n+=` `;else if(i===`\\`||i===`"`)n+=i;else if(i>=`0`&&i<=`7`){let r=i;for(;r.length<3&&e+1<t.length&&t[e+1]>=`0`&&t[e+1]<=`7`;)e+=1,r+=t[e];n+=String.fromCharCode(parseInt(r,8))}else n+=`\\${i}`}return n},Nt=e=>{let t=Mt(e);return t.startsWith(`a/`)||t.startsWith(`b/`)?t.slice(2):t},Pt=e=>{let t=e.slice(11).trim();if(t.startsWith(`"`)){let e=t.indexOf(`" `,1);return e===-1?null:{oldPath:Nt(t.slice(0,e+1)),newPath:Nt(t.slice(e+2).trim())}}let n=t.lastIndexOf(` b/`);if(n===-1){let e=t.indexOf(` `);return e===-1?null:{oldPath:Nt(t.slice(0,e)),newPath:Nt(t.slice(e+1))}}return{oldPath:Nt(t.slice(0,n)),newPath:Nt(t.slice(n+1))}},Ft=/^@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@/,It=e=>({path:e.status===`deleted`?e.oldPath:e.newPath,...e.status===`renamed`&&e.oldPath!==e.newPath?{oldPath:e.oldPath}:{},status:e.status,binary:e.binary,lines:e.lines,stats:wt(e.lines)}),Lt=e=>{let t=[],n=null;for(let r of e.split(`
6
+ `)){if(r.startsWith(`diff --git `)){n&&t.push(It(n));let e=Pt(r);n={oldPath:e?.oldPath??``,newPath:e?.newPath??e?.oldPath??``,status:`modified`,binary:!1,lines:[]};continue}if(!n)continue;if(r.startsWith(`new file mode`)){n.status=`added`;continue}if(r.startsWith(`deleted file mode`)){n.status=`deleted`;continue}if(r.startsWith(`rename from `)){n.status=`renamed`,n.oldPath=Mt(r.slice(12));continue}if(r.startsWith(`rename to `)){n.status=`renamed`,n.newPath=Mt(r.slice(10));continue}if(r.startsWith(`Binary files `)||r===`GIT binary patch`){n.binary=!0;continue}if(r.startsWith(`--- `)){let e=r.slice(4).trim();e!==`/dev/null`&&n.status!==`renamed`&&(n.oldPath=Nt(e));continue}if(r.startsWith(`+++ `)){let e=r.slice(4).trim();e!==`/dev/null`&&n.status!==`renamed`&&(n.newPath=Nt(e));continue}let e=r.match(Ft);if(e){n.beforeLine=parseInt(e[1],10),n.afterLine=parseInt(e[2],10);continue}if(!(r.startsWith(`index `)||r.startsWith(`similarity index`)||r.startsWith(`dissimilarity index`)||r.startsWith(`old mode`)||r.startsWith(`new mode`)||r.startsWith(`copy from`)||r.startsWith(`copy to`)||r.startsWith(`\\`))){if(r.startsWith(`+`)){n.lines.push({type:`added`,text:r.slice(1),...n.afterLine===void 0?{}:{afterLine:n.afterLine++}});continue}if(r.startsWith(`-`)){n.lines.push({type:`removed`,text:r.slice(1),...n.beforeLine===void 0?{}:{beforeLine:n.beforeLine++}});continue}if(r.startsWith(` `)){n.lines.push({type:`context`,text:r.slice(1),...n.beforeLine===void 0?{}:{beforeLine:n.beforeLine++},...n.afterLine===void 0?{}:{afterLine:n.afterLine++}});continue}}}return n&&t.push(It(n)),t},Rt=e=>{let t=0,n=0;for(let r of e)t+=r.stats.added,n+=r.stats.removed;return{added:t,removed:n}},zt=(e,t)=>{if(e.success&&e.data)return e.data;throw Error(e.error||t)},Bt=(e,t)=>{let n=e?.response?.data?.error;return typeof n==`string`&&n?n:e instanceof Error&&e.message?e.message:t},Vt=e=>e.indexStatus===`?`,Ht=e=>Vt(e)?`U`:e.workingTreeStatus===`.`?e.indexStatus:e.workingTreeStatus,Ut=e=>({modified:`M`,added:`A`,deleted:`D`,renamed:`R`})[e],Wt=e=>e===`A`||e===`U`?`text-[rgb(46,164,79)]`:e===`D`?`text-[rgb(255,61,129)]`:e===`R`||e===`C`?`text-sky-600 dark:text-sky-400`:`text-amber-600 dark:text-amber-500`,Gt=e=>{let t=e.lastIndexOf(`/`);return t===-1?{name:e,directory:``}:{name:e.slice(t+1),directory:e.slice(0,t)}};function Kt({added:e,removed:t,muted:n=!1}){return(0,K.jsxs)(`span`,{dir:`ltr`,className:`shrink-0 font-mono text-[10px] tabular-nums`,children:[(0,K.jsxs)(`span`,{className:n?`text-ink-subtle`:`text-[rgb(46,164,79)]`,children:[`+`,e]}),` `,(0,K.jsxs)(`span`,{className:n?`text-ink-subtle`:`text-[rgb(255,61,129)]`,children:[`−`,t]})]})}function qt({letter:e,path:t,oldPath:n,added:r,removed:i}){return(0,K.jsxs)(`div`,{className:`sticky top-0 z-10 flex items-center gap-2 border-b border-line bg-surface-raised/95 px-3 py-1.5 backdrop-blur`,children:[(0,K.jsx)(`span`,{"aria-hidden":`true`,className:l(`w-4 shrink-0 text-center font-mono text-[11px] font-semibold`,Wt(e)),children:e}),(0,K.jsx)(`span`,{dir:`ltr`,className:`min-w-0 flex-1 truncate text-start font-mono text-[11px] text-ink`,title:n?`${n} → ${t}`:t,children:n?`${n} → ${t}`:t}),(0,K.jsx)(Kt,{added:r,removed:i})]})}function Jt({taskId:e,mutationsDisabled:t=!1,disabledReason:n}){let{t:r}=c(),[i,a]=(0,G.useState)(null),[o,s]=(0,G.useState)(!0),[u,d]=(0,G.useState)(!1),[f,p]=(0,G.useState)(null),[h,b]=(0,G.useState)([]),[x,S]=(0,G.useState)(``),[C,T]=(0,G.useState)(``),[E,ee]=(0,G.useState)(``),[O,k]=(0,G.useState)(null),[te,A]=(0,G.useState)(!1),[j,M]=(0,G.useState)(null),[ne,re]=(0,G.useState)(!1),P=(0,G.useRef)(0),F=(0,G.useRef)(0),I=(0,G.useCallback)(async()=>{let t=++P.current;s(!0),p(null);try{let n=zt(await z.getGitStatus(e),r(`work.git.loadFailed`,{defaultValue:`Could not load Git status.`}));if(t!==P.current)return;a(n),b([])}catch(e){if(t!==P.current)return;p(Bt(e,r(`work.git.loadFailed`,{defaultValue:`Could not load Git status.`})))}finally{t===P.current&&s(!1)}},[r,e]);(0,G.useEffect)(()=>{let e=window.setTimeout(()=>void I(),0);return()=>{window.clearTimeout(e),P.current+=1}},[I]),(0,G.useEffect)(()=>{let t=!1,n=window.setTimeout(async()=>{if(!i?.initialized){M(null);return}if(!i.changes.some(e=>!Vt(e))){M(i.changes.length>0?{files:[],truncated:!1}:null);return}re(!0);try{let n=await z.getGitDiff(e);if(t||!n.success||!n.data)return;M({files:Lt(n.data.patch),truncated:n.data.truncated})}catch{}finally{t||re(!1)}},0);return()=>{t=!0,window.clearTimeout(n)}},[i,e]);let ie=async(e,n)=>{if(t||u)return!1;d(!0),p(null);try{let t=zt(await e(),r(`work.git.actionFailed`,{defaultValue:`Git action failed.`}));return F.current+=1,a(t),b([]),k(null),m.success(n),!0}catch(e){let t=Bt(e,r(`work.git.actionFailed`,{defaultValue:`Git action failed.`}));return p(t),m.error(t),!1}finally{d(!1)}},oe=async t=>{let n=++F.current;A(!0),p(null);try{if(Vt(t)){let i=zt(await z.getFile(e,t.path),r(`work.git.diffFailed`,{defaultValue:`Could not load this diff.`}));if(n!==F.current)return;k({path:t.path,status:`added`,lines:$(``,i.content),binary:!1,truncated:!1})}else{let i=zt(await z.getGitDiff(e,t.path),r(`work.git.diffFailed`,{defaultValue:`Could not load this diff.`}));if(n!==F.current)return;let a=Lt(i.patch)[0];k({path:t.path,status:a?.status??`modified`,lines:a?.lines??[],binary:a?.binary??!1,truncated:i.truncated})}}catch(e){if(n!==F.current)return;p(Bt(e,r(`work.git.diffFailed`,{defaultValue:`Could not load this diff.`})))}finally{n===F.current&&A(!1)}},L=(0,G.useMemo)(()=>{let e=new Map;for(let t of j?.files??[])e.set(t.path,t);return e},[j]),se=(0,G.useMemo)(()=>Rt(j?.files??[]),[j]),R=E.trim().toLowerCase(),ce=(0,G.useMemo)(()=>{let e=i?.changes??[];return R?e.filter(e=>e.path.toLowerCase().includes(R)):e},[R,i]);if(o&&!i)return(0,K.jsx)(`div`,{className:`flex h-full items-center justify-center text-ink-muted`,children:(0,K.jsx)(N,{className:`h-5 w-5 animate-spin`})});if(!i)return(0,K.jsxs)(`div`,{className:`flex h-full flex-col items-center justify-center px-6 text-center`,children:[(0,K.jsx)(w,{className:`mb-3 h-8 w-8 text-error-500`}),(0,K.jsx)(`p`,{className:`max-w-sm text-xs leading-relaxed text-error-600`,children:f||r(`work.git.loadFailed`,{defaultValue:`Could not load Git status.`})}),(0,K.jsxs)(B,{size:`sm`,variant:`secondary`,className:`mt-4`,onClick:()=>void I(),children:[(0,K.jsx)(_,{className:`h-3.5 w-3.5`}),r(`common.retry`,{defaultValue:`Retry`})]})]});if(!i.initialized)return(0,K.jsxs)(`div`,{className:`flex h-full flex-col items-center justify-center px-6 text-center`,children:[(0,K.jsx)(w,{className:`mb-3 h-8 w-8 text-ink-subtle`}),(0,K.jsx)(`h3`,{className:`text-sm font-medium text-ink`,children:r(`work.git.notInitialized`,{defaultValue:`Git is not initialized`})}),(0,K.jsx)(`p`,{className:`mt-1 max-w-sm text-xs leading-relaxed text-ink-muted`,children:r(`work.git.initializeDescription`,{defaultValue:`Create a local repository for status, diffs, branches, and commits. No remote credentials are connected.`})}),f&&(0,K.jsx)(`p`,{className:`mt-3 text-xs text-error-600`,children:f}),(0,K.jsxs)(B,{"data-testid":`work-git-init-button`,size:`sm`,className:`mt-4 bg-[#ff7b52] text-[#3d120c] hover:bg-[#ff7b52]/90`,disabled:t||u,onClick:()=>void ie(()=>z.initializeGit(e),r(`work.git.initialized`,{defaultValue:`Git repository initialized.`})),children:[u?(0,K.jsx)(N,{className:`me-2 h-3.5 w-3.5 animate-spin`}):(0,K.jsx)(ue,{className:`me-2 h-3.5 w-3.5`}),r(`work.git.initialize`,{defaultValue:`Initialize Git`})]}),t&&n&&(0,K.jsx)(`p`,{className:`mt-2 text-[11px] text-ink-subtle`,children:n})]});let le=i.changes.filter(e=>e.staged).length,de=i.changes.length>0,fe=ce.filter(Vt),pe=R?(j?.files??[]).filter(e=>e.path.toLowerCase().includes(R)):j?.files??[];return(0,K.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col`,"data-testid":`work-git-panel`,children:[(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 border-b border-line px-3 py-2`,children:[(0,K.jsxs)(`span`,{className:`inline-flex min-w-0 items-center gap-1.5 rounded-lg bg-surface-subtle px-2 py-1 font-mono text-[11px] text-ink`,children:[(0,K.jsx)(w,{className:`h-3.5 w-3.5 shrink-0`}),(0,K.jsx)(`span`,{className:`truncate`,children:i.detached?r(`work.git.detached`,{defaultValue:`detached HEAD`}):i.branch||`main`})]}),j&&(se.added>0||se.removed>0)&&(0,K.jsxs)(`span`,{"data-testid":`work-git-total-stats`,dir:`ltr`,className:`font-mono text-[11px] font-medium tabular-nums`,children:[(0,K.jsxs)(`span`,{className:`text-[rgb(46,164,79)]`,children:[`+`,se.added]}),` `,(0,K.jsxs)(`span`,{className:`text-[rgb(255,61,129)]`,children:[`−`,se.removed]})]}),(i.ahead>0||i.behind>0)&&(0,K.jsxs)(`span`,{className:`text-[10px] text-ink-muted`,children:[`↑`,i.ahead,` ↓`,i.behind]}),(0,K.jsxs)(`select`,{"data-testid":`work-git-branch-select`,"aria-label":r(`work.git.switchBranch`,{defaultValue:`Switch local branch`}),value:i.branch||``,disabled:t||u||de,onChange:t=>{let n=t.target.value;!n||n===i.branch||ie(()=>z.switchGitBranch(e,n),r(`work.git.branchSwitched`,{name:n,defaultValue:`Switched to {{name}}.`}))},className:`h-7 max-w-44 rounded-lg border border-line bg-surface px-2 text-[11px] text-ink outline-none disabled:opacity-50`,children:[i.detached&&(0,K.jsx)(`option`,{value:``,disabled:!0,children:r(`work.git.detached`,{defaultValue:`detached HEAD`})}),i.branches.map(e=>(0,K.jsx)(`option`,{value:e,children:e},e))]}),(0,K.jsxs)(`div`,{className:`flex min-w-44 flex-1 items-center gap-1`,children:[(0,K.jsx)(`input`,{"data-testid":`work-git-branch-input`,value:C,maxLength:200,onChange:e=>T(e.target.value),placeholder:r(`work.git.newBranch`,{defaultValue:`New local branch`}),className:`h-7 min-w-0 flex-1 rounded-lg border border-line bg-surface px-2 font-mono text-[11px] text-ink outline-none placeholder:text-ink-subtle focus:border-primary-500`}),(0,K.jsxs)(B,{"data-testid":`work-git-create-branch-button`,size:`sm`,variant:`ghost`,className:`h-7 px-2`,disabled:t||u||!i.head||!C.trim(),onClick:()=>{let t=C.trim();ie(()=>z.createGitBranch(e,t),r(`work.git.branchCreated`,{name:t,defaultValue:`Created {{name}}.`})).then(e=>{e&&T(``)})},children:[(0,K.jsx)(ue,{className:`h-3.5 w-3.5`}),(0,K.jsx)(`span`,{className:`hidden sm:inline`,children:r(`work.git.createBranch`,{defaultValue:`Create`})})]})]}),(0,K.jsx)(`button`,{type:`button`,onClick:()=>void I(),disabled:o||u,"aria-label":r(`common.refresh`,{defaultValue:`Refresh`}),className:`inline-flex h-7 w-7 items-center justify-center rounded-lg text-ink-muted hover:bg-surface-subtle hover:text-ink disabled:opacity-50`,children:(0,K.jsx)(_,{className:l(`h-3.5 w-3.5`,o&&`animate-spin`)})})]}),f&&(0,K.jsx)(`div`,{className:`border-b border-error-200 bg-error-50 px-3 py-2 text-xs text-error-700 dark:border-error-900/60 dark:bg-error-900/30 dark:text-error-300`,children:f}),t&&n&&(0,K.jsx)(`div`,{className:`border-b border-line px-3 py-1.5 text-[11px] text-ink-subtle`,children:n}),(0,K.jsxs)(`div`,{className:`grid min-h-0 flex-1 grid-cols-1 lg:grid-cols-[minmax(15rem,0.75fr)_minmax(0,2.25fr)]`,children:[(0,K.jsxs)(`section`,{className:`flex min-h-0 flex-col border-b border-line lg:border-b-0 lg:border-e`,children:[(0,K.jsxs)(`div`,{className:`flex items-center justify-between gap-2 px-3 py-2`,children:[(0,K.jsxs)(`h3`,{className:`text-xs font-medium text-ink`,children:[r(`work.git.changes`,{defaultValue:`Changes`}),` `,(0,K.jsx)(`span`,{className:`text-ink-subtle`,children:i.changes.length})]}),(0,K.jsxs)(B,{"data-testid":`work-git-stage-button`,size:`sm`,variant:`ghost`,className:`h-7 px-2 text-[11px]`,disabled:t||u||h.length===0&&i.changes.length===0,onClick:()=>{let t=h.length>0?h:i.changes.map(e=>e.path);ie(()=>z.stageGitPaths(e,t),r(`work.git.staged`,{defaultValue:`Changes staged.`}))},children:[(0,K.jsx)(ae,{className:`h-3.5 w-3.5`}),h.length>0?r(`work.git.stageSelected`,{count:h.length,defaultValue:`Stage {{count}}`}):r(`work.git.stageAll`,{defaultValue:`Stage all`})]})]}),i.changes.length>0&&(0,K.jsxs)(`div`,{className:`relative px-2 pb-1.5`,children:[(0,K.jsx)(y,{className:`pointer-events-none absolute start-4 top-1/2 h-3 w-3 -translate-y-[calc(50%+3px)] text-ink-subtle`}),(0,K.jsx)(`input`,{"data-testid":`work-git-filter`,value:E,maxLength:500,onChange:e=>ee(e.target.value),placeholder:r(`work.git.filterFiles`,{defaultValue:`Filter changed files`}),"aria-label":r(`work.git.filterFiles`,{defaultValue:`Filter changed files`}),className:`h-7 w-full rounded-lg border border-line bg-surface pe-2 ps-7 text-[11px] text-ink outline-none placeholder:text-ink-subtle focus:border-primary-500`})]}),(0,K.jsx)(`div`,{className:`min-h-32 flex-1 overflow-y-auto px-2 pb-2`,children:i.changes.length===0?(0,K.jsx)(`p`,{className:`px-2 py-8 text-center text-xs text-ink-muted`,children:r(`work.git.clean`,{defaultValue:`Working tree is clean.`})}):ce.length===0?(0,K.jsx)(`p`,{className:`px-2 py-8 text-center text-xs text-ink-muted`,children:r(`work.git.noFilterMatches`,{defaultValue:`No changed files match this filter.`})}):ce.map(e=>{let t=Ht(e),{name:n,directory:i}=Gt(e.path),a=L.get(e.path);return(0,K.jsxs)(`div`,{className:l(`flex items-center gap-1 rounded-lg hover:bg-surface-subtle`,O?.path===e.path&&`bg-surface-subtle`),children:[(0,K.jsx)(`input`,{type:`checkbox`,"aria-label":r(`work.git.selectPath`,{path:e.path,defaultValue:`Select {{path}}`}),checked:h.includes(e.path),onChange:t=>b(n=>t.target.checked?[...n,e.path]:n.filter(t=>t!==e.path)),className:`ms-2 h-3.5 w-3.5 accent-[#ff7b52]`}),(0,K.jsxs)(`button`,{type:`button`,"data-testid":`work-git-change`,onClick:()=>void oe(e),className:`flex min-w-0 flex-1 items-center gap-2 px-1.5 py-2 text-start`,title:e.path,children:[(0,K.jsx)(`span`,{"aria-hidden":`true`,className:l(`w-3.5 shrink-0 text-center font-mono text-[10px] font-semibold`,Wt(t),e.staged&&`underline underline-offset-2`),children:t}),(0,K.jsxs)(`span`,{dir:`ltr`,className:`min-w-0 flex-1 truncate text-start font-mono text-[11px]`,children:[(0,K.jsx)(`span`,{className:`text-ink`,children:n}),i&&(0,K.jsxs)(`span`,{className:`text-ink-subtle`,children:[` `,i]})]}),a&&(a.stats.added>0||a.stats.removed>0)&&(0,K.jsx)(Kt,{added:a.stats.added,removed:a.stats.removed})]})]},`${e.path}:${e.originalPath||``}`)})}),(0,K.jsxs)(`div`,{className:`border-t border-line p-2`,children:[(0,K.jsx)(`textarea`,{"data-testid":`work-git-commit-input`,value:x,maxLength:4e3,rows:2,onChange:e=>S(e.target.value),placeholder:r(`work.git.commitMessage`,{defaultValue:`Commit message`}),className:`w-full resize-none rounded-lg border border-line bg-surface px-2.5 py-2 text-xs text-ink outline-none placeholder:text-ink-subtle focus:border-primary-500`}),(0,K.jsxs)(B,{"data-testid":`work-git-commit-button`,size:`sm`,className:`mt-1.5 w-full bg-[#ff7b52] text-[#3d120c] hover:bg-[#ff7b52]/90`,disabled:t||u||le===0||!x.trim(),onClick:()=>{let t=x.trim();ie(()=>z.commitGit(e,t),r(`work.git.committed`,{defaultValue:`Commit created.`})).then(e=>{e&&S(``)})},children:[u&&(0,K.jsx)(N,{className:`h-3.5 w-3.5 animate-spin`}),r(`work.git.commit`,{defaultValue:`Commit staged changes`})]})]}),(0,K.jsxs)(`div`,{className:`max-h-56 shrink-0 overflow-y-auto border-t border-line p-3`,children:[(0,K.jsxs)(`div`,{className:`mb-2 flex items-center gap-2 text-xs font-medium text-ink`,children:[(0,K.jsx)(g,{className:`h-3.5 w-3.5`}),r(`work.git.history`,{defaultValue:`Local history`})]}),i.commits.length===0?(0,K.jsx)(`p`,{className:`py-3 text-center text-xs text-ink-muted`,children:r(`work.git.noCommits`,{defaultValue:`No commits yet.`})}):(0,K.jsx)(`ol`,{className:`space-y-2`,children:i.commits.map(e=>(0,K.jsxs)(`li`,{className:`rounded-lg border border-line bg-surface px-2.5 py-2`,children:[(0,K.jsx)(`p`,{dir:`auto`,className:`text-xs text-ink`,children:e.subject}),(0,K.jsxs)(`p`,{className:`mt-1 flex flex-wrap gap-x-2 text-[10px] text-ink-subtle`,children:[(0,K.jsx)(`span`,{dir:`ltr`,className:`font-mono`,children:e.shortHash}),(0,K.jsx)(`span`,{dir:`auto`,children:e.author}),(0,K.jsx)(`time`,{dateTime:e.authoredAt,children:new Date(e.authoredAt).toLocaleDateString()})]})]},e.hash))}),(0,K.jsx)(`p`,{className:`mt-3 border-t border-line pt-2 text-[10px] leading-relaxed text-ink-subtle`,children:r(`work.git.localOnly`,{defaultValue:`Local Git only. Push, pull, and pull requests require a separate trusted credential broker.`})})]})]}),(0,K.jsx)(`section`,{className:`flex min-h-48 min-w-0 flex-col`,children:O||te?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-1.5 border-b border-line px-2 py-1.5`,children:[(0,K.jsxs)(`button`,{type:`button`,"data-testid":`work-git-all-changes-button`,onClick:()=>{F.current+=1,k(null),A(!1)},className:`inline-flex h-6 shrink-0 items-center gap-1 rounded-lg px-1.5 text-[11px] text-ink-muted hover:bg-surface-subtle hover:text-ink`,children:[(0,K.jsx)(D,{className:`h-3 w-3 rtl:rotate-180`}),r(`work.git.allChanges`,{defaultValue:`All changes`})]}),O&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`span`,{"aria-hidden":`true`,className:l(`w-4 shrink-0 text-center font-mono text-[11px] font-semibold`,Wt(Ut(O.status))),children:Ut(O.status)}),(0,K.jsx)(`span`,{dir:`ltr`,className:`min-w-0 flex-1 truncate font-mono text-[11px] text-ink`,title:O.path,children:O.path}),!O.binary&&(0,K.jsx)(Kt,{added:O.lines.filter(e=>e.type===`added`).length,removed:O.lines.filter(e=>e.type===`removed`).length})]})]}),te?(0,K.jsx)(N,{className:`m-auto h-5 w-5 animate-spin text-ink-muted`}):O?(0,K.jsxs)(`div`,{"data-testid":`work-git-diff`,dir:`ltr`,className:`min-h-0 flex-1 overflow-auto bg-surface font-mono text-[12px] leading-5`,children:[O.truncated&&(0,K.jsx)(`p`,{className:`border-b border-line bg-surface-subtle/70 px-3 py-1.5 text-center font-sans text-[11px] text-ink-subtle`,children:r(`work.git.diffTruncated`,{defaultValue:`This diff is truncated.`})}),O.binary?(0,K.jsx)(`p`,{className:`px-5 py-10 text-center font-sans text-xs text-ink-muted`,children:r(`work.git.binaryFile`,{defaultValue:`Binary file, no text diff.`})}):O.lines.length===0?(0,K.jsx)(`p`,{className:`px-5 py-10 text-center font-sans text-xs text-ink-muted`,children:r(`work.git.noDiff`,{defaultValue:`No textual diff is available yet. Untracked files appear after staging.`})}):(0,K.jsx)(At,{lines:O.lines})]}):null]}):i.changes.length===0?(0,K.jsx)(`p`,{className:`m-auto px-5 text-center text-xs text-ink-muted`,children:r(`work.git.clean`,{defaultValue:`Working tree is clean.`})}):ne&&!j?(0,K.jsx)(N,{className:`m-auto h-5 w-5 animate-spin text-ink-muted`}):(0,K.jsxs)(`div`,{"data-testid":`work-git-review`,dir:`ltr`,className:`min-h-0 flex-1 overflow-auto bg-surface font-mono text-[12px] leading-5`,children:[j?.truncated&&(0,K.jsx)(`p`,{className:`border-b border-line bg-surface-subtle/70 px-3 py-1.5 text-center font-sans text-[11px] text-ink-subtle`,children:r(`work.git.diffTruncated`,{defaultValue:`This diff is truncated.`})}),pe.map(e=>(0,K.jsxs)(`div`,{"data-testid":`work-git-review-file`,children:[(0,K.jsx)(qt,{letter:Ut(e.status),path:e.path,oldPath:e.oldPath,added:e.stats.added,removed:e.stats.removed}),e.binary?(0,K.jsx)(`p`,{className:`px-5 py-6 text-center font-sans text-xs text-ink-muted`,children:r(`work.git.binaryFile`,{defaultValue:`Binary file, no text diff.`})}):(0,K.jsx)(At,{lines:e.lines})]},e.path)),fe.map(e=>(0,K.jsx)(`div`,{"data-testid":`work-git-review-file`,children:(0,K.jsxs)(`button`,{type:`button`,onClick:()=>void oe(e),title:e.path,className:`flex w-full items-center gap-2 border-b border-line px-3 py-1.5 text-start hover:bg-surface-subtle`,children:[(0,K.jsx)(`span`,{"aria-hidden":`true`,className:`w-4 shrink-0 text-center font-mono text-[11px] font-semibold text-[rgb(46,164,79)]`,children:`U`}),(0,K.jsx)(`span`,{dir:`ltr`,className:`min-w-0 flex-1 truncate font-mono text-[11px] text-ink`,children:e.path}),(0,K.jsx)(v,{className:`h-3 w-3 shrink-0 text-ink-subtle`})]})},e.path)),pe.length===0&&fe.length===0&&(0,K.jsx)(`p`,{className:`px-5 py-10 text-center font-sans text-xs text-ink-muted`,children:R?r(`work.git.noFilterMatches`,{defaultValue:`No changed files match this filter.`}):r(`work.git.selectChange`,{defaultValue:`Select a changed file to inspect its diff.`})})]})})]})]})}function Yt(e,t){return ge(e,t.ticket,t)}async function Xt(e){let t=(await fe.post(`/auth/websocket-ticket`,{audience:`work-terminal`,taskId:e})).data.data?.ticket;if(!t)throw Error(`The server did not issue a terminal ticket.`);return Yt(e,{protocol:window.location.protocol,host:window.location.host,hostname:window.location.hostname,apiBaseUrl:void 0,websocketBaseUrl:void 0,production:!0,ticket:t})}var Zt={background:`#ffffff`,foreground:`#1f2328`,cursor:`#1f2328`,selectionBackground:`rgba(255, 123, 82, 0.28)`},Qt={background:`#0f1115`,foreground:`#e6e6e6`,cursor:`#ff7b52`,selectionBackground:`rgba(255, 123, 82, 0.32)`};function $t({taskId:e,active:t,disabledReason:n}){let{t:r}=c(),i=xe(e=>e.theme.mode===`dark`),o=(0,G.useRef)(null),s=(0,G.useRef)(null),u=(0,G.useRef)(null),d=(0,G.useRef)(null),[f,m]=(0,G.useState)(`idle`),[h,g]=(0,G.useState)(null),[_,v]=(0,G.useState)(0),y=(0,G.useCallback)(()=>{let e=d.current,t=u.current,n=s.current;if(!(!e||!t||!n||n.readyState!==WebSocket.OPEN)){try{e.fit()}catch{return}n.send(JSON.stringify({type:`resize`,cols:t.cols,rows:t.rows}))}},[]);(0,G.useEffect)(()=>{if(!t||n)return;let r=!1,c,l;return(async()=>{m(`connecting`),g(null);let[{Terminal:t},{FitAddon:n}]=await Promise.all([a(()=>import(`./xterm-Da5ppSVt.js`),[]),a(()=>import(`./addon-fit-DIOBYJe3.js`),[])]);if(await a(()=>Promise.resolve({}),__vite__mapDeps([32])),r||!o.current)return;c=new t({allowProposedApi:!0,convertEol:!1,cursorBlink:!0,fontFamily:`ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace`,fontSize:12,scrollback:5e3,theme:i?Qt:Zt});let f=new n;c.loadAddon(f),c.open(o.current),u.current=c,d.current=f;try{f.fit()}catch{}let p;try{p=await Xt(e)}catch(e){r||(m(`error`),g(e instanceof Error?e.message:null));return}if(r)return;l=new WebSocket(p),l.binaryType=`arraybuffer`,s.current=l;let h=new TextDecoder;l.onmessage=e=>{if(typeof e.data!=`string`){c?.write(h.decode(new Uint8Array(e.data)));return}try{let t=JSON.parse(e.data);if(t.type===`ready`){m(`connected`),y(),c?.focus();return}if(t.type===`error`){m(`error`),g(t.message||null);return}t.type===`exit`&&m(`closed`)}catch{}},l.onclose=()=>{r||m(e=>e===`error`||e===`closed`?e:`closed`)},l.onerror=()=>{r||m(`error`)},c.onData(e=>{l?.readyState===WebSocket.OPEN&&l.send(JSON.stringify({type:`input`,data:e}))})})(),()=>{r=!0,l?.close(),s.current=null,c?.dispose(),u.current=null,d.current=null}},[t,n,_,i,y,e]),(0,G.useEffect)(()=>{let e=o.current;if(!e||!t)return;let n=new ResizeObserver(()=>y());return n.observe(e),()=>n.disconnect()},[t,y]);let b=()=>{s.current?.close(),v(e=>e+1)},x=n??(f===`error`?h??r(`work.terminal.failed`,{defaultValue:`The terminal session could not start.`}):f===`closed`?r(`work.terminal.closed`,{defaultValue:`Terminal session ended.`}):null);return(0,K.jsxs)(`div`,{"data-testid":`work-terminal-panel`,"data-status":n?`unavailable`:f,className:`relative flex min-h-0 flex-1 flex-col bg-surface`,children:[!n&&(0,K.jsx)(`div`,{ref:o,"data-testid":`work-terminal-surface`,dir:`ltr`,className:l(`min-h-0 flex-1 overflow-hidden p-2 text-left`,f!==`connected`&&`opacity-60`)}),f===`connecting`&&!n&&(0,K.jsxs)(`div`,{className:`pointer-events-none absolute inset-0 flex items-center justify-center gap-2 text-xs text-ink-muted`,children:[(0,K.jsx)(N,{className:`h-4 w-4 animate-spin`}),r(`work.terminal.connecting`,{defaultValue:`Opening a shell in the sandbox…`})]}),x&&(0,K.jsxs)(`div`,{role:f===`error`?`alert`:void 0,className:`flex flex-col items-center gap-3 border-t border-line bg-surface-raised px-6 py-4 text-center`,children:[(0,K.jsx)(p,{className:`h-6 w-6 text-ink-subtle`}),(0,K.jsx)(`p`,{dir:`auto`,"data-testid":`work-terminal-status`,className:`max-w-md text-xs leading-relaxed text-ink-muted`,children:x}),!n&&(0,K.jsx)(B,{size:`sm`,"data-testid":`work-terminal-reconnect-button`,className:`h-8 rounded-lg bg-[#ff7b52] px-3 text-[#3d120c] hover:bg-[#ff7b52]/90`,onClick:b,children:r(`work.terminal.reconnect`,{defaultValue:`Reconnect`})})]})]})}var en=e=>{if(!e)return null;if(/^\/api\/work\/previews\/[A-Za-z0-9-]{1,100}\/\d{1,5}\.[A-Za-z0-9_-]{22}\.[A-Za-z0-9_-]{43}\//.test(e))try{let t=new URL(de,window.location.origin).origin;return new URL(e,`${t}/`).toString()}catch{return null}return null},tn=e=>{let t=e.split(`/`).filter(Boolean);return t.pop(),t.join(`/`)},nn=(e,t)=>{let n=e.metadata?.name??e.metadata?.toolName??e.metadata?.tool??e.metadata?.command;return typeof n==`string`&&n?n:t};function rn({task:e,liveRun:t,files:n,selectedFile:r,loadingFiles:i,actionLoading:a,onLoadFiles:o,onLoadFile:s,onClearSelectedFile:d,onSaveFile:h,onStartPreview:g,onStopPreview:v,onDirtyChange:y,terminal:C}){let{t:E,i18n:ee}=c(),O=u(ee.language),[k,A]=(0,G.useState)(`files`),[M,re]=(0,G.useState)(``),[P,F]=(0,G.useState)(``),[I,ie]=(0,G.useState)(),[ae,oe]=(0,G.useState)(``),[L,le]=(0,G.useState)(!1),[ue,de]=(0,G.useState)(!1),fe=(0,G.useRef)(new Map),[z,pe]=(0,G.useState)(()=>new Map),ge=en(e.previewUrl),_e=t?.runId,ve=t?.error,be=t?.tools,xe=(0,G.useMemo)(()=>{let t=new Set(be?.map(e=>e.id)||[]);return(e.messages||[]).filter(e=>{if(e.kind===`reasoning`||e.role!==`tool`&&e.kind===`message`)return!1;if(!_e||e.runId!==_e)return!0;if(e.kind===`error`&&ve)return!1;let n=e.metadata?.toolCallId;return typeof n!=`string`||!t.has(n)})},[ve,_e,be,e.messages]),Se=xe.length+(be?.length||0),Ce=!!r&&P!==(r?.content??``),V=e.status===`preparing`||e.status===`running`,H=(0,G.useRef)(V),U=(0,G.useRef)(0),W=(0,G.useRef)(P),we=(0,G.useRef)(I),Te=(0,G.useRef)(r),Ee=(0,G.useRef)(e.id),De=(0,G.useRef)(o),Oe=(0,G.useRef)(s),ke=(0,G.useRef)(y),q=(0,G.useRef)(!0),Ae=r?z.get(r.path):void 0,J=(0,G.useMemo)(()=>r&&Ae!==void 0&&Ae!==r.content?$(Ae,r.content):null,[Ae,r]),je=(0,G.useMemo)(()=>J?wt(J):null,[J]),Me=!!(je&&(je.added>0||je.removed>0)),Ne=r?ft(r.path):!1,Pe=!r||pt(P),Fe=Ne&&Pe;(0,G.useEffect)(()=>{W.current=P,we.current=I,Te.current=r,Ee.current=e.id,ke.current=y},[I,P,y,r,e.id]),(0,G.useEffect)(()=>{De.current=o,Oe.current=s},[s,o]),(0,G.useEffect)(()=>(q.current=!0,()=>{q.current=!1,U.current+=1,ke.current(!1)}),[]),(0,G.useEffect)(()=>{if(!H.current&&V&&pe(new Map(fe.current)),H.current&&!V&&(De.current(M),r&&!Ce)){let e=++U.current,t=r.path,n=W.current,i=we.current;Oe.current(t).then(r=>{if(!q.current||e!==U.current||r.path!==t||W.current!==n||we.current!==i)return;fe.current.set(r.path,r.content);let a=z.get(r.path);a!==void 0&&a!==r.content&&de(!0),W.current=r.content,we.current=r.updatedAt??r.modifiedAt,F(r.content),ie(r.updatedAt??r.modifiedAt)}).catch(()=>void 0)}H.current=V},[M,Ce,r,V,z]);let Y=()=>!Ce||window.confirm(E(`work.files.discard`,{defaultValue:`Discard unsaved file changes?`})),Le=()=>{r&&me(e.id,r.path)},Re=async e=>{Y()&&(U.current+=1,Le(),d(),y(!1),de(!1),re(e),await o(e).catch(()=>void 0))},ze=async t=>{if(!Y())return;let n=++U.current;Le();let r=await s(t).catch(()=>void 0);if(!q.current||!r||n!==U.current)return;fe.current.set(r.path,r.content);let i=z.get(r.path);de(i!==void 0&&i!==r.content);let a=ye(e.id,r.path),o=a?.content??r.content,c=a?.baseUpdatedAt??r.updatedAt??r.modifiedAt;W.current=o,we.current=c,F(o),ie(c),y(a!==null&&a.content!==r.content)},Be=()=>{Y()&&(U.current+=1,Le(),d(),y(!1),de(!1))},Ve=t=>{r&&(W.current=t,F(t),t===r.content?me(e.id,r.path):he(e.id,r.path,{content:t,baseUpdatedAt:I??r.updatedAt??r.modifiedAt}),y(t!==r.content))},He=async()=>{if(!r)return;let t=e.id,n=r.path,i=P,a=U.current,o=await h(n,i,I).catch(()=>!1);if(!q.current||o===!1||a!==U.current||Ee.current!==t||Te.current?.path!==n)return;let s=o.updatedAt??o.modifiedAt;fe.current.set(n,typeof o.content==`string`?o.content:i),we.current=s,ie(s);let c=W.current;if(c===i){me(t,n),y(!1);return}he(t,n,{content:c,baseUpdatedAt:s}),y(!0)},Ue=async()=>{if(!r||V||L||!Fe)return;le(!0);let e=U.current,t=r.path,n=W.current;try{let r=await ht(t,n);if(!q.current||e!==U.current||Te.current?.path!==t||W.current!==n)return;Ve(r),m.success(E(`work.files.formatted`,{defaultValue:`Code formatted.`}))}catch(r){if(!q.current||e!==U.current||Te.current?.path!==t||W.current!==n)return;m.error(r instanceof Error?r.message:E(`work.files.formatFailed`,{defaultValue:`Could not format this file.`}))}finally{q.current&&le(!1)}},X=[{id:`files`,label:E(`work.workspace.files`,{defaultValue:`Files`}),icon:b,testId:`work-files-tab`},{id:`activity`,label:E(`work.workspace.activity`,{defaultValue:`Activity`}),icon:se,testId:`work-activity-tab`},{id:`git`,label:E(`work.workspace.git`,{defaultValue:`Git`}),icon:w,testId:`work-git-tab`},{id:`terminal`,label:E(`work.workspace.terminal`,{defaultValue:`Terminal`}),icon:p,testId:`work-terminal-tab`},{id:`preview`,label:E(`work.workspace.preview`,{defaultValue:`Preview`}),icon:te,testId:`work-preview-tab`}],We=(e,t)=>{let n=null;if(e.key===`ArrowRight`&&(n=(t+(O?-1:1)+X.length)%X.length),e.key===`ArrowLeft`&&(n=(t+(O?1:-1)+X.length)%X.length),e.key===`Home`&&(n=0),e.key===`End`&&(n=X.length-1),n===null)return;e.preventDefault();let r=X[n];A(r.id),e.currentTarget.parentElement?.querySelector(`#work-workspace-tab-${r.id}`)?.focus()};return(0,K.jsxs)(`section`,{className:`flex h-full min-h-0 flex-col bg-transparent`,children:[(0,K.jsxs)(`div`,{"data-testid":`work-workspace-toolbar`,className:`flex h-12 shrink-0 items-center gap-2 border-b border-line bg-surface-raised/75 px-2 backdrop-blur-xl`,children:[(0,K.jsx)(`div`,{role:`tablist`,"aria-orientation":`horizontal`,"aria-label":E(`work.workspace.label`,{defaultValue:`Workspace views`}),className:`flex min-w-0 items-center overflow-x-auto rounded-xl border border-line bg-surface-subtle p-0.5 [-ms-overflow-style:none] [scrollbar-width:none] [&::-webkit-scrollbar]:hidden`,children:X.map((e,t)=>{let n=e.icon;return(0,K.jsxs)(`button`,{type:`button`,role:`tab`,id:`work-workspace-tab-${e.id}`,"aria-selected":k===e.id,"aria-controls":k===e.id?`work-workspace-panel-${e.id}`:void 0,"aria-label":e.label,tabIndex:k===e.id?0:-1,title:e.label,"data-testid":e.testId,onClick:()=>A(e.id),onKeyDown:e=>We(e,t),className:l(`flex h-7 items-center gap-1.5 rounded-lg px-2 text-[11px] font-medium transition-[background-color,color,box-shadow]`,k===e.id?`bg-surface-raised text-ink shadow-subtle`:`text-ink-muted hover:text-ink`),children:[(0,K.jsx)(n,{className:`h-3.5 w-3.5 shrink-0`}),(0,K.jsx)(`span`,{className:`hidden xs:inline`,children:e.label}),e.id===`activity`&&Se>0&&(0,K.jsx)(`span`,{className:`rounded-full bg-surface px-1.5 text-[10px] text-ink-muted`,children:Se})]},e.id)})}),k===`files`&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-1.5`,children:[r&&(0,K.jsx)(`button`,{type:`button`,className:`inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-lg text-ink-muted hover:bg-surface-subtle hover:text-ink sm:hidden`,onClick:Be,"aria-label":E(`work.files.back`,{defaultValue:`Back to files`}),children:(0,K.jsx)(D,{className:`h-3.5 w-3.5 rtl:rotate-180`})}),(0,K.jsxs)(`span`,{dir:`ltr`,className:`min-w-0 flex-1 truncate font-mono text-[11px] text-ink-muted`,title:r?.path??`/workspace${M?`/${M}`:``}`,children:[r?.path??`/workspace${M?`/${M}`:``}`,Ce&&` •`]})]}),(0,K.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[(0,K.jsx)(`button`,{type:`button`,disabled:!M,onClick:()=>void Re(tn(M)),className:l(`hidden h-8 w-8 items-center justify-center rounded-lg border border-transparent text-ink-muted hover:border-line hover:bg-surface-subtle hover:text-ink disabled:opacity-30 sm:inline-flex`,!r&&`inline-flex`),"aria-label":E(`work.files.up`,{defaultValue:`Parent folder`}),title:E(`work.files.up`,{defaultValue:`Parent folder`}),children:(0,K.jsx)(D,{className:`h-3.5 w-3.5 rtl:rotate-180`})}),(0,K.jsx)(`button`,{type:`button`,"data-testid":`work-refresh-files-button`,onClick:()=>void o(M).catch(()=>void 0),className:`inline-flex h-8 w-8 items-center justify-center rounded-lg border border-transparent text-ink-muted hover:border-line hover:bg-surface-subtle hover:text-ink`,"aria-label":E(`common.refresh`,{defaultValue:`Refresh`}),title:E(`common.refresh`,{defaultValue:`Refresh`}),children:(0,K.jsx)(_,{className:l(`h-3.5 w-3.5`,i&&`animate-spin`)})}),r&&Me&&je&&(0,K.jsxs)(`button`,{type:`button`,"data-testid":`work-diff-toggle-button`,"aria-pressed":ue,onClick:()=>de(e=>!e),title:E(`work.files.changesSince`,{defaultValue:`What changed since the last turn`}),className:l(`inline-flex h-8 items-center gap-1.5 rounded-lg border px-2 text-[11px] font-medium transition-colors`,ue?`border-transparent bg-ink text-ink-inverse`:`border-line text-ink-muted hover:bg-surface-subtle hover:text-ink`),children:[(0,K.jsx)(R,{className:`h-3.5 w-3.5 shrink-0`}),(0,K.jsx)(`span`,{className:`hidden sm:inline`,children:E(`work.files.changes`,{defaultValue:`Changes`})}),(0,K.jsxs)(`span`,{dir:`ltr`,className:`tabular-nums`,children:[(0,K.jsxs)(`span`,{className:ue?void 0:`text-[rgb(46,164,79)]`,children:[`+`,je.added]}),` `,(0,K.jsxs)(`span`,{className:ue?void 0:`text-[rgb(255,61,129)]`,children:[`−`,je.removed]})]})]}),r&&!ue&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(B,{"data-testid":`work-format-file-button`,size:`sm`,variant:`ghost`,className:`h-8 w-8 rounded-lg px-0 sm:w-auto sm:px-2.5`,disabled:V||L||!Fe,onClick:()=>void Ue(),"aria-busy":L||void 0,title:Fe?E(`work.files.formatShortcut`,{defaultValue:`Format (Shift+Alt+F)`}):Ne?E(`work.files.formatTooLarge`,{defaultValue:`Formatting is limited to files under 100,000 characters and 4,000 lines.`}):E(`work.files.formatUnsupported`,{defaultValue:`Formatting is not available for this file type.`}),"aria-label":E(`work.files.format`,{defaultValue:`Format file`}),children:[L?(0,K.jsx)(N,{className:`h-3.5 w-3.5 animate-spin`}):(0,K.jsx)(j,{className:`h-3.5 w-3.5`}),(0,K.jsx)(`span`,{className:`hidden 2xl:inline`,children:E(`work.files.format`,{defaultValue:`Format`})})]}),(0,K.jsxs)(B,{"data-testid":`work-save-file-button`,size:`sm`,className:`h-8 w-8 rounded-lg bg-[#ff7b52] px-0 text-[#3d120c] hover:bg-[#ff7b52]/90 sm:w-auto sm:px-2.5`,disabled:!Ce||V||L||a,onClick:()=>void He(),"aria-busy":a||void 0,title:E(`work.files.saveShortcut`,{defaultValue:`Save (⌘/Ctrl+S)`}),"aria-label":E(`common.save`),children:[a?(0,K.jsx)(N,{className:`h-3.5 w-3.5 animate-spin`}):(0,K.jsx)(x,{className:`h-3.5 w-3.5`}),(0,K.jsx)(`span`,{className:`hidden 2xl:inline`,children:E(`common.save`)})]})]})]})]}),(k===`activity`||k===`git`)&&(0,K.jsx)(`div`,{className:`min-w-0 flex-1`}),k===`terminal`&&(0,K.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-2`,children:[(0,K.jsx)(`span`,{dir:`ltr`,className:`min-w-0 flex-1 truncate font-mono text-[11px] text-ink-muted`,children:`/workspace`}),V&&(0,K.jsx)(`span`,{className:`shrink-0 text-[10px] text-ink-subtle`,children:E(`work.terminal.taskRunning`,{defaultValue:`Model turn in progress`})})]}),k===`preview`&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`input`,{dir:`auto`,value:ae,onChange:e=>oe(e.target.value),placeholder:E(`work.preview.command`,{defaultValue:`Optional start command`}),"aria-label":E(`work.preview.command`,{defaultValue:`Optional start command`}),className:`h-8 min-w-0 flex-1 rounded-lg border border-line bg-surface px-2.5 font-mono text-[11px] text-ink outline-none placeholder:text-ink-subtle focus:border-primary-500`}),(0,K.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[e.previewStatus===`running`||e.previewStatus===`starting`?(0,K.jsxs)(B,{"data-testid":`work-stop-preview-button`,variant:`danger`,size:`sm`,className:`h-8 w-8 rounded-lg px-0 sm:w-auto sm:px-2.5`,disabled:a,onClick:()=>void v(),"aria-busy":a||void 0,"aria-label":E(`work.preview.stop`,{defaultValue:`Stop preview`}),children:[a?(0,K.jsx)(N,{className:`h-3.5 w-3.5 animate-spin`}):(0,K.jsx)(ce,{className:`h-3.5 w-3.5 fill-current`}),(0,K.jsx)(`span`,{className:`hidden 2xl:inline`,children:E(`work.preview.stop`,{defaultValue:`Stop preview`})})]}):(0,K.jsxs)(B,{"data-testid":`work-start-preview-button`,size:`sm`,className:`h-8 w-8 rounded-lg bg-[#ff7b52] px-0 text-[#3d120c] hover:bg-[#ff7b52]/90 sm:w-auto sm:px-2.5`,disabled:a,onClick:()=>void g(ae.trim()||void 0),"aria-busy":a||void 0,"aria-label":E(`work.preview.start`,{defaultValue:`Start preview`}),children:[a?(0,K.jsx)(N,{className:`h-3.5 w-3.5 animate-spin`}):(0,K.jsx)(f,{className:`h-3.5 w-3.5 fill-current`}),(0,K.jsx)(`span`,{className:`hidden 2xl:inline`,children:E(`work.preview.start`,{defaultValue:`Start preview`})})]}),ge&&(0,K.jsx)(`a`,{href:ge,target:`_blank`,rel:`noopener noreferrer`,"aria-label":E(`work.preview.open`,{defaultValue:`Open`}),title:E(`work.preview.open`,{defaultValue:`Open`}),className:`inline-flex h-8 w-8 items-center justify-center rounded-lg border border-line text-ink-muted hover:bg-surface-subtle hover:text-ink`,children:(0,K.jsx)(T,{className:`h-3.5 w-3.5`})})]})]})]}),k===`files`&&(0,K.jsxs)(`div`,{id:`work-workspace-panel-files`,role:`tabpanel`,"aria-labelledby":`work-workspace-tab-files`,className:`flex min-h-0 flex-1`,children:[(0,K.jsx)(`div`,{className:l(`flex min-h-0 w-full flex-col border-e border-line bg-surface-raised`,r?`hidden sm:flex sm:w-52 xl:w-60`:`flex`),children:(0,K.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-1.5`,children:i&&n.length===0?(0,K.jsx)(`div`,{className:`flex justify-center py-8 text-ink-muted`,children:(0,K.jsx)(N,{className:`h-5 w-5 animate-spin`})}):n.length===0?(0,K.jsx)(`p`,{className:`px-3 py-8 text-center text-xs text-ink-muted`,children:E(`work.files.empty`,{defaultValue:`No files in this folder yet.`})}):[...n].sort((e,t)=>e.type===t.type?e.name.localeCompare(t.name):e.type===`directory`?-1:1).map(e=>(0,K.jsxs)(`button`,{type:`button`,"data-testid":`work-file-item`,"data-path":e.path,onClick:()=>{e.type===`directory`?Re(e.path):ze(e.path)},className:l(`flex w-full items-center gap-2 rounded-lg px-2 py-1.5 text-start text-xs hover:bg-surface-subtle`,r?.path===e.path?`bg-surface-subtle text-ink`:`text-ink-muted`),children:[e.type===`directory`?(0,K.jsx)(ne,{className:`h-3.5 w-3.5 shrink-0 text-amber-500`}):(0,K.jsx)(S,{className:`h-3.5 w-3.5 shrink-0`}),(0,K.jsx)(`span`,{dir:`auto`,className:`truncate`,children:e.name})]},e.path))})}),(0,K.jsx)(`div`,{className:l(`min-h-0 min-w-0 flex-1 flex-col`,r?`flex`:`hidden sm:flex`),children:r&&ue&&J?(0,K.jsx)(jt,{lines:J,ariaLabel:E(`work.files.diffLabel`,{path:r.path,defaultValue:`Changes since the last turn: {{path}}`})}):r?(0,K.jsx)(bt,{path:r.path,value:P,ariaLabel:E(`work.files.editorLabel`,{path:r.path,defaultValue:`File editor: {{path}}`}),onChange:Ve,onSaveShortcut:()=>{Ce&&!V&&!a&&!L&&He()},onFormatShortcut:()=>void Ue(),disabled:V||L}):(0,K.jsxs)(`div`,{className:`m-auto px-6 text-center text-xs text-ink-muted`,children:[(0,K.jsx)(S,{className:`mx-auto mb-3 h-7 w-7 text-ink-subtle`}),E(`work.files.select`,{defaultValue:`Select a file to inspect and edit it.`})]})})]}),k===`activity`&&(0,K.jsxs)(`div`,{id:`work-workspace-panel-activity`,role:`tabpanel`,"aria-labelledby":`work-workspace-tab-activity`,className:`min-h-0 flex-1 overflow-y-auto p-3`,children:[t&&(0,K.jsx)(`div`,{className:`mb-3`,children:(0,K.jsx)(Ie,{run:t,variant:`activity`})}),xe.length===0&&!t?(0,K.jsxs)(`div`,{className:`flex h-full flex-col items-center justify-center px-6 text-center text-xs text-ink-muted`,children:[(0,K.jsx)(p,{className:`mb-3 h-7 w-7 text-ink-subtle`}),E(`work.activity.empty`,{defaultValue:`Commands, file operations, and tool results will appear here.`})]}):(0,K.jsx)(`div`,{className:`space-y-2`,children:xe.map(e=>(0,K.jsxs)(`div`,{className:`rounded-xl border border-line bg-surface p-3`,children:[(0,K.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,K.jsx)(`span`,{dir:`auto`,className:`truncate font-mono text-xs font-medium text-ink`,children:nn(e,E(`work.activity.toolActivity`,{defaultValue:`Tool activity`}))}),(0,K.jsx)(`span`,{className:`shrink-0 text-[10px] uppercase tracking-wide text-ink-subtle rtl:tracking-normal`,children:{message:E(`work.activity.kinds.message`,{defaultValue:`Message`}),reasoning:E(`libreClaw.metrics.reasoning`,{defaultValue:`Reasoning`}),tool_call:E(`work.activity.kinds.toolCall`,{defaultValue:`Tool call`}),tool_result:E(`work.activity.kinds.toolResult`,{defaultValue:`Tool result`}),error:E(`work.activity.kinds.error`,{defaultValue:`Error`})}[e.kind]})]}),e.content&&(0,K.jsx)(`pre`,{dir:`ltr`,className:`mt-2 max-h-56 overflow-auto whitespace-pre-wrap break-words text-left font-mono text-[11px] leading-relaxed text-ink-muted`,children:e.content})]},e.id))})]}),k===`git`&&(0,K.jsx)(`div`,{id:`work-workspace-panel-git`,role:`tabpanel`,"aria-labelledby":`work-workspace-tab-git`,className:`min-h-0 flex-1`,children:(0,K.jsx)(Jt,{taskId:e.id,mutationsDisabled:V||e.previewStatus===`starting`||e.previewStatus===`running`,disabledReason:V?E(`work.git.blockedByRun`,{defaultValue:`Git write actions unlock when the model turn finishes.`}):e.previewStatus===`starting`||e.previewStatus===`running`?E(`work.git.blockedByPreview`,{defaultValue:`Stop the preview before changing Git state.`}):void 0})}),k===`terminal`&&(0,K.jsx)(`div`,{id:`work-workspace-panel-terminal`,role:`tabpanel`,"aria-labelledby":`work-workspace-tab-terminal`,className:`flex min-h-0 flex-1 flex-col`,children:(0,K.jsx)($t,{taskId:e.id,active:k===`terminal`,disabledReason:C&&!C.available?C.reason??E(`work.terminal.unavailable`,{defaultValue:`The interactive terminal is not available in this deployment.`}):V?E(`work.terminal.blockedByRun`,{defaultValue:`The model is using this container. The terminal opens when the turn finishes.`}):void 0})}),k===`preview`&&(0,K.jsx)(`div`,{id:`work-workspace-panel-preview`,role:`tabpanel`,"aria-labelledby":`work-workspace-tab-preview`,className:`flex min-h-0 flex-1 flex-col`,children:e.previewStatus===`starting`?(0,K.jsxs)(`div`,{className:`m-auto flex items-center gap-2 text-xs text-ink-muted`,children:[(0,K.jsx)(N,{className:`h-4 w-4 animate-spin`}),E(`work.preview.starting`,{defaultValue:`Starting preview…`})]}):ge&&e.previewStatus===`running`?(0,K.jsx)(`iframe`,{"data-testid":`work-preview-frame`,title:E(`work.preview.frameTitle`,{defaultValue:`Workspace preview`}),src:ge,sandbox:`allow-scripts allow-forms allow-modals allow-downloads`,referrerPolicy:`no-referrer`,className:`min-h-0 flex-1 border-0 bg-white`}):(0,K.jsxs)(`div`,{className:`m-auto max-w-sm px-6 text-center text-xs leading-relaxed text-ink-muted`,children:[(0,K.jsx)(te,{className:`mx-auto mb-3 h-8 w-8 text-ink-subtle`}),e.previewStatus===`failed`?E(`work.preview.failed`,{defaultValue:`The preview could not start. Check Activity, then try another command.`}):E(`work.preview.empty`,{defaultValue:`Start the app inside this workspace to inspect it here.`})]})})]})}var an=e=>{let t=e.trim().toLowerCase();return!!t&&!t.includes(`embed`)},on=(e,t)=>e instanceof Error&&e.message?e.message:t,sn=(e,t)=>new Promise(n=>{if(t.aborted){n();return}let r,i=()=>{r!==void 0&&window.clearTimeout(r),t.removeEventListener(`abort`,i),n()};r=window.setTimeout(i,e),t.addEventListener(`abort`,i,{once:!0})});function cn(){let{t:e}=c(),t=s(),n=r(),{taskId:a}=i(),u=xe(e=>e.preferences),f=xe(e=>e.setPreferences),p=_e(e=>e.user),g=p?.id??null,[_,v]=(0,G.useState)(!1),y=d(e=>e.models),b=d(e=>e.selectedModel),x=d(e=>e.selectedProviderType),S=d(e=>e.selectedProviderId),C=d(e=>e.loadModels),{capabilities:w,tasks:T,selectedTask:D,files:O,selectedFile:A,liveRuns:j,loadingTask:ne,loadingOlderMessages:N,loadingFiles:F,actionLoading:I,error:ae,loadCapabilities:oe,loadTasks:L,selectTask:se,loadTask:R,loadOlderMessages:ce,createTask:le,updateTask:ue,deleteTask:de,startRun:fe,cancelRun:he,beginLiveRun:ge,applyRunEvents:ye,setLiveRunConnection:B,clearLiveRun:Se,loadFiles:H,loadFile:U,clearSelectedFile:Te,saveFile:Ee,startPreview:De,stopPreview:ke,clearError:q}=be(),Ae=(0,G.useMemo)(()=>y.filter(e=>!e.isPersona&&!e.isAgent&&an(e.name)&&(!e.isPlugin||!!e.pluginId)),[y]),J=(0,G.useMemo)(()=>Ae.flatMap(e=>{if(e.isPlugin&&!e.pluginId)return[];let t=e.isPlugin?`plugin`:`ollama`,n=e.isPlugin?e.pluginId:void 0,r=e.name.trim().toLowerCase(),i={model:e.name,providerType:t,providerId:n};return[{...i,key:W(i),label:e.isPlugin&&e.pluginName?`${e.name} · ${e.pluginName}`:e.name,remote:e.isPlugin||r.endsWith(`:cloud`)||r.endsWith(`-cloud`)}]}),[Ae]),[je,Me]=(0,G.useState)(``),[Ne,Pe]=(0,G.useState)({locationKey:t.key,value:`conversation`}),Fe=Ne.locationKey===t.key?Ne.value:`conversation`,Ie=e=>Pe({locationKey:t.key,value:e}),[Y,Le]=(0,G.useState)(!1),[Re,ze]=(0,G.useState)(``),Be=w?.hostWorkspaces?.enabled===!0,Ve=w?.hostWorkspaces?.roots??[],[Ue,X]=(0,G.useState)([]),[We,Ge]=(0,G.useState)(``),Ke=!D;(0,G.useEffect)(()=>{if(!Ke)return;let e=!1;return z.listPolicies().then(t=>{if(e||!t.success||!t.data)return;let n=t.data;X(n),Ge(e=>e&&!n.some(t=>t.id===e)?``:e)}).catch(()=>{}),()=>{e=!0}},[Ke]);let qe=D?.id,Je=D?.previewStatus===`running`||D?.previewStatus===`starting`;(0,G.useEffect)(()=>{if(!qe||!Je)return;let e=window.setInterval(()=>{document.visibilityState===`visible`&&R(qe,!0).catch(()=>{})},3e4);return()=>window.clearInterval(e)},[qe,Je,R]);let[Ye,Xe]=(0,G.useState)({taskId:null,open:!1}),Ze=Ye.open&&Ye.taskId===D?.id,Qe=(0,G.useRef)(null),$e=(0,G.useRef)(null),et=(0,G.useRef)(null),tt=(0,G.useCallback)((e=!1)=>{Xe(e=>({...e,open:!1})),e&&window.requestAnimationFrame(()=>$e.current?.focus())},[]);(0,G.useEffect)(()=>{if(!Ze)return;let e=window.requestAnimationFrame(()=>{et.current?.querySelector(`[role="menuitem"]`)?.focus()}),t=e=>{e.target instanceof Node&&!Qe.current?.contains(e.target)&&tt()},n=e=>{e.key===`Escape`&&(e.preventDefault(),tt(!0))};return document.addEventListener(`pointerdown`,t),document.addEventListener(`keydown`,n),()=>{window.cancelAnimationFrame(e),document.removeEventListener(`pointerdown`,t),document.removeEventListener(`keydown`,n)}},[tt,Ze]);let nt=e=>{if(e.key===`Escape`){e.preventDefault(),e.stopPropagation(),tt(!0);return}if(e.key!==`ArrowDown`&&e.key!==`ArrowUp`&&e.key!==`Home`&&e.key!==`End`)return;let t=[...et.current?.querySelectorAll(`[role="menuitem"]:not(:disabled)`)??[]];if(t.length===0)return;e.preventDefault();let n=t.indexOf(document.activeElement);t[e.key===`Home`?0:e.key===`End`?t.length-1:e.key===`ArrowUp`?(n-1+t.length)%t.length:(n+1)%t.length]?.focus()};(0,G.useEffect)(()=>{oe(),L()},[oe,L]),(0,G.useEffect)(()=>{if(!a){se(null);return}se(a),R(a).catch(()=>void 0),H(a,``).catch(()=>void 0)},[a,H,R,se]);let it=J.find(e=>e.key===je)||J.find(e=>e.model===b&&(x===`plugin`?e.providerType===`plugin`&&e.providerId===S:e.providerType===`ollama`))||J[0],at=a?T.find(e=>e.id===a):void 0,ot=at?.status??D?.status,st=D?.activeRun??at?.activeRun??null,Z=st?.id,ct=st?.status===`queued`||st?.status===`preparing`||st?.status===`running`,lt=a&&j[a]?.runId===Z?j[a]:void 0,ut=ot===`preparing`||ot===`running`?1e3:4e3;(0,G.useEffect)(()=>{let e,t=!1,n=async()=>{await L(!0),t||(e=setTimeout(n,ut))};return e=setTimeout(n,ut),()=>{t=!0,e&&clearTimeout(e)}},[L,ut]);let dt=(0,G.useRef)(null);(0,G.useEffect)(()=>{if(!a||!ot){dt.current=null;return}let e=dt.current;dt.current={taskId:a,status:ot},e?.taskId===a&&(e.status===`preparing`||e.status===`running`)&&ot!==`preparing`&&ot!==`running`&&(R(a,!0).catch(()=>void 0),H(a,``).catch(()=>void 0))},[H,R,ot,a]),(0,G.useEffect)(()=>{if(!a||!Z||!ct)return;let e=new AbortController,t=!1,n=0,r=be.getState().liveRuns[a]?.runId===Z&&be.getState().liveRuns[a]?.lastEventId||0,i=!1,o=[],s=null,c=()=>{if(s!==null&&(window.cancelAnimationFrame(s),s=null),o.length===0)return;let e=o;o=[],ye(e)},l=e=>{if(e.type!==`snapshot`&&(n=0),r=Math.max(r,e.id),o.push(e),e.type===`done`||e.type===`error`&&e.data.terminal!==!1){i=!0,c();return}s===null&&(s=window.requestAnimationFrame(c))};return ge(a,Z,st?.startedAt||void 0),(async()=>{for(;!t&&!e.signal.aborted&&!i;){B(a,Z,n>=3?`error`:n===0?`connecting`:`reconnecting`);let o=Date.now();try{if(await z.streamRunEvents({taskId:a,runId:Z,after:r,signal:e.signal,onEvent:l}),c(),i||t||e.signal.aborted)break;throw Error(`The live Work connection closed.`)}catch(r){if(c(),t||e.signal.aborted)return;Date.now()-o>=5e3&&(n=0),n+=1,B(a,Z,n>=3?`error`:`reconnecting`,n>=3?on(r,`Live updates are reconnecting in the background.`):void 0),await sn(Math.min(4e3,250*2**Math.min(n,4)),e.signal)}}if(c(),!(!i||e.signal.aborted)){B(a,Z,`closed`);try{await Promise.all([R(a,!0),H(a,``),L(!0)])}catch{}finally{Se(a,Z)}}})(),()=>{t=!0,e.abort(),c()}},[ye,ge,Se,H,R,L,st?.startedAt,ct,Z,B,a]),(0,G.useEffect)(()=>{if(!Y)return;let e=e=>{e.preventDefault()};return window.addEventListener(`beforeunload`,e),()=>window.removeEventListener(`beforeunload`,e)},[Y]);let ft=(0,G.useCallback)(()=>!Y||window.confirm(e(`work.files.discard`,{defaultValue:`Discard unsaved file changes?`})),[e,Y]),pt=(0,G.useCallback)(()=>!Y||window.confirm(e(`work.files.leaveWithDraft`,{defaultValue:`Leave this file? Your unsaved edit will remain as a browser draft.`})),[e,Y]),Q=()=>{D&&A&&me(D.id,A.path)},mt=o(({currentLocation:e,nextLocation:t})=>{let n=t.state;return Y&&n?.deletedWorkTaskId!==a&&`${e.pathname}${e.search}${e.hash}`!=`${t.pathname}${t.search}${t.hash}`});(0,G.useEffect)(()=>{if(mt.state!==`blocked`)return;if(!pt()){mt.reset();return}let e=mt.proceed,t=window.setTimeout(()=>{Le(!1),window.setTimeout(e,0)},0);return()=>window.clearTimeout(t)},[pt,mt]);let ht=()=>{q(),Ie(`conversation`),n(`/work`)},gt=async t=>{if(D&&!ft())return!1;D&&Y&&(Q(),Te(),Le(!1));try{if(D)await fe(D.id,{message:t,model:D.model,providerType:D.providerType,providerId:D.providerId||void 0});else{if(!it)throw Error(e(`work.composer.noModelSelected`,{defaultValue:`No Work-compatible model is selected.`}));let r=await le({message:t,model:it.model,providerType:it.providerType,providerId:it.providerId,networkEnabled:!0,...Be&&Re.trim()?{hostPath:Re.trim()}:{},...We?{policyId:We}:{}});n(`/work/${r.id}`)}return!0}catch(t){return m.error(on(t,e(`work.toasts.runFailed`,{defaultValue:`Could not start the Work task.`}))),!1}},_t=async t=>{let n=kt.find(e=>e.key===t);if(n){if(!D){Me(t);return}try{await ue(D.id,{model:n.model,providerType:n.providerType,providerId:n.providerId})}catch(t){m.error(on(t,e(`work.toasts.updateFailed`,{defaultValue:`Could not update this task.`})))}}},vt=async()=>{if(D)try{await he(D.id),m.success(e(`work.toasts.cancelled`,{defaultValue:`Work run stopped.`}))}catch(t){m.error(on(t,e(`work.toasts.cancelFailed`,{defaultValue:`Could not stop the Work run.`})))}},yt=async t=>{let r=T.find(e=>e.id===t);if(!window.confirm(e(`work.tasks.deleteConfirm`,{defaultValue:`Delete “{{title}}” and its workspace permanently?`,title:r?.title||e(`work.tasks.untitled`,{defaultValue:`Untitled task`})})))return;let i=a===t&&Y;i&&Le(!1);try{await de(t),ve(t),a===t&&n(`/work`)}catch(t){i&&Le(!0),m.error(on(t,e(`work.toasts.deleteFailed`,{defaultValue:`Could not delete this Work task.`})))}},bt=async t=>{if(!D)return!1;let n=t.trim();if(!n||n===D.title)return!!n;try{return await ue(D.id,{title:n}),!0}catch(t){return m.error(on(t,e(`work.toasts.renameFailed`,{defaultValue:`Could not rename this task.`}))),!1}},xt=async(e,t,n)=>{try{return await e(),n&&m.success(n),!0}catch(e){return m.error(on(e,t)),!1}},St=async(t,n,r)=>{if(!D)return!1;let i=D.id;try{let a=await Ee(i,t,n,r);return be.getState().selectedTaskId===i&&m.success(e(`work.toasts.saved`,{defaultValue:`File saved.`})),a}catch(t){return be.getState().selectedTaskId===i&&m.error(on(t,e(`work.toasts.saveFailed`,{defaultValue:`Could not save this file.`}))),!1}},$=w?.available===!1,Ct=e(`work.runtime.ready`,{defaultValue:`Runtime ready`}),wt=w?.runtime===`kubernetes`?`Kubernetes · ${Ct}`:w?.pluginAvailable?w.ollamaAvailable?e(`work.runtime.readyHybrid`,{defaultValue:`Docker + models ready`}):e(`work.runtime.readyPlugin`,{defaultValue:`Docker + plugin ready`}):e(`work.runtime.readyOllama`,{defaultValue:`Docker ready`}),Tt=D?we(D):!1,Et=D?{model:D.model,providerType:D.providerType,providerId:D.providerId||void 0}:void 0,Dt=Et?W(Et):it?.key||``,Ot=Et&&!J.some(e=>e.key===Dt)?{...Et,key:Dt,label:`${Et.model} · ${Et.providerType===`plugin`?Et.providerId||`plugin`:`Ollama`}`,remote:Et.providerType===`plugin`||Et.model.toLowerCase().endsWith(`:cloud`)||Et.model.toLowerCase().endsWith(`-cloud`)}:void 0,kt=Ot?[Ot,...J]:J,At=V[D?.status??`idle`],jt=e(At.labelKey,{defaultValue:At.label}),Mt=async()=>{if(u.workRemoteProviderDisclosureDismissed||_)return!1;let t=g;v(!0);try{let n=await pe.updatePreferences({workRemoteProviderDisclosureDismissed:!0});if(!n.success)throw Error(n.error||e(`work.composer.remoteDismissFailed`,{defaultValue:`Could not save the remote provider preference.`}));return(_e.getState().user?.id??null)===t&&(f({workRemoteProviderDisclosureDismissed:!0}),!0)}catch{return m.error(e(`work.composer.remoteDismissFailed`,{defaultValue:`Could not save the remote provider preference.`})),!1}finally{v(!1)}};return(0,K.jsx)(`div`,{"data-testid":`work-page`,className:`relative flex h-full min-h-0 overflow-hidden bg-transparent`,children:(0,K.jsxs)(`main`,{className:`flex min-h-0 min-w-0 flex-1 flex-col`,children:[(0,K.jsxs)(`header`,{className:`relative z-50 flex h-16 shrink-0 items-center gap-3 border-b border-line bg-surface/55 px-3 backdrop-blur-xl md:px-4`,children:[D?(0,K.jsx)(`input`,{"data-testid":`work-task-title`,dir:`auto`,defaultValue:D.title,onBlur:e=>{let t=e.currentTarget;if(!t.value.trim()){t.value=D.title;return}bt(t.value).then(e=>{e||(t.value=D.title)})},onKeyDown:e=>{e.key===`Enter`&&e.currentTarget.blur(),e.key===`Escape`&&(e.currentTarget.value=D.title,e.currentTarget.blur())},className:`min-w-0 max-w-sm flex-1 truncate rounded-lg border border-transparent bg-transparent px-2 py-1 text-sm font-semibold text-ink outline-none hover:border-line focus:border-primary-500 focus:bg-surface`,"aria-label":e(`work.tasks.rename`,{defaultValue:`Task title`})},`${D.id}:${D.title}`):(0,K.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,K.jsx)(`h1`,{className:`truncate text-sm font-semibold text-ink`,children:e(`work.title`,{defaultValue:`Work`})})}),D?.hostPath&&(0,K.jsxs)(`span`,{"data-testid":`work-host-path-chip`,title:D.hostPath,className:`hidden h-7 shrink-0 items-center gap-1.5 rounded-full border border-line bg-surface px-2.5 font-mono text-[11px] text-ink-muted sm:inline-flex`,children:[(0,K.jsx)(M,{"aria-hidden":`true`,className:`h-3.5 w-3.5`}),(0,K.jsx)(`span`,{className:`max-w-[16rem] truncate`,children:D.hostPath})]}),D&&(0,K.jsxs)(`span`,{"data-testid":`work-compact-status`,className:`inline-flex h-7 shrink-0 items-center gap-1.5 rounded-full border border-line bg-surface px-2 text-[11px] font-medium text-ink-muted xl:hidden`,"aria-label":e(`work.tasks.status`,{status:jt,defaultValue:`Status: {{status}}`}),title:e(`work.tasks.status`,{status:jt,defaultValue:`Status: {{status}}`}),children:[(0,K.jsx)(`span`,{"aria-hidden":`true`,"data-testid":`work-compact-status-indicator`,className:l(`h-1.5 w-1.5 rounded-full`,At.animated&&`animate-pulse`,D.status===`idle`&&`ring-1 ring-black/20 dark:ring-white/20`),style:{backgroundColor:At.color}}),(0,K.jsx)(`span`,{className:`hidden md:inline`,children:jt})]}),D&&(0,K.jsxs)(`div`,{className:`ms-auto inline-flex h-9 shrink-0 items-center rounded-xl border border-line bg-surface-subtle p-1 shadow-subtle xl:hidden`,role:`group`,"aria-label":e(`work.mobile.surface`,{defaultValue:`Task surface`}),children:[(0,K.jsxs)(`button`,{type:`button`,onClick:()=>Ie(`conversation`),"aria-label":e(`work.mobile.conversation`,{defaultValue:`Conversation`}),"aria-pressed":Fe===`conversation`,className:l(`inline-flex h-7 items-center justify-center gap-1.5 rounded-lg px-2 text-[11px] font-medium transition-[background-color,color,box-shadow] sm:px-2.5`,Fe===`conversation`?`bg-surface-raised text-ink shadow-subtle`:`text-ink-muted hover:bg-surface-raised/70 hover:text-ink`),children:[(0,K.jsx)(ie,{className:`h-3.5 w-3.5 shrink-0`}),(0,K.jsx)(`span`,{className:`hidden sm:inline`,children:e(`work.mobile.conversation`,{defaultValue:`Conversation`})})]}),(0,K.jsxs)(`button`,{type:`button`,onClick:()=>Ie(`workspace`),"aria-label":e(`work.mobile.workspace`,{defaultValue:`Workspace`}),"aria-pressed":Fe===`workspace`,className:l(`inline-flex h-7 items-center justify-center gap-1.5 rounded-lg px-2 text-[11px] font-medium transition-[background-color,color,box-shadow] sm:px-2.5`,Fe===`workspace`?`bg-surface-raised text-ink shadow-subtle`:`text-ink-muted hover:bg-surface-raised/70 hover:text-ink`),children:[(0,K.jsx)(te,{className:`h-3.5 w-3.5 shrink-0`}),(0,K.jsx)(`span`,{className:`hidden sm:inline`,children:e(`work.mobile.workspace`,{defaultValue:`Workspace`})})]})]}),(0,K.jsxs)(`div`,{className:l(`ms-auto hidden min-w-0 items-center gap-2`,D?`xl:flex`:`sm:flex`),children:[D&&(0,K.jsxs)(`span`,{"data-testid":`work-status`,className:`inline-flex h-7 items-center gap-1.5 rounded-full border border-line bg-surface px-2.5 text-[11px] font-medium text-ink-muted`,children:[(0,K.jsx)(`span`,{"aria-hidden":`true`,"data-testid":`work-status-indicator`,className:l(`h-1.5 w-1.5 rounded-full`,At.animated&&`animate-pulse`,D.status===`idle`&&`ring-1 ring-black/20 dark:ring-white/20`),style:{backgroundColor:At.color}}),jt]}),(0,K.jsxs)(`span`,{"data-testid":`work-runtime-status`,className:l(`inline-flex h-7 items-center gap-1.5 rounded-full border px-2.5 text-[11px] font-medium`,$?`border-transparent bg-error-500 text-[#0D0D0C]`:`border-transparent bg-success-500 text-[#0D0D0C]`),title:$?w?.reason||e(`work.runtime.unavailable`,{defaultValue:`Runtime unavailable`}):w?.image?`${wt} · ${w.image}`:wt,children:[(0,K.jsx)(P,{className:`h-3.5 w-3.5`}),$?e(`work.runtime.unavailable`,{defaultValue:`Runtime unavailable`}):Ct]}),D&&(0,K.jsxs)(`span`,{className:`hidden h-7 max-w-44 items-center gap-1.5 truncate rounded-full border border-line bg-surface px-2.5 text-[11px] font-medium text-ink-muted md:inline-flex`,children:[(0,K.jsx)(ee,{className:`h-3.5 w-3.5 shrink-0`}),(0,K.jsx)(`span`,{dir:`ltr`,className:`truncate`,children:D.model})]})]}),D&&(0,K.jsxs)(`div`,{ref:Qe,className:`relative shrink-0`,children:[(0,K.jsx)(`button`,{ref:$e,id:`work-task-actions-trigger`,type:`button`,"data-testid":`work-task-actions-button`,onClick:()=>Xe(e=>({taskId:D.id,open:e.taskId!==D.id||!e.open})),onKeyDown:e=>{(e.key===`ArrowDown`||e.key===`ArrowUp`)&&(e.preventDefault(),Xe({taskId:D.id,open:!0}))},className:`inline-flex h-9 w-9 items-center justify-center rounded-lg text-ink-muted transition-colors hover:bg-surface-subtle hover:text-ink`,"aria-label":e(`work.tasks.actions`,{defaultValue:`Task actions`}),"aria-haspopup":`menu`,"aria-expanded":Ze,"aria-controls":Ze?`work-task-actions-menu`:void 0,children:(0,K.jsx)(h,{className:`h-4 w-4`})}),Ze&&(0,K.jsx)(`div`,{ref:et,id:`work-task-actions-menu`,role:`menu`,"aria-labelledby":`work-task-actions-trigger`,onKeyDown:nt,className:`absolute end-0 top-10 z-40 min-w-44 rounded-xl border border-line bg-surface-overlay p-1.5 shadow-overlay`,children:(0,K.jsxs)(`button`,{type:`button`,role:`menuitem`,"data-testid":`work-delete-task-button`,onClick:()=>{tt(!0),yt(D.id)},className:`flex h-9 w-full items-center gap-2 rounded-lg px-2.5 text-start text-xs font-medium text-error-600 transition-colors hover:bg-error-500/10`,children:[(0,K.jsx)(re,{className:`h-3.5 w-3.5`}),e(`work.tasks.delete`,{defaultValue:`Delete task`})]})})]})]}),($||ae)&&(0,K.jsxs)(`div`,{className:l(`flex shrink-0 items-center gap-2 border-b px-4 py-2 text-xs`,$?`border-error-500/20 bg-error-500/10 text-error-700`:`border-amber-500/20 bg-amber-500/10 text-ink`),children:[(0,K.jsx)(k,{className:`h-4 w-4 shrink-0`}),(0,K.jsx)(`span`,{dir:`auto`,className:`min-w-0 flex-1`,children:$?w?.reason||e(`work.runtime.reason`,{defaultValue:`A Work runtime and an available Ollama or plugin model provider are required.`}):ae}),ae&&!$&&(0,K.jsx)(`button`,{type:`button`,className:`rounded-md p-1 hover:bg-black/5`,onClick:q,"aria-label":e(`common.close`),children:`×`})]}),a?D?(0,K.jsx)(rt,{userId:g,mobileSurface:Fe,conversation:(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(He,{task:D,user:p,liveRun:lt,loading:ne,loadingOlder:N,onLoadOlder:()=>ce(D.id)}),(0,K.jsx)(Oe,{models:kt,selectorModels:Ae,modelKey:Dt,running:Tt,loading:I,disabled:$,remoteDisclosureDismissed:u.workRemoteProviderDisclosureDismissed,remoteDisclosureSaving:_,onModelChange:_t,onDismissRemoteDisclosure:Mt,onModelsRefresh:C,onSubmit:gt,onCancel:vt},D.id)]}),workspace:(0,K.jsx)(`div`,{className:`min-h-0 min-w-0 flex-1`,children:(0,K.jsx)(rn,{task:D,liveRun:lt,files:O,selectedFile:A,loadingFiles:F,actionLoading:I,onLoadFiles:e=>H(D.id,e),onLoadFile:e=>U(D.id,e),onClearSelectedFile:Te,onSaveFile:St,onStartPreview:t=>xt(()=>De(D.id,t),e(`work.toasts.previewFailed`,{defaultValue:`Could not start the preview.`})),onStopPreview:()=>xt(()=>ke(D.id),e(`work.toasts.previewStopFailed`,{defaultValue:`Could not stop the preview.`})),onDirtyChange:Le,terminal:w?.terminal},D.id)})}):(0,K.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col items-center justify-center px-6 text-center`,children:ne?(0,K.jsx)(`div`,{className:`text-sm text-ink-muted`,children:e(`work.tasks.loading`,{defaultValue:`Loading task…`})}):(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(k,{className:`mb-3 h-8 w-8 text-ink-subtle`}),(0,K.jsx)(`h2`,{className:`text-lg font-semibold text-ink`,children:e(`work.tasks.notFound`,{defaultValue:`This Work task is unavailable`})}),(0,K.jsxs)(`button`,{type:`button`,onClick:ht,className:`mt-4 inline-flex items-center gap-1.5 text-sm font-medium text-primary-600 hover:text-primary-700`,children:[(0,K.jsx)(E,{className:`h-4 w-4 rtl:rotate-180`}),e(`work.tasks.back`,{defaultValue:`Start a new task`})]})]})}):(0,K.jsxs)(`div`,{className:`relative min-h-0 flex-1 overflow-y-auto`,children:[(0,K.jsxs)(`div`,{"aria-hidden":`true`,className:`pointer-events-none absolute inset-0`,children:[(0,K.jsx)(`div`,{className:`absolute left-[12%] top-[18%] h-56 w-56 rounded-full bg-primary-500/[0.035] blur-3xl dark:bg-primary-400/[0.04]`}),(0,K.jsx)(`div`,{className:`absolute bottom-[16%] right-[10%] h-72 w-72 rounded-full bg-gray-900/[0.025] blur-3xl dark:bg-white/[0.025]`}),(0,K.jsx)(`div`,{className:`absolute left-1/2 top-0 h-16 w-px bg-gray-300/60 dark:bg-white/10`})]}),(0,K.jsxs)(`section`,{"data-testid":`work-landing`,className:`relative z-[1] mx-auto flex min-h-full w-full max-w-3xl flex-col items-center justify-center px-4 py-20 sm:px-8 sm:py-24`,children:[(0,K.jsxs)(`div`,{className:`flex flex-col items-center text-center`,children:[(0,K.jsxs)(`div`,{className:`mb-3 flex items-center justify-center gap-3`,children:[(0,K.jsx)(Ce,{size:`sm`,label:null,className:`h-9 w-9 shrink-0 p-0 text-ink`}),(0,K.jsx)(`h2`,{className:`max-w-3xl text-balance text-[clamp(1.75rem,3.5vw,2.35rem)] font-medium leading-tight tracking-[-0.02em] text-ink rtl:tracking-normal`,children:e(`work.landing.title`,{defaultValue:`Start a new Work task`})})]}),(0,K.jsx)(`p`,{className:`max-w-xl text-balance text-[15px] leading-relaxed text-ink-subtle`,children:e(`work.landing.description`,{defaultValue:`Give a local model a durable, isolated workspace. It can inspect files, run tools, and continue where it left off when you return.`})})]}),Ue.length>0&&(0,K.jsxs)(`div`,{className:`mt-8 w-full max-w-2xl`,children:[(0,K.jsx)(`label`,{htmlFor:`work-policy`,className:`mb-1.5 block text-xs font-medium text-ink-muted`,children:e(`work.policy.label`,{defaultValue:`Runtime policy`})}),(0,K.jsxs)(`select`,{id:`work-policy`,"data-testid":`work-policy`,value:We,onChange:e=>Ge(e.target.value),className:`w-full rounded-xl border border-line bg-surface px-3 py-2 text-[13px] text-ink outline-none transition-colors focus:border-line-strong focus-visible:ring-2 focus-visible:ring-primary-500/30`,children:[(0,K.jsx)(`option`,{value:``,children:e(`work.policy.default`,{defaultValue:`Default (global limits)`})}),Ue.map(e=>(0,K.jsx)(`option`,{value:e.id,children:e.name},e.id))]})]}),Be&&(0,K.jsxs)(`div`,{className:`mt-8 w-full max-w-2xl`,children:[(0,K.jsx)(`label`,{htmlFor:`work-host-path`,className:`mb-1.5 block text-xs font-medium text-ink-muted`,children:e(`work.hostWorkspace.label`,{defaultValue:`Workspace folder (optional)`})}),(0,K.jsx)(`input`,{id:`work-host-path`,"data-testid":`work-host-path`,value:Re,onChange:e=>ze(e.target.value),spellCheck:!1,placeholder:Ve[0]?`${Ve[0]}/my-project`:`/path/to/folder`,className:`w-full rounded-xl border border-line bg-surface px-3 py-2 font-mono text-[13px] text-ink outline-none transition-colors placeholder:text-ink-subtle focus:border-line-strong focus-visible:ring-2 focus-visible:ring-primary-500/30`}),(0,K.jsx)(`p`,{className:`mt-1.5 text-[11px] leading-relaxed text-ink-subtle`,children:Re.trim()?e(`work.hostWorkspace.warning`,{defaultValue:`The task can read and write this folder directly. Leave blank to use an isolated workspace instead.`}):e(`work.hostWorkspace.hint`,{defaultValue:`Leave blank for an isolated workspace, or point the task at a folder on this machine.`})})]}),(0,K.jsx)(Oe,{variant:`landing`,models:J,selectorModels:Ae,modelKey:it?.key||``,running:!1,loading:I,disabled:$,remoteDisclosureDismissed:u.workRemoteProviderDisclosureDismissed,remoteDisclosureSaving:_,onModelChange:_t,onDismissRemoteDisclosure:Mt,onModelsRefresh:C,onSubmit:gt,onCancel:vt}),(0,K.jsxs)(`div`,{"data-testid":`work-workspace-note`,role:`note`,className:`mt-4 flex max-w-2xl flex-wrap items-center justify-center gap-x-2 gap-y-1 text-center text-[10px] leading-relaxed text-ink-subtle`,children:[(0,K.jsx)(P,{"aria-hidden":`true`,className:`h-3.5 w-3.5`}),(0,K.jsx)(`span`,{children:e(`work.composer.hint`,{defaultValue:`Each task keeps its own files and history. Review model output before using it.`})})]})]})]})]})})}export{cn as default};
@@ -0,0 +1,14 @@
1
+ import{n as e}from"./rolldown-runtime-hePW80VL.js";import{i as t}from"./logger-DSXjF4ye.js";import{t as n}from"./config-DPEEuTAe.js";import{a as r,i,r as a}from"./workApi-Czu69yWS.js";var o={getModels:()=>t()?i([]):a.get(`/agent-clis/models`).then(e=>e.data)},s=`0.22.0`,c={login:e=>t()?i({user:{id:`demo-user`,username:`demo`,email:`demo@example.com`,role:`admin`,status:`active`,createdAt:new Date().toISOString(),updatedAt:new Date().toISOString()},token:`demo-token`,systemInfo:{requiresAuth:!0,hasUsers:!0,userCount:1,signupEnabled:!0,version:s}}):a.post(`/auth/login`,e).then(e=>e.data),signup:e=>t()?i({user:{id:`demo-user-new`,username:e.username,email:e.email||``,role:`user`,status:`active`,createdAt:new Date().toISOString(),updatedAt:new Date().toISOString()},token:`demo-token-new`,systemInfo:{requiresAuth:!0,hasUsers:!0,userCount:1,signupEnabled:!0,version:s,turnstile:{enabled:!1}}}):a.post(`/auth/signup`,e).then(e=>e.data),logout:()=>t()?i(void 0):a.post(`/auth/logout`).then(e=>e.data),getSystemInfo:()=>(r.debug(`getSystemInfo called, demo mode:`,t()),t()?i({requiresAuth:!0,hasUsers:!0,userCount:1,signupEnabled:!0,version:s,turnstile:{enabled:!1}}):(r.debug(`Making API call to:`,n+`/auth/system-info`),r.debug(`Full URL from:`,window.location.origin,`-> API:`,n+`/auth/system-info`),a.get(`/auth/system-info`).then(e=>(r.debug(`getSystemInfo response:`,e.data),e.data)).catch(e=>{throw r.debug(`getSystemInfo error:`,e),e.response&&(r.debug(`Error response data:`,e.response.data),r.debug(`Error status:`,e.response.status),r.debug(`Error headers:`,e.response.headers)),e.request&&r.debug(`Network error - no response received:`,e.request),r.debug(`Error config:`,e.config),e}))),verifyToken:()=>t()?i({id:`demo-user`,username:`demo`,email:`demo@example.com`,role:`admin`,status:`active`,createdAt:new Date().toISOString(),updatedAt:new Date().toISOString()}):a.get(`/auth/verify`).then(e=>e.data),getEncryptionKey:()=>t()?i({encryptionKey:`demo-encryption-key-not-real`}):a.get(`/auth/encryption-key`).then(e=>e.data)},l={getUsers:()=>t()?i([{id:`demo-user`,username:`demo`,email:`demo@example.com`,role:`admin`,status:`active`,createdAt:new Date().toISOString(),updatedAt:new Date().toISOString()}]):a.get(`/users`).then(e=>e.data),createUser:e=>t()?i({id:`new-user-`+Date.now(),username:e.username,email:e.email,role:e.role,status:`active`,createdAt:new Date().toISOString(),updatedAt:new Date().toISOString()}):a.post(`/users`,e).then(e=>e.data),updateUser:(e,n)=>t()?i({id:e,username:n.username||`demo`,email:n.email||`demo@example.com`,role:n.role||`user`,status:`active`,createdAt:new Date().toISOString(),updatedAt:new Date().toISOString()}):a.patch(`/users/${e}`,n).then(e=>e.data),deleteUser:e=>t()?i(void 0):a.delete(`/users/${e}`).then(e=>e.data),getPendingApprovals:()=>t()?i({count:0,latestCreatedAt:null}):a.get(`/users/pending-approvals`).then(e=>e.data),approveUser:e=>t()?i({id:e,username:`demo-user`,email:`demo@example.com`,role:`user`,status:`active`,createdAt:new Date().toISOString(),updatedAt:new Date().toISOString()}):a.patch(`/users/${e}/approve`).then(e=>e.data),updateMyAvatar:e=>t()?i({id:`demo-user`,username:`demo`,email:`demo@example.com`,role:`admin`,status:`active`,avatar:e,createdAt:new Date().toISOString(),updatedAt:new Date().toISOString()}):a.patch(`/users/me/avatar`,{avatar:e}).then(e=>e.data)},u=[{name:`llama3.2:3b`,size:2048e6,digest:`demo-digest-1`,modified_at:new Date().toISOString(),details:{format:`gguf`,family:`llama`,families:[`llama`],parameter_size:`3B`,quantization_level:`Q4_0`}},{name:`qwen2.5:7b`,size:4096e6,digest:`demo-digest-2`,modified_at:new Date().toISOString(),details:{format:`gguf`,family:`qwen`,families:[`qwen`],parameter_size:`7B`,quantization_level:`Q4_0`}}],d=()=>[{id:`demo-session-1`,title:`Demo Chat Session`,model:u[0].name,providerType:`ollama`,providerId:null,messages:[{id:`demo-msg-1`,role:`user`,content:`Hello! Can you tell me about this demo?`,timestamp:Date.now()},{id:`demo-msg-2`,role:`assistant`,content:`This is a demo of Libre WebUI! In a real deployment, I would be powered by Ollama running locally on your machine. This demo shows the beautiful interface and features without the backend connection.`,timestamp:Date.now()}],createdAt:Date.now(),updatedAt:Date.now()}],f=d(),p={theme:{mode:`dark`,adaptToAccent:!1,accent:`blue`,customAccent:`#2563eb`},defaultModel:`llama3.2:3b`,defaultProviderType:`ollama`,defaultProviderId:null,visionModel:``,visionProviderType:null,visionProviderId:null,systemMessage:`You are a helpful assistant.`,generationOptions:{temperature:.7,top_p:.9,top_k:40,num_predict:1024},embeddingSettings:{enabled:!1,model:`nomic-embed-text`,chunkSize:1e3,chunkOverlap:200,similarityThreshold:.7},titleSettings:{autoTitle:!1,taskModel:``,taskProviderType:null,taskProviderId:null},showUsername:!1,hapticFeedbackEnabled:!1,workRemoteProviderDisclosureDismissed:!1,backgroundSettings:{enabled:!1,imageUrl:``,blurAmount:10,opacity:.6}},m={...p,theme:{...p.theme},generationOptions:{...p.generationOptions},embeddingSettings:{...p.embeddingSettings},titleSettings:{...p.titleSettings},backgroundSettings:{...p.backgroundSettings}},h=()=>m,g=e=>{let t=m.backgroundSettings||p.backgroundSettings;return m={...m,...e,theme:{...m.theme,...e.theme},generationOptions:{...m.generationOptions,...e.generationOptions},embeddingSettings:{...m.embeddingSettings,...e.embeddingSettings},titleSettings:e.titleSettings?{...m.titleSettings||p.titleSettings,...e.titleSettings}:m.titleSettings,backgroundSettings:e.backgroundSettings?{...t,...e.backgroundSettings}:m.backgroundSettings},m},_={getSessions:()=>a.get(`/chat/sessions`).then(e=>e.data),createSession:(e,t,n,r,i)=>a.post(`/chat/sessions`,{model:e,title:t,personaId:n,providerType:r,providerId:i}).then(e=>e.data),getSession:e=>{if(t()){let t=d().find(t=>t.id===e);return t?i(t):Promise.resolve({success:!1,error:`Session not found in demo mode`})}return a.get(`/chat/sessions/${e}`).then(e=>e.data)},updateSession:(e,n)=>{if(t()){let t=f.findIndex(t=>t.id===e),r=f[t];if(r){let e={...r,...n,updatedAt:Date.now()};return f[t]=e,i(e)}return Promise.resolve({success:!1,error:`Session not found in demo mode`})}return a.put(`/chat/sessions/${e}`,n).then(e=>e.data)},deleteSession:e=>t()?i(null):a.delete(`/chat/sessions/${e}`).then(e=>e.data),clearAllSessions:()=>a.delete(`/chat/sessions`).then(e=>e.data),generateTitle:(e,n,r,o,s)=>{if(t()){let e=r.substring(0,30)+(r.length>30?`...`:``);return i({title:e,source:`fallback`,updatedAt:Date.now()})}return a.post(`/chat/sessions/${e}/generate-title`,{model:n,message:r,providerType:o,providerId:s}).then(e=>e.data)},getFolders:()=>t()?i([]):a.get(`/chat/folders`).then(e=>e.data),createFolder:e=>a.post(`/chat/folders`,{name:e}).then(e=>e.data),renameFolder:(e,t)=>a.put(`/chat/folders/${e}`,{name:t}).then(e=>e.data),deleteFolder:e=>a.delete(`/chat/folders/${e}`).then(e=>e.data),generateFollowUps:e=>t()?i({suggestions:[]}):a.post(`/chat/sessions/${e}/followups`).then(e=>e.data),sendMessage:(e,t,n)=>a.post(`/chat/sessions/${e}/messages`,{content:t,options:n}).then(e=>e.data),saveMessage:(e,t)=>a.post(`/chat/sessions/${e}/messages`,t).then(e=>e.data),updateMessage:(e,n,r)=>t()?i({}):a.put(`/chat/sessions/${e}/messages/${n}`,r).then(e=>e.data),generateChatResponse:(e,t,n)=>a.post(`/chat/sessions/${e}/generate`,{message:t,options:n}).then(e=>e.data),generateChatStreamResponse:(e,t,i)=>({subscribe:async(a,o,s)=>{try{let c=await fetch(`${n}/chat/sessions/${e}/generate/stream`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({message:t,options:i})});if(!c.ok)throw Error(`HTTP error! status: ${c.status}`);let l=c.body?.getReader();if(!l)throw Error(`No response body reader available`);let u=new TextDecoder,d=``,f=()=>{l.read().then(({done:e,value:t})=>{if(e){s?.();return}d+=u.decode(t,{stream:!0});let n=d.split(`
2
+ `);d=n.pop()||``;for(let e of n){let t=e.trim();if(t.startsWith(`data: `)){let e=t.slice(6);if(e===`[DONE]`){s?.();return}try{let t=JSON.parse(e);if(a(t),t.type===`done`||t.type===`error`){t.type===`error`?o?.(t.error):s?.();return}}catch(e){r.error(`Failed to parse SSE data:`,e)}}}f()}).catch(e=>{o?.(e instanceof Error?e:Error(String(e)))})};return f(),()=>l.cancel()}catch(e){return o?.(e instanceof Error?e:Error(String(e))),()=>{}}}}),getMessageBranches:(e,n)=>t()?i([]):a.get(`/chat/sessions/${e}/messages/${n}/branches`).then(e=>e.data),switchMessageBranch:(e,n,r)=>t()?i({}):a.post(`/chat/sessions/${e}/messages/${n}/branch`,{branchIndex:r}).then(e=>e.data),createMessageBranch:(e,n,r)=>t()?i({}):a.post(`/chat/sessions/${e}/messages/${n}/branches`,{...r}).then(e=>e.data)},v={uploadDocument:(e,n)=>{if(t())return i({id:`demo-doc-`+Date.now(),filename:e.name,fileType:e.name.endsWith(`.pdf`)?`pdf`:`txt`,size:e.size,sessionId:n,uploadedAt:Date.now()});let r=new FormData;return r.append(`document`,e),n&&r.append(`sessionId`,n),a.post(`/documents/upload`,r).then(e=>e.data)},getCollections:()=>t()?i([]):a.get(`/documents/collections`).then(e=>e.data),createCollection:e=>a.post(`/documents/collections`,{name:e}).then(e=>e.data),deleteCollection:e=>a.delete(`/documents/collections/${e}`).then(e=>e.data),setDocumentCollection:(e,t)=>a.put(`/documents/${e}/collection`,{collectionId:t}).then(e=>e.data),fetchWebpage:(e,n)=>t()?i({id:`demo-doc-`+Date.now(),filename:`demo-webpage.txt`,fileType:`txt`,size:0,sessionId:n,uploadedAt:Date.now()}):a.post(`/documents/fetch-url`,{url:e,sessionId:n}).then(e=>e.data),getDocuments:e=>{if(t())return i([]);let n=e?`/documents/session/${e}`:`/documents`;return a.get(n).then(e=>e.data)},getDocument:e=>t()?i({id:e,filename:`demo-document.pdf`,fileType:`pdf`,size:1024,content:`Demo document content...`,uploadedAt:Date.now()}):a.get(`/documents/${e}`).then(e=>e.data),searchDocuments:(e,n,r)=>t()?i([]):a.post(`/documents/search`,{query:e,sessionId:n,limit:r}).then(e=>e.data),deleteDocument:e=>t()?i(void 0):a.delete(`/documents/${e}`).then(e=>e.data),getEmbeddingStatus:()=>t()?i({available:!1,model:`nomic-embed-text`,chunksWithEmbeddings:0,totalChunks:0}):a.get(`/documents/embeddings/status`).then(e=>e.data),regenerateEmbeddings:()=>t()?i({documentsTotal:0,documentsRegenerated:0,documentsSkipped:0,chunksTotal:0,chunksEmbedded:0,model:`nomic-embed-text`,version:`v1`}):a.post(`/documents/embeddings/regenerate`).then(e=>e.data)},y={getModels:()=>t()?i([{id:`nomic-embed-text`,name:`nomic-embed-text`,description:`Ollama - Default embedding model`,provider:`ollama`,dimensions:0,isDetectedEmbedding:!0}]):a.get(`/embeddings/models`).then(e=>e.data)},b={getNotes:()=>t()?i([]):a.get(`/notes`).then(e=>e.data),createNote:(e,t)=>a.post(`/notes`,{title:e,content:t}).then(e=>e.data),updateNote:(e,t)=>a.put(`/notes/${e}`,t).then(e=>e.data),deleteNote:e=>a.delete(`/notes/${e}`).then(e=>e.data)},x={getConfig:()=>t()?i({enabled:!1,available:!1,allowed:!1}):a.get(`/search/config`).then(e=>e.data),getAccess:()=>t()?i({mode:`admins`,allowed:!1}):a.get(`/search/access`).then(e=>e.data),setAccess:e=>t()?i({mode:e}):a.put(`/search/access`,{mode:e}).then(e=>e.data),setConfig:(e,n,r)=>t()?i({enabled:e,available:e,allowed:!1,url:n}):a.put(`/search/config`,{enabled:e,url:n,...r??{}}).then(e=>e.data),test:()=>t()?i({ok:!1,results:0},!1):a.post(`/search/test`).then(e=>e.data)},S={getModels:e=>t()?i([{id:`meta-llama/Llama-3.3-70B-Instruct`,modelId:`meta-llama/Llama-3.3-70B-Instruct`,author:`meta-llama`,downloads:1e6,likes:5e3,tags:[`text-generation`,`llama`],pipeline_tag:`text-generation`,gated:!1}]):a.get(`/huggingface-hub/models`,{params:e}).then(e=>e.data),getTrending:e=>t()?i([]):a.get(`/huggingface-hub/trending`,{params:e}).then(e=>e.data),getModel:(e,n)=>t()?i({id:`${e}/${n}`,modelId:`${e}/${n}`,author:e,downloads:0,likes:0,tags:[],gated:!1}):a.get(`/huggingface-hub/models/${e}/${n}`).then(e=>e.data),getTasks:()=>t()?i([`text-generation`,`text-to-speech`,`text-to-image`]):a.get(`/huggingface-hub/tasks`).then(e=>e.data),clearCache:()=>t()?i(!0):a.post(`/huggingface-hub/cache/clear`).then(e=>e.data),getGgufFiles:(e,n)=>t()?i([{filename:`model-Q4_K_M.gguf`,size:45e8,sizeFormatted:`4.19 GB`,quantization:`Q4_K_M`,url:`https://huggingface.co/${e}/${n}/resolve/main/model-Q4_K_M.gguf`,ollamaCommand:`hf.co/${e}/${n}:Q4_K_M`}]):a.get(`/huggingface-hub/models/${e}/${n}/gguf`).then(e=>e.data),hasGgufFiles:(e,n)=>t()?i({hasGguf:!1,count:0}):a.get(`/huggingface-hub/models/${e}/${n}/has-gguf`).then(e=>e.data)};function C(e,t){return t?t.aborted?Promise.reject(t.reason??new DOMException(`The operation was aborted`,`AbortError`)):new Promise((n,r)=>{let i=()=>{r(t.reason??new DOMException(`The operation was aborted`,`AbortError`))};t.addEventListener(`abort`,i,{once:!0}),e.then(e=>{t.removeEventListener(`abort`,i),n(e)},e=>{t.removeEventListener(`abort`,i),r(e)})}):e}var w={getModels:()=>t()?i([{model:`gpt-image-2`,plugin:`openai`,config:{sizes:[`1024x1024`,`1536x1024`,`1024x1536`],default_size:`1024x1024`,qualities:[`auto`,`low`,`medium`,`high`],default_quality:`auto`}}]):a.get(`/image-gen/models`).then(e=>e.data),getPlugins:()=>t()?i([{id:`openai`,name:`OpenAI GPT Image`,models:[`gpt-image-2`,`gpt-image-1.5`,`gpt-image-1`,`gpt-image-1-mini`],config:{sizes:[`1024x1024`,`1536x1024`,`1024x1536`],default_size:`1024x1024`,qualities:[`auto`,`low`,`medium`,`high`],default_quality:`auto`}}]):a.get(`/image-gen/plugins`).then(e=>e.data),getConfig:e=>t()?i({sizes:[`1024x1024`,`1536x1024`,`1024x1536`],default_size:`1024x1024`,qualities:[`auto`,`low`,`medium`,`high`],default_quality:`auto`}):a.get(`/image-gen/config/${e}`).then(e=>e.data),generate:(e,n)=>t()?C(i({images:[{url:`https://placehold.co/1024x1024/purple/white?text=Demo+Image`,revised_prompt:e.prompt}],model:e.model,pluginId:e.pluginId}),n):a.post(`/image-gen/generate`,e,{signal:n}).then(e=>e.data),getGallery:e=>t()?i({images:[],total:0}):a.get(`/image-gen/gallery`,{params:e}).then(e=>e.data),getGalleryImage:e=>t()?i({id:e,userId:`demo`,prompt:`Demo image prompt`,model:`dall-e-3`,imageData:`https://placehold.co/1024x1024/purple/white?text=Demo`,createdAt:Date.now()}):a.get(`/image-gen/gallery/${e}`).then(e=>e.data),deleteGalleryImage:e=>t()?i(void 0):a.delete(`/image-gen/gallery/${e}`).then(e=>e.data)},T={connected:!1,baseUrl:`http://127.0.0.1:8766`,dashboardUrl:`http://127.0.0.1:8766/dashboard`,error:`Libre Claw daemon is not connected in demo mode.`},E={access:()=>t()?i({enabled:!1,lockedByEnv:!1}):a.get(`/libre-claw/access`).then(e=>e.data),setAccess:e=>t()?i({enabled:e,lockedByEnv:!1}):a.put(`/libre-claw/access`,{enabled:e}).then(e=>e.data),status:()=>t()?i(T):a.get(`/libre-claw/status`).then(e=>e.data),dashboard:()=>t()?i({url:T.dashboardUrl}):a.get(`/libre-claw/dashboard`).then(e=>e.data),currentModel:()=>t()?i({provider:`openrouter`,model:`openrouter/auto`}):a.get(`/libre-claw/config/model`).then(e=>e.data),updateModel:(e,n,r=!1)=>t()?i({provider:e,model:n,persist_global:r}):a.patch(`/libre-claw/config/model`,{provider:e,model:n,persist_global:r}).then(e=>e.data),currentFallback:()=>t()?i({enabled:!1,routes:[]}):a.get(`/libre-claw/config/fallback`).then(e=>e.data),updateFallback:e=>t()?i(e):a.patch(`/libre-claw/config/fallback`,e).then(e=>e.data),updateTheme:(e,n=!0)=>t()?i({theme:e,label:e,persist_global:n}):a.patch(`/libre-claw/config/theme`,{theme:e,persist_global:n}).then(e=>e.data),usage:(e=``,n=250)=>{let r=new URLSearchParams({limit:String(n)});return e&&r.set(`provider`,e),t()?i({summary:{},records:[],text:``}):a.get(`/libre-claw/usage?${r.toString()}`).then(e=>e.data)},listRuns:(e=20)=>t()?i({runs:[]}):a.get(`/libre-claw/runs?limit=${e}`).then(e=>e.data),startRun:e=>{if(t()){let t=new Date().toISOString();return i({run:{run_id:`demo-${Date.now()}`,state:`queued`,title:e.message.slice(0,80)||`Libre Claw demo run`,kind:e.kind||`chat`,provider:e.provider||`openrouter`,model:e.model||`openrouter/auto`,working_directory:``,created_at:t,updated_at:t}})}return a.post(`/libre-claw/runs`,e).then(e=>e.data)},getRun:e=>t()?i({run_id:e}):a.get(`/libre-claw/runs/${encodeURIComponent(e)}`).then(e=>e.data),getEvents:(e,n=0)=>t()?i({events:[]}):a.get(`/libre-claw/runs/${encodeURIComponent(e)}/events?after=${n}`).then(e=>e.data),cancelRun:e=>t()?i({run_id:e,cancelled:!0}):a.post(`/libre-claw/runs/${encodeURIComponent(e)}/cancel`).then(e=>e.data),resolvePermission:(e,n,r)=>t()?i({run_id:e,tool_call_id:n,resolution:r}):a.post(`/libre-claw/runs/${encodeURIComponent(e)}/permissions/${encodeURIComponent(n)}`,{resolution:r}).then(e=>e.data),listAutomations:(e=50)=>t()?i({automations:[]}):a.get(`/libre-claw/automations?limit=${e}`).then(e=>e.data),createAutomation:e=>t()?i({...e,automation_id:`demo-${Date.now()}`}):a.post(`/libre-claw/automations`,e).then(e=>e.data),updateAutomation:(e,n)=>t()?i({...n,automation_id:e}):a.patch(`/libre-claw/automations/${encodeURIComponent(e)}`,n).then(e=>e.data),pauseAutomation:e=>t()?i({automation_id:e,status:`paused`}):a.post(`/libre-claw/automations/${encodeURIComponent(e)}/pause`).then(e=>e.data),resumeAutomation:e=>t()?i({automation_id:e,status:`active`}):a.post(`/libre-claw/automations/${encodeURIComponent(e)}/resume`).then(e=>e.data),runAutomationNow:e=>t()?i({automation_id:e,run:!0}):a.post(`/libre-claw/automations/${encodeURIComponent(e)}/run`).then(e=>e.data),deleteAutomation:e=>t()?i({automation_id:e,deleted:!0}):a.delete(`/libre-claw/automations/${encodeURIComponent(e)}`).then(e=>e.data)},D={getModels:()=>a.get(`/media/models`).then(e=>e.data),generateAudio:(e,t)=>a.post(`/media/audio/generate`,e,{signal:t}).then(e=>e.data),cloneVoice:(e,t)=>{let n=new FormData;return n.set(`model`,e.model),n.set(`pluginId`,e.pluginId),n.set(`input`,e.input),n.set(`reference_audio`,e.referenceAudio),e.referenceText&&n.set(`reference_text`,e.referenceText),e.responseFormat&&n.set(`response_format`,e.responseFormat),e.saveVoiceName&&n.set(`saveVoiceName`,e.saveVoiceName),e.consentToStore&&n.set(`consentToStore`,`true`),a.post(`/media/audio/voice-clone`,n,{signal:t}).then(e=>e.data)},generateSound:(e,t)=>a.post(`/media/sound/generate`,e,{signal:t}).then(e=>e.data),generateVideo:(e,t)=>a.post(`/media/video/generate`,e,{signal:t}).then(e=>e.data),getVideoJob:(e,t)=>a.get(`/media/video/jobs/${e}`,{signal:t}).then(e=>e.data),listVideoJobs:e=>a.get(`/media/video/jobs`,{params:e}).then(e=>e.data),resumeVideoJob:(e,t)=>a.post(`/media/video/jobs/${encodeURIComponent(e)}/resume`,void 0,{signal:t}).then(e=>e.data),cancelVideoJob:e=>a.delete(`/media/video/jobs/${encodeURIComponent(e)}`).then(e=>e.data),getGallery:e=>a.get(`/media/gallery`,{params:e}).then(e=>e.data),deleteGalleryItem:e=>a.delete(`/media/gallery/${e}`).then(e=>e.data),getGalleryContent:e=>a.get(`/media/gallery/${e}/content`,{responseType:`blob`}).then(e=>e.data)},O=(e,t,n)=>{let r=new AbortController,i=localStorage.getItem(`auth-token`);return(async()=>{try{let n=await fetch(e,{headers:{Accept:`text/event-stream`,...i?{Authorization:`Bearer ${i}`}:{}},cache:`no-store`,credentials:`same-origin`,signal:r.signal});if(!n.ok){let e=`Request failed with status ${n.status}`;try{let t=await n.json();typeof t.error==`string`?e=t.error:typeof t.message==`string`&&(e=t.message)}catch{}throw Error(e)}if(!n.body)throw Error(`Response stream is unavailable`);let a=n.body.getReader(),o=new TextDecoder,s=``;try{for(;!r.signal.aborted;){let{done:e,value:n}=await a.read();s+=o.decode(n,{stream:!e});let r=s.split(/\r?\n\r?\n/);s=r.pop()||``;for(let e of r){let n=e.split(/\r?\n/).find(e=>e.startsWith(`data:`));n&&t(JSON.parse(n.slice(5).trim()))}if(e)break}}finally{a.releaseLock()}}catch(e){r.signal.aborted||n(e instanceof Error?e.message:`Connection lost`)}})(),()=>r.abort()},k=`libre:models-changed`,A=()=>{window.dispatchEvent(new Event(k))},ee={checkHealth:()=>t()?i({status:`offline`},!1):a.get(`/ollama/health`).then(e=>e.data),getModels:()=>t()?i(u):a.get(`/ollama/models`).then(e=>e.data),getModelAccess:()=>t()?i({mode:`admins`,allowed:!1}):a.get(`/ollama/models/access`).then(e=>e.data),setModelAccess:e=>t()?i({mode:e}):a.put(`/ollama/models/access`,{mode:e}).then(e=>e.data),pullModel:e=>t()?i(null,!1):a.post(`/ollama/models/pull`,{name:e}).then(e=>(A(),e.data)),pullModelStream:(e,r,i,a)=>{if(t()){let e=0,t=setInterval(()=>{e+=Math.random()*20,e>=100?(e=100,r({status:`success`,total:100,completed:100,percent:100}),clearInterval(t),setTimeout(()=>{A(),i()},500)):r({status:`pulling`,total:100,completed:e,percent:Math.round(e)})},1e3);return()=>clearInterval(t)}let o=new URLSearchParams({model:e});return O(`${n}/ollama/pull/stream?${o.toString()}`,e=>{switch(e.type){case`progress`:r({status:typeof e.status==`string`?e.status:`pulling`,digest:typeof e.digest==`string`?e.digest:void 0,total:typeof e.total==`number`?e.total:void 0,completed:typeof e.completed==`number`?e.completed:void 0,percent:typeof e.percent==`number`?e.percent:void 0});break;case`complete`:A(),i();break;case`error`:a(String(e.error||`Model pull failed`))}},a)},deleteModel:e=>t()?i(null,!1):a.delete(`/ollama/models`,{params:{name:e}}).then(e=>(A(),e.data)),getModelDefaults:e=>a.get(`/ollama/models/${encodeURIComponent(e)}/defaults`).then(e=>e.data),showModel:(e,n=!1)=>{if(t()){let t=u.find(t=>t.name===e);return i(t||null,!!t)}return a.get(`/ollama/models/show`,{params:{name:e,verbose:n}}).then(e=>e.data)},createModel:e=>t()?i(null,!1):a.post(`/ollama/models`,e).then(e=>(A(),e.data)),copyModel:(e,n)=>t()?i(null,!1):a.post(`/ollama/models/copy`,{source:e,destination:n}).then(e=>(A(),e.data)),pushModel:e=>t()?i(null,!1):a.post(`/ollama/models/push`,{name:e}).then(e=>e.data),pullAllModels:()=>t()?i(null,!1):a.post(`/ollama/models/pull-all`).then(e=>e.data),pullAllModelsStream:(e,r,i)=>{if(t()){let t=u,n=0,i=setInterval(()=>{n++,n<=t.length&&e({current:n,total:t.length,modelName:t[n-1]?.name||`demo-model`,status:Math.random()>.1?`success`:`error`,error:Math.random()>.1?void 0:`Demo error`}),n>=t.length&&(clearInterval(i),setTimeout(()=>{A(),r()},500))},1e3);return}O(`${n}/ollama/models/pull-all/stream`,t=>{switch(t.type){case`progress`:{let n=t.status===`success`||t.status===`error`?t.status:`starting`;e({current:typeof t.current==`number`?t.current:0,total:typeof t.total==`number`?t.total:0,modelName:typeof t.modelName==`string`?t.modelName:`unknown`,status:n,error:typeof t.error==`string`?t.error:void 0});break}case`complete`:A(),r();break;case`error`:i(String(t.error||`Model update failed`))}},i)},generateEmbeddings:e=>t()?i({embeddings:[[]]},!1):a.post(`/ollama/embed`,e).then(e=>e.data),listRunningModels:()=>t()?i([]):a.get(`/ollama/running`).then(e=>e.data),unloadModel:e=>t()?i(null):a.post(`/ollama/models/unload`,{name:e}).then(e=>e.data),unloadAllModels:()=>t()?i(null):a.post(`/ollama/models/unload-all`).then(e=>e.data),getVersion:()=>t()?i({version:`demo-mode`},!1):a.get(`/ollama/version`).then(e=>e.data),chatCompletion:e=>t()?i({message:{content:`Demo response`,role:`assistant`}},!1):a.post(`/ollama/chat`,e).then(e=>e.data),checkBlobExists:e=>t()?Promise.resolve(!1):a.head(`/ollama/blobs/${e}`).then(()=>!0).catch(()=>!1),pushBlob:(e,n)=>t()?i(null,!1):a.post(`/ollama/blobs/${e}`,n,{headers:{"Content-Type":`application/octet-stream`}}).then(e=>e.data),generateLegacyEmbeddings:e=>t()?i({embedding:[]},!1):a.post(`/ollama/embeddings`,e).then(e=>e.data),getLibraryModels:e=>{if(t())return e?.category===`cloud`?i([{name:`gpt-oss:cloud`,description:`Demo cloud model using Ollama cloud naming`,category:`cloud`,sizes:[`cloud`],pulls:`Cloud`,tags:[`cloud`]}]):i([{name:`llama3.2`,description:`Meta's latest Llama model`,category:`general`,sizes:[`1b`,`3b`],pulls:`50M+`,tags:[`general`]},{name:`deepseek-r1`,description:`Open reasoning model`,category:`reasoning`,sizes:[`7b`,`14b`,`32b`],pulls:`200M+`,tags:[`reasoning`]}]);let n=new URLSearchParams;e?.search&&n.set(`search`,e.search),e?.sort&&n.set(`sort`,e.sort),e?.category&&n.set(`category`,e.category);let r=n.toString();return a.get(`/ollama/library${r?`?${r}`:``}`).then(e=>e.data)}},j=[[`#2563eb`,`#7c3aed`],[`#0891b2`,`#2563eb`],[`#0f766e`,`#2563eb`],[`#be123c`,`#7c3aed`],[`#ff7b52`,`#dc2626`]],M=e=>{let t=0;for(let n=0;n<e.length;n+=1)t=(t<<5)-t+e.charCodeAt(n),t|=0;return Math.abs(t)},N=e=>e.replace(/&/g,`&amp;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`).replace(/"/g,`&quot;`),P=e=>{let t=e.trim().split(/[\s._-]+/).filter(Boolean);return t.length===0?`AI`:t.slice(0,2).map(e=>e[0]?.toUpperCase()).join(``)||`AI`},F=(e,t=128)=>{let n=e.trim()||`AI Persona`,r=M(n),[i,a]=j[r%j.length],o=N(P(n)),s=`persona-avatar-${r}-${t}`,c=t>=96?44:24,l=`
3
+ <svg xmlns="http://www.w3.org/2000/svg" width="${t}" height="${t}" viewBox="0 0 ${t} ${t}" role="img" aria-label="${N(n)} avatar">
4
+ <defs>
5
+ <linearGradient id="${s}" x1="0" y1="0" x2="1" y2="1">
6
+ <stop offset="0%" stop-color="${i}" />
7
+ <stop offset="100%" stop-color="${a}" />
8
+ </linearGradient>
9
+ </defs>
10
+ <rect width="${t}" height="${t}" rx="${Math.round(t*.22)}" fill="url(#${s})" />
11
+ <circle cx="${t*.22}" cy="${t*.22}" r="${t*.26}" fill="rgba(255,255,255,0.16)" />
12
+ <text x="50%" y="52%" dominant-baseline="middle" text-anchor="middle" fill="white" font-family="Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif" font-size="${c}" font-weight="700">${o}</text>
13
+ </svg>
14
+ `;return`data:image/svg+xml;charset=UTF-8,${encodeURIComponent(l)}`},I=(e,t=128)=>e.avatar?.trim()||F(e.name,t),L=(e,t,n=128)=>{e.onerror=null,e.src=F(t,n)},R={getPersonas:()=>{if(t()){let e=[{id:`demo-1`,user_id:`default`,name:`Creative Assistant`,description:`Helpful assistant for creative tasks`,model:`llama3.3:latest`,parameters:{temperature:.8,top_p:.9,context_window:4096,system_prompt:`You are a creative and helpful assistant. Provide thoughtful and engaging responses.`},avatar:F(`Creative Assistant`,128),created_at:Date.now()-864e5,updated_at:Date.now()-864e5},{id:`demo-2`,user_id:`default`,name:`Research Assistant`,description:`Academic assistant for research and learning`,model:`qwen3:7b`,parameters:{temperature:.3,top_p:.8,context_window:8192,system_prompt:`You are a knowledgeable research assistant. Provide detailed, informative explanations.`},avatar:F(`Research Assistant`,128),created_at:Date.now()-1728e5,updated_at:Date.now()-1728e5}];return i(e)}return a.get(`/personas`).then(e=>e.data)},getPersona:e=>t()?i({id:e,user_id:`default`,name:`Sample Assistant`,description:`A sample assistant for demonstration`,model:`llama3.2:latest`,parameters:{temperature:.7,top_p:.9,context_window:4096,system_prompt:`You are a helpful assistant.`},created_at:Date.now(),updated_at:Date.now()}):a.get(`/personas/${e}`).then(e=>e.data),createPersona:e=>{if(t()){let t={id:`demo-`+Date.now(),user_id:`default`,...e,created_at:Date.now(),updated_at:Date.now()};return i(t)}return a.post(`/personas`,e).then(e=>e.data)},updatePersona:(e,n)=>{if(t()){let t={id:e,user_id:`default`,name:n.name||`Updated Sample Assistant`,description:n.description,model:n.model||`llama3.2:latest`,parameters:n.parameters||{temperature:.7,top_p:.9,context_window:4096,system_prompt:`You are a helpful assistant.`},avatar:n.avatar,background:n.background,created_at:Date.now()-864e5,updated_at:Date.now()};return i(t)}return a.put(`/personas/${e}`,n).then(e=>e.data)},deletePersona:e=>t()?i(void 0):a.delete(`/personas/${e}`).then(e=>e.data),exportPersona:e=>{if(t()){let e={name:`Sample Assistant`,description:`A sample assistant for demonstration`,model:`llama3.2:latest`,params:{temperature:.7,top_p:.9,context_window:4096,system_prompt:`You are a helpful assistant.`},exportedAt:Date.now(),version:`1.0.0`};return Promise.resolve(e)}return a.get(`/personas/${e}/export`).then(e=>e.data)},importPersona:e=>{if(t()){let t={id:`demo-imported-`+Date.now(),user_id:`default`,name:e.name,description:e.description,model:e.model,parameters:e.params,avatar:e.avatar,background:e.background,created_at:Date.now(),updated_at:Date.now(),embedding_model:e.embedding_model,memory_settings:e.memory_settings,mutation_settings:e.mutation_settings};return i(t)}return a.post(`/personas/import`,e).then(e=>e.data)},getPersonasCount:()=>t()?i({count:2}):a.get(`/personas/stats/count`).then(e=>e.data),getDefaultParameters:()=>t()?i({temperature:.7,top_p:.9,top_k:40,context_window:4096,max_tokens:1024,system_prompt:``,repeat_penalty:1.1,presence_penalty:0,frequency_penalty:0}):a.get(`/personas/defaults/parameters`).then(e=>e.data),getMemoryStatus:e=>t()?i({status:`active`,memory_count:42,last_backup:Date.now()-864e5,size_mb:2.3}):a.get(`/personas/${e}/memory/status`).then(e=>e.data),wipeMemories:e=>t()?i({deleted_count:42}):a.delete(`/personas/${e}/memory`).then(e=>e.data),backupPersona:e=>{if(t()){let t=JSON.stringify({persona_id:e,backup_date:new Date().toISOString(),data:`demo backup data`});return Promise.resolve(new Blob([t],{type:`application/json`}))}return a.get(`/personas/${e}/backup`,{responseType:`blob`}).then(e=>e.data)},exportPersonaDNA:e=>{if(t()){let t=JSON.stringify({persona_id:e,export_date:new Date().toISOString(),dna:`demo DNA data`,memories:[],learned_behaviors:{}});return Promise.resolve(new Blob([t],{type:`application/json`}))}return a.get(`/personas/${e}/export/dna`,{responseType:`blob`}).then(e=>e.data)},importPersonaDNA:e=>{if(t()){let e={id:`demo-dna-`+Date.now(),user_id:`default`,name:`Imported Persona`,description:`Persona imported from DNA`,model:`llama3.2:latest`,parameters:{temperature:.7,top_p:.9,context_window:4096,system_prompt:`You are a helpful assistant.`},created_at:Date.now(),updated_at:Date.now()};return i(e)}let n=new FormData;return n.append(`dnaFile`,e),a.post(`/personas/import/dna`,n).then(e=>e.data)},downloadPersona:async(e,t)=>{try{let n=await R.exportPersona(e),r=new Blob([JSON.stringify(n,null,2)],{type:`application/json`}),i=URL.createObjectURL(r),a=document.createElement(`a`);a.href=i,a.download=`${t}.json`,document.body.appendChild(a),a.click(),document.body.removeChild(a),URL.revokeObjectURL(i)}catch(e){throw r.error(`Error while downloading persona:`,e),Error(`Failed to download persona: ${e instanceof Error?e.message:String(e)}`)}}},z=e=>{let t=Date.now();return{range:{from:t-Math.max(0,e-1)*864e5,to:t,days:e},totals:{calls:0,successfulCalls:0,failedCalls:0,cancelledCalls:0,meteredCalls:0,promptTokens:0,completionTokens:0,reportedTokens:0,averageLatencyMs:0,uniqueUsers:0},series:[],plugins:[],models:[],capabilities:[]}},B={getUsage:(e=30)=>t()?i(z(e)):a.get(`/plugins/usage`,{params:{days:e}}).then(e=>e.data),getAllPlugins:()=>t()?i([]):a.get(`/plugins`).then(e=>e.data),discoverModels:e=>t()?i({models:[],outcome:`unavailable`}):a.post(`/plugins/discover/${encodeURIComponent(e)}`).then(e=>e.data),uploadPlugin:e=>{if(t())return i({},!1);let n=new FormData;return n.append(`plugin`,e),a.post(`/plugins/upload`,n).then(e=>e.data)},installPlugin:e=>t()?i({},!1):a.post(`/plugins/install`,e).then(e=>e.data),updatePlugin:(e,n)=>t()?i({},!1):a.put(`/plugins/${e}`,n).then(e=>e.data),deletePlugin:e=>t()?i(void 0):a.delete(`/plugins/${e}`).then(e=>e.data),activatePlugin:e=>t()?i(!1,!1):a.post(`/plugins/activate/${e}`).then(e=>e.data),deactivatePlugin:e=>{if(t())return i(void 0);let n=e?`/plugins/deactivate/${e}`:`/plugins/deactivate`;return a.post(n).then(e=>e.data)},getActivePlugin:()=>t()?i(null):a.get(`/plugins/active`).then(e=>e.data),getPluginStatus:()=>t()?i([]):a.get(`/plugins/status`).then(e=>e.data),exportPlugin:e=>t()?Promise.resolve(new Blob([`{}`],{type:`application/json`})):a.get(`/plugins/${e}/export`,{responseType:`blob`}).then(e=>e.data),getCredentials:()=>t()?i([]):a.get(`/plugins/credentials/all`).then(e=>e.data),setApiKey:(e,n)=>t()?i(!1,!1):a.post(`/plugins/${e}/credentials`,{api_key:n}).then(e=>e.data),deleteApiKey:e=>t()?i(!1,!1):a.delete(`/plugins/${e}/credentials`).then(e=>e.data),checkApiKey:e=>t()?i(!1):a.get(`/plugins/${e}/credentials/check`).then(e=>e.data),getVariables:e=>t()?i({}):a.get(`/plugins/${e}/variables`).then(e=>e.data),setVariables:(e,n,r=[])=>t()?i(!0):a.put(`/plugins/${e}/variables`,{variables:n,unset:r}).then(e=>e.data),resetVariables:e=>t()?i(!0):a.delete(`/plugins/${e}/variables`).then(e=>e.data)},V=`libre-webui-user-data`,H=`libre-webui-export`,U=new Set([2,3]);function W(e){return typeof e!=`object`||!e?JSON.stringify(e):Array.isArray(e)?`[${e.map(e=>W(e)).join(`,`)}]`:`{${Object.keys(e).sort().map(t=>`${JSON.stringify(t)}:${W(e[t])}`).join(`,`)}}`}async function G(e){let{integrity:t,...n}=e,r=JSON.parse(JSON.stringify(n)),i=await globalThis.crypto.subtle.digest(`SHA-256`,new TextEncoder().encode(W(r)));return Array.from(new Uint8Array(i),e=>e.toString(16).padStart(2,`0`)).join(``)}function K(e){let t;try{t=JSON.parse(e)}catch{throw Error(`Portable archive is not valid JSON.`)}if(!t||typeof t!=`object`||Array.isArray(t))throw Error(`Portable archive must contain a JSON object.`);let n=t;if(n.format===V){if(!U.has(n.version))throw Error(`Unsupported portable archive version ${String(n.version)}.`);return n}if(n.format===H)return n;throw Error(`This file is not a Libre WebUI portable archive.`)}var q=[{key:`accountAndAuthentication`,reason:`Account and authentication records are not portable.`},{key:`providerSecrets`,reason:`Provider credentials must be configured again.`},{key:`voiceProfiles`,reason:`Voice reference audio is biometric data and is not portable.`},{key:`personasAndMemory`,reason:`Personas and persona memory are not part of archive version 3.`},{key:`generatedMedia`,reason:`Generated media library files are not portable.`},{key:`work`,reason:`Work data and volumes require a system backup.`},{key:`derivedEmbeddings`,reason:`Document embeddings can be regenerated after import.`}];function J(e,t){if(typeof File<`u`&&e instanceof File){let n=new FormData;return n.append(`archive`,e),n.append(`strategy`,t),n}return{data:e,strategy:t}}var Y={getPreferences:()=>t()?i(h()):a.get(`/preferences`).then(e=>e.data),updatePreferences:e=>t()?i(g(e)):a.put(`/preferences`,e).then(e=>e.data),setDefaultModel:(e,n,r)=>t()?i(g({defaultModel:e,defaultProviderType:n,defaultProviderId:n===`plugin`||n===`agent`?r:null})):a.put(`/preferences/default-model`,{model:e,providerType:n,providerId:r}).then(e=>e.data),setSystemMessage:e=>t()?i(g({systemMessage:e})):a.put(`/preferences/system-message`,{message:e}).then(e=>e.data),setGenerationOptions:e=>t()?i(g({generationOptions:e})):a.put(`/preferences/generation-options`,e).then(e=>e.data),setModelGenerationOptions:(e,t)=>a.put(`/preferences/model-generation-options`,{model:e,options:t}).then(e=>e.data),resetGenerationOptions:()=>t()?i(g({generationOptions:p.generationOptions})):a.post(`/preferences/generation-options/reset`).then(e=>e.data),setEmbeddingSettings:e=>t()?i(g({embeddingSettings:e})):a.put(`/preferences/embedding-settings`,e).then(e=>e.data),resetEmbeddingSettings:()=>t()?i(g({embeddingSettings:p.embeddingSettings})):a.post(`/preferences/embedding-settings/reset`).then(e=>e.data),exportData:async()=>{if(t()){let e={format:`libre-webui-user-data`,version:3,exportedAt:new Date().toISOString(),preferences:h(),sessionFolders:[],sessions:[],notes:[],knowledgeCollections:[],documents:[],exclusions:q};return i({...e,integrity:{algorithm:`sha256`,canonicalization:`libre-json-sort-v1`,digest:await G(e)}})}return a.get(`/preferences/export`).then(e=>e.data)},preflightImport:(e,n)=>t()?i({valid:!0,format:`libre-webui-user-data`,version:3,strategy:n,incoming:{sessionFolders:0,sessions:0,messages:0,notes:0,knowledgeCollections:0,documents:0,documentChunks:0},result:{format:`libre-webui-user-data`,version:3,strategy:n,sessionFolders:{imported:0,overwritten:0,skipped:0},sessions:{imported:0,overwritten:0,skipped:0},notes:{imported:0,overwritten:0,skipped:0},knowledgeCollections:{imported:0,overwritten:0,skipped:0},documents:{imported:0,overwritten:0,skipped:0},remappedIds:0,warnings:[],exclusions:[]},warnings:[],exclusions:[]}):a.post(`/preferences/import/preflight`,J(e,n)).then(e=>e.data),importData:(e,n=`skip`)=>t()?i({format:`libre-webui-user-data`,version:3,strategy:n,preferences:{imported:!0,mode:n===`overwrite`?`replace`:`merge`},sessionFolders:{imported:0,overwritten:0,skipped:0},sessions:{imported:0,overwritten:0,skipped:0},notes:{imported:0,overwritten:0,skipped:0},knowledgeCollections:{imported:0,overwritten:0,skipped:0},documents:{imported:0,overwritten:0,skipped:0},remappedIds:0,warnings:[],exclusions:[]}):a.post(`/preferences/import`,J(e,n)).then(e=>e.data)},X={getDiagnostics:()=>a.get(`/system`).then(e=>e.data)};function Z(e,t,n){if(t)return e.find(e=>e.model===t&&(!n||e.plugin===n))}function Q(e,t,n){return Z(e,t,n)||e[0]}function te(e){return`${encodeURIComponent(e.plugin)}::${encodeURIComponent(e.model)}`}var $={getModels:()=>t()?i([{model:`tts-1`,plugin:`openai`,config:{voices:[`alloy`,`echo`,`fable`,`onyx`,`nova`,`shimmer`],default_voice:`alloy`,formats:[`mp3`,`opus`,`aac`,`flac`,`wav`],default_format:`mp3`,max_characters:4096}}]):a.get(`/tts/models`).then(e=>e.data),getPlugins:()=>t()?i([{id:`openai`,name:`OpenAI GPT`,models:[`tts-1`,`tts-1-hd`],config:{voices:[`alloy`,`echo`,`fable`,`onyx`,`nova`,`shimmer`],default_voice:`alloy`}}]):a.get(`/tts/plugins`).then(e=>e.data),getVoiceProfiles:(e={})=>t()?i([]):a.get(`/tts/voice-profiles`,{params:{pluginId:e.pluginId||void 0,model:e.model||void 0}}).then(e=>e.data),deleteVoiceProfile:async e=>{t()||await a.delete(`/tts/voice-profiles/${encodeURIComponent(e)}`)},getVoices:e=>t()?i({voices:[`alloy`,`echo`,`fable`,`onyx`,`nova`,`shimmer`],default_voice:`alloy`,formats:[`mp3`,`opus`,`aac`,`flac`,`wav`],default_format:`mp3`,max_characters:4096,supports_streaming:!1,supports_voice_cloning:!1,clone_requires_transcript:!1}):a.get(`/tts/voices/${e}`).then(e=>e.data),generateBase64:e=>{if(t())return i({audio:``,format:e.response_format||`mp3`,mimeType:`audio/mpeg`,size:0});let n={...e,pluginId:e.pluginId||void 0};return a.post(`/tts/generate-base64`,n).then(e=>e.data)},generate:async(e,n={})=>{if(t())return new Blob([],{type:`audio/mpeg`});let r={...e,pluginId:e.pluginId||void 0};return(await a.post(`/tts/generate`,r,{responseType:`blob`,signal:n.signal})).data},speak:async(e,t={})=>{try{t.onStart?.();let n=await $.generateBase64({model:t.model||`tts-1`,pluginId:t.pluginId,input:e,voice:t.voice,voiceProfileId:t.voiceProfileId,speed:t.speed,response_format:t.responseFormat});if(!n.success||!n.data?.audio)throw Error(n.message||`Failed to generate speech`);let r=`data:${n.data.mimeType};base64,${n.data.audio}`,i=new Audio(r);return i.onended=()=>t.onEnd?.(),i.onerror=()=>t.onError?.(Error(`Audio playback failed`)),await i.play(),i}catch(e){let n=e instanceof Error?e:Error(`Unknown error`);return t.onError?.(n),null}}},ne={getModels:()=>t()?i([]):a.get(`/stt/models`).then(e=>e.data),transcribe:async(e,t,n={})=>{let r=new FormData,i=re(e.type);r.append(`audio`,e,`recording.${i}`),r.append(`model`,t.model),r.append(`pluginId`,t.plugin),n.language&&r.append(`language`,n.language);let o=await a.post(`/stt/transcribe`,r,{signal:n.signal});if(!o.data.success||!o.data.data)throw Error(o.data.message||o.data.error||`Transcription failed`);return o.data.data}};function re(e){let t=e.split(`;`,1)[0].toLowerCase();return t.includes(`webm`)?`webm`:t.includes(`ogg`)?`ogg`:t.includes(`wav`)?`wav`:t.includes(`flac`)?`flac`:t.includes(`mp4`)||t.includes(`m4a`)?`m4a`:`mp3`}var ie=e({MODELS_CHANGED_EVENT:()=>k,agentCliApi:()=>o,personaApi:()=>R,preferencesApi:()=>Y});export{y as C,l as E,v as S,c as T,E as _,Q as a,x as b,Y as c,R as d,I as f,D as g,ee as h,te as i,K as l,k as m,ne as n,$ as o,L as p,Z as r,X as s,ie as t,B as u,w as v,_ as w,b as x,S as y};
@@ -0,0 +1,2 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["js/api-IzobHGND.js","js/rolldown-runtime-hePW80VL.js","js/logger-DSXjF4ye.js","js/config-DPEEuTAe.js","js/workApi-Czu69yWS.js","js/router-vendor-CbPDks39.js","js/markdown-core-BmPPZiuD.js","js/utils-vendor-BBa8OxtB.js"])))=>i.map(i=>d[i]);
2
+ import{i as e}from"./router-vendor-CbPDks39.js";import{o as t,t as n}from"./utils-vendor-BBa8OxtB.js";import{i as r,r as i,t as a}from"./logger-DSXjF4ye.js";var o=`dark`,s=`blue`,c=`#4176e6`,l=[{id:`violet`,label:`Violet`,color:`#7c3aed`,foreground:`#ffffff`},{id:`blue`,label:`Blue`,color:`#4176e6`,foreground:`#ffffff`},{id:`cyan`,label:`Cyan`,color:`#0e7490`,foreground:`#ffffff`},{id:`teal`,label:`Teal`,color:`#0f766e`,foreground:`#ffffff`},{id:`emerald`,label:`Emerald`,color:`#15803d`,foreground:`#ffffff`},{id:`amber`,label:`Coral`,color:`#ff7b52`,foreground:`#3d120c`},{id:`rose`,label:`Rose`,color:`#e11d48`,foreground:`#ffffff`},{id:`slate`,label:`Slate`,color:`#475569`,foreground:`#ffffff`}],u=[`50`,`100`,`200`,`300`,`400`,`500`,`600`,`700`,`800`,`900`,`950`],d=[`25`,...u],f=[`canvas`,`sidebar`,`surface`,`surface-subtle`,`surface-raised`,`surface-overlay`,`surface-inverse`,`ink`,`ink-muted`,`ink-subtle`,`ink-inverse`,`line`,`line-strong`],p={multiplier:.24,minimum:6,maximum:24},m={multiplier:.36,minimum:6,maximum:32},h={25:99,50:97,100:94,200:88,300:80,400:66,500:48,600:36,700:27,800:18,900:11,950:6},g={25:13,50:4,100:7,200:10,300:16,400:27,500:46,600:65,700:82,800:89,900:95,950:99},_={canvas:{lightness:96,saturationFactor:1},sidebar:{lightness:94,saturationFactor:1},surface:{lightness:98,saturationFactor:.9},"surface-subtle":{lightness:93,saturationFactor:1},"surface-raised":{lightness:99,saturationFactor:.8},"surface-overlay":{lightness:100,saturationFactor:0},"surface-inverse":{lightness:10,saturationFactor:.7},ink:{lightness:10,saturationFactor:.45},"ink-muted":{lightness:38,saturationFactor:.35},"ink-subtle":{lightness:54,saturationFactor:.4},"ink-inverse":{lightness:98,saturationFactor:.4},line:{lightness:86,saturationFactor:.8},"line-strong":{lightness:75,saturationFactor:.65}},v={canvas:{lightness:5,saturationFactor:.9},sidebar:{lightness:8,saturationFactor:1},surface:{lightness:7,saturationFactor:.9},"surface-subtle":{lightness:9,saturationFactor:1},"surface-raised":{lightness:11,saturationFactor:1},"surface-overlay":{lightness:13,saturationFactor:1},"surface-inverse":{lightness:96,saturationFactor:.35},ink:{lightness:96,saturationFactor:.3},"ink-muted":{lightness:67,saturationFactor:.35},"ink-subtle":{lightness:48,saturationFactor:.4},"ink-inverse":{lightness:7,saturationFactor:.45},line:{lightness:18,saturationFactor:.8},"line-strong":{lightness:28,saturationFactor:.65}},y={violet:{50:`#f5f3ff`,100:`#ede9fe`,200:`#ddd6fe`,300:`#c4b5fd`,400:`#a78bfa`,500:`#7c3aed`,600:`#6d28d9`,700:`#5b21b6`,800:`#4c1d95`,900:`#3b0764`,950:`#2e1065`},blue:{50:`#edf3fe`,100:`#e4edfd`,200:`#d3e2ff`,300:`#b7c8fe`,400:`#679efe`,500:`#4176e6`,600:`#4868b2`,700:`#2f4c8f`,800:`#34415b`,900:`#283142`,950:`#1e2635`},cyan:{50:`#ecfeff`,100:`#cffafe`,200:`#a5f3fc`,300:`#67e8f9`,400:`#22d3ee`,500:`#0e7490`,600:`#155e75`,700:`#164e63`,800:`#083344`,900:`#092f3f`,950:`#062634`},teal:{50:`#f0fdfa`,100:`#ccfbf1`,200:`#99f6e4`,300:`#5eead4`,400:`#2dd4bf`,500:`#0f766e`,600:`#0f625d`,700:`#115e59`,800:`#134e4a`,900:`#042f2e`,950:`#022c22`},emerald:{50:`#ecfdf5`,100:`#d1fae5`,200:`#a7f3d0`,300:`#6ee7b7`,400:`#34d399`,500:`#15803d`,600:`#166534`,700:`#14532d`,800:`#064e3b`,900:`#052e16`,950:`#022c22`},amber:{50:`#fff5f1`,100:`#ffe8df`,200:`#ffd0c2`,300:`#ffae96`,400:`#ff9273`,500:`#ff7b52`,600:`#c94a27`,700:`#a83a1f`,800:`#87301f`,900:`#70291e`,950:`#3d120c`},rose:{50:`#fff1f2`,100:`#ffe4e6`,200:`#fecdd3`,300:`#fda4af`,400:`#fb7185`,500:`#e11d48`,600:`#be123c`,700:`#9f1239`,800:`#881337`,900:`#4c0519`,950:`#2d0714`},slate:{50:`#f8fafc`,100:`#f1f5f9`,200:`#e2e8f0`,300:`#cbd5e1`,400:`#94a3b8`,500:`#475569`,600:`#334155`,700:`#1e293b`,800:`#0f172a`,900:`#020617`,950:`#010313`}},b={50:97,100:94,200:88,300:76,400:64,500:42,600:34,700:27,800:21,900:16,950:10},x=(e,t,n)=>Math.min(Math.max(e,t),n),S=e=>{if(!e)return null;let t=e.trim().match(/^#?([0-9a-f]{3}|[0-9a-f]{6})$/i);if(!t)return null;let n=t[1];return`#${(n.length===3?n.split(``).map(e=>`${e}${e}`).join(``):n).toLowerCase()}`},C=e=>{let t=S(e)||`#4176e6`,n=parseInt(t.slice(1),16);return{r:n>>16&255,g:n>>8&255,b:n&255}},w=(e,t,n)=>`#${[e,t,n].map(e=>x(Math.round(e),0,255).toString(16).padStart(2,`0`)).join(``)}`,T=(e,t,n)=>{let r=e/255,i=t/255,a=n/255,o=Math.max(r,i,a),s=Math.min(r,i,a),c=(o+s)/2;if(o===s)return{h:0,s:0,l:c*100};let l=o-s,u=c>.5?l/(2-o-s):l/(o+s),d=0;return d=o===r?(i-a)/l+(i<a?6:0):o===i?(a-r)/l+2:(r-i)/l+4,{h:d*60,s:u*100,l:c*100}},E=(e,t,n)=>{let r=x(t,0,100)/100,i=x(n,0,100)/100,a=(1-Math.abs(2*i-1))*r,o=(e%360+360)%360,s=a*(1-Math.abs(o/60%2-1)),c=i-a/2,l=0,u=0,d=0;return o<60?(l=a,u=s):o<120?(l=s,u=a):o<180?(u=a,d=s):o<240?(u=s,d=a):o<300?(l=s,d=a):(l=a,d=s),w((l+c)*255,(u+c)*255,(d+c)*255)},D=e=>{let{r:t,g:n,b:r}=C(e),i=[t,n,r].map(e=>{let t=e/255;return t<=.03928?t/12.92:((t+.055)/1.055)**2.4});return i[0]*.2126+i[1]*.7152+i[2]*.0722},O=(e,t)=>{let n=D(e),r=D(t),i=Math.max(n,r),a=Math.min(n,r);return(i+.05)/(a+.05)},k=(e,t,n)=>{let r=n,i=E(e,t,r);for(;O(`#ffffff`,i)<4.5&&r>12;)r-=2,i=E(e,t,r);return i},A=e=>{let{r:t,g:n,b:r}=C(S(e)||`#4176e6`),{h:i,s:a}=T(t,n,r),o=a<8?a:x(a,42,88);return u.reduce((e,t)=>{let n=b[t],r=Number(t)<300?o*.72:o;return e[t]=t===`500`||t===`600`?k(i,r,n):E(i,r,n),e},{})},j=e=>{let t=e?.mode===`light`?`light`:o,n=e?.accent===`custom`?`custom`:e?.accent,r=l.some(e=>e.id===n)?n:s,i=S(e?.customAccent)||`#4176e6`;return{mode:t,adaptToAccent:e?.adaptToAccent===!0,accent:n===`custom`?`custom`:r,customAccent:i}},M=()=>j({mode:o}),N=e=>{let t=j(e);return t.accent===`custom`?A(t.customAccent):y[t.accent||`blue`]},P=e=>{let t=j(e);return t.accent===`custom`?t.customAccent||`#4176e6`:l.find(e=>e.id===t.accent)?.color||`#4176e6`},F=(e,t,n)=>t===0||e<8?e*t:x(e*n.multiplier*t,n.minimum*t,n.maximum*t),I=(e,t,n,r)=>d.reduce((i,a)=>(i[a]=E(e,F(t,1,r),n[a]),i),{}),L=(e,t,n,r)=>f.reduce((i,a)=>{let o=n[a];return i[a]=E(e,F(t,o.saturationFactor,r),o.lightness),i},{}),R=(e,t,n)=>{let{r,g:i,b:a}=C(n);e.style.setProperty(t,`${r} ${i} ${a}`)},z=e=>{for(let t of d)e.style.removeProperty(`--color-gray-${t}`),e.style.removeProperty(`--color-dark-${t}`);for(let t of f)e.style.removeProperty(`--color-${t}`)},B=(e,t)=>{let{r:n,g:r,b:i}=C(P(t)),{h:a,s:o}=T(n,r,i),s=t.mode===`light`?m:p,c=I(a,o,h,s),l=I(a,o,g,p),u=L(a,o,t.mode===`dark`?v:_,s);for(let t of d)R(e,`--color-gray-${t}`,c[t]),R(e,`--color-dark-${t}`,l[t]);for(let t of f)R(e,`--color-${t}`,u[t])},V=e=>{if(typeof document>`u`)return;let t=j(e),n=document.documentElement,r=N(t);n.classList.remove(`dark`,`ophelia`),t.mode===`dark`&&n.classList.add(`dark`),n.style.colorScheme=t.mode,n.dataset.accent=t.accent||`blue`,n.dataset.themeStyle=t.adaptToAccent?`accent`:`default`;for(let e of u){let{r:t,g:i,b:a}=C(r[e]),o=`${t} ${i} ${a}`;n.style.setProperty(`--color-primary-${e}`,o),n.style.setProperty(`--color-accent-${e}`,o)}t.adaptToAccent?B(n,t):z(n)},H=a(`store:app-store`),U=250,W=null,G=t()(n((t,n)=>({theme:M(),themeSyncPending:!1,syncThemePreference:async i=>{if(W&&(clearTimeout(W),W=null),!(!r()&&!localStorage.getItem(`auth-token`)))try{let{preferencesApi:r}=await e(async()=>{let{preferencesApi:e}=await import(`./api-IzobHGND.js`).then(e=>e.t);return{preferencesApi:e}},__vite__mapDeps([0,1,2,3,4,5,6,7]));if(!(await r.updatePreferences({theme:i})).success){H.warn(`Failed to save theme preference to backend`);return}let a=j(n().theme),o=j(i);a.mode===o.mode&&a.adaptToAccent===o.adaptToAccent&&a.accent===o.accent&&a.customAccent===o.customAccent?t({themeSyncPending:!1}):(t({themeSyncPending:!0}),n().scheduleThemePreferenceSync())}catch(e){H.warn(`Failed to save theme preference to backend:`,e)}},scheduleThemePreferenceSync:()=>{W&&clearTimeout(W),W=setTimeout(()=>{W=null,n().syncThemePreference(j(n().theme))},U)},setTheme:e=>{let n=j(e);t(e=>({theme:n,preferences:{...e.preferences,theme:n}})),V(n)},updateTheme:e=>{let r=j(e);n().setTheme(r),t({themeSyncPending:!0}),n().scheduleThemePreferenceSync()},toggleTheme:()=>{let e=n().theme,t=e.mode===`dark`?`light`:`dark`;n().updateTheme({...e,mode:t})},sidebarOpen:!0,sidebarCompact:!1,setSidebarOpen:e=>t({sidebarOpen:e}),setSidebarCompact:e=>t({sidebarCompact:e}),toggleSidebar:()=>t(e=>({sidebarOpen:!e.sidebarOpen})),toggleSidebarCompact:()=>t(e=>({sidebarCompact:!e.sidebarCompact})),artifactPanelOpen:!1,artifactPanelArtifact:null,openArtifactPanel:e=>t({artifactPanelOpen:!0,artifactPanelArtifact:e}),closeArtifactPanel:()=>t({artifactPanelOpen:!1,artifactPanelArtifact:null}),preferences:{theme:M(),defaultModel:``,defaultProviderType:null,defaultProviderId:null,visionModel:``,visionProviderType:null,visionProviderId:null,systemMessage:``,generationOptions:{temperature:.7,top_p:.9,top_k:40,num_predict:1024},embeddingSettings:{enabled:!1,model:`nomic-embed-text`,chunkSize:1e3,chunkOverlap:200,similarityThreshold:.3},titleSettings:{autoTitle:!1,taskModel:``,taskProviderType:null,taskProviderId:null},showUsername:!1,hapticFeedbackEnabled:!1,workRemoteProviderDisclosureDismissed:!1,backgroundSettings:{enabled:!1,imageUrl:``,blurAmount:10,opacity:.6}},setPreferences:e=>{let n=e.theme?j(e.theme):null;t(t=>({...n&&{theme:n},preferences:{...t.preferences,...e,...n&&{theme:n}}})),n&&V(n)},loadPreferences:async()=>{try{let{preferencesApi:r}=await e(async()=>{let{preferencesApi:e}=await import(`./api-IzobHGND.js`).then(e=>e.t);return{preferencesApi:e}},__vite__mapDeps([0,1,2,3,4,5,6,7])),i=await r.getPreferences();if(i.success&&i.data){let e=i.data,r=n().themeSyncPending?j(n().theme):null;n().setPreferences(r?{...e,theme:r}:e),t({backgroundImage:e.backgroundSettings?.imageUrl||null}),r&&n().syncThemePreference(r)}}catch(e){H.warn(`Failed to load preferences from backend:`,e)}},isGenerating:!1,setIsGenerating:e=>t({isGenerating:e}),hasSeenSettingsNotification:!1,markSettingsNotificationAsSeen:()=>t({hasSeenSettingsNotification:!0}),isDemoMode:r(),demoConfig:i(),setDemoMode:e=>{t({isDemoMode:e,demoConfig:i()})},backgroundImage:null,setBackgroundImage:async r=>{if(t({backgroundImage:r}),r){let t=n(),i={...t.preferences,backgroundSettings:{enabled:!0,imageUrl:r,blurAmount:t.preferences.backgroundSettings?.blurAmount||10,opacity:t.preferences.backgroundSettings?.opacity||.6}};t.setPreferences(i);try{let{preferencesApi:t}=await e(async()=>{let{preferencesApi:e}=await import(`./api-IzobHGND.js`).then(e=>e.t);return{preferencesApi:e}},__vite__mapDeps([0,1,2,3,4,5,6,7]));await t.updatePreferences({backgroundSettings:i.backgroundSettings})}catch(e){H.warn(`Failed to save background settings to backend:`,e)}}},uploadBackgroundImage:async e=>{try{let t=new FileReader;return new Promise((r,i)=>{t.onload=async e=>{try{let t=e.target?.result;await n().setBackgroundImage(t),r()}catch(e){i(e)}},t.onerror=i,t.readAsDataURL(e)})}catch(e){throw H.error(`Failed to upload background image:`,e),e}},removeBackgroundImage:async()=>{t({backgroundImage:null});let r=n(),i={enabled:!1,imageUrl:``,blurAmount:r.preferences.backgroundSettings?.blurAmount||10,opacity:r.preferences.backgroundSettings?.opacity||.6};r.setPreferences({backgroundSettings:i});try{let{preferencesApi:t}=await e(async()=>{let{preferencesApi:e}=await import(`./api-IzobHGND.js`).then(e=>e.t);return{preferencesApi:e}},__vite__mapDeps([0,1,2,3,4,5,6,7]));await t.updatePreferences({backgroundSettings:i})}catch(e){H.warn(`Failed to save background removal to backend:`,e)}},clearUserState:()=>{let e=M();W&&(clearTimeout(W),W=null),t({theme:e,themeSyncPending:!1,backgroundImage:null,preferences:{theme:e,defaultModel:``,defaultProviderType:null,defaultProviderId:null,visionModel:``,visionProviderType:null,visionProviderId:null,systemMessage:``,generationOptions:{temperature:.7,top_p:.9,top_k:40,num_predict:1024},embeddingSettings:{enabled:!1,model:`nomic-embed-text`,chunkSize:1e3,chunkOverlap:200,similarityThreshold:.3},titleSettings:{autoTitle:!1,taskModel:``,taskProviderType:null,taskProviderId:null},showUsername:!1,workRemoteProviderDisclosureDismissed:!1,backgroundSettings:{enabled:!1,imageUrl:``,blurAmount:10,opacity:.6}}}),V(e)}}),{name:`libre-webui-app-state`,onRehydrateStorage:()=>e=>{e&&e.setTheme(j(e.theme))},partialize:e=>{let{backgroundSettings:t,...n}=e.preferences;return{theme:e.theme,themeSyncPending:e.themeSyncPending,sidebarOpen:e.sidebarOpen,sidebarCompact:e.sidebarCompact,preferences:n,hasSeenSettingsNotification:e.hasSeenSettingsNotification}}}));typeof window<`u`&&(()=>{let{theme:e,setTheme:t}=G.getState();t(e)})();export{P as a,c as i,l as n,j as o,s as r,G as t};