@powerhousedao/ph-clint-app 0.1.0-dev.106 → 0.1.0-dev.107
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.
- package/dist/connect/assets/{ClearStorageModal-DyU-FIgY-BJAb391v.js → ClearStorageModal-DyU-FIgY-Cv-Fjyuf.js} +2 -2
- package/dist/connect/assets/{ClearStorageModal-DyU-FIgY-BJAb391v.js.map → ClearStorageModal-DyU-FIgY-Cv-Fjyuf.js.map} +1 -1
- package/dist/connect/assets/{DebugSettingsModal-CwUN9gIr-BHtXVwZu.js → DebugSettingsModal-CwUN9gIr-CXybqnnl.js} +2 -2
- package/dist/connect/assets/{DebugSettingsModal-CwUN9gIr-BHtXVwZu.js.map → DebugSettingsModal-CwUN9gIr-CXybqnnl.js.map} +1 -1
- package/dist/connect/assets/{InspectorModal-Cd8kbCV8-wCEPH9Q6.js → InspectorModal-Cd8kbCV8-HwWTmWMU.js} +2 -2
- package/dist/connect/assets/{InspectorModal-Cd8kbCV8-wCEPH9Q6.js.map → InspectorModal-Cd8kbCV8-HwWTmWMU.js.map} +1 -1
- package/dist/connect/assets/{OpenFileDocumentsModal-BQsaBP4x-D0QTl2mc.js → OpenFileDocumentsModal-BQsaBP4x-DrXQ7KP_.js} +2 -2
- package/dist/connect/assets/{OpenFileDocumentsModal-BQsaBP4x-D0QTl2mc.js.map → OpenFileDocumentsModal-BQsaBP4x-DrXQ7KP_.js.map} +1 -1
- package/dist/connect/assets/{SettingsModal-CgjW-M2a-BKJzJ25U.js → SettingsModal-CgjW-M2a-DGpVrhR1.js} +2 -2
- package/dist/connect/assets/{SettingsModal-CgjW-M2a-BKJzJ25U.js.map → SettingsModal-CgjW-M2a-DGpVrhR1.js.map} +1 -1
- package/dist/connect/assets/{app-loader-l5wtQh5z-CYQpkwjk.js → app-loader-l5wtQh5z-bWtqX25O.js} +4 -4
- package/dist/connect/assets/{app-loader-l5wtQh5z-CYQpkwjk.js.map → app-loader-l5wtQh5z-bWtqX25O.js.map} +1 -1
- package/dist/connect/assets/{components-BH57lxCU-BZ_0YIzo.js → components-BH57lxCU-Eruh92Ls.js} +2 -2
- package/dist/connect/assets/{components-BH57lxCU-BZ_0YIzo.js.map → components-BH57lxCU-Eruh92Ls.js.map} +1 -1
- package/dist/connect/assets/{connect.config-CaXMoB42-Dbb5nzkI.js → connect.config-CaXMoB42-D2BeV43I.js} +2 -2
- package/dist/connect/assets/{connect.config-CaXMoB42-Dbb5nzkI.js.map → connect.config-CaXMoB42-D2BeV43I.js.map} +1 -1
- package/dist/connect/assets/{connection-state-Eqc2izmt-CZj5x6c0.js → connection-state-Eqc2izmt-C-KzrbY1.js} +2 -2
- package/dist/connect/assets/{connection-state-Eqc2izmt-CZj5x6c0.js.map → connection-state-Eqc2izmt-C-KzrbY1.js.map} +1 -1
- package/dist/connect/assets/{cookie-banner-BxXvPdIY-DwJZO4Kr.js → cookie-banner-BxXvPdIY-Blpa2FD0.js} +2 -2
- package/dist/connect/assets/{cookie-banner-BxXvPdIY-DwJZO4Kr.js.map → cookie-banner-BxXvPdIY-Blpa2FD0.js.map} +1 -1
- package/dist/connect/assets/{index-ypRDyz0_.js → index-DJjc4BDx.js} +3 -3
- package/dist/connect/assets/{index-ypRDyz0_.js.map → index-DJjc4BDx.js.map} +1 -1
- package/dist/connect/assets/{load-ftpCX1HI-CPPnPa1h.js → load-ftpCX1HI-Dexlo14X.js} +2 -2
- package/dist/connect/assets/{load-ftpCX1HI-CPPnPa1h.js.map → load-ftpCX1HI-Dexlo14X.js.map} +1 -1
- package/dist/connect/assets/{pglite-seed-Cl2d-iyl-Dm71yfXU.js → pglite-seed-Cl2d-iyl-B2jdiHFc.js} +2 -2
- package/dist/connect/assets/{pglite-seed-Cl2d-iyl-Dm71yfXU.js.map → pglite-seed-Cl2d-iyl-B2jdiHFc.js.map} +1 -1
- package/dist/connect/assets/{preferences-store-DZUIAkHE-DMBWFJbj.js → preferences-store-DZUIAkHE-Cc5P2Ff8.js} +2 -2
- package/dist/connect/assets/{preferences-store-DZUIAkHE-DMBWFJbj.js.map → preferences-store-DZUIAkHE-Cc5P2Ff8.js.map} +1 -1
- package/dist/connect/assets/{reactor-CItc8KaF-2ruIW1vZ.js → reactor-CItc8KaF-B-r7zrGd.js} +2 -2
- package/dist/connect/assets/{reactor-CItc8KaF-2ruIW1vZ.js.map → reactor-CItc8KaF-B-r7zrGd.js.map} +1 -1
- package/dist/connect/assets/{registerServiceWorker-smkROQhm-K2kHougF.js → registerServiceWorker-smkROQhm-CJA_w_O4.js} +2 -2
- package/dist/connect/assets/{registerServiceWorker-smkROQhm-K2kHougF.js.map → registerServiceWorker-smkROQhm-CJA_w_O4.js.map} +1 -1
- package/dist/connect/index.html +1 -1
- package/dist/connect/powerhouse.config.json +1 -1
- package/dist/connect/service-worker.js +1 -1
- package/package.json +1 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{t as e}from"./reactor-CItc8KaF-
|
|
2
|
-
//# sourceMappingURL=ClearStorageModal-DyU-FIgY-
|
|
1
|
+
import{t as e}from"./reactor-CItc8KaF-B-r7zrGd.js";import{t}from"./useTranslation-C3rJ2yqu.js";import{jsx as n}from"react/jsx-runtime";import{childLogger as r}from"document-model";import{closePHModal as i,setSelectedDrive as a,setSelectedNode as o,showPHModal as s,usePHModal as c}from"@powerhousedao/reactor-browser";import{useState as l}from"react";import{ConnectConfirmationModal as u}from"@powerhousedao/design-system/connect";(function(){try{var e=typeof window<`u`?window:typeof global<`u`?global:typeof globalThis<`u`?globalThis:typeof self<`u`?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]=`0c0f4b3a-0f14-5f05-a5ce-4eb6011cf2ad`)}catch{}})();var d=r([`ClearStorage`]);function f(){let r=c()?.type===`clearStorage`,{t:f}=t(),[p,m]=l(!1);function h(){m(!0),e().then(()=>{d.info(`Storage cleared`),a(void 0),o(void 0),window.location.reload()}).catch(e=>{d.error(`Error clearing storage: @error`,e),m(!1)})}return n(u,{open:r,header:f(`modals.connectSettings.clearStorage.confirmation.title`),body:f(`modals.connectSettings.clearStorage.confirmation.body`),cancelLabel:f(`common.cancel`),continueLabel:f(`modals.connectSettings.clearStorage.confirmation.clearButton`),onCancel:()=>s({type:`settings`}),onContinue:h,onOpenChange:e=>{if(!e)return i()},continueDisabled:p})}export{f as ClearStorageModal};
|
|
2
|
+
//# sourceMappingURL=ClearStorageModal-DyU-FIgY-Cv-Fjyuf.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ClearStorageModal-DyU-FIgY-
|
|
1
|
+
{"version":3,"file":"ClearStorageModal-DyU-FIgY-Cv-Fjyuf.js","names":[],"sources":["../../../../../node_modules/.pnpm/@powerhousedao+connect@6.2.3_031a39ff375233beffe5df359486f16d/node_modules/@powerhousedao/connect/dist/ClearStorageModal-DyU-FIgY.js"],"sourcesContent":["\n!function(){try{var e=\"undefined\"!=typeof window?window:\"undefined\"!=typeof global?global:\"undefined\"!=typeof globalThis?globalThis:\"undefined\"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]=\"0c0f4b3a-0f14-5f05-a5ce-4eb6011cf2ad\")}catch(e){}}();\nimport { t as clearReactorStorage } from \"./reactor-CItc8KaF.js\";\nimport { jsx } from \"react/jsx-runtime\";\nimport { useTranslation } from \"react-i18next\";\nimport { useState } from \"react\";\nimport { ConnectConfirmationModal } from \"@powerhousedao/design-system/connect\";\nimport { closePHModal, setSelectedDrive, setSelectedNode, showPHModal, usePHModal } from \"@powerhousedao/reactor-browser\";\nimport { childLogger } from \"document-model\";\n//#region src/components/modal/modals/ClearStorageModal.tsx\nconst logger$1 = childLogger([\"ClearStorage\"]);\nfunction ClearStorageModal() {\n\tconst open = usePHModal()?.type === \"clearStorage\";\n\tconst { t } = useTranslation();\n\tconst [loading, setLoading] = useState(false);\n\tfunction clearStorage() {\n\t\tsetLoading(true);\n\t\tclearReactorStorage().then(() => {\n\t\t\tlogger$1.info(\"Storage cleared\");\n\t\t\tsetSelectedDrive(void 0);\n\t\t\tsetSelectedNode(void 0);\n\t\t\twindow.location.reload();\n\t\t}).catch((error) => {\n\t\t\tlogger$1.error(\"Error clearing storage: @error\", error);\n\t\t\tsetLoading(false);\n\t\t});\n\t}\n\treturn /* @__PURE__ */ jsx(ConnectConfirmationModal, {\n\t\topen,\n\t\theader: t(\"modals.connectSettings.clearStorage.confirmation.title\"),\n\t\tbody: t(\"modals.connectSettings.clearStorage.confirmation.body\"),\n\t\tcancelLabel: t(\"common.cancel\"),\n\t\tcontinueLabel: t(\"modals.connectSettings.clearStorage.confirmation.clearButton\"),\n\t\tonCancel: () => showPHModal({ type: \"settings\" }),\n\t\tonContinue: clearStorage,\n\t\tonOpenChange: (status) => {\n\t\t\tif (!status) return closePHModal();\n\t\t},\n\t\tcontinueDisabled: loading\n\t});\n}\n//#endregion\nexport { ClearStorageModal };\n\n//# sourceMappingURL=ClearStorageModal-DyU-FIgY.js.map\n//# debugId=0c0f4b3a-0f14-5f05-a5ce-4eb6011cf2ad\n"],"x_google_ignoreList":[0],"mappings":"gbACC,UAAU,CAAC,GAAG,CAAC,IAAI,EAAe,OAAO,OAApB,IAA2B,OAAoB,OAAO,OAApB,IAA2B,OAAoB,OAAO,WAApB,IAA+B,WAAwB,OAAO,KAApB,IAAyB,KAAK,CAAC,EAAE,EAAG,IAAI,EAAE,MAAI,CAAC,CAAE,MAAM,IAAI,EAAE,gBAAgB,EAAE,iBAAiB,CAAC,EAAE,EAAE,gBAAgB,GAAG,uCAAuC,MAAS,CAAC,CAAC,EAAA,CAAE,EAShT,IAAM,EAAW,EAAY,CAAC,cAAc,CAAC,EAC7C,SAAS,GAAoB,CAC5B,IAAM,EAAO,EAAW,CAAC,EAAE,OAAS,eAC9B,CAAE,KAAM,EAAe,EACvB,CAAC,EAAS,GAAc,EAAS,EAAK,EAC5C,SAAS,GAAe,CACvB,EAAW,EAAI,EACf,EAAoB,CAAC,CAAC,SAAW,CAChC,EAAS,KAAK,iBAAiB,EAC/B,EAAiB,IAAK,EAAC,EACvB,EAAgB,IAAK,EAAC,EACtB,OAAO,SAAS,OAAO,CACxB,CAAC,CAAC,CAAC,MAAO,GAAU,CACnB,EAAS,MAAM,iCAAkC,CAAK,EACtD,EAAW,EAAK,CACjB,CAAC,CACF,CACA,OAAuB,EAAI,EAA0B,CACpD,OACA,OAAQ,EAAE,wDAAwD,EAClE,KAAM,EAAE,uDAAuD,EAC/D,YAAa,EAAE,eAAe,EAC9B,cAAe,EAAE,8DAA8D,EAC/E,aAAgB,EAAY,CAAE,KAAM,UAAW,CAAC,EAChD,WAAY,EACZ,aAAe,GAAW,CACzB,GAAI,CAAC,EAAQ,OAAO,EAAa,CAClC,EACA,iBAAkB,CACnB,CAAC,CACF"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{r as e}from"./connect.config-CaXMoB42-
|
|
2
|
-
//# sourceMappingURL=DebugSettingsModal-CwUN9gIr-
|
|
1
|
+
import{r as e}from"./connect.config-CaXMoB42-D2BeV43I.js";import{a as t,n,r}from"./build-info-BV8UtyA4-vnk7Wd-i.js";import{t as i}from"./icon-01W_S_9A-7FJRMZYN.js";import{n as a,t as o}from"./src-CrUksCLW-DV3pQOMC.js";import{n as s}from"./registerServiceWorker-smkROQhm-CJA_w_O4.js";import{jsx as c,jsxs as l}from"react/jsx-runtime";import{closePHModal as u,usePHModal as d}from"@powerhousedao/reactor-browser";import{useEffect as f,useState as p}from"react";import{Combobox as m,FormInput as h}from"@powerhousedao/design-system/connect";(function(){try{var e=typeof window<`u`?window:typeof global<`u`?global:typeof globalThis<`u`?globalThis:typeof self<`u`?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]=`8b8648ba-1a7e-5413-b4d3-cc6bd09cdce5`)}catch{}})();var g=()=>{let g=d()?.type===`debugSettings`,[_,v]=p(e.appVersion),[y,b]=p({label:s.debug?`Enabled`:`Disabled`,value:s.debug});return f(()=>{s.setDebug(y.value)},[y]),c(o,{open:g,onOpenChange:e=>{if(!e)return u()},contentProps:{className:`rounded-2xl`},children:l(`div`,{className:`w-[700px] rounded-2xl bg-background p-6`,children:[l(`div`,{className:`mb-6 flex justify-between`,children:[c(`div`,{className:`text-xl font-bold`,children:`Debug Tools`}),c(`button`,{id:`close-modal`,onClick:()=>u(),children:c(i,{name:`Xmark`,size:28})})]}),l(`div`,{className:`flex text-sm font-bold`,children:[c(i,{name:`Ring`,size:22}),l(`span`,{className:`ml-2`,children:[`App Version: `,e.appVersion]}),(()=>{let e=n();if(e===`unknown`)return null;let i=r(),a=t(e);return i?l(`a`,{className:`ml-2 font-mono text-xs font-normal text-info hover:underline`,href:i,target:`_blank`,rel:`noreferrer noopener`,title:e,children:[`(`,a,`)`]}):l(`span`,{className:`ml-2 font-mono text-xs font-normal text-muted-foreground`,title:e,children:[`(`,a,`)`]})})()]}),l(`div`,{className:`mt-4 flex text-sm font-bold`,children:[c(i,{name:`Hdd`,size:22}),c(`span`,{className:`ml-2`,children:`Drive Tools:`})]}),l(`div`,{className:`mt-4 flex text-sm font-bold`,children:[c(i,{name:`Gear`,size:22}),c(`span`,{className:`ml-2`,children:`Service Worker Tools:`})]}),c(`div`,{className:`mt-2 flex items-end justify-between pl-4`,children:l(`div`,{className:`w-[400px]`,children:[c(`label`,{htmlFor:`serviceWorkerDebugMode`,className:`text-xs`,children:`Service Worker Debug Mode:`}),c(m,{id:`serviceWorkerDebugMode`,onChange:e=>{b(e)},value:y,options:[{label:`Enabled`,value:!0},{label:`Disabled`,value:!1}]})]})}),l(`div`,{className:`mt-2 flex items-end justify-between pl-4`,children:[l(`div`,{className:`w-[400px]`,children:[c(`label`,{htmlFor:`appVersion`,className:`text-xs`,children:`Set invalid app version:`}),c(h,{containerClassName:`rounded-md border border-border bg-background p-1 text-sm`,inputClassName:`text-xs font-normal`,id:`appVersion`,icon:c(`div`,{className:`flex h-full items-center text-xs`,children:`Version:`}),value:_,onChange:e=>v(e.target.value)})]}),c(`div`,{className:`mb-1 flex items-center justify-center`,children:c(a,{color:_===``?`light`:`red`,size:`small`,disabled:_===``,onClick:()=>{s.sendMessage({type:`SET_APP_VERSION`,version:_}),v(``)},children:`Add Invalid App Version`})})]})]})})};export{g as DebugSettingsModal};
|
|
2
|
+
//# sourceMappingURL=DebugSettingsModal-CwUN9gIr-CXybqnnl.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DebugSettingsModal-CwUN9gIr-
|
|
1
|
+
{"version":3,"file":"DebugSettingsModal-CwUN9gIr-CXybqnnl.js","names":[],"sources":["../../../../../node_modules/.pnpm/@powerhousedao+connect@6.2.3_031a39ff375233beffe5df359486f16d/node_modules/@powerhousedao/connect/dist/DebugSettingsModal-CwUN9gIr.js"],"sourcesContent":["\n!function(){try{var e=\"undefined\"!=typeof window?window:\"undefined\"!=typeof global?global:\"undefined\"!=typeof globalThis?globalThis:\"undefined\"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]=\"8b8648ba-1a7e-5413-b4d3-cc6bd09cdce5\")}catch(e){}}();\nimport { r as connectConfig } from \"./connect.config-CaXMoB42.js\";\nimport { a as shortGitSha, n as getGitSha, r as getGitUrl } from \"./build-info-BV8UtyA4.js\";\nimport { n as serviceWorkerManager } from \"./registerServiceWorker-smkROQhm.js\";\nimport { jsx, jsxs } from \"react/jsx-runtime\";\nimport { useEffect, useState } from \"react\";\nimport { Combobox, FormInput } from \"@powerhousedao/design-system/connect\";\nimport { closePHModal, usePHModal } from \"@powerhousedao/reactor-browser\";\nimport { Icon, Modal, PowerhouseButton } from \"@powerhousedao/design-system\";\n//#region src/components/modal/modals/DebugSettingsModal.tsx\nconst DebugSettingsModal = () => {\n\tconst open = usePHModal()?.type === \"debugSettings\";\n\tconst [appVersion, setAppVersion] = useState(connectConfig.appVersion);\n\tconst [serviceWorkerDebugMode, setServiceWorkerDebugMode] = useState({\n\t\tlabel: serviceWorkerManager.debug ? \"Enabled\" : \"Disabled\",\n\t\tvalue: serviceWorkerManager.debug\n\t});\n\tuseEffect(() => {\n\t\tserviceWorkerManager.setDebug(serviceWorkerDebugMode.value);\n\t}, [serviceWorkerDebugMode]);\n\treturn /* @__PURE__ */ jsx(Modal, {\n\t\topen,\n\t\tonOpenChange: (status) => {\n\t\t\tif (!status) return closePHModal();\n\t\t},\n\t\tcontentProps: { className: \"rounded-2xl\" },\n\t\tchildren: /* @__PURE__ */ jsxs(\"div\", {\n\t\t\tclassName: \"w-[700px] rounded-2xl bg-background p-6\",\n\t\t\tchildren: [\n\t\t\t\t/* @__PURE__ */ jsxs(\"div\", {\n\t\t\t\t\tclassName: \"mb-6 flex justify-between\",\n\t\t\t\t\tchildren: [/* @__PURE__ */ jsx(\"div\", {\n\t\t\t\t\t\tclassName: \"text-xl font-bold\",\n\t\t\t\t\t\tchildren: \"Debug Tools\"\n\t\t\t\t\t}), /* @__PURE__ */ jsx(\"button\", {\n\t\t\t\t\t\tid: \"close-modal\",\n\t\t\t\t\t\tonClick: () => closePHModal(),\n\t\t\t\t\t\tchildren: /* @__PURE__ */ jsx(Icon, {\n\t\t\t\t\t\t\tname: \"Xmark\",\n\t\t\t\t\t\t\tsize: 28\n\t\t\t\t\t\t})\n\t\t\t\t\t})]\n\t\t\t\t}),\n\t\t\t\t/* @__PURE__ */ jsxs(\"div\", {\n\t\t\t\t\tclassName: \"flex text-sm font-bold\",\n\t\t\t\t\tchildren: [\n\t\t\t\t\t\t/* @__PURE__ */ jsx(Icon, {\n\t\t\t\t\t\t\tname: \"Ring\",\n\t\t\t\t\t\t\tsize: 22\n\t\t\t\t\t\t}),\n\t\t\t\t\t\t/* @__PURE__ */ jsxs(\"span\", {\n\t\t\t\t\t\t\tclassName: \"ml-2\",\n\t\t\t\t\t\t\tchildren: [\"App Version: \", connectConfig.appVersion]\n\t\t\t\t\t\t}),\n\t\t\t\t\t\t(() => {\n\t\t\t\t\t\t\tconst sha = getGitSha();\n\t\t\t\t\t\t\tif (sha === \"unknown\") return null;\n\t\t\t\t\t\t\tconst url = getGitUrl();\n\t\t\t\t\t\t\tconst label = shortGitSha(sha);\n\t\t\t\t\t\t\treturn url ? /* @__PURE__ */ jsxs(\"a\", {\n\t\t\t\t\t\t\t\tclassName: \"ml-2 font-mono text-xs font-normal text-info hover:underline\",\n\t\t\t\t\t\t\t\thref: url,\n\t\t\t\t\t\t\t\ttarget: \"_blank\",\n\t\t\t\t\t\t\t\trel: \"noreferrer noopener\",\n\t\t\t\t\t\t\t\ttitle: sha,\n\t\t\t\t\t\t\t\tchildren: [\n\t\t\t\t\t\t\t\t\t\"(\",\n\t\t\t\t\t\t\t\t\tlabel,\n\t\t\t\t\t\t\t\t\t\")\"\n\t\t\t\t\t\t\t\t]\n\t\t\t\t\t\t\t}) : /* @__PURE__ */ jsxs(\"span\", {\n\t\t\t\t\t\t\t\tclassName: \"ml-2 font-mono text-xs font-normal text-muted-foreground\",\n\t\t\t\t\t\t\t\ttitle: sha,\n\t\t\t\t\t\t\t\tchildren: [\n\t\t\t\t\t\t\t\t\t\"(\",\n\t\t\t\t\t\t\t\t\tlabel,\n\t\t\t\t\t\t\t\t\t\")\"\n\t\t\t\t\t\t\t\t]\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t})()\n\t\t\t\t\t]\n\t\t\t\t}),\n\t\t\t\t/* @__PURE__ */ jsxs(\"div\", {\n\t\t\t\t\tclassName: \"mt-4 flex text-sm font-bold\",\n\t\t\t\t\tchildren: [/* @__PURE__ */ jsx(Icon, {\n\t\t\t\t\t\tname: \"Hdd\",\n\t\t\t\t\t\tsize: 22\n\t\t\t\t\t}), /* @__PURE__ */ jsx(\"span\", {\n\t\t\t\t\t\tclassName: \"ml-2\",\n\t\t\t\t\t\tchildren: \"Drive Tools:\"\n\t\t\t\t\t})]\n\t\t\t\t}),\n\t\t\t\t/* @__PURE__ */ jsxs(\"div\", {\n\t\t\t\t\tclassName: \"mt-4 flex text-sm font-bold\",\n\t\t\t\t\tchildren: [/* @__PURE__ */ jsx(Icon, {\n\t\t\t\t\t\tname: \"Gear\",\n\t\t\t\t\t\tsize: 22\n\t\t\t\t\t}), /* @__PURE__ */ jsx(\"span\", {\n\t\t\t\t\t\tclassName: \"ml-2\",\n\t\t\t\t\t\tchildren: \"Service Worker Tools:\"\n\t\t\t\t\t})]\n\t\t\t\t}),\n\t\t\t\t/* @__PURE__ */ jsx(\"div\", {\n\t\t\t\t\tclassName: \"mt-2 flex items-end justify-between pl-4\",\n\t\t\t\t\tchildren: /* @__PURE__ */ jsxs(\"div\", {\n\t\t\t\t\t\tclassName: \"w-[400px]\",\n\t\t\t\t\t\tchildren: [/* @__PURE__ */ jsx(\"label\", {\n\t\t\t\t\t\t\thtmlFor: \"serviceWorkerDebugMode\",\n\t\t\t\t\t\t\tclassName: \"text-xs\",\n\t\t\t\t\t\t\tchildren: \"Service Worker Debug Mode:\"\n\t\t\t\t\t\t}), /* @__PURE__ */ jsx(Combobox, {\n\t\t\t\t\t\t\tid: \"serviceWorkerDebugMode\",\n\t\t\t\t\t\t\tonChange: (value) => {\n\t\t\t\t\t\t\t\tsetServiceWorkerDebugMode(value);\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tvalue: serviceWorkerDebugMode,\n\t\t\t\t\t\t\toptions: [{\n\t\t\t\t\t\t\t\tlabel: \"Enabled\",\n\t\t\t\t\t\t\t\tvalue: true\n\t\t\t\t\t\t\t}, {\n\t\t\t\t\t\t\t\tlabel: \"Disabled\",\n\t\t\t\t\t\t\t\tvalue: false\n\t\t\t\t\t\t\t}]\n\t\t\t\t\t\t})]\n\t\t\t\t\t})\n\t\t\t\t}),\n\t\t\t\t/* @__PURE__ */ jsxs(\"div\", {\n\t\t\t\t\tclassName: \"mt-2 flex items-end justify-between pl-4\",\n\t\t\t\t\tchildren: [/* @__PURE__ */ jsxs(\"div\", {\n\t\t\t\t\t\tclassName: \"w-[400px]\",\n\t\t\t\t\t\tchildren: [/* @__PURE__ */ jsx(\"label\", {\n\t\t\t\t\t\t\thtmlFor: \"appVersion\",\n\t\t\t\t\t\t\tclassName: \"text-xs\",\n\t\t\t\t\t\t\tchildren: \"Set invalid app version:\"\n\t\t\t\t\t\t}), /* @__PURE__ */ jsx(FormInput, {\n\t\t\t\t\t\t\tcontainerClassName: \"rounded-md border border-border bg-background p-1 text-sm\",\n\t\t\t\t\t\t\tinputClassName: \"text-xs font-normal\",\n\t\t\t\t\t\t\tid: \"appVersion\",\n\t\t\t\t\t\t\ticon: /* @__PURE__ */ jsx(\"div\", {\n\t\t\t\t\t\t\t\tclassName: \"flex h-full items-center text-xs\",\n\t\t\t\t\t\t\t\tchildren: \"Version:\"\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\tvalue: appVersion,\n\t\t\t\t\t\t\tonChange: (element) => setAppVersion(element.target.value)\n\t\t\t\t\t\t})]\n\t\t\t\t\t}), /* @__PURE__ */ jsx(\"div\", {\n\t\t\t\t\t\tclassName: \"mb-1 flex items-center justify-center\",\n\t\t\t\t\t\tchildren: /* @__PURE__ */ jsx(PowerhouseButton, {\n\t\t\t\t\t\t\tcolor: appVersion === \"\" ? \"light\" : \"red\",\n\t\t\t\t\t\t\tsize: \"small\",\n\t\t\t\t\t\t\tdisabled: appVersion === \"\",\n\t\t\t\t\t\t\tonClick: () => {\n\t\t\t\t\t\t\t\tserviceWorkerManager.sendMessage({\n\t\t\t\t\t\t\t\t\ttype: \"SET_APP_VERSION\",\n\t\t\t\t\t\t\t\t\tversion: appVersion\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\tsetAppVersion(\"\");\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tchildren: \"Add Invalid App Version\"\n\t\t\t\t\t\t})\n\t\t\t\t\t})]\n\t\t\t\t})\n\t\t\t]\n\t\t})\n\t});\n};\n//#endregion\nexport { DebugSettingsModal };\n\n//# source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,CAAC,EAAmB,EAAI,EAAW,CAClC,mBAAoB,4DACpB,eAAgB,sBAChB,GAAI,aACJ,KAAsB,EAAI,MAAO,CAChC,UAAW,mCACX,SAAU,UACX,CAAC,EACD,MAAO,EACP,SAAW,GAAY,EAAc,EAAQ,OAAO,KAAK,CAC1D,CAAC,CAAC,CACH,CAAC,EAAmB,EAAI,MAAO,CAC9B,UAAW,wCACX,SAA0B,EAAI,EAAkB,CAC/C,MAAO,IAAe,GAAK,QAAU,MACrC,KAAM,QACN,SAAU,IAAe,GACzB,YAAe,CACd,EAAqB,YAAY,CAChC,KAAM,kBACN,QAAS,CACV,CAAC,EACD,EAAc,EAAE,CACjB,EACA,SAAU,yBACX,CAAC,CACF,CAAC,CAAC,CACH,CAAC,CACF,CACD,CAAC,CACF,CAAC,CACF"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as e,i as t,r as n,t as r}from"./reactor-CItc8KaF-
|
|
1
|
+
import{a as e,i as t,r as n,t as r}from"./reactor-CItc8KaF-B-r7zrGd.js";import{S as i,T as a,l as o,m as s}from"./connection-state-Eqc2izmt-C-KzrbY1.js";import{t as c}from"./pglite-seed-Cl2d-iyl-B2jdiHFc.js";import{jsx as l}from"react/jsx-runtime";import{DocumentIntegrityService as u,InMemoryQueue as d,PollBehavior as f,REACTOR_SCHEMA as p,addRemoteDrive as m,closePHModal as h,useConnectionStates as g,useDatabase as _,usePGlite as v,usePHModal as y,useReactorClientModule as b,useSync as x}from"@powerhousedao/reactor-browser";import{useCallback as S,useMemo as C,useState as w,useSyncExternalStore as T}from"react";import{InspectorModal as E}from"@powerhousedao/design-system/connect";(function(){try{var e=typeof window<`u`?window:typeof global<`u`?global:typeof globalThis<`u`?globalThis:typeof self<`u`?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]=`5fa4ab4d-2ea8-5545-8537-8efeb6e1e0b7`)}catch{}})();function D(){let e=b(),t=e?.kind===`browser`?e.reactorModule?.catchUp:void 0,n=e?.kind===`worker`?e.inspector:void 0,[r,i]=w(),a=S(async()=>{if(n){i(await n.getCatchUpStatus());return}t&&i(t.status())},[t,n]),o=S(async()=>{if(n){await n.sweepCatchUp();return}t&&await t.sweepNow()},[t,n]);if(t||n)return{status:r,onRefresh:a,onSweepNow:o}}async function O(e){await new Promise(t=>e.block(()=>t()))}async function k(e){await new Promise((t,n)=>{e.Module.FS.syncfs(!1,e=>e?n(e):t())})}var A=[`documentType`,`documentId`,`scope`,`branch`,`index`,`skip`];function j(t){return new e({dialect:new n({query:async(e,n)=>({rows:await t.queryReactorDb(e,n)})})})}function M(){let e=_(),n=v(),r=b(),s=r?.kind===`browser`?r:void 0,c=s?.reactorModule?.reactor,l=s?.reactorModule?.queue,u=r?.kind===`worker`?r:void 0,d=C(()=>u?j(u.inspector):void 0,[u]),f=e??d,m=S(async()=>{if(!f)return[];let e=await t`
|
|
2
2
|
SELECT
|
|
3
3
|
c.table_name,
|
|
4
4
|
c.column_name,
|
|
@@ -27,4 +27,4 @@ import{a as e,i as t,r as n,t as r}from"./reactor-CItc8KaF-2ruIW1vZ.js";import{S
|
|
|
27
27
|
WHERE nspname NOT IN ('pg_catalog', 'pg_toast', 'information_schema', 'public')
|
|
28
28
|
AND nspname NOT LIKE 'pg_temp_%'
|
|
29
29
|
AND nspname NOT LIKE 'pg_toast_temp_%'`);for(let{nspname:e}of n.rows)await t.exec(`DROP SCHEMA IF EXISTS "${e}" CASCADE`);try{await t.exec(`SET standard_conforming_strings = off;`)}catch{}await t.exec(e),await t.exec(`SET search_path TO ${p}`)}),await k(n),window.location.reload(),await new Promise(()=>{}))},[n,l,c]),x=S(e=>{if(e===`Operation`)return{column:`timestampUtcMs`,direction:`desc`}},[]),w=!!n;return{getTables:m,getTableRows:h,getDefaultSort:x,onExportDb:w?g:void 0,onImportDb:w?y:void 0}}var N=[16,17];function P(){let e=T(s,o,()=>void 0),t=S(async e=>{console.info(`[debug-inspector] Reset requested: PG${e}`);try{localStorage.setItem(c,String(e)),console.info(`[debug-inspector] Clearing reactor storage...`),await r(),console.info(`[debug-inspector] Storage cleared. Reloading...`),window.location.reload()}catch(e){throw console.error(`[debug-inspector] Reset failed:`,e),localStorage.removeItem(c),e}},[]);return{supportedPgVersions:N,currentPgVersion:e??null,onResetToPgVersion:t}}function F(){let e=b(),t=e?.kind===`browser`?e.reactorModule:void 0,n=e?.kind===`worker`?e.inspector:void 0,r=C(()=>{if(t)return new u(t.keyframeStore,t.operationStore,t.writeCache,t.documentView,t.documentModelRegistry)},[t]),i=S(async(e,t)=>{if(n)return await n.validateDocument(e,t);if(!r)throw Error(`Reactor module not available`);return r.validateDocument(e,t)},[r,n]),a=S(async(e,t)=>{if(n)return await n.rebuildKeyframes(e,t);if(!r)throw Error(`Reactor module not available`);return r.rebuildKeyframes(e,t)},[r,n]),o=S(async(e,t)=>{if(n)return await n.rebuildSnapshots(e,t);if(!r)throw Error(`Reactor module not available`);return r.rebuildSnapshots(e,t)},[r,n]);if(r||n)return{onValidate:i,onRebuildKeyframes:a,onRebuildSnapshots:o}}function I(){let e=b(),t=e?.kind===`browser`?e.reactorModule?.processorManager:void 0,n=e?.kind===`worker`?e.inspector:void 0,r=C(()=>t!=null||n!=null,[t,n]),i=S(()=>n?n.getProcessors():t?Promise.resolve(t.getAll().map(e=>({processorId:e.processorId,factoryId:e.factoryId,driveId:e.driveId,processorIndex:e.processorIndex,lastOrdinal:e.lastOrdinal,status:e.status,lastError:e.lastError,lastErrorTimestamp:e.lastErrorTimestamp}))):Promise.resolve([]),[t,n]),a=S(async e=>{if(n){await n.retryProcessor(e);return}if(!t)return;let r=t.get(e);r&&await r.retry()},[t,n]);if(r)return{getProcessors:i,onRetry:a}}function L(){let e=b(),t=e?.kind===`browser`?e:void 0,n=e?.kind===`worker`?e.inspector:void 0,r=t?.reactorModule?.queue,i=C(()=>{if(r instanceof d)return r},[r]),a=S(()=>{if(n)return n.getQueueState();if(!i)return Promise.resolve({isPaused:!1,pendingJobs:[],executingJobs:[],totalPending:0,totalExecuting:0});let e=i.getPendingJobs(),t=i.getExecutingJobIds(),r=[];for(let e of t.values())for(let t of e){let e=i.getJob(t);e&&r.push(e)}return Promise.resolve({isPaused:i.paused,pendingJobs:e,executingJobs:r,totalPending:e.length,totalExecuting:r.length})},[i,n]),o=S(async()=>{if(n){await n.pauseQueue();return}i&&i.pause()},[i,n]),s=S(async()=>{if(n){await n.resumeQueue();return}i&&await i.resume()},[i,n]);if(i||n)return{getQueueState:a,onPause:o,onResume:s}}function R(){let e=x();if(!e)throw Error(`Sync manager not found`);let t=g(),n=S(()=>Promise.resolve(e.list()),[e]),r=S(t=>e.remove(t),[e]),i=S(async e=>{await m(e,void 0,{pollBehavior:f.Manual})},[]),a=S(t=>e.triggerPull(t),[e]);return{getAgreement:S(()=>e.agreement(),[e]),getHolds:S(t=>e.listHolds({remoteName:t}),[e]),getRemotes:n,removeRemote:r,addRemoteManual:i,triggerPull:a,connectionStates:t}}function z(){let e=b(),t=e?.kind===`worker`?e.adminClient:void 0;return C(()=>{if(t)return{getInfo:()=>t.info(),onRestart:()=>t.restart()}},[t])}var B=25,V=()=>{let e=y()?.type===`inspector`,{getTables:t,getTableRows:n,getDefaultSort:r,onExportDb:i,onImportDb:a}=M(),{getRemotes:o,removeRemote:s,addRemoteManual:c,triggerPull:u,connectionStates:d,getAgreement:f,getHolds:m}=R(),g=L(),_=I(),v=F(),b=D(),x=z(),{currentPgVersion:S,supportedPgVersions:C,onResetToPgVersion:w}=P();return l(E,{open:e,onOpenChange:e=>{e||h()},dbExplorerProps:{schema:p,getTables:t,getTableRows:n,getDefaultSort:r,pageSize:B,onExportDb:i,onImportDb:a,pgVersionControl:{currentPgVersion:S,supportedPgVersions:C,onResetToPgVersion:w}},remotesInspectorProps:{getRemotes:o,removeRemote:s,addRemoteManual:c,triggerPull:u,connectionStates:d,getAgreement:f,getHolds:m},queueInspectorProps:g,processorsInspectorProps:_,integrityInspectorProps:v,catchUpInspectorProps:b,workerInspectorProps:x})};export{V as InspectorModal};
|
|
30
|
-
//# sourceMappingURL=InspectorModal-Cd8kbCV8-
|
|
30
|
+
//# sourceMappingURL=InspectorModal-Cd8kbCV8-HwWTmWMU.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InspectorModal-Cd8kbCV8-wCEPH9Q6.js","names":[],"sources":["../../../../../node_modules/.pnpm/@powerhousedao+connect@6.2.3_031a39ff375233beffe5df359486f16d/node_modules/@powerhousedao/connect/dist/InspectorModal-Cd8kbCV8.js"],"sourcesContent":["\n!function(){try{var e=\"undefined\"!=typeof window?window:\"undefined\"!=typeof global?global:\"undefined\"!=typeof globalThis?globalThis:\"undefined\"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]=\"5fa4ab4d-2ea8-5545-8537-8efeb6e1e0b7\")}catch(e){}}();\nimport { a as resolvePgMajorForRuntime, i as loadPgDump } from \"./pglite-major-p4_YefAE.js\";\nimport { c as getCachedReactorPgMajor, d as subscribeReactorPgMajor } from \"./connection-state-Eqc2izmt.js\";\nimport { t as PENDING_PG_SEED_KEY } from \"./pglite-seed-Cl2d-iyl.js\";\nimport { t as clearReactorStorage } from \"./reactor-CItc8KaF.js\";\nimport { jsx } from \"react/jsx-runtime\";\nimport { Kysely, sql } from \"kysely\";\nimport { PGliteDialect } from \"kysely-pglite-dialect\";\nimport { useCallback, useMemo, useState, useSyncExternalStore } from \"react\";\nimport { InspectorModal as InspectorModal$1 } from \"@powerhousedao/design-system/connect\";\nimport { DocumentIntegrityService, InMemoryQueue, PollBehavior, REACTOR_SCHEMA, addRemoteDrive, closePHModal, useConnectionStates, useDatabase, usePGlite, usePHModal, useReactorClientModule, useSync } from \"@powerhousedao/reactor-browser\";\n//#region src/components/modal/modals/InspectorModal/useCatchUpInspector.ts\nfunction useCatchUpInspector() {\n\tconst module = useReactorClientModule();\n\tconst catchUp = module?.kind === \"browser\" ? module.reactorModule?.catchUp : void 0;\n\tconst inspector = module?.kind === \"worker\" ? module.inspector : void 0;\n\tconst [status, setStatus] = useState();\n\tconst onRefresh = useCallback(async () => {\n\t\tif (inspector) {\n\t\t\tsetStatus(await inspector.getCatchUpStatus());\n\t\t\treturn;\n\t\t}\n\t\tif (catchUp) setStatus(catchUp.status());\n\t}, [catchUp, inspector]);\n\tconst onSweepNow = useCallback(async () => {\n\t\tif (inspector) {\n\t\t\tawait inspector.sweepCatchUp();\n\t\t\treturn;\n\t\t}\n\t\tif (catchUp) await catchUp.sweepNow();\n\t}, [catchUp, inspector]);\n\tif (!catchUp && !inspector) return;\n\treturn {\n\t\tstatus,\n\t\tonRefresh,\n\t\tonSweepNow\n\t};\n}\n//#endregion\n//#region src/components/modal/modals/InspectorModal/useDbExplorer.ts\nasync function quiesceQueue(queue) {\n\tawait new Promise((resolve) => queue.block(() => resolve()));\n}\nasync function syncPgliteToIdb(pglite) {\n\tawait new Promise((resolve, reject) => {\n\t\tpglite.Module.FS.syncfs(false, (err) => err ? reject(err) : resolve());\n\t});\n}\nconst PRIORITY_COLUMNS = [\n\t\"documentType\",\n\t\"documentId\",\n\t\"scope\",\n\t\"branch\",\n\t\"index\",\n\t\"skip\"\n];\nfunction createWorkerReactorDatabase(inspector) {\n\treturn new Kysely({ dialect: new PGliteDialect({ query: async (statement, params) => ({ rows: await inspector.queryReactorDb(statement, params) }) }) });\n}\nfunction useDbExplorer() {\n\tconst browserDatabase = useDatabase();\n\tconst pglite = usePGlite();\n\tconst module = useReactorClientModule();\n\tconst reactorClientModule = module?.kind === \"browser\" ? module : void 0;\n\tconst reactor = reactorClientModule?.reactorModule?.reactor;\n\tconst queue = reactorClientModule?.reactorModule?.queue;\n\tconst workerModule = module?.kind === \"worker\" ? module : void 0;\n\tconst workerDatabase = useMemo(() => workerModule ? createWorkerReactorDatabase(workerModule.inspector) : void 0, [workerModule]);\n\tconst database = browserDatabase ?? workerDatabase;\n\tconst getTables = useCallback(async () => {\n\t\tif (!database) return [];\n\t\tconst result = await sql`\n SELECT\n c.table_name,\n c.column_name,\n c.data_type,\n c.is_nullable\n FROM information_schema.columns c\n INNER JOIN information_schema.tables t\n ON c.table_name = t.table_name\n AND c.table_schema = t.table_schema\n WHERE c.table_schema = ${REACTOR_SCHEMA}\n AND t.table_type = 'BASE TABLE'\n ORDER BY c.table_name, c.ordinal_position\n `.execute(database);\n\t\tconst tableMap = /* @__PURE__ */ new Map();\n\t\tfor (const row of result.rows) {\n\t\t\tif (!tableMap.has(row.table_name)) tableMap.set(row.table_name, []);\n\t\t\ttableMap.get(row.table_name).push({\n\t\t\t\tname: row.column_name,\n\t\t\t\tdataType: row.data_type,\n\t\t\t\tisNullable: row.is_nullable === \"YES\"\n\t\t\t});\n\t\t}\n\t\treturn Array.from(tableMap).map(([name, columns]) => {\n\t\t\tconst columnNames = columns.map((col) => col.name);\n\t\t\treturn {\n\t\t\t\tname,\n\t\t\t\tcolumns: [...PRIORITY_COLUMNS.filter((col) => columnNames.includes(col)).map((col) => columns.find((c) => c.name === col)), ...columns.filter((col) => !PRIORITY_COLUMNS.includes(col.name))]\n\t\t\t};\n\t\t});\n\t}, [database]);\n\tconst getTableRows = useCallback(async (table, options) => {\n\t\tif (!database) return {\n\t\t\tcolumns: [],\n\t\t\trows: [],\n\t\t\ttotal: null\n\t\t};\n\t\tconst limit = options.limit;\n\t\tconst offset = options.offset;\n\t\tconst sort = options.sort;\n\t\tconst filters = options.filters;\n\t\tconst tableRef = sql.raw(`${REACTOR_SCHEMA}.\"${table}\"`);\n\t\tlet whereClause = sql``;\n\t\tif (filters?.clauses && filters.clauses.length > 0) {\n\t\t\tconst conditions = [];\n\t\t\tfor (let i = 0; i < filters.clauses.length; i++) {\n\t\t\t\tconst clause = filters.clauses[i];\n\t\t\t\tif (!clause) continue;\n\t\t\t\tconst columnRef = sql.raw(`\"${clause.column}\"`);\n\t\t\t\tlet condition;\n\t\t\t\tif (clause.operator === \"IS NULL\") condition = sql`${columnRef} IS NULL`;\n\t\t\t\telse if (clause.operator === \"IS NOT NULL\") condition = sql`${columnRef} IS NOT NULL`;\n\t\t\t\telse if (clause.operator === \"LIKE\" || clause.operator === \"ILIKE\") {\n\t\t\t\t\tconst value = clause.value;\n\t\t\t\t\tconst operator = clause.operator === \"LIKE\" ? sql`LIKE` : sql`ILIKE`;\n\t\t\t\t\tcondition = sql`${columnRef} ${operator} ${value}`;\n\t\t\t\t} else {\n\t\t\t\t\tconst operator = sql.raw(clause.operator);\n\t\t\t\t\tconst value = clause.value;\n\t\t\t\t\tlet parsedValue = value;\n\t\t\t\t\tif (value !== \"\" && !isNaN(Number(value)) && value.trim() !== \"\") parsedValue = Number(value);\n\t\t\t\t\tcondition = sql`${columnRef} ${operator} ${parsedValue}`;\n\t\t\t\t}\n\t\t\t\tconditions.push(condition);\n\t\t\t\tif (i < filters.clauses.length - 1) {\n\t\t\t\t\tconst connector = filters.connectors?.[i] ?? \"AND\";\n\t\t\t\t\tconditions.push(sql.raw(connector));\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (conditions.length > 0) whereClause = sql`WHERE ${sql.join(conditions, sql` `)}`;\n\t\t}\n\t\tlet query;\n\t\tif (sort) {\n\t\t\tconst columnRef = sql.raw(`\"${sort.column}\"`);\n\t\t\tconst direction = sort.direction === \"desc\" ? sql`DESC` : sql`ASC`;\n\t\t\tquery = sql`\n SELECT * FROM ${tableRef}\n ${whereClause}\n ORDER BY ${columnRef} ${direction}\n LIMIT ${limit} OFFSET ${offset}\n `;\n\t\t} else query = sql`\n SELECT * FROM ${tableRef}\n ${whereClause}\n LIMIT ${limit} OFFSET ${offset}\n `;\n\t\tconst result = await query.execute(database);\n\t\tconst countResult = await sql`\n SELECT COUNT(*) as count FROM ${tableRef}\n ${whereClause}\n `.execute(database);\n\t\tconst total = countResult.rows[0] ? parseInt(countResult.rows[0].count, 10) : null;\n\t\tconst rawColumns = result.rows.length > 0 ? Object.keys(result.rows[0]) : [];\n\t\treturn {\n\t\t\tcolumns: [...PRIORITY_COLUMNS.filter((col) => rawColumns.includes(col)), ...rawColumns.filter((col) => !PRIORITY_COLUMNS.includes(col))],\n\t\t\trows: result.rows,\n\t\t\ttotal\n\t\t};\n\t}, [database]);\n\tconst onExportDb = useCallback(async () => {\n\t\tif (!pglite) return;\n\t\tif (queue) await quiesceQueue(queue);\n\t\ttry {\n\t\t\tconst major = resolvePgMajorForRuntime(getCachedReactorPgMajor() ?? null);\n\t\t\tconst sqlContent = await (await (await loadPgDump(major))({ pg: pglite })).text();\n\t\t\tconst blob = new Blob([sqlContent], { type: \"text/sql\" });\n\t\t\tconst url = URL.createObjectURL(blob);\n\t\t\tconst a = document.createElement(\"a\");\n\t\t\ta.href = url;\n\t\t\ta.download = `database-export-${Date.now()}.sql`;\n\t\t\ta.click();\n\t\t\tURL.revokeObjectURL(url);\n\t\t} finally {\n\t\t\tqueue?.unblock();\n\t\t}\n\t}, [pglite, queue]);\n\tconst onImportDb = useCallback(async (sqlContent) => {\n\t\tif (!pglite) return;\n\t\tif (queue) await quiesceQueue(queue);\n\t\tif (reactor) await reactor.kill().completed;\n\t\tawait pglite.transaction(async (tx) => {\n\t\t\tconst schemas = await tx.query(`SELECT nspname FROM pg_namespace\n WHERE nspname NOT IN ('pg_catalog', 'pg_toast', 'information_schema', 'public')\n AND nspname NOT LIKE 'pg_temp_%'\n AND nspname NOT LIKE 'pg_toast_temp_%'`);\n\t\t\tfor (const { nspname } of schemas.rows) await tx.exec(`DROP SCHEMA IF EXISTS \"${nspname}\" CASCADE`);\n\t\t\ttry {\n\t\t\t\tawait tx.exec(\"SET standard_conforming_strings = off;\");\n\t\t\t} catch {}\n\t\t\tawait tx.exec(sqlContent);\n\t\t\tawait tx.exec(`SET search_path TO ${REACTOR_SCHEMA}`);\n\t\t});\n\t\tawait syncPgliteToIdb(pglite);\n\t\twindow.location.reload();\n\t\tawait new Promise(() => {});\n\t}, [\n\t\tpglite,\n\t\tqueue,\n\t\treactor\n\t]);\n\tconst getDefaultSort = useCallback((table) => {\n\t\tif (table === \"Operation\") return {\n\t\t\tcolumn: \"timestampUtcMs\",\n\t\t\tdirection: \"desc\"\n\t\t};\n\t}, []);\n\tconst canModifyDb = !!pglite;\n\treturn {\n\t\tgetTables,\n\t\tgetTableRows,\n\t\tgetDefaultSort,\n\t\tonExportDb: canModifyDb ? onExportDb : void 0,\n\t\tonImportDb: canModifyDb ? onImportDb : void 0\n\t};\n}\n//#endregion\n//#region src/components/modal/modals/InspectorModal/useDebugInspector.ts\nconst SUPPORTED_PG_VERSIONS = [16, 17];\nfunction useDebugInspector() {\n\tconst currentPgVersion = useSyncExternalStore(subscribeReactorPgMajor, getCachedReactorPgMajor, () => void 0);\n\tconst onResetToPgVersion = useCallback(async (major) => {\n\t\tconsole.info(`[debug-inspector] Reset requested: PG${major}`);\n\t\ttry {\n\t\t\tlocalStorage.setItem(PENDING_PG_SEED_KEY, String(major));\n\t\t\tconsole.info(`[debug-inspector] Clearing reactor storage...`);\n\t\t\tawait clearReactorStorage();\n\t\t\tconsole.info(`[debug-inspector] Storage cleared. Reloading...`);\n\t\t\twindow.location.reload();\n\t\t} catch (err) {\n\t\t\tconsole.error(\"[debug-inspector] Reset failed:\", err);\n\t\t\tlocalStorage.removeItem(PENDING_PG_SEED_KEY);\n\t\t\tthrow err;\n\t\t}\n\t}, []);\n\treturn {\n\t\tsupportedPgVersions: SUPPORTED_PG_VERSIONS,\n\t\tcurrentPgVersion: currentPgVersion ?? null,\n\t\tonResetToPgVersion\n\t};\n}\n//#endregion\n//#region src/components/modal/modals/InspectorModal/useIntegrityInspector.ts\nfunction useIntegrityInspector() {\n\tconst module = useReactorClientModule();\n\tconst reactorModule = module?.kind === \"browser\" ? module.reactorModule : void 0;\n\tconst inspector = module?.kind === \"worker\" ? module.inspector : void 0;\n\tconst service = useMemo(() => {\n\t\tif (!reactorModule) return void 0;\n\t\treturn new DocumentIntegrityService(reactorModule.keyframeStore, reactorModule.operationStore, reactorModule.writeCache, reactorModule.documentView, reactorModule.documentModelRegistry);\n\t}, [reactorModule]);\n\tconst onValidate = useCallback(async (documentId, branch) => {\n\t\tif (inspector) return await inspector.validateDocument(documentId, branch);\n\t\tif (!service) throw new Error(\"Reactor module not available\");\n\t\treturn service.validateDocument(documentId, branch);\n\t}, [service, inspector]);\n\tconst onRebuildKeyframes = useCallback(async (documentId, branch) => {\n\t\tif (inspector) return await inspector.rebuildKeyframes(documentId, branch);\n\t\tif (!service) throw new Error(\"Reactor module not available\");\n\t\treturn service.rebuildKeyframes(documentId, branch);\n\t}, [service, inspector]);\n\tconst onRebuildSnapshots = useCallback(async (documentId, branch) => {\n\t\tif (inspector) return await inspector.rebuildSnapshots(documentId, branch);\n\t\tif (!service) throw new Error(\"Reactor module not available\");\n\t\treturn service.rebuildSnapshots(documentId, branch);\n\t}, [service, inspector]);\n\tif (!service && !inspector) return;\n\treturn {\n\t\tonValidate,\n\t\tonRebuildKeyframes,\n\t\tonRebuildSnapshots\n\t};\n}\n//#endregion\n//#region src/components/modal/modals/InspectorModal/useProcessorsInspector.ts\nfunction useProcessorsInspector() {\n\tconst module = useReactorClientModule();\n\tconst processorManager = module?.kind === \"browser\" ? module.reactorModule?.processorManager : void 0;\n\tconst inspector = module?.kind === \"worker\" ? module.inspector : void 0;\n\tconst available = useMemo(() => processorManager != null || inspector != null, [processorManager, inspector]);\n\tconst getProcessors = useCallback(() => {\n\t\tif (inspector) return inspector.getProcessors();\n\t\tif (!processorManager) return Promise.resolve([]);\n\t\treturn Promise.resolve(processorManager.getAll().map((tracked) => ({\n\t\t\tprocessorId: tracked.processorId,\n\t\t\tfactoryId: tracked.factoryId,\n\t\t\tdriveId: tracked.driveId,\n\t\t\tprocessorIndex: tracked.processorIndex,\n\t\t\tlastOrdinal: tracked.lastOrdinal,\n\t\t\tstatus: tracked.status,\n\t\t\tlastError: tracked.lastError,\n\t\t\tlastErrorTimestamp: tracked.lastErrorTimestamp\n\t\t})));\n\t}, [processorManager, inspector]);\n\tconst onRetry = useCallback(async (processorId) => {\n\t\tif (inspector) {\n\t\t\tawait inspector.retryProcessor(processorId);\n\t\t\treturn;\n\t\t}\n\t\tif (!processorManager) return;\n\t\tconst tracked = processorManager.get(processorId);\n\t\tif (tracked) await tracked.retry();\n\t}, [processorManager, inspector]);\n\tif (!available) return;\n\treturn {\n\t\tgetProcessors,\n\t\tonRetry\n\t};\n}\n//#endregion\n//#region src/components/modal/modals/InspectorModal/useQueueInspector.ts\nfunction useQueueInspector() {\n\tconst module = useReactorClientModule();\n\tconst reactorClientModule = module?.kind === \"browser\" ? module : void 0;\n\tconst inspector = module?.kind === \"worker\" ? module.inspector : void 0;\n\tconst queue = reactorClientModule?.reactorModule?.queue;\n\tconst inMemoryQueue = useMemo(() => {\n\t\tif (queue instanceof InMemoryQueue) return queue;\n\t}, [queue]);\n\tconst getQueueState = useCallback(() => {\n\t\tif (inspector) return inspector.getQueueState();\n\t\tif (!inMemoryQueue) return Promise.resolve({\n\t\t\tisPaused: false,\n\t\t\tpendingJobs: [],\n\t\t\texecutingJobs: [],\n\t\t\ttotalPending: 0,\n\t\t\ttotalExecuting: 0\n\t\t});\n\t\tconst pendingJobs = inMemoryQueue.getPendingJobs();\n\t\tconst executingJobIds = inMemoryQueue.getExecutingJobIds();\n\t\tconst executingJobs = [];\n\t\tfor (const jobIdSet of executingJobIds.values()) for (const jobId of jobIdSet) {\n\t\t\tconst job = inMemoryQueue.getJob(jobId);\n\t\t\tif (job) executingJobs.push(job);\n\t\t}\n\t\treturn Promise.resolve({\n\t\t\tisPaused: inMemoryQueue.paused,\n\t\t\tpendingJobs,\n\t\t\texecutingJobs,\n\t\t\ttotalPending: pendingJobs.length,\n\t\t\ttotalExecuting: executingJobs.length\n\t\t});\n\t}, [inMemoryQueue, inspector]);\n\tconst onPause = useCallback(async () => {\n\t\tif (inspector) {\n\t\t\tawait inspector.pauseQueue();\n\t\t\treturn;\n\t\t}\n\t\tif (inMemoryQueue) inMemoryQueue.pause();\n\t}, [inMemoryQueue, inspector]);\n\tconst onResume = useCallback(async () => {\n\t\tif (inspector) {\n\t\t\tawait inspector.resumeQueue();\n\t\t\treturn;\n\t\t}\n\t\tif (inMemoryQueue) await inMemoryQueue.resume();\n\t}, [inMemoryQueue, inspector]);\n\tif (!inMemoryQueue && !inspector) return;\n\treturn {\n\t\tgetQueueState,\n\t\tonPause,\n\t\tonResume\n\t};\n}\n//#endregion\n//#region src/components/modal/modals/InspectorModal/useRemotesInspector.ts\nfunction useRemotesInspector() {\n\tconst syncManager = useSync();\n\tif (!syncManager) throw new Error(\"Sync manager not found\");\n\tconst connectionStates = useConnectionStates();\n\tconst getRemotes = useCallback(() => {\n\t\treturn Promise.resolve(syncManager.list());\n\t}, [syncManager]);\n\tconst removeRemote = useCallback((name) => syncManager.remove(name), [syncManager]);\n\tconst addRemoteManual = useCallback(async (url) => {\n\t\tawait addRemoteDrive(url, void 0, { pollBehavior: PollBehavior.Manual });\n\t}, []);\n\tconst triggerPull = useCallback((name) => syncManager.triggerPull(name), [syncManager]);\n\treturn {\n\t\tgetAgreement: useCallback(() => syncManager.agreement(), [syncManager]),\n\t\tgetHolds: useCallback((remoteName) => syncManager.listHolds({ remoteName }), [syncManager]),\n\t\tgetRemotes,\n\t\tremoveRemote,\n\t\taddRemoteManual,\n\t\ttriggerPull,\n\t\tconnectionStates\n\t};\n}\n//#endregion\n//#region src/components/modal/modals/InspectorModal/useWorkerInspector.ts\nfunction useWorkerInspector() {\n\tconst module = useReactorClientModule();\n\tconst adminClient = module?.kind === \"worker\" ? module.adminClient : void 0;\n\treturn useMemo(() => {\n\t\tif (!adminClient) return;\n\t\treturn {\n\t\t\tgetInfo: () => adminClient.info(),\n\t\t\tonRestart: () => adminClient.restart()\n\t\t};\n\t}, [adminClient]);\n}\n//#endregion\n//#region src/components/modal/modals/InspectorModal/InspectorModal.tsx\nconst DEFAULT_PAGE_SIZE = 25;\nconst InspectorModal = () => {\n\tconst open = usePHModal()?.type === \"inspector\";\n\tconst { getTables, getTableRows, getDefaultSort, onExportDb, onImportDb } = useDbExplorer();\n\tconst { getRemotes, removeRemote, addRemoteManual, triggerPull, connectionStates, getAgreement, getHolds } = useRemotesInspector();\n\tconst queueInspectorProps = useQueueInspector();\n\tconst processorsInspectorProps = useProcessorsInspector();\n\tconst integrityInspectorProps = useIntegrityInspector();\n\tconst catchUpInspectorProps = useCatchUpInspector();\n\tconst workerInspectorProps = useWorkerInspector();\n\tconst { currentPgVersion, supportedPgVersions, onResetToPgVersion } = useDebugInspector();\n\treturn /* @__PURE__ */ jsx(InspectorModal$1, {\n\t\topen,\n\t\tonOpenChange: (status) => {\n\t\t\tif (!status) closePHModal();\n\t\t},\n\t\tdbExplorerProps: {\n\t\t\tschema: REACTOR_SCHEMA,\n\t\t\tgetTables,\n\t\t\tgetTableRows,\n\t\t\tgetDefaultSort,\n\t\t\tpageSize: DEFAULT_PAGE_SIZE,\n\t\t\tonExportDb,\n\t\t\tonImportDb,\n\t\t\tpgVersionControl: {\n\t\t\t\tcurrentPgVersion,\n\t\t\t\tsupportedPgVersions,\n\t\t\t\tonResetToPgVersion\n\t\t\t}\n\t\t},\n\t\tremotesInspectorProps: {\n\t\t\tgetRemotes,\n\t\t\tremoveRemote,\n\t\t\taddRemoteManual,\n\t\t\ttriggerPull,\n\t\t\tconnectionStates,\n\t\t\tgetAgreement,\n\t\t\tgetHolds\n\t\t},\n\t\tqueueInspectorProps,\n\t\tprocessorsInspectorProps,\n\t\tintegrityInspectorProps,\n\t\tcatchUpInspectorProps,\n\t\tworkerInspectorProps\n\t});\n};\n//#endregion\nexport { InspectorModal };\n\n//# sourceMappingURL=InspectorModal-Cd8kbCV8.js.map\n//# debugId=5fa4ab4d-2ea8-5545-8537-8efeb6e1e0b7\n"],"x_google_ignoreList":[0],"mappings":"mrBACC,UAAU,CAAC,GAAG,CAAC,IAAI,EAAe,OAAO,OAApB,IAA2B,OAAoB,OAAO,OAApB,IAA2B,OAAoB,OAAO,WAApB,IAA+B,WAAwB,OAAO,KAApB,IAAyB,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c,IAAK,GAC1E,OAAO,MAAc,CACf,KACL,MAAO,CACN,YAAe,EAAY,KAAK,EAChC,cAAiB,EAAY,QAAQ,CACtC,CACD,EAAG,CAAC,CAAW,CAAC,CACjB,CAGA,IAAM,EAAoB,GACpB,MAAuB,CAC5B,IAAM,EAAO,EAAW,CAAC,EAAE,OAAS,YAC9B,CAAE,YAAW,eAAc,iBAAgB,aAAY,cAAe,EAAc,EACpF,CAAE,aAAY,eAAc,kBAAiB,cAAa,mBAAkB,eAAc,YAAa,EAAoB,EAC3H,EAAsB,EAAkB,EACxC,EAA2B,EAAuB,EAClD,EAA0B,EAAsB,EAChD,EAAwB,EAAoB,EAC5C,EAAuB,EAAmB,EAC1C,CAAE,mBAAkB,sBAAqB,sBAAuB,EAAkB,EACxF,OAAuB,EAAI,EAAkB,CAC5C,OACA,aAAe,GAAW,CACpB,GAAQ,EAAa,CAC3B,EACA,gBAAiB,CAChB,OAAQ,EACR,YACA,eACA,iBACA,SAAU,EACV,aACA,aACA,iBAAkB,CACjB,mBACA,sBACA,oBACD,CACD,EACA,sBAAuB,CACtB,aACA,eACA,kBACA,cACA,mBACA,eACA,UACD,EACA,sBACA,2BACA,0BACA,wBACA,sBACD,CAAC,CACF"}
|
|
1
|
+
{"version":3,"file":"InspectorModal-Cd8kbCV8-HwWTmWMU.js","names":[],"sources":["../../../../../node_modules/.pnpm/@powerhousedao+connect@6.2.3_031a39ff375233beffe5df359486f16d/node_modules/@powerhousedao/connect/dist/InspectorModal-Cd8kbCV8.js"],"sourcesContent":["\n!function(){try{var e=\"undefined\"!=typeof window?window:\"undefined\"!=typeof global?global:\"undefined\"!=typeof globalThis?globalThis:\"undefined\"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]=\"5fa4ab4d-2ea8-5545-8537-8efeb6e1e0b7\")}catch(e){}}();\nimport { a as resolvePgMajorForRuntime, i as loadPgDump } from \"./pglite-major-p4_YefAE.js\";\nimport { c as getCachedReactorPgMajor, d as subscribeReactorPgMajor } from \"./connection-state-Eqc2izmt.js\";\nimport { t as PENDING_PG_SEED_KEY } from \"./pglite-seed-Cl2d-iyl.js\";\nimport { t as clearReactorStorage } from \"./reactor-CItc8KaF.js\";\nimport { jsx } from \"react/jsx-runtime\";\nimport { Kysely, sql } from \"kysely\";\nimport { PGliteDialect } from \"kysely-pglite-dialect\";\nimport { useCallback, useMemo, useState, useSyncExternalStore } from \"react\";\nimport { InspectorModal as InspectorModal$1 } from \"@powerhousedao/design-system/connect\";\nimport { DocumentIntegrityService, InMemoryQueue, PollBehavior, REACTOR_SCHEMA, addRemoteDrive, closePHModal, useConnectionStates, useDatabase, usePGlite, usePHModal, useReactorClientModule, useSync } from \"@powerhousedao/reactor-browser\";\n//#region src/components/modal/modals/InspectorModal/useCatchUpInspector.ts\nfunction useCatchUpInspector() {\n\tconst module = useReactorClientModule();\n\tconst catchUp = module?.kind === \"browser\" ? module.reactorModule?.catchUp : void 0;\n\tconst inspector = module?.kind === \"worker\" ? module.inspector : void 0;\n\tconst [status, setStatus] = useState();\n\tconst onRefresh = useCallback(async () => {\n\t\tif (inspector) {\n\t\t\tsetStatus(await inspector.getCatchUpStatus());\n\t\t\treturn;\n\t\t}\n\t\tif (catchUp) setStatus(catchUp.status());\n\t}, [catchUp, inspector]);\n\tconst onSweepNow = useCallback(async () => {\n\t\tif (inspector) {\n\t\t\tawait inspector.sweepCatchUp();\n\t\t\treturn;\n\t\t}\n\t\tif (catchUp) await catchUp.sweepNow();\n\t}, [catchUp, inspector]);\n\tif (!catchUp && !inspector) return;\n\treturn {\n\t\tstatus,\n\t\tonRefresh,\n\t\tonSweepNow\n\t};\n}\n//#endregion\n//#region src/components/modal/modals/InspectorModal/useDbExplorer.ts\nasync function quiesceQueue(queue) {\n\tawait new Promise((resolve) => queue.block(() => resolve()));\n}\nasync function syncPgliteToIdb(pglite) {\n\tawait new Promise((resolve, reject) => {\n\t\tpglite.Module.FS.syncfs(false, (err) => err ? reject(err) : resolve());\n\t});\n}\nconst PRIORITY_COLUMNS = [\n\t\"documentType\",\n\t\"documentId\",\n\t\"scope\",\n\t\"branch\",\n\t\"index\",\n\t\"skip\"\n];\nfunction createWorkerReactorDatabase(inspector) {\n\treturn new Kysely({ dialect: new PGliteDialect({ query: async (statement, params) => ({ rows: await inspector.queryReactorDb(statement, params) }) }) });\n}\nfunction useDbExplorer() {\n\tconst browserDatabase = useDatabase();\n\tconst pglite = usePGlite();\n\tconst module = useReactorClientModule();\n\tconst reactorClientModule = module?.kind === \"browser\" ? module : void 0;\n\tconst reactor = reactorClientModule?.reactorModule?.reactor;\n\tconst queue = reactorClientModule?.reactorModule?.queue;\n\tconst workerModule = module?.kind === \"worker\" ? module : void 0;\n\tconst workerDatabase = useMemo(() => workerModule ? createWorkerReactorDatabase(workerModule.inspector) : void 0, [workerModule]);\n\tconst database = browserDatabase ?? workerDatabase;\n\tconst getTables = useCallback(async () => {\n\t\tif (!database) return [];\n\t\tconst result = await sql`\n SELECT\n c.table_name,\n c.column_name,\n c.data_type,\n c.is_nullable\n FROM information_schema.columns c\n INNER JOIN information_schema.tables t\n ON c.table_name = t.table_name\n AND c.table_schema = t.table_schema\n WHERE c.table_schema = ${REACTOR_SCHEMA}\n AND t.table_type = 'BASE TABLE'\n ORDER BY c.table_name, c.ordinal_position\n `.execute(database);\n\t\tconst tableMap = /* @__PURE__ */ new Map();\n\t\tfor (const row of result.rows) {\n\t\t\tif (!tableMap.has(row.table_name)) tableMap.set(row.table_name, []);\n\t\t\ttableMap.get(row.table_name).push({\n\t\t\t\tname: row.column_name,\n\t\t\t\tdataType: row.data_type,\n\t\t\t\tisNullable: row.is_nullable === \"YES\"\n\t\t\t});\n\t\t}\n\t\treturn Array.from(tableMap).map(([name, columns]) => {\n\t\t\tconst columnNames = columns.map((col) => col.name);\n\t\t\treturn {\n\t\t\t\tname,\n\t\t\t\tcolumns: [...PRIORITY_COLUMNS.filter((col) => columnNames.includes(col)).map((col) => columns.find((c) => c.name === col)), ...columns.filter((col) => !PRIORITY_COLUMNS.includes(col.name))]\n\t\t\t};\n\t\t});\n\t}, [database]);\n\tconst getTableRows = useCallback(async (table, options) => {\n\t\tif (!database) return {\n\t\t\tcolumns: [],\n\t\t\trows: [],\n\t\t\ttotal: null\n\t\t};\n\t\tconst limit = options.limit;\n\t\tconst offset = options.offset;\n\t\tconst sort = options.sort;\n\t\tconst filters = options.filters;\n\t\tconst tableRef = sql.raw(`${REACTOR_SCHEMA}.\"${table}\"`);\n\t\tlet whereClause = sql``;\n\t\tif (filters?.clauses && filters.clauses.length > 0) {\n\t\t\tconst conditions = [];\n\t\t\tfor (let i = 0; i < filters.clauses.length; i++) {\n\t\t\t\tconst clause = filters.clauses[i];\n\t\t\t\tif (!clause) continue;\n\t\t\t\tconst columnRef = sql.raw(`\"${clause.column}\"`);\n\t\t\t\tlet condition;\n\t\t\t\tif (clause.operator === \"IS NULL\") condition = sql`${columnRef} IS NULL`;\n\t\t\t\telse if (clause.operator === \"IS NOT NULL\") condition = sql`${columnRef} IS NOT NULL`;\n\t\t\t\telse if (clause.operator === \"LIKE\" || clause.operator === \"ILIKE\") {\n\t\t\t\t\tconst value = clause.value;\n\t\t\t\t\tconst operator = clause.operator === \"LIKE\" ? sql`LIKE` : sql`ILIKE`;\n\t\t\t\t\tcondition = sql`${columnRef} ${operator} ${value}`;\n\t\t\t\t} else {\n\t\t\t\t\tconst operator = sql.raw(clause.operator);\n\t\t\t\t\tconst value = clause.value;\n\t\t\t\t\tlet parsedValue = value;\n\t\t\t\t\tif (value !== \"\" && !isNaN(Number(value)) && value.trim() !== \"\") parsedValue = Number(value);\n\t\t\t\t\tcondition = sql`${columnRef} ${operator} ${parsedValue}`;\n\t\t\t\t}\n\t\t\t\tconditions.push(condition);\n\t\t\t\tif (i < filters.clauses.length - 1) {\n\t\t\t\t\tconst connector = filters.connectors?.[i] ?? \"AND\";\n\t\t\t\t\tconditions.push(sql.raw(connector));\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (conditions.length > 0) whereClause = sql`WHERE ${sql.join(conditions, sql` `)}`;\n\t\t}\n\t\tlet query;\n\t\tif (sort) {\n\t\t\tconst columnRef = sql.raw(`\"${sort.column}\"`);\n\t\t\tconst direction = sort.direction === \"desc\" ? sql`DESC` : sql`ASC`;\n\t\t\tquery = sql`\n SELECT * FROM ${tableRef}\n ${whereClause}\n ORDER BY ${columnRef} ${direction}\n LIMIT ${limit} OFFSET ${offset}\n `;\n\t\t} else query = sql`\n SELECT * FROM ${tableRef}\n ${whereClause}\n LIMIT ${limit} OFFSET ${offset}\n `;\n\t\tconst result = await query.execute(database);\n\t\tconst countResult = await sql`\n SELECT COUNT(*) as count FROM ${tableRef}\n ${whereClause}\n `.execute(database);\n\t\tconst total = countResult.rows[0] ? parseInt(countResult.rows[0].count, 10) : null;\n\t\tconst rawColumns = result.rows.length > 0 ? Object.keys(result.rows[0]) : [];\n\t\treturn {\n\t\t\tcolumns: [...PRIORITY_COLUMNS.filter((col) => rawColumns.includes(col)), ...rawColumns.filter((col) => !PRIORITY_COLUMNS.includes(col))],\n\t\t\trows: result.rows,\n\t\t\ttotal\n\t\t};\n\t}, [database]);\n\tconst onExportDb = useCallback(async () => {\n\t\tif (!pglite) return;\n\t\tif (queue) await quiesceQueue(queue);\n\t\ttry {\n\t\t\tconst major = resolvePgMajorForRuntime(getCachedReactorPgMajor() ?? null);\n\t\t\tconst sqlContent = await (await (await loadPgDump(major))({ pg: pglite })).text();\n\t\t\tconst blob = new Blob([sqlContent], { type: \"text/sql\" });\n\t\t\tconst url = URL.createObjectURL(blob);\n\t\t\tconst a = document.createElement(\"a\");\n\t\t\ta.href = url;\n\t\t\ta.download = `database-export-${Date.now()}.sql`;\n\t\t\ta.click();\n\t\t\tURL.revokeObjectURL(url);\n\t\t} finally {\n\t\t\tqueue?.unblock();\n\t\t}\n\t}, [pglite, queue]);\n\tconst onImportDb = useCallback(async (sqlContent) => {\n\t\tif (!pglite) return;\n\t\tif (queue) await quiesceQueue(queue);\n\t\tif (reactor) await reactor.kill().completed;\n\t\tawait pglite.transaction(async (tx) => {\n\t\t\tconst schemas = await tx.query(`SELECT nspname FROM pg_namespace\n WHERE nspname NOT IN ('pg_catalog', 'pg_toast', 'information_schema', 'public')\n AND nspname NOT LIKE 'pg_temp_%'\n AND nspname NOT LIKE 'pg_toast_temp_%'`);\n\t\t\tfor (const { nspname } of schemas.rows) await tx.exec(`DROP SCHEMA IF EXISTS \"${nspname}\" CASCADE`);\n\t\t\ttry {\n\t\t\t\tawait tx.exec(\"SET standard_conforming_strings = off;\");\n\t\t\t} catch {}\n\t\t\tawait tx.exec(sqlContent);\n\t\t\tawait tx.exec(`SET search_path TO ${REACTOR_SCHEMA}`);\n\t\t});\n\t\tawait syncPgliteToIdb(pglite);\n\t\twindow.location.reload();\n\t\tawait new Promise(() => {});\n\t}, [\n\t\tpglite,\n\t\tqueue,\n\t\treactor\n\t]);\n\tconst getDefaultSort = useCallback((table) => {\n\t\tif (table === \"Operation\") return {\n\t\t\tcolumn: \"timestampUtcMs\",\n\t\t\tdirection: \"desc\"\n\t\t};\n\t}, []);\n\tconst canModifyDb = !!pglite;\n\treturn {\n\t\tgetTables,\n\t\tgetTableRows,\n\t\tgetDefaultSort,\n\t\tonExportDb: canModifyDb ? onExportDb : void 0,\n\t\tonImportDb: canModifyDb ? onImportDb : void 0\n\t};\n}\n//#endregion\n//#region src/components/modal/modals/InspectorModal/useDebugInspector.ts\nconst SUPPORTED_PG_VERSIONS = [16, 17];\nfunction useDebugInspector() {\n\tconst currentPgVersion = useSyncExternalStore(subscribeReactorPgMajor, getCachedReactorPgMajor, () => void 0);\n\tconst onResetToPgVersion = useCallback(async (major) => {\n\t\tconsole.info(`[debug-inspector] Reset requested: PG${major}`);\n\t\ttry {\n\t\t\tlocalStorage.setItem(PENDING_PG_SEED_KEY, String(major));\n\t\t\tconsole.info(`[debug-inspector] Clearing reactor storage...`);\n\t\t\tawait clearReactorStorage();\n\t\t\tconsole.info(`[debug-inspector] Storage cleared. Reloading...`);\n\t\t\twindow.location.reload();\n\t\t} catch (err) {\n\t\t\tconsole.error(\"[debug-inspector] Reset failed:\", err);\n\t\t\tlocalStorage.removeItem(PENDING_PG_SEED_KEY);\n\t\t\tthrow err;\n\t\t}\n\t}, []);\n\treturn {\n\t\tsupportedPgVersions: SUPPORTED_PG_VERSIONS,\n\t\tcurrentPgVersion: currentPgVersion ?? null,\n\t\tonResetToPgVersion\n\t};\n}\n//#endregion\n//#region src/components/modal/modals/InspectorModal/useIntegrityInspector.ts\nfunction useIntegrityInspector() {\n\tconst module = useReactorClientModule();\n\tconst reactorModule = module?.kind === \"browser\" ? module.reactorModule : void 0;\n\tconst inspector = module?.kind === \"worker\" ? module.inspector : void 0;\n\tconst service = useMemo(() => {\n\t\tif (!reactorModule) return void 0;\n\t\treturn new DocumentIntegrityService(reactorModule.keyframeStore, reactorModule.operationStore, reactorModule.writeCache, reactorModule.documentView, reactorModule.documentModelRegistry);\n\t}, [reactorModule]);\n\tconst onValidate = useCallback(async (documentId, branch) => {\n\t\tif (inspector) return await inspector.validateDocument(documentId, branch);\n\t\tif (!service) throw new Error(\"Reactor module not available\");\n\t\treturn service.validateDocument(documentId, branch);\n\t}, [service, inspector]);\n\tconst onRebuildKeyframes = useCallback(async (documentId, branch) => {\n\t\tif (inspector) return await inspector.rebuildKeyframes(documentId, branch);\n\t\tif (!service) throw new Error(\"Reactor module not available\");\n\t\treturn service.rebuildKeyframes(documentId, branch);\n\t}, [service, inspector]);\n\tconst onRebuildSnapshots = useCallback(async (documentId, branch) => {\n\t\tif (inspector) return await inspector.rebuildSnapshots(documentId, branch);\n\t\tif (!service) throw new Error(\"Reactor module not available\");\n\t\treturn service.rebuildSnapshots(documentId, branch);\n\t}, [service, inspector]);\n\tif (!service && !inspector) return;\n\treturn {\n\t\tonValidate,\n\t\tonRebuildKeyframes,\n\t\tonRebuildSnapshots\n\t};\n}\n//#endregion\n//#region src/components/modal/modals/InspectorModal/useProcessorsInspector.ts\nfunction useProcessorsInspector() {\n\tconst module = useReactorClientModule();\n\tconst processorManager = module?.kind === \"browser\" ? module.reactorModule?.processorManager : void 0;\n\tconst inspector = module?.kind === \"worker\" ? module.inspector : void 0;\n\tconst available = useMemo(() => processorManager != null || inspector != null, [processorManager, inspector]);\n\tconst getProcessors = useCallback(() => {\n\t\tif (inspector) return inspector.getProcessors();\n\t\tif (!processorManager) return Promise.resolve([]);\n\t\treturn Promise.resolve(processorManager.getAll().map((tracked) => ({\n\t\t\tprocessorId: tracked.processorId,\n\t\t\tfactoryId: tracked.factoryId,\n\t\t\tdriveId: tracked.driveId,\n\t\t\tprocessorIndex: tracked.processorIndex,\n\t\t\tlastOrdinal: tracked.lastOrdinal,\n\t\t\tstatus: tracked.status,\n\t\t\tlastError: tracked.lastError,\n\t\t\tlastErrorTimestamp: tracked.lastErrorTimestamp\n\t\t})));\n\t}, [processorManager, inspector]);\n\tconst onRetry = useCallback(async (processorId) => {\n\t\tif (inspector) {\n\t\t\tawait inspector.retryProcessor(processorId);\n\t\t\treturn;\n\t\t}\n\t\tif (!processorManager) return;\n\t\tconst tracked = processorManager.get(processorId);\n\t\tif (tracked) await tracked.retry();\n\t}, [processorManager, inspector]);\n\tif (!available) return;\n\treturn {\n\t\tgetProcessors,\n\t\tonRetry\n\t};\n}\n//#endregion\n//#region src/components/modal/modals/InspectorModal/useQueueInspector.ts\nfunction useQueueInspector() {\n\tconst module = useReactorClientModule();\n\tconst reactorClientModule = module?.kind === \"browser\" ? module : void 0;\n\tconst inspector = module?.kind === \"worker\" ? module.inspector : void 0;\n\tconst queue = reactorClientModule?.reactorModule?.queue;\n\tconst inMemoryQueue = useMemo(() => {\n\t\tif (queue instanceof InMemoryQueue) return queue;\n\t}, [queue]);\n\tconst getQueueState = useCallback(() => {\n\t\tif (inspector) return inspector.getQueueState();\n\t\tif (!inMemoryQueue) return Promise.resolve({\n\t\t\tisPaused: false,\n\t\t\tpendingJobs: [],\n\t\t\texecutingJobs: [],\n\t\t\ttotalPending: 0,\n\t\t\ttotalExecuting: 0\n\t\t});\n\t\tconst pendingJobs = inMemoryQueue.getPendingJobs();\n\t\tconst executingJobIds = inMemoryQueue.getExecutingJobIds();\n\t\tconst executingJobs = [];\n\t\tfor (const jobIdSet of executingJobIds.values()) for (const jobId of jobIdSet) {\n\t\t\tconst job = inMemoryQueue.getJob(jobId);\n\t\t\tif (job) executingJobs.push(job);\n\t\t}\n\t\treturn Promise.resolve({\n\t\t\tisPaused: inMemoryQueue.paused,\n\t\t\tpendingJobs,\n\t\t\texecutingJobs,\n\t\t\ttotalPending: pendingJobs.length,\n\t\t\ttotalExecuting: executingJobs.length\n\t\t});\n\t}, [inMemoryQueue, inspector]);\n\tconst onPause = useCallback(async () => {\n\t\tif (inspector) {\n\t\t\tawait inspector.pauseQueue();\n\t\t\treturn;\n\t\t}\n\t\tif (inMemoryQueue) inMemoryQueue.pause();\n\t}, [inMemoryQueue, inspector]);\n\tconst onResume = useCallback(async () => {\n\t\tif (inspector) {\n\t\t\tawait inspector.resumeQueue();\n\t\t\treturn;\n\t\t}\n\t\tif (inMemoryQueue) await inMemoryQueue.resume();\n\t}, [inMemoryQueue, inspector]);\n\tif (!inMemoryQueue && !inspector) return;\n\treturn {\n\t\tgetQueueState,\n\t\tonPause,\n\t\tonResume\n\t};\n}\n//#endregion\n//#region src/components/modal/modals/InspectorModal/useRemotesInspector.ts\nfunction useRemotesInspector() {\n\tconst syncManager = useSync();\n\tif (!syncManager) throw new Error(\"Sync manager not found\");\n\tconst connectionStates = useConnectionStates();\n\tconst getRemotes = useCallback(() => {\n\t\treturn Promise.resolve(syncManager.list());\n\t}, [syncManager]);\n\tconst removeRemote = useCallback((name) => syncManager.remove(name), [syncManager]);\n\tconst addRemoteManual = useCallback(async (url) => {\n\t\tawait addRemoteDrive(url, void 0, { pollBehavior: PollBehavior.Manual });\n\t}, []);\n\tconst triggerPull = useCallback((name) => syncManager.triggerPull(name), [syncManager]);\n\treturn {\n\t\tgetAgreement: useCallback(() => syncManager.agreement(), [syncManager]),\n\t\tgetHolds: useCallback((remoteName) => syncManager.listHolds({ remoteName }), [syncManager]),\n\t\tgetRemotes,\n\t\tremoveRemote,\n\t\taddRemoteManual,\n\t\ttriggerPull,\n\t\tconnectionStates\n\t};\n}\n//#endregion\n//#region src/components/modal/modals/InspectorModal/useWorkerInspector.ts\nfunction useWorkerInspector() {\n\tconst module = useReactorClientModule();\n\tconst adminClient = module?.kind === \"worker\" ? module.adminClient : void 0;\n\treturn useMemo(() => {\n\t\tif (!adminClient) return;\n\t\treturn {\n\t\t\tgetInfo: () => adminClient.info(),\n\t\t\tonRestart: () => adminClient.restart()\n\t\t};\n\t}, [adminClient]);\n}\n//#endregion\n//#region src/components/modal/modals/InspectorModal/InspectorModal.tsx\nconst DEFAULT_PAGE_SIZE = 25;\nconst InspectorModal = () => {\n\tconst open = usePHModal()?.type === \"inspector\";\n\tconst { getTables, getTableRows, getDefaultSort, onExportDb, onImportDb } = useDbExplorer();\n\tconst { getRemotes, removeRemote, addRemoteManual, triggerPull, connectionStates, getAgreement, getHolds } = useRemotesInspector();\n\tconst queueInspectorProps = useQueueInspector();\n\tconst processorsInspectorProps = useProcessorsInspector();\n\tconst integrityInspectorProps = useIntegrityInspector();\n\tconst catchUpInspectorProps = useCatchUpInspector();\n\tconst workerInspectorProps = useWorkerInspector();\n\tconst { currentPgVersion, supportedPgVersions, onResetToPgVersion } = useDebugInspector();\n\treturn /* @__PURE__ */ jsx(InspectorModal$1, {\n\t\topen,\n\t\tonOpenChange: (status) => {\n\t\t\tif (!status) closePHModal();\n\t\t},\n\t\tdbExplorerProps: {\n\t\t\tschema: REACTOR_SCHEMA,\n\t\t\tgetTables,\n\t\t\tgetTableRows,\n\t\t\tgetDefaultSort,\n\t\t\tpageSize: DEFAULT_PAGE_SIZE,\n\t\t\tonExportDb,\n\t\t\tonImportDb,\n\t\t\tpgVersionControl: {\n\t\t\t\tcurrentPgVersion,\n\t\t\t\tsupportedPgVersions,\n\t\t\t\tonResetToPgVersion\n\t\t\t}\n\t\t},\n\t\tremotesInspectorProps: {\n\t\t\tgetRemotes,\n\t\t\tremoveRemote,\n\t\t\taddRemoteManual,\n\t\t\ttriggerPull,\n\t\t\tconnectionStates,\n\t\t\tgetAgreement,\n\t\t\tgetHolds\n\t\t},\n\t\tqueueInspectorProps,\n\t\tprocessorsInspectorProps,\n\t\tintegrityInspectorProps,\n\t\tcatchUpInspectorProps,\n\t\tworkerInspectorProps\n\t});\n};\n//#endregion\nexport { InspectorModal };\n\n//# sourceMappingURL=InspectorModal-Cd8kbCV8.js.map\n//# debugId=5fa4ab4d-2ea8-5545-8537-8efeb6e1e0b7\n"],"x_google_ignoreList":[0],"mappings":"mrBACC,UAAU,CAAC,GAAG,CAAC,IAAI,EAAe,OAAO,OAApB,IAA2B,OAAoB,OAAO,OAApB,IAA2B,OAAoB,OAAO,WAApB,IAA+B,WAAwB,OAAO,KAApB,IAAyB,KAAK,CAAC,EAAE,EAAG,IAAI,EAAE,MAAI,CAAC,CAAE,MAAM,IAAI,EAAE,gBAAgB,EAAE,iBAAiB,CAAC,EAAE,EAAE,gBAAgB,GAAG,uCAAuC,MAAS,CAAC,CAAC,EAAA,CAAE,EAYhT,SAAS,GAAsB,CAC9B,IAAM,EAAS,EAAuB,EAChC,EAAU,GAAQ,OAAS,UAAY,EAAO,eAAe,QAAU,IAAK,GAC5E,EAAY,GAAQ,OAAS,SAAW,EAAO,UAAY,IAAK,GAChE,CAAC,EAAQ,GAAa,EAAS,EAC/B,EAAY,EAAY,SAAY,CACzC,GAAI,EAAW,CACd,EAAU,MAAM,EAAU,iBAAiB,CAAC,EAC5C,MACD,CACI,GAAS,EAAU,EAAQ,OAAO,CAAC,CACxC,EAAG,CAAC,EAAS,CAAS,CAAC,EACjB,EAAa,EAAY,SAAY,CAC1C,GAAI,EAAW,CACd,MAAM,EAAU,aAAa,EAC7B,MACD,CACI,GAAS,MAAM,EAAQ,SAAS,CACrC,EA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ACjB,mBACA,sBACA,oBACD,CACD,EACA,sBAAuB,CACtB,aACA,eACA,kBACA,cACA,mBACA,eACA,UACD,EACA,sBACA,2BACA,0BACA,wBACA,sBACD,CAAC,CACF"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{t as e}from"./useTranslation-C3rJ2yqu.js";import{t}from"./src-CrUksCLW-DV3pQOMC.js";import{_ as n,b as r,c as i,g as a,v as o,y as s}from"./app-loader-l5wtQh5z-
|
|
2
|
-
//# sourceMappingURL=OpenFileDocumentsModal-BQsaBP4x-
|
|
1
|
+
import{t as e}from"./useTranslation-C3rJ2yqu.js";import{t}from"./src-CrUksCLW-DV3pQOMC.js";import{_ as n,b as r,c as i,g as a,v as o,y as s}from"./app-loader-l5wtQh5z-bWtqX25O.js";import{Fragment as c,jsx as l,jsxs as u}from"react/jsx-runtime";import{DocumentModelNotFoundError as d,closePHModal as f,isDocumentTypeSupported as p,loadFile as m,setSelectedDrive as h,showPHModal as g,useDocumentTypes as _,useDrives as v,usePHModal as y,useUserPermissions as b}from"@powerhousedao/reactor-browser";import{useEffect as x,useState as S,useSyncExternalStore as C}from"react";import{Combobox as w,ModalButton as T,formatFileSize as E}from"@powerhousedao/design-system/connect";import{UnsupportedDocumentModelVersionError as D}from"@powerhousedao/shared/document-model";import{getNextCopyNumber as O,isFileNode as k}from"@powerhousedao/shared/document-drive";(function(){try{var e=typeof window<`u`?window:typeof global<`u`?global:typeof globalThis<`u`?globalThis:typeof self<`u`?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]=`c9044425-0d9b-591b-b686-b37a419b237f`)}catch{}})();function A(e){return e.name.replace(/\..+/gim,``)}function j(e){let{entries:t,nodes:n,documentTypes:r}=e,i=n.filter(e=>(e.parentFolder??null)===null),a=new Map,o=new Set;function s(e,t){if(!(t.includes(e)||o.has(e)))return e;let n=[...t,...o];return`${e} (copy) ${O(n,e)}`}for(let{key:e,file:n,parsed:c}of t){if(!c){a.set(e,{kind:`checking`});continue}if(c.state===`invalid`){a.set(e,{kind:`invalid`});continue}if(c.state===`version-unsupported`){a.set(e,{kind:`version-unsupported`,documentType:c.documentType,requiredVersion:c.requiredVersion});continue}if(c.state===`model-missing`){let t=A(n)||n.name,r=s(t,[]);o.add(r),a.set(e,{kind:`ready`,finalName:r,renamed:r!==t});continue}if(!p(c.documentType,r)){a.set(e,{kind:`unsupported`});continue}let t=A(n)||c.headerName,l=i.filter(e=>k(e)&&e.documentType===c.documentType).map(e=>e.name),u=i.some(e=>e.id===c.id),d=l.includes(t),f=s(t,l);o.add(f),a.set(e,{kind:`ready`,finalName:f,duplicate:d?`name`:u?`id`:void 0,renamed:f!==t})}return a}var M=new Map;async function N(e){try{let t=await m(e);return{state:`parsed`,id:t.header.id,documentType:t.header.documentType,headerName:t.header.name}}catch(e){return D.isError(e)?{state:`version-unsupported`,documentType:e.documentType,requiredVersion:e.requiredVersion}:d.isError(e)?{state:`model-missing`}:{state:`invalid`}}}function P(){let d=y()?.type===`openFileDocuments`,{t:p}=e(),m=v(),D=_(),{isAllowedToCreateDocuments:O}=b(),k=C(r,n),[A,P]=S(),[,F]=S(0);x(()=>{if(!window.ph?.reactorClient)return;let e=!1,t=new Set(k.map(o));for(let e of M.keys())t.has(e)||M.delete(e);for(let t of k){let n=o(t);if(M.has(n))continue;let r=N(t).then(e=>(M.set(n,e),e));M.set(n,r),r.then(()=>{e||F(e=>e+1)})}return()=>{e=!0}},[k]);let I=A??m?.[0]?.header.id,L=m?.find(e=>e.header.id===I),R=(m??[]).map(e=>({label:e.header.name||e.state.global.name,value:e.header.id,drive:e})),z=k.map(e=>{let t=M.get(o(e));return{key:o(e),file:e,parsed:t instanceof Promise?void 0:t}}),B=L?j({entries:z,nodes:L.state.global.nodes,documentTypes:D}):new Map,V=[...B.values()],H=V.filter(e=>e.kind===`ready`).length,U=V.some(e=>e.kind===`checking`),W=V.some(e=>e.kind===`ready`&&e.renamed);function G(){let e=L;if(!e)return;let t=[];for(let{key:e,file:n}of z){let r=B.get(e);r?.kind===`ready`&&t.push({file:n,name:r.finalName})}t.length!==0&&(a(),f(),h(e),s({driveId:e.header.id,imports:t,documentTypes:D}))}function K(){a(),f()}if(!d)return null;let q=(m?.length??0)>0;function J(e){let t=B.get(e);if(!t)return null;switch(t.kind){case`checking`:return l(`span`,{className:`text-xs text-muted-foreground`,children:p(`modals.openFileDocuments.checking`)});case`invalid`:return l(`span`,{className:`text-xs text-destructive`,children:p(`modals.openFileDocuments.invalidFile`)});case`version-unsupported`:return l(`span`,{className:`text-xs text-destructive`,children:`Requires version ${t.requiredVersion} of ${t.documentType} — update the package`});case`unsupported`:return l(`span`,{className:`text-xs text-destructive`,children:p(`modals.openFileDocuments.unsupportedType`)});case`ready`:return t.duplicate===`name`?l(`span`,{className:`text-xs text-muted-foreground`,children:p(`modals.openFileDocuments.duplicateHint`,{name:t.finalName})}):t.duplicate===`id`?l(`span`,{className:`text-xs text-muted-foreground`,children:p(`modals.openFileDocuments.duplicateCopyHint`)}):t.renamed?l(`span`,{className:`text-xs text-muted-foreground`,children:p(`modals.openFileDocuments.renamedHint`,{name:t.finalName})}):null}}return l(t,{open:d,onOpenChange:e=>{e||K()},contentProps:{className:`overflow-visible`},children:u(`div`,{className:`w-[520px] p-6`,children:[l(`div`,{className:`pb-2 text-2xl font-bold text-foreground`,children:p(`modals.openFileDocuments.title`,{count:k.length})}),O?u(c,{children:[l(`div`,{className:`my-4 flex flex-col gap-1 text-sm text-foreground`,children:k.map((e,t)=>{let n=o(e),r=J(n);return u(`div`,{className:`flex flex-col gap-0.5 rounded-md bg-background px-3 py-2`,children:[u(`div`,{className:`flex justify-between gap-2`,children:[l(`span`,{className:`truncate`,children:e.name}),l(`span`,{className:`shrink-0 text-muted-foreground`,children:E(e.size)})]}),r]},`${t}-${n}`)})}),q?u(c,{children:[l(`div`,{className:`mb-2 text-sm text-muted-foreground`,children:p(`modals.openFileDocuments.body`)}),l(w,{id:`open-file-documents-drive`,isSearchable:!1,options:R,value:R.find(e=>e.value===I)??null,onChange:e=>P(e.value),formatOptionLabel:e=>{let{label:t,drive:n}=e;return u(`span`,{className:`flex items-center gap-2`,children:[l(i,{drive:n}),l(`span`,{className:`truncate`,children:t})]})},maxMenuHeight:200})]}):l(`div`,{className:`my-6 rounded-md bg-background p-4 text-center text-foreground`,children:p(`modals.openFileDocuments.noDrives`)}),u(`div`,{className:`mt-8 flex justify-between gap-3`,children:[l(T,{variant:`cancel`,onClick:K,children:p(`common.cancel`)}),q?l(T,{variant:`confirm`,disabled:!I||H===0||U,onClick:G,children:p(W?`modals.openFileDocuments.renameAndImport`:`modals.openFileDocuments.import`)}):l(T,{variant:`confirm`,onClick:()=>g({type:`addDrive`}),children:p(`modals.openFileDocuments.createDrive`)})]})]}):u(c,{children:[l(`div`,{className:`my-6 rounded-md bg-background p-4 text-center text-foreground`,children:p(`modals.openFileDocuments.notAllowed`)}),l(`div`,{className:`mt-8 flex`,children:l(T,{variant:`cancel`,onClick:K,children:p(`common.cancel`)})})]})]})})}export{P as OpenFileDocumentsModal};
|
|
2
|
+
//# sourceMappingURL=OpenFileDocumentsModal-BQsaBP4x-DrXQ7KP_.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OpenFileDocumentsModal-BQsaBP4x-D0QTl2mc.js","names":[],"sources":["../../../../../node_modules/.pnpm/@powerhousedao+connect@6.2.3_031a39ff375233beffe5df359486f16d/node_modules/@powerhousedao/connect/dist/OpenFileDocumentsModal-BQsaBP4x.js"],"sourcesContent":["\n!function(){try{var e=\"undefined\"!=typeof window?window:\"undefined\"!=typeof global?global:\"undefined\"!=typeof globalThis?globalThis:\"undefined\"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]=\"c9044425-0d9b-591b-b686-b37a419b237f\")}catch(e){}}();\nimport { c as DriveIcon, d as runOpenFileImports, f as clearPendingImportFiles, h as subscribePendingImportFiles, m as pendingFileKey, p as getPendingImportFiles } from \"./app-loader-l5wtQh5z.js\";\nimport { Fragment, jsx, jsxs } from \"react/jsx-runtime\";\nimport { useTranslation } from \"react-i18next\";\nimport { useEffect, useState, useSyncExternalStore } from \"react\";\nimport { Combobox, ModalButton, formatFileSize } from \"@powerhousedao/design-system/connect\";\nimport { DocumentModelNotFoundError, closePHModal, isDocumentTypeSupported, loadFile, setSelectedDrive, showPHModal, useDocumentTypes, useDrives, usePHModal, useUserPermissions } from \"@powerhousedao/reactor-browser\";\nimport { Modal } from \"@powerhousedao/design-system\";\nimport { UnsupportedDocumentModelVersionError } from \"@powerhousedao/shared/document-model\";\nimport { getNextCopyNumber, isFileNode } from \"@powerhousedao/shared/document-drive\";\n//#region src/utils/open-file-plan.ts\n/** Same name normalization the import stores (use-on-drop-file convention). */\nfunction storedFileName(file) {\n\treturn file.name.replace(/\\..+/gim, \"\");\n}\n/**\n* Duplicate semantics mirror the import path's isDocumentInLocation, scoped\n* to the drive ROOT: an id match, or a file node with the same name AND the\n* same document type. Renames follow the drive-tree copy convention\n* (\"name (copy) N\" via getNextCopyNumber). Names assigned within the batch\n* accumulate into the collision set, so two pending files that would store\n* the same name never end up identical either.\n*/\nfunction planOpenFileImports(args) {\n\tconst { entries, nodes, documentTypes } = args;\n\tconst rootNodes = nodes.filter((node) => (node.parentFolder ?? null) === null);\n\tconst rows = /* @__PURE__ */ new Map();\n\tconst assignedNames = /* @__PURE__ */ new Set();\n\tfunction uniqueName(base, driveNames) {\n\t\tif (!(driveNames.includes(base) || assignedNames.has(base))) return base;\n\t\tconst candidates = [...driveNames, ...assignedNames];\n\t\treturn `${base} (copy) ${getNextCopyNumber(candidates, base)}`;\n\t}\n\tfor (const { key, file, parsed } of entries) {\n\t\tif (!parsed) {\n\t\t\trows.set(key, { kind: \"checking\" });\n\t\t\tcontinue;\n\t\t}\n\t\tif (parsed.state === \"invalid\") {\n\t\t\trows.set(key, { kind: \"invalid\" });\n\t\t\tcontinue;\n\t\t}\n\t\tif (parsed.state === \"version-unsupported\") {\n\t\t\trows.set(key, {\n\t\t\t\tkind: \"version-unsupported\",\n\t\t\t\tdocumentType: parsed.documentType,\n\t\t\t\trequiredVersion: parsed.requiredVersion\n\t\t\t});\n\t\t\tcontinue;\n\t\t}\n\t\tif (parsed.state === \"model-missing\") {\n\t\t\tconst base = storedFileName(file) || file.name;\n\t\t\tconst finalName = uniqueName(base, []);\n\t\t\tassignedNames.add(finalName);\n\t\t\trows.set(key, {\n\t\t\t\tkind: \"ready\",\n\t\t\t\tfinalName,\n\t\t\t\trenamed: finalName !== base\n\t\t\t});\n\t\t\tcontinue;\n\t\t}\n\t\tif (!isDocumentTypeSupported(parsed.documentType, documentTypes)) {\n\t\t\trows.set(key, { kind: \"unsupported\" });\n\t\t\tcontinue;\n\t\t}\n\t\tconst base = storedFileName(file) || parsed.headerName;\n\t\tconst sameTypeNames = rootNodes.filter((node) => isFileNode(node) && node.documentType === parsed.documentType).map((node) => node.name);\n\t\tconst idDuplicate = rootNodes.some((node) => node.id === parsed.id);\n\t\tconst nameDuplicate = sameTypeNames.includes(base);\n\t\tconst finalName = uniqueName(base, sameTypeNames);\n\t\tassignedNames.add(finalName);\n\t\trows.set(key, {\n\t\t\tkind: \"ready\",\n\t\t\tfinalName,\n\t\t\tduplicate: nameDuplicate ? \"name\" : idDuplicate ? \"id\" : void 0,\n\t\t\trenamed: finalName !== base\n\t\t});\n\t}\n\treturn rows;\n}\n//#endregion\n//#region src/components/modal/modals/OpenFileDocumentsModal.tsx\nconst parseCache = /* @__PURE__ */ new Map();\nasync function parsePendingFile(file) {\n\ttry {\n\t\tconst document = await loadFile(file);\n\t\treturn {\n\t\t\tstate: \"parsed\",\n\t\t\tid: document.header.id,\n\t\t\tdocumentType: document.header.documentType,\n\t\t\theaderName: document.header.name\n\t\t};\n\t} catch (error) {\n\t\tif (UnsupportedDocumentModelVersionError.isError(error)) return {\n\t\t\tstate: \"version-unsupported\",\n\t\t\tdocumentType: error.documentType,\n\t\t\trequiredVersion: error.requiredVersion\n\t\t};\n\t\tif (DocumentModelNotFoundError.isError(error)) return { state: \"model-missing\" };\n\t\treturn { state: \"invalid\" };\n\t}\n}\nfunction OpenFileDocumentsModal() {\n\tconst open = usePHModal()?.type === \"openFileDocuments\";\n\tconst { t } = useTranslation();\n\tconst drives = useDrives();\n\tconst documentTypes = useDocumentTypes();\n\tconst { isAllowedToCreateDocuments } = useUserPermissions();\n\tconst pendingFiles = useSyncExternalStore(subscribePendingImportFiles, getPendingImportFiles);\n\tconst [pickedDriveId, setPickedDriveId] = useState();\n\tconst [, setParseVersion] = useState(0);\n\tuseEffect(() => {\n\t\tif (!window.ph?.reactorClient) return;\n\t\tlet cancelled = false;\n\t\tconst pendingKeys = new Set(pendingFiles.map(pendingFileKey));\n\t\tfor (const key of parseCache.keys()) if (!pendingKeys.has(key)) parseCache.delete(key);\n\t\tfor (const file of pendingFiles) {\n\t\t\tconst key = pendingFileKey(file);\n\t\t\tif (parseCache.has(key)) continue;\n\t\t\tconst promise = parsePendingFile(file).then((info) => {\n\t\t\t\tparseCache.set(key, info);\n\t\t\t\treturn info;\n\t\t\t});\n\t\t\tparseCache.set(key, promise);\n\t\t\tpromise.then(() => {\n\t\t\t\tif (!cancelled) setParseVersion((version) => version + 1);\n\t\t\t});\n\t\t}\n\t\treturn () => {\n\t\t\tcancelled = true;\n\t\t};\n\t}, [pendingFiles]);\n\tconst selectedDriveId = pickedDriveId ?? drives?.[0]?.header.id;\n\tconst selectedDrive = drives?.find((drive) => drive.header.id === selectedDriveId);\n\tconst driveOptions = (drives ?? []).map((drive) => ({\n\t\tlabel: drive.header.name || drive.state.global.name,\n\t\tvalue: drive.header.id,\n\t\tdrive\n\t}));\n\tconst entries = pendingFiles.map((file) => {\n\t\tconst cached = parseCache.get(pendingFileKey(file));\n\t\treturn {\n\t\t\tkey: pendingFileKey(file),\n\t\t\tfile,\n\t\t\tparsed: cached instanceof Promise ? void 0 : cached\n\t\t};\n\t});\n\tconst plan = selectedDrive ? planOpenFileImports({\n\t\tentries,\n\t\tnodes: selectedDrive.state.global.nodes,\n\t\tdocumentTypes\n\t}) : /* @__PURE__ */ new Map();\n\tconst planRows = [...plan.values()];\n\tconst readyCount = planRows.filter((row) => row.kind === \"ready\").length;\n\tconst anyChecking = planRows.some((row) => row.kind === \"checking\");\n\tconst anyRenamed = planRows.some((row) => row.kind === \"ready\" && row.renamed);\n\tfunction onImport() {\n\t\tconst drive = selectedDrive;\n\t\tif (!drive) return;\n\t\tconst imports = [];\n\t\tfor (const { key, file } of entries) {\n\t\t\tconst row = plan.get(key);\n\t\t\tif (row?.kind === \"ready\") imports.push({\n\t\t\t\tfile,\n\t\t\t\tname: row.finalName\n\t\t\t});\n\t\t}\n\t\tif (imports.length === 0) return;\n\t\tclearPendingImportFiles();\n\t\tclosePHModal();\n\t\tsetSelectedDrive(drive);\n\t\trunOpenFileImports({\n\t\t\tdriveId: drive.header.id,\n\t\t\timports,\n\t\t\tdocumentTypes\n\t\t});\n\t}\n\tfunction onCancel() {\n\t\tclearPendingImportFiles();\n\t\tclosePHModal();\n\t}\n\tif (!open) return null;\n\tconst hasDrives = (drives?.length ?? 0) > 0;\n\tfunction rowAnnotation(key) {\n\t\tconst row = plan.get(key);\n\t\tif (!row) return null;\n\t\tswitch (row.kind) {\n\t\t\tcase \"checking\": return /* @__PURE__ */ jsx(\"span\", {\n\t\t\t\tclassName: \"text-xs text-muted-foreground\",\n\t\t\t\tchildren: t(\"modals.openFileDocuments.checking\")\n\t\t\t});\n\t\t\tcase \"invalid\": return /* @__PURE__ */ jsx(\"span\", {\n\t\t\t\tclassName: \"text-xs text-destructive\",\n\t\t\t\tchildren: t(\"modals.openFileDocuments.invalidFile\")\n\t\t\t});\n\t\t\tcase \"version-unsupported\": return /* @__PURE__ */ jsx(\"span\", {\n\t\t\t\tclassName: \"text-xs text-destructive\",\n\t\t\t\tchildren: `Requires version ${row.requiredVersion} of ${row.documentType} — update the package`\n\t\t\t});\n\t\t\tcase \"unsupported\": return /* @__PURE__ */ jsx(\"span\", {\n\t\t\t\tclassName: \"text-xs text-destructive\",\n\t\t\t\tchildren: t(\"modals.openFileDocuments.unsupportedType\")\n\t\t\t});\n\t\t\tcase \"ready\":\n\t\t\t\tif (row.duplicate === \"name\") return /* @__PURE__ */ jsx(\"span\", {\n\t\t\t\t\tclassName: \"text-xs text-muted-foreground\",\n\t\t\t\t\tchildren: t(\"modals.openFileDocuments.duplicateHint\", { name: row.finalName })\n\t\t\t\t});\n\t\t\t\tif (row.duplicate === \"id\") return /* @__PURE__ */ jsx(\"span\", {\n\t\t\t\t\tclassName: \"text-xs text-muted-foreground\",\n\t\t\t\t\tchildren: t(\"modals.openFileDocuments.duplicateCopyHint\")\n\t\t\t\t});\n\t\t\t\tif (row.renamed) return /* @__PURE__ */ jsx(\"span\", {\n\t\t\t\t\tclassName: \"text-xs text-muted-foreground\",\n\t\t\t\t\tchildren: t(\"modals.openFileDocuments.renamedHint\", { name: row.finalName })\n\t\t\t\t});\n\t\t\t\treturn null;\n\t\t}\n\t}\n\treturn /* @__PURE__ */ jsx(Modal, {\n\t\topen,\n\t\tonOpenChange: (status) => {\n\t\t\tif (!status) onCancel();\n\t\t},\n\t\tcontentProps: { className: \"overflow-visible\" },\n\t\tchildren: /* @__PURE__ */ jsxs(\"div\", {\n\t\t\tclassName: \"w-[520px] p-6\",\n\t\t\tchildren: [/* @__PURE__ */ jsx(\"div\", {\n\t\t\t\tclassName: \"pb-2 text-2xl font-bold text-foreground\",\n\t\t\t\tchildren: t(\"modals.openFileDocuments.title\", { count: pendingFiles.length })\n\t\t\t}), !isAllowedToCreateDocuments ? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(\"div\", {\n\t\t\t\tclassName: \"my-6 rounded-md bg-background p-4 text-center text-foreground\",\n\t\t\t\tchildren: t(\"modals.openFileDocuments.notAllowed\")\n\t\t\t}), /* @__PURE__ */ jsx(\"div\", {\n\t\t\t\tclassName: \"mt-8 flex\",\n\t\t\t\tchildren: /* @__PURE__ */ jsx(ModalButton, {\n\t\t\t\t\tvariant: \"cancel\",\n\t\t\t\t\tonClick: onCancel,\n\t\t\t\t\tchildren: t(\"common.cancel\")\n\t\t\t\t})\n\t\t\t})] }) : /* @__PURE__ */ jsxs(Fragment, { children: [\n\t\t\t\t/* @__PURE__ */ jsx(\"div\", {\n\t\t\t\t\tclassName: \"my-4 flex flex-col gap-1 text-sm text-foreground\",\n\t\t\t\t\tchildren: pendingFiles.map((file, index) => {\n\t\t\t\t\t\tconst key = pendingFileKey(file);\n\t\t\t\t\t\tconst annotation = rowAnnotation(key);\n\t\t\t\t\t\treturn /* @__PURE__ */ jsxs(\"div\", {\n\t\t\t\t\t\t\tclassName: \"flex flex-col gap-0.5 rounded-md bg-background px-3 py-2\",\n\t\t\t\t\t\t\tchildren: [/* @__PURE__ */ jsxs(\"div\", {\n\t\t\t\t\t\t\t\tclassName: \"flex justify-between gap-2\",\n\t\t\t\t\t\t\t\tchildren: [/* @__PURE__ */ jsx(\"span\", {\n\t\t\t\t\t\t\t\t\tclassName: \"truncate\",\n\t\t\t\t\t\t\t\t\tchildren: file.name\n\t\t\t\t\t\t\t\t}), /* @__PURE__ */ jsx(\"span\", {\n\t\t\t\t\t\t\t\t\tclassName: \"shrink-0 text-muted-foreground\",\n\t\t\t\t\t\t\t\t\tchildren: formatFileSize(file.size)\n\t\t\t\t\t\t\t\t})]\n\t\t\t\t\t\t\t}), annotation]\n\t\t\t\t\t\t}, `${index}-${key}`);\n\t\t\t\t\t})\n\t\t\t\t}),\n\t\t\t\thasDrives ? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(\"div\", {\n\t\t\t\t\tclassName: \"mb-2 text-sm text-muted-foreground\",\n\t\t\t\t\tchildren: t(\"modals.openFileDocuments.body\")\n\t\t\t\t}), /* @__PURE__ */ jsx(Combobox, {\n\t\t\t\t\tid: \"open-file-documents-drive\",\n\t\t\t\t\tisSearchable: false,\n\t\t\t\t\toptions: driveOptions,\n\t\t\t\t\tvalue: driveOptions.find((option) => option.value === selectedDriveId) ?? null,\n\t\t\t\t\tonChange: (option) => setPickedDriveId(option.value),\n\t\t\t\t\tformatOptionLabel: (option) => {\n\t\t\t\t\t\tconst { label, drive } = option;\n\t\t\t\t\t\treturn /* @__PURE__ */ jsxs(\"span\", {\n\t\t\t\t\t\t\tclassName: \"flex items-center gap-2\",\n\t\t\t\t\t\t\tchildren: [/* @__PURE__ */ jsx(DriveIcon, { drive }), /* @__PURE__ */ jsx(\"span\", {\n\t\t\t\t\t\t\t\tclassName: \"truncate\",\n\t\t\t\t\t\t\t\tchildren: label\n\t\t\t\t\t\t\t})]\n\t\t\t\t\t\t});\n\t\t\t\t\t},\n\t\t\t\t\tmaxMenuHeight: 200\n\t\t\t\t})] }) : /* @__PURE__ */ jsx(\"div\", {\n\t\t\t\t\tclassName: \"my-6 rounded-md bg-background p-4 text-center text-foreground\",\n\t\t\t\t\tchildren: t(\"modals.openFileDocuments.noDrives\")\n\t\t\t\t}),\n\t\t\t\t/* @__PURE__ */ jsxs(\"div\", {\n\t\t\t\t\tclassName: \"mt-8 flex justify-between gap-3\",\n\t\t\t\t\tchildren: [/* @__PURE__ */ jsx(ModalButton, {\n\t\t\t\t\t\tvariant: \"cancel\",\n\t\t\t\t\t\tonClick: onCancel,\n\t\t\t\t\t\tchildren: t(\"common.cancel\")\n\t\t\t\t\t}), hasDrives ? /* @__PURE__ */ jsx(ModalButton, {\n\t\t\t\t\t\tvariant: \"confirm\",\n\t\t\t\t\t\tdisabled: !selectedDriveId || readyCount === 0 || anyChecking,\n\t\t\t\t\t\tonClick: onImport,\n\t\t\t\t\t\tchildren: anyRenamed ? t(\"modals.openFileDocuments.renameAndImport\") : t(\"modals.openFileDocuments.import\")\n\t\t\t\t\t}) : /* @__PURE__ */ jsx(ModalButton, {\n\t\t\t\t\t\tvariant: \"confirm\",\n\t\t\t\t\t\tonClick: () => showPHModal({ type: \"addDrive\" }),\n\t\t\t\t\t\tchildren: t(\"modals.openFileDocuments.createDrive\")\n\t\t\t\t\t})]\n\t\t\t\t})\n\t\t\t] })]\n\t\t})\n\t});\n}\n//#endregion\nexport { OpenFileDocumentsModal };\n\n//# sourceMappingURL=OpenFileDocumentsModal-BQsaBP4x.js.map\n//# debugId=c9044425-0d9b-591b-b686-b37a419b237f\n"],"x_google_ignoreList":[0],"mappings":"s1BACC,UAAU,CAAC,GAAG,CAAC,IAAI,EAAe,OAAO,OAApB,IAA2B,OAAoB,OAAO,OAApB,IAA2B,OAAoB,OAAO,WAApB,IAA+B,WAAwB,OAAO,KAApB,IAAyB,KAAK,CAAC,EAAE,EAAG,IAAI,EAAE,MAAI,CAAC,CAAE,MAAM,IAAI,EAAE,gBAAgB,EAAE,iBAAiB,CAAC,EAAE,EAAE,gBAAgB,GAAG,uCAAuC,MAAS,CAAC,CAAC,EAAA,CAAE,EAYhT,SAAS,EAAe,EAAM,CAC7B,OAAO,EAAK,KAAK,QAAQ,UAAW,EAAE,CACvC,CASA,SAAS,EAAoB,EAAM,CAClC,GAAM,CAAE,UAAS,QAAO,iBAAkB,EACpC,EAAY,EAAM,OAAQ,IAAU,EAAK,cAAgB,QAAU,IAAI,EACvE,EAAuB,IAAI,IAC3B,EAAgC,IAAI,IAC1C,SAAS,EAAW,EAAM,EAAY,CACrC,GAAI,EAAE,EAAW,SAAS,CAAI,GAAK,EAAc,IAAI,CAAI,GAAI,OAAO,EACpE,IAAM,EAAa,CAAC,GAAG,EAAY,GAAG,CAAa,EACnD,MAAO,GAAG,EAAK,UAAU,EAAkB,EAAY,CAAI,GAC5D,CACA,IAAK,GAAM,CAAE,MAAK,OAAM,YAAY,EAAS,CAC5C,GAAI,CAAC,EAAQ,CACZ,EAAK,IAAI,EAAK,CAAE,KAAM,UAAW,CAAC,EAClC,QACD,CACA,GAAI,EAAO,QAAU,UAAW,CAC/B,EAAK,IAAI,EAAK,CAAE,KAAM,SAAU,CAAC,EACjC,QACD,CACA,GAA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"OpenFileDocumentsModal-BQsaBP4x-DrXQ7KP_.js","names":[],"sources":["../../../../../node_modules/.pnpm/@powerhousedao+connect@6.2.3_031a39ff375233beffe5df359486f16d/node_modules/@powerhousedao/connect/dist/OpenFileDocumentsModal-BQsaBP4x.js"],"sourcesContent":["\n!function(){try{var e=\"undefined\"!=typeof window?window:\"undefined\"!=typeof global?global:\"undefined\"!=typeof globalThis?globalThis:\"undefined\"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]=\"c9044425-0d9b-591b-b686-b37a419b237f\")}catch(e){}}();\nimport { c as DriveIcon, d as runOpenFileImports, f as clearPendingImportFiles, h as subscribePendingImportFiles, m as pendingFileKey, p as getPendingImportFiles } from \"./app-loader-l5wtQh5z.js\";\nimport { Fragment, jsx, jsxs } from \"react/jsx-runtime\";\nimport { useTranslation } from \"react-i18next\";\nimport { useEffect, useState, useSyncExternalStore } from \"react\";\nimport { Combobox, ModalButton, formatFileSize } from \"@powerhousedao/design-system/connect\";\nimport { DocumentModelNotFoundError, closePHModal, isDocumentTypeSupported, loadFile, setSelectedDrive, showPHModal, useDocumentTypes, useDrives, usePHModal, useUserPermissions } from \"@powerhousedao/reactor-browser\";\nimport { Modal } from \"@powerhousedao/design-system\";\nimport { UnsupportedDocumentModelVersionError } from \"@powerhousedao/shared/document-model\";\nimport { getNextCopyNumber, isFileNode } from \"@powerhousedao/shared/document-drive\";\n//#region src/utils/open-file-plan.ts\n/** Same name normalization the import stores (use-on-drop-file convention). */\nfunction storedFileName(file) {\n\treturn file.name.replace(/\\..+/gim, \"\");\n}\n/**\n* Duplicate semantics mirror the import path's isDocumentInLocation, scoped\n* to the drive ROOT: an id match, or a file node with the same name AND the\n* same document type. Renames follow the drive-tree copy convention\n* (\"name (copy) N\" via getNextCopyNumber). Names assigned within the batch\n* accumulate into the collision set, so two pending files that would store\n* the same name never end up identical either.\n*/\nfunction planOpenFileImports(args) {\n\tconst { entries, nodes, documentTypes } = args;\n\tconst rootNodes = nodes.filter((node) => (node.parentFolder ?? null) === null);\n\tconst rows = /* @__PURE__ */ new Map();\n\tconst assignedNames = /* @__PURE__ */ new Set();\n\tfunction uniqueName(base, driveNames) {\n\t\tif (!(driveNames.includes(base) || assignedNames.has(base))) return base;\n\t\tconst candidates = [...driveNames, ...assignedNames];\n\t\treturn `${base} (copy) ${getNextCopyNumber(candidates, base)}`;\n\t}\n\tfor (const { key, file, parsed } of entries) {\n\t\tif (!parsed) {\n\t\t\trows.set(key, { kind: \"checking\" });\n\t\t\tcontinue;\n\t\t}\n\t\tif (parsed.state === \"invalid\") {\n\t\t\trows.set(key, { kind: \"invalid\" });\n\t\t\tcontinue;\n\t\t}\n\t\tif (parsed.state === \"version-unsupported\") {\n\t\t\trows.set(key, {\n\t\t\t\tkind: \"version-unsupported\",\n\t\t\t\tdocumentType: parsed.documentType,\n\t\t\t\trequiredVersion: parsed.requiredVersion\n\t\t\t});\n\t\t\tcontinue;\n\t\t}\n\t\tif (parsed.state === \"model-missing\") {\n\t\t\tconst base = storedFileName(file) || file.name;\n\t\t\tconst finalName = uniqueName(base, []);\n\t\t\tassignedNames.add(finalName);\n\t\t\trows.set(key, {\n\t\t\t\tkind: \"ready\",\n\t\t\t\tfinalName,\n\t\t\t\trenamed: finalName !== base\n\t\t\t});\n\t\t\tcontinue;\n\t\t}\n\t\tif (!isDocumentTypeSupported(parsed.documentType, documentTypes)) {\n\t\t\trows.set(key, { kind: \"unsupported\" });\n\t\t\tcontinue;\n\t\t}\n\t\tconst base = storedFileName(file) || parsed.headerName;\n\t\tconst sameTypeNames = rootNodes.filter((node) => isFileNode(node) && node.documentType === parsed.documentType).map((node) => node.name);\n\t\tconst idDuplicate = rootNodes.some((node) => node.id === parsed.id);\n\t\tconst nameDuplicate = sameTypeNames.includes(base);\n\t\tconst finalName = uniqueName(base, sameTypeNames);\n\t\tassignedNames.add(finalName);\n\t\trows.set(key, {\n\t\t\tkind: \"ready\",\n\t\t\tfinalName,\n\t\t\tduplicate: nameDuplicate ? \"name\" : idDuplicate ? \"id\" : void 0,\n\t\t\trenamed: finalName !== base\n\t\t});\n\t}\n\treturn rows;\n}\n//#endregion\n//#region src/components/modal/modals/OpenFileDocumentsModal.tsx\nconst parseCache = /* @__PURE__ */ new Map();\nasync function parsePendingFile(file) {\n\ttry {\n\t\tconst document = await loadFile(file);\n\t\treturn {\n\t\t\tstate: \"parsed\",\n\t\t\tid: document.header.id,\n\t\t\tdocumentType: document.header.documentType,\n\t\t\theaderName: document.header.name\n\t\t};\n\t} catch (error) {\n\t\tif (UnsupportedDocumentModelVersionError.isError(error)) return {\n\t\t\tstate: \"version-unsupported\",\n\t\t\tdocumentType: error.documentType,\n\t\t\trequiredVersion: error.requiredVersion\n\t\t};\n\t\tif (DocumentModelNotFoundError.isError(error)) return { state: \"model-missing\" };\n\t\treturn { state: \"invalid\" };\n\t}\n}\nfunction OpenFileDocumentsModal() {\n\tconst open = usePHModal()?.type === \"openFileDocuments\";\n\tconst { t } = useTranslation();\n\tconst drives = useDrives();\n\tconst documentTypes = useDocumentTypes();\n\tconst { isAllowedToCreateDocuments } = useUserPermissions();\n\tconst pendingFiles = useSyncExternalStore(subscribePendingImportFiles, getPendingImportFiles);\n\tconst [pickedDriveId, setPickedDriveId] = useState();\n\tconst [, setParseVersion] = useState(0);\n\tuseEffect(() => {\n\t\tif (!window.ph?.reactorClient) return;\n\t\tlet cancelled = false;\n\t\tconst pendingKeys = new Set(pendingFiles.map(pendingFileKey));\n\t\tfor (const key of parseCache.keys()) if (!pendingKeys.has(key)) parseCache.delete(key);\n\t\tfor (const file of pendingFiles) {\n\t\t\tconst key = pendingFileKey(file);\n\t\t\tif (parseCache.has(key)) continue;\n\t\t\tconst promise = parsePendingFile(file).then((info) => {\n\t\t\t\tparseCache.set(key, info);\n\t\t\t\treturn info;\n\t\t\t});\n\t\t\tparseCache.set(key, promise);\n\t\t\tpromise.then(() => {\n\t\t\t\tif (!cancelled) setParseVersion((version) => version + 1);\n\t\t\t});\n\t\t}\n\t\treturn () => {\n\t\t\tcancelled = true;\n\t\t};\n\t}, [pendingFiles]);\n\tconst selectedDriveId = pickedDriveId ?? drives?.[0]?.header.id;\n\tconst selectedDrive = drives?.find((drive) => drive.header.id === selectedDriveId);\n\tconst driveOptions = (drives ?? []).map((drive) => ({\n\t\tlabel: drive.header.name || drive.state.global.name,\n\t\tvalue: drive.header.id,\n\t\tdrive\n\t}));\n\tconst entries = pendingFiles.map((file) => {\n\t\tconst cached = parseCache.get(pendingFileKey(file));\n\t\treturn {\n\t\t\tkey: pendingFileKey(file),\n\t\t\tfile,\n\t\t\tparsed: cached instanceof Promise ? void 0 : cached\n\t\t};\n\t});\n\tconst plan = selectedDrive ? planOpenFileImports({\n\t\tentries,\n\t\tnodes: selectedDrive.state.global.nodes,\n\t\tdocumentTypes\n\t}) : /* @__PURE__ */ new Map();\n\tconst planRows = [...plan.values()];\n\tconst readyCount = planRows.filter((row) => row.kind === \"ready\").length;\n\tconst anyChecking = planRows.some((row) => row.kind === \"checking\");\n\tconst anyRenamed = planRows.some((row) => row.kind === \"ready\" && row.renamed);\n\tfunction onImport() {\n\t\tconst drive = selectedDrive;\n\t\tif (!drive) return;\n\t\tconst imports = [];\n\t\tfor (const { key, file } of entries) {\n\t\t\tconst row = plan.get(key);\n\t\t\tif (row?.kind === \"ready\") imports.push({\n\t\t\t\tfile,\n\t\t\t\tname: row.finalName\n\t\t\t});\n\t\t}\n\t\tif (imports.length === 0) return;\n\t\tclearPendingImportFiles();\n\t\tclosePHModal();\n\t\tsetSelectedDrive(drive);\n\t\trunOpenFileImports({\n\t\t\tdriveId: drive.header.id,\n\t\t\timports,\n\t\t\tdocumentTypes\n\t\t});\n\t}\n\tfunction onCancel() {\n\t\tclearPendingImportFiles();\n\t\tclosePHModal();\n\t}\n\tif (!open) return null;\n\tconst hasDrives = (drives?.length ?? 0) > 0;\n\tfunction rowAnnotation(key) {\n\t\tconst row = plan.get(key);\n\t\tif (!row) return null;\n\t\tswitch (row.kind) {\n\t\t\tcase \"checking\": return /* @__PURE__ */ jsx(\"span\", {\n\t\t\t\tclassName: \"text-xs text-muted-foreground\",\n\t\t\t\tchildren: t(\"modals.openFileDocuments.checking\")\n\t\t\t});\n\t\t\tcase \"invalid\": return /* @__PURE__ */ jsx(\"span\", {\n\t\t\t\tclassName: \"text-xs text-destructive\",\n\t\t\t\tchildren: t(\"modals.openFileDocuments.invalidFile\")\n\t\t\t});\n\t\t\tcase \"version-unsupported\": return /* @__PURE__ */ jsx(\"span\", {\n\t\t\t\tclassName: \"text-xs text-destructive\",\n\t\t\t\tchildren: `Requires version ${row.requiredVersion} of ${row.documentType} — update the package`\n\t\t\t});\n\t\t\tcase \"unsupported\": return /* @__PURE__ */ jsx(\"span\", {\n\t\t\t\tclassName: \"text-xs text-destructive\",\n\t\t\t\tchildren: t(\"modals.openFileDocuments.unsupportedType\")\n\t\t\t});\n\t\t\tcase \"ready\":\n\t\t\t\tif (row.duplicate === \"name\") return /* @__PURE__ */ jsx(\"span\", {\n\t\t\t\t\tclassName: \"text-xs text-muted-foreground\",\n\t\t\t\t\tchildren: t(\"modals.openFileDocuments.duplicateHint\", { name: row.finalName })\n\t\t\t\t});\n\t\t\t\tif (row.duplicate === \"id\") return /* @__PURE__ */ jsx(\"span\", {\n\t\t\t\t\tclassName: \"text-xs text-muted-foreground\",\n\t\t\t\t\tchildren: t(\"modals.openFileDocuments.duplicateCopyHint\")\n\t\t\t\t});\n\t\t\t\tif (row.renamed) return /* @__PURE__ */ jsx(\"span\", {\n\t\t\t\t\tclassName: \"text-xs text-muted-foreground\",\n\t\t\t\t\tchildren: t(\"modals.openFileDocuments.renamedHint\", { name: row.finalName })\n\t\t\t\t});\n\t\t\t\treturn null;\n\t\t}\n\t}\n\treturn /* @__PURE__ */ jsx(Modal, {\n\t\topen,\n\t\tonOpenChange: (status) => {\n\t\t\tif (!status) onCancel();\n\t\t},\n\t\tcontentProps: { className: \"overflow-visible\" },\n\t\tchildren: /* @__PURE__ */ jsxs(\"div\", {\n\t\t\tclassName: \"w-[520px] p-6\",\n\t\t\tchildren: [/* @__PURE__ */ jsx(\"div\", {\n\t\t\t\tclassName: \"pb-2 text-2xl font-bold text-foreground\",\n\t\t\t\tchildren: t(\"modals.openFileDocuments.title\", { count: pendingFiles.length })\n\t\t\t}), !isAllowedToCreateDocuments ? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(\"div\", {\n\t\t\t\tclassName: \"my-6 rounded-md bg-background p-4 text-center text-foreground\",\n\t\t\t\tchildren: t(\"modals.openFileDocuments.notAllowed\")\n\t\t\t}), /* @__PURE__ */ jsx(\"div\", {\n\t\t\t\tclassName: \"mt-8 flex\",\n\t\t\t\tchildren: /* @__PURE__ */ jsx(ModalButton, {\n\t\t\t\t\tvariant: \"cancel\",\n\t\t\t\t\tonClick: onCancel,\n\t\t\t\t\tchildren: t(\"common.cancel\")\n\t\t\t\t})\n\t\t\t})] }) : /* @__PURE__ */ jsxs(Fragment, { children: [\n\t\t\t\t/* @__PURE__ */ jsx(\"div\", {\n\t\t\t\t\tclassName: \"my-4 flex flex-col gap-1 text-sm text-foreground\",\n\t\t\t\t\tchildren: pendingFiles.map((file, index) => {\n\t\t\t\t\t\tconst key = pendingFileKey(file);\n\t\t\t\t\t\tconst annotation = rowAnnotation(key);\n\t\t\t\t\t\treturn /* @__PURE__ */ jsxs(\"div\", {\n\t\t\t\t\t\t\tclassName: \"flex flex-col gap-0.5 rounded-md bg-background px-3 py-2\",\n\t\t\t\t\t\t\tchildren: [/* @__PURE__ */ jsxs(\"div\", {\n\t\t\t\t\t\t\t\tclassName: \"flex justify-between gap-2\",\n\t\t\t\t\t\t\t\tchildren: [/* @__PURE__ */ jsx(\"span\", {\n\t\t\t\t\t\t\t\t\tclassName: \"truncate\",\n\t\t\t\t\t\t\t\t\tchildren: file.name\n\t\t\t\t\t\t\t\t}), /* @__PURE__ */ jsx(\"span\", {\n\t\t\t\t\t\t\t\t\tclassName: \"shrink-0 text-muted-foreground\",\n\t\t\t\t\t\t\t\t\tchildren: formatFileSize(file.size)\n\t\t\t\t\t\t\t\t})]\n\t\t\t\t\t\t\t}), annotation]\n\t\t\t\t\t\t}, `${index}-${key}`);\n\t\t\t\t\t})\n\t\t\t\t}),\n\t\t\t\thasDrives ? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(\"div\", {\n\t\t\t\t\tclassName: \"mb-2 text-sm text-muted-foreground\",\n\t\t\t\t\tchildren: t(\"modals.openFileDocuments.body\")\n\t\t\t\t}), /* @__PURE__ */ jsx(Combobox, {\n\t\t\t\t\tid: \"open-file-documents-drive\",\n\t\t\t\t\tisSearchable: false,\n\t\t\t\t\toptions: driveOptions,\n\t\t\t\t\tvalue: driveOptions.find((option) => option.value === selectedDriveId) ?? null,\n\t\t\t\t\tonChange: (option) => setPickedDriveId(option.value),\n\t\t\t\t\tformatOptionLabel: (option) => {\n\t\t\t\t\t\tconst { label, drive } = option;\n\t\t\t\t\t\treturn /* @__PURE__ */ jsxs(\"span\", {\n\t\t\t\t\t\t\tclassName: \"flex items-center gap-2\",\n\t\t\t\t\t\t\tchildren: [/* @__PURE__ */ jsx(DriveIcon, { drive }), /* @__PURE__ */ jsx(\"span\", {\n\t\t\t\t\t\t\t\tclassName: \"truncate\",\n\t\t\t\t\t\t\t\tchildren: label\n\t\t\t\t\t\t\t})]\n\t\t\t\t\t\t});\n\t\t\t\t\t},\n\t\t\t\t\tmaxMenuHeight: 200\n\t\t\t\t})] }) : /* @__PURE__ */ jsx(\"div\", {\n\t\t\t\t\tclassName: \"my-6 rounded-md bg-background p-4 text-center text-foreground\",\n\t\t\t\t\tchildren: t(\"modals.openFileDocuments.noDrives\")\n\t\t\t\t}),\n\t\t\t\t/* @__PURE__ */ jsxs(\"div\", {\n\t\t\t\t\tclassName: \"mt-8 flex justify-between gap-3\",\n\t\t\t\t\tchildren: [/* @__PURE__ */ jsx(ModalButton, {\n\t\t\t\t\t\tvariant: \"cancel\",\n\t\t\t\t\t\tonClick: onCancel,\n\t\t\t\t\t\tchildren: t(\"common.cancel\")\n\t\t\t\t\t}), hasDrives ? /* @__PURE__ */ jsx(ModalButton, {\n\t\t\t\t\t\tvariant: \"confirm\",\n\t\t\t\t\t\tdisabled: !selectedDriveId || readyCount === 0 || anyChecking,\n\t\t\t\t\t\tonClick: onImport,\n\t\t\t\t\t\tchildren: anyRenamed ? t(\"modals.openFileDocuments.renameAndImport\") : t(\"modals.openFileDocuments.import\")\n\t\t\t\t\t}) : /* @__PURE__ */ jsx(ModalButton, {\n\t\t\t\t\t\tvariant: \"confirm\",\n\t\t\t\t\t\tonClick: () => showPHModal({ type: \"addDrive\" }),\n\t\t\t\t\t\tchildren: t(\"modals.openFileDocuments.createDrive\")\n\t\t\t\t\t})]\n\t\t\t\t})\n\t\t\t] })]\n\t\t})\n\t});\n}\n//#endregion\nexport { OpenFileDocumentsModal };\n\n//# sourceMappingURL=OpenFileDocumentsModal-BQsaBP4x.js.map\n//# debugId=c9044425-0d9b-591b-b686-b37a419b237f\n"],"x_google_ignoreList":[0],"mappings":"s1BACC,UAAU,CAAC,GAAG,CAAC,IAAI,EAAe,OAAO,OAApB,IAA2B,OAAoB,OAAO,OAApB,IAA2B,OAAoB,OAAO,WAApB,IAA+B,WAAwB,OAAO,KAApB,IAAyB,KAAK,CAAC,EAAE,EAAG,IAAI,EAAE,MAAI,CAAC,CAAE,MAAM,IAAI,EAAE,gBAAgB,EAAE,iBAAiB,CAAC,EAAE,EAAE,gBAAgB,GAAG,uCAAuC,MAAS,CAAC,CAAC,EAAA,CAAE,EAYhT,SAAS,EAAe,EAAM,CAC7B,OAAO,EAAK,KAAK,QAAQ,UAAW,EAAE,CACvC,CASA,SAAS,EAAoB,EAAM,CAClC,GAAM,CAAE,UAAS,QAAO,iBAAkB,EACpC,EAAY,EAAM,OAAQ,IAAU,EAAK,cAAgB,QAAU,IAAI,EACvE,EAAuB,IAAI,IAC3B,E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AoB,EAAI,EAAa,CACrC,QAAS,UACT,YAAe,EAAY,CAAE,KAAM,UAAW,CAAC,EAC/C,SAAU,EAAE,sCAAsC,CACnD,CAAC,CAAC,CACH,CAAC,CACF,CAAE,CAAC,EAxE+C,EAAK,EAAU,CAAE,SAAU,CAAiB,EAAI,MAAO,CACxG,UAAW,gEACX,SAAU,EAAE,qCAAqC,CAClD,CAAC,EAAmB,EAAI,MAAO,CAC9B,UAAW,YACX,SAA0B,EAAI,EAAa,CAC1C,QAAS,SACT,QAAS,EACT,SAAU,EAAE,eAAe,CAC5B,CAAC,CACF,CAAC,CAAC,CAAE,CAAC,CA8DD,CACL,CAAC,CACF,CAAC,CACF"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{r as e}from"./toast-C6WW-_O--BnFrYYYY.js";import{r as t}from"./i18next-CxmwyrLu.js";import{r as n}from"./connect.config-CaXMoB42-Dbb5nzkI.js";import{a as r,n as i,r as a}from"./build-info-BV8UtyA4-vnk7Wd-i.js";import{t as o}from"./icon-01W_S_9A-7FJRMZYN.js";import{t as s}from"./useRegistryPackages-DuoU75ap-DiEJJFe0.js";import{jsx as c,jsxs as l}from"react/jsx-runtime";import{DriveCollectionId as u,closePHModal as d,deleteDrive as f,setSelectedDrive as p,showPHModal as m,useDriveSystemInfo as h,useDrives as g,usePHModal as _,useSyncList as v,useVetraPackageManager as y}from"@powerhousedao/reactor-browser";import{createContext as b,createElement as x,forwardRef as S,useCallback as C,useContext as ee,useMemo as w,useState as T}from"react";import{About as te,DangerZone as ne,DefaultEditor as E,PackageManager as D,SettingsModal as O,ThemeSwitch as k}from"@powerhousedao/design-system/connect";import{getAiSettings as A,isAiConfigured as j,updateAiSettings as M}from"@powerhousedao/reactor-browser/ai";var re=e=>e?.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase();function ie(e,t,n=[]){if(t==null)throw Error(`[lucide]: iconNode is required when icon name is used`);return{name:re(e),size:24,node:t,...n.length>0?{aliases:n}:{}}}var ae=e=>{let t=``,n=!1;for(let r of e){if(r===`-`||r===`_`||r<=` `){n=t.length>0;continue}t.length===0?t+=r.toLowerCase():t+=n?r.toUpperCase():r,n=!1}return t},oe=e=>{let t=ae(e);return t.charAt(0).toUpperCase()+t.slice(1)},N=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),P={xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":2,"stroke-linecap":`round`,"stroke-linejoin":`round`};function F(e){return e!=null}function I(e,t={}){let n=t.attributeNames??{},r=e=>n[e]??e,i=e.size??e.width??P.width,a=e.size??e.height??P.height,o=e.aliases?.filter(e=>typeof e==`string`&&e.trim()!==``).map(e=>`lucide-${e}`)??[],s=[...e.name?[`lucide-${e.name}`]:[],...o],c=t.className?.split(` `).filter(Boolean)??[],l=t.includeDefaultClasses===!1?N(...c):N(`lucide`,...s,...c),u=t.absoluteStrokeWidth?Number(t.strokeWidth??P[`stroke-width`])*Number(e.size??e.width??P.width)/Number(t.size??t.width??P.width):t.strokeWidth??P[`stroke-width`];return[`svg`,{...Object.entries(P).reduce((e,[t,n])=>(e[r(t)]=n,e),{}),...`color`in t&&t.color&&{[r(`stroke`)]:t.color},...`size`in t&&F(t.size)&&{[r(`width`)]:t.size,[r(`height`)]:t.size},...`width`in t&&F(t.width)&&{[r(`width`)]:t.width},...`height`in t&&F(t.height)&&{[r(`height`)]:t.height},[r(`stroke-width`)]:u,...l&&{[r(`class`)]:l},[r(`viewBox`)]:`0 0 ${i} ${a}`,...t.hasA11yProp===!1?{[r(`aria-hidden`)]:`true`}:{},...`attributes`in t&&t.attributes},e.node.map(e=>{let[n,i,a]=e,o=t.nonScalingStroke?{[r(`vector-effect`)]:`non-scaling-stroke`,...i}:i;return a?[n,o,a]:[n,o]})]}function L(e,t={}){return I(e,{...t,attributeNames:{...t.attributeNames,class:`className`,"stroke-width":`strokeWidth`,"stroke-linecap":`strokeLinecap`,"stroke-linejoin":`strokeLinejoin`,"vector-effect":`vectorEffect`}})}var R=e=>{for(let t in e)if(t.startsWith(`aria-`)||t===`role`||t===`title`)return!0;return!1},z=b({}),B=()=>ee(z),V=S(({color:e,size:t,width:n,height:r,strokeWidth:i,absoluteStrokeWidth:a,nonScalingStroke:o,className:s=``,children:c,iconNode:l=[],icon:u={node:l,aliases:[],size:24},...d},f)=>{let{size:p=24,strokeWidth:m=2,absoluteStrokeWidth:h=!1,nonScalingStroke:g=!1,color:_=`currentColor`,className:v=``}=B()??{},y=!!c||R(d),[b,S,C=[]]=L(u,{color:e??_,width:n??t??p,height:r??t??p,strokeWidth:i??m,absoluteStrokeWidth:a??h,nonScalingStroke:o??g,className:N(v,s),hasA11yProp:y,attributes:d});return x(b,{ref:f,...S},[...C.map(([e,t])=>x(e,t)),...Array.isArray(c)?c:[c]])});function H(e,t=[],n=[]){let r=typeof e==`string`?ie(e,t,n):e,i=S(({className:e,...t},n)=>x(V,{ref:n,icon:r,className:e,...t}));return r.name&&(i.displayName=oe(r.name)),i}var U={name:`bot`,size:24,node:[[`path`,{d:`M12 8V4H8`,key:`hb8ula`}],[`rect`,{width:`16`,height:`12`,x:`4`,y:`8`,rx:`2`,key:`enze0r`}],[`path`,{d:`M2 14h2`,key:`vft8re`}],[`path`,{d:`M20 14h2`,key:`4cs60a`}],[`path`,{d:`M15 13v2`,key:`1xurst`}],[`path`,{d:`M9 13v2`,key:`rq6x2g`}]]};U.node;var W=H(U),G={name:`circle-question-mark`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3`,key:`1u773s`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]],aliases:[`help-circle`,`circle-help`]};G.node;var K=H(G),q={name:`package`,size:24,node:[[`path`,{d:`M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z`,key:`1a0edw`}],[`path`,{d:`M12 22V12`,key:`d0xqtd`}],[`polyline`,{points:`3.29 7 12 12 20.71 7`,key:`ousv84`}],[`path`,{d:`m7.5 4.27 9 5.15`,key:`1c824w`}]]};q.node;var se=H(q),J={name:`pen-line`,size:24,node:[[`path`,{d:`M13 21h8`,key:`1jsn5i`}],[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}]],aliases:[`edit-3`]};J.node;var ce=H(J),Y={name:`triangle-alert`,size:24,node:[[`path`,{d:`m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3`,key:`wmoenq`}],[`path`,{d:`M12 9v4`,key:`juzpu7`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]],aliases:[`alert-triangle`]};Y.node;var le=H(Y);(function(){try{var e=typeof window<`u`?window:typeof global<`u`?global:typeof globalThis<`u`?globalThis:typeof self<`u`?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]=`16dd2d42-107f-5e31-abf9-f920f913fb2f`)}catch{}})();var ue={name:`@powerhousedao/connect`,productName:`Powerhouse-Connect`,version:`6.2.3`,description:`Powerhouse Connect`,main:`dist/index.html`,type:`module`,engines:{node:`>=24.0.0`},files:[`dist`,`style.css`,`nginx.conf`,`nginx.sh`,`scripts`,`assets`,`public`,`heroku`,`.env`],exports:{".":{source:`./start-connect.tsx`,types:`./dist/start-connect.d.ts`,import:`./dist/start-connect.js`},"./main.js":{source:`./main.tsx`,types:`./dist/main.d.ts`,import:`./dist/main.js`},"./assets/*":`./assets/*`,"./style.css":`./dist/style.css`},sideEffects:[`./dist/main.js`,`./dist/start-connect.js`,`./dist/i18n-*.js`,`./src/i18n/index.ts`,`./dist/style.css`],license:`AGPL-3.0-only`,author:`powerhouse.inc`,repository:{type:`git`,url:`https://github.com/powerhouse-inc/powerhouse`},bugs:{url:`https://github.com/powerhouse-inc/powerhouse/issues`},homepage:`https://github.com/powerhouse-inc/powerhouse#readme`,scripts:{tsc:`tsc`,lint:`cd ../.. && oxlint apps/connect`,test:`vitest --run`,dev:`vite dev`,build:`pnpm run build:bundle && pnpm run build:css`,"build:bundle":`tsdown`,"build:css":`pnpm exec tailwindcss -i style.css -o dist/style.css`,"build:debug":`cross-env PH_DEBUG_BUILD=true vite build`,preview:`vite preview`,"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_CONNECT_BASE_PATH=/develop/powerhouse/connect -e PORT=4000 connect-test-dev`},dependencies:{"@electric-sql/pglite":`catalog:`,"@electric-sql/pglite-tools":`catalog:`,"@openfeature/core":`1.9.1`,"@openfeature/web-sdk":`1.6.2`,"@openpanel/web":`^1.4.1`,"@powerhousedao/config":`workspace:*`,"@powerhousedao/design-system":`workspace:*`,"@powerhousedao/document-engineering":`catalog:`,"@powerhousedao/powerhouse-vetra-packages":`workspace:*`,"@powerhousedao/reactor":`workspace:*`,"@powerhousedao/reactor-attachments":`workspace:*`,"@powerhousedao/reactor-browser":`workspace:*`,"@powerhousedao/reactor-mcp":`workspace:*`,"@powerhousedao/shared":`workspace:*`,"@powerhousedao/vetra":`workspace:*`,"@powerhousedao/workflow":`workspace:*`,"@privy-io/react-auth":`3.35.0`,"@rainbow-me/rainbowkit":`^2.2.11`,"@renown/sdk":`workspace:*`,"@sentry/react":`^10.17.0`,"@tanstack/react-query":`^5.90.2`,"document-model":`workspace:*`,i18next:`^25.5.3`,kysely:`catalog:`,"kysely-pglite-dialect":`catalog:`,"lucide-react":`^1.16.0`,"pglite-legacy-02":`npm:@electric-sql/pglite@0.2.17`,"pglite-tools-legacy-02":`npm:@electric-sql/pglite-tools@0.2.4`,"react-error-boundary":`^4.0.11`,"react-hotkeys-hook":`^4.6.2`,"react-i18next":`^16.0.0`,"react-router-dom":`^6.11.2`,"tailwind-merge":`catalog:`,"usehooks-ts":`^3.1.1`,wagmi:`2.19.5`,zod:`catalog:`},devDependencies:{"cross-env":`catalog:`,"@tailwindcss/cli":`catalog:`,"@tailwindcss/vite":`catalog:`,"@testing-library/dom":`^10.4.0`,"@testing-library/react":`^16.0.1`,"@types/bun":`catalog:`,"@types/node":`catalog:`,"@types/react":`catalog:`,"@types/react-dom":`catalog:`,"@types/wicg-file-system-access":`^2023.10.7`,"@vitejs/plugin-react":`catalog:`,"happy-dom":`^20.8.9`,react:`catalog:`,"react-dom":`catalog:`,tailwindcss:`catalog:`,tsdown:`catalog:`,typescript:`catalog:`,vite:`catalog:`,"vite-tsconfig-paths":`catalog:`},peerDependencies:{react:`>=19.0.0`,"react-dom":`>=19.0.0`}},de=()=>l(`div`,{children:[c(te,{packageJson:ue,phCliVersion:typeof n.phCliVersion==`string`?n.phCliVersion:void 0}),c(fe,{}),c(pe,{}),l(`div`,{className:`bg-background p-3`,children:[c(`h2`,{className:`mb-2 font-semibold text-foreground`,children:`Inspector`}),c(`p`,{className:`mb-3 text-sm font-normal text-foreground`,children:`Explore the local database and sync state for debugging.`}),l(`button`,{className:`flex items-center gap-x-2 rounded-md border border-border bg-transparent px-3 py-1 text-sm font-medium text-foreground transition-colors hover:hover-effect`,onClick:()=>{d(),m({type:`inspector`})},type:`button`,children:[`Open Inspector `,c(o,{name:`CircleInfo`,size:16})]})]})]});function fe(){let e=i();if(e===`unknown`)return null;let t=a(),n=r(e);return l(`div`,{className:`bg-background p-3 text-sm`,children:[c(`span`,{className:`font-semibold`,children:`Git hash: `}),t?c(`a`,{className:`font-mono underline`,href:t,target:`_blank`,rel:`noreferrer noopener`,title:e,children:n}):c(`span`,{className:`font-mono`,title:e,children:n})]})}function pe(){let e=g()??[],t=v(),n=w(()=>e.filter(e=>t.some(t=>t.meta.collectionId.equals(u.forDrive(e.header.id)))),[e,t]);return l(`div`,{className:`my-4 bg-background p-3`,children:[c(`h2`,{className:`mb-2 font-semibold text-foreground`,children:`Connected drives`}),n.length===0?c(`p`,{className:`text-sm font-normal text-foreground`,children:`No connected remote drives.`}):c(`ul`,{className:`flex flex-col gap-3`,children:n.map(e=>c(me,{drive:e},e.header.id))})]})}function me({drive:e}){let t=h(e),n=e.state.global.name||e.header.name;return l(`li`,{className:`text-sm text-foreground`,children:[l(`div`,{className:`flex items-baseline gap-2`,children:[c(`span`,{className:`font-medium`,children:n}),t.status===`ready`&&c(`span`,{className:`text-xs text-muted-foreground`,children:t.host})]}),t.status===`loading`&&c(`div`,{className:`mt-1 text-xs text-muted-foreground`,children:`Loading…`}),t.status===`error`&&c(`div`,{className:`mt-1 text-xs text-destructive`,children:`Could not load system info`}),t.status===`ready`&&l(`div`,{className:`mt-1 text-xs text-foreground`,children:[l(`div`,{children:[c(`span`,{className:`font-medium`,children:`Version:`}),` `,t.version]}),l(`div`,{children:[c(`span`,{className:`font-medium`,children:`Git hash: `}),t.gitUrl?c(`a`,{className:`font-mono hover:underline`,href:t.gitUrl,target:`_blank`,rel:`noreferrer noopener`,title:t.gitHash,children:r(t.gitHash)}):c(`span`,{className:`font-mono`,title:t.gitHash,children:r(t.gitHash)})]})]}),t.status===`local`&&c(`div`,{className:`mt-1 text-xs text-muted-foreground`,children:`Local drive — N/A`})]})}var X=`w-full rounded-md border border-border bg-background p-2.5 text-sm text-foreground outline-none placeholder:text-muted-foreground`,he=()=>{let[e,t]=T(()=>A()),[n,r]=T({status:`idle`}),i=e=>t(t=>({...t,...e})),a=async()=>{if(M(e),!j(e)){r({status:`error`,message:`Base URL, API key and model are all required.`});return}r({status:`testing`});try{let t=e.baseUrl.trim().replace(/\/+$/,``),n=await fetch(`${t}/models`,{headers:e.apiKey.trim()?{Authorization:`Bearer ${e.apiKey.trim()}`}:void 0});if(!n.ok)throw Error(`HTTP ${n.status}${n.statusText?` ${n.statusText}`:``}`);let i=(await n.json())?.data,a=Array.isArray(i)?i.length:0;r({status:`ok`,message:a?`Connected — ${a} model(s) available.`:`Connected.`})}catch(e){r({status:`error`,message:`Connection failed: ${e instanceof Error?e.message:String(e)}`})}};return l(`div`,{className:`space-y-4 p-1`,children:[l(`div`,{children:[l(`h3`,{className:`flex items-center gap-2 text-sm font-semibold text-foreground`,children:[c(W,{size:16}),` AI Assistant`]}),c(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:`An in-page assistant that creates and changes documents, manages drives, and inspects read models through an OpenAI-compatible endpoint.`})]}),l(`label`,{className:`flex items-center gap-2 text-sm text-foreground`,children:[c(`input`,{type:`checkbox`,checked:e.enabled,onChange:e=>{i({enabled:e.target.checked}),M({enabled:e.target.checked})}}),`Enable AI assistant`]}),e.enabled&&l(`div`,{className:`space-y-2 rounded-lg border border-border p-3`,children:[c(`div`,{className:`mb-1 text-xs font-semibold tracking-wide text-muted-foreground uppercase`,children:`Endpoint`}),c(`input`,{type:`url`,placeholder:`Base URL (e.g. https://api.openai.com/v1)`,value:e.baseUrl,onChange:e=>i({baseUrl:e.target.value}),className:X,spellCheck:!1}),c(`input`,{type:`password`,placeholder:`API key`,value:e.apiKey,onChange:e=>i({apiKey:e.target.value}),className:X,autoComplete:`off`,spellCheck:!1}),c(`input`,{type:`text`,placeholder:`Model (e.g. gpt-4o-mini)`,value:e.model,onChange:e=>i({model:e.target.value}),className:X,spellCheck:!1}),l(`label`,{className:`flex items-center gap-2 pt-1 text-sm text-foreground`,children:[c(`input`,{type:`checkbox`,checked:e.autoApproveWrites,onChange:e=>i({autoApproveWrites:e.target.checked})}),`Auto-approve write actions`]}),c(`p`,{className:`text-xs text-muted-foreground`,children:`Requests go directly from this browser to the endpoint; the API key is never sent to Powerhouse servers. The endpoint must allow cross-origin (CORS) requests from this site.`}),l(`div`,{className:`flex items-center gap-3 pt-1`,children:[c(`button`,{type:`button`,onClick:()=>void a(),disabled:n.status===`testing`,className:`rounded-md bg-primary px-3 py-1.5 text-sm font-semibold text-primary-foreground hover:bg-primary/90 disabled:disabled-effect`,children:n.status===`testing`?`Testing…`:`Save & test connection`}),n.status===`ok`&&c(`span`,{className:`text-xs text-foreground`,children:n.message}),n.status===`error`&&c(`span`,{className:`text-xs text-destructive`,children:n.message})]})]})]})},Z=()=>{let e=g(),t=async e=>{await f(e.header.id),p(void 0)};return c(ne,{drives:e??[],onDeleteDrive:e=>{t(e)},onClearStorage:()=>{m({type:`clearStorage`})}})},Q=[{label:`V1`,value:`document-model-editor`},{label:`V2`,value:`document-model-editor-v2`}],ge=()=>{let[e,t]=T(Q[1]),n=C(e=>{let n=Q.find(t=>t.value==e);n&&t(n)},[]);return c(E,{documentModelEditor:e.value,setDocumentModelEditor:n,documentModelEditorOptions:Q})};function _e(e){let t=e.trim(),n=t.startsWith(`@`)?t.lastIndexOf(`@`):t.indexOf(`@`);return n>0?t.slice(0,n):t}var ve=()=>{let t=y(),{registryPackageList:n,installedPackages:r,availablePackages:i,availableHasMore:a,isLoadingAvailable:o,isLoadingMoreAvailable:l,availableError:u,ensureAvailableLoaded:d,ensureInstalledMetadataLoaded:f,fetchAvailablePage:p,loadMoreAvailable:m,setAvailableSearch:h,updateRegistryPackageStatus:g,registerFallbackRegistryPackage:_}=s();async function v(r){if(!t)return;let i=_e(r),a=n.some(e=>e.name===i),o=await t.addPackage(r);if(o.type===`success`)a?g(i,`registry-install`):_(i,o.package,t.getPackageVersion(i)??t.getPackageVersion(r),`registry-install`),e(`Package "${r}" installed successfully`,{type:`connect-success`});else{let t=o.error.message;console.error(`[Connect][PackageManager] Install failed for "${r}":`,o.error);let n=/failed to fetch|404|not found/i.test(t)?`Couldn't install "${r}". It isn't available on this registry or via npm.`:`Couldn't install "${r}". Please try again.`;e(n,{type:`error`})}}function b(n){if(t)try{t.removePackage(n),g(n,`available`),e(`Package "${n}" uninstalled successfully`,{type:`connect-success`})}catch(t){console.error(`[Connect][PackageManager] Uninstall failed for "${n}":`,t),e(`Couldn't uninstall "${n}". Please try again.`,{type:`error`})}}return c(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:c(D,{mutable:!0,installedPackages:r,availablePackages:i,isAvailableLoading:o,isLoadingMoreAvailable:l,hasMoreAvailable:a,onLoadMoreAvailable:m,availableError:u,onAvailableRetry:()=>{p({reset:!0})},onAvailableSearchChange:h,onAvailableTabOpen:d,onInstalledTabOpen:f,onInstall:v,onUninstall:b})})},$={size:16},ye=()=>{let e=_()?.type===`settings`,r=w(()=>[...n.aiAssistantEnabled?[{id:`ai-assistant`,icon:c(W,{...$}),label:`AI Assistant`,content:he}]:[],{id:`package-manager`,icon:c(se,{...$}),label:`Package Manager`,content:ve},{id:`default-editors`,icon:c(ce,{...$}),label:`Default Editors`,content:ge},{id:`danger-zone`,icon:c(le,{...$,className:`text-destructive`}),label:c(`span`,{className:`text-destructive`,children:`Danger Zone`}),content:()=>c(Z,{})},{id:`about`,icon:c(K,{...$}),label:`About`,content:de}],[]);return c(O,{open:e,title:t(`modals.connectSettings.title`),onOpenChange:e=>{if(!e)return d()},tabs:r,navFooter:c(k,{horizontal:!0})})};export{ye as SettingsModal};
|
|
2
|
-
//# sourceMappingURL=SettingsModal-CgjW-M2a-
|
|
1
|
+
import{r as e}from"./toast-C6WW-_O--BnFrYYYY.js";import{r as t}from"./i18next-CxmwyrLu.js";import{r as n}from"./connect.config-CaXMoB42-D2BeV43I.js";import{a as r,n as i,r as a}from"./build-info-BV8UtyA4-vnk7Wd-i.js";import{t as o}from"./icon-01W_S_9A-7FJRMZYN.js";import{t as s}from"./useRegistryPackages-DuoU75ap-DiEJJFe0.js";import{jsx as c,jsxs as l}from"react/jsx-runtime";import{DriveCollectionId as u,closePHModal as d,deleteDrive as f,setSelectedDrive as p,showPHModal as m,useDriveSystemInfo as h,useDrives as g,usePHModal as _,useSyncList as v,useVetraPackageManager as y}from"@powerhousedao/reactor-browser";import{createContext as b,createElement as x,forwardRef as S,useCallback as C,useContext as ee,useMemo as w,useState as T}from"react";import{About as te,DangerZone as ne,DefaultEditor as E,PackageManager as D,SettingsModal as O,ThemeSwitch as k}from"@powerhousedao/design-system/connect";import{getAiSettings as A,isAiConfigured as j,updateAiSettings as M}from"@powerhousedao/reactor-browser/ai";var re=e=>e?.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase();function ie(e,t,n=[]){if(t==null)throw Error(`[lucide]: iconNode is required when icon name is used`);return{name:re(e),size:24,node:t,...n.length>0?{aliases:n}:{}}}var ae=e=>{let t=``,n=!1;for(let r of e){if(r===`-`||r===`_`||r<=` `){n=t.length>0;continue}t.length===0?t+=r.toLowerCase():t+=n?r.toUpperCase():r,n=!1}return t},oe=e=>{let t=ae(e);return t.charAt(0).toUpperCase()+t.slice(1)},N=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),P={xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":2,"stroke-linecap":`round`,"stroke-linejoin":`round`};function F(e){return e!=null}function I(e,t={}){let n=t.attributeNames??{},r=e=>n[e]??e,i=e.size??e.width??P.width,a=e.size??e.height??P.height,o=e.aliases?.filter(e=>typeof e==`string`&&e.trim()!==``).map(e=>`lucide-${e}`)??[],s=[...e.name?[`lucide-${e.name}`]:[],...o],c=t.className?.split(` `).filter(Boolean)??[],l=t.includeDefaultClasses===!1?N(...c):N(`lucide`,...s,...c),u=t.absoluteStrokeWidth?Number(t.strokeWidth??P[`stroke-width`])*Number(e.size??e.width??P.width)/Number(t.size??t.width??P.width):t.strokeWidth??P[`stroke-width`];return[`svg`,{...Object.entries(P).reduce((e,[t,n])=>(e[r(t)]=n,e),{}),...`color`in t&&t.color&&{[r(`stroke`)]:t.color},...`size`in t&&F(t.size)&&{[r(`width`)]:t.size,[r(`height`)]:t.size},...`width`in t&&F(t.width)&&{[r(`width`)]:t.width},...`height`in t&&F(t.height)&&{[r(`height`)]:t.height},[r(`stroke-width`)]:u,...l&&{[r(`class`)]:l},[r(`viewBox`)]:`0 0 ${i} ${a}`,...t.hasA11yProp===!1?{[r(`aria-hidden`)]:`true`}:{},...`attributes`in t&&t.attributes},e.node.map(e=>{let[n,i,a]=e,o=t.nonScalingStroke?{[r(`vector-effect`)]:`non-scaling-stroke`,...i}:i;return a?[n,o,a]:[n,o]})]}function L(e,t={}){return I(e,{...t,attributeNames:{...t.attributeNames,class:`className`,"stroke-width":`strokeWidth`,"stroke-linecap":`strokeLinecap`,"stroke-linejoin":`strokeLinejoin`,"vector-effect":`vectorEffect`}})}var R=e=>{for(let t in e)if(t.startsWith(`aria-`)||t===`role`||t===`title`)return!0;return!1},z=b({}),B=()=>ee(z),V=S(({color:e,size:t,width:n,height:r,strokeWidth:i,absoluteStrokeWidth:a,nonScalingStroke:o,className:s=``,children:c,iconNode:l=[],icon:u={node:l,aliases:[],size:24},...d},f)=>{let{size:p=24,strokeWidth:m=2,absoluteStrokeWidth:h=!1,nonScalingStroke:g=!1,color:_=`currentColor`,className:v=``}=B()??{},y=!!c||R(d),[b,S,C=[]]=L(u,{color:e??_,width:n??t??p,height:r??t??p,strokeWidth:i??m,absoluteStrokeWidth:a??h,nonScalingStroke:o??g,className:N(v,s),hasA11yProp:y,attributes:d});return x(b,{ref:f,...S},[...C.map(([e,t])=>x(e,t)),...Array.isArray(c)?c:[c]])});function H(e,t=[],n=[]){let r=typeof e==`string`?ie(e,t,n):e,i=S(({className:e,...t},n)=>x(V,{ref:n,icon:r,className:e,...t}));return r.name&&(i.displayName=oe(r.name)),i}var U={name:`bot`,size:24,node:[[`path`,{d:`M12 8V4H8`,key:`hb8ula`}],[`rect`,{width:`16`,height:`12`,x:`4`,y:`8`,rx:`2`,key:`enze0r`}],[`path`,{d:`M2 14h2`,key:`vft8re`}],[`path`,{d:`M20 14h2`,key:`4cs60a`}],[`path`,{d:`M15 13v2`,key:`1xurst`}],[`path`,{d:`M9 13v2`,key:`rq6x2g`}]]};U.node;var W=H(U),G={name:`circle-question-mark`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3`,key:`1u773s`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]],aliases:[`help-circle`,`circle-help`]};G.node;var K=H(G),q={name:`package`,size:24,node:[[`path`,{d:`M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z`,key:`1a0edw`}],[`path`,{d:`M12 22V12`,key:`d0xqtd`}],[`polyline`,{points:`3.29 7 12 12 20.71 7`,key:`ousv84`}],[`path`,{d:`m7.5 4.27 9 5.15`,key:`1c824w`}]]};q.node;var se=H(q),J={name:`pen-line`,size:24,node:[[`path`,{d:`M13 21h8`,key:`1jsn5i`}],[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}]],aliases:[`edit-3`]};J.node;var ce=H(J),Y={name:`triangle-alert`,size:24,node:[[`path`,{d:`m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3`,key:`wmoenq`}],[`path`,{d:`M12 9v4`,key:`juzpu7`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]],aliases:[`alert-triangle`]};Y.node;var le=H(Y);(function(){try{var e=typeof window<`u`?window:typeof global<`u`?global:typeof globalThis<`u`?globalThis:typeof self<`u`?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]=`16dd2d42-107f-5e31-abf9-f920f913fb2f`)}catch{}})();var ue={name:`@powerhousedao/connect`,productName:`Powerhouse-Connect`,version:`6.2.3`,description:`Powerhouse Connect`,main:`dist/index.html`,type:`module`,engines:{node:`>=24.0.0`},files:[`dist`,`style.css`,`nginx.conf`,`nginx.sh`,`scripts`,`assets`,`public`,`heroku`,`.env`],exports:{".":{source:`./start-connect.tsx`,types:`./dist/start-connect.d.ts`,import:`./dist/start-connect.js`},"./main.js":{source:`./main.tsx`,types:`./dist/main.d.ts`,import:`./dist/main.js`},"./assets/*":`./assets/*`,"./style.css":`./dist/style.css`},sideEffects:[`./dist/main.js`,`./dist/start-connect.js`,`./dist/i18n-*.js`,`./src/i18n/index.ts`,`./dist/style.css`],license:`AGPL-3.0-only`,author:`powerhouse.inc`,repository:{type:`git`,url:`https://github.com/powerhouse-inc/powerhouse`},bugs:{url:`https://github.com/powerhouse-inc/powerhouse/issues`},homepage:`https://github.com/powerhouse-inc/powerhouse#readme`,scripts:{tsc:`tsc`,lint:`cd ../.. && oxlint apps/connect`,test:`vitest --run`,dev:`vite dev`,build:`pnpm run build:bundle && pnpm run build:css`,"build:bundle":`tsdown`,"build:css":`pnpm exec tailwindcss -i style.css -o dist/style.css`,"build:debug":`cross-env PH_DEBUG_BUILD=true vite build`,preview:`vite preview`,"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_CONNECT_BASE_PATH=/develop/powerhouse/connect -e PORT=4000 connect-test-dev`},dependencies:{"@electric-sql/pglite":`catalog:`,"@electric-sql/pglite-tools":`catalog:`,"@openfeature/core":`1.9.1`,"@openfeature/web-sdk":`1.6.2`,"@openpanel/web":`^1.4.1`,"@powerhousedao/config":`workspace:*`,"@powerhousedao/design-system":`workspace:*`,"@powerhousedao/document-engineering":`catalog:`,"@powerhousedao/powerhouse-vetra-packages":`workspace:*`,"@powerhousedao/reactor":`workspace:*`,"@powerhousedao/reactor-attachments":`workspace:*`,"@powerhousedao/reactor-browser":`workspace:*`,"@powerhousedao/reactor-mcp":`workspace:*`,"@powerhousedao/shared":`workspace:*`,"@powerhousedao/vetra":`workspace:*`,"@powerhousedao/workflow":`workspace:*`,"@privy-io/react-auth":`3.35.0`,"@rainbow-me/rainbowkit":`^2.2.11`,"@renown/sdk":`workspace:*`,"@sentry/react":`^10.17.0`,"@tanstack/react-query":`^5.90.2`,"document-model":`workspace:*`,i18next:`^25.5.3`,kysely:`catalog:`,"kysely-pglite-dialect":`catalog:`,"lucide-react":`^1.16.0`,"pglite-legacy-02":`npm:@electric-sql/pglite@0.2.17`,"pglite-tools-legacy-02":`npm:@electric-sql/pglite-tools@0.2.4`,"react-error-boundary":`^4.0.11`,"react-hotkeys-hook":`^4.6.2`,"react-i18next":`^16.0.0`,"react-router-dom":`^6.11.2`,"tailwind-merge":`catalog:`,"usehooks-ts":`^3.1.1`,wagmi:`2.19.5`,zod:`catalog:`},devDependencies:{"cross-env":`catalog:`,"@tailwindcss/cli":`catalog:`,"@tailwindcss/vite":`catalog:`,"@testing-library/dom":`^10.4.0`,"@testing-library/react":`^16.0.1`,"@types/bun":`catalog:`,"@types/node":`catalog:`,"@types/react":`catalog:`,"@types/react-dom":`catalog:`,"@types/wicg-file-system-access":`^2023.10.7`,"@vitejs/plugin-react":`catalog:`,"happy-dom":`^20.8.9`,react:`catalog:`,"react-dom":`catalog:`,tailwindcss:`catalog:`,tsdown:`catalog:`,typescript:`catalog:`,vite:`catalog:`,"vite-tsconfig-paths":`catalog:`},peerDependencies:{react:`>=19.0.0`,"react-dom":`>=19.0.0`}},de=()=>l(`div`,{children:[c(te,{packageJson:ue,phCliVersion:typeof n.phCliVersion==`string`?n.phCliVersion:void 0}),c(fe,{}),c(pe,{}),l(`div`,{className:`bg-background p-3`,children:[c(`h2`,{className:`mb-2 font-semibold text-foreground`,children:`Inspector`}),c(`p`,{className:`mb-3 text-sm font-normal text-foreground`,children:`Explore the local database and sync state for debugging.`}),l(`button`,{className:`flex items-center gap-x-2 rounded-md border border-border bg-transparent px-3 py-1 text-sm font-medium text-foreground transition-colors hover:hover-effect`,onClick:()=>{d(),m({type:`inspector`})},type:`button`,children:[`Open Inspector `,c(o,{name:`CircleInfo`,size:16})]})]})]});function fe(){let e=i();if(e===`unknown`)return null;let t=a(),n=r(e);return l(`div`,{className:`bg-background p-3 text-sm`,children:[c(`span`,{className:`font-semibold`,children:`Git hash: `}),t?c(`a`,{className:`font-mono underline`,href:t,target:`_blank`,rel:`noreferrer noopener`,title:e,children:n}):c(`span`,{className:`font-mono`,title:e,children:n})]})}function pe(){let e=g()??[],t=v(),n=w(()=>e.filter(e=>t.some(t=>t.meta.collectionId.equals(u.forDrive(e.header.id)))),[e,t]);return l(`div`,{className:`my-4 bg-background p-3`,children:[c(`h2`,{className:`mb-2 font-semibold text-foreground`,children:`Connected drives`}),n.length===0?c(`p`,{className:`text-sm font-normal text-foreground`,children:`No connected remote drives.`}):c(`ul`,{className:`flex flex-col gap-3`,children:n.map(e=>c(me,{drive:e},e.header.id))})]})}function me({drive:e}){let t=h(e),n=e.state.global.name||e.header.name;return l(`li`,{className:`text-sm text-foreground`,children:[l(`div`,{className:`flex items-baseline gap-2`,children:[c(`span`,{className:`font-medium`,children:n}),t.status===`ready`&&c(`span`,{className:`text-xs text-muted-foreground`,children:t.host})]}),t.status===`loading`&&c(`div`,{className:`mt-1 text-xs text-muted-foreground`,children:`Loading…`}),t.status===`error`&&c(`div`,{className:`mt-1 text-xs text-destructive`,children:`Could not load system info`}),t.status===`ready`&&l(`div`,{className:`mt-1 text-xs text-foreground`,children:[l(`div`,{children:[c(`span`,{className:`font-medium`,children:`Version:`}),` `,t.version]}),l(`div`,{children:[c(`span`,{className:`font-medium`,children:`Git hash: `}),t.gitUrl?c(`a`,{className:`font-mono hover:underline`,href:t.gitUrl,target:`_blank`,rel:`noreferrer noopener`,title:t.gitHash,children:r(t.gitHash)}):c(`span`,{className:`font-mono`,title:t.gitHash,children:r(t.gitHash)})]})]}),t.status===`local`&&c(`div`,{className:`mt-1 text-xs text-muted-foreground`,children:`Local drive — N/A`})]})}var X=`w-full rounded-md border border-border bg-background p-2.5 text-sm text-foreground outline-none placeholder:text-muted-foreground`,he=()=>{let[e,t]=T(()=>A()),[n,r]=T({status:`idle`}),i=e=>t(t=>({...t,...e})),a=async()=>{if(M(e),!j(e)){r({status:`error`,message:`Base URL, API key and model are all required.`});return}r({status:`testing`});try{let t=e.baseUrl.trim().replace(/\/+$/,``),n=await fetch(`${t}/models`,{headers:e.apiKey.trim()?{Authorization:`Bearer ${e.apiKey.trim()}`}:void 0});if(!n.ok)throw Error(`HTTP ${n.status}${n.statusText?` ${n.statusText}`:``}`);let i=(await n.json())?.data,a=Array.isArray(i)?i.length:0;r({status:`ok`,message:a?`Connected — ${a} model(s) available.`:`Connected.`})}catch(e){r({status:`error`,message:`Connection failed: ${e instanceof Error?e.message:String(e)}`})}};return l(`div`,{className:`space-y-4 p-1`,children:[l(`div`,{children:[l(`h3`,{className:`flex items-center gap-2 text-sm font-semibold text-foreground`,children:[c(W,{size:16}),` AI Assistant`]}),c(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:`An in-page assistant that creates and changes documents, manages drives, and inspects read models through an OpenAI-compatible endpoint.`})]}),l(`label`,{className:`flex items-center gap-2 text-sm text-foreground`,children:[c(`input`,{type:`checkbox`,checked:e.enabled,onChange:e=>{i({enabled:e.target.checked}),M({enabled:e.target.checked})}}),`Enable AI assistant`]}),e.enabled&&l(`div`,{className:`space-y-2 rounded-lg border border-border p-3`,children:[c(`div`,{className:`mb-1 text-xs font-semibold tracking-wide text-muted-foreground uppercase`,children:`Endpoint`}),c(`input`,{type:`url`,placeholder:`Base URL (e.g. https://api.openai.com/v1)`,value:e.baseUrl,onChange:e=>i({baseUrl:e.target.value}),className:X,spellCheck:!1}),c(`input`,{type:`password`,placeholder:`API key`,value:e.apiKey,onChange:e=>i({apiKey:e.target.value}),className:X,autoComplete:`off`,spellCheck:!1}),c(`input`,{type:`text`,placeholder:`Model (e.g. gpt-4o-mini)`,value:e.model,onChange:e=>i({model:e.target.value}),className:X,spellCheck:!1}),l(`label`,{className:`flex items-center gap-2 pt-1 text-sm text-foreground`,children:[c(`input`,{type:`checkbox`,checked:e.autoApproveWrites,onChange:e=>i({autoApproveWrites:e.target.checked})}),`Auto-approve write actions`]}),c(`p`,{className:`text-xs text-muted-foreground`,children:`Requests go directly from this browser to the endpoint; the API key is never sent to Powerhouse servers. The endpoint must allow cross-origin (CORS) requests from this site.`}),l(`div`,{className:`flex items-center gap-3 pt-1`,children:[c(`button`,{type:`button`,onClick:()=>void a(),disabled:n.status===`testing`,className:`rounded-md bg-primary px-3 py-1.5 text-sm font-semibold text-primary-foreground hover:bg-primary/90 disabled:disabled-effect`,children:n.status===`testing`?`Testing…`:`Save & test connection`}),n.status===`ok`&&c(`span`,{className:`text-xs text-foreground`,children:n.message}),n.status===`error`&&c(`span`,{className:`text-xs text-destructive`,children:n.message})]})]})]})},Z=()=>{let e=g(),t=async e=>{await f(e.header.id),p(void 0)};return c(ne,{drives:e??[],onDeleteDrive:e=>{t(e)},onClearStorage:()=>{m({type:`clearStorage`})}})},Q=[{label:`V1`,value:`document-model-editor`},{label:`V2`,value:`document-model-editor-v2`}],ge=()=>{let[e,t]=T(Q[1]),n=C(e=>{let n=Q.find(t=>t.value==e);n&&t(n)},[]);return c(E,{documentModelEditor:e.value,setDocumentModelEditor:n,documentModelEditorOptions:Q})};function _e(e){let t=e.trim(),n=t.startsWith(`@`)?t.lastIndexOf(`@`):t.indexOf(`@`);return n>0?t.slice(0,n):t}var ve=()=>{let t=y(),{registryPackageList:n,installedPackages:r,availablePackages:i,availableHasMore:a,isLoadingAvailable:o,isLoadingMoreAvailable:l,availableError:u,ensureAvailableLoaded:d,ensureInstalledMetadataLoaded:f,fetchAvailablePage:p,loadMoreAvailable:m,setAvailableSearch:h,updateRegistryPackageStatus:g,registerFallbackRegistryPackage:_}=s();async function v(r){if(!t)return;let i=_e(r),a=n.some(e=>e.name===i),o=await t.addPackage(r);if(o.type===`success`)a?g(i,`registry-install`):_(i,o.package,t.getPackageVersion(i)??t.getPackageVersion(r),`registry-install`),e(`Package "${r}" installed successfully`,{type:`connect-success`});else{let t=o.error.message;console.error(`[Connect][PackageManager] Install failed for "${r}":`,o.error);let n=/failed to fetch|404|not found/i.test(t)?`Couldn't install "${r}". It isn't available on this registry or via npm.`:`Couldn't install "${r}". Please try again.`;e(n,{type:`error`})}}function b(n){if(t)try{t.removePackage(n),g(n,`available`),e(`Package "${n}" uninstalled successfully`,{type:`connect-success`})}catch(t){console.error(`[Connect][PackageManager] Uninstall failed for "${n}":`,t),e(`Couldn't uninstall "${n}". Please try again.`,{type:`error`})}}return c(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:c(D,{mutable:!0,installedPackages:r,availablePackages:i,isAvailableLoading:o,isLoadingMoreAvailable:l,hasMoreAvailable:a,onLoadMoreAvailable:m,availableError:u,onAvailableRetry:()=>{p({reset:!0})},onAvailableSearchChange:h,onAvailableTabOpen:d,onInstalledTabOpen:f,onInstall:v,onUninstall:b})})},$={size:16},ye=()=>{let e=_()?.type===`settings`,r=w(()=>[...n.aiAssistantEnabled?[{id:`ai-assistant`,icon:c(W,{...$}),label:`AI Assistant`,content:he}]:[],{id:`package-manager`,icon:c(se,{...$}),label:`Package Manager`,content:ve},{id:`default-editors`,icon:c(ce,{...$}),label:`Default Editors`,content:ge},{id:`danger-zone`,icon:c(le,{...$,className:`text-destructive`}),label:c(`span`,{className:`text-destructive`,children:`Danger Zone`}),content:()=>c(Z,{})},{id:`about`,icon:c(K,{...$}),label:`About`,content:de}],[]);return c(O,{open:e,title:t(`modals.connectSettings.title`),onOpenChange:e=>{if(!e)return d()},tabs:r,navFooter:c(k,{horizontal:!0})})};export{ye as SettingsModal};
|
|
2
|
+
//# sourceMappingURL=SettingsModal-CgjW-M2a-DGpVrhR1.js.map
|