@powerhousedao/connect 4.1.0-dev.21 → 4.1.0-dev.22

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 (68) hide show
  1. package/dist/assets/{AddDriveModal.CD236M_f.js → AddDriveModal.DZSqTSES.js} +2 -2
  2. package/dist/assets/{AddDriveModal.CD236M_f.js.map → AddDriveModal.DZSqTSES.js.map} +1 -1
  3. package/dist/assets/{CookiesPolicyModal.FF1s7vxo.js → CookiesPolicyModal.CmngOQJ0.js} +2 -2
  4. package/dist/assets/{CookiesPolicyModal.FF1s7vxo.js.map → CookiesPolicyModal.CmngOQJ0.js.map} +1 -1
  5. package/dist/assets/{CreateDocumentModal.DFAJgJSa.js → CreateDocumentModal.D0aOUvud.js} +2 -2
  6. package/dist/assets/{CreateDocumentModal.DFAJgJSa.js.map → CreateDocumentModal.D0aOUvud.js.map} +1 -1
  7. package/dist/assets/{DebugSettingsModal.vXpnO3gf.js → DebugSettingsModal.DH8afF4N.js} +2 -2
  8. package/dist/assets/{DebugSettingsModal.vXpnO3gf.js.map → DebugSettingsModal.DH8afF4N.js.map} +1 -1
  9. package/dist/assets/{DeleteDriveModal.Bw5O7v4Z.js → DeleteDriveModal.Bc5WuBbs.js} +2 -2
  10. package/dist/assets/{DeleteDriveModal.Bw5O7v4Z.js.map → DeleteDriveModal.Bc5WuBbs.js.map} +1 -1
  11. package/dist/assets/{DeleteItemModal.qQ6d94st.js → DeleteItemModal.kbH21iIM.js} +2 -2
  12. package/dist/assets/{DeleteItemModal.qQ6d94st.js.map → DeleteItemModal.kbH21iIM.js.map} +1 -1
  13. package/dist/assets/{DisclaimerModal.C6PESA51.js → DisclaimerModal.ByWNCYte.js} +2 -2
  14. package/dist/assets/{DisclaimerModal.C6PESA51.js.map → DisclaimerModal.ByWNCYte.js.map} +1 -1
  15. package/dist/assets/{DriveSettingsModal.B6QFaHSI.js → DriveSettingsModal.Drle0eFP.js} +2 -2
  16. package/dist/assets/{DriveSettingsModal.B6QFaHSI.js.map → DriveSettingsModal.Drle0eFP.js.map} +1 -1
  17. package/dist/assets/{SettingsModal.DaNF8zOc.js → SettingsModal.Prg1bwnU.js} +2 -2
  18. package/dist/assets/{SettingsModal.DaNF8zOc.js.map → SettingsModal.Prg1bwnU.js.map} +1 -1
  19. package/dist/assets/{Trans.tT3J1skx.js → Trans.Cfj7Hl8U.js} +2 -2
  20. package/dist/assets/{Trans.tT3J1skx.js.map → Trans.Cfj7Hl8U.js.map} +1 -1
  21. package/dist/assets/{UpgradeDriveModal.BP5lDPFB.js → UpgradeDriveModal.CLTqE5v0.js} +2 -2
  22. package/dist/assets/{UpgradeDriveModal.BP5lDPFB.js.map → UpgradeDriveModal.CLTqE5v0.js.map} +1 -1
  23. package/dist/assets/{atlas-import.BP-BUgaz.js → atlas-import.CE1LkueM.js} +2 -2
  24. package/dist/assets/{atlas-import.BP-BUgaz.js.map → atlas-import.CE1LkueM.js.map} +1 -1
  25. package/dist/assets/{content.BfvrMr0V.js → content.Di1_TxLo.js} +2 -2
  26. package/dist/assets/{content.BfvrMr0V.js.map → content.Di1_TxLo.js.map} +1 -1
  27. package/dist/assets/{cookie-banner.H8ltpgLH.js → cookie-banner.CN8lvPw2.js} +2 -2
  28. package/dist/assets/{cookie-banner.H8ltpgLH.js.map → cookie-banner.CN8lvPw2.js.map} +1 -1
  29. package/dist/assets/{index.CyGg9uhs.js → index.B8YpY9RS.js} +2 -2
  30. package/dist/assets/{index.CyGg9uhs.js.map → index.B8YpY9RS.js.map} +1 -1
  31. package/dist/assets/{index.DnAVSnDb.js → index.BQUHyrbF.js} +2 -2
  32. package/dist/assets/{index.DnAVSnDb.js.map → index.BQUHyrbF.js.map} +1 -1
  33. package/dist/assets/{index.BaBR0A-H.js → index.BTT7iJxn.js} +2 -2
  34. package/dist/assets/{index.BaBR0A-H.js.map → index.BTT7iJxn.js.map} +1 -1
  35. package/dist/assets/{index.DkU3u_hY.js → index.CE0NtSpX.js} +2 -2
  36. package/dist/assets/{index.DkU3u_hY.js.map → index.CE0NtSpX.js.map} +1 -1
  37. package/dist/assets/{index.gD5wGEzl.js → index.CvVLiiFL.js} +2 -2
  38. package/dist/assets/{index.gD5wGEzl.js.map → index.CvVLiiFL.js.map} +1 -1
  39. package/dist/assets/{index.Cx09-3h-.js → index.D1VdJrbu.js} +5 -5
  40. package/dist/assets/{index.Cx09-3h-.js.map → index.D1VdJrbu.js.map} +1 -1
  41. package/dist/assets/{index.BDASdl6n.js → index.ZacG98dM.js} +2 -2
  42. package/dist/assets/{index.BDASdl6n.js.map → index.ZacG98dM.js.map} +1 -1
  43. package/dist/assets/{main.Cvb9h3xm.js → main.BMn2Koxc.js} +3 -3
  44. package/dist/assets/{main.Cvb9h3xm.js.map → main.BMn2Koxc.js.map} +1 -1
  45. package/dist/assets/{modal.Bqyzi2Hr.js → modal.rCKchklN.js} +3 -3
  46. package/dist/assets/{modal.Bqyzi2Hr.js.map → modal.rCKchklN.js.map} +1 -1
  47. package/dist/assets/{modals.C51Hau9T.js → modals.BND5VgGq.js} +2 -2
  48. package/dist/assets/{modals.C51Hau9T.js.map → modals.BND5VgGq.js.map} +1 -1
  49. package/dist/assets/{nodefs.nYhQAdIV.js → nodefs.Bo5ZNHrD.js} +2 -2
  50. package/dist/assets/{nodefs.nYhQAdIV.js.map → nodefs.Bo5ZNHrD.js.map} +1 -1
  51. package/dist/assets/{nodes.CNC9HfbA.js → nodes.Dm7Ct2Qu.js} +2 -2
  52. package/dist/assets/{nodes.CNC9HfbA.js.map → nodes.Dm7Ct2Qu.js.map} +1 -1
  53. package/dist/assets/{opfs-ahp.DEI4_OMV.js → opfs-ahp.FfypeTGM.js} +2 -2
  54. package/dist/assets/{opfs-ahp.DEI4_OMV.js.map → opfs-ahp.FfypeTGM.js.map} +1 -1
  55. package/dist/assets/{registerServiceWorker.D3pB6TTq.js → registerServiceWorker.BedDSXhk.js} +2 -2
  56. package/dist/assets/{registerServiceWorker.D3pB6TTq.js.map → registerServiceWorker.BedDSXhk.js.map} +1 -1
  57. package/dist/assets/{root.Cc0x0eTC.js → root.DGk8DJK0.js} +2 -2
  58. package/dist/assets/{root.Cc0x0eTC.js.map → root.DGk8DJK0.js.map} +1 -1
  59. package/dist/assets/{useAcceptedCookies.DHQO4jEL.js → useAcceptedCookies.D1uKoy1t.js} +2 -2
  60. package/dist/assets/{useAcceptedCookies.DHQO4jEL.js.map → useAcceptedCookies.D1uKoy1t.js.map} +1 -1
  61. package/dist/assets/useDefaultDocumentModelEditor.8vdl-Z1u.js +2 -0
  62. package/dist/assets/{useDefaultDocumentModelEditor.rOh8o4If.js.map → useDefaultDocumentModelEditor.8vdl-Z1u.js.map} +1 -1
  63. package/dist/assets/{useInitSentry.BXZzeAO4.js → useInitSentry.Bb28RsdX.js} +6 -6
  64. package/dist/assets/{useInitSentry.BXZzeAO4.js.map → useInitSentry.Bb28RsdX.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/useDefaultDocumentModelEditor.rOh8o4If.js +0 -2
@@ -1,5 +1,5 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./index.CyGg9uhs.js","./index.Xt1GtJTP.js","./index.DnAVSnDb.js","./browser.BkwNmV2Z.js","./app-skeleton.js","./useInitSentry.BXZzeAO4.js","./useAcceptedCookies.DHQO4jEL.js","./registerServiceWorker.D3pB6TTq.js","./cookie-banner.H8ltpgLH.js","./i18next.CqOP20KE.js","./modal.Bqyzi2Hr.js","./Trans.tT3J1skx.js"])))=>i.map(i=>d[i]);
2
- var Bi=Object.defineProperty;var Fi=(t,e,n)=>e in t?Bi(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var fe=(t,e,n)=>Fi(t,typeof e!="symbol"?e+"":e,n);import{createRoot as Vi}from"react-dom/client";import{L as dt,s as ji,l as te,P as zi,a as Hi,i as Yi,g as Oo,c as Hn,b as Le,I as Wi,d as Gi,e as Ki,f as Ji,h as Nt,j as Tt,r as qi,k as Or,D as Ot,m as Xi,n as Qi,o as Cr,p as Zi,q as ea,t as ta,u as Lr,v as na,R as ra,w as oa,E as sa,x as ia,_ as Te,y as aa,z as ca,B as ua,F as da,G as la,J as fa,K as pn,M as pa,N as ha,O as Rr,Q as ga,S as _a,T as ma,U as va,V as wa,W as ya,X as Ea,Y as ba,Z as Sa,$ as Da,a0 as Ia,a1 as Aa,a2 as Pr,a3 as Rn,a4 as Na,a5 as Ta,a6 as Oa,a7 as Ca,a8 as hn}from"./index.Xt1GtJTP.js";import{jsxs as kt,jsx as ye}from"react/jsx-runtime";import Gt,{useRef as Me,createElement as La,createContext as Yn,useReducer as Co,useEffect as ce,useDebugValue as Lo,useContext as Wn,useCallback as J,useState as He,useMemo as ht,StrictMode as Ra,Suspense as xr,lazy as Gn}from"react";import{g as Pa}from"./browser.BkwNmV2Z.js";import{A as xa}from"./app-skeleton.js";const Ma="@powerhousedao/connect",$a="Powerhouse-Connect",Ua="4.1.0-dev.21",ka="Powerhouse Connect",Ba="./dist/index.html",Fa="module",Va={node:">=22.0.0"},ja=["dist","nginx.conf","nginx.sh","scripts"],za="AGPL-3.0-only",Ha="acaldas@powerhouse.inc",Ya={type:"git",url:"https://github.com/powerhouse-inc/powerhouse"},Wa={url:"https://github.com/powerhouse-inc/powerhouse/issues"},Ga="https://github.com/powerhouse-inc/powerhouse#readme",Ka={"build:tsc":"tsc --build",start:"electron-forge start",package:"electron-forge package",make:"PH_CONNECT_BASE_HREF=./ electron-forge make","make:mac":"PH_CONNECT_BASE_HREF=./ electron-forge make -p darwin","make:linux":"PH_CONNECT_BASE_HREF=./ electron-forge make -p linux","make:windows":"PH_CONNECT_BASE_HREF=./ electron-forge make -p win32","publish:electron":"electron-forge publish",prepublishOnly:"npm run build",lint:"eslint .","lint:fix":"eslint --fix .","lint:nx":"eslint --quiet --fix .",format:'prettier --write "**/*.+(js|ts|jsx|tsx|json)"',dev:"vite -c vite.renderer.config.mts","dev:nocache":"rm -rf node_modules/.vite && rm -rf node_modules/.cache && npm run dev",prebuild:"npm run clean && tsc --build --noEmit",build:"NODE_OPTIONS=--max-old-space-size=6144 vite build -c vite.renderer.config.mts",preview:"vite preview -c vite.renderer.config.mts",e2e:"playwright test","cy:open":"cypress open","build:service-worker":"tsc --build ./tsconfig.sw.json",clean:"rimraf dist","clean:node_modules":"rimraf node_modules","docker:build":"docker build -f ./Dockerfile --tag connect-test-dev --build-arg TAG=dev .","docker:run":"docker run -it -p 4000:4000 -v $(realpath ../../../monorepo):/monorepo -v $(pwd)/nginx.conf:/etc/nginx/nginx.conf.template -e PH_USE_LOCAL=true -e PH_CONNECT_BASE_PATH=/develop/powerhouse/connect -e PORT=4000 connect-test-dev"},Ja={"@didtools/key-webcrypto":"^0.2.0","@electron-forge/cli":"^6.1.1","@electron-forge/maker-deb":"^6.1.1","@electron-forge/maker-rpm":"^6.1.1","@electron-forge/maker-squirrel":"^6.1.1","@electron-forge/maker-zip":"^6.1.1","@electron-forge/plugin-vite":"^6.1.1","@electron-forge/publisher-electron-release-server":"^6.2.1","@electron-forge/publisher-github":"^7.2.0","@electron-forge/shared-types":"^7.7.0","@playwright/test":"^1.41.2","@powerhousedao/builder-tools":"workspace:*","@powerhousedao/common":"workspace:*","@powerhousedao/config":"workspace:*","@powerhousedao/design-system":"workspace:*","@powerhousedao/diff-analyzer":"^0.0.0-dev.10","@powerhousedao/reactor-browser":"workspace:*","@powerhousedao/state":"workspace:*","@renown/sdk":"workspace:*","@rollup/plugin-node-resolve":"^15.2.3","@sentry/browser":"^9.1.0","@sentry/react":"^7.109.0","@sentry/vite-plugin":"^2.23.0","@tailwindcss/vite":"^4.1.4","@tanstack/react-virtual":"^3.8.1","@types/node":"^22.15.17","@types/react":"^18.2.79","@types/react-dom":"^18.2.18","@types/uuid":"^9.0.7","@types/wicg-file-system-access":"^2020.9.6","@vitejs/plugin-basic-ssl":"^2.0.0","@vitejs/plugin-react":"^4.4.1",asar:"^3.2.0","did-jwt":"^8.0.14","did-jwt-vc":"^4.0.12","did-key-creator":"^1.2.0","document-drive":"workspace:*","document-model":"workspace:*",electron:"30.0.0","electron-is-dev":"^3.0.1","electron-playwright-helpers":"^1.7.1","electron-squirrel-startup":"^1.0.0","electron-store":"^8.1.0",esbuild:"^0.24.0","fast-deep-equal":"^3.1.3",graphql:"^16.11.0","graphql-request":"^6.1.0",i18next:"^23.7.6",jotai:"^2.1.0","jotai-devtools":"^0.12.0","jotai-effect":"^1.1.6",localforage:"^1.10.0",playwright:"^1.41.2","playwright-core":"^1.41.2",react:"^18.3.1","react-dom":"^18.3.1","react-error-boundary":"^4.0.11","react-hotkeys-hook":"^4.5.0","react-i18next":"^13.5.0","react-router-dom":"^6.11.2","tailwind-merge":"^3.0.2",tailwindcss:"^4.1.4",uint8arrays:"^5.1.0",uuid:"^9.0.1",viem:"^2.8.13",vite:"^6.3.3","vite-envs":"^4.6.0","vite-plugin-html":"^3.2.2","vite-plugin-node-polyfills":"^0.23.0","vite-plugin-svgr":"^4.3.0","vite-tsconfig-paths":"^5.1.4","xvfb-maybe":"^0.2.1"},qa={"@esbuild/linux-x64":"^0.21.4","@rollup/rollup-linux-x64-musl":"4.14.3"},Xa={name:Ma,productName:$a,version:Ua,description:ka,main:Ba,type:Fa,engines:Va,files:ja,license:za,author:Ha,repository:Ya,bugs:Wa,homepage:Ga,scripts:Ka,devDependencies:Ja,optionalDependencies:qa},Qa=Xa.version,Za=window.__VITE_ENVS.APP_VERSION||Qa,ec=window.__VITE_ENVS.PH_CONNECT_WARN_OUTDATED_APP||"false",tc=window.__VITE_ENVS.PH_CONNECT_STUDIO_MODE||"false",nc=window.__VITE_ENVS.PH_CONNECT_DISABLE_ADD_DRIVE||"false",rc=window.__VITE_ENVS.PH_CONNECT_DISABLE_ADD_PUBLIC_DRIVES||void 0,oc=window.__VITE_ENVS.PH_CONNECT_DISABLE_ADD_CLOUD_DRIVES||void 0,sc=window.__VITE_ENVS.PH_CONNECT_DISABLE_ADD_LOCAL_DRIVES||void 0,ic=window.__VITE_ENVS.PH_CONNECT_DISABLE_DELETE_PUBLIC_DRIVES||void 0,ac=window.__VITE_ENVS.PH_CONNECT_DISABLE_DELETE_CLOUD_DRIVES||void 0,cc=window.__VITE_ENVS.PH_CONNECT_DISABLE_DELETE_LOCAL_DRIVES||void 0,uc=window.__VITE_ENVS.PH_CONNECT_LOCAL_DRIVES_ENABLED||void 0,dc=window.__VITE_ENVS.PH_CONNECT_CLOUD_DRIVES_ENABLED||void 0,lc=window.__VITE_ENVS.PH_CONNECT_PUBLIC_DRIVES_ENABLED||void 0,fc=window.__VITE_ENVS.PH_CONNECT_SEARCH_BAR_ENABLED||void 0,pc=window.__VITE_ENVS.PH_CONNECT_HIDE_DOCUMENT_MODEL_SELECTION_SETTINGS||"false",Ro=Pa()||"/",hc=window.__VITE_ENVS.PH_CONNECT_SENTRY_DSN||"",gc=window.__VITE_ENVS.PH_CONNECT_SENTRY_ENV||"dev",_c=window.__VITE_ENVS.PH_CONNECT_SENTRY_TRACING_ENABLED||"false",mc=window.__VITE_ENVS.PH_CONNECT_GA_TRACKING_ID,vc=window.__VITE_ENVS.PH_CONNECT_CLI_VERSION||void 0,wc=window.__VITE_ENVS.PH_CONNECT_ANALYTICS_DATABASE_NAME||`${Ro.replace(/\//g,"")}:analytics`,yc=window.__VITE_ENVS.PH_CONNECT_ANALYTICS_DATABASE_WORKER_DISABLED||"false",Ec=window.__VITE_ENVS.PH_CONNECT_DIFF_ANALYTICS_ENABLED||"false",bc=window.__VITE_ENVS.PH_CONNECT_DRIVE_ANALYTICS_ENABLED||"false",Sc=window.__VITE_ENVS.PH_CONNECT_EXTERNAL_PROCESSORS_ENABLED||"true",Dc=Yi(window.__VITE_ENVS.LOG_LEVEL)?window.__VITE_ENVS.LOG_LEVEL:"info";ji(Dc);te.debug(`Setting log level to ${window.__VITE_ENVS.LOG_LEVEL}.`);const gt={appVersion:Za,studioMode:tc.toString()==="true",warnOutdatedApp:ec==="true",routerBasename:Ro,analytics:{databaseName:wc,useWorker:yc!=="true",driveAnalyticsEnabled:bc==="true",diffProcessorEnabled:Ec==="true",externalProcessorsEnabled:Sc==="true"},sentry:{dsn:hc,env:gc,tracing:_c==="true"},content:{showSearchBar:fc!=="false",showDocumentModelSelectionSetting:pc!=="true"},drives:{addDriveEnabled:nc!=="true",sections:{[dt]:{enabled:uc!=="false",allowAdd:sc!=="true",allowDelete:cc!=="true"},[Hi]:{enabled:dc!=="false",allowAdd:oc!=="true",allowDelete:ac!=="true"},[zi]:{enabled:lc!=="false",allowAdd:rc!=="true",allowDelete:ic!=="true"}}},gaTrackingId:mc,phCliVersion:vc},ot={},Mr=(t,e)=>t.unstable_is?t.unstable_is(e):e===t,$r=t=>"init"in t,gn=t=>!!t.write,Ur=t=>"v"in t||"e"in t,Ct=t=>{if("e"in t)throw t.e;if((ot?"production":void 0)!=="production"&&!("v"in t))throw new Error("[Bug] atom state is not initialized");return t.v},Bt=new WeakMap,kr=t=>{var e;return Ft(t)&&!!((e=Bt.get(t))!=null&&e[0])},Ic=t=>{const e=Bt.get(t);e!=null&&e[0]&&(e[0]=!1,e[1].forEach(n=>n()))},Po=(t,e)=>{let n=Bt.get(t);if(!n){n=[!0,new Set],Bt.set(t,n);const r=()=>{n[0]=!1};t.then(r,r)}n[1].add(e)},Ft=t=>typeof(t==null?void 0:t.then)=="function",xo=(t,e,n)=>{n.p.has(t)||(n.p.add(t),e.then(()=>{n.p.delete(t)},()=>{n.p.delete(t)}))},_n=(t,e,n)=>{const r=n(t),o="v"in r,s=r.v;if(Ft(e))for(const i of r.d.keys())xo(t,e,n(i));r.v=e,delete r.e,(!o||!Object.is(s,r.v))&&(++r.n,Ft(s)&&Ic(s))},Br=(t,e,n)=>{var r;const o=new Set;for(const s of((r=n.get(t))==null?void 0:r.t)||[])n.has(s)&&o.add(s);for(const s of e.p)o.add(s);return o},Ac=()=>{const t=new Set,e=()=>{t.forEach(n=>n())};return e.add=n=>(t.add(n),()=>{t.delete(n)}),e},mn=()=>{const t={},e=new WeakMap,n=r=>{var o,s;(o=e.get(t))==null||o.forEach(i=>i(r)),(s=e.get(r))==null||s.forEach(i=>i())};return n.add=(r,o)=>{const s=r||t,i=(e.has(s)?e:e.set(s,new Set)).get(s);return i.add(o),()=>{i==null||i.delete(o),i.size||e.delete(s)}},n},Nc=t=>(t.c||(t.c=mn()),t.m||(t.m=mn()),t.u||(t.u=mn()),t.f||(t.f=Ac()),t),Tc=Symbol(),Oc=(t=new WeakMap,e=new WeakMap,n=new WeakMap,r=new Set,o=new Set,s=new Set,i={},c=(_,...y)=>_.read(...y),d=(_,...y)=>_.write(...y),l=(_,y)=>{var N;return(N=_.unstable_onInit)==null?void 0:N.call(_,y)},m=(_,y)=>{var N;return(N=_.onMount)==null?void 0:N.call(_,y)},...f)=>{const _=f[0]||(w=>{if((ot?"production":void 0)!=="production"&&!w)throw new Error("Atom is undefined or null");let A=t.get(w);return A||(A={d:new Map,p:new Set,n:0},t.set(w,A),l==null||l(w,B)),A}),y=f[1]||(()=>{const w=[],A=S=>{try{S()}catch(D){w.push(D)}};do{i.f&&A(i.f);const S=new Set,D=S.add.bind(S);r.forEach(b=>{var I;return(I=e.get(b))==null?void 0:I.l.forEach(D)}),r.clear(),s.forEach(D),s.clear(),o.forEach(D),o.clear(),S.forEach(A),r.size&&N()}while(r.size||s.size||o.size);if(w.length)throw new AggregateError(w)}),N=f[2]||(()=>{const w=[],A=new WeakSet,S=new WeakSet,D=Array.from(r);for(;D.length;){const b=D[D.length-1],I=_(b);if(S.has(b)){D.pop();continue}if(A.has(b)){if(n.get(b)===I.n)w.push([b,I]);else if((ot?"production":void 0)!=="production"&&n.has(b))throw new Error("[Bug] invalidated atom exists");S.add(b),D.pop();continue}A.add(b);for(const Y of Br(b,I,e))A.has(Y)||D.push(Y)}for(let b=w.length-1;b>=0;--b){const[I,Y]=w[b];let K=!1;for(const se of Y.d.keys())if(se!==I&&r.has(se)){K=!0;break}K&&(F(I),H(I)),n.delete(I)}}),F=f[3]||(w=>{var A;const S=_(w);if(Ur(S)&&(e.has(w)&&n.get(w)!==S.n||Array.from(S.d).every(([j,M])=>F(j).n===M)))return S;S.d.clear();let D=!0;const b=()=>{e.has(w)&&(H(w),N(),y())},I=j=>{var M;if(Mr(w,j)){const $=_(j);if(!Ur($))if($r(j))_n(j,j.init,_);else throw new Error("no atom init");return Ct($)}const x=F(j);try{return Ct(x)}finally{S.d.set(j,x.n),kr(S.v)&&xo(w,S.v,x),(M=e.get(j))==null||M.t.add(w),D||b()}};let Y,K;const se={get signal(){return Y||(Y=new AbortController),Y.signal},get setSelf(){return(ot?"production":void 0)!=="production"&&!gn(w)&&console.warn("setSelf function cannot be used with read-only atom"),!K&&gn(w)&&(K=(...j)=>{if((ot?"production":void 0)!=="production"&&D&&console.warn("setSelf function cannot be called in sync"),!D)try{return V(w,...j)}finally{N(),y()}}),K}},he=S.n;try{const j=c(w,I,se);return _n(w,j,_),Ft(j)&&(Po(j,()=>Y==null?void 0:Y.abort()),j.then(b,b)),S}catch(j){return delete S.v,S.e=j,++S.n,S}finally{D=!1,he!==S.n&&n.get(w)===he&&(n.set(w,S.n),r.add(w),(A=i.c)==null||A.call(i,w))}}),P=f[4]||(w=>{const A=[w];for(;A.length;){const S=A.pop(),D=_(S);for(const b of Br(S,D,e)){const I=_(b);n.set(b,I.n),A.push(b)}}}),V=f[5]||((w,...A)=>{let S=!0;const D=I=>Ct(F(I)),b=(I,...Y)=>{var K;const se=_(I);try{if(Mr(w,I)){if(!$r(I))throw new Error("atom not writable");const he=se.n,j=Y[0];_n(I,j,_),H(I),he!==se.n&&(r.add(I),(K=i.c)==null||K.call(i,I),P(I));return}else return V(I,...Y)}finally{S||(N(),y())}};try{return d(w,D,b,...A)}finally{S=!1}}),H=f[6]||(w=>{var A;const S=_(w),D=e.get(w);if(D&&!kr(S.v)){for(const[b,I]of S.d)if(!D.d.has(b)){const Y=_(b);k(b).t.add(w),D.d.add(b),I!==Y.n&&(r.add(b),(A=i.c)==null||A.call(i,b),P(b))}for(const b of D.d||[])if(!S.d.has(b)){D.d.delete(b);const I=W(b);I==null||I.t.delete(w)}}}),k=f[7]||(w=>{var A;const S=_(w);let D=e.get(w);if(!D){F(w);for(const b of S.d.keys())k(b).t.add(w);if(D={l:new Set,d:new Set(S.d.keys()),t:new Set},e.set(w,D),(A=i.m)==null||A.call(i,w),gn(w)){const b=()=>{let I=!0;const Y=(...K)=>{try{return V(w,...K)}finally{I||(N(),y())}};try{const K=m(w,Y);K&&(D.u=()=>{I=!0;try{K()}finally{I=!1}})}finally{I=!1}};o.add(b)}}return D}),W=f[8]||(w=>{var A;const S=_(w);let D=e.get(w);if(D&&!D.l.size&&!Array.from(D.t).some(b=>{var I;return(I=e.get(b))==null?void 0:I.d.has(w)})){D.u&&s.add(D.u),D=void 0,e.delete(w),(A=i.u)==null||A.call(i,w);for(const b of S.d.keys()){const I=W(b);I==null||I.t.delete(w)}return}return D}),O=[t,e,n,r,o,s,i,c,d,l,m,_,y,N,F,P,V,H,k,W],B={get:w=>Ct(F(w)),set:(w,...A)=>{try{return V(w,...A)}finally{N(),y()}},sub:(w,A)=>{const D=k(w).l;return D.add(A),y(),()=>{D.delete(A),W(w),y()}}};return Object.defineProperty(B,Tc,{value:O}),B},Mo=Oc,Cc=Nc,Fr=Po,Kn={};let Lc=0;function de(t,e){const n=`atom${++Lc}`,r={toString(){return(Kn?"production":void 0)!=="production"&&this.debugLabel?n+":"+this.debugLabel:n}};return typeof t=="function"?r.read=t:(r.init=t,r.read=Rc,r.write=Pc),e&&(r.write=e),r}function Rc(t){return t(this)}function Pc(t,e,n){return e(this,typeof n=="function"?n(t(this)):n)}const xc=()=>{let t=0;const e=Cc({}),n=new WeakMap,r=new WeakMap,o=Mo(n,r,void 0,void 0,void 0,void 0,e,void 0,(c,d,l,...m)=>t?l(c,...m):c.write(d,l,...m)),s=new Set;return e.m.add(void 0,c=>{s.add(c);const d=n.get(c);d.m=r.get(c)}),e.u.add(void 0,c=>{s.delete(c);const d=n.get(c);delete d.m}),Object.assign(o,{dev4_get_internal_weak_map:()=>(console.log("Deprecated: Use devstore from the devtools library"),n),dev4_get_mounted_atoms:()=>s,dev4_restore_atoms:c=>{const d={read:()=>null,write:(l,m)=>{++t;try{for(const[f,_]of c)"init"in f&&m(f,_)}finally{--t}}};o.set(d)}})};function $o(){return(Kn?"production":void 0)!=="production"?xc():Mo()}let tt;function Mc(){return tt||(tt=$o(),(Kn?"production":void 0)!=="production"&&(globalThis.__JOTAI_DEFAULT_STORE__||(globalThis.__JOTAI_DEFAULT_STORE__=tt),globalThis.__JOTAI_DEFAULT_STORE__!==tt&&console.warn("Detected multiple Jotai instances. It may cause unexpected behavior with the default store. https://github.com/pmndrs/jotai/discussions/2044"))),tt}const $c={},Uo=Yn(void 0);function ko(t){return Wn(Uo)||Mc()}function Uc({children:t,store:e}){const n=Me(void 0);return!e&&!n.current&&(n.current=$o()),La(Uo.Provider,{value:e||n.current},t)}const Pn=t=>typeof(t==null?void 0:t.then)=="function",xn=t=>{t.status||(t.status="pending",t.then(e=>{t.status="fulfilled",t.value=e},e=>{t.status="rejected",t.reason=e}))},kc=Gt.use||(t=>{if(t.status==="pending")throw t;if(t.status==="fulfilled")return t.value;throw t.status==="rejected"?t.reason:(xn(t),t)}),vn=new WeakMap,Vr=(t,e)=>{let n=vn.get(t);return n||(n=new Promise((r,o)=>{let s=t;const i=l=>m=>{s===l&&r(m)},c=l=>m=>{s===l&&o(m)},d=()=>{try{const l=e();Pn(l)?(vn.set(l,n),s=l,l.then(i(l),c(l)),Fr(l,d)):r(l)}catch(l){o(l)}};t.then(i(t),c(t)),Fr(t,d)}),vn.set(t,n)),n};function Oe(t,e){const{delay:n,unstable_promiseStatus:r=!Gt.use}={},o=ko(),[[s,i,c],d]=Co(m=>{const f=o.get(t);return Object.is(m[0],f)&&m[1]===o&&m[2]===t?m:[f,o,t]},void 0,()=>[o.get(t),o,t]);let l=s;if((i!==o||c!==t)&&(d(),l=o.get(t)),ce(()=>{const m=o.sub(t,()=>{if(r)try{const f=o.get(t);Pn(f)&&xn(Vr(f,()=>o.get(t)))}catch{}if(typeof n=="number"){setTimeout(d,n);return}d()});return d(),m},[o,t,n,r]),Lo(l),Pn(l)){const m=Vr(l,()=>o.get(t));return r&&xn(m),kc(m)}return l}function Bc(t,e){const n=ko();return J((...o)=>{if(($c?"production":void 0)!=="production"&&!("write"in t))throw new Error("not writable atom");return n.set(t,...o)},[n,t])}function $e(t,e){return[Oe(t),Bc(t)]}const Fc=de(gt);function Vc(){return $e(Fc)}const st={},jr=(t,e)=>t.unstable_is?t.unstable_is(e):e===t,zr=t=>"init"in t,wn=t=>!!t.write,Hr=t=>"v"in t||"e"in t,Lt=t=>{if("e"in t)throw t.e;if((st?"production":void 0)!=="production"&&!("v"in t))throw new Error("[Bug] atom state is not initialized");return t.v},Vt=new WeakMap,Yr=t=>{var e;return jt(t)&&!!((e=Vt.get(t))!=null&&e[0])},jc=t=>{const e=Vt.get(t);e!=null&&e[0]&&(e[0]=!1,e[1].forEach(n=>n()))},Bo=(t,e)=>{let n=Vt.get(t);if(!n){n=[!0,new Set],Vt.set(t,n);const r=()=>{n[0]=!1};t.then(r,r)}n[1].add(e)},jt=t=>typeof(t==null?void 0:t.then)=="function",Fo=(t,e,n)=>{n.p.has(t)||(n.p.add(t),e.then(()=>{n.p.delete(t)},()=>{n.p.delete(t)}))},yn=(t,e,n)=>{const r=n(t),o="v"in r,s=r.v;if(jt(e))for(const i of r.d.keys())Fo(t,e,n(i));r.v=e,delete r.e,(!o||!Object.is(s,r.v))&&(++r.n,jt(s)&&jc(s))},Wr=(t,e,n)=>{var r;const o=new Set;for(const s of((r=n.get(t))==null?void 0:r.t)||[])n.has(s)&&o.add(s);for(const s of e.p)o.add(s);return o},zc=()=>{const t=new Set,e=()=>{t.forEach(n=>n())};return e.add=n=>(t.add(n),()=>{t.delete(n)}),e},En=()=>{const t={},e=new WeakMap,n=r=>{var o,s;(o=e.get(t))==null||o.forEach(i=>i(r)),(s=e.get(r))==null||s.forEach(i=>i())};return n.add=(r,o)=>{const s=r||t,i=(e.has(s)?e:e.set(s,new Set)).get(s);return i.add(o),()=>{i==null||i.delete(o),i.size||e.delete(s)}},n},Hc=t=>(t.c||(t.c=En()),t.m||(t.m=En()),t.u||(t.u=En()),t.f||(t.f=zc()),t),Yc=Symbol(),Wc=(t=new WeakMap,e=new WeakMap,n=new WeakMap,r=new Set,o=new Set,s=new Set,i={},c=(_,...y)=>_.read(...y),d=(_,...y)=>_.write(...y),l=(_,y)=>{var N;return(N=_.unstable_onInit)==null?void 0:N.call(_,y)},m=(_,y)=>{var N;return(N=_.onMount)==null?void 0:N.call(_,y)},...f)=>{const _=f[0]||(w=>{if((st?"production":void 0)!=="production"&&!w)throw new Error("Atom is undefined or null");let A=t.get(w);return A||(A={d:new Map,p:new Set,n:0},t.set(w,A),l==null||l(w,B)),A}),y=f[1]||(()=>{const w=[],A=S=>{try{S()}catch(D){w.push(D)}};do{i.f&&A(i.f);const S=new Set,D=S.add.bind(S);r.forEach(b=>{var I;return(I=e.get(b))==null?void 0:I.l.forEach(D)}),r.clear(),s.forEach(D),s.clear(),o.forEach(D),o.clear(),S.forEach(A),r.size&&N()}while(r.size||s.size||o.size);if(w.length)throw new AggregateError(w)}),N=f[2]||(()=>{const w=[],A=new WeakSet,S=new WeakSet,D=Array.from(r);for(;D.length;){const b=D[D.length-1],I=_(b);if(S.has(b)){D.pop();continue}if(A.has(b)){if(n.get(b)===I.n)w.push([b,I]);else if((st?"production":void 0)!=="production"&&n.has(b))throw new Error("[Bug] invalidated atom exists");S.add(b),D.pop();continue}A.add(b);for(const Y of Wr(b,I,e))A.has(Y)||D.push(Y)}for(let b=w.length-1;b>=0;--b){const[I,Y]=w[b];let K=!1;for(const se of Y.d.keys())if(se!==I&&r.has(se)){K=!0;break}K&&(F(I),H(I)),n.delete(I)}}),F=f[3]||(w=>{var A;const S=_(w);if(Hr(S)&&(e.has(w)&&n.get(w)!==S.n||Array.from(S.d).every(([j,M])=>F(j).n===M)))return S;S.d.clear();let D=!0;const b=()=>{e.has(w)&&(H(w),N(),y())},I=j=>{var M;if(jr(w,j)){const $=_(j);if(!Hr($))if(zr(j))yn(j,j.init,_);else throw new Error("no atom init");return Lt($)}const x=F(j);try{return Lt(x)}finally{S.d.set(j,x.n),Yr(S.v)&&Fo(w,S.v,x),(M=e.get(j))==null||M.t.add(w),D||b()}};let Y,K;const se={get signal(){return Y||(Y=new AbortController),Y.signal},get setSelf(){return(st?"production":void 0)!=="production"&&!wn(w)&&console.warn("setSelf function cannot be used with read-only atom"),!K&&wn(w)&&(K=(...j)=>{if((st?"production":void 0)!=="production"&&D&&console.warn("setSelf function cannot be called in sync"),!D)try{return V(w,...j)}finally{N(),y()}}),K}},he=S.n;try{const j=c(w,I,se);return yn(w,j,_),jt(j)&&(Bo(j,()=>Y==null?void 0:Y.abort()),j.then(b,b)),S}catch(j){return delete S.v,S.e=j,++S.n,S}finally{D=!1,he!==S.n&&n.get(w)===he&&(n.set(w,S.n),r.add(w),(A=i.c)==null||A.call(i,w))}}),P=f[4]||(w=>{const A=[w];for(;A.length;){const S=A.pop(),D=_(S);for(const b of Wr(S,D,e)){const I=_(b);n.set(b,I.n),A.push(b)}}}),V=f[5]||((w,...A)=>{let S=!0;const D=I=>Lt(F(I)),b=(I,...Y)=>{var K;const se=_(I);try{if(jr(w,I)){if(!zr(I))throw new Error("atom not writable");const he=se.n,j=Y[0];yn(I,j,_),H(I),he!==se.n&&(r.add(I),(K=i.c)==null||K.call(i,I),P(I));return}else return V(I,...Y)}finally{S||(N(),y())}};try{return d(w,D,b,...A)}finally{S=!1}}),H=f[6]||(w=>{var A;const S=_(w),D=e.get(w);if(D&&!Yr(S.v)){for(const[b,I]of S.d)if(!D.d.has(b)){const Y=_(b);k(b).t.add(w),D.d.add(b),I!==Y.n&&(r.add(b),(A=i.c)==null||A.call(i,b),P(b))}for(const b of D.d||[])if(!S.d.has(b)){D.d.delete(b);const I=W(b);I==null||I.t.delete(w)}}}),k=f[7]||(w=>{var A;const S=_(w);let D=e.get(w);if(!D){F(w);for(const b of S.d.keys())k(b).t.add(w);if(D={l:new Set,d:new Set(S.d.keys()),t:new Set},e.set(w,D),(A=i.m)==null||A.call(i,w),wn(w)){const b=()=>{let I=!0;const Y=(...K)=>{try{return V(w,...K)}finally{I||(N(),y())}};try{const K=m(w,Y);K&&(D.u=()=>{I=!0;try{K()}finally{I=!1}})}finally{I=!1}};o.add(b)}}return D}),W=f[8]||(w=>{var A;const S=_(w);let D=e.get(w);if(D&&!D.l.size&&!Array.from(D.t).some(b=>{var I;return(I=e.get(b))==null?void 0:I.d.has(w)})){D.u&&s.add(D.u),D=void 0,e.delete(w),(A=i.u)==null||A.call(i,w);for(const b of S.d.keys()){const I=W(b);I==null||I.t.delete(w)}return}return D}),O=[t,e,n,r,o,s,i,c,d,l,m,_,y,N,F,P,V,H,k,W],B={get:w=>Lt(F(w)),set:(w,...A)=>{try{return V(w,...A)}finally{N(),y()}},sub:(w,A)=>{const D=k(w).l;return D.add(A),y(),()=>{D.delete(A),W(w),y()}}};return Object.defineProperty(B,Yc,{value:O}),B},Vo=Wc,Gc=Hc,Gr=Bo,Jn={};let Kc=0;function oe(t,e){const n=`atom${++Kc}`,r={toString(){return(Jn?"production":void 0)!=="production"&&this.debugLabel?n+":"+this.debugLabel:n}};return typeof t=="function"?r.read=t:(r.init=t,r.read=Jc,r.write=qc),e&&(r.write=e),r}function Jc(t){return t(this)}function qc(t,e,n){return e(this,typeof n=="function"?n(t(this)):n)}const Xc=()=>{let t=0;const e=Gc({}),n=new WeakMap,r=new WeakMap,o=Vo(n,r,void 0,void 0,void 0,void 0,e,void 0,(c,d,l,...m)=>t?l(c,...m):c.write(d,l,...m)),s=new Set;return e.m.add(void 0,c=>{s.add(c);const d=n.get(c);d.m=r.get(c)}),e.u.add(void 0,c=>{s.delete(c);const d=n.get(c);delete d.m}),Object.assign(o,{dev4_get_internal_weak_map:()=>(console.log("Deprecated: Use devstore from the devtools library"),n),dev4_get_mounted_atoms:()=>s,dev4_restore_atoms:c=>{const d={read:()=>null,write:(l,m)=>{++t;try{for(const[f,_]of c)"init"in f&&m(f,_)}finally{--t}}};o.set(d)}})};function Qc(){return(Jn?"production":void 0)!=="production"?Xc():Vo()}let nt;function Zc(){return nt||(nt=Qc(),(Jn?"production":void 0)!=="production"&&(globalThis.__JOTAI_DEFAULT_STORE__||(globalThis.__JOTAI_DEFAULT_STORE__=nt),globalThis.__JOTAI_DEFAULT_STORE__!==nt&&console.warn("Detected multiple Jotai instances. It may cause unexpected behavior with the default store. https://github.com/pmndrs/jotai/discussions/2044"))),nt}const eu={},tu=Yn(void 0);function jo(t){return Wn(tu)||Zc()}const Mn=t=>typeof(t==null?void 0:t.then)=="function",$n=t=>{t.status||(t.status="pending",t.then(e=>{t.status="fulfilled",t.value=e},e=>{t.status="rejected",t.reason=e}))},nu=Gt.use||(t=>{if(t.status==="pending")throw t;if(t.status==="fulfilled")return t.value;throw t.status==="rejected"?t.reason:($n(t),t)}),bn=new WeakMap,Kr=(t,e)=>{let n=bn.get(t);return n||(n=new Promise((r,o)=>{let s=t;const i=l=>m=>{s===l&&r(m)},c=l=>m=>{s===l&&o(m)},d=()=>{try{const l=e();Mn(l)?(bn.set(l,n),s=l,l.then(i(l),c(l)),Gr(l,d)):r(l)}catch(l){o(l)}};t.then(i(t),c(t)),Gr(t,d)}),bn.set(t,n)),n};function De(t,e){const{delay:n,unstable_promiseStatus:r=!Gt.use}={},o=jo(),[[s,i,c],d]=Co(m=>{const f=o.get(t);return Object.is(m[0],f)&&m[1]===o&&m[2]===t?m:[f,o,t]},void 0,()=>[o.get(t),o,t]);let l=s;if((i!==o||c!==t)&&(d(),l=o.get(t)),ce(()=>{const m=o.sub(t,()=>{if(r)try{const f=o.get(t);Mn(f)&&$n(Kr(f,()=>o.get(t)))}catch{}if(typeof n=="number"){setTimeout(d,n);return}d()});return d(),m},[o,t,n,r]),Lo(l),Mn(l)){const m=Kr(l,()=>o.get(t));return r&&$n(m),nu(m)}return l}function Ue(t,e){const n=jo();return J((...o)=>{if((eu?"production":void 0)!=="production"&&!("write"in t))throw new Error("not writable atom");return n.set(t,...o)},[n,t])}var Sn,Jr;function ru(){return Jr||(Jr=1,Sn=function t(e,n){if(e===n)return!0;if(e&&n&&typeof e=="object"&&typeof n=="object"){if(e.constructor!==n.constructor)return!1;var r,o,s;if(Array.isArray(e)){if(r=e.length,r!=n.length)return!1;for(o=r;o--!==0;)if(!t(e[o],n[o]))return!1;return!0}if(e.constructor===RegExp)return e.source===n.source&&e.flags===n.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===n.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===n.toString();if(s=Object.keys(e),r=s.length,r!==Object.keys(n).length)return!1;for(o=r;o--!==0;)if(!Object.prototype.hasOwnProperty.call(n,s[o]))return!1;for(o=r;o--!==0;){var i=s[o];if(!t(e[i],n[i]))return!1}return!0}return e!==e&&n!==n}),Sn}var ou=ru();const zo=Oo(ou),lt={},su=t=>typeof(t==null?void 0:t.then)=="function";function iu(t=()=>{try{return window.localStorage}catch(n){(lt?"production":void 0)!=="production"&&typeof window<"u"&&console.warn(n);return}},e){var n;let r,o;const s={getItem:(d,l)=>{var m,f;const _=N=>{if(N=N||"",r!==N){try{o=JSON.parse(N,void 0)}catch{return l}r=N}return o},y=(f=(m=t())==null?void 0:m.getItem(d))!=null?f:null;return su(y)?y.then(_):_(y)},setItem:(d,l)=>{var m;return(m=t())==null?void 0:m.setItem(d,JSON.stringify(l,void 0))},removeItem:d=>{var l;return(l=t())==null?void 0:l.removeItem(d)}},i=d=>(l,m,f)=>d(l,_=>{let y;try{y=JSON.parse(_||"")}catch{y=f}m(y)});let c;try{c=(n=t())==null?void 0:n.subscribe}catch{}return!c&&typeof window<"u"&&typeof window.addEventListener=="function"&&window.Storage&&(c=(d,l)=>{if(!(t()instanceof window.Storage))return()=>{};const m=f=>{f.storageArea===t()&&f.key===d&&l(f.newValue)};return window.addEventListener("storage",m),()=>{window.removeEventListener("storage",m)}}),c&&(s.subscribe=i(c)),s}iu();const Dn=new WeakMap,au=(t,e)=>(Dn.has(e)?Dn:Dn.set(e,t())).get(e),cu=t=>typeof(t==null?void 0:t.then)=="function",qr={state:"loading"};function Be(t){return au(()=>{const e=new WeakMap,n=oe(0);(lt?"production":void 0)!=="production"&&(n.debugPrivate=!0);const r=oe((o,{setSelf:s})=>{o(n);let i;try{i=o(t)}catch(m){return{state:"hasError",error:m}}if(!cu(i))return{state:"hasData",data:i};const c=i,d=e.get(c);if(d)return d;c.then(m=>{e.set(c,{state:"hasData",data:m}),s()},m=>{e.set(c,{state:"hasError",error:m}),s()});const l=e.get(c);return l||(e.set(c,qr),qr)},(o,s)=>{s(n,i=>i+1)});return(lt?"production":void 0)!=="production"&&(r.debugPrivate=!0),oe(o=>o(r))},t)}const Xr=(t,e,n)=>(e.has(n)?e:e.set(n,t())).get(n),uu=new WeakMap,du=(t,e,n)=>{const r=Xr(()=>new WeakMap,uu,e);return Xr(t,r,n)},lu=t=>typeof(t==null?void 0:t.then)=="function",fu=()=>{};function Fe(t,e=fu){return du(()=>{const n=new WeakMap,r=new WeakMap,o=oe(0);(lt?"production":void 0)!=="production"&&(o.debugPrivate=!0);const s=oe((i,{setSelf:c})=>{i(o);const d=i(s),l=i(t);if(!lu(l))return{v:l};if(l!==(d==null?void 0:d.p)&&l.then(m=>{r.set(l,m),c()},m=>{n.set(l,m),c()}),n.has(l))throw n.get(l);return r.has(l)?{p:l,v:r.get(l)}:d&&"v"in d?{p:l,f:e(d.v),v:d.v}:{p:l,f:e()}},(i,c)=>{c(o,d=>d+1)});return s.init=void 0,(lt?"production":void 0)!=="production"&&(s.debugPrivate=!0),oe(i=>{const c=i(s);return"f"in c?c.f:c.v},(i,c,...d)=>c(t,...d))},t,e)}function Un(t){if(!t)return"PUBLIC";const e="readContext"in t,{sharingType:n}=e?{sharingType:"PUBLIC"}:t.state.local,r=n==null?void 0:n.toUpperCase();return r==="PRIVATE"?"LOCAL":r}function pu(t){if(!t)return!1;const e="readContext"in t,{availableOffline:n}=e?{availableOffline:!1}:t.state.local;return n??!1}function np(t){if(t)return{id:t.header.id,name:t.state.global.name,kind:"FOLDER",parentFolder:null}}async function hu(t,e){if(!t||!e)return[];const n=await t.getDocuments(e);return await Promise.all(n.map(o=>t.getDocument(o)))}async function gu(t){if(!t)return[];const e=await t.getDrives();return await Promise.all(e.map(r=>t.getDrive(r)))}function rp(t){return t.toSorted((e,n)=>e.name.localeCompare(n.name))}function op(t){return t?t.kind.toUpperCase()==="FILE":!1}function _u(t){return t?t.kind.toUpperCase()==="FOLDER":!1}const ge="NOT_SET";function _t(){return new Promise(()=>{})}const zt=oe(ge);zt.debugLabel="baseProcessorManagerAtom";const Ho=oe(t=>t(zt)!==ge);Ho.debugLabel="processorManagerInitializedAtom";const Kt=oe(t=>{const e=t(zt);return e===ge?_t():e},(t,e,n)=>{e(zt,n)});Kt.debugLabel="processorManagerAtom";const mu=Be(Kt);mu.debugLabel="loadableProcessorManagerAtom";const vu=Fe(Kt);vu.debugLabel="unwrappedProcessorManagerAtom";const at=oe(ge);at.debugLabel="baseDrivesAtom";const Yo=oe(t=>t(at)!==ge);Yo.debugLabel="drivesInitializedAtom";const mt=oe(async t=>{const e=t(at);return e===ge?_t():e},async(t,e)=>{const n=t(at),r=window.reactor,o=await gu(r);zo(o,n)||e(at,o)});mt.debugLabel="drivesAtom";const wu=Be(mt);wu.debugLabel="loadableDrivesAtom";const Wo=Fe(mt);Wo.debugLabel="unwrappedDrivesAtom";const Ht=oe(ge);Ht.debugLabel="selectedDriveIdAtom";const qn=oe(t=>t(Ht)!==ge);qn.debugLabel="driveIdInitializedAtom";const Ye=oe(async t=>{const e=t(Ht),n=await t(mt);return e===ge?_t():n==null?void 0:n.find(o=>o.header.id===e)},(t,e,n)=>{e(Ht,n),e(ft,void 0)});Ye.debugLabel="selectedDriveAtom";const Go=Be(Ye);Go.debugLabel="loadableSelectedDriveAtom";const Ko=Fe(Ye);Ko.debugLabel="unwrappedSelectedDriveAtom";const vt=oe(async t=>{const e=await t(Ye);return e==null?void 0:e.state.global.nodes});vt.debugLabel="nodesAtom";const yu=Be(vt);yu.debugLabel="loadableNodesAtom";const Eu=Fe(vt);Eu.debugLabel="unwrappedNodesAtom";const ft=oe(ge);ft.debugLabel="selectedNodeIdAtom";const Jo=oe(t=>t(ft)!==ge);Jo.debugLabel="selectedNodeIdInitializedAtom";const wt=oe(async t=>{const e=t(ft),n=await t(vt);return e===ge?_t():n==null?void 0:n.find(r=>r.id===e)},(t,e,n)=>{e(ft,n)});wt.debugLabel="selectedNodeAtom";const Xn=oe(async t=>{const e=await t(vt),n=await t(wt),r=e==null?void 0:e.filter(_u);return r==null?void 0:r.find(o=>o.id===(n==null?void 0:n.id))});Xn.debugLabel="selectedFolderAtom";const bu=Be(Xn);bu.debugLabel="loadableSelectedFolderAtom";const Su=Fe(Xn);Su.debugLabel="unwrappedSelectedFolderAtom";const ct=oe(ge);ct.debugLabel="baseDocumentsAtom";const qo=oe(t=>t(ct)!==ge);qo.debugLabel="documentsInitializedAtom";const yt=oe(t=>{const e=t(ct);return e===ge?_t():e},async(t,e,n)=>{const r=t(ct),o=window.reactor,s=await hu(o,n);zo(s,r)||e(ct,s)});yt.debugLabel="documentsAtom";const Du=Be(yt);Du.debugLabel="loadableDocumentsAtom";const Iu=Fe(yt);Iu.debugLabel="unwrappedDocumentsAtom";const Qn=oe(async t=>{const e=await t(yt),n=await t(wt);return e==null?void 0:e.find(r=>r.header.id===(n==null?void 0:n.id))});Qn.debugLabel="selectedDocumentAtom";const Au=Be(Qn);Au.debugLabel="loadableSelectedDocumentAtom";const Nu=Fe(Qn);Nu.debugLabel="unwrappedSelectedDocumentAtom";let Mt;typeof window<"u"?window.btoa?Mt=function(t){return btoa(unescape(encodeURIComponent(t)))}:Mt=function(t){const e=unescape(encodeURIComponent(t+""));let n="";for(let r,o,s=0,i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";e.charAt(s|0)||(i="=",s%1);n+=i.charAt(63&r>>8-s%1*8)){if(o=e.charCodeAt(s+=3/4),o>255)throw new Error("'btoa' failed: The string to be encoded contains characters outside of the Latin1 range.");r=r<<8|o}return n}:Mt=function(t){return Buffer.from(t).toString("base64")};function Z(t,e){let n=Qr(t,e);return(e&&e.fallback!==void 0?e.fallback:Z.defaults.fallback)===!0&&n===""&&(n=Qr(Mt(t),e)),n}const Xo={bg:{Й:"Y",й:"y",X:"H",x:"h",Ц:"Ts",ц:"ts",Щ:"Sht",щ:"sht",Ъ:"A",ъ:"a",Ь:"Y",ь:"y"},de:{Ä:"AE",ä:"ae",Ö:"OE",ö:"oe",Ü:"UE",ü:"ue"},sr:{đ:"dj",Đ:"DJ"},uk:{И:"Y",и:"y",Й:"Y",й:"y",Ц:"Ts",ц:"ts",Х:"Kh",х:"kh",Щ:"Shch",щ:"shch",Г:"H",г:"h"}};let Zn={};function Qr(t,e){if(typeof t!="string")throw new Error("slug() requires a string argument, received "+typeof t);if(!t.isWellFormed())throw new Error("slug() received a malformed string with lone surrogates");typeof e=="string"&&(e={replacement:e}),e=e?Object.assign({},e):{},e.mode=e.mode||Z.defaults.mode;const n=Z.defaults.modes[e.mode],r=["replacement","multicharmap","charmap","remove","lower","trim"];for(let d,l=0,m=r.length;l<m;l++)d=r[l],e[d]=d in e?e[d]:n[d];const o=Xo[e.locale]||Zn;let s=[];for(const d in e.multicharmap){if(!Object.prototype.hasOwnProperty.call(e.multicharmap,d))continue;const l=d.length;s.indexOf(l)===-1&&s.push(l)}s=s.sort(function(d,l){return l-d});const i=e.mode==="rfc3986"?/[^\w\s\-.~]/:/[^A-Za-z0-9\s]/;let c="";for(let d,l=0,m=t.length;l<m;l++){d=t[l];let f=!1;for(let _=0;_<s.length;_++){const y=s[_],N=t.substr(l,y);if(e.multicharmap[N]){l+=y-1,d=e.multicharmap[N],f=!0;break}}f||(o[d]?d=o[d]:e.charmap[d]?d=e.charmap[d].replace(e.replacement," "):d.includes(e.replacement)?d=d.replace(e.replacement," "):d=d.replace(i,"")),c+=d}return e.remove&&(c=c.replace(e.remove,"")),e.trim&&(c=c.trim()),c=c.replace(/\s+/g,e.replacement),e.lower&&(c=c.toLowerCase()),c}const Qo={फ़:"Fi",ग़:"Ghi",ख़:"Khi",क़:"Qi",ड़:"ugDha",ढ़:"ugDhha",य़:"Yi",ज़:"Za",בִי:"i",בֵ:"e",בֵי:"e",בֶ:"e",בַ:"a",בָ:"a",בֹ:"o",וֹ:"o",בֻ:"u",וּ:"u",בּ:"b",כּ:"k",ךּ:"k",פּ:"p",שׁ:"sh",שׂ:"s",בְ:"e",חֱ:"e",חֲ:"a",חֳ:"o",בִ:"i"},Zo={À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",Æ:"AE",Ç:"C",È:"E",É:"E",Ê:"E",Ë:"E",Ì:"I",Í:"I",Î:"I",Ï:"I",Ð:"D",Ñ:"N",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ő:"O",Ø:"O",Ō:"O",Ù:"U",Ú:"U",Û:"U",Ü:"U",Ű:"U",Ý:"Y",Þ:"TH",ß:"ss",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",æ:"ae",ç:"c",è:"e",é:"e",ê:"e",ë:"e",ì:"i",í:"i",î:"i",ï:"i",ð:"d",ñ:"n",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ő:"o",ø:"o",ō:"o",Œ:"OE",œ:"oe",ù:"u",ú:"u",û:"u",ü:"u",ű:"u",ý:"y",þ:"th",ÿ:"y","ẞ":"SS",α:"a",β:"b",γ:"g",δ:"d",ε:"e",ζ:"z",η:"h",θ:"th",ι:"i",κ:"k",λ:"l",μ:"m",ν:"n",ξ:"3",ο:"o",π:"p",ρ:"r",σ:"s",τ:"t",υ:"y",φ:"f",χ:"x",ψ:"ps",ω:"w",ά:"a",έ:"e",ί:"i",ό:"o",ύ:"y",ή:"h",ώ:"w",ς:"s",ϊ:"i",ΰ:"y",ϋ:"y",ΐ:"i",Α:"A",Β:"B",Γ:"G",Δ:"D",Ε:"E",Ζ:"Z",Η:"H",Θ:"Th",Ι:"I",Κ:"K",Λ:"L",Μ:"M",Ν:"N",Ξ:"3",Ο:"O",Π:"P",Ρ:"R",Σ:"S",Τ:"T",Υ:"Y",Φ:"F",Χ:"X",Ψ:"PS",Ω:"W",Ά:"A",Έ:"E",Ί:"I",Ό:"O",Ύ:"Y",Ή:"H",Ώ:"W",Ϊ:"I",Ϋ:"Y",ş:"s",Ş:"S",ı:"i",İ:"I",ğ:"g",Ğ:"G",а:"a",б:"b",в:"v",г:"g",д:"d",е:"e",ё:"yo",ж:"zh",з:"z",и:"i",й:"j",к:"k",л:"l",м:"m",н:"n",о:"o",п:"p",р:"r",с:"s",т:"t",у:"u",ф:"f",х:"h",ц:"c",ч:"ch",ш:"sh",щ:"sh",ъ:"u",ы:"y",ь:"",э:"e",ю:"yu",я:"ya",А:"A",Б:"B",В:"V",Г:"G",Д:"D",Е:"E",Ё:"Yo",Ж:"Zh",З:"Z",И:"I",Й:"J",К:"K",Л:"L",М:"M",Н:"N",О:"O",П:"P",Р:"R",С:"S",Т:"T",У:"U",Ф:"F",Х:"H",Ц:"C",Ч:"Ch",Ш:"Sh",Щ:"Sh",Ъ:"U",Ы:"Y",Ь:"",Э:"E",Ю:"Yu",Я:"Ya",Є:"Ye",І:"I",Ї:"Yi",Ґ:"G",є:"ye",і:"i",ї:"yi",ґ:"g",č:"c",ď:"d",ě:"e",ň:"n",ř:"r",š:"s",ť:"t",ů:"u",ž:"z",Č:"C",Ď:"D",Ě:"E",Ň:"N",Ř:"R",Š:"S",Ť:"T",Ů:"U",Ž:"Z",ľ:"l",ĺ:"l",ŕ:"r",Ľ:"L",Ĺ:"L",Ŕ:"R",ą:"a",ć:"c",ę:"e",ł:"l",ń:"n",ś:"s",ź:"z",ż:"z",Ą:"A",Ć:"C",Ę:"E",Ł:"L",Ń:"N",Ś:"S",Ź:"Z",Ż:"Z",ā:"a",ē:"e",ģ:"g",ī:"i",ķ:"k",ļ:"l",ņ:"n",ū:"u",Ā:"A",Ē:"E",Ģ:"G",Ī:"I",Ķ:"K",Ļ:"L",Ņ:"N",Ū:"U",أ:"a",إ:"i",ب:"b",ت:"t",ث:"th",ج:"g",ح:"h",خ:"kh",د:"d",ذ:"th",ر:"r",ز:"z",س:"s",ش:"sh",ص:"s",ض:"d",ط:"t",ظ:"th",ع:"aa",غ:"gh",ف:"f",ق:"k",ك:"k",ل:"l",م:"m",ن:"n",ه:"h",و:"o",ي:"y",ء:"aa",ة:"a",آ:"a",ا:"a",پ:"p",ژ:"zh",گ:"g",چ:"ch",ک:"k",ی:"i",ė:"e",į:"i",ų:"u",Ė:"E",Į:"I",Ų:"U",ț:"t",Ț:"T",ţ:"t",Ţ:"T",ș:"s",Ș:"S",ă:"a",Ă:"A",Ạ:"A",Ả:"A",Ầ:"A",Ấ:"A",Ậ:"A",Ẩ:"A",Ẫ:"A",Ằ:"A",Ắ:"A",Ặ:"A",Ẳ:"A",Ẵ:"A",Ẹ:"E",Ẻ:"E",Ẽ:"E",Ề:"E",Ế:"E",Ệ:"E",Ể:"E",Ễ:"E",Ị:"I",Ỉ:"I",Ĩ:"I",Ọ:"O",Ỏ:"O",Ồ:"O",Ố:"O",Ộ:"O",Ổ:"O",Ỗ:"O",Ơ:"O",Ờ:"O",Ớ:"O",Ợ:"O",Ở:"O",Ỡ:"O",Ụ:"U",Ủ:"U",Ũ:"U",Ư:"U",Ừ:"U",Ứ:"U",Ự:"U",Ử:"U",Ữ:"U",Ỳ:"Y",Ỵ:"Y",Ỷ:"Y",Ỹ:"Y",Đ:"D",ạ:"a",ả:"a",ầ:"a",ấ:"a",ậ:"a",ẩ:"a",ẫ:"a",ằ:"a",ắ:"a",ặ:"a",ẳ:"a",ẵ:"a",ẹ:"e",ẻ:"e",ẽ:"e",ề:"e",ế:"e",ệ:"e",ể:"e",ễ:"e",ị:"i",ỉ:"i",ĩ:"i",ọ:"o",ỏ:"o",ồ:"o",ố:"o",ộ:"o",ổ:"o",ỗ:"o",ơ:"o",ờ:"o",ớ:"o",ợ:"o",ở:"o",ỡ:"o",ụ:"u",ủ:"u",ũ:"u",ư:"u",ừ:"u",ứ:"u",ự:"u",ử:"u",ữ:"u",ỳ:"y",ỵ:"y",ỷ:"y",ỹ:"y",đ:"d",Ә:"AE",ә:"ae",Ғ:"GH",ғ:"gh",Қ:"KH",қ:"kh",Ң:"NG",ң:"ng",Ү:"UE",ү:"ue",Ұ:"U",ұ:"u",Һ:"H",һ:"h",Ө:"OE",ө:"oe",ђ:"dj",ј:"j",љ:"lj",њ:"nj",ћ:"c",џ:"dz",Ђ:"Dj",Ј:"j",Љ:"Lj",Њ:"Nj",Ћ:"C",Џ:"Dz",nj:"nj",lj:"lj",Nj:"NJ",Lj:"LJ",अ:"a",आ:"aa",ए:"e",ई:"ii",ऍ:"ei",ऎ:"ae",ऐ:"ai",इ:"i",ओ:"o",ऑ:"oi",ऒ:"oii",ऊ:"uu",औ:"ou",उ:"u",ब:"B",भ:"Bha",च:"Ca",छ:"Chha",ड:"Da",ढ:"Dha",फ:"Fa",ग:"Ga",घ:"Gha",ग़:"Ghi",ह:"Ha",ज:"Ja",झ:"Jha",क:"Ka",ख:"Kha",ख़:"Khi",ल:"L",ळ:"Li",ऌ:"Li",ऴ:"Lii",ॡ:"Lii",म:"Ma",न:"Na",ङ:"Na",ञ:"Nia",ण:"Nae",ऩ:"Ni",ॐ:"oms",प:"Pa",क़:"Qi",र:"Ra",ऋ:"Ri",ॠ:"Ri",ऱ:"Ri",स:"Sa",श:"Sha",ष:"Shha",ट:"Ta",त:"Ta",ठ:"Tha",द:"Tha",थ:"Tha",ध:"Thha",ड़:"ugDha",ढ़:"ugDhha",व:"Va",य:"Ya",य़:"Yi",ज़:"Za",ə:"e",Ə:"E",ა:"a",ბ:"b",გ:"g",დ:"d",ე:"e",ვ:"v",ზ:"z",თ:"t",ი:"i",კ:"k",ლ:"l",მ:"m",ნ:"n",ო:"o",პ:"p",ჟ:"zh",რ:"r",ს:"s",ტ:"t",უ:"u",ფ:"p",ქ:"k",ღ:"gh",ყ:"q",შ:"sh",ჩ:"ch",ც:"ts",ძ:"dz",წ:"ts",ჭ:"ch",ხ:"kh",ჯ:"j",ჰ:"h",ב:"v",גּ:"g",ג:"g",ד:"d",דּ:"d",ה:"h",ו:"v",ז:"z",ח:"h",ט:"t",י:"y",כ:"kh",ך:"kh",ל:"l",מ:"m",ם:"m",נ:"n",ן:"n",ס:"s",פ:"f",ף:"f",ץ:"ts",צ:"ts",ק:"k",ר:"r",תּ:"t",ת:"t"};Z.charmap=Object.assign({},Zo);Z.multicharmap=Object.assign({},Qo);Z.defaults={charmap:Z.charmap,mode:"pretty",modes:{rfc3986:{replacement:"-",remove:null,lower:!0,charmap:Z.charmap,multicharmap:Z.multicharmap,trim:!0},pretty:{replacement:"-",remove:null,lower:!0,charmap:Z.charmap,multicharmap:Z.multicharmap,trim:!0}},multicharmap:Z.multicharmap,fallback:!0};Z.reset=function(){Z.defaults.modes.rfc3986.charmap=Z.defaults.modes.pretty.charmap=Z.charmap=Z.defaults.charmap=Object.assign({},Zo),Z.defaults.modes.rfc3986.multicharmap=Z.defaults.modes.pretty.multicharmap=Z.multicharmap=Z.defaults.multicharmap=Object.assign({},Qo),Zn=""};Z.extend=function(t){const e=Object.keys(t),n={},r={};for(let o=0;o<e.length;o++)e[o].length>1?n[e[o]]=t[e[o]]:r[e[o]]=t[e[o]];Object.assign(Z.charmap,r),Object.assign(Z.multicharmap,n)};Z.setLocale=function(t){Zn=Xo[t]||{}};function Tu(t){return t?`/d/${Z(t.header.slug)}`:""}function Ou(t){if(!t)return"";const e=t.name;return Z(e?`${e}-${t.id}`:t.id)}function Cu(t){const e=/^\/d\/[^/]+\/([^/]+)$/.exec(t);return e?e[1]:void 0}function Lu(t){if(!t)return;const n=/\b[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}\b/.exec(t);return n?n[0]:void 0}function Ru(t){const e=Cu(t),n=Lu(e);return n||e}function es(t){const e=/^\/d\/([^/]+)/.exec(t);return e?e[1]:null}function Pu(t){return t.replaceAll(/\s/g,"-")}function xu(t){const e=new CustomEvent("ph:setDrive",{detail:{driveId:t}});window.dispatchEvent(e)}function Mu(t,e){const n=t.detail.driveId;if(e(n),typeof window>"u")return;if(!n){window.history.pushState(null,"","/");return}const r=window.reactor;r&&r.getDrive(n).then(o=>{const s=Tu(o);window.history.pushState(null,"",s)}).catch(o=>te.error(o))}function sp(t){const e=new CustomEvent("ph:setNode",{detail:{nodeId:t}});window.dispatchEvent(e)}function $u(t,e){const n=t.detail.nodeId;if(e(n),typeof window>"u")return;const r=window.reactor;if(!r)return;const o=es(window.location.pathname);if(o){if(!n){window.history.pushState(null,"",`/d/${o}`);return}r.getDriveBySlug(o).then(s=>{const c=s.state.global.nodes.find(l=>l.id===n),d=Ou(c);window.history.pushState(null,"",`/d/${o}/${d}`)}).catch(s=>te.error(s))}}function Et(){return De(Wo)}function Jt(t){const e=Et();if(t)return e==null?void 0:e.find(n=>n.header.id===t)}function ts(){return De(Ko)}function ip(){return De(Go)}function ap(){return J(t=>{xu(t)},[])}function ns(){const t=ts();return t==null?void 0:t.header.id}function Uu(t){const e=Jt(t),n=ku(t);if(e){if("remoteUrl"in e.state.global){const r=e.state.global.remoteUrl;if(typeof r=="string")return r}return n}}function rs(t){const e=Jt(t);return e==null?void 0:e.state.local.triggers.find(r=>r.type==="PullResponder")}function ku(t){var n;const e=rs(t);return(n=e==null?void 0:e.data)==null?void 0:n.url}function cp(t){const e=Uu(t),n=rs(t);return e!==void 0||n!==void 0}function up(t){const e=Jt(t);if(e)return Un(e)}function dp(t){const e=Jt(t);return e?pu(e):!1}function We(){return window.reactor}const er={32:16777619n,64:1099511628211n,128:309485009821345068724781371n,256:374144419156711147060143317175368453031918731002211n,512:35835915874844867368919076489095108449946327955754392558399825615420669938882575126094039892345713852759n,1024:5016456510113118655434598811035278955030765345404790744303017523831112055108147451509157692220295382716162651878526895249385292291816524375083746691371804094271873160484737966720260389217684476157468082573n},os={32:2166136261n,64:14695981039346656037n,128:144066263297769815596495629667062367629n,256:100029257958052580907070968620625704837092796014241193945225284501741471925557n,512:9659303129496669498009435400716310466090418745672637896108374329434462657994582932197716438449813051892206539805784495328239340083876191928701583869517785n,1024:14197795064947621068722070641403218320880622795441933960878474914617582723252296732303717722150864096521202355549365628174669108571814760471015076148029755969804077320157692458563003215304957150157403644460363550505412711285966361610267868082893823963790439336411086884584107735010676915n},ss=new globalThis.TextEncoder;function Bu(t,e){const n=er[e];let r=os[e];for(let o=0;o<t.length;o++)r^=BigInt(t[o]),r=BigInt.asUintN(e,r*n);return r}function Fu(t,e,n){if(n.length===0)throw new Error("The `utf8Buffer` option must have a length greater than zero");const r=er[e];let o=os[e],s=t;for(;s.length>0;){const i=ss.encodeInto(s,n);s=s.slice(i.read);for(let c=0;c<i.written;c++)o^=BigInt(n[c]),o=BigInt.asUintN(e,o*r)}return o}function Vu(t,{size:e=32,utf8Buffer:n}={}){if(!er[e])throw new Error("The `size` option must be one of 32, 64, 128, 256, 512, or 1024");if(typeof t=="string"){if(n)return Fu(t,e,n);t=ss.encode(t)}return Bu(t,e)}const ju=[32,64,128,256,512,1024],zu=Math.log2(26);function is(t,e=10,n="fnv1a"){if(n==="fnv1a"){const r=Math.ceil(e*zu),o=ju.find(i=>i&&i>=r)??1024,s=Vu(t,{size:o});return Hu(s,e)}else throw new Error(`Unsupported hashing algorithm: ${n}`)}function Hu(t,e=10){const n="abcdefghijklmnopqrstuvwxyz";let r="";for(;t>0n&&r.length<e;)r=n[Number(t%26n)]+r,t/=26n;return r.padStart(e,"a")}function lp(t,e){const n=t;return n.createNamespace=(r,o)=>Yu(t,r,o??e),n.queryNamespace=(r,o)=>Wu(t,r,o??e),n}async function Yu(t,e,n){const o=(n==null?void 0:n.hashNamespace)??!0?is(e):e;return await t.schema.createSchema(o).ifNotExists().execute(),t.withSchema(o)}function Wu(t,e,n){const o=(n==null?void 0:n.hashNamespace)??!0?is(e):e,s=t.withSchema(o);return tr(s)}function tr(t){return{selectFrom:t.selectFrom.bind(t),selectNoFrom:t.selectNoFrom.bind(t),with:t.with.bind(t),withRecursive:t.withRecursive.bind(t),withSchema:e=>tr(t.withSchema(e))}}function Zr(t){return as.is(t)}const eo=Symbol.for("ph.IS_RELATIONAL_DB_PROCESSOR");var To;To=eo;class as{constructor(e,n,r){fe(this,"_namespace");fe(this,"_filter");fe(this,"relationalDb");this._namespace=e,this._filter=n,this.relationalDb=r}static is(e){var r;let n=Object.getPrototypeOf(e);for(;n;){if((r=n.constructor)!=null&&r[eo])return!0;n=Object.getPrototypeOf(n)}return!1}static getNamespace(e){return`${this.name}_${e.replaceAll("-","_")}`}static query(e,n){return n.queryNamespace(this.getNamespace(e))}get filter(){return this._filter}get namespace(){return this._namespace}get query(){return tr(this.relationalDb)}}fe(as,To,!0);class Gu{constructor(e,n){fe(this,"listeners");fe(this,"drive");fe(this,"logger",Hn(["document-drive","processor-manager"]));fe(this,"processorsByDrive",new Map);fe(this,"idToFactory",new Map);fe(this,"identifierToListeners",new Map);this.listeners=e,this.drive=n}async registerFactory(e,n){this.logger.debug(`Registering factory '${e}'.`),this.idToFactory.set(e,n);const r=await this.drive.getDrives();for(const o of r)await this.createProcessors(o,e,n)}async unregisterFactory(e){var r;const n=this.identifierToListeners.get(e)??[];for(const o of n)await this.listeners.removeListener(o.driveId,o.listenerId).catch(this.logger.error),(r=o.transmitter)!=null&&r.disconnect&&await o.transmitter.disconnect();this.identifierToListeners.set(e,[])}async registerDrive(e){this.logger.debug(`Registering drive '${e}'.`);for(const[n,r]of this.idToFactory)await this.createProcessors(e,n,r)}async createProcessors(e,n,r){let o=this.identifierToListeners.get(n);o||(o=[],this.identifierToListeners.set(n,o));let s=this.processorsByDrive.get(e);s||(s=[],this.processorsByDrive.set(e,s));let i=[];try{i=await r(e)}catch(c){this.logger.error(`Error creating processors for drive ${e}:`,c);return}for(const{filter:c,processor:d}of i){const l=Zr(d);if(l&&s.some(_=>Zr(_.processor)&&_.processor.namespace===d.namespace)){this.logger.warn(`Processor with namespace '${d.namespace}' already registered for drive '${e}'.`);continue}l&&await d.initAndUpgrade();const m=Le(),f={driveId:e,listenerId:m,block:!1,system:!1,filter:c,callInfo:void 0,transmitter:new Wi(this.drive,d)};await this.listeners.setListener(e,f),o.push(f),s.push({filter:c,processor:d})}}}function Ku(){const t=We(),e=De(Ho),n=Ue(Kt);ce(()=>{if(e||!t)return;const r=new Gu(t.listeners,t);t.on("driveAdded",async o=>{await r.registerDrive(o.header.id)}),n(r)},[e,t,n])}function cs(){return Ue(yt)}function Ju(){const t=ns(),e=cs();return J(()=>{e(t).catch(n=>te.error(n))},[e,t])}function us(){return Ue(mt)}function qu(){const t=us();return J(()=>{t().catch(e=>te.error(e))},[t])}function Xu(t){const[e,n]=He(!!window.reactor),r=De(Yo),o=De(qn),s=ns(),i=De(qo),c=us(),d=cs();ce(()=>{if(e)return;async function l(){const m=await(t==null?void 0:t());window.reactor=m,n(!0)}l().catch(te.error)},[t,e]),ce(()=>{if(!e||r)return;async function l(){await c()}l().catch(te.error)},[e,c,r]),ce(()=>{if(!e||!o||i)return;async function l(){await d(s)}l().catch(te.error)},[e,i,o,s,d])}function Qu(){const t=Ue(Ye),e=Ue(wt),n=J(o=>{Mu(o,t)},[t]),r=J(o=>{$u(o,e)},[e]);ce(()=>{if(!(typeof window>"u"))return window.addEventListener("ph:setDrive",n),()=>{window.removeEventListener("ph:setDrive",n)}},[n]),ce(()=>{if(!(typeof window>"u"))return window.addEventListener("ph:setNode",r),()=>{window.removeEventListener("ph:setNode",r)}},[r])}function Zu(){const t=qu(),e=Ju(),n=We();ce(()=>{if(!n)return;const r=[n.on("syncStatus",(...o)=>{te.verbose("syncStatus",...o),t(),e()}),n.on("strandUpdate",(...o)=>{te.verbose("strandUpdate",...o),t(),e()}),n.on("defaultRemoteDrive",(...o)=>{te.verbose("defaultRemoteDrive",...o),t(),e()}),n.on("clientStrandsError",(...o)=>{te.verbose("clientStrandsError",...o),t(),e()}),n.on("driveAdded",(...o)=>{te.verbose("driveAdded",...o),t(),e()}),n.on("driveDeleted",(...o)=>{te.verbose("driveDeleted",...o),t(),e()}),n.on("documentModelModules",(...o)=>{te.verbose("documentModelModules",...o),t(),e()}),n.on("documentOperationsAdded",(...o)=>{te.verbose("documentOperationsAdded",...o),t(),e()}),n.on("driveOperationsAdded",(...o)=>{console.log("driveOperationsAdded",...o),te.verbose("driveOperationsAdded",...o),t(),e()}),n.on("operationsAdded",(...o)=>{console.log("operationsAdded",...o),te.verbose("operationsAdded",...o),t(),e()})];return()=>{r.forEach(o=>o())}},[t,e,n])}function ed(){const t=Ue(Ye),e=Ue(wt),n=De(qn),r=De(Jo),o=We();ce(()=>{async function s(){if(typeof window>"u"||!o||n)return;const i=window.location.pathname,c=await td(o,i,t);c&&(r||nd(c,i,e))}s().catch(te.error)},[o,n,r,t,e])}async function td(t,e,n){const r=es(e),o=await t.getDrives(),i=(await Promise.all(o.map(c=>t.getDrive(c)))).find(c=>c.header.slug===r||c.header.id===r);return n(i==null?void 0:i.header.id),i}function nd(t,e,n){const r=Ru(e),o=t==null?void 0:t.state.global.nodes,s=o==null?void 0:o.find(i=>i.id===r||Pu(i.name)===r);n(s==null?void 0:s.id)}function rd(t){Xu(t),Zu(),Qu(),Ku(),ed()}const it=Hn(["utils/document-model",Math.floor(Math.random()*999).toString()]),od=parseInt(window.__VITE_ENVS.FILE_UPLOAD_OPERATIONS_CHUNK_SIZE||"50");function fp(t,e,n=it.error){const[r,o]=He(e),[s,i]=He(),c=l=>{i(l),n(l)};return ce(()=>{o(e),i(void 0)},[e]),[r,(l,m,f)=>{i(void 0),o(_=>{if(!t||!_)return _;try{const y=t(_,l),N=l.scope??"global",F=y.operations[N],P=F[F.length-1];if(P.error){const V=new Error(P.error);c(V),f==null||f(V)}return m==null||m(P,{prevState:{..._},newState:{...y}}),y}catch(y){return c(y),f==null||f(y),_}})},s]}async function sd(t,e,n,r){const o=(r==null?void 0:r.operationsLimit)||od;it.verbose(`uploadDocumentOperations(documentId:${t}, ops: ${Object.keys(e.operations).join(",")}, limit:${o})`);for(const s of Object.values(e.operations))for(let i=0;i<s.length;i+=o){it.verbose(`uploadDocumentOperations:for(i:${i}, ops:${s.length}, limit:${o}): START`);const c=s.slice(i,i+o),d=c.at(-1);if(!d)break;const{scope:l}=d.action;await n(t,c),it.verbose(`uploadDocumentOperations:for:waitForUpdate(${t}:${l} rev ${d.index}): NEXT`)}it.verbose(`uploadDocumentOperations:for:waitForUpdate(${t}): END`)}const id=async t=>{Ji(t).generateAsync({type:"blob"}).then(n=>{const r=window.document.createElement("a");r.style.display="none",r.href=URL.createObjectURL(n),r.download=`${t.header.name||"Untitled"}.zip`,window.document.body.appendChild(r),r.click(),window.document.body.removeChild(r)}).catch(te.error)};async function pp(t,e){var o,s;const n=e(t.header.documentType);if(!n)throw new Error(`Document model not supported: ${t.header.documentType}`);const r=n.documentModel.extension;if(!window.showSaveFilePicker){await id(t);return}try{const i=await window.showSaveFilePicker({suggestedName:`${t.name||((o=t.state.global)==null?void 0:o.name)||"Untitled"}.${r?`${r}.`:""}zip`});await Ki(t,i);const c=(await i.getFile()).path;return typeof window<"u"&&((s=window.electronAPI)==null||s.fileSaved(t,c)),c}catch(i){if(!(i instanceof DOMException&&i.name==="AbortError"))throw i}}async function ad(t,e){const n=await Gi(t,o=>o,{checkHashes:!0}),r=e(n.header.documentType);if(!r)throw new Error(`Document "${n.header.documentType}" is not supported`);return r.utils.loadFromInput(t)}function to(t){let e=!1;const n=Object.entries(t.operations).reduce((r,[o,s])=>{const i=o;for(const c of s){const d=cd(c);r[i].push(d),d!==c&&(e=!0)}return r},{global:[],local:[]});return e?{...t,operations:n}:t}function cd(t){var s,i,c;let e=!1,n={...t};const r=(s=t.context)==null?void 0:s.signer,o=(c=(i=t.action)==null?void 0:i.context)==null?void 0:c.signer;if(r){if("signature"in r){const d=r.signature;n={...n,context:{...n.context,signer:{user:r.user,app:r.app,signatures:d!=null&&d.length?[d]:[]}}},e=!0}else if(r.signatures){const d=r.signatures.filter(l=>l&&l.length>0);d.length!==r.signatures.length&&(n={...n,context:{...n.context,signer:{...r,signatures:d}}},e=!0)}}if(o){if("signature"in o){const d=o.signature,l={...n.action.context,signer:{user:o.user,app:o.app,signatures:d!=null&&d.length?[d]:[]}};n={...n,action:{...n.action,context:l},context:l},e=!0}else if(o.signatures){const d=o.signatures.filter(l=>l&&l.length>0);if(d.length!==o.signatures.length){const l={...n.action.context,signer:{...o,signatures:d}};n={...n,action:{...n.action,context:l},context:l},e=!0}}}return e?n:t}var In={exports:{}};/*!
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./index.B8YpY9RS.js","./index.Xt1GtJTP.js","./index.BQUHyrbF.js","./browser.BkwNmV2Z.js","./app-skeleton.js","./useInitSentry.Bb28RsdX.js","./useAcceptedCookies.D1uKoy1t.js","./registerServiceWorker.BedDSXhk.js","./cookie-banner.CN8lvPw2.js","./i18next.CqOP20KE.js","./modal.rCKchklN.js","./Trans.Cfj7Hl8U.js"])))=>i.map(i=>d[i]);
2
+ var Bi=Object.defineProperty;var Fi=(t,e,n)=>e in t?Bi(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var fe=(t,e,n)=>Fi(t,typeof e!="symbol"?e+"":e,n);import{createRoot as Vi}from"react-dom/client";import{L as dt,s as ji,l as te,P as zi,a as Hi,i as Yi,g as Oo,c as Hn,b as Le,I as Wi,d as Gi,e as Ki,f as Ji,h as Nt,j as Tt,r as qi,k as Or,D as Ot,m as Xi,n as Qi,o as Cr,p as Zi,q as ea,t as ta,u as Lr,v as na,R as ra,w as oa,E as sa,x as ia,_ as Te,y as aa,z as ca,B as ua,F as da,G as la,J as fa,K as pn,M as pa,N as ha,O as Rr,Q as ga,S as _a,T as ma,U as va,V as wa,W as ya,X as Ea,Y as ba,Z as Sa,$ as Da,a0 as Ia,a1 as Aa,a2 as Pr,a3 as Rn,a4 as Na,a5 as Ta,a6 as Oa,a7 as Ca,a8 as hn}from"./index.Xt1GtJTP.js";import{jsxs as kt,jsx as ye}from"react/jsx-runtime";import Gt,{useRef as Me,createElement as La,createContext as Yn,useReducer as Co,useEffect as ce,useDebugValue as Lo,useContext as Wn,useCallback as J,useState as He,useMemo as ht,StrictMode as Ra,Suspense as xr,lazy as Gn}from"react";import{g as Pa}from"./browser.BkwNmV2Z.js";import{A as xa}from"./app-skeleton.js";const Ma="@powerhousedao/connect",$a="Powerhouse-Connect",Ua="4.1.0-dev.22",ka="Powerhouse Connect",Ba="./dist/index.html",Fa="module",Va={node:">=22.0.0"},ja=["dist","nginx.conf","nginx.sh","scripts"],za="AGPL-3.0-only",Ha="acaldas@powerhouse.inc",Ya={type:"git",url:"https://github.com/powerhouse-inc/powerhouse"},Wa={url:"https://github.com/powerhouse-inc/powerhouse/issues"},Ga="https://github.com/powerhouse-inc/powerhouse#readme",Ka={"build:tsc":"tsc --build",start:"electron-forge start",package:"electron-forge package",make:"PH_CONNECT_BASE_HREF=./ electron-forge make","make:mac":"PH_CONNECT_BASE_HREF=./ electron-forge make -p darwin","make:linux":"PH_CONNECT_BASE_HREF=./ electron-forge make -p linux","make:windows":"PH_CONNECT_BASE_HREF=./ electron-forge make -p win32","publish:electron":"electron-forge publish",prepublishOnly:"npm run build",lint:"eslint .","lint:fix":"eslint --fix .","lint:nx":"eslint --quiet --fix .",format:'prettier --write "**/*.+(js|ts|jsx|tsx|json)"',dev:"vite -c vite.renderer.config.mts","dev:nocache":"rm -rf node_modules/.vite && rm -rf node_modules/.cache && npm run dev",prebuild:"npm run clean && tsc --build --noEmit",build:"NODE_OPTIONS=--max-old-space-size=6144 vite build -c vite.renderer.config.mts",preview:"vite preview -c vite.renderer.config.mts",e2e:"playwright test","cy:open":"cypress open","build:service-worker":"tsc --build ./tsconfig.sw.json",clean:"rimraf dist","clean:node_modules":"rimraf node_modules","docker:build":"docker build -f ./Dockerfile --tag connect-test-dev --build-arg TAG=dev .","docker:run":"docker run -it -p 4000:4000 -v $(realpath ../../../monorepo):/monorepo -v $(pwd)/nginx.conf:/etc/nginx/nginx.conf.template -e PH_USE_LOCAL=true -e PH_CONNECT_BASE_PATH=/develop/powerhouse/connect -e PORT=4000 connect-test-dev"},Ja={"@didtools/key-webcrypto":"^0.2.0","@electron-forge/cli":"^6.1.1","@electron-forge/maker-deb":"^6.1.1","@electron-forge/maker-rpm":"^6.1.1","@electron-forge/maker-squirrel":"^6.1.1","@electron-forge/maker-zip":"^6.1.1","@electron-forge/plugin-vite":"^6.1.1","@electron-forge/publisher-electron-release-server":"^6.2.1","@electron-forge/publisher-github":"^7.2.0","@electron-forge/shared-types":"^7.7.0","@playwright/test":"^1.41.2","@powerhousedao/builder-tools":"workspace:*","@powerhousedao/common":"workspace:*","@powerhousedao/config":"workspace:*","@powerhousedao/design-system":"workspace:*","@powerhousedao/diff-analyzer":"^0.0.0-dev.10","@powerhousedao/reactor-browser":"workspace:*","@powerhousedao/state":"workspace:*","@renown/sdk":"workspace:*","@rollup/plugin-node-resolve":"^15.2.3","@sentry/browser":"^9.1.0","@sentry/react":"^7.109.0","@sentry/vite-plugin":"^2.23.0","@tailwindcss/vite":"^4.1.4","@tanstack/react-virtual":"^3.8.1","@types/node":"^22.15.17","@types/react":"^18.2.79","@types/react-dom":"^18.2.18","@types/uuid":"^9.0.7","@types/wicg-file-system-access":"^2020.9.6","@vitejs/plugin-basic-ssl":"^2.0.0","@vitejs/plugin-react":"^4.4.1",asar:"^3.2.0","did-jwt":"^8.0.14","did-jwt-vc":"^4.0.12","did-key-creator":"^1.2.0","document-drive":"workspace:*","document-model":"workspace:*",electron:"30.0.0","electron-is-dev":"^3.0.1","electron-playwright-helpers":"^1.7.1","electron-squirrel-startup":"^1.0.0","electron-store":"^8.1.0",esbuild:"^0.24.0","fast-deep-equal":"^3.1.3",graphql:"^16.11.0","graphql-request":"^6.1.0",i18next:"^23.7.6",jotai:"^2.1.0","jotai-devtools":"^0.12.0","jotai-effect":"^1.1.6",localforage:"^1.10.0",playwright:"^1.41.2","playwright-core":"^1.41.2",react:"^18.3.1","react-dom":"^18.3.1","react-error-boundary":"^4.0.11","react-hotkeys-hook":"^4.5.0","react-i18next":"^13.5.0","react-router-dom":"^6.11.2","tailwind-merge":"^3.0.2",tailwindcss:"^4.1.4",uint8arrays:"^5.1.0",uuid:"^9.0.1",viem:"^2.8.13",vite:"^6.3.3","vite-envs":"^4.6.0","vite-plugin-html":"^3.2.2","vite-plugin-node-polyfills":"^0.23.0","vite-plugin-svgr":"^4.3.0","vite-tsconfig-paths":"^5.1.4","xvfb-maybe":"^0.2.1"},qa={"@esbuild/linux-x64":"^0.21.4","@rollup/rollup-linux-x64-musl":"4.14.3"},Xa={name:Ma,productName:$a,version:Ua,description:ka,main:Ba,type:Fa,engines:Va,files:ja,license:za,author:Ha,repository:Ya,bugs:Wa,homepage:Ga,scripts:Ka,devDependencies:Ja,optionalDependencies:qa},Qa=Xa.version,Za=window.__VITE_ENVS.APP_VERSION||Qa,ec=window.__VITE_ENVS.PH_CONNECT_WARN_OUTDATED_APP||"false",tc=window.__VITE_ENVS.PH_CONNECT_STUDIO_MODE||"false",nc=window.__VITE_ENVS.PH_CONNECT_DISABLE_ADD_DRIVE||"false",rc=window.__VITE_ENVS.PH_CONNECT_DISABLE_ADD_PUBLIC_DRIVES||void 0,oc=window.__VITE_ENVS.PH_CONNECT_DISABLE_ADD_CLOUD_DRIVES||void 0,sc=window.__VITE_ENVS.PH_CONNECT_DISABLE_ADD_LOCAL_DRIVES||void 0,ic=window.__VITE_ENVS.PH_CONNECT_DISABLE_DELETE_PUBLIC_DRIVES||void 0,ac=window.__VITE_ENVS.PH_CONNECT_DISABLE_DELETE_CLOUD_DRIVES||void 0,cc=window.__VITE_ENVS.PH_CONNECT_DISABLE_DELETE_LOCAL_DRIVES||void 0,uc=window.__VITE_ENVS.PH_CONNECT_LOCAL_DRIVES_ENABLED||void 0,dc=window.__VITE_ENVS.PH_CONNECT_CLOUD_DRIVES_ENABLED||void 0,lc=window.__VITE_ENVS.PH_CONNECT_PUBLIC_DRIVES_ENABLED||void 0,fc=window.__VITE_ENVS.PH_CONNECT_SEARCH_BAR_ENABLED||void 0,pc=window.__VITE_ENVS.PH_CONNECT_HIDE_DOCUMENT_MODEL_SELECTION_SETTINGS||"false",Ro=Pa()||"/",hc=window.__VITE_ENVS.PH_CONNECT_SENTRY_DSN||"",gc=window.__VITE_ENVS.PH_CONNECT_SENTRY_ENV||"dev",_c=window.__VITE_ENVS.PH_CONNECT_SENTRY_TRACING_ENABLED||"false",mc=window.__VITE_ENVS.PH_CONNECT_GA_TRACKING_ID,vc=window.__VITE_ENVS.PH_CONNECT_CLI_VERSION||void 0,wc=window.__VITE_ENVS.PH_CONNECT_ANALYTICS_DATABASE_NAME||`${Ro.replace(/\//g,"")}:analytics`,yc=window.__VITE_ENVS.PH_CONNECT_ANALYTICS_DATABASE_WORKER_DISABLED||"false",Ec=window.__VITE_ENVS.PH_CONNECT_DIFF_ANALYTICS_ENABLED||"false",bc=window.__VITE_ENVS.PH_CONNECT_DRIVE_ANALYTICS_ENABLED||"false",Sc=window.__VITE_ENVS.PH_CONNECT_EXTERNAL_PROCESSORS_ENABLED||"true",Dc=Yi(window.__VITE_ENVS.LOG_LEVEL)?window.__VITE_ENVS.LOG_LEVEL:"info";ji(Dc);te.debug(`Setting log level to ${window.__VITE_ENVS.LOG_LEVEL}.`);const gt={appVersion:Za,studioMode:tc.toString()==="true",warnOutdatedApp:ec==="true",routerBasename:Ro,analytics:{databaseName:wc,useWorker:yc!=="true",driveAnalyticsEnabled:bc==="true",diffProcessorEnabled:Ec==="true",externalProcessorsEnabled:Sc==="true"},sentry:{dsn:hc,env:gc,tracing:_c==="true"},content:{showSearchBar:fc!=="false",showDocumentModelSelectionSetting:pc!=="true"},drives:{addDriveEnabled:nc!=="true",sections:{[dt]:{enabled:uc!=="false",allowAdd:sc!=="true",allowDelete:cc!=="true"},[Hi]:{enabled:dc!=="false",allowAdd:oc!=="true",allowDelete:ac!=="true"},[zi]:{enabled:lc!=="false",allowAdd:rc!=="true",allowDelete:ic!=="true"}}},gaTrackingId:mc,phCliVersion:vc},ot={},Mr=(t,e)=>t.unstable_is?t.unstable_is(e):e===t,$r=t=>"init"in t,gn=t=>!!t.write,Ur=t=>"v"in t||"e"in t,Ct=t=>{if("e"in t)throw t.e;if((ot?"production":void 0)!=="production"&&!("v"in t))throw new Error("[Bug] atom state is not initialized");return t.v},Bt=new WeakMap,kr=t=>{var e;return Ft(t)&&!!((e=Bt.get(t))!=null&&e[0])},Ic=t=>{const e=Bt.get(t);e!=null&&e[0]&&(e[0]=!1,e[1].forEach(n=>n()))},Po=(t,e)=>{let n=Bt.get(t);if(!n){n=[!0,new Set],Bt.set(t,n);const r=()=>{n[0]=!1};t.then(r,r)}n[1].add(e)},Ft=t=>typeof(t==null?void 0:t.then)=="function",xo=(t,e,n)=>{n.p.has(t)||(n.p.add(t),e.then(()=>{n.p.delete(t)},()=>{n.p.delete(t)}))},_n=(t,e,n)=>{const r=n(t),o="v"in r,s=r.v;if(Ft(e))for(const i of r.d.keys())xo(t,e,n(i));r.v=e,delete r.e,(!o||!Object.is(s,r.v))&&(++r.n,Ft(s)&&Ic(s))},Br=(t,e,n)=>{var r;const o=new Set;for(const s of((r=n.get(t))==null?void 0:r.t)||[])n.has(s)&&o.add(s);for(const s of e.p)o.add(s);return o},Ac=()=>{const t=new Set,e=()=>{t.forEach(n=>n())};return e.add=n=>(t.add(n),()=>{t.delete(n)}),e},mn=()=>{const t={},e=new WeakMap,n=r=>{var o,s;(o=e.get(t))==null||o.forEach(i=>i(r)),(s=e.get(r))==null||s.forEach(i=>i())};return n.add=(r,o)=>{const s=r||t,i=(e.has(s)?e:e.set(s,new Set)).get(s);return i.add(o),()=>{i==null||i.delete(o),i.size||e.delete(s)}},n},Nc=t=>(t.c||(t.c=mn()),t.m||(t.m=mn()),t.u||(t.u=mn()),t.f||(t.f=Ac()),t),Tc=Symbol(),Oc=(t=new WeakMap,e=new WeakMap,n=new WeakMap,r=new Set,o=new Set,s=new Set,i={},c=(_,...y)=>_.read(...y),d=(_,...y)=>_.write(...y),l=(_,y)=>{var N;return(N=_.unstable_onInit)==null?void 0:N.call(_,y)},m=(_,y)=>{var N;return(N=_.onMount)==null?void 0:N.call(_,y)},...f)=>{const _=f[0]||(w=>{if((ot?"production":void 0)!=="production"&&!w)throw new Error("Atom is undefined or null");let A=t.get(w);return A||(A={d:new Map,p:new Set,n:0},t.set(w,A),l==null||l(w,B)),A}),y=f[1]||(()=>{const w=[],A=S=>{try{S()}catch(D){w.push(D)}};do{i.f&&A(i.f);const S=new Set,D=S.add.bind(S);r.forEach(b=>{var I;return(I=e.get(b))==null?void 0:I.l.forEach(D)}),r.clear(),s.forEach(D),s.clear(),o.forEach(D),o.clear(),S.forEach(A),r.size&&N()}while(r.size||s.size||o.size);if(w.length)throw new AggregateError(w)}),N=f[2]||(()=>{const w=[],A=new WeakSet,S=new WeakSet,D=Array.from(r);for(;D.length;){const b=D[D.length-1],I=_(b);if(S.has(b)){D.pop();continue}if(A.has(b)){if(n.get(b)===I.n)w.push([b,I]);else if((ot?"production":void 0)!=="production"&&n.has(b))throw new Error("[Bug] invalidated atom exists");S.add(b),D.pop();continue}A.add(b);for(const Y of Br(b,I,e))A.has(Y)||D.push(Y)}for(let b=w.length-1;b>=0;--b){const[I,Y]=w[b];let K=!1;for(const se of Y.d.keys())if(se!==I&&r.has(se)){K=!0;break}K&&(F(I),H(I)),n.delete(I)}}),F=f[3]||(w=>{var A;const S=_(w);if(Ur(S)&&(e.has(w)&&n.get(w)!==S.n||Array.from(S.d).every(([j,M])=>F(j).n===M)))return S;S.d.clear();let D=!0;const b=()=>{e.has(w)&&(H(w),N(),y())},I=j=>{var M;if(Mr(w,j)){const $=_(j);if(!Ur($))if($r(j))_n(j,j.init,_);else throw new Error("no atom init");return Ct($)}const x=F(j);try{return Ct(x)}finally{S.d.set(j,x.n),kr(S.v)&&xo(w,S.v,x),(M=e.get(j))==null||M.t.add(w),D||b()}};let Y,K;const se={get signal(){return Y||(Y=new AbortController),Y.signal},get setSelf(){return(ot?"production":void 0)!=="production"&&!gn(w)&&console.warn("setSelf function cannot be used with read-only atom"),!K&&gn(w)&&(K=(...j)=>{if((ot?"production":void 0)!=="production"&&D&&console.warn("setSelf function cannot be called in sync"),!D)try{return V(w,...j)}finally{N(),y()}}),K}},he=S.n;try{const j=c(w,I,se);return _n(w,j,_),Ft(j)&&(Po(j,()=>Y==null?void 0:Y.abort()),j.then(b,b)),S}catch(j){return delete S.v,S.e=j,++S.n,S}finally{D=!1,he!==S.n&&n.get(w)===he&&(n.set(w,S.n),r.add(w),(A=i.c)==null||A.call(i,w))}}),P=f[4]||(w=>{const A=[w];for(;A.length;){const S=A.pop(),D=_(S);for(const b of Br(S,D,e)){const I=_(b);n.set(b,I.n),A.push(b)}}}),V=f[5]||((w,...A)=>{let S=!0;const D=I=>Ct(F(I)),b=(I,...Y)=>{var K;const se=_(I);try{if(Mr(w,I)){if(!$r(I))throw new Error("atom not writable");const he=se.n,j=Y[0];_n(I,j,_),H(I),he!==se.n&&(r.add(I),(K=i.c)==null||K.call(i,I),P(I));return}else return V(I,...Y)}finally{S||(N(),y())}};try{return d(w,D,b,...A)}finally{S=!1}}),H=f[6]||(w=>{var A;const S=_(w),D=e.get(w);if(D&&!kr(S.v)){for(const[b,I]of S.d)if(!D.d.has(b)){const Y=_(b);k(b).t.add(w),D.d.add(b),I!==Y.n&&(r.add(b),(A=i.c)==null||A.call(i,b),P(b))}for(const b of D.d||[])if(!S.d.has(b)){D.d.delete(b);const I=W(b);I==null||I.t.delete(w)}}}),k=f[7]||(w=>{var A;const S=_(w);let D=e.get(w);if(!D){F(w);for(const b of S.d.keys())k(b).t.add(w);if(D={l:new Set,d:new Set(S.d.keys()),t:new Set},e.set(w,D),(A=i.m)==null||A.call(i,w),gn(w)){const b=()=>{let I=!0;const Y=(...K)=>{try{return V(w,...K)}finally{I||(N(),y())}};try{const K=m(w,Y);K&&(D.u=()=>{I=!0;try{K()}finally{I=!1}})}finally{I=!1}};o.add(b)}}return D}),W=f[8]||(w=>{var A;const S=_(w);let D=e.get(w);if(D&&!D.l.size&&!Array.from(D.t).some(b=>{var I;return(I=e.get(b))==null?void 0:I.d.has(w)})){D.u&&s.add(D.u),D=void 0,e.delete(w),(A=i.u)==null||A.call(i,w);for(const b of S.d.keys()){const I=W(b);I==null||I.t.delete(w)}return}return D}),O=[t,e,n,r,o,s,i,c,d,l,m,_,y,N,F,P,V,H,k,W],B={get:w=>Ct(F(w)),set:(w,...A)=>{try{return V(w,...A)}finally{N(),y()}},sub:(w,A)=>{const D=k(w).l;return D.add(A),y(),()=>{D.delete(A),W(w),y()}}};return Object.defineProperty(B,Tc,{value:O}),B},Mo=Oc,Cc=Nc,Fr=Po,Kn={};let Lc=0;function de(t,e){const n=`atom${++Lc}`,r={toString(){return(Kn?"production":void 0)!=="production"&&this.debugLabel?n+":"+this.debugLabel:n}};return typeof t=="function"?r.read=t:(r.init=t,r.read=Rc,r.write=Pc),e&&(r.write=e),r}function Rc(t){return t(this)}function Pc(t,e,n){return e(this,typeof n=="function"?n(t(this)):n)}const xc=()=>{let t=0;const e=Cc({}),n=new WeakMap,r=new WeakMap,o=Mo(n,r,void 0,void 0,void 0,void 0,e,void 0,(c,d,l,...m)=>t?l(c,...m):c.write(d,l,...m)),s=new Set;return e.m.add(void 0,c=>{s.add(c);const d=n.get(c);d.m=r.get(c)}),e.u.add(void 0,c=>{s.delete(c);const d=n.get(c);delete d.m}),Object.assign(o,{dev4_get_internal_weak_map:()=>(console.log("Deprecated: Use devstore from the devtools library"),n),dev4_get_mounted_atoms:()=>s,dev4_restore_atoms:c=>{const d={read:()=>null,write:(l,m)=>{++t;try{for(const[f,_]of c)"init"in f&&m(f,_)}finally{--t}}};o.set(d)}})};function $o(){return(Kn?"production":void 0)!=="production"?xc():Mo()}let tt;function Mc(){return tt||(tt=$o(),(Kn?"production":void 0)!=="production"&&(globalThis.__JOTAI_DEFAULT_STORE__||(globalThis.__JOTAI_DEFAULT_STORE__=tt),globalThis.__JOTAI_DEFAULT_STORE__!==tt&&console.warn("Detected multiple Jotai instances. It may cause unexpected behavior with the default store. https://github.com/pmndrs/jotai/discussions/2044"))),tt}const $c={},Uo=Yn(void 0);function ko(t){return Wn(Uo)||Mc()}function Uc({children:t,store:e}){const n=Me(void 0);return!e&&!n.current&&(n.current=$o()),La(Uo.Provider,{value:e||n.current},t)}const Pn=t=>typeof(t==null?void 0:t.then)=="function",xn=t=>{t.status||(t.status="pending",t.then(e=>{t.status="fulfilled",t.value=e},e=>{t.status="rejected",t.reason=e}))},kc=Gt.use||(t=>{if(t.status==="pending")throw t;if(t.status==="fulfilled")return t.value;throw t.status==="rejected"?t.reason:(xn(t),t)}),vn=new WeakMap,Vr=(t,e)=>{let n=vn.get(t);return n||(n=new Promise((r,o)=>{let s=t;const i=l=>m=>{s===l&&r(m)},c=l=>m=>{s===l&&o(m)},d=()=>{try{const l=e();Pn(l)?(vn.set(l,n),s=l,l.then(i(l),c(l)),Fr(l,d)):r(l)}catch(l){o(l)}};t.then(i(t),c(t)),Fr(t,d)}),vn.set(t,n)),n};function Oe(t,e){const{delay:n,unstable_promiseStatus:r=!Gt.use}={},o=ko(),[[s,i,c],d]=Co(m=>{const f=o.get(t);return Object.is(m[0],f)&&m[1]===o&&m[2]===t?m:[f,o,t]},void 0,()=>[o.get(t),o,t]);let l=s;if((i!==o||c!==t)&&(d(),l=o.get(t)),ce(()=>{const m=o.sub(t,()=>{if(r)try{const f=o.get(t);Pn(f)&&xn(Vr(f,()=>o.get(t)))}catch{}if(typeof n=="number"){setTimeout(d,n);return}d()});return d(),m},[o,t,n,r]),Lo(l),Pn(l)){const m=Vr(l,()=>o.get(t));return r&&xn(m),kc(m)}return l}function Bc(t,e){const n=ko();return J((...o)=>{if(($c?"production":void 0)!=="production"&&!("write"in t))throw new Error("not writable atom");return n.set(t,...o)},[n,t])}function $e(t,e){return[Oe(t),Bc(t)]}const Fc=de(gt);function Vc(){return $e(Fc)}const st={},jr=(t,e)=>t.unstable_is?t.unstable_is(e):e===t,zr=t=>"init"in t,wn=t=>!!t.write,Hr=t=>"v"in t||"e"in t,Lt=t=>{if("e"in t)throw t.e;if((st?"production":void 0)!=="production"&&!("v"in t))throw new Error("[Bug] atom state is not initialized");return t.v},Vt=new WeakMap,Yr=t=>{var e;return jt(t)&&!!((e=Vt.get(t))!=null&&e[0])},jc=t=>{const e=Vt.get(t);e!=null&&e[0]&&(e[0]=!1,e[1].forEach(n=>n()))},Bo=(t,e)=>{let n=Vt.get(t);if(!n){n=[!0,new Set],Vt.set(t,n);const r=()=>{n[0]=!1};t.then(r,r)}n[1].add(e)},jt=t=>typeof(t==null?void 0:t.then)=="function",Fo=(t,e,n)=>{n.p.has(t)||(n.p.add(t),e.then(()=>{n.p.delete(t)},()=>{n.p.delete(t)}))},yn=(t,e,n)=>{const r=n(t),o="v"in r,s=r.v;if(jt(e))for(const i of r.d.keys())Fo(t,e,n(i));r.v=e,delete r.e,(!o||!Object.is(s,r.v))&&(++r.n,jt(s)&&jc(s))},Wr=(t,e,n)=>{var r;const o=new Set;for(const s of((r=n.get(t))==null?void 0:r.t)||[])n.has(s)&&o.add(s);for(const s of e.p)o.add(s);return o},zc=()=>{const t=new Set,e=()=>{t.forEach(n=>n())};return e.add=n=>(t.add(n),()=>{t.delete(n)}),e},En=()=>{const t={},e=new WeakMap,n=r=>{var o,s;(o=e.get(t))==null||o.forEach(i=>i(r)),(s=e.get(r))==null||s.forEach(i=>i())};return n.add=(r,o)=>{const s=r||t,i=(e.has(s)?e:e.set(s,new Set)).get(s);return i.add(o),()=>{i==null||i.delete(o),i.size||e.delete(s)}},n},Hc=t=>(t.c||(t.c=En()),t.m||(t.m=En()),t.u||(t.u=En()),t.f||(t.f=zc()),t),Yc=Symbol(),Wc=(t=new WeakMap,e=new WeakMap,n=new WeakMap,r=new Set,o=new Set,s=new Set,i={},c=(_,...y)=>_.read(...y),d=(_,...y)=>_.write(...y),l=(_,y)=>{var N;return(N=_.unstable_onInit)==null?void 0:N.call(_,y)},m=(_,y)=>{var N;return(N=_.onMount)==null?void 0:N.call(_,y)},...f)=>{const _=f[0]||(w=>{if((st?"production":void 0)!=="production"&&!w)throw new Error("Atom is undefined or null");let A=t.get(w);return A||(A={d:new Map,p:new Set,n:0},t.set(w,A),l==null||l(w,B)),A}),y=f[1]||(()=>{const w=[],A=S=>{try{S()}catch(D){w.push(D)}};do{i.f&&A(i.f);const S=new Set,D=S.add.bind(S);r.forEach(b=>{var I;return(I=e.get(b))==null?void 0:I.l.forEach(D)}),r.clear(),s.forEach(D),s.clear(),o.forEach(D),o.clear(),S.forEach(A),r.size&&N()}while(r.size||s.size||o.size);if(w.length)throw new AggregateError(w)}),N=f[2]||(()=>{const w=[],A=new WeakSet,S=new WeakSet,D=Array.from(r);for(;D.length;){const b=D[D.length-1],I=_(b);if(S.has(b)){D.pop();continue}if(A.has(b)){if(n.get(b)===I.n)w.push([b,I]);else if((st?"production":void 0)!=="production"&&n.has(b))throw new Error("[Bug] invalidated atom exists");S.add(b),D.pop();continue}A.add(b);for(const Y of Wr(b,I,e))A.has(Y)||D.push(Y)}for(let b=w.length-1;b>=0;--b){const[I,Y]=w[b];let K=!1;for(const se of Y.d.keys())if(se!==I&&r.has(se)){K=!0;break}K&&(F(I),H(I)),n.delete(I)}}),F=f[3]||(w=>{var A;const S=_(w);if(Hr(S)&&(e.has(w)&&n.get(w)!==S.n||Array.from(S.d).every(([j,M])=>F(j).n===M)))return S;S.d.clear();let D=!0;const b=()=>{e.has(w)&&(H(w),N(),y())},I=j=>{var M;if(jr(w,j)){const $=_(j);if(!Hr($))if(zr(j))yn(j,j.init,_);else throw new Error("no atom init");return Lt($)}const x=F(j);try{return Lt(x)}finally{S.d.set(j,x.n),Yr(S.v)&&Fo(w,S.v,x),(M=e.get(j))==null||M.t.add(w),D||b()}};let Y,K;const se={get signal(){return Y||(Y=new AbortController),Y.signal},get setSelf(){return(st?"production":void 0)!=="production"&&!wn(w)&&console.warn("setSelf function cannot be used with read-only atom"),!K&&wn(w)&&(K=(...j)=>{if((st?"production":void 0)!=="production"&&D&&console.warn("setSelf function cannot be called in sync"),!D)try{return V(w,...j)}finally{N(),y()}}),K}},he=S.n;try{const j=c(w,I,se);return yn(w,j,_),jt(j)&&(Bo(j,()=>Y==null?void 0:Y.abort()),j.then(b,b)),S}catch(j){return delete S.v,S.e=j,++S.n,S}finally{D=!1,he!==S.n&&n.get(w)===he&&(n.set(w,S.n),r.add(w),(A=i.c)==null||A.call(i,w))}}),P=f[4]||(w=>{const A=[w];for(;A.length;){const S=A.pop(),D=_(S);for(const b of Wr(S,D,e)){const I=_(b);n.set(b,I.n),A.push(b)}}}),V=f[5]||((w,...A)=>{let S=!0;const D=I=>Lt(F(I)),b=(I,...Y)=>{var K;const se=_(I);try{if(jr(w,I)){if(!zr(I))throw new Error("atom not writable");const he=se.n,j=Y[0];yn(I,j,_),H(I),he!==se.n&&(r.add(I),(K=i.c)==null||K.call(i,I),P(I));return}else return V(I,...Y)}finally{S||(N(),y())}};try{return d(w,D,b,...A)}finally{S=!1}}),H=f[6]||(w=>{var A;const S=_(w),D=e.get(w);if(D&&!Yr(S.v)){for(const[b,I]of S.d)if(!D.d.has(b)){const Y=_(b);k(b).t.add(w),D.d.add(b),I!==Y.n&&(r.add(b),(A=i.c)==null||A.call(i,b),P(b))}for(const b of D.d||[])if(!S.d.has(b)){D.d.delete(b);const I=W(b);I==null||I.t.delete(w)}}}),k=f[7]||(w=>{var A;const S=_(w);let D=e.get(w);if(!D){F(w);for(const b of S.d.keys())k(b).t.add(w);if(D={l:new Set,d:new Set(S.d.keys()),t:new Set},e.set(w,D),(A=i.m)==null||A.call(i,w),wn(w)){const b=()=>{let I=!0;const Y=(...K)=>{try{return V(w,...K)}finally{I||(N(),y())}};try{const K=m(w,Y);K&&(D.u=()=>{I=!0;try{K()}finally{I=!1}})}finally{I=!1}};o.add(b)}}return D}),W=f[8]||(w=>{var A;const S=_(w);let D=e.get(w);if(D&&!D.l.size&&!Array.from(D.t).some(b=>{var I;return(I=e.get(b))==null?void 0:I.d.has(w)})){D.u&&s.add(D.u),D=void 0,e.delete(w),(A=i.u)==null||A.call(i,w);for(const b of S.d.keys()){const I=W(b);I==null||I.t.delete(w)}return}return D}),O=[t,e,n,r,o,s,i,c,d,l,m,_,y,N,F,P,V,H,k,W],B={get:w=>Lt(F(w)),set:(w,...A)=>{try{return V(w,...A)}finally{N(),y()}},sub:(w,A)=>{const D=k(w).l;return D.add(A),y(),()=>{D.delete(A),W(w),y()}}};return Object.defineProperty(B,Yc,{value:O}),B},Vo=Wc,Gc=Hc,Gr=Bo,Jn={};let Kc=0;function oe(t,e){const n=`atom${++Kc}`,r={toString(){return(Jn?"production":void 0)!=="production"&&this.debugLabel?n+":"+this.debugLabel:n}};return typeof t=="function"?r.read=t:(r.init=t,r.read=Jc,r.write=qc),e&&(r.write=e),r}function Jc(t){return t(this)}function qc(t,e,n){return e(this,typeof n=="function"?n(t(this)):n)}const Xc=()=>{let t=0;const e=Gc({}),n=new WeakMap,r=new WeakMap,o=Vo(n,r,void 0,void 0,void 0,void 0,e,void 0,(c,d,l,...m)=>t?l(c,...m):c.write(d,l,...m)),s=new Set;return e.m.add(void 0,c=>{s.add(c);const d=n.get(c);d.m=r.get(c)}),e.u.add(void 0,c=>{s.delete(c);const d=n.get(c);delete d.m}),Object.assign(o,{dev4_get_internal_weak_map:()=>(console.log("Deprecated: Use devstore from the devtools library"),n),dev4_get_mounted_atoms:()=>s,dev4_restore_atoms:c=>{const d={read:()=>null,write:(l,m)=>{++t;try{for(const[f,_]of c)"init"in f&&m(f,_)}finally{--t}}};o.set(d)}})};function Qc(){return(Jn?"production":void 0)!=="production"?Xc():Vo()}let nt;function Zc(){return nt||(nt=Qc(),(Jn?"production":void 0)!=="production"&&(globalThis.__JOTAI_DEFAULT_STORE__||(globalThis.__JOTAI_DEFAULT_STORE__=nt),globalThis.__JOTAI_DEFAULT_STORE__!==nt&&console.warn("Detected multiple Jotai instances. It may cause unexpected behavior with the default store. https://github.com/pmndrs/jotai/discussions/2044"))),nt}const eu={},tu=Yn(void 0);function jo(t){return Wn(tu)||Zc()}const Mn=t=>typeof(t==null?void 0:t.then)=="function",$n=t=>{t.status||(t.status="pending",t.then(e=>{t.status="fulfilled",t.value=e},e=>{t.status="rejected",t.reason=e}))},nu=Gt.use||(t=>{if(t.status==="pending")throw t;if(t.status==="fulfilled")return t.value;throw t.status==="rejected"?t.reason:($n(t),t)}),bn=new WeakMap,Kr=(t,e)=>{let n=bn.get(t);return n||(n=new Promise((r,o)=>{let s=t;const i=l=>m=>{s===l&&r(m)},c=l=>m=>{s===l&&o(m)},d=()=>{try{const l=e();Mn(l)?(bn.set(l,n),s=l,l.then(i(l),c(l)),Gr(l,d)):r(l)}catch(l){o(l)}};t.then(i(t),c(t)),Gr(t,d)}),bn.set(t,n)),n};function De(t,e){const{delay:n,unstable_promiseStatus:r=!Gt.use}={},o=jo(),[[s,i,c],d]=Co(m=>{const f=o.get(t);return Object.is(m[0],f)&&m[1]===o&&m[2]===t?m:[f,o,t]},void 0,()=>[o.get(t),o,t]);let l=s;if((i!==o||c!==t)&&(d(),l=o.get(t)),ce(()=>{const m=o.sub(t,()=>{if(r)try{const f=o.get(t);Mn(f)&&$n(Kr(f,()=>o.get(t)))}catch{}if(typeof n=="number"){setTimeout(d,n);return}d()});return d(),m},[o,t,n,r]),Lo(l),Mn(l)){const m=Kr(l,()=>o.get(t));return r&&$n(m),nu(m)}return l}function Ue(t,e){const n=jo();return J((...o)=>{if((eu?"production":void 0)!=="production"&&!("write"in t))throw new Error("not writable atom");return n.set(t,...o)},[n,t])}var Sn,Jr;function ru(){return Jr||(Jr=1,Sn=function t(e,n){if(e===n)return!0;if(e&&n&&typeof e=="object"&&typeof n=="object"){if(e.constructor!==n.constructor)return!1;var r,o,s;if(Array.isArray(e)){if(r=e.length,r!=n.length)return!1;for(o=r;o--!==0;)if(!t(e[o],n[o]))return!1;return!0}if(e.constructor===RegExp)return e.source===n.source&&e.flags===n.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===n.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===n.toString();if(s=Object.keys(e),r=s.length,r!==Object.keys(n).length)return!1;for(o=r;o--!==0;)if(!Object.prototype.hasOwnProperty.call(n,s[o]))return!1;for(o=r;o--!==0;){var i=s[o];if(!t(e[i],n[i]))return!1}return!0}return e!==e&&n!==n}),Sn}var ou=ru();const zo=Oo(ou),lt={},su=t=>typeof(t==null?void 0:t.then)=="function";function iu(t=()=>{try{return window.localStorage}catch(n){(lt?"production":void 0)!=="production"&&typeof window<"u"&&console.warn(n);return}},e){var n;let r,o;const s={getItem:(d,l)=>{var m,f;const _=N=>{if(N=N||"",r!==N){try{o=JSON.parse(N,void 0)}catch{return l}r=N}return o},y=(f=(m=t())==null?void 0:m.getItem(d))!=null?f:null;return su(y)?y.then(_):_(y)},setItem:(d,l)=>{var m;return(m=t())==null?void 0:m.setItem(d,JSON.stringify(l,void 0))},removeItem:d=>{var l;return(l=t())==null?void 0:l.removeItem(d)}},i=d=>(l,m,f)=>d(l,_=>{let y;try{y=JSON.parse(_||"")}catch{y=f}m(y)});let c;try{c=(n=t())==null?void 0:n.subscribe}catch{}return!c&&typeof window<"u"&&typeof window.addEventListener=="function"&&window.Storage&&(c=(d,l)=>{if(!(t()instanceof window.Storage))return()=>{};const m=f=>{f.storageArea===t()&&f.key===d&&l(f.newValue)};return window.addEventListener("storage",m),()=>{window.removeEventListener("storage",m)}}),c&&(s.subscribe=i(c)),s}iu();const Dn=new WeakMap,au=(t,e)=>(Dn.has(e)?Dn:Dn.set(e,t())).get(e),cu=t=>typeof(t==null?void 0:t.then)=="function",qr={state:"loading"};function Be(t){return au(()=>{const e=new WeakMap,n=oe(0);(lt?"production":void 0)!=="production"&&(n.debugPrivate=!0);const r=oe((o,{setSelf:s})=>{o(n);let i;try{i=o(t)}catch(m){return{state:"hasError",error:m}}if(!cu(i))return{state:"hasData",data:i};const c=i,d=e.get(c);if(d)return d;c.then(m=>{e.set(c,{state:"hasData",data:m}),s()},m=>{e.set(c,{state:"hasError",error:m}),s()});const l=e.get(c);return l||(e.set(c,qr),qr)},(o,s)=>{s(n,i=>i+1)});return(lt?"production":void 0)!=="production"&&(r.debugPrivate=!0),oe(o=>o(r))},t)}const Xr=(t,e,n)=>(e.has(n)?e:e.set(n,t())).get(n),uu=new WeakMap,du=(t,e,n)=>{const r=Xr(()=>new WeakMap,uu,e);return Xr(t,r,n)},lu=t=>typeof(t==null?void 0:t.then)=="function",fu=()=>{};function Fe(t,e=fu){return du(()=>{const n=new WeakMap,r=new WeakMap,o=oe(0);(lt?"production":void 0)!=="production"&&(o.debugPrivate=!0);const s=oe((i,{setSelf:c})=>{i(o);const d=i(s),l=i(t);if(!lu(l))return{v:l};if(l!==(d==null?void 0:d.p)&&l.then(m=>{r.set(l,m),c()},m=>{n.set(l,m),c()}),n.has(l))throw n.get(l);return r.has(l)?{p:l,v:r.get(l)}:d&&"v"in d?{p:l,f:e(d.v),v:d.v}:{p:l,f:e()}},(i,c)=>{c(o,d=>d+1)});return s.init=void 0,(lt?"production":void 0)!=="production"&&(s.debugPrivate=!0),oe(i=>{const c=i(s);return"f"in c?c.f:c.v},(i,c,...d)=>c(t,...d))},t,e)}function Un(t){if(!t)return"PUBLIC";const e="readContext"in t,{sharingType:n}=e?{sharingType:"PUBLIC"}:t.state.local,r=n==null?void 0:n.toUpperCase();return r==="PRIVATE"?"LOCAL":r}function pu(t){if(!t)return!1;const e="readContext"in t,{availableOffline:n}=e?{availableOffline:!1}:t.state.local;return n??!1}function np(t){if(t)return{id:t.header.id,name:t.state.global.name,kind:"FOLDER",parentFolder:null}}async function hu(t,e){if(!t||!e)return[];const n=await t.getDocuments(e);return await Promise.all(n.map(o=>t.getDocument(o)))}async function gu(t){if(!t)return[];const e=await t.getDrives();return await Promise.all(e.map(r=>t.getDrive(r)))}function rp(t){return t.toSorted((e,n)=>e.name.localeCompare(n.name))}function op(t){return t?t.kind.toUpperCase()==="FILE":!1}function _u(t){return t?t.kind.toUpperCase()==="FOLDER":!1}const ge="NOT_SET";function _t(){return new Promise(()=>{})}const zt=oe(ge);zt.debugLabel="baseProcessorManagerAtom";const Ho=oe(t=>t(zt)!==ge);Ho.debugLabel="processorManagerInitializedAtom";const Kt=oe(t=>{const e=t(zt);return e===ge?_t():e},(t,e,n)=>{e(zt,n)});Kt.debugLabel="processorManagerAtom";const mu=Be(Kt);mu.debugLabel="loadableProcessorManagerAtom";const vu=Fe(Kt);vu.debugLabel="unwrappedProcessorManagerAtom";const at=oe(ge);at.debugLabel="baseDrivesAtom";const Yo=oe(t=>t(at)!==ge);Yo.debugLabel="drivesInitializedAtom";const mt=oe(async t=>{const e=t(at);return e===ge?_t():e},async(t,e)=>{const n=t(at),r=window.reactor,o=await gu(r);zo(o,n)||e(at,o)});mt.debugLabel="drivesAtom";const wu=Be(mt);wu.debugLabel="loadableDrivesAtom";const Wo=Fe(mt);Wo.debugLabel="unwrappedDrivesAtom";const Ht=oe(ge);Ht.debugLabel="selectedDriveIdAtom";const qn=oe(t=>t(Ht)!==ge);qn.debugLabel="driveIdInitializedAtom";const Ye=oe(async t=>{const e=t(Ht),n=await t(mt);return e===ge?_t():n==null?void 0:n.find(o=>o.header.id===e)},(t,e,n)=>{e(Ht,n),e(ft,void 0)});Ye.debugLabel="selectedDriveAtom";const Go=Be(Ye);Go.debugLabel="loadableSelectedDriveAtom";const Ko=Fe(Ye);Ko.debugLabel="unwrappedSelectedDriveAtom";const vt=oe(async t=>{const e=await t(Ye);return e==null?void 0:e.state.global.nodes});vt.debugLabel="nodesAtom";const yu=Be(vt);yu.debugLabel="loadableNodesAtom";const Eu=Fe(vt);Eu.debugLabel="unwrappedNodesAtom";const ft=oe(ge);ft.debugLabel="selectedNodeIdAtom";const Jo=oe(t=>t(ft)!==ge);Jo.debugLabel="selectedNodeIdInitializedAtom";const wt=oe(async t=>{const e=t(ft),n=await t(vt);return e===ge?_t():n==null?void 0:n.find(r=>r.id===e)},(t,e,n)=>{e(ft,n)});wt.debugLabel="selectedNodeAtom";const Xn=oe(async t=>{const e=await t(vt),n=await t(wt),r=e==null?void 0:e.filter(_u);return r==null?void 0:r.find(o=>o.id===(n==null?void 0:n.id))});Xn.debugLabel="selectedFolderAtom";const bu=Be(Xn);bu.debugLabel="loadableSelectedFolderAtom";const Su=Fe(Xn);Su.debugLabel="unwrappedSelectedFolderAtom";const ct=oe(ge);ct.debugLabel="baseDocumentsAtom";const qo=oe(t=>t(ct)!==ge);qo.debugLabel="documentsInitializedAtom";const yt=oe(t=>{const e=t(ct);return e===ge?_t():e},async(t,e,n)=>{const r=t(ct),o=window.reactor,s=await hu(o,n);zo(s,r)||e(ct,s)});yt.debugLabel="documentsAtom";const Du=Be(yt);Du.debugLabel="loadableDocumentsAtom";const Iu=Fe(yt);Iu.debugLabel="unwrappedDocumentsAtom";const Qn=oe(async t=>{const e=await t(yt),n=await t(wt);return e==null?void 0:e.find(r=>r.header.id===(n==null?void 0:n.id))});Qn.debugLabel="selectedDocumentAtom";const Au=Be(Qn);Au.debugLabel="loadableSelectedDocumentAtom";const Nu=Fe(Qn);Nu.debugLabel="unwrappedSelectedDocumentAtom";let Mt;typeof window<"u"?window.btoa?Mt=function(t){return btoa(unescape(encodeURIComponent(t)))}:Mt=function(t){const e=unescape(encodeURIComponent(t+""));let n="";for(let r,o,s=0,i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";e.charAt(s|0)||(i="=",s%1);n+=i.charAt(63&r>>8-s%1*8)){if(o=e.charCodeAt(s+=3/4),o>255)throw new Error("'btoa' failed: The string to be encoded contains characters outside of the Latin1 range.");r=r<<8|o}return n}:Mt=function(t){return Buffer.from(t).toString("base64")};function Z(t,e){let n=Qr(t,e);return(e&&e.fallback!==void 0?e.fallback:Z.defaults.fallback)===!0&&n===""&&(n=Qr(Mt(t),e)),n}const Xo={bg:{Й:"Y",й:"y",X:"H",x:"h",Ц:"Ts",ц:"ts",Щ:"Sht",щ:"sht",Ъ:"A",ъ:"a",Ь:"Y",ь:"y"},de:{Ä:"AE",ä:"ae",Ö:"OE",ö:"oe",Ü:"UE",ü:"ue"},sr:{đ:"dj",Đ:"DJ"},uk:{И:"Y",и:"y",Й:"Y",й:"y",Ц:"Ts",ц:"ts",Х:"Kh",х:"kh",Щ:"Shch",щ:"shch",Г:"H",г:"h"}};let Zn={};function Qr(t,e){if(typeof t!="string")throw new Error("slug() requires a string argument, received "+typeof t);if(!t.isWellFormed())throw new Error("slug() received a malformed string with lone surrogates");typeof e=="string"&&(e={replacement:e}),e=e?Object.assign({},e):{},e.mode=e.mode||Z.defaults.mode;const n=Z.defaults.modes[e.mode],r=["replacement","multicharmap","charmap","remove","lower","trim"];for(let d,l=0,m=r.length;l<m;l++)d=r[l],e[d]=d in e?e[d]:n[d];const o=Xo[e.locale]||Zn;let s=[];for(const d in e.multicharmap){if(!Object.prototype.hasOwnProperty.call(e.multicharmap,d))continue;const l=d.length;s.indexOf(l)===-1&&s.push(l)}s=s.sort(function(d,l){return l-d});const i=e.mode==="rfc3986"?/[^\w\s\-.~]/:/[^A-Za-z0-9\s]/;let c="";for(let d,l=0,m=t.length;l<m;l++){d=t[l];let f=!1;for(let _=0;_<s.length;_++){const y=s[_],N=t.substr(l,y);if(e.multicharmap[N]){l+=y-1,d=e.multicharmap[N],f=!0;break}}f||(o[d]?d=o[d]:e.charmap[d]?d=e.charmap[d].replace(e.replacement," "):d.includes(e.replacement)?d=d.replace(e.replacement," "):d=d.replace(i,"")),c+=d}return e.remove&&(c=c.replace(e.remove,"")),e.trim&&(c=c.trim()),c=c.replace(/\s+/g,e.replacement),e.lower&&(c=c.toLowerCase()),c}const Qo={फ़:"Fi",ग़:"Ghi",ख़:"Khi",क़:"Qi",ड़:"ugDha",ढ़:"ugDhha",य़:"Yi",ज़:"Za",בִי:"i",בֵ:"e",בֵי:"e",בֶ:"e",בַ:"a",בָ:"a",בֹ:"o",וֹ:"o",בֻ:"u",וּ:"u",בּ:"b",כּ:"k",ךּ:"k",פּ:"p",שׁ:"sh",שׂ:"s",בְ:"e",חֱ:"e",חֲ:"a",חֳ:"o",בִ:"i"},Zo={À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",Æ:"AE",Ç:"C",È:"E",É:"E",Ê:"E",Ë:"E",Ì:"I",Í:"I",Î:"I",Ï:"I",Ð:"D",Ñ:"N",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ő:"O",Ø:"O",Ō:"O",Ù:"U",Ú:"U",Û:"U",Ü:"U",Ű:"U",Ý:"Y",Þ:"TH",ß:"ss",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",æ:"ae",ç:"c",è:"e",é:"e",ê:"e",ë:"e",ì:"i",í:"i",î:"i",ï:"i",ð:"d",ñ:"n",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ő:"o",ø:"o",ō:"o",Œ:"OE",œ:"oe",ù:"u",ú:"u",û:"u",ü:"u",ű:"u",ý:"y",þ:"th",ÿ:"y","ẞ":"SS",α:"a",β:"b",γ:"g",δ:"d",ε:"e",ζ:"z",η:"h",θ:"th",ι:"i",κ:"k",λ:"l",μ:"m",ν:"n",ξ:"3",ο:"o",π:"p",ρ:"r",σ:"s",τ:"t",υ:"y",φ:"f",χ:"x",ψ:"ps",ω:"w",ά:"a",έ:"e",ί:"i",ό:"o",ύ:"y",ή:"h",ώ:"w",ς:"s",ϊ:"i",ΰ:"y",ϋ:"y",ΐ:"i",Α:"A",Β:"B",Γ:"G",Δ:"D",Ε:"E",Ζ:"Z",Η:"H",Θ:"Th",Ι:"I",Κ:"K",Λ:"L",Μ:"M",Ν:"N",Ξ:"3",Ο:"O",Π:"P",Ρ:"R",Σ:"S",Τ:"T",Υ:"Y",Φ:"F",Χ:"X",Ψ:"PS",Ω:"W",Ά:"A",Έ:"E",Ί:"I",Ό:"O",Ύ:"Y",Ή:"H",Ώ:"W",Ϊ:"I",Ϋ:"Y",ş:"s",Ş:"S",ı:"i",İ:"I",ğ:"g",Ğ:"G",а:"a",б:"b",в:"v",г:"g",д:"d",е:"e",ё:"yo",ж:"zh",з:"z",и:"i",й:"j",к:"k",л:"l",м:"m",н:"n",о:"o",п:"p",р:"r",с:"s",т:"t",у:"u",ф:"f",х:"h",ц:"c",ч:"ch",ш:"sh",щ:"sh",ъ:"u",ы:"y",ь:"",э:"e",ю:"yu",я:"ya",А:"A",Б:"B",В:"V",Г:"G",Д:"D",Е:"E",Ё:"Yo",Ж:"Zh",З:"Z",И:"I",Й:"J",К:"K",Л:"L",М:"M",Н:"N",О:"O",П:"P",Р:"R",С:"S",Т:"T",У:"U",Ф:"F",Х:"H",Ц:"C",Ч:"Ch",Ш:"Sh",Щ:"Sh",Ъ:"U",Ы:"Y",Ь:"",Э:"E",Ю:"Yu",Я:"Ya",Є:"Ye",І:"I",Ї:"Yi",Ґ:"G",є:"ye",і:"i",ї:"yi",ґ:"g",č:"c",ď:"d",ě:"e",ň:"n",ř:"r",š:"s",ť:"t",ů:"u",ž:"z",Č:"C",Ď:"D",Ě:"E",Ň:"N",Ř:"R",Š:"S",Ť:"T",Ů:"U",Ž:"Z",ľ:"l",ĺ:"l",ŕ:"r",Ľ:"L",Ĺ:"L",Ŕ:"R",ą:"a",ć:"c",ę:"e",ł:"l",ń:"n",ś:"s",ź:"z",ż:"z",Ą:"A",Ć:"C",Ę:"E",Ł:"L",Ń:"N",Ś:"S",Ź:"Z",Ż:"Z",ā:"a",ē:"e",ģ:"g",ī:"i",ķ:"k",ļ:"l",ņ:"n",ū:"u",Ā:"A",Ē:"E",Ģ:"G",Ī:"I",Ķ:"K",Ļ:"L",Ņ:"N",Ū:"U",أ:"a",إ:"i",ب:"b",ت:"t",ث:"th",ج:"g",ح:"h",خ:"kh",د:"d",ذ:"th",ر:"r",ز:"z",س:"s",ش:"sh",ص:"s",ض:"d",ط:"t",ظ:"th",ع:"aa",غ:"gh",ف:"f",ق:"k",ك:"k",ل:"l",م:"m",ن:"n",ه:"h",و:"o",ي:"y",ء:"aa",ة:"a",آ:"a",ا:"a",پ:"p",ژ:"zh",گ:"g",چ:"ch",ک:"k",ی:"i",ė:"e",į:"i",ų:"u",Ė:"E",Į:"I",Ų:"U",ț:"t",Ț:"T",ţ:"t",Ţ:"T",ș:"s",Ș:"S",ă:"a",Ă:"A",Ạ:"A",Ả:"A",Ầ:"A",Ấ:"A",Ậ:"A",Ẩ:"A",Ẫ:"A",Ằ:"A",Ắ:"A",Ặ:"A",Ẳ:"A",Ẵ:"A",Ẹ:"E",Ẻ:"E",Ẽ:"E",Ề:"E",Ế:"E",Ệ:"E",Ể:"E",Ễ:"E",Ị:"I",Ỉ:"I",Ĩ:"I",Ọ:"O",Ỏ:"O",Ồ:"O",Ố:"O",Ộ:"O",Ổ:"O",Ỗ:"O",Ơ:"O",Ờ:"O",Ớ:"O",Ợ:"O",Ở:"O",Ỡ:"O",Ụ:"U",Ủ:"U",Ũ:"U",Ư:"U",Ừ:"U",Ứ:"U",Ự:"U",Ử:"U",Ữ:"U",Ỳ:"Y",Ỵ:"Y",Ỷ:"Y",Ỹ:"Y",Đ:"D",ạ:"a",ả:"a",ầ:"a",ấ:"a",ậ:"a",ẩ:"a",ẫ:"a",ằ:"a",ắ:"a",ặ:"a",ẳ:"a",ẵ:"a",ẹ:"e",ẻ:"e",ẽ:"e",ề:"e",ế:"e",ệ:"e",ể:"e",ễ:"e",ị:"i",ỉ:"i",ĩ:"i",ọ:"o",ỏ:"o",ồ:"o",ố:"o",ộ:"o",ổ:"o",ỗ:"o",ơ:"o",ờ:"o",ớ:"o",ợ:"o",ở:"o",ỡ:"o",ụ:"u",ủ:"u",ũ:"u",ư:"u",ừ:"u",ứ:"u",ự:"u",ử:"u",ữ:"u",ỳ:"y",ỵ:"y",ỷ:"y",ỹ:"y",đ:"d",Ә:"AE",ә:"ae",Ғ:"GH",ғ:"gh",Қ:"KH",қ:"kh",Ң:"NG",ң:"ng",Ү:"UE",ү:"ue",Ұ:"U",ұ:"u",Һ:"H",һ:"h",Ө:"OE",ө:"oe",ђ:"dj",ј:"j",љ:"lj",њ:"nj",ћ:"c",џ:"dz",Ђ:"Dj",Ј:"j",Љ:"Lj",Њ:"Nj",Ћ:"C",Џ:"Dz",nj:"nj",lj:"lj",Nj:"NJ",Lj:"LJ",अ:"a",आ:"aa",ए:"e",ई:"ii",ऍ:"ei",ऎ:"ae",ऐ:"ai",इ:"i",ओ:"o",ऑ:"oi",ऒ:"oii",ऊ:"uu",औ:"ou",उ:"u",ब:"B",भ:"Bha",च:"Ca",छ:"Chha",ड:"Da",ढ:"Dha",फ:"Fa",ग:"Ga",घ:"Gha",ग़:"Ghi",ह:"Ha",ज:"Ja",झ:"Jha",क:"Ka",ख:"Kha",ख़:"Khi",ल:"L",ळ:"Li",ऌ:"Li",ऴ:"Lii",ॡ:"Lii",म:"Ma",न:"Na",ङ:"Na",ञ:"Nia",ण:"Nae",ऩ:"Ni",ॐ:"oms",प:"Pa",क़:"Qi",र:"Ra",ऋ:"Ri",ॠ:"Ri",ऱ:"Ri",स:"Sa",श:"Sha",ष:"Shha",ट:"Ta",त:"Ta",ठ:"Tha",द:"Tha",थ:"Tha",ध:"Thha",ड़:"ugDha",ढ़:"ugDhha",व:"Va",य:"Ya",य़:"Yi",ज़:"Za",ə:"e",Ə:"E",ა:"a",ბ:"b",გ:"g",დ:"d",ე:"e",ვ:"v",ზ:"z",თ:"t",ი:"i",კ:"k",ლ:"l",მ:"m",ნ:"n",ო:"o",პ:"p",ჟ:"zh",რ:"r",ს:"s",ტ:"t",უ:"u",ფ:"p",ქ:"k",ღ:"gh",ყ:"q",შ:"sh",ჩ:"ch",ც:"ts",ძ:"dz",წ:"ts",ჭ:"ch",ხ:"kh",ჯ:"j",ჰ:"h",ב:"v",גּ:"g",ג:"g",ד:"d",דּ:"d",ה:"h",ו:"v",ז:"z",ח:"h",ט:"t",י:"y",כ:"kh",ך:"kh",ל:"l",מ:"m",ם:"m",נ:"n",ן:"n",ס:"s",פ:"f",ף:"f",ץ:"ts",צ:"ts",ק:"k",ר:"r",תּ:"t",ת:"t"};Z.charmap=Object.assign({},Zo);Z.multicharmap=Object.assign({},Qo);Z.defaults={charmap:Z.charmap,mode:"pretty",modes:{rfc3986:{replacement:"-",remove:null,lower:!0,charmap:Z.charmap,multicharmap:Z.multicharmap,trim:!0},pretty:{replacement:"-",remove:null,lower:!0,charmap:Z.charmap,multicharmap:Z.multicharmap,trim:!0}},multicharmap:Z.multicharmap,fallback:!0};Z.reset=function(){Z.defaults.modes.rfc3986.charmap=Z.defaults.modes.pretty.charmap=Z.charmap=Z.defaults.charmap=Object.assign({},Zo),Z.defaults.modes.rfc3986.multicharmap=Z.defaults.modes.pretty.multicharmap=Z.multicharmap=Z.defaults.multicharmap=Object.assign({},Qo),Zn=""};Z.extend=function(t){const e=Object.keys(t),n={},r={};for(let o=0;o<e.length;o++)e[o].length>1?n[e[o]]=t[e[o]]:r[e[o]]=t[e[o]];Object.assign(Z.charmap,r),Object.assign(Z.multicharmap,n)};Z.setLocale=function(t){Zn=Xo[t]||{}};function Tu(t){return t?`/d/${Z(t.header.slug)}`:""}function Ou(t){if(!t)return"";const e=t.name;return Z(e?`${e}-${t.id}`:t.id)}function Cu(t){const e=/^\/d\/[^/]+\/([^/]+)$/.exec(t);return e?e[1]:void 0}function Lu(t){if(!t)return;const n=/\b[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}\b/.exec(t);return n?n[0]:void 0}function Ru(t){const e=Cu(t),n=Lu(e);return n||e}function es(t){const e=/^\/d\/([^/]+)/.exec(t);return e?e[1]:null}function Pu(t){return t.replaceAll(/\s/g,"-")}function xu(t){const e=new CustomEvent("ph:setDrive",{detail:{driveId:t}});window.dispatchEvent(e)}function Mu(t,e){const n=t.detail.driveId;if(e(n),typeof window>"u")return;if(!n){window.history.pushState(null,"","/");return}const r=window.reactor;r&&r.getDrive(n).then(o=>{const s=Tu(o);window.history.pushState(null,"",s)}).catch(o=>te.error(o))}function sp(t){const e=new CustomEvent("ph:setNode",{detail:{nodeId:t}});window.dispatchEvent(e)}function $u(t,e){const n=t.detail.nodeId;if(e(n),typeof window>"u")return;const r=window.reactor;if(!r)return;const o=es(window.location.pathname);if(o){if(!n){window.history.pushState(null,"",`/d/${o}`);return}r.getDriveBySlug(o).then(s=>{const c=s.state.global.nodes.find(l=>l.id===n),d=Ou(c);window.history.pushState(null,"",`/d/${o}/${d}`)}).catch(s=>te.error(s))}}function Et(){return De(Wo)}function Jt(t){const e=Et();if(t)return e==null?void 0:e.find(n=>n.header.id===t)}function ts(){return De(Ko)}function ip(){return De(Go)}function ap(){return J(t=>{xu(t)},[])}function ns(){const t=ts();return t==null?void 0:t.header.id}function Uu(t){const e=Jt(t),n=ku(t);if(e){if("remoteUrl"in e.state.global){const r=e.state.global.remoteUrl;if(typeof r=="string")return r}return n}}function rs(t){const e=Jt(t);return e==null?void 0:e.state.local.triggers.find(r=>r.type==="PullResponder")}function ku(t){var n;const e=rs(t);return(n=e==null?void 0:e.data)==null?void 0:n.url}function cp(t){const e=Uu(t),n=rs(t);return e!==void 0||n!==void 0}function up(t){const e=Jt(t);if(e)return Un(e)}function dp(t){const e=Jt(t);return e?pu(e):!1}function We(){return window.reactor}const er={32:16777619n,64:1099511628211n,128:309485009821345068724781371n,256:374144419156711147060143317175368453031918731002211n,512:35835915874844867368919076489095108449946327955754392558399825615420669938882575126094039892345713852759n,1024:5016456510113118655434598811035278955030765345404790744303017523831112055108147451509157692220295382716162651878526895249385292291816524375083746691371804094271873160484737966720260389217684476157468082573n},os={32:2166136261n,64:14695981039346656037n,128:144066263297769815596495629667062367629n,256:100029257958052580907070968620625704837092796014241193945225284501741471925557n,512:9659303129496669498009435400716310466090418745672637896108374329434462657994582932197716438449813051892206539805784495328239340083876191928701583869517785n,1024:14197795064947621068722070641403218320880622795441933960878474914617582723252296732303717722150864096521202355549365628174669108571814760471015076148029755969804077320157692458563003215304957150157403644460363550505412711285966361610267868082893823963790439336411086884584107735010676915n},ss=new globalThis.TextEncoder;function Bu(t,e){const n=er[e];let r=os[e];for(let o=0;o<t.length;o++)r^=BigInt(t[o]),r=BigInt.asUintN(e,r*n);return r}function Fu(t,e,n){if(n.length===0)throw new Error("The `utf8Buffer` option must have a length greater than zero");const r=er[e];let o=os[e],s=t;for(;s.length>0;){const i=ss.encodeInto(s,n);s=s.slice(i.read);for(let c=0;c<i.written;c++)o^=BigInt(n[c]),o=BigInt.asUintN(e,o*r)}return o}function Vu(t,{size:e=32,utf8Buffer:n}={}){if(!er[e])throw new Error("The `size` option must be one of 32, 64, 128, 256, 512, or 1024");if(typeof t=="string"){if(n)return Fu(t,e,n);t=ss.encode(t)}return Bu(t,e)}const ju=[32,64,128,256,512,1024],zu=Math.log2(26);function is(t,e=10,n="fnv1a"){if(n==="fnv1a"){const r=Math.ceil(e*zu),o=ju.find(i=>i&&i>=r)??1024,s=Vu(t,{size:o});return Hu(s,e)}else throw new Error(`Unsupported hashing algorithm: ${n}`)}function Hu(t,e=10){const n="abcdefghijklmnopqrstuvwxyz";let r="";for(;t>0n&&r.length<e;)r=n[Number(t%26n)]+r,t/=26n;return r.padStart(e,"a")}function lp(t,e){const n=t;return n.createNamespace=(r,o)=>Yu(t,r,o??e),n.queryNamespace=(r,o)=>Wu(t,r,o??e),n}async function Yu(t,e,n){const o=(n==null?void 0:n.hashNamespace)??!0?is(e):e;return await t.schema.createSchema(o).ifNotExists().execute(),t.withSchema(o)}function Wu(t,e,n){const o=(n==null?void 0:n.hashNamespace)??!0?is(e):e,s=t.withSchema(o);return tr(s)}function tr(t){return{selectFrom:t.selectFrom.bind(t),selectNoFrom:t.selectNoFrom.bind(t),with:t.with.bind(t),withRecursive:t.withRecursive.bind(t),withSchema:e=>tr(t.withSchema(e))}}function Zr(t){return as.is(t)}const eo=Symbol.for("ph.IS_RELATIONAL_DB_PROCESSOR");var To;To=eo;class as{constructor(e,n,r){fe(this,"_namespace");fe(this,"_filter");fe(this,"relationalDb");this._namespace=e,this._filter=n,this.relationalDb=r}static is(e){var r;let n=Object.getPrototypeOf(e);for(;n;){if((r=n.constructor)!=null&&r[eo])return!0;n=Object.getPrototypeOf(n)}return!1}static getNamespace(e){return`${this.name}_${e.replaceAll("-","_")}`}static query(e,n){return n.queryNamespace(this.getNamespace(e))}get filter(){return this._filter}get namespace(){return this._namespace}get query(){return tr(this.relationalDb)}}fe(as,To,!0);class Gu{constructor(e,n){fe(this,"listeners");fe(this,"drive");fe(this,"logger",Hn(["document-drive","processor-manager"]));fe(this,"processorsByDrive",new Map);fe(this,"idToFactory",new Map);fe(this,"identifierToListeners",new Map);this.listeners=e,this.drive=n}async registerFactory(e,n){this.logger.debug(`Registering factory '${e}'.`),this.idToFactory.set(e,n);const r=await this.drive.getDrives();for(const o of r)await this.createProcessors(o,e,n)}async unregisterFactory(e){var r;const n=this.identifierToListeners.get(e)??[];for(const o of n)await this.listeners.removeListener(o.driveId,o.listenerId).catch(this.logger.error),(r=o.transmitter)!=null&&r.disconnect&&await o.transmitter.disconnect();this.identifierToListeners.set(e,[])}async registerDrive(e){this.logger.debug(`Registering drive '${e}'.`);for(const[n,r]of this.idToFactory)await this.createProcessors(e,n,r)}async createProcessors(e,n,r){let o=this.identifierToListeners.get(n);o||(o=[],this.identifierToListeners.set(n,o));let s=this.processorsByDrive.get(e);s||(s=[],this.processorsByDrive.set(e,s));let i=[];try{i=await r(e)}catch(c){this.logger.error(`Error creating processors for drive ${e}:`,c);return}for(const{filter:c,processor:d}of i){const l=Zr(d);if(l&&s.some(_=>Zr(_.processor)&&_.processor.namespace===d.namespace)){this.logger.warn(`Processor with namespace '${d.namespace}' already registered for drive '${e}'.`);continue}l&&await d.initAndUpgrade();const m=Le(),f={driveId:e,listenerId:m,block:!1,system:!1,filter:c,callInfo:void 0,transmitter:new Wi(this.drive,d)};await this.listeners.setListener(e,f),o.push(f),s.push({filter:c,processor:d})}}}function Ku(){const t=We(),e=De(Ho),n=Ue(Kt);ce(()=>{if(e||!t)return;const r=new Gu(t.listeners,t);t.on("driveAdded",async o=>{await r.registerDrive(o.header.id)}),n(r)},[e,t,n])}function cs(){return Ue(yt)}function Ju(){const t=ns(),e=cs();return J(()=>{e(t).catch(n=>te.error(n))},[e,t])}function us(){return Ue(mt)}function qu(){const t=us();return J(()=>{t().catch(e=>te.error(e))},[t])}function Xu(t){const[e,n]=He(!!window.reactor),r=De(Yo),o=De(qn),s=ns(),i=De(qo),c=us(),d=cs();ce(()=>{if(e)return;async function l(){const m=await(t==null?void 0:t());window.reactor=m,n(!0)}l().catch(te.error)},[t,e]),ce(()=>{if(!e||r)return;async function l(){await c()}l().catch(te.error)},[e,c,r]),ce(()=>{if(!e||!o||i)return;async function l(){await d(s)}l().catch(te.error)},[e,i,o,s,d])}function Qu(){const t=Ue(Ye),e=Ue(wt),n=J(o=>{Mu(o,t)},[t]),r=J(o=>{$u(o,e)},[e]);ce(()=>{if(!(typeof window>"u"))return window.addEventListener("ph:setDrive",n),()=>{window.removeEventListener("ph:setDrive",n)}},[n]),ce(()=>{if(!(typeof window>"u"))return window.addEventListener("ph:setNode",r),()=>{window.removeEventListener("ph:setNode",r)}},[r])}function Zu(){const t=qu(),e=Ju(),n=We();ce(()=>{if(!n)return;const r=[n.on("syncStatus",(...o)=>{te.verbose("syncStatus",...o),t(),e()}),n.on("strandUpdate",(...o)=>{te.verbose("strandUpdate",...o),t(),e()}),n.on("defaultRemoteDrive",(...o)=>{te.verbose("defaultRemoteDrive",...o),t(),e()}),n.on("clientStrandsError",(...o)=>{te.verbose("clientStrandsError",...o),t(),e()}),n.on("driveAdded",(...o)=>{te.verbose("driveAdded",...o),t(),e()}),n.on("driveDeleted",(...o)=>{te.verbose("driveDeleted",...o),t(),e()}),n.on("documentModelModules",(...o)=>{te.verbose("documentModelModules",...o),t(),e()}),n.on("documentOperationsAdded",(...o)=>{te.verbose("documentOperationsAdded",...o),t(),e()}),n.on("driveOperationsAdded",(...o)=>{console.log("driveOperationsAdded",...o),te.verbose("driveOperationsAdded",...o),t(),e()}),n.on("operationsAdded",(...o)=>{console.log("operationsAdded",...o),te.verbose("operationsAdded",...o),t(),e()})];return()=>{r.forEach(o=>o())}},[t,e,n])}function ed(){const t=Ue(Ye),e=Ue(wt),n=De(qn),r=De(Jo),o=We();ce(()=>{async function s(){if(typeof window>"u"||!o||n)return;const i=window.location.pathname,c=await td(o,i,t);c&&(r||nd(c,i,e))}s().catch(te.error)},[o,n,r,t,e])}async function td(t,e,n){const r=es(e),o=await t.getDrives(),i=(await Promise.all(o.map(c=>t.getDrive(c)))).find(c=>c.header.slug===r||c.header.id===r);return n(i==null?void 0:i.header.id),i}function nd(t,e,n){const r=Ru(e),o=t==null?void 0:t.state.global.nodes,s=o==null?void 0:o.find(i=>i.id===r||Pu(i.name)===r);n(s==null?void 0:s.id)}function rd(t){Xu(t),Zu(),Qu(),Ku(),ed()}const it=Hn(["utils/document-model",Math.floor(Math.random()*999).toString()]),od=parseInt(window.__VITE_ENVS.FILE_UPLOAD_OPERATIONS_CHUNK_SIZE||"50");function fp(t,e,n=it.error){const[r,o]=He(e),[s,i]=He(),c=l=>{i(l),n(l)};return ce(()=>{o(e),i(void 0)},[e]),[r,(l,m,f)=>{i(void 0),o(_=>{if(!t||!_)return _;try{const y=t(_,l),N=l.scope??"global",F=y.operations[N],P=F[F.length-1];if(P.error){const V=new Error(P.error);c(V),f==null||f(V)}return m==null||m(P,{prevState:{..._},newState:{...y}}),y}catch(y){return c(y),f==null||f(y),_}})},s]}async function sd(t,e,n,r){const o=(r==null?void 0:r.operationsLimit)||od;it.verbose(`uploadDocumentOperations(documentId:${t}, ops: ${Object.keys(e.operations).join(",")}, limit:${o})`);for(const s of Object.values(e.operations))for(let i=0;i<s.length;i+=o){it.verbose(`uploadDocumentOperations:for(i:${i}, ops:${s.length}, limit:${o}): START`);const c=s.slice(i,i+o),d=c.at(-1);if(!d)break;const{scope:l}=d.action;await n(t,c),it.verbose(`uploadDocumentOperations:for:waitForUpdate(${t}:${l} rev ${d.index}): NEXT`)}it.verbose(`uploadDocumentOperations:for:waitForUpdate(${t}): END`)}const id=async t=>{Ji(t).generateAsync({type:"blob"}).then(n=>{const r=window.document.createElement("a");r.style.display="none",r.href=URL.createObjectURL(n),r.download=`${t.header.name||"Untitled"}.zip`,window.document.body.appendChild(r),r.click(),window.document.body.removeChild(r)}).catch(te.error)};async function pp(t,e){var o,s;const n=e(t.header.documentType);if(!n)throw new Error(`Document model not supported: ${t.header.documentType}`);const r=n.documentModel.extension;if(!window.showSaveFilePicker){await id(t);return}try{const i=await window.showSaveFilePicker({suggestedName:`${t.name||((o=t.state.global)==null?void 0:o.name)||"Untitled"}.${r?`${r}.`:""}zip`});await Ki(t,i);const c=(await i.getFile()).path;return typeof window<"u"&&((s=window.electronAPI)==null||s.fileSaved(t,c)),c}catch(i){if(!(i instanceof DOMException&&i.name==="AbortError"))throw i}}async function ad(t,e){const n=await Gi(t,o=>o,{checkHashes:!0}),r=e(n.header.documentType);if(!r)throw new Error(`Document "${n.header.documentType}" is not supported`);return r.utils.loadFromInput(t)}function to(t){let e=!1;const n=Object.entries(t.operations).reduce((r,[o,s])=>{const i=o;for(const c of s){const d=cd(c);r[i].push(d),d!==c&&(e=!0)}return r},{global:[],local:[]});return e?{...t,operations:n}:t}function cd(t){var s,i,c;let e=!1,n={...t};const r=(s=t.context)==null?void 0:s.signer,o=(c=(i=t.action)==null?void 0:i.context)==null?void 0:c.signer;if(r){if("signature"in r){const d=r.signature;n={...n,context:{...n.context,signer:{user:r.user,app:r.app,signatures:d!=null&&d.length?[d]:[]}}},e=!0}else if(r.signatures){const d=r.signatures.filter(l=>l&&l.length>0);d.length!==r.signatures.length&&(n={...n,context:{...n.context,signer:{...r,signatures:d}}},e=!0)}}if(o){if("signature"in o){const d=o.signature,l={...n.action.context,signer:{user:o.user,app:o.app,signatures:d!=null&&d.length?[d]:[]}};n={...n,action:{...n.action,context:l},context:l},e=!0}else if(o.signatures){const d=o.signatures.filter(l=>l&&l.length>0);if(d.length!==o.signatures.length){const l={...n.action.context,signer:{...o,signatures:d}};n={...n,action:{...n.action,context:l},context:l},e=!0}}}return e?n:t}var In={exports:{}};/*!
3
3
  localForage -- Offline Storage, Improved
4
4
  Version 1.10.0
5
5
  https://localforage.github.io/localForage
@@ -8,7 +8,7 @@ var Bi=Object.defineProperty;var Fi=(t,e,n)=>e in t?Bi(t,e,{enumerable:!0,config
8
8
  `);for(let i=r;i<s.length;i++){const c=s[i];if(c.length>1024)continue;const d=lo.test(c)?c.replace(lo,"$1"):c;if(!d.match(/\S*Error: /)){for(const l of e){const m=l(d);if(m){o.push(m);break}}if(o.length>=_s)break}}return Pd(o)}}function Op(t){return Array.isArray(t)?Rd(...t):t}function Pd(t){if(!t.length)return[];const e=Array.from(t);return/sentryWrapped/.test(e[e.length-1].function||"")&&e.pop(),e.reverse(),fo.test(e[e.length-1].function||"")&&(e.pop(),fo.test(e[e.length-1].function||"")&&e.pop()),e.slice(0,_s).map(n=>({...n,filename:n.filename||e[e.length-1].filename,function:n.function||"?"}))}const Tn="<anonymous>";function xd(t){try{return!t||typeof t!="function"?Tn:t.name||Tn}catch{return Tn}}function ie(){const t=_e,e=t.crypto||t.msCrypto;let n=()=>Math.random()*16;try{if(e&&e.randomUUID)return e.randomUUID().replace(/-/g,"");e&&e.getRandomValues&&(n=()=>{const r=new Uint8Array(1);return e.getRandomValues(r),r[0]})}catch{}return("10000000100040008000"+1e11).replace(/[018]/g,r=>(r^(n()&15)>>r/4).toString(16))}function ms(t){return t.exception&&t.exception.values?t.exception.values[0]:void 0}function Cp(t){const{message:e,event_id:n}=t;if(e)return e;const r=ms(t);return r?r.type&&r.value?`${r.type}: ${r.value}`:r.type||r.value||n||"<unknown>":n||"<unknown>"}function Lp(t,e,n){const r=t.exception=t.exception||{},o=r.values=r.values||[],s=o[0]=o[0]||{};s.value||(s.value=e||""),s.type||(s.type="Error")}function Md(t,e){const n=ms(t);if(!n)return;const r={type:"generic",handled:!0},o=n.mechanism;if(n.mechanism={...r,...o,...e},e&&"data"in e){const s={...o&&o.data,...e.data};n.mechanism.data=s}}function Rp(t,e,n=5){if(e.lineno===void 0)return;const r=t.length,o=Math.max(Math.min(r-1,e.lineno-1),0);e.pre_context=t.slice(Math.max(0,o-n),o).map(s=>Nn(s,0)),e.context_line=Nn(t[Math.min(r-1,o)],e.colno||0),e.post_context=t.slice(Math.min(o+1,r),o+1+n).map(s=>Nn(s,0))}function Pp(t){if(t&&t.__sentry_captured__)return!0;try{hs(t,"__sentry_captured__",!0)}catch{}return!1}function $d(t){return Array.isArray(t)?t:[t]}function Ud(){const t=typeof WeakSet=="function",e=t?new WeakSet:[];function n(o){if(t)return e.has(o)?!0:(e.add(o),!1);for(let s=0;s<e.length;s++)if(e[s]===o)return!0;return e.push(o),!1}function r(o){if(t)e.delete(o);else for(let s=0;s<e.length;s++)if(e[s]===o){e.splice(s,1);break}}return[n,r]}function Ce(t,e=100,n=1/0){try{return Fn("",t,e,n)}catch(r){return{ERROR:`**non-serializable** (${r})`}}}function kd(t,e=3,n=100*1024){const r=Ce(t,e);return jd(r)>n?kd(t,e-1,n):r}function Fn(t,e,n=1/0,r=1/0,o=Ud()){const[s,i]=o;if(e==null||["number","boolean","string"].includes(typeof e)&&!bd(e))return e;const c=Bd(t,e);if(!c.startsWith("[object "))return c;if(e.__sentry_skip_normalization__)return e;const d=typeof e.__sentry_override_normalization_depth__=="number"?e.__sentry_override_normalization_depth__:n;if(d===0)return c.replace("object ","");if(s(e))return"[Circular ~]";const l=e;if(l&&typeof l.toJSON=="function")try{const y=l.toJSON();return Fn("",y,d-1,r,o)}catch{}const m=Array.isArray(e)?[]:{};let f=0;const _=gs(e);for(const y in _){if(!Object.prototype.hasOwnProperty.call(_,y))continue;if(f>=r){m[y]="[MaxProperties ~]";break}const N=_[y];m[y]=Fn(y,N,d-1,r,o),f++}return i(e),m}function Bd(t,e){try{if(t==="domain"&&e&&typeof e=="object"&&e._events)return"[Domain]";if(t==="domainEmitter")return"[DomainEmitter]";if(typeof global<"u"&&e===global)return"[Global]";if(typeof window<"u"&&e===window)return"[Window]";if(typeof document<"u"&&e===document)return"[Document]";if(ls(e))return"[VueViewModel]";if(Ed(e))return"[SyntheticEvent]";if(typeof e=="number"&&e!==e)return"[NaN]";if(typeof e=="function")return`[Function: ${xd(e)}]`;if(typeof e=="symbol")return`[${String(e)}]`;if(typeof e=="bigint")return`[BigInt: ${String(e)}]`;const n=Fd(e);return/^HTML(\w*)Element$/.test(n)?`[HTMLElement: ${n}]`:`[object ${n}]`}catch(n){return`**non-serializable** (${n})`}}function Fd(t){const e=Object.getPrototypeOf(t);return e?e.constructor.name:"null prototype"}function Vd(t){return~-encodeURI(t).split(/%..|./).length}function jd(t){return Vd(JSON.stringify(t))}var Se;(function(t){t[t.PENDING=0]="PENDING";const n=1;t[t.RESOLVED=n]="RESOLVED";const r=2;t[t.REJECTED=r]="REJECTED"})(Se||(Se={}));function xp(t){return new Ee(e=>{e(t)})}function Mp(t){return new Ee((e,n)=>{n(t)})}class Ee{constructor(e){Ee.prototype.__init.call(this),Ee.prototype.__init2.call(this),Ee.prototype.__init3.call(this),Ee.prototype.__init4.call(this),this._state=Se.PENDING,this._handlers=[];try{e(this._resolve,this._reject)}catch(n){this._reject(n)}}then(e,n){return new Ee((r,o)=>{this._handlers.push([!1,s=>{if(!e)r(s);else try{r(e(s))}catch(i){o(i)}},s=>{if(!n)o(s);else try{r(n(s))}catch(i){o(i)}}]),this._executeHandlers()})}catch(e){return this.then(n=>n,e)}finally(e){return new Ee((n,r)=>{let o,s;return this.then(i=>{s=!1,o=i,e&&e()},i=>{s=!0,o=i,e&&e()}).then(()=>{if(s){r(o);return}n(o)})})}__init(){this._resolve=e=>{this._setResult(Se.RESOLVED,e)}}__init2(){this._reject=e=>{this._setResult(Se.REJECTED,e)}}__init3(){this._setResult=(e,n)=>{if(this._state===Se.PENDING){if(rr(n)){n.then(this._resolve,this._reject);return}this._state=e,this._value=n,this._executeHandlers()}}}__init4(){this._executeHandlers=()=>{if(this._state===Se.PENDING)return;const e=this._handlers.slice();this._handlers=[],e.forEach(n=>{n[0]||(this._state===Se.RESOLVED&&n[1](this._value),this._state===Se.REJECTED&&n[2](this._value),n[0]=!0)})}}}const vs=1e3;function Qt(){return Date.now()/vs}function zd(){const{performance:t}=_e;if(!t||!t.now)return Qt;const e=Date.now()-t.now(),n=t.timeOrigin==null?e:t.timeOrigin;return()=>(n+t.now())/vs}const sr=zd(),$p=(()=>{const{performance:t}=_e;if(!t||!t.now)return;const e=3600*1e3,n=t.now(),r=Date.now(),o=t.timeOrigin?Math.abs(t.timeOrigin+n-r):e,s=o<e,i=t.timing&&t.timing.navigationStart,d=typeof i=="number"?Math.abs(i+n-r):e,l=d<e;return s||l?o<=d?t.timeOrigin:i:r})(),Up="baggage",ws="sentry-",Hd=/^sentry-/,Yd=8192;function ys(t){if(!Yt(t)&&!Array.isArray(t))return;let e={};if(Array.isArray(t))e=t.reduce((r,o)=>{const s=po(o);for(const i of Object.keys(s))r[i]=s[i];return r},{});else{if(!t)return;e=po(t)}const n=Object.entries(e).reduce((r,[o,s])=>{if(o.match(Hd)){const i=o.slice(ws.length);r[i]=s}return r},{});if(Object.keys(n).length>0)return n}function kp(t){if(!t)return;const e=Object.entries(t).reduce((n,[r,o])=>(o&&(n[`${ws}${r}`]=o),n),{});return Wd(e)}function po(t){return t.split(",").map(e=>e.split("=").map(n=>decodeURIComponent(n.trim()))).reduce((e,[n,r])=>(e[n]=r,e),{})}function Wd(t){if(Object.keys(t).length!==0)return Object.entries(t).reduce((e,[n,r],o)=>{const s=`${encodeURIComponent(n)}=${encodeURIComponent(r)}`,i=o===0?s:`${e},${s}`;return i.length>Yd?(or&&we.warn(`Not adding key: ${n} with val: ${r} to baggage header due to exceeding baggage size limits.`),e):i},"")}const Gd=new RegExp("^[ \\t]*([0-9a-f]{32})?-?([0-9a-f]{16})?-?([01])?[ \\t]*$");function Es(t){if(!t)return;const e=t.match(Gd);if(!e)return;let n;return e[3]==="1"?n=!0:e[3]==="0"&&(n=!1),{traceId:e[1],parentSampled:n,parentSpanId:e[2]}}function Bp(t,e){const n=Es(t),r=ys(e),{traceId:o,parentSpanId:s,parentSampled:i}=n||{};return n?{traceparentData:n,dynamicSamplingContext:r||{},propagationContext:{traceId:o||ie(),parentSpanId:s||ie().substring(16),spanId:ie().substring(16),sampled:i,dsc:r||{}}}:{traceparentData:n,dynamicSamplingContext:void 0,propagationContext:{traceId:o||ie(),spanId:ie().substring(16)}}}function Fp(t,e){const n=Es(t),r=ys(e),{traceId:o,parentSpanId:s,parentSampled:i}=n||{};return n?{traceId:o||ie(),parentSpanId:s||ie().substring(16),spanId:ie().substring(16),sampled:i,dsc:r||{}}:{traceId:o||ie(),spanId:ie().substring(16)}}function Kd(t=ie(),e=ie().substring(16),n){let r="";return n!==void 0&&(r=n?"-1":"-0"),`${t}-${e}${r}`}const ze=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,Zt="production";function ir(){return fs("globalEventProcessors",()=>[])}function Vp(t){ir().push(t)}function Wt(t,e,n,r=0){return new Ee((o,s)=>{const i=t[r];if(e===null||typeof i!="function")o(e);else{const c=i({...e},n);ze&&i.id&&c===null&&we.log(`Event processor "${i.id}" dropped event`),rr(c)?c.then(d=>Wt(t,d,n,r+1).then(o)).then(null,s):Wt(t,c,n,r+1).then(o).then(null,s)}})}function bs(t){const e=sr(),n={sid:ie(),init:!0,timestamp:e,started:e,duration:0,status:"ok",errors:0,ignoreDuration:!1,toJSON:()=>Jd(n)};return t&&bt(n,t),n}function bt(t,e={}){if(e.user&&(!t.ipAddress&&e.user.ip_address&&(t.ipAddress=e.user.ip_address),!t.did&&!e.did&&(t.did=e.user.id||e.user.email||e.user.username)),t.timestamp=e.timestamp||sr(),e.abnormal_mechanism&&(t.abnormal_mechanism=e.abnormal_mechanism),e.ignoreDuration&&(t.ignoreDuration=e.ignoreDuration),e.sid&&(t.sid=e.sid.length===32?e.sid:ie()),e.init!==void 0&&(t.init=e.init),!t.did&&e.did&&(t.did=`${e.did}`),typeof e.started=="number"&&(t.started=e.started),t.ignoreDuration)t.duration=void 0;else if(typeof e.duration=="number")t.duration=e.duration;else{const n=t.timestamp-t.started;t.duration=n>=0?n:0}e.release&&(t.release=e.release),e.environment&&(t.environment=e.environment),!t.ipAddress&&e.ipAddress&&(t.ipAddress=e.ipAddress),!t.userAgent&&e.userAgent&&(t.userAgent=e.userAgent),typeof e.errors=="number"&&(t.errors=e.errors),e.status&&(t.status=e.status)}function Ss(t,e){let n={};t.status==="ok"&&(n={status:"exited"}),bt(t,n)}function Jd(t){return xe({sid:`${t.sid}`,init:t.init,started:new Date(t.started*1e3).toISOString(),timestamp:new Date(t.timestamp*1e3).toISOString(),status:t.status,errors:t.errors,did:typeof t.did=="number"||typeof t.did=="string"?`${t.did}`:void 0,duration:t.duration,abnormal_mechanism:t.abnormal_mechanism,attrs:{release:t.release,environment:t.environment,ip_address:t.ipAddress,user_agent:t.userAgent}})}const jp=0,qd=1;function Xd(t){const{spanId:e,traceId:n}=t.spanContext(),{data:r,op:o,parent_span_id:s,status:i,tags:c,origin:d}=pt(t);return xe({data:r,op:o,parent_span_id:s,span_id:e,status:i,tags:c,trace_id:n,origin:d})}function zp(t){const{traceId:e,spanId:n}=t.spanContext(),r=Ds(t);return Kd(e,n,r)}function Hp(t){return typeof t=="number"?ho(t):Array.isArray(t)?t[0]+t[1]/1e9:t instanceof Date?ho(t.getTime()):sr()}function ho(t){return t>9999999999?t/1e3:t}function pt(t){return Qd(t)?t.getSpanJSON():typeof t.toJSON=="function"?t.toJSON():{}}function Qd(t){return typeof t.getSpanJSON=="function"}function Ds(t){const{traceFlags:e}=t.spanContext();return!!(e&qd)}function Yp(t,e,n,r,o,s){const{normalizeDepth:i=3,normalizeMaxBreadth:c=1e3}=t,d={...e,event_id:e.event_id||n.event_id||ie(),timestamp:e.timestamp||Qt()},l=n.integrations||t.integrations.map(P=>P.name);Zd(d,t),nl(d,l),e.type===void 0&&el(d,t.stackParser);const m=ol(r,n.captureContext);n.mechanism&&Md(d,n.mechanism);const f=o&&o.getEventProcessors?o.getEventProcessors():[],_=wl().getScopeData();if(s){const P=s.getScopeData();_o(_,P)}if(m){const P=m.getScopeData();_o(_,P)}const y=[...n.attachments||[],..._.attachments];y.length&&(n.attachments=y),Ts(d,_);const N=[...f,...ir(),..._.eventProcessors];return Wt(N,d,n).then(P=>(P&&tl(P),typeof i=="number"&&i>0?rl(P,i,c):P))}function Zd(t,e){const{environment:n,release:r,dist:o,maxValueLength:s=250}=e;"environment"in t||(t.environment="environment"in e?n:Zt),t.release===void 0&&r!==void 0&&(t.release=r),t.dist===void 0&&o!==void 0&&(t.dist=o),t.message&&(t.message=ut(t.message,s));const i=t.exception&&t.exception.values&&t.exception.values[0];i&&i.value&&(i.value=ut(i.value,s));const c=t.request;c&&c.url&&(c.url=ut(c.url,s))}const go=new WeakMap;function el(t,e){const n=_e._sentryDebugIds;if(!n)return;let r;const o=go.get(e);o?r=o:(r=new Map,go.set(e,r));const s=Object.keys(n).reduce((i,c)=>{let d;const l=r.get(c);l?d=l:(d=e(c),r.set(c,d));for(let m=d.length-1;m>=0;m--){const f=d[m];if(f.filename){i[f.filename]=n[c];break}}return i},{});try{t.exception.values.forEach(i=>{i.stacktrace.frames.forEach(c=>{c.filename&&(c.debug_id=s[c.filename])})})}catch{}}function tl(t){const e={};try{t.exception.values.forEach(r=>{r.stacktrace.frames.forEach(o=>{o.debug_id&&(o.abs_path?e[o.abs_path]=o.debug_id:o.filename&&(e[o.filename]=o.debug_id),delete o.debug_id)})})}catch{}if(Object.keys(e).length===0)return;t.debug_meta=t.debug_meta||{},t.debug_meta.images=t.debug_meta.images||[];const n=t.debug_meta.images;Object.keys(e).forEach(r=>{n.push({type:"sourcemap",code_file:r,debug_id:e[r]})})}function nl(t,e){e.length>0&&(t.sdk=t.sdk||{},t.sdk.integrations=[...t.sdk.integrations||[],...e])}function rl(t,e,n){if(!t)return null;const r={...t,...t.breadcrumbs&&{breadcrumbs:t.breadcrumbs.map(o=>({...o,...o.data&&{data:Ce(o.data,e,n)}}))},...t.user&&{user:Ce(t.user,e,n)},...t.contexts&&{contexts:Ce(t.contexts,e,n)},...t.extra&&{extra:Ce(t.extra,e,n)}};return t.contexts&&t.contexts.trace&&r.contexts&&(r.contexts.trace=t.contexts.trace,t.contexts.trace.data&&(r.contexts.trace.data=Ce(t.contexts.trace.data,e,n))),t.spans&&(r.spans=t.spans.map(o=>{const s=pt(o).data;return s&&(o.data=Ce(s,e,n)),o})),r}function ol(t,e){if(!e)return t;const n=t?t.clone():new Ie;return n.update(e),n}function sl(t){if(t)return il(t)?{captureContext:t}:cl(t)?{captureContext:t}:t}function il(t){return t instanceof Ie||typeof t=="function"}const al=["user","level","extra","contexts","tags","fingerprint","requestSession","propagationContext"];function cl(t){return Object.keys(t).some(e=>al.includes(e))}function Wp(t,e){return pe().captureException(t,sl(e))}function Gp(t,e){const n=typeof e=="string"?e:void 0,r=typeof e!="string"?{captureContext:e}:void 0;return pe().captureMessage(t,n,r)}function Kp(t,e){return pe().captureEvent(t,e)}function Jp(t){pe().configureScope(t)}function qp(t,e){pe().addBreadcrumb(t,e)}function Xp(t,e){pe().setContext(t,e)}function Qp(t){pe().setExtras(t)}function Zp(t,e){pe().setExtra(t,e)}function eh(t){pe().setTags(t)}function th(t,e){pe().setTag(t,e)}function ul(t){pe().setUser(t)}function dl(...t){const e=pe();if(t.length===2){const[n,r]=t;return n?e.withScope(()=>(e.getStackTop().scope=n,r(n))):e.withScope(r)}return e.withScope(t[0])}function nh(t){return Sl(()=>t(tn()))}function rh(t,e){return dl(n=>(n.setSpan(t),e(n)))}function oh(t,e){return pe().startTransaction({...t},e)}async function sh(t){const e=Ke();return e?e.flush(t):(ze&&we.warn("Cannot flush events. No client defined."),Promise.resolve(!1))}async function ih(t){const e=Ke();return e?e.close(t):(ze&&we.warn("Cannot flush events and disable SDK. No client defined."),Promise.resolve(!1))}function ah(){return pe().lastEventId()}function Ke(){return pe().getClient()}function ch(){return!!Ke()}function en(){return pe().getScope()}function uh(t){const e=Ke(),n=tn(),r=en(),{release:o,environment:s=Zt}=e&&e.getOptions()||{},{userAgent:i}=_e.navigator||{},c=bs({release:o,environment:s,user:r.getUser()||n.getUser(),...i&&{userAgent:i},...t}),d=n.getSession();return d&&d.status==="ok"&&bt(d,{status:"exited"}),Is(),n.setSession(c),r.setSession(c),c}function Is(){const t=tn(),e=en(),n=e.getSession()||t.getSession();n&&Ss(n),As(),t.setSession(),e.setSession()}function As(){const t=tn(),e=en(),n=Ke(),r=e.getSession()||t.getSession();r&&n&&n.captureSession&&n.captureSession(r)}function dh(t=!1){if(t){Is();return}As()}function Ns(t){return t.transaction}function ll(t,e,n){const r=e.getOptions(),{publicKey:o}=e.getDsn()||{},{segment:s}=n&&n.getUser()||{},i=xe({environment:r.environment||Zt,release:r.release,user_segment:s,public_key:o,trace_id:t});return e.emit&&e.emit("createDsc",i),i}function fl(t){const e=Ke();if(!e)return{};const n=ll(pt(t).trace_id||"",e,en()),r=Ns(t);if(!r)return n;const o=r&&r._frozenDynamicSamplingContext;if(o)return o;const{sampleRate:s,source:i}=r.metadata;s!=null&&(n.sample_rate=`${s}`);const c=pt(r);return i&&i!=="url"&&(n.transaction=c.description),n.sampled=String(Ds(r)),e.emit&&e.emit("createDsc",n),n}function Ts(t,e){const{fingerprint:n,span:r,breadcrumbs:o,sdkProcessingMetadata:s}=e;pl(t,e),r&&_l(t,r),ml(t,n),hl(t,o),gl(t,s)}function _o(t,e){const{extra:n,tags:r,user:o,contexts:s,level:i,sdkProcessingMetadata:c,breadcrumbs:d,fingerprint:l,eventProcessors:m,attachments:f,propagationContext:_,transactionName:y,span:N}=e;rt(t,"extra",n),rt(t,"tags",r),rt(t,"user",o),rt(t,"contexts",s),rt(t,"sdkProcessingMetadata",c),i&&(t.level=i),y&&(t.transactionName=y),N&&(t.span=N),d.length&&(t.breadcrumbs=[...t.breadcrumbs,...d]),l.length&&(t.fingerprint=[...t.fingerprint,...l]),m.length&&(t.eventProcessors=[...t.eventProcessors,...m]),f.length&&(t.attachments=[...t.attachments,...f]),t.propagationContext={...t.propagationContext,..._}}function rt(t,e,n){if(n&&Object.keys(n).length){t[e]={...t[e]};for(const r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[e][r]=n[r])}}function pl(t,e){const{extra:n,tags:r,user:o,contexts:s,level:i,transactionName:c}=e,d=xe(n);d&&Object.keys(d).length&&(t.extra={...d,...t.extra});const l=xe(r);l&&Object.keys(l).length&&(t.tags={...l,...t.tags});const m=xe(o);m&&Object.keys(m).length&&(t.user={...m,...t.user});const f=xe(s);f&&Object.keys(f).length&&(t.contexts={...f,...t.contexts}),i&&(t.level=i),c&&(t.transaction=c)}function hl(t,e){const n=[...t.breadcrumbs||[],...e];t.breadcrumbs=n.length?n:void 0}function gl(t,e){t.sdkProcessingMetadata={...t.sdkProcessingMetadata,...e}}function _l(t,e){t.contexts={trace:Xd(e),...t.contexts};const n=Ns(e);if(n){t.sdkProcessingMetadata={dynamicSamplingContext:fl(e),...t.sdkProcessingMetadata};const r=pt(n).description;r&&(t.tags={transaction:r,...t.tags})}}function ml(t,e){t.fingerprint=t.fingerprint?$d(t.fingerprint):[],e&&(t.fingerprint=t.fingerprint.concat(e)),t.fingerprint&&!t.fingerprint.length&&delete t.fingerprint}const vl=100;let On;class Ie{constructor(){this._notifyingListeners=!1,this._scopeListeners=[],this._eventProcessors=[],this._breadcrumbs=[],this._attachments=[],this._user={},this._tags={},this._extra={},this._contexts={},this._sdkProcessingMetadata={},this._propagationContext=mo()}static clone(e){return e?e.clone():new Ie}clone(){const e=new Ie;return e._breadcrumbs=[...this._breadcrumbs],e._tags={...this._tags},e._extra={...this._extra},e._contexts={...this._contexts},e._user=this._user,e._level=this._level,e._span=this._span,e._session=this._session,e._transactionName=this._transactionName,e._fingerprint=this._fingerprint,e._eventProcessors=[...this._eventProcessors],e._requestSession=this._requestSession,e._attachments=[...this._attachments],e._sdkProcessingMetadata={...this._sdkProcessingMetadata},e._propagationContext={...this._propagationContext},e._client=this._client,e}setClient(e){this._client=e}getClient(){return this._client}addScopeListener(e){this._scopeListeners.push(e)}addEventProcessor(e){return this._eventProcessors.push(e),this}setUser(e){return this._user=e||{email:void 0,id:void 0,ip_address:void 0,segment:void 0,username:void 0},this._session&&bt(this._session,{user:e}),this._notifyScopeListeners(),this}getUser(){return this._user}getRequestSession(){return this._requestSession}setRequestSession(e){return this._requestSession=e,this}setTags(e){return this._tags={...this._tags,...e},this._notifyScopeListeners(),this}setTag(e,n){return this._tags={...this._tags,[e]:n},this._notifyScopeListeners(),this}setExtras(e){return this._extra={...this._extra,...e},this._notifyScopeListeners(),this}setExtra(e,n){return this._extra={...this._extra,[e]:n},this._notifyScopeListeners(),this}setFingerprint(e){return this._fingerprint=e,this._notifyScopeListeners(),this}setLevel(e){return this._level=e,this._notifyScopeListeners(),this}setTransactionName(e){return this._transactionName=e,this._notifyScopeListeners(),this}setContext(e,n){return n===null?delete this._contexts[e]:this._contexts[e]=n,this._notifyScopeListeners(),this}setSpan(e){return this._span=e,this._notifyScopeListeners(),this}getSpan(){return this._span}getTransaction(){const e=this._span;return e&&e.transaction}setSession(e){return e?this._session=e:delete this._session,this._notifyScopeListeners(),this}getSession(){return this._session}update(e){if(!e)return this;const n=typeof e=="function"?e(this):e;if(n instanceof Ie){const r=n.getScopeData();this._tags={...this._tags,...r.tags},this._extra={...this._extra,...r.extra},this._contexts={...this._contexts,...r.contexts},r.user&&Object.keys(r.user).length&&(this._user=r.user),r.level&&(this._level=r.level),r.fingerprint.length&&(this._fingerprint=r.fingerprint),n.getRequestSession()&&(this._requestSession=n.getRequestSession()),r.propagationContext&&(this._propagationContext=r.propagationContext)}else if(nr(n)){const r=e;this._tags={...this._tags,...r.tags},this._extra={...this._extra,...r.extra},this._contexts={...this._contexts,...r.contexts},r.user&&(this._user=r.user),r.level&&(this._level=r.level),r.fingerprint&&(this._fingerprint=r.fingerprint),r.requestSession&&(this._requestSession=r.requestSession),r.propagationContext&&(this._propagationContext=r.propagationContext)}return this}clear(){return this._breadcrumbs=[],this._tags={},this._extra={},this._user={},this._contexts={},this._level=void 0,this._transactionName=void 0,this._fingerprint=void 0,this._requestSession=void 0,this._span=void 0,this._session=void 0,this._notifyScopeListeners(),this._attachments=[],this._propagationContext=mo(),this}addBreadcrumb(e,n){const r=typeof n=="number"?n:vl;if(r<=0)return this;const o={timestamp:Qt(),...e},s=this._breadcrumbs;return s.push(o),this._breadcrumbs=s.length>r?s.slice(-r):s,this._notifyScopeListeners(),this}getLastBreadcrumb(){return this._breadcrumbs[this._breadcrumbs.length-1]}clearBreadcrumbs(){return this._breadcrumbs=[],this._notifyScopeListeners(),this}addAttachment(e){return this._attachments.push(e),this}getAttachments(){return this.getScopeData().attachments}clearAttachments(){return this._attachments=[],this}getScopeData(){const{_breadcrumbs:e,_attachments:n,_contexts:r,_tags:o,_extra:s,_user:i,_level:c,_fingerprint:d,_eventProcessors:l,_propagationContext:m,_sdkProcessingMetadata:f,_transactionName:_,_span:y}=this;return{breadcrumbs:e,attachments:n,contexts:r,tags:o,extra:s,user:i,level:c,fingerprint:d||[],eventProcessors:l,propagationContext:m,sdkProcessingMetadata:f,transactionName:_,span:y}}applyToEvent(e,n={},r=[]){Ts(e,this.getScopeData());const o=[...r,...ir(),...this._eventProcessors];return Wt(o,e,n)}setSDKProcessingMetadata(e){return this._sdkProcessingMetadata={...this._sdkProcessingMetadata,...e},this}setPropagationContext(e){return this._propagationContext=e,this}getPropagationContext(){return this._propagationContext}captureException(e,n){const r=n&&n.event_id?n.event_id:ie();if(!this._client)return we.warn("No client configured on scope - will not capture exception!"),r;const o=new Error("Sentry syntheticException");return this._client.captureException(e,{originalException:e,syntheticException:o,...n,event_id:r},this),r}captureMessage(e,n,r){const o=r&&r.event_id?r.event_id:ie();if(!this._client)return we.warn("No client configured on scope - will not capture message!"),o;const s=new Error(e);return this._client.captureMessage(e,n,{originalException:e,syntheticException:s,...r,event_id:o},this),o}captureEvent(e,n){const r=n&&n.event_id?n.event_id:ie();return this._client?(this._client.captureEvent(e,{...n,event_id:r},this),r):(we.warn("No client configured on scope - will not capture event!"),r)}_notifyScopeListeners(){this._notifyingListeners||(this._notifyingListeners=!0,this._scopeListeners.forEach(e=>{e(this)}),this._notifyingListeners=!1)}}function wl(){return On||(On=new Ie),On}function mo(){return{traceId:ie(),spanId:ie().substring(16)}}const yl="7.120.3",Os=parseFloat(yl),El=100;class Cs{constructor(e,n,r,o=Os){this._version=o;let s;n?s=n:(s=new Ie,s.setClient(e));let i;r?i=r:(i=new Ie,i.setClient(e)),this._stack=[{scope:s}],e&&this.bindClient(e),this._isolationScope=i}isOlderThan(e){return this._version<e}bindClient(e){const n=this.getStackTop();n.client=e,n.scope.setClient(e),e&&e.setupIntegrations&&e.setupIntegrations()}pushScope(){const e=this.getScope().clone();return this.getStack().push({client:this.getClient(),scope:e}),e}popScope(){return this.getStack().length<=1?!1:!!this.getStack().pop()}withScope(e){const n=this.pushScope();let r;try{r=e(n)}catch(o){throw this.popScope(),o}return rr(r)?r.then(o=>(this.popScope(),o),o=>{throw this.popScope(),o}):(this.popScope(),r)}getClient(){return this.getStackTop().client}getScope(){return this.getStackTop().scope}getIsolationScope(){return this._isolationScope}getStack(){return this._stack}getStackTop(){return this._stack[this._stack.length-1]}captureException(e,n){const r=this._lastEventId=n&&n.event_id?n.event_id:ie(),o=new Error("Sentry syntheticException");return this.getScope().captureException(e,{originalException:e,syntheticException:o,...n,event_id:r}),r}captureMessage(e,n,r){const o=this._lastEventId=r&&r.event_id?r.event_id:ie(),s=new Error(e);return this.getScope().captureMessage(e,n,{originalException:e,syntheticException:s,...r,event_id:o}),o}captureEvent(e,n){const r=n&&n.event_id?n.event_id:ie();return e.type||(this._lastEventId=r),this.getScope().captureEvent(e,{...n,event_id:r}),r}lastEventId(){return this._lastEventId}addBreadcrumb(e,n){const{scope:r,client:o}=this.getStackTop();if(!o)return;const{beforeBreadcrumb:s=null,maxBreadcrumbs:i=El}=o.getOptions&&o.getOptions()||{};if(i<=0)return;const d={timestamp:Qt(),...e},l=s?ps(()=>s(d,n)):d;l!==null&&(o.emit&&o.emit("beforeAddBreadcrumb",l,n),r.addBreadcrumb(l,i))}setUser(e){this.getScope().setUser(e),this.getIsolationScope().setUser(e)}setTags(e){this.getScope().setTags(e),this.getIsolationScope().setTags(e)}setExtras(e){this.getScope().setExtras(e),this.getIsolationScope().setExtras(e)}setTag(e,n){this.getScope().setTag(e,n),this.getIsolationScope().setTag(e,n)}setExtra(e,n){this.getScope().setExtra(e,n),this.getIsolationScope().setExtra(e,n)}setContext(e,n){this.getScope().setContext(e,n),this.getIsolationScope().setContext(e,n)}configureScope(e){const{scope:n,client:r}=this.getStackTop();r&&e(n)}run(e){const n=vo(this);try{e(this)}finally{vo(n)}}getIntegration(e){const n=this.getClient();if(!n)return null;try{return n.getIntegration(e)}catch{return ze&&we.warn(`Cannot retrieve integration ${e.id} from the current Hub`),null}}startTransaction(e,n){const r=this._callExtensionMethod("startTransaction",e,n);return ze&&!r&&(this.getClient()?we.warn(`Tracing extension 'startTransaction' has not been added. Call 'addTracingExtensions' before calling 'init':
9
9
  Sentry.addTracingExtensions();
10
10
  Sentry.init({...});
11
- `):we.warn("Tracing extension 'startTransaction' is missing. You should 'init' the SDK before calling 'startTransaction'")),r}traceHeaders(){return this._callExtensionMethod("traceHeaders")}captureSession(e=!1){if(e)return this.endSession();this._sendSessionUpdate()}endSession(){const n=this.getStackTop().scope,r=n.getSession();r&&Ss(r),this._sendSessionUpdate(),n.setSession()}startSession(e){const{scope:n,client:r}=this.getStackTop(),{release:o,environment:s=Zt}=r&&r.getOptions()||{},{userAgent:i}=_e.navigator||{},c=bs({release:o,environment:s,user:n.getUser(),...i&&{userAgent:i},...e}),d=n.getSession&&n.getSession();return d&&d.status==="ok"&&bt(d,{status:"exited"}),this.endSession(),n.setSession(c),c}shouldSendDefaultPii(){const e=this.getClient(),n=e&&e.getOptions();return!!(n&&n.sendDefaultPii)}_sendSessionUpdate(){const{scope:e,client:n}=this.getStackTop(),r=e.getSession();r&&n&&n.captureSession&&n.captureSession(r)}_callExtensionMethod(e,...n){const o=St().__SENTRY__;if(o&&o.extensions&&typeof o.extensions[e]=="function")return o.extensions[e].apply(this,n);ze&&we.warn(`Extension method ${e} couldn't be found, doing nothing.`)}}function St(){return _e.__SENTRY__=_e.__SENTRY__||{extensions:{},hub:void 0},_e}function vo(t){const e=St(),n=Vn(e);return Ls(e,t),n}function pe(){const t=St();if(t.__SENTRY__&&t.__SENTRY__.acs){const e=t.__SENTRY__.acs.getCurrentHub();if(e)return e}return bl(t)}function tn(){return pe().getIsolationScope()}function bl(t=St()){return(!Dl(t)||Vn(t).isOlderThan(Os))&&Ls(t,new Cs),Vn(t)}function Sl(t,e={}){const n=St();return n.__SENTRY__&&n.__SENTRY__.acs?n.__SENTRY__.acs.runWithAsyncContext(t,e):t()}function Dl(t){return!!(t&&t.__SENTRY__&&t.__SENTRY__.hub)}function Vn(t){return fs("hub",()=>new Cs,t)}function Ls(t,e){if(!t)return!1;const n=t.__SENTRY__=t.__SENTRY__||{};return n.hub=e,!0}const Il=window.__VITE_ENVS.PH_CONNECT_RENOWN_URL||"https://www.renown.id",Al=window.__VITE_ENVS.PH_CONNECT_RENOWN_NETWORK_ID||"eip155",Nl=window.__VITE_ENVS.PH_CONNECT_RENOWN_CHAIN_ID||"1",ke={},Tl=Symbol((ke?"production":void 0)!=="production"?"RESET":""),Rs=t=>typeof(t==null?void 0:t.then)=="function";function Ol(t=()=>{try{return window.localStorage}catch(n){(ke?"production":void 0)!=="production"&&typeof window<"u"&&console.warn(n);return}},e){var n;let r,o;const s={getItem:(d,l)=>{var m,f;const _=N=>{if(N=N||"",r!==N){try{o=JSON.parse(N,void 0)}catch{return l}r=N}return o},y=(f=(m=t())==null?void 0:m.getItem(d))!=null?f:null;return Rs(y)?y.then(_):_(y)},setItem:(d,l)=>{var m;return(m=t())==null?void 0:m.setItem(d,JSON.stringify(l,void 0))},removeItem:d=>{var l;return(l=t())==null?void 0:l.removeItem(d)}},i=d=>(l,m,f)=>d(l,_=>{let y;try{y=JSON.parse(_||"")}catch{y=f}m(y)});let c;try{c=(n=t())==null?void 0:n.subscribe}catch{}return!c&&typeof window<"u"&&typeof window.addEventListener=="function"&&window.Storage&&(c=(d,l)=>{if(!(t()instanceof window.Storage))return()=>{};const m=f=>{f.storageArea===t()&&f.key===d&&l(f.newValue)};return window.addEventListener("storage",m),()=>{window.removeEventListener("storage",m)}}),c&&(s.subscribe=i(c)),s}const Cl=Ol();function Ps(t,e,n=Cl,r){const o=de(e);return(ke?"production":void 0)!=="production"&&(o.debugPrivate=!0),o.onMount=i=>{i(n.getItem(t,e));let c;return n.subscribe&&(c=n.subscribe(t,i,e)),c},de(i=>i(o),(i,c,d)=>{const l=typeof d=="function"?d(i(o)):d;return l===Tl?(c(o,e),n.removeItem(t)):Rs(l)?l.then(m=>(c(o,m),n.setItem(t,m))):(c(o,l),n.setItem(t,l))})}const Cn=new WeakMap,Ll=(t,e)=>(Cn.has(e)?Cn:Cn.set(e,t())).get(e),Rl=t=>typeof(t==null?void 0:t.then)=="function",wo={state:"loading"};function lh(t){return Ll(()=>{const e=new WeakMap,n=de(0);(ke?"production":void 0)!=="production"&&(n.debugPrivate=!0);const r=de((o,{setSelf:s})=>{o(n);let i;try{i=o(t)}catch(m){return{state:"hasError",error:m}}if(!Rl(i))return{state:"hasData",data:i};const c=i,d=e.get(c);if(d)return d;c.then(m=>{e.set(c,{state:"hasData",data:m}),s()},m=>{e.set(c,{state:"hasError",error:m}),s()});const l=e.get(c);return l||(e.set(c,wo),wo)},(o,s)=>{s(n,i=>i+1)});return(ke?"production":void 0)!=="production"&&(r.debugPrivate=!0),de(o=>o(r))},t)}const yo=(t,e,n)=>(e.has(n)?e:e.set(n,t())).get(n),Pl=new WeakMap,xl=(t,e,n)=>{const r=yo(()=>new WeakMap,Pl,e);return yo(t,r,n)},Ml=t=>typeof(t==null?void 0:t.then)=="function",$l=()=>{};function Ul(t,e=$l){return xl(()=>{const n=new WeakMap,r=new WeakMap,o=de(0);(ke?"production":void 0)!=="production"&&(o.debugPrivate=!0);const s=de((i,{setSelf:c})=>{i(o);const d=i(s),l=i(t);if(!Ml(l))return{v:l};if(l!==(d==null?void 0:d.p)&&l.then(m=>{r.set(l,m),c()},m=>{n.set(l,m),c()}),n.has(l))throw n.get(l);return r.has(l)?{p:l,v:r.get(l)}:d&&"v"in d?{p:l,f:e(d.v),v:d.v}:{p:l,f:e()}},(i,c)=>{c(o,d=>d+1)});return s.init=void 0,(ke?"production":void 0)!=="production"&&(s.debugPrivate=!0),de(i=>{const c=i(s);return"f"in c?c.f:c.v},(i,c,...d)=>c(t,...d))},t,e)}function kl(t){const e=de(void 0);return delete e.init,Object.defineProperty(e,"init",{get(){return t()}}),e}const Bl=gt.routerBasename+"external-packages.js",Fl=window.__VITE_ENVS.PROD;async function Vl(){try{return Fl?(await import(Bl)).default??[]:[]}catch(t){return console.error(t),[]}}const xs=de(async()=>typeof await qt()<"u");xs.debugLabel="hmrAvailableAtom";const fh=()=>Oe(xs),Dt=kl(Vl);Dt.debugLabel="externalPackagesAtomInConnect";let Eo;Dt.onMount=t=>{Eo||(Eo=gd(e=>{t(e)}))};const jl=()=>Oe(Dt),zl={id:"powerhouse/common",name:"Generic Drive Explorer",driveEditor:"GenericDriveExplorer"},Ms=de(async t=>{const e=await t(Dt);return[zl,...e.map(n=>n.manifest.apps).filter(n=>n!==void 0).flat()]});Ms.debugLabel="appsAtomInConnect";const Hl=()=>Oe(Ms),ph=()=>{const t=Hl();return J(e=>{if(!e)return;const n=t.find(r=>r.driveEditor===e);return n==null?void 0:n.name},[t])},hh=t=>{const e=jl();return ht(()=>{if(!t)return;const n=e.find(r=>{var o;return(o=r.manifest.apps)==null?void 0:o.find(s=>s.driveEditor===t)});return n==null?void 0:n.editors.find(r=>r.config.id===t)},[e,t])};let Pt;async function Yl(){const{ConnectCrypto:t}=await Te(async()=>{const{ConnectCrypto:r}=await import("./index.CyGg9uhs.js");return{ConnectCrypto:r}},__vite__mapDeps([0,1,2,3,4]),import.meta.url),{BrowserKeyStorage:e}=await Te(async()=>{const{BrowserKeyStorage:r}=await import("./index.CyGg9uhs.js");return{BrowserKeyStorage:r}},__vite__mapDeps([0,1,2,3,4]),import.meta.url),n=new t(new e);return await n.did(),n}function Re(){return window.connectCrypto?Promise.resolve(window.connectCrypto):Pt||(Pt=Yl(),Pt)}function ar(){return ht(()=>({async regenerateDid(){return(await Re()).regenerateDid()},async did(){return(await Re()).did()},sign:async t=>await(await Re()).sign(t),async getIssuer(){return(await Re()).getIssuer()},async getBearerToken(t,e,n=!1){return(await Re()).getBearerToken(t,e,n)}}),[])}const $s=de(void 0);$s.debugLabel="didAtomInConnect";function Wl(){const[t,e]=$e($s);return ce(()=>{t||Re().then(n=>n.did()).then(n=>e(n)).catch(te.error)}),t}const Us=de("idle");Us.debugLabel="renownStatusAtomInConnect";const ks=de(window.renown?Promise.resolve(window.renown):void 0);ks.debugLabel="renownAtomInConnect";function nn(){const[t,e]=$e(ks),[n,r]=$e(Us),{did:o}=ar();async function s(i){r("loading");try{const c=await i();if(!c){r("error");return}const{initRenownBrowser:d}=await Te(async()=>{const{initRenownBrowser:f}=await import("./index.DnAVSnDb.js").then(_=>_.b);return{initRenownBrowser:f}},__vite__mapDeps([2,1]),import.meta.url),l=d(c),m={user:function(){return Promise.resolve(l.user)},login:function(f){return l.login(f)},logout(){return Promise.resolve(l.logout())},on:{user(f){return l.on("user",f)}}};return r("finished"),m}catch(c){console.error("Error initializing renown:",c instanceof Error?c.message:"Unknown error"),r("error");return}}return!t&&n==="idle"&&e(s(o)),t}function Gl(){if(console&&console.warn){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];typeof e[0]=="string"&&(e[0]=`react-i18next:: ${e[0]}`),console.warn(...e)}}const bo={};function jn(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];typeof e[0]=="string"&&bo[e[0]]||(typeof e[0]=="string"&&(bo[e[0]]=new Date),Gl(...e))}const Bs=(t,e)=>()=>{if(t.isInitialized)e();else{const n=()=>{setTimeout(()=>{t.off("initialized",n)},0),e()};t.on("initialized",n)}};function So(t,e,n){t.loadNamespaces(e,Bs(t,n))}function Do(t,e,n,r){typeof n=="string"&&(n=[n]),n.forEach(o=>{t.options.ns.indexOf(o)<0&&t.options.ns.push(o)}),t.loadLanguages(e,Bs(t,r))}function Kl(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const r=e.languages[0],o=e.options?e.options.fallbackLng:!1,s=e.languages[e.languages.length-1];if(r.toLowerCase()==="cimode")return!0;const i=(c,d)=>{const l=e.services.backendConnector.state[`${c}|${d}`];return l===-1||l===2};return n.bindI18n&&n.bindI18n.indexOf("languageChanging")>-1&&e.services.backendConnector.backend&&e.isLanguageChangingTo&&!i(e.isLanguageChangingTo,t)?!1:!!(e.hasResourceBundle(r,t)||!e.services.backendConnector.backend||e.options.resources&&!e.options.partialBundledLanguages||i(r,t)&&(!o||i(s,t)))}function Jl(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return!e.languages||!e.languages.length?(jn("i18n.languages were undefined or empty",e.languages),!0):e.options.ignoreJSONStructure!==void 0?e.hasLoadedNamespace(t,{lng:n.lng,precheck:(o,s)=>{if(n.bindI18n&&n.bindI18n.indexOf("languageChanging")>-1&&o.services.backendConnector.backend&&o.isLanguageChangingTo&&!s(o.isLanguageChangingTo,t))return!1}}):Kl(t,e,n)}const ql=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g,Xl={"&amp;":"&","&#38;":"&","&lt;":"<","&#60;":"<","&gt;":">","&#62;":">","&apos;":"'","&#39;":"'","&quot;":'"',"&#34;":'"',"&nbsp;":" ","&#160;":" ","&copy;":"©","&#169;":"©","&reg;":"®","&#174;":"®","&hellip;":"…","&#8230;":"…","&#x2F;":"/","&#47;":"/"},Ql=t=>Xl[t],Zl=t=>t.replace(ql,Ql);let zn={bindI18n:"languageChanged",bindI18nStore:"",transEmptyNodeValue:"",transSupportBasicHtmlNodes:!0,transWrapTextNodes:"",transKeepBasicHtmlNodesFor:["br","strong","i","p"],useSuspense:!0,unescape:Zl};function gh(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};zn={...zn,...t}}function ef(){return zn}let Fs;function _h(t){Fs=t}function tf(){return Fs}const nf=Yn();class rf{constructor(){this.usedNamespaces={}}addUsedNamespaces(e){e.forEach(n=>{this.usedNamespaces[n]||(this.usedNamespaces[n]=!0)})}getUsedNamespaces(){return Object.keys(this.usedNamespaces)}}const of=(t,e)=>{const n=Me();return ce(()=>{n.current=t},[t,e]),n.current};function Vs(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const{i18n:n}=e,{i18n:r,defaultNS:o}=Wn(nf)||{},s=n||r||tf();if(s&&!s.reportNamespaces&&(s.reportNamespaces=new rf),!s){jn("You will need to pass in an i18next instance by using initReactI18next");const k=(O,B)=>typeof B=="string"?B:B&&typeof B=="object"&&typeof B.defaultValue=="string"?B.defaultValue:Array.isArray(O)?O[O.length-1]:O,W=[k,{},!1];return W.t=k,W.i18n={},W.ready=!1,W}s.options.react&&s.options.react.wait!==void 0&&jn("It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.");const i={...ef(),...s.options.react,...e},{useSuspense:c,keyPrefix:d}=i;let l=o||s.options&&s.options.defaultNS;l=typeof l=="string"?[l]:l||["translation"],s.reportNamespaces.addUsedNamespaces&&s.reportNamespaces.addUsedNamespaces(l);const m=(s.isInitialized||s.initializedStoreOnce)&&l.every(k=>Jl(k,s,i));function f(){return s.getFixedT(e.lng||null,i.nsMode==="fallback"?l:l[0],d)}const[_,y]=He(f);let N=l.join();e.lng&&(N=`${e.lng}${N}`);const F=of(N),P=Me(!0);ce(()=>{const{bindI18n:k,bindI18nStore:W}=i;P.current=!0,!m&&!c&&(e.lng?Do(s,e.lng,l,()=>{P.current&&y(f)}):So(s,l,()=>{P.current&&y(f)})),m&&F&&F!==N&&P.current&&y(f);function O(){P.current&&y(f)}return k&&s&&s.on(k,O),W&&s&&s.store.on(W,O),()=>{P.current=!1,k&&s&&k.split(" ").forEach(B=>s.off(B,O)),W&&s&&W.split(" ").forEach(B=>s.store.off(B,O))}},[s,N]);const V=Me(!0);ce(()=>{P.current&&!V.current&&y(f),V.current=!1},[s,d]);const H=[_,s,m];if(H.t=_,H.i18n=s,H.ready=m,m||!m&&!c)return H;throw new Promise(k=>{e.lng?Do(s,e.lng,l,()=>k()):So(s,l,()=>k())})}const sf="connect";function Ln(t,e){const{type:n="default",containerId:r=sf,...o}=e||{};return aa(t,{type:n,containerId:r,...o})}const Pe=gt.routerBasename,af=(t,e,n,r)=>{const o=Ps(`${Pe}:${t}`,e,void 0);return o.debugLabel=`storageAtom:${Pe}:${t}`,o},mh=(t,e,n)=>{const r=Ps(t,e,{getItem(o,s){const i=localStorage.getItem(`${Pe}:${o}`);return i?JSON.parse(i):s},setItem(o,s){localStorage.setItem(`${Pe}:${o}`,JSON.stringify(s)),n(s)},removeItem(o){localStorage.removeItem(`${Pe}:${o}`)},subscribe(o,s){if(typeof window.addEventListener>"u")return()=>null;function i(c){c.storageArea===localStorage&&c.key===`${Pe}:${o}`&&s(c.newValue??"")}return window.addEventListener("storage",i),()=>window.removeEventListener("storage",i)}});return r.debugLabel=`storageAtomWithCallback:${Pe}:${t}`,r},cf=[ca,ua],uf=cf;function df(...t){const e=new Map;for(const n of t)e.set(n.documentModel.id,n);return Array.from(e.values())}function lf(t){return t.map(e=>e.documentModels).reduce((e,n)=>e.concat(n),[])}const cr=de(async t=>{const e=await t(Dt),n=lf(e);return df(...uf,...n)});cr.debugLabel="documentModelsAtomInConnect";const js=Ul(cr);js.debugLabel="unwrappedDocumentModelsAtomInConnect";const zs=()=>Oe(js);function ff(t,e){return e==null?void 0:e.find(n=>n.documentModel.id===t)}const pf=()=>{const t=zs();return e=>ff(e,t)},vh=()=>{const t=zs(),{config:e}=Mf(),{enabledEditors:n,disabledEditors:r}=e.editors;if(!t)return;const o=t.filter(s=>s.documentModel.id!=="powerhouse/document-drive");return n==="*"?t:r==="*"?[]:r?o.filter(s=>!r.includes(s.documentModel.id)):n?o.filter(s=>n.includes(s.documentModel.id)):o};async function hf(t,e){await _f(t,e);const n=await t.initialize(),r=n==null?void 0:n.at(0);if(r)throw r}function gf(){const t=gt.drives.sections.LOCAL.enabled,e=We(),n=Et(),r=Me(!1);ce(()=>{r.current||t&&e!==void 0&&n!==void 0&&(n.length>0||(e.addDrive({id:Le(),slug:"my-local-drive",global:{name:"My Local Drive",icon:null},local:{availableOffline:!1,sharingType:"private",listeners:[],triggers:[]}}).catch(te.error),r.current=!0))},[t,e,n])}async function _f(t,e){const n=await(e==null?void 0:e.user()),r=await Re();n!=null&&n.address&&t.setGenerateJwtHandler(async o=>r.getBearerToken(o,n.address))}async function mf(t,e,n){const r=pd(e,t);return await hf(r,n),r}const ur=de(fd(gt.routerBasename));ur.debugLabel="storageAtomInConnect";const vf=()=>Oe(ur);let xt=!1;const Hs=de(void 0);Hs.debugLabel="userAtomInConnect";const Ys=()=>{const[t,e]=$e(Hs),n=nn();return ce(()=>{var o;let r=null;if(t){const{credential:s,...i}=t;r={id:i.did,username:(o=i.ens)==null?void 0:o.name,...i}}ul(r)},[t]),ce(()=>{if(xt)return;xt=!0,n==null||n.user().then(o=>{e(o||null)}).catch(()=>{e(null)});const r=n==null?void 0:n.on.user(o=>{e(o||null)});return()=>{r==null||r(),xt=!1}},[n,xt]),t};async function Io(t,e){if(!t)return;const n=t.split("/");n.pop(),n.pop(),n.push("drives");const r=n.join("/");return(await(await fetch(r,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({query:`
11
+ `):we.warn("Tracing extension 'startTransaction' is missing. You should 'init' the SDK before calling 'startTransaction'")),r}traceHeaders(){return this._callExtensionMethod("traceHeaders")}captureSession(e=!1){if(e)return this.endSession();this._sendSessionUpdate()}endSession(){const n=this.getStackTop().scope,r=n.getSession();r&&Ss(r),this._sendSessionUpdate(),n.setSession()}startSession(e){const{scope:n,client:r}=this.getStackTop(),{release:o,environment:s=Zt}=r&&r.getOptions()||{},{userAgent:i}=_e.navigator||{},c=bs({release:o,environment:s,user:n.getUser(),...i&&{userAgent:i},...e}),d=n.getSession&&n.getSession();return d&&d.status==="ok"&&bt(d,{status:"exited"}),this.endSession(),n.setSession(c),c}shouldSendDefaultPii(){const e=this.getClient(),n=e&&e.getOptions();return!!(n&&n.sendDefaultPii)}_sendSessionUpdate(){const{scope:e,client:n}=this.getStackTop(),r=e.getSession();r&&n&&n.captureSession&&n.captureSession(r)}_callExtensionMethod(e,...n){const o=St().__SENTRY__;if(o&&o.extensions&&typeof o.extensions[e]=="function")return o.extensions[e].apply(this,n);ze&&we.warn(`Extension method ${e} couldn't be found, doing nothing.`)}}function St(){return _e.__SENTRY__=_e.__SENTRY__||{extensions:{},hub:void 0},_e}function vo(t){const e=St(),n=Vn(e);return Ls(e,t),n}function pe(){const t=St();if(t.__SENTRY__&&t.__SENTRY__.acs){const e=t.__SENTRY__.acs.getCurrentHub();if(e)return e}return bl(t)}function tn(){return pe().getIsolationScope()}function bl(t=St()){return(!Dl(t)||Vn(t).isOlderThan(Os))&&Ls(t,new Cs),Vn(t)}function Sl(t,e={}){const n=St();return n.__SENTRY__&&n.__SENTRY__.acs?n.__SENTRY__.acs.runWithAsyncContext(t,e):t()}function Dl(t){return!!(t&&t.__SENTRY__&&t.__SENTRY__.hub)}function Vn(t){return fs("hub",()=>new Cs,t)}function Ls(t,e){if(!t)return!1;const n=t.__SENTRY__=t.__SENTRY__||{};return n.hub=e,!0}const Il=window.__VITE_ENVS.PH_CONNECT_RENOWN_URL||"https://www.renown.id",Al=window.__VITE_ENVS.PH_CONNECT_RENOWN_NETWORK_ID||"eip155",Nl=window.__VITE_ENVS.PH_CONNECT_RENOWN_CHAIN_ID||"1",ke={},Tl=Symbol((ke?"production":void 0)!=="production"?"RESET":""),Rs=t=>typeof(t==null?void 0:t.then)=="function";function Ol(t=()=>{try{return window.localStorage}catch(n){(ke?"production":void 0)!=="production"&&typeof window<"u"&&console.warn(n);return}},e){var n;let r,o;const s={getItem:(d,l)=>{var m,f;const _=N=>{if(N=N||"",r!==N){try{o=JSON.parse(N,void 0)}catch{return l}r=N}return o},y=(f=(m=t())==null?void 0:m.getItem(d))!=null?f:null;return Rs(y)?y.then(_):_(y)},setItem:(d,l)=>{var m;return(m=t())==null?void 0:m.setItem(d,JSON.stringify(l,void 0))},removeItem:d=>{var l;return(l=t())==null?void 0:l.removeItem(d)}},i=d=>(l,m,f)=>d(l,_=>{let y;try{y=JSON.parse(_||"")}catch{y=f}m(y)});let c;try{c=(n=t())==null?void 0:n.subscribe}catch{}return!c&&typeof window<"u"&&typeof window.addEventListener=="function"&&window.Storage&&(c=(d,l)=>{if(!(t()instanceof window.Storage))return()=>{};const m=f=>{f.storageArea===t()&&f.key===d&&l(f.newValue)};return window.addEventListener("storage",m),()=>{window.removeEventListener("storage",m)}}),c&&(s.subscribe=i(c)),s}const Cl=Ol();function Ps(t,e,n=Cl,r){const o=de(e);return(ke?"production":void 0)!=="production"&&(o.debugPrivate=!0),o.onMount=i=>{i(n.getItem(t,e));let c;return n.subscribe&&(c=n.subscribe(t,i,e)),c},de(i=>i(o),(i,c,d)=>{const l=typeof d=="function"?d(i(o)):d;return l===Tl?(c(o,e),n.removeItem(t)):Rs(l)?l.then(m=>(c(o,m),n.setItem(t,m))):(c(o,l),n.setItem(t,l))})}const Cn=new WeakMap,Ll=(t,e)=>(Cn.has(e)?Cn:Cn.set(e,t())).get(e),Rl=t=>typeof(t==null?void 0:t.then)=="function",wo={state:"loading"};function lh(t){return Ll(()=>{const e=new WeakMap,n=de(0);(ke?"production":void 0)!=="production"&&(n.debugPrivate=!0);const r=de((o,{setSelf:s})=>{o(n);let i;try{i=o(t)}catch(m){return{state:"hasError",error:m}}if(!Rl(i))return{state:"hasData",data:i};const c=i,d=e.get(c);if(d)return d;c.then(m=>{e.set(c,{state:"hasData",data:m}),s()},m=>{e.set(c,{state:"hasError",error:m}),s()});const l=e.get(c);return l||(e.set(c,wo),wo)},(o,s)=>{s(n,i=>i+1)});return(ke?"production":void 0)!=="production"&&(r.debugPrivate=!0),de(o=>o(r))},t)}const yo=(t,e,n)=>(e.has(n)?e:e.set(n,t())).get(n),Pl=new WeakMap,xl=(t,e,n)=>{const r=yo(()=>new WeakMap,Pl,e);return yo(t,r,n)},Ml=t=>typeof(t==null?void 0:t.then)=="function",$l=()=>{};function Ul(t,e=$l){return xl(()=>{const n=new WeakMap,r=new WeakMap,o=de(0);(ke?"production":void 0)!=="production"&&(o.debugPrivate=!0);const s=de((i,{setSelf:c})=>{i(o);const d=i(s),l=i(t);if(!Ml(l))return{v:l};if(l!==(d==null?void 0:d.p)&&l.then(m=>{r.set(l,m),c()},m=>{n.set(l,m),c()}),n.has(l))throw n.get(l);return r.has(l)?{p:l,v:r.get(l)}:d&&"v"in d?{p:l,f:e(d.v),v:d.v}:{p:l,f:e()}},(i,c)=>{c(o,d=>d+1)});return s.init=void 0,(ke?"production":void 0)!=="production"&&(s.debugPrivate=!0),de(i=>{const c=i(s);return"f"in c?c.f:c.v},(i,c,...d)=>c(t,...d))},t,e)}function kl(t){const e=de(void 0);return delete e.init,Object.defineProperty(e,"init",{get(){return t()}}),e}const Bl=gt.routerBasename+"external-packages.js",Fl=window.__VITE_ENVS.PROD;async function Vl(){try{return Fl?(await import(Bl)).default??[]:[]}catch(t){return console.error(t),[]}}const xs=de(async()=>typeof await qt()<"u");xs.debugLabel="hmrAvailableAtom";const fh=()=>Oe(xs),Dt=kl(Vl);Dt.debugLabel="externalPackagesAtomInConnect";let Eo;Dt.onMount=t=>{Eo||(Eo=gd(e=>{t(e)}))};const jl=()=>Oe(Dt),zl={id:"powerhouse/common",name:"Generic Drive Explorer",driveEditor:"GenericDriveExplorer"},Ms=de(async t=>{const e=await t(Dt);return[zl,...e.map(n=>n.manifest.apps).filter(n=>n!==void 0).flat()]});Ms.debugLabel="appsAtomInConnect";const Hl=()=>Oe(Ms),ph=()=>{const t=Hl();return J(e=>{if(!e)return;const n=t.find(r=>r.driveEditor===e);return n==null?void 0:n.name},[t])},hh=t=>{const e=jl();return ht(()=>{if(!t)return;const n=e.find(r=>{var o;return(o=r.manifest.apps)==null?void 0:o.find(s=>s.driveEditor===t)});return n==null?void 0:n.editors.find(r=>r.config.id===t)},[e,t])};let Pt;async function Yl(){const{ConnectCrypto:t}=await Te(async()=>{const{ConnectCrypto:r}=await import("./index.B8YpY9RS.js");return{ConnectCrypto:r}},__vite__mapDeps([0,1,2,3,4]),import.meta.url),{BrowserKeyStorage:e}=await Te(async()=>{const{BrowserKeyStorage:r}=await import("./index.B8YpY9RS.js");return{BrowserKeyStorage:r}},__vite__mapDeps([0,1,2,3,4]),import.meta.url),n=new t(new e);return await n.did(),n}function Re(){return window.connectCrypto?Promise.resolve(window.connectCrypto):Pt||(Pt=Yl(),Pt)}function ar(){return ht(()=>({async regenerateDid(){return(await Re()).regenerateDid()},async did(){return(await Re()).did()},sign:async t=>await(await Re()).sign(t),async getIssuer(){return(await Re()).getIssuer()},async getBearerToken(t,e,n=!1){return(await Re()).getBearerToken(t,e,n)}}),[])}const $s=de(void 0);$s.debugLabel="didAtomInConnect";function Wl(){const[t,e]=$e($s);return ce(()=>{t||Re().then(n=>n.did()).then(n=>e(n)).catch(te.error)}),t}const Us=de("idle");Us.debugLabel="renownStatusAtomInConnect";const ks=de(window.renown?Promise.resolve(window.renown):void 0);ks.debugLabel="renownAtomInConnect";function nn(){const[t,e]=$e(ks),[n,r]=$e(Us),{did:o}=ar();async function s(i){r("loading");try{const c=await i();if(!c){r("error");return}const{initRenownBrowser:d}=await Te(async()=>{const{initRenownBrowser:f}=await import("./index.BQUHyrbF.js").then(_=>_.b);return{initRenownBrowser:f}},__vite__mapDeps([2,1]),import.meta.url),l=d(c),m={user:function(){return Promise.resolve(l.user)},login:function(f){return l.login(f)},logout(){return Promise.resolve(l.logout())},on:{user(f){return l.on("user",f)}}};return r("finished"),m}catch(c){console.error("Error initializing renown:",c instanceof Error?c.message:"Unknown error"),r("error");return}}return!t&&n==="idle"&&e(s(o)),t}function Gl(){if(console&&console.warn){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];typeof e[0]=="string"&&(e[0]=`react-i18next:: ${e[0]}`),console.warn(...e)}}const bo={};function jn(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];typeof e[0]=="string"&&bo[e[0]]||(typeof e[0]=="string"&&(bo[e[0]]=new Date),Gl(...e))}const Bs=(t,e)=>()=>{if(t.isInitialized)e();else{const n=()=>{setTimeout(()=>{t.off("initialized",n)},0),e()};t.on("initialized",n)}};function So(t,e,n){t.loadNamespaces(e,Bs(t,n))}function Do(t,e,n,r){typeof n=="string"&&(n=[n]),n.forEach(o=>{t.options.ns.indexOf(o)<0&&t.options.ns.push(o)}),t.loadLanguages(e,Bs(t,r))}function Kl(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const r=e.languages[0],o=e.options?e.options.fallbackLng:!1,s=e.languages[e.languages.length-1];if(r.toLowerCase()==="cimode")return!0;const i=(c,d)=>{const l=e.services.backendConnector.state[`${c}|${d}`];return l===-1||l===2};return n.bindI18n&&n.bindI18n.indexOf("languageChanging")>-1&&e.services.backendConnector.backend&&e.isLanguageChangingTo&&!i(e.isLanguageChangingTo,t)?!1:!!(e.hasResourceBundle(r,t)||!e.services.backendConnector.backend||e.options.resources&&!e.options.partialBundledLanguages||i(r,t)&&(!o||i(s,t)))}function Jl(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return!e.languages||!e.languages.length?(jn("i18n.languages were undefined or empty",e.languages),!0):e.options.ignoreJSONStructure!==void 0?e.hasLoadedNamespace(t,{lng:n.lng,precheck:(o,s)=>{if(n.bindI18n&&n.bindI18n.indexOf("languageChanging")>-1&&o.services.backendConnector.backend&&o.isLanguageChangingTo&&!s(o.isLanguageChangingTo,t))return!1}}):Kl(t,e,n)}const ql=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g,Xl={"&amp;":"&","&#38;":"&","&lt;":"<","&#60;":"<","&gt;":">","&#62;":">","&apos;":"'","&#39;":"'","&quot;":'"',"&#34;":'"',"&nbsp;":" ","&#160;":" ","&copy;":"©","&#169;":"©","&reg;":"®","&#174;":"®","&hellip;":"…","&#8230;":"…","&#x2F;":"/","&#47;":"/"},Ql=t=>Xl[t],Zl=t=>t.replace(ql,Ql);let zn={bindI18n:"languageChanged",bindI18nStore:"",transEmptyNodeValue:"",transSupportBasicHtmlNodes:!0,transWrapTextNodes:"",transKeepBasicHtmlNodesFor:["br","strong","i","p"],useSuspense:!0,unescape:Zl};function gh(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};zn={...zn,...t}}function ef(){return zn}let Fs;function _h(t){Fs=t}function tf(){return Fs}const nf=Yn();class rf{constructor(){this.usedNamespaces={}}addUsedNamespaces(e){e.forEach(n=>{this.usedNamespaces[n]||(this.usedNamespaces[n]=!0)})}getUsedNamespaces(){return Object.keys(this.usedNamespaces)}}const of=(t,e)=>{const n=Me();return ce(()=>{n.current=t},[t,e]),n.current};function Vs(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const{i18n:n}=e,{i18n:r,defaultNS:o}=Wn(nf)||{},s=n||r||tf();if(s&&!s.reportNamespaces&&(s.reportNamespaces=new rf),!s){jn("You will need to pass in an i18next instance by using initReactI18next");const k=(O,B)=>typeof B=="string"?B:B&&typeof B=="object"&&typeof B.defaultValue=="string"?B.defaultValue:Array.isArray(O)?O[O.length-1]:O,W=[k,{},!1];return W.t=k,W.i18n={},W.ready=!1,W}s.options.react&&s.options.react.wait!==void 0&&jn("It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.");const i={...ef(),...s.options.react,...e},{useSuspense:c,keyPrefix:d}=i;let l=o||s.options&&s.options.defaultNS;l=typeof l=="string"?[l]:l||["translation"],s.reportNamespaces.addUsedNamespaces&&s.reportNamespaces.addUsedNamespaces(l);const m=(s.isInitialized||s.initializedStoreOnce)&&l.every(k=>Jl(k,s,i));function f(){return s.getFixedT(e.lng||null,i.nsMode==="fallback"?l:l[0],d)}const[_,y]=He(f);let N=l.join();e.lng&&(N=`${e.lng}${N}`);const F=of(N),P=Me(!0);ce(()=>{const{bindI18n:k,bindI18nStore:W}=i;P.current=!0,!m&&!c&&(e.lng?Do(s,e.lng,l,()=>{P.current&&y(f)}):So(s,l,()=>{P.current&&y(f)})),m&&F&&F!==N&&P.current&&y(f);function O(){P.current&&y(f)}return k&&s&&s.on(k,O),W&&s&&s.store.on(W,O),()=>{P.current=!1,k&&s&&k.split(" ").forEach(B=>s.off(B,O)),W&&s&&W.split(" ").forEach(B=>s.store.off(B,O))}},[s,N]);const V=Me(!0);ce(()=>{P.current&&!V.current&&y(f),V.current=!1},[s,d]);const H=[_,s,m];if(H.t=_,H.i18n=s,H.ready=m,m||!m&&!c)return H;throw new Promise(k=>{e.lng?Do(s,e.lng,l,()=>k()):So(s,l,()=>k())})}const sf="connect";function Ln(t,e){const{type:n="default",containerId:r=sf,...o}=e||{};return aa(t,{type:n,containerId:r,...o})}const Pe=gt.routerBasename,af=(t,e,n,r)=>{const o=Ps(`${Pe}:${t}`,e,void 0);return o.debugLabel=`storageAtom:${Pe}:${t}`,o},mh=(t,e,n)=>{const r=Ps(t,e,{getItem(o,s){const i=localStorage.getItem(`${Pe}:${o}`);return i?JSON.parse(i):s},setItem(o,s){localStorage.setItem(`${Pe}:${o}`,JSON.stringify(s)),n(s)},removeItem(o){localStorage.removeItem(`${Pe}:${o}`)},subscribe(o,s){if(typeof window.addEventListener>"u")return()=>null;function i(c){c.storageArea===localStorage&&c.key===`${Pe}:${o}`&&s(c.newValue??"")}return window.addEventListener("storage",i),()=>window.removeEventListener("storage",i)}});return r.debugLabel=`storageAtomWithCallback:${Pe}:${t}`,r},cf=[ca,ua],uf=cf;function df(...t){const e=new Map;for(const n of t)e.set(n.documentModel.id,n);return Array.from(e.values())}function lf(t){return t.map(e=>e.documentModels).reduce((e,n)=>e.concat(n),[])}const cr=de(async t=>{const e=await t(Dt),n=lf(e);return df(...uf,...n)});cr.debugLabel="documentModelsAtomInConnect";const js=Ul(cr);js.debugLabel="unwrappedDocumentModelsAtomInConnect";const zs=()=>Oe(js);function ff(t,e){return e==null?void 0:e.find(n=>n.documentModel.id===t)}const pf=()=>{const t=zs();return e=>ff(e,t)},vh=()=>{const t=zs(),{config:e}=Mf(),{enabledEditors:n,disabledEditors:r}=e.editors;if(!t)return;const o=t.filter(s=>s.documentModel.id!=="powerhouse/document-drive");return n==="*"?t:r==="*"?[]:r?o.filter(s=>!r.includes(s.documentModel.id)):n?o.filter(s=>n.includes(s.documentModel.id)):o};async function hf(t,e){await _f(t,e);const n=await t.initialize(),r=n==null?void 0:n.at(0);if(r)throw r}function gf(){const t=gt.drives.sections.LOCAL.enabled,e=We(),n=Et(),r=Me(!1);ce(()=>{r.current||t&&e!==void 0&&n!==void 0&&(n.length>0||(e.addDrive({id:Le(),slug:"my-local-drive",global:{name:"My Local Drive",icon:null},local:{availableOffline:!1,sharingType:"private",listeners:[],triggers:[]}}).catch(te.error),r.current=!0))},[t,e,n])}async function _f(t,e){const n=await(e==null?void 0:e.user()),r=await Re();n!=null&&n.address&&t.setGenerateJwtHandler(async o=>r.getBearerToken(o,n.address))}async function mf(t,e,n){const r=pd(e,t);return await hf(r,n),r}const ur=de(fd(gt.routerBasename));ur.debugLabel="storageAtomInConnect";const vf=()=>Oe(ur);let xt=!1;const Hs=de(void 0);Hs.debugLabel="userAtomInConnect";const Ys=()=>{const[t,e]=$e(Hs),n=nn();return ce(()=>{var o;let r=null;if(t){const{credential:s,...i}=t;r={id:i.did,username:(o=i.ens)==null?void 0:o.name,...i}}ul(r)},[t]),ce(()=>{if(xt)return;xt=!0,n==null||n.user().then(o=>{e(o||null)}).catch(()=>{e(null)});const r=n==null?void 0:n.on.user(o=>{e(o||null)});return()=>{r==null||r(),xt=!1}},[n,xt]),t};async function Io(t,e){if(!t)return;const n=t.split("/");n.pop(),n.pop(),n.push("drives");const r=n.join("/");return(await(await fetch(r,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({query:`
12
12
  query getDriveIdBySlug($slug: String!) {
13
13
  driveIdBySlug(slug: $slug)
14
14
  }
@@ -27,5 +27,5 @@ Sentry.init({...});
27
27
  }
28
28
  }`}function bf(t,e,n){const r=wf(t),o=Ef(n),s={documentId:e,driveId:r};return la.compressToEncodedURIComponent(JSON.stringify({document:o.trim(),variables:JSON.stringify(s,null,2)}))}function wh(t,e,n){const r=yf(t),o=da(n.name),s=bf(t,e,n);return`${r}/${o}?explorerURLState=${s}`}const Sf=()=>{const{t}=Vs();return kt("div",{children:[ye("p",{className:"font-medium",children:t("notifications.reloadApp")}),kt("button",{onClick:()=>location.reload(),className:"underline decoration-solid underline-offset-2",children:[t("common.reloadConnect")," 🔄"]})]})},Ws=de("initial");Ws.debugLabel="loginStatusAtomInConnect";const Df=()=>{const[t,e]=$e(Ws),n=Ys(),r=nn(),{did:o,getBearerToken:s}=ar(),i=We(),c=J(async()=>{var _;const m=await o(),f=new URL(Il);if(f.searchParams.set("connect",m),f.searchParams.set("network",Al),f.searchParams.set("chain",Nl),window.electronAPI){const y=await window.electronAPI.protocol();f.searchParams.set("deeplink",y),await window.electronAPI.openURL(f.toString())}else{const y=new URL(window.location.pathname,window.location.origin);f.searchParams.set("returnUrl",y.toJSON()),(_=window.open(f,"_self"))==null||_.focus()}},[o]),d=J(async m=>{if(r)try{e("checking");const f=await r.user();if((f==null?void 0:f.did)===m)return e("authorized"),f;const _=await r.login(m);if(_)return e("authorized"),i==null||i.setGenerateJwtHandler(async y=>s(y,_.address)),_;e("not-authorized")}catch(f){e("not-authorized"),te.error(f)}},[r,i,s]);ce(()=>{n&&t!=="authorized"&&e("authorized")},[n,t]);const l=J(async()=>{e("initial"),await(r==null?void 0:r.logout()),i==null||i.removeJwtHandler()},[r,i]);return ht(()=>({openRenown:c,user:n,status:n?"authorized":t,login:r?d:void 0,logout:l}),[r,c,n,t,d,l])};function If(){const{user:t,status:e}=Df(),n=window.__VITE_ENVS.PH_CONNECT_ARBITRUM_ALLOW_LIST,r=window.__VITE_ENVS.PH_CONNECT_RWA_ALLOW_LIST,o=!!n&&n!=="",s=!!r&&r!=="";if(o&&s)throw new Error("Both Arbitrum and RWA allow lists are defined. Please only define one.");if(!o&&!s)return{isAllowed:!0,allowListType:"none"};if(t!==void 0){if(o){const i=n.split(",");return e!=="authorized"||!t?{isAllowed:!1,allowListType:"arbitrum"}:i.includes(t.address)?{isAllowed:!0,allowListType:"arbitrum"}:{isAllowed:!1,allowListType:"arbitrum"}}if(s){const i=r.split(",");return e!=="authorized"||!t?{isAllowed:!1,allowListType:"rwa"}:i.includes(t.address)?{isAllowed:!0,allowListType:"rwa"}:{isAllowed:!1,allowListType:"rwa"}}return{isAllowed:!0,allowListType:"none"}}}function Af(){const t=If();if(!t)return;const{allowListType:e,isAllowed:n}=t;return e==="arbitrum"?{isAllowedToCreateDocuments:n,isAllowedToEditDocuments:!0}:e==="rwa"?{isAllowedToCreateDocuments:n,isAllowedToEditDocuments:n}:{isAllowedToCreateDocuments:!0,isAllowedToEditDocuments:!0}}function Nf(t){const e=new Map;for(const n of t){const r=n.action.scope,o=e.get(r)??new Array;o.push(n),e.set(r,o)}return e}function Tf(t){const e=new Map;for(const[n,r]of t){const o=e.get(n)??new Array;for(const s of r){const i=o.find(c=>c.index===s.index);if(i){i.action.type===s.action.type&&JSON.stringify(i.action.input)===JSON.stringify(s.action.input)?console.warn(`skipping duplicate operations with index '${s.index}'`,i,s):console.warn(`skipping duplicate operations with index '${s.index}' but different actions`,i,s);continue}o.push(s)}e.set(n,o)}return e}function Gs(){const t=Hn(["useDocumentDriveServer",Math.floor(Math.random()*999).toString()]),{isAllowedToCreateDocuments:e}=Af()||{isAllowedToCreateDocuments:!1},n=Ys()||void 0,r=Wl(),{sign:o}=ar(),s=We(),i=vf(),c=pf(),d=Et(),l=ts(),m=J(async(M,x)=>s?await s.getDocument(M,x):void 0,[s]),f=J(async(M,x)=>{if(!s)return;const $=d==null?void 0:d.find(re=>re.header.id===M);if(!$)return;const G=hd(x.action,r,n),z={...x,action:{...x.action,context:{...x.action.context,...G.context}}},ne={...$},le=await so(z,o,M,ne,pn,n);try{const re=await s.queueOperation(M,le);return re.status!=="SUCCESS"&&t.error(re.error),re.document}catch(re){return t.error(re),$}},[s,d,o,n,r]),_=J(async(M,x)=>{if(!s)return;const $=d==null?void 0:d.find(me=>me.header.id===M);if(!$)return;const G={...$},z=pn($,x),ne=x.scope,re=z.operations[ne].findLast(me=>me.action.type===x.type);if(!re)throw new Error("There was an error applying the action");const be=await so(re,o,M,G,pn,n);return f(M,be)},[s,d,o,n,r,f]),y=J(async(M,x)=>{if(!s)return;const $=Nf(x),G=Tf($);let z;for(const ne of G.values())if(z=await s.queueOperations(M,ne),z.status!=="SUCCESS")break;return(z==null?void 0:z.status)!=="SUCCESS"&&t.error(z==null?void 0:z.error),z==null?void 0:z.document},[s]),N=J(async(M,x,$,G,z,ne)=>{if(!s)throw new Error("Reactor is not loaded");if(!e)throw new Error("User is not allowed to create documents");if(!(d==null?void 0:d.find(Qe=>Qe.header.id===M)))return;const re=ne??Le(),be=c($);if(!be)throw new Error(`Document model module for type ${$} not found`);const me=be.utils.createDocument({...z});me.header=pa(re,$),me.header.name=x,await s.addDocument(me);const Je=ha({id:re,name:x,documentType:$,parentFolder:G??null}),qe=await _(M,Je),Xe=qe==null?void 0:qe.state.global.nodes.find(Qe=>Qe.id===re);if(!Xe||!Rr(Xe))throw new Error("There was an error adding document");return Xe},[f,d,e]),F=J(async(M,x,$,G)=>{if(t.verbose(`addFile(drive: ${x}, name: ${$}, folder: ${G})`),!s)return;if(!e)throw new Error("User is not allowed to create files");const z=await ad(M,c),ne={header:z.header,history:z.history,initialState:z.initialState,state:z.initialState.state,operations:{global:[],local:[]},clipboard:[]},le=await N(x,$||(typeof M=="string"?z.header.name:M.name),z.header.documentType,G,ne);if(!le)throw new Error("There was an error adding file");d==null||d.find(re=>re.header.id===x),sd(le.id,z,y,{}).catch(re=>{throw re})},[N,y,c,d,e,s]),P=J(async(M,x,$,G,z)=>{if(!e)throw new Error("User is not allowed to update files");const ne=await _(M,ga({id:x,name:G||void 0,parentFolder:z,documentType:$})),le=ne==null?void 0:ne.state.global.nodes.find(re=>re.id===x);if(!le||!Rr(le))throw new Error("There was an error updating document");return le},[f,e]),V=J(async(M,x,$)=>{if(!e)throw new Error("User is not allowed to create folders");const G=Le(),z=await _(M,_a({id:G,name:x,parentFolder:$})),ne=z==null?void 0:z.state.global.nodes.find(le=>le.id===G);if(!ne||!ma(ne))throw new Error("There was an error adding folder");return ne},[f,e]),H=J(async(M,x)=>{if(!e)throw new Error("User is not allowed to delete documents");await _(M,va({id:x}))},[f,e]),k=J(async(M,x,$)=>{if(!e)throw new Error("User is not allowed to rename documents");const G=await _(M,wa({id:x,name:$})),z=G==null?void 0:G.state.global.nodes.find(ne=>ne.id===x);if(!z)throw new Error("There was an error renaming node");return z},[f,e]),W=J(async(M,x)=>{if(!e)throw new Error("User is not allowed to move documents");l!=null&&l.header.id&&await _(l.header.id,ya({srcFolder:M.id,targetParentFolder:x==null?void 0:x.id}))},[f,e,l==null?void 0:l.header.id]),O=J(async(M,x)=>{if(!s||!l)return;if(!e)throw new Error("User is not allowed to copy documents");const G=Ea({srcId:M.id,targetParentFolder:x==null?void 0:x.id,targetName:M.name},()=>Le(),l.state.global.nodes).map(ne=>ba(ne)),z=await s.addActions(l.header.id,G);return z.status!=="SUCCESS"&&t.error(`Error copying files: ${z.status}`,z.error),z.document},[e,s,l]),B=J(async(M,x)=>{if(!s)return;if(!e)throw new Error("User is not allowed to create drives");const $=M.id||Le(),G=Sa(M);return await s.addDrive({global:G.global,local:G.local,id:$},x)},[e,s]),w=J(async(M,x)=>s?await s.addRemoteDrive(M,x):void 0,[e,s]),A=J(async M=>{if(s){if(!e)throw new Error("User is not allowed to delete drives");await s.deleteDrive(M)}},[e,s]),S=J(async(M,x)=>{if(!e)throw new Error("User is not allowed to rename drives");return await _(M,Da({name:x}))},[f,e]),D=J(async(M,x)=>{if(!e)throw new Error("User is not allowed to change drive availability");return await _(M,Ia({availableOffline:x}))},[f,e]),b=J(async(M,x)=>{if(!e)throw new Error("User is not allowed to change drive availability");return await _(M,Aa({type:x}))},[f,e]),I=J(async(M,x)=>{if(x!==dt&&s)try{const $=s.getSyncStatus(M);return $ instanceof Pr?"INITIAL_SYNC":$}catch($){return console.error($),Rn}},[s]),Y=J((M,x)=>{if(x!==dt&&s)try{const $=s.getSyncStatus(M);return $ instanceof Pr?"INITIAL_SYNC":$}catch($){return console.error($),Rn}},[s]),K=J(async()=>{s&&await i.clear()},[s,i]),se=J(async(M,x)=>{const $=await _(M,Na({triggerId:x}));if($==null?void 0:$.state.local.triggers.find(z=>z.id===x))throw new Error(`There was an error removing trigger ${x}`)},[f]),he=J(async(M,x,$)=>{var le,re,be,me;if(!s)return;const G=Le(),z={driveId:M,listenerId:G,block:!1,filter:{branch:((le=$.pullFilter)==null?void 0:le.branch)??[],documentId:((re=$.pullFilter)==null?void 0:re.documentId)??[],documentType:((be=$.pullFilter)==null?void 0:be.documentType)??[],scope:((me=$.pullFilter)==null?void 0:me.scope)??[]},system:!1,label:`Pullresponder #${G}`,callInfo:{data:"",name:"PullResponder",transmitterType:"PullResponder"}},ne=s.listeners;z.transmitter=new Ta(z,ne);try{await ne.setListener(M,z)}catch(Je){throw new Error(`Listener couldn't be registered: ${Je}`)}return{driveId:M,filter:z.filter,data:{interval:`${$.pullInterval}`||"1000",listenerId:G,url:x},id:G,type:"PullResponder"}},[s]),j=J(async(M,x)=>{const $=await _(M,Oa({trigger:x}));if(!($==null?void 0:$.state.local.triggers.find(z=>z.id===z.id)))throw new Error(`There was an error adding the trigger ${x.id}`)},[f]);return ht(()=>({addDocument:N,addDocumentOperations:y,addDriveOperation:f,addFile:F,addFolder:V,openFile:m,updateFile:P,deleteNode:H,renameNode:k,moveNode:W,copyNode:O,addDrive:B,addRemoteDrive:w,deleteDrive:A,renameDrive:S,setDriveAvailableOffline:D,setDriveSharingType:b,getSyncStatus:I,getSyncStatusSync:Y,clearStorage:K,removeTrigger:se,addTrigger:j,registerNewPullResponderTrigger:he}),[N,y,f,F,V,m,P,H,k,W,O,B,w,A,S,D,b,I,Y,K,se,j,he])}const Of=1e5,Cf=(t,e)=>e?t.toLocaleLowerCase().includes(`transmitter ${e} not found`):!1,Lf=()=>{const[t,e]=He([]),[n,r]=He(new Map),{addTrigger:o,removeTrigger:s,registerNewPullResponderTrigger:i,renameDrive:c,addRemoteDrive:d,setDriveSharingType:l}=Gs(),m=Et(),f=Me(new Map),_=J(async(F,P,V)=>{e(k=>[...k,V]);const H=P.data;if(H)try{let k=n.get(V);if(!k){if(k=await i(F,H.url,{pullInterval:Number(H.interval)||3e3}),!k)return;n.set(V,k),r(n)}await s(F,P.id),await o(F,k),f.current.delete(V)}catch(k){const W=f.current.get(V)||1;f.current.set(V,W===Of?W:W*10),te.error(k)}finally{e(k=>k.filter(W=>W!==V))}},[n,s,o,f,i]),y=J(async(F,P,V)=>{var H;e(k=>[...k,V]);try{const k=m==null?void 0:m.find(W=>W.header.id===F);if(!k)return;if(await s(F,P.id),await c(F,k.state.global.name+` (${k.header.id})`),await l(F,dt),(H=P.data)!=null&&H.url&&k.header.slug){const W=await Io(P.data.url,k.header.slug);if(W){const O=P.data.url.split("/");O[O.length-1]=W;const B=O.join("/");await d(B,{availableOffline:!0,sharingType:"PUBLIC",listeners:[],triggers:[]})}}}catch(k){te.error(k)}finally{e(k=>k.filter(W=>W!==V))}},[m,s,c,l,Io,d]),N=J(async(F,P,V,H)=>{var k;switch(V){case 400:{if(Cf(H,(k=P.data)==null?void 0:k.listenerId)){if(!(localStorage.getItem("AUTO_REGISTER_PULL_RESPONDER")!=="false"))return;const O=`strands:${F}:${V}`;if(t.includes(O)||!P.data)return;const B=f.current.get(O)||0;setTimeout(()=>_(F,P,O),B)}break}case 404:{const W=`strands:${F}:${V}`;if(t.includes(W))return;setTimeout(()=>y(F,P,W),0);break}}},[y,_,t]);return ht(()=>({strandsErrorHandler:N}),[N])},Rf="feature-flags-config",$t=window.__VITE_ENVS.PH_CONNECT_ENABLED_EDITORS||void 0,Pf=$t==null?void 0:$t.split(","),Ut=window.__VITE_ENVS.PH_CONNECT_DISABLED_EDITORS||"powerhouse/document-drive",xf=Ut==null?void 0:Ut.split(","),Ks={editors:{enabledEditors:$t==="*"?"*":Pf,disabledEditors:Ut==="*"?"*":xf}},Js=af(Rf,Ks);Js.debugLabel="featureFlagAtomInConnect";const Mf=()=>{const[t,e]=$e(Js);return{config:{...Ks,...t},setConfig:e}},Ao=window.__VITE_ENVS.APP_VERSION,yh=window.navigator.userAgent.includes("Electron"),Eh=window.navigator.appVersion.includes("Mac"),No={"staging/makerdao":"deployments/staging/makerdao","staging/arbitrum":"arb-ltip","staging/powerhouse":"staging",makerdao:"deployments/makerdao",arbitrum:"deployments/arbitrum",arbgrants:"deployments/arbitrum",localhost:"develop"},$f=()=>{const t="https://raw.githubusercontent.com/powerhouse-inc/connect",e=window.location.href,n=Object.keys(No).find(o=>e.includes(o)),r=n?No[n]:void 0;if(r)return`${t}/${r}/package.json`},Uf=async()=>{const t=$f();if(!t)return;const n=await(await fetch(t)).json(),{version:r}=n;return r},kf=async()=>{const t=await Uf();return t?{isLatest:t===Ao,currentVersion:Ao,latestVersion:t}:null},Bf=()=>{const{t}=Vs(),{getSyncStatusSync:e}=Gs(),n=Me([]),r=Et();Lf();const[o]=Vc();async function s(){const c=await kf();if(c!==null){if(c.isLatest||c.currentVersion.includes("-"))return!0;window.__VITE_ENVS.MODE==="development"||o.studioMode||!o.warnOutdatedApp?te.warn(`Connect is outdated:
29
29
  Current: ${c.currentVersion}
30
- Latest: ${c.latestVersion}`):Ln(ye(Sf,{}),{type:"connect-warning",toastId:"outdated-app",autoClose:!1})}}ce(()=>{s().catch(console.error)},[]);const i=J(async(c,d)=>{c.forEach(l=>{const m=n.current.find(N=>N.header.id===l.header.id);if(!m)return;const f=Un(l),_=e(m.header.id,f),y=e(l.header.id,f);if(f!==dt&&y===Ca&&n.current.includes(l))return n.current=n.current.filter(N=>N.header.id!==l.header.id),Ln(d("notifications.driveSyncSuccess"),{type:"connect-success"});(y===hn||y===Rn)&&y!==_&&n.current.push(l)}),n.current.length>0&&await s()&&n.current.forEach(m=>{const f=Un(m),_=e(m.header.id,f);Ln(d(`notifications.${_===hn?"driveSyncConflict":"driveSyncError"}`,{drive:m.header.name}),{type:"connect-warning",toastId:`${_===hn?"driveSyncConflict":"driveSyncError"}-${m.header.id}`})})},[]);ce(()=>{i(r??[],t).catch(console.error)},[r,t,i])};var Ff=()=>null;function Vf(){const t=Oe(ur),e=Oe(cr),n=nn();rd(()=>mf(t,e,n)),gf()}const jf=Gn(()=>Te(()=>import("./useInitSentry.BXZzeAO4.js").then(t=>t.r),__vite__mapDeps([5,1,6,7]),import.meta.url)),zf=Gn(()=>Te(()=>import("./cookie-banner.H8ltpgLH.js"),__vite__mapDeps([8,6,9,10,1,11,3,4]),import.meta.url).then(t=>({default:t.CookieBanner}))),Hf=Gn(()=>Te(()=>import("./modal.Bqyzi2Hr.js"),__vite__mapDeps([10,1]),import.meta.url).then(t=>({default:t.ModalManager})));function Yf(){return Bf(),Vf(),nn(),null}const Wf=ye(Ra,{children:kt(Uc,{children:[window.__VITE_ENVS.DEV&&ye(Ff,{}),kt(xr,{fallback:ye(xa,{}),name:"AppLoader",children:[ye(Yf,{}),ye(jf,{})]}),ye(xr,{name:"CookieBanner",children:ye(Hf,{children:ye(zf,{})})})]})});function Gf(t){Vi(t).render(Wf)}const qs=document.getElementById("app");if(!qs)throw new Error("#app element not found!");Gf(qs);const bh=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));export{or as $,ar as A,pf as B,fp as C,Af as D,hd as E,so as F,Gs as G,cp as H,Uu as I,pp as J,wh as K,vh as L,hh as M,We as N,Et as O,ip as P,ap as Q,Il as R,ph as S,Df as T,yh as U,Eh as V,Hl as W,Ln as X,Xt as Y,ut as Z,ps as _,De as a,Wp as a$,we as a0,xd as a1,_e as a2,io as a3,Ip as a4,ao as a5,hs as a6,ie as a7,Dd as a8,Yt as a9,bd as aA,St as aB,Np as aC,$d as aD,Vp as aE,Pp as aF,wp as aG,bt as aH,Yp as aI,ll as aJ,md as aK,nr as aL,yl as aM,Cp as aN,Ep as aO,Ap as aP,$p as aQ,Ad as aR,Dp as aS,Kd as aT,kp as aU,Up as aV,Fp as aW,Sp as aX,Cd as aY,Lp as aZ,Md as a_,Ee as aa,xp as ab,Mp as ac,xe as ad,Ce as ae,Qt as af,Es as ag,pe as ah,ze as ai,rr as aj,Ke as ak,en as al,Bp as am,Sl as an,Hp as ao,tn as ap,fl as aq,Ds as ar,dl as as,pt as at,sr as au,qd as av,jp as aw,Ns as ax,zp as ay,Xd as az,vu as b,_p as b0,mp as b1,vp as b2,_d as b3,vd as b4,kd as b5,Tp as b6,Rd as b7,qp as b8,yp as b9,oh as bA,nh as bB,up as bC,dp as bD,Xa as bE,jl as bF,fh as bG,af as bH,$e as bI,Nu as bJ,Au as bK,sp as bL,Su as bM,_u as bN,Eu as bO,bu as bP,rp as bQ,op as bR,jn as bS,tf as bT,ef as bU,Gl as bV,nf as bW,bh as bX,Kp as ba,bp as bb,Op as bc,uh as bd,dh as be,Xp as bf,Gp as bg,Rp as bh,Zt as bi,rh as bj,wl as bk,Cs as bl,Ie as bm,ih as bn,Jp as bo,Is as bp,sh as bq,Vn as br,ch as bs,ah as bt,vo as bu,Zp as bv,Qp as bw,th as bx,eh as by,ul as bz,lp as c,Oe as d,de as e,Dt as f,gt as g,_h as h,Vs as i,qt as j,hp as k,gd as l,Al as m,Nl as n,mh as o,Ul as p,kl as q,gp as r,gh as s,lh as t,Vc as u,ts as v,Un as w,np as x,Ys as y,Wl as z};
31
- //# sourceMappingURL=index.Cx09-3h-.js.map
30
+ Latest: ${c.latestVersion}`):Ln(ye(Sf,{}),{type:"connect-warning",toastId:"outdated-app",autoClose:!1})}}ce(()=>{s().catch(console.error)},[]);const i=J(async(c,d)=>{c.forEach(l=>{const m=n.current.find(N=>N.header.id===l.header.id);if(!m)return;const f=Un(l),_=e(m.header.id,f),y=e(l.header.id,f);if(f!==dt&&y===Ca&&n.current.includes(l))return n.current=n.current.filter(N=>N.header.id!==l.header.id),Ln(d("notifications.driveSyncSuccess"),{type:"connect-success"});(y===hn||y===Rn)&&y!==_&&n.current.push(l)}),n.current.length>0&&await s()&&n.current.forEach(m=>{const f=Un(m),_=e(m.header.id,f);Ln(d(`notifications.${_===hn?"driveSyncConflict":"driveSyncError"}`,{drive:m.header.name}),{type:"connect-warning",toastId:`${_===hn?"driveSyncConflict":"driveSyncError"}-${m.header.id}`})})},[]);ce(()=>{i(r??[],t).catch(console.error)},[r,t,i])};var Ff=()=>null;function Vf(){const t=Oe(ur),e=Oe(cr),n=nn();rd(()=>mf(t,e,n)),gf()}const jf=Gn(()=>Te(()=>import("./useInitSentry.Bb28RsdX.js").then(t=>t.r),__vite__mapDeps([5,1,6,7]),import.meta.url)),zf=Gn(()=>Te(()=>import("./cookie-banner.CN8lvPw2.js"),__vite__mapDeps([8,6,9,10,1,11,3,4]),import.meta.url).then(t=>({default:t.CookieBanner}))),Hf=Gn(()=>Te(()=>import("./modal.rCKchklN.js"),__vite__mapDeps([10,1]),import.meta.url).then(t=>({default:t.ModalManager})));function Yf(){return Bf(),Vf(),nn(),null}const Wf=ye(Ra,{children:kt(Uc,{children:[window.__VITE_ENVS.DEV&&ye(Ff,{}),kt(xr,{fallback:ye(xa,{}),name:"AppLoader",children:[ye(Yf,{}),ye(jf,{})]}),ye(xr,{name:"CookieBanner",children:ye(Hf,{children:ye(zf,{})})})]})});function Gf(t){Vi(t).render(Wf)}const qs=document.getElementById("app");if(!qs)throw new Error("#app element not found!");Gf(qs);const bh=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));export{or as $,ar as A,pf as B,fp as C,Af as D,hd as E,so as F,Gs as G,cp as H,Uu as I,pp as J,wh as K,vh as L,hh as M,We as N,Et as O,ip as P,ap as Q,Il as R,ph as S,Df as T,yh as U,Eh as V,Hl as W,Ln as X,Xt as Y,ut as Z,ps as _,De as a,Wp as a$,we as a0,xd as a1,_e as a2,io as a3,Ip as a4,ao as a5,hs as a6,ie as a7,Dd as a8,Yt as a9,bd as aA,St as aB,Np as aC,$d as aD,Vp as aE,Pp as aF,wp as aG,bt as aH,Yp as aI,ll as aJ,md as aK,nr as aL,yl as aM,Cp as aN,Ep as aO,Ap as aP,$p as aQ,Ad as aR,Dp as aS,Kd as aT,kp as aU,Up as aV,Fp as aW,Sp as aX,Cd as aY,Lp as aZ,Md as a_,Ee as aa,xp as ab,Mp as ac,xe as ad,Ce as ae,Qt as af,Es as ag,pe as ah,ze as ai,rr as aj,Ke as ak,en as al,Bp as am,Sl as an,Hp as ao,tn as ap,fl as aq,Ds as ar,dl as as,pt as at,sr as au,qd as av,jp as aw,Ns as ax,zp as ay,Xd as az,vu as b,_p as b0,mp as b1,vp as b2,_d as b3,vd as b4,kd as b5,Tp as b6,Rd as b7,qp as b8,yp as b9,oh as bA,nh as bB,up as bC,dp as bD,Xa as bE,jl as bF,fh as bG,af as bH,$e as bI,Nu as bJ,Au as bK,sp as bL,Su as bM,_u as bN,Eu as bO,bu as bP,rp as bQ,op as bR,jn as bS,tf as bT,ef as bU,Gl as bV,nf as bW,bh as bX,Kp as ba,bp as bb,Op as bc,uh as bd,dh as be,Xp as bf,Gp as bg,Rp as bh,Zt as bi,rh as bj,wl as bk,Cs as bl,Ie as bm,ih as bn,Jp as bo,Is as bp,sh as bq,Vn as br,ch as bs,ah as bt,vo as bu,Zp as bv,Qp as bw,th as bx,eh as by,ul as bz,lp as c,Oe as d,de as e,Dt as f,gt as g,_h as h,Vs as i,qt as j,hp as k,gd as l,Al as m,Nl as n,mh as o,Ul as p,kl as q,gp as r,gh as s,lh as t,Vc as u,ts as v,Un as w,np as x,Ys as y,Wl as z};
31
+ //# sourceMappingURL=index.D1VdJrbu.js.map