"use strict";(globalThis.webpackChunk_affine_web=globalThis.webpackChunk_affine_web||[]).push([[1389],{53653:(e,t,a)=>{a.d(t,{A:()=>i});var s=a(4285),n=a(24312),r=a(86326);function i(){let e=(0,n.s9)(),t=(0,r.useMemo)(()=>n.YZ.find(t=>t.tag===e.language),[e.language]),a=(0,r.useMemo)(()=>n.YZ.map(e=>({tag:e.tag,originalName:e.originalName,name:e.name,Completeness:e.completeRate})),[]),i=(0,s.V)(async t=>{await e.changeLanguage(t)},[e]);return(0,r.useEffect)(()=>{t&&(document.documentElement.lang=t.tag)},[t]),(0,r.useMemo)(()=>({currentLanguage:t,languagesList:a,onLanguageChange:i}),[t,a,i])}},22563:(e,t,a)=>{a.d(t,{h:()=>i});var s=a(10980),n=a(98504),r=a(86326);function i(e){let t=(0,s.h1)(n.q),[a,i]=(0,r.useState)(null);return(0,r.useEffect)(()=>{if(!e){i(null);return}let a=t.open({metadata:e});return i(a.workspace),()=>{a.dispose()}},[e,t]),a}},41389:(e,t,a)=>{a.r(t),a.d(t,{AllWorkspaceModals:()=>sM,AuthModal:()=>s$,CurrentWorkspaceModals:()=>sA,Setting:()=>s_,SignOutConfirmModal:()=>sL});var s,n,r,i=a(36870),l=a(63234),c=a(81427),o=a(21823),d=a(10980),m=a(17049),u=a(61569),p=a(98504),h=a(5863),C=a(86326),x=a(77846),g=a(73679),j=a(62759),f=a(34310),y=a(4285),v=a(94002),b=a(52490),k=a(24312);a(56964);var w=a(21038),S=a(59481),N=a(10330),_=a(7776),$="_457yde1";let A=new b.k("CreateWorkspaceModal"),L=({loading:e,onConfirmName:t,...a})=>{let s=(0,k.s9)(),[n,r]=(0,C.useState)(""),[c,m]=(0,C.useState)(!0),p=(0,d.h1)(S.uR).session,g=(0,u.S)(p.status$),j=(0,h.Xr)(x.W7),y=(0,C.useCallback)(()=>{j(e=>({...e,openModal:!0}))},[j]),v=(0,C.useCallback)(e=>"authenticated"!==g?y():m(e),[g,y]),b=(0,C.useCallback)(()=>{t(n,c?o.j.AFFINE_CLOUD:o.j.LOCAL)},[c,t,n]),w=(0,C.useCallback)(e=>{"Enter"===e.key&&n&&b()},[b,n]);return(0,i.jsxs)(f.uo,{defaultOpen:!0,title:s["com.arms.nameWorkspace.title"](),description:s["com.arms.nameWorkspace.description"](),cancelText:s["com.arms.nameWorkspace.button.cancel"](),confirmText:s["com.arms.nameWorkspace.button.create"](),confirmButtonOptions:{variant:"primary",loading:e,disabled:!n,"data-testid":"create-workspace-create-button"},closeButtonOptions:{"data-testid":"create-workspace-close-button"},onConfirm:b,...a,children:[(0,i.jsx)("div",{className:"_457yde2",children:(0,i.jsx)(l.eu,{size:56,name:n,colorfulFallback:!0})}),(0,i.jsxs)("div",{className:"_457yde3",children:[(0,i.jsx)("div",{className:$,children:s["com.arms.nameWorkspace.subtitle.workspace-name"]()}),(0,i.jsx)(l.pd,{autoFocus:!0,"data-testid":"create-workspace-input",onKeyDown:w,placeholder:s["com.arms.nameWorkspace.placeholder"](),maxLength:64,minLength:0,onChange:r,size:"large"})]}),(0,i.jsxs)("div",{className:"_457yde4",children:[(0,i.jsx)("div",{className:$,children:s["AFFiNE Cloud"]()}),(0,i.jsxs)("div",{className:"_457yde5",children:[(0,i.jsxs)("div",{className:"_457yde6",children:[(0,i.jsxs)("div",{className:"_457yde7",children:[(0,i.jsx)("span",{children:s["com.arms.nameWorkspace.affine-cloud.title"]()}),(0,i.jsx)(l.dO,{checked:c,onChange:v,disabled:!0})]}),(0,i.jsx)("div",{className:"_457yde8",children:s["com.arms.nameWorkspace.affine-cloud.description"]()})]}),(0,i.jsx)("div",{className:"_457ydea",children:(0,i.jsx)(_.u,{})})]}),(0,i.jsx)("a",{className:"_457yde9",href:"https://affine.pro/download",target:"_blank",rel:"noreferrer",children:s["com.arms.nameWorkspace.affine-cloud.web-tips"]()})]})]})},M=({mode:e,onClose:t,onCreate:a})=>{let[s,n]=(0,C.useState)(),r=(0,k.s9)(),o=(0,d.h1)(p.q),[m,u]=(0,C.useState)(!1);(0,C.useLayoutEffect)(()=>{let s=!1;return"add"===e?(async()=>{if(!c.Ok)return;A.info("load db file"),n(void 0);let e=await c.Ok.dialog.loadDBFile();e.workspaceId&&!s?((0,N.tE)(e.workspaceId),o.list.revalidate(),a(e.workspaceId)):(e.error||e.canceled)&&(e.error&&(0,l.oR)(r[e.error]()),t())})().catch(e=>{console.error(e)}):"new"===e?n("name-workspace"):n(void 0),()=>{s=!0}},[e,t,a,r,o]);let h=(0,y.V)(async(e,t)=>{if(v.u4.$.$.$.createWorkspace({flavour:t}),!m){u(!0);{let{meta:s,defaultDocId:n}=await (0,w.R)(o,t,e);a(s.id,n)}u(!1)}},[m,a,o]),x=(0,C.useCallback)(e=>{e||t()},[t]);return"name-workspace"===s?(0,i.jsx)(L,{loading:m,open:!1!==e&&!!s,onOpenChange:x,onConfirmName:h}):(0,i.jsx)(f.aF,{open:!1!==e&&!!s,width:560,onOpenChange:x,contentOptions:{style:{padding:"10px"}},children:(0,i.jsx)("div",{className:"_457yde0"})})};var F=a(38711),E=a(99971);function R(){return(0,i.jsxs)("svg",{width:"400",height:"220",viewBox:"0 0 400 220",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[(0,i.jsxs)("g",{clipPath:"url(#clip0_5877_92351)",children:[(0,i.jsx)("g",{filter:"url(#filter0_d_5877_92351)",children:(0,i.jsx)("rect",{y:"0.0753174",width:"400",height:"220",fill:(0,E.Vg)("backgroundPrimaryColor")})}),(0,i.jsx)("rect",{x:"16",y:"10",width:"64",height:"32",rx:"12",fill:(0,E.Vg)("backgroundSecondaryColor")}),(0,i.jsxs)("g",{filter:"url(#filter1_d_5877_92351)",children:[(0,i.jsx)("rect",{x:"20",y:"14",width:"24",height:"24",rx:"8",fill:(0,E.Vg)("backgroundPrimaryColor"),shapeRendering:"crispEdges"}),(0,i.jsx)("g",{clipPath:"url(#clip1_5877_92351)",children:(0,i.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M27.8334 18.7084C26.5677 18.7084 25.5417 19.7344 25.5417 21V31C25.5417 32.2657 26.5677 33.2917 27.8334 33.2917H36.1667C37.4323 33.2917 38.4584 32.2657 38.4584 31V21C38.4584 19.7344 37.4323 18.7084 36.1667 18.7084H27.8334ZM26.7917 21C26.7917 20.4247 27.2581 19.9584 27.8334 19.9584H36.1667C36.742 19.9584 37.2084 20.4247 37.2084 21V31C37.2084 31.5753 36.742 32.0417 36.1667 32.0417H27.8334C27.2581 32.0417 26.7917 31.5753 26.7917 31V21ZM29.5 22.0417C29.1548 22.0417 28.875 22.3215 28.875 22.6667C28.875 23.0119 29.1548 23.2917 29.5 23.2917H32.4167C32.7619 23.2917 33.0417 23.0119 33.0417 22.6667C33.0417 22.3215 32.7619 22.0417 32.4167 22.0417H29.5ZM28.875 25.5834C28.875 25.2382 29.1548 24.9584 29.5 24.9584H34.5C34.8452 24.9584 35.125 25.2382 35.125 25.5834C35.125 25.9286 34.8452 26.2084 34.5 26.2084H29.5C29.1548 26.2084 28.875 25.9286 28.875 25.5834ZM29.5 27.875C29.1548 27.875 28.875 28.1549 28.875 28.5C28.875 28.8452 29.1548 29.125 29.5 29.125H33.6667C34.0119 29.125 34.2917 28.8452 34.2917 28.5C34.2917 28.1549 34.0119 27.875 33.6667 27.875H29.5Z",fill:(0,E.Vg)("primaryColor")})})]}),(0,i.jsx)("g",{clipPath:"url(#clip2_5877_92351)",children:(0,i.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M59.9735 19.9584C59.1137 19.9584 58.4167 20.6554 58.4167 21.5152C58.4167 22.3751 59.1137 23.0721 59.9735 23.0721C60.8334 23.0721 61.5304 22.3751 61.5304 21.5152C61.5304 20.6554 60.8334 19.9584 59.9735 19.9584ZM57.1667 21.5152C57.1667 19.965 58.4234 18.7084 59.9735 18.7084C61.4604 18.7084 62.6772 19.8644 62.7742 21.3266C63.4762 21.3273 64.1503 21.3383 64.8517 21.5077C65.6295 21.6956 66.4061 22.0674 67.3305 22.7607L67.3475 22.7734L67.3636 22.7873C68.669 23.9126 69.3224 25.7317 69.326 27.4358H70.7084C71.0536 27.4358 71.3334 27.7156 71.3334 28.0608V31.9881C71.3334 32.3333 71.0536 32.6131 70.7084 32.6131H66.781C66.4359 32.6131 66.156 32.3333 66.156 31.9881V28.0608C66.156 27.7156 66.4359 27.4358 66.781 27.4358H68.076C68.0724 26.0148 67.5229 24.5853 66.563 23.7476C65.7506 23.1409 65.1313 22.8612 64.5582 22.7227C63.9652 22.5795 63.3858 22.5766 62.5918 22.5766V22.5289C62.2585 23.3891 61.5135 24.0442 60.5986 24.2523V27.5056C61.8479 27.7898 62.7804 28.9073 62.7804 30.2427C62.7804 31.7928 61.5237 33.0495 59.9735 33.0495C58.4234 33.0495 57.1667 31.7928 57.1667 30.2427C57.1667 28.9073 58.0992 27.7897 59.3486 27.5056V24.2523C58.0992 23.9682 57.1667 22.8506 57.1667 21.5152ZM59.9735 28.6858C59.1137 28.6858 58.4167 29.3828 58.4167 30.2427C58.4167 31.1025 59.1137 31.7995 59.9735 31.7995C60.8334 31.7995 61.5304 31.1025 61.5304 30.2427C61.5304 29.3828 60.8334 28.6858 59.9735 28.6858ZM67.406 31.3631V28.6858H70.0834V31.3631H67.406Z",fill:(0,E.Vg)("iconColor")})}),(0,i.jsx)("rect",{x:"92",y:"10",width:"128.528",height:"32",rx:"12",fill:(0,E.Vg)("backgroundSecondaryColor")}),(0,i.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M238.998 23.4697C239.29 23.1768 239.765 23.1768 240.058 23.4697L244.174 27.5858C244.37 27.781 244.686 27.781 244.881 27.5858L248.998 23.4697C249.29 23.1768 249.765 23.1768 250.058 23.4697C250.351 23.7626 250.351 24.2374 250.058 24.5303L245.942 28.6464C245.161 29.4275 243.895 29.4275 243.114 28.6464L238.998 24.5303C238.705 24.2374 238.705 23.7626 238.998 23.4697Z",fill:(0,E.Vg)("iconColor")}),(0,i.jsx)("g",{filter:"url(#filter2_di_5877_92351)",children:(0,i.jsx)("rect",{x:"107.402",y:"32.1934",width:"211.325",height:"221.308",rx:"8",stroke:(0,E.Vg)("borderColor"),fill:(0,E.Vg)("backgroundOverlayPanelColor")})}),(0,i.jsx)("rect",{x:"120",y:"49",width:"183.726",height:"18",rx:"4",fill:(0,E.Vg)("backgroundSecondaryColor")}),(0,i.jsx)("rect",{x:"120",y:"77",width:"183.726",height:"18",rx:"4",fill:(0,E.Vg)("backgroundSecondaryColor")}),(0,i.jsx)("rect",{x:"120",y:"105",width:"183.726",height:"18",rx:"4",fill:(0,E.Vg)("backgroundSecondaryColor")}),(0,i.jsx)("rect",{x:"120",y:"133",width:"183.726",height:"18",rx:"4",fill:(0,E.Vg)("backgroundSecondaryColor")}),(0,i.jsxs)("g",{clipPath:"url(#clip3_5877_92351)",children:[(0,i.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M137.973 171.496L137.972 171.497L136.958 172.412H138.25C138.595 172.412 138.875 172.692 138.875 173.037C138.875 173.382 138.595 173.662 138.25 173.662H135.333C134.988 173.662 134.708 173.382 134.708 173.037V170.167C134.708 169.822 134.988 169.542 135.333 169.542C135.678 169.542 135.958 169.822 135.958 170.167V171.631L137.139 170.565C138.428 169.411 140.133 168.708 142 168.708C146.027 168.708 149.292 171.973 149.292 176C149.292 180.027 146.027 183.292 142 183.292C138.529 183.292 135.626 180.867 134.889 177.62C134.813 177.283 135.024 176.948 135.36 176.872C135.697 176.796 136.032 177.007 136.108 177.343C136.719 180.034 139.125 182.042 142 182.042C145.337 182.042 148.042 179.337 148.042 176C148.042 172.663 145.337 169.958 142 169.958C140.453 169.958 139.043 170.539 137.973 171.496Z",fill:(0,E.Vg)("iconColor")}),(0,i.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M142 171.625C142.345 171.625 142.625 171.905 142.625 172.25V175.741L144.942 178.058C145.186 178.302 145.186 178.698 144.942 178.942C144.698 179.186 144.302 179.186 144.058 178.942L141.582 176.466C141.45 176.334 141.375 176.153 141.375 175.966V172.25C141.375 171.905 141.655 171.625 142 171.625Z",fill:(0,E.Vg)("iconColor")})]}),(0,i.jsx)("path",{d:"M161.651 170.818L164.673 179.389H164.793L167.815 170.818H169.108L165.369 181H164.097L160.358 170.818H161.651ZM170.535 181V173.364H171.708V181H170.535ZM171.131 172.091C170.903 172.091 170.705 172.013 170.54 171.857C170.377 171.701 170.296 171.514 170.296 171.295C170.296 171.077 170.377 170.889 170.54 170.734C170.705 170.578 170.903 170.5 171.131 170.5C171.36 170.5 171.556 170.578 171.718 170.734C171.884 170.889 171.967 171.077 171.967 171.295C171.967 171.514 171.884 171.701 171.718 171.857C171.556 172.013 171.36 172.091 171.131 172.091ZM177.059 181.159C176.323 181.159 175.688 180.997 175.155 180.672C174.624 180.344 174.215 179.886 173.927 179.3C173.642 178.71 173.499 178.024 173.499 177.241C173.499 176.459 173.642 175.77 173.927 175.173C174.215 174.573 174.616 174.106 175.13 173.771C175.647 173.433 176.25 173.264 176.939 173.264C177.337 173.264 177.73 173.33 178.118 173.463C178.506 173.596 178.858 173.811 179.177 174.109C179.495 174.404 179.748 174.795 179.937 175.283C180.126 175.77 180.221 176.37 180.221 177.082V177.58H174.334V176.565H179.028C179.028 176.134 178.941 175.75 178.769 175.412C178.6 175.074 178.358 174.807 178.043 174.612C177.732 174.416 177.364 174.318 176.939 174.318C176.472 174.318 176.068 174.434 175.726 174.666C175.388 174.895 175.128 175.193 174.946 175.561C174.764 175.929 174.672 176.323 174.672 176.744V177.42C174.672 177.997 174.772 178.486 174.971 178.887C175.173 179.285 175.453 179.588 175.811 179.797C176.169 180.002 176.585 180.105 177.059 180.105C177.367 180.105 177.645 180.062 177.894 179.976C178.146 179.886 178.363 179.754 178.545 179.578C178.728 179.399 178.868 179.177 178.968 178.912L180.101 179.23C179.982 179.615 179.782 179.953 179.5 180.244C179.218 180.533 178.87 180.758 178.456 180.92C178.041 181.08 177.576 181.159 177.059 181.159ZM183.736 181L181.409 173.364H182.642L184.292 179.21H184.372L186.003 173.364H187.256L188.866 179.19H188.946L190.596 173.364H191.829L189.503 181H188.349L186.679 175.134H186.559L184.889 181H183.736ZM197.477 181V170.818H198.71V175.352H204.139V170.818H205.372V181H204.139V176.446H198.71V181H197.477ZM207.681 181V173.364H208.855V181H207.681ZM208.278 172.091C208.049 172.091 207.852 172.013 207.686 171.857C207.524 171.701 207.443 171.514 207.443 171.295C207.443 171.077 207.524 170.889 207.686 170.734C207.852 170.578 208.049 170.5 208.278 170.5C208.507 170.5 208.702 170.578 208.865 170.734C209.03 170.889 209.113 171.077 209.113 171.295C209.113 171.514 209.03 171.701 208.865 171.857C208.702 172.013 208.507 172.091 208.278 172.091ZM216.413 175.074L215.359 175.372C215.292 175.196 215.195 175.026 215.065 174.86C214.939 174.691 214.767 174.552 214.548 174.442C214.33 174.333 214.049 174.278 213.708 174.278C213.241 174.278 212.851 174.386 212.54 174.602C212.232 174.814 212.077 175.084 212.077 175.412C212.077 175.704 212.183 175.934 212.396 176.103C212.608 176.272 212.939 176.413 213.39 176.526L214.523 176.804C215.206 176.97 215.715 177.223 216.05 177.565C216.384 177.903 216.552 178.339 216.552 178.872C216.552 179.31 216.426 179.701 216.174 180.045C215.925 180.39 215.577 180.662 215.13 180.861C214.683 181.06 214.162 181.159 213.569 181.159C212.79 181.159 212.145 180.99 211.635 180.652C211.125 180.314 210.801 179.82 210.665 179.17L211.779 178.892C211.885 179.303 212.086 179.611 212.381 179.817C212.679 180.022 213.068 180.125 213.549 180.125C214.096 180.125 214.53 180.009 214.852 179.777C215.176 179.542 215.339 179.26 215.339 178.932C215.339 178.667 215.246 178.445 215.06 178.266C214.875 178.083 214.59 177.947 214.205 177.858L212.933 177.56C212.233 177.394 211.719 177.137 211.391 176.789C211.067 176.438 210.904 175.999 210.904 175.472C210.904 175.041 211.025 174.66 211.267 174.328C211.512 173.997 211.845 173.737 212.266 173.548C212.691 173.359 213.171 173.264 213.708 173.264C214.464 173.264 215.057 173.43 215.488 173.761C215.922 174.093 216.23 174.53 216.413 175.074ZM221.639 173.364V174.358H217.682V173.364H221.639ZM218.835 171.534H220.008V178.812C220.008 179.144 220.056 179.393 220.153 179.558C220.252 179.721 220.378 179.83 220.53 179.886C220.686 179.939 220.85 179.966 221.023 179.966C221.152 179.966 221.258 179.959 221.341 179.946C221.424 179.929 221.49 179.916 221.54 179.906L221.778 180.96C221.699 180.99 221.588 181.02 221.445 181.05C221.303 181.083 221.122 181.099 220.903 181.099C220.572 181.099 220.247 181.028 219.929 180.886C219.614 180.743 219.352 180.526 219.143 180.234C218.938 179.943 218.835 179.575 218.835 179.131V171.534ZM226.424 181.159C225.735 181.159 225.13 180.995 224.61 180.667C224.093 180.339 223.688 179.88 223.396 179.29C223.108 178.7 222.964 178.01 222.964 177.222C222.964 176.426 223.108 175.732 223.396 175.138C223.688 174.545 224.093 174.085 224.61 173.756C225.13 173.428 225.735 173.264 226.424 173.264C227.114 173.264 227.717 173.428 228.234 173.756C228.754 174.085 229.159 174.545 229.447 175.138C229.739 175.732 229.884 176.426 229.884 177.222C229.884 178.01 229.739 178.7 229.447 179.29C229.159 179.88 228.754 180.339 228.234 180.667C227.717 180.995 227.114 181.159 226.424 181.159ZM226.424 180.105C226.948 180.105 227.379 179.971 227.717 179.702C228.055 179.434 228.305 179.081 228.468 178.643C228.63 178.206 228.711 177.732 228.711 177.222C228.711 176.711 228.63 176.236 228.468 175.795C228.305 175.354 228.055 174.998 227.717 174.726C227.379 174.454 226.948 174.318 226.424 174.318C225.901 174.318 225.47 174.454 225.132 174.726C224.794 174.998 224.543 175.354 224.381 175.795C224.218 176.236 224.137 176.711 224.137 177.222C224.137 177.732 224.218 178.206 224.381 178.643C224.543 179.081 224.794 179.434 225.132 179.702C225.47 179.971 225.901 180.105 226.424 180.105ZM231.675 181V173.364H232.809V174.517H232.888C233.028 174.139 233.28 173.833 233.644 173.597C234.009 173.362 234.42 173.244 234.877 173.244C234.963 173.244 235.071 173.246 235.2 173.249C235.33 173.253 235.427 173.258 235.494 173.264V174.457C235.454 174.447 235.363 174.433 235.22 174.413C235.081 174.389 234.933 174.378 234.778 174.378C234.406 174.378 234.075 174.456 233.783 174.612C233.495 174.764 233.266 174.976 233.097 175.248C232.932 175.516 232.849 175.823 232.849 176.168V181H231.675ZM237.873 183.864C237.674 183.864 237.496 183.847 237.341 183.814C237.185 183.784 237.077 183.754 237.017 183.724L237.316 182.69C237.601 182.763 237.853 182.79 238.071 182.77C238.29 182.75 238.484 182.652 238.653 182.477C238.825 182.304 238.983 182.024 239.125 181.636L239.344 181.04L236.52 173.364H237.793L239.901 179.449H239.98L242.088 173.364H243.361L240.12 182.114C239.974 182.508 239.793 182.835 239.578 183.093C239.362 183.355 239.112 183.549 238.827 183.675C238.545 183.801 238.227 183.864 237.873 183.864ZM249.424 170.818L252.447 179.389H252.566L255.589 170.818H256.881L253.143 181H251.87L248.131 170.818H249.424ZM260.799 181.159C260.063 181.159 259.429 180.997 258.895 180.672C258.365 180.344 257.955 179.886 257.667 179.3C257.382 178.71 257.239 178.024 257.239 177.241C257.239 176.459 257.382 175.77 257.667 175.173C257.955 174.573 258.356 174.106 258.87 173.771C259.387 173.433 259.99 173.264 260.68 173.264C261.077 173.264 261.47 173.33 261.858 173.463C262.246 173.596 262.599 173.811 262.917 174.109C263.235 174.404 263.489 174.795 263.678 175.283C263.866 175.77 263.961 176.37 263.961 177.082V177.58H258.075V176.565H262.768C262.768 176.134 262.682 175.75 262.509 175.412C262.34 175.074 262.098 174.807 261.783 174.612C261.472 174.416 261.104 174.318 260.68 174.318C260.212 174.318 259.808 174.434 259.467 174.666C259.129 174.895 258.868 175.193 258.686 175.561C258.504 175.929 258.413 176.323 258.413 176.744V177.42C258.413 177.997 258.512 178.486 258.711 178.887C258.913 179.285 259.193 179.588 259.551 179.797C259.909 180.002 260.325 180.105 260.799 180.105C261.107 180.105 261.386 180.062 261.634 179.976C261.886 179.886 262.103 179.754 262.286 179.578C262.468 179.399 262.609 179.177 262.708 178.912L263.842 179.23C263.722 179.615 263.522 179.953 263.24 180.244C262.958 180.533 262.61 180.758 262.196 180.92C261.782 181.08 261.316 181.159 260.799 181.159ZM265.746 181V173.364H266.879V174.517H266.959C267.098 174.139 267.35 173.833 267.714 173.597C268.079 173.362 268.49 173.244 268.947 173.244C269.034 173.244 269.141 173.246 269.271 173.249C269.4 173.253 269.498 173.258 269.564 173.264V174.457C269.524 174.447 269.433 174.433 269.29 174.413C269.151 174.389 269.004 174.378 268.848 174.378C268.477 174.378 268.145 174.456 267.854 174.612C267.565 174.764 267.337 174.976 267.168 175.248C267.002 175.516 266.919 175.823 266.919 176.168V181H265.746ZM276.364 175.074L275.31 175.372C275.244 175.196 275.146 175.026 275.017 174.86C274.891 174.691 274.718 174.552 274.499 174.442C274.281 174.333 274.001 174.278 273.659 174.278C273.192 174.278 272.802 174.386 272.491 174.602C272.183 174.814 272.029 175.084 272.029 175.412C272.029 175.704 272.135 175.934 272.347 176.103C272.559 176.272 272.89 176.413 273.341 176.526L274.475 176.804C275.157 176.97 275.666 177.223 276.001 177.565C276.336 177.903 276.503 178.339 276.503 178.872C276.503 179.31 276.377 179.701 276.125 180.045C275.877 180.39 275.529 180.662 275.081 180.861C274.634 181.06 274.113 181.159 273.52 181.159C272.741 181.159 272.097 180.99 271.586 180.652C271.076 180.314 270.753 179.82 270.617 179.17L271.73 178.892C271.836 179.303 272.037 179.611 272.332 179.817C272.63 180.022 273.02 180.125 273.5 180.125C274.047 180.125 274.481 180.009 274.803 179.777C275.128 179.542 275.29 179.26 275.29 178.932C275.29 178.667 275.197 178.445 275.012 178.266C274.826 178.083 274.541 177.947 274.156 177.858L272.884 177.56C272.184 177.394 271.671 177.137 271.343 176.789C271.018 176.438 270.855 175.999 270.855 175.472C270.855 175.041 270.976 174.66 271.218 174.328C271.463 173.997 271.797 173.737 272.218 173.548C272.642 173.359 273.122 173.264 273.659 173.264C274.415 173.264 275.008 173.43 275.439 173.761C275.873 174.093 276.182 174.53 276.364 175.074ZM278.269 181V173.364H279.442V181H278.269ZM278.866 172.091C278.637 172.091 278.44 172.013 278.274 171.857C278.112 171.701 278.031 171.514 278.031 171.295C278.031 171.077 278.112 170.889 278.274 170.734C278.44 170.578 278.637 170.5 278.866 170.5C279.094 170.5 279.29 170.578 279.452 170.734C279.618 170.889 279.701 171.077 279.701 171.295C279.701 171.514 279.618 171.701 279.452 171.857C279.29 172.013 279.094 172.091 278.866 172.091ZM284.694 181.159C284.004 181.159 283.399 180.995 282.879 180.667C282.362 180.339 281.958 179.88 281.666 179.29C281.378 178.7 281.233 178.01 281.233 177.222C281.233 176.426 281.378 175.732 281.666 175.138C281.958 174.545 282.362 174.085 282.879 173.756C283.399 173.428 284.004 173.264 284.694 173.264C285.383 173.264 285.986 173.428 286.503 173.756C287.024 174.085 287.428 174.545 287.716 175.138C288.008 175.732 288.154 176.426 288.154 177.222C288.154 178.01 288.008 178.7 287.716 179.29C287.428 179.88 287.024 180.339 286.503 180.667C285.986 180.995 285.383 181.159 284.694 181.159ZM284.694 180.105C285.217 180.105 285.648 179.971 285.986 179.702C286.324 179.434 286.575 179.081 286.737 178.643C286.899 178.206 286.981 177.732 286.981 177.222C286.981 176.711 286.899 176.236 286.737 175.795C286.575 175.354 286.324 174.998 285.986 174.726C285.648 174.454 285.217 174.318 284.694 174.318C284.17 174.318 283.739 174.454 283.401 174.726C283.063 174.998 282.813 175.354 282.65 175.795C282.488 176.236 282.407 176.711 282.407 177.222C282.407 177.732 282.488 178.206 282.65 178.643C282.813 179.081 283.063 179.434 283.401 179.702C283.739 179.971 284.17 180.105 284.694 180.105ZM291.118 176.406V181H289.945V173.364H291.078V174.557H291.178C291.357 174.169 291.629 173.857 291.993 173.622C292.358 173.384 292.828 173.264 293.405 173.264C293.922 173.264 294.375 173.37 294.762 173.582C295.15 173.791 295.452 174.109 295.667 174.537C295.883 174.961 295.99 175.498 295.99 176.148V181H294.817V176.227C294.817 175.627 294.661 175.16 294.35 174.825C294.038 174.487 293.611 174.318 293.067 174.318C292.693 174.318 292.358 174.399 292.063 174.562C291.771 174.724 291.541 174.961 291.372 175.273C291.203 175.584 291.118 175.962 291.118 176.406Z",fill:(0,E.Vg)("textPrimaryColor")}),(0,i.jsx)("rect",{x:"120",y:"201",width:"183.726",height:"18",rx:"4",fill:(0,E.Vg)("backgroundSecondaryColor")})]}),(0,i.jsxs)("defs",{children:[(0,i.jsxs)("filter",{id:"filter0_d_5877_92351",x:"-7.65691",y:"-7.5816",width:"415.314",height:"235.314",filterUnits:"userSpaceOnUse",colorInterpolationFilters:"sRGB",children:[(0,i.jsx)("feFlood",{floodOpacity:"0",result:"BackgroundImageFix"}),(0,i.jsx)("feColorMatrix",{in:"SourceAlpha",type:"matrix",values:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0",result:"hardAlpha"}),(0,i.jsx)("feOffset",{}),(0,i.jsx)("feGaussianBlur",{stdDeviation:"3.82846"}),(0,i.jsx)("feComposite",{in2:"hardAlpha",operator:"out"}),(0,i.jsx)("feColorMatrix",{type:"matrix",values:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.05 0"}),(0,i.jsx)("feBlend",{mode:"normal",in2:"BackgroundImageFix",result:"effect1_dropShadow_5877_92351"}),(0,i.jsx)("feBlend",{mode:"normal",in:"SourceGraphic",in2:"effect1_dropShadow_5877_92351",result:"shape"})]}),(0,i.jsxs)("filter",{id:"filter1_d_5877_92351",x:"16",y:"10",width:"32",height:"32",filterUnits:"userSpaceOnUse",colorInterpolationFilters:"sRGB",children:[(0,i.jsx)("feFlood",{floodOpacity:"0",result:"BackgroundImageFix"}),(0,i.jsx)("feColorMatrix",{in:"SourceAlpha",type:"matrix",values:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0",result:"hardAlpha"}),(0,i.jsx)("feOffset",{}),(0,i.jsx)("feGaussianBlur",{stdDeviation:"2"}),(0,i.jsx)("feComposite",{in2:"hardAlpha",operator:"out"}),(0,i.jsx)("feColorMatrix",{type:"matrix",values:"0 0 0 0 0.258824 0 0 0 0 0.254902 0 0 0 0 0.286275 0 0 0 0.14 0"}),(0,i.jsx)("feBlend",{mode:"normal",in2:"BackgroundImageFix",result:"effect1_dropShadow_5877_92351"}),(0,i.jsx)("feBlend",{mode:"normal",in:"SourceGraphic",in2:"effect1_dropShadow_5877_92351",result:"shape"})]}),(0,i.jsxs)("filter",{id:"filter2_di_5877_92351",x:"95.4016",y:"20.1934",width:"235.325",height:"245.308",filterUnits:"userSpaceOnUse",colorInterpolationFilters:"sRGB",children:[(0,i.jsx)("feFlood",{floodOpacity:"0",result:"BackgroundImageFix"}),(0,i.jsx)("feColorMatrix",{in:"SourceAlpha",type:"matrix",values:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0",result:"hardAlpha"}),(0,i.jsx)("feOffset",{}),(0,i.jsx)("feGaussianBlur",{stdDeviation:"6"}),(0,i.jsx)("feComposite",{in2:"hardAlpha",operator:"out"}),(0,i.jsx)("feColorMatrix",{type:"matrix",values:"0 0 0 0 0.258824 0 0 0 0 0.254902 0 0 0 0 0.286275 0 0 0 0.14 0"}),(0,i.jsx)("feBlend",{mode:"normal",in2:"BackgroundImageFix",result:"effect1_dropShadow_5877_92351"}),(0,i.jsx)("feBlend",{mode:"normal",in:"SourceGraphic",in2:"effect1_dropShadow_5877_92351",result:"shape"}),(0,i.jsx)("feColorMatrix",{in:"SourceAlpha",type:"matrix",values:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0",result:"hardAlpha"}),(0,i.jsx)("feMorphology",{radius:"0.5",operator:"erode",in:"SourceAlpha",result:"effect2_innerShadow_5877_92351"}),(0,i.jsx)("feOffset",{}),(0,i.jsx)("feComposite",{in2:"hardAlpha",operator:"arithmetic",k2:"-1",k3:"1"}),(0,i.jsx)("feColorMatrix",{type:"matrix",values:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0"}),(0,i.jsx)("feBlend",{mode:"normal",in2:"shape",result:"effect2_innerShadow_5877_92351"})]}),(0,i.jsx)("clipPath",{id:"clip0_5877_92351",children:(0,i.jsx)("rect",{width:"400",height:"220",fill:"white"})}),(0,i.jsx)("clipPath",{id:"clip1_5877_92351",children:(0,i.jsx)("rect",{width:"20",height:"20",fill:"white",transform:"translate(22 16)"})}),(0,i.jsx)("clipPath",{id:"clip2_5877_92351",children:(0,i.jsx)("rect",{width:"20",height:"20",fill:"white",transform:"translate(54 16)"})}),(0,i.jsx)("clipPath",{id:"clip3_5877_92351",children:(0,i.jsx)("rect",{width:"20",height:"20",fill:"white",transform:"translate(132 166)"})})]})]})}let P=()=>{let e=(0,k.s9)(),t=(0,d.h1)(m.j).workspace,[a,s]=(0,h.fp)(x.Jr),n=(0,F.K)(),r=(0,C.useCallback)(()=>{s(!1),n(t)},[n,t,s]);return(0,i.jsx)(l.of,{open:a,topImage:(0,i.jsx)(R,{}),title:e["com.arms.history-vision.tips-modal.title"](),onOpenChange:s,description:e["com.arms.history-vision.tips-modal.description"](),cancelText:e["com.arms.history-vision.tips-modal.cancel"](),confirmButtonOptions:{variant:"primary"},onConfirm:r,confirmText:e["com.arms.history-vision.tips-modal.confirm"]()})},I=()=>{let e=(0,k.s9)(),[t,a]=(0,h.fp)(x.tc);return(0,i.jsx)(l.of,{open:t,topImage:(0,i.jsx)("video",{width:400,height:300,style:{objectFit:"cover"},src:"/static/newIssue.mp4",autoPlay:!0,loop:!0}),title:e["com.arms.issue-feedback.title"](),onOpenChange:a,description:e["com.arms.issue-feedback.description"](),cancelText:e["com.arms.issue-feedback.cancel"](),to:"https://github.com/toeverything/AFFiNE/issues/new/choose",confirmText:e["com.arms.issue-feedback.confirm"](),confirmButtonOptions:{variant:"primary"},external:!0})};var O=a(61953),B=a(52114),T=a(1630),V=a.n(T);let Z=()=>{let e=(0,k.s9)(),t=(0,d.h1)(m.j).workspace,[a,s]=(0,h.fp)(x.Tb),n=(0,d.h1)(B.P);(0,C.useEffect)(()=>{n.quota.revalidate()},[n]);let r=(0,u.S)(n.quota.quota$),l=(0,d.h1)(O.Q),c=(0,u.S)(l.permission.isOwner$);(0,C.useEffect)(()=>{l.permission.revalidate()},[l]);let o=(0,d.h1)(S.RK),p=(0,u.S)(o.quota.quota$.map(e=>e?{name:e.humanReadable.name,blobLimit:e.humanReadable.blobLimit}:null)),g=(0,C.useMemo)(()=>c&&p?.name==="free",[c,p]),j=(0,h.Xr)(x.JO),y=(0,C.useCallback)(()=>{j({open:!0,activeTab:"plans",scrollAnchor:"cloudPricingPlan"}),v.u4.$.paywall.storage.viewPlans(),s(!1)},[s,j]),b=(0,C.useMemo)(()=>p&&g?e["com.arms.payment.blob-limit.description.owner.free"]({planName:p.name,currentQuota:p.blobLimit,upgradeQuota:"100MB"}):c&&p&&"pro"===p.name.toLowerCase()?e["com.arms.payment.blob-limit.description.owner.pro"]({planName:p.name,quota:p.blobLimit}):r?e["com.arms.payment.blob-limit.description.member"]({quota:r.humanReadable.blobLimit}):null,[p,g,c,r,e]);return(0,C.useEffect)(()=>{if(!r)return;t.engine.blob.singleBlobSizeLimit=V().parse(r.blobLimit.toString());let e=t.engine.blob.onAbortLargeBlob.on(()=>{s(!0)});return()=>{e?.dispose()}},[t.engine.blob,s,r]),(0,i.jsx)(f.uo,{open:a,title:e["com.arms.payment.blob-limit.title"](),onOpenChange:s,description:b,cancelButtonOptions:{hidden:!g},onConfirm:y,confirmText:g?e["com.arms.payment.upgrade"]():e["Got it"](),confirmButtonOptions:{variant:"primary"}})},H=()=>{let e=(0,k.s9)(),t=(0,d.h1)(m.j).workspace,[a,s]=(0,h.fp)(x.Tb),n=(0,C.useCallback)(()=>{s(!1)},[s]);return(0,C.useEffect)(()=>{let e=t.engine.blob.onAbortLargeBlob.on(()=>{s(!0)});return()=>{e?.dispose()}},[t.engine.blob.onAbortLargeBlob,s]),(0,i.jsx)(f.uo,{open:a,title:e["com.arms.payment.blob-limit.title"](),description:e["com.arms.payment.blob-limit.description.local"]({quota:"100MB"}),onOpenChange:s,cancelButtonOptions:{hidden:!0},onConfirm:n,confirmText:e["Got it"](),confirmButtonOptions:{variant:"primary"}})},D=({title:e,subtitle:t,...a})=>(0,i.jsxs)("div",{className:"_43pnlm0",...a,children:[(0,i.jsx)("div",{className:"title",children:e}),t?(0,i.jsx)("div",{className:"subtitle",children:t}):null]});var q=a(37064);let U=({name:e,desc:t,children:a,onClick:s,style:n,spreadCol:r=!0,disabled:l=!1,className:c,...o})=>(0,i.jsxs)("div",{className:(0,q.A)("_43pnlm2",{"two-col":r,disabled:l},c),style:n,onClick:s,"data-testid":o["data-testid"],children:[(0,i.jsxs)("div",{className:"left-col",children:[(0,i.jsx)("div",{className:"name",children:e}),(0,i.jsx)("div",{className:"desc",children:t})]}),r?(0,i.jsx)("div",{className:"right-col",children:a}):a]});var z=a(59097);let W=({title:e,children:t})=>(0,i.jsxs)("div",{className:"_43pnlm1",children:[e?(0,i.jsx)("div",{className:"title",children:e}):null,t]}),K=()=>(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(D,{title:(0,i.jsx)(z.E,{}),subtitle:(0,i.jsx)(z.E,{})}),Array.from({length:3},(e,t)=>(0,i.jsx)(W,{title:(0,i.jsx)(z.E,{}),children:(0,i.jsx)(U,{name:(0,i.jsx)(z.E,{}),desc:(0,i.jsx)(z.E,{}),spreadCol:!1})},t))]});var G=a(23675);let X=()=>(0,i.jsxs)(G.Z6,{alignItems:"center",style:{padding:"0 24px",height:30,marginBottom:4},children:[(0,i.jsx)(z.E,{variant:"circular",width:14,height:14,style:{marginRight:10}}),(0,i.jsx)(z.E,{variant:"rectangular",height:16,width:0,style:{flexGrow:1}})]}),Y=()=>(0,i.jsx)(i.Fragment,{children:Array.from({length:5},(e,t)=>(0,i.jsx)(X,{},t))});var J=a(45483),Q=a(55161),ee=a(80198),et=a(55683),ea=a(27502),es=a(53216);let en=({fileChange:e,accept:t,children:a,disabled:s,...n})=>{let r=(0,k.s9)(),l=(0,C.useRef)(null);return s?a??(0,i.jsx)(et.$n,{children:r.Upload()}):(0,i.jsxs)("div",{style:{display:"flex"},onClick:()=>{l.current&&l.current.click()},children:[a??(0,i.jsx)(et.$n,{children:r.Upload()}),(0,i.jsx)("input",{ref:l,type:"file",style:{display:"none"},onChange:t=>{let a=t.target.files;a&&(e(a[0]),l.current&&(l.current.value=""))},accept:t,...n})]})};var er=a(99029),ei=a(29007),el=a(30397);let ec=e=>{let t=(0,k.s9)(),[a,s]=(0,C.useState)(!1),[n,r]=(0,C.useState)((0,el.Ak)()),c=(0,d.h1)(S.nC).subscription,o=(0,d.h1)(S.uR),{openConfirmModal:m}=(0,l.fl)(),u=(0,er.k)(),p=(0,y.V)(async()=>{let e=c.ai$.value;e&&v.u4.$.settingsPanel.plans.cancelSubscription({plan:es.R$.AI,recurring:e.recurring}),m({title:t["com.arms.payment.ai.action.cancel.confirm.title"](),description:t["com.arms.payment.ai.action.cancel.confirm.description"](),reverseFooter:!0,confirmText:t["com.arms.payment.ai.action.cancel.confirm.confirm-text"](),confirmButtonOptions:{variant:"secondary"},cancelText:t["com.arms.payment.ai.action.cancel.confirm.cancel-text"](),cancelButtonOptions:{variant:"primary"},onConfirm:async()=>{try{s(!0),await c.cancelSubscription(n,es.R$.AI),r((0,el.Ak)()),v.u4.$.settingsPanel.plans.confirmCancelingSubscription({plan:es.R$.AI,recurring:e?.recurring});let t=o.session.account$.value,a=c.ai$.value?.recurring;t&&a&&u((0,ei.Pc)({email:t.email,name:t.info?.name,id:t.id,plan:es.R$.AI,recurring:a}))}finally{s(!1)}}})},[c,m,t,n,o.session.account$.value,u]);return(0,i.jsx)(l.$n,{onClick:p,loading:a,variant:"primary",...e,children:t["com.arms.payment.ai.action.cancel.button-label"]()})},eo=e=>{let t=(0,k.s9)(),a=(0,h.Xr)(x.W7),s=(0,C.useCallback)(()=>{a(e=>({...e,openModal:!0}))},[a]);return(0,i.jsx)(l.$n,{onClick:s,variant:"primary",...e,children:t["com.arms.payment.ai.action.login.button-label"]()})},ed=e=>{let t=(0,k.s9)(),[a,s]=(0,C.useState)((0,el.Ak)()),n=(0,d.h1)(S.nC).subscription,[r,c]=(0,C.useState)(!1),{openConfirmModal:o}=(0,l.fl)(),m=(0,y.V)(async()=>{let e=n.ai$.value;e&&v.u4.$.settingsPanel.plans.resumeSubscription({plan:es.R$.AI,recurring:e.recurring}),o({title:t["com.arms.payment.ai.action.resume.confirm.title"](),description:t["com.arms.payment.ai.action.resume.confirm.description"](),confirmText:t["com.arms.payment.ai.action.resume.confirm.confirm-text"](),confirmButtonOptions:{variant:"primary"},cancelText:t["com.arms.payment.ai.action.resume.confirm.cancel-text"](),onConfirm:async()=>{c(!0),await n.resumeSubscription(a,es.R$.AI),e&&v.u4.$.settingsPanel.plans.confirmResumingSubscription({plan:e.plan,recurring:e.recurring}),(0,l.me)({icon:(0,i.jsx)(J.SingleSelectSelectSolidIcon,{}),iconColor:(0,E.Vg)("processingColor"),title:t["com.arms.payment.ai.action.resume.confirm.notify.title"](),message:t["com.arms.payment.ai.action.resume.confirm.notify.msg"]()}),s((0,el.Ak)())}})},[n,o,t,a]);return(0,i.jsx)(l.$n,{loading:r,onClick:m,variant:"primary",...e,children:t["com.arms.payment.ai.action.resume.button-label"]()})};var em=a(86639);let eu=({displayedFrequency:e="yearly",...t})=>{let[a,s]=(0,C.useState)((0,el.Ak)()),[n,r]=(0,C.useState)(!1),[c,o]=(0,C.useState)(!1),m=(0,d.h1)(S.uR),p=(0,d.h1)(S.nC),h=(0,u.S)(p.prices.aiPrice$);(0,C.useEffect)(()=>{p.prices.revalidate()},[p]);let x=(0,k.s9)();(0,C.useEffect)(()=>{if(c)return window.addEventListener("focus",p.subscription.revalidate),()=>{window.removeEventListener("focus",p.subscription.revalidate)}},[c,p]);let g=(0,y.V)(async()=>{r(!0),v.u4.$.settingsPanel.plans.checkout({plan:es.R$.AI,recurring:es.zS.Yearly});try{let e=await p.createCheckoutSession({recurring:es.zS.Yearly,idempotencyKey:a,plan:es.R$.AI,coupon:null,successCallbackLink:(0,ei.e6)(m.session.account$.value,es.R$.AI,es.zS.Yearly)});(0,em.RM)(e),o(!0),s((0,el.Ak)())}finally{r(!1)}},[m,a,p]);if(!h||!h.yearlyAmount)return(0,i.jsx)(l.EA,{className:t.className,width:160,height:36,style:{borderRadius:18,...t.style}});let j=`$${(h.yearlyAmount/100/("yearly"===e?1:12)).toFixed(2)}`,f="yearly"===e?x["com.arms.payment.billing-setting.year"]():x["com.arms.payment.billing-setting.month"]();return(0,i.jsxs)(l.$n,{loading:n,onClick:g,variant:"primary",...t,children:[t.children??`${j} / ${f}`,"monthly"===e?(0,i.jsx)("span",{style:{fontSize:10,opacity:.75,letterSpacing:-.2,paddingLeft:4},children:x["com.arms.payment.ai.subscribe.billed-annually"]()}):null]})};var ep="xhwnaf2",eh="xhwnaf0",eC="xhwnaf1";let ex=()=>{let e=(0,k.s9)(),t=(0,h.Xr)(x.JO),a=(0,d.h1)(S.BB),s=(0,u.S)(a.serverConfig.features$.map(e=>e?.payment)),n=(0,d.h1)(S.nC),r=(0,u.S)(n.subscription.ai$);(0,C.useEffect)(()=>{n.subscription.revalidate()},[n]);let c=(0,d.h1)(S.bl);(0,C.useEffect)(()=>{c.copilotQuota.revalidate()},[c]);let o=(0,u.S)(c.copilotQuota.copilotActionLimit$),m=(0,u.S)(c.copilotQuota.copilotActionUsed$),p=null===o||null===m,g=(0,u.S)(c.copilotQuota.error$),j=(0,C.useCallback)(()=>{t({open:!0,activeTab:"billing"}),v.u4.$.settingsPanel.accountUsage.viewPlans({plan:es.R$.AI})},[t]);if(p)return g?(0,i.jsx)(U,{name:e["com.arms.payment.ai.usage-title"](),desc:"",spreadCol:!1,children:(0,i.jsx)(l.Kw,{children:"Load error"})}):(0,i.jsx)(U,{name:e["com.arms.payment.ai.usage-title"](),desc:"",spreadCol:!1,children:(0,i.jsx)(l.EA,{height:42})});let f="unlimited"===o?0:Math.min(100,Math.max(.5,Number((m/o*100).toFixed(4)))),y=f>80?(0,E.Vg)("errorColor"):(0,E.Vg)("processingColor");return(0,i.jsx)(U,{spreadCol:!!r,desc:r?e["com.arms.payment.ai.usage-description-purchased"]():"",name:e["com.arms.payment.ai.usage-title"](),children:"unlimited"===o?s&&r?.canceledAt?(0,i.jsx)(ed,{}):(0,i.jsx)(l.$n,{onClick:j,children:e["com.arms.payment.ai.usage.change-button-label"]()}):(0,i.jsxs)("div",{className:eh,children:[(0,i.jsxs)("div",{className:eC,children:[(0,i.jsxs)("div",{className:"storage-progress-desc",children:[(0,i.jsx)("span",{children:e["com.arms.payment.ai.usage.used-caption"]()}),(0,i.jsx)("span",{children:e["com.arms.payment.ai.usage.used-detail"]({used:m.toString(),limit:o.toString()})})]}),(0,i.jsx)("div",{className:"storage-progress-bar-wrapper",children:(0,i.jsx)("div",{className:ep,style:{width:`${f}%`,backgroundColor:y}})})]}),s&&(0,i.jsx)(eu,{variant:"primary",children:e["com.arms.payment.ai.usage.purchase-button-label"]()})]})})};!function(e){e.Primary="primary",e.Default="secondary"}(s||(s={}));let eg=({onUpgrade:e})=>{let t=(0,k.s9)(),a=(0,d.h1)(S.RK).quota;(0,C.useEffect)(()=>{a.revalidate()},[a]);let s=(0,u.S)(a.color$),n=(0,u.S)(a.usedFormatted$),r=(0,u.S)(a.maxFormatted$),c=(0,u.S)(a.percent$),o=(0,d.h1)(S.BB),m=(0,u.S)(o.serverConfig.features$.map(e=>e?.payment)),p=(0,d.h1)(S.nC).subscription;(0,C.useEffect)(()=>{p.revalidate()},[p]);let h=(0,u.S)(p.pro$),x=!h,g=(0,u.S)(a.quota$.map(e=>null!==e?e?.humanReadable.name:null)),j=(0,u.S)(a.error$),f=(0,C.useMemo)(()=>x?"primary":"secondary",[x]);return null===h||null===c||null===g?j?(0,i.jsx)(l.Kw,{children:"Load error"}):(0,i.jsx)(l.EA,{height:42}):(0,i.jsxs)("div",{className:eh,children:[(0,i.jsxs)("div",{className:eC,children:[(0,i.jsxs)("div",{className:"storage-progress-desc",children:[(0,i.jsx)("span",{children:t["com.arms.storage.used.hint"]()}),(0,i.jsxs)("span",{children:[n,"/",r,` (${g} ${t["com.arms.storage.plan"]()})`]})]}),(0,i.jsx)("div",{className:"storage-progress-bar-wrapper",children:(0,i.jsx)("div",{className:ep,style:{width:`${c}%`,backgroundColor:s??(0,E.Vg)("processingColor")}})})]}),m?(0,i.jsx)(l.m_,{options:{hidden:c<100},content:x?t["com.arms.storage.maximum-tips"]():t["com.arms.storage.maximum-tips.pro"](),children:(0,i.jsx)("span",{tabIndex:0,children:(0,i.jsx)(l.$n,{variant:f,onClick:e,children:x?t["com.arms.storage.upgrade"]():t["com.arms.storage.change-plan"]()})})}):null]})},ej=()=>{let e=(0,k.s9)(),t=(0,d.h1)(S.uR).session,a=(0,u.M)(t.account$),s=(0,y.V)(async e=>{try{v.u4.$.settingsPanel.accountSettings.uploadAvatar(),await t.uploadAvatar(e),l.me.success({title:"Update user avatar success"})}catch(e){l.me.error({title:"Update user avatar failed",message:String(e)})}},[t]),n=(0,ea.A)(async()=>{v.u4.$.settingsPanel.accountSettings.removeAvatar(),await t.removeAvatar()},[t]);return(0,i.jsx)(en,{accept:"image/gif,image/jpeg,image/jpg,image/png,image/svg",fileChange:s,"data-testid":"upload-user-avatar",children:(0,i.jsx)(ee.e,{size:56,name:a.label,url:a.avatar,hoverIcon:(0,i.jsx)(J.CameraIcon,{}),onRemove:a.avatar?n:void 0,avatarTooltipOptions:{content:e["Click to replace photo"]()},removeTooltipOptions:{content:e["Remove photo"]()},"data-testid":"user-setting-avatar",removeButtonProps:{"data-testid":"user-setting-remove-avatar-button"}})})},ef=()=>{let e=(0,k.s9)(),t=(0,d.h1)(S.uR).session,a=(0,u.M)(t.account$),[s,n]=(0,C.useState)(a.label),r=!!s&&s!==a.label,c=(0,y.V)(async()=>{if(null!==a&&r)try{v.u4.$.settingsPanel.accountSettings.updateUserName(),await t.updateLabel(s)}catch(e){l.me.error({title:"Failed to update user name.",message:String(e)})}},[a,r,t,s]);return(0,i.jsx)(U,{name:e["com.arms.settings.profile"](),desc:e["com.arms.settings.profile.message"](),spreadCol:!1,children:(0,i.jsxs)(l.Z6,{style:{margin:"12px 0 24px 0"},alignItems:"center",children:[(0,i.jsx)(ej,{}),(0,i.jsxs)("div",{className:"_6mftq30",children:[(0,i.jsx)("label",{children:e["com.arms.settings.profile.name"]()}),(0,i.jsxs)(l.Z6,{alignItems:"center",children:[(0,i.jsx)(l.pd,{defaultValue:s,"data-testid":"user-name-input",placeholder:e["com.arms.settings.profile.placeholder"](),maxLength:64,minLength:0,style:{width:280,height:32},onChange:n,onEnter:c}),r?(0,i.jsx)(et.$n,{"data-testid":"save-user-name",onClick:c,style:{marginLeft:"12px"},children:e["com.arms.editCollection.save"]()}):null]})]})]})})},ey=()=>{let e=(0,k.s9)(),t=(0,h.Xr)(x.JO),a=(0,C.useCallback)(()=>{v.u4.$.settingsPanel.accountUsage.viewPlans({plan:es.R$.Pro}),t({open:!0,activeTab:"plans",scrollAnchor:"cloudPricingPlan"})},[t]);return(0,i.jsx)(U,{name:e["com.arms.storage.title"](),desc:"",spreadCol:!1,children:(0,i.jsx)(eg,{onUpgrade:a})})},ev=()=>{let{authService:e,serverConfigService:t}=(0,d.A$)({AuthService:S.uR,ServerConfigService:S.BB}),a=(0,u.S)(t.serverConfig.features$),s=(0,k.s9)(),n=e.session;(0,C.useEffect)(()=>{n.revalidate()},[n]);let r=(0,u.M)(n.account$),l=(0,h.Xr)(x.W7),c=(0,h.Xr)(x.G4),o=(0,C.useCallback)(()=>{l({openModal:!0,state:"sendEmail",email:r.email,emailType:r.info?.emailVerified?"changeEmail":"verifyEmail"})},[r.email,r.info?.emailVerified,l]),m=(0,C.useCallback)(()=>{l({openModal:!0,state:"sendEmail",email:r.email,emailType:r.info?.hasPassword?"changePassword":"setPassword"})},[r.email,r.info?.hasPassword,l]),p=(0,C.useCallback)(()=>{c(!0)},[c]);return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(D,{title:s["com.arms.setting.account"](),subtitle:s["com.arms.setting.account.message"](),"data-testid":"account-title"}),(0,i.jsx)(ef,{}),(0,i.jsx)(U,{name:s["com.arms.settings.email"](),desc:r.email,children:(0,i.jsx)(et.$n,{onClick:o,children:r.info?.emailVerified?s["com.arms.settings.email.action.change"]():s["com.arms.settings.email.action.verify"]()})}),(0,i.jsx)(U,{name:s["com.arms.settings.password"](),desc:s["com.arms.settings.password.message"](),children:(0,i.jsx)(et.$n,{onClick:m,children:r.info?.hasPassword?s["com.arms.settings.password.action.change"]():s["com.arms.settings.password.action.set"]()})}),(0,i.jsx)(ey,{}),a?.copilot&&(0,i.jsx)(ex,{}),(0,i.jsx)(U,{name:s["Sign out"](),desc:s["com.arms.setting.sign.out.message"](),style:{cursor:"pointer"},"data-testid":"sign-out-button",onClick:p,children:(0,i.jsx)(J.ArrowRightSmallIcon,{})})]})},eb=(0,a(49791).eU)(null);var ek=a(52858),ew=a(5685),eS=a(6503),eN=a(25670);let e_=[{icon:(0,i.jsx)(()=>(0,i.jsxs)("svg",{width:"25",height:"24",viewBox:"0 0 25 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",children:[(0,i.jsx)("g",{clipPath:"url(#clip0_3073_4801)",children:(0,i.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M12.667 2C7.14199 2 2.66699 6.58819 2.66699 12.2529C2.66699 16.7899 5.52949 20.6219 9.50449 21.9804C10.0045 22.0701 10.192 21.7625 10.192 21.4934C10.192 21.2499 10.1795 20.4425 10.1795 19.5838C7.66699 20.058 7.01699 18.9558 6.81699 18.3791C6.70449 18.0843 6.21699 17.1743 5.79199 16.9308C5.44199 16.7386 4.94199 16.2644 5.77949 16.2516C6.56699 16.2388 7.12949 16.9949 7.31699 17.3025C8.21699 18.8533 9.65449 18.4175 10.2295 18.1484C10.317 17.4819 10.5795 17.0334 10.867 16.777C8.64199 16.5207 6.31699 15.6364 6.31699 11.7147C6.31699 10.5997 6.70449 9.67689 7.34199 8.95918C7.24199 8.70286 6.89199 7.65193 7.44199 6.24215C7.44199 6.24215 8.27949 5.97301 10.192 7.29308C10.992 7.06239 11.842 6.94704 12.692 6.94704C13.542 6.94704 14.392 7.06239 15.192 7.29308C17.1045 5.9602 17.942 6.24215 17.942 6.24215C18.492 7.65193 18.142 8.70286 18.042 8.95918C18.6795 9.67689 19.067 10.5868 19.067 11.7147C19.067 15.6492 16.7295 16.5207 14.5045 16.777C14.867 17.0975 15.1795 17.7126 15.1795 18.6738C15.1795 20.0452 15.167 21.1474 15.167 21.4934C15.167 21.7625 15.3545 22.0829 15.8545 21.9804C17.8396 21.2932 19.5646 19.9851 20.7867 18.2401C22.0088 16.4951 22.6664 14.4012 22.667 12.2529C22.667 6.58819 18.192 2 12.667 2Z"})}),(0,i.jsx)("defs",{children:(0,i.jsx)("clipPath",{id:"clip0_3073_4801",children:(0,i.jsx)("rect",{width:"25",height:"24",fill:"white"})})})]}),{}),title:"GitHub",link:"https://github.com/toeverything/AFFiNE"},{icon:(0,i.jsx)(J.TwitterIcon,{}),title:"X",link:"https://twitter.com/AffineOfficial"},{icon:(0,i.jsx)(()=>(0,i.jsxs)("svg",{width:"25",height:"24",viewBox:"0 0 25 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[(0,i.jsx)("g",{clipPath:"url(#clip0_3073_4801)",children:(0,i.jsx)("path",{d:"M19.2565 5.64663C17.9898 5.05614 16.6183 4.62755 15.1897 4.37993C15.1772 4.37953 15.1647 4.38188 15.1532 4.38681C15.1417 4.39175 15.1314 4.39915 15.1231 4.4085C14.9516 4.72279 14.7516 5.13233 14.6183 5.44662C13.103 5.21804 11.562 5.21804 10.0467 5.44662C9.9134 5.1228 9.71339 4.72279 9.53243 4.4085C9.52291 4.38945 9.49434 4.37993 9.46576 4.37993C8.03715 4.62755 6.67521 5.05614 5.39899 5.64663C5.38946 5.64663 5.37994 5.65615 5.37041 5.66568C2.77987 9.54197 2.06556 13.3135 2.41795 17.0469C2.41795 17.066 2.42748 17.085 2.44652 17.0946C4.16086 18.3517 5.80852 19.1137 7.43714 19.6184C7.46571 19.628 7.49428 19.6184 7.50381 19.5994C7.88477 19.0756 8.22764 18.5232 8.52288 17.9422C8.54193 17.9041 8.52288 17.866 8.48479 17.8565C7.94191 17.647 7.42761 17.3993 6.92284 17.1136C6.88474 17.0946 6.88474 17.0374 6.91331 17.0088C7.01808 16.9327 7.12284 16.8469 7.22761 16.7707C7.24666 16.7517 7.27523 16.7517 7.29428 16.7612C10.5706 18.2565 14.104 18.2565 17.3422 16.7612C17.3612 16.7517 17.3898 16.7517 17.4088 16.7707C17.5136 16.8565 17.6184 16.9327 17.7231 17.0184C17.7612 17.0469 17.7612 17.1041 17.7136 17.1231C17.2184 17.4184 16.6945 17.6565 16.1517 17.866C16.1136 17.8755 16.104 17.9232 16.1136 17.9517C16.4183 18.5327 16.7612 19.0851 17.1326 19.6089C17.1612 19.6184 17.1898 19.628 17.2184 19.6184C18.8565 19.1137 20.5042 18.3517 22.2185 17.0946C22.2375 17.085 22.2471 17.066 22.2471 17.0469C22.6661 12.7325 21.5518 8.98958 19.2946 5.66568C19.2851 5.65615 19.2756 5.64663 19.2565 5.64663ZM9.01813 14.7707C8.03715 14.7707 7.21808 13.8659 7.21808 12.7516C7.21808 11.6373 8.01811 10.7325 9.01813 10.7325C10.0277 10.7325 10.8277 11.6468 10.8182 12.7516C10.8182 13.8659 10.0182 14.7707 9.01813 14.7707ZM15.6564 14.7707C14.6754 14.7707 13.8564 13.8659 13.8564 12.7516C13.8564 11.6373 14.6564 10.7325 15.6564 10.7325C16.666 10.7325 17.466 11.6468 17.4565 12.7516C17.4565 13.8659 16.666 14.7707 15.6564 14.7707Z",fill:"#5865F2"})}),(0,i.jsx)("defs",{children:(0,i.jsx)("clipPath",{id:"clip0_3073_4801",children:(0,i.jsx)("rect",{width:"25",height:"24",fill:"white"})})})]}),{}),title:"Discord",link:"https://discord.gg/whd5mjYqVw"},{icon:(0,i.jsx)(()=>(0,i.jsxs)("svg",{width:"25",height:"24",viewBox:"0 0 25 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[(0,i.jsx)("path",{d:"M21.7477 7.19232C21.6387 6.76858 21.4261 6.38227 21.1311 6.07186C20.8361 5.76145 20.4689 5.53776 20.0662 5.42308C18.5917 5 12.6575 5 12.6575 5C12.6575 5 6.72304 5.01281 5.24858 5.43589C4.84583 5.55057 4.47865 5.77427 4.18363 6.0847C3.88861 6.39512 3.67602 6.78145 3.56705 7.2052C3.12106 9.96155 2.94806 14.1616 3.5793 16.8077C3.68828 17.2314 3.90087 17.6177 4.19589 17.9281C4.49092 18.2386 4.85808 18.4622 5.26083 18.5769C6.73528 19 12.6696 19 12.6696 19C12.6696 19 18.6039 19 20.0783 18.5769C20.481 18.4623 20.8482 18.2386 21.1432 17.9282C21.4383 17.6177 21.6509 17.2314 21.7599 16.8077C22.2303 14.0474 22.3752 9.85004 21.7477 7.1924V7.19232Z",fill:"#FF0000"}),(0,i.jsx)("path",{d:"M10.667 15L15.667 12L10.667 9V15Z",fill:"white"})]}),{}),title:"YouTube",link:"https://www.youtube.com/@affinepro"},{icon:(0,i.jsx)(()=>(0,i.jsxs)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[(0,i.jsx)("path",{d:"M12 2C9.34844 2 6.80312 3.05422 4.92969 4.92891C3.05432 6.80434 2.00052 9.34778 2 12C2 14.6511 3.05469 17.1964 4.92969 19.0711C6.80312 20.9458 9.34844 22 12 22C14.6516 22 17.1969 20.9458 19.0703 19.0711C20.9453 17.1964 22 14.6511 22 12C22 9.34891 20.9453 6.80359 19.0703 4.92891C17.1969 3.05422 14.6516 2 12 2Z",fill:"url(#paint0_linear_8233_169329)"}),(0,i.jsx)("path",{d:"M6.5267 11.8943C9.44232 10.6243 11.3861 9.78694 12.3579 9.38241C15.1361 8.22726 15.7126 8.02663 16.0892 8.01983C16.172 8.01851 16.3564 8.03898 16.4767 8.13624C16.5767 8.21827 16.6048 8.32921 16.6189 8.4071C16.6314 8.48491 16.6486 8.66226 16.6345 8.80069C16.4845 10.3819 15.8329 14.2191 15.5017 15.9902C15.3626 16.7396 15.0861 16.9908 14.8189 17.0154C14.2376 17.0688 13.797 16.6316 13.2345 16.263C12.3548 15.686 11.8579 15.3269 11.0033 14.764C10.0158 14.1134 10.6564 13.7557 11.2189 13.1713C11.3658 13.0184 13.9251 10.691 13.9736 10.4799C13.9798 10.4535 13.9861 10.3551 13.9267 10.3032C13.8689 10.2512 13.7829 10.269 13.7204 10.283C13.6314 10.303 12.2267 11.2324 9.5017 13.071C9.10326 13.3451 8.74232 13.4787 8.41732 13.4716C8.06107 13.464 7.37357 13.2698 6.86264 13.1038C6.23764 12.9002 5.7392 12.7926 5.78295 12.4468C5.80482 12.2668 6.05326 12.0826 6.5267 11.8943Z",fill:"white"}),(0,i.jsx)("defs",{children:(0,i.jsxs)("linearGradient",{id:"paint0_linear_8233_169329",x1:"1002",y1:"2",x2:"1002",y2:"2002",gradientUnits:"userSpaceOnUse",children:[(0,i.jsx)("stop",{stopColor:"#2AABEE"}),(0,i.jsx)("stop",{offset:"1",stopColor:"#229ED9"})]})})]}),{}),title:"Telegram",link:"https://t.me/affineworkos"},{icon:(0,i.jsx)(()=>(0,i.jsxs)("svg",{width:"25",height:"24",viewBox:"0 0 25 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[(0,i.jsx)("path",{d:"M12.334 22C17.8568 22 22.334 17.5228 22.334 12C22.334 6.47715 17.8568 2 12.334 2C6.81114 2 2.33398 6.47715 2.33398 12C2.33398 17.5228 6.81114 22 12.334 22Z",fill:"#FF4500"}),(0,i.jsx)("path",{d:"M18.9863 12.0954C18.9863 11.2848 18.3308 10.641 17.5319 10.641C17.1545 10.6404 16.7915 10.7857 16.5186 11.0463C15.5172 10.331 14.1461 9.86611 12.6202 9.8065L13.2877 6.68299L15.4574 7.14783C15.4814 7.69627 15.9343 8.13744 16.4948 8.13744C17.067 8.13744 17.5319 7.6726 17.5319 7.1001C17.5319 6.52791 17.067 6.06299 16.4948 6.06299C16.0895 6.06299 15.7316 6.30143 15.5648 6.64721L13.1448 6.13455C13.0732 6.12252 13.0016 6.13455 12.9539 6.17033C12.8943 6.20611 12.8586 6.26564 12.8468 6.33721L12.1074 9.8183C10.5577 9.86611 9.16273 10.331 8.14945 11.0583C7.87653 10.7976 7.51349 10.6524 7.13609 10.653C6.32539 10.653 5.68164 11.3085 5.68164 12.1074C5.68164 12.7035 6.03922 13.2041 6.54008 13.4308C6.51576 13.5766 6.50379 13.7241 6.5043 13.8719C6.5043 16.113 9.11524 17.9372 12.3341 17.9372C15.553 17.9372 18.1639 16.125 18.1639 13.8719C18.1638 13.7241 18.1519 13.5766 18.1281 13.4308C18.6288 13.2041 18.9863 12.6914 18.9863 12.0954ZM8.99586 13.1325C8.99586 12.5603 9.4607 12.0954 10.0332 12.0954C10.6054 12.0954 11.0703 12.5603 11.0703 13.1325C11.0703 13.7048 10.6055 14.1699 10.0332 14.1699C9.46078 14.1816 8.99586 13.7048 8.99586 13.1325ZM14.8019 15.8865C14.0866 16.6019 12.7274 16.6496 12.3341 16.6496C11.9288 16.6496 10.5697 16.5899 9.86609 15.8865C9.75898 15.7792 9.75898 15.6123 9.86609 15.505C9.97344 15.3979 10.1403 15.3979 10.2477 15.505C10.7008 15.9581 11.6545 16.113 12.3341 16.113C13.0137 16.113 13.9792 15.9581 14.4203 15.505C14.5277 15.3979 14.6945 15.3979 14.8019 15.505C14.8972 15.6123 14.8972 15.7792 14.8019 15.8865ZM14.611 14.1817C14.0387 14.1817 13.5739 13.7168 13.5739 13.1446C13.5739 12.5723 14.0387 12.1074 14.611 12.1074C15.1834 12.1074 15.6483 12.5723 15.6483 13.1446C15.6483 13.7047 15.1834 14.1817 14.611 14.1817Z",fill:"white"})]}),{}),title:"Reddit",link:"https://www.reddit.com/r/Affine/"}];var e$="_6l2oz60";!function(e){e.UNCHECK="uncheck",e.LATEST="latest",e.UPDATE_AVAILABLE="update-available",e.ERROR="error"}(n||(n={}));let eA=e=>{let t=(0,k.s9)(),{updateAvailable:a,downloadProgress:s,updateReady:n,checkingForUpdates:r}=(0,ew.iI)(),c=(0,C.useMemo)(()=>n?t["com.arms.aboutAFFiNE.checkUpdate.button.restart"]():a&&null===s?t["com.arms.aboutAFFiNE.checkUpdate.button.download"]():"latest"===e||"error"===e?t["com.arms.aboutAFFiNE.checkUpdate.button.retry"]():t["com.arms.aboutAFFiNE.checkUpdate.button.check"](),[e,s,t,a,n]),o=(0,C.useMemo)(()=>n?t["com.arms.aboutAFFiNE.checkUpdate.subtitle.restart"]():a&&null===s?t["com.arms.aboutAFFiNE.checkUpdate.subtitle.update-available"]({version:a.version}):r?t["com.arms.aboutAFFiNE.checkUpdate.subtitle.checking"]():a&&null!==s?t["com.arms.aboutAFFiNE.checkUpdate.subtitle.downloading"]():"error"===e?t["com.arms.aboutAFFiNE.checkUpdate.subtitle.error"]():"latest"===e?t["com.arms.aboutAFFiNE.checkUpdate.subtitle.latest"]():t["com.arms.aboutAFFiNE.checkUpdate.subtitle.check"](),[e,s,r,t,a,n]);return{subtitle:(0,C.useMemo)(()=>(0,i.jsxs)("span",{className:(0,q.A)("_6l2oz63",{active:n||a&&null===s||"latest"===e,error:"error"===e}),children:[r?(0,i.jsx)(l.Rh,{size:14}):null,o]}),[e,s,r,o,a,n]),buttonLabel:c}},eL=()=>{let e=(0,k.s9)(),{checkForUpdates:t,downloadUpdate:a,quitAndInstall:s,updateAvailable:n,downloadProgress:r,updateReady:l}=(0,ew.iI)(),[c,o]=(0,C.useState)("uncheck"),{buttonLabel:d,subtitle:m}=eA(c),u=(0,y.V)(async()=>{let e="uncheck";try{let a=await t();null===a?e="error":!1===a?e="latest":"string"==typeof a&&(e="update-available")}catch(t){console.error(t),e="error"}finally{o(e)}},[t]),p=(0,C.useCallback)(()=>n&&null===r?a():l?s():void u(),[u,r,a,s,n,l]);return(0,i.jsx)(U,{name:e["com.arms.aboutAFFiNE.checkUpdate.title"](),desc:m,children:(0,i.jsx)(et.$n,{"data-testid":"check-update-button",onClick:p,disabled:null!==r&&!l,children:d})})},eM=()=>{let e=(0,k.s9)(),{appSettings:t,updateSettings:a}=(0,eS.V)(),{toggleAutoCheck:s,toggleAutoDownload:n}=(0,ew.iI)(),r="internal",c=eN.appIconMap[r],o=eN.appNames[r],d=(0,C.useCallback)(e=>{s(e),a("autoCheckUpdate",e)},[s,a]),m=(0,C.useCallback)(e=>{n(e),a("autoDownloadUpdate",e)},[n,a]),u=(0,C.useCallback)(e=>{e?v.jp.opt_in_tracking():v.jp.opt_out_tracking(),a("enableTelemetry",e)},[a]);return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(D,{title:e["com.arms.aboutAFFiNE.title"](),subtitle:e["com.arms.aboutAFFiNE.subtitle"](),"data-testid":"about-title"}),(0,i.jsxs)(W,{title:e["com.arms.aboutAFFiNE.version.title"](),children:[(0,i.jsx)(U,{name:o,desc:"0.16.0",className:"_6l2oz64",children:(0,i.jsx)("img",{src:c,alt:o,width:56,height:56})}),(0,i.jsx)(U,{name:e["com.arms.aboutAFFiNE.version.editor.title"](),desc:"0.17.0-canary-202408121434-8bc42f0"}),environment.isDesktop?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(eL,{}),(0,i.jsx)(U,{name:e["com.arms.aboutAFFiNE.autoCheckUpdate.title"](),desc:e["com.arms.aboutAFFiNE.autoCheckUpdate.description"](),children:(0,i.jsx)(l.dO,{checked:t.autoCheckUpdate,onChange:d})}),(0,i.jsx)(U,{name:e["com.arms.aboutAFFiNE.autoDownloadUpdate.title"](),desc:e["com.arms.aboutAFFiNE.autoDownloadUpdate.description"](),children:(0,i.jsx)(l.dO,{checked:t.autoDownloadUpdate,onChange:m})}),(0,i.jsx)(U,{name:e["com.arms.aboutAFFiNE.changelog.title"](),desc:e["com.arms.aboutAFFiNE.changelog.description"](),style:{cursor:"pointer"},onClick:()=>{(0,em.RM)("https://github.com/toeverything/AFFiNE/releases")},children:(0,i.jsx)(J.ArrowRightSmallIcon,{})})]}):null,(0,i.jsx)(U,{name:e["com.arms.telemetry.enable"](),desc:e["com.arms.telemetry.enable.desc"](),children:(0,i.jsx)(l.dO,{checked:!1!==t.enableTelemetry,onChange:u})})]}),(0,i.jsxs)(W,{title:e["com.arms.aboutAFFiNE.contact.title"](),children:[(0,i.jsxs)("a",{className:e$,rel:"noreferrer",href:"https://affine.pro",target:"_blank",children:[e["com.arms.aboutAFFiNE.contact.website"](),(0,i.jsx)(J.OpenInNewIcon,{className:"icon"})]}),(0,i.jsxs)("a",{className:e$,rel:"noreferrer",href:"https://community.affine.pro",target:"_blank",children:[e["com.arms.aboutAFFiNE.contact.community"](),(0,i.jsx)(J.OpenInNewIcon,{className:"icon"})]})]}),(0,i.jsx)(W,{title:e["com.arms.aboutAFFiNE.community.title"](),children:(0,i.jsx)("div",{className:"_6l2oz61",children:e_.map(({icon:e,title:t,link:a})=>(0,i.jsxs)("div",{className:"_6l2oz62",onClick:()=>{(0,em.RM)(a)},children:[e,(0,i.jsx)("p",{children:t})]},t))})}),(0,i.jsxs)(W,{title:e["com.arms.aboutAFFiNE.legal.title"](),children:[(0,i.jsxs)("a",{className:e$,rel:"noreferrer",href:"https://affine.pro/privacy",target:"_blank",children:[e["com.arms.aboutAFFiNE.legal.privacy"](),(0,i.jsx)(J.OpenInNewIcon,{className:"icon"})]}),(0,i.jsxs)("a",{className:e$,rel:"noreferrer",href:"https://affine.pro/terms",target:"_blank",children:[e["com.arms.aboutAFFiNE.legal.tos"](),(0,i.jsx)(J.OpenInNewIcon,{className:"icon"})]})]})]})};var eF=a(51520),eE=a(33926),eR=a(14277),eP=a(53653);let eI=(0,C.memo)(function(){let{currentLanguage:e,languagesList:t,onLanguageChange:a}=(0,eP.A)();return(0,i.jsx)(i.Fragment,{children:t.map(t=>{let s=e?.originalName===t.originalName;return(0,i.jsx)(eR.Dr,{title:t.name,lang:t.tag,onSelect:()=>a(t.tag),endFix:(100*t.Completeness).toFixed(0)+"%","data-selected":s,className:"hooakb1",children:(0,i.jsxs)("div",{className:"hooakb2",children:[(0,i.jsx)("div",{children:t.originalName}),s&&(0,i.jsx)(J.DoneIcon,{fontSize:"16px"})]})},t.name)})})}),eO=()=>{let{currentLanguage:e}=(0,eP.A)();return(0,i.jsx)(eR.W1,{items:(0,i.jsx)(eI,{}),contentOptions:{className:"hooakb0",align:"end"},children:(0,i.jsx)(eR.cQ,{"data-testid":"language-menu-button",style:{textTransform:"capitalize",fontWeight:600,width:"250px"},block:!0,children:e?.originalName||""})})};var eB=a(94343),eT="_497d0d0";let eV=()=>{let e=(0,k.s9)(),{setTheme:t,theme:a}=(0,eE.D)(),s=(0,C.useMemo)(()=>[{value:"system",label:e["com.arms.themeSettings.system"](),testId:"system-theme-trigger"},{value:"light",label:e["com.arms.themeSettings.light"](),testId:"light-theme-trigger"},{value:"dark",label:e["com.arms.themeSettings.dark"](),testId:"dark-theme-trigger"}],[e]);return(0,i.jsx)(l.z6,{items:s,value:a,width:250,className:eT,onChange:(0,C.useCallback)(e=>{t(e)},[t])})},eZ=()=>{let e=(0,k.s9)(),{appSettings:t,updateSettings:a}=(0,eS.V)(),s=(0,C.useMemo)(()=>eF.r1.map(({key:t,value:a})=>{let s="Mono"===t?e["com.arms.appearanceSettings.fontStyle.mono"]():"Sans"===t?e["com.arms.appearanceSettings.fontStyle.sans"]():"Serif"===t?e["com.arms.appearanceSettings.fontStyle.serif"]():"";return{value:t,label:s,testId:"system-font-style-trigger",style:{fontFamily:a}}}),[e]);return(0,i.jsx)(l.z6,{items:s,value:t.fontStyle,width:250,className:eT,onChange:(0,C.useCallback)(e=>{a("fontStyle",e)},[a])})},eH=()=>{let e=(0,k.s9)(),{appSettings:t,updateSettings:a}=(0,eS.V)();return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(D,{title:e["com.arms.appearanceSettings.title"](),subtitle:e["com.arms.appearanceSettings.subtitle"]()}),(0,i.jsxs)(W,{title:e["com.arms.appearanceSettings.theme.title"](),children:[(0,i.jsx)(U,{name:e["com.arms.appearanceSettings.color.title"](),desc:e["com.arms.appearanceSettings.color.description"](),children:(0,i.jsx)(eV,{})}),(0,i.jsx)(U,{name:e["com.arms.appearanceSettings.font.title"](),desc:e["com.arms.appearanceSettings.font.description"](),children:(0,i.jsx)(eZ,{})}),(0,i.jsx)(U,{name:e["com.arms.appearanceSettings.language.title"](),desc:e["com.arms.appearanceSettings.language.description"](),children:(0,i.jsx)("div",{className:eT,children:(0,i.jsx)(eO,{})})}),environment.isDesktop?(0,i.jsx)(U,{name:e["com.arms.appearanceSettings.clientBorder.title"](),desc:e["com.arms.appearanceSettings.clientBorder.description"](),"data-testid":"client-border-style-trigger",children:(0,i.jsx)(l.dO,{checked:t.clientBorder,onChange:e=>a("clientBorder",e)})}):null,(0,i.jsx)(U,{name:e["com.arms.appearanceSettings.fullWidth.title"](),desc:e["com.arms.appearanceSettings.fullWidth.description"](),children:(0,i.jsx)(l.dO,{"data-testid":"full-width-layout-trigger",checked:t.fullWidthLayout,onChange:e=>a("fullWidthLayout",e)})}),null]}),null,environment.isDesktop?(0,i.jsxs)(W,{title:e["com.arms.appearanceSettings.sidebar.title"](),children:[(0,i.jsx)(U,{name:e["com.arms.appearanceSettings.noisyBackground.title"](),desc:e["com.arms.appearanceSettings.noisyBackground.description"](),children:(0,i.jsx)(l.dO,{checked:t.enableNoisyBackground,onChange:e=>a("enableNoisyBackground",e)})}),environment.isMacOs&&(0,i.jsx)(U,{name:e["com.arms.appearanceSettings.translucentUI.title"](),desc:e["com.arms.appearanceSettings.translucentUI.description"](),children:(0,i.jsx)(l.dO,{checked:t.enableBlurBackground,onChange:e=>a("enableBlurBackground",e)})})]}):null]})};var eD=a(6610),eq=a(73896),eU=a(21817),ez=a(89679),eW=a(14486),eK=a(31523),eG=a(47488);let eX=e=>{let{onReset:t,onError:a}=e,s=(0,C.useRef)([]),{cache:n}=(0,eG.iX)(),r=C.useCallback(()=>{let e=s.current;for(let t of(s.current=[],n.keys())){let a=n.get(t);e.includes(a?.error)&&n.delete(t)}},[n]),l=C.useCallback(e=>{r(),t?.(e)},[r,t]),c=C.useCallback((e,t)=>{s.current.push(e),a?.(e,t)},[a]);return C.useEffect(()=>r,[r]),(0,i.jsx)(eK.tH,{...e,onReset:l,onError:c,children:e.children})};var eY=a(53978),eJ="_12asts4w",eQ="_12asts4m",e1="_12asts42",e0="_12asts4o",e2="_12asts4z";let e7=({type:e,loading:t,open:a,content:s,onOpenChange:n,onConfirm:r,...l})=>{let c=(0,k.s9)(),o=(0,C.useRef)(!1),d=c[`com.arms.payment.modal.${e}.title`](),m=c[`com.arms.payment.modal.${e}.confirm`](),u=c[`com.arms.payment.modal.${e}.cancel`](),p="change"!==e?c[`com.arms.payment.modal.${e}.content`]():"";return(0,C.useEffect)(()=>{!t&&a&&o.current&&(n?.(!1),o.current=!1)},[t,a,n]),(0,i.jsx)(f.uo,{title:d,cancelText:u,confirmText:m,confirmButtonOptions:{variant:"primary",loading:t},open:a,onOpenChange:n,onConfirm:()=>{o.current=!0,r?.()?.catch(console.error)},...l,children:s??p})},e3=({open:e,loading:t,onOpenChange:a,onCancel:s})=>{let n=(0,k.s9)(),r=(0,C.useRef)(!1);return(0,C.useEffect)(()=>{!t&&e&&r.current&&(a?.(!1),r.current=!1)},[t,e,a]),(0,i.jsxs)(f.aF,{title:n["com.arms.payment.modal.downgrade.title"](),open:e,contentOptions:{},width:480,onOpenChange:a,children:[(0,i.jsxs)("div",{className:"_12asts4v",children:[(0,i.jsx)("p",{className:eJ,children:n["com.arms.payment.modal.downgrade.content"]()}),(0,i.jsx)("p",{className:"_12asts4x",children:n["com.arms.payment.modal.downgrade.caption"]()})]}),(0,i.jsxs)("footer",{className:"_12asts4y",children:[(0,i.jsx)(et.$n,{onClick:()=>{r.current=!0,s?.()},loading:t,children:n["com.arms.payment.modal.downgrade.cancel"]()}),(0,i.jsx)(eY.zM,{asChild:!0,children:(0,i.jsx)(et.$n,{disabled:t,onClick:()=>a?.(!1),variant:"primary",children:n["com.arms.payment.modal.downgrade.confirm"]()})})]})]})},e4=({children:e,open:t,onOpenChange:a})=>{let[s,n]=(0,C.useState)((0,el.Ak)()),[r,l]=(0,C.useState)(!1),c=(0,d.h1)(S.nC).subscription,o=(0,u.S)(c.pro$),m=(0,d.h1)(S.uR),p=(0,er.k)();(0,C.useEffect)(()=>{t&&o&&v.u4.$.settingsPanel.plans.cancelSubscription({plan:o.plan,recurring:o.recurring})},[t,o]);let h=(0,y.V)(async()=>{try{let e=m.session.account$.value,t=c.pro$.value?.recurring;l(!0),await c.cancelSubscription(s),c.revalidate(),await c.isRevalidating$.waitFor(e=>!e),n((0,el.Ak)()),a(!1);let r=c.pro$.value;r&&v.u4.$.settingsPanel.plans.confirmCancelingSubscription({plan:r.plan,recurring:r.recurring}),e&&t&&p((0,ei.Pc)({email:e.email??"",id:e.id,name:e.info?.name??"",plan:es.R$.Pro,recurring:t}))}finally{l(!1)}},[m.session.account$.value,c,s,a,p]);return(0,i.jsxs)(i.Fragment,{children:[e,(0,i.jsx)(e3,{open:t,onCancel:h,onOpenChange:a,loading:r})]})},e6=({children:e,open:t,onOpenChange:a})=>{let[s,n]=(0,C.useState)((0,el.Ak)()),[r,l]=(0,C.useState)(!1),c=(0,d.h1)(S.nC).subscription,o=(0,y.V)(async()=>{try{l(!0),await c.resumeSubscription(s),c.revalidate(),await c.isRevalidating$.waitFor(e=>!e),n((0,el.Ak)()),a(!1);let e=c.pro$.value;e&&v.u4.$.settingsPanel.plans.confirmResumingSubscription({plan:e.plan,recurring:e.recurring})}finally{l(!1)}},[c,s,a]);return(0,i.jsxs)(i.Fragment,{children:[e,(0,i.jsx)(e7,{type:"resume",open:t,onConfirm:o,onOpenChange:a,loading:r})]})},e8=`
`,e5=`
`,e9=({children:e,type:t,className:a,...s})=>(0,i.jsxs)("div",{className:(0,q.A)("_15uwrpu2",a),"data-type":t,...s,children:[(0,i.jsx)("div",{className:"_15uwrpu4",dangerouslySetInnerHTML:{__html:`${e8}${e5}`}}),(0,i.jsx)("div",{className:"_15uwrpu3",children:e})]});var te="_1qfr8z71";let tt=({className:e,...t})=>{let a=(0,k.s9)();return(0,i.jsxs)("ul",{className:(0,q.A)("_1qfr8z70",e),...t,children:[(0,i.jsxs)("li",{className:te,children:[(0,i.jsx)(J.AfFiNeIcon,{}),(0,i.jsx)("span",{children:a["com.arms.payment.lifetime.benefit-1"]()})]}),(0,i.jsxs)("li",{className:te,children:[(0,i.jsx)(J.DoneIcon,{}),(0,i.jsx)("span",{children:a["com.arms.payment.lifetime.benefit-2"]()})]}),(0,i.jsxs)("li",{className:te,children:[(0,i.jsx)(J.DoneIcon,{}),(0,i.jsx)("span",{children:a["com.arms.payment.lifetime.benefit-3"]({capacity:"1T"})})]})]})};var ta="klcomi7",ts="klcomi4",tn="klcomia",tr="klcomi8",ti="klcomi5",tl="klcomi3",tc="klcomi6";!function(e){e.Basic="com.arms.payment.billing-setting.current-plan.description",e.Monthly="com.arms.payment.billing-setting.current-plan.description.monthly",e.Yearly="com.arms.payment.billing-setting.current-plan.description.yearly",e.Lifetime="com.arms.payment.billing-setting.current-plan.description.lifetime"}(r||(r={}));let to=(e,t)=>e!==es.R$.Pro?"com.arms.payment.billing-setting.current-plan.description":r[t],td=()=>{let e=(0,k.s9)();return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(D,{title:e["com.arms.payment.billing-setting.title"](),subtitle:e["com.arms.payment.billing-setting.subtitle"]()}),(0,i.jsx)(eX,{FallbackComponent:tv,children:(0,i.jsx)(C.Suspense,{fallback:(0,i.jsx)(tv,{}),children:(0,i.jsx)(W,{title:e["com.arms.payment.billing-setting.information"](),children:(0,i.jsx)(tm,{})})})}),(0,i.jsx)(eX,{FallbackComponent:tb,children:(0,i.jsx)(C.Suspense,{fallback:(0,i.jsx)(tb,{}),children:(0,i.jsx)(W,{title:e["com.arms.payment.billing-setting.history"](),children:(0,i.jsx)(tf,{})})})})]})},tm=()=>{let e=(0,k.s9)(),t=(0,d.h1)(S.nC);(0,C.useEffect)(()=>{t.subscription.revalidate(),t.prices.revalidate()},[t]);let a=(0,u.S)(t.subscription.pro$),s=(0,u.S)(t.prices.proPrice$),n=(0,u.S)(t.subscription.isBeliever$),[r,l]=(0,C.useState)(!1),c=(0,h.Xr)(x.JO),o=a?.plan??es.R$.Free,m=a?.recurring??es.zS.Monthly,p=(0,C.useCallback)(e=>{v.u4.$.settingsPanel.billing.viewPlans(),c({open:!0,activeTab:"plans",scrollAnchor:e})},[c]),g=(0,C.useCallback)(()=>p("cloudPricingPlan"),[p]),j=(0,C.useCallback)(()=>p("aiPricingPlan"),[p]),f=a?s?a.recurring===es.zS.Monthly?String((s.amount??0)/100):String((s.yearlyAmount??0)/100):"?":"0";return(0,i.jsxs)("div",{className:"klcomi0",children:[(0,i.jsx)(th,{onClick:j}),null!==a?n?(0,i.jsx)(tp,{onOpenPlans:g}):(0,i.jsxs)("div",{className:tl,children:[(0,i.jsxs)("div",{className:ts,children:[(0,i.jsx)(U,{spreadCol:!1,name:e["com.arms.payment.billing-setting.current-plan"](),desc:(0,i.jsx)(k.x6,{i18nKey:to(o,m),values:{planName:o},components:{1:(0,i.jsx)("span",{onClick:g,className:tn})}})}),(0,i.jsx)(tC,{plan:o,gotoPlansSetting:g})]}),(0,i.jsxs)("p",{className:tc,children:["$",f,(0,i.jsxs)("span",{className:ta,children:["/",m===es.zS.Monthly?e["com.arms.payment.billing-setting.month"]():e["com.arms.payment.billing-setting.year"]()]})]})]}):(0,i.jsx)(tv,{}),(0,i.jsx)(tu,{}),null!==a?a?.status===es.it.Active&&(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(U,{className:tr,name:e["com.arms.payment.billing-setting.payment-method"](),desc:e["com.arms.payment.billing-setting.payment-method.description"](),children:(0,i.jsx)(tx,{})}),a.nextBillAt&&(0,i.jsx)(U,{name:e["com.arms.payment.billing-setting.renew-date"](),desc:e["com.arms.payment.billing-setting.renew-date.description"]({renewDate:new Date(a.nextBillAt).toLocaleDateString()})}),n?null:a.end&&a.canceledAt?(0,i.jsx)(U,{name:e["com.arms.payment.billing-setting.expiration-date"](),desc:e["com.arms.payment.billing-setting.expiration-date.description"]({expirationDate:new Date(a.end).toLocaleDateString()}),children:(0,i.jsx)(tg,{})}):(0,i.jsx)(e4,{open:r,onOpenChange:l,children:(0,i.jsx)(U,{style:{cursor:"pointer"},onClick:()=>{l(!0)},className:"dangerous-setting",name:e["com.arms.payment.billing-setting.cancel-subscription"](),desc:e["com.arms.payment.billing-setting.cancel-subscription.description"](),children:(0,i.jsx)(tj,{})})})]}):(0,i.jsx)(tv,{})]})},tu=()=>{let e=(0,k.s9)(),t=(0,d.h1)(S.nC),a=(0,d.h1)(S.uR),s=(0,u.S)(t.subscription.pro$),n=(0,u.S)(t.subscription.ai$),r=(0,u.S)(a.session.account$);if(!r||!s&&!n)return null;let l=[];s&&l.push(es.R$.Pro),n&&l.push(es.R$.AI);let c=(0,ei.ed)({name:r.info?.name,id:r.id,email:r.email,recurring:s?.recurring??n?.recurring??es.zS.Yearly,plan:l});return(0,i.jsx)(U,{className:tr,name:e["com.arms.payment.billing-type-form.title"](),desc:e["com.arms.payment.billing-type-form.description"](),children:(0,i.jsx)("a",{target:"_blank",href:c,rel:"noreferrer",children:(0,i.jsx)(et.$n,{children:e["com.arms.payment.billing-type-form.go"]()})})})},tp=({onOpenPlans:e})=>{let t=(0,k.s9)(),a=(0,d.h1)(S.nC),s=(0,u.S)(a.prices.readableLifetimePrice$);return s?(0,i.jsxs)(e9,{type:2,style:{borderRadius:8,padding:12},children:[(0,i.jsxs)("header",{className:"klcomid",children:[(0,i.jsxs)("div",{children:[(0,i.jsx)("div",{className:"klcomie",children:t["com.arms.payment.billing-setting.believer.title"]()}),(0,i.jsx)("div",{className:"klcomif",children:(0,i.jsx)(k.x6,{i18nKey:"com.arms.payment.billing-setting.believer.description",components:{a:(0,i.jsx)("a",{href:"#",onClick:e})}})})]}),(0,i.jsxs)("div",{className:"klcomig",children:[(0,i.jsx)("div",{className:"klcomih",children:s}),(0,i.jsx)("div",{className:"klcomii",children:t["com.arms.payment.billing-setting.believer.price-caption"]()})]})]}),(0,i.jsx)(tt,{})]}):null},th=({onClick:e})=>{let t=(0,k.s9)(),a=(0,d.h1)(S.nC);(0,C.useEffect)(()=>{a.subscription.revalidate(),a.prices.revalidate()},[a]);let s=(0,u.S)(a.prices.aiPrice$),n=(0,u.S)(a.subscription.ai$),r=s?.yearlyAmount?`$${(s.yearlyAmount/100).toFixed(2)}`:"?",c=t["com.arms.payment.billing-setting.year"]();if(null===n)return(0,i.jsx)(l.EA,{height:100});let o=void 0===n?(0,i.jsx)(k.x6,{i18nKey:"com.arms.payment.billing-setting.ai.free-desc",components:{a:(0,i.jsx)("a",{href:"#",onClick:e,className:tn})}}):n?.nextBillAt?t["com.arms.payment.ai.billing-tip.next-bill-at"]({due:(0,k.U$)(n.nextBillAt,{absolute:{accuracy:"day"}})}):n?.canceledAt&&n.end?t["com.arms.payment.ai.billing-tip.end-at"]({end:(0,k.U$)(n.end,{absolute:{accuracy:"day"}})}):null;return(0,i.jsxs)("div",{className:tl,style:{marginBottom:24},children:[(0,i.jsxs)("div",{className:ts,children:[(0,i.jsx)(U,{spreadCol:!1,name:t["com.arms.payment.billing-setting.ai-plan"](),desc:o}),s?.yearlyAmount?n?n.canceledAt?(0,i.jsx)(ed,{className:ti}):(0,i.jsx)(ec,{className:ti}):(0,i.jsx)(eu,{className:ti,children:t["com.arms.payment.billing-setting.ai.purchase"]()}):null]}),(0,i.jsxs)("p",{className:tc,children:[n?r:"$0",(0,i.jsxs)("span",{className:ta,children:["/",c]})]})]})},tC=({plan:e,gotoPlansSetting:t})=>{let a=(0,k.s9)();return(0,i.jsx)(et.$n,{className:ti,variant:"primary",onClick:t,children:e===es.R$.Pro?a["com.arms.payment.billing-setting.change-plan"]():a["com.arms.payment.billing-setting.upgrade"]()})},tx=()=>{let{isMutating:e,trigger:t}=(0,ez.n)({mutation:eU.Yl}),a=(0,k.s9)(),s=(0,y.V)(async()=>{await t(null,{onSuccess:e=>{(0,em.RM)(e.createCustomerPortal)}})},[t]);return(0,i.jsx)(et.$n,{onClick:s,loading:e,disabled:e,children:a["com.arms.payment.billing-setting.update"]()})},tg=()=>{let e=(0,k.s9)(),[t,a]=(0,C.useState)(!1),s=(0,d.h1)(S.nC).subscription,n=(0,C.useCallback)(()=>{a(!0)},[]);return(0,i.jsx)(e6,{open:t,onOpenChange:a,children:(0,i.jsx)(et.$n,{onClick:n,"data-event-props":"$.settingsPanel.plans.resumeSubscription","data-event-args-type":s.pro$.value?.plan,"data-event-args-category":s.pro$.value?.recurring,children:e["com.arms.payment.billing-setting.resume-subscription"]()})})},tj=({loading:e})=>(0,i.jsx)(et.K0,{style:{pointerEvents:"none"},disabled:e,loading:e,children:(0,i.jsx)(J.ArrowRightSmallIcon,{})}),tf=()=>{let e=(0,k.s9)(),{data:t}=(0,eW.IT)({query:eU.W1}),[a,s]=(0,C.useState)(0),{data:n}=(0,eW.IT)({query:eU.P2,variables:{skip:a,take:12}}),r=n.currentUser?.invoices??[],l=t.currentUser?.invoiceCount??0;return(0,i.jsxs)("div",{className:"klcomi1",children:[(0,i.jsx)("div",{className:"klcomi2",children:0===r.length?(0,i.jsx)("p",{className:"klcomi9",children:e["com.arms.payment.billing-setting.no-invoice"]()}):r.map(e=>(0,i.jsx)(ty,{invoice:e},e.id))}),l>12&&(0,i.jsx)(eD.dK,{totalCount:l,countPerPage:12,onPageChange:e=>s(e)})]})},ty=({invoice:e})=>{let t=(0,k.s9)(),a=(0,C.useCallback)(()=>{e.link&&(0,em.RM)(e.link)},[e.link]),s=e.plan===es.R$.AI?"AFFiNE AI":e.plan===es.R$.Pro?e.recurring===es.zS.Lifetime?"AFFiNE Cloud Believer":"AFFiNE Cloud":null;return(0,i.jsx)(U,{name:new Date(e.createdAt).toLocaleDateString(),desc:`${e.status===es.Sx.Paid?t["com.arms.payment.billing-setting.paid"]():""} $${e.amount/100} - ${s}`,children:(0,i.jsx)(et.$n,{onClick:a,children:t["com.arms.payment.billing-setting.view-invoice"]()})},e.id)},tv=()=>{let e=(0,k.s9)();return(0,i.jsx)(W,{title:e["com.arms.payment.billing-setting.information"](),children:(0,i.jsxs)("div",{className:"klcomib",children:[(0,i.jsx)(l.EA,{variant:"rounded",height:"104px"}),(0,i.jsx)(l.EA,{variant:"rounded",height:"46px"})]})})},tb=()=>{let e=(0,k.s9)();return(0,i.jsx)(W,{title:e["com.arms.payment.billing-setting.history"](),children:(0,i.jsx)("div",{className:"klcomic",children:(0,i.jsx)(eq.R,{})})})},tk=({width:e,height:t})=>(0,i.jsx)("svg",{className:"icon",width:e||16,height:t||16,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:(0,i.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M1.5 8C1.5 4.41022 4.41022 1.5 8 1.5C11.5898 1.5 14.5 4.41022 14.5 8C14.5 11.5898 11.5898 14.5 8 14.5C4.41022 14.5 1.5 11.5898 1.5 8ZM8 2.5C4.96251 2.5 2.5 4.96251 2.5 8C2.5 11.0375 4.96251 13.5 8 13.5C11.0375 13.5 13.5 11.0375 13.5 8C13.5 4.96251 11.0375 2.5 8 2.5ZM4.91917 7.64645L7.64645 4.91917C7.84171 4.72391 8.15829 4.72391 8.35355 4.91917L11.0808 7.64645C11.2761 7.84171 11.2761 8.15829 11.0808 8.35355C10.8856 8.54882 10.569 8.54882 10.3737 8.35355L8.5 6.47983V11C8.5 11.2761 8.27614 11.5 8 11.5C7.72386 11.5 7.5 11.2761 7.5 11V6.47983L5.62628 8.35355C5.43102 8.54882 5.11444 8.54882 4.91917 8.35355C4.72391 8.15829 4.72391 7.84171 4.91917 7.64645Z",fill:"currentColor"})}),tw=({width:e,height:t})=>(0,i.jsx)("svg",{className:"icon",width:e||16,height:t||16,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:(0,i.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M1.5 4.66634C1.5 3.65382 2.32081 2.83301 3.33333 2.83301H12.6667C13.6792 2.83301 14.5 3.65382 14.5 4.66634V11.333C14.5 12.3455 13.6792 13.1663 12.6667 13.1663H3.33333C2.32081 13.1663 1.5 12.3455 1.5 11.333V4.66634ZM3.33333 3.83301C2.8731 3.83301 2.5 4.2061 2.5 4.66634V5.49967H13.5V4.66634C13.5 4.2061 13.1269 3.83301 12.6667 3.83301H3.33333ZM13.5 6.49967H2.5V11.333C2.5 11.7932 2.8731 12.1663 3.33333 12.1663H12.6667C13.1269 12.1663 13.5 11.7932 13.5 11.333V6.49967ZM9.5 9.99967C9.5 9.72353 9.72386 9.49967 10 9.49967H12C12.2761 9.49967 12.5 9.72353 12.5 9.99967C12.5 10.2758 12.2761 10.4997 12 10.4997H10C9.72386 10.4997 9.5 10.2758 9.5 9.99967Z",fill:"currentColor"})});var tS="_1eqdg9h7",tN=a(55137),t_=a(59142),t$=a(35623);let tA=({title:e,caption:t,children:a})=>{let[s,n]=(0,C.useState)(!0),r=(0,C.useCallback)(()=>n(e=>!e),[]);return(0,i.jsxs)(tN.bL,{open:s,onOpenChange:n,children:[(0,i.jsxs)("section",{className:"_4aytmw5",children:[(0,i.jsxs)("div",{className:"_4aytmw6",children:[(0,i.jsx)("div",{className:"_4aytmw7",children:e}),(0,i.jsx)("div",{className:"_4aytmw8",children:t})]}),(0,i.jsx)(l.K0,{onClick:r,size:"20",children:(0,i.jsx)(J.ArrowUpSmallIcon,{style:{transform:s?"rotate(0deg)":"rotate(180deg)",transition:"transform 0.23s ease"}})})]}),(0,i.jsx)(tN.UC,{children:a})]})},tL=({cloud:e,ai:t,cloudTip:a})=>{let s=(0,k.s9)(),[n,r]=(0,h.fp)(x.JO),c="plans"===n.activeTab?n.scrollAnchor:null,o=(0,C.useRef)(null),d=(0,C.useRef)(null),m=(0,h.md)(eb),u=(0,C.useCallback)(()=>{if(!a)return;let e=o.current?.querySelector("#cloudPricingPlan");if(!m||!e)return;let t=m.getBoundingClientRect();e.getBoundingClientRect().top-t.top{c&&(0,t$.flushSync)(()=>{let e=o.current?.querySelector(`#${c}`);e&&(e.scrollIntoView(),r(e=>({...e,scrollAnchor:void 0})))})},[c,r]),(0,C.useEffect)(()=>{if(m&&d.current)return m.addEventListener("scroll",u),u(),()=>{m.removeEventListener("scroll",u)}},[m,u]);let p=(0,C.useCallback)(e=>{let t=o.current?.querySelector(`#${e}`);t&&t.scrollIntoView({behavior:"smooth"})},[]);return(0,i.jsxs)("div",{className:"_4aytmw0",ref:o,children:[(0,i.jsx)(D,{style:{marginBottom:"0px"},title:s["com.arms.payment.title"]()}),t?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)("div",{id:"aiPricingPlan",children:t}),(0,i.jsx)(l.cG,{className:"_4aytmwa"})]}):null,(0,i.jsx)("div",{id:"cloudPricingPlan",children:e}),a&&m?(0,t$.createPortal)((0,i.jsxs)("div",{className:"_4aytmwc",ref:d,children:[(0,i.jsxs)("div",{children:[(0,i.jsx)("div",{className:"_4aytmwd",children:s["com.arms.cloud-scroll-tip.title"]()}),(0,i.jsx)("div",{className:"_4aytmwe",children:s["com.arms.cloud-scroll-tip.caption"]()})]}),(0,i.jsx)(l.$n,{onClick:()=>p("cloudPricingPlan"),variant:"primary",children:s["com.arms.ai-scroll-tip.view"]()})]}),m,"aiScrollTip"):null]})},tM=({title:e="AFFiNE Cloud",caption:t,select:a,toggle:s,scroll:n,lifetime:r,scrollRef:l})=>(0,i.jsxs)(tA,{title:e,caption:t,children:[(0,i.jsxs)("div",{className:"_4aytmw9",children:[(0,i.jsx)("div",{children:a}),(0,i.jsx)("div",{children:s})]}),(0,i.jsxs)(t_.bL,{children:[(0,i.jsx)(t_.LM,{ref:l,className:"_4aytmw1",children:n}),(0,i.jsx)(t_.Ze,{forceMount:!0,orientation:"horizontal",className:"_4aytmw2",children:(0,i.jsx)(t_.zi,{className:"_4aytmw3"})})]}),r?(0,i.jsx)("div",{style:{paddingTop:12},id:"lifetimePricingPlan",children:r}):null]}),tF=e=>[{name:e["com.arms.payment.ai.benefit.g1"](),icon:(0,i.jsx)(J.TextIcon,{}),items:[e["com.arms.payment.ai.benefit.g1-1"](),e["com.arms.payment.ai.benefit.g1-2"](),e["com.arms.payment.ai.benefit.g1-3"]()]},{name:e["com.arms.payment.ai.benefit.g2"](),icon:(0,i.jsx)(J.PenIcon,{}),items:[e["com.arms.payment.ai.benefit.g2-1"](),e["com.arms.payment.ai.benefit.g2-2"](),e["com.arms.payment.ai.benefit.g2-3"]()]},{name:e["com.arms.payment.ai.benefit.g3"](),icon:(0,i.jsx)(J.CheckBoxCheckLinearIcon,{}),items:[e["com.arms.payment.ai.benefit.g3-1"](),e["com.arms.payment.ai.benefit.g3-2"](),e["com.arms.payment.ai.benefit.g3-3"]()]}],tE=()=>{let e=(0,k.s9)(),t=(0,C.useMemo)(()=>tF(e),[e]);return(0,i.jsx)("div",{className:"_1eqdg9ha",children:t.map(({name:e,icon:t,items:a})=>(0,i.jsxs)("div",{className:"_1eqdg9hb",children:[(0,i.jsxs)("div",{className:"_1eqdg9hc",children:[t,e]}),(0,i.jsx)("ul",{className:"_1eqdg9hd",children:a.map(e=>(0,i.jsx)("li",{className:"_1eqdg9he",children:e},e))})]},e))})},tR=({caption:e,actionButtons:t,billingTip:a})=>{let s=(0,k.s9)(),n=s["com.arms.payment.ai.pricing-plan.title"]();return(0,i.jsx)(tA,{title:n,caption:e,children:(0,i.jsxs)("div",{className:"_1eqdg9h0",children:[(0,i.jsxs)("div",{className:"_1eqdg9h1",children:[(0,i.jsx)("section",{className:"_1eqdg9h2",children:s["com.arms.payment.ai.pricing-plan.title-caption-1"]()}),(0,i.jsx)("section",{className:"_1eqdg9h4",children:s["com.arms.payment.ai.pricing-plan.title"]()}),(0,i.jsx)("section",{className:"_1eqdg9h3",children:s["com.arms.payment.ai.pricing-plan.title-caption-2"]()})]}),(0,i.jsxs)("div",{className:"_1eqdg9h5",children:[(0,i.jsx)("div",{className:"_1eqdg9h6",children:t}),a?(0,i.jsx)("div",{className:"_1eqdg9h9",children:a}):null]}),(0,i.jsx)(tE,{})]})})},tP=()=>{let e=(0,k.s9)(),t=(0,d.h1)(S.uR),a=(0,d.h1)(S.nC),s=(0,u.S)(a.subscription.ai$),n=(0,u.S)(a.prices.aiPrice$),r="authenticated"===(0,u.S)(t.session.status$);if((0,C.useEffect)(()=>{a.subscription.revalidate(),a.prices.revalidate()},[a]),!n?.yearlyAmount)return null;let c=s?.nextBillAt?e["com.arms.payment.ai.billing-tip.next-bill-at"]({due:(0,k.U$)(s.nextBillAt,{absolute:{accuracy:"day"}})}):s?.canceledAt&&s.end?e["com.arms.payment.ai.billing-tip.end-at"]({end:(0,k.U$)(s.end,{absolute:{accuracy:"day"}})}):null;return(0,i.jsx)(tR,{caption:s?e["com.arms.payment.ai.pricing-plan.caption-purchased"]():e["com.arms.payment.ai.pricing-plan.caption-free"](),actionButtons:r?s?s.canceledAt?(0,i.jsx)(ed,{className:tS}):(0,i.jsx)(ec,{className:tS}):(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(eu,{className:tS,displayedFrequency:"monthly"}),(0,i.jsx)("a",{href:"https://ai.affine.pro",target:"_blank",rel:"noreferrer",children:(0,i.jsx)(l.$n,{className:"_1eqdg9h8 _1eqdg9h7",children:e["com.arms.payment.ai.pricing-plan.learn"]()})})]}):(0,i.jsx)(eo,{className:tS}),billingTip:c})};var tI=a(39958);let tO=e=>{let{detail:t,recurring:a}=e,s="authenticated"===(0,u.S)((0,d.h1)(S.uR).session.status$),n=(0,d.h1)(S.nC),r=(0,u.S)(n.subscription.pro$),l=r?.plan??es.R$.Free,c=s&&t.plan===l&&a===r?.recurring,o=t.plan===es.R$.Pro;return(0,i.jsxs)("div",{"data-current":c,className:o?"_12asts4a _12asts48":"_12asts48",children:[(0,i.jsx)("div",{className:"_12asts49"}),(0,i.jsxs)("div",{className:"_12asts4d",children:[(0,i.jsxs)("div",{style:{paddingBottom:12},children:[(0,i.jsx)("section",{className:"_12asts4f",children:t.name}),(0,i.jsx)("section",{className:"_12asts4g",children:t.description}),(0,i.jsx)("section",{className:"_12asts4h",children:t.titleRenderer(a,t)})]}),(0,i.jsx)(tB,{...e})]}),(0,i.jsx)("div",{className:"_12asts4p",children:Object.entries(t.benefits).map(([e,t])=>(0,i.jsxs)("ul",{className:"_12asts4q",children:[(0,i.jsxs)("section",{className:"_12asts4r",children:[e,":"]}),t.map(({icon:e,title:t},a)=>(0,i.jsxs)("li",{className:"_12asts4s",children:[(0,i.jsx)("div",{className:"_12asts4t",children:e??(0,i.jsx)(J.DoneIcon,{})}),(0,i.jsx)("div",{className:"_12asts4u",children:t})]},a))]},e))})]},t.plan)},tB=({detail:e,recurring:t})=>{let a=(0,k.s9)(),s="authenticated"===(0,u.S)((0,d.h1)(S.uR).session.status$),n=(0,d.h1)(S.nC),r=(0,u.S)(n.subscription.isBeliever$),l=(0,u.S)(n.subscription.pro$),c=l?.plan??es.R$.Free,o=l?.recurring;if("dynamic"===e.type)return(0,i.jsx)(tZ,{plan:e.plan});if(!s)return(0,i.jsx)(tq,{children:e.plan===es.R$.Free?a["com.arms.payment.sign-up-free"]():a["com.arms.payment.buy-pro"]()});if(r)return(0,i.jsx)(et.$n,{className:eQ,disabled:!0,children:a["com.arms.payment.cloud.lifetime.included"]()});let m=!!l?.canceledAt,p=e.plan===es.R$.Free;return e.plan===c&&(p||o===t&&l?.status===es.it.Active)?m?(0,i.jsx)(tU,{}):(0,i.jsx)(tT,{}):p?(0,i.jsx)(tV,{disabled:m}):c===e.plan?(0,i.jsx)(tD,{from:o,to:t,due:l?.nextBillAt||"",disabled:m}):(0,i.jsx)(tH,{recurring:t})},tT=()=>{let e=(0,k.s9)();return(0,i.jsx)(et.$n,{className:eQ,children:e["com.arms.payment.current-plan"]()})},tV=({disabled:e})=>{let t=(0,k.s9)(),[a,s]=(0,C.useState)(!1),n=e?t["com.arms.payment.downgraded-tooltip"]():null,r=(0,C.useCallback)(()=>{s(!0)},[]);return(0,i.jsx)(e4,{open:a,onOpenChange:s,children:(0,i.jsx)(tI.m,{content:n,rootOptions:{delayDuration:0},children:(0,i.jsx)("div",{className:eQ,children:(0,i.jsx)(et.$n,{className:eQ,variant:"primary",onClick:r,disabled:e,children:t["com.arms.payment.downgrade"]()})})})})},tZ=({plan:e})=>{let t=(0,k.s9)(),a=(0,C.useMemo)(()=>{switch(e){case es.R$.Team:return"https://6dxre9ihosp.typeform.com/to/niBcdkvs";case es.R$.Enterprise:return"https://6dxre9ihosp.typeform.com/to/rFfobTjf";default:return"https://affine.pro/pricing"}},[e]);return(0,i.jsx)("a",{className:eQ,href:a,target:"_blank",rel:"noreferrer",children:(0,i.jsx)(et.$n,{className:eQ,variant:"primary","data-event-props":"$.settingsPanel.billing.bookDemo","data-event-args-url":a,children:t["com.arms.payment.tell-us-use-case"]()})})},tH=({className:e,recurring:t,children:a,...s})=>{let[n,r]=(0,C.useState)(!1),[l,c]=(0,C.useState)(!1),o=(0,k.s9)(),m=(0,d.h1)(S.nC),u=(0,d.h1)(S.uR),[p,h]=(0,C.useState)((0,el.Ak)());(0,C.useEffect)(()=>{if(l)return window.addEventListener("focus",m.subscription.revalidate),()=>{window.removeEventListener("focus",m.subscription.revalidate)}},[l,m]);let x=(0,y.V)(async()=>{r(!0),v.u4.$.settingsPanel.plans.checkout({plan:es.R$.Pro,recurring:t});let e=await m.createCheckoutSession({recurring:t,idempotencyKey:p,plan:es.R$.Pro,coupon:null,successCallbackLink:(0,ei.e6)(u.session.account$.value,es.R$.Pro,t)});r(!1),h((0,el.Ak)()),(0,em.RM)(e),c(!0)},[t,u.session.account$.value,m,p]);return(0,i.jsx)(et.$n,{className:(0,q.A)(eQ,e),variant:"primary",onClick:x,disabled:n,loading:n,...s,children:a??o["com.arms.payment.upgrade"]()})},tD=({from:e,to:t,disabled:a,due:s})=>{let n=(0,k.s9)(),[r,l]=(0,C.useState)(!1),[c,o]=(0,C.useState)(!1),[m,u]=(0,C.useState)((0,el.Ak)()),p=(0,d.h1)(S.nC).subscription,h=(0,C.useCallback)(()=>{v.u4.$.settingsPanel.plans.changeSubscriptionRecurring({plan:es.R$.Pro,recurring:t}),l(!0)},[t]),x=(0,y.V)(async()=>{o(!0),await p.setSubscriptionRecurring(m,t),u((0,el.Ak)()),o(!1)},[p,t,m]),g=(0,i.jsxs)(k.x6,{values:{from:e,to:t,due:s},className:eJ,children:["You are changing your ",(0,i.jsx)("span",{className:e2,children:e})," ","subscription to ",(0,i.jsx)("span",{className:e2,children:t})," ","subscription. This change will take effect in the next billing cycle, with an effective date of"," ",(0,i.jsx)("span",{className:e2,children:new Date(s).toLocaleDateString()}),"."]});return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(et.$n,{className:eQ,variant:"primary",onClick:h,disabled:a||c,loading:c,children:n["com.arms.payment.change-to"]({to:t})}),(0,i.jsx)(e7,{type:"change",loading:c,open:r,onConfirm:x,onOpenChange:l,content:g})]})},tq=({children:e})=>{let t=(0,h.Xr)(x.W7),a=(0,C.useCallback)(()=>{t(e=>({...e,openModal:!0}))},[t]);return(0,i.jsx)(et.$n,{onClick:a,className:eQ,variant:"primary",children:e})},tU=()=>{let e=(0,k.s9)(),[t,a]=(0,C.useState)(!1),s=(0,d.h1)(S.nC).subscription,n=(0,C.useCallback)(()=>{a(!0);let e=s.pro$.value;e&&v.u4.$.settingsPanel.plans.resumeSubscription({plan:es.R$.Pro,recurring:e.recurring})},[s.pro$.value]);return(0,i.jsx)(e6,{open:t,onOpenChange:a,children:(0,i.jsxs)(et.$n,{className:"_12asts4n _12asts4m",onClick:n,children:[(0,i.jsx)("span",{"data-show-hover":"true",className:(0,q.A)(e0),children:e["com.arms.payment.resume-renewal"]()}),(0,i.jsx)("span",{"data-show-hover":"false",className:(0,q.A)(e0),children:e["com.arms.payment.current-plan"]()})]})})};var tz="_1as6clu3";let tW=()=>{let e=(0,k.s9)(),t=(0,d.h1)(S.nC),a=(0,u.S)(t.prices.readableLifetimePrice$),s=(0,u.S)(t.subscription.isBeliever$);return a?(0,i.jsxs)(e9,{type:1,children:[(0,i.jsx)("div",{className:"_1as6clu0",children:e["com.arms.payment.lifetime.caption-1"]()}),(0,i.jsx)("div",{className:"_1as6clu1",children:e["com.arms.payment.lifetime.title"]()}),(0,i.jsx)("div",{className:"_1as6clu2",children:a}),s?(0,i.jsx)(l.$n,{className:tz,size:"default",disabled:!0,children:e["com.arms.payment.lifetime.purchased"]()}):(0,i.jsx)(tH,{className:tz,recurring:es.zS.Lifetime,children:e["com.arms.payment.lifetime.purchase"]()}),(0,i.jsx)("div",{className:"_1as6clu4",children:(0,i.jsx)(k.x6,{i18nKey:"com.arms.payment.lifetime.caption-2",components:{a:(0,i.jsx)("a",{className:"_1as6clu5",href:"#"})}})}),(0,i.jsx)(tt,{style:{padding:"8px 6px"}})]}):null},tK=e=>({[e["com.arms.payment.cloud.free.benefit.g1"]()]:[1,2,3].map(t=>({title:e[`com.arms.payment.cloud.free.benefit.g1-${t}`]()})),[e["com.arms.payment.cloud.free.benefit.g2"]()]:[1,2,3,4,5].map(t=>({title:e[`com.arms.payment.cloud.free.benefit.g2-${t}`]()}))}),tG=e=>({[e["com.arms.payment.cloud.pro.benefit.g1"]()]:[{title:e["com.arms.payment.cloud.pro.benefit.g1-1"](),icon:(0,i.jsx)(J.AfFiNeIcon,{})},...[2,3,4,5,6,7,8].map(t=>({title:e[`com.arms.payment.cloud.pro.benefit.g1-${t}`]()}))]}),tX=e=>({[e["com.arms.payment.cloud.team.benefit.g1"]()]:[{title:e["com.arms.payment.cloud.team.benefit.g1-1"](),icon:(0,i.jsx)(J.AfFiNeIcon,{})},...[2,3,4].map(t=>({title:e[`com.arms.payment.cloud.team.benefit.g1-${t}`]()}))],[e["com.arms.payment.cloud.team.benefit.g2"]()]:[{title:e["com.arms.payment.cloud.team.benefit.g2-1"]()},{title:e["com.arms.payment.cloud.team.benefit.g2-2"]()},{title:e["com.arms.payment.cloud.team.benefit.g2-3"]()}]}),tY=({recurring:e,t})=>e===es.zS.Monthly?t["com.arms.payment.recurring-monthly"]():t["com.arms.payment.recurring-yearly"](),tJ=()=>{let e=(0,k.s9)(),t=(0,C.useRef)(null),{authService:a,subscriptionService:s}=(0,d.A$)({AuthService:S.uR,SubscriptionService:S.nC}),n=(0,u.S)(s.prices.prices$),r="authenticated"===(0,u.S)(a.session.status$),c=(0,u.S)(s.subscription.pro$),[o,m]=(0,C.useState)(c?.recurring??es.zS.Yearly),p=(0,C.useMemo)(()=>{let t=function(e){return new Map([[es.R$.Free,{type:"fixed",plan:es.R$.Free,price:"0",yearlyPrice:"0",name:e["com.arms.payment.cloud.free.name"](),description:e["com.arms.payment.cloud.free.description"](),titleRenderer:()=>e["com.arms.payment.cloud.free.title"](),benefits:tK(e)}],[es.R$.Pro,{type:"fixed",plan:es.R$.Pro,price:"1",yearlyPrice:"1",name:e["com.arms.payment.cloud.pro.name"](),description:e["com.arms.payment.cloud.pro.description"](),titleRenderer:(t,a)=>{let s=t===es.zS.Yearly?a.yearlyPrice:a.price;return(0,i.jsxs)(i.Fragment,{children:[e["com.arms.payment.cloud.pro.title.price-monthly"]({price:"$"+s}),t===es.zS.Yearly?(0,i.jsx)("span",{className:"_12asts4i",children:e["com.arms.payment.cloud.pro.title.billed-yearly"]()}):null]})},benefits:tG(e)}],[es.R$.Team,{type:"dynamic",plan:es.R$.Team,contact:!0,name:e["com.arms.payment.cloud.team.name"](),description:e["com.arms.payment.cloud.team.description"](),titleRenderer:()=>e["com.arms.payment.cloud.team.title"](),benefits:tX(e)}]])}(e),a=new Map;return t.forEach((e,t)=>{a.set(t,{...e})}),n?.forEach(e=>{let t=a.get(e.plan);t?.type==="fixed"&&(t.price=((e.amount??0)/100).toFixed(2),t.yearlyPrice=((e.yearlyAmount??0)/100/12).toFixed(2),t.discount=e.yearlyAmount&&e.amount?Math.floor((1-e.yearlyAmount/12/e.amount)*100).toString():void 0)}),a},[n,e]),h=c?.plan??es.R$.Free,x=!!c?.canceledAt,g=c?.recurring??es.zS.Monthly,j=p.get(es.R$.Pro)?.discount;(0,C.useEffect)(()=>{if(!t.current)return;let e=t.current?.querySelector('[data-current="true"]'),a=getComputedStyle(t.current),s=e?e.getBoundingClientRect().left-t.current.getBoundingClientRect().left-parseInt(a.paddingLeft):0,n="true"===t.current.dataset.appeared,r=requestAnimationFrame(()=>{t.current?.scrollTo({behavior:n?"smooth":"instant",left:s}),t.current?.setAttribute("data-appeared","true")});return()=>{cancelAnimationFrame(r)}},[o]);let f=r?x?(0,i.jsx)("p",{children:e["com.arms.payment.subtitle-canceled"]({plan:`${tY({recurring:g,t:e})} ${h}`})}):(0,i.jsx)("p",{children:(0,i.jsxs)(k.x6,{plan:h,i18nKey:"com.arms.payment.subtitle-active",values:{currentPlan:h},children:["You are currently on the ",{currentPlan:h}," plan. If you have any questions, please contact our ",(0,i.jsx)("a",{href:"mailto:support@toeverything.info",style:{color:"var(--affine-link-color)"},children:"customer support"}),"."]})}):(0,i.jsx)("p",{children:e["com.arms.payment.subtitle-not-signed-in"]()}),y=(0,i.jsxs)("div",{className:"_12asts41",children:[(0,i.jsx)("div",{children:o===es.zS.Yearly?(0,i.jsx)("div",{className:e1,children:e["com.arms.payment.cloud.pricing-plan.toggle-yearly"]()}):(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)("div",{className:e1,children:(0,i.jsx)("span",{children:e["com.arms.payment.cloud.pricing-plan.toggle-billed-yearly"]()})}),j?(0,i.jsx)("div",{className:"_12asts43",children:e["com.arms.payment.cloud.pricing-plan.toggle-discount"]({discount:j})}):null]})}),(0,i.jsx)(l.dO,{checked:o===es.zS.Yearly,onChange:e=>m(e?es.zS.Yearly:es.zS.Monthly)})]}),v=(0,i.jsx)("div",{className:"_12asts47",ref:t,children:Array.from(p.values()).map(e=>(0,i.jsx)(tO,{detail:e,recurring:o},e.plan))}),b=(0,i.jsxs)("div",{className:"_12asts46",children:[(0,i.jsx)("b",{children:e["com.arms.payment.cloud.pricing-plan.select.title"]()}),(0,i.jsx)("span",{children:e["com.arms.payment.cloud.pricing-plan.select.caption"]()})]});return(0,i.jsx)(tM,{caption:f,select:b,toggle:y,scroll:v,scrollRef:t,lifetime:(0,i.jsx)(tW,{})})},tQ=({radius:e=8,...t})=>(0,i.jsx)(l.EA,{...t,style:{borderRadius:`${e}px`}}),t1=()=>(0,i.jsx)(l.EA,{variant:"rounded",width:"256px",height:"24px"}),t0=()=>(0,i.jsxs)("div",{className:"_1wd2fkr1",children:[(0,i.jsxs)("header",{className:"_1wd2fkr2",children:[(0,i.jsx)(tQ,{variant:"rounded",width:"100%",height:"60px"}),(0,i.jsx)(tQ,{variant:"rounded",width:"100%",height:"28px"})]}),(0,i.jsx)("main",{className:"_1wd2fkr3",children:(0,i.jsx)(tQ,{variant:"rounded",width:"100%",height:"100%"})})]}),t2=()=>(0,i.jsxs)("div",{className:"_1wd2fkr0",children:[(0,i.jsx)(t0,{}),(0,i.jsx)(t0,{}),(0,i.jsx)(t0,{})]}),t7=()=>(0,i.jsx)(tL,{ai:(0,i.jsx)(tR,{caption:(0,i.jsx)(tQ,{variant:"rectangular",radius:2,width:"200px",height:"20px"}),actionButtons:(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(tQ,{variant:"rectangular",radius:20,width:"206px",height:"37px"}),(0,i.jsx)(tQ,{variant:"rectangular",radius:20,width:"193px",height:"37px"})]})}),cloud:(0,i.jsx)(tM,{toggle:(0,i.jsx)(tQ,{variant:"rounded",width:"100%",height:"32px"}),select:(0,i.jsx)(t1,{}),scroll:(0,i.jsx)(t2,{})})}),t3=()=>{let e=(0,d.h1)(S.nC),t=(0,u.S)(e.prices.prices$);return((0,C.useEffect)(()=>{e.subscription.revalidate(),e.prices.revalidate()},[e]),null===t)?(0,i.jsx)(t7,{}):(0,i.jsx)(tL,{cloudTip:!0,cloud:(0,i.jsx)(tJ,{}),ai:(0,i.jsx)(tP,{})})},t4=()=>(0,i.jsx)(eX,{FallbackComponent:t6,children:(0,i.jsx)(t3,{})}),t6=({resetErrorBoundary:e})=>{let t=(0,k.s9)(),a=(0,i.jsxs)("div",{className:"_12asts410",children:[(0,i.jsx)("span",{children:t["com.arms.payment.plans-error-tip"]()}),(0,i.jsx)("a",{onClick:e,className:"_12asts411",children:t["com.arms.payment.plans-error-retry"]()})]});return(0,i.jsx)(tL,{cloud:(0,i.jsx)(tM,{scroll:a})})},t8=()=>{let e=(0,k.s9)();return(0,C.useCallback)(t=>e[`com.arms.keyboardShortcuts.${t}`](),[e])},t5=()=>{let e=(0,k.s9)();return(0,C.useCallback)(t=>e["com.arms.keyboardShortcuts.heading"]({number:t}),[e])},t9=()=>{let e=t8();return(0,C.useMemo)(()=>({[e("cancel")]:["ESC"],[e("quickSearch")]:["Ctrl","K"],[e("newPage")]:["Ctrl","N"],[e("expandOrCollapseSidebar")]:["Ctrl","/"],[e("goBack")]:["Ctrl","["],[e("goForward")]:["Ctrl","]"],[e("copy-private-link")]:["⌘","⇧","C"]}),[e])},ae=()=>{let e=t8();return(0,C.useMemo)(()=>({[e("cancel")]:["ESC"],[e("quickSearch")]:["⌘","K"],[e("newPage")]:["⌘","N"],[e("expandOrCollapseSidebar")]:["⌘","/"],[e("goBack")]:["⌘ ","["],[e("goForward")]:["⌘ ","]"],[e("copy-private-link")]:["⌘","⇧","C"]}),[e])},at=()=>{let e=t8();return(0,C.useMemo)(()=>({[e("selectAll")]:["⌘","A"],[e("undo")]:["⌘","Z"],[e("redo")]:["⌘","⇧","Z"],[e("zoomIn")]:["⌘","+"],[e("zoomOut")]:["⌘","-"],[e("zoomTo100")]:["⌘","0"],[e("zoomToFit")]:["⌘","1"],[e("select")]:["V"],[e("text")]:["T"],[e("shape")]:["S"],[e("image")]:["I"],[e("straightConnector")]:["L"],[e("elbowedConnector")]:["X"],[e("pen")]:["P"],[e("hand")]:["H"],[e("note")]:["N"]}),[e])},aa=()=>{let e=t8();return(0,C.useMemo)(()=>({[e("selectAll")]:["Ctrl","A"],[e("undo")]:["Ctrl","Z"],[e("redo")]:["Ctrl","Y/Ctrl","Shift","Z"],[e("zoomIn")]:["Ctrl","+"],[e("zoomOut")]:["Ctrl","-"],[e("zoomTo100")]:["Ctrl","0"],[e("zoomToFit")]:["Ctrl","1"],[e("select")]:["V"],[e("text")]:["T"],[e("shape")]:["S"],[e("image")]:["I"],[e("straightConnector")]:["L"],[e("elbowedConnector")]:["X"],[e("pen")]:["P"],[e("hand")]:["H"],[e("note")]:["N"],[e("switch")]:["Alt ",""]}),[e])},as=()=>{let e=t8(),t=t5();return(0,C.useMemo)(()=>({[e("undo")]:["⌘","Z"],[e("redo")]:["⌘","⇧","Z"],[e("bold")]:["⌘","B"],[e("italic")]:["⌘","I"],[e("underline")]:["⌘","U"],[e("strikethrough")]:["⌘","⇧","S"],[e("inlineCode")]:["⌘","E"],[e("codeBlock")]:["⌘","⌥","C"],[e("link")]:["⌘","K"],[e("quickSearch")]:["⌘","K"],[e("bodyText")]:["⌘","⌥","0"],[t("1")]:["⌘","⌥","1"],[t("2")]:["⌘","⌥","2"],[t("3")]:["⌘","⌥","3"],[t("4")]:["⌘","⌥","4"],[t("5")]:["⌘","⌥","5"],[t("6")]:["⌘","⌥","6"],[e("increaseIndent")]:["Tab"],[e("reduceIndent")]:["⇧","Tab"],[e("groupDatabase")]:["⌘","G"],[e("switch")]:["⌥","S"]}),[e,t])},an=()=>{let e=t8(),t=t5();return(0,C.useMemo)(()=>({[e("bold")]:["**Text**"],[e("italic")]:["*Text*"],[e("underline")]:["~Text~"],[e("strikethrough")]:["~~Text~~"],[e("divider")]:["***"],[e("inlineCode")]:["`Text` "],[e("codeBlock")]:["``` Space"],[t("1")]:["# Text"],[t("2")]:["## Text"],[t("3")]:["### Text"],[t("4")]:["#### Text"],[t("5")]:["##### Text"],[t("6")]:["###### Text"]}),[e,t])},ar=()=>{let e=t8(),t=t5();return(0,C.useMemo)(()=>({[e("undo")]:["Ctrl","Z"],[e("redo")]:["Ctrl","Y"],[e("bold")]:["Ctrl","B"],[e("italic")]:["Ctrl","I"],[e("underline")]:["Ctrl","U"],[e("strikethrough")]:["Ctrl","Shift","S"],[e("inlineCode")]:[" Ctrl","E"],[e("codeBlock")]:["Ctrl","Alt","C"],[e("link")]:["Ctr","K"],[e("quickSearch")]:["Ctrl","K"],[e("bodyText")]:["Ctrl","Shift","0"],[t("1")]:["Ctrl","Shift","1"],[t("2")]:["Ctrl","Shift","2"],[t("3")]:["Ctrl","Shift","3"],[t("4")]:["Ctrl","Shift","4"],[t("5")]:["Ctrl","Shift","5"],[t("6")]:["Ctrl","Shift","6"],[e("increaseIndent")]:["Tab"],[e("reduceIndent")]:["Shift+Tab"],[e("groupDatabase")]:["Ctrl + G"]}),[e,t])},ai=()=>{let e=t8(),t=t5();return(0,C.useMemo)(()=>({[e("bold")]:["**Text** "],[e("italic")]:["*Text* "],[e("underline")]:["~Text~ "],[e("strikethrough")]:["~~Text~~ "],[e("divider")]:["***"],[e("inlineCode")]:["`Text` "],[e("codeBlock")]:["``` Text"],[t("1")]:["# Text"],[t("2")]:["## Text"],[t("3")]:["### Text"],[t("4")]:["#### Text"],[t("5")]:["##### Text"],[t("6")]:["###### Text"]}),[e,t])},al=()=>{let e=(0,k.s9)(),t=an(),a=ai(),s=environment.isBrowser&&environment.isMacOs;return{title:e["com.arms.shortcutsTitle.markdownSyntax"](),shortcuts:s?t:a}},ac=()=>{let e=(0,k.s9)(),t=as(),a=ar(),s=environment.isBrowser&&environment.isMacOs;return{title:e["com.arms.shortcutsTitle.page"](),shortcuts:s?t:a}},ao=()=>{let e=(0,k.s9)(),t=at(),a=aa(),s=environment.isBrowser&&environment.isMacOs;return{title:e["com.arms.shortcutsTitle.edgeless"](),shortcuts:s?t:a}},ad=()=>{let e=(0,k.s9)(),t=ae(),a=t9(),s=environment.isBrowser&&environment.isMacOs;return{title:e["com.arms.shortcutsTitle.general"](),shortcuts:s?t:a}},am=({shortcutsInfo:e})=>(0,i.jsx)(W,{title:e.title,children:Object.entries(e.shortcuts).map(([e,t])=>(0,i.jsxs)("div",{className:"hw5iyc0",children:[(0,i.jsx)("span",{children:e}),(0,i.jsx)("div",{className:"hw5iyc1",children:t.map(e=>(0,i.jsx)("span",{className:"hw5iyc2",children:e},e))})]},e))}),au=()=>{let e=(0,k.s9)(),t=al(),a=ac(),s=ao(),n=ad();return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(D,{title:e["com.arms.keyboardShortcuts.title"](),subtitle:e["com.arms.keyboardShortcuts.subtitle"](),"data-testid":"keyboard-shortcuts-title"}),(0,i.jsx)(am,{shortcutsInfo:n}),(0,i.jsx)(am,{shortcutsInfo:a}),(0,i.jsx)(am,{shortcutsInfo:s}),(0,i.jsx)(am,{shortcutsInfo:t})]})},ap=()=>{let e=(0,k.s9)(),{authService:t,serverConfigService:a,userFeatureService:s}=(0,d.A$)({AuthService:S.uR,ServerConfigService:S.BB,UserFeatureService:ek.r}),n=(0,u.S)(t.session.status$),r=(0,u.S)(a.serverConfig.features$.map(e=>e?.payment));(0,C.useEffect)(()=>{s.userFeature.revalidate()},[s]);let i=[{key:"appearance",title:e["com.arms.settings.appearance"](),icon:J.AppearanceIcon,testId:"appearance-panel-trigger"},{key:"shortcuts",title:e["com.arms.keyboardShortcuts.title"](),icon:J.KeyboardIcon,testId:"shortcuts-panel-trigger"},{key:"about",title:e["com.arms.aboutAFFiNE.title"](),icon:J.InformationIcon,testId:"about-panel-trigger"}];return r&&(i.splice(3,0,{key:"plans",title:e["com.arms.payment.title"](),icon:tk,testId:"plans-panel-trigger"}),"authenticated"===n&&i.splice(3,0,{key:"billing",title:e["com.arms.payment.billing-setting.title"](),icon:tw,testId:"billing-panel-trigger"})),i},ah=({generalKey:e})=>{switch(e){case"shortcuts":return(0,i.jsx)(au,{});case"appearance":return(0,i.jsx)(eH,{});case"about":return(0,i.jsx)(eM,{});case"plans":return(0,i.jsx)(t4,{});case"billing":return(0,i.jsx)(td,{});default:return null}};var aC=a(48834),ax=a(81340),ag=a(52428),aj=a(40971),af="w6lall8",ay="w6lall3",av="w6lall4",ab="w6lall2";let ak=({onAccountSettingClick:e,active:t})=>{let a=(0,u.S)((0,d.h1)(S.uR).session.account$);if(a)return(0,i.jsxs)("div",{"data-testid":"user-info-card",className:(0,q.A)(af,{active:t}),onClick:e,children:[(0,i.jsx)(ee.e,{size:28,rounded:2,name:a.label,url:a.avatar,className:"avatar"}),(0,i.jsxs)("div",{className:"content",children:[(0,i.jsxs)("div",{className:"name-container",children:[(0,i.jsx)("div",{className:"name",title:a.label,children:a.label}),(0,i.jsx)(aj.$,{})]}),(0,i.jsx)("div",{className:"email",title:a.email,children:a.email})]})]})},aw=()=>{let e=(0,k.s9)(),[,t]=(0,h.fp)(x.W7);return(0,i.jsxs)("div",{className:af,onClick:(0,C.useCallback)(()=>{t({openModal:!0,state:"signIn"})},[t]),children:[(0,i.jsx)("div",{className:"avatar not-sign",children:(0,i.jsx)(J.Logo1Icon,{})}),(0,i.jsxs)("div",{className:"content",children:[(0,i.jsx)("div",{className:"name",title:e["com.arms.settings.sign"](),children:e["com.arms.settings.sign"]()}),(0,i.jsx)("div",{className:"email",title:e["com.arms.setting.sign.message"](),children:e["com.arms.setting.sign.message"]()})]})]})},aS=({activeTab:e,onTabChange:t,selectedWorkspaceId:a})=>{let s=(0,k.s9)(),n=(0,u.S)((0,d.h1)(S.uR).session.status$),r=ap(),l=(0,C.useCallback)(e=>{let a=e.currentTarget.dataset.eventArg;a&&(v.u4.$.settingsPanel.menu.openSettings({to:a}),t(a,null))},[t]),c=(0,C.useCallback)(()=>{v.u4.$.settingsPanel.menu.openSettings({to:"account"}),t("account",null)},[t]),o=(0,C.useCallback)((e,a)=>{v.u4.$.settingsPanel.menu.openSettings({to:"workspace",control:e}),t(`workspace:${e}`,a)},[t]);return(0,i.jsxs)("div",{className:"w6lall0","data-testid":"settings-sidebar",children:[(0,i.jsx)("div",{className:"w6lall1",children:s["com.arms.settingSidebar.title"]()}),(0,i.jsx)("div",{className:ab,children:s["com.arms.settingSidebar.settings.general"]()}),(0,i.jsx)("div",{className:ay,children:r.map(({title:t,icon:a,key:s,testId:n})=>(0,i.jsxs)("div",{className:(0,q.A)(av,{active:s===e}),title:t,"data-event-arg":s,onClick:l,"data-testid":n,children:[a({className:"icon"}),(0,i.jsx)("span",{className:"setting-name",children:t})]},s))}),(0,i.jsx)("div",{className:ab,children:s["com.arms.settingSidebar.settings.workspace"]()}),(0,i.jsx)("div",{className:(0,q.A)(ay,"scroll"),children:(0,i.jsx)(C.Suspense,{fallback:(0,i.jsx)(Y,{}),children:(0,i.jsx)(aN,{onWorkspaceSettingClick:o,selectedWorkspaceId:a,activeSubTab:e.split(":")[1]})})}),(0,i.jsxs)("div",{className:"w6lall7",children:["unauthenticated"===n?(0,i.jsx)(aw,{}):null,"authenticated"===n?(0,i.jsx)(C.Suspense,{children:(0,i.jsx)(ak,{onAccountSettingClick:c,active:"account"===e})}):null]})]})},aN=({onWorkspaceSettingClick:e,selectedWorkspaceId:t,activeSubTab:a})=>{let s=(0,u.S)((0,d.h1)(p.q).list.workspaces$);return(0,i.jsx)(i.Fragment,{children:s.map(s=>(0,i.jsx)(C.Suspense,{fallback:(0,i.jsx)(X,{}),children:(0,i.jsx)(a$,{meta:s,onClick:t=>{e(t,s)},activeSubTab:s.id===t?a:void 0})},s.id))})},a_=[{key:"preference",title:"com.arms.settings.workspace.preferences"},{key:"properties",title:"com.arms.settings.workspace.properties"}],a$=({activeSubTab:e,meta:t,onClick:a})=>{let{workspaceService:s,userFeatureService:n}=(0,d.A$)({WorkspaceService:m.j,UserFeatureService:ek.r}),r=(0,ax.R)(t),l=r?.name??ag.EZ,c=s.workspace.id===t.id,o=(0,k.s9)();(0,C.useEffect)(()=>{n.userFeature.revalidate()},[n]);let u=(0,C.useCallback)(()=>{a("preference")},[a]),p=(0,C.useMemo)(()=>a_.map(({key:t,title:s})=>(0,i.jsx)("div",{"data-testid":`workspace-list-item-${t}`,onClick:()=>{a(t)},className:(0,q.A)("w6lall5",{active:e===t}),children:o[s]()},t)),[e,a,o]);return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)("div",{className:(0,q.A)(av,{active:!!e}),title:l,onClick:u,"data-testid":"workspace-list-item",children:[(0,i.jsx)(aC.z,{meta:t,size:16,name:l,colorfulFallback:!0,style:{marginRight:"10px"},rounded:2},t.id),(0,i.jsx)("span",{className:"setting-name",children:l}),c?(0,i.jsx)(tI.m,{content:"Current",side:"top",children:(0,i.jsx)("div",{className:"w6lall6","data-testid":"current-workspace-label"})}):null]}),e&&p.length>1?p:null]})};var aA="_1hbyecy6";let aL=["shortcuts","appearance","about","plans","billing","experimental-features"];var aM=a(22563),aF=a(33907),aE=a(69628),aR=a(93965),aP="fvkbfk3";let aI=({workspaceMetadata:e,...t})=>{let{onConfirm:a}=t,[s,n]=(0,C.useState)(""),r=(0,ax.R)(e),c=r?.name??ag.EZ,d=s===c,m=(0,k.s9)(),u=(0,C.useCallback)(()=>{if(d)return a?.()},[d,a]);return(0,i.jsxs)(f.uo,{title:`${m["com.arms.workspaceDelete.title"]()}?`,cancelText:m["com.arms.workspaceDelete.button.cancel"](),confirmText:m["com.arms.workspaceDelete.button.delete"](),confirmButtonOptions:{variant:"error",disabled:!d,"data-testid":"delete-workspace-confirm-button"},...t,children:[e.flavour===o.j.LOCAL?(0,i.jsxs)(k.x6,{i18nKey:"com.arms.workspaceDelete.description",children:["Deleting (",(0,i.jsx)("span",{className:aP,children:{workspace:c}}),") cannot be undone, please proceed with caution. All contents will be lost."]}):(0,i.jsxs)(k.x6,{i18nKey:"com.arms.workspaceDelete.description2",children:["Deleting (",(0,i.jsx)("span",{className:aP,children:{workspace:c}}),") will delete both local and cloud data, this operation cannot be undone, please proceed with caution."]}),(0,i.jsx)("div",{className:"fvkbfk2",children:(0,i.jsx)(l.pd,{autoFocus:!0,onChange:n,"data-testid":"delete-workspace-input",onEnter:u,placeholder:m["com.arms.workspaceDelete.placeholder"](),size:"large"})})]})},aO=()=>{let{workspaceService:e,globalContextService:t,workspacePermissionService:a,workspacesService:s}=(0,d.A$)({WorkspaceService:m.j,GlobalContextService:aF.q,WorkspacePermissionService:O.Q,WorkspacesService:p.q}),n=(0,k.s9)(),r=e.workspace,{jumpToSubPath:c,jumpToIndex:o}=(0,aE.P)(),[g,j]=(0,C.useState)(!1),[v,b]=(0,C.useState)(!1),w=(0,h.Xr)(x.JO),S=(0,u.S)(s.list.workspaces$),N=(0,u.S)(t.globalContext.workspaceId.$),_=(0,u.S)(a.permission.isOwner$);(0,C.useEffect)(()=>{a.permission.revalidate()},[a]);let $=(0,C.useCallback)(()=>{null!==_&&(_?j(!0):b(!0))},[_]),A=(0,y.V)(async()=>{if(w(e=>({...e,open:!1,workspaceId:null})),N===r.id){let e=S.find(e=>e.id!==N);e?c(e?.id||"",aR.Tk.ALL,aE.Q.REPLACE):o(aE.Q.REPLACE)}_?await s.deleteWorkspace(r.meta):await a.leaveWorkspace(),l.me.success({title:n["Successfully deleted"]()})},[w,N,r.id,r.meta,_,n,S,c,o,s,a]);return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(U,{name:(0,i.jsx)("span",{style:{color:"var(--affine-error-color)"},children:_?n["com.arms.workspaceDelete.title"]():n["com.arms.deleteLeaveWorkspace.leave"]()}),desc:n["com.arms.deleteLeaveWorkspace.description"](),style:{cursor:"pointer"},onClick:$,"data-testid":"delete-workspace-button",children:(0,i.jsx)(J.ArrowRightSmallIcon,{})}),_?(0,i.jsx)(aI,{onConfirm:A,open:g,onOpenChange:j,workspaceMetadata:r.meta}):(0,i.jsx)(f.uo,{open:v,cancelText:n["com.arms.confirmModal.button.cancel"](),onConfirm:A,onOpenChange:b,title:`${n["com.arms.deleteLeaveWorkspace.leave"]()}?`,description:n["com.arms.deleteLeaveWorkspace.leaveDescription"](),confirmText:n.Leave(),confirmButtonOptions:{variant:"error"}})]})},aB=()=>{let e=(0,k.s9)(),t=(0,F.K)(),a=(0,d.h1)(m.j).workspace,s=(0,u.S)(a.name$),n=a.flavour,r=(0,h.Xr)(x.JO),l=(0,C.useCallback)(()=>{a&&t(a,{onSuccess:()=>{r(e=>({...e,open:!1}))}})},[t,r,a]);return n!==o.j.LOCAL?null:(0,i.jsx)(U,{name:e["Workspace saved locally"]({name:s??ag.EZ}),desc:e["Enable cloud hint"](),spreadCol:!1,style:{padding:"10px",background:"var(--affine-background-secondary-color)"},children:(0,i.jsx)(et.$n,{"data-testid":"publish-enable-affine-cloud-button",variant:"primary",onClick:l,style:{marginTop:"12px"},children:e["Enable AFFiNE Cloud"]()})})};var aT=a(10265);let aV=({workspaceMetadata:e,workspace:t})=>{let a=e.id,s=(0,k.s9)(),[n,r]=(0,C.useState)(!1),o=(0,aT.A)(),d=(0,y.V)(async()=>{if(!n&&t){r(!0);try{o&&(await t.engine.waitForDocSynced(),await t.engine.blob.sync());let e=await c.Ok?.dialog.saveDBFileAs(a);if(e?.error)throw Error(e.error);e?.canceled||l.me.success({title:s["Export success"]()})}catch(e){l.me.error({title:s["Export failed"](),message:e.message})}finally{r(!1)}}},[o,n,s,t,a]);return(0,i.jsx)(U,{name:s.Export(),desc:s["Export Description"](),children:(0,i.jsx)(et.$n,{"data-testid":"export-affine-backup",onClick:d,disabled:n,children:s.Export()})})};var aZ="_1ap5wdpc",aH="_1ap5wdp7";let aD=({value:e,background:t})=>(0,i.jsx)("div",{children:(0,i.jsx)("div",{className:"_1ap5wdpg",style:{background:t},children:e})}),aq=()=>{let e=(0,d.h1)(m.j).workspace,t=(0,d.h1)(O.Q),a=(0,u.S)(t.permission.isOwner$);(0,C.useEffect)(()=>{t.permission.revalidate()},[t]);let s=(0,C.useMemo)(()=>({local:{value:"Local",background:"var(--affine-tag-orange)"},syncCloud:{value:"Sync with AFFiNE Cloud",background:"var(--affine-tag-blue)"},syncDocker:{value:"Sync with AFFiNE Docker",background:"var(--affine-tag-green)"},selfHosted:{value:"Self-Hosted Server",background:"var(--affine-tag-purple)"},joinedWorkspace:{value:"Joined Workspace",background:"var(--affine-tag-yellow)"},availableOffline:{value:"Available Offline",background:"var(--affine-tag-green)"},publishedToWeb:{value:"Published to Web",background:"var(--affine-tag-blue)"}}),[]),n=[{condition:!a,label:"joinedWorkspace"},{condition:"local"===e.flavour,label:"local"},{condition:"affine-cloud"===e.flavour,label:"syncCloud"}];return(0,i.jsx)("div",{className:"_1ap5wdp2",children:n.map(({condition:e,label:t})=>e&&(0,i.jsx)(aD,{value:s[t].value,background:s[t].background},t))})};var aU=a(61362);function az(){let{mutate:e}=(0,eG.iX)();return(0,C.useCallback)(async()=>e(e=>!!Array.isArray(e)&&"cloud"===e[0]),[e])}function aW(e){let t={[es.aX.Owner]:4,[es.aX.Admin]:3,[es.aX.Write]:2,[es.aX.Read]:1};return[Number(e.permission===es.aX.Owner),Number(!e.accepted),t[e.permission]||0].reduce((e,t,a,s)=>e+t*Math.pow(10,s.length-1-a),0)}let aK=()=>{let e=(0,k.s9)();return(0,i.jsx)(tI.m,{content:e["com.arms.settings.member-tooltip"](),children:(0,i.jsx)("div",{className:"_1ap5wdp5",children:(0,i.jsx)(U,{name:`${e.Members()} (0)`,desc:e["Members hint"](),children:(0,i.jsx)(et.$n,{children:e["Invite Members"]()})})})})},aG=()=>{let e=(0,d.h1)(S.BB).serverConfig,t=(0,u.S)(e.features$.map(e=>e?.payment)),a=(0,d.h1)(m.j).workspace,s=function(e){let{data:t}=(0,eW.IT)({query:eU.TJ,variables:{workspaceId:e}});return t.workspace.memberCount}(a.id),n=(0,d.h1)(O.Q),r=(0,u.S)(n.permission.isOwner$);(0,C.useEffect)(()=>{n.permission.revalidate()},[n]);let c=(0,C.useCallback)((e,t)=>void 0!==t&&e>=t,[]),o=(0,d.h1)(B.P);(0,C.useEffect)(()=>{o.quota.revalidate()},[o]);let p=(0,u.S)(o.quota.quota$),g=(0,d.h1)(S.nC),j=(0,u.S)(g.subscription.pro$.map(e=>e?.plan)),f=p?c(s,p.memberLimit):null,y=(0,k.s9)(),{invite:b,isMutating:w}=function(e){let{trigger:t,isMutating:a}=(0,ez.n)({mutation:eU.i6}),s=az();return{invite:(0,C.useCallback)(async(a,n,r=!1)=>{let i=await t({workspaceId:e,email:a,permission:n,sendInviteMail:r});return await s(),i?.invite},[s,t,e]),isMutating:a}}(a.id),N=function(e){let t=az(),{trigger:a}=(0,ez.n)({mutation:eU.NW});return(0,C.useCallback)(async s=>{let n=await a({workspaceId:e,userId:s});return await t(),n},[t,a,e])}(a.id),[_,$]=(0,C.useState)(!1),[A,L]=(0,C.useState)(0),M=(0,C.useCallback)(()=>{$(!0)},[]),F=(0,C.useCallback)(e=>{L(e)},[]),E=(0,C.useCallback)(async({email:e,permission:t})=>{await b(e,t,!0)&&(l.me.success({title:y["Invitation sent"](),message:y["Invitation sent hint"]()}),$(!1))},[b,y]),R=(0,h.Xr)(x.JO),P=(0,C.useCallback)(()=>{R({open:!0,activeTab:"plans",scrollAnchor:"cloudPricingPlan"}),v.u4.$.settingsPanel.workspace.viewPlans({control:"inviteMember"})},[R]),I=(0,C.useRef)(null),[T,V]=(0,C.useState)(null);(0,C.useLayoutEffect)(()=>{s>8&&I.current&&null===T&&V(I.current.getBoundingClientRect().height)},[I,s,T]);let Z=(0,C.useCallback)(async e=>{let t=await N(e);t?.revoke&&l.me.success({title:y["Removed successfully"]()})},[N,y]),H=(0,C.useMemo)(()=>p?(0,i.jsxs)("span",{children:[y["com.arms.payment.member.description2"](),t?(0,i.jsx)("div",{className:"_1ap5wdpi",onClick:P,children:(0,i.jsx)("span",{className:"_1ap5wdph",children:y["com.arms.payment.member.description.choose-plan"]()})}):null]}):null,[P,t,y,p]);return null===p?null:(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(U,{name:`${y.Members()} (${s}/${p.humanReadable.memberLimit})`,desc:H,spreadCol:!!r,children:r?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(et.$n,{onClick:M,children:y["Invite Members"]()}),f?(0,i.jsx)(eD.bI,{isFreePlan:!!j,open:_,plan:p.humanReadable.name??"",quota:p.humanReadable.memberLimit??"",setOpen:$,onConfirm:P}):(0,i.jsx)(eD.lq,{open:_,setOpen:$,onConfirm:E,isMutating:w})]}):null}),(0,i.jsxs)("div",{className:aH,ref:I,style:T?{height:T}:{},children:[(0,i.jsx)(C.Suspense,{fallback:(0,i.jsx)(aY,{memberCount:s}),children:(0,i.jsx)(aJ,{workspaceId:a.id,isOwner:!!r,skip:A,onRevoke:Z})}),s>8&&(0,i.jsx)(eD.dK,{totalCount:s,countPerPage:8,onPageChange:F})]})]})},aX=()=>{let e=(0,k.s9)();return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(U,{name:e.Members(),desc:e["com.arms.payment.member.description2"]()}),(0,i.jsx)("div",{className:aH,children:(0,i.jsx)(aY,{memberCount:1})})]})},aY=({memberCount:e})=>{let t=(0,C.useMemo)(()=>e>8?506:"auto",[e]),a=(0,k.s9)();return(0,i.jsxs)("div",{style:{height:t},className:"_1ap5wdp6",children:[(0,i.jsx)(eq.R,{size:20}),(0,i.jsx)("span",{children:a["com.arms.settings.member.loading"]()})]})},aJ=({workspaceId:e,isOwner:t,skip:a,onRevoke:s})=>{let n=function(e,t,a=8){let{data:s}=(0,eW.IT)({query:eU.JL,variables:{workspaceId:e,skip:t,take:a}}),n=s.workspace.members;return(0,C.useMemo)(()=>n.sort((e,t)=>{let a=aW(t)-aW(e);return 0!==a?a:null===e.name?1:null===t.name?-1:e.name.localeCompare(t.name)}),[n])}(e,a,8),r=(0,d.h1)(S.uR).session,l=(0,u.M)(r.account$);return(0,i.jsx)("div",{className:"_1ap5wdp8",children:n.map(e=>(0,i.jsx)(aQ,{currentAccount:l,member:e,isOwner:t,onRevoke:s},e.id))})},aQ=({member:e,isOwner:t,currentAccount:a,onRevoke:s})=>{let n=(0,k.s9)(),r=(0,C.useCallback)(()=>{s(e.id)},[s,e.id]),l=(0,C.useMemo)(()=>({show:t&&a.id!==e.id,leaveOrRevokeText:n["Remove from workspace"]()}),[a.id,t,e.id,n]);return(0,i.jsxs)("div",{className:"_1ap5wdp9","data-testid":"member-item",children:[(0,i.jsx)(ee.e,{size:36,url:e.avatarUrl,name:e.name?e.name:e.email}),(0,i.jsx)("div",{className:"_1ap5wdpa",children:e.name?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)("div",{className:aZ,children:e.name}),(0,i.jsx)("div",{className:"_1ap5wdpd",children:e.email})]}):(0,i.jsx)("div",{className:aZ,children:e.email})}),(0,i.jsx)("div",{className:(0,q.A)("_1ap5wdpb",{pending:!e.accepted}),children:e.accepted?e.permission===es.aX.Owner?"Workspace Owner":"Member":"Pending"}),(0,i.jsx)(eR.W1,{items:(0,i.jsx)(eR.Dr,{"data-member-id":e.id,onClick:r,children:l.leaveOrRevokeText}),children:(0,i.jsx)(et.K0,{disabled:!l.show,style:{visibility:l.show?"visible":"hidden",flexShrink:0},children:(0,i.jsx)(J.MoreVerticalIcon,{})})})]},e.id)},a1=()=>(0,d.h1)(m.j).workspace.flavour===o.j.LOCAL?(0,i.jsx)(aK,{}):(0,i.jsx)(aU.E,{children:(0,i.jsx)(C.Suspense,{fallback:(0,i.jsx)(aX,{}),children:(0,i.jsx)(aG,{})})});var a0=a(80943);let a2=()=>{let e=(0,k.s9)(),t=(0,d.h1)(m.j).workspace,a=(0,d.h1)(O.Q),s=(0,u.S)(a.permission.isOwner$);(0,C.useEffect)(()=>{a.permission.revalidate()},[a]);let n=u.S(t?.engine.rootDocState$)?.ready,[r,c]=(0,C.useState)("");(0,C.useEffect)(()=>{if(t?.docCollection){c(t.docCollection.meta.name??ag.EZ);let e=t.docCollection.meta.commonFieldsUpdated.on(()=>{c(t.docCollection.meta.name??ag.EZ)});return()=>{e.dispose()}}c(ag.EZ)},[t]);let o=(0,C.useCallback)(async e=>{if(t){if(!e){t.docCollection.meta.setAvatar("");return}try{let a=await (0,a0.f)(e),s=t.docCollection.blobSync,n=await s.set(a);t.docCollection.meta.setAvatar(n)}catch(e){throw console.error(e),e}}},[t]),p=(0,C.useCallback)(e=>{t&&t.docCollection.meta.setName(e)},[t]),[h,x]=(0,C.useState)("");(0,C.useEffect)(()=>{x(r)},[r]);let g=(0,C.useCallback)(t=>{p(t),l.me.success({title:e["Update workspace name success"]()})},[p,e]),j=(0,C.useCallback)(e=>{x(e)},[]),f=(0,C.useCallback)(e=>{"Enter"===e.code&&r!==h&&g(h)},[g,h,r]),y=(0,C.useCallback)(()=>{g(h)},[g,h]),v=(0,ea.A)(async()=>{await o(null)},[o]),b=(0,C.useCallback)(e=>{o(e).then(()=>{l.me.success({title:"Update workspace avatar success"})}).catch(e=>{l.me.error({title:"Update workspace avatar failed",message:e})})},[o]),w=n&&s;return(0,i.jsxs)("div",{className:"_1ap5wdp0",children:[(0,i.jsx)(en,{accept:"image/gif,image/jpeg,image/jpg,image/png,image/svg",fileChange:b,"data-testid":"upload-avatar",disabled:!s,children:(0,i.jsx)(aC.z,{meta:t.meta,size:56,name:r,rounded:8,colorfulFallback:!0,hoverIcon:s?(0,i.jsx)(J.CameraIcon,{}):void 0,onRemove:w?v:void 0,avatarTooltipOptions:w?{content:e["Click to replace photo"]()}:void 0,removeTooltipOptions:w?{content:e["Remove photo"]()}:void 0,"data-testid":"workspace-setting-avatar",removeButtonProps:{"data-testid":"workspace-setting-remove-avatar-button"}})}),(0,i.jsxs)(l.mO,{marginLeft:20,children:[(0,i.jsx)("div",{className:"_1ap5wdpf",children:e["Workspace Name"]()}),(0,i.jsxs)(l.Z6,{alignItems:"center",flexGrow:"1",children:[(0,i.jsx)(l.pd,{disabled:!n||!s,value:h,style:{width:280,height:32},"data-testid":"workspace-name-input",placeholder:e["Workspace Name"](),maxLength:64,minLength:0,onChange:j,onKeyUp:f}),h===r?null:(0,i.jsx)(et.$n,{"data-testid":"save-workspace-name",onClick:y,style:{marginLeft:"12px"},children:e["com.arms.editCollection.save"]()})]})]})]})},a7=({workspaceMetadata:e})=>{let t=(0,k.s9)(),a=(0,aM.h)(e),s=(0,ax.R)(e),n=(0,C.useCallback)(()=>{a?.engine.doc.resetSyncStatus().then(()=>{window.location.reload()}).catch(e=>{console.error(e)})},[a]);return a?(0,i.jsxs)(d.xc,{scope:a.scope,children:[(0,i.jsx)(D,{title:t["Workspace Settings with name"]({name:s?.name??ag.EZ}),subtitle:t["com.arms.settings.workspace.description"]()}),(0,i.jsx)(W,{title:t.Info(),children:(0,i.jsxs)(U,{name:t["Workspace Profile"](),desc:t["com.arms.settings.workspace.not-owner"](),spreadCol:!1,children:[(0,i.jsx)(a2,{}),(0,i.jsx)(aq,{})]})}),(0,i.jsxs)(W,{title:t["com.arms.brand.affineCloud"](),children:[(0,i.jsx)(aB,{}),(0,i.jsx)(a1,{})]}),environment.isDesktop&&(0,i.jsx)(W,{title:t["Storage and Export"](),children:(0,i.jsx)(aV,{workspace:a,workspaceMetadata:e})}),(0,i.jsxs)(W,{children:[(0,i.jsx)(aO,{}),(0,i.jsx)(U,{name:(0,i.jsx)("span",{style:{color:"var(--affine-text-secondary-color)"},children:t["com.arms.resetSyncStatus.button"]()}),desc:t["com.arms.resetSyncStatus.description"](),style:{cursor:"pointer"},onClick:n,"data-testid":"reset-sync-status",children:(0,i.jsx)(J.ArrowRightSmallIcon,{})})]})]}):null};var a3=a(67301),a4=a(78059),a6=a(20880),a8=a(65002),a5="jgw419a";let a9=(0,C.createContext)(),se=()=>{let e=(0,a3.o)();return(0,C.useMemo)(()=>new a4.hW(e),[e])},st=()=>(0,i.jsx)("div",{className:"jgw4197"}),sa=({property:e})=>{let t=(0,k.s9)(),a=(0,C.useContext)(a9),[s,n]=(0,C.useState)(()=>({...e}));(0,C.useEffect)(()=>{n(e)},[e]);let r=(0,C.useCallback)(()=>{a.updatePropertyMeta(s.id,{required:!s.required})},[a,s.id,s.required]),c=(0,C.useCallback)(()=>{a.removePropertyMeta(s.id)},[a,s.id]),[o,d]=(0,C.useState)(!1),[m,u]=(0,C.useState)(!1),[p,h]=(0,C.useState)(!1),x=(0,C.useCallback)(()=>{d(!1),u(!1),a.updatePropertyMeta(s.id,s)},[s,a]),g=(0,C.useMemo)(()=>{let e=[];return e.push({text:t["com.arms.settings.workspace.properties.set-as-required"](),onClick:r,checked:s.required}),e.push("-"),e.push({text:t["com.arms.settings.workspace.properties.edit-property"](),onClick:e=>{e.preventDefault(),u(!0)}}),e.push({text:t["com.arms.settings.workspace.properties.delete-property"](),onClick:()=>h(!0),type:"danger",icon:(0,i.jsx)(J.DeleteIcon,{})}),(0,a8.DP)(e)},[r,s.required,t]),j=(0,C.useCallback)(e=>{a.updatePropertyMeta(s.id,{name:e})},[a,s.id]),f=(0,C.useCallback)(e=>{n(t=>({...t,name:e}))},[]),y=(0,C.useCallback)(e=>{n(t=>({...t,icon:e})),a.updatePropertyMeta(s.id,{icon:e})},[s.id,a]),v=(0,C.useMemo)(()=>{let e=[];return e.push((0,i.jsx)(a8.hf,{property:s,onIconChange:y,onNameBlur:j,onNameChange:f})),e.push((0,i.jsx)(a8.mM,{property:s})),e.push("-"),e.push({text:t["com.arms.settings.workspace.properties.delete-property"](),onClick:c,type:"danger",icon:(0,i.jsx)(J.DeleteIcon,{})}),(0,a8.DP)(e)},[c,y,j,f,s,t]);return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(l.W1,{rootOptions:{open:o,onOpenChange:x},items:m?v:g,children:(0,i.jsx)(l.K0,{onClick:()=>d(!0),size:"20",children:(0,i.jsx)(J.MoreHorizontalIcon,{})})}),(0,i.jsx)(a6.K,{onConfirm:()=>{h(!1),c()},onCancel:()=>h(!1),show:p,property:e})]})},ss=({property:e,relatedPages:t})=>{let a=(0,a4.U)(e.icon,e.type),s=e.required,n=(0,k.s9)();return(0,i.jsxs)("div",{className:"jgw4192","data-property-id":e.id,"data-testid":"custom-property-row",children:[(0,i.jsx)(a,{className:"jgw4194"}),(0,i.jsx)("div",{"data-unnamed":!e.name,className:"jgw4195",children:e.name||n.unnamed()}),t.length>0?(0,i.jsxs)("div",{className:"jgw4196",children:["·"," ",(0,i.jsxs)(k.x6,{i18nKey:t.length>1?"com.arms.settings.workspace.properties.doc_others":"com.arms.settings.workspace.properties.doc",count:t.length,children:[(0,i.jsx)("span",{children:{count:t.length}})," doc"]})]}):null,(0,i.jsx)("div",{className:"jgw4198"}),s?(0,i.jsx)("div",{className:"jgw4199",children:n["com.arms.page-properties.property.required"]()}):null,(0,i.jsx)(sa,{property:e})]})},sn=({properties:e,statistics:t})=>(0,i.jsx)("div",{className:"jgw4193",children:e.map(e=>{let a=[...t.get(e.id)??[]];return(0,i.jsxs)(C.Fragment,{children:[(0,i.jsx)(ss,{property:e,relatedPages:a}),(0,i.jsx)(st,{})]},e.id)})}),sr=({filterMode:e})=>{let t=(0,C.useContext)(a9),a=t.getOrderedPropertiesSchema(),s=t.getPropertyStatistics(),n=(0,k.s9)();if("all"!==e){let t=a.filter(t=>{let a=s.get(t.id)?.size??0;return"in-use"===e?a>0:0===a});return(0,i.jsx)(sn,{properties:t,statistics:s})}{let e=a.filter(e=>e.required),t=a.filter(e=>!e.required);return(0,i.jsxs)(i.Fragment,{children:[e.length>0?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)("div",{className:a5,children:n["com.arms.settings.workspace.properties.required-properties"]()}),(0,i.jsx)(sn,{properties:e,statistics:s})]}):null,t.length>0?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)("div",{className:a5,children:n["com.arms.settings.workspace.properties.general-properties"]()}),(0,i.jsx)(sn,{properties:t,statistics:s})]}):null]})}},si=()=>{let e=(0,k.s9)(),t=(0,C.useContext)(a9),[a,s]=(0,C.useState)("all"),n=t.getOrderedPropertiesSchema(),r=(0,C.useMemo)(()=>{let t=["all","-","in-use","unused"].map(t=>"-"===t?"-":{text:e[`com.arms.settings.workspace.properties.${t}`](),onClick:()=>s(t),checked:a===t});return(0,a8.DP)(t)},[a,e]),c=(0,C.useCallback)((e,t)=>{setTimeout(()=>{let e=document.querySelector(`[data-testid="custom-property-row"][data-property-id="${t}"]`);e&&(e.scrollIntoView({behavior:"smooth"}),e.dataset.highlight="",setTimeout(()=>{delete e.dataset.highlight},3e3))})},[]);return(0,i.jsxs)("div",{className:"jgw4190",children:[(0,i.jsxs)("div",{className:"jgw4191",children:[n.length>0?(0,i.jsx)(l.W1,{items:r,children:(0,i.jsx)(l.$n,{prefix:(0,i.jsx)(J.FilterIcon,{}),children:"all"===a?e["com.arms.filter"]():e[`com.arms.settings.workspace.properties.${a}`]()})}):null,(0,i.jsx)(l.W1,{items:(0,i.jsx)(a4.fq,{onCreated:c,metaManager:t}),children:(0,i.jsx)(l.$n,{variant:"primary",children:e["com.arms.settings.workspace.properties.add_property"]()})})]}),(0,i.jsx)(sr,{filterMode:a})]})},sl=()=>{let e=se();return(0,i.jsx)(a9.Provider,{value:e,children:(0,i.jsx)(si,{})})},sc=({workspaceMetadata:e})=>{let t=(0,k.s9)(),a=(0,aM.h)(e),s=(0,ax.R)(e),n=s?.name||"untitled";return null===a?null:(0,i.jsxs)(d.xc,{scope:a.scope,children:[(0,i.jsx)(D,{title:t["com.arms.settings.workspace.properties.header.title"](),subtitle:(0,i.jsxs)(k.x6,{values:{name:n},i18nKey:"com.arms.settings.workspace.properties.header.subtitle",children:["Manage workspace ",(0,i.jsx)("strong",{children:"name"})," properties"]})}),(0,i.jsx)(sl,{})]})},so=({workspaceMetadata:e,subTab:t})=>{switch(t){case"preference":return(0,i.jsx)(a7,{workspaceMetadata:e});case"properties":return(0,i.jsx)(sc,{workspaceMetadata:e})}},sd=e=>aL.includes(e),sm=()=>(0,i.jsx)("div",{className:"_1hbyecy7",children:(0,i.jsx)(l.Rh,{size:24})}),su=({activeTab:e="appearance",workspaceMetadata:t=null,onSettingClick:a,...s})=>{let n=(0,u.S)((0,d.h1)(S.uR).session.status$),r=(0,C.useRef)(null),c=(0,C.useRef)(null),o=(0,h.Xr)(eb);(0,C.useLayoutEffect)(()=>{let e;if(!s.open)return;let t=(0,Q.A)(()=>{cancelAnimationFrame(e),e=requestAnimationFrame(()=>{if(!r.current||!c.current)return;let e=c.current.offsetWidth,t=c.current.offsetHeight,a=r.current.offsetWidth,s=c.current;s?.style.setProperty("--setting-modal-width",`${e}px`),s?.style.setProperty("--setting-modal-height",`${t}px`),s?.style.setProperty("--setting-modal-content-width",`${a}px`),s?.style.setProperty("--setting-modal-gap-x",`${(e-a)/2}px`)})},200);return window.addEventListener("resize",t),t(),()=>{cancelAnimationFrame(e),window.removeEventListener("resize",t)}},[s.open]),(0,C.useEffect)(()=>(o(c.current),()=>{o(null)}),[o]);let m=(0,C.useCallback)((e,t)=>{a({activeTab:e,workspaceMetadata:t})},[a]),p=(0,h.Xr)(x.tc),g=(0,h.Xr)(x.SH),j=(0,C.useCallback)(()=>{p(!0)},[p]),f=(0,C.useCallback)(()=>{g(!0)},[g]);return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(aS,{activeTab:e,onTabChange:m,selectedWorkspaceId:t?.id??null}),(0,i.jsx)(l.yE.Root,{children:(0,i.jsxs)(l.yE.Viewport,{"data-testid":"setting-modal-content",className:"_1hbyecy0",ref:c,children:[(0,i.jsxs)("div",{ref:r,className:"_1hbyecy1",children:[(0,i.jsx)("div",{className:"_1hbyecy2",children:(0,i.jsxs)(C.Suspense,{fallback:(0,i.jsx)(K,{}),children:[e.startsWith("workspace:")&&t?(0,i.jsx)(so,{subTab:e.split(":")[1],workspaceMetadata:t},t.id):null,sd(e)?(0,i.jsx)(ah,{generalKey:e}):null,"account"===e&&"authenticated"===n?(0,i.jsx)(ev,{}):null]})}),(0,i.jsxs)("div",{className:"_1hbyecy5",children:[(0,i.jsx)(J.ContactWithUsIcon,{fontSize:16}),(0,i.jsx)(k.x6,{i18nKey:"com.arms.settings.suggestion-2",components:{1:(0,i.jsx)("span",{className:aA,onClick:f}),2:(0,i.jsx)("span",{className:aA,onClick:j})}})]})]}),(0,i.jsx)(l.yE.Scrollbar,{})]})})]})},sp=({activeTab:e="appearance",workspaceMetadata:t=null,onSettingClick:a,...s})=>(0,i.jsx)(f.aF,{width:1280,height:920,contentOptions:{"data-testid":"setting-modal",style:{maxHeight:"85vh",maxWidth:"70vw",padding:0,overflow:"hidden",display:"flex"}},...s,children:(0,i.jsx)(C.Suspense,{fallback:(0,i.jsx)(sm,{}),children:(0,i.jsx)(su,{activeTab:e,workspaceMetadata:t,onSettingClick:a,...s})})});var sh=a(93813);let sC=()=>{let e=(0,k.s9)(),[t,a]=(0,h.fp)(x.SH);return(0,i.jsx)(l.of,{open:t,topImage:(0,i.jsx)("video",{width:400,height:300,style:{objectFit:"cover"},src:"/static/githubStar.mp4",autoPlay:!0,loop:!0}),title:e["com.arms.star-affine.title"](),onOpenChange:a,description:e["com.arms.star-affine.description"](),cancelText:e["com.arms.star-affine.cancel"](),to:"https://github.com/toeverything/AFFiNE",confirmButtonOptions:{variant:"primary"},confirmText:e["com.arms.star-affine.confirm"](),external:!0})};var sx=a(77562),sg=a(80696),sj=a(17660),sf=a(50822),sy=a(85651),sv=a(74255),sb="_17rc1nd";let sk=(e,t,a)=>{let s=e.getContext("2d");if(!s)return;let n=window.devicePixelRatio||1;e.width=e.getBoundingClientRect().width*n,e.height=e.getBoundingClientRect().height*n;let r=getComputedStyle(document.documentElement).getPropertyValue("--affine-text-primary-color").trim();s.scale(n,n),s.clearRect(0,0,e.width,e.height),s.fillStyle=r,s.font="15px Inter",s.fillText(t,-a,22),s.textAlign="left",s.textBaseline="middle"},sw=({text:e,scrollLeft:t,className:a})=>{let s=(0,C.useRef)(null);return(0,C.useEffect)(()=>{let a=s.current;if(a)return sk(a,e,t),(0,l.vy)(a,()=>sk(a,e,t))},[e,t]),(0,i.jsx)("canvas",{className:a,ref:s})},sS=()=>{let[e,t]=(0,C.useState)(""),a=(0,d.h1)(sv.H).findInPage,s=(0,u.S)(a.visible$),n=(0,u.S)(a.result$),r=(0,u.S)(a.isSearching$),c=(0,C.useRef)(null),[o,m]=(0,C.useState)(!1),[p,h]=(0,C.useState)(0),[x,g]=(0,C.useState)(!1),[{status:j},f]=(0,sy.p)({timeout:120});(0,C.useEffect)(()=>{f(s)},[s]);let y=(0,C.useCallback)(e=>{let s=e.target.value;t(s),x||a.findInPage(s),0===s.length&&a.clear(),c.current?.focus()},[x,a]),v=(0,C.useCallback)(()=>{m(!0)},[]),b=(0,C.useCallback)(()=>{m(!1)},[]);(0,C.useEffect)(()=>{if(s){t(a.searchText$.value||"");let e=e=>{"Escape"===e.key&&a.onChangeVisible(!1)};return window.addEventListener("keydown",e),()=>{window.removeEventListener("keydown",e)}}return()=>{}},[a,a.searchText$.value,s]),(0,C.useEffect)(()=>{let e=a.isSearching$.subscribe(()=>{c.current?.focus(),setTimeout(()=>{c.current?.focus()})});return()=>{e.unsubscribe()}},[a.isSearching$]);let k=(0,C.useCallback)(()=>{a.backward()},[a]),w=(0,C.useCallback)(()=>{a.forward()},[a]),S=(0,C.useCallback)(e=>{e||a.clear(),a.onChangeVisible(e)},[a]),N=(0,C.useCallback)(()=>{S(!1)},[S]),_=(0,C.useCallback)(e=>{("Enter"===e.key||"ArrowDown"===e.key)&&w(),"ArrowUp"===e.key&&k()},[k,w]),$=(0,C.useCallback)(e=>{h(e.currentTarget.scrollLeft)},[]),A=(0,C.useCallback)(()=>{g(!0)},[]),L=(0,C.useCallback)(e=>{g(!1),a.findInPage(e.currentTarget.value)},[a]);return(0,i.jsx)(eY.bL,{open:"exited"!==j,children:(0,i.jsxs)(eY.ZL,{children:[(0,i.jsx)(eY.hJ,{className:"_17rc1n3"}),(0,i.jsx)("div",{className:"_17rc1n4",children:(0,i.jsxs)(eY.UC,{style:(0,sf.D)({"var(--_17rc1n0)":"120ms"}),className:"_17rc1n5","data-state":j,children:[(0,i.jsxs)("div",{className:(0,q.A)("_17rc1n8",{active:o||r}),children:[(0,i.jsx)(J.SearchIcon,{className:"_17rc1n7"}),(0,i.jsxs)("div",{className:"_17rc1n9",children:[(0,i.jsx)("input",{type:"text",autoFocus:!0,value:e,ref:c,style:{visibility:r?"hidden":"visible"},onBlur:b,onFocus:v,className:"_17rc1na",onKeyDown:_,onChange:y,onScroll:$,onCompositionStart:A,onCompositionEnd:L}),(0,i.jsx)(sw,{className:"_17rc1nb _17rc1na",text:e,scrollLeft:p})]}),(0,i.jsx)("div",{className:"_17rc1nc",children:e.length>0&&n&&0!==n.matches?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)("span",{children:n?.activeMatchOrdinal||0}),(0,i.jsx)("span",{children:"/"}),(0,i.jsx)("span",{children:n?.matches||0})]}):e.length?(0,i.jsx)("span",{children:"No matches"}):null})]}),(0,i.jsxs)("div",{children:[(0,i.jsx)(l.K0,{size:"24",className:(0,q.A)(sb,"backward"),onClick:k,icon:(0,i.jsx)(J.ArrowUpSmallIcon,{})}),(0,i.jsx)(l.K0,{size:"24",className:(0,q.A)(sb,"forward"),onClick:w,icon:(0,i.jsx)(J.ArrowDownSmallIcon,{})})]}),(0,i.jsx)(l.K0,{onClick:N,icon:(0,i.jsx)(J.CloseIcon,{})})]})})]})})};var sN=a(64161);let s_=()=>{let[{open:e,workspaceMetadata:t,activeTab:a},s]=(0,h.fp)(x.JO),n=(0,C.useCallback)(({activeTab:e,workspaceMetadata:t})=>{s(a=>({...a,activeTab:e,workspaceMetadata:t}))},[s]),r=(0,C.useCallback)(e=>{s(t=>({...t,open:e}))},[s]);return((0,C.useEffect)(()=>{if(environment.isDesktop)return c.AZ?.applicationMenu.openAboutPageInSettingModal(()=>s({activeTab:"about",open:!0}))},[s]),e)?(0,i.jsx)(sp,{open:e,activeTab:a,workspaceMetadata:t,onSettingClick:n,onOpenChange:r}):null},s$=()=>{let[{openModal:e,state:t,email:a="",emailType:s="changePassword"},n]=(0,h.fp)(x.W7);return(0,i.jsx)(g.U,{open:e,state:t,email:a,emailType:s,setEmailType:(0,C.useCallback)(e=>{n(t=>({...t,emailType:e}))},[n]),setOpen:(0,C.useCallback)(e=>{n(t=>({...t,openModal:e}))},[n]),setAuthState:(0,C.useCallback)(e=>{n(t=>({...t,state:e}))},[n]),setAuthEmail:(0,C.useCallback)(e=>{n(t=>({...t,email:e}))},[n])})};function sA(){let e=(0,d.h1)(m.j).workspace,{trashModal:t,setTrashModal:a,handleOnConfirm:s}=(0,sg.T)(e.docCollection),n=t.pageTitles,r=t.open,l=(0,C.useCallback)(e=>{a({...t,open:e})},[t,a]);return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(sC,{}),(0,i.jsx)(I,{}),e?(0,i.jsx)(s_,{}):null,e?.flavour===o.j.LOCAL&&(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(H,{}),(0,i.jsx)(P,{})]}),e?.flavour===o.j.AFFINE_CLOUD&&(0,i.jsx)(Z,{}),(0,i.jsx)(j.I,{}),(0,i.jsx)(sN.hv,{}),environment.isDesktop&&(0,i.jsx)(sS,{}),(0,i.jsx)(sx.fB.ConfirmModal,{open:r,onConfirm:s,onOpenChange:l,titles:n})]})}let sL=()=>{let{openPage:e}=(0,aE.P)(),t=(0,d.h1)(sj.uR),[a,s]=(0,h.fp)(x.G4),n=d.Dq(m.j)?.workspace,r=(0,u.S)((0,d.h1)(p.q).list.workspaces$),c=(0,y.V)(async()=>{s(!1);try{await t.signOut()}catch(e){console.error(e),l.me.error({title:"Failed to sign out"})}if(n?.flavour===o.j.AFFINE_CLOUD){let t=r.find(e=>e.flavour===o.j.LOCAL);t&&e(t.id,aR.Tk.ALL)}},[t,n,e,s,r]);return(0,i.jsx)(sh.$,{open:a,onOpenChange:s,onConfirm:c})},sM=()=>{let[e,t]=(0,h.fp)(x.qj),{jumpToSubPath:a,jumpToPage:s}=(0,aE.P)();return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(M,{mode:e,onClose:(0,C.useCallback)(()=>{t(!1)},[t]),onCreate:(0,C.useCallback)((e,n)=>{t(!1),setTimeout(()=>{n?s(e,n):a(e,aR.Tk.ALL)})},[s,a,t])}),(0,i.jsx)(s$,{}),(0,i.jsx)(sL,{})]})}}}]);
//# sourceMappingURL=chunk.1389.11e633c3.js.map