@powerhousedao/connect 3.3.0-dev.3 → 3.3.0-dev.4

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 (93) hide show
  1. package/dist/assets/{AddDriveModal.BWLDv9-A.js → AddDriveModal.CJPjKF1s.js} +2 -2
  2. package/dist/assets/{AddDriveModal.BWLDv9-A.js.map → AddDriveModal.CJPjKF1s.js.map} +1 -1
  3. package/dist/assets/{AddLocalDriveModal.BJL0ePdk.js → AddLocalDriveModal.BAkHn56-.js} +2 -2
  4. package/dist/assets/{AddLocalDriveModal.BJL0ePdk.js.map → AddLocalDriveModal.BAkHn56-.js.map} +1 -1
  5. package/dist/assets/{AddRemoteDriveModal.DLdo_wgd.js → AddRemoteDriveModal.BeBjr_Gc.js} +2 -2
  6. package/dist/assets/{AddRemoteDriveModal.DLdo_wgd.js.map → AddRemoteDriveModal.BeBjr_Gc.js.map} +1 -1
  7. package/dist/assets/{ConfirmationModal.BVWHyq8I.js → ConfirmationModal.C1UZuSFY.js} +2 -2
  8. package/dist/assets/{ConfirmationModal.BVWHyq8I.js.map → ConfirmationModal.C1UZuSFY.js.map} +1 -1
  9. package/dist/assets/{CookiesPolicyModal.DTMmXTXa.js → CookiesPolicyModal.B-ZxNrOu.js} +2 -2
  10. package/dist/assets/{CookiesPolicyModal.DTMmXTXa.js.map → CookiesPolicyModal.B-ZxNrOu.js.map} +1 -1
  11. package/dist/assets/{CreateDocumentModal.CKf9_npU.js → CreateDocumentModal.CpHnFnUJ.js} +2 -2
  12. package/dist/assets/{CreateDocumentModal.CKf9_npU.js.map → CreateDocumentModal.CpHnFnUJ.js.map} +1 -1
  13. package/dist/assets/{DebugSettingsModal.DXakhKUJ.js → DebugSettingsModal.D3A_JtOs.js} +2 -2
  14. package/dist/assets/{DebugSettingsModal.DXakhKUJ.js.map → DebugSettingsModal.D3A_JtOs.js.map} +1 -1
  15. package/dist/assets/{DeleteDriveModal.Bbpouoff.js → DeleteDriveModal.D8Ch4AyV.js} +2 -2
  16. package/dist/assets/{DeleteDriveModal.Bbpouoff.js.map → DeleteDriveModal.D8Ch4AyV.js.map} +1 -1
  17. package/dist/assets/{DeleteItemModal.De0DPxV8.js → DeleteItemModal.DqemXyAD.js} +2 -2
  18. package/dist/assets/{DeleteItemModal.De0DPxV8.js.map → DeleteItemModal.DqemXyAD.js.map} +1 -1
  19. package/dist/assets/{DisclaimerModal.BiQFbwZ6.js → DisclaimerModal.Cz1xkiPi.js} +2 -2
  20. package/dist/assets/{DisclaimerModal.BiQFbwZ6.js.map → DisclaimerModal.Cz1xkiPi.js.map} +1 -1
  21. package/dist/assets/{DriveSettingsModal.DF2Lz9YO.js → DriveSettingsModal.BS8aHEgW.js} +2 -2
  22. package/dist/assets/{DriveSettingsModal.DF2Lz9YO.js.map → DriveSettingsModal.BS8aHEgW.js.map} +1 -1
  23. package/dist/assets/{SettingsModal.0rI7lRqF.js → SettingsModal.Csoz4048.js} +2 -2
  24. package/dist/assets/{SettingsModal.0rI7lRqF.js.map → SettingsModal.Csoz4048.js.map} +1 -1
  25. package/dist/assets/{Trans.9WMVTRYl.js → Trans.LIVu639i.js} +2 -2
  26. package/dist/assets/{Trans.9WMVTRYl.js.map → Trans.LIVu639i.js.map} +1 -1
  27. package/dist/assets/{UpgradeDriveModal.Dglc4A67.js → UpgradeDriveModal.CNx8GF4J.js} +2 -2
  28. package/dist/assets/{UpgradeDriveModal.Dglc4A67.js.map → UpgradeDriveModal.CNx8GF4J.js.map} +1 -1
  29. package/dist/assets/app-skeleton.js +1 -1
  30. package/dist/assets/{app.Brcw_g_p.js → app.BdxMoAAL.js} +5 -5
  31. package/dist/assets/app.BdxMoAAL.js.map +1 -0
  32. package/dist/assets/{atlas-import.CjA9uDEt.js → atlas-import.BaW3Y7_S.js} +2 -2
  33. package/dist/assets/{atlas-import.CjA9uDEt.js.map → atlas-import.BaW3Y7_S.js.map} +1 -1
  34. package/dist/assets/{connect.config._A2guXhv.js → connect.config.CzMoERNI.js} +2 -2
  35. package/dist/assets/{connect.config._A2guXhv.js.map → connect.config.CzMoERNI.js.map} +1 -1
  36. package/dist/assets/{content.mtsZfVv6.js → content.BtkNuaBR.js} +3 -3
  37. package/dist/assets/{content.mtsZfVv6.js.map → content.BtkNuaBR.js.map} +1 -1
  38. package/dist/assets/{cookie-banner.7WqE8VdG.js → cookie-banner.CQakPLqU.js} +2 -2
  39. package/dist/assets/{cookie-banner.7WqE8VdG.js.map → cookie-banner.CQakPLqU.js.map} +1 -1
  40. package/dist/assets/{home.CHwcgR2d.js → home.CRGUjEn-.js} +2 -2
  41. package/dist/assets/{home.CHwcgR2d.js.map → home.CRGUjEn-.js.map} +1 -1
  42. package/dist/assets/{index.BGemDCBc.js → index.BcBVmRI8.js} +3 -3
  43. package/dist/assets/{index.BGemDCBc.js.map → index.BcBVmRI8.js.map} +1 -1
  44. package/dist/assets/{index.UWl3P2EU.js → index.C03E0kfk.js} +2 -2
  45. package/dist/assets/{index.UWl3P2EU.js.map → index.C03E0kfk.js.map} +1 -1
  46. package/dist/assets/{index.BvX7i3ya.js → index.CCtK4G2j.js} +2 -2
  47. package/dist/assets/{index.BvX7i3ya.js.map → index.CCtK4G2j.js.map} +1 -1
  48. package/dist/assets/{index.Dwexo_zk.js → index.CsZYy69M.js} +3 -3
  49. package/dist/assets/{index.Dwexo_zk.js.map → index.CsZYy69M.js.map} +1 -1
  50. package/dist/assets/{index.Q6GFaI_V.js → index.DQ6Y_BFS.js} +2 -2
  51. package/dist/assets/{index.Q6GFaI_V.js.map → index.DQ6Y_BFS.js.map} +1 -1
  52. package/dist/assets/{index.DE5r83gK.js → index.DUXGJnxw.js} +2 -2
  53. package/dist/assets/{index.DE5r83gK.js.map → index.DUXGJnxw.js.map} +1 -1
  54. package/dist/assets/{index.DWdwQnZG.js → index.DbzMt0Q8.js} +2 -2
  55. package/dist/assets/{index.DWdwQnZG.js.map → index.DbzMt0Q8.js.map} +1 -1
  56. package/dist/assets/{index.C_GzfUCS.js → index.IOLzgUZt.js} +2 -2
  57. package/dist/assets/{index.C_GzfUCS.js.map → index.IOLzgUZt.js.map} +1 -1
  58. package/dist/assets/{main.DaM0PlWx.js → main.Dmte0hti.js} +3 -3
  59. package/dist/assets/{main.DaM0PlWx.js.map → main.Dmte0hti.js.map} +1 -1
  60. package/dist/assets/{modal.BFkV0xND.js → modal.BbdrOfry.js} +3 -3
  61. package/dist/assets/{modal.BFkV0xND.js.map → modal.BbdrOfry.js.map} +1 -1
  62. package/dist/assets/{modals.B3lvHv29.js → modals.BuTWliYF.js} +2 -2
  63. package/dist/assets/{modals.B3lvHv29.js.map → modals.BuTWliYF.js.map} +1 -1
  64. package/dist/assets/{nodefs.DfCwvm03.js → nodefs.Dt53RQvO.js} +2 -2
  65. package/dist/assets/{nodefs.DfCwvm03.js.map → nodefs.Dt53RQvO.js.map} +1 -1
  66. package/dist/assets/{opfs-ahp.DhpsuWfZ.js → opfs-ahp.CO8kl4hl.js} +2 -2
  67. package/dist/assets/{opfs-ahp.DhpsuWfZ.js.map → opfs-ahp.CO8kl4hl.js.map} +1 -1
  68. package/dist/assets/{react-error-boundary.esm.BdKfLyaR.js → react-error-boundary.esm.DHp-mKwc.js} +2 -2
  69. package/dist/assets/{react-error-boundary.esm.BdKfLyaR.js.map → react-error-boundary.esm.DHp-mKwc.js.map} +1 -1
  70. package/dist/assets/{registerServiceWorker.w3jaNxQm.js → registerServiceWorker.C2QkuGt_.js} +2 -2
  71. package/dist/assets/{registerServiceWorker.w3jaNxQm.js.map → registerServiceWorker.C2QkuGt_.js.map} +1 -1
  72. package/dist/assets/{root.C9pGPT_U.js → root.OJGI0z2p.js} +2 -2
  73. package/dist/assets/{root.C9pGPT_U.js.map → root.OJGI0z2p.js.map} +1 -1
  74. package/dist/assets/{toast.CJBPfWGX.js → toast.BwLkWP-U.js} +2 -2
  75. package/dist/assets/{toast.CJBPfWGX.js.map → toast.BwLkWP-U.js.map} +1 -1
  76. package/dist/assets/{useAcceptedCookies.B2E2vhVo.js → useAcceptedCookies.Be0ZV09a.js} +2 -2
  77. package/dist/assets/{useAcceptedCookies.B2E2vhVo.js.map → useAcceptedCookies.Be0ZV09a.js.map} +1 -1
  78. package/dist/assets/useConnectConfig.DZ65pVmg.js +2 -0
  79. package/dist/assets/{useConnectConfig.CwkmyF48.js.map → useConnectConfig.DZ65pVmg.js.map} +1 -1
  80. package/dist/assets/useDefaultDocumentModelEditor.CdkEVA6g.js +2 -0
  81. package/dist/assets/{useDefaultDocumentModelEditor.DcbpTZSv.js.map → useDefaultDocumentModelEditor.CdkEVA6g.js.map} +1 -1
  82. package/dist/assets/{useDocumentDriveServer.ArDMFxnb.js → useDocumentDriveServer.6V2gzdbc.js} +2 -2
  83. package/dist/assets/{useDocumentDriveServer.ArDMFxnb.js.map → useDocumentDriveServer.6V2gzdbc.js.map} +1 -1
  84. package/dist/assets/{useFeatureFlags.BTVpX3W5.js → useFeatureFlags.Dk1vb5i-.js} +2 -2
  85. package/dist/assets/{useFeatureFlags.BTVpX3W5.js.map → useFeatureFlags.Dk1vb5i-.js.map} +1 -1
  86. package/dist/assets/{user.DBQJIPxu.js → user.zVDczLr_.js} +4 -4
  87. package/dist/assets/{user.DBQJIPxu.js.map → user.zVDczLr_.js.map} +1 -1
  88. package/dist/index.html +1 -1
  89. package/dist/vite-envs.sh +1 -1
  90. package/package.json +9 -9
  91. package/dist/assets/app.Brcw_g_p.js.map +0 -1
  92. package/dist/assets/useConnectConfig.CwkmyF48.js +0 -2
  93. package/dist/assets/useDefaultDocumentModelEditor.DcbpTZSv.js +0 -2
@@ -1,6 +1,6 @@
1
- import{jsx as o,jsxs as g,Fragment as b}from"react/jsx-runtime";import*as t from"react";import{useRef as A,useState as h,useEffect as C,useCallback as v,useMemo as k}from"react";import{B as U,ao as F,ap as I}from"./index.BGemDCBc.js";import{t as D}from"./toast.CJBPfWGX.js";import{h as R}from"./useFeatureFlags.BTVpX3W5.js";import{i as N,e as S,d as M}from"./index.CAUjMUXb.js";import{u as T}from"./useDocumentDriveServer.ArDMFxnb.js";import"react-dom";import"./user.DBQJIPxu.js";import"./connect.config._A2guXhv.js";import"./browser.BkwNmV2Z.js";import"./index.Dwexo_zk.js";import"react-dom/client";import"./app-skeleton.js";const B=e=>t.createElement("svg",{width:28,height:32,viewBox:"0 0 28 32",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},t.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M0.05092 23.7286L0.000163347 23.9993L0 23.9995L0.207853 24.067L27.6823 24.067L27.9995 23.9995L27.9161 23.6913L14.2182 0.209032L13.9998 0L13.749 0.246353L0.05092 23.7286ZM20.9994 11.9999L7.0003 11.9999L13.9998 23.999L20.9994 11.9999Z",fill:"url(#paint0_radial_319_20865)"}),t.createElement("path",{d:"M14 0L0 23.9998V7.99993L14 0Z",fill:"url(#paint1_linear_319_20865)"}),t.createElement("path",{d:"M28 24L7.82013e-05 24L14 31.9999L28 24Z",fill:"url(#paint2_linear_319_20865)"}),t.createElement("path",{d:"M14 0L28 23.9998V7.99993L14 0Z",fill:"url(#paint3_linear_319_20865)"}),t.createElement("defs",null,t.createElement("radialGradient",{id:"paint0_radial_319_20865",cx:0,cy:0,r:1,gradientUnits:"userSpaceOnUse",gradientTransform:"translate(13.9994 16.0344) rotate(-89.9988) scale(16.0344 16.201)"},t.createElement("stop",{offset:.181008,stopColor:"#FFCD6B"}),t.createElement("stop",{offset:1,stopColor:"#EB5EDF"})),t.createElement("linearGradient",{id:"paint1_linear_319_20865",x1:-.031454,y1:24.041,x2:13.801,y2:-.142908,gradientUnits:"userSpaceOnUse"},t.createElement("stop",{stopColor:"#4331E9"}),t.createElement("stop",{offset:1,stopColor:"#A273FF"})),t.createElement("linearGradient",{id:"paint2_linear_319_20865",x1:-.0310093,y1:24,x2:28.0444,y2:24,gradientUnits:"userSpaceOnUse"},t.createElement("stop",{stopColor:"#A273FF"}),t.createElement("stop",{offset:1,stopColor:"#4331E9"})),t.createElement("linearGradient",{id:"paint3_linear_319_20865",x1:28.0315,y1:24.041,x2:14.199,y2:-.142908,gradientUnits:"userSpaceOnUse"},t.createElement("stop",{stopColor:"#A273FF"}),t.createElement("stop",{offset:1,stopColor:"#4331E9"})))),O=e=>t.createElement("svg",{width:16,height:16,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},t.createElement("path",{d:"M15.6867 8.03333C15.4933 7.83999 15.1733 7.83999 14.98 8.03333L14.6733 8.34001V8C14.6733 4.32 11.68 1.32666 7.99999 1.32666C5.96666 1.32666 4.06666 2.23999 2.79333 3.82666C2.61999 4.03999 2.65332 4.35999 2.87332 4.52665C3.08666 4.69999 3.40666 4.66666 3.57332 4.44666C4.65999 3.09332 6.27332 2.31999 7.99999 2.31999C11.1267 2.31999 13.6733 4.86666 13.6733 7.99333V8.32666L13.3667 8.02002C13.1733 7.82669 12.8533 7.82669 12.66 8.02002C12.4667 8.21335 12.4667 8.53335 12.66 8.72668L13.82 9.88668C13.8667 9.93334 13.92 9.96666 13.98 9.99333C14.04 10.02 14.1067 10.0333 14.1733 10.0333C14.24 10.0333 14.3 10.02 14.3667 9.99333C14.4267 9.96666 14.48 9.93334 14.5267 9.88668L15.6867 8.72668C15.88 8.54668 15.88 8.22666 15.6867 8.03333Z",fill:"#6C7275"}),t.createElement("path",{d:"M13.1267 11.4666C12.9133 11.2933 12.5933 11.3266 12.4267 11.5466C11.34 12.9 9.72665 13.6733 7.99998 13.6733C4.87332 13.6733 2.32665 11.1266 2.32665 7.99996V7.66663L2.63332 7.97331C2.73332 8.07331 2.85999 8.11996 2.98665 8.11996C3.11332 8.11996 3.23999 8.07331 3.33999 7.97331C3.53332 7.77998 3.53332 7.45998 3.33999 7.26664L2.17998 6.10661C2.13332 6.05994 2.07998 6.02663 2.01998 5.99996C1.89998 5.94663 1.75998 5.94663 1.63998 5.99996C1.57998 6.02663 1.52665 6.05994 1.47999 6.10661L0.319988 7.26664C0.126654 7.45998 0.126654 7.77998 0.319988 7.97331C0.513321 8.16664 0.833319 8.16664 1.02665 7.97331L1.33332 7.66663V7.99996C1.33332 11.68 4.32665 14.6733 8.00665 14.6733C10.04 14.6733 11.94 13.76 13.2133 12.1733C13.38 11.96 13.3467 11.64 13.1267 11.4666Z",fill:"#6C7275"})),P="https://apps.powerhouse.io/sky-atlas/staging/switchboard",Z=2e3;function $(){const{search:e}=M();return k(()=>{const a=new URLSearchParams(e).get("reactorUrl")??P;return a.endsWith("/")?a:`${a}/`},[e])}async function V(e,s){const a=F`
1
+ import{jsx as o,jsxs as g,Fragment as b}from"react/jsx-runtime";import*as t from"react";import{useRef as A,useState as h,useEffect as C,useCallback as v,useMemo as k}from"react";import{B as U,ao as F,ap as I}from"./index.BcBVmRI8.js";import{t as D}from"./toast.BwLkWP-U.js";import{h as R}from"./useFeatureFlags.Dk1vb5i-.js";import{i as N,e as S,d as M}from"./index.CAUjMUXb.js";import{u as T}from"./useDocumentDriveServer.6V2gzdbc.js";import"react-dom";import"./user.zVDczLr_.js";import"./connect.config.CzMoERNI.js";import"./browser.BkwNmV2Z.js";import"./index.CsZYy69M.js";import"react-dom/client";import"./app-skeleton.js";const B=e=>t.createElement("svg",{width:28,height:32,viewBox:"0 0 28 32",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},t.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M0.05092 23.7286L0.000163347 23.9993L0 23.9995L0.207853 24.067L27.6823 24.067L27.9995 23.9995L27.9161 23.6913L14.2182 0.209032L13.9998 0L13.749 0.246353L0.05092 23.7286ZM20.9994 11.9999L7.0003 11.9999L13.9998 23.999L20.9994 11.9999Z",fill:"url(#paint0_radial_319_20865)"}),t.createElement("path",{d:"M14 0L0 23.9998V7.99993L14 0Z",fill:"url(#paint1_linear_319_20865)"}),t.createElement("path",{d:"M28 24L7.82013e-05 24L14 31.9999L28 24Z",fill:"url(#paint2_linear_319_20865)"}),t.createElement("path",{d:"M14 0L28 23.9998V7.99993L14 0Z",fill:"url(#paint3_linear_319_20865)"}),t.createElement("defs",null,t.createElement("radialGradient",{id:"paint0_radial_319_20865",cx:0,cy:0,r:1,gradientUnits:"userSpaceOnUse",gradientTransform:"translate(13.9994 16.0344) rotate(-89.9988) scale(16.0344 16.201)"},t.createElement("stop",{offset:.181008,stopColor:"#FFCD6B"}),t.createElement("stop",{offset:1,stopColor:"#EB5EDF"})),t.createElement("linearGradient",{id:"paint1_linear_319_20865",x1:-.031454,y1:24.041,x2:13.801,y2:-.142908,gradientUnits:"userSpaceOnUse"},t.createElement("stop",{stopColor:"#4331E9"}),t.createElement("stop",{offset:1,stopColor:"#A273FF"})),t.createElement("linearGradient",{id:"paint2_linear_319_20865",x1:-.0310093,y1:24,x2:28.0444,y2:24,gradientUnits:"userSpaceOnUse"},t.createElement("stop",{stopColor:"#A273FF"}),t.createElement("stop",{offset:1,stopColor:"#4331E9"})),t.createElement("linearGradient",{id:"paint3_linear_319_20865",x1:28.0315,y1:24.041,x2:14.199,y2:-.142908,gradientUnits:"userSpaceOnUse"},t.createElement("stop",{stopColor:"#A273FF"}),t.createElement("stop",{offset:1,stopColor:"#4331E9"})))),O=e=>t.createElement("svg",{width:16,height:16,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},t.createElement("path",{d:"M15.6867 8.03333C15.4933 7.83999 15.1733 7.83999 14.98 8.03333L14.6733 8.34001V8C14.6733 4.32 11.68 1.32666 7.99999 1.32666C5.96666 1.32666 4.06666 2.23999 2.79333 3.82666C2.61999 4.03999 2.65332 4.35999 2.87332 4.52665C3.08666 4.69999 3.40666 4.66666 3.57332 4.44666C4.65999 3.09332 6.27332 2.31999 7.99999 2.31999C11.1267 2.31999 13.6733 4.86666 13.6733 7.99333V8.32666L13.3667 8.02002C13.1733 7.82669 12.8533 7.82669 12.66 8.02002C12.4667 8.21335 12.4667 8.53335 12.66 8.72668L13.82 9.88668C13.8667 9.93334 13.92 9.96666 13.98 9.99333C14.04 10.02 14.1067 10.0333 14.1733 10.0333C14.24 10.0333 14.3 10.02 14.3667 9.99333C14.4267 9.96666 14.48 9.93334 14.5267 9.88668L15.6867 8.72668C15.88 8.54668 15.88 8.22666 15.6867 8.03333Z",fill:"#6C7275"}),t.createElement("path",{d:"M13.1267 11.4666C12.9133 11.2933 12.5933 11.3266 12.4267 11.5466C11.34 12.9 9.72665 13.6733 7.99998 13.6733C4.87332 13.6733 2.32665 11.1266 2.32665 7.99996V7.66663L2.63332 7.97331C2.73332 8.07331 2.85999 8.11996 2.98665 8.11996C3.11332 8.11996 3.23999 8.07331 3.33999 7.97331C3.53332 7.77998 3.53332 7.45998 3.33999 7.26664L2.17998 6.10661C2.13332 6.05994 2.07998 6.02663 2.01998 5.99996C1.89998 5.94663 1.75998 5.94663 1.63998 5.99996C1.57998 6.02663 1.52665 6.05994 1.47999 6.10661L0.319988 7.26664C0.126654 7.45998 0.126654 7.77998 0.319988 7.97331C0.513321 8.16664 0.833319 8.16664 1.02665 7.97331L1.33332 7.66663V7.99996C1.33332 11.68 4.32665 14.6733 8.00665 14.6733C10.04 14.6733 11.94 13.76 13.2133 12.1733C13.38 11.96 13.3467 11.64 13.1267 11.4666Z",fill:"#6C7275"})),P="https://apps.powerhouse.io/sky-atlas/staging/switchboard",Z=2e3;function $(){const{search:e}=M();return k(()=>{const a=new URLSearchParams(e).get("reactorUrl")??P;return a.endsWith("/")?a:`${a}/`},[e])}async function V(e,s){const a=F`
2
2
  mutation ForkAtlas($docId: PHID) {
3
3
  ForkAtlas(docId: $docId)
4
4
  }
5
5
  `;return await I(`${s}graphql`,a,{docId:e})}function ae(){const e=A("initial"),s=R(),{documentId:a}=N(),l=$(),c=S(),{addRemoteDrive:L}=T(),[n,w]=h(void 0),[d,m]=h(void 0),[p,E]=h(!0),u=e.current==="error";C(()=>{d&&(console.error("Error forking Atlas:",d),D("Error forking Atlas",{type:"error"}))},[d]);async function x(r){const i=(await V(r,l)).ForkAtlas;e.current="forked",w(i)}const y=v(()=>{n&&!p&&c(`/d/${n}`,{replace:!0})},[n,c,p]),_=v(async r=>{console.log("Adding remote drive:",r);const f=`${l}d/${r}`;try{const i=await L(f,{sharingType:"PUBLIC",availableOffline:!0,listeners:[{block:!0,callInfo:{data:f,name:"switchboard-push",transmitterType:"SwitchboardPush"},filter:{branch:["main"],documentId:["*"],documentType:["*"],scope:["global"]},label:"Switchboard Sync",listenerId:"1",system:!0}],triggers:[]});e.current="done",console.log("Added remote drive:",i),setTimeout(()=>{E(!1)},Z)}catch(i){e.current="error",E(!1),m(i)}},[L,c,l]);return C(()=>{!a||e.current!=="initial"||(e.current="forking",x(a).catch(r=>{e.current="error",m(r)}))},[a,e]),C(()=>{!n||!s||e.current!=="forked"||(e.current="addingDrive",new Promise(r=>{setTimeout(r,500)}).then(()=>_(n)).catch(r=>{e.current="error",m(r)}))},[n,s,e]),o("div",{className:"bg-gray-50 size-full flex justify-center gap-x-4",children:g("div",{className:"bg-white rounded-2xl w-full max-w-[850px] drop-shadow-sm p-6",children:[o("h1",{className:"text-lg text-gray-900 font-medium",children:"Welcome to the Atlas Explorer"}),o("div",{className:"mt-4 bg-gray-50 border border-gray-200 rounded-xl p-6",children:g("div",{className:"bg-slate-50 rounded-2xl min-h-80 flex flex-col justify-center items-center",children:[o("div",{children:o(B,{})}),u?o("div",{className:"text-sm text-gray-800 mt-3",children:"Error forking Atlas scope. Please try again."}):o("div",{className:"text-sm text-gray-500 mt-3",children:"Forking Atlas scope..."}),o(U,{onClick:u?window.location.reload.bind(window.location):y,size:"small",color:"light",className:"bg-white border border-gray-200 h-9 px-3 mt-4 text-gray-600",children:u?"Retry":p?g(b,{children:[o(O,{className:"animate-spin"}),"Loading"]}):"Continue"})]})})]})})}export{ae as AtlasImport};
6
- //# sourceMappingURL=atlas-import.CjA9uDEt.js.map
6
+ //# sourceMappingURL=atlas-import.BaW3Y7_S.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"atlas-import.CjA9uDEt.js","sources":["../../assets/icons/Atlas-Logomark.svg?react","../../assets/icons/refresh.svg?react","../../src/components/demo/atlas-import.tsx"],"sourcesContent":["import * as React from \"react\";\nconst SvgAtlasLogomark = (props) => /* @__PURE__ */ React.createElement(\"svg\", { width: 28, height: 32, viewBox: \"0 0 28 32\", fill: \"none\", xmlns: \"http://www.w3.org/2000/svg\", ...props }, /* @__PURE__ */ React.createElement(\"path\", { fillRule: \"evenodd\", clipRule: \"evenodd\", d: \"M0.05092 23.7286L0.000163347 23.9993L0 23.9995L0.207853 24.067L27.6823 24.067L27.9995 23.9995L27.9161 23.6913L14.2182 0.209032L13.9998 0L13.749 0.246353L0.05092 23.7286ZM20.9994 11.9999L7.0003 11.9999L13.9998 23.999L20.9994 11.9999Z\", fill: \"url(#paint0_radial_319_20865)\" }), /* @__PURE__ */ React.createElement(\"path\", { d: \"M14 0L0 23.9998V7.99993L14 0Z\", fill: \"url(#paint1_linear_319_20865)\" }), /* @__PURE__ */ React.createElement(\"path\", { d: \"M28 24L7.82013e-05 24L14 31.9999L28 24Z\", fill: \"url(#paint2_linear_319_20865)\" }), /* @__PURE__ */ React.createElement(\"path\", { d: \"M14 0L28 23.9998V7.99993L14 0Z\", fill: \"url(#paint3_linear_319_20865)\" }), /* @__PURE__ */ React.createElement(\"defs\", null, /* @__PURE__ */ React.createElement(\"radialGradient\", { id: \"paint0_radial_319_20865\", cx: 0, cy: 0, r: 1, gradientUnits: \"userSpaceOnUse\", gradientTransform: \"translate(13.9994 16.0344) rotate(-89.9988) scale(16.0344 16.201)\" }, /* @__PURE__ */ React.createElement(\"stop\", { offset: 0.181008, stopColor: \"#FFCD6B\" }), /* @__PURE__ */ React.createElement(\"stop\", { offset: 1, stopColor: \"#EB5EDF\" })), /* @__PURE__ */ React.createElement(\"linearGradient\", { id: \"paint1_linear_319_20865\", x1: -0.031454, y1: 24.041, x2: 13.801, y2: -0.142908, gradientUnits: \"userSpaceOnUse\" }, /* @__PURE__ */ React.createElement(\"stop\", { stopColor: \"#4331E9\" }), /* @__PURE__ */ React.createElement(\"stop\", { offset: 1, stopColor: \"#A273FF\" })), /* @__PURE__ */ React.createElement(\"linearGradient\", { id: \"paint2_linear_319_20865\", x1: -0.0310093, y1: 24, x2: 28.0444, y2: 24, gradientUnits: \"userSpaceOnUse\" }, /* @__PURE__ */ React.createElement(\"stop\", { stopColor: \"#A273FF\" }), /* @__PURE__ */ React.createElement(\"stop\", { offset: 1, stopColor: \"#4331E9\" })), /* @__PURE__ */ React.createElement(\"linearGradient\", { id: \"paint3_linear_319_20865\", x1: 28.0315, y1: 24.041, x2: 14.199, y2: -0.142908, gradientUnits: \"userSpaceOnUse\" }, /* @__PURE__ */ React.createElement(\"stop\", { stopColor: \"#A273FF\" }), /* @__PURE__ */ React.createElement(\"stop\", { offset: 1, stopColor: \"#4331E9\" }))));\nexport default SvgAtlasLogomark;\n","import * as React from \"react\";\nconst SvgRefresh = (props) => /* @__PURE__ */ React.createElement(\"svg\", { width: 16, height: 16, viewBox: \"0 0 16 16\", fill: \"none\", xmlns: \"http://www.w3.org/2000/svg\", ...props }, /* @__PURE__ */ React.createElement(\"path\", { d: \"M15.6867 8.03333C15.4933 7.83999 15.1733 7.83999 14.98 8.03333L14.6733 8.34001V8C14.6733 4.32 11.68 1.32666 7.99999 1.32666C5.96666 1.32666 4.06666 2.23999 2.79333 3.82666C2.61999 4.03999 2.65332 4.35999 2.87332 4.52665C3.08666 4.69999 3.40666 4.66666 3.57332 4.44666C4.65999 3.09332 6.27332 2.31999 7.99999 2.31999C11.1267 2.31999 13.6733 4.86666 13.6733 7.99333V8.32666L13.3667 8.02002C13.1733 7.82669 12.8533 7.82669 12.66 8.02002C12.4667 8.21335 12.4667 8.53335 12.66 8.72668L13.82 9.88668C13.8667 9.93334 13.92 9.96666 13.98 9.99333C14.04 10.02 14.1067 10.0333 14.1733 10.0333C14.24 10.0333 14.3 10.02 14.3667 9.99333C14.4267 9.96666 14.48 9.93334 14.5267 9.88668L15.6867 8.72668C15.88 8.54668 15.88 8.22666 15.6867 8.03333Z\", fill: \"#6C7275\" }), /* @__PURE__ */ React.createElement(\"path\", { d: \"M13.1267 11.4666C12.9133 11.2933 12.5933 11.3266 12.4267 11.5466C11.34 12.9 9.72665 13.6733 7.99998 13.6733C4.87332 13.6733 2.32665 11.1266 2.32665 7.99996V7.66663L2.63332 7.97331C2.73332 8.07331 2.85999 8.11996 2.98665 8.11996C3.11332 8.11996 3.23999 8.07331 3.33999 7.97331C3.53332 7.77998 3.53332 7.45998 3.33999 7.26664L2.17998 6.10661C2.13332 6.05994 2.07998 6.02663 2.01998 5.99996C1.89998 5.94663 1.75998 5.94663 1.63998 5.99996C1.57998 6.02663 1.52665 6.05994 1.47999 6.10661L0.319988 7.26664C0.126654 7.45998 0.126654 7.77998 0.319988 7.97331C0.513321 8.16664 0.833319 8.16664 1.02665 7.97331L1.33332 7.66663V7.99996C1.33332 11.68 4.32665 14.6733 8.00665 14.6733C10.04 14.6733 11.94 13.76 13.2133 12.1733C13.38 11.96 13.3467 11.64 13.1267 11.4666Z\", fill: \"#6C7275\" }));\nexport default SvgRefresh;\n","import AtlasIcon from '#assets/icons/Atlas-Logomark.svg?react';\nimport RefreshIcon from '#assets/icons/refresh.svg?react';\nimport { useDocumentDriveServer } from '#hooks';\nimport { useUnwrappedReactor } from '#store';\nimport { Button } from '@powerhousedao/design-system';\nimport { gql, request } from 'graphql-request';\nimport { useCallback, useEffect, useMemo, useRef, useState } from 'react';\nimport { useLocation, useNavigate, useParams } from 'react-router-dom';\nimport { toast } from '../../services/toast';\n\nconst REACTOR_URL = 'https://apps.powerhouse.io/sky-atlas/staging/switchboard';\nconst MIN_LOADING_TIME = 2000;\n\nfunction useReactorUrl() {\n const { search } = useLocation();\n return useMemo(() => {\n const params = new URLSearchParams(search);\n const url = params.get('reactorUrl') ?? REACTOR_URL;\n return url.endsWith('/') ? url : `${url}/`;\n }, [search]);\n}\n\nasync function forkAtlas(\n docId: string,\n reactorUrl: string,\n): Promise<{ ForkAtlas: string }> {\n const document = gql`\n mutation ForkAtlas($docId: PHID) {\n ForkAtlas(docId: $docId)\n }\n `;\n return await request(`${reactorUrl}graphql`, document, { docId });\n}\n\nexport function AtlasImport() {\n const status = useRef<\n 'initial' | 'forking' | 'forked' | 'addingDrive' | 'done' | 'error'\n >('initial');\n const reactor = useUnwrappedReactor();\n const { documentId } = useParams();\n const reactorUrl = useReactorUrl();\n const navigate = useNavigate();\n const { addRemoteDrive } = useDocumentDriveServer();\n const [driveId, setDriveId] = useState<string | undefined>(undefined);\n const [error, setError] = useState<unknown>(undefined);\n const [loading, setLoading] = useState(true);\n const hasError = status.current === 'error';\n\n useEffect(() => {\n if (error) {\n console.error('Error forking Atlas:', error);\n toast('Error forking Atlas', { type: 'error' });\n }\n }, [error]);\n\n async function forkAtlasDocument(documentId: string) {\n const result = await forkAtlas(documentId, reactorUrl);\n const driveId = result.ForkAtlas;\n status.current = 'forked';\n setDriveId(driveId);\n }\n\n const redirectToDrive = useCallback(() => {\n if (driveId && !loading) {\n navigate(`/d/${driveId}`, { replace: true });\n }\n }, [driveId, navigate, loading]);\n\n const addForkDrive = useCallback(\n async (driveId: string) => {\n console.log('Adding remote drive:', driveId);\n const driveUrl = `${reactorUrl}d/${driveId}`;\n try {\n const addedDrive = await addRemoteDrive(driveUrl, {\n sharingType: 'PUBLIC',\n availableOffline: true,\n listeners: [\n {\n block: true,\n callInfo: {\n data: driveUrl,\n name: 'switchboard-push',\n transmitterType: 'SwitchboardPush',\n },\n filter: {\n branch: ['main'],\n documentId: ['*'],\n documentType: ['*'],\n scope: ['global'],\n },\n label: 'Switchboard Sync',\n listenerId: '1',\n system: true,\n },\n ],\n triggers: [],\n });\n status.current = 'done';\n console.log('Added remote drive:', addedDrive);\n setTimeout(() => {\n setLoading(false);\n }, MIN_LOADING_TIME);\n } catch (error) {\n status.current = 'error';\n setLoading(false);\n setError(error);\n }\n },\n [addRemoteDrive, navigate, reactorUrl],\n );\n\n useEffect(() => {\n if (!documentId || status.current !== 'initial') return;\n status.current = 'forking';\n forkAtlasDocument(documentId).catch(error => {\n status.current = 'error';\n setError(error);\n });\n }, [documentId, status]);\n\n useEffect(() => {\n if (!driveId || !reactor || status.current !== 'forked') return;\n status.current = 'addingDrive';\n new Promise<void>(resolve => {\n setTimeout(resolve, 500);\n })\n .then(() => addForkDrive(driveId))\n .catch(error => {\n status.current = 'error';\n setError(error);\n });\n }, [driveId, reactor, status]);\n\n return (\n <div className=\"bg-gray-50 size-full flex justify-center gap-x-4\">\n <div className=\"bg-white rounded-2xl w-full max-w-[850px] drop-shadow-sm p-6\">\n <h1 className=\"text-lg text-gray-900 font-medium\">\n Welcome to the Atlas Explorer\n </h1>\n <div className=\"mt-4 bg-gray-50 border border-gray-200 rounded-xl p-6\">\n <div className=\"bg-slate-50 rounded-2xl min-h-80 flex flex-col justify-center items-center\">\n <div>\n <AtlasIcon />\n </div>\n {hasError ? (\n <div className=\"text-sm text-gray-800 mt-3\">\n Error forking Atlas scope. Please try again.\n </div>\n ) : (\n <div className=\"text-sm text-gray-500 mt-3\">\n Forking Atlas scope...\n </div>\n )}\n <Button\n onClick={\n hasError\n ? window.location.reload.bind(\n window.location,\n )\n : redirectToDrive\n }\n size=\"small\"\n color=\"light\"\n className=\"bg-white border border-gray-200 h-9 px-3 mt-4 text-gray-600\"\n >\n {hasError ? (\n 'Retry'\n ) : loading ? (\n <>\n <RefreshIcon className=\"animate-spin\" />\n Loading\n </>\n ) : (\n 'Continue'\n )}\n </Button>\n </div>\n </div>\n </div>\n </div>\n );\n}\n"],"names":["SvgAtlasLogomark","props","React","SvgRefresh","REACTOR_URL","MIN_LOADING_TIME","useReactorUrl","search","useLocation","useMemo","url","forkAtlas","docId","reactorUrl","document","gql","request","AtlasImport","status","useRef","reactor","useUnwrappedReactor","documentId","useParams","navigate","useNavigate","addRemoteDrive","useDocumentDriveServer","driveId","setDriveId","useState","error","setError","loading","setLoading","hasError","useEffect","toast","forkAtlasDocument","redirectToDrive","useCallback","addForkDrive","driveUrl","addedDrive","resolve","jsxs","jsx","AtlasIcon","Button","Fragment","RefreshIcon"],"mappings":"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"}
1
+ {"version":3,"file":"atlas-import.BaW3Y7_S.js","sources":["../../assets/icons/Atlas-Logomark.svg?react","../../assets/icons/refresh.svg?react","../../src/components/demo/atlas-import.tsx"],"sourcesContent":["import * as React from \"react\";\nconst SvgAtlasLogomark = (props) => /* @__PURE__ */ React.createElement(\"svg\", { width: 28, height: 32, viewBox: \"0 0 28 32\", fill: \"none\", xmlns: \"http://www.w3.org/2000/svg\", ...props }, /* @__PURE__ */ React.createElement(\"path\", { fillRule: \"evenodd\", clipRule: \"evenodd\", d: \"M0.05092 23.7286L0.000163347 23.9993L0 23.9995L0.207853 24.067L27.6823 24.067L27.9995 23.9995L27.9161 23.6913L14.2182 0.209032L13.9998 0L13.749 0.246353L0.05092 23.7286ZM20.9994 11.9999L7.0003 11.9999L13.9998 23.999L20.9994 11.9999Z\", fill: \"url(#paint0_radial_319_20865)\" }), /* @__PURE__ */ React.createElement(\"path\", { d: \"M14 0L0 23.9998V7.99993L14 0Z\", fill: \"url(#paint1_linear_319_20865)\" }), /* @__PURE__ */ React.createElement(\"path\", { d: \"M28 24L7.82013e-05 24L14 31.9999L28 24Z\", fill: \"url(#paint2_linear_319_20865)\" }), /* @__PURE__ */ React.createElement(\"path\", { d: \"M14 0L28 23.9998V7.99993L14 0Z\", fill: \"url(#paint3_linear_319_20865)\" }), /* @__PURE__ */ React.createElement(\"defs\", null, /* @__PURE__ */ React.createElement(\"radialGradient\", { id: \"paint0_radial_319_20865\", cx: 0, cy: 0, r: 1, gradientUnits: \"userSpaceOnUse\", gradientTransform: \"translate(13.9994 16.0344) rotate(-89.9988) scale(16.0344 16.201)\" }, /* @__PURE__ */ React.createElement(\"stop\", { offset: 0.181008, stopColor: \"#FFCD6B\" }), /* @__PURE__ */ React.createElement(\"stop\", { offset: 1, stopColor: \"#EB5EDF\" })), /* @__PURE__ */ React.createElement(\"linearGradient\", { id: \"paint1_linear_319_20865\", x1: -0.031454, y1: 24.041, x2: 13.801, y2: -0.142908, gradientUnits: \"userSpaceOnUse\" }, /* @__PURE__ */ React.createElement(\"stop\", { stopColor: \"#4331E9\" }), /* @__PURE__ */ React.createElement(\"stop\", { offset: 1, stopColor: \"#A273FF\" })), /* @__PURE__ */ React.createElement(\"linearGradient\", { id: \"paint2_linear_319_20865\", x1: -0.0310093, y1: 24, x2: 28.0444, y2: 24, gradientUnits: \"userSpaceOnUse\" }, /* @__PURE__ */ React.createElement(\"stop\", { stopColor: \"#A273FF\" }), /* @__PURE__ */ React.createElement(\"stop\", { offset: 1, stopColor: \"#4331E9\" })), /* @__PURE__ */ React.createElement(\"linearGradient\", { id: \"paint3_linear_319_20865\", x1: 28.0315, y1: 24.041, x2: 14.199, y2: -0.142908, gradientUnits: \"userSpaceOnUse\" }, /* @__PURE__ */ React.createElement(\"stop\", { stopColor: \"#A273FF\" }), /* @__PURE__ */ React.createElement(\"stop\", { offset: 1, stopColor: \"#4331E9\" }))));\nexport default SvgAtlasLogomark;\n","import * as React from \"react\";\nconst SvgRefresh = (props) => /* @__PURE__ */ React.createElement(\"svg\", { width: 16, height: 16, viewBox: \"0 0 16 16\", fill: \"none\", xmlns: \"http://www.w3.org/2000/svg\", ...props }, /* @__PURE__ */ React.createElement(\"path\", { d: \"M15.6867 8.03333C15.4933 7.83999 15.1733 7.83999 14.98 8.03333L14.6733 8.34001V8C14.6733 4.32 11.68 1.32666 7.99999 1.32666C5.96666 1.32666 4.06666 2.23999 2.79333 3.82666C2.61999 4.03999 2.65332 4.35999 2.87332 4.52665C3.08666 4.69999 3.40666 4.66666 3.57332 4.44666C4.65999 3.09332 6.27332 2.31999 7.99999 2.31999C11.1267 2.31999 13.6733 4.86666 13.6733 7.99333V8.32666L13.3667 8.02002C13.1733 7.82669 12.8533 7.82669 12.66 8.02002C12.4667 8.21335 12.4667 8.53335 12.66 8.72668L13.82 9.88668C13.8667 9.93334 13.92 9.96666 13.98 9.99333C14.04 10.02 14.1067 10.0333 14.1733 10.0333C14.24 10.0333 14.3 10.02 14.3667 9.99333C14.4267 9.96666 14.48 9.93334 14.5267 9.88668L15.6867 8.72668C15.88 8.54668 15.88 8.22666 15.6867 8.03333Z\", fill: \"#6C7275\" }), /* @__PURE__ */ React.createElement(\"path\", { d: \"M13.1267 11.4666C12.9133 11.2933 12.5933 11.3266 12.4267 11.5466C11.34 12.9 9.72665 13.6733 7.99998 13.6733C4.87332 13.6733 2.32665 11.1266 2.32665 7.99996V7.66663L2.63332 7.97331C2.73332 8.07331 2.85999 8.11996 2.98665 8.11996C3.11332 8.11996 3.23999 8.07331 3.33999 7.97331C3.53332 7.77998 3.53332 7.45998 3.33999 7.26664L2.17998 6.10661C2.13332 6.05994 2.07998 6.02663 2.01998 5.99996C1.89998 5.94663 1.75998 5.94663 1.63998 5.99996C1.57998 6.02663 1.52665 6.05994 1.47999 6.10661L0.319988 7.26664C0.126654 7.45998 0.126654 7.77998 0.319988 7.97331C0.513321 8.16664 0.833319 8.16664 1.02665 7.97331L1.33332 7.66663V7.99996C1.33332 11.68 4.32665 14.6733 8.00665 14.6733C10.04 14.6733 11.94 13.76 13.2133 12.1733C13.38 11.96 13.3467 11.64 13.1267 11.4666Z\", fill: \"#6C7275\" }));\nexport default SvgRefresh;\n","import AtlasIcon from '#assets/icons/Atlas-Logomark.svg?react';\nimport RefreshIcon from '#assets/icons/refresh.svg?react';\nimport { useDocumentDriveServer } from '#hooks';\nimport { useUnwrappedReactor } from '#store';\nimport { Button } from '@powerhousedao/design-system';\nimport { gql, request } from 'graphql-request';\nimport { useCallback, useEffect, useMemo, useRef, useState } from 'react';\nimport { useLocation, useNavigate, useParams } from 'react-router-dom';\nimport { toast } from '../../services/toast';\n\nconst REACTOR_URL = 'https://apps.powerhouse.io/sky-atlas/staging/switchboard';\nconst MIN_LOADING_TIME = 2000;\n\nfunction useReactorUrl() {\n const { search } = useLocation();\n return useMemo(() => {\n const params = new URLSearchParams(search);\n const url = params.get('reactorUrl') ?? REACTOR_URL;\n return url.endsWith('/') ? url : `${url}/`;\n }, [search]);\n}\n\nasync function forkAtlas(\n docId: string,\n reactorUrl: string,\n): Promise<{ ForkAtlas: string }> {\n const document = gql`\n mutation ForkAtlas($docId: PHID) {\n ForkAtlas(docId: $docId)\n }\n `;\n return await request(`${reactorUrl}graphql`, document, { docId });\n}\n\nexport function AtlasImport() {\n const status = useRef<\n 'initial' | 'forking' | 'forked' | 'addingDrive' | 'done' | 'error'\n >('initial');\n const reactor = useUnwrappedReactor();\n const { documentId } = useParams();\n const reactorUrl = useReactorUrl();\n const navigate = useNavigate();\n const { addRemoteDrive } = useDocumentDriveServer();\n const [driveId, setDriveId] = useState<string | undefined>(undefined);\n const [error, setError] = useState<unknown>(undefined);\n const [loading, setLoading] = useState(true);\n const hasError = status.current === 'error';\n\n useEffect(() => {\n if (error) {\n console.error('Error forking Atlas:', error);\n toast('Error forking Atlas', { type: 'error' });\n }\n }, [error]);\n\n async function forkAtlasDocument(documentId: string) {\n const result = await forkAtlas(documentId, reactorUrl);\n const driveId = result.ForkAtlas;\n status.current = 'forked';\n setDriveId(driveId);\n }\n\n const redirectToDrive = useCallback(() => {\n if (driveId && !loading) {\n navigate(`/d/${driveId}`, { replace: true });\n }\n }, [driveId, navigate, loading]);\n\n const addForkDrive = useCallback(\n async (driveId: string) => {\n console.log('Adding remote drive:', driveId);\n const driveUrl = `${reactorUrl}d/${driveId}`;\n try {\n const addedDrive = await addRemoteDrive(driveUrl, {\n sharingType: 'PUBLIC',\n availableOffline: true,\n listeners: [\n {\n block: true,\n callInfo: {\n data: driveUrl,\n name: 'switchboard-push',\n transmitterType: 'SwitchboardPush',\n },\n filter: {\n branch: ['main'],\n documentId: ['*'],\n documentType: ['*'],\n scope: ['global'],\n },\n label: 'Switchboard Sync',\n listenerId: '1',\n system: true,\n },\n ],\n triggers: [],\n });\n status.current = 'done';\n console.log('Added remote drive:', addedDrive);\n setTimeout(() => {\n setLoading(false);\n }, MIN_LOADING_TIME);\n } catch (error) {\n status.current = 'error';\n setLoading(false);\n setError(error);\n }\n },\n [addRemoteDrive, navigate, reactorUrl],\n );\n\n useEffect(() => {\n if (!documentId || status.current !== 'initial') return;\n status.current = 'forking';\n forkAtlasDocument(documentId).catch(error => {\n status.current = 'error';\n setError(error);\n });\n }, [documentId, status]);\n\n useEffect(() => {\n if (!driveId || !reactor || status.current !== 'forked') return;\n status.current = 'addingDrive';\n new Promise<void>(resolve => {\n setTimeout(resolve, 500);\n })\n .then(() => addForkDrive(driveId))\n .catch(error => {\n status.current = 'error';\n setError(error);\n });\n }, [driveId, reactor, status]);\n\n return (\n <div className=\"bg-gray-50 size-full flex justify-center gap-x-4\">\n <div className=\"bg-white rounded-2xl w-full max-w-[850px] drop-shadow-sm p-6\">\n <h1 className=\"text-lg text-gray-900 font-medium\">\n Welcome to the Atlas Explorer\n </h1>\n <div className=\"mt-4 bg-gray-50 border border-gray-200 rounded-xl p-6\">\n <div className=\"bg-slate-50 rounded-2xl min-h-80 flex flex-col justify-center items-center\">\n <div>\n <AtlasIcon />\n </div>\n {hasError ? (\n <div className=\"text-sm text-gray-800 mt-3\">\n Error forking Atlas scope. Please try again.\n </div>\n ) : (\n <div className=\"text-sm text-gray-500 mt-3\">\n Forking Atlas scope...\n </div>\n )}\n <Button\n onClick={\n hasError\n ? window.location.reload.bind(\n window.location,\n )\n : redirectToDrive\n }\n size=\"small\"\n color=\"light\"\n className=\"bg-white border border-gray-200 h-9 px-3 mt-4 text-gray-600\"\n >\n {hasError ? (\n 'Retry'\n ) : loading ? (\n <>\n <RefreshIcon className=\"animate-spin\" />\n Loading\n </>\n ) : (\n 'Continue'\n )}\n </Button>\n </div>\n </div>\n </div>\n </div>\n );\n}\n"],"names":["SvgAtlasLogomark","props","React","SvgRefresh","REACTOR_URL","MIN_LOADING_TIME","useReactorUrl","search","useLocation","useMemo","url","forkAtlas","docId","reactorUrl","document","gql","request","AtlasImport","status","useRef","reactor","useUnwrappedReactor","documentId","useParams","navigate","useNavigate","addRemoteDrive","useDocumentDriveServer","driveId","setDriveId","useState","error","setError","loading","setLoading","hasError","useEffect","toast","forkAtlasDocument","redirectToDrive","useCallback","addForkDrive","driveUrl","addedDrive","resolve","jsxs","jsx","AtlasIcon","Button","Fragment","RefreshIcon"],"mappings":"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"}
@@ -1,2 +1,2 @@
1
- import{a$ as o,m as _,aj as t,b0 as E,ae as n,b1 as r}from"./index.BGemDCBc.js";import{g as s}from"./browser.BkwNmV2Z.js";const i="@powerhousedao/connect",c="Powerhouse-Connect",a="3.3.0-dev.3",l="Powerhouse Connect",N="./dist/index.html",d="module",C={node:">=22.0.0"},D=["dist","nginx.conf","nginx.sh","scripts"],T="AGPL-3.0-only",w="acaldas@powerhouse.inc",S={type:"git",url:"https://github.com/powerhouse-inc/powerhouse"},A={url:"https://github.com/powerhouse-inc/powerhouse/issues"},u="https://github.com/powerhouse-inc/powerhouse#readme",p={"build:tsc":"tsc --build",start:"electron-forge start",package:"electron-forge package",make:"PH_CONNECT_BASE_HREF=./ electron-forge make","make:mac":"PH_CONNECT_BASE_HREF=./ electron-forge make -p darwin","make:linux":"PH_CONNECT_BASE_HREF=./ electron-forge make -p linux","make:windows":"PH_CONNECT_BASE_HREF=./ electron-forge make -p win32","publish:electron":"electron-forge publish",prepublishOnly:"npm run build",lint:"eslint .","lint:fix":"eslint --fix .","lint:nx":"eslint --quiet --fix .",format:'prettier --write "**/*.+(js|ts|jsx|tsx|json)"',dev:"vite -c vite.renderer.config.mts","dev:nocache":"rm -rf node_modules/.vite && rm -rf node_modules/.cache && npm run dev",prebuild:"npm run clean && tsc --build --noEmit",build:"NODE_OPTIONS=--max-old-space-size=6144 vite build -c vite.renderer.config.mts",preview:"vite preview -c vite.renderer.config.mts",e2e:"playwright test","cy:open":"cypress open","build:service-worker":"tsc --build ./tsconfig.sw.json",clean:"rimraf dist","clean:node_modules":"rimraf node_modules","docker:build":"docker build -f ./Dockerfile --tag connect-test-dev --build-arg TAG=dev .","docker:run":"docker run -it -p 4000:4000 -v $(realpath ../../../monorepo):/monorepo -v $(pwd)/nginx.conf:/etc/nginx/nginx.conf.template -e PH_USE_LOCAL=true -e PH_CONNECT_BASE_PATH=/develop/powerhouse/connect -e PORT=4000 connect-test-dev"},I={"@didtools/key-webcrypto":"^0.2.0","@electron-forge/cli":"^6.1.1","@electron-forge/maker-deb":"^6.1.1","@electron-forge/maker-rpm":"^6.1.1","@electron-forge/maker-squirrel":"^6.1.1","@electron-forge/maker-zip":"^6.1.1","@electron-forge/plugin-vite":"^6.1.1","@electron-forge/publisher-electron-release-server":"^6.2.1","@electron-forge/publisher-github":"^7.2.0","@electron-forge/shared-types":"^7.7.0","@playwright/test":"^1.41.2","@powerhousedao/builder-tools":"workspace:*","@powerhousedao/common":"workspace:*","@powerhousedao/config":"workspace:*","@powerhousedao/design-system":"workspace:*","@powerhousedao/diff-analyzer":"^0.0.0-dev.10","@powerhousedao/reactor-browser":"workspace:*","@renown/sdk":"workspace:*","@rollup/plugin-node-resolve":"^15.2.3","@sentry/browser":"^9.1.0","@sentry/react":"^7.109.0","@sentry/vite-plugin":"^2.23.0","@tailwindcss/vite":"^4.1.4","@tanstack/react-virtual":"^3.8.1","@types/node":"^22.15.17","@types/react":"^18.2.79","@types/react-dom":"^18.2.18","@types/uuid":"^9.0.7","@types/wicg-file-system-access":"^2020.9.6","@vitejs/plugin-basic-ssl":"^2.0.0","@vitejs/plugin-react":"^4.4.1",asar:"^3.2.0","did-jwt":"^8.0.14","did-jwt-vc":"^4.0.12","did-key-creator":"^1.2.0","document-drive":"workspace:*","document-model":"workspace:*",electron:"30.0.0","electron-is-dev":"^3.0.1","electron-playwright-helpers":"^1.7.1","electron-squirrel-startup":"^1.0.0","electron-store":"^8.1.0",esbuild:"^0.24.0",graphql:"^16.11.0","graphql-request":"^6.1.0",i18next:"^23.7.6",jotai:"^2.1.0","jotai-effect":"^1.1.6",localforage:"^1.10.0",playwright:"^1.41.2","playwright-core":"^1.41.2",react:"^18.3.1","react-dom":"^18.3.1","react-error-boundary":"^4.0.11","react-hotkeys-hook":"^4.5.0","react-i18next":"^13.5.0","react-router-dom":"^6.11.2","tailwind-merge":"^3.0.2",tailwindcss:"^4.1.4",uint8arrays:"^5.1.0",uuid:"^9.0.1",viem:"^2.8.13",vite:"^6.3.3","vite-envs":"^4.6.0","vite-plugin-html":"^3.2.2","vite-plugin-node-polyfills":"^0.23.0","vite-plugin-svgr":"^4.3.0","vite-tsconfig-paths":"^5.1.4","xvfb-maybe":"^0.2.1"},L={"@esbuild/linux-x64":"^0.21.4","@rollup/rollup-linux-x64-musl":"4.14.3"},V={name:i,productName:c,version:a,description:l,main:N,type:d,engines:C,files:D,license:T,author:w,repository:S,bugs:A,homepage:u,scripts:p,devDependencies:I,optionalDependencies:L},O=V.version,g=window.__VITE_ENVS.APP_VERSION||O,m=window.__VITE_ENVS.PH_CONNECT_WARN_OUTDATED_APP||"false",P=window.__VITE_ENVS.PH_CONNECT_STUDIO_MODE||"false",v=window.__VITE_ENVS.PH_CONNECT_DISABLE_ADD_DRIVE||"false",f=window.__VITE_ENVS.PH_CONNECT_DISABLE_ADD_PUBLIC_DRIVES||void 0,R=window.__VITE_ENVS.PH_CONNECT_DISABLE_ADD_CLOUD_DRIVES||void 0,h=window.__VITE_ENVS.PH_CONNECT_DISABLE_ADD_LOCAL_DRIVES||void 0,B=window.__VITE_ENVS.PH_CONNECT_DISABLE_DELETE_PUBLIC_DRIVES||void 0,H=window.__VITE_ENVS.PH_CONNECT_DISABLE_DELETE_CLOUD_DRIVES||void 0,b=window.__VITE_ENVS.PH_CONNECT_DISABLE_DELETE_LOCAL_DRIVES||void 0,k=window.__VITE_ENVS.PH_CONNECT_LOCAL_DRIVES_ENABLED||void 0,y=window.__VITE_ENVS.PH_CONNECT_CLOUD_DRIVES_ENABLED||void 0,x=window.__VITE_ENVS.PH_CONNECT_PUBLIC_DRIVES_ENABLED||void 0,U=window.__VITE_ENVS.PH_CONNECT_SEARCH_BAR_ENABLED||void 0,G=window.__VITE_ENVS.PH_CONNECT_HIDE_DOCUMENT_MODEL_SELECTION_SETTINGS||"false",e=s()||"/",Y=window.__VITE_ENVS.PH_CONNECT_SENTRY_DSN||"",j=window.__VITE_ENVS.PH_CONNECT_SENTRY_ENV||"dev",M=window.__VITE_ENVS.PH_CONNECT_SENTRY_TRACING_ENABLED||"false",F=window.__VITE_ENVS.PH_CONNECT_GA_TRACKING_ID,q=window.__VITE_ENVS.PH_CONNECT_CLI_VERSION||void 0,$=window.__VITE_ENVS.PH_CONNECT_ANALYTICS_DATABASE_NAME||`${e.replace(/\//g,"")}:analytics`,W=window.__VITE_ENVS.PH_CONNECT_ANALYTICS_DATABASE_WORKER_DISABLED||"false",K=window.__VITE_ENVS.PH_CONNECT_DIFF_ANALYTICS_ENABLED||"false",z=window.__VITE_ENVS.PH_CONNECT_DRIVE_ANALYTICS_ENABLED||"false",X=window.__VITE_ENVS.PH_CONNECT_EXTERNAL_PROCESSORS_ENABLED||"false",J=r(window.__VITE_ENVS.LOG_LEVEL)?window.__VITE_ENVS.LOG_LEVEL:"info";o(J);_.debug(`Setting log level to ${window.__VITE_ENVS.LOG_LEVEL}.`);const ee={appVersion:g,studioMode:P.toString()==="true",warnOutdatedApp:m==="true",routerBasename:e,analytics:{databaseName:$,useWorker:W!=="true",driveAnalyticsEnabled:z==="true",diffProcessorEnabled:K==="true",externalProcessorsEnabled:X==="true"},sentry:{dsn:Y,env:j,tracing:M==="true"},content:{showSearchBar:U!=="false",showDocumentModelSelectionSetting:G!=="true"},drives:{addDriveEnabled:v!=="true",sections:{[n]:{enabled:k!=="false",allowAdd:h!=="true",allowDelete:b!=="true"},[E]:{enabled:y!=="false",allowAdd:R!=="true",allowDelete:H!=="true"},[t]:{enabled:x!=="false",allowAdd:f!=="true",allowDelete:B!=="true"}}},gaTrackingId:F,phCliVersion:q};export{ee as c,V as p};
2
- //# sourceMappingURL=connect.config._A2guXhv.js.map
1
+ import{a$ as o,m as _,aj as t,b0 as E,ae as n,b1 as r}from"./index.BcBVmRI8.js";import{g as s}from"./browser.BkwNmV2Z.js";const i="@powerhousedao/connect",c="Powerhouse-Connect",a="3.3.0-dev.4",l="Powerhouse Connect",N="./dist/index.html",d="module",C={node:">=22.0.0"},D=["dist","nginx.conf","nginx.sh","scripts"],T="AGPL-3.0-only",w="acaldas@powerhouse.inc",S={type:"git",url:"https://github.com/powerhouse-inc/powerhouse"},A={url:"https://github.com/powerhouse-inc/powerhouse/issues"},u="https://github.com/powerhouse-inc/powerhouse#readme",p={"build:tsc":"tsc --build",start:"electron-forge start",package:"electron-forge package",make:"PH_CONNECT_BASE_HREF=./ electron-forge make","make:mac":"PH_CONNECT_BASE_HREF=./ electron-forge make -p darwin","make:linux":"PH_CONNECT_BASE_HREF=./ electron-forge make -p linux","make:windows":"PH_CONNECT_BASE_HREF=./ electron-forge make -p win32","publish:electron":"electron-forge publish",prepublishOnly:"npm run build",lint:"eslint .","lint:fix":"eslint --fix .","lint:nx":"eslint --quiet --fix .",format:'prettier --write "**/*.+(js|ts|jsx|tsx|json)"',dev:"vite -c vite.renderer.config.mts","dev:nocache":"rm -rf node_modules/.vite && rm -rf node_modules/.cache && npm run dev",prebuild:"npm run clean && tsc --build --noEmit",build:"NODE_OPTIONS=--max-old-space-size=6144 vite build -c vite.renderer.config.mts",preview:"vite preview -c vite.renderer.config.mts",e2e:"playwright test","cy:open":"cypress open","build:service-worker":"tsc --build ./tsconfig.sw.json",clean:"rimraf dist","clean:node_modules":"rimraf node_modules","docker:build":"docker build -f ./Dockerfile --tag connect-test-dev --build-arg TAG=dev .","docker:run":"docker run -it -p 4000:4000 -v $(realpath ../../../monorepo):/monorepo -v $(pwd)/nginx.conf:/etc/nginx/nginx.conf.template -e PH_USE_LOCAL=true -e PH_CONNECT_BASE_PATH=/develop/powerhouse/connect -e PORT=4000 connect-test-dev"},I={"@didtools/key-webcrypto":"^0.2.0","@electron-forge/cli":"^6.1.1","@electron-forge/maker-deb":"^6.1.1","@electron-forge/maker-rpm":"^6.1.1","@electron-forge/maker-squirrel":"^6.1.1","@electron-forge/maker-zip":"^6.1.1","@electron-forge/plugin-vite":"^6.1.1","@electron-forge/publisher-electron-release-server":"^6.2.1","@electron-forge/publisher-github":"^7.2.0","@electron-forge/shared-types":"^7.7.0","@playwright/test":"^1.41.2","@powerhousedao/builder-tools":"workspace:*","@powerhousedao/common":"workspace:*","@powerhousedao/config":"workspace:*","@powerhousedao/design-system":"workspace:*","@powerhousedao/diff-analyzer":"^0.0.0-dev.10","@powerhousedao/reactor-browser":"workspace:*","@renown/sdk":"workspace:*","@rollup/plugin-node-resolve":"^15.2.3","@sentry/browser":"^9.1.0","@sentry/react":"^7.109.0","@sentry/vite-plugin":"^2.23.0","@tailwindcss/vite":"^4.1.4","@tanstack/react-virtual":"^3.8.1","@types/node":"^22.15.17","@types/react":"^18.2.79","@types/react-dom":"^18.2.18","@types/uuid":"^9.0.7","@types/wicg-file-system-access":"^2020.9.6","@vitejs/plugin-basic-ssl":"^2.0.0","@vitejs/plugin-react":"^4.4.1",asar:"^3.2.0","did-jwt":"^8.0.14","did-jwt-vc":"^4.0.12","did-key-creator":"^1.2.0","document-drive":"workspace:*","document-model":"workspace:*",electron:"30.0.0","electron-is-dev":"^3.0.1","electron-playwright-helpers":"^1.7.1","electron-squirrel-startup":"^1.0.0","electron-store":"^8.1.0",esbuild:"^0.24.0",graphql:"^16.11.0","graphql-request":"^6.1.0",i18next:"^23.7.6",jotai:"^2.1.0","jotai-effect":"^1.1.6",localforage:"^1.10.0",playwright:"^1.41.2","playwright-core":"^1.41.2",react:"^18.3.1","react-dom":"^18.3.1","react-error-boundary":"^4.0.11","react-hotkeys-hook":"^4.5.0","react-i18next":"^13.5.0","react-router-dom":"^6.11.2","tailwind-merge":"^3.0.2",tailwindcss:"^4.1.4",uint8arrays:"^5.1.0",uuid:"^9.0.1",viem:"^2.8.13",vite:"^6.3.3","vite-envs":"^4.6.0","vite-plugin-html":"^3.2.2","vite-plugin-node-polyfills":"^0.23.0","vite-plugin-svgr":"^4.3.0","vite-tsconfig-paths":"^5.1.4","xvfb-maybe":"^0.2.1"},L={"@esbuild/linux-x64":"^0.21.4","@rollup/rollup-linux-x64-musl":"4.14.3"},V={name:i,productName:c,version:a,description:l,main:N,type:d,engines:C,files:D,license:T,author:w,repository:S,bugs:A,homepage:u,scripts:p,devDependencies:I,optionalDependencies:L},O=V.version,g=window.__VITE_ENVS.APP_VERSION||O,m=window.__VITE_ENVS.PH_CONNECT_WARN_OUTDATED_APP||"false",P=window.__VITE_ENVS.PH_CONNECT_STUDIO_MODE||"false",v=window.__VITE_ENVS.PH_CONNECT_DISABLE_ADD_DRIVE||"false",f=window.__VITE_ENVS.PH_CONNECT_DISABLE_ADD_PUBLIC_DRIVES||void 0,R=window.__VITE_ENVS.PH_CONNECT_DISABLE_ADD_CLOUD_DRIVES||void 0,h=window.__VITE_ENVS.PH_CONNECT_DISABLE_ADD_LOCAL_DRIVES||void 0,B=window.__VITE_ENVS.PH_CONNECT_DISABLE_DELETE_PUBLIC_DRIVES||void 0,H=window.__VITE_ENVS.PH_CONNECT_DISABLE_DELETE_CLOUD_DRIVES||void 0,b=window.__VITE_ENVS.PH_CONNECT_DISABLE_DELETE_LOCAL_DRIVES||void 0,k=window.__VITE_ENVS.PH_CONNECT_LOCAL_DRIVES_ENABLED||void 0,y=window.__VITE_ENVS.PH_CONNECT_CLOUD_DRIVES_ENABLED||void 0,x=window.__VITE_ENVS.PH_CONNECT_PUBLIC_DRIVES_ENABLED||void 0,U=window.__VITE_ENVS.PH_CONNECT_SEARCH_BAR_ENABLED||void 0,G=window.__VITE_ENVS.PH_CONNECT_HIDE_DOCUMENT_MODEL_SELECTION_SETTINGS||"false",e=s()||"/",Y=window.__VITE_ENVS.PH_CONNECT_SENTRY_DSN||"",j=window.__VITE_ENVS.PH_CONNECT_SENTRY_ENV||"dev",M=window.__VITE_ENVS.PH_CONNECT_SENTRY_TRACING_ENABLED||"false",F=window.__VITE_ENVS.PH_CONNECT_GA_TRACKING_ID,q=window.__VITE_ENVS.PH_CONNECT_CLI_VERSION||void 0,$=window.__VITE_ENVS.PH_CONNECT_ANALYTICS_DATABASE_NAME||`${e.replace(/\//g,"")}:analytics`,W=window.__VITE_ENVS.PH_CONNECT_ANALYTICS_DATABASE_WORKER_DISABLED||"false",K=window.__VITE_ENVS.PH_CONNECT_DIFF_ANALYTICS_ENABLED||"false",z=window.__VITE_ENVS.PH_CONNECT_DRIVE_ANALYTICS_ENABLED||"false",X=window.__VITE_ENVS.PH_CONNECT_EXTERNAL_PROCESSORS_ENABLED||"false",J=r(window.__VITE_ENVS.LOG_LEVEL)?window.__VITE_ENVS.LOG_LEVEL:"info";o(J);_.debug(`Setting log level to ${window.__VITE_ENVS.LOG_LEVEL}.`);const ee={appVersion:g,studioMode:P.toString()==="true",warnOutdatedApp:m==="true",routerBasename:e,analytics:{databaseName:$,useWorker:W!=="true",driveAnalyticsEnabled:z==="true",diffProcessorEnabled:K==="true",externalProcessorsEnabled:X==="true"},sentry:{dsn:Y,env:j,tracing:M==="true"},content:{showSearchBar:U!=="false",showDocumentModelSelectionSetting:G!=="true"},drives:{addDriveEnabled:v!=="true",sections:{[n]:{enabled:k!=="false",allowAdd:h!=="true",allowDelete:b!=="true"},[E]:{enabled:y!=="false",allowAdd:R!=="true",allowDelete:H!=="true"},[t]:{enabled:x!=="false",allowAdd:f!=="true",allowDelete:B!=="true"}}},gaTrackingId:F,phCliVersion:q};export{ee as c,V as p};
2
+ //# sourceMappingURL=connect.config.CzMoERNI.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"connect.config._A2guXhv.js","sources":["../../src/connect.config.ts"],"sourcesContent":["import { CLOUD, LOCAL, PUBLIC } from '@powerhousedao/design-system';\nimport { isLogLevel, logger, setLogLevel } from 'document-drive/utils/logger';\nimport pkg from '../package.json' with { type: 'json' };\nimport { getBasePath } from './utils/browser';\n\nconst version = pkg.version;\nconst APP_VERSION = import.meta.env.APP_VERSION || version;\nconst WARN_OUTDATED_APP =\n import.meta.env.PH_CONNECT_WARN_OUTDATED_APP || 'false';\nconst PH_CONNECT_STUDIO_MODE =\n import.meta.env.PH_CONNECT_STUDIO_MODE || 'false';\n\nconst DISABLE_ADD_DRIVE =\n import.meta.env.PH_CONNECT_DISABLE_ADD_DRIVE || 'false';\nconst DISABLE_ADD_PUBLIC_DRIVES =\n import.meta.env.PH_CONNECT_DISABLE_ADD_PUBLIC_DRIVES || undefined;\nconst DISABLE_ADD_CLOUD_DRIVES =\n import.meta.env.PH_CONNECT_DISABLE_ADD_CLOUD_DRIVES || undefined;\nconst DISABLE_ADD_LOCAL_DRIVES =\n import.meta.env.PH_CONNECT_DISABLE_ADD_LOCAL_DRIVES || undefined;\nconst DISABLE_DELETE_PUBLIC_DRIVES =\n import.meta.env.PH_CONNECT_DISABLE_DELETE_PUBLIC_DRIVES || undefined;\nconst DISABLE_DELETE_CLOUD_DRIVES =\n import.meta.env.PH_CONNECT_DISABLE_DELETE_CLOUD_DRIVES || undefined;\nconst DISABLE_DELETE_LOCAL_DRIVES =\n import.meta.env.PH_CONNECT_DISABLE_DELETE_LOCAL_DRIVES || undefined;\n\nconst LOCAL_DRIVES_ENABLED =\n import.meta.env.PH_CONNECT_LOCAL_DRIVES_ENABLED || undefined;\nconst CLOUD_DRIVES_ENABLED =\n import.meta.env.PH_CONNECT_CLOUD_DRIVES_ENABLED || undefined;\nconst PUBLIC_DRIVES_ENABLED =\n import.meta.env.PH_CONNECT_PUBLIC_DRIVES_ENABLED || undefined;\n\nconst SEARCH_BAR_ENABLED =\n import.meta.env.PH_CONNECT_SEARCH_BAR_ENABLED || undefined;\n\nconst HIDE_DOCUMENT_MODEL_SELECTION_SETTINGS =\n import.meta.env.PH_CONNECT_HIDE_DOCUMENT_MODEL_SELECTION_SETTINGS ||\n 'false';\n\nconst PH_CONNECT_ROUTER_BASENAME = getBasePath() || '/';\n\nconst PH_CONNECT_SENTRY_DSN = import.meta.env.PH_CONNECT_SENTRY_DSN || '';\nconst PH_CONNECT_SENTRY_ENV = import.meta.env.PH_CONNECT_SENTRY_ENV || 'dev';\nconst PH_CONNECT_SENTRY_TRACING_ENABLED =\n import.meta.env.PH_CONNECT_SENTRY_TRACING_ENABLED || 'false';\n\nconst GA_TRACKING_ID = import.meta.env.PH_CONNECT_GA_TRACKING_ID;\nconst PH_CONNECT_CLI_VERSION =\n import.meta.env.PH_CONNECT_CLI_VERSION || undefined;\n\nconst PH_CONNECT_ANALYTICS_DATABASE_NAME =\n import.meta.env.PH_CONNECT_ANALYTICS_DATABASE_NAME ||\n `${PH_CONNECT_ROUTER_BASENAME.replace(/\\//g, '')}:analytics`; // remove ending slash\nconst PH_CONNECT_ANALYTICS_DATABASE_WORKER_DISABLED =\n import.meta.env.PH_CONNECT_ANALYTICS_DATABASE_WORKER_DISABLED || 'false';\n\nconst PH_CONNECT_DIFF_ANALYTICS_ENABLED =\n import.meta.env.PH_CONNECT_DIFF_ANALYTICS_ENABLED || 'false';\n\nconst PH_CONNECT_DRIVE_ANALYTICS_ENABLED =\n import.meta.env.PH_CONNECT_DRIVE_ANALYTICS_ENABLED || 'false';\n\nconst PH_CONNECT_EXTERNAL_PROCESSORS_ENABLED =\n import.meta.env.PH_CONNECT_EXTERNAL_PROCESSORS_ENABLED || 'false';\n\nconst LOG_LEVEL = isLogLevel(import.meta.env.LOG_LEVEL)\n ? import.meta.env.LOG_LEVEL\n : 'info';\nsetLogLevel(LOG_LEVEL);\nlogger.debug(`Setting log level to ${import.meta.env.LOG_LEVEL}.`);\n\nexport default {\n appVersion: APP_VERSION,\n studioMode: PH_CONNECT_STUDIO_MODE.toString() === 'true',\n warnOutdatedApp: WARN_OUTDATED_APP === 'true',\n routerBasename: PH_CONNECT_ROUTER_BASENAME,\n analytics: {\n databaseName: PH_CONNECT_ANALYTICS_DATABASE_NAME,\n useWorker: PH_CONNECT_ANALYTICS_DATABASE_WORKER_DISABLED !== 'true',\n driveAnalyticsEnabled: PH_CONNECT_DRIVE_ANALYTICS_ENABLED === 'true',\n diffProcessorEnabled: PH_CONNECT_DIFF_ANALYTICS_ENABLED === 'true',\n externalProcessorsEnabled: PH_CONNECT_EXTERNAL_PROCESSORS_ENABLED === 'true',\n },\n sentry: {\n dsn: PH_CONNECT_SENTRY_DSN,\n env: PH_CONNECT_SENTRY_ENV,\n tracing: PH_CONNECT_SENTRY_TRACING_ENABLED === 'true',\n },\n content: {\n showSearchBar: SEARCH_BAR_ENABLED !== 'false',\n showDocumentModelSelectionSetting:\n HIDE_DOCUMENT_MODEL_SELECTION_SETTINGS !== 'true',\n },\n drives: {\n addDriveEnabled: DISABLE_ADD_DRIVE === 'true' ? false : true,\n sections: {\n [LOCAL]: {\n enabled: LOCAL_DRIVES_ENABLED !== 'false',\n allowAdd: DISABLE_ADD_LOCAL_DRIVES !== 'true',\n allowDelete: DISABLE_DELETE_LOCAL_DRIVES !== 'true',\n },\n [CLOUD]: {\n enabled: CLOUD_DRIVES_ENABLED !== 'false',\n allowAdd: DISABLE_ADD_CLOUD_DRIVES !== 'true',\n allowDelete: DISABLE_DELETE_CLOUD_DRIVES !== 'true',\n },\n [PUBLIC]: {\n enabled: PUBLIC_DRIVES_ENABLED !== 'false',\n allowAdd: DISABLE_ADD_PUBLIC_DRIVES !== 'true',\n allowDelete: DISABLE_DELETE_PUBLIC_DRIVES !== 'true',\n },\n },\n },\n gaTrackingId: GA_TRACKING_ID,\n phCliVersion: PH_CONNECT_CLI_VERSION,\n};\n"],"names":["version","pkg","APP_VERSION","WARN_OUTDATED_APP","PH_CONNECT_STUDIO_MODE","DISABLE_ADD_DRIVE","DISABLE_ADD_PUBLIC_DRIVES","DISABLE_ADD_CLOUD_DRIVES","DISABLE_ADD_LOCAL_DRIVES","DISABLE_DELETE_PUBLIC_DRIVES","DISABLE_DELETE_CLOUD_DRIVES","DISABLE_DELETE_LOCAL_DRIVES","LOCAL_DRIVES_ENABLED","CLOUD_DRIVES_ENABLED","PUBLIC_DRIVES_ENABLED","SEARCH_BAR_ENABLED","HIDE_DOCUMENT_MODEL_SELECTION_SETTINGS","PH_CONNECT_ROUTER_BASENAME","getBasePath","PH_CONNECT_SENTRY_DSN","PH_CONNECT_SENTRY_ENV","PH_CONNECT_SENTRY_TRACING_ENABLED","GA_TRACKING_ID","PH_CONNECT_CLI_VERSION","PH_CONNECT_ANALYTICS_DATABASE_NAME","PH_CONNECT_ANALYTICS_DATABASE_WORKER_DISABLED","PH_CONNECT_DIFF_ANALYTICS_ENABLED","PH_CONNECT_DRIVE_ANALYTICS_ENABLED","PH_CONNECT_EXTERNAL_PROCESSORS_ENABLED","LOG_LEVEL","isLogLevel","setLogLevel","logger","connectConfig","LOCAL","CLOUD","PUBLIC"],"mappings":"8nIAKMA,EAAUC,EAAI,QACdC,EAAc,OAAA,YAAA,aAA+BF,EAC7CG,EACF,iDAAgD,QAC9CC,EACF,OAAA,YAAA,wBAA0C,QAExCC,EACF,iDAAgD,QAC9CC,EACF,OAAA,YAAA,sCAAwD,OACtDC,EACF,OAAA,YAAA,qCAAuD,OACrDC,EACF,OAAA,YAAA,qCAAuD,OACrDC,EACF,4DAA2D,OACzDC,EACF,2DAA0D,OACxDC,EACF,2DAA0D,OAExDC,EACF,OAAA,YAAA,iCAAmD,OACjDC,EACF,OAAA,YAAA,iCAAmD,OACjDC,EACF,OAAA,YAAA,kCAAoD,OAElDC,EACF,OAAA,YAAA,+BAAiD,OAE/CC,EACF,OAAA,YAAA,mDACA,QAEEC,EAA6BC,KAAiB,IAE9CC,EAAwB,OAAA,YAAA,uBAAyC,GACjEC,EAAwB,OAAA,YAAA,uBAAyC,MACjEC,EACF,OAAA,YAAA,mCAAqD,QAEnDC,EAAiB,OAAA,YAAA,0BACjBC,EACF,OAAA,YAAA,wBAA0C,OAExCC,EACF,OAAA,YAAA,oCACA,GAAGP,EAA2B,QAAQ,MAAO,EAAE,CAAC,aAC9CQ,EACF,OAAA,YAAA,+CAAiE,QAE/DC,EACF,OAAA,YAAA,mCAAqD,QAEnDC,EACF,OAAA,YAAA,oCAAsD,QAEpDC,EACF,OAAA,YAAA,wCAA0D,QAExDC,EAAYC,EAAW,OAAA,YAAA,SAAyB,EAChD,6BACA,OACNC,EAAYF,CAAS,EACrBG,EAAO,MAAM,wBAAwB,OAAA,YAAA,SAAyB,GAAG,EAEjE,MAAAC,GAAe,CACX,WAAY/B,EACZ,WAAYE,EAAuB,SAAA,IAAe,OAClD,gBAAiBD,IAAsB,OACvC,eAAgBc,EAChB,UAAW,CACP,aAAcO,EACd,UAAWC,IAAkD,OAC7D,sBAAuBE,IAAuC,OAC9D,qBAAsBD,IAAsC,OAC5D,0BAA2BE,IAA2C,MAAA,EAE1E,OAAQ,CACJ,IAAKT,EACL,IAAKC,EACL,QAASC,IAAsC,MAAA,EAEnD,QAAS,CACL,cAAeN,IAAuB,QACtC,kCACIC,IAA2C,MAAA,EAEnD,OAAQ,CACJ,gBAAiBX,IAAsB,OACvC,SAAU,CACN,CAAC6B,CAAK,EAAG,CACL,QAAStB,IAAyB,QAClC,SAAUJ,IAA6B,OACvC,YAAaG,IAAgC,MAAA,EAEjD,CAACwB,CAAK,EAAG,CACL,QAAStB,IAAyB,QAClC,SAAUN,IAA6B,OACvC,YAAaG,IAAgC,MAAA,EAEjD,CAAC0B,CAAM,EAAG,CACN,QAAStB,IAA0B,QACnC,SAAUR,IAA8B,OACxC,YAAaG,IAAiC,MAAA,CAClD,CACJ,EAEJ,aAAca,EACd,aAAcC,CAClB"}
1
+ {"version":3,"file":"connect.config.CzMoERNI.js","sources":["../../src/connect.config.ts"],"sourcesContent":["import { CLOUD, LOCAL, PUBLIC } from '@powerhousedao/design-system';\nimport { isLogLevel, logger, setLogLevel } from 'document-drive/utils/logger';\nimport pkg from '../package.json' with { type: 'json' };\nimport { getBasePath } from './utils/browser';\n\nconst version = pkg.version;\nconst APP_VERSION = import.meta.env.APP_VERSION || version;\nconst WARN_OUTDATED_APP =\n import.meta.env.PH_CONNECT_WARN_OUTDATED_APP || 'false';\nconst PH_CONNECT_STUDIO_MODE =\n import.meta.env.PH_CONNECT_STUDIO_MODE || 'false';\n\nconst DISABLE_ADD_DRIVE =\n import.meta.env.PH_CONNECT_DISABLE_ADD_DRIVE || 'false';\nconst DISABLE_ADD_PUBLIC_DRIVES =\n import.meta.env.PH_CONNECT_DISABLE_ADD_PUBLIC_DRIVES || undefined;\nconst DISABLE_ADD_CLOUD_DRIVES =\n import.meta.env.PH_CONNECT_DISABLE_ADD_CLOUD_DRIVES || undefined;\nconst DISABLE_ADD_LOCAL_DRIVES =\n import.meta.env.PH_CONNECT_DISABLE_ADD_LOCAL_DRIVES || undefined;\nconst DISABLE_DELETE_PUBLIC_DRIVES =\n import.meta.env.PH_CONNECT_DISABLE_DELETE_PUBLIC_DRIVES || undefined;\nconst DISABLE_DELETE_CLOUD_DRIVES =\n import.meta.env.PH_CONNECT_DISABLE_DELETE_CLOUD_DRIVES || undefined;\nconst DISABLE_DELETE_LOCAL_DRIVES =\n import.meta.env.PH_CONNECT_DISABLE_DELETE_LOCAL_DRIVES || undefined;\n\nconst LOCAL_DRIVES_ENABLED =\n import.meta.env.PH_CONNECT_LOCAL_DRIVES_ENABLED || undefined;\nconst CLOUD_DRIVES_ENABLED =\n import.meta.env.PH_CONNECT_CLOUD_DRIVES_ENABLED || undefined;\nconst PUBLIC_DRIVES_ENABLED =\n import.meta.env.PH_CONNECT_PUBLIC_DRIVES_ENABLED || undefined;\n\nconst SEARCH_BAR_ENABLED =\n import.meta.env.PH_CONNECT_SEARCH_BAR_ENABLED || undefined;\n\nconst HIDE_DOCUMENT_MODEL_SELECTION_SETTINGS =\n import.meta.env.PH_CONNECT_HIDE_DOCUMENT_MODEL_SELECTION_SETTINGS ||\n 'false';\n\nconst PH_CONNECT_ROUTER_BASENAME = getBasePath() || '/';\n\nconst PH_CONNECT_SENTRY_DSN = import.meta.env.PH_CONNECT_SENTRY_DSN || '';\nconst PH_CONNECT_SENTRY_ENV = import.meta.env.PH_CONNECT_SENTRY_ENV || 'dev';\nconst PH_CONNECT_SENTRY_TRACING_ENABLED =\n import.meta.env.PH_CONNECT_SENTRY_TRACING_ENABLED || 'false';\n\nconst GA_TRACKING_ID = import.meta.env.PH_CONNECT_GA_TRACKING_ID;\nconst PH_CONNECT_CLI_VERSION =\n import.meta.env.PH_CONNECT_CLI_VERSION || undefined;\n\nconst PH_CONNECT_ANALYTICS_DATABASE_NAME =\n import.meta.env.PH_CONNECT_ANALYTICS_DATABASE_NAME ||\n `${PH_CONNECT_ROUTER_BASENAME.replace(/\\//g, '')}:analytics`; // remove ending slash\nconst PH_CONNECT_ANALYTICS_DATABASE_WORKER_DISABLED =\n import.meta.env.PH_CONNECT_ANALYTICS_DATABASE_WORKER_DISABLED || 'false';\n\nconst PH_CONNECT_DIFF_ANALYTICS_ENABLED =\n import.meta.env.PH_CONNECT_DIFF_ANALYTICS_ENABLED || 'false';\n\nconst PH_CONNECT_DRIVE_ANALYTICS_ENABLED =\n import.meta.env.PH_CONNECT_DRIVE_ANALYTICS_ENABLED || 'false';\n\nconst PH_CONNECT_EXTERNAL_PROCESSORS_ENABLED =\n import.meta.env.PH_CONNECT_EXTERNAL_PROCESSORS_ENABLED || 'false';\n\nconst LOG_LEVEL = isLogLevel(import.meta.env.LOG_LEVEL)\n ? import.meta.env.LOG_LEVEL\n : 'info';\nsetLogLevel(LOG_LEVEL);\nlogger.debug(`Setting log level to ${import.meta.env.LOG_LEVEL}.`);\n\nexport default {\n appVersion: APP_VERSION,\n studioMode: PH_CONNECT_STUDIO_MODE.toString() === 'true',\n warnOutdatedApp: WARN_OUTDATED_APP === 'true',\n routerBasename: PH_CONNECT_ROUTER_BASENAME,\n analytics: {\n databaseName: PH_CONNECT_ANALYTICS_DATABASE_NAME,\n useWorker: PH_CONNECT_ANALYTICS_DATABASE_WORKER_DISABLED !== 'true',\n driveAnalyticsEnabled: PH_CONNECT_DRIVE_ANALYTICS_ENABLED === 'true',\n diffProcessorEnabled: PH_CONNECT_DIFF_ANALYTICS_ENABLED === 'true',\n externalProcessorsEnabled: PH_CONNECT_EXTERNAL_PROCESSORS_ENABLED === 'true',\n },\n sentry: {\n dsn: PH_CONNECT_SENTRY_DSN,\n env: PH_CONNECT_SENTRY_ENV,\n tracing: PH_CONNECT_SENTRY_TRACING_ENABLED === 'true',\n },\n content: {\n showSearchBar: SEARCH_BAR_ENABLED !== 'false',\n showDocumentModelSelectionSetting:\n HIDE_DOCUMENT_MODEL_SELECTION_SETTINGS !== 'true',\n },\n drives: {\n addDriveEnabled: DISABLE_ADD_DRIVE === 'true' ? false : true,\n sections: {\n [LOCAL]: {\n enabled: LOCAL_DRIVES_ENABLED !== 'false',\n allowAdd: DISABLE_ADD_LOCAL_DRIVES !== 'true',\n allowDelete: DISABLE_DELETE_LOCAL_DRIVES !== 'true',\n },\n [CLOUD]: {\n enabled: CLOUD_DRIVES_ENABLED !== 'false',\n allowAdd: DISABLE_ADD_CLOUD_DRIVES !== 'true',\n allowDelete: DISABLE_DELETE_CLOUD_DRIVES !== 'true',\n },\n [PUBLIC]: {\n enabled: PUBLIC_DRIVES_ENABLED !== 'false',\n allowAdd: DISABLE_ADD_PUBLIC_DRIVES !== 'true',\n allowDelete: DISABLE_DELETE_PUBLIC_DRIVES !== 'true',\n },\n },\n },\n gaTrackingId: GA_TRACKING_ID,\n phCliVersion: PH_CONNECT_CLI_VERSION,\n};\n"],"names":["version","pkg","APP_VERSION","WARN_OUTDATED_APP","PH_CONNECT_STUDIO_MODE","DISABLE_ADD_DRIVE","DISABLE_ADD_PUBLIC_DRIVES","DISABLE_ADD_CLOUD_DRIVES","DISABLE_ADD_LOCAL_DRIVES","DISABLE_DELETE_PUBLIC_DRIVES","DISABLE_DELETE_CLOUD_DRIVES","DISABLE_DELETE_LOCAL_DRIVES","LOCAL_DRIVES_ENABLED","CLOUD_DRIVES_ENABLED","PUBLIC_DRIVES_ENABLED","SEARCH_BAR_ENABLED","HIDE_DOCUMENT_MODEL_SELECTION_SETTINGS","PH_CONNECT_ROUTER_BASENAME","getBasePath","PH_CONNECT_SENTRY_DSN","PH_CONNECT_SENTRY_ENV","PH_CONNECT_SENTRY_TRACING_ENABLED","GA_TRACKING_ID","PH_CONNECT_CLI_VERSION","PH_CONNECT_ANALYTICS_DATABASE_NAME","PH_CONNECT_ANALYTICS_DATABASE_WORKER_DISABLED","PH_CONNECT_DIFF_ANALYTICS_ENABLED","PH_CONNECT_DRIVE_ANALYTICS_ENABLED","PH_CONNECT_EXTERNAL_PROCESSORS_ENABLED","LOG_LEVEL","isLogLevel","setLogLevel","logger","connectConfig","LOCAL","CLOUD","PUBLIC"],"mappings":"8nIAKMA,EAAUC,EAAI,QACdC,EAAc,OAAA,YAAA,aAA+BF,EAC7CG,EACF,iDAAgD,QAC9CC,EACF,OAAA,YAAA,wBAA0C,QAExCC,EACF,iDAAgD,QAC9CC,EACF,OAAA,YAAA,sCAAwD,OACtDC,EACF,OAAA,YAAA,qCAAuD,OACrDC,EACF,OAAA,YAAA,qCAAuD,OACrDC,EACF,4DAA2D,OACzDC,EACF,2DAA0D,OACxDC,EACF,2DAA0D,OAExDC,EACF,OAAA,YAAA,iCAAmD,OACjDC,EACF,OAAA,YAAA,iCAAmD,OACjDC,EACF,OAAA,YAAA,kCAAoD,OAElDC,EACF,OAAA,YAAA,+BAAiD,OAE/CC,EACF,OAAA,YAAA,mDACA,QAEEC,EAA6BC,KAAiB,IAE9CC,EAAwB,OAAA,YAAA,uBAAyC,GACjEC,EAAwB,OAAA,YAAA,uBAAyC,MACjEC,EACF,OAAA,YAAA,mCAAqD,QAEnDC,EAAiB,OAAA,YAAA,0BACjBC,EACF,OAAA,YAAA,wBAA0C,OAExCC,EACF,OAAA,YAAA,oCACA,GAAGP,EAA2B,QAAQ,MAAO,EAAE,CAAC,aAC9CQ,EACF,OAAA,YAAA,+CAAiE,QAE/DC,EACF,OAAA,YAAA,mCAAqD,QAEnDC,EACF,OAAA,YAAA,oCAAsD,QAEpDC,EACF,OAAA,YAAA,wCAA0D,QAExDC,EAAYC,EAAW,OAAA,YAAA,SAAyB,EAChD,6BACA,OACNC,EAAYF,CAAS,EACrBG,EAAO,MAAM,wBAAwB,OAAA,YAAA,SAAyB,GAAG,EAEjE,MAAAC,GAAe,CACX,WAAY/B,EACZ,WAAYE,EAAuB,SAAA,IAAe,OAClD,gBAAiBD,IAAsB,OACvC,eAAgBc,EAChB,UAAW,CACP,aAAcO,EACd,UAAWC,IAAkD,OAC7D,sBAAuBE,IAAuC,OAC9D,qBAAsBD,IAAsC,OAC5D,0BAA2BE,IAA2C,MAAA,EAE1E,OAAQ,CACJ,IAAKT,EACL,IAAKC,EACL,QAASC,IAAsC,MAAA,EAEnD,QAAS,CACL,cAAeN,IAAuB,QACtC,kCACIC,IAA2C,MAAA,EAEnD,OAAQ,CACJ,gBAAiBX,IAAsB,OACvC,SAAU,CACN,CAAC6B,CAAK,EAAG,CACL,QAAStB,IAAyB,QAClC,SAAUJ,IAA6B,OACvC,YAAaG,IAAgC,MAAA,EAEjD,CAACwB,CAAK,EAAG,CACL,QAAStB,IAAyB,QAClC,SAAUN,IAA6B,OACvC,YAAaG,IAAgC,MAAA,EAEjD,CAAC0B,CAAM,EAAG,CACN,QAAStB,IAA0B,QACnC,SAAUR,IAA8B,OACxC,YAAaG,IAAiC,MAAA,CAClD,CACJ,EAEJ,aAAca,EACd,aAAcC,CAClB"}
@@ -1,3 +1,3 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./index.C_GzfUCS.js","./index.BGemDCBc.js","./style-BkLV0sfQ.css"])))=>i.map(i=>d[i]);
2
- import{jsxs as T,jsx as u,Fragment as We}from"react/jsx-runtime";import Nt,{useRef as $,useState as F,useMemo as O,useCallback as w,useEffect as k,Suspense as kt,useSyncExternalStore as Rt,useLayoutEffect as Ot,useContext as qe,createContext as Qe}from"react";import{B as J,z as Mt,D as Re,F as Pt,E as X,G as Ft,J as Je,K as Oe,L as Ut,M as Ht,y as q,N as Bt,O as _t,v as j,S as zt,V as Me,X as Kt,Y as $t,Z as jt,h as Gt,j as Wt,$ as qt,a as Z,u as Qt,m as oe,a0 as Pe,b as ge,_ as Fe,a1 as Jt,a2 as Yt,a3 as Xt,a4 as Zt,a5 as Ye,a6 as Xe,a7 as Vt,a8 as en,a9 as tn,aa as nn,ab as on}from"./index.BGemDCBc.js";import{E as Ze,b as rn}from"./react-error-boundary.esm.BdKfLyaR.js";import{b as sn,c as Ue,e as V,a as Ve,f as cn,g as an,h as dn,i as un}from"./useFeatureFlags.BTVpX3W5.js";import{e as ln,b as De,c as be,d as Ee,f as mn}from"./user.DBQJIPxu.js";import{u as fn}from"./useDefaultDocumentModelEditor.DcbpTZSv.js";import{u as hn,a as pn,l as vn}from"./index.Dwexo_zk.js";import{u as _,a as et,b as tt,s as nt,e as re}from"./useDocumentDriveServer.ArDMFxnb.js";import{u as ot,a as yn,D as me,A as fe,b as gn,c as Dn}from"./app.Brcw_g_p.js";import{e as rt,i as bn}from"./index.CAUjMUXb.js";import{useModal as se}from"./modal.BFkV0xND.js";import{u as ee}from"./useTranslation.BpVv6XIW.js";import{c as En}from"./connect.config._A2guXhv.js";import{t as Sn}from"./toast.CJBPfWGX.js";import"react-dom";import"react-dom/client";import"./app-skeleton.js";import"./browser.BkwNmV2Z.js";import"./useAcceptedCookies.B2E2vhVo.js";import"./useConnectConfig.CwkmyF48.js";import"./registerServiceWorker.w3jaNxQm.js";function wn(e){return"documentModelState"in e?e.documentModelState:e.documentModel}const Cn=({documentModels:e,createDocument:t})=>T("div",{className:"px-6",children:[u("h3",{className:"mb-3 mt-4 text-xl font-bold text-gray-600",children:"New document"}),u("div",{className:"flex w-full flex-wrap gap-4",children:e==null?void 0:e.map(n=>{const o=wn(n);return u(J,{color:"light",title:o.name,"aria-description":o.description,onClick:()=>t(n),children:u("span",{className:"text-sm",children:o.name})},o.id)})})]});function He(e,t){return e.name.localeCompare(t.name)}const Q=8,he=256,Be=48,In=420;function An(e){const t=$(null),{t:n}=ee(),o=Mt(),{fileNodes:s,...c}=e,r=o.innerWidth-In,d=Math.floor(r/(he+Q))||1,l=Math.ceil(s.length/d),a=Re({count:l,getScrollElement:()=>t.current,estimateSize:g=>g>0?Be+Q:Be,overscan:5}),f=Re({horizontal:!0,count:d,getScrollElement:()=>t.current,estimateSize:g=>g>0?he+Q:he,overscan:5}),h=(g,v)=>g*d+v,m=(g,v)=>{const D=h(g,v);return s[D]||null};if(s.length===0)return u("div",{className:"mb-8 text-sm text-gray-400",children:n("folderView.sections.documents.empty",{defaultValue:"No documents or files 📄"})});const i=(g,v)=>{const D=m(g,v);return D?u("div",{style:{marginLeft:v===0?0:Q},children:u(Pt,{uiNode:D,...c},D.id)}):null};return u("div",{ref:t,style:{height:"400px",width:"100%",overflow:"auto"},children:u("div",{style:{height:`${a.getTotalSize()}px`,width:`${f.getTotalSize()}px`,position:"relative"},children:a.getVirtualItems().map(g=>u(Nt.Fragment,{children:f.getVirtualItems().map(v=>u("div",{style:{position:"absolute",top:0,left:0,marginTop:g.index===0?0:Q,width:`${v.size}px`,height:`${g.size}px`,transform:`translateX(${v.start}px) translateY(${g.start}px)`},children:i(g.index,v.index)},v.key))},g.key))})})}function R({children:e,className:t,...n}){return u(R.Container,{className:t,...n,children:e})}R.Container=function({children:t,className:n,containerProps:o,...s}){return u("div",{className:X("flex grow flex-col overflow-auto rounded-2xl bg-gray-50 p-2",n),...o,...s,children:t})};R.Header=function({children:t,className:n,containerProps:o,...s}){return u("div",{className:X("flex-0",n),...o,...s,children:t})};R.Content=function({children:t,className:n,containerProps:o,...s}){return u("div",{className:X("mb-5 flex-1 px-4",n),...o,...s,children:t})};R.ContentSection=function({title:t,children:n,className:o,containerProps:s,...c}){return T("div",{className:X(o),...s,...c,children:[t&&u("div",{className:"mb-4 text-base font-semibold text-gray-600",children:t}),u("div",{className:"flex flex-wrap gap-2",children:n})]})};R.Footer=function({children:t,className:n,containerProps:o,...s}){return u("div",{className:X("flex-0",n),...o,...s,children:t})};function xn(e){const{node:t,className:n,isDropTarget:o,containerProps:s,...c}=e,{t:r}=ee(),d=t.children.filter(m=>m.kind===Ft).sort(He),l=t.children.filter(m=>m.kind===Je).sort(He),a={onSelectNode:m=>c.onSelectNode(m),onRenameNode:(m,i)=>c.onRenameNode(m,i),onDuplicateNode:m=>c.onDuplicateNode(m),onDeleteNode:m=>c.onDeleteNode(m)},f={onSelectNode:m=>c.onSelectNode(m),onRenameNode:(m,i)=>c.onRenameNode(m,i),onDuplicateNode:m=>c.onDuplicateNode(m),onDeleteNode:m=>c.onDeleteNode(m)},h={onAddFile:async(m,i)=>{await c.onAddFile(m,i)},onCopyNode:async(m,i)=>{await c.onCopyNode(m,i)},onMoveNode:async(m,i)=>{await c.onMoveNode(m,i)}};return T("div",{className:Oe("rounded-md border-2 border-transparent p-2",o&&"border-dashed border-blue-100",n),...s,children:[u(R.ContentSection,{title:r("folderView.sections.folders.title",{defaultValue:"Folders"}),className:"mb-4",children:d.length>0?d.map(m=>u(Ut,{uiNode:m,...h,...a,isAllowedToCreateDocuments:c.isAllowedToCreateDocuments},m.id)):u("div",{className:"mb-8 text-sm text-gray-400",children:r("folderView.sections.folders.empty",{defaultValue:"No documents or files 📄"})})}),u(R.ContentSection,{title:r("folderView.sections.documents.title",{defaultValue:"Documents and files"}),children:u("div",{className:Oe("w-full",l.length>0?"min-h-[400px]":"min-h-14"),children:u(An,{fileNodes:l,...f,isAllowedToCreateDocuments:c.isAllowedToCreateDocuments})})})]})}const Tn=[{id:"project",label:".project",icon:u(q,{name:"Project",color:"#FF6A55",size:16})},{id:"budget",label:".budget",icon:u(q,{name:"BarChart",color:"#8E55EA",size:16})},{id:"profile",label:".profile",icon:u(q,{name:"Person",color:"#3E90F0",size:16})},{id:"legal",label:".legal",icon:u(q,{name:"Briefcase",color:"#4BAB71",size:16})},{id:"atlas",label:".Atlas",icon:u(q,{name:"Globe",color:"#FF8A00",size:16})}],Ln=()=>{const{t:e}=ee(),[t,n]=F("");return u(Ht,{className:"max-w-searchbar-width m-4 shrink-0 bg-gray-100",placeholder:e("searchbar.placeholder"),filterLabel:e("searchbar.filterLabel"),filterItems:Tn,value:t,onChange:n})};function Nn(e){const{document:t,dispatch:n,className:o,children:s}=e,{header:{id:c}}=t,{showSearchBar:r,isAllowedToCreateDocuments:d,documentModels:l,showCreateDocumentModal:a}=_t(),{driveNodes:f,selectedNode:h,selectedNodePath:m,getNodeById:i,setSelectedNode:g}=j(),v=O(()=>f.find(U=>U.id===c),[f,c]),{addDocument:D,addFile:E,addFolder:A,renameNode:L,deleteNode:S,moveNode:b,copyNode:y,duplicateNode:p}=zt(t,n),C=w(async U=>{const{name:ce}=await a(U),W=U.utils.createDocument();await D(ce,U.documentModel.name,W,h==null?void 0:h.id)},[D,a,h==null?void 0:h.id]),{isDropTarget:x,dropProps:N}=Me({uiNode:h,onAddFile:E,onCopyNode:y,onMoveNode:b}),{isDropTarget:I,dropProps:M}=Me({uiNode:(h==null?void 0:h.kind)==="FOLDER"?h:null,onAddFile:E,onCopyNode:y,onMoveNode:b}),{breadcrumbs:z,onBreadcrumbSelected:K}=Kt({selectedNodePath:m,getNodeById:i,setSelectedNode:g});if(v){if((h==null?void 0:h.kind)===$t)return u(We,{})}else return u("div",{children:"Drive not found"});return T(R,{className:o,children:[s,T(R.Header,{children:[u(jt,{breadcrumbs:z,createEnabled:d,onCreate:A,onBreadcrumbSelected:K}),r&&u(Ln,{})]}),u(R.Content,{...M,className:I?"rounded-xl bg-blue-100":"",children:u(xn,{node:h||v,onSelectNode:g,onRenameNode:L,onDuplicateNode:p,onDeleteNode:S,onAddFile:E,onCopyNode:y,onMoveNode:b,isAllowedToCreateDocuments:d,isDropTarget:x,...N})}),u(R.Footer,{children:d&&u(Cn,{documentModels:l,createDocument:C})})]})}function kn(e){return u(Bt,{value:e.context,children:u(Nn,{...e})})}const Rn={Component:kn};function On(e){const{queryFn:t,...n}=e,{data:o}=ot(),{data:s}=yn(),c="enabled"in n?n.enabled:!!o&&!!s;return Wt({...n,enabled:c,queryFn:async()=>{if(!o||!s)throw new Error("No analytics store available. Use within an AnalyticsProvider.");return await t({store:o,engine:s})}})}const Mn=200;function Pn(e,t){const{data:n}=ot(),o=Gt(),s=(t==null?void 0:t.sources)??[],c=On({queryKey:["analytics","query",e],queryFn:({engine:r})=>r.execute(e),...t});return k(()=>{if(!s.length||!n)return;const r=new Array;let d=null;const l=()=>{d&&clearTimeout(d),d=setTimeout(()=>{o.invalidateQueries({queryKey:["analytics","query",e]}).catch(a=>{console.error(a)})},Mn)};return s.forEach(a=>{const f=n.subscribeToSource(a,l);r.push(f)}),()=>{r.forEach(a=>a())}},[e,n,s]),c}const _e=e=>e<=0?0:e>0&&e<=50?1:e>50&&e<=100?2:e>100&&e<=250?3:4;function Fn(e){if(!e.length)return[];const t=[];return e.forEach((n,o)=>{if(t.push(n),o<e.length-1){const s=new Date(n.startDate),c=new Date(e[o+1].startDate),r=s.getHours(),d=c.getHours(),l=s.toDateString(),a=c.toDateString();(l!==a||l===a&&Math.abs(d-r)>1)&&t.push({id:`divider-${n.id}-${e[o+1].id}`,type:"divider",revision:0})}}),t}function Un(e){if(!e)return[];const t=e.sort((n,o)=>{const s=new Date(n.start),c=new Date(o.start);return s.getTime()-c.getTime()}).filter(n=>n.rows.every(o=>o.value>0)).map(n=>{const{additions:o,deletions:s}=n.rows.reduce((r,d)=>(d.dimensions.changes.path==="ph/diff/changes/add"?r.additions+=d.value:d.dimensions.changes.path==="ph/diff/changes/remove"&&(r.deletions+=d.value),r),{additions:0,deletions:0}),c=new Date(n.start);return{id:c.toISOString(),type:"bar",addSize:_e(o),delSize:_e(s),additions:o,deletions:s,timestamp:c.toISOString(),startDate:c,endDate:new Date(n.end),revision:0}});return Fn(t)}const Hn=(e,t,n)=>{const o=t?me.fromISO(t):me.now().startOf("day");return Pn({start:o,end:me.now().endOf("day"),granularity:gn.Hourly,metrics:["Count"],select:{changes:[fe.fromString("ph/diff/changes")],document:[fe.fromString(`ph/diff/document/${e}`)]},lod:{changes:4}},{sources:[fe.fromString(`ph/diff/${n}/${e}`)],select:Un})},Bn=(e,t,n=[])=>{if(!e||!t)return 0;const o=n.find(s=>{const c=new Date(s.timestamp);return c>=e&&c<=t});return o?o.index:0},st=sn("theme","light",e=>{var t;typeof window<"u"&&((t=window.electronAPI)==null||t.setTheme(e))});function ze(e,t=50){let n;const o=[];return s=>{n&&clearTimeout(n);const c=o.findIndex(r=>r.scope===s.scope&&r.index===s.index);if(c>-1){const r=o[c];r.type===s.type&&JSON.stringify(s.input)===JSON.stringify(r.input)||console.warn("Two conflicting operations were dispatched:",r,s),o[c]=s}else o.push(s);return new Promise((r,d)=>{n=setTimeout(()=>{e(o).then(r).catch(d)},t)})}}const it=Z(new Map);it.debugLabel="documentCacheAtomInConnect";const te=Z(void 0);te.debugLabel="singletonFileNodeDocumentAtomInConnect";function ct(e,t){return e===t?!0:!e||!t?!1:Pe(e)===Pe(t)}const Y=Z(e=>e(te),(e,t,n)=>{const o=e(te),s=e(it);return!(n!=null&&n.document)&&(n==null?void 0:n.status)==="LOADING"&&(n.document=s.get(`${n.driveId}:${n.documentId}`)),(o==null?void 0:o.driveId)!==(n==null?void 0:n.driveId)||(o==null?void 0:o.documentId)!==(n==null?void 0:n.documentId)||(o==null?void 0:o.documentType)!==(n==null?void 0:n.documentType)||(o==null?void 0:o.status)!==(n==null?void 0:n.status)||!!(o!=null&&o.document)!=!!(n!=null&&n.document)||o!=null&&o.document&&(n!=null&&n.document)&&Ue(o.document)!==Ue(n.document)?((n==null?void 0:n.status)==="LOADED"&&s.set(`${n.driveId}:${n.documentId}`,n.document),t(te,n),!0):!1});Y.debugLabel="fileNodeDocumentAtomInConnect";const at=Z(null,(e,t,n)=>{const o=e(Y);if(o)n?ct(n,o.document)||t(Y,{...o,document:n}):t(Y,void 0);else throw new Error("fileNodeDocument is undefined")});at.debugLabel="selectedDocumentAtomInConnect";const _n=()=>Qt(at);function ie(){const{selectedNode:e,selectedDriveNode:t}=j(),{openFile:n,addOperations:o,onStrandUpdate:s}=_(),{fetchDocument:c}=Dn(),[r,d]=qt(Y),l=(t==null?void 0:t.sharingType)!=="LOCAL"&&(t==null?void 0:t.syncStatus)===void 0,a=e==null?void 0:e.driveId,f=e==null?void 0:e.id,h=e==null?void 0:e.name,m=e==null?void 0:e.kind,i=m==="FILE"?e==null?void 0:e.documentType:void 0,g=_n(),v=w(async(S,b,y)=>{const p=await(l?c(S,b,y):n(S,b));if(p instanceof Error)throw p;return p},[c,l,n]);k(()=>{if(!a||!f||!i){r&&d(void 0);return}(a!==(r==null?void 0:r.driveId)||f!==r.documentId||i!==r.documentType||h!==r.name)&&d({driveId:a,documentId:f,documentType:i,name:h||"",document:void 0,status:"LOADING"})&&v(a,f,i).then(b=>d(b?{driveId:a,documentId:f,documentType:i,document:b,name:h||"",status:"LOADED"}:{driveId:a,documentId:f,documentType:i,document:b,name:h||"",status:"ERROR"})).catch(b=>{oe.error(b),d({driveId:a,documentId:f,documentType:i,name:h||"",document:void 0,status:"ERROR"})})},[e,f,i,h,a,v,r,d]),k(()=>!(r!=null&&r.driveId)||!r.documentId||!r.documentType?void 0:s(b=>{b.driveId===r.driveId&&b.documentId===r.documentId&&v(r.driveId,r.documentId,r.documentType).then(g).catch(oe.error)}),[r==null?void 0:r.driveId,r==null?void 0:r.documentId,r==null?void 0:r.documentType,s,v,g]);const D=O(()=>{if(a&&f&&m==="FILE")return ze(S=>o(a,f,S))},[o,a,f,m]),E=w(S=>{if(!(t!=null&&t.id))throw new Error("No drive node selected");return ze(b=>o(t.id,void 0,b))(S)},[o,t==null?void 0:t.id]),A=m==="FILE"&&(r==null?void 0:r.driveId)===a&&(r==null?void 0:r.documentId)===f,L=A?r==null?void 0:r.document:void 0;return O(()=>({fileNodeDocument:r,selectedDocument:L,setSelectedDocument:g,addOperationToSelectedDocument:D,addOperationToSelectedDrive:E}),[r,A,L,g,D,E])}async function zn(){const e=await Fe(()=>import("./index.C_GzfUCS.js"),__vite__mapDeps([0,1]),import.meta.url);return await Fe(()=>Promise.resolve({}),__vite__mapDeps([2]),import.meta.url),[e.documentModelEditorModule]}function Kn(e){return e.map(t=>t.editors).reduce((t,n)=>t.concat(n),[])}const dt=pn(zn);dt.debugLabel="baseEditorsAtomInConnect";const Se=Z(async e=>{const t=await e(dt),n=await e(ln);return Kn(n).concat(t)});Se.debugLabel="editorsAtomInConnect";const ut=hn(Se);ut.debugLabel="unwrappedEditorsAtomInConnect";const $n=vn(Se);$n.debugLabel="loadableEditorsAtomInConnect";const jn=()=>ge(ut),Gn=(e,t,n)=>{const o=t.find(c=>c.config.id===n&&c.documentTypes.includes(e));return o||t.find(c=>c.documentTypes.includes(e))||t.find(c=>c.documentTypes.includes("*"))||null},lt=()=>{const e=jn(),[t]=fn();return n=>e?Gn(n,e,t.value):void 0},Wn=e=>window.open(e,"_blank");var Ge;const qn=((Ge=window.electronAPI)==null?void 0:Ge.openURL)??Wn,mt=e=>{const t=[];if(e.header.documentType!=="powerhouse/document-model")return t;const n=e,o=n.state.global.specifications[0],s=Object.keys(o.state).reduce((d,l)=>{const a=l;return[...d,...Jt(o.state[a].initialValue,a!=="global").map(f=>({...f,message:`${f.message}. Scope: ${a}`,details:{...f.details,scope:a}}))]},[]),c=Object.keys(o.state).reduce((d,l)=>{var h;const a=l,f=a==="global";return[...d,...Yt(o.state[a].schema,n.header.name||((h=n.state.global)==null?void 0:h.name)||"",f?"":a,!f).map(m=>({...m,message:`${m.message}. Scope: ${a}`,details:{...m.details,scope:a}}))]},[]),r=Xt(o.modules);return[...s,...c,...r]};function Ke(e){const[t,n]=F(!1);if(k(()=>{setTimeout(()=>{n(!0)},e.loadingTimeout??200)},[e]),!t)return null;const{customEditorLoader:o,...s}=e;return o?u(We,{children:o}):u(Zt,{...s})}function ne({message:e}){return u("div",{className:"flex size-full items-center justify-center",children:u("h3",{className:"text-lg font-semibold",children:e})})}function Qn(e){const t=e.error instanceof Error?e.error.message:e.error;return u(ne,{message:t})}const Jn=e=>{const{fileNodeDocument:t,document:n,onClose:o,onChange:s,onExport:c,onAddOperation:r,onGetDocumentRevision:d,onOpenSwitchboardLink:l}=e,a=t==null?void 0:t.documentId,[f,h]=F(null),[m,i]=F(!1),g=ge(st),v=De()||void 0,D=be(),{sign:E}=Ee(),A=V(),L=lt(),S=t==null?void 0:t.documentType,b=O(()=>S?A(S):void 0,[S,A]),y=O(()=>S?L(S):void 0,[S,L]),[p,C,x]=et(b==null?void 0:b.reducer,n),N=O(()=>({theme:g,user:v}),[g,v]),I=Ve(),M=Hn(a,n==null?void 0:n.header.createdAtUtcIso),z=$({...t,document:p});k(()=>{var P;if(!(!(t!=null&&t.documentId)||!p)){if(!("documentId"in z.current)||z.current.documentId!==a){z.current={...t,document:p};return}ct(z.current.document,p)||(z.current.document=p,(P=window.documentEditorDebugTools)==null||P.setDocument(p),s==null||s(a,p))}},[p,a,t,s]);const K=w((P,le)=>{const At=(Ne,xt)=>{if(!(t!=null&&t.documentId))return;const{prevState:Tt}=xt;nt(Ne,E,t.documentId,Tt,b==null?void 0:b.reducer,v).then(Lt=>{var ke;return(ke=window.documentEditorDebugTools)==null||ke.pushOperation(Ne),r(Lt)}).catch(oe.error)};C(tt(P,D,v),At,le)},[C,D,b==null?void 0:b.reducer,r,t,E,v]),U=w(()=>i(!0),[]),ce=w(()=>i(!1),[]),W=w(()=>{K(Ye())},[K]),ae=w(()=>{K(Xe())},[K]),Ce=(t==null?void 0:t.status)==="LOADING"||!p,bt=y===void 0||!!p&&y&&!y.documentTypes.includes(p.header.documentType)&&!y.documentTypes.includes("*"),de=!!p&&(p.header.revision.global>0||p.header.revision.local>0),ue=!!(p!=null&&p.clipboard.length);Io({undo:W,redo:ae,canUndo:de,canRedo:ue}),k(()=>()=>{var P;(P=window.documentEditorDebugTools)==null||P.clear()},[]);const Ie=rt(),{showModal:Ae}=se(),[G,xe]=F(void 0);k(()=>{G&&G.documentId!==(t==null?void 0:t.documentId)&&xe(void 0)},[G,t,p]);const Et=w((P,le)=>{xe({error:P,documentId:a,info:le})},[a]);if((t==null?void 0:t.status)==="ERROR")return u(ne,{message:"Error loading document"});if(Ce||bt)return u(Ke,{message:Ce?"Loading document":"Loading editor"});if(!t)return null;if(!b)return u(ne,{message:T("div",{className:"text-center leading-10",children:[T("p",{children:['Unable to open the document because the document model "',S,'" is not supported.']}),T("p",{children:["Go to the"," ",u("button",{type:"button",className:"cursor-pointer underline",onClick:()=>{Ae("settingsModal",{onRefresh:()=>Ie(0)})},children:"package manager"})," ","to install this document model"]})]})});if(y===null)return u(ne,{message:T("div",{className:"text-center leading-10",children:[u("p",{children:"Unable to open the document because no editor has been found"}),T("p",{children:["Go to the"," ",u("button",{type:"button",className:"cursor-pointer underline",onClick:()=>{Ae("settingsModal",{onRefresh:()=>Ie(0)})},children:"package manager"})," ",'an editor for the "$',S,'" document type']})]})});const St=y.Component,{disableExternalControls:Te,documentToolbarEnabled:wt,showSwitchboardLink:Ct,timelineEnabled:It}=y.config||{},Le=Ct!==!1?l:void 0;return T("div",{className:"relative h-full",id:"document-editor-context",children:[wt&&Te&&!m&&u(Vt,{onClose:o,onExport:c,onShowRevisionHistory:U,title:t.name||p.header.name,onSwitchboardLinkClick:Le,timelineButtonVisible:It,timelineItems:M.data,onTimelineItemClick:h}),!Te&&T("div",{className:"mb-4 flex justify-end gap-10",children:[u(J,{onClick:c,children:"Export"}),T("div",{className:"flex gap-4",children:[u(J,{onClick:W,disabled:!de,children:"Undo"}),u(J,{onClick:ae,disabled:!ue,children:"Redo"})]}),u("div",{className:"flex gap-4",children:u(J,{onClick:o,children:"Close"})})]}),m?u(en,{documentTitle:p.header.name,documentId:t.documentId,globalOperations:p.operations.global,localOperations:p.operations.local,onClose:ce},a):u(kt,{fallback:u(Ke,{}),name:"EditorLoader",children:u(Ze,{fallbackRender:Qn,onError:Et,children:!(G!=null&&G.error)&&u(St,{error:x,context:{...N,getDocumentRevision:d,readMode:!!f,selectedTimelineRevision:Bn(f==null?void 0:f.startDate,f==null?void 0:f.endDate,p.operations.global)},document:p,documentNodeName:t.name,dispatch:K,onClose:o,onExport:c,canUndo:de,canRedo:ue,undo:W,redo:ae,onSwitchboardLinkClick:Le,onShowRevisionHistory:U,isAllowedToCreateDocuments:(I==null?void 0:I.isAllowedToCreateDocuments)??!1,isAllowedToEditDocuments:(I==null?void 0:I.isAllowedToEditDocuments)??!1},a)},a)})]})};function Yn(){const{t:e}=ee(),{showModal:t}=se(),{selectedDocument:n,fileNodeDocument:o,setSelectedDocument:s,addOperationToSelectedDocument:c}=ie(),{renameNode:r}=_(),{selectedNode:d,selectedDriveNode:l,selectedParentNode:a,setSelectedNode:f}=j(),{isRemoteDrive:h,remoteUrl:m}=ft(l==null?void 0:l.id),i=V(),g=ht(),v=w(async y=>{if(!n)throw new Error("No document selected");if(!c)throw new Error("No add operation function defined");await c(y)},[c,n]),D=w((y,p)=>{if(y===(o==null?void 0:o.documentId)&&(s(p),d&&p.header.name!==""&&d.name!==p.header.name))return r(d.driveId,d.id,p.header.name)},[o==null?void 0:o.documentId,r,d,s]),E=w(()=>{f(a)},[a,f]),A=w(y=>{const p=mt(y);if(p.length)t("confirmationModal",{title:e("modals.exportDocumentWithErrors.title"),body:T("div",{children:[u("p",{children:e("modals.exportDocumentWithErrors.body")}),u("ul",{className:"mt-4 flex list-disc flex-col items-start px-4 text-xs",children:p.map((C,x)=>u("li",{children:C.message},x))})]}),cancelLabel:e("common.cancel"),continueLabel:e("common.export"),onCancel(C){C()},onContinue(C){return C(),re(y,i)}});else return re(y,i)},[i,t,e]),L=w(y=>d?g(d.driveId,d.id,y):(console.error("No selected node"),Promise.reject(new Error("No selected node"))),[g,d]),S=w(()=>{if(n)return A(n)},[A,n]),b=O(()=>h?async()=>{if(!n){console.error("No selected document");return}if(!m){console.error("No remote drive url found");return}const y=i(n.header.documentType);if(!y){console.error("No document model found");return}const p=rn(m,n.header.id,y.documentModel);try{await qn(p)}catch(C){console.error("Error opening switchboard link",C)}}:void 0,[h,m,n,i]);return o?u("div",{className:"flex-1 rounded-2xl bg-gray-50 p-4",children:u(Jn,{fileNodeDocument:o,document:n,onChange:D,onClose:E,onExport:S,onGetDocumentRevision:L,onAddOperation:v,onOpenSwitchboardLink:b})},o.documentId):null}function Xn(e){const{reactor:t,driveId:n,documentIds:o,options:s}=e,[c,r]=F({}),d=$(!1),l=$(!1);return k(()=>{async function a(){if(d.current||!t||!n)return;d.current=!0;const f=o??await t.getDocuments(n),h={};for(const m of f){const i=await t.getDocument(n,m,s);h[m]={...i.state,documentType:i.header.documentType,revision:i.header.revision,createdAtUtcIso:i.header.createdAtUtcIso,lastModifiedAtUtcIso:i.header.lastModifiedAtUtcIso}}r(h)}a()},[t,n,s]),k(()=>!t||!n||l.current?void 0:(l.current=!0,t.on("strandUpdate",async f=>{if(f.driveId!==n||o&&!o.includes(f.documentId))return;const h=await t.getDocument(n,f.documentId,s);r(m=>{const i={...m};return i[f.documentId]={...h.state,documentType:h.header.documentType,revision:h.header.revision,createdAtUtcIso:h.header.createdAtUtcIso,lastModifiedAtUtcIso:h.header.lastModifiedAtUtcIso},i})})),[t,n,s]),O(()=>c,[c])}function Zn(e){return w(n=>{const{driveId:o,documentId:s}=n;return Vn({reactor:e,driveId:o,documentId:s})},[e])}function Vn(e){const{reactor:t,driveId:n,documentId:o}=e,s=Xn({reactor:t,driveId:n,documentIds:[o]});return O(()=>s[o],[s,o])}const eo="DELETE_NODE";function to(e){const{driveId:t}=e,[n,o]=F({}),{getDocumentsIds:s,openFile:c,onOperationsAdded:r}=_(),d=async(l,a,f=[])=>{let h=a;(!h||h.length===0)&&(h=await s(l));const m=h.map(async v=>{const D=await c(l,v);return[v,D]}),g=(await Promise.all(m)).reduce((v,[D,E])=>(v[D]={...E.state,documentType:E.header.documentType,revision:E.header.revision,createdAtUtcIso:E.header.createdAtUtcIso,lastModifiedAtUtcIso:E.header.lastModifiedAtUtcIso},v),{});o(v=>({...v,...g})),f.length>0&&o(v=>{const D={...v};return f.forEach(E=>{delete D[E]}),D})};return k(()=>{t&&d(t).catch(console.error)},[t]),k(()=>r((a,f,h)=>{const m=[];if(a===a&&!f){const i=h.filter(g=>g.type===eo).map(g=>g.input.id);m.push(...i)}a===a&&d(a,f?[f]:void 0,m).catch(console.error)}),[r,t]),[n,d]}function no({error:e}){return T("div",{className:"mx-auto flex max-w-[80%] flex-1 flex-col items-center justify-center",children:[u("h1",{className:"mb-2 text-xl font-semibold",children:"Error"}),u("i",{children:e instanceof Error?e.message:e}),u("pre",{children:JSON.stringify(e,null,2)})]})}function oo(){const{selectedDriveNode:e}=j();if(!e)throw new Error("No drive node selected");const t=ft(e.id);if(!t.drive)throw new Error(`Drive with id "${e.id}" not found`);return t.drive}function ro(){var x;const{selectedDriveNode:e,setSelectedNode:t,selectedNode:n,selectedParentNode:o}=j(),{addOperationToSelectedDrive:s}=ie(),c=oo(),[r,d,l]=et(tn.reducer,c),a=cn(),f=w(async N=>{await s(N)},[s]),h=co(r,e,d,f),{showModal:m}=se(),i=w(N=>{if(!e)throw new Error("No drive node selected");return m("createDocument",{documentModel:N,selectedParentNode:o,setSelectedNode:t}),Promise.resolve({name:"New Document"})},[e,o,t,m]),{addFile:g,addDocument:v}=_(),D=an(),E=Zn(a),A=ht(),L=V(),S=lt(),b=w((N,I)=>n?A(n.driveId,N,I):(console.error("No selected node"),Promise.reject(new Error("No selected node"))),[A,n]),y=O(()=>({showSearchBar:!1,isAllowedToCreateDocuments:h.isAllowedToCreateDocuments,documentModels:D??[],selectedDriveNode:e,selectedNode:n,selectNode:t,addFile:g,showCreateDocumentModal:i,useSyncStatus:ao,useDocumentEditorProps:so,useDriveDocumentStates:to,useDriveDocumentState:E,addDocument:v,reactor:a}),[a,h.isAllowedToCreateDocuments,D,n,t,g,v,i]),p=mn((x=r==null?void 0:r.header.meta)==null?void 0:x.preferredEditor);if(!r)return null;const C=(p==null?void 0:p.Component)??Rn.Component;return u(Ze,{fallbackRender:no,children:u(C,{...h,context:{...h.context,...y,analyticsDatabaseName:En.analytics.databaseName,getDocumentRevision:b,getDocumentModelModule:L,getEditor:S},onSwitchboardLinkClick:void 0,document:r,error:l},e==null?void 0:e.id)},e==null?void 0:e.id)}function ft(e){var r;const{documentDrives:t}=_();if(!e)return{drive:null,remoteUrl:null,isRemoteDrive:!1};const n=t.find(d=>d.header.id===e),o=n==null?void 0:n.state.local.triggers.find(d=>d.type==="PullResponder"),{remoteUrl:s}=(n==null?void 0:n.state.global)||{},c=!!s||!!o;return{drive:n,remoteUrl:s||((r=o==null?void 0:o.data)==null?void 0:r.url),isRemoteDrive:c}}function so(e){const{driveId:t,documentId:n,documentType:o,documentModelModule:s,user:c}=e,r=dn(),d=be(),{sign:l}=Ee(),a=nn(r,{documentId:n,driveId:t,documentType:o});return on(r,{nodeId:n,driveId:t,document:a,documentModelModule:s,connectDid:d,sign:l,user:c})}function io(e,t,n){const o=De()||void 0,s=be(),{sign:c}=Ee(),r=(e==null?void 0:e.kind)==="DRIVE"?"powerhouse/document-drive":e==null?void 0:e.documentType,d=V(),l=O(()=>r?d(r):void 0,[r,d]);return w((f,h)=>{const m=(i,g)=>{if(!(e!=null&&e.id))return;const{prevState:v}=g;nt(i,c,e.id,v,l==null?void 0:l.reducer,o).then(D=>{var E;return(E=window.documentEditorDebugTools)==null||E.pushOperation(i),n(D)}).catch(oe.error)};t(tt(f,s,o),m,h)},[t,s,l==null?void 0:l.reducer,n,e,c,o])}function co(e,t,n,o){const{t:s}=ee(),{showModal:c}=se(),r=ge(st),d=De()||void 0,l=Ve(),a=O(()=>({theme:r,user:d}),[r,d]),{selectedDocument:f}=ie(),{selectedParentNode:h,setSelectedNode:m}=j(),i=V(),g=!!e&&(e.header.revision.global>0||e.header.revision.local>0),v=!!(e!=null&&e.clipboard.length),D=io(t,n,o),E=w(()=>{D(Ye())},[D]),A=w(()=>{D(Xe())},[D]),L=w(()=>{m(h)},[h,m]),S=w(x=>{const N=mt(x);if(N.length)c("confirmationModal",{title:s("modals.exportDocumentWithErrors.title"),body:T("div",{children:[u("p",{children:s("modals.exportDocumentWithErrors.body")}),u("ul",{className:"mt-4 flex list-disc flex-col items-start px-4 text-xs",children:N.map((I,M)=>u("li",{children:I.message},M))})]}),cancelLabel:s("common.cancel"),continueLabel:s("common.export"),onCancel(I){I()},onContinue(I){return I(),re(x,i)}});else return re(x,i)},[i,c,s]),b=w(()=>{if(f)return S(f)},[S,f]),[y,p]=F(!1),C=w(()=>p(!0),[]);return{dispatch:D,revisionHistoryVisible:y,context:a,canUndo:g,canRedo:v,undo:E,redo:A,onClose:L,onExport:b,onShowRevisionHistory:C,isAllowedToCreateDocuments:(l==null?void 0:l.isAllowedToCreateDocuments)??!1,isAllowedToEditDocuments:(l==null?void 0:l.isAllowedToEditDocuments)??!1}}function ht(){const{openFile:e}=_();return w(async(n,o,s)=>await e(n,o,s),[e])}function ao(e,t){const{getSyncStatusSync:n,onSyncStatus:o,documentDrives:s}=_();return Rt(r=>o(r),()=>{var m;const r=s.find(i=>i.header.id===e);if(!r)return;const l="readContext"in r?"PUBLIC":(m=r.state.local.sharingType)==null?void 0:m.toUpperCase(),a=l==="PRIVATE"?"LOCAL":l;if(!t)return n(e,a);const f=r.state.global.nodes.find(i=>i.id===t);return!f||!("synchronizationUnits"in f)?void 0:n(f.synchronizationUnits[0].syncId,a)})}function ye(){return ye=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)({}).hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},ye.apply(null,arguments)}var pt=["shift","alt","meta","mod","ctrl"],uo={esc:"escape",return:"enter",".":"period",",":"comma","-":"slash"," ":"space","`":"backquote","#":"backslash","+":"bracketright",ShiftLeft:"shift",ShiftRight:"shift",AltLeft:"alt",AltRight:"alt",MetaLeft:"meta",MetaRight:"meta",OSLeft:"meta",OSRight:"meta",ControlLeft:"ctrl",ControlRight:"ctrl"};function H(e){return(e&&uo[e]||e||"").trim().toLowerCase().replace(/key|digit|numpad|arrow/,"")}function lo(e){return pt.includes(e)}function pe(e,t){return t===void 0&&(t=","),e.split(t)}function ve(e,t,n){t===void 0&&(t="+");var o=e.toLocaleLowerCase().split(t).map(function(r){return H(r)}),s={alt:o.includes("alt"),ctrl:o.includes("ctrl")||o.includes("control"),shift:o.includes("shift"),meta:o.includes("meta"),mod:o.includes("mod")},c=o.filter(function(r){return!pt.includes(r)});return ye({},s,{keys:c,description:n,hotkey:e})}(function(){typeof document<"u"&&(document.addEventListener("keydown",function(e){e.key!==void 0&&vt([H(e.key),H(e.code)])}),document.addEventListener("keyup",function(e){e.key!==void 0&&yt([H(e.key),H(e.code)])})),typeof window<"u"&&window.addEventListener("blur",function(){B.clear()})})();var B=new Set;function we(e){return Array.isArray(e)}function mo(e,t){t===void 0&&(t=",");var n=we(e)?e:e.split(t);return n.every(function(o){return B.has(o.trim().toLowerCase())})}function vt(e){var t=Array.isArray(e)?e:[e];B.has("meta")&&B.forEach(function(n){return!lo(n)&&B.delete(n.toLowerCase())}),t.forEach(function(n){return B.add(n.toLowerCase())})}function yt(e){var t=Array.isArray(e)?e:[e];e==="meta"?B.clear():t.forEach(function(n){return B.delete(n.toLowerCase())})}function fo(e,t,n){(typeof n=="function"&&n(e,t)||n===!0)&&e.preventDefault()}function ho(e,t,n){return typeof n=="function"?n(e,t):n===!0||n===void 0}function po(e){return gt(e,["input","textarea","select"])}function gt(e,t){t===void 0&&(t=!1);var n=e.target,o=e.composed,s=null;return vo(n)&&o?s=e.composedPath()[0]&&e.composedPath()[0].tagName:s=n&&n.tagName,we(t)?!!(s&&t&&t.some(function(c){var r;return c.toLowerCase()===((r=s)==null?void 0:r.toLowerCase())})):!!(s&&t&&t)}function vo(e){return!!e.tagName&&!e.tagName.startsWith("-")&&e.tagName.includes("-")}function yo(e,t){return e.length===0&&t?(console.warn('A hotkey has the "scopes" option set, however no active scopes were found. If you want to use the global scopes feature, you need to wrap your app in a <HotkeysProvider>'),!0):t?e.some(function(n){return t.includes(n)})||e.includes("*"):!0}var go=function(t,n,o){o===void 0&&(o=!1);var s=n.alt,c=n.meta,r=n.mod,d=n.shift,l=n.ctrl,a=n.keys,f=t.key,h=t.code,m=t.ctrlKey,i=t.metaKey,g=t.shiftKey,v=t.altKey,D=H(h),E=f.toLowerCase();if(!(a!=null&&a.includes(D))&&!(a!=null&&a.includes(E))&&!["ctrl","control","unknown","meta","alt","shift","os"].includes(D))return!1;if(!o){if(s===!v&&E!=="alt"||d===!g&&E!=="shift")return!1;if(r){if(!i&&!m)return!1}else if(c===!i&&E!=="meta"&&E!=="os"||l===!m&&E!=="ctrl"&&E!=="control")return!1}return a&&a.length===1&&(a.includes(E)||a.includes(D))?!0:a?mo(a):!a},Do=Qe(void 0),bo=function(){return qe(Do)};function Dt(e,t){return e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(e).length===Object.keys(t).length&&Object.keys(e).reduce(function(n,o){return n&&Dt(e[o],t[o])},!0):e===t}var Eo=Qe({hotkeys:[],enabledScopes:[],toggleScope:function(){},enableScope:function(){},disableScope:function(){}}),So=function(){return qe(Eo)};function wo(e){var t=$(void 0);return Dt(t.current,e)||(t.current=e),t.current}var $e=function(t){t.stopPropagation(),t.preventDefault(),t.stopImmediatePropagation()},Co=typeof window<"u"?Ot:k;function je(e,t,n,o){var s=F(null),c=s[0],r=s[1],d=$(!1),l=n instanceof Array?o instanceof Array?void 0:o:n,a=we(e)?e.join(l==null?void 0:l.splitKey):e,f=n instanceof Array?n:o instanceof Array?o:void 0,h=w(t,f??[]),m=$(h);f?m.current=h:m.current=t;var i=wo(l),g=So(),v=g.enabledScopes,D=bo();return Co(function(){if(!((i==null?void 0:i.enabled)===!1||!yo(v,i==null?void 0:i.scopes))){var E=function(y,p){var C;if(p===void 0&&(p=!1),!(po(y)&&!gt(y,i==null?void 0:i.enableOnFormTags))){if(c!==null){var x=c.getRootNode();if((x instanceof Document||x instanceof ShadowRoot)&&x.activeElement!==c&&!c.contains(x.activeElement)){$e(y);return}}(C=y.target)!=null&&C.isContentEditable&&!(i!=null&&i.enableOnContentEditable)||pe(a,i==null?void 0:i.splitKey).forEach(function(N){var I,M=ve(N,i==null?void 0:i.combinationKey);if(go(y,M,i==null?void 0:i.ignoreModifiers)||(I=M.keys)!=null&&I.includes("*")){if(i!=null&&i.ignoreEventWhen!=null&&i.ignoreEventWhen(y)||p&&d.current)return;if(fo(y,M,i==null?void 0:i.preventDefault),!ho(y,M,i==null?void 0:i.enabled)){$e(y);return}m.current(y,M),p||(d.current=!0)}})}},A=function(y){y.key!==void 0&&(vt(H(y.code)),((i==null?void 0:i.keydown)===void 0&&(i==null?void 0:i.keyup)!==!0||i!=null&&i.keydown)&&E(y))},L=function(y){y.key!==void 0&&(yt(H(y.code)),d.current=!1,i!=null&&i.keyup&&E(y,!0))},S=c||(l==null?void 0:l.document)||document;return S.addEventListener("keyup",L,l==null?void 0:l.eventListenerOptions),S.addEventListener("keydown",A,l==null?void 0:l.eventListenerOptions),D&&pe(a,i==null?void 0:i.splitKey).forEach(function(b){return D.addHotkey(ve(b,i==null?void 0:i.combinationKey,i==null?void 0:i.description))}),function(){S.removeEventListener("keyup",L,l==null?void 0:l.eventListenerOptions),S.removeEventListener("keydown",A,l==null?void 0:l.eventListenerOptions),D&&pe(a,i==null?void 0:i.splitKey).forEach(function(b){return D.removeHotkey(ve(b,i==null?void 0:i.combinationKey,i==null?void 0:i.description))})}}},[c,a,i,v]),r}const Io=e=>{var l;const{undo:t,redo:n,canRedo:o,canUndo:s}=e,{isMac:c}=((l=window.electronAPI)==null?void 0:l.platformInfo)||{};let r="ctrl+z",d="ctrl+y";c&&(r="mod+z",d="mod+shift+z"),je(r,a=>{a.preventDefault(),s&&t()},{},[s,t]),je(d,a=>{a.preventDefault(),o&&n()},{},[o,n])};function Qo(){const e=rt(),{driveId:t}=bn(),[n,,,o]=un(),{selectedDriveNode:s,selectedNode:c}=j(),{addFile:r}=_(),{fileNodeDocument:d}=ie();return k(()=>{var l;return(l=window.electronAPI)==null?void 0:l.handleFileOpen(async a=>{!s||(c==null?void 0:c.kind)!==Je||await r(a.content,s.id,a.name,c.parentFolder)})},[s,c,r]),k(()=>{(o==="LOADED"||o==="ERROR")&&!n.find(l=>l.header.id===t||l.header.slug===t||l.state.global.name===t)&&(Sn(T("p",{children:["Drive ",t," not found"]}),{type:"warning"}),e("/"))},[o,t,n]),u("div",{className:"flex h-full flex-col overflow-auto",id:"content-view",children:d?u(Yn,{},d.documentId):s?u(ro,{},s.id):null})}export{Qo as default};
3
- //# sourceMappingURL=content.mtsZfVv6.js.map
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./index.IOLzgUZt.js","./index.BcBVmRI8.js","./style-BkLV0sfQ.css"])))=>i.map(i=>d[i]);
2
+ import{jsxs as T,jsx as u,Fragment as We}from"react/jsx-runtime";import Nt,{useRef as $,useState as F,useMemo as O,useCallback as w,useEffect as k,Suspense as kt,useSyncExternalStore as Rt,useLayoutEffect as Ot,useContext as qe,createContext as Qe}from"react";import{B as J,z as Mt,D as Re,F as Pt,E as X,G as Ft,J as Je,K as Oe,L as Ut,M as Ht,y as q,N as Bt,O as _t,v as j,S as zt,V as Me,X as Kt,Y as $t,Z as jt,h as Gt,j as Wt,$ as qt,a as Z,u as Qt,m as oe,a0 as Pe,b as ge,_ as Fe,a1 as Jt,a2 as Yt,a3 as Xt,a4 as Zt,a5 as Ye,a6 as Xe,a7 as Vt,a8 as en,a9 as tn,aa as nn,ab as on}from"./index.BcBVmRI8.js";import{E as Ze,b as rn}from"./react-error-boundary.esm.DHp-mKwc.js";import{b as sn,c as Ue,e as V,a as Ve,f as cn,g as an,h as dn,i as un}from"./useFeatureFlags.Dk1vb5i-.js";import{e as ln,b as De,c as be,d as Ee,f as mn}from"./user.zVDczLr_.js";import{u as fn}from"./useDefaultDocumentModelEditor.CdkEVA6g.js";import{u as hn,a as pn,l as vn}from"./index.CsZYy69M.js";import{u as _,a as et,b as tt,s as nt,e as re}from"./useDocumentDriveServer.6V2gzdbc.js";import{u as ot,a as yn,D as me,A as fe,b as gn,c as Dn}from"./app.BdxMoAAL.js";import{e as rt,i as bn}from"./index.CAUjMUXb.js";import{useModal as se}from"./modal.BbdrOfry.js";import{u as ee}from"./useTranslation.BpVv6XIW.js";import{c as En}from"./connect.config.CzMoERNI.js";import{t as Sn}from"./toast.BwLkWP-U.js";import"react-dom";import"react-dom/client";import"./app-skeleton.js";import"./browser.BkwNmV2Z.js";import"./useAcceptedCookies.Be0ZV09a.js";import"./useConnectConfig.DZ65pVmg.js";import"./registerServiceWorker.C2QkuGt_.js";function wn(e){return"documentModelState"in e?e.documentModelState:e.documentModel}const Cn=({documentModels:e,createDocument:t})=>T("div",{className:"px-6",children:[u("h3",{className:"mb-3 mt-4 text-xl font-bold text-gray-600",children:"New document"}),u("div",{className:"flex w-full flex-wrap gap-4",children:e==null?void 0:e.map(n=>{const o=wn(n);return u(J,{color:"light",title:o.name,"aria-description":o.description,onClick:()=>t(n),children:u("span",{className:"text-sm",children:o.name})},o.id)})})]});function He(e,t){return e.name.localeCompare(t.name)}const Q=8,he=256,Be=48,In=420;function An(e){const t=$(null),{t:n}=ee(),o=Mt(),{fileNodes:s,...c}=e,r=o.innerWidth-In,d=Math.floor(r/(he+Q))||1,l=Math.ceil(s.length/d),a=Re({count:l,getScrollElement:()=>t.current,estimateSize:g=>g>0?Be+Q:Be,overscan:5}),f=Re({horizontal:!0,count:d,getScrollElement:()=>t.current,estimateSize:g=>g>0?he+Q:he,overscan:5}),h=(g,v)=>g*d+v,m=(g,v)=>{const D=h(g,v);return s[D]||null};if(s.length===0)return u("div",{className:"mb-8 text-sm text-gray-400",children:n("folderView.sections.documents.empty",{defaultValue:"No documents or files 📄"})});const i=(g,v)=>{const D=m(g,v);return D?u("div",{style:{marginLeft:v===0?0:Q},children:u(Pt,{uiNode:D,...c},D.id)}):null};return u("div",{ref:t,style:{height:"400px",width:"100%",overflow:"auto"},children:u("div",{style:{height:`${a.getTotalSize()}px`,width:`${f.getTotalSize()}px`,position:"relative"},children:a.getVirtualItems().map(g=>u(Nt.Fragment,{children:f.getVirtualItems().map(v=>u("div",{style:{position:"absolute",top:0,left:0,marginTop:g.index===0?0:Q,width:`${v.size}px`,height:`${g.size}px`,transform:`translateX(${v.start}px) translateY(${g.start}px)`},children:i(g.index,v.index)},v.key))},g.key))})})}function R({children:e,className:t,...n}){return u(R.Container,{className:t,...n,children:e})}R.Container=function({children:t,className:n,containerProps:o,...s}){return u("div",{className:X("flex grow flex-col overflow-auto rounded-2xl bg-gray-50 p-2",n),...o,...s,children:t})};R.Header=function({children:t,className:n,containerProps:o,...s}){return u("div",{className:X("flex-0",n),...o,...s,children:t})};R.Content=function({children:t,className:n,containerProps:o,...s}){return u("div",{className:X("mb-5 flex-1 px-4",n),...o,...s,children:t})};R.ContentSection=function({title:t,children:n,className:o,containerProps:s,...c}){return T("div",{className:X(o),...s,...c,children:[t&&u("div",{className:"mb-4 text-base font-semibold text-gray-600",children:t}),u("div",{className:"flex flex-wrap gap-2",children:n})]})};R.Footer=function({children:t,className:n,containerProps:o,...s}){return u("div",{className:X("flex-0",n),...o,...s,children:t})};function xn(e){const{node:t,className:n,isDropTarget:o,containerProps:s,...c}=e,{t:r}=ee(),d=t.children.filter(m=>m.kind===Ft).sort(He),l=t.children.filter(m=>m.kind===Je).sort(He),a={onSelectNode:m=>c.onSelectNode(m),onRenameNode:(m,i)=>c.onRenameNode(m,i),onDuplicateNode:m=>c.onDuplicateNode(m),onDeleteNode:m=>c.onDeleteNode(m)},f={onSelectNode:m=>c.onSelectNode(m),onRenameNode:(m,i)=>c.onRenameNode(m,i),onDuplicateNode:m=>c.onDuplicateNode(m),onDeleteNode:m=>c.onDeleteNode(m)},h={onAddFile:async(m,i)=>{await c.onAddFile(m,i)},onCopyNode:async(m,i)=>{await c.onCopyNode(m,i)},onMoveNode:async(m,i)=>{await c.onMoveNode(m,i)}};return T("div",{className:Oe("rounded-md border-2 border-transparent p-2",o&&"border-dashed border-blue-100",n),...s,children:[u(R.ContentSection,{title:r("folderView.sections.folders.title",{defaultValue:"Folders"}),className:"mb-4",children:d.length>0?d.map(m=>u(Ut,{uiNode:m,...h,...a,isAllowedToCreateDocuments:c.isAllowedToCreateDocuments},m.id)):u("div",{className:"mb-8 text-sm text-gray-400",children:r("folderView.sections.folders.empty",{defaultValue:"No documents or files 📄"})})}),u(R.ContentSection,{title:r("folderView.sections.documents.title",{defaultValue:"Documents and files"}),children:u("div",{className:Oe("w-full",l.length>0?"min-h-[400px]":"min-h-14"),children:u(An,{fileNodes:l,...f,isAllowedToCreateDocuments:c.isAllowedToCreateDocuments})})})]})}const Tn=[{id:"project",label:".project",icon:u(q,{name:"Project",color:"#FF6A55",size:16})},{id:"budget",label:".budget",icon:u(q,{name:"BarChart",color:"#8E55EA",size:16})},{id:"profile",label:".profile",icon:u(q,{name:"Person",color:"#3E90F0",size:16})},{id:"legal",label:".legal",icon:u(q,{name:"Briefcase",color:"#4BAB71",size:16})},{id:"atlas",label:".Atlas",icon:u(q,{name:"Globe",color:"#FF8A00",size:16})}],Ln=()=>{const{t:e}=ee(),[t,n]=F("");return u(Ht,{className:"max-w-searchbar-width m-4 shrink-0 bg-gray-100",placeholder:e("searchbar.placeholder"),filterLabel:e("searchbar.filterLabel"),filterItems:Tn,value:t,onChange:n})};function Nn(e){const{document:t,dispatch:n,className:o,children:s}=e,{header:{id:c}}=t,{showSearchBar:r,isAllowedToCreateDocuments:d,documentModels:l,showCreateDocumentModal:a}=_t(),{driveNodes:f,selectedNode:h,selectedNodePath:m,getNodeById:i,setSelectedNode:g}=j(),v=O(()=>f.find(U=>U.id===c),[f,c]),{addDocument:D,addFile:E,addFolder:A,renameNode:L,deleteNode:S,moveNode:b,copyNode:y,duplicateNode:p}=zt(t,n),C=w(async U=>{const{name:ce}=await a(U),W=U.utils.createDocument();await D(ce,U.documentModel.name,W,h==null?void 0:h.id)},[D,a,h==null?void 0:h.id]),{isDropTarget:x,dropProps:N}=Me({uiNode:h,onAddFile:E,onCopyNode:y,onMoveNode:b}),{isDropTarget:I,dropProps:M}=Me({uiNode:(h==null?void 0:h.kind)==="FOLDER"?h:null,onAddFile:E,onCopyNode:y,onMoveNode:b}),{breadcrumbs:z,onBreadcrumbSelected:K}=Kt({selectedNodePath:m,getNodeById:i,setSelectedNode:g});if(v){if((h==null?void 0:h.kind)===$t)return u(We,{})}else return u("div",{children:"Drive not found"});return T(R,{className:o,children:[s,T(R.Header,{children:[u(jt,{breadcrumbs:z,createEnabled:d,onCreate:A,onBreadcrumbSelected:K}),r&&u(Ln,{})]}),u(R.Content,{...M,className:I?"rounded-xl bg-blue-100":"",children:u(xn,{node:h||v,onSelectNode:g,onRenameNode:L,onDuplicateNode:p,onDeleteNode:S,onAddFile:E,onCopyNode:y,onMoveNode:b,isAllowedToCreateDocuments:d,isDropTarget:x,...N})}),u(R.Footer,{children:d&&u(Cn,{documentModels:l,createDocument:C})})]})}function kn(e){return u(Bt,{value:e.context,children:u(Nn,{...e})})}const Rn={Component:kn};function On(e){const{queryFn:t,...n}=e,{data:o}=ot(),{data:s}=yn(),c="enabled"in n?n.enabled:!!o&&!!s;return Wt({...n,enabled:c,queryFn:async()=>{if(!o||!s)throw new Error("No analytics store available. Use within an AnalyticsProvider.");return await t({store:o,engine:s})}})}const Mn=200;function Pn(e,t){const{data:n}=ot(),o=Gt(),s=(t==null?void 0:t.sources)??[],c=On({queryKey:["analytics","query",e],queryFn:({engine:r})=>r.execute(e),...t});return k(()=>{if(!s.length||!n)return;const r=new Array;let d=null;const l=()=>{d&&clearTimeout(d),d=setTimeout(()=>{o.invalidateQueries({queryKey:["analytics","query",e]}).catch(a=>{console.error(a)})},Mn)};return s.forEach(a=>{const f=n.subscribeToSource(a,l);r.push(f)}),()=>{r.forEach(a=>a())}},[e,n,s]),c}const _e=e=>e<=0?0:e>0&&e<=50?1:e>50&&e<=100?2:e>100&&e<=250?3:4;function Fn(e){if(!e.length)return[];const t=[];return e.forEach((n,o)=>{if(t.push(n),o<e.length-1){const s=new Date(n.startDate),c=new Date(e[o+1].startDate),r=s.getHours(),d=c.getHours(),l=s.toDateString(),a=c.toDateString();(l!==a||l===a&&Math.abs(d-r)>1)&&t.push({id:`divider-${n.id}-${e[o+1].id}`,type:"divider",revision:0})}}),t}function Un(e){if(!e)return[];const t=e.sort((n,o)=>{const s=new Date(n.start),c=new Date(o.start);return s.getTime()-c.getTime()}).filter(n=>n.rows.every(o=>o.value>0)).map(n=>{const{additions:o,deletions:s}=n.rows.reduce((r,d)=>(d.dimensions.changes.path==="ph/diff/changes/add"?r.additions+=d.value:d.dimensions.changes.path==="ph/diff/changes/remove"&&(r.deletions+=d.value),r),{additions:0,deletions:0}),c=new Date(n.start);return{id:c.toISOString(),type:"bar",addSize:_e(o),delSize:_e(s),additions:o,deletions:s,timestamp:c.toISOString(),startDate:c,endDate:new Date(n.end),revision:0}});return Fn(t)}const Hn=(e,t,n)=>{const o=t?me.fromISO(t):me.now().startOf("day");return Pn({start:o,end:me.now().endOf("day"),granularity:gn.Hourly,metrics:["Count"],select:{changes:[fe.fromString("ph/diff/changes")],document:[fe.fromString(`ph/diff/document/${e}`)]},lod:{changes:4}},{sources:[fe.fromString(`ph/diff/${n}/${e}`)],select:Un})},Bn=(e,t,n=[])=>{if(!e||!t)return 0;const o=n.find(s=>{const c=new Date(s.timestamp);return c>=e&&c<=t});return o?o.index:0},st=sn("theme","light",e=>{var t;typeof window<"u"&&((t=window.electronAPI)==null||t.setTheme(e))});function ze(e,t=50){let n;const o=[];return s=>{n&&clearTimeout(n);const c=o.findIndex(r=>r.scope===s.scope&&r.index===s.index);if(c>-1){const r=o[c];r.type===s.type&&JSON.stringify(s.input)===JSON.stringify(r.input)||console.warn("Two conflicting operations were dispatched:",r,s),o[c]=s}else o.push(s);return new Promise((r,d)=>{n=setTimeout(()=>{e(o).then(r).catch(d)},t)})}}const it=Z(new Map);it.debugLabel="documentCacheAtomInConnect";const te=Z(void 0);te.debugLabel="singletonFileNodeDocumentAtomInConnect";function ct(e,t){return e===t?!0:!e||!t?!1:Pe(e)===Pe(t)}const Y=Z(e=>e(te),(e,t,n)=>{const o=e(te),s=e(it);return!(n!=null&&n.document)&&(n==null?void 0:n.status)==="LOADING"&&(n.document=s.get(`${n.driveId}:${n.documentId}`)),(o==null?void 0:o.driveId)!==(n==null?void 0:n.driveId)||(o==null?void 0:o.documentId)!==(n==null?void 0:n.documentId)||(o==null?void 0:o.documentType)!==(n==null?void 0:n.documentType)||(o==null?void 0:o.status)!==(n==null?void 0:n.status)||!!(o!=null&&o.document)!=!!(n!=null&&n.document)||o!=null&&o.document&&(n!=null&&n.document)&&Ue(o.document)!==Ue(n.document)?((n==null?void 0:n.status)==="LOADED"&&s.set(`${n.driveId}:${n.documentId}`,n.document),t(te,n),!0):!1});Y.debugLabel="fileNodeDocumentAtomInConnect";const at=Z(null,(e,t,n)=>{const o=e(Y);if(o)n?ct(n,o.document)||t(Y,{...o,document:n}):t(Y,void 0);else throw new Error("fileNodeDocument is undefined")});at.debugLabel="selectedDocumentAtomInConnect";const _n=()=>Qt(at);function ie(){const{selectedNode:e,selectedDriveNode:t}=j(),{openFile:n,addOperations:o,onStrandUpdate:s}=_(),{fetchDocument:c}=Dn(),[r,d]=qt(Y),l=(t==null?void 0:t.sharingType)!=="LOCAL"&&(t==null?void 0:t.syncStatus)===void 0,a=e==null?void 0:e.driveId,f=e==null?void 0:e.id,h=e==null?void 0:e.name,m=e==null?void 0:e.kind,i=m==="FILE"?e==null?void 0:e.documentType:void 0,g=_n(),v=w(async(S,b,y)=>{const p=await(l?c(S,b,y):n(S,b));if(p instanceof Error)throw p;return p},[c,l,n]);k(()=>{if(!a||!f||!i){r&&d(void 0);return}(a!==(r==null?void 0:r.driveId)||f!==r.documentId||i!==r.documentType||h!==r.name)&&d({driveId:a,documentId:f,documentType:i,name:h||"",document:void 0,status:"LOADING"})&&v(a,f,i).then(b=>d(b?{driveId:a,documentId:f,documentType:i,document:b,name:h||"",status:"LOADED"}:{driveId:a,documentId:f,documentType:i,document:b,name:h||"",status:"ERROR"})).catch(b=>{oe.error(b),d({driveId:a,documentId:f,documentType:i,name:h||"",document:void 0,status:"ERROR"})})},[e,f,i,h,a,v,r,d]),k(()=>!(r!=null&&r.driveId)||!r.documentId||!r.documentType?void 0:s(b=>{b.driveId===r.driveId&&b.documentId===r.documentId&&v(r.driveId,r.documentId,r.documentType).then(g).catch(oe.error)}),[r==null?void 0:r.driveId,r==null?void 0:r.documentId,r==null?void 0:r.documentType,s,v,g]);const D=O(()=>{if(a&&f&&m==="FILE")return ze(S=>o(a,f,S))},[o,a,f,m]),E=w(S=>{if(!(t!=null&&t.id))throw new Error("No drive node selected");return ze(b=>o(t.id,void 0,b))(S)},[o,t==null?void 0:t.id]),A=m==="FILE"&&(r==null?void 0:r.driveId)===a&&(r==null?void 0:r.documentId)===f,L=A?r==null?void 0:r.document:void 0;return O(()=>({fileNodeDocument:r,selectedDocument:L,setSelectedDocument:g,addOperationToSelectedDocument:D,addOperationToSelectedDrive:E}),[r,A,L,g,D,E])}async function zn(){const e=await Fe(()=>import("./index.IOLzgUZt.js"),__vite__mapDeps([0,1]),import.meta.url);return await Fe(()=>Promise.resolve({}),__vite__mapDeps([2]),import.meta.url),[e.documentModelEditorModule]}function Kn(e){return e.map(t=>t.editors).reduce((t,n)=>t.concat(n),[])}const dt=pn(zn);dt.debugLabel="baseEditorsAtomInConnect";const Se=Z(async e=>{const t=await e(dt),n=await e(ln);return Kn(n).concat(t)});Se.debugLabel="editorsAtomInConnect";const ut=hn(Se);ut.debugLabel="unwrappedEditorsAtomInConnect";const $n=vn(Se);$n.debugLabel="loadableEditorsAtomInConnect";const jn=()=>ge(ut),Gn=(e,t,n)=>{const o=t.find(c=>c.config.id===n&&c.documentTypes.includes(e));return o||t.find(c=>c.documentTypes.includes(e))||t.find(c=>c.documentTypes.includes("*"))||null},lt=()=>{const e=jn(),[t]=fn();return n=>e?Gn(n,e,t.value):void 0},Wn=e=>window.open(e,"_blank");var Ge;const qn=((Ge=window.electronAPI)==null?void 0:Ge.openURL)??Wn,mt=e=>{const t=[];if(e.header.documentType!=="powerhouse/document-model")return t;const n=e,o=n.state.global.specifications[0],s=Object.keys(o.state).reduce((d,l)=>{const a=l;return[...d,...Jt(o.state[a].initialValue,a!=="global").map(f=>({...f,message:`${f.message}. Scope: ${a}`,details:{...f.details,scope:a}}))]},[]),c=Object.keys(o.state).reduce((d,l)=>{var h;const a=l,f=a==="global";return[...d,...Yt(o.state[a].schema,n.header.name||((h=n.state.global)==null?void 0:h.name)||"",f?"":a,!f).map(m=>({...m,message:`${m.message}. Scope: ${a}`,details:{...m.details,scope:a}}))]},[]),r=Xt(o.modules);return[...s,...c,...r]};function Ke(e){const[t,n]=F(!1);if(k(()=>{setTimeout(()=>{n(!0)},e.loadingTimeout??200)},[e]),!t)return null;const{customEditorLoader:o,...s}=e;return o?u(We,{children:o}):u(Zt,{...s})}function ne({message:e}){return u("div",{className:"flex size-full items-center justify-center",children:u("h3",{className:"text-lg font-semibold",children:e})})}function Qn(e){const t=e.error instanceof Error?e.error.message:e.error;return u(ne,{message:t})}const Jn=e=>{const{fileNodeDocument:t,document:n,onClose:o,onChange:s,onExport:c,onAddOperation:r,onGetDocumentRevision:d,onOpenSwitchboardLink:l}=e,a=t==null?void 0:t.documentId,[f,h]=F(null),[m,i]=F(!1),g=ge(st),v=De()||void 0,D=be(),{sign:E}=Ee(),A=V(),L=lt(),S=t==null?void 0:t.documentType,b=O(()=>S?A(S):void 0,[S,A]),y=O(()=>S?L(S):void 0,[S,L]),[p,C,x]=et(b==null?void 0:b.reducer,n),N=O(()=>({theme:g,user:v}),[g,v]),I=Ve(),M=Hn(a,n==null?void 0:n.header.createdAtUtcIso),z=$({...t,document:p});k(()=>{var P;if(!(!(t!=null&&t.documentId)||!p)){if(!("documentId"in z.current)||z.current.documentId!==a){z.current={...t,document:p};return}ct(z.current.document,p)||(z.current.document=p,(P=window.documentEditorDebugTools)==null||P.setDocument(p),s==null||s(a,p))}},[p,a,t,s]);const K=w((P,le)=>{const At=(Ne,xt)=>{if(!(t!=null&&t.documentId))return;const{prevState:Tt}=xt;nt(Ne,E,t.documentId,Tt,b==null?void 0:b.reducer,v).then(Lt=>{var ke;return(ke=window.documentEditorDebugTools)==null||ke.pushOperation(Ne),r(Lt)}).catch(oe.error)};C(tt(P,D,v),At,le)},[C,D,b==null?void 0:b.reducer,r,t,E,v]),U=w(()=>i(!0),[]),ce=w(()=>i(!1),[]),W=w(()=>{K(Ye())},[K]),ae=w(()=>{K(Xe())},[K]),Ce=(t==null?void 0:t.status)==="LOADING"||!p,bt=y===void 0||!!p&&y&&!y.documentTypes.includes(p.header.documentType)&&!y.documentTypes.includes("*"),de=!!p&&(p.header.revision.global>0||p.header.revision.local>0),ue=!!(p!=null&&p.clipboard.length);Io({undo:W,redo:ae,canUndo:de,canRedo:ue}),k(()=>()=>{var P;(P=window.documentEditorDebugTools)==null||P.clear()},[]);const Ie=rt(),{showModal:Ae}=se(),[G,xe]=F(void 0);k(()=>{G&&G.documentId!==(t==null?void 0:t.documentId)&&xe(void 0)},[G,t,p]);const Et=w((P,le)=>{xe({error:P,documentId:a,info:le})},[a]);if((t==null?void 0:t.status)==="ERROR")return u(ne,{message:"Error loading document"});if(Ce||bt)return u(Ke,{message:Ce?"Loading document":"Loading editor"});if(!t)return null;if(!b)return u(ne,{message:T("div",{className:"text-center leading-10",children:[T("p",{children:['Unable to open the document because the document model "',S,'" is not supported.']}),T("p",{children:["Go to the"," ",u("button",{type:"button",className:"cursor-pointer underline",onClick:()=>{Ae("settingsModal",{onRefresh:()=>Ie(0)})},children:"package manager"})," ","to install this document model"]})]})});if(y===null)return u(ne,{message:T("div",{className:"text-center leading-10",children:[u("p",{children:"Unable to open the document because no editor has been found"}),T("p",{children:["Go to the"," ",u("button",{type:"button",className:"cursor-pointer underline",onClick:()=>{Ae("settingsModal",{onRefresh:()=>Ie(0)})},children:"package manager"})," ",'an editor for the "$',S,'" document type']})]})});const St=y.Component,{disableExternalControls:Te,documentToolbarEnabled:wt,showSwitchboardLink:Ct,timelineEnabled:It}=y.config||{},Le=Ct!==!1?l:void 0;return T("div",{className:"relative h-full",id:"document-editor-context",children:[wt&&Te&&!m&&u(Vt,{onClose:o,onExport:c,onShowRevisionHistory:U,title:t.name||p.header.name,onSwitchboardLinkClick:Le,timelineButtonVisible:It,timelineItems:M.data,onTimelineItemClick:h}),!Te&&T("div",{className:"mb-4 flex justify-end gap-10",children:[u(J,{onClick:c,children:"Export"}),T("div",{className:"flex gap-4",children:[u(J,{onClick:W,disabled:!de,children:"Undo"}),u(J,{onClick:ae,disabled:!ue,children:"Redo"})]}),u("div",{className:"flex gap-4",children:u(J,{onClick:o,children:"Close"})})]}),m?u(en,{documentTitle:p.header.name,documentId:t.documentId,globalOperations:p.operations.global,localOperations:p.operations.local,onClose:ce},a):u(kt,{fallback:u(Ke,{}),name:"EditorLoader",children:u(Ze,{fallbackRender:Qn,onError:Et,children:!(G!=null&&G.error)&&u(St,{error:x,context:{...N,getDocumentRevision:d,readMode:!!f,selectedTimelineRevision:Bn(f==null?void 0:f.startDate,f==null?void 0:f.endDate,p.operations.global)},document:p,documentNodeName:t.name,dispatch:K,onClose:o,onExport:c,canUndo:de,canRedo:ue,undo:W,redo:ae,onSwitchboardLinkClick:Le,onShowRevisionHistory:U,isAllowedToCreateDocuments:(I==null?void 0:I.isAllowedToCreateDocuments)??!1,isAllowedToEditDocuments:(I==null?void 0:I.isAllowedToEditDocuments)??!1},a)},a)})]})};function Yn(){const{t:e}=ee(),{showModal:t}=se(),{selectedDocument:n,fileNodeDocument:o,setSelectedDocument:s,addOperationToSelectedDocument:c}=ie(),{renameNode:r}=_(),{selectedNode:d,selectedDriveNode:l,selectedParentNode:a,setSelectedNode:f}=j(),{isRemoteDrive:h,remoteUrl:m}=ft(l==null?void 0:l.id),i=V(),g=ht(),v=w(async y=>{if(!n)throw new Error("No document selected");if(!c)throw new Error("No add operation function defined");await c(y)},[c,n]),D=w((y,p)=>{if(y===(o==null?void 0:o.documentId)&&(s(p),d&&p.header.name!==""&&d.name!==p.header.name))return r(d.driveId,d.id,p.header.name)},[o==null?void 0:o.documentId,r,d,s]),E=w(()=>{f(a)},[a,f]),A=w(y=>{const p=mt(y);if(p.length)t("confirmationModal",{title:e("modals.exportDocumentWithErrors.title"),body:T("div",{children:[u("p",{children:e("modals.exportDocumentWithErrors.body")}),u("ul",{className:"mt-4 flex list-disc flex-col items-start px-4 text-xs",children:p.map((C,x)=>u("li",{children:C.message},x))})]}),cancelLabel:e("common.cancel"),continueLabel:e("common.export"),onCancel(C){C()},onContinue(C){return C(),re(y,i)}});else return re(y,i)},[i,t,e]),L=w(y=>d?g(d.driveId,d.id,y):(console.error("No selected node"),Promise.reject(new Error("No selected node"))),[g,d]),S=w(()=>{if(n)return A(n)},[A,n]),b=O(()=>h?async()=>{if(!n){console.error("No selected document");return}if(!m){console.error("No remote drive url found");return}const y=i(n.header.documentType);if(!y){console.error("No document model found");return}const p=rn(m,n.header.id,y.documentModel);try{await qn(p)}catch(C){console.error("Error opening switchboard link",C)}}:void 0,[h,m,n,i]);return o?u("div",{className:"flex-1 rounded-2xl bg-gray-50 p-4",children:u(Jn,{fileNodeDocument:o,document:n,onChange:D,onClose:E,onExport:S,onGetDocumentRevision:L,onAddOperation:v,onOpenSwitchboardLink:b})},o.documentId):null}function Xn(e){const{reactor:t,driveId:n,documentIds:o,options:s}=e,[c,r]=F({}),d=$(!1),l=$(!1);return k(()=>{async function a(){if(d.current||!t||!n)return;d.current=!0;const f=o??await t.getDocuments(n),h={};for(const m of f){const i=await t.getDocument(n,m,s);h[m]={...i.state,documentType:i.header.documentType,revision:i.header.revision,createdAtUtcIso:i.header.createdAtUtcIso,lastModifiedAtUtcIso:i.header.lastModifiedAtUtcIso}}r(h)}a()},[t,n,s]),k(()=>!t||!n||l.current?void 0:(l.current=!0,t.on("strandUpdate",async f=>{if(f.driveId!==n||o&&!o.includes(f.documentId))return;const h=await t.getDocument(n,f.documentId,s);r(m=>{const i={...m};return i[f.documentId]={...h.state,documentType:h.header.documentType,revision:h.header.revision,createdAtUtcIso:h.header.createdAtUtcIso,lastModifiedAtUtcIso:h.header.lastModifiedAtUtcIso},i})})),[t,n,s]),O(()=>c,[c])}function Zn(e){return w(n=>{const{driveId:o,documentId:s}=n;return Vn({reactor:e,driveId:o,documentId:s})},[e])}function Vn(e){const{reactor:t,driveId:n,documentId:o}=e,s=Xn({reactor:t,driveId:n,documentIds:[o]});return O(()=>s[o],[s,o])}const eo="DELETE_NODE";function to(e){const{driveId:t}=e,[n,o]=F({}),{getDocumentsIds:s,openFile:c,onOperationsAdded:r}=_(),d=async(l,a,f=[])=>{let h=a;(!h||h.length===0)&&(h=await s(l));const m=h.map(async v=>{const D=await c(l,v);return[v,D]}),g=(await Promise.all(m)).reduce((v,[D,E])=>(v[D]={...E.state,documentType:E.header.documentType,revision:E.header.revision,createdAtUtcIso:E.header.createdAtUtcIso,lastModifiedAtUtcIso:E.header.lastModifiedAtUtcIso},v),{});o(v=>({...v,...g})),f.length>0&&o(v=>{const D={...v};return f.forEach(E=>{delete D[E]}),D})};return k(()=>{t&&d(t).catch(console.error)},[t]),k(()=>r((a,f,h)=>{const m=[];if(a===a&&!f){const i=h.filter(g=>g.type===eo).map(g=>g.input.id);m.push(...i)}a===a&&d(a,f?[f]:void 0,m).catch(console.error)}),[r,t]),[n,d]}function no({error:e}){return T("div",{className:"mx-auto flex max-w-[80%] flex-1 flex-col items-center justify-center",children:[u("h1",{className:"mb-2 text-xl font-semibold",children:"Error"}),u("i",{children:e instanceof Error?e.message:e}),u("pre",{children:JSON.stringify(e,null,2)})]})}function oo(){const{selectedDriveNode:e}=j();if(!e)throw new Error("No drive node selected");const t=ft(e.id);if(!t.drive)throw new Error(`Drive with id "${e.id}" not found`);return t.drive}function ro(){var x;const{selectedDriveNode:e,setSelectedNode:t,selectedNode:n,selectedParentNode:o}=j(),{addOperationToSelectedDrive:s}=ie(),c=oo(),[r,d,l]=et(tn.reducer,c),a=cn(),f=w(async N=>{await s(N)},[s]),h=co(r,e,d,f),{showModal:m}=se(),i=w(N=>{if(!e)throw new Error("No drive node selected");return m("createDocument",{documentModel:N,selectedParentNode:o,setSelectedNode:t}),Promise.resolve({name:"New Document"})},[e,o,t,m]),{addFile:g,addDocument:v}=_(),D=an(),E=Zn(a),A=ht(),L=V(),S=lt(),b=w((N,I)=>n?A(n.driveId,N,I):(console.error("No selected node"),Promise.reject(new Error("No selected node"))),[A,n]),y=O(()=>({showSearchBar:!1,isAllowedToCreateDocuments:h.isAllowedToCreateDocuments,documentModels:D??[],selectedDriveNode:e,selectedNode:n,selectNode:t,addFile:g,showCreateDocumentModal:i,useSyncStatus:ao,useDocumentEditorProps:so,useDriveDocumentStates:to,useDriveDocumentState:E,addDocument:v,reactor:a}),[a,h.isAllowedToCreateDocuments,D,n,t,g,v,i]),p=mn((x=r==null?void 0:r.header.meta)==null?void 0:x.preferredEditor);if(!r)return null;const C=(p==null?void 0:p.Component)??Rn.Component;return u(Ze,{fallbackRender:no,children:u(C,{...h,context:{...h.context,...y,analyticsDatabaseName:En.analytics.databaseName,getDocumentRevision:b,getDocumentModelModule:L,getEditor:S},onSwitchboardLinkClick:void 0,document:r,error:l},e==null?void 0:e.id)},e==null?void 0:e.id)}function ft(e){var r;const{documentDrives:t}=_();if(!e)return{drive:null,remoteUrl:null,isRemoteDrive:!1};const n=t.find(d=>d.header.id===e),o=n==null?void 0:n.state.local.triggers.find(d=>d.type==="PullResponder"),{remoteUrl:s}=(n==null?void 0:n.state.global)||{},c=!!s||!!o;return{drive:n,remoteUrl:s||((r=o==null?void 0:o.data)==null?void 0:r.url),isRemoteDrive:c}}function so(e){const{driveId:t,documentId:n,documentType:o,documentModelModule:s,user:c}=e,r=dn(),d=be(),{sign:l}=Ee(),a=nn(r,{documentId:n,driveId:t,documentType:o});return on(r,{nodeId:n,driveId:t,document:a,documentModelModule:s,connectDid:d,sign:l,user:c})}function io(e,t,n){const o=De()||void 0,s=be(),{sign:c}=Ee(),r=(e==null?void 0:e.kind)==="DRIVE"?"powerhouse/document-drive":e==null?void 0:e.documentType,d=V(),l=O(()=>r?d(r):void 0,[r,d]);return w((f,h)=>{const m=(i,g)=>{if(!(e!=null&&e.id))return;const{prevState:v}=g;nt(i,c,e.id,v,l==null?void 0:l.reducer,o).then(D=>{var E;return(E=window.documentEditorDebugTools)==null||E.pushOperation(i),n(D)}).catch(oe.error)};t(tt(f,s,o),m,h)},[t,s,l==null?void 0:l.reducer,n,e,c,o])}function co(e,t,n,o){const{t:s}=ee(),{showModal:c}=se(),r=ge(st),d=De()||void 0,l=Ve(),a=O(()=>({theme:r,user:d}),[r,d]),{selectedDocument:f}=ie(),{selectedParentNode:h,setSelectedNode:m}=j(),i=V(),g=!!e&&(e.header.revision.global>0||e.header.revision.local>0),v=!!(e!=null&&e.clipboard.length),D=io(t,n,o),E=w(()=>{D(Ye())},[D]),A=w(()=>{D(Xe())},[D]),L=w(()=>{m(h)},[h,m]),S=w(x=>{const N=mt(x);if(N.length)c("confirmationModal",{title:s("modals.exportDocumentWithErrors.title"),body:T("div",{children:[u("p",{children:s("modals.exportDocumentWithErrors.body")}),u("ul",{className:"mt-4 flex list-disc flex-col items-start px-4 text-xs",children:N.map((I,M)=>u("li",{children:I.message},M))})]}),cancelLabel:s("common.cancel"),continueLabel:s("common.export"),onCancel(I){I()},onContinue(I){return I(),re(x,i)}});else return re(x,i)},[i,c,s]),b=w(()=>{if(f)return S(f)},[S,f]),[y,p]=F(!1),C=w(()=>p(!0),[]);return{dispatch:D,revisionHistoryVisible:y,context:a,canUndo:g,canRedo:v,undo:E,redo:A,onClose:L,onExport:b,onShowRevisionHistory:C,isAllowedToCreateDocuments:(l==null?void 0:l.isAllowedToCreateDocuments)??!1,isAllowedToEditDocuments:(l==null?void 0:l.isAllowedToEditDocuments)??!1}}function ht(){const{openFile:e}=_();return w(async(n,o,s)=>await e(n,o,s),[e])}function ao(e,t){const{getSyncStatusSync:n,onSyncStatus:o,documentDrives:s}=_();return Rt(r=>o(r),()=>{var m;const r=s.find(i=>i.header.id===e);if(!r)return;const l="readContext"in r?"PUBLIC":(m=r.state.local.sharingType)==null?void 0:m.toUpperCase(),a=l==="PRIVATE"?"LOCAL":l;if(!t)return n(e,a);const f=r.state.global.nodes.find(i=>i.id===t);return!f||!("synchronizationUnits"in f)?void 0:n(f.synchronizationUnits[0].syncId,a)})}function ye(){return ye=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)({}).hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},ye.apply(null,arguments)}var pt=["shift","alt","meta","mod","ctrl"],uo={esc:"escape",return:"enter",".":"period",",":"comma","-":"slash"," ":"space","`":"backquote","#":"backslash","+":"bracketright",ShiftLeft:"shift",ShiftRight:"shift",AltLeft:"alt",AltRight:"alt",MetaLeft:"meta",MetaRight:"meta",OSLeft:"meta",OSRight:"meta",ControlLeft:"ctrl",ControlRight:"ctrl"};function H(e){return(e&&uo[e]||e||"").trim().toLowerCase().replace(/key|digit|numpad|arrow/,"")}function lo(e){return pt.includes(e)}function pe(e,t){return t===void 0&&(t=","),e.split(t)}function ve(e,t,n){t===void 0&&(t="+");var o=e.toLocaleLowerCase().split(t).map(function(r){return H(r)}),s={alt:o.includes("alt"),ctrl:o.includes("ctrl")||o.includes("control"),shift:o.includes("shift"),meta:o.includes("meta"),mod:o.includes("mod")},c=o.filter(function(r){return!pt.includes(r)});return ye({},s,{keys:c,description:n,hotkey:e})}(function(){typeof document<"u"&&(document.addEventListener("keydown",function(e){e.key!==void 0&&vt([H(e.key),H(e.code)])}),document.addEventListener("keyup",function(e){e.key!==void 0&&yt([H(e.key),H(e.code)])})),typeof window<"u"&&window.addEventListener("blur",function(){B.clear()})})();var B=new Set;function we(e){return Array.isArray(e)}function mo(e,t){t===void 0&&(t=",");var n=we(e)?e:e.split(t);return n.every(function(o){return B.has(o.trim().toLowerCase())})}function vt(e){var t=Array.isArray(e)?e:[e];B.has("meta")&&B.forEach(function(n){return!lo(n)&&B.delete(n.toLowerCase())}),t.forEach(function(n){return B.add(n.toLowerCase())})}function yt(e){var t=Array.isArray(e)?e:[e];e==="meta"?B.clear():t.forEach(function(n){return B.delete(n.toLowerCase())})}function fo(e,t,n){(typeof n=="function"&&n(e,t)||n===!0)&&e.preventDefault()}function ho(e,t,n){return typeof n=="function"?n(e,t):n===!0||n===void 0}function po(e){return gt(e,["input","textarea","select"])}function gt(e,t){t===void 0&&(t=!1);var n=e.target,o=e.composed,s=null;return vo(n)&&o?s=e.composedPath()[0]&&e.composedPath()[0].tagName:s=n&&n.tagName,we(t)?!!(s&&t&&t.some(function(c){var r;return c.toLowerCase()===((r=s)==null?void 0:r.toLowerCase())})):!!(s&&t&&t)}function vo(e){return!!e.tagName&&!e.tagName.startsWith("-")&&e.tagName.includes("-")}function yo(e,t){return e.length===0&&t?(console.warn('A hotkey has the "scopes" option set, however no active scopes were found. If you want to use the global scopes feature, you need to wrap your app in a <HotkeysProvider>'),!0):t?e.some(function(n){return t.includes(n)})||e.includes("*"):!0}var go=function(t,n,o){o===void 0&&(o=!1);var s=n.alt,c=n.meta,r=n.mod,d=n.shift,l=n.ctrl,a=n.keys,f=t.key,h=t.code,m=t.ctrlKey,i=t.metaKey,g=t.shiftKey,v=t.altKey,D=H(h),E=f.toLowerCase();if(!(a!=null&&a.includes(D))&&!(a!=null&&a.includes(E))&&!["ctrl","control","unknown","meta","alt","shift","os"].includes(D))return!1;if(!o){if(s===!v&&E!=="alt"||d===!g&&E!=="shift")return!1;if(r){if(!i&&!m)return!1}else if(c===!i&&E!=="meta"&&E!=="os"||l===!m&&E!=="ctrl"&&E!=="control")return!1}return a&&a.length===1&&(a.includes(E)||a.includes(D))?!0:a?mo(a):!a},Do=Qe(void 0),bo=function(){return qe(Do)};function Dt(e,t){return e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(e).length===Object.keys(t).length&&Object.keys(e).reduce(function(n,o){return n&&Dt(e[o],t[o])},!0):e===t}var Eo=Qe({hotkeys:[],enabledScopes:[],toggleScope:function(){},enableScope:function(){},disableScope:function(){}}),So=function(){return qe(Eo)};function wo(e){var t=$(void 0);return Dt(t.current,e)||(t.current=e),t.current}var $e=function(t){t.stopPropagation(),t.preventDefault(),t.stopImmediatePropagation()},Co=typeof window<"u"?Ot:k;function je(e,t,n,o){var s=F(null),c=s[0],r=s[1],d=$(!1),l=n instanceof Array?o instanceof Array?void 0:o:n,a=we(e)?e.join(l==null?void 0:l.splitKey):e,f=n instanceof Array?n:o instanceof Array?o:void 0,h=w(t,f??[]),m=$(h);f?m.current=h:m.current=t;var i=wo(l),g=So(),v=g.enabledScopes,D=bo();return Co(function(){if(!((i==null?void 0:i.enabled)===!1||!yo(v,i==null?void 0:i.scopes))){var E=function(y,p){var C;if(p===void 0&&(p=!1),!(po(y)&&!gt(y,i==null?void 0:i.enableOnFormTags))){if(c!==null){var x=c.getRootNode();if((x instanceof Document||x instanceof ShadowRoot)&&x.activeElement!==c&&!c.contains(x.activeElement)){$e(y);return}}(C=y.target)!=null&&C.isContentEditable&&!(i!=null&&i.enableOnContentEditable)||pe(a,i==null?void 0:i.splitKey).forEach(function(N){var I,M=ve(N,i==null?void 0:i.combinationKey);if(go(y,M,i==null?void 0:i.ignoreModifiers)||(I=M.keys)!=null&&I.includes("*")){if(i!=null&&i.ignoreEventWhen!=null&&i.ignoreEventWhen(y)||p&&d.current)return;if(fo(y,M,i==null?void 0:i.preventDefault),!ho(y,M,i==null?void 0:i.enabled)){$e(y);return}m.current(y,M),p||(d.current=!0)}})}},A=function(y){y.key!==void 0&&(vt(H(y.code)),((i==null?void 0:i.keydown)===void 0&&(i==null?void 0:i.keyup)!==!0||i!=null&&i.keydown)&&E(y))},L=function(y){y.key!==void 0&&(yt(H(y.code)),d.current=!1,i!=null&&i.keyup&&E(y,!0))},S=c||(l==null?void 0:l.document)||document;return S.addEventListener("keyup",L,l==null?void 0:l.eventListenerOptions),S.addEventListener("keydown",A,l==null?void 0:l.eventListenerOptions),D&&pe(a,i==null?void 0:i.splitKey).forEach(function(b){return D.addHotkey(ve(b,i==null?void 0:i.combinationKey,i==null?void 0:i.description))}),function(){S.removeEventListener("keyup",L,l==null?void 0:l.eventListenerOptions),S.removeEventListener("keydown",A,l==null?void 0:l.eventListenerOptions),D&&pe(a,i==null?void 0:i.splitKey).forEach(function(b){return D.removeHotkey(ve(b,i==null?void 0:i.combinationKey,i==null?void 0:i.description))})}}},[c,a,i,v]),r}const Io=e=>{var l;const{undo:t,redo:n,canRedo:o,canUndo:s}=e,{isMac:c}=((l=window.electronAPI)==null?void 0:l.platformInfo)||{};let r="ctrl+z",d="ctrl+y";c&&(r="mod+z",d="mod+shift+z"),je(r,a=>{a.preventDefault(),s&&t()},{},[s,t]),je(d,a=>{a.preventDefault(),o&&n()},{},[o,n])};function Qo(){const e=rt(),{driveId:t}=bn(),[n,,,o]=un(),{selectedDriveNode:s,selectedNode:c}=j(),{addFile:r}=_(),{fileNodeDocument:d}=ie();return k(()=>{var l;return(l=window.electronAPI)==null?void 0:l.handleFileOpen(async a=>{!s||(c==null?void 0:c.kind)!==Je||await r(a.content,s.id,a.name,c.parentFolder)})},[s,c,r]),k(()=>{(o==="LOADED"||o==="ERROR")&&!n.find(l=>l.header.id===t||l.header.slug===t||l.state.global.name===t)&&(Sn(T("p",{children:["Drive ",t," not found"]}),{type:"warning"}),e("/"))},[o,t,n]),u("div",{className:"flex h-full flex-col overflow-auto",id:"content-view",children:d?u(Yn,{},d.documentId):s?u(ro,{},s.id):null})}export{Qo as default};
3
+ //# sourceMappingURL=content.BtkNuaBR.js.map