@powerhousedao/connect 4.1.0-dev.18 → 4.1.0-dev.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (71) hide show
  1. package/dist/assets/{AddDriveModal.Cg4TqLU6.js → AddDriveModal.atIXkYDv.js} +2 -2
  2. package/dist/assets/{AddDriveModal.Cg4TqLU6.js.map → AddDriveModal.atIXkYDv.js.map} +1 -1
  3. package/dist/assets/{CookiesPolicyModal.C72UZ1KY.js → CookiesPolicyModal.CSr2nTWu.js} +2 -2
  4. package/dist/assets/{CookiesPolicyModal.C72UZ1KY.js.map → CookiesPolicyModal.CSr2nTWu.js.map} +1 -1
  5. package/dist/assets/{CreateDocumentModal.Be8Yb4Tw.js → CreateDocumentModal.hCyyznzw.js} +2 -2
  6. package/dist/assets/{CreateDocumentModal.Be8Yb4Tw.js.map → CreateDocumentModal.hCyyznzw.js.map} +1 -1
  7. package/dist/assets/{DebugSettingsModal.BYAH2kLg.js → DebugSettingsModal.CgAXBUpR.js} +2 -2
  8. package/dist/assets/{DebugSettingsModal.BYAH2kLg.js.map → DebugSettingsModal.CgAXBUpR.js.map} +1 -1
  9. package/dist/assets/{DeleteDriveModal.D2WirfE-.js → DeleteDriveModal.Ba1pkRrp.js} +2 -2
  10. package/dist/assets/{DeleteDriveModal.D2WirfE-.js.map → DeleteDriveModal.Ba1pkRrp.js.map} +1 -1
  11. package/dist/assets/{DeleteItemModal.Czi0wE_6.js → DeleteItemModal.59EW1OYd.js} +2 -2
  12. package/dist/assets/{DeleteItemModal.Czi0wE_6.js.map → DeleteItemModal.59EW1OYd.js.map} +1 -1
  13. package/dist/assets/{DisclaimerModal.cBHngnNt.js → DisclaimerModal.CMaIiFx2.js} +2 -2
  14. package/dist/assets/{DisclaimerModal.cBHngnNt.js.map → DisclaimerModal.CMaIiFx2.js.map} +1 -1
  15. package/dist/assets/{DriveSettingsModal.DltE5rSu.js → DriveSettingsModal.G8tppGWb.js} +2 -2
  16. package/dist/assets/{DriveSettingsModal.DltE5rSu.js.map → DriveSettingsModal.G8tppGWb.js.map} +1 -1
  17. package/dist/assets/{SettingsModal.CZmfov8g.js → SettingsModal.CLpRdHfo.js} +2 -2
  18. package/dist/assets/{SettingsModal.CZmfov8g.js.map → SettingsModal.CLpRdHfo.js.map} +1 -1
  19. package/dist/assets/{Trans.GeuewYUs.js → Trans.CBZW5Jpo.js} +2 -2
  20. package/dist/assets/{Trans.GeuewYUs.js.map → Trans.CBZW5Jpo.js.map} +1 -1
  21. package/dist/assets/{UpgradeDriveModal.BLXcEgmt.js → UpgradeDriveModal.ooyxdViv.js} +2 -2
  22. package/dist/assets/{UpgradeDriveModal.BLXcEgmt.js.map → UpgradeDriveModal.ooyxdViv.js.map} +1 -1
  23. package/dist/assets/{atlas-import.Tq-cGz94.js → atlas-import.Bvmc6eu-.js} +2 -2
  24. package/dist/assets/{atlas-import.Tq-cGz94.js.map → atlas-import.Bvmc6eu-.js.map} +1 -1
  25. package/dist/assets/{content.C38XllGR.js → content.B_2fQ3XO.js} +2 -2
  26. package/dist/assets/content.B_2fQ3XO.js.map +1 -0
  27. package/dist/assets/{cookie-banner.CA1rcZYO.js → cookie-banner.CQrIFtr9.js} +2 -2
  28. package/dist/assets/{cookie-banner.CA1rcZYO.js.map → cookie-banner.CQrIFtr9.js.map} +1 -1
  29. package/dist/assets/{index.tjOyiWN1.js → index.BWsvZ6s-.js} +2 -2
  30. package/dist/assets/{index.tjOyiWN1.js.map → index.BWsvZ6s-.js.map} +1 -1
  31. package/dist/assets/{index.CupF3yfn.js → index.BbKJCE01.js} +2 -2
  32. package/dist/assets/{index.CupF3yfn.js.map → index.BbKJCE01.js.map} +1 -1
  33. package/dist/assets/{index.D4rIKeA_.js → index.BfgjawT0.js} +2 -2
  34. package/dist/assets/{index.D4rIKeA_.js.map → index.BfgjawT0.js.map} +1 -1
  35. package/dist/assets/index.DoxG1d4A.js +31 -0
  36. package/dist/assets/index.DoxG1d4A.js.map +1 -0
  37. package/dist/assets/{index.DqaPdXs7.js → index.EpI4H1M9.js} +2 -2
  38. package/dist/assets/{index.DqaPdXs7.js.map → index.EpI4H1M9.js.map} +1 -1
  39. package/dist/assets/{index.DqtagVhW.js → index.lZCfN3WH.js} +2 -2
  40. package/dist/assets/{index.DqtagVhW.js.map → index.lZCfN3WH.js.map} +1 -1
  41. package/dist/assets/{index.Beg62ngn.js → index.wkpkULnU.js} +2 -2
  42. package/dist/assets/{index.Beg62ngn.js.map → index.wkpkULnU.js.map} +1 -1
  43. package/dist/assets/{main.DTZCxlJU.js → main.C-z7q4Cv.js} +3 -3
  44. package/dist/assets/{main.DTZCxlJU.js.map → main.C-z7q4Cv.js.map} +1 -1
  45. package/dist/assets/{modal.B9PP9n2B.js → modal.BizsZF2D.js} +3 -3
  46. package/dist/assets/{modal.B9PP9n2B.js.map → modal.BizsZF2D.js.map} +1 -1
  47. package/dist/assets/{modals.BVvUIuNm.js → modals.Bh5aGAsh.js} +2 -2
  48. package/dist/assets/{modals.BVvUIuNm.js.map → modals.Bh5aGAsh.js.map} +1 -1
  49. package/dist/assets/{nodefs.DG9XiPrJ.js → nodefs.DRM5jodc.js} +2 -2
  50. package/dist/assets/{nodefs.DG9XiPrJ.js.map → nodefs.DRM5jodc.js.map} +1 -1
  51. package/dist/assets/{nodes.bF-gqvzp.js → nodes.1z5U6LVM.js} +2 -2
  52. package/dist/assets/{nodes.bF-gqvzp.js.map → nodes.1z5U6LVM.js.map} +1 -1
  53. package/dist/assets/{opfs-ahp.CQz3T4kD.js → opfs-ahp.CIwZIbNR.js} +2 -2
  54. package/dist/assets/{opfs-ahp.CQz3T4kD.js.map → opfs-ahp.CIwZIbNR.js.map} +1 -1
  55. package/dist/assets/{registerServiceWorker.DZCbK6MJ.js → registerServiceWorker.BNf1b8wD.js} +2 -2
  56. package/dist/assets/{registerServiceWorker.DZCbK6MJ.js.map → registerServiceWorker.BNf1b8wD.js.map} +1 -1
  57. package/dist/assets/{root.MjuhTv80.js → root.SqECa_nN.js} +2 -2
  58. package/dist/assets/{root.MjuhTv80.js.map → root.SqECa_nN.js.map} +1 -1
  59. package/dist/assets/{useAcceptedCookies.BwmKLuW0.js → useAcceptedCookies.BwfkDBue.js} +2 -2
  60. package/dist/assets/{useAcceptedCookies.BwmKLuW0.js.map → useAcceptedCookies.BwfkDBue.js.map} +1 -1
  61. package/dist/assets/useDefaultDocumentModelEditor.DmNu7Xm0.js +2 -0
  62. package/dist/assets/{useDefaultDocumentModelEditor.CjlFHIbF.js.map → useDefaultDocumentModelEditor.DmNu7Xm0.js.map} +1 -1
  63. package/dist/assets/{useInitSentry.DAHyudtD.js → useInitSentry.BsZC-0d6.js} +6 -6
  64. package/dist/assets/{useInitSentry.DAHyudtD.js.map → useInitSentry.BsZC-0d6.js.map} +1 -1
  65. package/dist/index.html +1 -1
  66. package/dist/vite-envs.sh +1 -1
  67. package/package.json +10 -10
  68. package/dist/assets/content.C38XllGR.js.map +0 -1
  69. package/dist/assets/index.DJX9_IxB.js +0 -31
  70. package/dist/assets/index.DJX9_IxB.js.map +0 -1
  71. package/dist/assets/useDefaultDocumentModelEditor.CjlFHIbF.js +0 -2
@@ -0,0 +1 @@
1
+ {"version":3,"mappings":";44CAAA,MAAMA,GAAkBC,GAAgB,OAAO,KAAKA,EAAK,QAAQ,SAE1D,MAAMC,KAAUC,GAAA,OAAO,cAAP,YAAAA,GAAoB,UAAWH,GCMzCI,GAAoBC,GAAyB,CACtD,MAAMC,EAA4B,GAElC,GAAID,EAAS,OAAO,eAAiB,4BACjC,OAAOC,EAGX,MAAMC,EAAMF,EACNG,EAAQD,EAAI,MAAM,OAAO,eAAe,CAAC,EAGzCE,EAAqB,OAAO,KAAKD,EAAM,KAAK,EAAE,OAElD,CAACE,EAAKC,IAAa,CACjB,MAAMC,EAAQD,EAEd,MAAO,CACH,GAAGD,EACH,GAAGG,GACCL,EAAM,MAAMI,CAAK,EAAE,aACnBA,IAAU,UACZ,IAAIE,IAAQ,CACV,G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E,EAAyB,QAAU,UAEjCc,EACFlB,EAAsB,QAAU,YAChCE,EAAuB,QAAU,YACjCE,EAAyB,QAAU,WAEjCe,EACF,CAACF,GACD,CAACC,IACA,CAAC,CAAClB,EAAsB,MACrB,CAAC,CAACE,EAAuB,MACzB,CAAC,CAACE,EAAyB,MAMnC,OAJIR,IAAa,KAIbuB,EACO,OAINC,GAAA,CACI,UAAAtB,GAAA,YAAAA,EAAQ,IAAIiB,GAAS,OAClB,MAAMM,GAAW7e,EAAAue,EAAM,OAAO,OAAb,YAAAve,EAAmB,gBAC9B8e,EAAUD,EACVX,EAA6BW,CAAQ,EACrC,OACN,OACIxR,EAAC0R,GAAA,CAEG,MAAOR,EAAM,MAAM,OAAO,KAC1B,YAAaO,GAAW,qBACxB,KAAMzR,EAAC2R,GAAA,CAAU,MAAAT,CAAA,CAAc,EAC/B,QAAS,IAAMD,EAAiBC,CAAK,GAJhCA,EAAM,OAAO,GAKtB,GAGPH,EAAO,OAAO,iBACX/Q,EAAC4R,GAAA,CAAuB,QAAST,CAAA,CAAiB,GAE1D,CAER","names":["openBrowserUrl","url","openUrl","_a","validateDocument","document","errors","doc","specs","initialStateErrors","acc","scopeKey","scope","validateInitialState","err","schemaStateErrors","isGlobalScope","validateStateSchemaName","modulesErrors","validateModules","themeAtom","atomWithStorageCallback","theme","loadBaseEditors","documentModelEditor","__vitePreload","getEditorsFromModules","modules","module","val","baseEditorsAtom","atomWithLazy","editorsAtom","atom","get","baseEditors","externalModules","externalPackagesAtom","unwrappedEditorsAtom","unwrap","loadableEditorsAtom","loadable","useUnwrappedEditors","useAtomValue","getEditor","documentType","editors","preferredEditorId","preferredEditor","e","useGetEditor","defaultDocumentModelEditor","useDefaultDocumentModelEditor","DriveContext","createContext","DriveContextProvider","value","children","_jsx","useDriveContext","context","useContext","getDocumentSpec","CreateDocument","documentModels","createDocument","_jsxs","spec","Button","GAP","ITEM_WIDTH","ITEM_HEIGHT","USED_SPACE","FileContentView","props","parentRef","useRef","t","useTranslation","windowSize","useWindowSize","fileNodes","availableWidth","columnCount","rowCount","rowVirtualizer","useVirtualizer","index","columnVirtualizer","getItemIndex","rowIndex","columnIndex","getItem","renderItem","fileNode","FileItem","virtualRow","React","virtualColumn","DriveLayout","className","containerProps","cn","title","FolderView","node","isAllowedToCreateDocuments","sharingType","getSyncStatusSync","setSelectedNode","onAddFile","onCopyNode","onMoveNode","onRenameNode","onDuplicateNode","onAddFolder","onAddAndSelectNewFolder","showDeleteNodeModal","folderNodes","useFolderChildNodesForId","useFileChildNodesForId","isDropTarget","dropProps","useDrop","twMerge","folderNode","FolderItem","defaultFilterItems","Icon","SearchBar","setValue","useState","ConnectSearchBar","BaseEditor","showSearchBar","showCreateDocumentModal","selectedDrive","useSelectedDrive","selectedFolder","useSelectedFolder","selectedDriveAsFolderNode","makeFolderNodeFromDrive","selectedNodePath","useSelectedNodePath","useSetSelectedNode","onCreateDocument","useCallback","documentModel","breadcrumbs","onBreadcrumbSelected","useBreadcrumbs","getDriveSharingType","Breadcrumbs","Editor","GenericDriveExplorer","useAnalyticsQueryWrapper","options","queryFn","queryOptions","store","useAnalyticsStoreAsync","engine","useAnalyticsEngineAsync","enabled","useQuery","DEBOUNCE_INTERVAL","useAnalyticsQuery","query","queryClient","useQueryClient","sources","result","useEffect","subscriptions","invalidateTimeout","debouncedInvalidate","path","unsub","getBarSize","addItemsDividers","items","item","currentDate","nextDate","currentHour","nextHour","currentDay","nextDay","metricsToItems","metrics","a","b","aDate","bDate","row","additions","deletions","startDate","useTimelineItems","documentId","startTimestamp","driveId","start","DateTime","AnalyticsGranularity","AnalyticsPath","getRevisionFromDate","endDate","operations","operation","operationDate","EditorLoader","showLoading","setShowLoading","customEditorLoader","defaultProps","jsx","Fragment","DefaultEditorLoader","EditorError","message","FallbackEditorError","DocumentEditor","onClose","onExport","onAddOperation","onOpenSwitchboardLink","selectedTimelineItem","setSelectedTimelineItem","revisionHistoryVisible","setRevisionHistoryVisible","user","useUser","connectDid","useConnectDid","sign","useConnectCrypto","getDocumentModelModule","useGetDocumentModelModule","useMemo","editor","_dispatch","error","useDocumentDispatch","userPermissions","useUserPermissions","timelineItems","dispatch","action","onErrorCallback","callback","state","prevState","signOperation","op","logger","addActionContext","showRevisionHistory","hideRevisionHistory","handleUndo","undo","handleRedo","redo","isLoadingEditor","canUndo","canRedo","useUndoRedoShortcuts","navigate","useNavigate","showModal","useModal","editorError","setEditorError","handleEditorError","info","jsxs","EditorComponent","disableExternalControls","documentToolbarEnabled","showSwitchboardLink","timelineEnabled","handleSwitchboardLinkClick","DocumentToolbar","RevisionHistory","Suspense","ErrorBoundary","DocumentEditorContainer","addDocumentOperations","useDocumentDriveServer","unwrappedSelectedDrive","selectedDocument","useSelectedDocument","parentFolderId","useParentFolderId","isRemoteDrive","useDriveIsRemote","remoteUrl","useDriveRemoteUrl","documentModelModule","exportDocument","validationErrors","closeModal","exportFile","buildDocumentSubgraphUrl","DriveEditorError","DriveEditorContainer","addDriveOperation","nodeActions","useNodeActions","driveDocumentModelModule","editorProps","useEditorProps","useShowDeleteNodeModal","addFile","addDocument","useFilteredDocumentModels","analyticsDatabaseName","connectConfig","driveContext","useDocumentEditorProps","driveEditor","useDriveEditor","DriveEditorComponent","useDocument","reactor","documentMeta","setDocument","onStrandUpdate","cb","strand","reducer","_b","buildSignedAction","debounceOperations","timeout","timer","oldOperation","resolve","reject","useAddDebouncedOperations","isAllowedToEditDocuments","addOperations","id","documentReducer","initialState","onError","setState","setError","onErrorHandler","_state","newState","nodeId","initialDocument","addDebouncedOperations","useDocumentEditor","useReactor","useEditorDispatch","documentDispatch","parentFolder","useParentFolder","selectedParentFolder","useSelectedParentFolder","addFolder","renameNode","copyNode","moveNode","file","parent","fileName","name","newName","src","target","newFolder","_extends","n","r","reservedModifierKeywords","mappedKeys","mapKey","key","isHotkeyModifier","parseKeysHookInput","keys","splitKey","parseHotkey","hotkey","combinationKey","description","k","modifiers","singleCharKeys","pushToCurrentlyPressedKeys","removeFromCurrentlyPressedKeys","currentlyPressedKeys","isReadonlyArray","isHotkeyPressed","hotkeyArray","maybePreventDefault","preventDefault","isHotkeyEnabled","isKeyboardEventTriggeredByInput","ev","isHotkeyEnabledOnTag","event","enabledOnTags","composed","targetTagName","isCustomElement","tag","_targetTagName","element","isScopeActive","activeScopes","scopes","isHotkeyMatchingKeyboardEvent","ignoreModifiers","alt","meta","mod","shift","ctrl","pressedKeyUppercase","code","ctrlKey","metaKey","shiftKey","altKey","keyCode","pressedKey","BoundHotkeysProxyProvider","useBoundHotkeysProxy","deepEqual","x","y","isEqual","HotkeysContext","useHotkeysContext","useDeepEqualMemo","ref","stopPropagation","useSafeLayoutEffect","useLayoutEffect","useHotkeys","dependencies","_useState","setRef","hasTriggeredRef","_options","_keys","_deps","memoisedCB","cbRef","memoisedOptions","_useHotkeysContext","enabledScopes","proxy","listener","isKeyUp","_e$target","rootNode","_hotkey$keys","handleKeyDown","handleKeyUp","domNode","isMac","undoShortcut","redoShortcut","Content","ContentContainer","HomeScreenContainer","pathname","useLocation","drives","useDrives","loadableSelectedDrive","useLoadableSelectedDrive","loadableSelectedFolder","useLoadableSelectedFolder","loadableSelectedDocument","useLoadableSelectedDocument","showAddDriveModal","useShowAddDriveModal","setSelectedDrive","useSetSelectedDrive","getAppDescriptionForEditorId","useGetAppNameForEditorId","config","useConnectConfig","handleDriveClick","drive","onAddDriveClick","isLoading","isError","hasSelectedDriveOrFolderOrDocument","HomeScreen","editorId","appName","HomeScreenItem","DriveIcon","HomeScreenAddDriveItem"],"ignoreList":[28],"sources":["../../src/utils/openUrl.ts","../../src/utils/validate-document.ts","../../src/store/theme.ts","../../src/store/editor.ts","../../../../packages/reactor-browser/dist/src/hooks/useDriveContext.js","../../../../packages/common/dist/editors/generic-drive-explorer/components/create-document.js","../../../../packages/common/dist/editors/generic-drive-explorer/components/file-content-view.js","../../../../packages/common/dist/editors/generic-drive-explorer/components/layout.js","../../../../packages/common/dist/editors/generic-drive-explorer/components/folder-view.js","../../../../packages/common/dist/editors/generic-drive-explorer/components/search-bar.js","../../../../packages/common/dist/editors/generic-drive-explorer/editor.js","../../../../packages/common/dist/editors/generic-drive-explorer/index.js","../../../../packages/reactor-browser/dist/src/analytics/hooks.js","../../../../packages/common/dist/hooks/useTimelineItems.js","../../../../packages/common/dist/utils/index.js","../../src/components/editor-loader.tsx","../../src/components/editors.tsx","../../src/components/document-editor-container.tsx","../../src/components/drive-editor-container.tsx","../../../../packages/reactor-browser/dist/src/hooks/useUserPermissions.js","../../../../packages/reactor-browser/dist/src/hooks/useDocument.js","../../../../packages/reactor-browser/dist/src/utils/signature.js","../../../../packages/reactor-browser/dist/src/hooks/useAddDebouncedOperations.js","../../../../packages/reactor-browser/dist/src/hooks/useDocumentDispatch.js","../../../../packages/reactor-browser/dist/src/hooks/useDocumentEditor.js","../../src/hooks/useDocumentEditor.ts","../../src/hooks/useEditorProps.tsx","../../src/hooks/useNodeActions.ts","../../../../node_modules/.pnpm/react-hotkeys-hook@4.6.2_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/react-hotkeys-hook/dist/react-hotkeys-hook.esm.js","../../src/hooks/useUndoRedoShortcuts.ts","../../src/pages/content.tsx"],"sourcesContent":["const openBrowserUrl = (url: string) => window.open(url, '_blank');\n\nexport const openUrl = window.electronAPI?.openURL ?? openBrowserUrl;\n","import {\n type DocumentModelDocument,\n type PHDocument,\n validateInitialState,\n validateModules,\n validateStateSchemaName,\n type ValidationError,\n} from 'document-model';\nexport const validateDocument = (document: PHDocument) => {\n const errors: ValidationError[] = [];\n\n if (document.header.documentType !== 'powerhouse/document-model') {\n return errors;\n }\n\n const doc = document as DocumentModelDocument;\n const specs = doc.state.global.specifications[0];\n\n // validate initial state errors\n const initialStateErrors = Object.keys(specs.state).reduce<\n ValidationError[]\n >((acc, scopeKey) => {\n const scope = scopeKey as keyof typeof specs.state;\n\n return [\n ...acc,\n ...validateInitialState(\n specs.state[scope].initialValue,\n scope !== 'global',\n ).map(err => ({\n ...err,\n message: `${err.message}. Scope: ${scope}`,\n details: { ...err.details, scope },\n })),\n ];\n }, []);\n\n // validate schema state errors\n const schemaStateErrors = Object.keys(specs.state).reduce<\n ValidationError[]\n >((acc, scopeKey) => {\n const scope = scopeKey as keyof typeof specs.state;\n const isGlobalScope = scope === 'global';\n\n return [\n ...acc,\n ...validateStateSchemaName(\n specs.state[scope].schema,\n doc.header.name || doc.state.global?.name || '',\n !isGlobalScope ? scope : '',\n !isGlobalScope,\n ).map(err => ({\n ...err,\n message: `${err.message}. Scope: ${scope}`,\n details: { ...err.details, scope },\n })),\n ];\n }, []);\n\n // modules validation\n const modulesErrors = validateModules(specs.modules);\n\n return [...initialStateErrors, ...schemaStateErrors, ...modulesErrors];\n};\n","import { useAtomValue } from 'jotai';\nimport { atomWithStorageCallback } from './utils.js';\n\nconst THEMES = ['light', 'dark'] as const;\n\nexport type Theme = (typeof THEMES)[number];\n\nexport const themeAtom = atomWithStorageCallback<Theme>(\n 'theme',\n 'light',\n theme => {\n if (typeof window !== 'undefined') {\n window.electronAPI?.setTheme(theme);\n }\n },\n);\n\nexport const useTheme = () => useAtomValue(themeAtom);\n\nexport function isTheme(theme: string): theme is Theme {\n return THEMES.includes(theme as Theme);\n}\n","import { useDefaultDocumentModelEditor } from '#hooks';\nimport { type DocumentModelLib, type EditorModule } from 'document-model';\nimport { atom, useAtomValue } from 'jotai';\nimport { atomWithLazy, loadable, unwrap } from 'jotai/utils';\nimport { useCallback, useEffect, useRef } from 'react';\nimport { externalPackagesAtom } from './external-packages.js';\n\nasync function loadBaseEditors() {\n const documentModelEditor = await import(\n '@powerhousedao/builder-tools/document-model-editor'\n );\n await import('@powerhousedao/builder-tools/style.css');\n\n const baseEditors = [\n documentModelEditor.documentModelEditorModule,\n ] as EditorModule[];\n\n return baseEditors;\n}\n\nfunction getEditorsFromModules(modules: DocumentModelLib[]) {\n return modules\n .map(module => module.editors)\n .reduce((acc, val) => acc.concat(val), []);\n}\n\nconst baseEditorsAtom = atomWithLazy(loadBaseEditors);\nbaseEditorsAtom.debugLabel = 'baseEditorsAtomInConnect';\nexport const editorsAtom = atom(async get => {\n const baseEditors = await get(baseEditorsAtom);\n const externalModules = await get(externalPackagesAtom);\n const externalEditors = getEditorsFromModules(externalModules);\n\n return externalEditors.concat(baseEditors);\n});\neditorsAtom.debugLabel = 'editorsAtomInConnect';\n\nconst unwrappedEditorsAtom = unwrap(editorsAtom);\nunwrappedEditorsAtom.debugLabel = 'unwrappedEditorsAtomInConnect';\nconst loadableEditorsAtom = loadable(editorsAtom);\nloadableEditorsAtom.debugLabel = 'loadableEditorsAtomInConnect';\n\n// suspends the UI while editors are loading\nexport const useEditors = () => {\n return useAtomValue(editorsAtom);\n};\n\n// will return undefined until editors are initialized. Does not block rendering.\nexport const useUnwrappedEditors = () => {\n return useAtomValue(unwrappedEditorsAtom);\n};\n\n// returns state, data and error, which will cause a rerender when the editors are loaded. Does not suspend the UI\nexport const useLoadableEditors = () => {\n return useAtomValue(loadableEditorsAtom);\n};\n\nexport const useEditorsAsync = () => {\n const editorsPromise = useRef(\n (() => {\n let resolveFn!: (value: EditorModule[]) => void;\n let rejectFn!: (reason?: any) => void;\n\n const promise = new Promise<EditorModule[]>((resolve, reject) => {\n resolveFn = resolve;\n rejectFn = reject;\n });\n\n return { promise, resolve: resolveFn, reject: rejectFn };\n })(),\n );\n\n const editors = useLoadableEditors();\n\n useEffect(() => {\n if (editors.state === 'hasError') {\n editorsPromise.current.reject(editors.error);\n } else if (editors.state === 'hasData') {\n editorsPromise.current.resolve(editors.data);\n }\n }, [editors]);\n return editorsPromise.current.promise;\n};\n\nconst getEditor = (\n documentType: string | undefined,\n editors: EditorModule[],\n preferredEditorId?: string,\n) => {\n if (!documentType) return null;\n const preferredEditor = editors.find(\n e =>\n e.config.id === preferredEditorId &&\n e.documentTypes.includes(documentType),\n );\n\n if (preferredEditor) return preferredEditor;\n\n const editor =\n editors.find(e => e.documentTypes.includes(documentType)) ||\n editors.find(e => e.documentTypes.includes('*'));\n\n return editor || null;\n};\n\nexport const useEditor = (documentType: string) => {\n const editors = useUnwrappedEditors();\n if (!editors) {\n return undefined;\n }\n return getEditor(documentType, editors);\n};\n\nexport const useGetEditor = () => {\n const editors = useUnwrappedEditors();\n const [defaultDocumentModelEditor] = useDefaultDocumentModelEditor();\n\n return (documentType: string | undefined) =>\n editors\n ? getEditor(documentType, editors, defaultDocumentModelEditor.value)\n : undefined;\n};\n\nexport const usePreloadEditor = () => {\n const editorsPromise = useEditorsAsync();\n return useCallback(\n async (documentType: string) => {\n const editors = await editorsPromise;\n const editor = getEditor(documentType, editors);\n if (editor && 'preload' in editor.Component) {\n console.log(\n `Preloading editor for document '${documentType}': ${editor.config.id}`,\n );\n await (\n editor.Component as { preload: () => Promise<void> }\n ).preload();\n }\n },\n [editorsPromise],\n );\n};\n","import { jsx as _jsx } from \"react/jsx-runtime\";\nimport { createContext, useContext } from \"react\";\nconst DriveContext = createContext(undefined);\nexport const DriveContextProvider = ({ value, children }) => (_jsx(DriveContext.Provider, { value: value, children: children }));\n/**\n * Hook to access the drive context values provided by the host application.\n * Must be used within a DriveContextProvider component.\n *\n * @returns IDriveContext - Object containing drive-related values and functions\n *\n * @example\n * const {\n * showSearchBar,\n * documentModels,\n * selectedNode,\n * addFile\n * } = useDriveContext();\n */\nexport function useDriveContext() {\n const context = useContext(DriveContext);\n if (!context) {\n throw new Error(\"useDriveContext must be used within a DriveContextProvider\");\n }\n return context;\n}\n//# sourceMappingURL=useDriveContext.js.map","import { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nimport { Button } from \"@powerhousedao/design-system\";\nfunction getDocumentSpec(doc) {\n if (\"documentModelState\" in doc) {\n return doc.documentModelState;\n }\n return doc.documentModel;\n}\nexport const CreateDocument = ({ documentModels, createDocument, }) => {\n return (_jsxs(\"div\", { className: \"px-6\", children: [_jsx(\"h3\", { className: \"mb-3 mt-4 text-xl font-bold text-gray-600\", children: \"New document\" }), _jsx(\"div\", { className: \"flex w-full flex-wrap gap-4\", children: documentModels?.map((doc) => {\n const spec = getDocumentSpec(doc);\n return (_jsx(Button, { color: \"light\", title: spec.name, \"aria-description\": spec.description, onClick: () => createDocument(doc), children: _jsx(\"span\", { className: \"text-sm\", children: spec.name }) }, spec.id));\n }) })] }));\n};\n//# sourceMappingURL=create-document.js.map","import { jsx as _jsx } from \"react/jsx-runtime\";\nimport { FileItem, useWindowSize, } from \"@powerhousedao/design-system\";\nimport { useVirtualizer } from \"@tanstack/react-virtual\";\nimport React, { useRef } from \"react\";\nimport { useTranslation } from \"react-i18next\";\nconst GAP = 8;\nconst ITEM_WIDTH = 256;\nconst ITEM_HEIGHT = 48;\nconst USED_SPACE = 420;\nexport function FileContentView(props) {\n const parentRef = useRef(null);\n const { t } = useTranslation();\n const windowSize = useWindowSize();\n const { fileNodes } = props;\n const availableWidth = windowSize.innerWidth - USED_SPACE;\n const columnCount = Math.floor(availableWidth / (ITEM_WIDTH + GAP)) || 1;\n const rowCount = Math.ceil(fileNodes.length / columnCount);\n const rowVirtualizer = useVirtualizer({\n count: rowCount,\n getScrollElement: () => parentRef.current,\n estimateSize: (index) => {\n if (index > 0) {\n return ITEM_HEIGHT + GAP;\n }\n return ITEM_HEIGHT;\n },\n overscan: 5,\n });\n const columnVirtualizer = useVirtualizer({\n horizontal: true,\n count: columnCount,\n getScrollElement: () => parentRef.current,\n estimateSize: (index) => {\n if (index > 0) {\n return ITEM_WIDTH + GAP;\n }\n return ITEM_WIDTH;\n },\n overscan: 5,\n });\n const getItemIndex = (rowIndex, columnIndex) => rowIndex * columnCount + columnIndex;\n const getItem = (rowIndex, columnIndex) => {\n const index = getItemIndex(rowIndex, columnIndex);\n return fileNodes[index] || null;\n };\n if (fileNodes.length === 0) {\n return (_jsx(\"div\", { className: \"mb-8 text-sm text-gray-400\", children: t(\"folderView.sections.documents.empty\", {\n defaultValue: \"No documents or files 📄\",\n }) }));\n }\n const renderItem = (rowIndex, columnIndex) => {\n const fileNode = getItem(rowIndex, columnIndex);\n if (!fileNode) {\n return null;\n }\n return (_jsx(\"div\", { style: {\n marginLeft: columnIndex === 0 ? 0 : GAP,\n }, children: _jsx(FileItem, { fileNode: fileNode, ...props }, fileNode.id) }));\n };\n return (_jsx(\"div\", { ref: parentRef, style: {\n height: `400px`,\n width: `100%`,\n overflow: \"auto\",\n }, children: _jsx(\"div\", { style: {\n height: `${rowVirtualizer.getTotalSize()}px`,\n width: `${columnVirtualizer.getTotalSize()}px`,\n position: \"relative\",\n }, children: rowVirtualizer.getVirtualItems().map((virtualRow) => (_jsx(React.Fragment, { children: columnVirtualizer.getVirtualItems().map((virtualColumn) => (_jsx(\"div\", { style: {\n position: \"absolute\",\n top: 0,\n left: 0,\n marginTop: virtualRow.index === 0 ? 0 : GAP,\n width: `${virtualColumn.size}px`,\n height: `${virtualRow.size}px`,\n transform: `translateX(${virtualColumn.start}px) translateY(${virtualRow.start}px)`,\n }, children: renderItem(virtualRow.index, virtualColumn.index) }, virtualColumn.key))) }, virtualRow.key))) }) }));\n}\nexport default FileContentView;\n//# sourceMappingURL=file-content-view.js.map","import { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nimport { cn } from \"@powerhousedao/design-system\";\nexport function DriveLayout({ children, className, ...props }) {\n return (_jsx(DriveLayout.Container, { className: className, ...props, children: children }));\n}\nDriveLayout.Container = function DriveLayoutContainer({ children, className, containerProps, ...props }) {\n return (_jsx(\"div\", { className: cn(\"flex grow flex-col overflow-auto rounded-2xl bg-gray-50 p-2\", className), ...containerProps, ...props, children: children }));\n};\nDriveLayout.Header = function DriveLayoutHeader({ children, className, containerProps, ...props }) {\n return (_jsx(\"div\", { className: cn(\"flex-0\", className), ...containerProps, ...props, children: children }));\n};\nDriveLayout.Content = function DriveLayoutContent({ children, className, containerProps, ...props }) {\n return (_jsx(\"div\", { className: cn(\"mb-5 flex-1 px-4\", className), ...containerProps, ...props, children: children }));\n};\nDriveLayout.ContentSection = function DriveLayoutContentSection({ title, children, className, containerProps, ...props }) {\n return (_jsxs(\"div\", { className: cn(className), ...containerProps, ...props, children: [title && (_jsx(\"div\", { className: \"mb-4 text-base font-semibold text-gray-600\", children: title })), _jsx(\"div\", { className: \"flex flex-wrap gap-2\", children: children })] }));\n};\nDriveLayout.Footer = function DriveLayoutFooter({ children, className, containerProps, ...props }) {\n return (_jsx(\"div\", { className: cn(\"flex-0\", className), ...containerProps, ...props, children: children }));\n};\n//# sourceMappingURL=layout.js.map","import { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nimport { FolderItem, useDrop, } from \"@powerhousedao/design-system\";\nimport { useFileChildNodesForId, useFolderChildNodesForId, } from \"@powerhousedao/state\";\nimport { useTranslation } from \"react-i18next\";\nimport { twMerge } from \"tailwind-merge\";\nimport FileContentView from \"./file-content-view.js\";\nimport { DriveLayout } from \"./layout.js\";\nexport function FolderView(props) {\n const { node, isAllowedToCreateDocuments, className, containerProps, sharingType, getSyncStatusSync, setSelectedNode, onAddFile, onCopyNode, onMoveNode, onRenameNode, onDuplicateNode, onAddFolder, onAddAndSelectNewFolder, showDeleteNodeModal, } = props;\n const { t } = useTranslation();\n const folderNodes = useFolderChildNodesForId(node?.id);\n const fileNodes = useFileChildNodesForId(node?.id);\n const { isDropTarget, dropProps } = useDrop({\n node,\n onAddFile,\n onCopyNode,\n onMoveNode,\n });\n return (_jsxs(\"div\", { className: twMerge(\"rounded-md border-2 border-transparent p-2\", isDropTarget && \"border-dashed border-blue-100\", className), ...containerProps, ...dropProps, children: [_jsx(DriveLayout.ContentSection, { title: t(\"folderView.sections.folders.title\", {\n defaultValue: \"Folders\",\n }), className: \"mb-4\", children: folderNodes.length > 0 ? (folderNodes.map((folderNode) => (_jsx(FolderItem, { folderNode: folderNode, isAllowedToCreateDocuments: isAllowedToCreateDocuments, sharingType: sharingType, getSyncStatusSync: getSyncStatusSync, setSelectedNode: setSelectedNode, onAddFile: onAddFile, onCopyNode: onCopyNode, onMoveNode: onMoveNode, onRenameNode: onRenameNode, onDuplicateNode: onDuplicateNode, onAddFolder: onAddFolder, onAddAndSelectNewFolder: onAddAndSelectNewFolder, showDeleteNodeModal: showDeleteNodeModal }, folderNode.id)))) : (_jsx(\"div\", { className: \"mb-8 text-sm text-gray-400\", children: t(\"folderView.sections.folders.empty\", {\n defaultValue: \"No documents or files 📄\",\n }) })) }), _jsx(DriveLayout.ContentSection, { title: t(\"folderView.sections.documents.title\", {\n defaultValue: \"Documents and files\",\n }), children: _jsx(\"div\", { className: twMerge(\"w-full\", fileNodes.length > 0 ? \"min-h-[400px]\" : \"min-h-14\"), children: _jsx(FileContentView, { fileNodes: fileNodes, isAllowedToCreateDocuments: isAllowedToCreateDocuments, sharingType: sharingType, getSyncStatusSync: getSyncStatusSync, setSelectedNode: setSelectedNode, showDeleteNodeModal: showDeleteNodeModal, onAddFile: onAddFile, onCopyNode: onCopyNode, onMoveNode: onMoveNode, onRenameNode: onRenameNode, onDuplicateNode: onDuplicateNode, onAddFolder: onAddFolder, onAddAndSelectNewFolder: onAddAndSelectNewFolder }) }) })] }));\n}\nexport default FolderView;\n//# sourceMappingURL=folder-view.js.map","import { jsx as _jsx } from \"react/jsx-runtime\";\nimport { ConnectSearchBar, Icon, } from \"@powerhousedao/design-system\";\nimport { useState } from \"react\";\nimport { useTranslation } from \"react-i18next\";\nconst defaultFilterItems = [\n {\n id: \"project\",\n label: \".project\",\n icon: _jsx(Icon, { name: \"Project\", color: \"#FF6A55\", size: 16 }),\n },\n {\n id: \"budget\",\n label: \".budget\",\n icon: _jsx(Icon, { name: \"BarChart\", color: \"#8E55EA\", size: 16 }),\n },\n {\n id: \"profile\",\n label: \".profile\",\n icon: _jsx(Icon, { name: \"Person\", color: \"#3E90F0\", size: 16 }),\n },\n {\n id: \"legal\",\n label: \".legal\",\n icon: _jsx(Icon, { name: \"Briefcase\", color: \"#4BAB71\", size: 16 }),\n },\n {\n id: \"atlas\",\n label: \".Atlas\",\n icon: _jsx(Icon, { name: \"Globe\", color: \"#FF8A00\", size: 16 }),\n },\n];\nexport const SearchBar = () => {\n const { t } = useTranslation();\n const [value, setValue] = useState(\"\"); // TODO\n return (_jsx(ConnectSearchBar, { className: \"max-w-searchbar-width m-4 shrink-0 bg-gray-100\", placeholder: t(\"searchbar.placeholder\"), filterLabel: t(\"searchbar.filterLabel\"), filterItems: defaultFilterItems, value: value, onChange: setValue }));\n};\n//# sourceMappingURL=search-bar.js.map","import { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nimport { Breadcrumbs, useBreadcrumbs, useDrop, } from \"@powerhousedao/design-system\";\nimport { DriveContextProvider, useDriveContext, } from \"@powerhousedao/reactor-browser/hooks/useDriveContext\";\nimport { getDriveSharingType, makeFolderNodeFromDrive, useSelectedDrive, useSelectedFolder, useSelectedNodePath, useSetSelectedNode, } from \"@powerhousedao/state\";\nimport { useCallback } from \"react\";\nimport { CreateDocument } from \"./components/create-document.js\";\nimport FolderView from \"./components/folder-view.js\";\nimport { DriveLayout } from \"./components/layout.js\";\nimport { SearchBar } from \"./components/search-bar.js\";\nexport function BaseEditor(props) {\n const { document, className, children } = props;\n const { showSearchBar, isAllowedToCreateDocuments, documentModels, getSyncStatusSync, showCreateDocumentModal, onRenameNode, onDuplicateNode, onAddFolder, onAddFile, onCopyNode, onMoveNode, onAddAndSelectNewFolder, showDeleteNodeModal, } = useDriveContext();\n const selectedDrive = useSelectedDrive();\n const selectedFolder = useSelectedFolder();\n const selectedDriveAsFolderNode = makeFolderNodeFromDrive(selectedDrive);\n const selectedNodePath = useSelectedNodePath();\n const setSelectedNode = useSetSelectedNode();\n const onCreateDocument = useCallback((documentModel) => {\n showCreateDocumentModal(documentModel);\n }, [showCreateDocumentModal]);\n const { isDropTarget, dropProps } = useDrop({\n node: selectedDriveAsFolderNode,\n onAddFile,\n onCopyNode,\n onMoveNode,\n });\n const { breadcrumbs, onBreadcrumbSelected } = useBreadcrumbs({\n selectedNodePath,\n setSelectedNode,\n });\n const sharingType = getDriveSharingType(document);\n if (!selectedDrive) {\n return _jsx(\"div\", { children: \"Drive not found\" });\n }\n return (_jsxs(DriveLayout, { className: className, children: [children, _jsxs(DriveLayout.Header, { children: [_jsx(Breadcrumbs, { breadcrumbs: breadcrumbs, createEnabled: isAllowedToCreateDocuments, onCreate: onAddAndSelectNewFolder, onBreadcrumbSelected: onBreadcrumbSelected }), showSearchBar && _jsx(SearchBar, {})] }), _jsx(DriveLayout.Content, { ...dropProps, className: isDropTarget ? \"rounded-xl bg-blue-100\" : \"\", children: _jsx(FolderView, { node: selectedFolder ?? selectedDriveAsFolderNode, sharingType: sharingType, getSyncStatusSync: getSyncStatusSync, setSelectedNode: setSelectedNode, onRenameNode: onRenameNode, onDuplicateNode: onDuplicateNode, onAddFolder: onAddFolder, onAddFile: onAddFile, onCopyNode: onCopyNode, onMoveNode: onMoveNode, onAddAndSelectNewFolder: onAddAndSelectNewFolder, showDeleteNodeModal: showDeleteNodeModal, isAllowedToCreateDocuments: isAllowedToCreateDocuments }) }), _jsx(DriveLayout.Footer, { children: isAllowedToCreateDocuments && (_jsx(CreateDocument, { documentModels: documentModels, createDocument: onCreateDocument })) })] }));\n}\nexport default function Editor(props) {\n return (_jsx(DriveContextProvider, { value: props.context, children: _jsx(BaseEditor, { ...props }) }));\n}\n//# sourceMappingURL=editor.js.map","import Editor from \"./editor.js\";\nexport const GenericDriveExplorer = {\n Component: Editor,\n documentTypes: [\"powerhouse/document-drive\"],\n config: {\n id: \"GenericDriveExplorer\",\n disableExternalControls: true,\n documentToolbarEnabled: true,\n showSwitchboardLink: true,\n },\n};\n//# sourceMappingURL=index.js.map","import { AnalyticsPath, } from \"@powerhousedao/analytics-engine-core\";\nimport { useMutation, useQuery, useQueryClient, } from \"@tanstack/react-query\";\nimport { useEffect } from \"react\";\nimport { getAnalyticsStore, useAnalyticsEngineAsync, useAnalyticsStoreAsync, useAnalyticsStoreOptions, } from \"./context.js\";\nfunction useAnalyticsQueryWrapper(options) {\n const { queryFn, ...queryOptions } = options;\n const { data: store } = useAnalyticsStoreAsync();\n const { data: engine } = useAnalyticsEngineAsync();\n const enabled = \"enabled\" in queryOptions ? queryOptions.enabled : !!store && !!engine;\n return useQuery({\n ...queryOptions,\n enabled,\n queryFn: async () => {\n if (!store || !engine) {\n throw new Error(\"No analytics store available. Use within an AnalyticsProvider.\");\n }\n return await queryFn({ store, engine });\n },\n });\n}\nfunction useAnalyticsMutationWrapper(options) {\n const { mutationFn, ...mutationOptions } = options;\n const storeOptions = useAnalyticsStoreOptions();\n return useMutation({\n ...mutationOptions,\n mutationFn: async (value) => {\n let store = null;\n try {\n store = await getAnalyticsStore(storeOptions);\n }\n catch (e) {\n console.error(e);\n }\n if (!store) {\n throw new Error(\"No analytics store available. Use within an AnalyticsProvider.\");\n }\n return await mutationFn(value, { store });\n },\n });\n}\nconst DEBOUNCE_INTERVAL = 200;\nexport function useAnalyticsQuery(query, options) {\n const { data: store } = useAnalyticsStoreAsync();\n const queryClient = useQueryClient();\n const sources = options?.sources ?? [];\n const result = useAnalyticsQueryWrapper({\n queryKey: [\"analytics\", \"query\", query],\n queryFn: ({ engine }) => engine.execute(query),\n ...options,\n });\n useEffect(() => {\n if (!sources.length || !store) {\n return;\n }\n const subscriptions = new Array();\n // Debounce invalidateQueries so it's not called too frequently\n let invalidateTimeout = null;\n const debouncedInvalidate = () => {\n if (invalidateTimeout)\n clearTimeout(invalidateTimeout);\n invalidateTimeout = setTimeout(() => {\n queryClient\n .invalidateQueries({\n queryKey: [\"analytics\", \"query\", query],\n })\n .catch((e) => {\n console.error(e);\n });\n }, DEBOUNCE_INTERVAL);\n };\n sources.forEach((path) => {\n const unsub = store.subscribeToSource(path, debouncedInvalidate);\n subscriptions.push(unsub);\n });\n // Unsubscribes from store when component unmounts or dependencies change\n return () => {\n subscriptions.forEach((unsub) => unsub());\n };\n }, [query, store, sources]);\n return result;\n}\nexport function useAnalyticsSeries(query, options) {\n return useAnalyticsQueryWrapper({\n queryKey: [\"analytics\", \"series\", query],\n queryFn: ({ store }) => store.getMatchingSeries(query),\n ...options,\n });\n}\nexport function useAddSeriesValue(options) {\n return useAnalyticsMutationWrapper({\n mutationKey: [\"analytics\", \"addSeries\"],\n mutationFn: async (value, { store }) => {\n return await store.addSeriesValue(value);\n },\n ...options,\n });\n}\nexport function useClearSeriesBySource(options) {\n return useAnalyticsMutationWrapper({\n mutationKey: [\"analytics\", \"clearSeries\"],\n mutationFn: async ({ source, cleanUpDimensions }, { store }) => {\n return store.clearSeriesBySource(source, cleanUpDimensions);\n },\n ...options,\n });\n}\nexport function useClearEmptyAnalyticsDimensions(options) {\n return useAnalyticsMutationWrapper({\n mutationKey: [\"analytics\", \"clearEmptyDimensions\"],\n mutationFn: async (_, { store }) => {\n return store.clearEmptyAnalyticsDimensions();\n },\n ...options,\n });\n}\nexport function useAddSeriesValues(options) {\n return useAnalyticsMutationWrapper({\n mutationKey: [\"analytics\", \"addSeriesValues\"],\n mutationFn: async (values, { store }) => {\n return store.addSeriesValues(values);\n },\n ...options,\n });\n}\nexport function useGetDimensions(options) {\n return useAnalyticsQueryWrapper({\n queryKey: [\"analytics\", \"dimensions\"],\n queryFn: ({ store }) => store.getDimensions(),\n ...options,\n });\n}\nexport function useMatchingSeries(query, options) {\n const result = useAnalyticsQueryWrapper({\n queryKey: [\"analytics\", \"matchingSeries\", query],\n queryFn: ({ store }) => store.getMatchingSeries(query),\n ...options,\n });\n return result;\n}\nexport function useQuerySources(query, options) {\n const { data: matchingSeries } = useMatchingSeries(query);\n return useQuery({\n queryKey: [\"analytics\", \"sources\", query],\n queryFn: () => {\n if (!matchingSeries?.length) {\n return [];\n }\n const uniqueSources = [\n ...new Set(matchingSeries.map((s) => s.source.toString())),\n ];\n return uniqueSources.map((source) => AnalyticsPath.fromString(source));\n },\n enabled: !!matchingSeries,\n ...options,\n });\n}\n//# sourceMappingURL=hooks.js.map","import { AnalyticsGranularity, AnalyticsPath, DateTime, useAnalyticsQuery, } from \"@powerhousedao/reactor-browser/analytics\";\nconst getBarSize = (value) => {\n if (value <= 0)\n return 0;\n if (value > 0 && value <= 50)\n return 1;\n if (value > 50 && value <= 100)\n return 2;\n if (value > 100 && value <= 250)\n return 3;\n return 4;\n};\nfunction addItemsDividers(items) {\n if (!items.length)\n return [];\n const result = [];\n items.forEach((item, index) => {\n result.push(item);\n // Check if there's a next item and if they're not in consecutive hours\n if (index < items.length - 1) {\n const currentDate = new Date(item.startDate);\n const nextDate = new Date(items[index + 1].startDate);\n const currentHour = currentDate.getHours();\n const nextHour = nextDate.getHours();\n // Get day parts (without time) for comparison\n const currentDay = currentDate.toDateString();\n const nextDay = nextDate.toDateString();\n // If different days or non-consecutive hours on the same day\n if (currentDay !== nextDay ||\n (currentDay === nextDay && Math.abs(nextHour - currentHour) > 1)) {\n result.push({\n id: `divider-${item.id}-${items[index + 1].id}`,\n type: \"divider\",\n revision: 0,\n });\n }\n }\n });\n return result;\n}\nfunction metricsToItems(metrics) {\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n if (!metrics)\n return [];\n const items = metrics\n .sort((a, b) => {\n const aDate = new Date(a.start);\n const bDate = new Date(b.start);\n return aDate.getTime() - bDate.getTime();\n })\n .filter((result) => {\n return result.rows.every((row) => row.value > 0);\n })\n .map((result) => {\n const { additions, deletions } = result.rows.reduce((acc, row) => {\n if (row.dimensions.changes.path ===\n \"ph/diff/changes/add\") {\n acc.additions += row.value;\n }\n else if (row.dimensions.changes.path ===\n \"ph/diff/changes/remove\") {\n acc.deletions += row.value;\n }\n return acc;\n }, { additions: 0, deletions: 0 });\n const startDate = new Date(result.start);\n return {\n id: startDate.toISOString(),\n type: \"bar\",\n addSize: getBarSize(additions),\n delSize: getBarSize(deletions),\n additions,\n deletions,\n timestamp: startDate.toISOString(),\n startDate: startDate,\n endDate: new Date(result.end),\n revision: 0,\n };\n });\n return addItemsDividers(items);\n}\nexport const useTimelineItems = (documentId, startTimestamp, driveId) => {\n const start = startTimestamp\n ? DateTime.fromISO(startTimestamp)\n : DateTime.now().startOf(\"day\");\n return useAnalyticsQuery({\n start,\n end: DateTime.now().endOf(\"day\"),\n granularity: AnalyticsGranularity.Hourly,\n metrics: [\"Count\"],\n select: {\n changes: [AnalyticsPath.fromString(`ph/diff/changes`)],\n document: [AnalyticsPath.fromString(`ph/diff/document/${documentId}`)],\n },\n lod: {\n changes: 4,\n },\n }, {\n sources: [AnalyticsPath.fromString(`ph/diff/${driveId}/${documentId}`)],\n select: metricsToItems,\n });\n};\n//# sourceMappingURL=useTimelineItems.js.map","export const getRevisionFromDate = (startDate, endDate, operations = []) => {\n if (!startDate || !endDate)\n return 0;\n const operation = operations.find((operation) => {\n const operationDate = new Date(operation.timestamp);\n return operationDate >= startDate && operationDate <= endDate;\n });\n return operation ? operation.index : 0;\n};\n//# sourceMappingURL=index.js.map","import { DefaultEditorLoader } from '@powerhousedao/design-system';\nimport {\n type ComponentProps,\n type ReactNode,\n useEffect,\n useState,\n} from 'react';\n\ntype Props = ComponentProps<typeof DefaultEditorLoader> & {\n loadingTimeout?: number;\n customEditorLoader?: ReactNode;\n};\nexport function EditorLoader(props: Props) {\n const [showLoading, setShowLoading] = useState(false);\n\n // only shows the loader after some time has passed\n useEffect(() => {\n setTimeout(() => {\n setShowLoading(true);\n }, props.loadingTimeout ?? 200);\n }, [props]);\n\n if (!showLoading) return null;\n\n const { customEditorLoader, ...defaultProps } = props;\n\n if (customEditorLoader) return <>{customEditorLoader}</>;\n\n return <DefaultEditorLoader {...defaultProps} />;\n}\n","import {\n useConnectCrypto,\n useConnectDid,\n useUndoRedoShortcuts,\n useUserPermissions,\n} from '#hooks';\nimport {\n themeAtom,\n useGetDocumentModelModule,\n useGetEditor,\n useUser,\n} from '#store';\nimport {\n addActionContext,\n type DocumentDispatchCallback,\n signOperation,\n useDocumentDispatch,\n} from '#utils';\nimport { getRevisionFromDate, useTimelineItems } from '@powerhousedao/common';\nimport {\n Button,\n DocumentToolbar,\n RevisionHistory,\n type TimelineItem,\n} from '@powerhousedao/design-system';\nimport { logger } from 'document-drive';\nimport {\n type Action,\n type ActionErrorCallback,\n type EditorContext,\n type Operation,\n type PHDocument,\n redo,\n undo,\n} from 'document-model';\nimport { useAtomValue } from 'jotai';\nimport { Suspense, useCallback, useEffect, useMemo, useState } from 'react';\nimport { ErrorBoundary, type FallbackProps } from 'react-error-boundary';\nimport { useNavigate } from 'react-router-dom';\nimport { EditorLoader } from './editor-loader.js';\nimport { useModal } from './modal/index.js';\n\ntype Props<TDocument extends PHDocument = PHDocument> = {\n document: TDocument;\n onClose: () => void;\n onExport: () => void;\n onAddOperation: (operation: Operation) => Promise<void>;\n onOpenSwitchboardLink?: () => Promise<void>;\n};\n\nfunction EditorError({ message }: { message: React.ReactNode }) {\n return (\n <div className=\"flex size-full items-center justify-center\">\n <h3 className=\"text-lg font-semibold\">{message}</h3>\n </div>\n );\n}\n\nfunction FallbackEditorError(props: FallbackProps) {\n const message =\n props.error instanceof Error\n ? props.error.message\n : (props.error as string);\n return <EditorError message={message} />;\n}\n\nexport const DocumentEditor: React.FC<Props> = props => {\n const {\n document,\n onClose,\n onExport,\n onAddOperation,\n onOpenSwitchboardLink,\n } = props;\n const documentId = document.header.id;\n const [selectedTimelineItem, setSelectedTimelineItem] =\n useState<TimelineItem | null>(null);\n const [revisionHistoryVisible, setRevisionHistoryVisible] = useState(false);\n const theme = useAtomValue(themeAtom);\n const user = useUser() || undefined;\n const connectDid = useConnectDid();\n const { sign } = useConnectCrypto();\n const getDocumentModelModule = useGetDocumentModelModule();\n const getEditor = useGetEditor();\n const documentType = document.header.documentType;\n const documentModel = useMemo(\n () => (documentType ? getDocumentModelModule(documentType) : undefined),\n [documentType, getDocumentModelModule],\n );\n\n const editor = useMemo(\n () => (documentType ? getEditor(documentType) : undefined),\n [documentType, getEditor],\n );\n\n const [, _dispatch, error] = useDocumentDispatch(\n documentModel?.reducer,\n document,\n );\n const context: EditorContext = useMemo(\n () => ({ theme, user }),\n [theme, user],\n );\n const userPermissions = useUserPermissions();\n\n const timelineItems = useTimelineItems(\n documentId,\n document.header.createdAtUtcIso,\n );\n\n const dispatch = useCallback(\n (action: Action, onErrorCallback?: ActionErrorCallback) => {\n const callback: DocumentDispatchCallback<PHDocument> = (\n operation,\n state,\n ) => {\n if (!documentId) return;\n\n const { prevState } = state;\n\n signOperation(\n operation,\n sign,\n documentId,\n prevState,\n documentModel?.reducer,\n user,\n )\n .then(op => {\n window.documentEditorDebugTools?.pushOperation(\n operation,\n );\n return onAddOperation(op);\n })\n .catch(logger.error);\n };\n\n _dispatch(\n addActionContext(action, connectDid, user),\n callback,\n onErrorCallback,\n );\n },\n [\n _dispatch,\n connectDid,\n documentModel?.reducer,\n onAddOperation,\n documentId,\n sign,\n user,\n ],\n );\n\n const showRevisionHistory = useCallback(\n () => setRevisionHistoryVisible(true),\n [],\n );\n\n const hideRevisionHistory = useCallback(\n () => setRevisionHistoryVisible(false),\n [],\n );\n const handleUndo = useCallback(() => {\n dispatch(undo());\n }, [dispatch]);\n\n const handleRedo = useCallback(() => {\n dispatch(redo());\n }, [dispatch]);\n\n const isLoadingEditor =\n editor === undefined ||\n (editor &&\n !editor.documentTypes.includes(document.header.documentType) &&\n !editor.documentTypes.includes('*'));\n\n const canUndo =\n document.header.revision.global > 0 ||\n document.header.revision.local > 0;\n const canRedo = !!document?.clipboard.length;\n useUndoRedoShortcuts({\n undo: handleUndo,\n redo: handleRedo,\n canUndo,\n canRedo,\n });\n\n useEffect(() => {\n return () => {\n window.documentEditorDebugTools?.clear();\n };\n }, []);\n\n const navigate = useNavigate();\n const { showModal } = useModal();\n\n const [editorError, setEditorError] = useState<\n | {\n error: any;\n info: React.ErrorInfo;\n documentId?: string;\n // clear: () => void;\n }\n | undefined\n >(undefined);\n\n useEffect(() => {\n if (editorError && editorError.documentId !== documentId) {\n setEditorError(undefined);\n }\n }, [editorError, documentId]);\n\n const handleEditorError = useCallback(\n (error: Error, info: React.ErrorInfo) => {\n setEditorError({\n error,\n documentId,\n info,\n });\n },\n [documentId],\n );\n\n if (isLoadingEditor) {\n return <EditorLoader message=\"Loading editor\" />;\n }\n\n if (!documentModel) {\n return (\n <EditorError\n message={\n <div className=\"text-center leading-10\">\n <p>\n Unable to open the document because the document\n model \"{documentType}\" is not supported.\n </p>\n <p>\n Go to the{' '}\n <button\n type=\"button\"\n className=\"cursor-pointer underline\"\n onClick={() => {\n showModal('settingsModal', {\n onRefresh: () => navigate(0),\n });\n }}\n >\n package manager\n </button>{' '}\n to install this document model\n </p>\n </div>\n }\n />\n );\n }\n\n if (!editor) {\n return (\n <EditorError\n message={\n <div className=\"text-center leading-10\">\n <p>\n Unable to open the document because no editor has\n been found\n </p>\n <p>\n Go to the{' '}\n <button\n type=\"button\"\n className=\"cursor-pointer underline\"\n onClick={() => {\n showModal('settingsModal', {\n onRefresh: () => navigate(0),\n });\n }}\n >\n package manager\n </button>{' '}\n an editor for the \"${documentType}\" document type\n </p>\n </div>\n }\n />\n );\n }\n\n const EditorComponent = editor.Component;\n const {\n disableExternalControls,\n documentToolbarEnabled,\n showSwitchboardLink,\n timelineEnabled,\n } = editor.config;\n\n const handleSwitchboardLinkClick =\n showSwitchboardLink !== false ? onOpenSwitchboardLink : undefined;\n return (\n <div className=\"relative h-full\" id=\"document-editor-context\">\n {documentToolbarEnabled &&\n disableExternalControls &&\n !revisionHistoryVisible && (\n <DocumentToolbar\n onClose={onClose}\n onExport={onExport}\n onShowRevisionHistory={showRevisionHistory}\n title={document.header.name}\n onSwitchboardLinkClick={handleSwitchboardLinkClick}\n timelineButtonVisible={timelineEnabled}\n timelineItems={timelineItems.data}\n onTimelineItemClick={setSelectedTimelineItem}\n />\n )}\n {!disableExternalControls && (\n <div className=\"mb-4 flex justify-end gap-10\">\n <Button onClick={onExport}>Export</Button>\n <div className=\"flex gap-4\">\n <Button onClick={handleUndo} disabled={!canUndo}>\n Undo\n </Button>\n <Button onClick={handleRedo} disabled={!canRedo}>\n Redo\n </Button>\n </div>\n <div className=\"flex gap-4\">\n <Button onClick={onClose}>Close</Button>\n </div>\n </div>\n )}\n {revisionHistoryVisible ? (\n <RevisionHistory\n key={documentId}\n documentTitle={document.header.name}\n documentId={document.header.id}\n globalOperations={document.operations.global}\n localOperations={document.operations.local}\n onClose={hideRevisionHistory}\n />\n ) : (\n <Suspense fallback={<EditorLoader />} name=\"EditorLoader\">\n <ErrorBoundary\n fallbackRender={FallbackEditorError}\n key={documentId}\n onError={handleEditorError}\n >\n {!editorError?.error && (\n <EditorComponent\n key={documentId}\n error={error}\n context={{\n ...context,\n readMode: !!selectedTimelineItem,\n selectedTimelineRevision:\n getRevisionFromDate(\n selectedTimelineItem?.startDate,\n selectedTimelineItem?.endDate,\n document.operations.global,\n ),\n }}\n document={document}\n documentNodeName={document.header.name}\n dispatch={dispatch}\n onClose={onClose}\n onExport={onExport}\n canUndo={canUndo}\n canRedo={canRedo}\n undo={handleUndo}\n redo={handleRedo}\n onSwitchboardLinkClick={\n handleSwitchboardLinkClick\n }\n onShowRevisionHistory={showRevisionHistory}\n isAllowedToCreateDocuments={\n userPermissions?.isAllowedToCreateDocuments ??\n false\n }\n isAllowedToEditDocuments={\n userPermissions?.isAllowedToEditDocuments ??\n false\n }\n />\n )}\n </ErrorBoundary>\n </Suspense>\n )}\n </div>\n );\n};\n","import { useDocumentDriveServer } from '#hooks';\nimport { useGetDocumentModelModule } from '#store';\nimport { buildDocumentSubgraphUrl } from '@powerhousedao/reactor-browser/utils/switchboard';\nimport {\n useDriveIsRemote,\n useDriveRemoteUrl,\n useParentFolderId,\n useSelectedDocument,\n useSelectedDrive,\n useSetSelectedNode,\n} from '@powerhousedao/state';\nimport { type Operation, type PHDocument } from 'document-model';\nimport { useCallback, useMemo } from 'react';\nimport { useTranslation } from 'react-i18next';\nimport { useModal } from '../components/modal/index.js';\nimport { exportFile, openUrl } from '../utils/index.js';\nimport { validateDocument } from '../utils/validate-document.js';\nimport { DocumentEditor } from './editors.js';\n\nexport function DocumentEditorContainer() {\n const { t } = useTranslation();\n const { showModal } = useModal();\n const { addDocumentOperations } = useDocumentDriveServer();\n const unwrappedSelectedDrive = useSelectedDrive();\n const selectedDocument = useSelectedDocument();\n const parentFolderId = useParentFolderId(selectedDocument?.header.id);\n const documentType = selectedDocument?.header.documentType;\n const isRemoteDrive = useDriveIsRemote(unwrappedSelectedDrive?.header.id);\n const remoteUrl = useDriveRemoteUrl(unwrappedSelectedDrive?.header.id);\n const getDocumentModelModule = useGetDocumentModelModule();\n const documentModelModule = documentType\n ? getDocumentModelModule(documentType)\n : undefined;\n const setSelectedNode = useSetSelectedNode();\n\n const onAddOperation = useCallback(\n async (operation: Operation) => {\n if (!selectedDocument?.header.id) {\n return;\n }\n await addDocumentOperations(selectedDocument.header.id, [\n operation,\n ]);\n },\n [addDocumentOperations, selectedDocument],\n );\n\n const onClose = useCallback(() => {\n setSelectedNode(parentFolderId);\n }, [parentFolderId, setSelectedNode]);\n\n const exportDocument = useCallback(\n (document: PHDocument) => {\n const validationErrors = validateDocument(document);\n\n if (validationErrors.length) {\n showModal('confirmationModal', {\n title: t('modals.exportDocumentWithErrors.title'),\n body: (\n <div>\n <p>{t('modals.exportDocumentWithErrors.body')}</p>\n <ul className=\"mt-4 flex list-disc flex-col items-start px-4 text-xs\">\n {validationErrors.map((error, index) => (\n <li key={index}>{error.message}</li>\n ))}\n </ul>\n </div>\n ),\n cancelLabel: t('common.cancel'),\n continueLabel: t('common.export'),\n onCancel(closeModal) {\n closeModal();\n },\n onContinue(closeModal) {\n closeModal();\n return exportFile(document, getDocumentModelModule);\n },\n });\n } else {\n return exportFile(document, getDocumentModelModule);\n }\n },\n [getDocumentModelModule, showModal, t],\n );\n\n const onExport = useCallback(() => {\n if (selectedDocument) {\n return exportDocument(selectedDocument);\n }\n }, [exportDocument, selectedDocument]);\n\n const onOpenSwitchboardLink = useMemo(() => {\n return isRemoteDrive\n ? async () => {\n if (!selectedDocument?.header.id) {\n console.error('No selected document');\n return;\n }\n\n if (!remoteUrl) {\n console.error('No remote drive url found');\n return;\n }\n\n if (!documentModelModule) {\n console.error('No document model found');\n return;\n }\n\n const url = buildDocumentSubgraphUrl(\n remoteUrl,\n selectedDocument.header.id,\n documentModelModule.documentModel,\n );\n try {\n await openUrl(url);\n } catch (e) {\n console.error('Error opening switchboard link', e);\n }\n }\n : undefined;\n }, [isRemoteDrive, remoteUrl, selectedDocument, documentModelModule]);\n\n if (!selectedDocument) return null;\n\n return (\n <div className=\"flex-1 rounded-2xl bg-gray-50 p-4\">\n <DocumentEditor\n document={selectedDocument}\n onClose={onClose}\n onExport={onExport}\n onAddOperation={onAddOperation}\n onOpenSwitchboardLink={onOpenSwitchboardLink}\n />\n </div>\n );\n}\n","import connectConfig from '#connect-config';\nimport {\n useDocumentDriveServer,\n useDocumentEditor as useDocumentEditorProps,\n useEditorProps,\n useNodeActions,\n useShowDeleteNodeModal,\n} from '#hooks';\nimport {\n useDriveEditor,\n useFilteredDocumentModels,\n useGetDocumentModelModule,\n useGetEditor,\n} from '#store';\nimport { useDocumentDispatch } from '#utils';\nimport { GenericDriveExplorer } from '@powerhousedao/common';\nimport { type IDriveContext } from '@powerhousedao/reactor-browser';\nimport { useSelectedDocument, useSelectedDrive } from '@powerhousedao/state';\nimport { driveDocumentModelModule } from 'document-drive';\nimport { type DocumentModelModule, type Operation } from 'document-model';\nimport { useCallback, useMemo } from 'react';\nimport { ErrorBoundary, type FallbackProps } from 'react-error-boundary';\nimport { useModal } from './modal/index.js';\n\nfunction DriveEditorError({ error }: FallbackProps) {\n return (\n <div className=\"mx-auto flex max-w-[80%] flex-1 flex-col items-center justify-center\">\n <h1 className=\"mb-2 text-xl font-semibold\">Error</h1>\n <i>{error instanceof Error ? error.message : error}</i>\n <pre>{JSON.stringify(error, null, 2)}</pre>\n </div>\n );\n}\n\nexport function DriveEditorContainer() {\n const { addDriveOperation, getSyncStatusSync } = useDocumentDriveServer();\n const selectedDrive = useSelectedDrive();\n const selectedDocument = useSelectedDocument();\n const nodeActions = useNodeActions();\n const [, _dispatch, error] = useDocumentDispatch(\n driveDocumentModelModule.reducer,\n selectedDrive,\n );\n const onAddOperation = useCallback(\n async (operation: Operation) => {\n if (!selectedDrive?.header.id) {\n throw new Error('No drive selected');\n }\n await addDriveOperation(selectedDrive.header.id, operation);\n },\n [addDriveOperation, selectedDrive?.header.id],\n );\n\n const editorProps = useEditorProps(\n selectedDrive,\n _dispatch,\n onAddOperation,\n );\n\n const { isAllowedToCreateDocuments } = editorProps;\n\n const { showModal } = useModal();\n const showCreateDocumentModal = useCallback(\n (documentModel: DocumentModelModule) => {\n showModal('createDocument', {\n documentModel,\n });\n },\n [showModal],\n );\n const showDeleteNodeModal = useShowDeleteNodeModal();\n const { addFile, addDocument } = useDocumentDriveServer();\n const documentModels = useFilteredDocumentModels() ?? [];\n const getDocumentModelModule = useGetDocumentModelModule();\n const getEditor = useGetEditor();\n const analyticsDatabaseName = connectConfig.analytics.databaseName;\n const showSearchBar = false;\n\n const driveContext: IDriveContext = useMemo(\n () => ({\n ...nodeActions,\n showSearchBar,\n isAllowedToCreateDocuments,\n documentModels,\n analyticsDatabaseName,\n getSyncStatusSync,\n getDocumentModelModule,\n getEditor,\n addFile,\n showCreateDocumentModal,\n showDeleteNodeModal,\n useDocumentEditorProps,\n addDocument,\n }),\n [\n nodeActions,\n isAllowedToCreateDocuments,\n documentModels,\n addFile,\n addDocument,\n getSyncStatusSync,\n getDocumentModelModule,\n getEditor,\n showDeleteNodeModal,\n showCreateDocumentModal,\n ],\n );\n\n const driveEditor = useDriveEditor(\n selectedDrive?.header.meta?.preferredEditor,\n );\n\n const DriveEditorComponent =\n driveEditor?.Component ?? GenericDriveExplorer.Component;\n\n if (selectedDocument || !selectedDrive) return null;\n\n return (\n <ErrorBoundary\n fallbackRender={DriveEditorError}\n key={selectedDrive.header.id}\n >\n <DriveEditorComponent\n {...editorProps}\n context={{\n ...editorProps.context,\n ...driveContext,\n }}\n onSwitchboardLinkClick={undefined} // TODO\n document={selectedDrive}\n error={error}\n />\n </ErrorBoundary>\n );\n}\n","export function useUserPermissions() {\n return {\n isAllowedToCreateDocuments: true,\n isAllowedToEditDocuments: true,\n };\n}\n//# sourceMappingURL=useUserPermissions.js.map","import { useCallback, useEffect, useState } from \"react\";\nexport function useDocument(reactor, documentMeta = {}) {\n const { documentId, documentType } = documentMeta;\n const [document, setDocument] = useState();\n const onStrandUpdate = useCallback((cb) => {\n if (!reactor) {\n throw new Error(\"Reactor is not loaded\");\n }\n return reactor.on(\"strandUpdate\", cb);\n }, [reactor]);\n useEffect(() => {\n if (!reactor)\n return;\n if (!documentId || !documentType)\n return;\n reactor.getDocument(documentId).then(setDocument).catch(console.error);\n }, [documentId, documentType, reactor]);\n useEffect(() => {\n if (!reactor)\n return;\n if (!documentId || !documentType)\n return;\n const removeListener = onStrandUpdate((strand) => {\n if (strand.documentId === documentId) {\n reactor.getDocument(documentId).then(setDocument).catch(console.error);\n }\n });\n return removeListener;\n }, [onStrandUpdate, documentId, documentType]);\n return document;\n}\n//# sourceMappingURL=useDocument.js.map","import { buildSignedAction, } from \"document-model\";\nexport async function signOperation(operation, sign, document, reducer, user) {\n if (!user)\n return operation;\n if (!operation.action?.context?.signer)\n return operation;\n if (!reducer) {\n console.error(`Document model '${document.header.documentType}' does not have a reducer`);\n return operation;\n }\n const signedAction = await buildSignedAction(operation.action, reducer, document, operation.action.context.signer, sign);\n return signedAction;\n}\nexport function addActionContext(action, connectDid, user) {\n if (!user)\n return action;\n const signer = {\n app: {\n name: \"Connect\",\n key: connectDid || \"\",\n },\n user: {\n address: user.address,\n networkId: user.networkId,\n chainId: user.chainId,\n },\n signatures: [],\n };\n return {\n context: { signer },\n ...action,\n };\n}\n//# sourceMappingURL=signature.js.map","import { useCallback, useMemo } from \"react\";\nimport { useUserPermissions } from \"./useUserPermissions.js\";\nfunction debounceOperations(callback, timeout = 50) {\n let timer;\n const operations = [];\n return (operation) => {\n if (timer) {\n clearTimeout(timer);\n }\n const index = operations.findIndex((op) => op.scope === operation.scope && op.index === operation.index);\n if (index > -1) {\n const oldOperation = operations[index];\n if (!(oldOperation.type === operation.type &&\n JSON.stringify(operation.input) === JSON.stringify(oldOperation.input))) {\n console.warn(\"Two conflicting operations were dispatched:\", oldOperation, operation);\n }\n operations[index] = operation;\n }\n else {\n operations.push(operation);\n }\n return new Promise((resolve, reject) => {\n timer = setTimeout(() => {\n callback(operations).then(resolve).catch(reject);\n }, timeout);\n });\n };\n}\nexport function useAddDebouncedOperations(reactor, props) {\n const { documentId } = props;\n const { isAllowedToEditDocuments } = useUserPermissions() || {\n isAllowedToCreateDocuments: false,\n isAllowedToEditDocuments: false,\n };\n const addOperations = useCallback(async (id, operations) => {\n if (!isAllowedToEditDocuments) {\n throw new Error(\"User is not allowed to edit documents\");\n }\n if (!reactor) {\n throw new Error(\"Reactor is not loaded\");\n }\n if (!id) {\n throw new Error(\"Document id is not set\");\n }\n const newDocument = await reactor.queueOperations(id, operations);\n return newDocument.document;\n }, [isAllowedToEditDocuments, reactor]);\n const addDebouncedOperations = useMemo(() => {\n return debounceOperations((operations) => addOperations(documentId, operations));\n }, [addOperations, documentId]);\n return addDebouncedOperations;\n}\n//# sourceMappingURL=useAddDebouncedOperations.js.map","import { useEffect, useState } from \"react\";\nexport function useDocumentDispatch(documentReducer, initialState, onError = console.error) {\n const [state, setState] = useState(initialState);\n const [error, setError] = useState();\n const onErrorHandler = (error) => {\n setError(error);\n onError(error);\n };\n useEffect(() => {\n setState(initialState);\n }, [initialState]);\n const dispatch = (action, callback, onErrorCallback) => {\n setError(undefined);\n setState((_state) => {\n if (!documentReducer || !_state)\n return _state;\n try {\n const newState = documentReducer(_state, action);\n const scope = action.scope ?? \"global\";\n const operations = newState.operations[scope];\n const operation = operations[operations.length - 1];\n if (operation.error) {\n const error = new Error(operation.error);\n onErrorHandler(error);\n onErrorCallback?.(error);\n }\n callback?.(operation, {\n prevState: { ..._state },\n newState: { ...newState },\n });\n return newState;\n }\n catch (error) {\n onErrorHandler(error);\n onErrorCallback?.(error);\n return _state;\n }\n });\n };\n return [state, dispatch, error];\n}\n//# sourceMappingURL=useDocumentDispatch.js.map","import { addActionContext, signOperation } from \"../utils/signature.js\";\nimport { useAddDebouncedOperations } from \"./useAddDebouncedOperations.js\";\nimport { useConnectCrypto, useConnectDid } from \"./useConnectCrypto.js\";\nimport { useDocumentDispatch } from \"./useDocumentDispatch.js\";\nexport function useDocumentEditorProps(reactor, props) {\n const { nodeId, documentModelModule, document: initialDocument, user, connectDid, sign, } = props;\n const addDebouncedOperations = useAddDebouncedOperations(reactor, {\n documentId: nodeId,\n });\n const [document, _dispatch, error] = useDocumentDispatch(documentModelModule?.reducer, initialDocument);\n function dispatch(action, onErrorCallback) {\n const callback = (operation, state) => {\n const { prevState } = state;\n if (!nodeId) {\n throw new Error(\"Node id is not set\");\n }\n signOperation(operation, sign, prevState, documentModelModule?.reducer, user)\n .then((op) => {\n return addDebouncedOperations(op);\n })\n .catch(console.error);\n };\n _dispatch(addActionContext(action, connectDid, user), callback, onErrorCallback);\n }\n return {\n dispatch,\n document,\n error,\n };\n}\nexport function useDocumentEditor(reactor, props) {\n const connectDid = useConnectDid();\n const { sign } = useConnectCrypto();\n const documentEditorDispatch = useDocumentEditorProps(reactor, {\n ...props,\n connectDid,\n sign,\n });\n return documentEditorDispatch;\n}\n//# sourceMappingURL=useDocumentEditor.js.map","import {\n useDocument,\n useDocumentEditorProps,\n type User,\n} from '@powerhousedao/reactor-browser';\nimport { type DocumentModelModule, type PHDocument } from 'document-model';\n\nimport { useConnectCrypto, useConnectDid } from '#hooks';\nimport { useReactor } from '@powerhousedao/state';\n\nexport interface DocumentEditorProps {\n driveId: string | undefined;\n documentId: string | undefined;\n documentType: string | undefined;\n documentModelModule: DocumentModelModule<PHDocument> | undefined;\n user?: User;\n}\n\nexport function useDocumentEditor(props: DocumentEditorProps) {\n const { driveId, documentId, documentType, documentModelModule, user } =\n props;\n\n const reactor = useReactor();\n const connectDid = useConnectDid();\n const { sign } = useConnectCrypto();\n\n const doc = useDocument(reactor, { documentId, documentType });\n\n const documentEditorProps = useDocumentEditorProps(reactor, {\n nodeId: documentId,\n driveId: driveId,\n document: doc,\n documentModelModule,\n connectDid,\n sign,\n user,\n });\n\n return documentEditorProps;\n}\n","import { useModal } from '#components';\nimport { themeAtom, useGetDocumentModelModule, useUser } from '#store';\nimport {\n addActionContext,\n type DocumentDispatch,\n type DocumentDispatchCallback,\n exportFile,\n signOperation,\n validateDocument,\n} from '#utils';\nimport {\n useParentFolder,\n useSelectedDrive,\n useSetSelectedNode,\n} from '@powerhousedao/state';\nimport { logger } from 'document-drive';\nimport {\n type Action,\n type ActionErrorCallback,\n type EditorContext,\n type Operation,\n type PHDocument,\n redo,\n undo,\n} from 'document-model';\nimport { useAtomValue } from 'jotai';\nimport { useCallback, useMemo, useState } from 'react';\nimport { useTranslation } from 'react-i18next';\nimport { useConnectCrypto, useConnectDid } from './useConnectCrypto.js';\nimport { useUserPermissions } from './useUserPermissions.js';\n\nexport interface EditorProps {\n context: EditorContext;\n canUndo: boolean;\n canRedo: boolean;\n undo: () => void;\n redo: () => void;\n onClose: () => void;\n onExport: () => void;\n onShowRevisionHistory: () => void;\n isAllowedToCreateDocuments: boolean;\n isAllowedToEditDocuments: boolean;\n}\n\nexport function useEditorDispatch<T extends PHDocument = PHDocument>(\n document: T | undefined,\n documentDispatch: DocumentDispatch<T>,\n onAddOperation: (operation: Operation) => Promise<void>,\n) {\n const user = useUser() || undefined;\n const connectDid = useConnectDid();\n const { sign } = useConnectCrypto();\n const documentType = document?.header.documentType;\n const getDocumentModelModule = useGetDocumentModelModule();\n const documentModelModule = useMemo(\n () => (documentType ? getDocumentModelModule(documentType) : undefined),\n [documentType, getDocumentModelModule],\n );\n\n const dispatch = useCallback(\n (action: Action, onErrorCallback?: ActionErrorCallback) => {\n const callback: DocumentDispatchCallback<PHDocument> = (\n operation,\n state,\n ) => {\n if (!document?.header.id) return;\n\n const { prevState } = state;\n\n signOperation(\n operation,\n sign,\n document.header.id,\n prevState,\n documentModelModule?.reducer,\n user,\n )\n .then(op => {\n window.documentEditorDebugTools?.pushOperation(\n operation,\n );\n return onAddOperation(op);\n })\n .catch(logger.error);\n };\n\n documentDispatch(\n addActionContext(action, connectDid, user),\n callback,\n onErrorCallback,\n );\n },\n [\n documentDispatch,\n connectDid,\n documentModelModule?.reducer,\n onAddOperation,\n document?.header.id,\n sign,\n user,\n ],\n );\n\n return dispatch;\n}\n\nexport function useEditorProps<T extends PHDocument = PHDocument>(\n document: T | undefined,\n documentDispatch: DocumentDispatch<T>,\n onAddOperation: (operation: Operation) => Promise<void>,\n) {\n const { t } = useTranslation();\n const { showModal } = useModal();\n const theme = useAtomValue(themeAtom);\n const user = useUser() || undefined;\n const userPermissions = useUserPermissions();\n const selectedDrive = useSelectedDrive();\n const parentFolder = useParentFolder(document?.header.id);\n const setSelectedNode = useSetSelectedNode();\n const context = useMemo(() => ({ theme, user }), [theme, user]);\n const getDocumentModelModule = useGetDocumentModelModule();\n\n const canUndo =\n !!document &&\n (document.header.revision.global > 0 ||\n document.header.revision.local > 0);\n const canRedo = !!document?.clipboard.length;\n\n const dispatch = useEditorDispatch(\n document,\n documentDispatch,\n onAddOperation,\n );\n\n const handleUndo = useCallback(() => {\n dispatch(undo());\n }, [dispatch]);\n\n const handleRedo = useCallback(() => {\n dispatch(redo());\n }, [dispatch]);\n\n const onClose = useCallback(() => {\n setSelectedNode(parentFolder?.id);\n }, [parentFolder, setSelectedNode]);\n\n const exportDocument = useCallback(\n (document: PHDocument) => {\n const validationErrors = validateDocument(document);\n\n if (validationErrors.length) {\n showModal('confirmationModal', {\n title: t('modals.exportDocumentWithErrors.title'),\n body: (\n <div>\n <p>{t('modals.exportDocumentWithErrors.body')}</p>\n <ul className=\"mt-4 flex list-disc flex-col items-start px-4 text-xs\">\n {validationErrors.map((error, index) => (\n <li key={index}>{error.message}</li>\n ))}\n </ul>\n </div>\n ),\n cancelLabel: t('common.cancel'),\n continueLabel: t('common.export'),\n onCancel(closeModal) {\n closeModal();\n },\n onContinue(closeModal) {\n closeModal();\n return exportFile(document, getDocumentModelModule);\n },\n });\n } else {\n return exportFile(document, getDocumentModelModule);\n }\n },\n [getDocumentModelModule, showModal, t],\n );\n\n const onExport = useCallback(() => {\n if (document) {\n return exportDocument(document);\n }\n }, [exportDocument, document]);\n\n const [revisionHistoryVisible, setRevisionHistoryVisible] = useState(false);\n const showRevisionHistory = useCallback(\n () => setRevisionHistoryVisible(true),\n [],\n );\n\n return {\n dispatch,\n revisionHistoryVisible,\n context,\n canUndo,\n canRedo,\n undo: handleUndo,\n redo: handleRedo,\n onClose,\n onExport,\n onShowRevisionHistory: showRevisionHistory,\n isAllowedToCreateDocuments:\n userPermissions?.isAllowedToCreateDocuments ?? false,\n isAllowedToEditDocuments:\n userPermissions?.isAllowedToEditDocuments ?? false,\n };\n}\n","import { type TNodeActions } from '@powerhousedao/design-system';\nimport {\n useSelectedDrive,\n useSelectedFolder,\n useSelectedParentFolder,\n useSetSelectedNode,\n} from '@powerhousedao/state';\nimport { type Node } from 'document-drive';\nimport { useCallback, useMemo } from 'react';\nimport { useDocumentDriveServer } from './useDocumentDriveServer.js';\nexport function useDebugHandlers() {\n const { removeTrigger, addTrigger, registerNewPullResponderTrigger } =\n useDocumentDriveServer();\n\n const onAddTrigger = useCallback(\n async (driveId: string) => {\n const url = window.prompt('url') || '';\n\n const pullResponderTrigger = await registerNewPullResponderTrigger(\n driveId,\n url,\n { pullInterval: 6000 },\n );\n if (!pullResponderTrigger) return;\n await addTrigger(driveId, pullResponderTrigger);\n },\n [addTrigger, registerNewPullResponderTrigger],\n );\n\n const onRemoveTrigger = useCallback(\n async (driveId: string) => {\n const triggerId = window.prompt('triggerId:');\n\n if (triggerId) {\n await removeTrigger(driveId, triggerId);\n }\n },\n [removeTrigger],\n );\n\n const onAddInvalidTrigger = useCallback(\n async (driveId: string) => {\n const url = window.prompt('url') || '';\n\n await addTrigger(driveId, {\n id: 'some-invalid-id',\n type: 'PullResponder',\n data: {\n interval: '3000',\n listenerId: 'invalid-listener-id',\n url,\n },\n });\n },\n [addTrigger],\n );\n\n return {\n onAddTrigger,\n onRemoveTrigger,\n onAddInvalidTrigger,\n };\n}\n\nexport function useNodeActions(): TNodeActions {\n const selectedDrive = useSelectedDrive();\n const selectedFolder = useSelectedFolder();\n const selectedParentFolder = useSelectedParentFolder();\n const setSelectedNode = useSetSelectedNode();\n const { addFolder, addFile, renameNode, copyNode, moveNode } =\n useDocumentDriveServer();\n\n const onAddFile = useCallback(\n async (file: File, parent: Node | undefined) => {\n if (!selectedDrive?.header.id) return;\n\n const fileName = file.name.replace(/\\.zip$/gim, '');\n\n return await addFile(\n file,\n selectedDrive.header.id,\n fileName,\n parent?.id,\n );\n },\n [addFile, selectedDrive?.header.id],\n );\n\n const onAddFolder = useCallback(\n async (name: string, parent: { id: string } | undefined) => {\n if (!selectedDrive?.header.id) return;\n\n return await addFolder(selectedDrive.header.id, name, parent?.id);\n },\n [addFolder, selectedDrive?.header.id],\n );\n\n const onRenameNode = useCallback(\n async (newName: string, node: Node): Promise<Node | undefined> => {\n if (!selectedDrive?.header.id) return;\n\n return await renameNode(selectedDrive.header.id, node.id, newName);\n },\n [renameNode, selectedDrive?.header.id],\n );\n\n const onCopyNode = useCallback(\n async (src: Node, target: Node | undefined) => {\n await copyNode(src, target);\n },\n [copyNode],\n );\n\n const onMoveNode = useCallback(\n async (src: Node, target: Node | undefined) => {\n await moveNode(src, target);\n },\n [moveNode],\n );\n\n const onDuplicateNode = useCallback(\n async (src: Node) => {\n await copyNode(src, selectedFolder ?? selectedParentFolder);\n },\n [copyNode, selectedFolder, selectedParentFolder],\n );\n\n const onAddAndSelectNewFolder = useCallback(\n async (name: string) => {\n if (!name) return;\n\n const newFolder = await onAddFolder(\n name,\n selectedFolder ?? selectedParentFolder,\n );\n\n if (newFolder) {\n setSelectedNode(newFolder.id);\n }\n },\n [onAddFolder, selectedFolder, selectedParentFolder, setSelectedNode],\n );\n\n return useMemo(\n () => ({\n onAddFile,\n onAddFolder,\n onRenameNode,\n onCopyNode,\n onMoveNode,\n onDuplicateNode,\n onAddAndSelectNewFolder,\n }),\n [\n onAddFolder,\n onAddFile,\n onCopyNode,\n onMoveNode,\n onRenameNode,\n onDuplicateNode,\n onAddAndSelectNewFolder,\n ],\n );\n}\n","import { useContext, createContext, useState, useCallback, useRef, useLayoutEffect, useEffect } from 'react';\nimport { jsx } from 'react/jsx-runtime';\n\nfunction _extends() {\n return _extends = Object.assign ? Object.assign.bind() : function (n) {\n for (var e = 1; e < arguments.length; e++) {\n var t = arguments[e];\n for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);\n }\n return n;\n }, _extends.apply(null, arguments);\n}\n\nvar reservedModifierKeywords = ['shift', 'alt', 'meta', 'mod', 'ctrl'];\nvar mappedKeys = {\n esc: 'escape',\n \"return\": 'enter',\n '.': 'period',\n ',': 'comma',\n '-': 'slash',\n ' ': 'space',\n '`': 'backquote',\n '#': 'backslash',\n '+': 'bracketright',\n ShiftLeft: 'shift',\n ShiftRight: 'shift',\n AltLeft: 'alt',\n AltRight: 'alt',\n MetaLeft: 'meta',\n MetaRight: 'meta',\n OSLeft: 'meta',\n OSRight: 'meta',\n ControlLeft: 'ctrl',\n ControlRight: 'ctrl'\n};\nfunction mapKey(key) {\n return (key && mappedKeys[key] || key || '').trim().toLowerCase().replace(/key|digit|numpad|arrow/, '');\n}\nfunction isHotkeyModifier(key) {\n return reservedModifierKeywords.includes(key);\n}\nfunction parseKeysHookInput(keys, splitKey) {\n if (splitKey === void 0) {\n splitKey = ',';\n }\n return keys.split(splitKey);\n}\nfunction parseHotkey(hotkey, combinationKey, description) {\n if (combinationKey === void 0) {\n combinationKey = '+';\n }\n var keys = hotkey.toLocaleLowerCase().split(combinationKey).map(function (k) {\n return mapKey(k);\n });\n var modifiers = {\n alt: keys.includes('alt'),\n ctrl: keys.includes('ctrl') || keys.includes('control'),\n shift: keys.includes('shift'),\n meta: keys.includes('meta'),\n mod: keys.includes('mod')\n };\n var singleCharKeys = keys.filter(function (k) {\n return !reservedModifierKeywords.includes(k);\n });\n return _extends({}, modifiers, {\n keys: singleCharKeys,\n description: description,\n hotkey: hotkey\n });\n}\n\n(function () {\n if (typeof document !== 'undefined') {\n document.addEventListener('keydown', function (e) {\n if (e.key === undefined) {\n // Synthetic event (e.g., Chrome autofill). Ignore.\n return;\n }\n pushToCurrentlyPressedKeys([mapKey(e.key), mapKey(e.code)]);\n });\n document.addEventListener('keyup', function (e) {\n if (e.key === undefined) {\n // Synthetic event (e.g., Chrome autofill). Ignore.\n return;\n }\n removeFromCurrentlyPressedKeys([mapKey(e.key), mapKey(e.code)]);\n });\n }\n if (typeof window !== 'undefined') {\n window.addEventListener('blur', function () {\n currentlyPressedKeys.clear();\n });\n }\n})();\nvar currentlyPressedKeys = /*#__PURE__*/new Set();\n// https://github.com/microsoft/TypeScript/issues/17002\nfunction isReadonlyArray(value) {\n return Array.isArray(value);\n}\nfunction isHotkeyPressed(key, splitKey) {\n if (splitKey === void 0) {\n splitKey = ',';\n }\n var hotkeyArray = isReadonlyArray(key) ? key : key.split(splitKey);\n return hotkeyArray.every(function (hotkey) {\n return currentlyPressedKeys.has(hotkey.trim().toLowerCase());\n });\n}\nfunction pushToCurrentlyPressedKeys(key) {\n var hotkeyArray = Array.isArray(key) ? key : [key];\n /*\r\n Due to a weird behavior on macOS we need to clear the set if the user pressed down the meta key and presses another key.\r\n https://stackoverflow.com/questions/11818637/why-does-javascript-drop-keyup-events-when-the-metakey-is-pressed-on-mac-browser\r\n Otherwise the set will hold all ever pressed keys while the meta key is down which leads to wrong results.\r\n */\n if (currentlyPressedKeys.has('meta')) {\n currentlyPressedKeys.forEach(function (key) {\n return !isHotkeyModifier(key) && currentlyPressedKeys[\"delete\"](key.toLowerCase());\n });\n }\n hotkeyArray.forEach(function (hotkey) {\n return currentlyPressedKeys.add(hotkey.toLowerCase());\n });\n}\nfunction removeFromCurrentlyPressedKeys(key) {\n var hotkeyArray = Array.isArray(key) ? key : [key];\n /*\r\n Due to a weird behavior on macOS we need to clear the set if the user pressed down the meta key and presses another key.\r\n https://stackoverflow.com/questions/11818637/why-does-javascript-drop-keyup-events-when-the-metakey-is-pressed-on-mac-browser\r\n Otherwise the set will hold all ever pressed keys while the meta key is down which leads to wrong results.\r\n */\n if (key === 'meta') {\n currentlyPressedKeys.clear();\n } else {\n hotkeyArray.forEach(function (hotkey) {\n return currentlyPressedKeys[\"delete\"](hotkey.toLowerCase());\n });\n }\n}\n\nfunction maybePreventDefault(e, hotkey, preventDefault) {\n if (typeof preventDefault === 'function' && preventDefault(e, hotkey) || preventDefault === true) {\n e.preventDefault();\n }\n}\nfunction isHotkeyEnabled(e, hotkey, enabled) {\n if (typeof enabled === 'function') {\n return enabled(e, hotkey);\n }\n return enabled === true || enabled === undefined;\n}\nfunction isKeyboardEventTriggeredByInput(ev) {\n return isHotkeyEnabledOnTag(ev, ['input', 'textarea', 'select']);\n}\nfunction isHotkeyEnabledOnTag(event, enabledOnTags) {\n if (enabledOnTags === void 0) {\n enabledOnTags = false;\n }\n var target = event.target,\n composed = event.composed;\n var targetTagName = null;\n if (isCustomElement(target) && composed) {\n targetTagName = event.composedPath()[0] && event.composedPath()[0].tagName;\n } else {\n targetTagName = target && target.tagName;\n }\n if (isReadonlyArray(enabledOnTags)) {\n return Boolean(targetTagName && enabledOnTags && enabledOnTags.some(function (tag) {\n var _targetTagName;\n return tag.toLowerCase() === ((_targetTagName = targetTagName) == null ? void 0 : _targetTagName.toLowerCase());\n }));\n }\n return Boolean(targetTagName && enabledOnTags && enabledOnTags);\n}\nfunction isCustomElement(element) {\n // We just do a basic check w/o any complex RegEx or validation against the list of legacy names containing a hyphen,\n // as none of them is likely to be an event target, and it won't hurt anyway if we miss.\n // see: https://html.spec.whatwg.org/multipage/custom-elements.html#prod-potentialcustomelementname\n return !!element.tagName && !element.tagName.startsWith(\"-\") && element.tagName.includes(\"-\");\n}\nfunction isScopeActive(activeScopes, scopes) {\n if (activeScopes.length === 0 && scopes) {\n console.warn('A hotkey has the \"scopes\" option set, however no active scopes were found. If you want to use the global scopes feature, you need to wrap your app in a <HotkeysProvider>');\n return true;\n }\n if (!scopes) {\n return true;\n }\n return activeScopes.some(function (scope) {\n return scopes.includes(scope);\n }) || activeScopes.includes('*');\n}\nvar isHotkeyMatchingKeyboardEvent = function isHotkeyMatchingKeyboardEvent(e, hotkey, ignoreModifiers) {\n if (ignoreModifiers === void 0) {\n ignoreModifiers = false;\n }\n var alt = hotkey.alt,\n meta = hotkey.meta,\n mod = hotkey.mod,\n shift = hotkey.shift,\n ctrl = hotkey.ctrl,\n keys = hotkey.keys;\n var pressedKeyUppercase = e.key,\n code = e.code,\n ctrlKey = e.ctrlKey,\n metaKey = e.metaKey,\n shiftKey = e.shiftKey,\n altKey = e.altKey;\n var keyCode = mapKey(code);\n var pressedKey = pressedKeyUppercase.toLowerCase();\n if (!(keys != null && keys.includes(keyCode)) && !(keys != null && keys.includes(pressedKey)) && !['ctrl', 'control', 'unknown', 'meta', 'alt', 'shift', 'os'].includes(keyCode)) {\n return false;\n }\n if (!ignoreModifiers) {\n // We check the pressed keys for compatibility with the keyup event. In keyup events the modifier flags are not set.\n if (alt === !altKey && pressedKey !== 'alt') {\n return false;\n }\n if (shift === !shiftKey && pressedKey !== 'shift') {\n return false;\n }\n // Mod is a special key name that is checking for meta on macOS and ctrl on other platforms\n if (mod) {\n if (!metaKey && !ctrlKey) {\n return false;\n }\n } else {\n if (meta === !metaKey && pressedKey !== 'meta' && pressedKey !== 'os') {\n return false;\n }\n if (ctrl === !ctrlKey && pressedKey !== 'ctrl' && pressedKey !== 'control') {\n return false;\n }\n }\n }\n // All modifiers are correct, now check the key\n // If the key is set, we check for the key\n if (keys && keys.length === 1 && (keys.includes(pressedKey) || keys.includes(keyCode))) {\n return true;\n } else if (keys) {\n // Check if all keys are present in pressedDownKeys set\n return isHotkeyPressed(keys);\n } else if (!keys) {\n // If the key is not set, we only listen for modifiers, that check went alright, so we return true\n return true;\n }\n // There is nothing that matches.\n return false;\n};\n\nvar BoundHotkeysProxyProvider = /*#__PURE__*/createContext(undefined);\nvar useBoundHotkeysProxy = function useBoundHotkeysProxy() {\n return useContext(BoundHotkeysProxyProvider);\n};\nfunction BoundHotkeysProxyProviderProvider(_ref) {\n var addHotkey = _ref.addHotkey,\n removeHotkey = _ref.removeHotkey,\n children = _ref.children;\n return /*#__PURE__*/jsx(BoundHotkeysProxyProvider.Provider, {\n value: {\n addHotkey: addHotkey,\n removeHotkey: removeHotkey\n },\n children: children\n });\n}\n\nfunction deepEqual(x, y) {\n //@ts-ignore\n return x && y && typeof x === 'object' && typeof y === 'object' ? Object.keys(x).length === Object.keys(y).length &&\n //@ts-ignore\n Object.keys(x).reduce(function (isEqual, key) {\n return isEqual && deepEqual(x[key], y[key]);\n }, true) : x === y;\n}\n\nvar HotkeysContext = /*#__PURE__*/createContext({\n hotkeys: [],\n enabledScopes: [],\n toggleScope: function toggleScope() {},\n enableScope: function enableScope() {},\n disableScope: function disableScope() {}\n});\nvar useHotkeysContext = function useHotkeysContext() {\n return useContext(HotkeysContext);\n};\nvar HotkeysProvider = function HotkeysProvider(_ref) {\n var _ref$initiallyActiveS = _ref.initiallyActiveScopes,\n initiallyActiveScopes = _ref$initiallyActiveS === void 0 ? ['*'] : _ref$initiallyActiveS,\n children = _ref.children;\n var _useState = useState((initiallyActiveScopes == null ? void 0 : initiallyActiveScopes.length) > 0 ? initiallyActiveScopes : ['*']),\n internalActiveScopes = _useState[0],\n setInternalActiveScopes = _useState[1];\n var _useState2 = useState([]),\n boundHotkeys = _useState2[0],\n setBoundHotkeys = _useState2[1];\n var enableScope = useCallback(function (scope) {\n setInternalActiveScopes(function (prev) {\n if (prev.includes('*')) {\n return [scope];\n }\n return Array.from(new Set([].concat(prev, [scope])));\n });\n }, []);\n var disableScope = useCallback(function (scope) {\n setInternalActiveScopes(function (prev) {\n if (prev.filter(function (s) {\n return s !== scope;\n }).length === 0) {\n return ['*'];\n } else {\n return prev.filter(function (s) {\n return s !== scope;\n });\n }\n });\n }, []);\n var toggleScope = useCallback(function (scope) {\n setInternalActiveScopes(function (prev) {\n if (prev.includes(scope)) {\n if (prev.filter(function (s) {\n return s !== scope;\n }).length === 0) {\n return ['*'];\n } else {\n return prev.filter(function (s) {\n return s !== scope;\n });\n }\n } else {\n if (prev.includes('*')) {\n return [scope];\n }\n return Array.from(new Set([].concat(prev, [scope])));\n }\n });\n }, []);\n var addBoundHotkey = useCallback(function (hotkey) {\n setBoundHotkeys(function (prev) {\n return [].concat(prev, [hotkey]);\n });\n }, []);\n var removeBoundHotkey = useCallback(function (hotkey) {\n setBoundHotkeys(function (prev) {\n return prev.filter(function (h) {\n return !deepEqual(h, hotkey);\n });\n });\n }, []);\n return /*#__PURE__*/jsx(HotkeysContext.Provider, {\n value: {\n enabledScopes: internalActiveScopes,\n hotkeys: boundHotkeys,\n enableScope: enableScope,\n disableScope: disableScope,\n toggleScope: toggleScope\n },\n children: /*#__PURE__*/jsx(BoundHotkeysProxyProviderProvider, {\n addHotkey: addBoundHotkey,\n removeHotkey: removeBoundHotkey,\n children: children\n })\n });\n};\n\nfunction useDeepEqualMemo(value) {\n var ref = useRef(undefined);\n if (!deepEqual(ref.current, value)) {\n ref.current = value;\n }\n return ref.current;\n}\n\nvar stopPropagation = function stopPropagation(e) {\n e.stopPropagation();\n e.preventDefault();\n e.stopImmediatePropagation();\n};\nvar useSafeLayoutEffect = typeof window !== 'undefined' ? useLayoutEffect : useEffect;\nfunction useHotkeys(keys, callback, options, dependencies) {\n var _useState = useState(null),\n ref = _useState[0],\n setRef = _useState[1];\n var hasTriggeredRef = useRef(false);\n var _options = !(options instanceof Array) ? options : !(dependencies instanceof Array) ? dependencies : undefined;\n var _keys = isReadonlyArray(keys) ? keys.join(_options == null ? void 0 : _options.splitKey) : keys;\n var _deps = options instanceof Array ? options : dependencies instanceof Array ? dependencies : undefined;\n var memoisedCB = useCallback(callback, _deps != null ? _deps : []);\n var cbRef = useRef(memoisedCB);\n if (_deps) {\n cbRef.current = memoisedCB;\n } else {\n cbRef.current = callback;\n }\n var memoisedOptions = useDeepEqualMemo(_options);\n var _useHotkeysContext = useHotkeysContext(),\n enabledScopes = _useHotkeysContext.enabledScopes;\n var proxy = useBoundHotkeysProxy();\n useSafeLayoutEffect(function () {\n if ((memoisedOptions == null ? void 0 : memoisedOptions.enabled) === false || !isScopeActive(enabledScopes, memoisedOptions == null ? void 0 : memoisedOptions.scopes)) {\n return;\n }\n var listener = function listener(e, isKeyUp) {\n var _e$target;\n if (isKeyUp === void 0) {\n isKeyUp = false;\n }\n if (isKeyboardEventTriggeredByInput(e) && !isHotkeyEnabledOnTag(e, memoisedOptions == null ? void 0 : memoisedOptions.enableOnFormTags)) {\n return;\n }\n // TODO: SINCE THE EVENT IS NOW ATTACHED TO THE REF, THE ACTIVE ELEMENT CAN NEVER BE INSIDE THE REF. THE HOTKEY ONLY TRIGGERS IF THE\n // REF IS THE ACTIVE ELEMENT. THIS IS A PROBLEM SINCE FOCUSED SUB COMPONENTS WON'T TRIGGER THE HOTKEY.\n if (ref !== null) {\n var rootNode = ref.getRootNode();\n if ((rootNode instanceof Document || rootNode instanceof ShadowRoot) && rootNode.activeElement !== ref && !ref.contains(rootNode.activeElement)) {\n stopPropagation(e);\n return;\n }\n }\n if ((_e$target = e.target) != null && _e$target.isContentEditable && !(memoisedOptions != null && memoisedOptions.enableOnContentEditable)) {\n return;\n }\n parseKeysHookInput(_keys, memoisedOptions == null ? void 0 : memoisedOptions.splitKey).forEach(function (key) {\n var _hotkey$keys;\n var hotkey = parseHotkey(key, memoisedOptions == null ? void 0 : memoisedOptions.combinationKey);\n if (isHotkeyMatchingKeyboardEvent(e, hotkey, memoisedOptions == null ? void 0 : memoisedOptions.ignoreModifiers) || (_hotkey$keys = hotkey.keys) != null && _hotkey$keys.includes('*')) {\n if (memoisedOptions != null && memoisedOptions.ignoreEventWhen != null && memoisedOptions.ignoreEventWhen(e)) {\n return;\n }\n if (isKeyUp && hasTriggeredRef.current) {\n return;\n }\n maybePreventDefault(e, hotkey, memoisedOptions == null ? void 0 : memoisedOptions.preventDefault);\n if (!isHotkeyEnabled(e, hotkey, memoisedOptions == null ? void 0 : memoisedOptions.enabled)) {\n stopPropagation(e);\n return;\n }\n // Execute the user callback for that hotkey\n cbRef.current(e, hotkey);\n if (!isKeyUp) {\n hasTriggeredRef.current = true;\n }\n }\n });\n };\n var handleKeyDown = function handleKeyDown(event) {\n if (event.key === undefined) {\n // Synthetic event (e.g., Chrome autofill). Ignore.\n return;\n }\n pushToCurrentlyPressedKeys(mapKey(event.code));\n if ((memoisedOptions == null ? void 0 : memoisedOptions.keydown) === undefined && (memoisedOptions == null ? void 0 : memoisedOptions.keyup) !== true || memoisedOptions != null && memoisedOptions.keydown) {\n listener(event);\n }\n };\n var handleKeyUp = function handleKeyUp(event) {\n if (event.key === undefined) {\n // Synthetic event (e.g., Chrome autofill). Ignore.\n return;\n }\n removeFromCurrentlyPressedKeys(mapKey(event.code));\n hasTriggeredRef.current = false;\n if (memoisedOptions != null && memoisedOptions.keyup) {\n listener(event, true);\n }\n };\n var domNode = ref || (_options == null ? void 0 : _options.document) || document;\n // @ts-ignore\n domNode.addEventListener('keyup', handleKeyUp, _options == null ? void 0 : _options.eventListenerOptions);\n // @ts-ignore\n domNode.addEventListener('keydown', handleKeyDown, _options == null ? void 0 : _options.eventListenerOptions);\n if (proxy) {\n parseKeysHookInput(_keys, memoisedOptions == null ? void 0 : memoisedOptions.splitKey).forEach(function (key) {\n return proxy.addHotkey(parseHotkey(key, memoisedOptions == null ? void 0 : memoisedOptions.combinationKey, memoisedOptions == null ? void 0 : memoisedOptions.description));\n });\n }\n return function () {\n // @ts-ignore\n domNode.removeEventListener('keyup', handleKeyUp, _options == null ? void 0 : _options.eventListenerOptions);\n // @ts-ignore\n domNode.removeEventListener('keydown', handleKeyDown, _options == null ? void 0 : _options.eventListenerOptions);\n if (proxy) {\n parseKeysHookInput(_keys, memoisedOptions == null ? void 0 : memoisedOptions.splitKey).forEach(function (key) {\n return proxy.removeHotkey(parseHotkey(key, memoisedOptions == null ? void 0 : memoisedOptions.combinationKey, memoisedOptions == null ? void 0 : memoisedOptions.description));\n });\n }\n };\n }, [ref, _keys, memoisedOptions, enabledScopes]);\n return setRef;\n}\n\nfunction useRecordHotkeys() {\n var _useState = useState(new Set()),\n keys = _useState[0],\n setKeys = _useState[1];\n var _useState2 = useState(false),\n isRecording = _useState2[0],\n setIsRecording = _useState2[1];\n var handler = useCallback(function (event) {\n if (event.key === undefined) {\n // Synthetic event (e.g., Chrome autofill). Ignore.\n return;\n }\n event.preventDefault();\n event.stopPropagation();\n setKeys(function (prev) {\n var newKeys = new Set(prev);\n newKeys.add(mapKey(event.code));\n return newKeys;\n });\n }, []);\n var stop = useCallback(function () {\n if (typeof document !== 'undefined') {\n document.removeEventListener('keydown', handler);\n setIsRecording(false);\n }\n }, [handler]);\n var start = useCallback(function () {\n setKeys(new Set());\n if (typeof document !== 'undefined') {\n stop();\n document.addEventListener('keydown', handler);\n setIsRecording(true);\n }\n }, [handler, stop]);\n var resetKeys = useCallback(function () {\n setKeys(new Set());\n }, []);\n return [keys, {\n start: start,\n stop: stop,\n resetKeys: resetKeys,\n isRecording: isRecording\n }];\n}\n\nexport { HotkeysProvider, isHotkeyPressed, useHotkeys, useHotkeysContext, useRecordHotkeys };\n//# sourceMappingURL=react-hotkeys-hook.esm.js.map\n","import { useHotkeys } from 'react-hotkeys-hook';\n\nexport interface UseUndoRedoShortcutsProps {\n undo: () => void;\n redo: () => void;\n canUndo: boolean;\n canRedo: boolean;\n}\n\nexport const useUndoRedoShortcuts = (props: UseUndoRedoShortcutsProps) => {\n const { undo, redo, canRedo, canUndo } = props;\n const { isMac } = window.electronAPI?.platformInfo || {};\n\n let undoShortcut = 'ctrl+z';\n let redoShortcut = 'ctrl+y';\n\n if (isMac) {\n undoShortcut = 'mod+z';\n redoShortcut = 'mod+shift+z';\n }\n\n // set handler for undo\n useHotkeys(\n undoShortcut,\n event => {\n event.preventDefault();\n if (canUndo) {\n undo();\n }\n },\n {},\n [canUndo, undo],\n );\n\n // set handler for redo\n useHotkeys(\n redoShortcut,\n event => {\n event.preventDefault();\n if (canRedo) {\n redo();\n }\n },\n {},\n [canRedo, redo],\n );\n};\n","import {\n useConnectConfig,\n useDocumentDriveServer,\n useShowAddDriveModal,\n} from '#hooks';\nimport { useGetAppNameForEditorId } from '#store';\nimport {\n HomeScreen,\n HomeScreenAddDriveItem,\n HomeScreenItem,\n} from '@powerhousedao/design-system';\nimport {\n useDocuments,\n useDrives,\n useLoadableSelectedDocument,\n useLoadableSelectedDrive,\n useLoadableSelectedFolder,\n useSelectedDocument,\n useSelectedDrive,\n useSelectedFolder,\n useSetSelectedDrive,\n} from '@powerhousedao/state';\nimport { type DocumentDriveDocument } from 'document-drive';\nimport { useCallback, useEffect } from 'react';\nimport { useLocation } from 'react-router-dom';\nimport { DocumentEditorContainer } from '../components/document-editor-container.js';\nimport { DriveEditorContainer } from '../components/drive-editor-container.js';\nimport { DriveIcon } from '../components/drive-icon.js';\nexport default function Content() {\n const { addFile } = useDocumentDriveServer();\n const selectedDrive = useSelectedDrive();\n const selectedFolder = useSelectedFolder();\n const selectedDocument = useSelectedDocument();\n\n useEffect(() => {\n return window.electronAPI?.handleFileOpen(async file => {\n if (!selectedDrive?.header.id || !selectedDocument?.header.id) {\n return;\n }\n\n await addFile(\n file.content,\n selectedDrive.header.id,\n file.name,\n selectedFolder?.id,\n );\n });\n }, [\n selectedDrive?.header.id,\n selectedFolder?.id,\n selectedDocument?.header.id,\n addFile,\n ]);\n\n return (\n <ContentContainer>\n <DocumentEditorContainer />\n <DriveEditorContainer />\n <HomeScreenContainer />\n </ContentContainer>\n );\n}\n\nfunction ContentContainer({ children }: { children: React.ReactNode }) {\n return (\n <div className=\"flex h-full flex-col overflow-auto\" id=\"content-view\">\n {children}\n </div>\n );\n}\n\nfunction HomeScreenContainer() {\n const { pathname } = useLocation();\n const drives = useDrives();\n const loadableSelectedDrive = useLoadableSelectedDrive();\n const loadableSelectedFolder = useLoadableSelectedFolder();\n const loadableSelectedDocument = useLoadableSelectedDocument();\n const showAddDriveModal = useShowAddDriveModal();\n const setSelectedDrive = useSetSelectedDrive();\n const getAppDescriptionForEditorId = useGetAppNameForEditorId();\n const [config] = useConnectConfig();\n const handleDriveClick = useCallback(\n (drive: DocumentDriveDocument) => {\n setSelectedDrive(drive.header.id);\n },\n [setSelectedDrive],\n );\n\n const onAddDriveClick = useCallback(() => {\n showAddDriveModal();\n }, [showAddDriveModal]);\n\n const isLoading =\n loadableSelectedDrive.state === 'loading' ||\n loadableSelectedFolder.state === 'loading' ||\n loadableSelectedDocument.state === 'loading';\n\n const isError =\n loadableSelectedDrive.state === 'hasError' ||\n loadableSelectedFolder.state === 'hasError' ||\n loadableSelectedDocument.state === 'hasError';\n\n const hasSelectedDriveOrFolderOrDocument =\n !isLoading &&\n !isError &&\n (!!loadableSelectedDrive.data ||\n !!loadableSelectedFolder.data ||\n !!loadableSelectedDocument.data);\n\n if (pathname !== '/') {\n return null;\n }\n\n if (hasSelectedDriveOrFolderOrDocument) {\n return null;\n }\n\n return (\n <HomeScreen>\n {drives?.map(drive => {\n const editorId = drive.header.meta?.preferredEditor;\n const appName = editorId\n ? getAppDescriptionForEditorId(editorId)\n : undefined;\n return (\n <HomeScreenItem\n key={drive.header.id}\n title={drive.state.global.name}\n description={appName || 'Drive Explorer App'}\n icon={<DriveIcon drive={drive} />}\n onClick={() => handleDriveClick(drive)}\n />\n );\n })}\n {config.drives.addDriveEnabled && (\n <HomeScreenAddDriveItem onClick={onAddDriveClick} />\n )}\n </HomeScreen>\n );\n}\n"],"file":"assets/content.B_2fQ3XO.js"}
@@ -1,2 +1,2 @@
1
- import{jsxs as y,jsx as o}from"react/jsx-runtime";import{u as b}from"./useAcceptedCookies.BwmKLuW0.js";import{s as v,h as g,g as k,i as w}from"./index.DJX9_IxB.js";import{useSyncExternalStore as S}from"react";import{i as l}from"./i18next.CqOP20KE.js";import{useModal as C}from"./modal.B9PP9n2B.js";import{ah as D}from"./index.u4lctn3H.js";import{T as B}from"./Trans.GeuewYUs.js";import"react-dom/client";import"./browser.BkwNmV2Z.js";import"./app-skeleton.js";import"react-dom";const x={type:"3rdParty",init(e){v(e.options.react),g(e)}},A=k.routerBasename,c=`${A}:display-cookie-banner`,n=new Set;let d=T();function T(){try{return localStorage.getItem(c)!=="false"}catch(e){return console.error(e),!0}}function a(){return d}function N(e){d=e,localStorage.setItem(c,JSON.stringify(e))}function E(e){return n.add(e),()=>n.delete(e)}const I=()=>[S(E,a,a),N],P={cancel:"Cancel",delete:"Delete",continue:"Continue",empty:"Empty",create:"Create",save:"Save",export:"Export",reload:"Reload",reloadConnect:"Click here to reload Connect"},j={placeholder:"Search Powerhouse",filterLabel:"File type"},F={sections:{folders:{title:"Folders",empty:"No folders 🗂️"},documents:{title:"Documents and files",empty:"No documents or files 📄"}}},O={options:{switchboardLink:"Switchboard Link"}},R={deleteItem:{folder:{header:"Delete “{{item}}” folder?",body:"Are you sure you want to delete this folder? All files and subfolders within it will be removed."},file:{header:"Delete “{{item}}” file?",body:"Are you sure you want to delete this file?"}},deleteDrive:{title:'Delete "{{label}}" drive?',body:"Are you sure you want to delete this drive? All files and subfolders within it will be removed. Do you want to proceed?",inputPlaceholder:"Enter drive name..."},upgradeDrive:{header:"Upgrade to cloud drive",body:"You are moving files from a private to a shared drive. These files will become accessible to others in the shared drive.Do you want to proceed?"},createDocument:{header:"Create a new document",placeholder:"Document name"},connectSettings:{title:"Settings",body:"These settings will apply to all drives.",clearStorage:{button:"Clear Storage",description:"Delete previous session data",confirmation:{title:"Clear Storage",body:"Are you sure you want to clear the storage? This will remove all previous session data.",clearButton:"Clear Storage"}},enabledDocumentTypes:{title:"Document Models",description:"Documents enabled",allSelected:"All documents are selected"}},exportDocumentWithErrors:{title:"Your document contains errors",body:"Your document contains structure errors. Do you want to export it anyway?"},disclaimer:{title:"Disclaimer",body:"All content provided herein our website, hyperlinked sites, associated applications, forums, blogs, social media accounts and other platforms (“Site”) is for your general information only, procured from third party sources. We make no warranties of any kind in relation to our content, including but not limited to accuracy and updatedness. No part of the content that we provide constitutes financial advice, legal advice or any other form of advice meant for your specific reliance for any purpose. Any use or reliance on our content is solely at your own risk and discretion. You should conduct your own research, review, analyse and verify our content before relying on them. Trading is a highly risky activity that can lead to major losses, please therefore consult your financial advisor before making any decision. No content on our Site is meant to be a solicitation or offer."},cookiesPolicy:{title:"Cookies Policy",body:"<subtitle>Use of Cookies and Similar Technologies</subtitle><p>The Site is using cookies. Cookies are small text files that are placed on your computer by websites that you visit. They are widely used in order to make websites work, or work more efficiently, as well as to provide information to the owners of the site. Cookies are typically stored on your computer´s hard drive.Information collected from cookies is used by us to evaluate the effectiveness of our Site and analyze trends. The information collected from cookies allows us to determine such things as which parts of the Site are most visited and difficulties our visitors may experience in accessing the SIte. With this knowledge, we can improve the quality of your experience on the Site by recognizing and delivering more of the most desired features and information, as well as by resolving access difficulties.</p><p>We use third party service providers, to assist us in better understanding the use of our Site. Our service providers will place cookies on the hard drive of your computer (or use similar technologies) and will receive information that we select that will educate us on such things as how visitors navigate around our Site. This information is aggregated to provide statistical data about our users browsing actions and patterns, and does not personally identify individuals. This information may include:</p><p>Computer or mobile device information, Website usage information, such as:<list></p><bullet>Page views,</bullet><bullet>Button clicks,</bullet><bullet>Input form changes (without the values being entered),</bullet><bullet>Errors.</bullet></list><p>Our service providers analyses this information and provides us with aggregate reports. The information and analysis provided by our service providers will be used to assist us in better understanding our visitors interests in our Site and how to better serve those interests. If you want to avoid using cookies altogether, you can disable cookies in your browser. However, disabling cookies might make it impossible for you to use certain features of the Site. Your use of the Site with a browser that is configured to accept cookies constitutes an acceptance of our and third-party cookies.</p>"}},W={deleteDriveSuccess:"Drive successfully deleted",deleteFolderSuccess:"Folder deleted",fileDeleteSuccess:"File deleted",addDriveSuccess:"New drive successfully added",driveSyncSuccess:"Drive synced successfully",driveSyncError:"Error synchronizing drive {{drive}}",driveSyncConflict:"Conflict error detected in {{drive}}",reloadApp:"It seems like you're running an outdated version of the app. Please reload Connect to get the latest version."},Y={cookiePolicy:"Cookie Policy",termsOfUse:"Terms of Use",disclaimer:"Disclaimer",builtWith:"Built with <icon /> Powerhouse"},L={message:"This website uses cookies for analytic purposes only. Cookies are anonymous and do not link to user data. We collect information to improve the user experience and validate UI changes. You can still use the page without cookies. For more information, please read our <a>cookies policy.</a>",accept:"Accept configured cookies",reject:"Reject all cookies",cookies:{functional:"Functional cookies",analytics:"Analytics cookies"}},U={common:P,searchbar:j,folderView:F,files:O,modals:R,notifications:W,footer:Y,cookieBanner:L},z={en:{code:"en",name:"English",translation:U}};l.use(x).init({resources:z,fallbackLng:"en",debug:!1,interpolation:{escapeValue:!1}}).catch(e=>{console.error(e)});const K=(e,i)=>e.some(t=>t.id===i&&t.value),oe=()=>{const{t:e}=w(void 0,{useSuspense:!0,i18n:l}),{showModal:i}=C(),[t,s]=I(),[,r]=b(),u=[{id:"analytics-cookie",label:e("cookieBanner.cookies.analytics"),value:!0}],m=p=>{s(!1),K(p,"analytics-cookie")&&r(h=>({...h,analytics:!0}))},f=()=>{s(!1),r(()=>({analytics:!1,functional:!1,marketing:!1}))};return t?y("div",{className:"absolute inset-0 z-[10000] backdrop-blur-sm",children:[o("div",{className:"absolute inset-0 bg-black opacity-15"}),o("div",{className:"absolute inset-x-0 bottom-0 flex justify-center bg-white px-10 pb-16 pt-10 shadow-lg",children:o(D,{className:"max-w-[1024px] ",cookies:u,onSubmit:m,onReject:f,submitLabel:e("cookieBanner.accept"),rejectLabel:e("cookieBanner.reject"),children:o("p",{className:"font-semibold text-gray-500",children:o(B,{i18nKey:"cookieBanner.message",components:{a:o("a",{onClick:()=>i("cookiesPolicy",{}),className:"cursor-pointer text-gray-900 hover:underline"},"cookieBanner.message-link")}},"cookieBanner.message")})})})]}):null};export{oe as CookieBanner};
2
- //# sourceMappingURL=cookie-banner.CA1rcZYO.js.map
1
+ import{jsxs as y,jsx as o}from"react/jsx-runtime";import{u as b}from"./useAcceptedCookies.BwfkDBue.js";import{s as v,h as g,g as k,i as w}from"./index.DoxG1d4A.js";import{useSyncExternalStore as S}from"react";import{i as l}from"./i18next.CqOP20KE.js";import{useModal as C}from"./modal.BizsZF2D.js";import{ah as D}from"./index.u4lctn3H.js";import{T as B}from"./Trans.CBZW5Jpo.js";import"react-dom/client";import"./browser.BkwNmV2Z.js";import"./app-skeleton.js";import"react-dom";const x={type:"3rdParty",init(e){v(e.options.react),g(e)}},A=k.routerBasename,c=`${A}:display-cookie-banner`,n=new Set;let d=T();function T(){try{return localStorage.getItem(c)!=="false"}catch(e){return console.error(e),!0}}function a(){return d}function N(e){d=e,localStorage.setItem(c,JSON.stringify(e))}function E(e){return n.add(e),()=>n.delete(e)}const I=()=>[S(E,a,a),N],P={cancel:"Cancel",delete:"Delete",continue:"Continue",empty:"Empty",create:"Create",save:"Save",export:"Export",reload:"Reload",reloadConnect:"Click here to reload Connect"},j={placeholder:"Search Powerhouse",filterLabel:"File type"},F={sections:{folders:{title:"Folders",empty:"No folders 🗂️"},documents:{title:"Documents and files",empty:"No documents or files 📄"}}},O={options:{switchboardLink:"Switchboard Link"}},R={deleteItem:{folder:{header:"Delete “{{item}}” folder?",body:"Are you sure you want to delete this folder? All files and subfolders within it will be removed."},file:{header:"Delete “{{item}}” file?",body:"Are you sure you want to delete this file?"}},deleteDrive:{title:'Delete "{{label}}" drive?',body:"Are you sure you want to delete this drive? All files and subfolders within it will be removed. Do you want to proceed?",inputPlaceholder:"Enter drive name..."},upgradeDrive:{header:"Upgrade to cloud drive",body:"You are moving files from a private to a shared drive. These files will become accessible to others in the shared drive.Do you want to proceed?"},createDocument:{header:"Create a new document",placeholder:"Document name"},connectSettings:{title:"Settings",body:"These settings will apply to all drives.",clearStorage:{button:"Clear Storage",description:"Delete previous session data",confirmation:{title:"Clear Storage",body:"Are you sure you want to clear the storage? This will remove all previous session data.",clearButton:"Clear Storage"}},enabledDocumentTypes:{title:"Document Models",description:"Documents enabled",allSelected:"All documents are selected"}},exportDocumentWithErrors:{title:"Your document contains errors",body:"Your document contains structure errors. Do you want to export it anyway?"},disclaimer:{title:"Disclaimer",body:"All content provided herein our website, hyperlinked sites, associated applications, forums, blogs, social media accounts and other platforms (“Site”) is for your general information only, procured from third party sources. We make no warranties of any kind in relation to our content, including but not limited to accuracy and updatedness. No part of the content that we provide constitutes financial advice, legal advice or any other form of advice meant for your specific reliance for any purpose. Any use or reliance on our content is solely at your own risk and discretion. You should conduct your own research, review, analyse and verify our content before relying on them. Trading is a highly risky activity that can lead to major losses, please therefore consult your financial advisor before making any decision. No content on our Site is meant to be a solicitation or offer."},cookiesPolicy:{title:"Cookies Policy",body:"<subtitle>Use of Cookies and Similar Technologies</subtitle><p>The Site is using cookies. Cookies are small text files that are placed on your computer by websites that you visit. They are widely used in order to make websites work, or work more efficiently, as well as to provide information to the owners of the site. Cookies are typically stored on your computer´s hard drive.Information collected from cookies is used by us to evaluate the effectiveness of our Site and analyze trends. The information collected from cookies allows us to determine such things as which parts of the Site are most visited and difficulties our visitors may experience in accessing the SIte. With this knowledge, we can improve the quality of your experience on the Site by recognizing and delivering more of the most desired features and information, as well as by resolving access difficulties.</p><p>We use third party service providers, to assist us in better understanding the use of our Site. Our service providers will place cookies on the hard drive of your computer (or use similar technologies) and will receive information that we select that will educate us on such things as how visitors navigate around our Site. This information is aggregated to provide statistical data about our users browsing actions and patterns, and does not personally identify individuals. This information may include:</p><p>Computer or mobile device information, Website usage information, such as:<list></p><bullet>Page views,</bullet><bullet>Button clicks,</bullet><bullet>Input form changes (without the values being entered),</bullet><bullet>Errors.</bullet></list><p>Our service providers analyses this information and provides us with aggregate reports. The information and analysis provided by our service providers will be used to assist us in better understanding our visitors interests in our Site and how to better serve those interests. If you want to avoid using cookies altogether, you can disable cookies in your browser. However, disabling cookies might make it impossible for you to use certain features of the Site. Your use of the Site with a browser that is configured to accept cookies constitutes an acceptance of our and third-party cookies.</p>"}},W={deleteDriveSuccess:"Drive successfully deleted",deleteFolderSuccess:"Folder deleted",fileDeleteSuccess:"File deleted",addDriveSuccess:"New drive successfully added",driveSyncSuccess:"Drive synced successfully",driveSyncError:"Error synchronizing drive {{drive}}",driveSyncConflict:"Conflict error detected in {{drive}}",reloadApp:"It seems like you're running an outdated version of the app. Please reload Connect to get the latest version."},Y={cookiePolicy:"Cookie Policy",termsOfUse:"Terms of Use",disclaimer:"Disclaimer",builtWith:"Built with <icon /> Powerhouse"},L={message:"This website uses cookies for analytic purposes only. Cookies are anonymous and do not link to user data. We collect information to improve the user experience and validate UI changes. You can still use the page without cookies. For more information, please read our <a>cookies policy.</a>",accept:"Accept configured cookies",reject:"Reject all cookies",cookies:{functional:"Functional cookies",analytics:"Analytics cookies"}},U={common:P,searchbar:j,folderView:F,files:O,modals:R,notifications:W,footer:Y,cookieBanner:L},z={en:{code:"en",name:"English",translation:U}};l.use(x).init({resources:z,fallbackLng:"en",debug:!1,interpolation:{escapeValue:!1}}).catch(e=>{console.error(e)});const K=(e,i)=>e.some(t=>t.id===i&&t.value),oe=()=>{const{t:e}=w(void 0,{useSuspense:!0,i18n:l}),{showModal:i}=C(),[t,s]=I(),[,r]=b(),u=[{id:"analytics-cookie",label:e("cookieBanner.cookies.analytics"),value:!0}],m=p=>{s(!1),K(p,"analytics-cookie")&&r(h=>({...h,analytics:!0}))},f=()=>{s(!1),r(()=>({analytics:!1,functional:!1,marketing:!1}))};return t?y("div",{className:"absolute inset-0 z-[10000] backdrop-blur-sm",children:[o("div",{className:"absolute inset-0 bg-black opacity-15"}),o("div",{className:"absolute inset-x-0 bottom-0 flex justify-center bg-white px-10 pb-16 pt-10 shadow-lg",children:o(D,{className:"max-w-[1024px] ",cookies:u,onSubmit:m,onReject:f,submitLabel:e("cookieBanner.accept"),rejectLabel:e("cookieBanner.reject"),children:o("p",{className:"font-semibold text-gray-500",children:o(B,{i18nKey:"cookieBanner.message",components:{a:o("a",{onClick:()=>i("cookiesPolicy",{}),className:"cursor-pointer text-gray-900 hover:underline"},"cookieBanner.message-link")}},"cookieBanner.message")})})})]}):null};export{oe as CookieBanner};
2
+ //# sourceMappingURL=cookie-banner.CQrIFtr9.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"cookie-banner.CA1rcZYO.js","sources":["../../../../node_modules/.pnpm/react-i18next@13.5.0_i18next@23.16.8_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/react-i18next/dist/es/initReactI18next.js","../../src/hooks/useCookiebanner.ts","../../src/i18n/index.ts","../../src/components/cookie-banner.tsx"],"sourcesContent":["import { setDefaults } from './defaults.js';\nimport { setI18n } from './i18nInstance.js';\nexport const initReactI18next = {\n type: '3rdParty',\n init(instance) {\n setDefaults(instance.options.react);\n setI18n(instance);\n }\n};","import connectConfig from '#connect-config';\nimport { useSyncExternalStore } from 'react';\n\nconst namespace = connectConfig.routerBasename;\n\nexport const COOKIE_BANNER_KEY_STORAGE = `${namespace}:display-cookie-banner`;\n\nconst listeners = new Set<() => void>();\n\nlet bannerShown = getInitial();\n\nfunction getInitial(): boolean {\n try {\n const value = localStorage.getItem(COOKIE_BANNER_KEY_STORAGE);\n return value !== 'false';\n } catch (error) {\n console.error(error);\n return true;\n }\n}\n\nfunction getCookieBannerState(): boolean {\n return bannerShown;\n}\n\nfunction setCookieBannerState(state: boolean) {\n bannerShown = state;\n localStorage.setItem(COOKIE_BANNER_KEY_STORAGE, JSON.stringify(state));\n}\n\nfunction subscribe(fn: () => void) {\n listeners.add(fn);\n return () => listeners.delete(fn);\n}\n\nexport const useCookieBanner = () => {\n const cookieBannerShown = useSyncExternalStore(\n subscribe,\n getCookieBannerState,\n getCookieBannerState,\n );\n return [cookieBannerShown, setCookieBannerState] as const;\n};\n","import i18n, { type Resource } from 'i18next';\nimport { initReactI18next } from 'react-i18next';\n\nimport translationEN from './locales/en.json' with { type: 'json' };\n\nconst resources: Resource = {\n en: {\n code: 'en',\n name: 'English',\n translation: translationEN,\n },\n};\n\ni18n.use(initReactI18next)\n .init({\n resources,\n fallbackLng: 'en',\n debug: false,\n interpolation: {\n escapeValue: false,\n },\n })\n .catch((e: unknown) => {\n console.error(e);\n });\n\nexport default i18n;\n","import {\n type CookieInput,\n CookieBanner as PHCookieBanner,\n} from '@powerhousedao/design-system';\nimport { Trans, useTranslation } from 'react-i18next';\nimport { useAcceptedCookies } from '../hooks/useAcceptedCookies.js';\nimport { useCookieBanner } from '../hooks/useCookiebanner.js';\nimport i18n from '../i18n';\nimport { useModal } from './modal/index.js';\n\nconst isCookieAccepted = (cookies: CookieInput[], id: string) => {\n return cookies.some(cookie => cookie.id === id && cookie.value);\n};\n\nexport const CookieBanner = () => {\n const { t } = useTranslation(undefined, {\n useSuspense: true,\n i18n,\n });\n const { showModal } = useModal();\n const [showBanner, setShowBanner] = useCookieBanner();\n const [, setAcceptedCookies] = useAcceptedCookies();\n\n const cookiesInput: CookieInput[] = [\n {\n id: 'analytics-cookie',\n label: t('cookieBanner.cookies.analytics'),\n value: true,\n },\n ];\n\n const handleAccept = (cookies: CookieInput[]) => {\n setShowBanner(false);\n\n if (isCookieAccepted(cookies, 'analytics-cookie')) {\n setAcceptedCookies(acceptedCookies => ({\n ...acceptedCookies,\n analytics: true,\n }));\n }\n };\n\n const handleReject = () => {\n setShowBanner(false);\n setAcceptedCookies(() => ({\n analytics: false,\n functional: false,\n marketing: false,\n }));\n };\n\n if (!showBanner) {\n return null;\n }\n\n return (\n <div className=\"absolute inset-0 z-[10000] backdrop-blur-sm\">\n <div className=\"absolute inset-0 bg-black opacity-15\" />\n <div className=\"absolute inset-x-0 bottom-0 flex justify-center bg-white px-10 pb-16 pt-10 shadow-lg\">\n <PHCookieBanner\n className=\"max-w-[1024px] \"\n cookies={cookiesInput}\n onSubmit={handleAccept}\n onReject={handleReject}\n submitLabel={t('cookieBanner.accept')}\n rejectLabel={t('cookieBanner.reject')}\n >\n <p className=\"font-semibold text-gray-500\">\n <Trans\n key={'cookieBanner.message'}\n i18nKey=\"cookieBanner.message\"\n components={{\n a: (\n <a\n onClick={() =>\n showModal('cookiesPolicy', {})\n }\n key={'cookieBanner.message-link'}\n className=\"cursor-pointer text-gray-900 hover:underline\"\n />\n ),\n }}\n />\n </p>\n </PHCookieBanner>\n </div>\n </div>\n );\n};\n"],"names":["initReactI18next","instance","setDefaults","setI18n","namespace","connectConfig","COOKIE_BANNER_KEY_STORAGE","listeners","bannerShown","getInitial","error","getCookieBannerState","setCookieBannerState","state","subscribe","fn","useCookieBanner","useSyncExternalStore","resources","translationEN","i18n","isCookieAccepted","cookies","id","cookie","CookieBanner","t","useTranslation","showModal","useModal","showBanner","setShowBanner","setAcceptedCookies","useAcceptedCookies","cookiesInput","handleAccept","acceptedCookies","handleReject","jsxs","jsx","PHCookieBanner","Trans"],"mappings":"8dAEO,MAAMA,EAAmB,CAC9B,KAAM,WACN,KAAKC,EAAU,CACbC,EAAYD,EAAS,QAAQ,KAAK,EAClCE,EAAQF,CAAQ,CACpB,CACA,ECLMG,EAAYC,EAAc,eAEnBC,EAA4B,GAAGF,CAAS,yBAE/CG,MAAgB,IAEtB,IAAIC,EAAcC,EAAA,EAElB,SAASA,GAAsB,CAC3B,GAAI,CAEA,OADc,aAAa,QAAQH,CAAyB,IAC3C,OAAA,OACZI,EAAO,CACZ,eAAQ,MAAMA,CAAK,EACZ,EAAA,CAEf,CAEA,SAASC,GAAgC,CACrC,OAAOH,CACX,CAEA,SAASI,EAAqBC,EAAgB,CAC1CL,EAAcK,EACd,aAAa,QAAQP,EAA2B,KAAK,UAAUO,CAAK,CAAC,CACzE,CAEA,SAASC,EAAUC,EAAgB,CAC/B,OAAAR,EAAU,IAAIQ,CAAE,EACT,IAAMR,EAAU,OAAOQ,CAAE,CACpC,CAEO,MAAMC,EAAkB,IAMpB,CALmBC,EACtBH,EACAH,EACAA,CAAA,EAEuBC,CAAoB,47LCpC7CM,EAAsB,CACxB,GAAI,CACA,KAAM,KACN,KAAM,UACN,YAAaC,CAAA,CAErB,EAEAC,EAAK,IAAIpB,CAAgB,EACpB,KAAK,CACF,UAAAkB,EACA,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aT,CACJ,CAAA,CAAA,CACJ,CACJ,CAAA,EACJ,EAlCO,IAoCf","x_google_ignoreList":[0]}
1
+ {"version":3,"file":"cookie-banner.CQrIFtr9.js","sources":["../../../../node_modules/.pnpm/react-i18next@13.5.0_i18next@23.16.8_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/react-i18next/dist/es/initReactI18next.js","../../src/hooks/useCookiebanner.ts","../../src/i18n/index.ts","../../src/components/cookie-banner.tsx"],"sourcesContent":["import { setDefaults } from './defaults.js';\nimport { setI18n } from './i18nInstance.js';\nexport const initReactI18next = {\n type: '3rdParty',\n init(instance) {\n setDefaults(instance.options.react);\n setI18n(instance);\n }\n};","import connectConfig from '#connect-config';\nimport { useSyncExternalStore } from 'react';\n\nconst namespace = connectConfig.routerBasename;\n\nexport const COOKIE_BANNER_KEY_STORAGE = `${namespace}:display-cookie-banner`;\n\nconst listeners = new Set<() => void>();\n\nlet bannerShown = getInitial();\n\nfunction getInitial(): boolean {\n try {\n const value = localStorage.getItem(COOKIE_BANNER_KEY_STORAGE);\n return value !== 'false';\n } catch (error) {\n console.error(error);\n return true;\n }\n}\n\nfunction getCookieBannerState(): boolean {\n return bannerShown;\n}\n\nfunction setCookieBannerState(state: boolean) {\n bannerShown = state;\n localStorage.setItem(COOKIE_BANNER_KEY_STORAGE, JSON.stringify(state));\n}\n\nfunction subscribe(fn: () => void) {\n listeners.add(fn);\n return () => listeners.delete(fn);\n}\n\nexport const useCookieBanner = () => {\n const cookieBannerShown = useSyncExternalStore(\n subscribe,\n getCookieBannerState,\n getCookieBannerState,\n );\n return [cookieBannerShown, setCookieBannerState] as const;\n};\n","import i18n, { type Resource } from 'i18next';\nimport { initReactI18next } from 'react-i18next';\n\nimport translationEN from './locales/en.json' with { type: 'json' };\n\nconst resources: Resource = {\n en: {\n code: 'en',\n name: 'English',\n translation: translationEN,\n },\n};\n\ni18n.use(initReactI18next)\n .init({\n resources,\n fallbackLng: 'en',\n debug: false,\n interpolation: {\n escapeValue: false,\n },\n })\n .catch((e: unknown) => {\n console.error(e);\n });\n\nexport default i18n;\n","import {\n type CookieInput,\n CookieBanner as PHCookieBanner,\n} from '@powerhousedao/design-system';\nimport { Trans, useTranslation } from 'react-i18next';\nimport { useAcceptedCookies } from '../hooks/useAcceptedCookies.js';\nimport { useCookieBanner } from '../hooks/useCookiebanner.js';\nimport i18n from '../i18n';\nimport { useModal } from './modal/index.js';\n\nconst isCookieAccepted = (cookies: CookieInput[], id: string) => {\n return cookies.some(cookie => cookie.id === id && cookie.value);\n};\n\nexport const CookieBanner = () => {\n const { t } = useTranslation(undefined, {\n useSuspense: true,\n i18n,\n });\n const { showModal } = useModal();\n const [showBanner, setShowBanner] = useCookieBanner();\n const [, setAcceptedCookies] = useAcceptedCookies();\n\n const cookiesInput: CookieInput[] = [\n {\n id: 'analytics-cookie',\n label: t('cookieBanner.cookies.analytics'),\n value: true,\n },\n ];\n\n const handleAccept = (cookies: CookieInput[]) => {\n setShowBanner(false);\n\n if (isCookieAccepted(cookies, 'analytics-cookie')) {\n setAcceptedCookies(acceptedCookies => ({\n ...acceptedCookies,\n analytics: true,\n }));\n }\n };\n\n const handleReject = () => {\n setShowBanner(false);\n setAcceptedCookies(() => ({\n analytics: false,\n functional: false,\n marketing: false,\n }));\n };\n\n if (!showBanner) {\n return null;\n }\n\n return (\n <div className=\"absolute inset-0 z-[10000] backdrop-blur-sm\">\n <div className=\"absolute inset-0 bg-black opacity-15\" />\n <div className=\"absolute inset-x-0 bottom-0 flex justify-center bg-white px-10 pb-16 pt-10 shadow-lg\">\n <PHCookieBanner\n className=\"max-w-[1024px] \"\n cookies={cookiesInput}\n onSubmit={handleAccept}\n onReject={handleReject}\n submitLabel={t('cookieBanner.accept')}\n rejectLabel={t('cookieBanner.reject')}\n >\n <p className=\"font-semibold text-gray-500\">\n <Trans\n key={'cookieBanner.message'}\n i18nKey=\"cookieBanner.message\"\n components={{\n a: (\n <a\n onClick={() =>\n showModal('cookiesPolicy', {})\n }\n key={'cookieBanner.message-link'}\n className=\"cursor-pointer text-gray-900 hover:underline\"\n />\n ),\n }}\n />\n </p>\n </PHCookieBanner>\n </div>\n </div>\n );\n};\n"],"names":["initReactI18next","instance","setDefaults","setI18n","namespace","connectConfig","COOKIE_BANNER_KEY_STORAGE","listeners","bannerShown","getInitial","error","getCookieBannerState","setCookieBannerState","state","subscribe","fn","useCookieBanner","useSyncExternalStore","resources","translationEN","i18n","isCookieAccepted","cookies","id","cookie","CookieBanner","t","useTranslation","showModal","useModal","showBanner","setShowBanner","setAcceptedCookies","useAcceptedCookies","cookiesInput","handleAccept","acceptedCookies","handleReject","jsxs","jsx","PHCookieBanner","Trans"],"mappings":"8dAEO,MAAMA,EAAmB,CAC9B,KAAM,WACN,KAAKC,EAAU,CACbC,EAAYD,EAAS,QAAQ,KAAK,EAClCE,EAAQF,CAAQ,CACpB,CACA,ECLMG,EAAYC,EAAc,eAEnBC,EAA4B,GAAGF,CAAS,yBAE/CG,MAAgB,IAEtB,IAAIC,EAAcC,EAAA,EAElB,SAASA,GAAsB,CAC3B,GAAI,CAEA,OADc,aAAa,QAAQH,CAAyB,IAC3C,OAAA,OACZI,EAAO,CACZ,eAAQ,MAAMA,CAAK,EACZ,EAAA,CAEf,CAEA,SAASC,GAAgC,CACrC,OAAOH,CACX,CAEA,SAASI,EAAqBC,EAAgB,CAC1CL,EAAcK,EACd,aAAa,QAAQP,EAA2B,KAAK,UAAUO,CAAK,CAAC,CACzE,CAEA,SAASC,EAAUC,EAAgB,CAC/B,OAAAR,EAAU,IAAIQ,CAAE,EACT,IAAMR,EAAU,OAAOQ,CAAE,CACpC,CAEO,MAAMC,EAAkB,IAMpB,CALmBC,EACtBH,EACAH,EACAA,CAAA,EAEuBC,CAAoB,47LCpC7CM,EAAsB,CACxB,GAAI,CACA,KAAM,KACN,KAAM,UACN,YAAaC,CAAA,CAErB,EAEAC,EAAK,IAAIpB,CAAgB,EACpB,KAAK,CACF,UAAAkB,EACA,YAAa,KACb,MAAO,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AAA,CACJ,CACJ,CAAA,EACJ,EAlCO,IAoCf","x_google_ignoreList":[0]}
@@ -1,4 +1,4 @@
1
- import{Y as fn,Z as Rl,_ as Dt,$ as Ms,a0 as h,a1 as ze,a2 as U,a3 as aa,a4 as se,a5 as bi,a6 as it,a7 as Lt,a8 as ca,a9 as At,aa as Os,ab as Pt,ac as Ns,ad as Te,ae as gr,af as Cl,ag as xl,ah as Ie,ai as k,aj as ua,ak as A,al as ae,am as Al,an as Ds,ao as _r,ap as Gt,aq as pn,ar as Ml,as as lt,at as j,au as ot,av as Ol,aw as Nl,ax as Jn,ay as yr,az as la,aA as Dl,aB as Ll,aC as Pl,aD as Fl,aE as $l,aF as Ei,aG as Ls,aH as vi,aI as Ps,aJ as Fs,aK as da,aL as Zn,aM as Ti,aN as He,aO as Yt,aP as $s,aQ as oe,aR as at,aS as fa,aT as pa,aU as ha,aV as rs,aW as ma,aX as ga,aY as Bl,aZ as ss,a_ as Ft,a$ as Sn,b0 as Bs,b1 as Ii,b2 as Hl,b3 as Mt,b4 as Hs,b5 as Ul,b6 as Wl,b7 as zl,b8 as je,b9 as Qn,ba as Sr,bb as _a,bc as jl,bd as wi,be as ki,bf as ql,bg as is,bh as Gl,bi as Yl,bj as Ri,bk as Vl}from"./index.DJX9_IxB.js";import{bl as Ov,bm as Nv,bn as Dv,bo as Lv,bp as Pv,bq as Fv,br as $v,bs as Bv,bt as Hv,bu as Uv,bv as Wv,bw as zv,bx as jv,by as qv,bz as Gv,bA as Yv,bB as Vv}from"./index.DJX9_IxB.js";import{a9 as Ci,aU as br}from"./index.u4lctn3H.js";import*as me from"react";import"react-dom/client";import"react/jsx-runtime";import"./browser.BkwNmV2Z.js";import"./app-skeleton.js";import"react-dom";function ya(e,t,n=250,r,s,i,o){if(!i.exception||!i.exception.values||!o||!fn(o.originalException,Error))return;const a=i.exception.values.length>0?i.exception.values[i.exception.values.length-1]:void 0;a&&(i.exception.values=Kl(os(e,t,s,o.originalException,r,i.exception.values,a,0),n))}function os(e,t,n,r,s,i,o,a){if(i.length>=n+1)return i;let c=[...i];if(fn(r[s],Error)){xi(o,a);const u=e(t,r[s]),l=c.length;Ai(u,s,l,a),c=os(e,t,n,r[s],s,[u,...c],u,l)}return Array.isArray(r.errors)&&r.errors.forEach((u,l)=>{if(fn(u,Error)){xi(o,a);const d=e(t,u),f=c.length;Ai(d,`errors[${l}]`,f,a),c=os(e,t,n,u,s,[d,...c],d,f)}}),c}function xi(e,t){e.mechanism=e.mechanism||{type:"generic",handled:!0},e.mechanism={...e.mechanism,...e.type==="AggregateError"&&{is_exception_group:!0},exception_id:t}}function Ai(e,t,n,r){e.mechanism=e.mechanism||{type:"generic",handled:!0},e.mechanism={...e.mechanism,type:"chained",source:t,exception_id:n,parent_id:r}}function Kl(e,t){return e.map(n=>(n.value&&(n.value=Rl(n.value,t)),n))}const Xl=/^(?:(\w+):)\/\/(?:(\w+)(?::(\w+)?)?@)([\w.-]+)(?::(\d+))?\/(.+)/;function Jl(e){return e==="http"||e==="https"}function dt(e,t=!1){const{host:n,path:r,pass:s,port:i,projectId:o,protocol:a,publicKey:c}=e;return`${a}://${c}${t&&s?`:${s}`:""}@${n}${i?`:${i}`:""}/${r&&`${r}/`}${o}`}function Sa(e){const t=Xl.exec(e);if(!t){Dt(()=>{console.error(`Invalid Sentry Dsn: ${e}`)});return}const[n,r,s="",i,o="",a]=t.slice(1);let c="",u=a;const l=u.split("/");if(l.length>1&&(c=l.slice(0,-1).join("/"),u=l.pop()),u){const d=u.match(/^\d+/);d&&(u=d[0])}return ba({host:i,pass:s,path:c,projectId:u,port:o,protocol:n,publicKey:r})}function ba(e){return{protocol:e.protocol,publicKey:e.publicKey||"",pass:e.pass||"",host:e.host,port:e.port||"",path:e.path||"",projectId:e.projectId}}function Zl(e){if(!Ms)return!0;const{port:t,projectId:n,protocol:r}=e;return["protocol","publicKey","host","projectId"].find(o=>e[o]?!1:(h.error(`Invalid Sentry Dsn: ${o} missing`),!0))?!1:n.match(/^\d+$/)?Jl(r)?t&&isNaN(parseInt(t,10))?(h.error(`Invalid Sentry Dsn: Invalid port ${t}`),!1):!0:(h.error(`Invalid Sentry Dsn: Invalid protocol ${r}`),!1):(h.error(`Invalid Sentry Dsn: Invalid projectId ${n}`),!1)}function Ea(e){const t=typeof e=="string"?Sa(e):ba(e);if(!(!t||!Zl(t)))return t}class Ce extends Error{constructor(t,n="warn"){super(t),this.message=t,this.name=new.target.prototype.constructor.name,Object.setPrototypeOf(this,new.target.prototype),this.logLevel=n}}const Gn={},Mi={};function ft(e,t){Gn[e]=Gn[e]||[],Gn[e].push(t)}function pt(e,t){Mi[e]||(t(),Mi[e]=!0)}function ve(e,t){const n=e&&Gn[e];if(n)for(const r of n)try{r(t)}catch(s){Ms&&h.error(`Error while triggering instrumentation handler.
1
+ import{Y as fn,Z as Rl,_ as Dt,$ as Ms,a0 as h,a1 as ze,a2 as U,a3 as aa,a4 as se,a5 as bi,a6 as it,a7 as Lt,a8 as ca,a9 as At,aa as Os,ab as Pt,ac as Ns,ad as Te,ae as gr,af as Cl,ag as xl,ah as Ie,ai as k,aj as ua,ak as A,al as ae,am as Al,an as Ds,ao as _r,ap as Gt,aq as pn,ar as Ml,as as lt,at as j,au as ot,av as Ol,aw as Nl,ax as Jn,ay as yr,az as la,aA as Dl,aB as Ll,aC as Pl,aD as Fl,aE as $l,aF as Ei,aG as Ls,aH as vi,aI as Ps,aJ as Fs,aK as da,aL as Zn,aM as Ti,aN as He,aO as Yt,aP as $s,aQ as oe,aR as at,aS as fa,aT as pa,aU as ha,aV as rs,aW as ma,aX as ga,aY as Bl,aZ as ss,a_ as Ft,a$ as Sn,b0 as Bs,b1 as Ii,b2 as Hl,b3 as Mt,b4 as Hs,b5 as Ul,b6 as Wl,b7 as zl,b8 as je,b9 as Qn,ba as Sr,bb as _a,bc as jl,bd as wi,be as ki,bf as ql,bg as is,bh as Gl,bi as Yl,bj as Ri,bk as Vl}from"./index.DoxG1d4A.js";import{bl as Ov,bm as Nv,bn as Dv,bo as Lv,bp as Pv,bq as Fv,br as $v,bs as Bv,bt as Hv,bu as Uv,bv as Wv,bw as zv,bx as jv,by as qv,bz as Gv,bA as Yv,bB as Vv}from"./index.DoxG1d4A.js";import{a9 as Ci,aU as br}from"./index.u4lctn3H.js";import*as me from"react";import"react-dom/client";import"react/jsx-runtime";import"./browser.BkwNmV2Z.js";import"./app-skeleton.js";import"react-dom";function ya(e,t,n=250,r,s,i,o){if(!i.exception||!i.exception.values||!o||!fn(o.originalException,Error))return;const a=i.exception.values.length>0?i.exception.values[i.exception.values.length-1]:void 0;a&&(i.exception.values=Kl(os(e,t,s,o.originalException,r,i.exception.values,a,0),n))}function os(e,t,n,r,s,i,o,a){if(i.length>=n+1)return i;let c=[...i];if(fn(r[s],Error)){xi(o,a);const u=e(t,r[s]),l=c.length;Ai(u,s,l,a),c=os(e,t,n,r[s],s,[u,...c],u,l)}return Array.isArray(r.errors)&&r.errors.forEach((u,l)=>{if(fn(u,Error)){xi(o,a);const d=e(t,u),f=c.length;Ai(d,`errors[${l}]`,f,a),c=os(e,t,n,u,s,[d,...c],d,f)}}),c}function xi(e,t){e.mechanism=e.mechanism||{type:"generic",handled:!0},e.mechanism={...e.mechanism,...e.type==="AggregateError"&&{is_exception_group:!0},exception_id:t}}function Ai(e,t,n,r){e.mechanism=e.mechanism||{type:"generic",handled:!0},e.mechanism={...e.mechanism,type:"chained",source:t,exception_id:n,parent_id:r}}function Kl(e,t){return e.map(n=>(n.value&&(n.value=Rl(n.value,t)),n))}const Xl=/^(?:(\w+):)\/\/(?:(\w+)(?::(\w+)?)?@)([\w.-]+)(?::(\d+))?\/(.+)/;function Jl(e){return e==="http"||e==="https"}function dt(e,t=!1){const{host:n,path:r,pass:s,port:i,projectId:o,protocol:a,publicKey:c}=e;return`${a}://${c}${t&&s?`:${s}`:""}@${n}${i?`:${i}`:""}/${r&&`${r}/`}${o}`}function Sa(e){const t=Xl.exec(e);if(!t){Dt(()=>{console.error(`Invalid Sentry Dsn: ${e}`)});return}const[n,r,s="",i,o="",a]=t.slice(1);let c="",u=a;const l=u.split("/");if(l.length>1&&(c=l.slice(0,-1).join("/"),u=l.pop()),u){const d=u.match(/^\d+/);d&&(u=d[0])}return ba({host:i,pass:s,path:c,projectId:u,port:o,protocol:n,publicKey:r})}function ba(e){return{protocol:e.protocol,publicKey:e.publicKey||"",pass:e.pass||"",host:e.host,port:e.port||"",path:e.path||"",projectId:e.projectId}}function Zl(e){if(!Ms)return!0;const{port:t,projectId:n,protocol:r}=e;return["protocol","publicKey","host","projectId"].find(o=>e[o]?!1:(h.error(`Invalid Sentry Dsn: ${o} missing`),!0))?!1:n.match(/^\d+$/)?Jl(r)?t&&isNaN(parseInt(t,10))?(h.error(`Invalid Sentry Dsn: Invalid port ${t}`),!1):!0:(h.error(`Invalid Sentry Dsn: Invalid protocol ${r}`),!1):(h.error(`Invalid Sentry Dsn: Invalid projectId ${n}`),!1)}function Ea(e){const t=typeof e=="string"?Sa(e):ba(e);if(!(!t||!Zl(t)))return t}class Ce extends Error{constructor(t,n="warn"){super(t),this.message=t,this.name=new.target.prototype.constructor.name,Object.setPrototypeOf(this,new.target.prototype),this.logLevel=n}}const Gn={},Mi={};function ft(e,t){Gn[e]=Gn[e]||[],Gn[e].push(t)}function pt(e,t){Mi[e]||(t(),Mi[e]=!0)}function ve(e,t){const n=e&&Gn[e];if(n)for(const r of n)try{r(t)}catch(s){Ms&&h.error(`Error while triggering instrumentation handler.
2
2
  Type: ${e}
3
3
  Name: ${ze(r)}
4
4
  Error:`,s)}}function va(e){const t="console";ft(t,e),pt(t,Ql)}function Ql(){"console"in U&&aa.forEach(function(e){e in U.console&&se(U.console,e,function(t){return bi[e]=t,function(...n){ve("console",{args:n,level:e});const s=bi[e];s&&s.apply(U.console,n)}})})}const bt=U,ed=1e3;let Oi,as,cs;function Ta(e){const t="dom";ft(t,e),pt(t,td)}function td(){if(!bt.document)return;const e=ve.bind(null,"dom"),t=Ni(e,!0);bt.document.addEventListener("click",t,!1),bt.document.addEventListener("keypress",t,!1),["EventTarget","Node"].forEach(n=>{const r=bt[n]&&bt[n].prototype;!r||!r.hasOwnProperty||!r.hasOwnProperty("addEventListener")||(se(r,"addEventListener",function(s){return function(i,o,a){if(i==="click"||i=="keypress")try{const c=this,u=c.__sentry_instrumentation_handlers__=c.__sentry_instrumentation_handlers__||{},l=u[i]=u[i]||{refCount:0};if(!l.handler){const d=Ni(e);l.handler=d,s.call(this,i,d,a)}l.refCount++}catch{}return s.call(this,i,o,a)}}),se(r,"removeEventListener",function(s){return function(i,o,a){if(i==="click"||i=="keypress")try{const c=this,u=c.__sentry_instrumentation_handlers__||{},l=u[i];l&&(l.refCount--,l.refCount<=0&&(s.call(this,i,l.handler,a),l.handler=void 0,delete u[i]),Object.keys(u).length===0&&delete c.__sentry_instrumentation_handlers__)}catch{}return s.call(this,i,o,a)}}))})}function nd(e){if(e.type!==as)return!1;try{if(!e.target||e.target._sentryId!==cs)return!1}catch{}return!0}function rd(e,t){return e!=="keypress"?!1:!t||!t.tagName?!0:!(t.tagName==="INPUT"||t.tagName==="TEXTAREA"||t.isContentEditable)}function Ni(e,t=!1){return n=>{if(!n||n._sentryCaptured)return;const r=sd(n);if(rd(n.type,r))return;it(n,"_sentryCaptured",!0),r&&!r._sentryId&&it(r,"_sentryId",Lt());const s=n.type==="keypress"?"input":n.type;nd(n)||(e({event:n,name:s,global:t}),as=n.type,cs=r?r._sentryId:void 0),clearTimeout(Oi),Oi=bt.setTimeout(()=>{cs=void 0,as=void 0},ed)}}function sd(e){try{return e.target}catch{return null}}const er=ca();function Ia(){if(!("fetch"in er))return!1;try{return new Headers,new Request("http://www.example.com"),new Response,!0}catch{return!1}}function us(e){return e&&/^function fetch\(\)\s+\{\s+\[native code\]\s+\}$/.test(e.toString())}function wa(){if(typeof EdgeRuntime=="string")return!0;if(!Ia())return!1;if(us(er.fetch))return!0;let e=!1;const t=er.document;if(t&&typeof t.createElement=="function")try{const n=t.createElement("iframe");n.hidden=!0,t.head.appendChild(n),n.contentWindow&&n.contentWindow.fetch&&(e=us(n.contentWindow.fetch)),t.head.removeChild(n)}catch(n){Ms&&h.warn("Could not create sandbox iframe for pure fetch check, bailing to window.fetch: ",n)}return e}function id(){return"ReportingObserver"in er}function Er(e){const t="fetch";ft(t,e),pt(t,od)}function od(){wa()&&se(U,"fetch",function(e){return function(...t){const{method:n,url:r}=ad(t),s={args:t,fetchData:{method:n,url:r},startTimestamp:Date.now()};return ve("fetch",{...s}),e.apply(U,t).then(i=>{const o={...s,endTimestamp:Date.now(),response:i};return ve("fetch",o),i},i=>{const o={...s,endTimestamp:Date.now(),error:i};throw ve("fetch",o),i})}})}function ls(e,t){return!!e&&typeof e=="object"&&!!e[t]}function Di(e){return typeof e=="string"?e:e?ls(e,"url")?e.url:e.toString?e.toString():"":""}function ad(e){if(e.length===0)return{method:"GET",url:""};if(e.length===2){const[n,r]=e;return{url:Di(n),method:ls(r,"method")?String(r.method).toUpperCase():"GET"}}const t=e[0];return{url:Di(t),method:ls(t,"method")?String(t.method).toUpperCase():"GET"}}let On=null;function ka(e){const t="error";ft(t,e),pt(t,cd)}function cd(){On=U.onerror,U.onerror=function(e,t,n,r,s){return ve("error",{column:r,error:s,line:n,msg:e,url:t}),On&&!On.__SENTRY_LOADER__?On.apply(this,arguments):!1},U.onerror.__SENTRY_INSTRUMENTED__=!0}let Nn=null;function Ra(e){const t="unhandledrejection";ft(t,e),pt(t,ud)}function ud(){Nn=U.onunhandledrejection,U.onunhandledrejection=function(e){return ve("unhandledrejection",e),Nn&&!Nn.__SENTRY_LOADER__?Nn.apply(this,arguments):!0},U.onunhandledrejection.__SENTRY_INSTRUMENTED__=!0}const Dn=ca();function ld(){const e=Dn.chrome,t=e&&e.app&&e.app.runtime,n="history"in Dn&&!!Dn.history.pushState&&!!Dn.history.replaceState;return!t&&n}const en=U;let Ln;function bn(e){const t="history";ft(t,e),pt(t,dd)}function dd(){if(!ld())return;const e=en.onpopstate;en.onpopstate=function(...n){const r=en.location.href,s=Ln;if(Ln=r,ve("history",{from:s,to:r}),e)try{return e.apply(this,n)}catch{}};function t(n){return function(...r){const s=r.length>2?r[2]:void 0;if(s){const i=Ln,o=String(s);Ln=o,ve("history",{from:i,to:o})}return n.apply(this,r)}}se(en.history,"pushState",t),se(en.history,"replaceState",t)}const fd=U,Me="__sentry_xhr_v3__";function vr(e){const t="xhr";ft(t,e),pt(t,pd)}function pd(){if(!fd.XMLHttpRequest)return;const e=XMLHttpRequest.prototype;se(e,"open",function(t){return function(...n){const r=Date.now(),s=At(n[0])?n[0].toUpperCase():void 0,i=hd(n[1]);if(!s||!i)return t.apply(this,n);this[Me]={method:s,url:i,request_headers:{}},s==="POST"&&i.match(/sentry_key/)&&(this.__sentry_own_request__=!0);const o=()=>{const a=this[Me];if(a&&this.readyState===4){try{a.status_code=this.status}catch{}const c={args:[s,i],endTimestamp:Date.now(),startTimestamp:r,xhr:this};ve("xhr",c)}};return"onreadystatechange"in this&&typeof this.onreadystatechange=="function"?se(this,"onreadystatechange",function(a){return function(...c){return o(),a.apply(this,c)}}):this.addEventListener("readystatechange",o),se(this,"setRequestHeader",function(a){return function(...c){const[u,l]=c,d=this[Me];return d&&At(u)&&At(l)&&(d.request_headers[u.toLowerCase()]=l),a.apply(this,c)}}),t.apply(this,n)}}),se(e,"send",function(t){return function(...n){const r=this[Me];if(!r)return t.apply(this,n);n[0]!==void 0&&(r.body=n[0]);const s={args:[r.method,r.url],startTimestamp:Date.now(),xhr:this};return ve("xhr",s),t.apply(this,n)}})}function hd(e){if(At(e))return e;try{return e.toString()}catch{}}function md(){return typeof __SENTRY_BROWSER_BUNDLE__<"u"&&!!__SENTRY_BROWSER_BUNDLE__}function gd(){return"npm"}function _d(){return!md()&&Object.prototype.toString.call(typeof Ci<"u"?Ci:0)==="[object process]"}function ds(){return typeof window<"u"&&(!_d()||yd())}function yd(){return U.process!==void 0&&U.process.type==="renderer"}function Sd(e,t){let n=0;for(let r=e.length-1;r>=0;r--){const s=e[r];s==="."?e.splice(r,1):s===".."?(e.splice(r,1),n++):n&&(e.splice(r,1),n--)}if(t)for(;n--;n)e.unshift("..");return e}const bd=/^(\S+:\\|\/?)([\s\S]*?)((?:\.{1,2}|[^/\\]+?|)(\.[^./\\]*|))(?:[/\\]*)$/;function Ed(e){const t=e.length>1024?`<truncated>${e.slice(-1024)}`:e,n=bd.exec(t);return n?n.slice(1):[]}function Li(...e){let t="",n=!1;for(let r=e.length-1;r>=-1&&!n;r--){const s=r>=0?e[r]:"/";s&&(t=`${s}/${t}`,n=s.charAt(0)==="/")}return t=Sd(t.split("/").filter(r=>!!r),!n).join("/"),(n?"/":"")+t||"."}function Pi(e){let t=0;for(;t<e.length&&e[t]==="";t++);let n=e.length-1;for(;n>=0&&e[n]==="";n--);return t>n?[]:e.slice(t,n-t+1)}function vd(e,t){e=Li(e).slice(1),t=Li(t).slice(1);const n=Pi(e.split("/")),r=Pi(t.split("/")),s=Math.min(n.length,r.length);let i=s;for(let a=0;a<s;a++)if(n[a]!==r[a]){i=a;break}let o=[];for(let a=i;a<n.length;a++)o.push("..");return o=o.concat(r.slice(i)),o.join("/")}function Td(e,t){return Ed(e)[2]}function Id(e){const t=[];function n(){return e===void 0||t.length<e}function r(o){return t.splice(t.indexOf(o),1)[0]}function s(o){if(!n())return Ns(new Ce("Not adding Promise because buffer limit was reached."));const a=o();return t.indexOf(a)===-1&&t.push(a),a.then(()=>r(a)).then(null,()=>r(a).then(null,()=>{})),a}function i(o){return new Os((a,c)=>{let u=t.length;if(!u)return a(!0);const l=setTimeout(()=>{o&&o>0&&a(!1)},o);t.forEach(d=>{Pt(d).then(()=>{--u||(clearTimeout(l),a(!0))},c)})})}return{$:t,add:s,drain:i}}function et(e){if(!e)return{};const t=e.match(/^(([^:/?#]+):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$/);if(!t)return{};const n=t[6]||"",r=t[8]||"";return{host:t[4],path:t[5],protocol:t[2],search:n,hash:r,relative:t[5]+n+r}}function wd(e){return e.split(/[\?#]/,1)[0]}function Fi(e){return e.split(/\\?\//).filter(t=>t.length>0&&t!==",").length}const kd=["fatal","error","warning","log","info","debug"];function Ca(e){return e==="warn"?"warning":kd.includes(e)?e:"log"}function Ne(e,t=[]){return[e,t]}function Rd(e,t){const[n,r]=e;return[n,[...r,t]]}function $t(e,t){const n=e[1];for(const r of n){const s=r[0].type;if(t(r,s))return!0}return!1}function Cd(e,t){return $t(e,(n,r)=>t.includes(r))}function fs(e,t){return(t||new TextEncoder).encode(e)}function xa(e,t){const[n,r]=e;let s=JSON.stringify(n);function i(o){typeof s=="string"?s=typeof o=="string"?s+o:[fs(s,t),o]:s.push(typeof o=="string"?fs(o,t):o)}for(const o of r){const[a,c]=o;if(i(`
@@ -358,4 +358,4 @@ ${t==="system"?`
358
358
  `),"</html>"];return s.forEach(a=>{const c=a.stacktrace;c&&c.frames&&(c.frames=c.frames.map(u=>Kb(u,o,r,t)))}),e}function Kb(e,t,n,r){return e.filename!==n||!e.lineno||!t.length||Gl(t,e,r),e}function yn(e){return new Promise((t,n)=>{e.oncomplete=e.onsuccess=()=>t(e.result),e.onabort=e.onerror=()=>n(e.error)})}function Xb(e,t){const n=indexedDB.open(e);n.onupgradeneeded=()=>n.result.createObjectStore(t);const r=yn(n);return s=>r.then(i=>s(i.transaction(t,"readwrite").objectStore(t)))}function al(e){return yn(e.getAllKeys())}function Jb(e,t,n){return e(r=>al(r).then(s=>{if(!(s.length>=n))return r.put(t,Math.max(...s,0)+1),yn(r.transaction)}))}function Zb(e){return e(t=>al(t).then(n=>{if(n.length!==0)return yn(t.get(n[0])).then(r=>(t.delete(n[0]),yn(t.transaction).then(()=>r)))}))}function Qb(e){let t;function n(){return t==null&&(t=Xb(e.dbName||"sentry-offline",e.storeName||"queue")),t}return{insert:async r=>{try{const s=await xa(r,e.textEncoder);await Jb(n(),s,e.maxQueueSize||30)}catch{}},pop:async()=>{try{const r=await Zb(n());if(r)return Ad(r,e.textEncoder||new TextEncoder,e.textDecoder||new TextDecoder)}catch{}}}}function eE(e){return t=>e({...t,createStore:Qb})}function fv(e){return eE(Pf(e))}const ea=1e6,Xn=String(0),tE="main";let cl="",ul="",ll="",Cs=E.navigator&&E.navigator.userAgent||"",dl="";const nE=E.navigator&&E.navigator.language||E.navigator&&E.navigator.languages&&E.navigator.languages[0]||"";function rE(e){return typeof e=="object"&&e!==null&&"getHighEntropyValues"in e}const ta=E.navigator&&E.navigator.userAgentData;rE(ta)&&ta.getHighEntropyValues(["architecture","model","platform","platformVersion","fullVersionList"]).then(e=>{if(cl=e.platform||"",ll=e.architecture||"",dl=e.model||"",ul=e.platformVersion||"",e.fullVersionList&&e.fullVersionList.length>0){const t=e.fullVersionList[e.fullVersionList.length-1];Cs=`${t.brand} ${t.version}`}}).catch(e=>{});function sE(e){return!("thread_metadata"in e)}function iE(e){return sE(e)?cE(e):e}function oE(e){const t=e&&e.contexts&&e.contexts.trace&&e.contexts.trace.trace_id;return typeof t=="string"&&t.length!==32&&F&&h.log(`[Profiling] Invalid traceId: ${t} on profiled event`),typeof t!="string"?"":t}function aE(e,t,n,r){if(r.type!=="transaction")throw new TypeError("Profiling events may only be attached to transactions, this should never occur.");if(n==null)throw new TypeError(`Cannot construct profiling event envelope without a valid profile. Got ${n} instead.`);const s=oE(r),i=iE(n),o=t||(typeof r.start_timestamp=="number"?r.start_timestamp*1e3:Date.now()),a=typeof r.timestamp=="number"?r.timestamp*1e3:Date.now();return{event_id:e,timestamp:new Date(o).toISOString(),platform:"javascript",version:"1",release:r.release||"",environment:r.environment||Yl,runtime:{name:"javascript",version:E.navigator.userAgent},os:{name:cl,version:ul,build_number:Cs},device:{locale:nE,model:dl,manufacturer:Cs,architecture:ll,is_emulator:!1},debug_meta:{images:dE(n.resources)},profile:i,transactions:[{name:r.transaction||"",id:r.event_id||Lt(),trace_id:s,active_thread_id:Xn,relative_start_ns:"0",relative_end_ns:((a-o)*1e6).toFixed(0)}]}}function fl(e){return e.op==="pageload"}function cE(e){let t,n=0;const r={samples:[],stacks:[],frames:[],thread_metadata:{[Xn]:{name:tE}}};if(!e.samples.length)return r;const s=e.samples[0].timestamp,i=typeof performance.timeOrigin=="number"?performance.timeOrigin:oe||0,o=i-(oe||i);for(let a=0;a<e.samples.length;a++){const c=e.samples[a];if(c.stackId===void 0){t===void 0&&(t=n,r.stacks[t]=[],n++),r.samples[a]={elapsed_since_start_ns:((c.timestamp+o-s)*ea).toFixed(0),stack_id:t,thread_id:Xn};continue}let u=e.stacks[c.stackId];const l=[];for(;u;){l.push(u.frameId);const f=e.frames[u.frameId];r.frames[u.frameId]===void 0&&(r.frames[u.frameId]={function:f.name,abs_path:typeof f.resourceId=="number"?e.resources[f.resourceId]:void 0,lineno:f.line,colno:f.column}),u=u.parentId===void 0?void 0:e.stacks[u.parentId]}const d={elapsed_since_start_ns:((c.timestamp+o-s)*ea).toFixed(0),stack_id:n,thread_id:Xn};r.stacks[n]=l,r.samples[a]=d,n++}return r}function uE(e,t){if(!t.length)return e;for(const n of t)e[1].push([{type:"profile"},n]);return e}function lE(e){const t=[];return $t(e,(n,r)=>{if(r==="transaction")for(let s=1;s<n.length;s++){const i=n[s];i&&i.contexts&&i.contexts.profile&&i.contexts.profile.profile_id&&t.push(n[s])}}),t}const na=new WeakMap;function dE(e){const t=U._sentryDebugIds;if(!t)return[];const n=A(),r=n&&n.getOptions(),s=r&&r.stackParser;if(!s)return[];let i;const o=na.get(s);o?i=o:(i=new Map,na.set(s,i));const a=Object.keys(t).reduce((u,l)=>{let d;const f=i.get(l);f?d=f:(d=s(l),i.set(l,d));for(let p=d.length-1;p>=0;p--){const m=d[p],_=m&&m.filename;if(m&&_){u[_]=t[l];break}}return u},{}),c=[];for(const u of e)u&&a[u]&&c.push({type:"sourcemap",code_file:u,debug_id:a[u]});return c}function fE(e){return typeof e!="number"&&typeof e!="boolean"||typeof e=="number"&&isNaN(e)?(F&&h.warn(`[Profiling] Invalid sample rate. Sample rate must be a boolean or a number between 0 and 1. Got ${JSON.stringify(e)} of type ${JSON.stringify(typeof e)}.`),!1):e===!0||e===!1?!0:e<0||e>1?(F&&h.warn(`[Profiling] Invalid sample rate. Sample rate must be between 0 and 1. Got ${e}.`),!1):!0}function pE(e){return e.samples.length<2?(F&&h.log("[Profiling] Discarding profile because it contains less than 2 samples"),!1):e.frames.length?!0:(F&&h.log("[Profiling] Discarding profile because it contains no frames"),!1)}let pl=!1;const hl=3e4;function hE(e){return typeof e=="function"}function mE(){const e=E.Profiler;if(!hE(e)){F&&h.log("[Profiling] Profiling is not supported by this browser, Profiler interface missing on window object.");return}const t=10,n=Math.floor(hl/t);try{return new e({sampleInterval:t,maxBufferSize:n})}catch{F&&(h.log("[Profiling] Failed to initialize the Profiling constructor, this is likely due to a missing 'Document-Policy': 'js-profiling' header."),h.log("[Profiling] Disabling profiling for current user session.")),pl=!0}}function xs(e){if(pl)return F&&h.log("[Profiling] Profiling has been disabled for the duration of the current user session."),!1;if(!e.isRecording())return F&&h.log("[Profiling] Discarding profile because transaction was not sampled."),!1;const t=A(),n=t&&t.getOptions();if(!n)return F&&h.log("[Profiling] Profiling disabled, no options found."),!1;const r=n.profilesSampleRate;return fE(r)?r?(r===!0?!0:Math.random()<r)?!0:(F&&h.log(`[Profiling] Discarding profile because it's not included in the random sample (sampling rate = ${Number(r)})`),!1):(F&&h.log("[Profiling] Discarding profile because a negative sampling decision was inherited or profileSampleRate is set to 0"),!1):(F&&h.warn("[Profiling] Discarding profile because of invalid sample rate."),!1)}function gE(e,t,n,r){return pE(n)?aE(e,t,n,r):null}const Qe=new Map;function _E(){return Qe.size}function yE(e){const t=Qe.get(e);return t&&Qe.delete(e),t}function SE(e,t){if(Qe.set(e,t),Qe.size>30){const n=Qe.keys().next().value;Qe.delete(n)}}function pv(e){return e?xs(e)?As(e):e:(F&&h.log("[Profiling] Transaction is undefined, skipping profiling"),e)}function As(e){let t;fl(e)&&(t=ot()*1e3);const n=mE();if(!n)return e;F&&h.log(`[Profiling] started profiling transaction: ${j(e).description}`);const r=Lt();async function s(){return!e||!n?null:n.stop().then(c=>(i&&(E.clearTimeout(i),i=void 0),F&&h.log(`[Profiling] stopped profiling of transaction: ${j(e).description}`),c?(SE(r,c),null):(F&&h.log(`[Profiling] profiler returned null profile for: ${j(e).description}`,"this may indicate an overlapping transaction or a call to stopProfiling with a profile title that was never started"),null))).catch(c=>(F&&h.log("[Profiling] error while stopping profiler:",c),null))}let i=E.setTimeout(()=>{F&&h.log("[Profiling] max profile duration elapsed, stopping profiling for:",j(e).description),s()},hl);const o=e.end.bind(e);function a(){return e?(s().then(()=>{e.setContext("profile",{profile_id:r,start_timestamp:t}),o()},()=>{o()}),e):o()}return e.end=a,e}const ml="BrowserProfiling",bE=()=>({name:ml,setupOnce(){},setup(e){const n=ae().getTransaction();if(n&&fl(n)&&xs(n)&&As(n),typeof e.on!="function"){h.warn("[Profiling] Client does not support hooks, profiling will be disabled");return}e.on("startTransaction",r=>{xs(r)&&As(r)}),e.on("beforeEnvelope",r=>{if(!_E())return;const s=lE(r);if(!s.length)return;const i=[];for(const o of s){const a=o&&o.contexts,c=a&&a.profile&&a.profile.profile_id,u=a&&a.profile&&a.profile.start_timestamp;if(typeof c!="string"){F&&h.log("[Profiling] cannot find profile for a transaction without a profile context");continue}if(!c){F&&h.log("[Profiling] cannot find profile for a transaction without a profile context");continue}a&&a.profile&&delete a.profile;const l=yE(c);if(!l){F&&h.log(`[Profiling] Could not retrieve profile for transaction: ${c}`);continue}const d=gE(c,u,l,o);d&&i.push(d)}uE(r,i)})}}),EE=bE,hv=Z(ml,EE);let gl={};E.Sentry&&E.Sentry.Integrations&&(gl=E.Sentry.Integrations);const mv={...gl,...Ip,...Jm};function gv(e){const t={...e};nc(t,"react"),Km(t)}const _l="ui.react.render",vE="ui.react.update",yl="ui.react.mount",ra="/home/runner/work/sentry-javascript/sentry-javascript/packages/react/src/profiler.tsx",TE="unknown";class Sl extends me.Component{static __initStatic(){this.defaultProps={disabled:!1,includeRender:!0,includeUpdates:!0}}constructor(t){super(t);const{name:n,disabled:r=!1}=this.props;r||(this._mountSpan=tt({name:`<${n}>`,onlyIfParent:!0,op:yl,origin:"auto.ui.react.profiler",attributes:{"ui.component_name":n}}))}componentDidMount(){this._mountSpan&&this._mountSpan.end()}shouldComponentUpdate({updateProps:t,includeUpdates:n=!0}){if(n&&this._mountSpan&&t!==this.props.updateProps){const r=Object.keys(t).filter(s=>t[s]!==this.props.updateProps[s]);if(r.length>0){const s=ot();this._updateSpan=Ri(this._mountSpan,()=>tt({name:`<${this.props.name}>`,onlyIfParent:!0,op:vE,origin:"auto.ui.react.profiler",startTimestamp:s,attributes:{"ui.component_name":this.props.name,"ui.react.changed_props":r}}))}}return!0}componentDidUpdate(){this._updateSpan&&(this._updateSpan.end(),this._updateSpan=void 0)}componentWillUnmount(){const t=ot(),{name:n,includeRender:r=!0}=this.props;if(this._mountSpan&&r){const s=j(this._mountSpan).timestamp;Ri(this._mountSpan,()=>{const i=tt({onlyIfParent:!0,name:`<${n}>`,op:_l,origin:"auto.ui.react.profiler",startTimestamp:s,attributes:{"ui.component_name":n}});i&&i.end(t)})}}render(){return this.props.children}}Sl.__initStatic();function _v(e,t){const n=t&&t.name||e.displayName||e.name||TE,r=s=>me.createElement(Sl,{...t,name:n,updateProps:s,__self:this,__source:{fileName:ra,lineNumber:159}},me.createElement(e,{...s,__self:this,__source:{fileName:ra,lineNumber:160}}));return r.displayName=`profiler(${n})`,br(r,e),r}function yv(e,t={disabled:!1,hasRenderSpan:!0}){const[n]=me.useState(()=>{if(!(t&&t.disabled))return tt({name:`<${e}>`,onlyIfParent:!0,op:yl,origin:"auto.ui.react.profiler",attributes:{"ui.component_name":e}})});me.useEffect(()=>(n&&n.end(),()=>{if(n&&t.hasRenderSpan){const r=j(n).timestamp,s=ot(),i=tt({name:`<${e}>`,onlyIfParent:!0,op:_l,origin:"auto.ui.react.profiler",startTimestamp:r,attributes:{"ui.component_name":e}});i&&i.end(s)}}),[])}const fi=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,sa="/home/runner/work/sentry-javascript/sentry-javascript/packages/react/src/errorboundary.tsx";function IE(e){const t=e.match(/^([^.]+)/);return t!==null&&parseInt(t[0])>=17}const wE="unknown",ia={componentStack:null,error:null,eventId:null};function kE(e,t){const n=new WeakMap;function r(s,i){if(!n.has(s)){if(s.cause)return n.set(s,!0),r(s.cause,i);s.cause=i}}r(e,t)}class pi extends me.Component{constructor(t){super(t),pi.prototype.__init.call(this),this.state=ia,this._openFallbackReportDialog=!0;const n=A();n&&n.on&&t.showDialog&&(this._openFallbackReportDialog=!1,n.on("afterSendEvent",r=>{!r.type&&r.event_id===this._lastEventId&&lo({...t.dialogOptions,eventId:this._lastEventId})}))}componentDidCatch(t,{componentStack:n}){const{beforeCapture:r,onError:s,showDialog:i,dialogOptions:o}=this.props;lt(a=>{if(IE(me.version)&&Mt(t)){const u=new Error(t.message);u.name=`React ErrorBoundary ${t.name}`,u.stack=n,kE(t,u)}r&&r(a,t,n);const c=Sn(t,{captureContext:{contexts:{react:{componentStack:n}}},mechanism:{handled:!!this.props.fallback}});s&&s(t,n,c),i&&(this._lastEventId=c,this._openFallbackReportDialog&&lo({...o,eventId:c})),this.setState({error:t,componentStack:n,eventId:c})})}componentDidMount(){const{onMount:t}=this.props;t&&t()}componentWillUnmount(){const{error:t,componentStack:n,eventId:r}=this.state,{onUnmount:s}=this.props;s&&s(t,n,r)}__init(){this.resetErrorBoundary=()=>{const{onReset:t}=this.props,{error:n,componentStack:r,eventId:s}=this.state;t&&t(n,r,s),this.setState(ia)}}render(){const{fallback:t,children:n}=this.props,r=this.state;if(r.error){let s;return typeof t=="function"?s=t({error:r.error,componentStack:r.componentStack,resetError:this.resetErrorBoundary,eventId:r.eventId}):s=t,me.isValidElement(s)?s:(t&&fi&&h.warn("fallback did not produce a valid ReactElement"),null)}return typeof n=="function"?n():n}}function Sv(e,t){const n=e.displayName||e.name||wE,r=s=>me.createElement(pi,{...t,__self:this,__source:{fileName:sa,lineNumber:240}},me.createElement(e,{...s,__self:this,__source:{fileName:sa,lineNumber:241}}));return r.displayName=`errorBoundary(${n})`,br(r,e),r}const RE="redux.action",CE="info",xE={attachReduxState:!0,actionTransformer:e=>e,stateTransformer:e=>e||null};function bv(e){const t={...xE,...e};return n=>(r,s)=>(t.attachReduxState&&Vl().addEventProcessor((o,a)=>{try{o.type===void 0&&o.contexts.state.state.type==="redux"&&(a.attachments=[...a.attachments||[],{filename:"redux_state.json",data:JSON.stringify(o.contexts.state.state.value)}])}catch{}return o}),n((o,a)=>{const c=r(o,a),u=ae(),l=t.actionTransformer(a);typeof l<"u"&&l!==null&&u.addBreadcrumb({category:RE,data:l,type:CE});const d=t.stateTransformer(c);if(typeof d<"u"&&d!==null){const p=A(),m=p&&p.getOptions(),_=m&&m.normalizeDepth||3,S={state:{type:"redux",value:d}};it(S,"__sentry_override_normalization_depth__",3+_),u.setContext("state",S)}else u.setContext("state",null);const{configureScopeWithState:f}=t;return typeof f=="function"&&f(u,c),c},s))}function Ev(e){const t=Cr({...e,instrumentPageLoad:!1,instrumentNavigation:!1}),{history:n,routes:r,match:s,instrumentPageLoad:i=!0,instrumentNavigation:o=!0}=e;return{...t,afterAllSetup(a){t.afterAllSetup(a);const c=d=>{wn(a,d)},u=d=>{kn(a,d)},l=AE(n,r,s);l(c,i,!1),l(u,!1,o)}}}function AE(e,t,n){return(r,s=!0,i=!0)=>{let o,a;s&&E&&E.location&&oa(t,E.location,n,(c,u="url")=>{a=c,o=r({name:a,attributes:{[Ee]:"pageload",[he]:"auto.pageload.react.reactrouter_v3",[ee]:u}})}),i&&e.listen&&e.listen(c=>{(c.action==="PUSH"||c.action==="POP")&&(o&&o.end(),oa(t,c,n,(u,l="url")=>{a=u;const d={[Ee]:"navigation",[he]:"auto.navigation.react.reactrouter_v3",[ee]:l};o=r({name:a,attributes:d})}))})}}function oa(e,t,n,r){let s=t.pathname;n({location:t,routes:e},(i,o,a)=>{if(i||!a)return r(s);const c=ME(a.routes||[]);return c.length===0||c==="/*"?r(s):(s=c,r(s,"route"))})}function ME(e){if(!Array.isArray(e)||e.length===0)return"";const t=e.filter(r=>!!r.path);let n=-1;for(let r=t.length-1;r>=0;r--){const s=t[r];if(s.path&&s.path.startsWith("/")){n=r;break}}return t.slice(n).filter(({path:r})=>!!r).map(({path:r})=>r).join("")}const OE="/home/runner/work/sentry-javascript/sentry-javascript/packages/react/src/reactrouter.tsx";let xt;function vv(e){const t=Cr({...e,instrumentPageLoad:!1,instrumentNavigation:!1}),{history:n,routes:r,matchPath:s,instrumentPageLoad:i=!0,instrumentNavigation:o=!0}=e;return{...t,afterAllSetup(a){t.afterAllSetup(a);const c=d=>{wn(a,d)},u=d=>{kn(a,d)},l=NE(n,r,s);l(c,i,!1),l(u,!1,o)}}}function Tv(e){const t=Cr({...e,instrumentPageLoad:!1,instrumentNavigation:!1}),{history:n,routes:r,matchPath:s}=e;return{...t,afterAllSetup(i){t.afterAllSetup(i);const o=u=>{wn(i,u)},a=u=>{kn(i,u)},c=DE(n,r,s);c(o,e.instrumentPageLoad,!1),c(a,!1,e.instrumentNavigation)}}}function NE(e,t,n){return bl(e,"reactrouter_v4",t,n)}function DE(e,t,n){return bl(e,"reactrouter_v5",t,n)}function bl(e,t,n=[],r){function s(){if(e&&e.location)return e.location.pathname;if(E&&E.location)return E.location.pathname}function i(o){if(n.length===0||!r)return[o,"url"];const a=El(n,o,r);for(let c=0;c<a.length;c++)if(a[c].match.isExact)return[a[c].match.path,"route"];return[o,"url"]}return(o,a=!0,c=!0)=>{const u=s();if(a&&u){const[l,d]=i(u);xt=o({name:l,attributes:{[Ee]:"pageload",[he]:`auto.pageload.react.${t}`,[ee]:d}})}c&&e.listen&&e.listen((l,d)=>{if(d&&(d==="PUSH"||d==="POP")){xt&&xt.end();const[f,p]=i(l.pathname);xt=o({name:f,attributes:{[Ee]:"navigation",[he]:`auto.navigation.react.${t}`,[ee]:p}})}})}}function El(e,t,n,r=[]){return e.some(s=>{const i=s.path?n(t,s):r.length?r[r.length-1].match:LE(t);return i&&(r.push({route:s,match:i}),s.routes&&El(s.routes,t,n,r)),!!i}),r}function LE(e){return{path:"/",url:"/",params:{},isExact:e==="/"}}function Iv(e){const t=e.displayName||e.name,n=r=>{if(r&&r.computedMatch&&r.computedMatch.isExact){const s=r.computedMatch.path,i=PE();i&&(i.updateName(s),i.setAttribute(ee,"route"))}return me.createElement(e,{...r,__self:this,__source:{fileName:OE,lineNumber:279}})};return n.displayName=`sentryRoute(${t})`,br(n,e),n}function PE(){if(xt)return xt;const e=Kt(),t=e?Jn(e):void 0;if(!t)return;const n=j(t).op;return n==="navigation"||n==="pageload"?t:void 0}const vl="/home/runner/work/sentry-javascript/sentry-javascript/packages/react/src/reactrouterv6.tsx";let Nt,nt,rt,st,dn,ut,qt,Fr,Je=!1;function wv(e){const t=Cr({...e,instrumentPageLoad:!1,instrumentNavigation:!1}),{useEffect:n,useLocation:r,useNavigationType:s,createRoutesFromChildren:i,matchRoutes:o,stripBasename:a,instrumentPageLoad:c=!0,instrumentNavigation:u=!0}=e;return{...t,afterAllSetup(l){t.afterAllSetup(l);const d=p=>{kn(l,p)},f=E&&E.location&&E.location.pathname;c&&f&&wn(l,{name:f,attributes:{[ee]:"url",[Ee]:"pageload",[he]:"auto.pageload.react.reactrouter_v6"}}),nt=n,rt=r,st=s,ut=o,dn=i,Je=a||!1,qt=d,Fr=u}}}function kv(e,t,n,r,s,i){return(o,a=!0,c=!0)=>{const u=E&&E.location&&E.location.pathname;a&&u&&(Nt=o({name:u,attributes:{[ee]:"url",[Ee]:"pageload",[he]:"auto.pageload.react.reactrouter_v6"}})),nt=e,rt=t,st=n,ut=s,dn=r,Je=i||!1,qt=o,Fr=c}}function ns(e,t){if(!t||t==="/"||!e.toLowerCase().startsWith(t.toLowerCase()))return e;const n=t.endsWith("/")?t.length-1:t.length,r=e.charAt(n);return r&&r!=="/"?e:e.slice(n)||"/"}function Tl(e,t,n,r=""){if(!e||e.length===0)return[Je?ns(t.pathname,r):t.pathname,"url"];let s="";if(n)for(let i=0;i<n.length;i++){const o=n[i],a=o.route;if(a){if(a.index)return[Je?ns(o.pathname,r):o.pathname,"route"];const c=a.path;if(c){const u=c[0]==="/"||s[s.length-1]==="/"?c:`/${c}`;if(s+=u,r+o.pathname===t.pathname)return Fi(s)!==Fi(o.pathname)&&s.slice(-2)!=="/*"?[(Je?"":r)+u,"route"]:[(Je?"":r)+s,"route"]}}}return[Je?ns(t.pathname,r):t.pathname,"url"]}function hi(e,t,n,r,s){const i=Array.isArray(r)?r:ut(n,t,s);if(e&&i){const[o,a]=Tl(n,t,i,s);e.updateName(o),e.setAttribute(ee,a)}}function mi(e,t,n,r,s){const i=Array.isArray(r)?r:ut(t,e,s);if(Fr&&(n==="PUSH"||n==="POP")&&i){Nt&&Nt.end();const[o,a]=Tl(t,e,i,s);Nt=qt({name:o,attributes:{[ee]:a,[Ee]:"navigation",[he]:"auto.navigation.react.reactrouter_v6"}})}}function Rv(e){if(!nt||!rt||!st||!dn||!ut||!qt)return fi&&h.warn(`reactRouterV6Instrumentation was unable to wrap Routes because of one or more missing parameters.
359
359
  useEffect: ${nt}. useLocation: ${rt}. useNavigationType: ${st}.
360
360
  createRoutesFromChildren: ${dn}. matchRoutes: ${ut}. customStartTransaction: ${qt}.`),e;let t=!0;const n=r=>{const s=rt(),i=st();return nt(()=>{const o=dn(r.children);t?(hi(gi(),s,o),t=!1):mi(s,o,i)},[s,i]),me.createElement(e,{...r,__self:this,__source:{fileName:vl,lineNumber:329}})};return br(n,e),n}function Cv(e){if(!nt||!rt||!st||!ut||!qt)return fi&&h.warn("reactRouterV6Instrumentation was unable to wrap `useRoutes` because of one or more missing parameters."),e;let t=!0;const n=r=>{const{routes:s,locationArg:i}=r,o=e(s,i),a=rt(),c=st(),u=typeof i=="string"||i&&i.pathname?i:a;return nt(()=>{const l=typeof u=="string"?{pathname:u}:u;t?(hi(gi(),l,s),t=!1):mi(l,s,c)},[c,u]),o};return(r,s)=>me.createElement(n,{routes:r,locationArg:s,__self:this,__source:{fileName:vl,lineNumber:386}})}function xv(e){return function(t,n){const r=e(t,n),s=n&&n.basename,i=gi();return r.state.historyAction==="POP"&&i&&hi(i,r.state.location,t,void 0,s),r.subscribe(o=>{const a=o.location;Fr&&(o.historyAction==="PUSH"||o.historyAction==="POP")&&mi(a,t,o.historyAction,void 0,s)}),r}}function gi(){if(Nt)return Nt;const e=Kt(),t=e?Jn(e):void 0;if(!t)return;const n=j(t).op;return n==="navigation"||n==="pageload"?t:void 0}export{mm as Breadcrumbs,Hh as BrowserClient,hv as BrowserProfilingIntegration,tv as BrowserTracing,Im as Dedupe,pi as ErrorBoundary,Pr as Feedback,lp as FunctionToString,xm as GlobalHandlers,Pm as HttpContext,Ov as Hub,Qf as InboundFilters,mv as Integrations,Hm as LinkedErrors,QE as ModuleMetadata,Sl as Profiler,Dr as Replay,lv as ReplayCanvas,Ti as SDK_VERSION,Ee as SEMANTIC_ATTRIBUTE_SENTRY_OP,he as SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,Tt as SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE,ee as SEMANTIC_ATTRIBUTE_SENTRY_SOURCE,Nv as Scope,zm as TryCatch,E as WINDOW,je as addBreadcrumb,Tf as addEventProcessor,$l as addGlobalEventProcessor,XE as addIntegration,za as addTracingExtensions,Dc as breadcrumbsIntegration,Vc as browserApiErrorsIntegration,EE as browserProfilingIntegration,Cr as browserTracingIntegration,pb as captureConsoleIntegration,Sr as captureEvent,Sn as captureException,is as captureMessage,ki as captureSession,av as captureUserFeedback,em as chromeStackLineParser,Dv as close,Lv as configureScope,Yb as contextLinesIntegration,KE as continueTrace,bv as createReduxEnhancer,Qa as createTransport,$h as createUserFeedbackEnvelope,gb as debugIntegration,yb as dedupeIntegration,Ym as defaultIntegrations,ir as defaultRequestInstrumentationOptions,fm as defaultStackLineParsers,pm as defaultStackParser,Pv as endSession,Dh as eventFromException,Lh as eventFromMessage,Mc as exceptionFromError,Tb as extraErrorDataIntegration,jE as extractTraceparentData,dv as feedbackIntegration,Fv as flush,sv as forceLoad,cc as functionToStringIntegration,sm as geckoStackLineParser,Kt as getActiveSpan,Oe as getActiveTransaction,A as getClient,Ie as getCurrentHub,ae as getCurrentScope,Vm as getDefaultIntegrations,$v as getHubFromCarrier,uv as getReplay,Da as getSpanStatusFromHttpCode,Hc as globalHandlersIntegration,Db as httpClientIntegration,jc as httpContextIntegration,oc as inboundFiltersIntegration,gv as init,Cc as instrumentOutgoingRequests,Bv as isInitialized,Hv as lastEventId,Gc as linkedErrorsIntegration,fv as makeBrowserOfflineTransport,zh as makeFetchTransport,Uv as makeMain,JE as makeMultiplexedTransport,qh as makeXHRTransport,ev as metrics,Kf as moduleMetadataIntegration,iv as onLoad,pv as onProfilingStartRouteTransaction,nv as opera10StackLineParser,rv as opera11StackLineParser,ZE as parameterize,Ev as reactRouterV3BrowserTracingIntegration,AE as reactRouterV3Instrumentation,vv as reactRouterV4BrowserTracingIntegration,NE as reactRouterV4Instrumentation,Tv as reactRouterV5BrowserTracingIntegration,DE as reactRouterV5Instrumentation,wv as reactRouterV6BrowserTracingIntegration,kv as reactRouterV6Instrumentation,DS as replayCanvasIntegration,cv as replayIntegration,Cb as reportingObserverIntegration,Ab as rewriteFramesIntegration,KS as sendFeedback,Ob as sessionTimingIntegration,ql as setContext,Mf as setCurrentClient,Wv as setExtra,zv as setExtras,Ws as setHttpStatus,Xd as setMeasurement,jv as setTag,qv as setTags,Gv as setUser,lo as showReportDialog,qE as spanStatusfromHttpCode,kn as startBrowserTracingNavigationSpan,wn as startBrowserTracingPageLoadSpan,tt as startInactiveSpan,wi as startSession,YE as startSpan,VE as startSpanManual,Yv as startTransaction,GE as trace,yv as useProfiler,am as winjsStackLineParser,Ri as withActiveSpan,Sv as withErrorBoundary,Vv as withIsolationScope,_v as withProfiler,lt as withScope,Rv as withSentryReactRouterV6Routing,Iv as withSentryRouting,ov as wrap,xv as wrapCreateBrowserRouter,Cv as wrapUseRoutes};
361
- //# sourceMappingURL=index.tjOyiWN1.js.map
361
+ //# sourceMappingURL=index.BWsvZ6s-.js.map