@powerhousedao/connect 6.0.0-dev.36 → 6.0.0-dev.38
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/assets/{AddDriveModal-CbbhwoK5.js → AddDriveModal-DQFXtw_S.js} +1 -1
- package/dist/assets/{ClearStorageModal-D9ImX_Y2.js → ClearStorageModal-Bn6Hs4x2.js} +1 -1
- package/dist/assets/{CookiesPolicyModal-DZyR4I6Q.js → CookiesPolicyModal-CJm7uquv.js} +1 -1
- package/dist/assets/{CreateDocumentModal-cuFCUL54.js → CreateDocumentModal-B9wNM9gh.js} +1 -1
- package/dist/assets/{DebugSettingsModal-VZC-kyV4.js → DebugSettingsModal-DS0GlMhY.js} +1 -1
- package/dist/assets/{DeleteDriveModal-CZ8ybNGd.js → DeleteDriveModal-Vqn89DDe.js} +1 -1
- package/dist/assets/{DeleteItemModal-C4TMzdIM.js → DeleteItemModal-DhEB9XC0.js} +1 -1
- package/dist/assets/DisclaimerModal-KImr4tMa.js +1 -0
- package/dist/assets/{DriveSettingsModal-CZUaaimi.js → DriveSettingsModal-D7fhWStQ.js} +1 -1
- package/dist/assets/{ExportDocumentWithErrorsModal-DGqH3ZUh.js → ExportDocumentWithErrorsModal-BfVDLSe2.js} +1 -1
- package/dist/assets/{SettingsModal-BAwPX5lx.js → SettingsModal-Bw1yhjJE.js} +1 -1
- package/dist/assets/UpgradeDriveModal-TdAM-Nv_.js +1 -0
- package/dist/assets/{design_system-2B9-gBoy.js → design_system-gRtxS73S.js} +1 -1
- package/dist/assets/{design_system_connect-BDSRzEbz.js → design_system_connect-BM4udPUI.js} +35 -35
- package/dist/assets/{design_system_ui-DfgQWIF6.js → design_system_ui-DDBl0KT-.js} +1 -1
- package/dist/assets/document_drive-CDoSbU60.js +132 -0
- package/dist/assets/{document_engineering-Ml4bCoxs.js → document_engineering-DrHxNTED.js} +1 -1
- package/dist/assets/{document_model-DxDgOZQk.js → document_model-Dc-BTYKH.js} +6 -6
- package/dist/assets/{document_model_editor-HMgNrWzH.js → document_model_editor-8Rt5FvRZ.js} +4 -4
- package/dist/assets/{drive_explorer-Ci_KsiFF.js → drive_explorer-CZKd_9V_.js} +2 -2
- package/dist/assets/{graphql-editor-D6R-QKan.js → graphql-editor-CbCCBvWl.js} +1 -1
- package/dist/assets/{hooks-BAkpcESF.js → hooks-gkbkNyXc.js} +1 -1
- package/dist/assets/{index-Cunlfu9j.js → index-Cy9Y2XiY.js} +2 -2
- package/dist/assets/{index-Do-t7JyC.js → index-_nvp47tf.js} +3 -3
- package/dist/assets/{json-editor-Bmu8AdkO.js → json-editor-Ddm55-9U.js} +1 -1
- package/dist/assets/nodefs-abWu13w1.js +1 -0
- package/dist/assets/{opfs-ahp-W4_dEVA8.js → opfs-ahp-CNCCHAfx.js} +1 -1
- package/dist/assets/{reactor_browser-DKT7DitQ.js → reactor_browser-DABkDW8h.js} +15 -15
- package/dist/assets/{state-schemas-CGHq7g1z.js → state-schemas-CnulJXFp.js} +2 -2
- package/dist/index.html +9 -9
- package/lib/package.copy.json +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.copy.json +1 -1
- package/package.json +10 -10
- package/dist/assets/DisclaimerModal-C5IAgg0F.js +0 -1
- package/dist/assets/UpgradeDriveModal-CqiN9g24.js +0 -1
- package/dist/assets/document_drive-CDMxtf9f.js +0 -132
- package/dist/assets/nodefs-DzwRvn5F.js +0 -1
- package/dist/assets/rwa-report-Bb0W5-ac.png +0 -0
package/package.copy.json
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@powerhousedao/connect",
|
|
3
3
|
"productName": "Powerhouse-Connect",
|
|
4
|
-
"version": "6.0.0-dev.
|
|
4
|
+
"version": "6.0.0-dev.38",
|
|
5
5
|
"description": "Powerhouse Connect",
|
|
6
6
|
"main": "dist/index.html",
|
|
7
7
|
"type": "module",
|
|
@@ -147,15 +147,15 @@
|
|
|
147
147
|
"vite-plugin-node-polyfills": "^0.24.0",
|
|
148
148
|
"vite-plugin-svgr": "^4.5.0",
|
|
149
149
|
"zod": "^4.3.5",
|
|
150
|
-
"@powerhousedao/
|
|
151
|
-
"@powerhousedao/
|
|
152
|
-
"@powerhousedao/
|
|
153
|
-
"@powerhousedao/reactor": "6.0.0-dev.
|
|
154
|
-
"@powerhousedao/
|
|
155
|
-
"@
|
|
156
|
-
"
|
|
157
|
-
"document-model": "6.0.0-dev.
|
|
158
|
-
"
|
|
150
|
+
"@powerhousedao/common": "6.0.0-dev.38",
|
|
151
|
+
"@powerhousedao/config": "6.0.0-dev.38",
|
|
152
|
+
"@powerhousedao/builder-tools": "6.0.0-dev.38",
|
|
153
|
+
"@powerhousedao/reactor": "6.0.0-dev.38",
|
|
154
|
+
"@powerhousedao/design-system": "6.0.0-dev.38",
|
|
155
|
+
"@renown/sdk": "6.0.0-dev.38",
|
|
156
|
+
"document-drive": "6.0.0-dev.38",
|
|
157
|
+
"document-model": "6.0.0-dev.38",
|
|
158
|
+
"@powerhousedao/reactor-browser": "6.0.0-dev.38"
|
|
159
159
|
},
|
|
160
160
|
"devDependencies": {
|
|
161
161
|
"@tailwindcss/cli": "^4.1.16"
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as t}from"./document_model_editor-HMgNrWzH.js";import"./sentry_react-cODD7zWc.js";import{u as i}from"./index-Do-t7JyC.js";import{a3 as m,aJ as p}from"./reactor_browser-DKT7DitQ.js";import{r as a}from"./design_system_connect-BDSRzEbz.js";import"./graphql-DwmBvzSo.js";import"./drive_explorer-Ci_KsiFF.js";import"./react/jsx-runtime-DldvXD6N.js";import"./document_model-DxDgOZQk.js";import"./zod-9j67vCAu.js";import"./react-DQSxOgtG.js";import"./design_system-2B9-gBoy.js";import"./tailwind_merge-Dr4f9Rms.js";import"./react-dom-D6zQJsh6.js";import"./sentry_browser-B4YoBIIG.js";import"./react-dom/client-BVPiT_FE.js";import"./graphql_request-G5F4jsaa.js";import"./document_drive-CDMxtf9f.js";import"./design_system_ui-DfgQWIF6.js";const E=()=>{const r=m()?.type==="disclaimer",{t:o}=i();return t.jsx(a,{open:r,header:o("modals.disclaimer.title"),body:o("modals.disclaimer.body"),closeLabel:"Close",onContinue:()=>p()})};export{E as DisclaimerModal};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as a}from"./document_model_editor-HMgNrWzH.js";import"./sentry_react-cODD7zWc.js";import{u as n}from"./index-Do-t7JyC.js";import{L as d}from"./design_system_connect-BDSRzEbz.js";import{a3 as s,aJ as t}from"./reactor_browser-DKT7DitQ.js";import"./graphql-DwmBvzSo.js";import"./drive_explorer-Ci_KsiFF.js";import"./react/jsx-runtime-DldvXD6N.js";import"./document_model-DxDgOZQk.js";import"./zod-9j67vCAu.js";import"./react-DQSxOgtG.js";import"./design_system-2B9-gBoy.js";import"./tailwind_merge-Dr4f9Rms.js";import"./react-dom-D6zQJsh6.js";import"./sentry_browser-B4YoBIIG.js";import"./react-dom/client-BVPiT_FE.js";import"./graphql_request-G5F4jsaa.js";import"./document_drive-CDMxtf9f.js";import"./design_system_ui-DfgQWIF6.js";const E=()=>{const r=s(),e=r?.type==="upgradeDrive",i=e?r.driveId:void 0,{t:o}=n(),p=()=>{console.log("Upgrade drive: ",i),t()};return a.jsx(d,{open:e,onContinue:p,header:o("modals.upgradeDrive.header"),body:o("modals.upgradeDrive.body"),cancelLabel:o("common.cancel"),continueLabel:o("common.continue"),onOpenChange:m=>{if(!m)return t()}})};export{E as UpgradeDriveModal};
|
|
@@ -1,132 +0,0 @@
|
|
|
1
|
-
import{o as v,s as c,e as $,a as _,_ as fe,d as C,u as ze,b as $e}from"./zod-9j67vCAu.js";import{c as S,a as Ve,i as Je,B as Qe,b as We,d as Ye,e as Ke,f as Xe,g as Ze,h as he,j as et,l as tt,k as rt}from"./document_model-DxDgOZQk.js";import{a as nt,p as ot,G as st}from"./graphql-DwmBvzSo.js";import{c as j,g as it}from"./react-DQSxOgtG.js";function at(e,t){for(var n=0;n<t.length;n++){const r=t[n];if(typeof r!="string"&&!Array.isArray(r)){for(const s in r)if(s!=="default"&&!(s in e)){const i=Object.getOwnPropertyDescriptor(r,s);i&&Object.defineProperty(e,s,i.get?i:{enumerable:!0,get:()=>r[s]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}const dt="phdd",ut=e=>e!=null;$e().refine(e=>ut(e));const lt=fe(["Internal","MatrixConnect","PullResponder","RESTWebhook","SecureConnect","SwitchboardPush"]),ct=fe(["PullResponder"]);function me(){return v({documentType:c(),id:c(),name:c(),parentFolder:c().nullish()})}function ye(){return v({id:c(),name:c(),parentFolder:c().nullish()})}function ge(){return v({listener:we()})}function be(){return v({trigger:Ne()})}function ve(){return v({srcId:c(),targetId:c(),targetName:c().nullish(),targetParentFolder:c().nullish()})}function Ee(){return v({id:c()})}function pt(){return v({__typename:_("DocumentDriveLocalState").optional(),availableOffline:$(),listeners:C(we()),sharingType:c().nullable(),triggers:C(Ne())})}function ft(){return v({__typename:_("DocumentDriveState").optional(),icon:c().nullable(),name:c(),nodes:C(bt())})}function ht(){return v({__typename:_("FileNode").optional(),documentType:c(),id:c(),kind:c(),name:c(),parentFolder:c().nullable()})}function mt(){return v({__typename:_("FolderNode").optional(),id:c(),kind:c(),name:c(),parentFolder:c().nullable()})}function we(){return v({__typename:_("Listener").optional(),block:$(),callInfo:yt().nullable(),filter:gt(),label:c().nullable(),listenerId:c(),system:$()})}function yt(){return v({__typename:_("ListenerCallInfo").optional(),data:c().nullable(),name:c().nullable(),transmitterType:lt.nullable()})}function gt(){return v({__typename:_("ListenerFilter").optional(),branch:C(c()).nullable(),documentId:C(c()).nullable(),documentType:C(c()),scope:C(c()).nullable()})}function Te(){return v({srcFolder:c(),targetParentFolder:c().nullish()})}function bt(){return ze([ht(),mt()])}function vt(){return v({__typename:_("PullResponderTriggerData").optional(),interval:c(),listenerId:c(),url:c()})}function Ie(){return v({listenerId:c()})}function De(){return v({triggerId:c()})}function Se(){return v({availableOffline:$()})}function Oe(){return v({icon:c()})}function Ae(){return v({name:c()})}function _e(){return v({type:c()})}function Ne(){return v({__typename:_("Trigger").optional(),data:Et().nullable(),id:c(),type:ct})}function Et(){return vt()}function Fe(){return v({documentType:c().nullish(),id:c(),name:c().nullish(),parentFolder:c().nullish()})}function Pe(){return v({id:c(),name:c().nullish(),parentFolder:c().nullish()})}function wt(e){return e&&typeof e=="object"&&"synchronizationUnits"in e?S("ADD_FILE",{...e},void 0,void 0,"global"):S("ADD_FILE",{...e},void 0,me,"global")}const Tt=e=>S("ADD_FOLDER",{...e},void 0,ye,"global"),It=e=>S("DELETE_NODE",{...e},void 0,Ee,"global"),Dt=e=>S("UPDATE_FILE",{...e},void 0,Fe,"global"),St=e=>S("UPDATE_NODE",{...e},void 0,Pe,"global"),Ot=e=>S("COPY_NODE",{...e},void 0,ve,"global"),At=e=>S("MOVE_NODE",{...e},void 0,Te,"global"),_t=e=>S("SET_DRIVE_NAME",{...e},void 0,Ae,"global"),Nt=e=>S("SET_DRIVE_ICON",{...e},void 0,Oe,"global"),Ft=e=>S("SET_SHARING_TYPE",{...e},void 0,_e,"local"),Pt=e=>S("SET_AVAILABLE_OFFLINE",{...e},void 0,Se,"local"),Rt=e=>S("ADD_LISTENER",{...e},void 0,ge,"local"),Ct=e=>S("REMOVE_LISTENER",{...e},void 0,Ie,"local"),xt=e=>S("ADD_TRIGGER",{...e},void 0,be,"local"),Lt=e=>S("REMOVE_TRIGGER",{...e},void 0,De,"local"),qt=Object.freeze(Object.defineProperty({__proto__:null,addFile:wt,addFolder:Tt,addListener:Rt,addTrigger:xt,copyNode:Ot,deleteNode:It,moveNode:At,removeListener:Ct,removeTrigger:Lt,setAvailableOffline:Pt,setDriveIcon:Nt,setDriveName:_t,setSharingType:Ft,updateFile:Dt,updateNode:St},Symbol.toStringTag,{value:"Module"})),Mt={id:"powerhouse/document-drive",name:"DocumentDrive",extension:"phdd",description:"",author:{name:"Powerhouse Inc",website:"https://www.powerhouse.inc/"},specifications:[{version:1,changeLog:[],state:{global:{schema:`type FolderNode {
|
|
2
|
-
id: String!
|
|
3
|
-
name: String!
|
|
4
|
-
kind: String!
|
|
5
|
-
parentFolder: String
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
type FileNode {
|
|
9
|
-
id: String!
|
|
10
|
-
name: String!
|
|
11
|
-
kind: String!
|
|
12
|
-
documentType: String!
|
|
13
|
-
parentFolder: String
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
union Node = FolderNode | FileNode
|
|
17
|
-
|
|
18
|
-
type DocumentDriveState {
|
|
19
|
-
name: String!
|
|
20
|
-
nodes: [Node!]!
|
|
21
|
-
icon: String
|
|
22
|
-
}`,initialValue:'"{\\"name\\":\\"\\",\\"nodes\\":[],\\"icon\\":null}"',examples:[]},local:{schema:`type ListenerFilter {
|
|
23
|
-
documentType: [String!]!
|
|
24
|
-
documentId: [ID!]
|
|
25
|
-
scope: [String!]
|
|
26
|
-
branch: [String!]
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
enum TransmitterType {
|
|
30
|
-
Internal,
|
|
31
|
-
SwitchboardPush,
|
|
32
|
-
PullResponder,
|
|
33
|
-
SecureConnect,
|
|
34
|
-
MatrixConnect,
|
|
35
|
-
RESTWebhook
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
type ListenerCallInfo {
|
|
39
|
-
transmitterType: TransmitterType
|
|
40
|
-
name: String
|
|
41
|
-
data: String
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
type Listener {
|
|
45
|
-
listenerId: ID!
|
|
46
|
-
label: String
|
|
47
|
-
block: Boolean!
|
|
48
|
-
system: Boolean!
|
|
49
|
-
filter: ListenerFilter!
|
|
50
|
-
callInfo: ListenerCallInfo
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
enum TriggerType {
|
|
54
|
-
PullResponder
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
type PullResponderTriggerData {
|
|
58
|
-
listenerId: ID!
|
|
59
|
-
url: String!
|
|
60
|
-
interval: String!
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
union TriggerData = PullResponderTriggerData
|
|
64
|
-
|
|
65
|
-
type Trigger {
|
|
66
|
-
id: ID!
|
|
67
|
-
type: TriggerType!
|
|
68
|
-
data: TriggerData
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
type DocumentDriveLocalState{
|
|
72
|
-
sharingType: String
|
|
73
|
-
listeners: [Listener!]!
|
|
74
|
-
triggers: [Trigger!]!
|
|
75
|
-
availableOffline: Boolean!
|
|
76
|
-
}`,initialValue:'"{ \\"listeners\\": [], \\"triggers\\": [], \\"sharingType\\": \\"private\\", \\"availableOffline\\": false}"',examples:[]}},modules:[{id:"GRzuvv78tBvmB6ciitokLfonNHA=",name:"Node",description:"",operations:[{id:"7xiTdxonc9yEASR8sfV/KnbSV10=",name:"ADD_FILE",description:"",schema:`input AddFileInput {
|
|
77
|
-
id: ID!
|
|
78
|
-
name: String!
|
|
79
|
-
documentType: String!
|
|
80
|
-
parentFolder: ID
|
|
81
|
-
}`,template:"",reducer:"",errors:[],examples:[],scope:"global"},{id:"4lzNMMKKdIAtEU6i12xLgi9hp+U=",name:"ADD_FOLDER",description:"",schema:`input AddFolderInput {
|
|
82
|
-
id: ID!
|
|
83
|
-
name: String!
|
|
84
|
-
parentFolder: ID
|
|
85
|
-
}`,template:"",reducer:"",errors:[],examples:[],scope:"global"},{id:"53jH2/3TWTTcgCJiv2C+BmuC6i0=",name:"DELETE_NODE",description:"",schema:`input DeleteNodeInput {
|
|
86
|
-
id: ID!
|
|
87
|
-
}`,template:"",reducer:"",errors:[],examples:[],scope:"global"},{id:"pNn+Y1/HVq/GNMk7t0u3g3gtMLE=",name:"UPDATE_FILE",description:"",schema:`input UpdateFileInput {
|
|
88
|
-
id: ID!
|
|
89
|
-
parentFolder: ID
|
|
90
|
-
name: String
|
|
91
|
-
documentType: String
|
|
92
|
-
}`,template:"",reducer:"",errors:[],examples:[],scope:"global"},{id:"P0x1M8Mnt+Q/+9nggkwgVbfybsc=",name:"UPDATE_NODE",description:"",schema:`input UpdateNodeInput {
|
|
93
|
-
id: ID!
|
|
94
|
-
parentFolder: ID
|
|
95
|
-
name: String
|
|
96
|
-
}`,template:"",reducer:"",errors:[],examples:[],scope:"global"},{id:"vnQ7OB5b3wGLgjhbgJqAIpA+JLE=",name:"COPY_NODE",description:"",schema:`input CopyNodeInput {
|
|
97
|
-
srcId: ID!
|
|
98
|
-
targetId: ID!
|
|
99
|
-
targetName: String
|
|
100
|
-
targetParentFolder: ID
|
|
101
|
-
}`,template:"",reducer:"",errors:[],examples:[],scope:"global"},{id:"VNyiD/sNGzk6k9A1Qe7s8dmrJxA=",name:"MOVE_NODE",description:"",schema:`input MoveNodeInput {
|
|
102
|
-
srcFolder: ID!
|
|
103
|
-
targetParentFolder: ID
|
|
104
|
-
}`,template:"",reducer:"",errors:[],examples:[],scope:"global"}]},{id:"0dHwHlxOM9x0vMZ+gLnKxf2qTEo=",name:"Drive",description:"",operations:[{id:"qGCiPGpTt/cyz3HzyrBn92z1dsU=",name:"SET_DRIVE_NAME",description:"",schema:`input SetDriveNameInput {
|
|
105
|
-
name: String!
|
|
106
|
-
}`,template:"",reducer:"",errors:[],examples:[],scope:"global"},{id:"qGCiPGpTt/cyz3HzyrBn92z30dsU=",name:"SET_DRIVE_ICON",description:"",schema:`input SetDriveIconInput {
|
|
107
|
-
icon: String!
|
|
108
|
-
}`,template:"",reducer:"",errors:[],examples:[],scope:"global"},{id:"qGCiPGpTt/cyz3HzyrBn92z2dsU=",name:"SET_SHARING_TYPE",description:"",schema:`input SetSharingTypeInput {
|
|
109
|
-
type: String!
|
|
110
|
-
}`,template:"",reducer:"",errors:[],examples:[],scope:"local"},{id:"qGCiPGpTt/cyz3HzyrBn92z3dsU=",name:"SET_AVAILABLE_OFFLINE",description:"",schema:`input SetAvailableOfflineInput {
|
|
111
|
-
availableOffline: Boolean!
|
|
112
|
-
}`,template:"",reducer:"",errors:[],examples:[],scope:"local"},{id:"qGCiPGpTt/cyz3HzyrBn92z9dsU=",name:"ADD_LISTENER",description:"",schema:`input AddListenerInput {
|
|
113
|
-
listener: Listener!
|
|
114
|
-
}`,template:"",reducer:"",errors:[],examples:[],scope:"local"},{id:"qGCiPGpTt/cyz3HzyrBn92z10dsU=",name:"REMOVE_LISTENER",description:"",schema:`input RemoveListenerInput {
|
|
115
|
-
listenerId: String!
|
|
116
|
-
}`,template:"",reducer:"",errors:[],examples:[],scope:"local"},{id:"qGCiPGpTt/cyz3HzyrBn92z20dsU=",name:"ADD_TRIGGER",description:"",schema:`input AddTriggerInput {
|
|
117
|
-
trigger: Trigger!
|
|
118
|
-
}`,template:"",reducer:"",errors:[],examples:[],scope:"local"},{id:"qGCiPGpTt/cyz3HzyrBn92z30dsU=",name:"REMOVE_TRIGGER",description:"",schema:`input RemoveTriggerInput {
|
|
119
|
-
triggerId: String!
|
|
120
|
-
}`,template:"",reducer:"",errors:[],examples:[],scope:"local"}]}]}]},Re="powerhouse/document-drive",F={setDriveNameOperation(e,t,n){e.name=t.input.name},setDriveIconOperation(e,t,n){e.icon=t.input.icon},setSharingTypeOperation(e,t,n){e.sharingType=t.input.type},setAvailableOfflineOperation(e,t,n){e.availableOffline=t.input.availableOffline},addListenerOperation(e,t,n){if(e.listeners.find(r=>r.listenerId===t.input.listener.listenerId))throw new Error(`A listener with Id: ${t.input.listener.listenerId} already exists`);e.listeners.push(t.input.listener)},removeListenerOperation(e,t,n){e.listeners=e.listeners.filter(r=>r.listenerId!==t.input.listenerId)},addTriggerOperation(e,t,n){if(e.triggers.find(r=>r.id===t.input.trigger.id))throw new Error(`A trigger with Id: ${t.input.trigger.id} already exists`);e.triggers.push(t.input.trigger)},removeTriggerOperation(e,t,n){e.triggers=e.triggers.filter(r=>r.id!==t.input.triggerId)}};function ie(e){return e.kind==="file"}function Bt(e){return e.kind==="folder"}function V(e,t){const n=t.filter(s=>s.parentFolder===e.id),r=n.map(s=>V(s,t));return[...n,...r.flat()]}function Sr(e,t,n){const r=n.find(d=>d.id===e.srcId);if(!r)throw new Error(`Node with id ${e.srcId} not found`);const s=[{...r,name:e.targetName||r.name,parentFolder:e.targetParentFolder||null},...V(r,n)],i={};e.targetParentFolder&&(i[e.targetParentFolder]=e.targetParentFolder);const l=d=>{let f=i[d.id];if(!f){const g=d.id;f=t(d),i[g]=f}return f};return s.map(d=>({srcId:d.id,targetId:l(d),targetName:d.name,targetParentFolder:d.parentFolder?i[d.parentFolder]:null}))}function Ut(e,t){let n=0;const r=new RegExp(`^${Ht(t)} \\(copy\\)(?: (\\d+))?$`);for(const s of e){const i=s.match(r);if(i){const l=i[1]?parseInt(i[1],10):1;l>n&&(n=l)}}return n+1}function Ht(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function x(e){const{nodes:t,targetParentFolder:n,srcName:r}=e,s=t.filter(u=>n===""?u.parentFolder===null:u.parentFolder===n).map(u=>u.name);return s.includes(r)?`${r} (copy) ${Ut(s,r)}`:r}const k=e=>/^[a-zA-Z0-9-_.\s()]+$/.test(e),R={addFileOperation(e,t,n){if(e.nodes.find(i=>i.id===t.input.id))throw new Error(`Node with id ${t.input.id} already exists!`);if(!k(t.input.name))throw new Error(`Invalid name: '${t.input.name}'. Names must be valid URL characters.`);const r=x({nodes:e.nodes,srcName:t.input.name,targetParentFolder:t.input.parentFolder||null}),s={id:t.input.id,name:r,kind:"file",parentFolder:t.input.parentFolder??null,documentType:t.input.documentType};e.nodes.push(s),e.nodes.sort((i,l)=>i.id.localeCompare(l.id)),n?.({type:"CREATE_CHILD_DOCUMENT",input:{id:t.input.id,documentType:t.input.documentType}})},addFolderOperation(e,t){if(e.nodes.find(r=>r.id===t.input.id))throw new Error(`Node with id ${t.input.id} already exists!`);if(!k(t.input.name))throw new Error(`Invalid name: '${t.input.name}'. Names must be valid URL characters.`);const n=x({nodes:e.nodes,srcName:t.input.name,targetParentFolder:t.input.parentFolder||null});e.nodes.push({...t.input,name:n,kind:"folder",parentFolder:t.input.parentFolder??null}),e.nodes.sort((r,s)=>r.id.localeCompare(s.id))},deleteNodeOperation(e,t,n){const r=e.nodes.find(i=>i.id===t.input.id);if(!r)throw new Error(`Node with id ${t.input.id} not found`);const s=V(r,e.nodes);e.nodes=e.nodes.filter(i=>i.id!==t.input.id&&!s.find(l=>l.id===i.id)),[r,...s].filter(i=>ie(i)).forEach(i=>{n?.({type:"DELETE_CHILD_DOCUMENT",input:{id:i.id}})})},updateFileOperation(e,t){if(t.input.name&&!k(t.input.name))throw new Error(`Invalid name: '${t.input.name}'. Names must be valid URL characters.`);e.nodes=e.nodes.map(n=>n.id===t.input.id?{...n,name:x({nodes:e.nodes,srcName:t.input.name??n.name,targetParentFolder:t.input.parentFolder||null}),documentType:t.input.documentType??n.documentType}:n),e.nodes.sort((n,r)=>n.id.localeCompare(r.id))},updateNodeOperation(e,t){if(t.input.name&&!k(t.input.name))throw new Error(`Invalid name: '${t.input.name}'. Names must be valid URL characters.`);e.nodes=e.nodes.map(n=>n.id===t.input.id?{...n,name:x({nodes:e.nodes,srcName:t.input.name??n.name,targetParentFolder:t.input.parentFolder||null}),parentFolder:t.input.parentFolder===null?null:n.parentFolder}:n),e.nodes.sort((n,r)=>n.id.localeCompare(r.id))},copyNodeOperation(e,t,n){const r=e.nodes.find(d=>d.id===t.input.srcId);if(!r)throw new Error(`Node with id ${t.input.srcId} not found`);if(e.nodes.find(d=>d.id===t.input.targetId))throw new Error(`Node with id ${t.input.targetId} already exists`);const i=x({nodes:e.nodes,srcName:t.input.targetName||r.name,targetParentFolder:t.input.targetParentFolder||null}),l={...r,id:t.input.targetId,slug:t.input.targetId,name:i,parentFolder:t.input.targetParentFolder||null};e.nodes.push(l),e.nodes.sort((d,f)=>d.id.localeCompare(f.id)),ie(l)&&n?.({type:"COPY_CHILD_DOCUMENT",input:{id:t.input.srcId,newId:t.input.targetId}})},moveNodeOperation(e,t){if(t.input.srcFolder===t.input.targetParentFolder)throw new Error("Circular Reference Error: Attempting to move a node to its current parent folder");const n=e.nodes.find(s=>s.id===t.input.srcFolder);if(!n)throw new Error(`Node with id ${t.input.srcFolder} not found`);const r=x({nodes:e.nodes,srcName:n.name,targetParentFolder:t.input.targetParentFolder||null});if(Bt(n)&&V(n,e.nodes).find(i=>i.id===t.input.targetParentFolder))throw new Error("Circular Reference Error: Cannot move a folder to one of its descendants");e.nodes=e.nodes.map(s=>s.id===t.input.srcFolder?{...s,name:r,parentFolder:t.input.targetParentFolder||null}:s),e.nodes.sort((s,i)=>s.id.localeCompare(i.id))}},jt=(e,t,n)=>{if(Je(t))return e;const r=t;switch(r.type){case"ADD_FILE":me().parse(r.input),R.addFileOperation(e[r.scope],t,n);break;case"ADD_FOLDER":ye().parse(r.input),R.addFolderOperation(e[r.scope],t,n);break;case"DELETE_NODE":Ee().parse(r.input),R.deleteNodeOperation(e[r.scope],t,n);break;case"UPDATE_FILE":Fe().parse(r.input),R.updateFileOperation(e[r.scope],t,n);break;case"UPDATE_NODE":Pe().parse(r.input),R.updateNodeOperation(e[r.scope],t,n);break;case"COPY_NODE":ve().parse(r.input),R.copyNodeOperation(e[r.scope],t,n);break;case"MOVE_NODE":Te().parse(r.input),R.moveNodeOperation(e[r.scope],t,n);break;case"SET_DRIVE_NAME":Ae().parse(r.input),F.setDriveNameOperation(e[r.scope],t,n);break;case"SET_DRIVE_ICON":Oe().parse(r.input),F.setDriveIconOperation(e[r.scope],t,n);break;case"SET_SHARING_TYPE":_e().parse(r.input),F.setSharingTypeOperation(e[r.scope],t,n);break;case"SET_AVAILABLE_OFFLINE":Se().parse(r.input),F.setAvailableOfflineOperation(e[r.scope],t,n);break;case"ADD_LISTENER":ge().parse(r.input),F.addListenerOperation(e[r.scope],t,n);break;case"REMOVE_LISTENER":Ie().parse(r.input),F.removeListenerOperation(e[r.scope],t,n);break;case"ADD_TRIGGER":be().parse(r.input),F.addTriggerOperation(e[r.scope],t,n);break;case"REMOVE_TRIGGER":De().parse(r.input),F.removeTriggerOperation(e[r.scope],t,n);break;default:return e}},Ce=Ve(jt),kt=We.extend({documentType:_(Re)}),J=Qe.extend({global:ft(),local:pt()}),xe=v({header:kt,state:J,initialState:J});function Gt(e){return J.safeParse(e).success}function zt(e){J.parse(e)}function $t(e){return xe.safeParse(e).success}function Vt(e){xe.parse(e)}const Jt={name:"",nodes:[],icon:null},Qt={listeners:[],triggers:[],sharingType:"private",availableOffline:!1},Le=e=>({...he(),global:{...Jt,...e?.global},local:{...Qt,...e?.local}}),Wt=e=>{const t=Xe(Le,e);return t.header.documentType=Re,t.header.id=Ze(),t},Yt=(e,t)=>Ye(e,t),Kt=e=>Ke(e,Ce),Xt=e=>Gt(e),Zt=e=>{zt(e)},er=e=>$t(e),tr=e=>{Vt(e)},Or={actions:qt,reducer:Ce,documentModel:et(he(),Mt),utils:{fileExtension:dt,createState:Le,createDocument:Wt,loadFromInput:Kt,saveToFileHandle:Yt,isStateOfType:Xt,assertIsStateOfType:Zt,isDocumentOfType:er,assertIsDocumentOfType:tr}};class Ar extends Error{id;constructor(t,n){super(`Document model "${t}" not found`,{cause:n}),this.id=t}}class rr extends Error{status;operation;constructor(t,n,r,s){super(r,{cause:s??n}),this.status=t,this.operation=n,s instanceof Error&&(this.stack=s.stack)}}var Q;(function(e){e.ID="id",e.SLUG="slug"})(Q||(Q={}));class ae extends Error{documentId;constructor(t,n=Q.ID){super(`Document (${t}) uses ${n} that already exists`),this.documentId=t}}class q extends Error{documentId;constructor(t){super(`Document with id ${t} not found`),this.documentId=t}}function de(e,t){const n=Object.keys(e).reduce((s,i)=>{const l=i,u=e[l];return s[l]=u?.at(-1)?.index??0,s},{}),r=t.find(s=>s.index<(n[s.action.scope]??0));if(r)throw new rr("ERROR",r,`Tried to add operation with index ${r.index} and document is at index ${n[r.action.scope]}`);return t.sort((s,i)=>s.index-i.index).reduce((s,i)=>{const l=s[i.action.scope]||[];return{...s,[i.action.scope]:[...l,i]}},e)}function X(e){const t=e?.at(-1);return t?t.index+1:0}const re=JSON,nr=e=>e.toUpperCase(),or=e=>{const t={};return e.forEach((n,r)=>{t[r]=n}),t},sr=(e,t,n)=>e.document?e:{document:e,variables:t,requestHeaders:n,signal:void 0},ir=(e,t,n)=>e.query?e:{query:e,variables:t,requestHeaders:n,signal:void 0},ar=(e,t)=>e.documents?e:{documents:e,requestHeaders:t,signal:void 0},ue=e=>{let t;const n=e.definitions.filter(r=>r.kind==="OperationDefinition");return n.length===1&&(t=n[0]?.name?.value),t},Z=e=>{if(typeof e=="string"){let n;try{const r=nt(e);n=ue(r)}catch{}return{query:e,operationName:n}}const t=ue(e);return{query:ot(e),operationName:t}};class B extends Error{constructor(t,n){const r=`${B.extractMessage(t)}: ${JSON.stringify({response:t,request:n})}`;super(r),Object.setPrototypeOf(this,B.prototype),this.response=t,this.request=n,typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,B)}static extractMessage(t){return t.errors?.[0]?.message??`GraphQL Error (Code: ${t.status})`}}var G={exports:{}},le;function dr(){return le||(le=1,(function(e,t){var n=typeof globalThis<"u"&&globalThis||typeof self<"u"&&self||typeof j<"u"&&j,r=(function(){function i(){this.fetch=!1,this.DOMException=n.DOMException}return i.prototype=n,new i})();(function(i){(function(l){var u=typeof i<"u"&&i||typeof self<"u"&&self||typeof j<"u"&&j||{},d={searchParams:"URLSearchParams"in u,iterable:"Symbol"in u&&"iterator"in Symbol,blob:"FileReader"in u&&"Blob"in u&&(function(){try{return new Blob,!0}catch{return!1}})(),formData:"FormData"in u,arrayBuffer:"ArrayBuffer"in u};function f(o){return o&&DataView.prototype.isPrototypeOf(o)}if(d.arrayBuffer)var g=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],T=ArrayBuffer.isView||function(o){return o&&g.indexOf(Object.prototype.toString.call(o))>-1};function E(o){if(typeof o!="string"&&(o=String(o)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(o)||o==="")throw new TypeError('Invalid character in header field name: "'+o+'"');return o.toLowerCase()}function b(o){return typeof o!="string"&&(o=String(o)),o}function I(o){var a={next:function(){var p=o.shift();return{done:p===void 0,value:p}}};return d.iterable&&(a[Symbol.iterator]=function(){return a}),a}function h(o){this.map={},o instanceof h?o.forEach(function(a,p){this.append(p,a)},this):Array.isArray(o)?o.forEach(function(a){if(a.length!=2)throw new TypeError("Headers constructor: expected name/value pair to be length 2, found"+a.length);this.append(a[0],a[1])},this):o&&Object.getOwnPropertyNames(o).forEach(function(a){this.append(a,o[a])},this)}h.prototype.append=function(o,a){o=E(o),a=b(a);var p=this.map[o];this.map[o]=p?p+", "+a:a},h.prototype.delete=function(o){delete this.map[E(o)]},h.prototype.get=function(o){return o=E(o),this.has(o)?this.map[o]:null},h.prototype.has=function(o){return this.map.hasOwnProperty(E(o))},h.prototype.set=function(o,a){this.map[E(o)]=b(a)},h.prototype.forEach=function(o,a){for(var p in this.map)this.map.hasOwnProperty(p)&&o.call(a,this.map[p],p,this)},h.prototype.keys=function(){var o=[];return this.forEach(function(a,p){o.push(p)}),I(o)},h.prototype.values=function(){var o=[];return this.forEach(function(a){o.push(a)}),I(o)},h.prototype.entries=function(){var o=[];return this.forEach(function(a,p){o.push([p,a])}),I(o)},d.iterable&&(h.prototype[Symbol.iterator]=h.prototype.entries);function O(o){if(!o._noBody){if(o.bodyUsed)return Promise.reject(new TypeError("Already read"));o.bodyUsed=!0}}function U(o){return new Promise(function(a,p){o.onload=function(){a(o.result)},o.onerror=function(){p(o.error)}})}function qe(o){var a=new FileReader,p=U(a);return a.readAsArrayBuffer(o),p}function Me(o){var a=new FileReader,p=U(a),y=/charset=([A-Za-z0-9_-]+)/.exec(o.type),w=y?y[1]:"utf-8";return a.readAsText(o,w),p}function Be(o){for(var a=new Uint8Array(o),p=new Array(a.length),y=0;y<a.length;y++)p[y]=String.fromCharCode(a[y]);return p.join("")}function ne(o){if(o.slice)return o.slice(0);var a=new Uint8Array(o.byteLength);return a.set(new Uint8Array(o)),a.buffer}function oe(){return this.bodyUsed=!1,this._initBody=function(o){this.bodyUsed=this.bodyUsed,this._bodyInit=o,o?typeof o=="string"?this._bodyText=o:d.blob&&Blob.prototype.isPrototypeOf(o)?this._bodyBlob=o:d.formData&&FormData.prototype.isPrototypeOf(o)?this._bodyFormData=o:d.searchParams&&URLSearchParams.prototype.isPrototypeOf(o)?this._bodyText=o.toString():d.arrayBuffer&&d.blob&&f(o)?(this._bodyArrayBuffer=ne(o.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):d.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(o)||T(o))?this._bodyArrayBuffer=ne(o):this._bodyText=o=Object.prototype.toString.call(o):(this._noBody=!0,this._bodyText=""),this.headers.get("content-type")||(typeof o=="string"?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):d.searchParams&&URLSearchParams.prototype.isPrototypeOf(o)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},d.blob&&(this.blob=function(){var o=O(this);if(o)return o;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))}),this.arrayBuffer=function(){if(this._bodyArrayBuffer){var o=O(this);return o||(ArrayBuffer.isView(this._bodyArrayBuffer)?Promise.resolve(this._bodyArrayBuffer.buffer.slice(this._bodyArrayBuffer.byteOffset,this._bodyArrayBuffer.byteOffset+this._bodyArrayBuffer.byteLength)):Promise.resolve(this._bodyArrayBuffer))}else{if(d.blob)return this.blob().then(qe);throw new Error("could not read as ArrayBuffer")}},this.text=function(){var o=O(this);if(o)return o;if(this._bodyBlob)return Me(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(Be(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},d.formData&&(this.formData=function(){return this.text().then(je)}),this.json=function(){return this.text().then(JSON.parse)},this}var Ue=["CONNECT","DELETE","GET","HEAD","OPTIONS","PATCH","POST","PUT","TRACE"];function He(o){var a=o.toUpperCase();return Ue.indexOf(a)>-1?a:o}function N(o,a){if(!(this instanceof N))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');a=a||{};var p=a.body;if(o instanceof N){if(o.bodyUsed)throw new TypeError("Already read");this.url=o.url,this.credentials=o.credentials,a.headers||(this.headers=new h(o.headers)),this.method=o.method,this.mode=o.mode,this.signal=o.signal,!p&&o._bodyInit!=null&&(p=o._bodyInit,o.bodyUsed=!0)}else this.url=String(o);if(this.credentials=a.credentials||this.credentials||"same-origin",(a.headers||!this.headers)&&(this.headers=new h(a.headers)),this.method=He(a.method||this.method||"GET"),this.mode=a.mode||this.mode||null,this.signal=a.signal||this.signal||(function(){if("AbortController"in u){var m=new AbortController;return m.signal}})(),this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&p)throw new TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(p),(this.method==="GET"||this.method==="HEAD")&&(a.cache==="no-store"||a.cache==="no-cache")){var y=/([?&])_=[^&]*/;if(y.test(this.url))this.url=this.url.replace(y,"$1_="+new Date().getTime());else{var w=/\?/;this.url+=(w.test(this.url)?"&":"?")+"_="+new Date().getTime()}}}N.prototype.clone=function(){return new N(this,{body:this._bodyInit})};function je(o){var a=new FormData;return o.trim().split("&").forEach(function(p){if(p){var y=p.split("="),w=y.shift().replace(/\+/g," "),m=y.join("=").replace(/\+/g," ");a.append(decodeURIComponent(w),decodeURIComponent(m))}}),a}function ke(o){var a=new h,p=o.replace(/\r?\n[\t ]+/g," ");return p.split("\r").map(function(y){return y.indexOf(`
|
|
121
|
-
`)===0?y.substr(1,y.length):y}).forEach(function(y){var w=y.split(":"),m=w.shift().trim();if(m){var H=w.join(":").trim();try{a.append(m,H)}catch(K){console.warn("Response "+K.message)}}}),a}oe.call(N.prototype);function A(o,a){if(!(this instanceof A))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');if(a||(a={}),this.type="default",this.status=a.status===void 0?200:a.status,this.status<200||this.status>599)throw new RangeError("Failed to construct 'Response': The status provided (0) is outside the range [200, 599].");this.ok=this.status>=200&&this.status<300,this.statusText=a.statusText===void 0?"":""+a.statusText,this.headers=new h(a.headers),this.url=a.url||"",this._initBody(o)}oe.call(A.prototype),A.prototype.clone=function(){return new A(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new h(this.headers),url:this.url})},A.error=function(){var o=new A(null,{status:200,statusText:""});return o.ok=!1,o.status=0,o.type="error",o};var Ge=[301,302,303,307,308];A.redirect=function(o,a){if(Ge.indexOf(a)===-1)throw new RangeError("Invalid status code");return new A(null,{status:a,headers:{location:o}})},l.DOMException=u.DOMException;try{new l.DOMException}catch{l.DOMException=function(a,p){this.message=a,this.name=p;var y=Error(a);this.stack=y.stack},l.DOMException.prototype=Object.create(Error.prototype),l.DOMException.prototype.constructor=l.DOMException}function Y(o,a){return new Promise(function(p,y){var w=new N(o,a);if(w.signal&&w.signal.aborted)return y(new l.DOMException("Aborted","AbortError"));var m=new XMLHttpRequest;function H(){m.abort()}m.onload=function(){var D={statusText:m.statusText,headers:ke(m.getAllResponseHeaders()||"")};w.url.indexOf("file://")===0&&(m.status<200||m.status>599)?D.status=200:D.status=m.status,D.url="responseURL"in m?m.responseURL:D.headers.get("X-Request-URL");var P="response"in m?m.response:m.responseText;setTimeout(function(){p(new A(P,D))},0)},m.onerror=function(){setTimeout(function(){y(new TypeError("Network request failed"))},0)},m.ontimeout=function(){setTimeout(function(){y(new TypeError("Network request timed out"))},0)},m.onabort=function(){setTimeout(function(){y(new l.DOMException("Aborted","AbortError"))},0)};function K(D){try{return D===""&&u.location.href?u.location.href:D}catch{return D}}if(m.open(w.method,K(w.url),!0),w.credentials==="include"?m.withCredentials=!0:w.credentials==="omit"&&(m.withCredentials=!1),"responseType"in m&&(d.blob?m.responseType="blob":d.arrayBuffer&&(m.responseType="arraybuffer")),a&&typeof a.headers=="object"&&!(a.headers instanceof h||u.Headers&&a.headers instanceof u.Headers)){var se=[];Object.getOwnPropertyNames(a.headers).forEach(function(D){se.push(E(D)),m.setRequestHeader(D,b(a.headers[D]))}),w.headers.forEach(function(D,P){se.indexOf(P)===-1&&m.setRequestHeader(P,D)})}else w.headers.forEach(function(D,P){m.setRequestHeader(P,D)});w.signal&&(w.signal.addEventListener("abort",H),m.onreadystatechange=function(){m.readyState===4&&w.signal.removeEventListener("abort",H)}),m.send(typeof w._bodyInit>"u"?null:w._bodyInit)})}return Y.polyfill=!0,u.fetch||(u.fetch=Y,u.Headers=h,u.Request=N,u.Response=A),l.Headers=h,l.Request=N,l.Response=A,l.fetch=Y,Object.defineProperty(l,"__esModule",{value:!0}),l})({})})(r),r.fetch.ponyfill=!0,delete r.fetch.polyfill;var s=n.fetch?n:r;t=s.fetch,t.default=s.fetch,t.fetch=s.fetch,t.Headers=s.Headers,t.Request=s.Request,t.Response=s.Response,e.exports=t})(G,G.exports)),G.exports}var W=dr();const z=it(W),ur=at({__proto__:null,default:z},[W]),L=e=>{let t={};return e&&(typeof Headers<"u"&&e instanceof Headers||ur&&W.Headers&&e instanceof W.Headers?t=or(e):Array.isArray(e)?e.forEach(([n,r])=>{n&&r!==void 0&&(t[n]=r)}):t=e),t},ce=e=>e.replace(/([\s,]|#[^\n\r]+)+/g," ").trim(),lr=e=>{if(!Array.isArray(e.query)){const r=e,s=[`query=${encodeURIComponent(ce(r.query))}`];return e.variables&&s.push(`variables=${encodeURIComponent(r.jsonSerializer.stringify(r.variables))}`),r.operationName&&s.push(`operationName=${encodeURIComponent(r.operationName)}`),s.join("&")}if(typeof e.variables<"u"&&!Array.isArray(e.variables))throw new Error("Cannot create query with given variable type, array expected");const t=e,n=e.query.reduce((r,s,i)=>(r.push({query:ce(s),variables:t.variables?t.jsonSerializer.stringify(t.variables[i]):void 0}),r),[]);return`query=${encodeURIComponent(t.jsonSerializer.stringify(n))}`},cr=e=>async t=>{const{url:n,query:r,variables:s,operationName:i,fetch:l,fetchOptions:u,middleware:d}=t,f={...t.headers};let g="",T;e==="POST"?(T=fr(r,s,i,u.jsonSerializer),typeof T=="string"&&(f["Content-Type"]="application/json")):g=lr({query:r,variables:s,operationName:i,jsonSerializer:u.jsonSerializer??re});const E={method:e,headers:f,body:T,...u};let b=n,I=E;if(d){const h=await Promise.resolve(d({...E,url:n,operationName:i,variables:s})),{url:O,...U}=h;b=O,I=U}return g&&(b=`${b}?${g}`),await l(b,I)};class pr{constructor(t,n={}){this.url=t,this.requestConfig=n,this.rawRequest=async(...r)=>{const[s,i,l]=r,u=ir(s,i,l),{headers:d,fetch:f=z,method:g="POST",requestMiddleware:T,responseMiddleware:E,...b}=this.requestConfig,{url:I}=this;u.signal!==void 0&&(b.signal=u.signal);const{operationName:h}=Z(u.query);return ee({url:I,query:u.query,variables:u.variables,headers:{...L(te(d)),...L(u.requestHeaders)},operationName:h,fetch:f,method:g,fetchOptions:b,middleware:T}).then(O=>(E&&E(O),O)).catch(O=>{throw E&&E(O),O})}}async request(t,...n){const[r,s]=n,i=sr(t,r,s),{headers:l,fetch:u=z,method:d="POST",requestMiddleware:f,responseMiddleware:g,...T}=this.requestConfig,{url:E}=this;i.signal!==void 0&&(T.signal=i.signal);const{query:b,operationName:I}=Z(i.document);return ee({url:E,query:b,variables:i.variables,headers:{...L(te(l)),...L(i.requestHeaders)},operationName:I,fetch:u,method:d,fetchOptions:T,middleware:f}).then(h=>(g&&g(h),h.data)).catch(h=>{throw g&&g(h),h})}batchRequests(t,n){const r=ar(t,n),{headers:s,...i}=this.requestConfig;r.signal!==void 0&&(i.signal=r.signal);const l=r.documents.map(({document:d})=>Z(d).query),u=r.documents.map(({variables:d})=>d);return ee({url:this.url,query:l,variables:u,headers:{...L(te(s)),...L(r.requestHeaders)},operationName:void 0,fetch:this.requestConfig.fetch??z,method:this.requestConfig.method||"POST",fetchOptions:i,middleware:this.requestConfig.requestMiddleware}).then(d=>(this.requestConfig.responseMiddleware&&this.requestConfig.responseMiddleware(d),d.data)).catch(d=>{throw this.requestConfig.responseMiddleware&&this.requestConfig.responseMiddleware(d),d})}setHeaders(t){return this.requestConfig.headers=t,this}setHeader(t,n){const{headers:r}=this.requestConfig;return r?r[t]=n:this.requestConfig.headers={[t]:n},this}setEndpoint(t){return this.url=t,this}}const ee=async e=>{const{query:t,variables:n,fetchOptions:r}=e,s=cr(nr(e.method??"post")),i=Array.isArray(e.query),l=await s(e),u=await hr(l,r.jsonSerializer??re),d=Array.isArray(u)?!u.some(({data:g})=>!g):!!u.data,f=Array.isArray(u)||!u.errors||Array.isArray(u.errors)&&!u.errors.length||r.errorPolicy==="all"||r.errorPolicy==="ignore";if(l.ok&&f&&d){const{errors:g,...T}=(Array.isArray(u),u),E=r.errorPolicy==="ignore"?T:u;return{...i?{data:E}:E,headers:l.headers,status:l.status}}else{const g=typeof u=="string"?{error:u}:u;throw new B({...g,status:l.status,headers:l.headers},{query:t,variables:n})}},fr=(e,t,n,r)=>{const s=r??re;if(!Array.isArray(e))return s.stringify({query:e,variables:t,operationName:n});if(typeof t<"u"&&!Array.isArray(t))throw new Error("Cannot create request body with given variable type, array expected");const i=e.reduce((l,u,d)=>(l.push({query:u,variables:t?t[d]:void 0}),l),[]);return s.stringify(i)},hr=async(e,t)=>{let n;return e.headers.forEach((r,s)=>{s.toLowerCase()==="content-type"&&(n=r)}),n&&(n.toLowerCase().startsWith("application/json")||n.toLowerCase().startsWith("application/graphql+json")||n.toLowerCase().startsWith("application/graphql-response+json"))?t.parse(await e.text()):e.text()},te=e=>typeof e=="function"?e():e,mr=(e,...t)=>e.reduce((n,r,s)=>`${n}${r}${s in t?String(t[s]):""}`,"");async function yr(e,t,n,r){const s=new pr(e,{fetch,headers:r||{}}),{errors:i,...l}=await s.request(t,n),u={...l};return i?.length&&(u.errors=i.map(({message:d,...f})=>new st(d,f))),u}async function _r(e,t){const n=e.split("/").pop()??"",r=new URL(e),s=`${r.protocol}//${r.host}/graphql/r`;let i;try{const l=await yr(s,mr`
|
|
122
|
-
query getDocument($identifier: String!) {
|
|
123
|
-
document(identifier: $identifier) {
|
|
124
|
-
document {
|
|
125
|
-
id
|
|
126
|
-
name
|
|
127
|
-
slug
|
|
128
|
-
state
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
`,{identifier:n},t);if(l.errors?.length||!l.document?.document)throw l.errors?.at(0)??new Error("Drive not found");const u=l.document.document,d=u.state.global;i={id:u.id,name:u.name,slug:u.slug??"",icon:d?.icon,meta:d?.meta}}catch(l){throw tt.error("@error",l),new Error("Couldn't find drive info")}return i}function gr(e){return["LOCAL","CLOUD","PUBLIC"].includes(e)}function Nr(e){if(typeof e!="object")return"LOCAL";const t="readContext"in e,{sharingType:n}=t?{sharingType:"PUBLIC"}:e.state.local,r=n?.toUpperCase();return!r||r==="PRIVATE"||!gr(r)?"LOCAL":r}class pe extends Error{constructor(t){super(t||"Aborted"),this.name="AbortError"}}const M=e=>e&&e.length>0&&!e.includes("*")?new Set(e):null,br=e=>({parentId:M(e.parentId),documentId:M(e.documentId),documentModelType:M(e.documentModelType),scope:M(e.scope),branch:M(e.branch)}),vr=(e,...t)=>{const n=new Set(e);for(const r of t)for(const s of r)n.add(s);return n},Er=(e,t)=>{const n=new Set;for(const r of e)t.has(r)&&n.add(r);return n};class Fr{logger=rt(["MemoryStorage"]);documents;driveManifests;slugToDocumentId;constructor(){this.documents={},this.driveManifests={},this.slugToDocumentId={}}resolveIds(t,n){const r=[];for(const s of t){const i=this.slugToDocumentId[s];if(!i)throw new q(s);r.push(i)}if(n?.aborted)throw new pe("Aborted");return Promise.resolve(r)}resolveSlugs(t,n){const r=[];for(const s of t){const i=this.documents[s];if(!i)throw new q(s);r.push(i.header.slug)}if(n?.aborted)throw new pe("Aborted");return Promise.resolve(r)}exists(t){return Promise.resolve(!!this.documents[t])}create(t){const n=t.header.id;if(this.documents[n])throw new ae(n);const r=t.header.slug?.length>0?t.header.slug:n;if(r&&this.slugToDocumentId[r])throw new ae(n,Q.SLUG);return t.header.slug=r,this.documents[n]=t,r&&(this.slugToDocumentId[r]=n),t.header.documentType==="powerhouse/document-drive"&&this.updateDriveManifest(n,{documentIds:new Set}),Promise.resolve()}get(t){const n=this.documents[t];return n?Promise.resolve(n):Promise.reject(new q(t))}getBySlug(t){const n=this.slugToDocumentId[t];return n?this.get(n):Promise.reject(new q(t))}async findByType(t,n=100,r){const s=Object.entries(this.documents).filter(([d,f])=>f.header.documentType===t).map(([d,f])=>({id:d,document:f}));s.sort((d,f)=>{const g=new Date(d.document.header.createdAtUtcIso),T=new Date(f.document.header.createdAtUtcIso);if(g.getTime()===T.getTime()){const E=d.id,b=f.id;return E.localeCompare(b)}return g.getTime()-T.getTime()});let i=0;if(r){const d=s.findIndex(({id:f})=>f===r);d!==-1&&(i=d)}const l=Math.min(i+n,s.length);let u;return l<s.length&&(u=s[l].id),{documents:s.slice(i,l).map(({id:d})=>d),nextCursor:u}}async delete(t){const n=this.documents[t];if(n){const s=n.header.slug?.length>0?n.header.slug:t;s&&this.slugToDocumentId[s]===t&&delete this.slugToDocumentId[s]}const r=await this.getParents(t);for(const s of r)await this.removeChild(s,t);return delete this.driveManifests[t],this.documents[t]?(delete this.documents[t],Promise.resolve(!0)):Promise.resolve(!1)}async addChild(t,n){if(t===n)return Promise.reject(new Error("Cannot associate a document with itself"));if((await this.getChildren(n)).includes(t))return Promise.reject(new Error("Cannot associate a document with its child"));const s=this.getManifest(t);return s.documentIds.add(n),this.updateDriveManifest(t,s),Promise.resolve()}async removeChild(t,n){const r=this.getManifest(t);return r.documentIds.delete(n)?(this.updateDriveManifest(t,r),Promise.resolve(!0)):Promise.resolve(!1)}async getChildren(t){return[...this.getManifest(t).documentIds]}async getParents(t){const n=[];for(const[r,s]of Object.entries(this.driveManifests))s.documentIds.has(t)&&n.push(r);return n}async clear(){this.documents={},this.driveManifests={},this.slugToDocumentId={}}async addDocumentOperations(t,n,r){const s=await this.get(t);if(!r)return Promise.reject(new q(t));const i=de(s.operations,n),l={};for(const[u,d]of Object.entries(i))l[u]=X(d);this.documents[t]={...s,state:r.state,initialState:r.initialState,header:{...s.header,...r.header,revision:l},operations:i,clipboard:r.clipboard}}async addDriveOperations(t,n,r){const s=await this.get(t),i=de(s.operations,n),l={};for(const[u,d]of Object.entries(i))l[u]=X(d);this.documents[t]={...s,state:r.state,initialState:r.initialState,header:{...s.header,...r.header,revision:l},operations:i,clipboard:r.clipboard}}async getSynchronizationUnitsRevision(t){return(await Promise.allSettled(t.map(async r=>{try{const s=await this.get(r.documentId);if(!s||!Object.keys(s.state).includes(r.scope))return;const i=s.operations[r.scope];return i?{documentId:r.documentId,documentType:r.documentType,scope:r.scope,branch:r.branch,lastUpdated:i.at(-1)?.timestampUtcMs??s.header.createdAtUtcIso,revision:i.length>0?X(i):0}:void 0}catch(s){this.logger.error("Error getting synchronization units revision: @error",s);return}}))).reduce((r,s)=>(s.status==="fulfilled"&&s.value!==void 0&&r.push(s.value),r),[])}async findStorageUnitsBy(t,n,r){const s=[],{parentId:i,documentId:l,documentModelType:u,scope:d}=br(t);let f;if(i){const b=new Set;for(const I of i)(await this.getChildren(I)).forEach(O=>b.add(O));f=vr(i,b)}else f=new Set(Object.keys(this.documents));f=l?Er(l,f):f;for(const b of f){const I=this.documents[b];if(I&&!(u&&!u.has(I.header.documentType)))for(const[h]of Object.entries(I.state))d&&!d.has(h)||s.push({documentId:b,documentModelType:I.header.documentType,scope:h,branch:"main"})}let g=0;if(r){const b=s.findIndex(I=>I.documentId===r);b!==-1&&(g=b)}const T=Math.min(g+n,s.length),E=T<s.length?s[T].documentId:void 0;return{units:s.slice(g,T),nextCursor:E}}getManifest(t){return this.driveManifests[t]||(this.driveManifests[t]={documentIds:new Set}),this.driveManifests[t]}updateDriveManifest(t,n){this.driveManifests[t]=n}}export{pe as A,q as D,Fr as M,Tt as a,ie as b,Ot as c,It as d,wt as e,Pt as f,Sr as g,x as h,Bt as i,Wt as j,Ar as k,Nr as l,k as m,Or as n,_r as r,Ft as s,St as u};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{b4 as s,b5 as o,b6 as e}from"./reactor_browser-DKT7DitQ.js";import"./document_model-DxDgOZQk.js";import"./zod-9j67vCAu.js";import"./react-DQSxOgtG.js";import"./document_drive-CDMxtf9f.js";import"./graphql-DwmBvzSo.js";import"./sentry_react-cODD7zWc.js";import"./sentry_browser-B4YoBIIG.js";import"./document_model_editor-HMgNrWzH.js";import"./drive_explorer-Ci_KsiFF.js";import"./react/jsx-runtime-DldvXD6N.js";import"./design_system-2B9-gBoy.js";import"./tailwind_merge-Dr4f9Rms.js";import"./react-dom-D6zQJsh6.js";import"./design_system_connect-BDSRzEbz.js";import"./design_system_ui-DfgQWIF6.js";e();var N=class extends s{constructor(t){super(t),this.rootDir=(void 0)(t),(void 0)((void 0)(this.rootDir))||(void 0)(this.rootDir)}async init(t,r){return this.pg=t,{emscriptenOpts:{...r,preRun:[...r.preRun||[],i=>{let p=i.FS.filesystems.NODEFS;i.FS.mkdir(o),i.FS.mount(p,{root:this.rootDir},o)}]}}}async closeFs(){this.pg.Module.FS.quit()}};export{N as NodeFS};
|
|
Binary file
|