@harperfast/harper 5.2.0 → 5.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (241) hide show
  1. package/bin/copyDb.ts +21 -4
  2. package/bin/harper.ts +20 -51
  3. package/bin/help.ts +216 -0
  4. package/components/Application.ts +236 -46
  5. package/components/ApplicationScope.ts +26 -0
  6. package/components/EntryHandler.ts +410 -105
  7. package/components/RuntimeModuleTracker.ts +189 -0
  8. package/components/Scope.ts +68 -24
  9. package/components/componentLoader.ts +70 -16
  10. package/components/deployLifecycle.ts +119 -33
  11. package/components/mcp/tools/operations.ts +6 -0
  12. package/components/operations.js +4 -6
  13. package/config/configUtils.ts +12 -9
  14. package/config-root.schema.json +10 -0
  15. package/dataLayer/harperBridge/ResourceBridge.ts +26 -5
  16. package/dataLayer/hdbInfoController.ts +8 -0
  17. package/dataLayer/schemaDescribe.ts +2 -1
  18. package/dist/bin/copyDb.js +13 -2
  19. package/dist/bin/copyDb.js.map +1 -1
  20. package/dist/bin/harper.d.ts +6 -0
  21. package/dist/bin/harper.js +18 -50
  22. package/dist/bin/harper.js.map +1 -1
  23. package/dist/bin/help.d.ts +8 -0
  24. package/dist/bin/help.js +192 -0
  25. package/dist/bin/help.js.map +1 -0
  26. package/dist/components/Application.d.ts +16 -1
  27. package/dist/components/Application.js +210 -38
  28. package/dist/components/Application.js.map +1 -1
  29. package/dist/components/ApplicationScope.d.ts +7 -0
  30. package/dist/components/ApplicationScope.js +22 -0
  31. package/dist/components/ApplicationScope.js.map +1 -1
  32. package/dist/components/EntryHandler.d.ts +4 -4
  33. package/dist/components/EntryHandler.js +386 -95
  34. package/dist/components/EntryHandler.js.map +1 -1
  35. package/dist/components/RuntimeModuleTracker.d.ts +11 -0
  36. package/dist/components/RuntimeModuleTracker.js +189 -0
  37. package/dist/components/RuntimeModuleTracker.js.map +1 -0
  38. package/dist/components/Scope.d.ts +1 -0
  39. package/dist/components/Scope.js +69 -22
  40. package/dist/components/Scope.js.map +1 -1
  41. package/dist/components/componentLoader.js +69 -10
  42. package/dist/components/componentLoader.js.map +1 -1
  43. package/dist/components/deployLifecycle.d.ts +6 -2
  44. package/dist/components/deployLifecycle.js +109 -31
  45. package/dist/components/deployLifecycle.js.map +1 -1
  46. package/dist/components/mcp/tools/operations.js +6 -0
  47. package/dist/components/mcp/tools/operations.js.map +1 -1
  48. package/dist/components/operations.js +4 -6
  49. package/dist/components/operations.js.map +1 -1
  50. package/dist/config/configUtils.js +13 -9
  51. package/dist/config/configUtils.js.map +1 -1
  52. package/dist/dataLayer/harperBridge/ResourceBridge.js +12 -5
  53. package/dist/dataLayer/harperBridge/ResourceBridge.js.map +1 -1
  54. package/dist/dataLayer/hdbInfoController.js +4 -0
  55. package/dist/dataLayer/hdbInfoController.js.map +1 -1
  56. package/dist/dataLayer/schemaDescribe.js +2 -1
  57. package/dist/dataLayer/schemaDescribe.js.map +1 -1
  58. package/dist/resources/DatabaseTransaction.d.ts +55 -0
  59. package/dist/resources/DatabaseTransaction.js +282 -103
  60. package/dist/resources/DatabaseTransaction.js.map +1 -1
  61. package/dist/resources/ResourceInterface.d.ts +8 -2
  62. package/dist/resources/ResourceInterface.js.map +1 -1
  63. package/dist/resources/Resources.js +22 -4
  64. package/dist/resources/Resources.js.map +1 -1
  65. package/dist/resources/Table.d.ts +6 -5
  66. package/dist/resources/Table.js +92 -15
  67. package/dist/resources/Table.js.map +1 -1
  68. package/dist/resources/analytics/write.js +6 -6
  69. package/dist/resources/analytics/write.js.map +1 -1
  70. package/dist/resources/blob.d.ts +0 -1
  71. package/dist/resources/blob.js +15 -7
  72. package/dist/resources/blob.js.map +1 -1
  73. package/dist/resources/databases.d.ts +22 -5
  74. package/dist/resources/databases.js +118 -9
  75. package/dist/resources/databases.js.map +1 -1
  76. package/dist/resources/jsResource.d.ts +4 -26
  77. package/dist/resources/jsResource.js +5 -59
  78. package/dist/resources/jsResource.js.map +1 -1
  79. package/dist/resources/models/Models.d.ts +11 -1
  80. package/dist/resources/models/Models.js +10 -1
  81. package/dist/resources/models/Models.js.map +1 -1
  82. package/dist/resources/models/backendRegistry.d.ts +9 -0
  83. package/dist/resources/models/backendRegistry.js +10 -0
  84. package/dist/resources/models/backendRegistry.js.map +1 -1
  85. package/dist/resources/models/openaiStream.d.ts +16 -1
  86. package/dist/resources/models/openaiStream.js +113 -21
  87. package/dist/resources/models/openaiStream.js.map +1 -1
  88. package/dist/resources/models/v1/chatCompletions.d.ts +54 -0
  89. package/dist/resources/models/v1/chatCompletions.js +115 -0
  90. package/dist/resources/models/v1/chatCompletions.js.map +1 -0
  91. package/dist/resources/models/v1/embeddings.d.ts +11 -0
  92. package/dist/resources/models/v1/embeddings.js +71 -0
  93. package/dist/resources/models/v1/embeddings.js.map +1 -0
  94. package/dist/resources/models/v1/errors.d.ts +54 -0
  95. package/dist/resources/models/v1/errors.js +130 -0
  96. package/dist/resources/models/v1/errors.js.map +1 -0
  97. package/dist/resources/models/v1/index.d.ts +36 -0
  98. package/dist/resources/models/v1/index.js +75 -0
  99. package/dist/resources/models/v1/index.js.map +1 -0
  100. package/dist/resources/models/v1/models.d.ts +26 -0
  101. package/dist/resources/models/v1/models.js +44 -0
  102. package/dist/resources/models/v1/models.js.map +1 -0
  103. package/dist/resources/models/v1/translation.d.ts +133 -0
  104. package/dist/resources/models/v1/translation.js +298 -0
  105. package/dist/resources/models/v1/translation.js.map +1 -0
  106. package/dist/resources/roles.d.ts +1 -1
  107. package/dist/resources/roles.js +54 -7
  108. package/dist/resources/roles.js.map +1 -1
  109. package/dist/security/jsLoader.js +84 -33
  110. package/dist/security/jsLoader.js.map +1 -1
  111. package/dist/security/role.js +4 -0
  112. package/dist/security/role.js.map +1 -1
  113. package/dist/security/superUserGuard.d.ts +7 -0
  114. package/dist/security/superUserGuard.js +23 -0
  115. package/dist/security/superUserGuard.js.map +1 -0
  116. package/dist/security/tokenAuthentication.d.ts +0 -1
  117. package/dist/security/tokenAuthentication.js +6 -2
  118. package/dist/security/tokenAuthentication.js.map +1 -1
  119. package/dist/security/user.d.ts +6 -1
  120. package/dist/security/user.js +23 -1
  121. package/dist/security/user.js.map +1 -1
  122. package/dist/server/http.d.ts +23 -2
  123. package/dist/server/http.js +99 -12
  124. package/dist/server/http.js.map +1 -1
  125. package/dist/server/operationsServer.d.ts +0 -2
  126. package/dist/server/operationsServer.js.map +1 -1
  127. package/dist/server/serverHelpers/multipartParser.js +9 -0
  128. package/dist/server/serverHelpers/multipartParser.js.map +1 -1
  129. package/dist/server/serverHelpers/operationAuthorizationState.d.ts +2 -0
  130. package/dist/server/serverHelpers/operationAuthorizationState.js +13 -0
  131. package/dist/server/serverHelpers/operationAuthorizationState.js.map +1 -0
  132. package/dist/server/serverHelpers/registeredOperations.d.ts +3 -2
  133. package/dist/server/serverHelpers/registeredOperations.js +14 -13
  134. package/dist/server/serverHelpers/registeredOperations.js.map +1 -1
  135. package/dist/server/serverHelpers/serverHandlers.js +19 -3
  136. package/dist/server/serverHelpers/serverHandlers.js.map +1 -1
  137. package/dist/server/serverHelpers/serverUtilities.d.ts +1 -1
  138. package/dist/server/serverHelpers/serverUtilities.js +10 -7
  139. package/dist/server/serverHelpers/serverUtilities.js.map +1 -1
  140. package/dist/server/static.js +57 -18
  141. package/dist/server/static.js.map +1 -1
  142. package/dist/server/storageReclamation.d.ts +17 -0
  143. package/dist/server/storageReclamation.js +90 -6
  144. package/dist/server/storageReclamation.js.map +1 -1
  145. package/dist/server/threads/socketRouter.js +20 -0
  146. package/dist/server/threads/socketRouter.js.map +1 -1
  147. package/dist/server/threads/threadServer.js +12 -0
  148. package/dist/server/threads/threadServer.js.map +1 -1
  149. package/dist/sqlEngine/diff/differential.js +7 -3
  150. package/dist/sqlEngine/diff/differential.js.map +1 -1
  151. package/dist/sqlTranslator/index.js +6 -1
  152. package/dist/sqlTranslator/index.js.map +1 -1
  153. package/dist/upgrade/upgradePrompt.d.ts +2 -2
  154. package/dist/upgrade/upgradePrompt.js +22 -3
  155. package/dist/upgrade/upgradePrompt.js.map +1 -1
  156. package/dist/utility/errors/commonErrors.d.ts +1 -0
  157. package/dist/utility/errors/commonErrors.js +1 -0
  158. package/dist/utility/errors/commonErrors.js.map +1 -1
  159. package/dist/utility/hdbTerms.d.ts +2 -0
  160. package/dist/utility/hdbTerms.js +2 -0
  161. package/dist/utility/hdbTerms.js.map +1 -1
  162. package/dist/utility/install/installer.js +32 -0
  163. package/dist/utility/install/installer.js.map +1 -1
  164. package/dist/utility/logging/harper_logger.d.ts +7 -0
  165. package/dist/utility/logging/harper_logger.js +57 -24
  166. package/dist/utility/logging/harper_logger.js.map +1 -1
  167. package/npm-shrinkwrap.json +197 -193
  168. package/package.json +9 -7
  169. package/resources/DatabaseTransaction.ts +310 -101
  170. package/resources/ResourceInterface.ts +8 -2
  171. package/resources/Resources.ts +22 -4
  172. package/resources/Table.ts +321 -243
  173. package/resources/analytics/write.ts +22 -20
  174. package/resources/blob.ts +15 -8
  175. package/resources/databases.ts +123 -12
  176. package/resources/jsResource.ts +5 -62
  177. package/resources/models/Models.ts +14 -1
  178. package/resources/models/backendRegistry.ts +10 -0
  179. package/resources/models/openaiStream.ts +131 -19
  180. package/resources/models/v1/chatCompletions.ts +128 -0
  181. package/resources/models/v1/embeddings.ts +70 -0
  182. package/resources/models/v1/errors.ts +141 -0
  183. package/resources/models/v1/index.ts +72 -0
  184. package/resources/models/v1/models.ts +53 -0
  185. package/resources/models/v1/translation.ts +362 -0
  186. package/resources/roles.ts +67 -7
  187. package/security/jsLoader.ts +84 -30
  188. package/security/role.ts +7 -0
  189. package/security/superUserGuard.ts +20 -0
  190. package/security/tokenAuthentication.ts +6 -3
  191. package/security/user.ts +26 -1
  192. package/server/DESIGN.md +45 -34
  193. package/server/http.ts +100 -13
  194. package/server/operationsServer.ts +0 -2
  195. package/server/serverHelpers/multipartParser.ts +9 -0
  196. package/server/serverHelpers/operationAuthorizationState.ts +11 -0
  197. package/server/serverHelpers/registeredOperations.ts +19 -15
  198. package/server/serverHelpers/serverHandlers.js +20 -3
  199. package/server/serverHelpers/serverUtilities.ts +10 -7
  200. package/server/static.ts +75 -20
  201. package/server/storageReclamation.ts +104 -8
  202. package/server/threads/socketRouter.ts +20 -0
  203. package/server/threads/threadServer.js +11 -0
  204. package/sqlTranslator/index.ts +6 -1
  205. package/static/defaultConfig.yaml +2 -0
  206. package/studio/web/assets/{Chat-DoVWScmq.js → Chat-aApwhRmz.js} +2 -2
  207. package/studio/web/assets/{Chat-DoVWScmq.js.map → Chat-aApwhRmz.js.map} +1 -1
  208. package/studio/web/assets/{FloatingChat-UZ2NsUOZ.js → FloatingChat-sC0H91n9.js} +4 -4
  209. package/studio/web/assets/{FloatingChat-UZ2NsUOZ.js.map → FloatingChat-sC0H91n9.js.map} +1 -1
  210. package/studio/web/assets/{apiToken-BUI_04o7.js → apiToken-DZ8JhHOI.js} +2 -2
  211. package/studio/web/assets/{apiToken-BUI_04o7.js.map → apiToken-DZ8JhHOI.js.map} +1 -1
  212. package/studio/web/assets/{applications-D03NA7wW.js → applications-9SEVLIO5.js} +2 -2
  213. package/studio/web/assets/{applications-D03NA7wW.js.map → applications-9SEVLIO5.js.map} +1 -1
  214. package/studio/web/assets/{index-Bh_CNAHr.js → index-Dy3uDGXb.js} +6 -6
  215. package/studio/web/assets/{index-Bh_CNAHr.js.map → index-Dy3uDGXb.js.map} +1 -1
  216. package/studio/web/assets/{index.lazy-Dx3MpyDC.js → index.lazy-CN1zq4I4.js} +4 -4
  217. package/studio/web/assets/{index.lazy-Dx3MpyDC.js.map → index.lazy-CN1zq4I4.js.map} +1 -1
  218. package/studio/web/assets/{notifications-0edoFTsb.js → notifications-BFAF07xr.js} +2 -2
  219. package/studio/web/assets/{notifications-0edoFTsb.js.map → notifications-BFAF07xr.js.map} +1 -1
  220. package/studio/web/assets/{notifications-CwKhipK7.js → notifications-CKlYVvVN.js} +2 -2
  221. package/studio/web/assets/{notifications-CwKhipK7.js.map → notifications-CKlYVvVN.js.map} +1 -1
  222. package/studio/web/assets/{profile-DUfEPQtx.js → profile-A1zhEdFG.js} +2 -2
  223. package/studio/web/assets/{profile-DUfEPQtx.js.map → profile-A1zhEdFG.js.map} +1 -1
  224. package/studio/web/assets/{setComponentFile-DMPo4UjC.js → setComponentFile-SEtBt_GV.js} +2 -2
  225. package/studio/web/assets/{setComponentFile-DMPo4UjC.js.map → setComponentFile-SEtBt_GV.js.map} +1 -1
  226. package/studio/web/assets/{setup-B56Oz1_u.js → setup-BisINqdH.js} +2 -2
  227. package/studio/web/assets/{setup-B56Oz1_u.js.map → setup-BisINqdH.js.map} +1 -1
  228. package/studio/web/assets/{status-BAod7p3o.js → status-BuQoCc7l.js} +2 -2
  229. package/studio/web/assets/{status-BAod7p3o.js.map → status-BuQoCc7l.js.map} +1 -1
  230. package/studio/web/assets/{swagger-ui-react-lQrBxfwM.js → swagger-ui-react-CAi_s1PC.js} +2 -2
  231. package/studio/web/assets/{swagger-ui-react-lQrBxfwM.js.map → swagger-ui-react-CAi_s1PC.js.map} +1 -1
  232. package/studio/web/assets/{tsMode-CrHCRjTK.js → tsMode-DT74tlkM.js} +2 -2
  233. package/studio/web/assets/{tsMode-CrHCRjTK.js.map → tsMode-DT74tlkM.js.map} +1 -1
  234. package/studio/web/assets/{useEntityRestURL-DoaBMEvU.js → useEntityRestURL-CGRGc1n7.js} +2 -2
  235. package/studio/web/assets/{useEntityRestURL-DoaBMEvU.js.map → useEntityRestURL-CGRGc1n7.js.map} +1 -1
  236. package/studio/web/index.html +1 -1
  237. package/upgrade/upgradePrompt.ts +22 -3
  238. package/utility/errors/commonErrors.ts +2 -0
  239. package/utility/hdbTerms.ts +2 -0
  240. package/utility/install/installer.ts +37 -0
  241. package/utility/logging/harper_logger.ts +57 -26
@@ -1,5 +1,5 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/Chat-DoVWScmq.js","assets/rolldown-runtime-CNC7AqOf.js","assets/vendor-core-xUefYpUO.js","assets/button-oQgW4t1x.js","assets/vendor-datadog-DyjkTkvg.js","assets/vendor-react-DeL8Gtgl.js","assets/vendor-ui-Bj22lHGK.js","assets/vendor-tanstack-0SjDjtT0.js","assets/createLucideIcon-BDx8noBh.js","assets/react-CjDfh48f.js","assets/x-C3uc0qMD.js","assets/setComponentFile-DMPo4UjC.js","assets/pollUnlessForbidden-HHdQZW1N.js","assets/authStore-CNoNfv0F.js","assets/index-Bh_CNAHr.js","assets/useAuth-DvlnspkA.js","assets/card-BHplR9Xd.js","assets/select-y6NKMkG_.js","assets/setLocalStorage-CD_L8p_D.js","assets/useLocalStorage-hkNSGGg8.js","assets/getRegistrationInfo-BOLlgqXr.js","assets/textarea-DhLMZ3PA.js","assets/errorText-NpBmvk9I.js","assets/queryClient-CbA8wM7J.js","assets/editor.api-OBQnf1nL.js","assets/editor-jjEx9u7D.css","assets/tokenization-uOBOyHAS.js","assets/index-C8Mv9kHV.css","assets/useEntityRestURL-DoaBMEvU.js","assets/getAnalytics-ChWFgfXd.js","assets/Chat-B-7kW9XZ.css"])))=>i.map(i=>d[i]);
2
- import{a as e}from"./rolldown-runtime-CNC7AqOf.js";import{a as t,i as n}from"./vendor-datadog-DyjkTkvg.js";import{r}from"./vendor-react-DeL8Gtgl.js";import{a as i,c as a,i as o,l as s,n as c,o as l,r as u,s as d,t as f}from"./react-CjDfh48f.js";import{n as p}from"./setLocalStorage-CD_L8p_D.js";import{t as m}from"./useLocalStorage-hkNSGGg8.js";import{At as h,kn as g}from"./index-Bh_CNAHr.js";var _=e(t(),1);function v(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}function y(...e){return t=>{let n=!1,r=e.map(e=>{let r=v(e,t);return!n&&typeof r==`function`&&(n=!0),r});if(n)return()=>{for(let t=0;t<r.length;t++){let n=r[t];typeof n==`function`?n():v(e[t],null)}}}}function b(...e){return _.useCallback(y(...e),e)}var x=r(),S=class extends _.Component{getSnapshotBeforeUpdate(e){let t=this.props.childRef.current;if(o(t)&&e.isPresent&&!this.props.isPresent&&this.props.pop!==!1){let e=t.offsetParent,n=o(e)&&e.offsetWidth||0,r=o(e)&&e.offsetHeight||0,i=getComputedStyle(t),a=this.props.sizeRef.current;a.height=parseFloat(i.height),a.width=parseFloat(i.width),a.top=t.offsetTop,a.left=t.offsetLeft,a.right=n-a.width-a.left,a.bottom=r-a.height-a.top,a.direction=i.direction}return null}componentDidUpdate(){}render(){return this.props.children}};function C({children:e,isPresent:t,anchorX:n,anchorY:r,root:i,pop:a}){let o=(0,_.useId)(),s=(0,_.useRef)(null),c=(0,_.useRef)({width:0,height:0,top:0,left:0,right:0,bottom:0,direction:`ltr`}),{nonce:l}=(0,_.useContext)(u),d=b(s,e.props?.ref??e?.ref);return(0,_.useInsertionEffect)(()=>{let{width:e,height:u,top:d,left:f,right:p,bottom:m,direction:h}=c.current;if(t||a===!1||!s.current||!e||!u)return;let g=h===`rtl`,_=n===`left`?g?`right: ${p}`:`left: ${f}`:g?`left: ${f}`:`right: ${p}`,v=r===`bottom`?`bottom: ${m}`:`top: ${d}`;s.current.dataset.motionPopId=o;let y=document.createElement(`style`);l&&(y.nonce=l);let b=i??document.head;return b.appendChild(y),y.sheet&&y.sheet.insertRule(`
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/Chat-aApwhRmz.js","assets/rolldown-runtime-CNC7AqOf.js","assets/vendor-core-xUefYpUO.js","assets/button-oQgW4t1x.js","assets/vendor-datadog-DyjkTkvg.js","assets/vendor-react-DeL8Gtgl.js","assets/vendor-ui-Bj22lHGK.js","assets/vendor-tanstack-0SjDjtT0.js","assets/createLucideIcon-BDx8noBh.js","assets/react-CjDfh48f.js","assets/x-C3uc0qMD.js","assets/setComponentFile-SEtBt_GV.js","assets/pollUnlessForbidden-HHdQZW1N.js","assets/authStore-CNoNfv0F.js","assets/index-Dy3uDGXb.js","assets/useAuth-DvlnspkA.js","assets/card-BHplR9Xd.js","assets/select-y6NKMkG_.js","assets/setLocalStorage-CD_L8p_D.js","assets/useLocalStorage-hkNSGGg8.js","assets/getRegistrationInfo-BOLlgqXr.js","assets/textarea-DhLMZ3PA.js","assets/errorText-NpBmvk9I.js","assets/queryClient-CbA8wM7J.js","assets/editor.api-OBQnf1nL.js","assets/editor-jjEx9u7D.css","assets/tokenization-uOBOyHAS.js","assets/index-C8Mv9kHV.css","assets/useEntityRestURL-CGRGc1n7.js","assets/getAnalytics-ChWFgfXd.js","assets/Chat-B-7kW9XZ.css"])))=>i.map(i=>d[i]);
2
+ import{a as e}from"./rolldown-runtime-CNC7AqOf.js";import{a as t,i as n}from"./vendor-datadog-DyjkTkvg.js";import{r}from"./vendor-react-DeL8Gtgl.js";import{a as i,c as a,i as o,l as s,n as c,o as l,r as u,s as d,t as f}from"./react-CjDfh48f.js";import{n as p}from"./setLocalStorage-CD_L8p_D.js";import{t as m}from"./useLocalStorage-hkNSGGg8.js";import{At as h,kn as g}from"./index-Dy3uDGXb.js";var _=e(t(),1);function v(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}function y(...e){return t=>{let n=!1,r=e.map(e=>{let r=v(e,t);return!n&&typeof r==`function`&&(n=!0),r});if(n)return()=>{for(let t=0;t<r.length;t++){let n=r[t];typeof n==`function`?n():v(e[t],null)}}}}function b(...e){return _.useCallback(y(...e),e)}var x=r(),S=class extends _.Component{getSnapshotBeforeUpdate(e){let t=this.props.childRef.current;if(o(t)&&e.isPresent&&!this.props.isPresent&&this.props.pop!==!1){let e=t.offsetParent,n=o(e)&&e.offsetWidth||0,r=o(e)&&e.offsetHeight||0,i=getComputedStyle(t),a=this.props.sizeRef.current;a.height=parseFloat(i.height),a.width=parseFloat(i.width),a.top=t.offsetTop,a.left=t.offsetLeft,a.right=n-a.width-a.left,a.bottom=r-a.height-a.top,a.direction=i.direction}return null}componentDidUpdate(){}render(){return this.props.children}};function C({children:e,isPresent:t,anchorX:n,anchorY:r,root:i,pop:a}){let o=(0,_.useId)(),s=(0,_.useRef)(null),c=(0,_.useRef)({width:0,height:0,top:0,left:0,right:0,bottom:0,direction:`ltr`}),{nonce:l}=(0,_.useContext)(u),d=b(s,e.props?.ref??e?.ref);return(0,_.useInsertionEffect)(()=>{let{width:e,height:u,top:d,left:f,right:p,bottom:m,direction:h}=c.current;if(t||a===!1||!s.current||!e||!u)return;let g=h===`rtl`,_=n===`left`?g?`right: ${p}`:`left: ${f}`:g?`left: ${f}`:`right: ${p}`,v=r===`bottom`?`bottom: ${m}`:`top: ${d}`;s.current.dataset.motionPopId=o;let y=document.createElement(`style`);l&&(y.nonce=l);let b=i??document.head;return b.appendChild(y),y.sheet&&y.sheet.insertRule(`
3
3
  [data-motion-pop-id="${o}"] {
4
4
  position: absolute !important;
5
5
  width: ${e}px !important;
@@ -7,7 +7,7 @@ import{a as e}from"./rolldown-runtime-CNC7AqOf.js";import{a as t,i as n}from"./v
7
7
  ${_}px !important;
8
8
  ${v}px !important;
9
9
  }
10
- `),()=>{s.current?.removeAttribute(`data-motion-pop-id`),b.contains(y)&&b.removeChild(y)}},[t]),(0,x.jsx)(S,{isPresent:t,childRef:s,sizeRef:c,pop:a,children:a===!1?e:_.cloneElement(e,{ref:d})})}var w=({children:e,initial:t,isPresent:n,onExitComplete:r,custom:a,presenceAffectsLayout:o,mode:s,anchorX:c,anchorY:u,root:f})=>{let p=d(T),m=(0,_.useId)(),h=(0,_.useRef)(n),g=(0,_.useRef)(r);l(()=>{h.current=n,g.current=r});let v=!0,y=(0,_.useMemo)(()=>(v=!1,{id:m,initial:t,isPresent:n,custom:a,onExitComplete:e=>{p.set(e,!0);for(let e of p.values())if(!e)return;r&&r()},register:e=>(p.set(e,!1),()=>{p.delete(e),!h.current&&!p.size&&g.current?.()})}),[n,p,r]);return o&&v&&(y={...y}),(0,_.useMemo)(()=>{p.forEach((e,t)=>p.set(t,!1))},[n]),_.useEffect(()=>{!n&&!p.size&&r&&r()},[n]),e=(0,x.jsx)(C,{pop:s===`popLayout`,isPresent:n,anchorX:c,anchorY:u,root:f,children:e}),(0,x.jsx)(i.Provider,{value:y,children:e})};function T(){return new Map}var E=e=>e.key||``;function D(e){let t=[];return _.Children.forEach(e,e=>{(0,_.isValidElement)(e)&&t.push(e)}),t}var O=({children:e,custom:t,initial:n=!0,onExitComplete:r,presenceAffectsLayout:i=!0,mode:o=`sync`,propagate:s=!1,anchorX:u=`left`,anchorY:f=`top`,root:p})=>{let[m,h]=c(s),g=(0,_.useMemo)(()=>D(e),[e]),v=s&&!m?[]:g.map(E),y=(0,_.useRef)(!0),b=(0,_.useRef)(g),S=d(()=>new Map),C=(0,_.useRef)(new Set),[T,O]=(0,_.useState)(g),[k,A]=(0,_.useState)(g);l(()=>{y.current=!1,b.current=g;for(let e=0;e<k.length;e++){let t=E(k[e]);v.includes(t)?(S.delete(t),C.current.delete(t)):S.get(t)!==!0&&S.set(t,!1)}},[k,v.length,v.join(`-`)]);let j=[];if(g!==T){let e=[...g];for(let t=0;t<k.length;t++){let n=k[t],r=E(n);v.includes(r)||(e.splice(t,0,n),j.push(n))}return o===`wait`&&j.length&&(e=j),A(D(e)),O(g),null}let{forceRender:M}=(0,_.useContext)(a);return(0,x.jsx)(x.Fragment,{children:k.map(e=>{let a=E(e),c=s&&!m?!1:g===k||v.includes(a);return(0,x.jsx)(w,{isPresent:c,initial:!y.current||n?void 0:!1,custom:t,presenceAffectsLayout:i,mode:o,root:p,onExitComplete:c?void 0:()=>{if(C.current.has(a))return;if(S.has(a))C.current.add(a),S.set(a,!0);else return;let e=!0;S.forEach(t=>{t||(e=!1)}),e&&(M?.(),A(b.current),s&&h?.(),r&&r())},anchorX:u,anchorY:f,children:e},a)})})},k=(0,_.lazy)(()=>n(()=>import(`./Chat-DoVWScmq.js`).then(e=>({default:e.Chat})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30]))),A=56,j=24;function M(){let[e,t]=(0,_.useState)(!1),[n,r]=(0,_.useState)(!1),[i,a]=(0,_.useState)(!1),[o,c]=h(`ApplicationChatOpen`,!1),[l,u]=m(p.ApplicationChatPosition,{x:-40,y:-40}),[d,v]=m(p.ApplicationChatWidth,600),y=(0,_.useRef)(null);(0,_.useEffect)(()=>{let e=()=>{let e=window.innerWidth<768;t(e),!e&&d>window.innerWidth&&v(window.innerWidth)};return e(),window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[d,v]);let b=(0,_.useCallback)(e=>{e.preventDefault(),a(!0)},[]);(0,_.useEffect)(()=>{if(!i)return;let e=e=>{let t=window.innerWidth-e.clientX,n=Math.min(Math.max(t,300),window.innerWidth);v(n)},t=()=>{a(!1)};return window.addEventListener(`mousemove`,e),window.addEventListener(`mouseup`,t),()=>{window.removeEventListener(`mousemove`,e),window.removeEventListener(`mouseup`,t)}},[i,v]);let S=(0,_.useCallback)(()=>{n||c(e=>!e)},[n]),C=(0,_.useCallback)(()=>{c(!1)},[]);return(0,_.useEffect)(()=>{if(o){let e=e=>{e.key===`Escape`&&C()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)}},[o,C]),(0,x.jsxs)(`div`,{className:`fixed inset-0 pointer-events-none z-50`,ref:y,children:[(0,x.jsx)(O,{children:o&&(0,x.jsxs)(f.div,{initial:e?{opacity:0,y:`100%`}:{opacity:0,x:`100%`},animate:e?{opacity:1,y:0}:{opacity:1,x:0},exit:e?{opacity:0,y:`100%`}:{opacity:0,x:`100%`},transition:{type:`spring`,damping:25,stiffness:200},style:e?{}:{top:0,bottom:0,right:0,width:d,maxWidth:`100vw`},className:`
10
+ `),()=>{s.current?.removeAttribute(`data-motion-pop-id`),b.contains(y)&&b.removeChild(y)}},[t]),(0,x.jsx)(S,{isPresent:t,childRef:s,sizeRef:c,pop:a,children:a===!1?e:_.cloneElement(e,{ref:d})})}var w=({children:e,initial:t,isPresent:n,onExitComplete:r,custom:a,presenceAffectsLayout:o,mode:s,anchorX:c,anchorY:u,root:f})=>{let p=d(T),m=(0,_.useId)(),h=(0,_.useRef)(n),g=(0,_.useRef)(r);l(()=>{h.current=n,g.current=r});let v=!0,y=(0,_.useMemo)(()=>(v=!1,{id:m,initial:t,isPresent:n,custom:a,onExitComplete:e=>{p.set(e,!0);for(let e of p.values())if(!e)return;r&&r()},register:e=>(p.set(e,!1),()=>{p.delete(e),!h.current&&!p.size&&g.current?.()})}),[n,p,r]);return o&&v&&(y={...y}),(0,_.useMemo)(()=>{p.forEach((e,t)=>p.set(t,!1))},[n]),_.useEffect(()=>{!n&&!p.size&&r&&r()},[n]),e=(0,x.jsx)(C,{pop:s===`popLayout`,isPresent:n,anchorX:c,anchorY:u,root:f,children:e}),(0,x.jsx)(i.Provider,{value:y,children:e})};function T(){return new Map}var E=e=>e.key||``;function D(e){let t=[];return _.Children.forEach(e,e=>{(0,_.isValidElement)(e)&&t.push(e)}),t}var O=({children:e,custom:t,initial:n=!0,onExitComplete:r,presenceAffectsLayout:i=!0,mode:o=`sync`,propagate:s=!1,anchorX:u=`left`,anchorY:f=`top`,root:p})=>{let[m,h]=c(s),g=(0,_.useMemo)(()=>D(e),[e]),v=s&&!m?[]:g.map(E),y=(0,_.useRef)(!0),b=(0,_.useRef)(g),S=d(()=>new Map),C=(0,_.useRef)(new Set),[T,O]=(0,_.useState)(g),[k,A]=(0,_.useState)(g);l(()=>{y.current=!1,b.current=g;for(let e=0;e<k.length;e++){let t=E(k[e]);v.includes(t)?(S.delete(t),C.current.delete(t)):S.get(t)!==!0&&S.set(t,!1)}},[k,v.length,v.join(`-`)]);let j=[];if(g!==T){let e=[...g];for(let t=0;t<k.length;t++){let n=k[t],r=E(n);v.includes(r)||(e.splice(t,0,n),j.push(n))}return o===`wait`&&j.length&&(e=j),A(D(e)),O(g),null}let{forceRender:M}=(0,_.useContext)(a);return(0,x.jsx)(x.Fragment,{children:k.map(e=>{let a=E(e),c=s&&!m?!1:g===k||v.includes(a);return(0,x.jsx)(w,{isPresent:c,initial:!y.current||n?void 0:!1,custom:t,presenceAffectsLayout:i,mode:o,root:p,onExitComplete:c?void 0:()=>{if(C.current.has(a))return;if(S.has(a))C.current.add(a),S.set(a,!0);else return;let e=!0;S.forEach(t=>{t||(e=!1)}),e&&(M?.(),A(b.current),s&&h?.(),r&&r())},anchorX:u,anchorY:f,children:e},a)})})},k=(0,_.lazy)(()=>n(()=>import(`./Chat-aApwhRmz.js`).then(e=>({default:e.Chat})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30]))),A=56,j=24;function M(){let[e,t]=(0,_.useState)(!1),[n,r]=(0,_.useState)(!1),[i,a]=(0,_.useState)(!1),[o,c]=h(`ApplicationChatOpen`,!1),[l,u]=m(p.ApplicationChatPosition,{x:-40,y:-40}),[d,v]=m(p.ApplicationChatWidth,600),y=(0,_.useRef)(null);(0,_.useEffect)(()=>{let e=()=>{let e=window.innerWidth<768;t(e),!e&&d>window.innerWidth&&v(window.innerWidth)};return e(),window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[d,v]);let b=(0,_.useCallback)(e=>{e.preventDefault(),a(!0)},[]);(0,_.useEffect)(()=>{if(!i)return;let e=e=>{let t=window.innerWidth-e.clientX,n=Math.min(Math.max(t,300),window.innerWidth);v(n)},t=()=>{a(!1)};return window.addEventListener(`mousemove`,e),window.addEventListener(`mouseup`,t),()=>{window.removeEventListener(`mousemove`,e),window.removeEventListener(`mouseup`,t)}},[i,v]);let S=(0,_.useCallback)(()=>{n||c(e=>!e)},[n]),C=(0,_.useCallback)(()=>{c(!1)},[]);return(0,_.useEffect)(()=>{if(o){let e=e=>{e.key===`Escape`&&C()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)}},[o,C]),(0,x.jsxs)(`div`,{className:`fixed inset-0 pointer-events-none z-50`,ref:y,children:[(0,x.jsx)(O,{children:o&&(0,x.jsxs)(f.div,{initial:e?{opacity:0,y:`100%`}:{opacity:0,x:`100%`},animate:e?{opacity:1,y:0}:{opacity:1,x:0},exit:e?{opacity:0,y:`100%`}:{opacity:0,x:`100%`},transition:{type:`spring`,damping:25,stiffness:200},style:e?{}:{top:0,bottom:0,right:0,width:d,maxWidth:`100vw`},className:`
11
11
  pointer-events-auto
12
12
  fixed bg-background shadow-2xl border-l border-border overflow-visible
13
13
  ${e?`inset-0 w-full h-full rounded-none`:`h-full`}
@@ -21,4 +21,4 @@ import{a as e}from"./rolldown-runtime-CNC7AqOf.js";import{a as t,i as n}from"./v
21
21
  text-primary-foreground shadow-lg flex items-center justify-center cursor-pointer
22
22
  hover:bg-primary/90 transition-colors
23
23
  `,children:(0,x.jsx)(s,{size:28})})]})}export{M as FloatingChat};
24
- //# sourceMappingURL=FloatingChat-UZ2NsUOZ.js.map
24
+ //# sourceMappingURL=FloatingChat-sC0H91n9.js.map
@@ -1 +1 @@
1
- {"version":3,"mappings":";yZASA,SAAS,EAAO,EAAK,EAAO,CACxB,GAAI,OAAO,GAAQ,WACf,OAAO,EAAI,CAAK,EAEX,GAAQ,OACb,EAAI,QAAU,EAEtB,CAKA,SAAS,EAAY,GAAG,EAAM,CAC1B,MAAQ,IAAS,CACb,IAAI,EAAa,GACX,EAAW,EAAK,IAAK,GAAQ,CAC/B,IAAM,EAAU,EAAO,EAAK,CAAI,EAIhC,MAHI,CAAC,GAAc,OAAO,GAAY,aAClC,EAAa,IAEV,CACX,CAAC,EAKD,GAAI,EACA,UAAa,CACT,IAAK,IAAI,EAAI,EAAG,EAAI,EAAS,OAAQ,IAAK,CACtC,IAAM,EAAU,EAAS,GACrB,OAAO,GAAY,WACnB,EAAQ,EAGR,EAAO,EAAK,GAAI,IAAI,CAE5B,CACJ,CAER,CACJ,CAKA,SAAS,EAAgB,GAAG,EAAM,CAE9B,SAAa,YAAY,EAAY,GAAG,CAAI,EAAG,CAAI,CACvD,WC7CM,EAAN,gBAAoC,SAAU,CAC1C,wBAAwB,EAAW,CAC/B,IAAM,EAAU,KAAK,MAAM,SAAS,QACpC,GAAI,EAAc,CAAO,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,EAAI,CAEpB,EAmGI,WAjGmB,EAAa,IAAc,CAOjD,GAJA,eAAiB,CAChB,EAAc,EAAK,CACpB,EAAG,GAAG,EAEF,EAAY,OAEhB,GAAM,CAAE,aAAY,eAAgB,OAI9B,EAAO,EAAS,EAAI,EAAK,OAAO,EAChC,EAAO,EAAS,EAAI,EAAK,OAAO,EAIhC,EAAW,EAAK,MAAM,EACtB,EAAY,EAAa,EAAK,MAAM,EACpC,EAAU,EAAK,MAAM,EACrB,EAAa,EAAc,EAAK,MAAM,EAExC,EAAQ,EACR,EAAQ,EAGR,EAAW,IAEd,EAAQ,EAAE,EAAa,EAAc,EAAU,GACrC,EAAY,MAEtB,EAAQ,GAGL,EAAU,IAEb,EAAQ,EAAE,EAAc,EAAc,EAAU,GACtC,EAAa,MAEvB,EAAQ,GAGT,EAAY,CACX,EAAG,EACH,EAAG,CACJ,CAAC,CACF,EAmDI,QAAS,CAAE,EAAG,EAAS,EAAG,EAAG,EAAS,CAAE,EACxC,WAAY,CAAE,MAAO,GAAI,EACzB,SAAU,CAAE,MAAO,EAAI,EACvB,QAAS,EACT,MAAO,CACN,OAAQ,EACR,MAAO,CACR,EACA,UAAU;;;;;iBAOV,SAAC,EAAD,CAAK,KAAM,EAAK,EACF,EAEZ,GAEP","names":["Fragment"],"ignoreList":[0,1,2,3,4],"sources":["../../node_modules/.pnpm/framer-motion@12.42.2_react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/framer-motion/dist/es/utils/use-composed-ref.mjs","../../node_modules/.pnpm/framer-motion@12.42.2_react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/framer-motion/dist/es/components/AnimatePresence/PopChild.mjs","../../node_modules/.pnpm/framer-motion@12.42.2_react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/framer-motion/dist/es/components/AnimatePresence/PresenceChild.mjs","../../node_modules/.pnpm/framer-motion@12.42.2_react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/framer-motion/dist/es/components/AnimatePresence/utils.mjs","../../node_modules/.pnpm/framer-motion@12.42.2_react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/framer-motion/dist/es/components/AnimatePresence/index.mjs","../../src/features/instance/applications/components/Chat/FloatingChat.tsx"],"sourcesContent":["import * as React from 'react';\n\n/**\n * Taken from https://github.com/radix-ui/primitives/blob/main/packages/react/compose-refs/src/compose-refs.tsx\n */\n/**\n * Set a given ref to a given value\n * This utility takes care of different types of refs: callback refs and RefObject(s)\n */\nfunction setRef(ref, value) {\n if (typeof ref === \"function\") {\n return ref(value);\n }\n else if (ref !== null && ref !== undefined) {\n ref.current = value;\n }\n}\n/**\n * A utility to compose multiple refs together\n * Accepts callback refs and RefObject(s)\n */\nfunction composeRefs(...refs) {\n return (node) => {\n let hasCleanup = false;\n const cleanups = refs.map((ref) => {\n const cleanup = setRef(ref, node);\n if (!hasCleanup && typeof cleanup === \"function\") {\n hasCleanup = true;\n }\n return cleanup;\n });\n // React <19 will log an error to the console if a callback ref returns a\n // value. We don't use ref cleanups internally so this will only happen if a\n // user's ref callback returns a value, which we only expect if they are\n // using the cleanup functionality added in React 19.\n if (hasCleanup) {\n return () => {\n for (let i = 0; i < cleanups.length; i++) {\n const cleanup = cleanups[i];\n if (typeof cleanup === \"function\") {\n cleanup();\n }\n else {\n setRef(refs[i], null);\n }\n }\n };\n }\n };\n}\n/**\n * A custom hook that composes multiple refs\n * Accepts callback refs and RefObject(s)\n */\nfunction useComposedRefs(...refs) {\n // eslint-disable-next-line react-hooks/exhaustive-deps\n return React.useCallback(composeRefs(...refs), refs);\n}\n\nexport { useComposedRefs };\n//# sourceMappingURL=use-composed-ref.mjs.map\n","\"use client\";\nimport { jsx } from 'react/jsx-runtime';\nimport { isHTMLElement } from 'motion-dom';\nimport * as React from 'react';\nimport { useId, useRef, useContext, useInsertionEffect } from 'react';\nimport { MotionConfigContext } from '../../context/MotionConfigContext.mjs';\nimport { useComposedRefs } from '../../utils/use-composed-ref.mjs';\n\n/**\n * Measurement functionality has to be within a separate component\n * to leverage snapshot lifecycle.\n */\nclass PopChildMeasure extends React.Component {\n getSnapshotBeforeUpdate(prevProps) {\n const element = this.props.childRef.current;\n if (isHTMLElement(element) && prevProps.isPresent && !this.props.isPresent && this.props.pop !== false) {\n const parent = element.offsetParent;\n const parentWidth = isHTMLElement(parent)\n ? parent.offsetWidth || 0\n : 0;\n const parentHeight = isHTMLElement(parent)\n ? parent.offsetHeight || 0\n : 0;\n const computedStyle = getComputedStyle(element);\n const size = this.props.sizeRef.current;\n size.height = parseFloat(computedStyle.height);\n size.width = parseFloat(computedStyle.width);\n size.top = element.offsetTop;\n size.left = element.offsetLeft;\n size.right = parentWidth - size.width - size.left;\n size.bottom = parentHeight - size.height - size.top;\n size.direction = computedStyle.direction;\n }\n return null;\n }\n /**\n * Required with getSnapshotBeforeUpdate to stop React complaining.\n */\n componentDidUpdate() { }\n render() {\n return this.props.children;\n }\n}\nfunction PopChild({ children, isPresent, anchorX, anchorY, root, pop }) {\n const id = useId();\n const ref = useRef(null);\n const size = useRef({\n width: 0,\n height: 0,\n top: 0,\n left: 0,\n right: 0,\n bottom: 0,\n direction: \"ltr\",\n });\n const { nonce } = useContext(MotionConfigContext);\n /**\n * In React 19, refs are passed via props.ref instead of element.ref.\n * We check props.ref first (React 19) and fall back to element.ref (React 18).\n */\n const childRef = children.props?.ref ??\n children?.ref;\n const composedRef = useComposedRefs(ref, childRef);\n /**\n * We create and inject a style block so we can apply this explicit\n * sizing in a non-destructive manner by just deleting the style block.\n *\n * We can't apply size via render as the measurement happens\n * in getSnapshotBeforeUpdate (post-render), likewise if we apply the\n * styles directly on the DOM node, we might be overwriting\n * styles set via the style prop.\n */\n useInsertionEffect(() => {\n const { width, height, top, left, right, bottom, direction } = size.current;\n if (isPresent || pop === false || !ref.current || !width || !height)\n return;\n const isRTL = direction === \"rtl\";\n const x = anchorX === \"left\"\n ? (isRTL ? `right: ${right}` : `left: ${left}`)\n : (isRTL ? `left: ${left}` : `right: ${right}`);\n const y = anchorY === \"bottom\" ? `bottom: ${bottom}` : `top: ${top}`;\n ref.current.dataset.motionPopId = id;\n const style = document.createElement(\"style\");\n if (nonce)\n style.nonce = nonce;\n const parent = root ?? document.head;\n parent.appendChild(style);\n if (style.sheet) {\n style.sheet.insertRule(`\n [data-motion-pop-id=\"${id}\"] {\n position: absolute !important;\n width: ${width}px !important;\n height: ${height}px !important;\n ${x}px !important;\n ${y}px !important;\n }\n `);\n }\n return () => {\n ref.current?.removeAttribute(\"data-motion-pop-id\");\n if (parent.contains(style)) {\n parent.removeChild(style);\n }\n };\n }, [isPresent]);\n return (jsx(PopChildMeasure, { isPresent: isPresent, childRef: ref, sizeRef: size, pop: pop, children: pop === false\n ? children\n : React.cloneElement(children, { ref: composedRef }) }));\n}\n\nexport { PopChild };\n//# sourceMappingURL=PopChild.mjs.map\n","\"use client\";\nimport { jsx } from 'react/jsx-runtime';\nimport * as React from 'react';\nimport { useId, useRef, useMemo } from 'react';\nimport { PresenceContext } from '../../context/PresenceContext.mjs';\nimport { useConstant } from '../../utils/use-constant.mjs';\nimport { useIsomorphicLayoutEffect } from '../../utils/use-isomorphic-effect.mjs';\nimport { PopChild } from './PopChild.mjs';\n\nconst PresenceChild = ({ children, initial, isPresent, onExitComplete, custom, presenceAffectsLayout, mode, anchorX, anchorY, root }) => {\n const presenceChildren = useConstant(newChildrenMap);\n const id = useId();\n // Written in a layout effect (not render) so discarded concurrent\n // renders can't leave the refs pointing at uncommitted state.\n const isPresentRef = useRef(isPresent);\n const onExitCompleteRef = useRef(onExitComplete);\n useIsomorphicLayoutEffect(() => {\n isPresentRef.current = isPresent;\n onExitCompleteRef.current = onExitComplete;\n });\n let isReusedContext = true;\n let context = useMemo(() => {\n isReusedContext = false;\n return {\n id,\n initial,\n isPresent,\n custom,\n onExitComplete: (childId) => {\n presenceChildren.set(childId, true);\n for (const isComplete of presenceChildren.values()) {\n if (!isComplete)\n return; // can stop searching when any is incomplete\n }\n onExitComplete && onExitComplete();\n },\n register: (childId) => {\n presenceChildren.set(childId, false);\n return () => {\n presenceChildren.delete(childId);\n !isPresentRef.current &&\n !presenceChildren.size &&\n onExitCompleteRef.current?.();\n };\n },\n };\n }, [isPresent, presenceChildren, onExitComplete]);\n /**\n * If the presence of a child affects the layout of the components around it,\n * we want to make a new context value to ensure they get re-rendered\n * so they can detect that layout change.\n */\n if (presenceAffectsLayout && isReusedContext) {\n context = { ...context };\n }\n useMemo(() => {\n presenceChildren.forEach((_, key) => presenceChildren.set(key, false));\n }, [isPresent]);\n /**\n * If there's no `motion` components to fire exit animations, we want to remove this\n * component immediately.\n */\n React.useEffect(() => {\n !isPresent &&\n !presenceChildren.size &&\n onExitComplete &&\n onExitComplete();\n }, [isPresent]);\n children = (jsx(PopChild, { pop: mode === \"popLayout\", isPresent: isPresent, anchorX: anchorX, anchorY: anchorY, root: root, children: children }));\n return (jsx(PresenceContext.Provider, { value: context, children: children }));\n};\nfunction newChildrenMap() {\n return new Map();\n}\n\nexport { PresenceChild };\n//# sourceMappingURL=PresenceChild.mjs.map\n","import { Children, isValidElement } from 'react';\n\nconst getChildKey = (child) => child.key || \"\";\nfunction onlyElements(children) {\n const filtered = [];\n // We use forEach here instead of map as map mutates the component key by preprending `.$`\n Children.forEach(children, (child) => {\n if (isValidElement(child))\n filtered.push(child);\n });\n return filtered;\n}\n\nexport { getChildKey, onlyElements };\n//# sourceMappingURL=utils.mjs.map\n","\"use client\";\nimport { jsx, Fragment } from 'react/jsx-runtime';\nimport { useMemo, useRef, useState, useContext } from 'react';\nimport { LayoutGroupContext } from '../../context/LayoutGroupContext.mjs';\nimport { useConstant } from '../../utils/use-constant.mjs';\nimport { useIsomorphicLayoutEffect } from '../../utils/use-isomorphic-effect.mjs';\nimport { PresenceChild } from './PresenceChild.mjs';\nimport { usePresence } from './use-presence.mjs';\nimport { onlyElements, getChildKey } from './utils.mjs';\n\n/**\n * `AnimatePresence` enables the animation of components that have been removed from the tree.\n *\n * When adding/removing more than a single child, every child **must** be given a unique `key` prop.\n *\n * Any `motion` components that have an `exit` property defined will animate out when removed from\n * the tree.\n *\n * ```jsx\n * import { motion, AnimatePresence } from 'framer-motion'\n *\n * export const Items = ({ items }) => (\n * <AnimatePresence>\n * {items.map(item => (\n * <motion.div\n * key={item.id}\n * initial={{ opacity: 0 }}\n * animate={{ opacity: 1 }}\n * exit={{ opacity: 0 }}\n * />\n * ))}\n * </AnimatePresence>\n * )\n * ```\n *\n * You can sequence exit animations throughout a tree using variants.\n *\n * If a child contains multiple `motion` components with `exit` props, it will only unmount the child\n * once all `motion` components have finished animating out. Likewise, any components using\n * `usePresence` all need to call `safeToRemove`.\n *\n * @public\n */\nconst AnimatePresence = ({ children, custom, initial = true, onExitComplete, presenceAffectsLayout = true, mode = \"sync\", propagate = false, anchorX = \"left\", anchorY = \"top\", root }) => {\n const [isParentPresent, safeToRemove] = usePresence(propagate);\n /**\n * Filter any children that aren't ReactElements. We can only track components\n * between renders with a props.key.\n */\n const presentChildren = useMemo(() => onlyElements(children), [children]);\n /**\n * Track the keys of the currently rendered children. This is used to\n * determine which children are exiting.\n */\n const presentKeys = propagate && !isParentPresent ? [] : presentChildren.map(getChildKey);\n /**\n * If `initial={false}` we only want to pass this to components in the first render.\n */\n const isInitialRender = useRef(true);\n /**\n * A ref containing the currently present children. When all exit animations\n * are complete, we use this to re-render the component with the latest children\n * *committed* rather than the latest children *rendered*.\n */\n const pendingPresentChildren = useRef(presentChildren);\n /**\n * Track which exiting children have finished animating out.\n */\n const exitComplete = useConstant(() => new Map());\n /**\n * Track which components are currently processing exit to prevent duplicate processing.\n */\n const exitingComponents = useRef(new Set());\n /**\n * Save children to render as React state. To ensure this component is concurrent-safe,\n * we check for exiting children via an effect.\n */\n const [diffedChildren, setDiffedChildren] = useState(presentChildren);\n const [renderedChildren, setRenderedChildren] = useState(presentChildren);\n useIsomorphicLayoutEffect(() => {\n isInitialRender.current = false;\n pendingPresentChildren.current = presentChildren;\n /**\n * Update complete status of exiting children.\n */\n for (let i = 0; i < renderedChildren.length; i++) {\n const key = getChildKey(renderedChildren[i]);\n if (!presentKeys.includes(key)) {\n if (exitComplete.get(key) !== true) {\n exitComplete.set(key, false);\n }\n }\n else {\n exitComplete.delete(key);\n exitingComponents.current.delete(key);\n }\n }\n }, [renderedChildren, presentKeys.length, presentKeys.join(\"-\")]);\n const exitingChildren = [];\n if (presentChildren !== diffedChildren) {\n let nextChildren = [...presentChildren];\n /**\n * Loop through all the currently rendered components and decide which\n * are exiting.\n */\n for (let i = 0; i < renderedChildren.length; i++) {\n const child = renderedChildren[i];\n const key = getChildKey(child);\n if (!presentKeys.includes(key)) {\n nextChildren.splice(i, 0, child);\n exitingChildren.push(child);\n }\n }\n /**\n * If we're in \"wait\" mode, and we have exiting children, we want to\n * only render these until they've all exited.\n */\n if (mode === \"wait\" && exitingChildren.length) {\n nextChildren = exitingChildren;\n }\n setRenderedChildren(onlyElements(nextChildren));\n setDiffedChildren(presentChildren);\n /**\n * Early return to ensure once we've set state with the latest diffed\n * children, we can immediately re-render.\n */\n return null;\n }\n if (process.env.NODE_ENV !== \"production\" &&\n mode === \"wait\" &&\n renderedChildren.length > 1) {\n console.warn(`You're attempting to animate multiple children within AnimatePresence, but its mode is set to \"wait\". This will lead to odd visual behaviour.`);\n }\n /**\n * If we've been provided a forceRender function by the LayoutGroupContext,\n * we can use it to force a re-render amongst all surrounding components once\n * all components have finished animating out.\n */\n const { forceRender } = useContext(LayoutGroupContext);\n return (jsx(Fragment, { children: renderedChildren.map((child) => {\n const key = getChildKey(child);\n const isPresent = propagate && !isParentPresent\n ? false\n : presentChildren === renderedChildren ||\n presentKeys.includes(key);\n const onExit = () => {\n if (exitingComponents.current.has(key)) {\n return;\n }\n if (exitComplete.has(key)) {\n exitingComponents.current.add(key);\n exitComplete.set(key, true);\n }\n else {\n return;\n }\n let isEveryExitComplete = true;\n exitComplete.forEach((isExitComplete) => {\n if (!isExitComplete)\n isEveryExitComplete = false;\n });\n if (isEveryExitComplete) {\n forceRender?.();\n setRenderedChildren(pendingPresentChildren.current);\n propagate && safeToRemove?.();\n onExitComplete && onExitComplete();\n }\n };\n return (jsx(PresenceChild, { isPresent: isPresent, initial: !isInitialRender.current || initial\n ? undefined\n : false, custom: custom, presenceAffectsLayout: presenceAffectsLayout, mode: mode, root: root, onExitComplete: isPresent ? undefined : onExit, anchorX: anchorX, anchorY: anchorY, children: child }, key));\n }) }));\n};\n\nexport { AnimatePresence };\n//# sourceMappingURL=index.mjs.map\n","import { Loading } from '@/components/Loading';\nimport { useLocalStorage } from '@/hooks/useLocalStorage';\nimport { useSessionStorage } from '@/hooks/useSessionStorage';\nimport { LocalStorageKeys } from '@/lib/storage/localStorageKeys';\nimport { Bot } from 'lucide-react';\nimport { AnimatePresence, motion } from 'motion/react';\nimport { lazy, Suspense, useCallback, useEffect, useRef, useState } from 'react';\n\n// Second-tier lazy load: this file (the floating bubble) loads when you land on\n// an instance, but the chat pane — and its heavy dependencies (the AI SDK, the\n// chat tools, the markdown message renderer) — only loads the first time the\n// bubble is opened.\nconst Chat = lazy(() => import('./index').then((m) => ({ default: m.Chat })));\n\nconst BUBBLE_SIZE = 56;\nconst PADDING = 24;\n\nexport function FloatingChat() {\n\tconst [isMobile, setIsMobile] = useState(false);\n\tconst [isDragging, setIsDragging] = useState(false);\n\tconst [isResizing, setIsResizing] = useState(false);\n\tconst [isOpen, setIsOpen] = useSessionStorage('ApplicationChatOpen', false);\n\tconst [position, setPosition] = useLocalStorage(LocalStorageKeys.ApplicationChatPosition, { x: -40, y: -40 });\n\tconst [width, setWidth] = useLocalStorage(LocalStorageKeys.ApplicationChatWidth, 600);\n\tconst containerRef = useRef<HTMLDivElement>(null);\n\n\tuseEffect(() => {\n\t\tconst checkMobile = () => {\n\t\t\tconst mobile = window.innerWidth < 768;\n\t\t\tsetIsMobile(mobile);\n\t\t\tif (!mobile && width > window.innerWidth) {\n\t\t\t\tsetWidth(window.innerWidth);\n\t\t\t}\n\t\t};\n\t\tcheckMobile();\n\t\twindow.addEventListener('resize', checkMobile);\n\t\treturn () => window.removeEventListener('resize', checkMobile);\n\t}, [width, setWidth]);\n\n\tconst handleResizeStart = useCallback((e: React.MouseEvent) => {\n\t\te.preventDefault();\n\t\tsetIsResizing(true);\n\t}, []);\n\n\tuseEffect(() => {\n\t\tif (!isResizing) { return; }\n\n\t\tconst handleMouseMove = (e: MouseEvent) => {\n\t\t\tconst newWidth = window.innerWidth - e.clientX;\n\t\t\tconst clampedWidth = Math.min(Math.max(newWidth, 300), window.innerWidth);\n\t\t\tsetWidth(clampedWidth);\n\t\t};\n\n\t\tconst handleMouseUp = () => {\n\t\t\tsetIsResizing(false);\n\t\t};\n\n\t\twindow.addEventListener('mousemove', handleMouseMove);\n\t\twindow.addEventListener('mouseup', handleMouseUp);\n\t\treturn () => {\n\t\t\twindow.removeEventListener('mousemove', handleMouseMove);\n\t\t\twindow.removeEventListener('mouseup', handleMouseUp);\n\t\t};\n\t}, [isResizing, setWidth]);\n\n\tconst toggleChat = useCallback(() => {\n\t\tif (isDragging) { return; }\n\t\tsetIsOpen(prev => !prev);\n\t}, [isDragging]);\n\n\tconst closeChat = useCallback(() => {\n\t\tsetIsOpen(false);\n\t}, []);\n\n\tuseEffect(() => {\n\t\tif (isOpen) {\n\t\t\tconst handleEscape = (e: KeyboardEvent) => {\n\t\t\t\tif (e.key === 'Escape') {\n\t\t\t\t\tcloseChat();\n\t\t\t\t}\n\t\t\t};\n\t\t\twindow.addEventListener('keydown', handleEscape);\n\t\t\treturn () => window.removeEventListener('keydown', handleEscape);\n\t\t}\n\t}, [isOpen, closeChat]);\n\n\tconst handleDragStart = () => {\n\t\tsetIsDragging(false);\n\t};\n\n\tconst handleDrag = (_event: any, info: any) => {\n\t\t// If the user has moved the pointer more than 5px, consider it a drag\n\t\tif (Math.abs(info.offset.x) > 5 || Math.abs(info.offset.y) > 5) {\n\t\t\tsetIsDragging(true);\n\t\t}\n\t};\n\n\tconst handleDragEnd = (_event: any, info: any) => {\n\t\t// Small delay to ensure the click handler (which fires after dragEnd)\n\t\t// can still see the isDragging = true state.\n\t\tsetTimeout(() => {\n\t\t\tsetIsDragging(false);\n\t\t}, 100);\n\n\t\tif (isMobile) { return; }\n\n\t\tconst { innerWidth, innerHeight } = window;\n\n\t\t// Calculate new offsets based on where we started and how far we dragged.\n\t\t// x and y in position are offsets from the initial bottom-right (PADDING, PADDING)\n\t\tconst newX = position.x + info.offset.x;\n\t\tconst newY = position.y + info.offset.y;\n\n\t\t// We still want snapping if it's close to the screen edge.\n\t\t// info.point is absolute screen coordinates of the pointer.\n\t\tconst distLeft = info.point.x;\n\t\tconst distRight = innerWidth - info.point.x;\n\t\tconst distTop = info.point.y;\n\t\tconst distBottom = innerHeight - info.point.y;\n\n\t\tlet snapX = newX;\n\t\tlet snapY = newY;\n\n\t\tconst threshold = 100;\n\t\tif (distLeft < threshold) {\n\t\t\t// Snap to left: x offset should be -(innerWidth - BUBBLE_SIZE - PADDING * 2)\n\t\t\tsnapX = -(innerWidth - BUBBLE_SIZE - PADDING * 2);\n\t\t} else if (distRight < threshold) {\n\t\t\t// Snap to right: x offset should be 0\n\t\t\tsnapX = 0;\n\t\t}\n\n\t\tif (distTop < threshold) {\n\t\t\t// Snap to top: y offset should be -(innerHeight - BUBBLE_SIZE - PADDING * 2)\n\t\t\tsnapY = -(innerHeight - BUBBLE_SIZE - PADDING * 2);\n\t\t} else if (distBottom < threshold) {\n\t\t\t// Snap to bottom: y offset should be 0\n\t\t\tsnapY = 0;\n\t\t}\n\n\t\tsetPosition({\n\t\t\tx: snapX,\n\t\t\ty: snapY,\n\t\t});\n\t};\n\n\treturn (\n\t\t<div className=\"fixed inset-0 pointer-events-none z-50\" ref={containerRef}>\n\t\t\t<AnimatePresence>\n\t\t\t\t{isOpen && (\n\t\t\t\t\t<motion.div\n\t\t\t\t\t\tinitial={isMobile ? { opacity: 0, y: '100%' } : { opacity: 0, x: '100%' }}\n\t\t\t\t\t\tanimate={isMobile ? { opacity: 1, y: 0 } : { opacity: 1, x: 0 }}\n\t\t\t\t\t\texit={isMobile ? { opacity: 0, y: '100%' } : { opacity: 0, x: '100%' }}\n\t\t\t\t\t\ttransition={{ type: 'spring', damping: 25, stiffness: 200 }}\n\t\t\t\t\t\tstyle={!isMobile\n\t\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\ttop: 0,\n\t\t\t\t\t\t\t\tbottom: 0,\n\t\t\t\t\t\t\t\tright: 0,\n\t\t\t\t\t\t\t\twidth,\n\t\t\t\t\t\t\t\tmaxWidth: '100vw',\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t: {}}\n\t\t\t\t\t\tclassName={`\n\t\t\t\t\t\t\tpointer-events-auto\n\t\t\t\t\t\t\tfixed bg-background shadow-2xl border-l border-border overflow-visible\n\t\t\t\t\t\t\t${isMobile ? 'inset-0 w-full h-full rounded-none' : 'h-full'}\n\t\t\t\t\t\t`}\n\t\t\t\t\t>\n\t\t\t\t\t\t{!isMobile && (\n\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\tonMouseDown={handleResizeStart}\n\t\t\t\t\t\t\t\tclassName={`\n\t\t\t\t\t\t\t\t\tabsolute left-0 top-0 bottom-0 w-1 cursor-ew-resize\n\t\t\t\t\t\t\t\t\thover:bg-primary transition-colors z-50\n\t\t\t\t\t\t\t\t\t${isResizing ? 'bg-primary' : ''}\n\t\t\t\t\t\t\t\t`}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t)}\n\t\t\t\t\t\t<Suspense fallback={<Loading centered text=\"Loading chat…\" />}>\n\t\t\t\t\t\t\t<Chat autoFocus closeChat={closeChat} />\n\t\t\t\t\t\t</Suspense>\n\t\t\t\t\t</motion.div>\n\t\t\t\t)}\n\t\t\t</AnimatePresence>\n\n\t\t\t{!isOpen && (\n\t\t\t\t<motion.button\n\t\t\t\t\tdrag\n\t\t\t\t\tdragMomentum={false}\n\t\t\t\t\tdragConstraints={containerRef}\n\t\t\t\t\tonDragStart={handleDragStart}\n\t\t\t\t\tonDrag={handleDrag}\n\t\t\t\t\tonDragEnd={handleDragEnd}\n\t\t\t\t\tinitial={{ x: position.x, y: position.y }}\n\t\t\t\t\twhileHover={{ scale: 1.1 }}\n\t\t\t\t\twhileTap={{ scale: 0.9 }}\n\t\t\t\t\tonClick={toggleChat}\n\t\t\t\t\tstyle={{\n\t\t\t\t\t\tbottom: PADDING,\n\t\t\t\t\t\tright: PADDING,\n\t\t\t\t\t}}\n\t\t\t\t\tclassName=\"\n\t\t\t\t\t\tpointer-events-auto\n\t\t\t\t\t\tfixed w-14 h-14 rounded-full bg-primary\n\t\t\t\t\t\ttext-primary-foreground shadow-lg flex items-center justify-center cursor-pointer\n\t\t\t\t\t\thover:bg-primary/90 transition-colors\n\t\t\t\t\t\"\n\t\t\t\t>\n\t\t\t\t\t<Bot size={28} />\n\t\t\t\t</motion.button>\n\t\t\t)}\n\t\t</div>\n\t);\n}\n"],"file":"FloatingChat-UZ2NsUOZ.js"}
1
+ {"version":3,"mappings":";yZASA,SAAS,EAAO,EAAK,EAAO,CACxB,GAAI,OAAO,GAAQ,WACf,OAAO,EAAI,CAAK,EAEX,GAAQ,OACb,EAAI,QAAU,EAEtB,CAKA,SAAS,EAAY,GAAG,EAAM,CAC1B,MAAQ,IAAS,CACb,IAAI,EAAa,GACX,EAAW,EAAK,IAAK,GAAQ,CAC/B,IAAM,EAAU,EAAO,EAAK,CAAI,EAIhC,MAHI,CAAC,GAAc,OAAO,GAAY,aAClC,EAAa,IAEV,CACX,CAAC,EAKD,GAAI,EACA,UAAa,CACT,IAAK,IAAI,EAAI,EAAG,EAAI,EAAS,OAAQ,IAAK,CACtC,IAAM,EAAU,EAAS,GACrB,OAAO,GAAY,WACnB,EAAQ,EAGR,EAAO,EAAK,GAAI,IAAI,CAE5B,CACJ,CAER,CACJ,CAKA,SAAS,EAAgB,GAAG,EAAM,CAE9B,SAAa,YAAY,EAAY,GAAG,CAAI,EAAG,CAAI,CACvD,WC7CM,EAAN,gBAAoC,SAAU,CAC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,EAAK,OAAO,CAAC,EAAI,GAAK,KAAK,IAAI,EAAK,OAAO,CAAC,EAAI,IAC5D,EAAc,EAAI,CAEpB,EAmGI,WAjGmB,EAAa,IAAc,CAOjD,GAJA,eAAiB,CAChB,EAAc,EAAK,CACpB,EAAG,GAAG,EAEF,EAAY,OAEhB,GAAM,CAAE,aAAY,eAAgB,OAI9B,EAAO,EAAS,EAAI,EAAK,OAAO,EAChC,EAAO,EAAS,EAAI,EAAK,OAAO,EAIhC,EAAW,EAAK,MAAM,EACtB,EAAY,EAAa,EAAK,MAAM,EACpC,EAAU,EAAK,MAAM,EACrB,EAAa,EAAc,EAAK,MAAM,EAExC,EAAQ,EACR,EAAQ,EAGR,EAAW,IAEd,EAAQ,EAAE,EAAa,EAAc,EAAU,GACrC,EAAY,MAEtB,EAAQ,GAGL,EAAU,IAEb,EAAQ,EAAE,EAAc,EAAc,EAAU,GACtC,EAAa,MAEvB,EAAQ,GAGT,EAAY,CACX,EAAG,EACH,EAAG,CACJ,CAAC,CACF,EAmDI,QAAS,CAAE,EAAG,EAAS,EAAG,EAAG,EAAS,CAAE,EACxC,WAAY,CAAE,MAAO,GAAI,EACzB,SAAU,CAAE,MAAO,EAAI,EACvB,QAAS,EACT,MAAO,CACN,OAAQ,EACR,MAAO,CACR,EACA,UAAU;;;;;iBAOV,SAAC,EAAD,CAAK,KAAM,EAAK,EACF,EAEZ,GAEP","names":["Fragment"],"ignoreList":[0,1,2,3,4],"sources":["../../node_modules/.pnpm/framer-motion@12.42.2_react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/framer-motion/dist/es/utils/use-composed-ref.mjs","../../node_modules/.pnpm/framer-motion@12.42.2_react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/framer-motion/dist/es/components/AnimatePresence/PopChild.mjs","../../node_modules/.pnpm/framer-motion@12.42.2_react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/framer-motion/dist/es/components/AnimatePresence/PresenceChild.mjs","../../node_modules/.pnpm/framer-motion@12.42.2_react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/framer-motion/dist/es/components/AnimatePresence/utils.mjs","../../node_modules/.pnpm/framer-motion@12.42.2_react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/framer-motion/dist/es/components/AnimatePresence/index.mjs","../../src/features/instance/applications/components/Chat/FloatingChat.tsx"],"sourcesContent":["import * as React from 'react';\n\n/**\n * Taken from https://github.com/radix-ui/primitives/blob/main/packages/react/compose-refs/src/compose-refs.tsx\n */\n/**\n * Set a given ref to a given value\n * This utility takes care of different types of refs: callback refs and RefObject(s)\n */\nfunction setRef(ref, value) {\n if (typeof ref === \"function\") {\n return ref(value);\n }\n else if (ref !== null && ref !== undefined) {\n ref.current = value;\n }\n}\n/**\n * A utility to compose multiple refs together\n * Accepts callback refs and RefObject(s)\n */\nfunction composeRefs(...refs) {\n return (node) => {\n let hasCleanup = false;\n const cleanups = refs.map((ref) => {\n const cleanup = setRef(ref, node);\n if (!hasCleanup && typeof cleanup === \"function\") {\n hasCleanup = true;\n }\n return cleanup;\n });\n // React <19 will log an error to the console if a callback ref returns a\n // value. We don't use ref cleanups internally so this will only happen if a\n // user's ref callback returns a value, which we only expect if they are\n // using the cleanup functionality added in React 19.\n if (hasCleanup) {\n return () => {\n for (let i = 0; i < cleanups.length; i++) {\n const cleanup = cleanups[i];\n if (typeof cleanup === \"function\") {\n cleanup();\n }\n else {\n setRef(refs[i], null);\n }\n }\n };\n }\n };\n}\n/**\n * A custom hook that composes multiple refs\n * Accepts callback refs and RefObject(s)\n */\nfunction useComposedRefs(...refs) {\n // eslint-disable-next-line react-hooks/exhaustive-deps\n return React.useCallback(composeRefs(...refs), refs);\n}\n\nexport { useComposedRefs };\n//# sourceMappingURL=use-composed-ref.mjs.map\n","\"use client\";\nimport { jsx } from 'react/jsx-runtime';\nimport { isHTMLElement } from 'motion-dom';\nimport * as React from 'react';\nimport { useId, useRef, useContext, useInsertionEffect } from 'react';\nimport { MotionConfigContext } from '../../context/MotionConfigContext.mjs';\nimport { useComposedRefs } from '../../utils/use-composed-ref.mjs';\n\n/**\n * Measurement functionality has to be within a separate component\n * to leverage snapshot lifecycle.\n */\nclass PopChildMeasure extends React.Component {\n getSnapshotBeforeUpdate(prevProps) {\n const element = this.props.childRef.current;\n if (isHTMLElement(element) && prevProps.isPresent && !this.props.isPresent && this.props.pop !== false) {\n const parent = element.offsetParent;\n const parentWidth = isHTMLElement(parent)\n ? parent.offsetWidth || 0\n : 0;\n const parentHeight = isHTMLElement(parent)\n ? parent.offsetHeight || 0\n : 0;\n const computedStyle = getComputedStyle(element);\n const size = this.props.sizeRef.current;\n size.height = parseFloat(computedStyle.height);\n size.width = parseFloat(computedStyle.width);\n size.top = element.offsetTop;\n size.left = element.offsetLeft;\n size.right = parentWidth - size.width - size.left;\n size.bottom = parentHeight - size.height - size.top;\n size.direction = computedStyle.direction;\n }\n return null;\n }\n /**\n * Required with getSnapshotBeforeUpdate to stop React complaining.\n */\n componentDidUpdate() { }\n render() {\n return this.props.children;\n }\n}\nfunction PopChild({ children, isPresent, anchorX, anchorY, root, pop }) {\n const id = useId();\n const ref = useRef(null);\n const size = useRef({\n width: 0,\n height: 0,\n top: 0,\n left: 0,\n right: 0,\n bottom: 0,\n direction: \"ltr\",\n });\n const { nonce } = useContext(MotionConfigContext);\n /**\n * In React 19, refs are passed via props.ref instead of element.ref.\n * We check props.ref first (React 19) and fall back to element.ref (React 18).\n */\n const childRef = children.props?.ref ??\n children?.ref;\n const composedRef = useComposedRefs(ref, childRef);\n /**\n * We create and inject a style block so we can apply this explicit\n * sizing in a non-destructive manner by just deleting the style block.\n *\n * We can't apply size via render as the measurement happens\n * in getSnapshotBeforeUpdate (post-render), likewise if we apply the\n * styles directly on the DOM node, we might be overwriting\n * styles set via the style prop.\n */\n useInsertionEffect(() => {\n const { width, height, top, left, right, bottom, direction } = size.current;\n if (isPresent || pop === false || !ref.current || !width || !height)\n return;\n const isRTL = direction === \"rtl\";\n const x = anchorX === \"left\"\n ? (isRTL ? `right: ${right}` : `left: ${left}`)\n : (isRTL ? `left: ${left}` : `right: ${right}`);\n const y = anchorY === \"bottom\" ? `bottom: ${bottom}` : `top: ${top}`;\n ref.current.dataset.motionPopId = id;\n const style = document.createElement(\"style\");\n if (nonce)\n style.nonce = nonce;\n const parent = root ?? document.head;\n parent.appendChild(style);\n if (style.sheet) {\n style.sheet.insertRule(`\n [data-motion-pop-id=\"${id}\"] {\n position: absolute !important;\n width: ${width}px !important;\n height: ${height}px !important;\n ${x}px !important;\n ${y}px !important;\n }\n `);\n }\n return () => {\n ref.current?.removeAttribute(\"data-motion-pop-id\");\n if (parent.contains(style)) {\n parent.removeChild(style);\n }\n };\n }, [isPresent]);\n return (jsx(PopChildMeasure, { isPresent: isPresent, childRef: ref, sizeRef: size, pop: pop, children: pop === false\n ? children\n : React.cloneElement(children, { ref: composedRef }) }));\n}\n\nexport { PopChild };\n//# sourceMappingURL=PopChild.mjs.map\n","\"use client\";\nimport { jsx } from 'react/jsx-runtime';\nimport * as React from 'react';\nimport { useId, useRef, useMemo } from 'react';\nimport { PresenceContext } from '../../context/PresenceContext.mjs';\nimport { useConstant } from '../../utils/use-constant.mjs';\nimport { useIsomorphicLayoutEffect } from '../../utils/use-isomorphic-effect.mjs';\nimport { PopChild } from './PopChild.mjs';\n\nconst PresenceChild = ({ children, initial, isPresent, onExitComplete, custom, presenceAffectsLayout, mode, anchorX, anchorY, root }) => {\n const presenceChildren = useConstant(newChildrenMap);\n const id = useId();\n // Written in a layout effect (not render) so discarded concurrent\n // renders can't leave the refs pointing at uncommitted state.\n const isPresentRef = useRef(isPresent);\n const onExitCompleteRef = useRef(onExitComplete);\n useIsomorphicLayoutEffect(() => {\n isPresentRef.current = isPresent;\n onExitCompleteRef.current = onExitComplete;\n });\n let isReusedContext = true;\n let context = useMemo(() => {\n isReusedContext = false;\n return {\n id,\n initial,\n isPresent,\n custom,\n onExitComplete: (childId) => {\n presenceChildren.set(childId, true);\n for (const isComplete of presenceChildren.values()) {\n if (!isComplete)\n return; // can stop searching when any is incomplete\n }\n onExitComplete && onExitComplete();\n },\n register: (childId) => {\n presenceChildren.set(childId, false);\n return () => {\n presenceChildren.delete(childId);\n !isPresentRef.current &&\n !presenceChildren.size &&\n onExitCompleteRef.current?.();\n };\n },\n };\n }, [isPresent, presenceChildren, onExitComplete]);\n /**\n * If the presence of a child affects the layout of the components around it,\n * we want to make a new context value to ensure they get re-rendered\n * so they can detect that layout change.\n */\n if (presenceAffectsLayout && isReusedContext) {\n context = { ...context };\n }\n useMemo(() => {\n presenceChildren.forEach((_, key) => presenceChildren.set(key, false));\n }, [isPresent]);\n /**\n * If there's no `motion` components to fire exit animations, we want to remove this\n * component immediately.\n */\n React.useEffect(() => {\n !isPresent &&\n !presenceChildren.size &&\n onExitComplete &&\n onExitComplete();\n }, [isPresent]);\n children = (jsx(PopChild, { pop: mode === \"popLayout\", isPresent: isPresent, anchorX: anchorX, anchorY: anchorY, root: root, children: children }));\n return (jsx(PresenceContext.Provider, { value: context, children: children }));\n};\nfunction newChildrenMap() {\n return new Map();\n}\n\nexport { PresenceChild };\n//# sourceMappingURL=PresenceChild.mjs.map\n","import { Children, isValidElement } from 'react';\n\nconst getChildKey = (child) => child.key || \"\";\nfunction onlyElements(children) {\n const filtered = [];\n // We use forEach here instead of map as map mutates the component key by preprending `.$`\n Children.forEach(children, (child) => {\n if (isValidElement(child))\n filtered.push(child);\n });\n return filtered;\n}\n\nexport { getChildKey, onlyElements };\n//# sourceMappingURL=utils.mjs.map\n","\"use client\";\nimport { jsx, Fragment } from 'react/jsx-runtime';\nimport { useMemo, useRef, useState, useContext } from 'react';\nimport { LayoutGroupContext } from '../../context/LayoutGroupContext.mjs';\nimport { useConstant } from '../../utils/use-constant.mjs';\nimport { useIsomorphicLayoutEffect } from '../../utils/use-isomorphic-effect.mjs';\nimport { PresenceChild } from './PresenceChild.mjs';\nimport { usePresence } from './use-presence.mjs';\nimport { onlyElements, getChildKey } from './utils.mjs';\n\n/**\n * `AnimatePresence` enables the animation of components that have been removed from the tree.\n *\n * When adding/removing more than a single child, every child **must** be given a unique `key` prop.\n *\n * Any `motion` components that have an `exit` property defined will animate out when removed from\n * the tree.\n *\n * ```jsx\n * import { motion, AnimatePresence } from 'framer-motion'\n *\n * export const Items = ({ items }) => (\n * <AnimatePresence>\n * {items.map(item => (\n * <motion.div\n * key={item.id}\n * initial={{ opacity: 0 }}\n * animate={{ opacity: 1 }}\n * exit={{ opacity: 0 }}\n * />\n * ))}\n * </AnimatePresence>\n * )\n * ```\n *\n * You can sequence exit animations throughout a tree using variants.\n *\n * If a child contains multiple `motion` components with `exit` props, it will only unmount the child\n * once all `motion` components have finished animating out. Likewise, any components using\n * `usePresence` all need to call `safeToRemove`.\n *\n * @public\n */\nconst AnimatePresence = ({ children, custom, initial = true, onExitComplete, presenceAffectsLayout = true, mode = \"sync\", propagate = false, anchorX = \"left\", anchorY = \"top\", root }) => {\n const [isParentPresent, safeToRemove] = usePresence(propagate);\n /**\n * Filter any children that aren't ReactElements. We can only track components\n * between renders with a props.key.\n */\n const presentChildren = useMemo(() => onlyElements(children), [children]);\n /**\n * Track the keys of the currently rendered children. This is used to\n * determine which children are exiting.\n */\n const presentKeys = propagate && !isParentPresent ? [] : presentChildren.map(getChildKey);\n /**\n * If `initial={false}` we only want to pass this to components in the first render.\n */\n const isInitialRender = useRef(true);\n /**\n * A ref containing the currently present children. When all exit animations\n * are complete, we use this to re-render the component with the latest children\n * *committed* rather than the latest children *rendered*.\n */\n const pendingPresentChildren = useRef(presentChildren);\n /**\n * Track which exiting children have finished animating out.\n */\n const exitComplete = useConstant(() => new Map());\n /**\n * Track which components are currently processing exit to prevent duplicate processing.\n */\n const exitingComponents = useRef(new Set());\n /**\n * Save children to render as React state. To ensure this component is concurrent-safe,\n * we check for exiting children via an effect.\n */\n const [diffedChildren, setDiffedChildren] = useState(presentChildren);\n const [renderedChildren, setRenderedChildren] = useState(presentChildren);\n useIsomorphicLayoutEffect(() => {\n isInitialRender.current = false;\n pendingPresentChildren.current = presentChildren;\n /**\n * Update complete status of exiting children.\n */\n for (let i = 0; i < renderedChildren.length; i++) {\n const key = getChildKey(renderedChildren[i]);\n if (!presentKeys.includes(key)) {\n if (exitComplete.get(key) !== true) {\n exitComplete.set(key, false);\n }\n }\n else {\n exitComplete.delete(key);\n exitingComponents.current.delete(key);\n }\n }\n }, [renderedChildren, presentKeys.length, presentKeys.join(\"-\")]);\n const exitingChildren = [];\n if (presentChildren !== diffedChildren) {\n let nextChildren = [...presentChildren];\n /**\n * Loop through all the currently rendered components and decide which\n * are exiting.\n */\n for (let i = 0; i < renderedChildren.length; i++) {\n const child = renderedChildren[i];\n const key = getChildKey(child);\n if (!presentKeys.includes(key)) {\n nextChildren.splice(i, 0, child);\n exitingChildren.push(child);\n }\n }\n /**\n * If we're in \"wait\" mode, and we have exiting children, we want to\n * only render these until they've all exited.\n */\n if (mode === \"wait\" && exitingChildren.length) {\n nextChildren = exitingChildren;\n }\n setRenderedChildren(onlyElements(nextChildren));\n setDiffedChildren(presentChildren);\n /**\n * Early return to ensure once we've set state with the latest diffed\n * children, we can immediately re-render.\n */\n return null;\n }\n if (process.env.NODE_ENV !== \"production\" &&\n mode === \"wait\" &&\n renderedChildren.length > 1) {\n console.warn(`You're attempting to animate multiple children within AnimatePresence, but its mode is set to \"wait\". This will lead to odd visual behaviour.`);\n }\n /**\n * If we've been provided a forceRender function by the LayoutGroupContext,\n * we can use it to force a re-render amongst all surrounding components once\n * all components have finished animating out.\n */\n const { forceRender } = useContext(LayoutGroupContext);\n return (jsx(Fragment, { children: renderedChildren.map((child) => {\n const key = getChildKey(child);\n const isPresent = propagate && !isParentPresent\n ? false\n : presentChildren === renderedChildren ||\n presentKeys.includes(key);\n const onExit = () => {\n if (exitingComponents.current.has(key)) {\n return;\n }\n if (exitComplete.has(key)) {\n exitingComponents.current.add(key);\n exitComplete.set(key, true);\n }\n else {\n return;\n }\n let isEveryExitComplete = true;\n exitComplete.forEach((isExitComplete) => {\n if (!isExitComplete)\n isEveryExitComplete = false;\n });\n if (isEveryExitComplete) {\n forceRender?.();\n setRenderedChildren(pendingPresentChildren.current);\n propagate && safeToRemove?.();\n onExitComplete && onExitComplete();\n }\n };\n return (jsx(PresenceChild, { isPresent: isPresent, initial: !isInitialRender.current || initial\n ? undefined\n : false, custom: custom, presenceAffectsLayout: presenceAffectsLayout, mode: mode, root: root, onExitComplete: isPresent ? undefined : onExit, anchorX: anchorX, anchorY: anchorY, children: child }, key));\n }) }));\n};\n\nexport { AnimatePresence };\n//# sourceMappingURL=index.mjs.map\n","import { Loading } from '@/components/Loading';\nimport { useLocalStorage } from '@/hooks/useLocalStorage';\nimport { useSessionStorage } from '@/hooks/useSessionStorage';\nimport { LocalStorageKeys } from '@/lib/storage/localStorageKeys';\nimport { Bot } from 'lucide-react';\nimport { AnimatePresence, motion } from 'motion/react';\nimport { lazy, Suspense, useCallback, useEffect, useRef, useState } from 'react';\n\n// Second-tier lazy load: this file (the floating bubble) loads when you land on\n// an instance, but the chat pane — and its heavy dependencies (the AI SDK, the\n// chat tools, the markdown message renderer) — only loads the first time the\n// bubble is opened.\nconst Chat = lazy(() => import('./index').then((m) => ({ default: m.Chat })));\n\nconst BUBBLE_SIZE = 56;\nconst PADDING = 24;\n\nexport function FloatingChat() {\n\tconst [isMobile, setIsMobile] = useState(false);\n\tconst [isDragging, setIsDragging] = useState(false);\n\tconst [isResizing, setIsResizing] = useState(false);\n\tconst [isOpen, setIsOpen] = useSessionStorage('ApplicationChatOpen', false);\n\tconst [position, setPosition] = useLocalStorage(LocalStorageKeys.ApplicationChatPosition, { x: -40, y: -40 });\n\tconst [width, setWidth] = useLocalStorage(LocalStorageKeys.ApplicationChatWidth, 600);\n\tconst containerRef = useRef<HTMLDivElement>(null);\n\n\tuseEffect(() => {\n\t\tconst checkMobile = () => {\n\t\t\tconst mobile = window.innerWidth < 768;\n\t\t\tsetIsMobile(mobile);\n\t\t\tif (!mobile && width > window.innerWidth) {\n\t\t\t\tsetWidth(window.innerWidth);\n\t\t\t}\n\t\t};\n\t\tcheckMobile();\n\t\twindow.addEventListener('resize', checkMobile);\n\t\treturn () => window.removeEventListener('resize', checkMobile);\n\t}, [width, setWidth]);\n\n\tconst handleResizeStart = useCallback((e: React.MouseEvent) => {\n\t\te.preventDefault();\n\t\tsetIsResizing(true);\n\t}, []);\n\n\tuseEffect(() => {\n\t\tif (!isResizing) { return; }\n\n\t\tconst handleMouseMove = (e: MouseEvent) => {\n\t\t\tconst newWidth = window.innerWidth - e.clientX;\n\t\t\tconst clampedWidth = Math.min(Math.max(newWidth, 300), window.innerWidth);\n\t\t\tsetWidth(clampedWidth);\n\t\t};\n\n\t\tconst handleMouseUp = () => {\n\t\t\tsetIsResizing(false);\n\t\t};\n\n\t\twindow.addEventListener('mousemove', handleMouseMove);\n\t\twindow.addEventListener('mouseup', handleMouseUp);\n\t\treturn () => {\n\t\t\twindow.removeEventListener('mousemove', handleMouseMove);\n\t\t\twindow.removeEventListener('mouseup', handleMouseUp);\n\t\t};\n\t}, [isResizing, setWidth]);\n\n\tconst toggleChat = useCallback(() => {\n\t\tif (isDragging) { return; }\n\t\tsetIsOpen(prev => !prev);\n\t}, [isDragging]);\n\n\tconst closeChat = useCallback(() => {\n\t\tsetIsOpen(false);\n\t}, []);\n\n\tuseEffect(() => {\n\t\tif (isOpen) {\n\t\t\tconst handleEscape = (e: KeyboardEvent) => {\n\t\t\t\tif (e.key === 'Escape') {\n\t\t\t\t\tcloseChat();\n\t\t\t\t}\n\t\t\t};\n\t\t\twindow.addEventListener('keydown', handleEscape);\n\t\t\treturn () => window.removeEventListener('keydown', handleEscape);\n\t\t}\n\t}, [isOpen, closeChat]);\n\n\tconst handleDragStart = () => {\n\t\tsetIsDragging(false);\n\t};\n\n\tconst handleDrag = (_event: any, info: any) => {\n\t\t// If the user has moved the pointer more than 5px, consider it a drag\n\t\tif (Math.abs(info.offset.x) > 5 || Math.abs(info.offset.y) > 5) {\n\t\t\tsetIsDragging(true);\n\t\t}\n\t};\n\n\tconst handleDragEnd = (_event: any, info: any) => {\n\t\t// Small delay to ensure the click handler (which fires after dragEnd)\n\t\t// can still see the isDragging = true state.\n\t\tsetTimeout(() => {\n\t\t\tsetIsDragging(false);\n\t\t}, 100);\n\n\t\tif (isMobile) { return; }\n\n\t\tconst { innerWidth, innerHeight } = window;\n\n\t\t// Calculate new offsets based on where we started and how far we dragged.\n\t\t// x and y in position are offsets from the initial bottom-right (PADDING, PADDING)\n\t\tconst newX = position.x + info.offset.x;\n\t\tconst newY = position.y + info.offset.y;\n\n\t\t// We still want snapping if it's close to the screen edge.\n\t\t// info.point is absolute screen coordinates of the pointer.\n\t\tconst distLeft = info.point.x;\n\t\tconst distRight = innerWidth - info.point.x;\n\t\tconst distTop = info.point.y;\n\t\tconst distBottom = innerHeight - info.point.y;\n\n\t\tlet snapX = newX;\n\t\tlet snapY = newY;\n\n\t\tconst threshold = 100;\n\t\tif (distLeft < threshold) {\n\t\t\t// Snap to left: x offset should be -(innerWidth - BUBBLE_SIZE - PADDING * 2)\n\t\t\tsnapX = -(innerWidth - BUBBLE_SIZE - PADDING * 2);\n\t\t} else if (distRight < threshold) {\n\t\t\t// Snap to right: x offset should be 0\n\t\t\tsnapX = 0;\n\t\t}\n\n\t\tif (distTop < threshold) {\n\t\t\t// Snap to top: y offset should be -(innerHeight - BUBBLE_SIZE - PADDING * 2)\n\t\t\tsnapY = -(innerHeight - BUBBLE_SIZE - PADDING * 2);\n\t\t} else if (distBottom < threshold) {\n\t\t\t// Snap to bottom: y offset should be 0\n\t\t\tsnapY = 0;\n\t\t}\n\n\t\tsetPosition({\n\t\t\tx: snapX,\n\t\t\ty: snapY,\n\t\t});\n\t};\n\n\treturn (\n\t\t<div className=\"fixed inset-0 pointer-events-none z-50\" ref={containerRef}>\n\t\t\t<AnimatePresence>\n\t\t\t\t{isOpen && (\n\t\t\t\t\t<motion.div\n\t\t\t\t\t\tinitial={isMobile ? { opacity: 0, y: '100%' } : { opacity: 0, x: '100%' }}\n\t\t\t\t\t\tanimate={isMobile ? { opacity: 1, y: 0 } : { opacity: 1, x: 0 }}\n\t\t\t\t\t\texit={isMobile ? { opacity: 0, y: '100%' } : { opacity: 0, x: '100%' }}\n\t\t\t\t\t\ttransition={{ type: 'spring', damping: 25, stiffness: 200 }}\n\t\t\t\t\t\tstyle={!isMobile\n\t\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\ttop: 0,\n\t\t\t\t\t\t\t\tbottom: 0,\n\t\t\t\t\t\t\t\tright: 0,\n\t\t\t\t\t\t\t\twidth,\n\t\t\t\t\t\t\t\tmaxWidth: '100vw',\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t: {}}\n\t\t\t\t\t\tclassName={`\n\t\t\t\t\t\t\tpointer-events-auto\n\t\t\t\t\t\t\tfixed bg-background shadow-2xl border-l border-border overflow-visible\n\t\t\t\t\t\t\t${isMobile ? 'inset-0 w-full h-full rounded-none' : 'h-full'}\n\t\t\t\t\t\t`}\n\t\t\t\t\t>\n\t\t\t\t\t\t{!isMobile && (\n\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\tonMouseDown={handleResizeStart}\n\t\t\t\t\t\t\t\tclassName={`\n\t\t\t\t\t\t\t\t\tabsolute left-0 top-0 bottom-0 w-1 cursor-ew-resize\n\t\t\t\t\t\t\t\t\thover:bg-primary transition-colors z-50\n\t\t\t\t\t\t\t\t\t${isResizing ? 'bg-primary' : ''}\n\t\t\t\t\t\t\t\t`}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t)}\n\t\t\t\t\t\t<Suspense fallback={<Loading centered text=\"Loading chat…\" />}>\n\t\t\t\t\t\t\t<Chat autoFocus closeChat={closeChat} />\n\t\t\t\t\t\t</Suspense>\n\t\t\t\t\t</motion.div>\n\t\t\t\t)}\n\t\t\t</AnimatePresence>\n\n\t\t\t{!isOpen && (\n\t\t\t\t<motion.button\n\t\t\t\t\tdrag\n\t\t\t\t\tdragMomentum={false}\n\t\t\t\t\tdragConstraints={containerRef}\n\t\t\t\t\tonDragStart={handleDragStart}\n\t\t\t\t\tonDrag={handleDrag}\n\t\t\t\t\tonDragEnd={handleDragEnd}\n\t\t\t\t\tinitial={{ x: position.x, y: position.y }}\n\t\t\t\t\twhileHover={{ scale: 1.1 }}\n\t\t\t\t\twhileTap={{ scale: 0.9 }}\n\t\t\t\t\tonClick={toggleChat}\n\t\t\t\t\tstyle={{\n\t\t\t\t\t\tbottom: PADDING,\n\t\t\t\t\t\tright: PADDING,\n\t\t\t\t\t}}\n\t\t\t\t\tclassName=\"\n\t\t\t\t\t\tpointer-events-auto\n\t\t\t\t\t\tfixed w-14 h-14 rounded-full bg-primary\n\t\t\t\t\t\ttext-primary-foreground shadow-lg flex items-center justify-center cursor-pointer\n\t\t\t\t\t\thover:bg-primary/90 transition-colors\n\t\t\t\t\t\"\n\t\t\t\t>\n\t\t\t\t\t<Bot size={28} />\n\t\t\t\t</motion.button>\n\t\t\t)}\n\t\t</div>\n\t);\n}\n"],"file":"FloatingChat-sC0H91n9.js"}
@@ -1,2 +1,2 @@
1
- import{a as e}from"./rolldown-runtime-CNC7AqOf.js";import{i as t,t as n}from"./button-oQgW4t1x.js";import{A as r}from"./vendor-tanstack-0SjDjtT0.js";import{a as i}from"./vendor-datadog-DyjkTkvg.js";import{r as a}from"./vendor-react-DeL8Gtgl.js";import{a as o,i as s,n as c,r as l,t as u}from"./card-BHplR9Xd.js";import{Kt as d,or as f,rn as p,rr as m}from"./index-Bh_CNAHr.js";async function h(){let{data:e}=await t.post(`/Admin/ApiToken`,{});return e}function g(){return r({mutationFn:h,gcTime:0})}var _=e(i(),1),v=a();function y(){let{mutate:e,isPending:t,reset:r}=g(),[i,a]=(0,_.useState)(null),h=d();return(0,v.jsxs)(`div`,{className:`max-w-2xl`,children:[(0,v.jsx)(`h1`,{className:`text-2xl font-light`,children:`API Token`}),(0,v.jsxs)(`p`,{className:`mt-2 text-sm text-muted-foreground`,children:[`Generate a short-lived token for programmatic API access. It authenticates as you, with your permissions. Send it as a bearer token:`,` `,(0,v.jsx)(`code`,{className:`rounded bg-muted px-1 py-0.5 text-xs`,children:`Authorization: Bearer <token>`})]}),(0,v.jsxs)(n,{className:`mt-4`,variant:`submit`,onClick:()=>{e(void 0,{onSuccess:e=>{a(e),r()}})},disabled:t,children:[(0,v.jsx)(m,{}),t?`Generating…`:`Generate token`]}),i&&(0,v.jsxs)(u,{className:`mt-6`,children:[(0,v.jsxs)(s,{children:[(0,v.jsx)(o,{children:`Your API token`}),(0,v.jsxs)(l,{children:[`Copy it now — it won't be shown again. Expires `,new Date(i.expiresAt).toLocaleString(),`.`]})]}),(0,v.jsxs)(c,{className:`flex items-center gap-2`,children:[(0,v.jsx)(p,{readOnly:!0,value:i.operationToken,className:`font-mono text-xs`,onClick:()=>h(i.operationToken)}),(0,v.jsx)(n,{type:`button`,size:`icon`,variant:`ghost`,className:`shrink-0`,"aria-label":`Copy token`,onClick:()=>h(i.operationToken),children:(0,v.jsx)(f,{})})]})]})]})}export{y as ApiTokenIndex};
2
- //# sourceMappingURL=apiToken-BUI_04o7.js.map
1
+ import{a as e}from"./rolldown-runtime-CNC7AqOf.js";import{i as t,t as n}from"./button-oQgW4t1x.js";import{A as r}from"./vendor-tanstack-0SjDjtT0.js";import{a as i}from"./vendor-datadog-DyjkTkvg.js";import{r as a}from"./vendor-react-DeL8Gtgl.js";import{a as o,i as s,n as c,r as l,t as u}from"./card-BHplR9Xd.js";import{Kt as d,or as f,rn as p,rr as m}from"./index-Dy3uDGXb.js";async function h(){let{data:e}=await t.post(`/Admin/ApiToken`,{});return e}function g(){return r({mutationFn:h,gcTime:0})}var _=e(i(),1),v=a();function y(){let{mutate:e,isPending:t,reset:r}=g(),[i,a]=(0,_.useState)(null),h=d();return(0,v.jsxs)(`div`,{className:`max-w-2xl`,children:[(0,v.jsx)(`h1`,{className:`text-2xl font-light`,children:`API Token`}),(0,v.jsxs)(`p`,{className:`mt-2 text-sm text-muted-foreground`,children:[`Generate a short-lived token for programmatic API access. It authenticates as you, with your permissions. Send it as a bearer token:`,` `,(0,v.jsx)(`code`,{className:`rounded bg-muted px-1 py-0.5 text-xs`,children:`Authorization: Bearer <token>`})]}),(0,v.jsxs)(n,{className:`mt-4`,variant:`submit`,onClick:()=>{e(void 0,{onSuccess:e=>{a(e),r()}})},disabled:t,children:[(0,v.jsx)(m,{}),t?`Generating…`:`Generate token`]}),i&&(0,v.jsxs)(u,{className:`mt-6`,children:[(0,v.jsxs)(s,{children:[(0,v.jsx)(o,{children:`Your API token`}),(0,v.jsxs)(l,{children:[`Copy it now — it won't be shown again. Expires `,new Date(i.expiresAt).toLocaleString(),`.`]})]}),(0,v.jsxs)(c,{className:`flex items-center gap-2`,children:[(0,v.jsx)(p,{readOnly:!0,value:i.operationToken,className:`font-mono text-xs`,onClick:()=>h(i.operationToken)}),(0,v.jsx)(n,{type:`button`,size:`icon`,variant:`ghost`,className:`shrink-0`,"aria-label":`Copy token`,onClick:()=>h(i.operationToken),children:(0,v.jsx)(f,{})})]})]})]})}export{y as ApiTokenIndex};
2
+ //# sourceMappingURL=apiToken-DZ8JhHOI.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"apiToken-BUI_04o7.js","names":[],"sources":["../../src/features/admin/apiToken/mutations/useGenerateApiToken.ts","../../src/features/admin/apiToken/index.tsx"],"sourcesContent":["import { apiClient } from '@/config/apiClient';\nimport { ApiTokenResult } from '@/integrations/api/api.patch';\nimport { useMutation } from '@tanstack/react-query';\n\n/**\n * POST /Admin/ApiToken → a short-lived Bearer token for the SSO'd fabric admin.\n *\n * The endpoint isn't in the generated API types yet, so the URL and response are\n * cast (same approach as getCurrentUser / updateUserMutation).\n */\nexport async function generateApiToken(): Promise<ApiTokenResult> {\n\tconst { data } = await apiClient.post('/Admin/ApiToken' as '/Cluster/', {});\n\treturn data as unknown as ApiTokenResult;\n}\n\nexport function useGenerateApiTokenMutation() {\n\treturn useMutation<ApiTokenResult, Error, void>({\n\t\tmutationFn: generateApiToken,\n\t\t// The result is a bearer credential. Don't let it linger in the shared\n\t\t// MutationCache: that's readable via queryClient.getMutationCache(), shows\n\t\t// in the mutation inspector, and survives logout (logoutOnSuccess clears\n\t\t// only the QueryCache). gcTime:0 discards it the moment the observer\n\t\t// unmounts; the page also reset()s right after copying it into local state.\n\t\tgcTime: 0,\n\t});\n}\n","import { Button } from '@/components/ui/button';\nimport { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui/card';\nimport { Input } from '@/components/ui/input';\nimport { useGenerateApiTokenMutation } from '@/features/admin/apiToken/mutations/useGenerateApiToken';\nimport { useCopyTextToClipboard } from '@/hooks/useCopyToClipboard';\nimport { ApiTokenResult } from '@/integrations/api/api.patch';\nimport { CopyIcon, KeyRoundIcon } from 'lucide-react';\nimport { useState } from 'react';\n\nexport function ApiTokenIndex() {\n\tconst { mutate, isPending, reset } = useGenerateApiTokenMutation();\n\tconst [token, setToken] = useState<ApiTokenResult | null>(null);\n\tconst copyText = useCopyTextToClipboard();\n\n\tconst onGenerate = () => {\n\t\t// The global MutationCache.onError (react-query/queryClient) already surfaces\n\t\t// failures with a toast, so no local onError.\n\t\tmutate(undefined, {\n\t\t\tonSuccess: (result) => {\n\t\t\t\t// Hold the credential in local component state only, then drop it from\n\t\t\t\t// the shared MutationCache so it can't be read there or outlive the page.\n\t\t\t\tsetToken(result);\n\t\t\t\treset();\n\t\t\t},\n\t\t});\n\t};\n\n\treturn (\n\t\t<div className=\"max-w-2xl\">\n\t\t\t<h1 className=\"text-2xl font-light\">API Token</h1>\n\t\t\t<p className=\"mt-2 text-sm text-muted-foreground\">\n\t\t\t\tGenerate a short-lived token for programmatic API access. It authenticates as you, with your permissions. Send\n\t\t\t\tit as a bearer token:{' '}\n\t\t\t\t<code className=\"rounded bg-muted px-1 py-0.5 text-xs\">Authorization: Bearer &lt;token&gt;</code>\n\t\t\t</p>\n\n\t\t\t<Button className=\"mt-4\" variant=\"submit\" onClick={onGenerate} disabled={isPending}>\n\t\t\t\t<KeyRoundIcon />\n\t\t\t\t{isPending ? 'Generating…' : 'Generate token'}\n\t\t\t</Button>\n\n\t\t\t{token && (\n\t\t\t\t<Card className=\"mt-6\">\n\t\t\t\t\t<CardHeader>\n\t\t\t\t\t\t<CardTitle>Your API token</CardTitle>\n\t\t\t\t\t\t<CardDescription>\n\t\t\t\t\t\t\tCopy it now — it won't be shown again. Expires {new Date(token.expiresAt).toLocaleString()}.\n\t\t\t\t\t\t</CardDescription>\n\t\t\t\t\t</CardHeader>\n\t\t\t\t\t<CardContent className=\"flex items-center gap-2\">\n\t\t\t\t\t\t<Input\n\t\t\t\t\t\t\treadOnly\n\t\t\t\t\t\t\tvalue={token.operationToken}\n\t\t\t\t\t\t\tclassName=\"font-mono text-xs\"\n\t\t\t\t\t\t\tonClick={() => copyText(token.operationToken)}\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t\tsize=\"icon\"\n\t\t\t\t\t\t\tvariant=\"ghost\"\n\t\t\t\t\t\t\tclassName=\"shrink-0\"\n\t\t\t\t\t\t\taria-label=\"Copy token\"\n\t\t\t\t\t\t\tonClick={() => copyText(token.operationToken)}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<CopyIcon />\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t</CardContent>\n\t\t\t\t</Card>\n\t\t\t)}\n\t\t</div>\n\t);\n}\n"],"mappings":"yXAUA,eAAsB,GAA4C,CACjE,GAAM,CAAE,QAAS,MAAM,EAAU,KAAK,kBAAkC,CAAC,CAAC,EAC1E,OAAO,CACR,CAEA,SAAgB,GAA8B,CAC7C,OAAO,EAAyC,CAC/C,WAAY,EAMZ,OAAQ,CACT,CAAC,CACF,sBChBA,SAAgB,GAAgB,CAC/B,GAAM,CAAE,SAAQ,YAAW,SAAU,EAA4B,EAC3D,CAAC,EAAO,IAAA,EAAA,EAAA,SAAA,CAA4C,IAAI,EACx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ACR,GAEH,GAEP"}
1
+ {"version":3,"file":"apiToken-DZ8JhHOI.js","names":[],"sources":["../../src/features/admin/apiToken/mutations/useGenerateApiToken.ts","../../src/features/admin/apiToken/index.tsx"],"sourcesContent":["import { apiClient } from '@/config/apiClient';\nimport { ApiTokenResult } from '@/integrations/api/api.patch';\nimport { useMutation } from '@tanstack/react-query';\n\n/**\n * POST /Admin/ApiToken → a short-lived Bearer token for the SSO'd fabric admin.\n *\n * The endpoint isn't in the generated API types yet, so the URL and response are\n * cast (same approach as getCurrentUser / updateUserMutation).\n */\nexport async function generateApiToken(): Promise<ApiTokenResult> {\n\tconst { data } = await apiClient.post('/Admin/ApiToken' as '/Cluster/', {});\n\treturn data as unknown as ApiTokenResult;\n}\n\nexport function useGenerateApiTokenMutation() {\n\treturn useMutation<ApiTokenResult, Error, void>({\n\t\tmutationFn: generateApiToken,\n\t\t// The result is a bearer credential. Don't let it linger in the shared\n\t\t// MutationCache: that's readable via queryClient.getMutationCache(), shows\n\t\t// in the mutation inspector, and survives logout (logoutOnSuccess clears\n\t\t// only the QueryCache). gcTime:0 discards it the moment the observer\n\t\t// unmounts; the page also reset()s right after copying it into local state.\n\t\tgcTime: 0,\n\t});\n}\n","import { Button } from '@/components/ui/button';\nimport { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui/card';\nimport { Input } from '@/components/ui/input';\nimport { useGenerateApiTokenMutation } from '@/features/admin/apiToken/mutations/useGenerateApiToken';\nimport { useCopyTextToClipboard } from '@/hooks/useCopyToClipboard';\nimport { ApiTokenResult } from '@/integrations/api/api.patch';\nimport { CopyIcon, KeyRoundIcon } from 'lucide-react';\nimport { useState } from 'react';\n\nexport function ApiTokenIndex() {\n\tconst { mutate, isPending, reset } = useGenerateApiTokenMutation();\n\tconst [token, setToken] = useState<ApiTokenResult | null>(null);\n\tconst copyText = useCopyTextToClipboard();\n\n\tconst onGenerate = () => {\n\t\t// The global MutationCache.onError (react-query/queryClient) already surfaces\n\t\t// failures with a toast, so no local onError.\n\t\tmutate(undefined, {\n\t\t\tonSuccess: (result) => {\n\t\t\t\t// Hold the credential in local component state only, then drop it from\n\t\t\t\t// the shared MutationCache so it can't be read there or outlive the page.\n\t\t\t\tsetToken(result);\n\t\t\t\treset();\n\t\t\t},\n\t\t});\n\t};\n\n\treturn (\n\t\t<div className=\"max-w-2xl\">\n\t\t\t<h1 className=\"text-2xl font-light\">API Token</h1>\n\t\t\t<p className=\"mt-2 text-sm text-muted-foreground\">\n\t\t\t\tGenerate a short-lived token for programmatic API access. It authenticates as you, with your permissions. Send\n\t\t\t\tit as a bearer token:{' '}\n\t\t\t\t<code className=\"rounded bg-muted px-1 py-0.5 text-xs\">Authorization: Bearer &lt;token&gt;</code>\n\t\t\t</p>\n\n\t\t\t<Button className=\"mt-4\" variant=\"submit\" onClick={onGenerate} disabled={isPending}>\n\t\t\t\t<KeyRoundIcon />\n\t\t\t\t{isPending ? 'Generating…' : 'Generate token'}\n\t\t\t</Button>\n\n\t\t\t{token && (\n\t\t\t\t<Card className=\"mt-6\">\n\t\t\t\t\t<CardHeader>\n\t\t\t\t\t\t<CardTitle>Your API token</CardTitle>\n\t\t\t\t\t\t<CardDescription>\n\t\t\t\t\t\t\tCopy it now — it won't be shown again. Expires {new Date(token.expiresAt).toLocaleString()}.\n\t\t\t\t\t\t</CardDescription>\n\t\t\t\t\t</CardHeader>\n\t\t\t\t\t<CardContent className=\"flex items-center gap-2\">\n\t\t\t\t\t\t<Input\n\t\t\t\t\t\t\treadOnly\n\t\t\t\t\t\t\tvalue={token.operationToken}\n\t\t\t\t\t\t\tclassName=\"font-mono text-xs\"\n\t\t\t\t\t\t\tonClick={() => copyText(token.operationToken)}\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t\tsize=\"icon\"\n\t\t\t\t\t\t\tvariant=\"ghost\"\n\t\t\t\t\t\t\tclassName=\"shrink-0\"\n\t\t\t\t\t\t\taria-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AAyB,CAAA,GACpC,EAAA,EAAA,KAAA,CAAC,EAAD,CAAA,SAAA,CAAiB,kDACgC,IAAI,KAAK,EAAM,SAAS,CAAC,CAAC,eAAe,EAAE,GAC3E,CAAA,CAAA,CACN,CAAA,CAAA,GACZ,EAAA,EAAA,KAAA,CAAC,EAAD,CAAa,UAAU,mCAAvB,EACC,EAAA,EAAA,IAAA,CAAC,EAAD,CACC,SAAA,GACA,MAAO,EAAM,eACb,UAAU,oBACV,YAAe,EAAS,EAAM,cAAc,CAC5C,CAAA,GACD,EAAA,EAAA,IAAA,CAAC,EAAD,CACC,KAAK,SACL,KAAK,OACL,QAAQ,QACR,UAAU,WACV,aAAW,aACX,YAAe,EAAS,EAAM,cAAc,YAE5C,EAAA,EAAA,IAAA,CAAC,EAAD,CAAW,CAAA,CACJ,CAAA,CACI,GACR,GAEH,GAEP"}
@@ -1,5 +1,5 @@
1
1
  const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/mermaid.core-CXSmPYwc.js","assets/vendor-datadog-DyjkTkvg.js","assets/rolldown-runtime-CNC7AqOf.js","assets/chunk-Y2CYZVJY-DsF7k-Jl.js","assets/src-CtLGTdOL.js","assets/string-f6JzSHaO.js","assets/chunk-WYO6CB5R-DjlzoSAR.js","assets/chunk-ICXQ74PX-BGPx4ENl.js","assets/math-Bi_r_ZWc.js","assets/step-D4Q0arzR.js","assets/dist-CjNnd4gY.js","assets/chunk-VAUOI2AC-Bzwa4xgc.js","assets/chunk-HOUHSVGY-FzIeTmFw.js","assets/chunk-Q4XR5HBZ-CrfpKH7r.js","assets/chunk-7BUUIJ7U-Bb538aSH.js","assets/chunk-OGEWGWER-BUWG_C6A.js","assets/chunk-C7G6YPKG-DShM0cGF.js","assets/chunk-ZGVPDNZ5-CEHQDif0.js","assets/rough.esm-CSKSodPl.js","assets/chunk-52WLFC77-VT62FhiG.js","assets/line-BMvOdiSv.js","assets/path-BWPyau1x.js","assets/array-BifhSqXX.js","assets/chunk-FWX5IMBZ-Dp4aBT5M.js","assets/chunk-ZIRB5QZD-C6fEPe3t.js"])))=>i.map(i=>d[i]);
2
- import{a as e,r as t,t as n}from"./rolldown-runtime-CNC7AqOf.js";import{d as r,f as i,g as a,h as o,n as s,t as c}from"./authStore-CNoNfv0F.js";import{A as l,b as u,d,l as f,m as p,n as m,r as h,v as g}from"./vendor-core-xUefYpUO.js";import{n as _,r as v,t as y}from"./button-oQgW4t1x.js";import{A as b,C as x,I as S,N as C,S as w,b as T,v as E,x as D,y as O}from"./vendor-tanstack-0SjDjtT0.js";import{a as k,i as A}from"./vendor-datadog-DyjkTkvg.js";import{r as j}from"./vendor-react-DeL8Gtgl.js";import{a as M}from"./useAuth-DvlnspkA.js";import{$ as N,Rt as P,it as ee}from"./vendor-ui-Bj22lHGK.js";import{a as F,i as I,n as te,r as ne,t as re}from"./card-BHplR9Xd.js";import{t as L}from"./createLucideIcon-BDx8noBh.js";import{c as ie,d as ae,f as oe,i as se,l as ce,n as le,o as ue,p as de,s as fe,t as pe,u as me}from"./select-y6NKMkG_.js";import{a as he,n as ge}from"./getRegistrationInfo-BOLlgqXr.js";import{l as _e}from"./textarea-DhLMZ3PA.js";import{i as ve,r as ye,t as be}from"./x-C3uc0qMD.js";import{a as xe,i as Se,n as Ce,r as we,t as Te}from"./tabs-CxZ4MxTw.js";import{c as Ee,d as De,f as Oe,g as ke,h as Ae,i as je,l as Me,m as Ne,n as Pe,o as Fe,r as Ie,t as Le}from"./setComponentFile-DMPo4UjC.js";import{t as Re}from"./queryClient-CbA8wM7J.js";import{n as ze}from"./setLocalStorage-CD_L8p_D.js";import{t as Be}from"./useLocalStorage-hkNSGGg8.js";import{o as Ve,r as He,s as Ue}from"./pollUnlessForbidden-HHdQZW1N.js";import{f as We,i as Ge,p as Ke,r as qe}from"./editor.api-OBQnf1nL.js";import{$ as Je,$n as Ye,$t as Xe,A as Ze,An as Qe,At as $e,B as et,C as tt,Ct as nt,D as rt,E as it,F as at,Fn as ot,Ft as st,G as ct,Gt as lt,H as ut,Hn as dt,Ht as ft,In as pt,J as mt,Jn as ht,Jt as gt,Kn as _t,Kt as vt,Ln as yt,Lt as bt,M as xt,Mn as St,Mt as Ct,N as wt,Nn as Tt,Nt as Et,O as Dt,On as Ot,P as kt,Pn as At,Pt as jt,Q as Mt,Qn as Nt,Qt as Pt,Rn as Ft,Rt as It,S as Lt,St as Rt,T as zt,Tt as Bt,U as Vt,V as R,Vn as Ht,Vt as Ut,W as Wt,Wn as Gt,Wt as Kt,X as qt,Xn as Jt,Xt as Yt,Y as Xt,Yn as Zt,Yt as Qt,Z as $t,Zn as en,Zt as tn,_ as nn,an as rn,at as z,b as an,bt as on,cn as sn,cr as cn,d as ln,dt as un,en as dn,er as fn,et as pn,f as mn,g as hn,gt as gn,h as _n,hn as vn,ht as yn,in as bn,ir as xn,it as Sn,j as Cn,jn as wn,k as Tn,l as En,ln as Dn,lr as On,m as kn,mn as An,mt as jn,nt as Mn,on as Nn,or as Pn,p as Fn,pn as In,pt as Ln,qn as Rn,qt as zn,rn as Bn,rt as Vn,sn as Hn,sr as Un,st as Wn,tn as Gn,tr as Kn,tt as qn,u as Jn,un as Yn,ur as Xn,ut as Zn,v as Qn,vt as $n,w as er,wt as tr,x as nr,xt as rr,y as ir,yt as ar,z as or,zt as sr}from"./index-Bh_CNAHr.js";import{a as cr,c as lr,i as ur,n as dr,o as fr,r as pr,s as mr,t as hr}from"./alertDialog-DSs2KlnR.js";import{t as gr}from"./useEntityRestURL-DoaBMEvU.js";import"./editor-DK9rdQRE.js";var _r=L(`arrow-down-a-z`,[[`path`,{d:`m3 16 4 4 4-4`,key:`1co6wj`}],[`path`,{d:`M7 20V4`,key:`1yoxec`}],[`path`,{d:`M20 8h-5`,key:`1vsyxs`}],[`path`,{d:`M15 10V6.5a2.5 2.5 0 0 1 5 0V10`,key:`ag13bf`}],[`path`,{d:`M15 14h5l-5 6h5`,key:`ur5jdg`}]]),vr=L(`arrow-up-a-z`,[[`path`,{d:`m3 8 4-4 4 4`,key:`11wl7u`}],[`path`,{d:`M7 4v16`,key:`1glfcx`}],[`path`,{d:`M20 8h-5`,key:`1vsyxs`}],[`path`,{d:`M15 10V6.5a2.5 2.5 0 0 1 5 0V10`,key:`ag13bf`}],[`path`,{d:`M15 14h5l-5 6h5`,key:`ur5jdg`}]]),yr=L(`boxes`,[[`path`,{d:`M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z`,key:`lc1i9w`}],[`path`,{d:`m7 16.5-4.74-2.85`,key:`1o9zyk`}],[`path`,{d:`m7 16.5 5-3`,key:`va8pkn`}],[`path`,{d:`M7 16.5v5.17`,key:`jnp8gn`}],[`path`,{d:`M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z`,key:`8zsnat`}],[`path`,{d:`m17 16.5-5-3`,key:`8arw3v`}],[`path`,{d:`m17 16.5 4.74-2.85`,key:`8rfmw`}],[`path`,{d:`M17 16.5v5.17`,key:`k6z78m`}],[`path`,{d:`M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z`,key:`1xygjf`}],[`path`,{d:`M12 8 7.26 5.15`,key:`1vbdud`}],[`path`,{d:`m12 8 4.74-2.85`,key:`3rx089`}],[`path`,{d:`M12 13.5V8`,key:`1io7kd`}]]),br=L(`case-lower`,[[`path`,{d:`M10 9v7`,key:`ylp826`}],[`path`,{d:`M14 6v10`,key:`1jy4vg`}],[`circle`,{cx:`17.5`,cy:`12.5`,r:`3.5`,key:`1a9481`}],[`circle`,{cx:`6.5`,cy:`12.5`,r:`3.5`,key:`2jlv1r`}]]),xr=L(`case-sensitive`,[[`path`,{d:`m2 16 4.039-9.69a.5.5 0 0 1 .923 0L11 16`,key:`d5nyq2`}],[`path`,{d:`M22 9v7`,key:`pvm9v3`}],[`path`,{d:`M3.304 13h6.392`,key:`1q3zxz`}],[`circle`,{cx:`18.5`,cy:`12.5`,r:`3.5`,key:`z97x68`}]]),Sr=L(`case-upper`,[[`path`,{d:`M15 11h4.5a1 1 0 0 1 0 5h-4a.5.5 0 0 1-.5-.5v-9a.5.5 0 0 1 .5-.5h3a1 1 0 0 1 0 5`,key:`nxs35`}],[`path`,{d:`m2 16 4.039-9.69a.5.5 0 0 1 .923 0L11 16`,key:`d5nyq2`}],[`path`,{d:`M3.304 13h6.392`,key:`1q3zxz`}]]),Cr=L(`code`,[[`path`,{d:`m16 18 6-6-6-6`,key:`eg8j8`}],[`path`,{d:`m8 6-6 6 6 6`,key:`ppft3o`}]]),wr=L(`command`,[[`path`,{d:`M15 6v12a3 3 0 1 0 3-3H6a3 3 0 1 0 3 3V6a3 3 0 1 0-3 3h12a3 3 0 1 0-3-3`,key:`11bfej`}]]),Tr=L(`eraser`,[[`path`,{d:`M21 21H8a2 2 0 0 1-1.42-.587l-3.994-3.999a2 2 0 0 1 0-2.828l10-10a2 2 0 0 1 2.829 0l5.999 6a2 2 0 0 1 0 2.828L12.834 21`,key:`g5wo59`}],[`path`,{d:`m5.082 11.09 8.828 8.828`,key:`1wx5vj`}]]),Er=L(`file-archive`,[[`path`,{d:`M13.659 22H18a2 2 0 0 0 2-2V8a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 14 2H6a2 2 0 0 0-2 2v11.5`,key:`4pqfef`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M8 12v-1`,key:`1ej8lb`}],[`path`,{d:`M8 18v-2`,key:`qcmpov`}],[`path`,{d:`M8 7V6`,key:`1nbb54`}],[`circle`,{cx:`8`,cy:`20`,r:`2`,key:`ckkr5m`}]]),Dr=L(`file-braces`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1`,key:`1oajmo`}],[`path`,{d:`M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1`,key:`mpwhp6`}]]),Or=L(`file-code-corner`,[[`path`,{d:`M4 12.15V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2h-3.35`,key:`1wthlu`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`m5 16-3 3 3 3`,key:`331omg`}],[`path`,{d:`m9 22 3-3-3-3`,key:`lsp7cz`}]]),kr=L(`file-image`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`circle`,{cx:`10`,cy:`12`,r:`2`,key:`737tya`}],[`path`,{d:`m20 17-1.296-1.296a2.41 2.41 0 0 0-3.408 0L9 22`,key:`wt3hpn`}]]),Ar=L(`file-key`,[[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M4 12v6`,key:`bg1pfk`}],[`path`,{d:`M4 14h2`,key:`1sf9f8`}],[`path`,{d:`M9.65 22H18a2 2 0 0 0 2-2V8a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 14 2H6a2 2 0 0 0-2 2v4`,key:`d56i0q`}],[`circle`,{cx:`4`,cy:`20`,r:`2`,key:`6kqj1y`}]]),jr=L(`file-plus`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M9 15h6`,key:`cctwl0`}],[`path`,{d:`M12 18v-6`,key:`17g6i2`}]]),Mr=L(`file-type`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M11 18h2`,key:`12mj7e`}],[`path`,{d:`M12 12v6`,key:`3ahymv`}],[`path`,{d:`M9 13v-.5a.5.5 0 0 1 .5-.5h5a.5.5 0 0 1 .5.5v.5`,key:`qbrxap`}]]),Nr=L(`fold-vertical`,[[`path`,{d:`M12 22v-6`,key:`6o8u61`}],[`path`,{d:`M12 8V2`,key:`1wkif3`}],[`path`,{d:`M4 12H2`,key:`rhcxmi`}],[`path`,{d:`M10 12H8`,key:`s88cx1`}],[`path`,{d:`M16 12h-2`,key:`10asgb`}],[`path`,{d:`M22 12h-2`,key:`14jgyd`}],[`path`,{d:`m15 19-3-3-3 3`,key:`e37ymu`}],[`path`,{d:`m15 5-3 3-3-3`,key:`19d6lf`}]]),Pr=L(`folder-input`,[[`path`,{d:`M2 9V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-1`,key:`fm4g5t`}],[`path`,{d:`M2 13h10`,key:`pgb2dq`}],[`path`,{d:`m9 16 3-3-3-3`,key:`6m91ic`}]]),Fr=L(`folder-open`,[[`path`,{d:`m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2`,key:`usdka0`}]]),Ir=L(`folder-plus`,[[`path`,{d:`M12 10v6`,key:`1bos4e`}],[`path`,{d:`M9 13h6`,key:`1uhe8q`}],[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}]]),Lr=L(`git-branch`,[[`path`,{d:`M15 6a9 9 0 0 0-9 9V3`,key:`1cii5b`}],[`circle`,{cx:`18`,cy:`6`,r:`3`,key:`1h7g24`}],[`circle`,{cx:`6`,cy:`18`,r:`3`,key:`fqmcym`}]]),Rr=L(`git-merge`,[[`circle`,{cx:`18`,cy:`18`,r:`3`,key:`1xkwt0`}],[`circle`,{cx:`6`,cy:`6`,r:`3`,key:`1lh9wr`}],[`path`,{d:`M6 21V9a9 9 0 0 0 9 9`,key:`7kw0sc`}]]),zr=L(`image`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`,key:`1m3agn`}],[`circle`,{cx:`9`,cy:`9`,r:`2`,key:`af1f0g`}],[`path`,{d:`m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21`,key:`1xmnt7`}]]),Br=L(`lightbulb`,[[`path`,{d:`M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5`,key:`1gvzjb`}],[`path`,{d:`M9 18h6`,key:`x1upvd`}],[`path`,{d:`M10 22h4`,key:`ceow96`}]]),Vr=L(`link`,[[`path`,{d:`M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71`,key:`1cjeqo`}],[`path`,{d:`M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71`,key:`19qd67`}]]),Hr=L(`list-ordered`,[[`path`,{d:`M11 5h10`,key:`1cz7ny`}],[`path`,{d:`M11 12h10`,key:`1438ji`}],[`path`,{d:`M11 19h10`,key:`11t30w`}],[`path`,{d:`M4 4h1v5`,key:`10yrso`}],[`path`,{d:`M4 9h2`,key:`r1h2o0`}],[`path`,{d:`M6.5 20H3.4c0-1 2.6-1.925 2.6-3.5a1.5 1.5 0 0 0-2.6-1.02`,key:`xtkcd5`}]]),Ur=L(`list-tree`,[[`path`,{d:`M8 5h13`,key:`1pao27`}],[`path`,{d:`M13 12h8`,key:`h98zly`}],[`path`,{d:`M13 19h8`,key:`c3s6r1`}],[`path`,{d:`M3 10a2 2 0 0 0 2 2h3`,key:`1npucw`}],[`path`,{d:`M3 5v12a2 2 0 0 0 2 2h3`,key:`x1gjn2`}]]),Wr=L(`message-square-text`,[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}],[`path`,{d:`M7 11h10`,key:`1twpyw`}],[`path`,{d:`M7 15h6`,key:`d9of3u`}],[`path`,{d:`M7 7h8`,key:`af5zfr`}]]),Gr=L(`message-square`,[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}]]),Kr=L(`mouse-pointer-click`,[[`path`,{d:`M14 4.1 12 6`,key:`ita8i4`}],[`path`,{d:`m5.1 8-2.9-.8`,key:`1go3kf`}],[`path`,{d:`m6 12-1.9 2`,key:`mnht97`}],[`path`,{d:`M7.2 2.2 8 5.1`,key:`1cfko1`}],[`path`,{d:`M9.037 9.69a.498.498 0 0 1 .653-.653l11 4.5a.5.5 0 0 1-.074.949l-4.349 1.041a1 1 0 0 0-.74.739l-1.04 4.35a.5.5 0 0 1-.95.074z`,key:`s0h3yz`}]]),qr=L(`package-open`,[[`path`,{d:`M12 22v-9`,key:`x3hkom`}],[`path`,{d:`M15.17 2.21a1.67 1.67 0 0 1 1.63 0L21 4.57a1.93 1.93 0 0 1 0 3.36L8.82 14.79a1.655 1.655 0 0 1-1.64 0L3 12.43a1.93 1.93 0 0 1 0-3.36z`,key:`2ntwy6`}],[`path`,{d:`M20 13v3.87a2.06 2.06 0 0 1-1.11 1.83l-6 3.08a1.93 1.93 0 0 1-1.78 0l-6-3.08A2.06 2.06 0 0 1 4 16.87V13`,key:`1pmm1c`}],[`path`,{d:`M21 12.43a1.93 1.93 0 0 0 0-3.36L8.83 2.2a1.64 1.64 0 0 0-1.63 0L3 4.57a1.93 1.93 0 0 0 0 3.36l12.18 6.86a1.636 1.636 0 0 0 1.63 0z`,key:`12ttoo`}]]),Jr=L(`panel-right-close`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M15 3v18`,key:`14nvp0`}],[`path`,{d:`m8 9 3 3-3 3`,key:`12hl5m`}]]),Yr=L(`panel-right-open`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M15 3v18`,key:`14nvp0`}],[`path`,{d:`m10 15-3-3 3-3`,key:`1pgupc`}]]),Xr=L(`panel-top`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M3 9h18`,key:`1pudct`}]]),Zr=L(`replace`,[[`path`,{d:`M14 4a1 1 0 0 1 1-1`,key:`dhj8ez`}],[`path`,{d:`M15 10a1 1 0 0 1-1-1`,key:`1mnyi5`}],[`path`,{d:`M21 4a1 1 0 0 0-1-1`,key:`sfs9ap`}],[`path`,{d:`M21 9a1 1 0 0 1-1 1`,key:`mp6qeo`}],[`path`,{d:`m3 7 3 3 3-3`,key:`x25e72`}],[`path`,{d:`M6 10V5a2 2 0 0 1 2-2h2`,key:`15xut4`}],[`rect`,{x:`3`,y:`14`,width:`7`,height:`7`,rx:`1`,key:`1bkyp8`}]]),Qr=L(`sparkles`,[[`path`,{d:`M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z`,key:`1s2grr`}],[`path`,{d:`M20 2v4`,key:`1rf3ol`}],[`path`,{d:`M22 4h-4`,key:`gwowj6`}],[`circle`,{cx:`4`,cy:`20`,r:`2`,key:`6kqj1y`}]]),$r=L(`text-cursor-input`,[[`path`,{d:`M12 20h-1a2 2 0 0 1-2-2 2 2 0 0 1-2 2H6`,key:`1528k5`}],[`path`,{d:`M13 8h7a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2h-7`,key:`13ksps`}],[`path`,{d:`M5 16H4a2 2 0 0 1-2-2v-4a2 2 0 0 1 2-2h1`,key:`1n9rhb`}],[`path`,{d:`M6 4h1a2 2 0 0 1 2 2 2 2 0 0 1 2-2h1`,key:`1mj8rg`}],[`path`,{d:`M9 6v12`,key:`velyjx`}]]),ei=L(`undo-2`,[[`path`,{d:`M9 14 4 9l5-5`,key:`102s5s`}],[`path`,{d:`M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11`,key:`f3b9sd`}]]),ti=L(`unfold-vertical`,[[`path`,{d:`M12 22v-6`,key:`6o8u61`}],[`path`,{d:`M12 8V2`,key:`1wkif3`}],[`path`,{d:`M4 12H2`,key:`rhcxmi`}],[`path`,{d:`M10 12H8`,key:`s88cx1`}],[`path`,{d:`M16 12h-2`,key:`10asgb`}],[`path`,{d:`M22 12h-2`,key:`14jgyd`}],[`path`,{d:`m15 19-3 3-3-3`,key:`11eu04`}],[`path`,{d:`m15 5-3-3-3 3`,key:`itvq4r`}]]),B=e(k(),1);function ni(e,t=!1){let[n,r]=$e(e,t),i=(0,B.useCallback)(e=>{e?.preventDefault?.(),r(e=>!e)},[r]),a=(0,B.useCallback)(e=>{e?.preventDefault?.(),r(!0)},[r]),o=(0,B.useCallback)(e=>{e?.preventDefault?.(),r(!1)},[r]);return(0,B.useMemo)(()=>({toggled:n,setToggled:r,toggle:i,toggleOn:a,toggleOff:o}),[i,r,o,a,n])}var ri=(0,B.createContext)(null);function V(){return(0,B.useContext)(ri)}var H=j();function ii(){let{reloadRootEntries:e,setFocusedItem:t,setSelectedItems:n}=V(),r=Ve();return(0,B.useCallback)(async a=>{let o=!1,s=a.filter(e=>e.from!==e.to);if(s.length===0)return!0;let c=`Renaming ${i(s.length,`File`,`Files`)}`,l={duration:6e4,action:{label:`Cancel`,onClick:()=>{o=!0}}};l.id=P.loading(c,{...l,description:(0,H.jsx)(ge,{animated:!0,width:`0%`})});let u=s.length*3,d=0;function f(){d+=1,P.loading(c,{...l,description:(0,H.jsx)(ge,{animated:!0,width:(d===0?0:d/u*100)+`%`})})}try{for(let e of s){let t=e.from.split(`/`),n=t.shift(),i=t.join(`/`),a=e.to.split(`/`),s=a.shift(),c=a.join(`/`),l=await Jn({...r,file:i,project:n,encoding:`base64`});if(o||(f(),await Le({...r,file:c,project:s,encoding:`base64`,payload:l.message}),o)||(f(),await Ee({...r,file:i,project:n}),o))break;f()}}catch(t){return P.error(`Rename Failed`,{id:l.id,description:t instanceof Error?t.message:`An unexpected error occurred while renaming.`,duration:1e4,action:{label:`OK`,onClick:()=>void 0}}),e(),!1}return d>=u?P.success(`Renamed ${i(s.length,`File`,`Files`)}`,{id:l.id,description:`All done!`,duration:3e3,action:{label:`OK`,onClick:()=>{}}}):P.warning(`Rename Cancelled`,{id:l.id,description:`${d} of ${u} steps completed.`,duration:1e4,action:{label:`OK`,onClick:()=>{}}}),e(),n(e=>{let t=e.slice();for(let e of s){let n=t.indexOf(e.from);n>=0?t.splice(n,1,e.to):t.push(e.to)}return t}),t(e=>{for(let t of s)if(e===t.from)return t.to;return e}),d>=u},[r,e,t,n])}var ai;function oi(e){ai=e}function si(e){return e.files.length>0||e.directories.length>0?ai?new Promise(t=>ai(e,t)):Promise.resolve(!1):Promise.resolve(!0)}function ci(e,t){return e[t]!==void 0}function li(e){return t=>ci(t,e)}var ui={handleGlobal(e,t){if((t.cmd||t.ctrl)&&e===`Delete`)return R(`ShowDeleteDirectoryOrFileModal`,!0),!0},addEditorAction(e){return{id:`delete-file`,label:`Delete File`,keybindings:[e.KeyMod.CtrlCmd|e.KeyCode.Delete],run:et(`ShowDeleteDirectoryOrFileModal`,!0)}}},di={handleGlobal(e,t){if(t.ctrl&&t.alt&&t.shift&&e===`˜`)return R(`ShowAddDirectoryOrFileModalType`,`directory`),!0},addEditorAction(e){return{id:`new-directory`,label:`New Directory`,keybindings:[e.KeyMod.WinCtrl|e.KeyMod.Alt|e.KeyMod.Shift|e.KeyCode.KeyN],run:et(`ShowAddDirectoryOrFileModalType`,`directory`)}}},fi={handleGlobal(e,t){if(t.ctrl&&e===`n`)return R(`ShowAddDirectoryOrFileModalType`,`file`),!0},addEditorAction(e){return{id:`new-file`,label:`New File`,keybindings:[e.KeyMod.WinCtrl|e.KeyCode.KeyN],run:et(`ShowAddDirectoryOrFileModalType`,`file`)}}},pi;function mi(e){pi=e}function hi(){pi?.()}var gi=[ui,di,fi,{handleGlobal(e){if(e===`F2`)return R(`ShowRenameFileModal`,`file`),!0},addEditorAction(e){return{id:`rename-file`,label:`Rename File`,keybindings:[e.KeyMod.WinCtrl|e.KeyMod.Alt|e.KeyCode.KeyR,e.KeyCode.F2],run:et(`ShowRenameFileModal`,!0)}}},{addEditorAction(){return{id:`revert-file`,label:`Revert File`,run:Ct(`RevertChanges`,!0)}}},{handleGlobal(e,t){if(t.cmd&&e===`s`)return Et(`SaveFile`,!0),!0},addEditorAction(e){return{id:`save-file`,label:`Save Changes`,keybindings:[e.KeyMod.CtrlCmd|e.KeyCode.KeyS],run:Ct(`SaveFile`,!0)}}}],_i=gi.filter(li(`addEditorAction`)),vi=gi.filter(li(`handleGlobal`));function yi(e){let[t,n]=e,r=_i.map(e=>t.addAction(e.addEditorAction(n)));return()=>{for(let e of r)e?.dispose()}}function bi(){(0,B.useEffect)(()=>(document.addEventListener(`keydown`,xi),()=>{document.removeEventListener(`keydown`,xi)}),[])}function xi(e){let t={cmd:e.getModifierState(`Meta`),alt:e.getModifierState(`Alt`),shift:e.getModifierState(`Shift`),ctrl:e.getModifierState(`Control`)};for(let n of vi)if(n.handleGlobal(e.key,t)){hi(),e.preventDefault();return}}function Si(e){return e.split(`/`).pop()}function Ci(){let[e,t]=(0,B.useState)(!1),[n,r]=(0,B.useState)(void 0),i=(0,B.useCallback)(e=>{if(!e.dataTransfer?.types?.includes(`Files`))return;let n=e.target instanceof Element?e.target:null,i=n?.closest(`.rct-tree-item-button-isFolder`)??n?.closest(`.rct-tree-item-title-container`)?.querySelector(`:scope > .rct-tree-item-button-isFolder`)??null;if(i){let e=i.getAttribute(`data-rct-item-id`);!i.querySelector(`.packageIsLocked`)&&e&&e!==`importedApplications`&&e!==`newApplication`&&r(e=>e===i?e:(e?.classList?.remove?.(`rct-tree-item-title-container-dragging-over`),i.classList.add(`rct-tree-item-title-container-dragging-over`),i))}t(!0)},[]),a=(0,B.useCallback)(()=>{t(!1),r(e=>{e&&e.classList.remove(`rct-tree-item-title-container-dragging-over`)})},[]),o=(0,B.useCallback)(e=>{if(!e.dataTransfer?.types?.includes(`Files`)||e.detail===1337)return;t(!1),n&&(n.classList.remove(`rct-tree-item-title-container-dragging-over`),r(void 0));let i=document.getElementById(`dropTarget`);return i?i.dispatchEvent(new DragEvent(`drop`,{bubbles:!0,detail:1337,cancelable:!0,dataTransfer:e.dataTransfer})):!1},[n]);return(0,B.useEffect)(()=>(document.addEventListener(`dragenter`,i),document.addEventListener(`dragover`,i),document.addEventListener(`dragleave`,a),document.addEventListener(`drop`,o),()=>{document.removeEventListener(`dragenter`,i),document.removeEventListener(`dragover`,i),document.removeEventListener(`dragleave`,a),document.removeEventListener(`drop`,o)}),[i,o,a]),(0,B.useMemo)(()=>({dragging:e,dragTarget:n}),[e,n])}function wi(e){return new Promise((t,n)=>{let r=new FileReader;r.onabort=n,r.onerror=n,r.onload=t,r.readAsDataURL(e)})}var Ti=new Map([[`avif`,`image/avif`],[`bmp`,`image/bmp`],[`css`,`text/css`],[`csv`,`text/csv`],[`doc`,`application/msword`],[`docx`,`application/vnd.openxmlformats-officedocument.wordprocessingml.document`],[`gif`,`image/gif`],[`gz`,`application/gzip`],[`htm`,`text/html`],[`html`,`text/html`],[`ico`,`image/x-icon`],[`jpeg`,`image/jpeg`],[`jpg`,`image/jpeg`],[`js`,`application/javascript`],[`json`,`application/json`],[`md`,`text/markdown`],[`mjs`,`application/javascript`],[`mp3`,`audio/mpeg`],[`mp4`,`video/mp4`],[`ogg`,`audio/ogg`],[`pdf`,`application/pdf`],[`png`,`image/png`],[`ppt`,`application/powerpoint`],[`pptx`,`application/vnd.openxmlformats-officedocument.presentationml.presentation`],[`svg`,`image/svg+xml`],[`tif`,`image/tiff`],[`tiff`,`image/tiff`],[`txt`,`text/plain`],[`wasm`,`application/wasm`],[`wav`,`audio/x-wav`],[`weba`,`audio/webm`],[`webm`,`video/webm`],[`webp`,`image/webp`],[`xls`,`application/vnd.ms-excel`],[`xlsx`,`application/vnd.openxmlformats-officedocument.spreadsheetml.sheet`],[`xml`,`application/xml`],[`zip`,`application/zip`]]),Ei=class extends Error{constructor(e){super(`DataTransferItem is not a file`),this.item=e,this.name=`UnexpectedObjectError`}};function Di(e,t,n){let r=e,{webkitRelativePath:i}=e,a=typeof t==`string`?t:typeof i==`string`&&i.length>0?i:`./${e.name}`;return typeof r.path!=`string`&&ki(r,`path`,a),n!==void 0&&Object.defineProperty(r,"handle",{value:n,writable:!1,configurable:!1,enumerable:!0}),ki(r,`relativePath`,a),r}function Oi(e,t=Ti){let{name:n}=e;if(n&&n.lastIndexOf(`.`)!==-1&&!e.type){let r=n.split(`.`).pop().toLowerCase(),i=t.get(r);i&&Object.defineProperty(e,"type",{value:i,writable:!1,configurable:!1,enumerable:!0})}return e}function ki(e,t,n){Object.defineProperty(e,t,{value:n,writable:!1,configurable:!1,enumerable:!0})}var Ai=[`.DS_Store`,`Thumbs.db`];async function ji(e,{mimeTypes:t=Ti}={}){return(await Mi(e)).map(e=>e instanceof File?Oi(e,t):e)}async function Mi(e){return Fi(e)&&Ni(e.dataTransfer)?Ri(e.dataTransfer,e.type):Pi(e)?Ii(e):Array.isArray(e)&&e.every(e=>`getFile`in e&&typeof e.getFile==`function`)?Li(e):[]}function Ni(e){return Fi(e)}function Pi(e){return Fi(e)&&Fi(e.target)}function Fi(e){return typeof e==`object`&&!!e}function Ii(e){return Bi(e.target.files).map(e=>Di(e))}async function Li(e){return(await Promise.all(e.map(e=>e.getFile()))).map(e=>Di(e))}async function Ri(e,t){let n=Bi(e.items).filter(e=>e.kind===`file`);return t===`drop`?zi(Hi(await Promise.all(n.map(Vi)))):n}function zi(e){return e.filter(e=>Ai.indexOf(e.name)===-1)}function Bi(e){return e===null?[]:Array.from(e)}async function Vi(e){if(typeof e.webkitGetAsEntry!=`function`)return Ui(e);let t=e.webkitGetAsEntry();if(t?.isDirectory){let n=await Wi(e);return n?.kind===`directory`?Gi(n,`/${n.name}`):qi(t)}return Ui(e,t)}function Hi(e){let t=[];for(let n of e)Array.isArray(n)?t.push(...Hi(n)):t.push(n);return t}async function Ui(e,t){let n=e.getAsFile(),r=await Wi(e);if(r!=null){let e=n??await r.getFile();return e.handle=r,Di(e)}if(!n)throw new Ei(e);return Di(n,t?.fullPath??void 0)}async function Wi(e){if(globalThis.isSecureContext&&typeof e.getAsFileSystemHandle==`function`)return e.getAsFileSystemHandle()}async function Gi(e,t){let n=[];for await(let r of e.values()){let e=`${t}/${r.name}`;if(r.kind===`directory`)n.push(...await Gi(r,e));else{let t=await r.getFile();n.push(Di(t,e,r))}}return n}async function Ki(e){return e.isDirectory?qi(e):Ji(e)}function qi(e){let t=e.createReader();return new Promise((e,n)=>{let r=[];function i(){t.readEntries(async t=>{if(t.length){let e=Promise.all(t.map(Ki));r.push(e),i()}else try{e(await Promise.all(r))}catch(e){n(e)}},e=>{n(e)})}i()})}async function Ji(e){return new Promise((t,n)=>{e.file(n=>{t(Di(n,e.fullPath))},e=>{n(e)})})}var Yi=e(n((e=>{e.__esModule=!0,e.default=function(e,t){if(e&&t){var n=Array.isArray(t)?t:t.split(`,`);if(n.length===0)return!0;var r=e.name||``,i=(e.type||``).toLowerCase(),a=i.replace(/\/.*$/,``);return n.some(function(e){var t=e.trim().toLowerCase();return t.charAt(0)===`.`?r.toLowerCase().endsWith(t):t.endsWith(`/*`)?a===t.replace(/\/.*$/,``):i===t})}return!0}}))(),1),Xi=typeof Yi.default==`function`?Yi.default:Yi.default.default,Zi=`file-invalid-type`,Qi=`file-too-large`,$i=`file-too-small`,ea=`too-many-files`;function ta(e=``){let t=e.split(`,`);return{code:Zi,message:`File type must be ${t.length>1?`one of ${t.join(`, `)}`:t[0]}`}}var na=[`KB`,`MB`,`GB`,`TB`,`PB`];function ra(e){if(e<1024)return`${e} ${e===1?`byte`:`bytes`}`;let t=e/1024,n=0;for(;t>=1024&&n<na.length-1;)t/=1024,n++;return`${Number(t.toFixed(2))} ${na[n]}`}function ia(e){return{code:Qi,message:`File is larger than ${ra(e)}`}}function aa(e){return{code:$i,message:`File is smaller than ${ra(e)}`}}var oa={code:ea,message:`Too many files`};function sa(e){return e.type===``&&typeof e.getAsFile==`function`}function ca(e,t){let n=e.type===`application/x-moz-file`||Xi(e,t??``)||sa(e);return[n,n?null:ta(t)]}function la(e,t,n){if(ua(e.size)){if(ua(t)&&ua(n)){if(e.size>n)return[!1,ia(n)];if(e.size<t)return[!1,aa(t)]}else if(ua(t)&&e.size<t)return[!1,aa(t)];else if(ua(n)&&e.size>n)return[!1,ia(n)]}return[!0,null]}function ua(e){return e!=null}function da(e){return e!=null&&typeof e.then==`function`}function fa({files:e,accept:t,minSize:n,maxSize:r,multiple:i,maxFiles:a=0,validator:o}){return!i&&e.length>1||i&&a>=1&&e.length>a||e.some(e=>{let[i]=ca(e,t),[a]=la(e,n,r);return!i||!a})?`reject`:o?`unknown`:`accept`}function pa(e){return typeof e.isPropagationStopped==`function`?e.isPropagationStopped():e.cancelBubble!==void 0&&e.cancelBubble}function ma(e){return e.dataTransfer?Array.prototype.some.call(e.dataTransfer.types,e=>e===`Files`||e===`application/x-moz-file`)||Array.prototype.some.call(e.dataTransfer.items??[],ha):!!e.target&&!!e.target.files}function ha(e){return typeof e==`object`&&!!e&&e.kind===`file`}function ga(e){e.preventDefault()}function _a(e){return e.indexOf(`MSIE`)!==-1||e.indexOf(`Trident/`)!==-1}function va(e){return e.indexOf(`Edge/`)!==-1}function ya(e=window.navigator.userAgent){return _a(e)||va(e)}function ba(...e){return(t,...n)=>e.some(e=>(!pa(t)&&e&&e(t,...n),pa(t)))}function xa(){return`showOpenFilePicker`in window}function Sa(e){if(ua(e))return[{description:`Files`,accept:Object.entries(e).filter(([e,t])=>{let n=!0;return Da(e)||(console.warn(`Skipped "${e}" because it is not a valid MIME type. Check https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types for a list of valid MIME types.`),n=!1),(!Array.isArray(t)||!t.every(ka))&&(console.warn(`Skipped "${e}" because an invalid file extension was provided.`),n=!1),n}).reduce((e,[t,n])=>(e[t]=n,e),{})}]}function Ca(e,{omitWildcardMimeTypesWithExtensions:t=!1}={}){if(ua(e))return Object.entries(e).reduce((e,[n,r])=>(t&&Oa(n)&&r.some(ka)?e.push(...r):e.push(n,...r),e),[]).filter(e=>Da(e)||ka(e)).join(`,`)}function wa(e){return e instanceof DOMException&&(e.name===`AbortError`||e.code===e.ABORT_ERR)}function Ta(e){return e instanceof DOMException&&(e.name===`SecurityError`||e.code===e.SECURITY_ERR)}function Ea(e){return e instanceof DOMException&&e.name===`NotAllowedError`}function Da(e){return e===`audio/*`||e===`video/*`||e===`image/*`||e===`text/*`||e===`application/*`||/\w+\/[-+.\w]+/g.test(e)}function Oa(e){return e.endsWith(`/*`)}function ka(e){return/^.*\.[\w]+$/.test(e)}var Aa=(0,B.forwardRef)(({children:e,...t},n)=>{let{open:r,...i}=Ma(t);return(0,B.useImperativeHandle)(n,()=>({open:r}),[r]),(0,H.jsx)(H.Fragment,{children:e?.({...i,open:r})})});Aa.displayName=`Dropzone`;var ja={isFocused:!1,isFileDialogActive:!1,isDragActive:!1,isDragAccept:!1,isDragReject:!1,isDragUnknown:!1,isDragGlobal:!1,isProcessing:!1,acceptedFiles:[],fileRejections:[]};function Ma(e={}){let{accept:t,disabled:n=!1,getFilesFromEvent:r=ji,maxSize:i=1/0,minSize:a=0,multiple:o=!0,maxFiles:s=0,onDragEnter:c,onDragLeave:l,onDragOver:u,onDrop:d,onDropAccepted:f,onDropRejected:p,onFileDialogCancel:m,onFileDialogOpen:h,useFsAccessApi:g=!1,autoFocus:_=!1,preventDropOnDocument:v=!0,noClick:y=!1,noKeyboard:b=!1,noDrag:x=!1,noDragEventsBubbling:S=!1,onError:C,validator:w,getErrorMessage:T}=e,E=(0,B.useMemo)(()=>Ca(t),[t]),D=(0,B.useMemo)(()=>Ca(t,{omitWildcardMimeTypesWithExtensions:!0}),[t]),O=(0,B.useMemo)(()=>Sa(t),[t]),k=(0,B.useMemo)(()=>typeof h==`function`?h:Pa,[h]),A=(0,B.useMemo)(()=>typeof m==`function`?m:Pa,[m]),j=(0,B.useRef)(null),M=(0,B.useRef)(null),[N,P]=(0,B.useReducer)(Na,ja),{isFocused:ee,isFileDialogActive:F}=N,I=(0,B.useRef)(F);I.current=F;let te=(0,B.useRef)(null),ne=(0,B.useCallback)(()=>{te.current?.abort();let e=new AbortController;return te.current=e,P({type:`setProcessing`,isProcessing:!0}),e.signal},[]),re=(0,B.useCallback)(e=>{e.aborted||P({type:`setProcessing`,isProcessing:!1})},[]),L=(0,B.useRef)(typeof window<`u`&&window.isSecureContext&&g&&xa()),ie=()=>{!L.current&&F&&setTimeout(()=>{if(M.current){let{files:e}=M.current;e?.length||(P({type:`closeDialog`}),A())}},300)};(0,B.useEffect)(()=>(window.addEventListener(`focus`,ie,!1),()=>{window.removeEventListener(`focus`,ie,!1)}),[M,F,A,L]);let ae=(0,B.useRef)([]),oe=(0,B.useRef)([]),se=e=>{j.current&&e.target&&j.current.contains(e.target)&&e.defaultPrevented||(e.preventDefault(),ae.current=[])};(0,B.useEffect)(()=>(v&&(document.addEventListener(`dragover`,ga,!1),document.addEventListener(`drop`,se,!1)),()=>{v&&(document.removeEventListener(`dragover`,ga),document.removeEventListener(`drop`,se))}),[j,v]),(0,B.useEffect)(()=>{let e=e=>{e.target&&(oe.current=[...oe.current,e.target]),ma(e)&&P({isDragGlobal:!0,type:`setDragGlobal`})},t=e=>{oe.current=oe.current.filter(t=>t!==e.target&&t!==null),!(oe.current.length>0)&&P({isDragGlobal:!1,type:`setDragGlobal`})},n=()=>{oe.current=[],P({isDragGlobal:!1,type:`setDragGlobal`})},r=()=>{oe.current=[],P({isDragGlobal:!1,type:`setDragGlobal`})};return document.addEventListener(`dragenter`,e,!1),document.addEventListener(`dragleave`,t,!1),document.addEventListener(`dragend`,n,!1),document.addEventListener(`drop`,r,!1),()=>{document.removeEventListener(`dragenter`,e),document.removeEventListener(`dragleave`,t),document.removeEventListener(`dragend`,n),document.removeEventListener(`drop`,r)}},[j]),(0,B.useEffect)(()=>(!n&&_&&j.current&&j.current.focus(),()=>{}),[j,_,n]);let ce=(0,B.useCallback)(e=>{C?C(e):console.error(e)},[C]),le=(0,B.useCallback)(e=>{e.preventDefault(),e.persist?.(),Se(e),!I.current&&(ae.current=[...ae.current,e.target],ma(e)&&Promise.resolve(r(e)).then(t=>{if(pa(e)&&!S)return;let n=t.length>0?fa({files:t,accept:E,minSize:a,maxSize:i,multiple:o,maxFiles:s,validator:w}):null;P({isDragAccept:n===`accept`,isDragReject:n===`reject`,isDragUnknown:n===`unknown`,isDragActive:!0,type:`setDraggedFiles`}),c&&c(e)}).catch(e=>ce(e)))},[r,c,ce,S,E,a,i,o,s,w]),ue=(0,B.useCallback)(e=>{if(e.preventDefault(),e.persist?.(),Se(e),I.current)return!1;let t=ma(e);if(t&&e.dataTransfer)try{e.dataTransfer.dropEffect=`copy`}catch{}return t&&u&&u(e),!1},[u,S]),de=(0,B.useCallback)(e=>{e.preventDefault(),e.persist?.(),Se(e);let t=ae.current.filter(e=>j.current?.contains(e)),n=t.indexOf(e.target);n!==-1&&t.splice(n,1),ae.current=t,!(t.length>0)&&(P({type:`setDraggedFiles`,isDragActive:!1,isDragAccept:!1,isDragReject:!1,isDragUnknown:!1}),ma(e)&&l&&l(e))},[j,l,S]),fe=(0,B.useCallback)(async(e,t,n)=>{let r=(e,t)=>T?{...e,message:T(e,t)}:e,c=e=>{let n=[],i=[];e.forEach(({file:e,accepted:t,acceptError:a,sizeMatch:o,sizeError:s,customErrors:c})=>{if(t&&o&&!c)n.push(e);else{let t=[a,s];c&&(t=t.concat(c)),i.push({file:e,errors:t.filter(e=>e!=null).map(t=>r(t,e))})}});let a=o?s>=1?s:1/0:1;n.length>a&&n.splice(a).forEach(e=>{i.push({file:e,errors:[r(oa,e)]})}),P({acceptedFiles:n,fileRejections:i,type:`setFiles`}),d&&d(n,i,t),i.length>0&&p&&p(i,t),n.length>0&&f&&f(n,t)},l=e.map(e=>{let[t,n]=ca(e,D),[r,o]=la(e,a,i);return{file:e,accepted:t,acceptError:n,sizeMatch:r,sizeError:o,customErrors:w?w(e):null}});if(!l.some(({customErrors:e})=>da(e))){c(l);return}let u;try{u=await Promise.all(l.map(async({customErrors:e,...t})=>({...t,customErrors:await e})))}catch(e){n.aborted||(re(n),ce(e));return}n.aborted||c(u)},[P,o,D,a,i,s,d,f,p,w,T,ce,re]),pe=(0,B.useCallback)(e=>{if(e.preventDefault(),e.persist?.(),Se(e),ae.current=[],!(I.current&&e.dataTransfer)&&(P({type:`reset`}),ma(e))){let t=ne();Promise.resolve(r(e)).then(n=>{if(!t.aborted){if(pa(e)&&!S){re(t);return}return fe(n,e,t)}}).catch(e=>{t.aborted||(re(t),ce(e))})}},[r,fe,ce,S,ne,re]),me=(0,B.useCallback)(()=>{if(L.current){P({type:`openDialog`}),k();let e={multiple:o,types:O},t;window.showOpenFilePicker(e).then(e=>(t=ne(),r(e))).then(e=>{if(P({type:`closeDialog`}),!t.aborted)return fe(e,null,t)}).catch(e=>{t&&re(t),wa(e)?(A(e),P({type:`closeDialog`})):Ta(e)||Ea(e)?(L.current=!1,M.current?(M.current.value=``,M.current.click()):ce(Error(`Cannot open the file picker because the https://developer.mozilla.org/en-US/docs/Web/API/File_System_Access_API is not supported and no <input> was provided.`))):ce(e)});return}M.current&&(P({type:`openDialog`}),k(),M.current.value=``,M.current.click())},[P,k,A,g,fe,ce,O,o,ne,re]),he=(0,B.useCallback)(e=>{j.current?.isEqualNode(e.target)&&(e.key===` `||e.key===`Enter`||e.keyCode===32||e.keyCode===13)&&(e.preventDefault(),me())},[j,me]),ge=(0,B.useCallback)(()=>{P({type:`focus`})},[]),_e=(0,B.useCallback)(()=>{P({type:`blur`})},[]),ve=(0,B.useCallback)(()=>{y||(ya()?setTimeout(me,0):me())},[y,me]),ye=e=>n?null:e,be=e=>b?null:ye(e),xe=e=>x?null:ye(e),Se=e=>{S&&e.stopPropagation()},Ce=(0,B.useMemo)(()=>({refKey:e=`ref`,role:t,onKeyDown:r,onFocus:i,onBlur:a,onClick:o,onDragEnter:s,onDragOver:c,onDragLeave:l,onDrop:u,...d}={})=>({onKeyDown:be(ba(r,he)),onFocus:be(ba(i,ge)),onBlur:be(ba(a,_e)),onClick:ye(ba(o,ve)),onDragEnter:xe(ba(s,le)),onDragOver:xe(ba(c,ue)),onDragLeave:xe(ba(l,de)),onDrop:xe(ba(u,pe)),role:typeof t==`string`&&t!==``?t:`presentation`,[e]:j,...!n&&!b?{tabIndex:0}:{},...n?{"aria-disabled":!0}:{},...d}),[j,he,ge,_e,ve,le,ue,de,pe,b,x,n]),we=(0,B.useCallback)(e=>{e.stopPropagation()},[]),Te=(0,B.useMemo)(()=>({refKey:e=`ref`,onChange:t,onClick:n,...r}={})=>({accept:D,multiple:o,type:`file`,"aria-label":`file upload`,style:{border:0,display:`block`,height:0,margin:0,opacity:0,overflow:`hidden`,padding:0,width:0},onChange:ye(ba(t,pe)),onClick:ye(ba(n,we)),tabIndex:-1,[e]:M,...r}),[M,t,o,pe,n]);return{...N,isFocused:ee&&!n,getRootProps:Ce,getInputProps:Te,rootRef:j,inputRef:M,open:ye(me)}}function Na(e,t){switch(t.type){case`focus`:return{...e,isFocused:!0};case`blur`:return{...e,isFocused:!1};case`openDialog`:return{...ja,isFileDialogActive:!0};case`closeDialog`:return{...e,isFileDialogActive:!1};case`setDraggedFiles`:return{...e,isDragActive:t.isDragActive,isDragAccept:t.isDragAccept,isDragReject:t.isDragReject,isDragUnknown:t.isDragUnknown};case`setProcessing`:return{...e,isProcessing:t.isProcessing};case`setFiles`:return{...e,acceptedFiles:t.acceptedFiles,fileRejections:t.fileRejections,isProcessing:!1,isDragReject:!1,isDragUnknown:!1};case`setDragGlobal`:return{...e,isDragGlobal:t.isDragGlobal};case`reset`:return{...ja};default:return e}}function Pa(){}function Fa(){let[e,t]=(0,B.useState)(``),{clusterId:n}=x({strict:!1}),{openedEntry:r,restrictPackageModification:c,reloadRootEntries:u,entryExists:d}=V(),f=!!r&&!r.package&&!c,p=Ve(),{dragging:m,dragTarget:h}=Ci(),g=(h?.getAttribute?.(`data-rct-item-id`))?.split?.(`/`)?.pop?.(),_=r?.project,v=!1,y;if(r?.path){let e=r.path.split(`/`),t=z(r);v=f&&(t?e.slice(1):e.slice(1,-1)).join(`/`),y=e[e.length-(t?1:2)]}let b=(0,B.useCallback)(async(e,n)=>{let r=e,a=h?.getAttribute?.(`data-rct-item-id`)?.split?.(`/`),o=a?.length?a[0]:f?_:!1,s=a?.length?a.slice(1).join(`/`):f?v:!1;if(o===!1||o===void 0||s===!1||s===void 0)return;let c=[],l=n.slice(),m=[];for(let e of r){let t=Ia(s,e);e.name.startsWith(`.`)||e.relativePath?.includes(`/.`)?l.push({file:e,errors:[{message:`Sensitive files and folders starting with . are skipped.`,code:`dot-ignored`}]}):d(`${o}/${t}`)?m.push({file:e,path:`${o}/${t}`}):c.push(e)}if(m.length>0){let e=await si({files:m.map(e=>e.path),directories:[]});for(let t of m)e?c.push(t.file):l.push({file:t.file,errors:[{message:`${Ia(s,t.file)} already exists`,code:`duplicate`}]})}let g=!1,y=`uploading-files`,b={label:`Cancel`,onClick:()=>{g=!0}},x={label:`OK`,onClick:()=>void 0};t(`Uploading ${i(c.length,`file`,`files`)}...`);try{let e=c.reduce((e,t)=>e+t.size,0),t=0,n=0;for(let r of c){n+=1,P.loading(`Upload in progress...`,{id:y,descriptionClassName:`whitespace-pre-line`,description:`${n} of ${i(c.length,`file`,`files`)}
2
+ import{a as e,r as t,t as n}from"./rolldown-runtime-CNC7AqOf.js";import{d as r,f as i,g as a,h as o,n as s,t as c}from"./authStore-CNoNfv0F.js";import{A as l,b as u,d,l as f,m as p,n as m,r as h,v as g}from"./vendor-core-xUefYpUO.js";import{n as _,r as v,t as y}from"./button-oQgW4t1x.js";import{A as b,C as x,I as S,N as C,S as w,b as T,v as E,x as D,y as O}from"./vendor-tanstack-0SjDjtT0.js";import{a as k,i as A}from"./vendor-datadog-DyjkTkvg.js";import{r as j}from"./vendor-react-DeL8Gtgl.js";import{a as M}from"./useAuth-DvlnspkA.js";import{$ as N,Rt as P,it as ee}from"./vendor-ui-Bj22lHGK.js";import{a as F,i as I,n as te,r as ne,t as re}from"./card-BHplR9Xd.js";import{t as L}from"./createLucideIcon-BDx8noBh.js";import{c as ie,d as ae,f as oe,i as se,l as ce,n as le,o as ue,p as de,s as fe,t as pe,u as me}from"./select-y6NKMkG_.js";import{a as he,n as ge}from"./getRegistrationInfo-BOLlgqXr.js";import{l as _e}from"./textarea-DhLMZ3PA.js";import{i as ve,r as ye,t as be}from"./x-C3uc0qMD.js";import{a as xe,i as Se,n as Ce,r as we,t as Te}from"./tabs-CxZ4MxTw.js";import{c as Ee,d as De,f as Oe,g as ke,h as Ae,i as je,l as Me,m as Ne,n as Pe,o as Fe,r as Ie,t as Le}from"./setComponentFile-SEtBt_GV.js";import{t as Re}from"./queryClient-CbA8wM7J.js";import{n as ze}from"./setLocalStorage-CD_L8p_D.js";import{t as Be}from"./useLocalStorage-hkNSGGg8.js";import{o as Ve,r as He,s as Ue}from"./pollUnlessForbidden-HHdQZW1N.js";import{f as We,i as Ge,p as Ke,r as qe}from"./editor.api-OBQnf1nL.js";import{$ as Je,$n as Ye,$t as Xe,A as Ze,An as Qe,At as $e,B as et,C as tt,Ct as nt,D as rt,E as it,F as at,Fn as ot,Ft as st,G as ct,Gt as lt,H as ut,Hn as dt,Ht as ft,In as pt,J as mt,Jn as ht,Jt as gt,Kn as _t,Kt as vt,Ln as yt,Lt as bt,M as xt,Mn as St,Mt as Ct,N as wt,Nn as Tt,Nt as Et,O as Dt,On as Ot,P as kt,Pn as At,Pt as jt,Q as Mt,Qn as Nt,Qt as Pt,Rn as Ft,Rt as It,S as Lt,St as Rt,T as zt,Tt as Bt,U as Vt,V as R,Vn as Ht,Vt as Ut,W as Wt,Wn as Gt,Wt as Kt,X as qt,Xn as Jt,Xt as Yt,Y as Xt,Yn as Zt,Yt as Qt,Z as $t,Zn as en,Zt as tn,_ as nn,an as rn,at as z,b as an,bt as on,cn as sn,cr as cn,d as ln,dt as un,en as dn,er as fn,et as pn,f as mn,g as hn,gt as gn,h as _n,hn as vn,ht as yn,in as bn,ir as xn,it as Sn,j as Cn,jn as wn,k as Tn,l as En,ln as Dn,lr as On,m as kn,mn as An,mt as jn,nt as Mn,on as Nn,or as Pn,p as Fn,pn as In,pt as Ln,qn as Rn,qt as zn,rn as Bn,rt as Vn,sn as Hn,sr as Un,st as Wn,tn as Gn,tr as Kn,tt as qn,u as Jn,un as Yn,ur as Xn,ut as Zn,v as Qn,vt as $n,w as er,wt as tr,x as nr,xt as rr,y as ir,yt as ar,z as or,zt as sr}from"./index-Dy3uDGXb.js";import{a as cr,c as lr,i as ur,n as dr,o as fr,r as pr,s as mr,t as hr}from"./alertDialog-DSs2KlnR.js";import{t as gr}from"./useEntityRestURL-CGRGc1n7.js";import"./editor-DK9rdQRE.js";var _r=L(`arrow-down-a-z`,[[`path`,{d:`m3 16 4 4 4-4`,key:`1co6wj`}],[`path`,{d:`M7 20V4`,key:`1yoxec`}],[`path`,{d:`M20 8h-5`,key:`1vsyxs`}],[`path`,{d:`M15 10V6.5a2.5 2.5 0 0 1 5 0V10`,key:`ag13bf`}],[`path`,{d:`M15 14h5l-5 6h5`,key:`ur5jdg`}]]),vr=L(`arrow-up-a-z`,[[`path`,{d:`m3 8 4-4 4 4`,key:`11wl7u`}],[`path`,{d:`M7 4v16`,key:`1glfcx`}],[`path`,{d:`M20 8h-5`,key:`1vsyxs`}],[`path`,{d:`M15 10V6.5a2.5 2.5 0 0 1 5 0V10`,key:`ag13bf`}],[`path`,{d:`M15 14h5l-5 6h5`,key:`ur5jdg`}]]),yr=L(`boxes`,[[`path`,{d:`M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z`,key:`lc1i9w`}],[`path`,{d:`m7 16.5-4.74-2.85`,key:`1o9zyk`}],[`path`,{d:`m7 16.5 5-3`,key:`va8pkn`}],[`path`,{d:`M7 16.5v5.17`,key:`jnp8gn`}],[`path`,{d:`M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z`,key:`8zsnat`}],[`path`,{d:`m17 16.5-5-3`,key:`8arw3v`}],[`path`,{d:`m17 16.5 4.74-2.85`,key:`8rfmw`}],[`path`,{d:`M17 16.5v5.17`,key:`k6z78m`}],[`path`,{d:`M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z`,key:`1xygjf`}],[`path`,{d:`M12 8 7.26 5.15`,key:`1vbdud`}],[`path`,{d:`m12 8 4.74-2.85`,key:`3rx089`}],[`path`,{d:`M12 13.5V8`,key:`1io7kd`}]]),br=L(`case-lower`,[[`path`,{d:`M10 9v7`,key:`ylp826`}],[`path`,{d:`M14 6v10`,key:`1jy4vg`}],[`circle`,{cx:`17.5`,cy:`12.5`,r:`3.5`,key:`1a9481`}],[`circle`,{cx:`6.5`,cy:`12.5`,r:`3.5`,key:`2jlv1r`}]]),xr=L(`case-sensitive`,[[`path`,{d:`m2 16 4.039-9.69a.5.5 0 0 1 .923 0L11 16`,key:`d5nyq2`}],[`path`,{d:`M22 9v7`,key:`pvm9v3`}],[`path`,{d:`M3.304 13h6.392`,key:`1q3zxz`}],[`circle`,{cx:`18.5`,cy:`12.5`,r:`3.5`,key:`z97x68`}]]),Sr=L(`case-upper`,[[`path`,{d:`M15 11h4.5a1 1 0 0 1 0 5h-4a.5.5 0 0 1-.5-.5v-9a.5.5 0 0 1 .5-.5h3a1 1 0 0 1 0 5`,key:`nxs35`}],[`path`,{d:`m2 16 4.039-9.69a.5.5 0 0 1 .923 0L11 16`,key:`d5nyq2`}],[`path`,{d:`M3.304 13h6.392`,key:`1q3zxz`}]]),Cr=L(`code`,[[`path`,{d:`m16 18 6-6-6-6`,key:`eg8j8`}],[`path`,{d:`m8 6-6 6 6 6`,key:`ppft3o`}]]),wr=L(`command`,[[`path`,{d:`M15 6v12a3 3 0 1 0 3-3H6a3 3 0 1 0 3 3V6a3 3 0 1 0-3 3h12a3 3 0 1 0-3-3`,key:`11bfej`}]]),Tr=L(`eraser`,[[`path`,{d:`M21 21H8a2 2 0 0 1-1.42-.587l-3.994-3.999a2 2 0 0 1 0-2.828l10-10a2 2 0 0 1 2.829 0l5.999 6a2 2 0 0 1 0 2.828L12.834 21`,key:`g5wo59`}],[`path`,{d:`m5.082 11.09 8.828 8.828`,key:`1wx5vj`}]]),Er=L(`file-archive`,[[`path`,{d:`M13.659 22H18a2 2 0 0 0 2-2V8a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 14 2H6a2 2 0 0 0-2 2v11.5`,key:`4pqfef`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M8 12v-1`,key:`1ej8lb`}],[`path`,{d:`M8 18v-2`,key:`qcmpov`}],[`path`,{d:`M8 7V6`,key:`1nbb54`}],[`circle`,{cx:`8`,cy:`20`,r:`2`,key:`ckkr5m`}]]),Dr=L(`file-braces`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1`,key:`1oajmo`}],[`path`,{d:`M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1`,key:`mpwhp6`}]]),Or=L(`file-code-corner`,[[`path`,{d:`M4 12.15V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2h-3.35`,key:`1wthlu`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`m5 16-3 3 3 3`,key:`331omg`}],[`path`,{d:`m9 22 3-3-3-3`,key:`lsp7cz`}]]),kr=L(`file-image`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`circle`,{cx:`10`,cy:`12`,r:`2`,key:`737tya`}],[`path`,{d:`m20 17-1.296-1.296a2.41 2.41 0 0 0-3.408 0L9 22`,key:`wt3hpn`}]]),Ar=L(`file-key`,[[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M4 12v6`,key:`bg1pfk`}],[`path`,{d:`M4 14h2`,key:`1sf9f8`}],[`path`,{d:`M9.65 22H18a2 2 0 0 0 2-2V8a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 14 2H6a2 2 0 0 0-2 2v4`,key:`d56i0q`}],[`circle`,{cx:`4`,cy:`20`,r:`2`,key:`6kqj1y`}]]),jr=L(`file-plus`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M9 15h6`,key:`cctwl0`}],[`path`,{d:`M12 18v-6`,key:`17g6i2`}]]),Mr=L(`file-type`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M11 18h2`,key:`12mj7e`}],[`path`,{d:`M12 12v6`,key:`3ahymv`}],[`path`,{d:`M9 13v-.5a.5.5 0 0 1 .5-.5h5a.5.5 0 0 1 .5.5v.5`,key:`qbrxap`}]]),Nr=L(`fold-vertical`,[[`path`,{d:`M12 22v-6`,key:`6o8u61`}],[`path`,{d:`M12 8V2`,key:`1wkif3`}],[`path`,{d:`M4 12H2`,key:`rhcxmi`}],[`path`,{d:`M10 12H8`,key:`s88cx1`}],[`path`,{d:`M16 12h-2`,key:`10asgb`}],[`path`,{d:`M22 12h-2`,key:`14jgyd`}],[`path`,{d:`m15 19-3-3-3 3`,key:`e37ymu`}],[`path`,{d:`m15 5-3 3-3-3`,key:`19d6lf`}]]),Pr=L(`folder-input`,[[`path`,{d:`M2 9V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-1`,key:`fm4g5t`}],[`path`,{d:`M2 13h10`,key:`pgb2dq`}],[`path`,{d:`m9 16 3-3-3-3`,key:`6m91ic`}]]),Fr=L(`folder-open`,[[`path`,{d:`m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2`,key:`usdka0`}]]),Ir=L(`folder-plus`,[[`path`,{d:`M12 10v6`,key:`1bos4e`}],[`path`,{d:`M9 13h6`,key:`1uhe8q`}],[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}]]),Lr=L(`git-branch`,[[`path`,{d:`M15 6a9 9 0 0 0-9 9V3`,key:`1cii5b`}],[`circle`,{cx:`18`,cy:`6`,r:`3`,key:`1h7g24`}],[`circle`,{cx:`6`,cy:`18`,r:`3`,key:`fqmcym`}]]),Rr=L(`git-merge`,[[`circle`,{cx:`18`,cy:`18`,r:`3`,key:`1xkwt0`}],[`circle`,{cx:`6`,cy:`6`,r:`3`,key:`1lh9wr`}],[`path`,{d:`M6 21V9a9 9 0 0 0 9 9`,key:`7kw0sc`}]]),zr=L(`image`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`,key:`1m3agn`}],[`circle`,{cx:`9`,cy:`9`,r:`2`,key:`af1f0g`}],[`path`,{d:`m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21`,key:`1xmnt7`}]]),Br=L(`lightbulb`,[[`path`,{d:`M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5`,key:`1gvzjb`}],[`path`,{d:`M9 18h6`,key:`x1upvd`}],[`path`,{d:`M10 22h4`,key:`ceow96`}]]),Vr=L(`link`,[[`path`,{d:`M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71`,key:`1cjeqo`}],[`path`,{d:`M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71`,key:`19qd67`}]]),Hr=L(`list-ordered`,[[`path`,{d:`M11 5h10`,key:`1cz7ny`}],[`path`,{d:`M11 12h10`,key:`1438ji`}],[`path`,{d:`M11 19h10`,key:`11t30w`}],[`path`,{d:`M4 4h1v5`,key:`10yrso`}],[`path`,{d:`M4 9h2`,key:`r1h2o0`}],[`path`,{d:`M6.5 20H3.4c0-1 2.6-1.925 2.6-3.5a1.5 1.5 0 0 0-2.6-1.02`,key:`xtkcd5`}]]),Ur=L(`list-tree`,[[`path`,{d:`M8 5h13`,key:`1pao27`}],[`path`,{d:`M13 12h8`,key:`h98zly`}],[`path`,{d:`M13 19h8`,key:`c3s6r1`}],[`path`,{d:`M3 10a2 2 0 0 0 2 2h3`,key:`1npucw`}],[`path`,{d:`M3 5v12a2 2 0 0 0 2 2h3`,key:`x1gjn2`}]]),Wr=L(`message-square-text`,[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}],[`path`,{d:`M7 11h10`,key:`1twpyw`}],[`path`,{d:`M7 15h6`,key:`d9of3u`}],[`path`,{d:`M7 7h8`,key:`af5zfr`}]]),Gr=L(`message-square`,[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}]]),Kr=L(`mouse-pointer-click`,[[`path`,{d:`M14 4.1 12 6`,key:`ita8i4`}],[`path`,{d:`m5.1 8-2.9-.8`,key:`1go3kf`}],[`path`,{d:`m6 12-1.9 2`,key:`mnht97`}],[`path`,{d:`M7.2 2.2 8 5.1`,key:`1cfko1`}],[`path`,{d:`M9.037 9.69a.498.498 0 0 1 .653-.653l11 4.5a.5.5 0 0 1-.074.949l-4.349 1.041a1 1 0 0 0-.74.739l-1.04 4.35a.5.5 0 0 1-.95.074z`,key:`s0h3yz`}]]),qr=L(`package-open`,[[`path`,{d:`M12 22v-9`,key:`x3hkom`}],[`path`,{d:`M15.17 2.21a1.67 1.67 0 0 1 1.63 0L21 4.57a1.93 1.93 0 0 1 0 3.36L8.82 14.79a1.655 1.655 0 0 1-1.64 0L3 12.43a1.93 1.93 0 0 1 0-3.36z`,key:`2ntwy6`}],[`path`,{d:`M20 13v3.87a2.06 2.06 0 0 1-1.11 1.83l-6 3.08a1.93 1.93 0 0 1-1.78 0l-6-3.08A2.06 2.06 0 0 1 4 16.87V13`,key:`1pmm1c`}],[`path`,{d:`M21 12.43a1.93 1.93 0 0 0 0-3.36L8.83 2.2a1.64 1.64 0 0 0-1.63 0L3 4.57a1.93 1.93 0 0 0 0 3.36l12.18 6.86a1.636 1.636 0 0 0 1.63 0z`,key:`12ttoo`}]]),Jr=L(`panel-right-close`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M15 3v18`,key:`14nvp0`}],[`path`,{d:`m8 9 3 3-3 3`,key:`12hl5m`}]]),Yr=L(`panel-right-open`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M15 3v18`,key:`14nvp0`}],[`path`,{d:`m10 15-3-3 3-3`,key:`1pgupc`}]]),Xr=L(`panel-top`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M3 9h18`,key:`1pudct`}]]),Zr=L(`replace`,[[`path`,{d:`M14 4a1 1 0 0 1 1-1`,key:`dhj8ez`}],[`path`,{d:`M15 10a1 1 0 0 1-1-1`,key:`1mnyi5`}],[`path`,{d:`M21 4a1 1 0 0 0-1-1`,key:`sfs9ap`}],[`path`,{d:`M21 9a1 1 0 0 1-1 1`,key:`mp6qeo`}],[`path`,{d:`m3 7 3 3 3-3`,key:`x25e72`}],[`path`,{d:`M6 10V5a2 2 0 0 1 2-2h2`,key:`15xut4`}],[`rect`,{x:`3`,y:`14`,width:`7`,height:`7`,rx:`1`,key:`1bkyp8`}]]),Qr=L(`sparkles`,[[`path`,{d:`M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z`,key:`1s2grr`}],[`path`,{d:`M20 2v4`,key:`1rf3ol`}],[`path`,{d:`M22 4h-4`,key:`gwowj6`}],[`circle`,{cx:`4`,cy:`20`,r:`2`,key:`6kqj1y`}]]),$r=L(`text-cursor-input`,[[`path`,{d:`M12 20h-1a2 2 0 0 1-2-2 2 2 0 0 1-2 2H6`,key:`1528k5`}],[`path`,{d:`M13 8h7a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2h-7`,key:`13ksps`}],[`path`,{d:`M5 16H4a2 2 0 0 1-2-2v-4a2 2 0 0 1 2-2h1`,key:`1n9rhb`}],[`path`,{d:`M6 4h1a2 2 0 0 1 2 2 2 2 0 0 1 2-2h1`,key:`1mj8rg`}],[`path`,{d:`M9 6v12`,key:`velyjx`}]]),ei=L(`undo-2`,[[`path`,{d:`M9 14 4 9l5-5`,key:`102s5s`}],[`path`,{d:`M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11`,key:`f3b9sd`}]]),ti=L(`unfold-vertical`,[[`path`,{d:`M12 22v-6`,key:`6o8u61`}],[`path`,{d:`M12 8V2`,key:`1wkif3`}],[`path`,{d:`M4 12H2`,key:`rhcxmi`}],[`path`,{d:`M10 12H8`,key:`s88cx1`}],[`path`,{d:`M16 12h-2`,key:`10asgb`}],[`path`,{d:`M22 12h-2`,key:`14jgyd`}],[`path`,{d:`m15 19-3 3-3-3`,key:`11eu04`}],[`path`,{d:`m15 5-3-3-3 3`,key:`itvq4r`}]]),B=e(k(),1);function ni(e,t=!1){let[n,r]=$e(e,t),i=(0,B.useCallback)(e=>{e?.preventDefault?.(),r(e=>!e)},[r]),a=(0,B.useCallback)(e=>{e?.preventDefault?.(),r(!0)},[r]),o=(0,B.useCallback)(e=>{e?.preventDefault?.(),r(!1)},[r]);return(0,B.useMemo)(()=>({toggled:n,setToggled:r,toggle:i,toggleOn:a,toggleOff:o}),[i,r,o,a,n])}var ri=(0,B.createContext)(null);function V(){return(0,B.useContext)(ri)}var H=j();function ii(){let{reloadRootEntries:e,setFocusedItem:t,setSelectedItems:n}=V(),r=Ve();return(0,B.useCallback)(async a=>{let o=!1,s=a.filter(e=>e.from!==e.to);if(s.length===0)return!0;let c=`Renaming ${i(s.length,`File`,`Files`)}`,l={duration:6e4,action:{label:`Cancel`,onClick:()=>{o=!0}}};l.id=P.loading(c,{...l,description:(0,H.jsx)(ge,{animated:!0,width:`0%`})});let u=s.length*3,d=0;function f(){d+=1,P.loading(c,{...l,description:(0,H.jsx)(ge,{animated:!0,width:(d===0?0:d/u*100)+`%`})})}try{for(let e of s){let t=e.from.split(`/`),n=t.shift(),i=t.join(`/`),a=e.to.split(`/`),s=a.shift(),c=a.join(`/`),l=await Jn({...r,file:i,project:n,encoding:`base64`});if(o||(f(),await Le({...r,file:c,project:s,encoding:`base64`,payload:l.message}),o)||(f(),await Ee({...r,file:i,project:n}),o))break;f()}}catch(t){return P.error(`Rename Failed`,{id:l.id,description:t instanceof Error?t.message:`An unexpected error occurred while renaming.`,duration:1e4,action:{label:`OK`,onClick:()=>void 0}}),e(),!1}return d>=u?P.success(`Renamed ${i(s.length,`File`,`Files`)}`,{id:l.id,description:`All done!`,duration:3e3,action:{label:`OK`,onClick:()=>{}}}):P.warning(`Rename Cancelled`,{id:l.id,description:`${d} of ${u} steps completed.`,duration:1e4,action:{label:`OK`,onClick:()=>{}}}),e(),n(e=>{let t=e.slice();for(let e of s){let n=t.indexOf(e.from);n>=0?t.splice(n,1,e.to):t.push(e.to)}return t}),t(e=>{for(let t of s)if(e===t.from)return t.to;return e}),d>=u},[r,e,t,n])}var ai;function oi(e){ai=e}function si(e){return e.files.length>0||e.directories.length>0?ai?new Promise(t=>ai(e,t)):Promise.resolve(!1):Promise.resolve(!0)}function ci(e,t){return e[t]!==void 0}function li(e){return t=>ci(t,e)}var ui={handleGlobal(e,t){if((t.cmd||t.ctrl)&&e===`Delete`)return R(`ShowDeleteDirectoryOrFileModal`,!0),!0},addEditorAction(e){return{id:`delete-file`,label:`Delete File`,keybindings:[e.KeyMod.CtrlCmd|e.KeyCode.Delete],run:et(`ShowDeleteDirectoryOrFileModal`,!0)}}},di={handleGlobal(e,t){if(t.ctrl&&t.alt&&t.shift&&e===`˜`)return R(`ShowAddDirectoryOrFileModalType`,`directory`),!0},addEditorAction(e){return{id:`new-directory`,label:`New Directory`,keybindings:[e.KeyMod.WinCtrl|e.KeyMod.Alt|e.KeyMod.Shift|e.KeyCode.KeyN],run:et(`ShowAddDirectoryOrFileModalType`,`directory`)}}},fi={handleGlobal(e,t){if(t.ctrl&&e===`n`)return R(`ShowAddDirectoryOrFileModalType`,`file`),!0},addEditorAction(e){return{id:`new-file`,label:`New File`,keybindings:[e.KeyMod.WinCtrl|e.KeyCode.KeyN],run:et(`ShowAddDirectoryOrFileModalType`,`file`)}}},pi;function mi(e){pi=e}function hi(){pi?.()}var gi=[ui,di,fi,{handleGlobal(e){if(e===`F2`)return R(`ShowRenameFileModal`,`file`),!0},addEditorAction(e){return{id:`rename-file`,label:`Rename File`,keybindings:[e.KeyMod.WinCtrl|e.KeyMod.Alt|e.KeyCode.KeyR,e.KeyCode.F2],run:et(`ShowRenameFileModal`,!0)}}},{addEditorAction(){return{id:`revert-file`,label:`Revert File`,run:Ct(`RevertChanges`,!0)}}},{handleGlobal(e,t){if(t.cmd&&e===`s`)return Et(`SaveFile`,!0),!0},addEditorAction(e){return{id:`save-file`,label:`Save Changes`,keybindings:[e.KeyMod.CtrlCmd|e.KeyCode.KeyS],run:Ct(`SaveFile`,!0)}}}],_i=gi.filter(li(`addEditorAction`)),vi=gi.filter(li(`handleGlobal`));function yi(e){let[t,n]=e,r=_i.map(e=>t.addAction(e.addEditorAction(n)));return()=>{for(let e of r)e?.dispose()}}function bi(){(0,B.useEffect)(()=>(document.addEventListener(`keydown`,xi),()=>{document.removeEventListener(`keydown`,xi)}),[])}function xi(e){let t={cmd:e.getModifierState(`Meta`),alt:e.getModifierState(`Alt`),shift:e.getModifierState(`Shift`),ctrl:e.getModifierState(`Control`)};for(let n of vi)if(n.handleGlobal(e.key,t)){hi(),e.preventDefault();return}}function Si(e){return e.split(`/`).pop()}function Ci(){let[e,t]=(0,B.useState)(!1),[n,r]=(0,B.useState)(void 0),i=(0,B.useCallback)(e=>{if(!e.dataTransfer?.types?.includes(`Files`))return;let n=e.target instanceof Element?e.target:null,i=n?.closest(`.rct-tree-item-button-isFolder`)??n?.closest(`.rct-tree-item-title-container`)?.querySelector(`:scope > .rct-tree-item-button-isFolder`)??null;if(i){let e=i.getAttribute(`data-rct-item-id`);!i.querySelector(`.packageIsLocked`)&&e&&e!==`importedApplications`&&e!==`newApplication`&&r(e=>e===i?e:(e?.classList?.remove?.(`rct-tree-item-title-container-dragging-over`),i.classList.add(`rct-tree-item-title-container-dragging-over`),i))}t(!0)},[]),a=(0,B.useCallback)(()=>{t(!1),r(e=>{e&&e.classList.remove(`rct-tree-item-title-container-dragging-over`)})},[]),o=(0,B.useCallback)(e=>{if(!e.dataTransfer?.types?.includes(`Files`)||e.detail===1337)return;t(!1),n&&(n.classList.remove(`rct-tree-item-title-container-dragging-over`),r(void 0));let i=document.getElementById(`dropTarget`);return i?i.dispatchEvent(new DragEvent(`drop`,{bubbles:!0,detail:1337,cancelable:!0,dataTransfer:e.dataTransfer})):!1},[n]);return(0,B.useEffect)(()=>(document.addEventListener(`dragenter`,i),document.addEventListener(`dragover`,i),document.addEventListener(`dragleave`,a),document.addEventListener(`drop`,o),()=>{document.removeEventListener(`dragenter`,i),document.removeEventListener(`dragover`,i),document.removeEventListener(`dragleave`,a),document.removeEventListener(`drop`,o)}),[i,o,a]),(0,B.useMemo)(()=>({dragging:e,dragTarget:n}),[e,n])}function wi(e){return new Promise((t,n)=>{let r=new FileReader;r.onabort=n,r.onerror=n,r.onload=t,r.readAsDataURL(e)})}var Ti=new Map([[`avif`,`image/avif`],[`bmp`,`image/bmp`],[`css`,`text/css`],[`csv`,`text/csv`],[`doc`,`application/msword`],[`docx`,`application/vnd.openxmlformats-officedocument.wordprocessingml.document`],[`gif`,`image/gif`],[`gz`,`application/gzip`],[`htm`,`text/html`],[`html`,`text/html`],[`ico`,`image/x-icon`],[`jpeg`,`image/jpeg`],[`jpg`,`image/jpeg`],[`js`,`application/javascript`],[`json`,`application/json`],[`md`,`text/markdown`],[`mjs`,`application/javascript`],[`mp3`,`audio/mpeg`],[`mp4`,`video/mp4`],[`ogg`,`audio/ogg`],[`pdf`,`application/pdf`],[`png`,`image/png`],[`ppt`,`application/powerpoint`],[`pptx`,`application/vnd.openxmlformats-officedocument.presentationml.presentation`],[`svg`,`image/svg+xml`],[`tif`,`image/tiff`],[`tiff`,`image/tiff`],[`txt`,`text/plain`],[`wasm`,`application/wasm`],[`wav`,`audio/x-wav`],[`weba`,`audio/webm`],[`webm`,`video/webm`],[`webp`,`image/webp`],[`xls`,`application/vnd.ms-excel`],[`xlsx`,`application/vnd.openxmlformats-officedocument.spreadsheetml.sheet`],[`xml`,`application/xml`],[`zip`,`application/zip`]]),Ei=class extends Error{constructor(e){super(`DataTransferItem is not a file`),this.item=e,this.name=`UnexpectedObjectError`}};function Di(e,t,n){let r=e,{webkitRelativePath:i}=e,a=typeof t==`string`?t:typeof i==`string`&&i.length>0?i:`./${e.name}`;return typeof r.path!=`string`&&ki(r,`path`,a),n!==void 0&&Object.defineProperty(r,"handle",{value:n,writable:!1,configurable:!1,enumerable:!0}),ki(r,`relativePath`,a),r}function Oi(e,t=Ti){let{name:n}=e;if(n&&n.lastIndexOf(`.`)!==-1&&!e.type){let r=n.split(`.`).pop().toLowerCase(),i=t.get(r);i&&Object.defineProperty(e,"type",{value:i,writable:!1,configurable:!1,enumerable:!0})}return e}function ki(e,t,n){Object.defineProperty(e,t,{value:n,writable:!1,configurable:!1,enumerable:!0})}var Ai=[`.DS_Store`,`Thumbs.db`];async function ji(e,{mimeTypes:t=Ti}={}){return(await Mi(e)).map(e=>e instanceof File?Oi(e,t):e)}async function Mi(e){return Fi(e)&&Ni(e.dataTransfer)?Ri(e.dataTransfer,e.type):Pi(e)?Ii(e):Array.isArray(e)&&e.every(e=>`getFile`in e&&typeof e.getFile==`function`)?Li(e):[]}function Ni(e){return Fi(e)}function Pi(e){return Fi(e)&&Fi(e.target)}function Fi(e){return typeof e==`object`&&!!e}function Ii(e){return Bi(e.target.files).map(e=>Di(e))}async function Li(e){return(await Promise.all(e.map(e=>e.getFile()))).map(e=>Di(e))}async function Ri(e,t){let n=Bi(e.items).filter(e=>e.kind===`file`);return t===`drop`?zi(Hi(await Promise.all(n.map(Vi)))):n}function zi(e){return e.filter(e=>Ai.indexOf(e.name)===-1)}function Bi(e){return e===null?[]:Array.from(e)}async function Vi(e){if(typeof e.webkitGetAsEntry!=`function`)return Ui(e);let t=e.webkitGetAsEntry();if(t?.isDirectory){let n=await Wi(e);return n?.kind===`directory`?Gi(n,`/${n.name}`):qi(t)}return Ui(e,t)}function Hi(e){let t=[];for(let n of e)Array.isArray(n)?t.push(...Hi(n)):t.push(n);return t}async function Ui(e,t){let n=e.getAsFile(),r=await Wi(e);if(r!=null){let e=n??await r.getFile();return e.handle=r,Di(e)}if(!n)throw new Ei(e);return Di(n,t?.fullPath??void 0)}async function Wi(e){if(globalThis.isSecureContext&&typeof e.getAsFileSystemHandle==`function`)return e.getAsFileSystemHandle()}async function Gi(e,t){let n=[];for await(let r of e.values()){let e=`${t}/${r.name}`;if(r.kind===`directory`)n.push(...await Gi(r,e));else{let t=await r.getFile();n.push(Di(t,e,r))}}return n}async function Ki(e){return e.isDirectory?qi(e):Ji(e)}function qi(e){let t=e.createReader();return new Promise((e,n)=>{let r=[];function i(){t.readEntries(async t=>{if(t.length){let e=Promise.all(t.map(Ki));r.push(e),i()}else try{e(await Promise.all(r))}catch(e){n(e)}},e=>{n(e)})}i()})}async function Ji(e){return new Promise((t,n)=>{e.file(n=>{t(Di(n,e.fullPath))},e=>{n(e)})})}var Yi=e(n((e=>{e.__esModule=!0,e.default=function(e,t){if(e&&t){var n=Array.isArray(t)?t:t.split(`,`);if(n.length===0)return!0;var r=e.name||``,i=(e.type||``).toLowerCase(),a=i.replace(/\/.*$/,``);return n.some(function(e){var t=e.trim().toLowerCase();return t.charAt(0)===`.`?r.toLowerCase().endsWith(t):t.endsWith(`/*`)?a===t.replace(/\/.*$/,``):i===t})}return!0}}))(),1),Xi=typeof Yi.default==`function`?Yi.default:Yi.default.default,Zi=`file-invalid-type`,Qi=`file-too-large`,$i=`file-too-small`,ea=`too-many-files`;function ta(e=``){let t=e.split(`,`);return{code:Zi,message:`File type must be ${t.length>1?`one of ${t.join(`, `)}`:t[0]}`}}var na=[`KB`,`MB`,`GB`,`TB`,`PB`];function ra(e){if(e<1024)return`${e} ${e===1?`byte`:`bytes`}`;let t=e/1024,n=0;for(;t>=1024&&n<na.length-1;)t/=1024,n++;return`${Number(t.toFixed(2))} ${na[n]}`}function ia(e){return{code:Qi,message:`File is larger than ${ra(e)}`}}function aa(e){return{code:$i,message:`File is smaller than ${ra(e)}`}}var oa={code:ea,message:`Too many files`};function sa(e){return e.type===``&&typeof e.getAsFile==`function`}function ca(e,t){let n=e.type===`application/x-moz-file`||Xi(e,t??``)||sa(e);return[n,n?null:ta(t)]}function la(e,t,n){if(ua(e.size)){if(ua(t)&&ua(n)){if(e.size>n)return[!1,ia(n)];if(e.size<t)return[!1,aa(t)]}else if(ua(t)&&e.size<t)return[!1,aa(t)];else if(ua(n)&&e.size>n)return[!1,ia(n)]}return[!0,null]}function ua(e){return e!=null}function da(e){return e!=null&&typeof e.then==`function`}function fa({files:e,accept:t,minSize:n,maxSize:r,multiple:i,maxFiles:a=0,validator:o}){return!i&&e.length>1||i&&a>=1&&e.length>a||e.some(e=>{let[i]=ca(e,t),[a]=la(e,n,r);return!i||!a})?`reject`:o?`unknown`:`accept`}function pa(e){return typeof e.isPropagationStopped==`function`?e.isPropagationStopped():e.cancelBubble!==void 0&&e.cancelBubble}function ma(e){return e.dataTransfer?Array.prototype.some.call(e.dataTransfer.types,e=>e===`Files`||e===`application/x-moz-file`)||Array.prototype.some.call(e.dataTransfer.items??[],ha):!!e.target&&!!e.target.files}function ha(e){return typeof e==`object`&&!!e&&e.kind===`file`}function ga(e){e.preventDefault()}function _a(e){return e.indexOf(`MSIE`)!==-1||e.indexOf(`Trident/`)!==-1}function va(e){return e.indexOf(`Edge/`)!==-1}function ya(e=window.navigator.userAgent){return _a(e)||va(e)}function ba(...e){return(t,...n)=>e.some(e=>(!pa(t)&&e&&e(t,...n),pa(t)))}function xa(){return`showOpenFilePicker`in window}function Sa(e){if(ua(e))return[{description:`Files`,accept:Object.entries(e).filter(([e,t])=>{let n=!0;return Da(e)||(console.warn(`Skipped "${e}" because it is not a valid MIME type. Check https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types for a list of valid MIME types.`),n=!1),(!Array.isArray(t)||!t.every(ka))&&(console.warn(`Skipped "${e}" because an invalid file extension was provided.`),n=!1),n}).reduce((e,[t,n])=>(e[t]=n,e),{})}]}function Ca(e,{omitWildcardMimeTypesWithExtensions:t=!1}={}){if(ua(e))return Object.entries(e).reduce((e,[n,r])=>(t&&Oa(n)&&r.some(ka)?e.push(...r):e.push(n,...r),e),[]).filter(e=>Da(e)||ka(e)).join(`,`)}function wa(e){return e instanceof DOMException&&(e.name===`AbortError`||e.code===e.ABORT_ERR)}function Ta(e){return e instanceof DOMException&&(e.name===`SecurityError`||e.code===e.SECURITY_ERR)}function Ea(e){return e instanceof DOMException&&e.name===`NotAllowedError`}function Da(e){return e===`audio/*`||e===`video/*`||e===`image/*`||e===`text/*`||e===`application/*`||/\w+\/[-+.\w]+/g.test(e)}function Oa(e){return e.endsWith(`/*`)}function ka(e){return/^.*\.[\w]+$/.test(e)}var Aa=(0,B.forwardRef)(({children:e,...t},n)=>{let{open:r,...i}=Ma(t);return(0,B.useImperativeHandle)(n,()=>({open:r}),[r]),(0,H.jsx)(H.Fragment,{children:e?.({...i,open:r})})});Aa.displayName=`Dropzone`;var ja={isFocused:!1,isFileDialogActive:!1,isDragActive:!1,isDragAccept:!1,isDragReject:!1,isDragUnknown:!1,isDragGlobal:!1,isProcessing:!1,acceptedFiles:[],fileRejections:[]};function Ma(e={}){let{accept:t,disabled:n=!1,getFilesFromEvent:r=ji,maxSize:i=1/0,minSize:a=0,multiple:o=!0,maxFiles:s=0,onDragEnter:c,onDragLeave:l,onDragOver:u,onDrop:d,onDropAccepted:f,onDropRejected:p,onFileDialogCancel:m,onFileDialogOpen:h,useFsAccessApi:g=!1,autoFocus:_=!1,preventDropOnDocument:v=!0,noClick:y=!1,noKeyboard:b=!1,noDrag:x=!1,noDragEventsBubbling:S=!1,onError:C,validator:w,getErrorMessage:T}=e,E=(0,B.useMemo)(()=>Ca(t),[t]),D=(0,B.useMemo)(()=>Ca(t,{omitWildcardMimeTypesWithExtensions:!0}),[t]),O=(0,B.useMemo)(()=>Sa(t),[t]),k=(0,B.useMemo)(()=>typeof h==`function`?h:Pa,[h]),A=(0,B.useMemo)(()=>typeof m==`function`?m:Pa,[m]),j=(0,B.useRef)(null),M=(0,B.useRef)(null),[N,P]=(0,B.useReducer)(Na,ja),{isFocused:ee,isFileDialogActive:F}=N,I=(0,B.useRef)(F);I.current=F;let te=(0,B.useRef)(null),ne=(0,B.useCallback)(()=>{te.current?.abort();let e=new AbortController;return te.current=e,P({type:`setProcessing`,isProcessing:!0}),e.signal},[]),re=(0,B.useCallback)(e=>{e.aborted||P({type:`setProcessing`,isProcessing:!1})},[]),L=(0,B.useRef)(typeof window<`u`&&window.isSecureContext&&g&&xa()),ie=()=>{!L.current&&F&&setTimeout(()=>{if(M.current){let{files:e}=M.current;e?.length||(P({type:`closeDialog`}),A())}},300)};(0,B.useEffect)(()=>(window.addEventListener(`focus`,ie,!1),()=>{window.removeEventListener(`focus`,ie,!1)}),[M,F,A,L]);let ae=(0,B.useRef)([]),oe=(0,B.useRef)([]),se=e=>{j.current&&e.target&&j.current.contains(e.target)&&e.defaultPrevented||(e.preventDefault(),ae.current=[])};(0,B.useEffect)(()=>(v&&(document.addEventListener(`dragover`,ga,!1),document.addEventListener(`drop`,se,!1)),()=>{v&&(document.removeEventListener(`dragover`,ga),document.removeEventListener(`drop`,se))}),[j,v]),(0,B.useEffect)(()=>{let e=e=>{e.target&&(oe.current=[...oe.current,e.target]),ma(e)&&P({isDragGlobal:!0,type:`setDragGlobal`})},t=e=>{oe.current=oe.current.filter(t=>t!==e.target&&t!==null),!(oe.current.length>0)&&P({isDragGlobal:!1,type:`setDragGlobal`})},n=()=>{oe.current=[],P({isDragGlobal:!1,type:`setDragGlobal`})},r=()=>{oe.current=[],P({isDragGlobal:!1,type:`setDragGlobal`})};return document.addEventListener(`dragenter`,e,!1),document.addEventListener(`dragleave`,t,!1),document.addEventListener(`dragend`,n,!1),document.addEventListener(`drop`,r,!1),()=>{document.removeEventListener(`dragenter`,e),document.removeEventListener(`dragleave`,t),document.removeEventListener(`dragend`,n),document.removeEventListener(`drop`,r)}},[j]),(0,B.useEffect)(()=>(!n&&_&&j.current&&j.current.focus(),()=>{}),[j,_,n]);let ce=(0,B.useCallback)(e=>{C?C(e):console.error(e)},[C]),le=(0,B.useCallback)(e=>{e.preventDefault(),e.persist?.(),Se(e),!I.current&&(ae.current=[...ae.current,e.target],ma(e)&&Promise.resolve(r(e)).then(t=>{if(pa(e)&&!S)return;let n=t.length>0?fa({files:t,accept:E,minSize:a,maxSize:i,multiple:o,maxFiles:s,validator:w}):null;P({isDragAccept:n===`accept`,isDragReject:n===`reject`,isDragUnknown:n===`unknown`,isDragActive:!0,type:`setDraggedFiles`}),c&&c(e)}).catch(e=>ce(e)))},[r,c,ce,S,E,a,i,o,s,w]),ue=(0,B.useCallback)(e=>{if(e.preventDefault(),e.persist?.(),Se(e),I.current)return!1;let t=ma(e);if(t&&e.dataTransfer)try{e.dataTransfer.dropEffect=`copy`}catch{}return t&&u&&u(e),!1},[u,S]),de=(0,B.useCallback)(e=>{e.preventDefault(),e.persist?.(),Se(e);let t=ae.current.filter(e=>j.current?.contains(e)),n=t.indexOf(e.target);n!==-1&&t.splice(n,1),ae.current=t,!(t.length>0)&&(P({type:`setDraggedFiles`,isDragActive:!1,isDragAccept:!1,isDragReject:!1,isDragUnknown:!1}),ma(e)&&l&&l(e))},[j,l,S]),fe=(0,B.useCallback)(async(e,t,n)=>{let r=(e,t)=>T?{...e,message:T(e,t)}:e,c=e=>{let n=[],i=[];e.forEach(({file:e,accepted:t,acceptError:a,sizeMatch:o,sizeError:s,customErrors:c})=>{if(t&&o&&!c)n.push(e);else{let t=[a,s];c&&(t=t.concat(c)),i.push({file:e,errors:t.filter(e=>e!=null).map(t=>r(t,e))})}});let a=o?s>=1?s:1/0:1;n.length>a&&n.splice(a).forEach(e=>{i.push({file:e,errors:[r(oa,e)]})}),P({acceptedFiles:n,fileRejections:i,type:`setFiles`}),d&&d(n,i,t),i.length>0&&p&&p(i,t),n.length>0&&f&&f(n,t)},l=e.map(e=>{let[t,n]=ca(e,D),[r,o]=la(e,a,i);return{file:e,accepted:t,acceptError:n,sizeMatch:r,sizeError:o,customErrors:w?w(e):null}});if(!l.some(({customErrors:e})=>da(e))){c(l);return}let u;try{u=await Promise.all(l.map(async({customErrors:e,...t})=>({...t,customErrors:await e})))}catch(e){n.aborted||(re(n),ce(e));return}n.aborted||c(u)},[P,o,D,a,i,s,d,f,p,w,T,ce,re]),pe=(0,B.useCallback)(e=>{if(e.preventDefault(),e.persist?.(),Se(e),ae.current=[],!(I.current&&e.dataTransfer)&&(P({type:`reset`}),ma(e))){let t=ne();Promise.resolve(r(e)).then(n=>{if(!t.aborted){if(pa(e)&&!S){re(t);return}return fe(n,e,t)}}).catch(e=>{t.aborted||(re(t),ce(e))})}},[r,fe,ce,S,ne,re]),me=(0,B.useCallback)(()=>{if(L.current){P({type:`openDialog`}),k();let e={multiple:o,types:O},t;window.showOpenFilePicker(e).then(e=>(t=ne(),r(e))).then(e=>{if(P({type:`closeDialog`}),!t.aborted)return fe(e,null,t)}).catch(e=>{t&&re(t),wa(e)?(A(e),P({type:`closeDialog`})):Ta(e)||Ea(e)?(L.current=!1,M.current?(M.current.value=``,M.current.click()):ce(Error(`Cannot open the file picker because the https://developer.mozilla.org/en-US/docs/Web/API/File_System_Access_API is not supported and no <input> was provided.`))):ce(e)});return}M.current&&(P({type:`openDialog`}),k(),M.current.value=``,M.current.click())},[P,k,A,g,fe,ce,O,o,ne,re]),he=(0,B.useCallback)(e=>{j.current?.isEqualNode(e.target)&&(e.key===` `||e.key===`Enter`||e.keyCode===32||e.keyCode===13)&&(e.preventDefault(),me())},[j,me]),ge=(0,B.useCallback)(()=>{P({type:`focus`})},[]),_e=(0,B.useCallback)(()=>{P({type:`blur`})},[]),ve=(0,B.useCallback)(()=>{y||(ya()?setTimeout(me,0):me())},[y,me]),ye=e=>n?null:e,be=e=>b?null:ye(e),xe=e=>x?null:ye(e),Se=e=>{S&&e.stopPropagation()},Ce=(0,B.useMemo)(()=>({refKey:e=`ref`,role:t,onKeyDown:r,onFocus:i,onBlur:a,onClick:o,onDragEnter:s,onDragOver:c,onDragLeave:l,onDrop:u,...d}={})=>({onKeyDown:be(ba(r,he)),onFocus:be(ba(i,ge)),onBlur:be(ba(a,_e)),onClick:ye(ba(o,ve)),onDragEnter:xe(ba(s,le)),onDragOver:xe(ba(c,ue)),onDragLeave:xe(ba(l,de)),onDrop:xe(ba(u,pe)),role:typeof t==`string`&&t!==``?t:`presentation`,[e]:j,...!n&&!b?{tabIndex:0}:{},...n?{"aria-disabled":!0}:{},...d}),[j,he,ge,_e,ve,le,ue,de,pe,b,x,n]),we=(0,B.useCallback)(e=>{e.stopPropagation()},[]),Te=(0,B.useMemo)(()=>({refKey:e=`ref`,onChange:t,onClick:n,...r}={})=>({accept:D,multiple:o,type:`file`,"aria-label":`file upload`,style:{border:0,display:`block`,height:0,margin:0,opacity:0,overflow:`hidden`,padding:0,width:0},onChange:ye(ba(t,pe)),onClick:ye(ba(n,we)),tabIndex:-1,[e]:M,...r}),[M,t,o,pe,n]);return{...N,isFocused:ee&&!n,getRootProps:Ce,getInputProps:Te,rootRef:j,inputRef:M,open:ye(me)}}function Na(e,t){switch(t.type){case`focus`:return{...e,isFocused:!0};case`blur`:return{...e,isFocused:!1};case`openDialog`:return{...ja,isFileDialogActive:!0};case`closeDialog`:return{...e,isFileDialogActive:!1};case`setDraggedFiles`:return{...e,isDragActive:t.isDragActive,isDragAccept:t.isDragAccept,isDragReject:t.isDragReject,isDragUnknown:t.isDragUnknown};case`setProcessing`:return{...e,isProcessing:t.isProcessing};case`setFiles`:return{...e,acceptedFiles:t.acceptedFiles,fileRejections:t.fileRejections,isProcessing:!1,isDragReject:!1,isDragUnknown:!1};case`setDragGlobal`:return{...e,isDragGlobal:t.isDragGlobal};case`reset`:return{...ja};default:return e}}function Pa(){}function Fa(){let[e,t]=(0,B.useState)(``),{clusterId:n}=x({strict:!1}),{openedEntry:r,restrictPackageModification:c,reloadRootEntries:u,entryExists:d}=V(),f=!!r&&!r.package&&!c,p=Ve(),{dragging:m,dragTarget:h}=Ci(),g=(h?.getAttribute?.(`data-rct-item-id`))?.split?.(`/`)?.pop?.(),_=r?.project,v=!1,y;if(r?.path){let e=r.path.split(`/`),t=z(r);v=f&&(t?e.slice(1):e.slice(1,-1)).join(`/`),y=e[e.length-(t?1:2)]}let b=(0,B.useCallback)(async(e,n)=>{let r=e,a=h?.getAttribute?.(`data-rct-item-id`)?.split?.(`/`),o=a?.length?a[0]:f?_:!1,s=a?.length?a.slice(1).join(`/`):f?v:!1;if(o===!1||o===void 0||s===!1||s===void 0)return;let c=[],l=n.slice(),m=[];for(let e of r){let t=Ia(s,e);e.name.startsWith(`.`)||e.relativePath?.includes(`/.`)?l.push({file:e,errors:[{message:`Sensitive files and folders starting with . are skipped.`,code:`dot-ignored`}]}):d(`${o}/${t}`)?m.push({file:e,path:`${o}/${t}`}):c.push(e)}if(m.length>0){let e=await si({files:m.map(e=>e.path),directories:[]});for(let t of m)e?c.push(t.file):l.push({file:t.file,errors:[{message:`${Ia(s,t.file)} already exists`,code:`duplicate`}]})}let g=!1,y=`uploading-files`,b={label:`Cancel`,onClick:()=>{g=!0}},x={label:`OK`,onClick:()=>void 0};t(`Uploading ${i(c.length,`file`,`files`)}...`);try{let e=c.reduce((e,t)=>e+t.size,0),t=0,n=0;for(let r of c){n+=1,P.loading(`Upload in progress...`,{id:y,descriptionClassName:`whitespace-pre-line`,description:`${n} of ${i(c.length,`file`,`files`)}
3
3
  ${r.name}
4
4
  ${ft(t)} of ${ft(e)}`,action:b});let a=Ia(s,r),u=(await wi(r)).target?.result;if(!u)throw Error(`Failed to read file: ${r.name}`);let d=u.indexOf(`base64,`);if(d===-1)throw Error(`Invalid data URL format for file: ${r.name}`);g?l.push({file:r,errors:[{message:`${a} cancelled`,code:`cancelled`}]}):(await Le({...p,file:a,project:o,encoding:`base64`,payload:u.slice(d+7)}),t+=r.size)}P.loading(`Reloading sidebar...`,{id:y,action:x,description:``}),await u(),l.length===0?r.length>0?P.success(`Uploaded ${i(c.length,`file`,`files`)}!`,{id:y,action:x,description:``}):P.dismiss(y):(console.log(l),P.error(g?`Cancelled uploads`:`Rejected uploads`,{id:y,action:x,descriptionClassName:`whitespace-pre-line overflow-y-auto`,description:l.slice(0,5).map(e=>e.errors.map(e=>e.message).join(`
5
5
  `)).join(`
@@ -294,4 +294,4 @@ declare module '*?url' { const url: string; export default url; }
294
294
  `)?(0,H.jsx)(`code`,{className:t,children:n}):a===`mermaid`?(0,H.jsx)($y,{chart:r}):(0,H.jsxs)(`code`,{className:`relative`,children:[(0,H.jsx)(y,{className:`absolute top-2 right-2`,type:`button`,variant:`default`,size:`sm`,onClick:i,children:(0,H.jsx)(Pn,{className:`w-4 h-4`})}),r]})}function tb(e,t,n){let r=t,i=t.replace(/:9925/,``).replace(/\/?$/,``);return r&&(e=e.replaceAll(/https?:\/\/localhost:9926/g,i)),n.project&&(e=e.replaceAll(`Your New Harper Fabric App`,n.project).replaceAll(`your-project-name-here`,n.project)),e}function nb({children:e}){let t=D(),[n,r]=(0,B.useState)(void 0),[i,a]=(0,B.useState)(void 0),{setContent:o}=Ha(n?.path),s=Ve(),c=gr(),l=S(),{open:u}=w({strict:!1}),{data:d}=C(un(s)),f=(0,B.useMemo)(()=>d?Ie(d.entries):{rootEntries:[],pathsRegistry:new Map,allEntries:new Map},[d]),p=(0,B.useCallback)(async()=>l.fetchQuery({queryKey:[s.entityId,`get_components`],networkMode:`online`}),[l,s]);st(`ReloadApplicationRootEntries`,p,[p]);let m=(0,B.useCallback)(e=>f.pathsRegistry.has(e),[f.pathsRegistry]),h=f.rootEntries.filter(e=>!e.package&&e.path!==`newApplication`).map(e=>e.name),g=h[0],_=h.slice(0,1);!g&&d&&(g=Fe,_=[Fe]);let[v,y]=$e(`FileFocused/${s.entityId}`,g),[b,x]=$e(`FolderOpened/${s.entityId}`,h),[T,E]=$e(`FileSelected/${s.entityId}`,_);(0,B.useEffect)(()=>{if(u?.length){let e=u.split(`?`),n=e[0],r=e[1],i=n.split(`/`);if(r){let e=r.split(`=`);R(e[0],e[1]===`true`||e[1]!==`false`&&e[1])}x(e=>{let t=new Set(e);for(let e=1;e<i.length;e++)t.add(i.slice(0,e).join(`/`));return[...t]}),E([n]),y(n),t({search:void 0})}},[t,u,x,y,E]);let O=n&&(z(n)?n.overviewEntry?.path:n.path)||``,k=n&&(z(n)?n.overviewEntry?.project:n.project)||``,A=n&&(z(n)?!!n.overviewEntry?.path:!1)||!1,j=n&&!z(n)&&mo(n.name)?void 0:O?.split(`/`).slice(1).join(`/`),M=ln({file:j,project:k,...s}),{data:N}=C(mn({file:j,project:k,...s}));(0,B.useEffect)(function(){let e=N?.project+`/`+N?.file,t=N?.message;e===O&&t!==void 0?(A&&c&&N&&(t=tb(t,c,N)),a(t)):a(void 0)},[N,O,A,s]);let{mutate:P,isPending:ee}=Pe(),F=(0,B.useCallback)((e,t)=>{P(e,{onSuccess:()=>{n?.path===t&&e.payload!==void 0&&(o(void 0),a(e.payload||void 0),l.setQueryData(M,{...N,message:e.payload}))},onError:e=>{console.error(`Error saving file:`,e)}})},[M,N,n?.path,l,P,o]),I=(0,B.useMemo)(()=>n?n.package?.includes(`github.com/HarperDB/status-check-fabric`)||n.package?.includes(`github.com/HarperFast/status-check-fabric`)||n.path===`importedApplications`||n.path===`newApplication`:!1,[n]),te=(0,B.useMemo)(()=>({rootEntries:f.rootEntries,reloadRootEntries:p,entryExists:m,focusedItem:v,setFocusedItem:y,expandedItems:b,setExpandedItems:x,selectedItems:T,setSelectedItems:E,restrictPackageModification:I,openedEntry:n,setOpenedEntry:r,openedEntryContents:i,setOpenedEntryContents:a,saveFile:F,isSavingFile:ee}),[f.rootEntries,p,m,v,y,b,x,T,E,I,n,r,i,a,F,ee]);return(0,H.jsx)(ri.Provider,{value:te,children:e})}function rb(e){let t=e;if(t?.focus)ib(t);else{let t=e;t?.target?.focus&&ib(t.target)}}function ib(e){r(1).then(()=>{e.focus?.()})}function ab(){let{value:e,trigger:t}=Vt(`ShowAddDirectoryOrFileModalType`,!1),n=(0,B.useCallback)(()=>{R(`ShowAddDirectoryOrFileModalType`,!1),rb(t)},[t]),{openedEntry:r,entryExists:i,reloadRootEntries:a,setFocusedItem:o,setSelectedItems:s,setExpandedItems:c}=V(),l=Ve(),{mutate:u,isPending:d}=Pe(),f=ee({resolver:N(m.object({name:m.string().nonempty({error:`Please enter a valid name.`}).regex(/^[a-zA-Z0-9_\- .]*$/,{error:`Names can only contain letters, numbers, underscores, hyphens, periods, and spaces.`}).max(50,{error:`Names cannot be longer than 50 characters.`}).trim()})),defaultValues:{name:``}}),p=(0,B.useCallback)(async t=>{if(!r||!e)return;let d=r.path.split(`/`),p=(z(r)?d.slice(1):d.slice(1,-1)).join(`/`),m=p?`${p}/${t.name}`:t.name,h=`${r.project}/${m}`;i(h)&&!await si({files:e===`file`?[h]:[],directories:e===`directory`?[h]:[]})||u({file:m,project:r.project,payload:e===`directory`?void 0:``,...l},{onSuccess:()=>{a(),n(),f.reset();let i=[r.project,p,t.name].filter(He).join(`/`);o(i),s([i]),e===`directory`?(c(e=>[...e,i]),R(`FocusFileTree`,!0)):R(`FocusEditor`,!0)}})},[u,f,n,l,r,i,a,c,o,s,e]),h=(0,B.useCallback)(()=>{n(),f.reset()},[n,f]);return(0,H.jsx)(ie,{onOpenChange:n,open:!!e,children:(0,H.jsx)(ce,{"aria-describedby":void 0,className:`text-popover-foreground`,onOpenAutoFocus:e=>{e.preventDefault(),requestAnimationFrame(()=>f.setFocus(`name`))},children:(0,H.jsx)(Yn,{...f,children:(0,H.jsxs)(`form`,{id:`instance-add-app-${e}-form`,name:`instance-add-app-${e}-form`,onSubmit:f.handleSubmit(p),children:[(0,H.jsxs)(oe,{children:[(0,H.jsxs)(de,{children:[`Add `,e]}),(0,H.jsxs)(me,{children:[`Enter the name of the `,e,` you want to add`,e===`file`?`, don't forget the extension`:``,`!`]})]}),(0,H.jsx)(sn,{control:f.control,name:`name`,render:({field:e})=>(0,H.jsxs)(Hn,{className:`my-2`,children:[(0,H.jsx)(rn,{children:`Name`}),(0,H.jsx)(Dn,{children:(0,H.jsx)(Bn,{disabled:d,type:`text`,autoComplete:`off`,autoCapitalize:`off`,...e})}),(0,H.jsx)(bn,{})]})}),(0,H.jsx)(ae,{children:(0,H.jsxs)(`div`,{className:`flex justify-between w-full`,children:[(0,H.jsx)(y,{type:`button`,variant:`ghostOutline`,onClick:h,children:`Cancel`}),(0,H.jsxs)(y,{variant:`positiveOutline`,type:`submit`,disabled:d,children:[(0,H.jsx)(Ye,{}),` Add `,e]})]})})]})})})})}async function ob(e,{dropItem:t,onProgress:n,isCanceled:r}){let i=0,a=[];for(let o of e){let e=o.split(`/`);a=e;let s=e[0],c=e.length>1?e.slice(1).join(`/`):void 0;n?.(i);try{await t(s,c),i+=1}catch(e){return{deleted:i,canceled:!1,error:e,lastSplit:a}}if(r?.())return{deleted:i,canceled:!0,lastSplit:a}}return{deleted:i,canceled:!1,lastSplit:a}}function sb(){let{value:e,trigger:t}=Vt(`ShowDeleteDirectoryOrFileModal`,!1),n=Ve(),{openedEntry:r,reloadRootEntries:a,setFocusedItem:o,setSelectedItems:s,selectedItems:c}=V(),l=c.length>1,u=z(r),d=u&&r.path===r.project,f=!!r?.package,p=f?`Remove`:`Delete`,m=f?`Imported Application`:d?`Application`:u?`Directory`:`File`,h=(0,B.useCallback)(()=>{R(`ShowDeleteDirectoryOrFileModal`,!1),rb(t)},[t]),g=(0,B.useCallback)(async()=>{h();let e=!1,t=`deleting-files`,r=i(c.length,`item`,`items`),l={label:`OK`,onClick:()=>void 0},u=await ob(c.map(String).reverse(),{dropItem:(e,t)=>Ee({file:t,project:e,...n}),onProgress:n=>{P.loading(`${p} in progress...`,{id:t,description:`${n} of ${r}`,action:{label:`Cancel`,onClick:()=>{e=!0}}})},isCanceled:()=>e});if(u.error?(P.dismiss(t),Re(u.error)):u.canceled?P.warning(`${p} canceled!`,{id:t,description:``,action:l}):P.success(`${p} completed!`,{id:t,description:``,action:l}),u.lastSplit.length){let e=u.lastSplit.slice(0,-1).join(`/`);o(e||void 0),s(e?[e]:[]),a(),R(`FocusFileTree`,!0)}},[p,h,n,a,c,o,s]),_=(0,B.useCallback)(e=>{e.preventDefault(),g()},[g]);return(0,H.jsx)(ie,{onOpenChange:h,open:e,children:(0,H.jsxs)(ce,{"aria-describedby":void 0,className:`text-popover-foreground`,children:[(0,H.jsxs)(oe,{children:[(0,H.jsxs)(de,{children:[p,` `,m]}),(0,H.jsxs)(me,{children:[`Are you sure you want to `,p.toLowerCase(),` `,l?`these ${c.length} items`:`this ${m.toLowerCase()}`,`?`]}),!f&&(0,H.jsx)(me,{className:`whitespace-pre`,children:l?c.join(`
295
295
  `):r?.path})]}),(0,H.jsxs)(`div`,{className:`flex w-full gap-4`,children:[(0,H.jsx)(y,{type:`button`,variant:`ghostOutline`,className:`w-full`,onClick:h,children:`Cancel`}),(0,H.jsxs)(y,{variant:`destructiveOutline`,type:`button`,className:`w-full`,autoFocus:!0,onClick:_,children:[(0,H.jsx)(dt,{}),` `,p,` `,l?`items`:m]})]})]})})}async function cb({packageName:e,project:t,skipNodeModules:n,skipSymlinks:r,instanceClient:i}){let{data:a}=await i.post(`/`,{operation:`package_component`,package:e,project:t,skip_node_modules:n,skip_symlinks:r},{timeout:3e5});return a}function lb(){return b({mutationFn:cb})}function ub(){let{value:e,trigger:t}=Vt(`ShowDownloadApplicationModal`,!1),n=Ve(),{openedEntry:r}=V(),{mutate:i,isPending:a,isSuccess:o}=lb(),s=o?`Downloaded`:a?`Downloading`:`Download`,[c,l]=(0,B.useState)(!1),u=(0,B.useCallback)(e=>{l(e.target.checked)},[]),d=(0,B.useCallback)(()=>{R(`ShowDownloadApplicationModal`,!1),rb(t)},[t]),f=(0,B.useCallback)(e=>{if(e.preventDefault(),!r)return;d();let t=P.loading(`Packaging...`);i({packageName:r.package,project:r.project,skipNodeModules:!c,...n},{onSuccess:e=>{P.success(`Download ready!`,{id:t});let n=document.createElement(`a`);n.setAttribute(`class`,`invisible absolute top-0`);let i=Uint8Array.from(atob(e.payload),e=>e.charCodeAt(0)),a=new Blob([i],{type:`application/gzip`});n.href=URL.createObjectURL(a),n.download=`${r.project}.gz`,document.body.appendChild(n),n.click(),document.body.removeChild(n)}})},[r,i,c,n,d]);return(0,H.jsx)(ie,{onOpenChange:d,open:e,children:(0,H.jsxs)(ce,{"aria-describedby":void 0,className:`text-popover-foreground`,children:[(0,H.jsxs)(oe,{children:[(0,H.jsx)(de,{children:`Download Application`}),(0,H.jsxs)(me,{children:[`This will package up the contents of `,(0,H.jsx)(`strong`,{children:r?.project}),` into a gzipped file.`]})]}),(0,H.jsxs)(Nn,{className:`flex`,children:[(0,H.jsx)(Bn,{type:`checkbox`,className:`w-6`,disabled:a,checked:c,onChange:u}),(0,H.jsx)(`span`,{className:`pl-4 pr-8 flex-1 py-2.5`,children:`Include Node Modules`})]}),(0,H.jsxs)(`div`,{className:`flex w-full gap-4`,children:[(0,H.jsx)(y,{type:`button`,variant:`ghostOutline`,className:`w-full`,onClick:d,children:`Cancel`}),(0,H.jsxs)(y,{variant:`positive`,type:`button`,className:`w-full`,disabled:a,autoFocus:!0,onClick:f,children:[(0,H.jsx)(xe,{}),` `,s,a?`...`:``]})]})]})})}function db({files:e,directories:t}){let n=[];return e.length&&n.push(`Overwrite ${i(e.length,`file`,`files`)}`),t.length&&n.push(`Merge ${i(t.length,`directory`,`directories`)}`),n.join(` & `)||`Overwrite`}function fb(){let[e,t]=(0,B.useState)(null);(0,B.useEffect)(()=>(oi((e,n)=>{t(t=>(t?.resolve(!1),{request:e,resolve:n}))}),()=>oi(void 0)),[]);let n=(0,B.useCallback)(e=>{t(t=>(t?.resolve(e),null))},[]),r=e?.request,i=r?[...r.directories,...r.files]:[];return(0,H.jsx)(hr,{open:!!e,onOpenChange:e=>!e&&n(!1),children:(0,H.jsxs)(ur,{className:`text-popover-foreground`,children:[(0,H.jsxs)(mr,{children:[(0,H.jsx)(lr,{children:`Overwrite existing items?`}),(0,H.jsx)(cr,{children:r?.directories.length?`Some of these already exist. Files will be overwritten and directories merged.`:`Some of these files already exist and will be overwritten.`})]}),i.length>0&&(0,H.jsxs)(`div`,{className:`max-h-48 overflow-y-auto rounded-md border border-border bg-muted/40 p-2 text-sm whitespace-pre-wrap break-all`,children:[i.slice(0,50).join(`
296
296
  `),i.length>50?`\n…and ${i.length-50} more`:``]}),(0,H.jsxs)(fr,{children:[(0,H.jsx)(pr,{onClick:()=>n(!1),children:`Cancel`}),(0,H.jsx)(dr,{className:v({variant:`destructive`}),onClick:()=>n(!0),children:r?db(r):`Overwrite`})]})]})})}function pb(){let{value:e,trigger:t}=Vt(`ShowRedeployApplicationModal`,!1),n=S(),r=Ve(),i=ar(),a=on(),o=uy(r),{openedEntry:s}=V(),c=s?.package,{mutate:l,isPending:u}=py(),[d,f]=(0,B.useState)(!1),p=ee({defaultValues:{applicationUrl:c,installCommand:``}}),{control:m,handleSubmit:h,reset:g}=p;(0,B.useEffect)(()=>{g({applicationUrl:c})},[g,c]);let _=(0,B.useCallback)(()=>{R(`ShowRedeployApplicationModal`,!1),rb(t),g({applicationUrl:c}),f(!1),a.reset()},[g,c,t,a]),v=(0,B.useCallback)(()=>{n.invalidateQueries({queryKey:[r.entityId,`get_components`],refetchType:`active`})},[n,r.entityId]),b=(0,B.useCallback)((e,t)=>{if(!s)return;let n=s.project;a.reset(),a.markStarted(),f(!0),l({applicationName:n,applicationUrl:e,installCommand:t,useSSE:!0,onEvent:a.onEvent,...r},{onSuccess:async()=>{a.markSettled(`success`),v();let e=await o(n);dy(n,e),_()},onError:async e=>{if(e instanceof nt){a.markSettled(`inconclusive`),v();let e=await o(n);dy(n,e),_();return}a.markSettled(`error`,e instanceof Error?e.message:String(e)),P.error(`Failed to redeploy ${n}`,{description:e instanceof Error?e.message:void 0})}})},[l,s,r,a,v,o,_]),x=(0,B.useCallback)((e,t)=>{if(!s)return;_();let n=P.loading(`Redeploying...`);l({applicationName:s.project,applicationUrl:e,installCommand:t,...r},{onSuccess:()=>{P.success(`Application ${s.project} redeployed successfully`,{id:n}),v()},onError:()=>{P.dismiss(n)}})},[l,s,r,v,_]),C=({applicationUrl:e,installCommand:t})=>{e&&(i?b(e,t):x(e,t))};return(0,H.jsx)(ie,{onOpenChange:_,open:e,children:(0,H.jsxs)(ce,{"aria-describedby":void 0,className:`text-popover-foreground`,children:[(0,H.jsxs)(oe,{children:[(0,H.jsx)(de,{children:`Redeploy Package`}),(0,H.jsx)(me,{children:d?`Redeploying ${s?.project??`package`}…`:`Redeploy this package?`})]}),d?(0,H.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,H.jsx)(rr,{state:a.state}),(0,H.jsx)(y,{type:`button`,variant:`ghostOutline`,className:`w-full`,onClick:_,disabled:u,children:u?`Deploying…`:`Close`})]}):(0,H.jsx)(`div`,{children:(0,H.jsx)(Yn,{...p,children:(0,H.jsxs)(`form`,{id:`instance-redeploy-app-form`,name:`instance-redeploy-app-form`,className:`flex flex-col w-full gap-4`,onSubmit:h(C),children:[(0,H.jsx)(sn,{control:m,name:`applicationUrl`,render:({field:e})=>(0,H.jsxs)(Hn,{children:[(0,H.jsx)(rn,{className:`pb-1`,children:`Package Reference`}),(0,H.jsx)(Dn,{children:(0,H.jsx)(Bn,{type:`text`,autoFocus:!0,...e})}),(0,H.jsx)(bn,{})]})}),(0,H.jsx)(sn,{control:m,name:`installCommand`,render:({field:e})=>(0,H.jsxs)(Hn,{children:[(0,H.jsx)(rn,{className:`pb-1`,children:`Install Command`}),(0,H.jsx)(Dn,{children:(0,H.jsx)(Bn,{type:`text`,placeholder:`npm install`,...e})}),(0,H.jsx)(bn,{})]})}),(0,H.jsxs)(y,{variant:`positiveOutline`,type:`submit`,className:`w-full`,disabled:u,children:[(0,H.jsx)(Nt,{}),` Redeploy Application`]}),(0,H.jsx)(y,{type:`button`,variant:`ghostOutline`,className:`w-full`,onClick:_,disabled:u,children:`Cancel`})]})})})]})})}function mb(e){return Ne(e.split(`/`).slice(0,-1))}function hb(e,t){return Ne(mb(e),t)}function gb(e){return z(e)?e.entries.flatMap(gb):[e]}function _b(){let{value:e,trigger:t}=Vt(`ShowRenameFileModal`,!1),n=(0,B.useCallback)(()=>{R(`ShowRenameFileModal`,!1),rb(t)},[t]),{openedEntry:r,entryExists:i,reloadRootEntries:a}=V(),o=Ve(),s=m.object({name:m.string().nonempty({error:`Please enter a valid name.`}).regex(/^[a-zA-Z0-9_\- .]*$/,{error:`Names can only contain letters, numbers, underscores, hyphens, periods, and spaces.`}).max(50,{error:`Names cannot be longer than 50 characters.`}).trim().refine(e=>e!==r?.name,{error:`Please enter a new name.`})}),[c,l]=(0,B.useState)(!1),u=ii(),d=ee({resolver:N(s)});(0,B.useEffect)(()=>{r?.name&&d.reset({name:r?.name})},[d,r?.name]);let f=(0,B.useCallback)(async e=>{if(!r)return;let t=hb(r.path,e.name),s=z(r);if(i(t)&&!await si({files:s?[]:[t],directories:s?[t]:[]}))return;let c=s?gb(r).map(e=>({from:e.path,to:t+e.path.slice(r.path.length)})):[{from:r.path,to:t}];l(!0);let f=await u(c);if(f&&s){let e=e=>e.split(`/`).slice(1).join(`/`);try{c.length===0&&await Le({...o,project:r.project,file:e(t),payload:void 0}),await Ee({...o,project:r.project,file:e(r.path)}),await a()}catch(e){P.error(`Rename Failed`,{description:e instanceof Error?e.message:`Could not remove the original directory.`}),l(!1);return}}l(!1),f&&(n(),d.reset(),R(s?`FocusFileTree`:`FocusEditor`,!0))},[n,i,d,o,r,a,u,l]),p=(0,B.useCallback)(()=>{n(),d.reset()},[n,d]);return(0,H.jsx)(ie,{onOpenChange:n,open:e,children:(0,H.jsx)(ce,{"aria-describedby":void 0,className:`text-popover-foreground`,onOpenAutoFocus:e=>{e.preventDefault(),requestAnimationFrame(()=>d.setFocus(`name`,{shouldSelect:!0}))},children:(0,H.jsx)(Yn,{...d,children:(0,H.jsxs)(`form`,{id:`instance-rename-app-file-form`,name:`instance-rename-app-file-form`,onSubmit:d.handleSubmit(f),children:[(0,H.jsxs)(oe,{children:[(0,H.jsxs)(de,{children:[`Rename `,z(r)?`Directory`:`File`]}),(0,H.jsx)(me,{children:r?.path})]}),(0,H.jsx)(sn,{control:d.control,name:`name`,render:({field:e})=>(0,H.jsxs)(Hn,{className:`my-2`,children:[(0,H.jsx)(rn,{children:`Name`}),(0,H.jsx)(Dn,{children:(0,H.jsx)(Bn,{disabled:c,type:`text`,autoComplete:`off`,autoCapitalize:`off`,...e})}),(0,H.jsx)(bn,{})]})}),(0,H.jsx)(ae,{children:(0,H.jsxs)(`div`,{className:`flex justify-between w-full`,children:[(0,H.jsx)(y,{type:`button`,variant:`ghostOutline`,onClick:p,children:`Cancel`}),(0,H.jsxs)(y,{variant:`positiveOutline`,type:`submit`,disabled:c||!d.formState.isDirty||!d.formState.isValid,children:[(0,H.jsx)(_e,{}),` Rename`]})]})})]})})})})}function vb(){let e=Qt(),t=x({strict:!1}),{toggle:n,toggled:r}=ni(`ApplicationsSidebarOpened`,!0),{width:i,isResizing:a,startResizing:o}=Za();if(!e)return(0,H.jsx)(T,{to:$n(t,`databases`)});let s={"--app-sidebar-width":`${i}px`};return(0,H.jsxs)(nb,{children:[(0,H.jsxs)(`aside`,{id:`file-explorer-sidebar`,style:s,className:l(`pt-[calc(--spacing(32))] w-[var(--app-sidebar-width)] fixed top-0 left-0 bottom-0 z-30`,`bg-violet-50 border-r border-violet-200 shadow shadow-black/10`,`dark:bg-grey-700 dark:border-grey-600 dark:shadow-black`,`transition-transform -translate-x-full`,r?`translate-x-0`:`md:translate-x-0`),"aria-label":`Sidebar`,children:[(0,H.jsx)(Ya,{}),(0,H.jsx)(Qa,{isResizing:a,onMouseDown:o})]}),(0,H.jsxs)(`div`,{style:s,className:l(`applications-content`,`overflow-y-auto overflow-x-hidden`,`fixed top-32 right-0 bottom-0 left-0`,!a&&`transition-[left]`,`md:left-[var(--app-sidebar-width)]`,r&&`sm:left-[var(--app-sidebar-width)]`),children:[(0,H.jsx)(Xy,{}),(0,H.jsx)(uo,{toggledSidebar:r,toggleSidebar:n})]}),(0,H.jsx)(ab,{}),(0,H.jsx)(sb,{}),(0,H.jsx)(ub,{}),(0,H.jsx)(pb,{}),(0,H.jsx)(_b,{}),(0,H.jsx)(fb,{})]})}export{vb as ApplicationsEditor};
297
- //# sourceMappingURL=applications-D03NA7wW.js.map
297
+ //# sourceMappingURL=applications-9SEVLIO5.js.map