@adonis-agora/authkit-server 0.73.0 → 0.74.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. package/README.md +4 -0
  2. package/build/commands/clients_create.d.ts +2 -0
  3. package/build/commands/clients_create.js +41 -13
  4. package/build/commands/commands.json +7 -0
  5. package/build/index.d.ts +6 -0
  6. package/build/index.js +7 -0
  7. package/build/src/commands/import_clients.js +2 -0
  8. package/build/src/host/access_token_verifier.d.ts +100 -0
  9. package/build/src/host/access_token_verifier.js +240 -0
  10. package/build/src/host/admin_api/api_clients_controller.d.ts +4 -1
  11. package/build/src/host/admin_api/api_clients_controller.js +25 -2
  12. package/build/src/host/admin_api/dto.d.ts +1 -0
  13. package/build/src/host/admin_api/dto.js +1 -0
  14. package/build/src/host/admin_clients_service.d.ts +9 -0
  15. package/build/src/host/admin_clients_service.js +21 -0
  16. package/build/src/host/admin_console/console_clients_controller.d.ts +3 -1
  17. package/build/src/host/admin_console/console_clients_controller.js +25 -2
  18. package/build/src/host/admin_validators.d.ts +11 -1
  19. package/build/src/host/admin_validators.js +36 -8
  20. package/build/src/host/bearer_account.d.ts +9 -0
  21. package/build/src/host/bearer_account.js +28 -0
  22. package/build/src/host/client_metadata.d.ts +51 -0
  23. package/build/src/host/client_metadata.js +98 -0
  24. package/build/src/host/console_session.d.ts +14 -3
  25. package/build/src/host/console_session.js +21 -9
  26. package/build/src/host/oidc_bearer_guard.d.ts +113 -0
  27. package/build/src/host/oidc_bearer_guard.js +223 -0
  28. package/build/src/host/oidc_rp_guard.d.ts +3 -1
  29. package/build/src/host/oidc_rp_guard.js +6 -2
  30. package/build/src/host/ui-dist/assets/{index-Dct63ai-.js → index-CIqtoNcO.js} +1 -1
  31. package/build/src/host/ui-dist/index.html +1 -1
  32. package/build/src/provider/build_provider.js +42 -17
  33. package/build/src/provider/oidc_service.d.ts +8 -0
  34. package/build/src/provider/oidc_service.js +11 -1
  35. package/package.json +3 -3
@@ -100,7 +100,7 @@ Error generating stack: `+e.message+`
100
100
  0% { background-position: 200% 0; }
101
101
  100% { background-position: -200% 0; }
102
102
  }
103
- `,document.head.appendChild(t)}}function xl({lines:e=3,lastWidth:t=`60%`}){return(0,b.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:8},children:Array.from({length:e}).map((n,r)=>(0,b.jsx)(bl,{width:r===e-1?t:`100%`,height:13},r))})}function Sl(){return(0,b.jsxs)(`div`,{style:{background:`var(--bg2)`,border:`1px solid var(--line)`,borderRadius:`var(--radius)`,padding:`14px 16px`,display:`flex`,flexDirection:`column`,gap:8},children:[(0,b.jsx)(bl,{width:80,height:11}),(0,b.jsx)(bl,{width:60,height:28,borderRadius:8}),(0,b.jsx)(bl,{width:100,height:11})]})}function Cl({count:e=6,columns:t=3}){return(0,b.jsx)(`div`,{style:{display:`grid`,gridTemplateColumns:`repeat(${t}, 1fr)`,gap:12},children:Array.from({length:e}).map((e,t)=>(0,b.jsx)(Sl,{},t))})}function wl({rows:e=5,cols:t=4}){return(0,b.jsxs)(`div`,{style:{padding:`0 0 8px`},children:[(0,b.jsx)(`div`,{style:{display:`grid`,gridTemplateColumns:`repeat(${t}, 1fr)`,gap:12,padding:`10px 16px`,borderBottom:`1px solid var(--line)`},children:Array.from({length:t}).map((e,t)=>(0,b.jsx)(bl,{height:11,width:`50%`},t))}),Array.from({length:e}).map((e,n)=>(0,b.jsx)(`div`,{style:{display:`grid`,gridTemplateColumns:`repeat(${t}, 1fr)`,gap:12,padding:`12px 16px`,borderBottom:`1px solid var(--line)`},children:Array.from({length:t}).map((e,n)=>(0,b.jsx)(bl,{height:13,width:n===0?`80%`:n===t-1?`40%`:`65%`},n))},n))]})}function Tl({rows:e=5,cols:t=4}){return(0,b.jsxs)(`div`,{style:{background:`var(--bg2)`,border:`1px solid var(--line)`,borderRadius:`var(--radius)`,overflow:`hidden`},children:[(0,b.jsx)(`div`,{style:{padding:`12px 16px`,borderBottom:`1px solid var(--line)`},children:(0,b.jsx)(bl,{width:200,height:13})}),(0,b.jsx)(wl,{rows:e,cols:t})]})}function El(){return(0,b.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:20},children:[(0,b.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:12},children:[(0,b.jsx)(bl,{width:44,height:44,borderRadius:`50%`}),(0,b.jsxs)(`div`,{style:{flex:1,display:`flex`,flexDirection:`column`,gap:6},children:[(0,b.jsx)(bl,{width:`60%`,height:14}),(0,b.jsx)(bl,{width:`40%`,height:11})]})]}),(0,b.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:8},children:[(0,b.jsx)(bl,{width:80,height:10}),(0,b.jsx)(bl,{height:32,borderRadius:8})]}),(0,b.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:8},children:[(0,b.jsx)(bl,{width:80,height:10}),(0,b.jsx)(xl,{lines:3,lastWidth:`50%`})]})]})}function Dl(e){return e.includes(`login`)||e.includes(`signin`)||e.includes(`success`)?`badge-green`:e.includes(`fail`)||e.includes(`error`)||e.includes(`locked`)||e.includes(`block`)?`badge-red`:e.includes(`register`)||e.includes(`signup`)||e.includes(`created`)?`badge-accent`:e.includes(`settings`)||e.includes(`admin`)||e.includes(`updated`)?`badge-amber`:`badge-muted`}var Ol=30;function kl({typeFilter:e,page:t,onPage:n,selected:r,onSelect:i,onUnavailable:a}){let[o,s]=(0,f.useState)(!1),{data:c,isLoading:l,error:u,refetch:d}=z({...Vs({type:e||void 0,page:t,size:Ol}),retry:(e,t)=>t&&typeof t==`object`&&`status`in t&&t.status===404?(o||(s(!0),a()),!1):e<1}),p=c?.data??[],m=c?.meta.total??0,h=u&&typeof u==`object`&&`status`in u&&u.status===404;return(0,b.jsx)(`div`,{className:`panel`,children:(0,b.jsx)(vl,{isLoading:l,error:u&&!h?u:void 0,onRetry:d,skeleton:(0,b.jsx)(Tl,{rows:8,cols:4}),children:p.length===0?(0,b.jsxs)(`div`,{className:`empty-state`,children:[(0,b.jsx)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,children:(0,b.jsx)(`path`,{d:`M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2`,strokeLinecap:`round`})}),(0,b.jsx)(`h4`,{children:`No events found`}),(0,b.jsx)(`p`,{children:e?`No events match this filter`:`No audit events recorded yet`})]}):(0,b.jsxs)(`div`,{className:`tbl-wrap`,children:[(0,b.jsxs)(`table`,{children:[(0,b.jsx)(`thead`,{children:(0,b.jsxs)(`tr`,{children:[(0,b.jsx)(`th`,{children:`Type`}),(0,b.jsx)(`th`,{children:`Account`}),(0,b.jsx)(`th`,{children:`IP`}),(0,b.jsx)(`th`,{children:`When`})]})}),(0,b.jsx)(`tbody`,{children:p.map(e=>(0,b.jsxs)(`tr`,{onClick:()=>i(r?.id===e.id?null:e),children:[(0,b.jsx)(`td`,{children:(0,b.jsx)(`span`,{className:`badge ${Dl(e.type)}`,children:e.type})}),(0,b.jsx)(`td`,{children:(0,b.jsx)(`span`,{style:{fontFamily:`var(--mono)`,fontSize:11.5},children:e.email??e.accountId??(0,b.jsx)(`span`,{style:{color:`var(--faint)`},children:`—`})})}),(0,b.jsx)(`td`,{children:(0,b.jsx)(`span`,{className:`code`,children:e.ip??`—`})}),(0,b.jsx)(`td`,{children:(0,b.jsx)(`span`,{style:{fontFamily:`var(--mono)`,fontSize:11,color:`var(--faint)`},children:e.createdAt?new Date(e.createdAt).toLocaleString():`—`})})]},e.id))})]}),(0,b.jsx)(`div`,{style:{padding:`0 16px 12px`},children:(0,b.jsx)(fl,{page:t,total:m,size:Ol,onPage:n})})]})})})}function Al({event:e,onClose:t}){return(0,b.jsxs)(`div`,{className:`panel`,style:{padding:`14px 16px`},children:[(0,b.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,alignItems:`center`,marginBottom:10},children:[(0,b.jsx)(`div`,{style:{fontWeight:600,fontSize:13},children:`Event Detail`}),(0,b.jsx)(`button`,{className:`btn btn-ghost btn-sm`,onClick:t,children:(0,b.jsx)(`svg`,{viewBox:`0 0 16 16`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,children:(0,b.jsx)(`path`,{d:`M3 3l10 10M13 3L3 13`,strokeLinecap:`round`})})})]}),(0,b.jsx)(`pre`,{style:{fontFamily:`var(--mono)`,fontSize:11.5,color:`var(--muted)`,overflow:`auto`,lineHeight:1.6},children:JSON.stringify(e,null,2)})]})}var jl=[``,`login.success`,`login.failed`,`login.mfa_required`,`logout`,`register`,`password_reset`,`settings.updated`,`client.created`,`client.deleted`,`account.disabled`,`account.enabled`];function Ml(){let[e,t]=rl(`page`,qc.withDefault(1)),[n,r]=rl(`type`,Kc.withDefault(``)),[i,a]=(0,f.useState)(null),[o,s]=(0,f.useState)(!1);return o?(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`div`,{className:`page-title`,style:{marginBottom:8},children:`Audit Log`}),(0,b.jsx)(`div`,{className:`error-box`,children:`Audit log is not configured. Add an audit sink to your AuthKit config.`})]}):(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`div`,{className:`page-header-row`,children:(0,b.jsx)(`div`,{children:(0,b.jsx)(`div`,{className:`page-title`,children:`Audit Log`})})}),(0,b.jsx)(`div`,{className:`panel`,style:{marginBottom:0},children:(0,b.jsx)(`div`,{className:`panel-head`,children:(0,b.jsx)(`select`,{className:`input`,style:{width:240},value:n,onChange:e=>{r(e.target.value),t(1)},children:jl.map(e=>(0,b.jsx)(`option`,{value:e,children:e||`All event types`},e))})})}),(0,b.jsx)(kl,{typeFilter:n,page:e,onPage:t,selected:i,onSelect:a,onUnavailable:()=>s(!0)}),i&&(0,b.jsx)(`div`,{style:{marginTop:12},children:(0,b.jsx)(Al,{event:i,onClose:()=>a(null)})})]})}function Nl({open:e,onClose:t,title:n,children:r,footer:i,large:a}){return(0,f.useEffect)(()=>{if(!e)return;let n=e=>{e.key===`Escape`&&t()};return window.addEventListener(`keydown`,n),()=>window.removeEventListener(`keydown`,n)},[e,t]),e?(0,b.jsx)(`div`,{className:`modal-overlay`,onClick:t,children:(0,b.jsxs)(`div`,{className:`modal${a?` modal-lg`:``}`,onClick:e=>e.stopPropagation(),children:[(0,b.jsxs)(`div`,{className:`modal-head`,children:[(0,b.jsx)(`h2`,{children:n}),(0,b.jsx)(`button`,{className:`modal-close`,onClick:t,children:(0,b.jsx)(`svg`,{viewBox:`0 0 16 16`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,children:(0,b.jsx)(`path`,{d:`M3 3l10 10M13 3L3 13`,strokeLinecap:`round`})})})]}),(0,b.jsx)(`div`,{className:`modal-body`,children:r}),i&&(0,b.jsx)(`div`,{className:`modal-foot`,children:i})]})}):null}function Pl(){return(0,b.jsxs)(`div`,{style:{background:`var(--bg2)`,border:`1px solid var(--line)`,borderRadius:`var(--radius)`,padding:`14px 16px`,display:`flex`,flexDirection:`column`,gap:8},children:[(0,b.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8},children:[(0,b.jsx)(bl,{width:`30%`,height:13}),(0,b.jsx)(bl,{width:60,height:18,borderRadius:20})]}),(0,b.jsxs)(`div`,{style:{display:`flex`,gap:6},children:[(0,b.jsx)(bl,{width:100,height:18,borderRadius:20}),(0,b.jsx)(bl,{width:80,height:18,borderRadius:20})]}),(0,b.jsx)(bl,{width:`50%`,height:11})]})}function Fl(){return(0,b.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:10},children:[1,2,3].map(e=>(0,b.jsx)(Pl,{},e))})}function Il({onEdit:e,onDelete:t,onRegenerate:n}){let{data:r,isLoading:i,error:a,refetch:o}=z(Es()),s=r?.data??[],c=r?.canList??!0;return(0,b.jsx)(vl,{isLoading:i,error:a,onRetry:o,skeleton:(0,b.jsx)(Fl,{}),children:c?s.length===0?(0,b.jsxs)(`div`,{className:`empty-state`,children:[(0,b.jsxs)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,children:[(0,b.jsx)(`path`,{d:`M18 13l4-3.5L18 6`,strokeLinecap:`round`,strokeLinejoin:`round`}),(0,b.jsx)(`path`,{d:`M22 9.5H9M6 5H4a1 1 0 00-1 1v12a1 1 0 001 1h2`,strokeLinecap:`round`})]}),(0,b.jsx)(`h4`,{children:`No clients yet`}),(0,b.jsx)(`p`,{children:`Create an OAuth 2.0 / OIDC client to get started`})]}):(0,b.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:10},children:s.map(r=>(0,b.jsx)(`div`,{className:`panel`,style:{padding:`14px 16px`},children:(0,b.jsxs)(`div`,{style:{display:`flex`,alignItems:`flex-start`,gap:14},children:[(0,b.jsxs)(`div`,{style:{flex:1},children:[(0,b.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,marginBottom:6},children:[(0,b.jsx)(`span`,{style:{fontFamily:`var(--mono)`,fontWeight:600,fontSize:13,color:`var(--text)`},children:r.clientId}),(0,b.jsx)(`span`,{className:`badge ${r.confidential?`badge-accent`:`badge-muted`}`,children:r.confidential?`confidential`:`public`})]}),(0,b.jsx)(`div`,{style:{display:`flex`,flexWrap:`wrap`,gap:4,marginBottom:6},children:r.grants.map(e=>(0,b.jsx)(`span`,{className:`badge badge-muted`,children:e},e))}),r.redirectUris.length>0&&(0,b.jsx)(`div`,{style:{fontSize:11,color:`var(--faint)`,display:`flex`,flexWrap:`wrap`,gap:4},children:r.redirectUris.map(e=>(0,b.jsx)(`span`,{className:`code`,children:e},e))})]}),(0,b.jsxs)(`div`,{style:{display:`flex`,gap:6,flexShrink:0},children:[(0,b.jsx)(`button`,{className:`btn btn-sm`,onClick:()=>e(r),children:`Edit`}),(0,b.jsx)(`button`,{className:`btn btn-sm`,onClick:()=>n(r),title:`Regenerate secret`,children:(0,b.jsxs)(`svg`,{viewBox:`0 0 16 16`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.8`,children:[(0,b.jsx)(`path`,{d:`M2 8a6 6 0 016-6 6 6 0 014.24 1.76L14 5`,strokeLinecap:`round`}),(0,b.jsx)(`path`,{d:`M14 2v3h-3M14 8a6 6 0 01-6 6 6 6 0 01-4.24-1.76L2 11`,strokeLinecap:`round`}),(0,b.jsx)(`path`,{d:`M2 14v-3h3`,strokeLinecap:`round`})]})}),(0,b.jsx)(`button`,{className:`btn btn-sm btn-danger`,onClick:()=>t(r),children:(0,b.jsx)(`svg`,{viewBox:`0 0 16 16`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.8`,children:(0,b.jsx)(`path`,{d:`M2 4.5h12M5.5 4.5V3h5v1.5M10.5 4.5v8a1 1 0 01-1 1h-3a1 1 0 01-1-1v-8`,strokeLinecap:`round`})})})]})]})},r.clientId))}):(0,b.jsx)(`div`,{className:`error-box`,children:`Client store does not support listing (no dynamic registration adapter configured).`})})}function Ll(){let{data:e}=z(Es());return e?.data.length??0}var Rl=(0,f.createContext)(null);function zl({children:e}){let[t,n]=(0,f.useState)([]),r=(0,f.useCallback)((e,t)=>{let r=Math.random().toString(36).slice(2);n(n=>[...n,{id:r,type:e,message:t}]),setTimeout(()=>n(e=>e.filter(e=>e.id!==r)),4e3)},[]),i={show:r,success:e=>r(`success`,e),error:e=>r(`error`,e),info:e=>r(`info`,e)};return(0,b.jsxs)(Rl.Provider,{value:i,children:[e,(0,b.jsx)(`div`,{className:`toast-container`,children:t.map(e=>(0,b.jsxs)(`div`,{className:`toast toast-${e.type}`,children:[e.type===`success`&&(0,b.jsxs)(`svg`,{viewBox:`0 0 16 16`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.8`,children:[(0,b.jsx)(`circle`,{cx:`8`,cy:`8`,r:`6.5`}),(0,b.jsx)(`path`,{d:`M5 8l2.2 2.2L11 5.5`,strokeLinecap:`round`,strokeLinejoin:`round`})]}),e.type===`error`&&(0,b.jsxs)(`svg`,{viewBox:`0 0 16 16`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.8`,children:[(0,b.jsx)(`circle`,{cx:`8`,cy:`8`,r:`6.5`}),(0,b.jsx)(`path`,{d:`M6 6l4 4M10 6l-4 4`,strokeLinecap:`round`})]}),e.type===`info`&&(0,b.jsxs)(`svg`,{viewBox:`0 0 16 16`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.8`,children:[(0,b.jsx)(`circle`,{cx:`8`,cy:`8`,r:`6.5`}),(0,b.jsx)(`path`,{d:`M8 7v4M8 5.5v.5`,strokeLinecap:`round`})]}),(0,b.jsx)(`span`,{children:e.message})]},e.id))})]})}function q(){let e=(0,f.useContext)(Rl);if(!e)throw Error(`useToast outside ToastProvider`);return e}var J=[`authorization_code`,`refresh_token`,`client_credentials`,`implicit`],Bl=[`client_secret_basic`,`client_secret_post`,`none`];function Vl(){return{clientIdOverride:``,redirectUris:[],postLogoutRedirectUris:[],grantTypes:[`authorization_code`,`refresh_token`],tokenEndpointAuthMethod:`client_secret_basic`,backchannelLogoutUri:``,backchannelLogoutSessionRequired:!1}}function Hl(){let e=q(),t=S(),n=V(),r=Ll(),[i,a]=(0,f.useState)(!1),[o,s]=(0,f.useState)(null),[c,l]=(0,f.useState)(null),[u,d]=(0,f.useState)(Vl()),[p,m]=(0,f.useState)(``),[h,g]=(0,f.useState)(``),_=B(Ds()),v=B(Os(o?.clientId??``));function y(){d(Vl()),m(``),g(``),a(!0)}function x(e){d({clientIdOverride:``,redirectUris:[...e.redirectUris],postLogoutRedirectUris:[...e.postLogoutRedirectUris],grantTypes:[...e.grants],tokenEndpointAuthMethod:e.tokenEndpointAuthMethod,backchannelLogoutUri:e.backchannelLogoutUri??``,backchannelLogoutSessionRequired:e.backchannelLogoutSessionRequired}),m(``),g(``),s(e)}function C(e){let t=e===`redirect`?p.trim():h.trim();t&&(e===`redirect`?(d(e=>({...e,redirectUris:[...e.redirectUris,t]})),m(``)):(d(e=>({...e,postLogoutRedirectUris:[...e.postLogoutRedirectUris,t]})),g(``)))}function w(e,t){d(e===`redirect`?e=>({...e,redirectUris:e.redirectUris.filter((e,n)=>n!==t)}):e=>({...e,postLogoutRedirectUris:e.postLogoutRedirectUris.filter((e,n)=>n!==t)}))}function T(e){d(t=>({...t,grantTypes:t.grantTypes.includes(e)?t.grantTypes.filter(t=>t!==e):[...t.grantTypes,e]}))}async function E(n){n.preventDefault();try{let n={clientId:u.clientIdOverride||void 0,redirectUris:u.redirectUris,postLogoutRedirectUris:u.postLogoutRedirectUris,grantTypes:u.grantTypes,tokenEndpointAuthMethod:u.tokenEndpointAuthMethod,backchannelLogoutUri:u.backchannelLogoutUri||void 0,backchannelLogoutSessionRequired:u.backchannelLogoutSessionRequired},r=await _.mutateAsync(n);t.invalidateQueries({queryKey:K.admin.clients()}),a(!1),r.clientSecret?l({clientId:r.clientId,secret:r.clientSecret}):e.success(`Client ${r.clientId} created`)}catch(t){e.error(t instanceof Error?t.message:String(t))}}async function D(n){if(n.preventDefault(),o)try{await v.mutateAsync({redirectUris:u.redirectUris,postLogoutRedirectUris:u.postLogoutRedirectUris,grantTypes:u.grantTypes,tokenEndpointAuthMethod:u.tokenEndpointAuthMethod,backchannelLogoutUri:u.backchannelLogoutUri||void 0,backchannelLogoutSessionRequired:u.backchannelLogoutSessionRequired}),t.invalidateQueries({queryKey:K.admin.clients()}),e.success(`Client updated`),s(null)}catch(t){e.error(t instanceof Error?t.message:String(t))}}async function O(r){if(confirm(`Delete client ${r.clientId}?`))try{await n.admin.clients.remove(r.clientId),t.invalidateQueries({queryKey:K.admin.clients()}),e.success(`Client deleted`)}catch(t){e.error(t instanceof Error?t.message:String(t))}}async function k(t){if(confirm(`Regenerate secret for ${t.clientId}? Existing secret will stop working.`))try{let r=await n.admin.clients.regenerateSecret(t.clientId);r.clientSecret?l({clientId:r.clientId,secret:r.clientSecret}):e.info(`No secret returned (public client)`)}catch(t){e.error(t instanceof Error?t.message:String(t))}}let A=()=>(0,b.jsxs)(`form`,{onSubmit:o?D:E,children:[!o&&(0,b.jsxs)(`div`,{className:`field`,children:[(0,b.jsx)(`label`,{children:`Client ID (optional — auto-generated if blank)`}),(0,b.jsx)(`input`,{className:`input input-mono`,value:u.clientIdOverride,onChange:e=>d(t=>({...t,clientIdOverride:e.target.value})),placeholder:`my-app (auto if blank)`})]}),(0,b.jsxs)(`div`,{className:`field`,children:[(0,b.jsx)(`label`,{children:`Grant Types`}),(0,b.jsx)(`div`,{style:{display:`flex`,flexWrap:`wrap`,gap:6,marginTop:4},children:J.map(e=>(0,b.jsxs)(`label`,{className:`checkbox-row`,style:{padding:`4px 0`},children:[(0,b.jsx)(`input`,{type:`checkbox`,checked:u.grantTypes.includes(e),onChange:()=>T(e)}),(0,b.jsx)(`span`,{className:`chk-label mono`,children:e})]},e))})]}),(0,b.jsxs)(`div`,{className:`field`,children:[(0,b.jsx)(`label`,{children:`Token Endpoint Auth Method`}),(0,b.jsx)(`select`,{className:`input`,value:u.tokenEndpointAuthMethod,onChange:e=>d(t=>({...t,tokenEndpointAuthMethod:e.target.value})),children:Bl.map(e=>(0,b.jsx)(`option`,{value:e,children:e},e))})]}),(0,b.jsxs)(`div`,{className:`field`,children:[(0,b.jsx)(`label`,{children:`Redirect URIs`}),u.redirectUris.map((e,t)=>(0,b.jsxs)(`div`,{style:{display:`flex`,gap:6,marginBottom:4},children:[(0,b.jsx)(`input`,{className:`input input-mono`,value:e,readOnly:!0,style:{flex:1}}),(0,b.jsx)(`button`,{type:`button`,className:`btn btn-sm btn-danger`,onClick:()=>w(`redirect`,t),children:(0,b.jsx)(`svg`,{viewBox:`0 0 16 16`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,children:(0,b.jsx)(`path`,{d:`M3 3l10 10M13 3L3 13`,strokeLinecap:`round`})})})]},t)),(0,b.jsxs)(`div`,{style:{display:`flex`,gap:6},children:[(0,b.jsx)(`input`,{className:`input input-mono`,value:p,onChange:e=>m(e.target.value),placeholder:`https://app.example.com/callback`,onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),C(`redirect`))}}),(0,b.jsx)(`button`,{type:`button`,className:`btn btn-sm`,onClick:()=>C(`redirect`),children:`Add`})]})]}),(0,b.jsxs)(`div`,{className:`field`,children:[(0,b.jsx)(`label`,{children:`Post-Logout Redirect URIs`}),u.postLogoutRedirectUris.map((e,t)=>(0,b.jsxs)(`div`,{style:{display:`flex`,gap:6,marginBottom:4},children:[(0,b.jsx)(`input`,{className:`input input-mono`,value:e,readOnly:!0,style:{flex:1}}),(0,b.jsx)(`button`,{type:`button`,className:`btn btn-sm btn-danger`,onClick:()=>w(`logout`,t),children:(0,b.jsx)(`svg`,{viewBox:`0 0 16 16`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,children:(0,b.jsx)(`path`,{d:`M3 3l10 10M13 3L3 13`,strokeLinecap:`round`})})})]},t)),(0,b.jsxs)(`div`,{style:{display:`flex`,gap:6},children:[(0,b.jsx)(`input`,{className:`input input-mono`,value:h,onChange:e=>g(e.target.value),placeholder:`https://app.example.com/logged-out`,onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),C(`logout`))}}),(0,b.jsx)(`button`,{type:`button`,className:`btn btn-sm`,onClick:()=>C(`logout`),children:`Add`})]})]}),(0,b.jsxs)(`div`,{className:`field`,children:[(0,b.jsx)(`label`,{children:`Backchannel Logout URI`}),(0,b.jsx)(`input`,{className:`input input-mono`,value:u.backchannelLogoutUri,onChange:e=>d(t=>({...t,backchannelLogoutUri:e.target.value})),placeholder:`https://app.example.com/backchannel-logout`})]}),(0,b.jsxs)(`label`,{className:`checkbox-row`,children:[(0,b.jsx)(`input`,{type:`checkbox`,checked:u.backchannelLogoutSessionRequired,onChange:e=>d(t=>({...t,backchannelLogoutSessionRequired:e.target.checked}))}),(0,b.jsx)(`span`,{className:`chk-label`,children:`Require session ID in backchannel logout`})]})]});return(0,b.jsxs)(`div`,{children:[(0,b.jsxs)(`div`,{className:`page-header-row`,children:[(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`div`,{className:`page-title`,children:`OAuth Clients`}),(0,b.jsxs)(`div`,{className:`page-sub`,children:[r,` dynamic clients`]})]}),(0,b.jsx)(`div`,{className:`page-actions`,children:(0,b.jsxs)(`button`,{className:`btn btn-primary`,onClick:y,children:[(0,b.jsx)(`svg`,{viewBox:`0 0 16 16`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,children:(0,b.jsx)(`path`,{d:`M8 2v12M2 8h12`,strokeLinecap:`round`})}),`New Client`]})})]}),(0,b.jsx)(Il,{onEdit:x,onDelete:O,onRegenerate:k}),(0,b.jsx)(Nl,{open:i,onClose:()=>a(!1),title:`New OAuth Client`,large:!0,footer:(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(`button`,{className:`btn`,onClick:()=>a(!1),children:`Cancel`}),(0,b.jsx)(`button`,{className:`btn btn-primary`,onClick:E,disabled:_.isPending,children:_.isPending?(0,b.jsx)(`span`,{className:`spinner sm`}):`Create Client`})]}),children:(0,b.jsx)(A,{})}),(0,b.jsx)(Nl,{open:!!o,onClose:()=>s(null),title:`Edit — ${o?.clientId}`,large:!0,footer:(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(`button`,{className:`btn`,onClick:()=>s(null),children:`Cancel`}),(0,b.jsx)(`button`,{className:`btn btn-primary`,onClick:D,disabled:v.isPending,children:v.isPending?(0,b.jsx)(`span`,{className:`spinner sm`}):`Save Changes`})]}),children:(0,b.jsx)(A,{})}),(0,b.jsxs)(Nl,{open:!!c,onClose:()=>l(null),title:`Client Secret — Save Now`,footer:(0,b.jsx)(`button`,{className:`btn btn-primary`,onClick:()=>l(null),children:`I've saved it`}),children:[(0,b.jsx)(`div`,{className:`error-box`,style:{background:`var(--amber-soft)`,borderColor:`rgba(255,180,84,0.3)`,color:`var(--amber)`},children:`This secret will not be shown again. Copy it now.`}),(0,b.jsxs)(`div`,{className:`secret-box`,style:{marginTop:12},children:[(0,b.jsx)(`small`,{children:`Client ID`}),c?.clientId]}),(0,b.jsxs)(`div`,{className:`secret-box`,children:[(0,b.jsx)(`small`,{children:`Client Secret`}),c?.secret]}),(0,b.jsxs)(`button`,{className:`btn btn-sm`,style:{marginTop:4},onClick:()=>navigator.clipboard.writeText(c?.secret??``),children:[(0,b.jsxs)(`svg`,{viewBox:`0 0 16 16`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.7`,children:[(0,b.jsx)(`rect`,{x:`5`,y:`5`,width:`9`,height:`9`,rx:`1.5`}),(0,b.jsx)(`path`,{d:`M3.5 11H3a1.5 1.5 0 01-1.5-1.5V3A1.5 1.5 0 013 1.5h6.5A1.5 1.5 0 0111 3v.5`,strokeLinecap:`round`})]}),`Copy secret`]})]})]})}function Ul(){let e=q(),t=S(),{data:n,isLoading:r,error:i,refetch:a}=z({...Ks(),retry:(e,t)=>t&&typeof t==`object`&&`status`in t&&t.status===501?!1:e<1}),o=B(qs()),s=B(Us()),[c,l]=(0,f.useState)(null),[u,d]=(0,f.useState)(null),[p,m]=(0,f.useState)(null),h=i&&typeof i==`object`&&`status`in i&&i.status===501;if(h)return(0,b.jsxs)(`div`,{className:`error-box`,children:[`Rotação indisponível: o `,(0,b.jsx)(`code`,{children:`jwks`}),` não é `,(0,b.jsx)(`code`,{children:`managed`}),` com um`,` `,(0,b.jsx)(`code`,{children:`store`}),` persistente (ex.:`,` `,(0,b.jsx)(`code`,{children:`{ source: 'managed', store: { driver: 'lucid' } }`}),`). Chaves inline (`,(0,b.jsx)(`code`,{children:`source: 'jwks'`}),`) não rotacionam.`]});let g=n?.policy,_=c??g?.maxAgeDays??90,v=u??g?.keep??2;async function y(n){m(`policy`);try{let r={enabled:n.enabled??g?.enabled??!1,maxAgeDays:n.maxAgeDays??_,keep:n.keep??v};await s.mutateAsync({key:`key_rotation`,value:r}),t.invalidateQueries({queryKey:K.admin.keys()}),l(null),d(null),e.success(`Política de rotação salva`)}catch(t){e.error(t instanceof Error?t.message:String(t))}finally{m(null)}}async function x(n){let r=n?`Isso DESABILITA todas as chaves atuais e cria uma nova. Tokens já emitidos deixam de validar imediatamente. Continuar?`:`Rotacionar agora? Uma chave nova vira a ativa; as antigas continuam validando (janela de grace).`;if(window.confirm(r)){m(n?`retire`:`rotate`);try{let r=await o.mutateAsync(n?{retire:!0}:{keep:v});t.invalidateQueries({queryKey:K.admin.keys()}),e.success(`Rotacionado. Nova chave: ${r.newKid.slice(0,8)}…`)}catch(t){e.error(t instanceof Error?t.message:String(t))}finally{m(null)}}}return(0,b.jsx)(vl,{isLoading:r,error:h?void 0:i,onRetry:a,skeleton:(0,b.jsx)(bl,{width:`100%`,height:220}),children:n&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(`div`,{className:`panel`,style:{marginBottom:16},children:(0,b.jsx)(`div`,{className:`panel-body`,children:(0,b.jsxs)(`div`,{className:`settings-row`,children:[(0,b.jsxs)(`div`,{className:`settings-info`,children:[(0,b.jsx)(`div`,{className:`settings-key`,children:`Chave de assinatura ativa`}),(0,b.jsx)(`div`,{style:{fontFamily:`var(--mono)`,fontSize:12},children:n.keys.find(e=>e.active)?.kid??`—`})]}),(0,b.jsxs)(`div`,{className:`settings-info`,style:{textAlign:`right`},children:[(0,b.jsxs)(`div`,{className:`settings-desc`,children:[`Idade: `,n.ageDays,` dia(s)`]}),(0,b.jsxs)(`div`,{className:`settings-desc`,children:[`Próxima rotação:`,` `,n.nextRotationInDays===null?`— (auto off)`:`~${n.nextRotationInDays} dia(s)`]})]})]})})}),(0,b.jsxs)(`div`,{className:`settings-section`,children:[(0,b.jsx)(`div`,{className:`settings-section-head`,children:(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`h3`,{children:`Rotação automática`}),(0,b.jsx)(`p`,{style:{marginTop:2},children:`Gera uma chave nova quando a ativa passa da idade máxima; mantém as N mais recentes (janela de grace).`})]})}),(0,b.jsx)(`div`,{className:`panel`,children:(0,b.jsxs)(`div`,{className:`panel-body`,style:{padding:0},children:[(0,b.jsxs)(`div`,{className:`settings-row`,children:[(0,b.jsxs)(`div`,{className:`settings-info`,children:[(0,b.jsx)(`div`,{className:`settings-key`,children:`Habilitar rotação agendada`}),(0,b.jsx)(`div`,{className:`settings-desc`,children:`key_rotation.enabled`})]}),(0,b.jsx)(`div`,{className:`settings-control`,children:(0,b.jsxs)(`label`,{className:`toggle`,children:[(0,b.jsx)(`input`,{type:`checkbox`,checked:!!g?.enabled,disabled:p===`policy`,onChange:e=>y({enabled:e.target.checked})}),(0,b.jsx)(`div`,{className:`toggle-track`}),(0,b.jsx)(`div`,{className:`toggle-thumb`})]})})]}),(0,b.jsxs)(`div`,{className:`settings-row`,children:[(0,b.jsxs)(`div`,{className:`settings-info`,children:[(0,b.jsx)(`div`,{className:`settings-key`,children:`Idade máxima (dias)`}),(0,b.jsx)(`div`,{className:`settings-desc`,children:`key_rotation.maxAgeDays`})]}),(0,b.jsxs)(`div`,{className:`settings-control`,children:[(0,b.jsx)(`input`,{className:`input input-mono`,type:`number`,style:{width:90,textAlign:`right`},value:String(_),onChange:e=>l(Number(e.target.value))}),c!==null&&(0,b.jsx)(`button`,{className:`btn btn-primary btn-sm`,disabled:p===`policy`,onClick:()=>y({maxAgeDays:_}),children:`Save`})]})]}),(0,b.jsxs)(`div`,{className:`settings-row`,children:[(0,b.jsxs)(`div`,{className:`settings-info`,children:[(0,b.jsx)(`div`,{className:`settings-key`,children:`Manter N chaves (grace)`}),(0,b.jsx)(`div`,{className:`settings-desc`,children:`key_rotation.keep`})]}),(0,b.jsxs)(`div`,{className:`settings-control`,children:[(0,b.jsx)(`input`,{className:`input input-mono`,type:`number`,style:{width:90,textAlign:`right`},value:String(v),onChange:e=>d(Number(e.target.value))}),u!==null&&(0,b.jsx)(`button`,{className:`btn btn-primary btn-sm`,disabled:p===`policy`,onClick:()=>y({keep:v}),children:`Save`})]})]})]})})]}),(0,b.jsxs)(`div`,{className:`settings-section`,children:[(0,b.jsx)(`div`,{className:`settings-section-head`,children:(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`h3`,{children:`Chaves no keyset`}),(0,b.jsx)(`p`,{style:{marginTop:2},children:`A primeira é a ativa (assina); as demais ainda validam tokens (grace).`})]})}),(0,b.jsx)(`div`,{className:`panel`,children:(0,b.jsx)(`div`,{className:`panel-body`,style:{padding:0},children:n.keys.map(e=>(0,b.jsx)(`div`,{className:`settings-row`,children:(0,b.jsxs)(`div`,{className:`settings-info`,children:[(0,b.jsxs)(`div`,{className:`settings-key`,style:{fontFamily:`var(--mono)`,fontSize:12},children:[e.kid,(0,b.jsx)(`span`,{className:`settings-badge`,style:e.active?{background:`var(--accent-soft, rgba(99,102,241,0.12))`,color:`var(--accent, #6366f1)`}:void 0,children:e.active?`ativa`:`grace`})]}),(0,b.jsxs)(`div`,{className:`settings-desc`,children:[e.alg,` · `,e.ageDays,` dia(s)`]})]})},e.kid))})})]}),(0,b.jsxs)(`div`,{className:`settings-section`,children:[(0,b.jsx)(`div`,{className:`settings-section-head`,children:(0,b.jsx)(`div`,{children:(0,b.jsx)(`h3`,{children:`Ações`})})}),(0,b.jsx)(`div`,{className:`panel`,children:(0,b.jsxs)(`div`,{className:`panel-body`,style:{display:`flex`,gap:12,flexWrap:`wrap`},children:[(0,b.jsx)(`button`,{className:`btn btn-primary`,disabled:!!p,onClick:()=>x(!1),children:p===`rotate`?(0,b.jsx)(`span`,{className:`spinner sm`}):`Rotacionar agora`}),(0,b.jsx)(`button`,{className:`btn btn-ghost`,disabled:!!p,onClick:()=>x(!0),style:{color:`var(--danger, #e5484d)`,borderColor:`var(--danger, #e5484d)`},children:p===`retire`?(0,b.jsx)(`span`,{className:`spinner sm`}):`Desabilitar todas + criar nova`})]})})]})]})})}function Wl(){return(0,b.jsxs)(`div`,{children:[(0,b.jsxs)(`div`,{className:`page-header`,children:[(0,b.jsx)(`div`,{className:`page-title`,children:`Signing Keys`}),(0,b.jsx)(`div`,{className:`page-sub`,children:`Chaves JWKS de assinatura — rotação, grace e status. Mudanças aplicam ao vivo.`})]}),(0,b.jsx)(Ul,{})]})}function Gl({open:e,onClose:t,title:n,children:r}){return(0,f.useEffect)(()=>{if(!e)return;let n=e=>{e.key===`Escape`&&t()};return window.addEventListener(`keydown`,n),()=>window.removeEventListener(`keydown`,n)},[e,t]),e?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(`div`,{className:`drawer-overlay`,onClick:t}),(0,b.jsxs)(`div`,{className:`drawer`,children:[(0,b.jsxs)(`div`,{className:`drawer-head`,children:[(0,b.jsx)(`h2`,{children:n}),(0,b.jsx)(`button`,{className:`modal-close`,onClick:t,children:(0,b.jsx)(`svg`,{viewBox:`0 0 16 16`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,children:(0,b.jsx)(`path`,{d:`M3 3l10 10M13 3L3 13`,strokeLinecap:`round`})})})]}),(0,b.jsx)(`div`,{className:`drawer-body`,children:r})]})]}):null}function Kl(e,t){let[n,r]=(0,f.useState)(e);return(0,f.useEffect)(()=>{let n=setTimeout(()=>r(e),t);return()=>clearTimeout(n)},[e,t]),n}function ql({onPick:e,placeholder:t}){let[n,r]=(0,f.useState)(``),i=Kl(n,250),a=z({...ms({search:i,size:6}),enabled:i.trim().length>=2}),o=a.data?.data??[];return(0,b.jsxs)(`div`,{style:{position:`relative`},children:[(0,b.jsx)(`input`,{className:`input`,value:n,onChange:e=>r(e.target.value),placeholder:t??`Search user by email or name…`}),i.trim().length>=2&&(0,b.jsx)(`div`,{style:{position:`absolute`,top:`100%`,left:0,right:0,zIndex:30,marginTop:4,background:`var(--panel, var(--bg))`,border:`1px solid var(--line)`,borderRadius:6,overflow:`hidden`,boxShadow:`0 8px 24px rgba(0,0,0,0.25)`},children:a.isLoading?(0,b.jsx)(`div`,{style:{padding:`8px 12px`,fontSize:12,color:`var(--faint)`},children:`Searching…`}):o.length===0?(0,b.jsx)(`div`,{style:{padding:`8px 12px`,fontSize:12,color:`var(--faint)`},children:`No users match.`}):o.map(t=>(0,b.jsxs)(`button`,{type:`button`,onClick:()=>e({id:t.id,email:t.email,name:t.name}),style:{display:`block`,width:`100%`,textAlign:`left`,padding:`8px 12px`,background:`none`,border:`none`,cursor:`pointer`,color:`var(--text)`,fontSize:12.5},onMouseEnter:e=>e.currentTarget.style.background=`var(--line)`,onMouseLeave:e=>e.currentTarget.style.background=`none`,children:[(0,b.jsx)(`span`,{style:{fontWeight:600},children:t.name??t.email}),t.name&&(0,b.jsx)(`span`,{style:{color:`var(--muted)`,marginLeft:8},children:t.email})]},t.id))})]})}function Jl({user:e,onClear:t}){return(0,b.jsxs)(`span`,{className:`badge badge-muted`,style:{display:`inline-flex`,alignItems:`center`,gap:6},children:[e.name?`${e.name} · `:``,e.email,(0,b.jsx)(`button`,{type:`button`,onClick:t,style:{background:`none`,border:`none`,cursor:`pointer`,color:`inherit`,padding:0,lineHeight:1},"aria-label":`Clear selected user`,children:`×`})]})}function Yl({label:e,hint:t,children:n}){return(0,b.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:10},children:[(0,b.jsxs)(`div`,{style:{flex:1},children:[(0,b.jsx)(`div`,{style:{fontSize:12,fontWeight:500,color:`var(--text)`},children:e}),t&&(0,b.jsx)(`div`,{style:{fontSize:11,color:`var(--faint)`},children:t})]}),n]})}function Xl({checked:e,onChange:t}){return(0,b.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":e,onClick:()=>t(!e),style:{position:`relative`,width:36,height:20,borderRadius:999,border:`none`,cursor:`pointer`,background:e?`var(--accent)`:`var(--line)`,transition:`background 0.15s`},children:(0,b.jsx)(`span`,{style:{position:`absolute`,top:2,left:e?18:2,width:16,height:16,borderRadius:`50%`,background:`#fff`,transition:`left 0.15s`}})})}function Zl({values:e,onChange:t,locked:n=[],placeholder:r}){let[i,a]=(0,f.useState)(``);function o(){let n=i.trim();!n||e.includes(n)||(t([...e,n]),a(``))}return(0,b.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:6},children:[(0,b.jsx)(`div`,{style:{display:`flex`,gap:6,flexWrap:`wrap`},children:e.map(r=>(0,b.jsxs)(`span`,{className:`badge badge-muted`,style:{display:`inline-flex`,alignItems:`center`,gap:5},children:[r,!n.includes(r)&&(0,b.jsx)(`button`,{type:`button`,onClick:()=>t(e.filter(e=>e!==r)),style:{background:`none`,border:`none`,cursor:`pointer`,color:`inherit`,padding:0,lineHeight:1},"aria-label":`Remove ${r}`,children:`×`})]},r))}),(0,b.jsxs)(`div`,{style:{display:`flex`,gap:6},children:[(0,b.jsx)(`input`,{className:`input`,value:i,onChange:e=>a(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),o())},placeholder:r??`add…`,style:{maxWidth:160}}),(0,b.jsx)(`button`,{type:`button`,className:`btn btn-ghost btn-sm`,onClick:o,children:`Add`})]})]})}var Ql=[`organizations_policy`,`roles_catalog`],$l={organizations_policy:{en:`Organizations policy`,pt:`Política de organizações`},roles_catalog:{en:`Roles catalog`,pt:`Catálogo de papéis`}},eu=[`owner`,`admin`,`member`];function tu(e){let t=e??{};return{allowSelfCreate:!!t.allowSelfCreate,invitationTtlHours:Number(t.invitationTtlHours)||168,roles:Array.isArray(t.roles)&&t.roles.length?t.roles.map(String):eu}}function nu(e){let t=e??{};return{roles:(Array.isArray(t.roles)&&t.roles.length?t.roles:[{name:`ADMIN`,description:`Full access to the admin console`}]).map(e=>({name:String(e.name),description:e.description?String(e.description):void 0}))}}function ru({orgId:e}){let t=q(),n=S(),{data:r,isLoading:i}=z({...Hs(e),retry:!1}),{data:a}=z({...Hs(null),retry:!1}),o=B(Us(e)),s=B(Ws(e)),[c,l]=(0,f.useState)(null),u=r?.data??[],d=a?.data??[];function p(e){return u.find(t=>t.key===e)??null}function m(e){return d.find(t=>t.key===e)??null}async function h(r,i){try{await o.mutateAsync({key:r,value:i}),n.invalidateQueries({queryKey:K.admin.settings(e)}),t.success(`Setting saved for this organization`),l(null)}catch(e){t.error(e instanceof Error?e.message:`Failed to save setting`)}}async function g(r){try{await s.mutateAsync(r),n.invalidateQueries({queryKey:K.admin.settings(e)}),t.success(`Organization setting removed (falls back to global)`)}catch(e){t.error(e instanceof Error?e.message:`Failed to remove setting`)}}return i?null:(0,b.jsxs)(`div`,{style:{borderTop:`1px solid var(--line)`,paddingTop:16},children:[(0,b.jsx)(`div`,{style:{fontSize:10.5,letterSpacing:`0.12em`,textTransform:`uppercase`,color:`var(--faint)`,fontWeight:600,marginBottom:12},children:`Organization Settings`}),(0,b.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:10},children:Ql.map(e=>{let t=p(e),n=m(e),r=$l[e],i=t?{text:`from org`,color:`var(--accent, #4f46e5)`}:n?{text:`from global`,color:`var(--muted)`}:{text:`default`,color:`var(--faint)`},a=c===e,u=t?.value??n?.value??null;return(0,b.jsxs)(`div`,{style:{background:`var(--surface, var(--bg))`,border:`1px solid var(--line)`,borderRadius:6,padding:`10px 12px`},children:[(0,b.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,marginBottom:a?10:0},children:[(0,b.jsxs)(`div`,{style:{flex:1},children:[(0,b.jsx)(`div`,{style:{fontSize:12,fontWeight:600,color:`var(--text)`},children:r.en}),(0,b.jsx)(`div`,{style:{fontSize:11,color:`var(--muted)`},children:r.pt})]}),(0,b.jsx)(`span`,{style:{fontSize:10,padding:`2px 6px`,borderRadius:4,background:`transparent`,border:`1px solid ${i.color}`,color:i.color,fontWeight:600},children:i.text}),!a&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(`button`,{className:`btn btn-ghost btn-sm`,onClick:()=>l(e),children:t?`Edit`:`Override`}),t&&(0,b.jsx)(`button`,{className:`btn btn-ghost btn-sm`,onClick:()=>g(e),disabled:s.isPending,style:{color:`var(--danger, #e53e3e)`},title:`Remove org override (falls back to global)`,children:`Reset`})]})]}),e===`organizations_policy`&&(a?(0,b.jsx)(ou,{initial:tu(u),saving:o.isPending,onSave:t=>h(e,t),onCancel:()=>l(null)}):(0,b.jsx)(iu,{value:tu(u)})),e===`roles_catalog`&&(a?(0,b.jsx)(su,{initial:nu(u),saving:o.isPending,onSave:t=>h(e,t),onCancel:()=>l(null)}):(0,b.jsx)(au,{value:nu(u)}))]},e)})})]})}function iu({value:e}){return(0,b.jsxs)(`div`,{style:{marginTop:8,display:`flex`,gap:6,flexWrap:`wrap`},children:[(0,b.jsxs)(`span`,{className:`badge badge-muted`,children:[`self-create: `,e.allowSelfCreate?`on`:`off`]}),(0,b.jsxs)(`span`,{className:`badge badge-muted`,children:[`invite TTL: `,e.invitationTtlHours,`h`]}),e.roles.map(e=>(0,b.jsx)(`span`,{className:`badge badge-muted`,children:e},e))]})}function au({value:e}){return(0,b.jsx)(`div`,{style:{marginTop:8,display:`flex`,gap:6,flexWrap:`wrap`},children:e.roles.map(e=>(0,b.jsx)(`span`,{className:`badge badge-muted`,title:e.description??``,children:e.name},e.name))})}function ou({initial:e,saving:t,onSave:n,onCancel:r}){let[i,a]=(0,f.useState)(e.allowSelfCreate),[o,s]=(0,f.useState)(e.invitationTtlHours),[c,l]=(0,f.useState)(e.roles);return(0,b.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:12},children:[(0,b.jsx)(Yl,{label:`Allow self-create`,hint:`Members can create their own organizations`,children:(0,b.jsx)(Xl,{checked:i,onChange:a})}),(0,b.jsx)(Yl,{label:`Invitation TTL`,hint:`Hours before a pending invitation expires`,children:(0,b.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:6},children:[(0,b.jsx)(`input`,{className:`input`,type:`number`,min:1,value:o,onChange:e=>s(Number(e.target.value)),style:{width:80}}),(0,b.jsx)(`span`,{style:{fontSize:11,color:`var(--faint)`},children:`h`})]})}),(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`div`,{style:{fontSize:12,fontWeight:500,color:`var(--text)`,marginBottom:6},children:`Organization roles`}),(0,b.jsx)(Zl,{values:c,onChange:l,locked:[`owner`],placeholder:`new role…`})]}),(0,b.jsxs)(`div`,{style:{display:`flex`,gap:8},children:[(0,b.jsx)(`button`,{type:`button`,className:`btn btn-primary btn-sm`,disabled:t,onClick:()=>n({allowSelfCreate:i,invitationTtlHours:o,roles:c}),children:t?`Saving…`:`Save`}),(0,b.jsx)(`button`,{type:`button`,className:`btn btn-ghost btn-sm`,onClick:r,children:`Cancel`})]})]})}function su({initial:e,saving:t,onSave:n,onCancel:r}){let[i,a]=(0,f.useState)(e.roles.map(e=>({name:e.name,description:e.description??``}))),[o,s]=(0,f.useState)(``),[c,l]=(0,f.useState)(``);function u(){let e=o.trim().toUpperCase();!e||i.some(t=>t.name===e)||(a([...i,{name:e,description:c.trim()}]),s(``),l(``))}return(0,b.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:8},children:[i.map((e,t)=>(0,b.jsxs)(`div`,{style:{display:`flex`,gap:6,alignItems:`center`},children:[(0,b.jsx)(`span`,{className:`badge badge-muted`,style:{minWidth:70,justifyContent:`center`},children:e.name}),(0,b.jsx)(`input`,{className:`input`,value:e.description,onChange:e=>a(i.map((n,r)=>r===t?{...n,description:e.target.value}:n)),placeholder:`description…`,style:{flex:1}}),e.name!==`ADMIN`&&(0,b.jsx)(`button`,{type:`button`,className:`btn btn-ghost btn-sm`,style:{color:`var(--danger, #e53e3e)`},onClick:()=>a(i.filter((e,n)=>n!==t)),children:`×`})]},e.name)),(0,b.jsxs)(`div`,{style:{display:`flex`,gap:6},children:[(0,b.jsx)(`input`,{className:`input`,value:o,onChange:e=>s(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),u())},placeholder:`ROLE_NAME`,style:{width:130}}),(0,b.jsx)(`input`,{className:`input`,value:c,onChange:e=>l(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),u())},placeholder:`description…`,style:{flex:1}}),(0,b.jsx)(`button`,{type:`button`,className:`btn btn-ghost btn-sm`,onClick:u,children:`Add`})]}),(0,b.jsxs)(`div`,{style:{display:`flex`,gap:8},children:[(0,b.jsx)(`button`,{type:`button`,className:`btn btn-primary btn-sm`,disabled:t,onClick:()=>n({roles:i.map(e=>({name:e.name,description:e.description||void 0}))}),children:t?`Saving…`:`Save`}),(0,b.jsx)(`button`,{type:`button`,className:`btn btn-ghost btn-sm`,onClick:r,children:`Cancel`})]})]})}function cu({value:e,onChange:t}){let n=eu.includes(e)?eu:[...eu,e];return(0,b.jsx)(`select`,{className:`input`,value:e,onChange:e=>t(e.target.value),style:{width:110},children:n.map(e=>(0,b.jsx)(`option`,{value:e,children:e},e))})}function lu({orgId:e,onDone:t}){let n=q(),r=S(),[i,a]=(0,f.useState)(null),[o,s]=(0,f.useState)(`member`),c=B(Is(e));async function l(a){if(a.preventDefault(),i)try{await c.mutateAsync({accountId:i.id,role:o}),r.invalidateQueries({queryKey:K.admin.org(e)}),r.invalidateQueries({queryKey:K.admin.orgs()}),n.success(`${i.email} added as ${o}`),t()}catch(e){n.error(e instanceof Error?e.message:`Failed to add member`)}}return(0,b.jsx)(`form`,{onSubmit:l,style:{display:`flex`,flexDirection:`column`,gap:8},children:i?(0,b.jsxs)(`div`,{style:{display:`flex`,gap:8,alignItems:`center`,flexWrap:`wrap`},children:[(0,b.jsx)(Jl,{user:i,onClear:()=>a(null)}),(0,b.jsx)(cu,{value:o,onChange:s}),(0,b.jsx)(`button`,{type:`submit`,className:`btn btn-primary btn-sm`,disabled:c.isPending,children:c.isPending?`Adding…`:`Add member`}),(0,b.jsx)(`button`,{type:`button`,className:`btn btn-ghost btn-sm`,onClick:t,children:`Cancel`})]}):(0,b.jsxs)(`div`,{children:[(0,b.jsx)(ql,{onPick:a}),(0,b.jsx)(`div`,{style:{marginTop:6,display:`flex`,justifyContent:`flex-end`},children:(0,b.jsx)(`button`,{type:`button`,className:`btn btn-ghost btn-sm`,onClick:t,children:`Cancel`})})]})})}function uu({orgId:e,onDone:t}){let n=q(),r=S(),[i,a]=(0,f.useState)(``),[o,s]=(0,f.useState)(`member`),c=B(zs(e));async function l(s){if(s.preventDefault(),i.trim())try{await c.mutateAsync({email:i.trim(),role:o}),r.invalidateQueries({queryKey:K.admin.org(e)}),n.success(`Invitation sent`),a(``),t()}catch(e){n.error(e instanceof Error?e.message:`Failed to create invitation`)}}return(0,b.jsxs)(`form`,{onSubmit:l,style:{display:`flex`,gap:8,alignItems:`flex-end`,flexWrap:`wrap`},children:[(0,b.jsxs)(`div`,{style:{flex:1,minWidth:180},children:[(0,b.jsx)(`label`,{className:`field-label`,children:`Email`}),(0,b.jsx)(`input`,{className:`input`,type:`email`,value:i,onChange:e=>a(e.target.value),placeholder:`user@example.com`,required:!0})]}),(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`label`,{className:`field-label`,children:`Role`}),(0,b.jsx)(cu,{value:o,onChange:s})]}),(0,b.jsx)(`button`,{type:`submit`,className:`btn btn-primary btn-sm`,disabled:c.isPending,children:c.isPending?`Sending…`:`Invite`}),(0,b.jsx)(`button`,{type:`button`,className:`btn btn-ghost btn-sm`,onClick:t,children:`Cancel`})]})}function du({orgId:e,member:t}){let n=q(),r=S(),[i,a]=(0,f.useState)(!1),[o,s]=(0,f.useState)(t.role),c=B(Ls(e,t.accountId)),l=B(Rs(e,t.accountId));async function u(){try{await c.mutateAsync(),r.invalidateQueries({queryKey:K.admin.org(e)}),r.invalidateQueries({queryKey:K.admin.orgs()}),n.success(`Member removed`)}catch(e){n.error(e instanceof Error?e.message:`Failed to remove member`)}}async function d(t){t.preventDefault();try{await l.mutateAsync(o),r.invalidateQueries({queryKey:K.admin.org(e)}),n.success(`Role updated`),a(!1)}catch(e){n.error(e instanceof Error?e.message:`Failed to update role`)}}return(0,b.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,padding:`6px 0`,borderBottom:`1px solid var(--line)`},children:[(0,b.jsx)(`div`,{className:`avatar`,style:{width:24,height:24,fontSize:9},children:(t.email??`?`).slice(0,2).toUpperCase()}),(0,b.jsx)(`div`,{style:{flex:1},children:(0,b.jsx)(`div`,{style:{fontSize:12,color:`var(--text)`},children:t.email??t.accountId})}),i?(0,b.jsxs)(`form`,{onSubmit:d,style:{display:`flex`,gap:4},children:[(0,b.jsx)(`input`,{className:`input`,value:o,onChange:e=>s(e.target.value),style:{width:80,padding:`2px 6px`,fontSize:11}}),(0,b.jsx)(`button`,{type:`submit`,className:`btn btn-primary btn-sm`,disabled:l.isPending,children:`✓`}),(0,b.jsx)(`button`,{type:`button`,className:`btn btn-ghost btn-sm`,onClick:()=>a(!1),children:`✕`})]}):(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(`button`,{className:`badge badge-muted`,title:`Click to change role`,onClick:()=>a(!0),style:{cursor:`pointer`,background:`none`,border:`1px solid var(--line)`},children:t.role}),(0,b.jsx)(`button`,{className:`icon-btn`,title:`Remove member`,onClick:u,disabled:c.isPending,style:{color:`var(--danger, #e53e3e)`,fontSize:13},children:`✕`})]})]})}function fu({orgId:e,invitation:t}){let n=q(),r=S(),i=B(Bs(e,t.id));async function a(){try{await i.mutateAsync(),r.invalidateQueries({queryKey:K.admin.org(e)}),n.success(`Invitation revoked`)}catch(e){n.error(e instanceof Error?e.message:`Failed to revoke invitation`)}}return(0,b.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,padding:`6px 0`,borderBottom:`1px solid var(--line)`},children:[(0,b.jsx)(`div`,{style:{flex:1,fontSize:12,color:`var(--muted)`},children:t.email}),(0,b.jsx)(`span`,{className:`badge badge-amber`,children:t.role}),(0,b.jsx)(`button`,{className:`icon-btn`,title:`Revoke invitation`,onClick:a,disabled:i.isPending,style:{color:`var(--danger, #e53e3e)`,fontSize:13},children:`✕`})]})}var pu=20;function mu(e){return e.toLowerCase().normalize(`NFD`).replace(/[̀-ͯ]/g,``).replace(/[^a-z0-9]+/g,`-`).replace(/^-+|-+$/g,``)}function hu({open:e,onClose:t,onCreated:n}){let r=q(),i=S(),[a,o]=(0,f.useState)(``),[s,c]=(0,f.useState)(``),[l,u]=(0,f.useState)(!1),[d,p]=(0,f.useState)(null),m=B(Ns());function h(e){o(e),l||c(mu(e))}async function g(e){if(e.preventDefault(),!(!a.trim()||!s.trim()||!d))try{await m.mutateAsync({name:a.trim(),slug:s.trim(),ownerAccountId:d.id}),i.invalidateQueries({queryKey:K.admin.orgs()}),r.success(`Organization created`),o(``),c(``),p(null),u(!1),n()}catch(e){r.error(e instanceof Error?e.message:`Failed to create organization`)}}return e?(0,b.jsx)(`div`,{className:`modal-backdrop`,onClick:t,children:(0,b.jsxs)(`div`,{className:`modal`,onClick:e=>e.stopPropagation(),children:[(0,b.jsxs)(`div`,{className:`modal-head`,children:[(0,b.jsx)(`span`,{children:`New Organization`}),(0,b.jsx)(`button`,{className:`icon-btn`,onClick:t,children:`✕`})]}),(0,b.jsxs)(`form`,{onSubmit:g,style:{display:`flex`,flexDirection:`column`,gap:14},children:[(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`label`,{className:`field-label`,children:`Name`}),(0,b.jsx)(`input`,{className:`input`,value:a,onChange:e=>h(e.target.value),placeholder:`Acme Inc.`,required:!0})]}),(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`label`,{className:`field-label`,children:`Slug`}),(0,b.jsx)(`input`,{className:`input`,value:s,onChange:e=>{c(e.target.value),u(!0)},placeholder:`acme-inc`,required:!0})]}),(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`label`,{className:`field-label`,children:`Owner`}),d?(0,b.jsx)(Jl,{user:d,onClear:()=>p(null)}):(0,b.jsx)(ql,{onPick:p,placeholder:`Search the initial owner by email…`})]}),(0,b.jsxs)(`div`,{style:{display:`flex`,gap:8,justifyContent:`flex-end`,marginTop:4},children:[(0,b.jsx)(`button`,{type:`button`,className:`btn btn-ghost`,onClick:t,children:`Cancel`}),(0,b.jsx)(`button`,{type:`submit`,className:`btn btn-primary`,disabled:m.isPending,children:m.isPending?`Creating…`:`Create`})]})]})]})}):null}function gu({search:e,page:t,onPage:n,onSelectOrg:r,onUnavailable:i,onCreateClick:a}){let[o,s]=(0,f.useState)(!1),{data:c,isLoading:l,error:u,refetch:d}=z({...js(),retry:(e,t)=>t&&typeof t==`object`&&`status`in t&&t.status===404?(o||(s(!0),i()),!1):e<1}),p=c?.data??[],m=e?p.filter(t=>t.name.toLowerCase().includes(e.toLowerCase())||t.slug.toLowerCase().includes(e.toLowerCase())):p,h=m.length,g=m.slice((t-1)*pu,t*pu),_=u&&typeof u==`object`&&`status`in u&&u.status===404;return(0,b.jsx)(`div`,{className:`panel`,children:(0,b.jsx)(vl,{isLoading:l,error:u&&!_?u:void 0,onRetry:d,skeleton:(0,b.jsx)(Tl,{rows:6,cols:4}),children:g.length===0?(0,b.jsxs)(`div`,{className:`empty-state`,children:[(0,b.jsxs)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,children:[(0,b.jsx)(`rect`,{x:`3`,y:`3`,width:`7`,height:`7`,rx:`1`}),(0,b.jsx)(`rect`,{x:`3`,y:`14`,width:`7`,height:`7`,rx:`1`}),(0,b.jsx)(`rect`,{x:`14`,y:`3`,width:`7`,height:`7`,rx:`1`}),(0,b.jsx)(`path`,{d:`M17.5 14v7M14 17.5h7`,strokeLinecap:`round`})]}),(0,b.jsx)(`h4`,{children:`No organizations`}),(0,b.jsx)(`p`,{children:e?`No results for your search`:`No organizations created yet`}),!e&&(0,b.jsx)(`button`,{className:`btn btn-primary`,style:{marginTop:12},onClick:a,children:`New organization`})]}):(0,b.jsxs)(`div`,{className:`tbl-wrap`,children:[(0,b.jsxs)(`table`,{children:[(0,b.jsx)(`thead`,{children:(0,b.jsxs)(`tr`,{children:[(0,b.jsx)(`th`,{children:`Name`}),(0,b.jsx)(`th`,{children:`Slug`}),(0,b.jsx)(`th`,{children:`Members`}),(0,b.jsx)(`th`,{children:`Created`})]})}),(0,b.jsx)(`tbody`,{children:g.map(e=>(0,b.jsxs)(`tr`,{onClick:()=>r(e.id),children:[(0,b.jsx)(`td`,{children:(0,b.jsx)(`b`,{children:e.name})}),(0,b.jsx)(`td`,{children:(0,b.jsx)(`span`,{className:`code`,children:e.slug})}),(0,b.jsx)(`td`,{children:(0,b.jsx)(`span`,{className:`mono text-sm`,children:e.memberCount??`—`})}),(0,b.jsx)(`td`,{children:(0,b.jsx)(`span`,{style:{fontFamily:`var(--mono)`,fontSize:11,color:`var(--faint)`},children:e.createdAt?new Date(e.createdAt).toLocaleDateString():`—`})})]},e.id))})]}),(0,b.jsx)(`div`,{style:{padding:`0 16px 12px`},children:(0,b.jsx)(fl,{page:t,total:h,size:pu,onPage:n})})]})})})}function _u({orgId:e,currentName:t,currentLogoUrl:n,onDone:r}){let i=q(),a=S(),[o,s]=(0,f.useState)(t),[c,l]=(0,f.useState)(n??``),u=B(Ps(e));async function d(t){t.preventDefault();try{await u.mutateAsync({name:o.trim()||void 0,logoUrl:c.trim()||null}),a.invalidateQueries({queryKey:K.admin.orgs()}),a.invalidateQueries({queryKey:K.admin.org(e)}),i.success(`Organization updated`),r()}catch(e){i.error(e instanceof Error?e.message:`Failed to update organization`)}}return(0,b.jsxs)(`form`,{onSubmit:d,style:{display:`flex`,flexDirection:`column`,gap:10},children:[(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`label`,{className:`field-label`,children:`Name`}),(0,b.jsx)(`input`,{className:`input`,value:o,onChange:e=>s(e.target.value)})]}),(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`label`,{className:`field-label`,children:`Logo URL`}),(0,b.jsx)(`input`,{className:`input`,value:c,onChange:e=>l(e.target.value),placeholder:`https://…`})]}),(0,b.jsxs)(`div`,{style:{display:`flex`,gap:8},children:[(0,b.jsx)(`button`,{type:`submit`,className:`btn btn-primary btn-sm`,disabled:u.isPending,children:u.isPending?`Saving…`:`Save`}),(0,b.jsx)(`button`,{type:`button`,className:`btn btn-ghost btn-sm`,onClick:r,children:`Cancel`})]})]})}function vu({orgId:e,onDeleted:t}){let n=q(),r=S(),{data:i,isLoading:a,error:o,refetch:s}=z(Ms(e)),[c,l]=(0,f.useState)(!1),[u,d]=(0,f.useState)(!1),[p,m]=(0,f.useState)(!1),[h,g]=(0,f.useState)(!1),_=B(Fs(e));async function v(){try{await _.mutateAsync(),r.invalidateQueries({queryKey:K.admin.orgs()}),n.success(`Organization deleted`),t()}catch(e){n.error(e instanceof Error?e.message:`Failed to delete organization`)}}return(0,b.jsx)(vl,{isLoading:a,error:o,onRetry:s,skeleton:(0,b.jsx)(El,{}),children:i&&(0,b.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:20},children:[(0,b.jsxs)(`div`,{children:[(0,b.jsxs)(`div`,{style:{fontSize:10.5,letterSpacing:`0.12em`,textTransform:`uppercase`,color:`var(--faint)`,fontWeight:600,marginBottom:8,display:`flex`,alignItems:`center`,justifyContent:`space-between`},children:[(0,b.jsx)(`span`,{children:`Info`}),!c&&(0,b.jsx)(`button`,{className:`btn btn-ghost btn-sm`,onClick:()=>l(!0),children:`Edit`})]}),c?(0,b.jsx)(_u,{orgId:e,currentName:i.name,currentLogoUrl:i.logoUrl,onDone:()=>l(!1)}):(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(`div`,{className:`code`,children:i.id}),(0,b.jsx)(`div`,{style:{marginTop:6,fontSize:12},children:(0,b.jsx)(`span`,{className:`badge badge-muted`,children:i.slug})})]})]}),(0,b.jsxs)(`div`,{children:[(0,b.jsxs)(`div`,{style:{fontSize:10.5,letterSpacing:`0.12em`,textTransform:`uppercase`,color:`var(--faint)`,fontWeight:600,marginBottom:8,display:`flex`,alignItems:`center`,justifyContent:`space-between`},children:[(0,b.jsxs)(`span`,{children:[`Members (`,i.members.length,`)`]}),!u&&(0,b.jsx)(`button`,{className:`btn btn-ghost btn-sm`,onClick:()=>d(!0),children:`+ Add`})]}),u&&(0,b.jsx)(`div`,{style:{marginBottom:10},children:(0,b.jsx)(lu,{orgId:e,onDone:()=>d(!1)})}),i.members.map(t=>(0,b.jsx)(du,{orgId:e,member:t},t.accountId))]}),(0,b.jsxs)(`div`,{children:[(0,b.jsxs)(`div`,{style:{fontSize:10.5,letterSpacing:`0.12em`,textTransform:`uppercase`,color:`var(--faint)`,fontWeight:600,marginBottom:8,display:`flex`,alignItems:`center`,justifyContent:`space-between`},children:[(0,b.jsxs)(`span`,{children:[`Pending Invitations (`,i.pendingInvitations.length,`)`]}),!p&&(0,b.jsx)(`button`,{className:`btn btn-ghost btn-sm`,onClick:()=>m(!0),children:`+ Invite`})]}),p&&(0,b.jsx)(`div`,{style:{marginBottom:10},children:(0,b.jsx)(uu,{orgId:e,onDone:()=>m(!1)})}),i.pendingInvitations.length===0&&!p&&(0,b.jsx)(`div`,{style:{fontSize:12,color:`var(--faint)`},children:`No pending invitations`}),i.pendingInvitations.map(t=>(0,b.jsx)(fu,{orgId:e,invitation:t},t.id))]}),(0,b.jsx)(ru,{orgId:e}),(0,b.jsxs)(`div`,{style:{borderTop:`1px solid var(--line)`,paddingTop:16},children:[(0,b.jsx)(`div`,{style:{fontSize:10.5,letterSpacing:`0.12em`,textTransform:`uppercase`,color:`var(--danger, #e53e3e)`,fontWeight:600,marginBottom:8},children:`Danger Zone`}),h?(0,b.jsxs)(`div`,{style:{display:`flex`,gap:8,alignItems:`center`,fontSize:13},children:[(0,b.jsx)(`span`,{style:{color:`var(--muted)`},children:`Delete this organization?`}),(0,b.jsx)(`button`,{className:`btn btn-danger btn-sm`,onClick:v,disabled:_.isPending,children:_.isPending?`Deleting…`:`Yes, delete`}),(0,b.jsx)(`button`,{className:`btn btn-ghost btn-sm`,onClick:()=>g(!1),children:`Cancel`})]}):(0,b.jsx)(`button`,{className:`btn btn-danger btn-sm`,onClick:()=>g(!0),children:`Delete organization`})]})]})})}function yu({orgId:e,onClose:t}){let{data:n}=z(Ms(e));return(0,b.jsx)(Gl,{open:!0,onClose:t,title:n?.name??`Organization`,children:(0,b.jsx)(vu,{orgId:e,onDeleted:t})})}function bu(e){let{data:t}=z(js()),n=t?.data??[];return(e?n.filter(t=>t.name.toLowerCase().includes(e.toLowerCase())||t.slug.toLowerCase().includes(e.toLowerCase())):n).length}function xu(){let[e,t]=rl(`page`,qc.withDefault(1)),[n,r]=rl(`q`,Kc.withDefault(``)),[i,a]=rl(`org`),o=Kl(n,300),[s,c]=(0,f.useState)(!1),[l,u]=(0,f.useState)(!1),d=bu(o);return s?(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`div`,{className:`page-title`,style:{marginBottom:8},children:`Organizations`}),(0,b.jsx)(`div`,{className:`error-box`,children:`Organizations are not enabled in this AuthKit installation.`})]}):(0,b.jsxs)(`div`,{children:[(0,b.jsxs)(`div`,{className:`page-header-row`,children:[(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`div`,{className:`page-title`,children:`Organizations`}),(0,b.jsxs)(`div`,{className:`page-sub`,children:[d.toLocaleString(),` orgs`]})]}),(0,b.jsx)(`button`,{className:`btn btn-primary`,onClick:()=>u(!0),children:`New organization`})]}),(0,b.jsx)(`div`,{className:`panel`,style:{marginBottom:0},children:(0,b.jsx)(`div`,{className:`panel-head`,children:(0,b.jsxs)(`div`,{className:`search-input`,style:{flex:1,maxWidth:300},children:[(0,b.jsxs)(`svg`,{className:`search-ico`,viewBox:`0 0 16 16`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.7`,children:[(0,b.jsx)(`circle`,{cx:`7`,cy:`7`,r:`4.5`}),(0,b.jsx)(`path`,{d:`M10 10l3 3`,strokeLinecap:`round`})]}),(0,b.jsx)(`input`,{className:`input`,placeholder:`Search organizations…`,value:n,onChange:e=>{r(e.target.value),t(1)}})]})})}),(0,b.jsx)(gu,{search:o,page:e,onPage:t,onSelectOrg:a,onUnavailable:()=>c(!0),onCreateClick:()=>u(!0)}),i&&(0,b.jsx)(yu,{orgId:i,onClose:()=>a(null)}),(0,b.jsx)(hu,{open:l,onClose:()=>u(!1),onCreated:()=>u(!1)})]})}function Su(e){var t,n,r=``;if(typeof e==`string`||typeof e==`number`)r+=e;else if(typeof e==`object`){if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(n=Su(e[t]))&&(r&&(r+=` `),r+=n)}else for(n in e)e[n]&&(r&&(r+=` `),r+=n)}return r}function Cu(){for(var e,t,n=0,r=``,i=arguments.length;n<i;n++)(e=arguments[n])&&(t=Su(e))&&(r&&(r+=` `),r+=t);return r}var wu=`dangerouslySetInnerHTML.onCopy.onCopyCapture.onCut.onCutCapture.onPaste.onPasteCapture.onCompositionEnd.onCompositionEndCapture.onCompositionStart.onCompositionStartCapture.onCompositionUpdate.onCompositionUpdateCapture.onFocus.onFocusCapture.onBlur.onBlurCapture.onChange.onChangeCapture.onBeforeInput.onBeforeInputCapture.onInput.onInputCapture.onReset.onResetCapture.onSubmit.onSubmitCapture.onInvalid.onInvalidCapture.onLoad.onLoadCapture.onError.onErrorCapture.onKeyDown.onKeyDownCapture.onKeyPress.onKeyPressCapture.onKeyUp.onKeyUpCapture.onAbort.onAbortCapture.onCanPlay.onCanPlayCapture.onCanPlayThrough.onCanPlayThroughCapture.onDurationChange.onDurationChangeCapture.onEmptied.onEmptiedCapture.onEncrypted.onEncryptedCapture.onEnded.onEndedCapture.onLoadedData.onLoadedDataCapture.onLoadedMetadata.onLoadedMetadataCapture.onLoadStart.onLoadStartCapture.onPause.onPauseCapture.onPlay.onPlayCapture.onPlaying.onPlayingCapture.onProgress.onProgressCapture.onRateChange.onRateChangeCapture.onSeeked.onSeekedCapture.onSeeking.onSeekingCapture.onStalled.onStalledCapture.onSuspend.onSuspendCapture.onTimeUpdate.onTimeUpdateCapture.onVolumeChange.onVolumeChangeCapture.onWaiting.onWaitingCapture.onAuxClick.onAuxClickCapture.onClick.onClickCapture.onContextMenu.onContextMenuCapture.onDoubleClick.onDoubleClickCapture.onDrag.onDragCapture.onDragEnd.onDragEndCapture.onDragEnter.onDragEnterCapture.onDragExit.onDragExitCapture.onDragLeave.onDragLeaveCapture.onDragOver.onDragOverCapture.onDragStart.onDragStartCapture.onDrop.onDropCapture.onMouseDown.onMouseDownCapture.onMouseEnter.onMouseLeave.onMouseMove.onMouseMoveCapture.onMouseOut.onMouseOutCapture.onMouseOver.onMouseOverCapture.onMouseUp.onMouseUpCapture.onSelect.onSelectCapture.onTouchCancel.onTouchCancelCapture.onTouchEnd.onTouchEndCapture.onTouchMove.onTouchMoveCapture.onTouchStart.onTouchStartCapture.onPointerDown.onPointerDownCapture.onPointerMove.onPointerMoveCapture.onPointerUp.onPointerUpCapture.onPointerCancel.onPointerCancelCapture.onPointerEnter.onPointerEnterCapture.onPointerLeave.onPointerLeaveCapture.onPointerOver.onPointerOverCapture.onPointerOut.onPointerOutCapture.onGotPointerCapture.onGotPointerCaptureCapture.onLostPointerCapture.onLostPointerCaptureCapture.onScroll.onScrollCapture.onWheel.onWheelCapture.onAnimationStart.onAnimationStartCapture.onAnimationEnd.onAnimationEndCapture.onAnimationIteration.onAnimationIterationCapture.onTransitionEnd.onTransitionEndCapture`.split(`.`);function Tu(e){return typeof e==`string`&&wu.includes(e)}var Eu=new Set(`aria-activedescendant.aria-atomic.aria-autocomplete.aria-busy.aria-checked.aria-colcount.aria-colindex.aria-colspan.aria-controls.aria-current.aria-describedby.aria-details.aria-disabled.aria-errormessage.aria-expanded.aria-flowto.aria-haspopup.aria-hidden.aria-invalid.aria-keyshortcuts.aria-label.aria-labelledby.aria-level.aria-live.aria-modal.aria-multiline.aria-multiselectable.aria-orientation.aria-owns.aria-placeholder.aria-posinset.aria-pressed.aria-readonly.aria-relevant.aria-required.aria-roledescription.aria-rowcount.aria-rowindex.aria-rowspan.aria-selected.aria-setsize.aria-sort.aria-valuemax.aria-valuemin.aria-valuenow.aria-valuetext.className.color.height.id.lang.max.media.method.min.name.style.target.width.role.tabIndex.accentHeight.accumulate.additive.alignmentBaseline.allowReorder.alphabetic.amplitude.arabicForm.ascent.attributeName.attributeType.autoReverse.azimuth.baseFrequency.baselineShift.baseProfile.bbox.begin.bias.by.calcMode.capHeight.clip.clipPath.clipPathUnits.clipRule.colorInterpolation.colorInterpolationFilters.colorProfile.colorRendering.contentScriptType.contentStyleType.cursor.cx.cy.d.decelerate.descent.diffuseConstant.direction.display.divisor.dominantBaseline.dur.dx.dy.edgeMode.elevation.enableBackground.end.exponent.externalResourcesRequired.fill.fillOpacity.fillRule.filter.filterRes.filterUnits.floodColor.floodOpacity.focusable.fontFamily.fontSize.fontSizeAdjust.fontStretch.fontStyle.fontVariant.fontWeight.format.from.fx.fy.g1.g2.glyphName.glyphOrientationHorizontal.glyphOrientationVertical.glyphRef.gradientTransform.gradientUnits.hanging.horizAdvX.horizOriginX.href.ideographic.imageRendering.in2.in.intercept.k1.k2.k3.k4.k.kernelMatrix.kernelUnitLength.kerning.keyPoints.keySplines.keyTimes.lengthAdjust.letterSpacing.lightingColor.limitingConeAngle.local.markerEnd.markerHeight.markerMid.markerStart.markerUnits.markerWidth.mask.maskContentUnits.maskUnits.mathematical.mode.numOctaves.offset.opacity.operator.order.orient.orientation.origin.overflow.overlinePosition.overlineThickness.paintOrder.panose1.pathLength.patternContentUnits.patternTransform.patternUnits.pointerEvents.pointsAtX.pointsAtY.pointsAtZ.preserveAlpha.preserveAspectRatio.primitiveUnits.r.radius.refX.refY.renderingIntent.repeatCount.repeatDur.requiredExtensions.requiredFeatures.restart.result.rotate.rx.ry.seed.shapeRendering.slope.spacing.specularConstant.specularExponent.speed.spreadMethod.startOffset.stdDeviation.stemh.stemv.stitchTiles.stopColor.stopOpacity.strikethroughPosition.strikethroughThickness.string.stroke.strokeDasharray.strokeDashoffset.strokeLinecap.strokeLinejoin.strokeMiterlimit.strokeOpacity.strokeWidth.surfaceScale.systemLanguage.tableValues.targetX.targetY.textAnchor.textDecoration.textLength.textRendering.to.transform.u1.u2.underlinePosition.underlineThickness.unicode.unicodeBidi.unicodeRange.unitsPerEm.vAlphabetic.values.vectorEffect.version.vertAdvY.vertOriginX.vertOriginY.vHanging.vIdeographic.viewTarget.visibility.vMathematical.widths.wordSpacing.writingMode.x1.x2.x.xChannelSelector.xHeight.xlinkActuate.xlinkArcrole.xlinkHref.xlinkRole.xlinkShow.xlinkTitle.xlinkType.xmlBase.xmlLang.xmlns.xmlnsXlink.xmlSpace.y1.y2.y.yChannelSelector.z.zoomAndPan.ref.key.angle`.split(`.`));function Du(e){return typeof e==`string`&&Eu.has(e)}function Ou(e){return typeof e==`string`&&e.startsWith(`data-`)}function ku(e){if(typeof e!=`object`||!e)return{};var t={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(Du(n)||Ou(n))&&(t[n]=e[n]);return t}function Au(e){if(e==null)return null;if((0,f.isValidElement)(e)&&typeof e.props==`object`&&e.props!==null){var t=e.props;return ku(t)}return typeof e==`object`&&!Array.isArray(e)?ku(e):null}function ju(e){var t={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(Du(n)||Ou(n)||Tu(n))&&(t[n]=e[n]);return t}function Mu(e){return e==null?null:(0,f.isValidElement)(e)?ju(e.props):typeof e==`object`&&!Array.isArray(e)?ju(e):null}var Nu=[`children`,`width`,`height`,`viewBox`,`className`,`style`,`title`,`desc`];function Pu(){return Pu=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Pu.apply(null,arguments)}function Fu(e,t){if(e==null)return{};var n,r,i=Iu(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function Iu(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}var Lu=(0,f.forwardRef)((e,t)=>{var n=e.children,r=e.width,i=e.height,a=e.viewBox,o=e.className,s=e.style,c=e.title,l=e.desc,u=Fu(e,Nu),d=a||{width:r,height:i,x:0,y:0},p=Cu(`recharts-surface`,o);return f.createElement(`svg`,Pu({},ju(u),{className:p,width:r,height:i,style:s,viewBox:`${d.x} ${d.y} ${d.width} ${d.height}`,ref:t}),f.createElement(`title`,null,c),f.createElement(`desc`,null,l),n)}),Ru=[`children`,`className`];function zu(){return zu=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},zu.apply(null,arguments)}function Bu(e,t){if(e==null)return{};var n,r,i=Vu(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function Vu(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}var Hu=f.forwardRef((e,t)=>{var n=e.children,r=e.className,i=Bu(e,Ru),a=Cu(`recharts-layer`,r);return f.createElement(`g`,zu({className:a},ju(i),{ref:t}),n)}),Uu=4;function Wu(e){var t=10**(arguments.length>1&&arguments[1]!==void 0?arguments[1]:Uu),n=Math.round(e*t)/t;return Object.is(n,-0)?0:n}function Gu(e){var t=[...arguments].slice(1);return e.reduce((e,n,r)=>{var i=t[r-1];return typeof i==`string`?e+i+n:i===void 0?e+n:e+Wu(i)+n},``)}var Ku=e=>e===0?0:e>0?1:-1,Y=e=>typeof e==`number`&&e!=+e,qu=e=>typeof e==`string`&&e.length>1&&e.indexOf(`%`)===e.length-1,X=e=>(typeof e==`number`||e instanceof Number)&&!Y(e),Ju=e=>X(e)||typeof e==`string`,Yu=0,Xu=e=>{var t=++Yu;return`${e||``}${t}`},Zu=function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,r=arguments.length>3&&arguments[3]!==void 0&&arguments[3];if(!X(e)&&typeof e!=`string`)return n;var i;if(qu(e)){if(t==null)return n;var a=e.indexOf(`%`);i=t*parseFloat(e.slice(0,a))/100}else i=+e;return Y(i)&&(i=n),r&&t!=null&&i>t&&(i=t),i},Qu=e=>{if(!Array.isArray(e))return!1;for(var t=e.length,n={},r=0;r<t;r++)if(!n[String(e[r])])n[String(e[r])]=!0;else return!0;return!1};function $u(e,t,n){return X(e)&&X(t)?Wu(e+n*(t-e)):t}function ed(e,t,n){if(!(!e||!e.length))return e.find(e=>e&&(typeof t==`function`?t(e):H(e,t))===n)}var td=e=>e==null,nd=e=>td(e)?e:`${e.charAt(0).toUpperCase()}${e.slice(1)}`;function rd(e){return e!=null}function id(){}function ad(e){if(e)return{x:e.x,y:e.y,upperWidth:`upperWidth`in e?e.upperWidth:e.width,lowerWidth:`lowerWidth`in e?e.lowerWidth:e.width,width:e.width,height:e.height}}function od(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function sd(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?od(Object(n),!0).forEach(function(t){cd(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):od(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function cd(e,t,n){return(t=ld(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ld(e){var t=ud(e,`string`);return typeof t==`symbol`?t:t+``}function ud(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}var dd=e=>{var t=e.viewBox,n=e.position,r=e.offset,i=r===void 0?0:r,a=e.parentViewBox,o=e.clamp,s=ad(t),c=s.x,l=s.y,u=s.height,d=s.upperWidth,f=s.lowerWidth,p=c,m=c+(d-f)/2,h=(p+m)/2,g=(d+f)/2,_=p+d/2,v=u>=0?1:-1,y=v*i,b=v>0?`end`:`start`,x=v>0?`start`:`end`,S=d>=0?1:-1,C=S*i,w=S>0?`end`:`start`,T=S>0?`start`:`end`,E=a;if(n===`top`){var D={x:p+d/2,y:l-y,horizontalAnchor:`middle`,verticalAnchor:b};return o&&E&&(D.height=Math.max(l-E.y,0),D.width=d),D}if(n===`bottom`){var O={x:m+f/2,y:l+u+y,horizontalAnchor:`middle`,verticalAnchor:x};return o&&E&&(O.height=Math.max(E.y+E.height-(l+u),0),O.width=f),O}if(n===`left`){var k={x:h-C,y:l+u/2,horizontalAnchor:w,verticalAnchor:`middle`};return o&&E&&(k.width=Math.max(k.x-E.x,0),k.height=u),k}if(n===`right`){var A={x:h+g+C,y:l+u/2,horizontalAnchor:T,verticalAnchor:`middle`};return o&&E&&(A.width=Math.max(E.x+E.width-A.x,0),A.height=u),A}var j=o&&E?{width:g,height:u}:{};return n===`insideLeft`?sd({x:h+C,y:l+u/2,horizontalAnchor:T,verticalAnchor:`middle`},j):n===`insideRight`?sd({x:h+g-C,y:l+u/2,horizontalAnchor:w,verticalAnchor:`middle`},j):n===`insideTop`?sd({x:p+d/2,y:l+y,horizontalAnchor:`middle`,verticalAnchor:x},j):n===`insideBottom`?sd({x:m+f/2,y:l+u-y,horizontalAnchor:`middle`,verticalAnchor:b},j):n===`insideTopLeft`?sd({x:p+C,y:l+y,horizontalAnchor:T,verticalAnchor:x},j):n===`insideTopRight`?sd({x:p+d-C,y:l+y,horizontalAnchor:w,verticalAnchor:x},j):n===`insideBottomLeft`?sd({x:m+C,y:l+u-y,horizontalAnchor:T,verticalAnchor:b},j):n===`insideBottomRight`?sd({x:m+f-C,y:l+u-y,horizontalAnchor:w,verticalAnchor:b},j):n&&typeof n==`object`&&(X(n.x)||qu(n.x))&&(X(n.y)||qu(n.y))?sd({x:c+Zu(n.x,g),y:l+Zu(n.y,u),horizontalAnchor:`end`,verticalAnchor:`end`},j):sd({x:_,y:l+u/2,horizontalAnchor:`middle`,verticalAnchor:`middle`},j)},fd=[`top`,`left`,`right`,`bottom`];function pd(e){return e==null?!1:typeof e==`object`||fd.includes(e)}var md=(0,f.createContext)(null);function hd(e){return function(){return e}}var gd=Math.PI,_d=2*gd,vd=1e-6,yd=_d-vd;function bd(e){this._+=e[0];for(let t=1,n=e.length;t<n;++t)this._+=arguments[t]+e[t]}function Z(e){let t=Math.floor(e);if(!(t>=0))throw Error(`invalid digits: ${e}`);if(t>15)return bd;let n=10**t;return function(e){this._+=e[0];for(let t=1,r=e.length;t<r;++t)this._+=Math.round(arguments[t]*n)/n+e[t]}}var xd=class{constructor(e){this._x0=this._y0=this._x1=this._y1=null,this._=``,this._append=e==null?bd:Z(e)}moveTo(e,t){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+t}`}closePath(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._append`Z`)}lineTo(e,t){this._append`L${this._x1=+e},${this._y1=+t}`}quadraticCurveTo(e,t,n,r){this._append`Q${+e},${+t},${this._x1=+n},${this._y1=+r}`}bezierCurveTo(e,t,n,r,i,a){this._append`C${+e},${+t},${+n},${+r},${this._x1=+i},${this._y1=+a}`}arcTo(e,t,n,r,i){if(e=+e,t=+t,n=+n,r=+r,i=+i,i<0)throw Error(`negative radius: ${i}`);let a=this._x1,o=this._y1,s=n-e,c=r-t,l=a-e,u=o-t,d=l*l+u*u;if(this._x1===null)this._append`M${this._x1=e},${this._y1=t}`;else if(d>vd){if(!(Math.abs(u*s-c*l)>vd)||!i)this._append`L${this._x1=e},${this._y1=t}`;else{let f=n-a,p=r-o,m=s*s+c*c,h=f*f+p*p,g=Math.sqrt(m),_=Math.sqrt(d),v=i*Math.tan((gd-Math.acos((m+d-h)/(2*g*_)))/2),y=v/_,b=v/g;Math.abs(y-1)>vd&&this._append`L${e+y*l},${t+y*u}`,this._append`A${i},${i},0,0,${+(u*f>l*p)},${this._x1=e+b*s},${this._y1=t+b*c}`}}}arc(e,t,n,r,i,a){if(e=+e,t=+t,n=+n,a=!!a,n<0)throw Error(`negative radius: ${n}`);let o=n*Math.cos(r),s=n*Math.sin(r),c=e+o,l=t+s,u=1^a,d=a?r-i:i-r;this._x1===null?this._append`M${c},${l}`:(Math.abs(this._x1-c)>vd||Math.abs(this._y1-l)>vd)&&this._append`L${c},${l}`,n&&(d<0&&(d=d%_d+_d),d>yd?this._append`A${n},${n},0,1,${u},${e-o},${t-s}A${n},${n},0,1,${u},${this._x1=c},${this._y1=l}`:d>vd&&this._append`A${n},${n},0,${+(d>=gd)},${u},${this._x1=e+n*Math.cos(i)},${this._y1=t+n*Math.sin(i)}`)}rect(e,t,n,r){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+t}h${n=+n}v${+r}h${-n}Z`}toString(){return this._}};xd.prototype;function Sd(e){let t=3;return e.digits=function(n){if(!arguments.length)return t;if(n==null)t=null;else{let e=Math.floor(n);if(!(e>=0))throw RangeError(`invalid digits: ${n}`);t=e}return e},()=>new xd(t)}Array.prototype.slice;function Cd(e){return typeof e==`object`&&`length`in e?e:Array.from(e)}function wd(e){this._context=e}wd.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._context.lineTo(e,t)}}};function Td(e){return new wd(e)}function Ed(e){return e[0]}function Dd(e){return e[1]}function Od(e,t){var n=hd(!0),r=null,i=Td,a=null,o=Sd(s);e=typeof e==`function`?e:e===void 0?Ed:hd(e),t=typeof t==`function`?t:t===void 0?Dd:hd(t);function s(s){var c,l=(s=Cd(s)).length,u,d=!1,f;for(r??(a=i(f=o())),c=0;c<=l;++c)!(c<l&&n(u=s[c],c,s))===d&&((d=!d)?a.lineStart():a.lineEnd()),d&&a.point(+e(u,c,s),+t(u,c,s));if(f)return a=null,f+``||null}return s.x=function(t){return arguments.length?(e=typeof t==`function`?t:hd(+t),s):e},s.y=function(e){return arguments.length?(t=typeof e==`function`?e:hd(+e),s):t},s.defined=function(e){return arguments.length?(n=typeof e==`function`?e:hd(!!e),s):n},s.curve=function(e){return arguments.length?(i=e,r!=null&&(a=i(r)),s):i},s.context=function(e){return arguments.length?(e==null?r=a=null:a=i(r=e),s):r},s}function kd(e,t,n){var r=null,i=hd(!0),a=null,o=Td,s=null,c=Sd(l);e=typeof e==`function`?e:e===void 0?Ed:hd(+e),t=typeof t==`function`?t:hd(t===void 0?0:+t),n=typeof n==`function`?n:n===void 0?Dd:hd(+n);function l(l){var u,d,f,p=(l=Cd(l)).length,m,h=!1,g,_=Array(p),v=Array(p);for(a??(s=o(g=c())),u=0;u<=p;++u){if(!(u<p&&i(m=l[u],u,l))===h){if(h=!h)d=u,s.areaStart(),s.lineStart();else{for(s.lineEnd(),s.lineStart(),f=u-1;f>=d;--f)s.point(_[f],v[f]);s.lineEnd(),s.areaEnd()}}h&&(_[u]=+e(m,u,l),v[u]=+t(m,u,l),s.point(r?+r(m,u,l):_[u],n?+n(m,u,l):v[u]))}if(g)return s=null,g+``||null}function u(){return Od().defined(i).curve(o).context(a)}return l.x=function(t){return arguments.length?(e=typeof t==`function`?t:hd(+t),r=null,l):e},l.x0=function(t){return arguments.length?(e=typeof t==`function`?t:hd(+t),l):e},l.x1=function(e){return arguments.length?(r=e==null?null:typeof e==`function`?e:hd(+e),l):r},l.y=function(e){return arguments.length?(t=typeof e==`function`?e:hd(+e),n=null,l):t},l.y0=function(e){return arguments.length?(t=typeof e==`function`?e:hd(+e),l):t},l.y1=function(e){return arguments.length?(n=e==null?null:typeof e==`function`?e:hd(+e),l):n},l.lineX0=l.lineY0=function(){return u().x(e).y(t)},l.lineY1=function(){return u().x(e).y(n)},l.lineX1=function(){return u().x(r).y(t)},l.defined=function(e){return arguments.length?(i=typeof e==`function`?e:hd(!!e),l):i},l.curve=function(e){return arguments.length?(o=e,a!=null&&(s=o(a)),l):o},l.context=function(e){return arguments.length?(e==null?a=s=null:s=o(a=e),l):a},l}var Ad=class{constructor(e,t){this._context=e,this._x=t}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line}point(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._x?this._context.bezierCurveTo(this._x0=(this._x0+e)/2,this._y0,this._x0,t,e,t):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+t)/2,e,this._y0,e,t)}this._x0=e,this._y0=t}};function jd(e){return new Ad(e,!0)}function Md(e){return new Ad(e,!1)}function Nd(){}function Pd(e,t,n){e._context.bezierCurveTo((2*e._x0+e._x1)/3,(2*e._y0+e._y1)/3,(e._x0+2*e._x1)/3,(e._y0+2*e._y1)/3,(e._x0+4*e._x1+t)/6,(e._y0+4*e._y1+n)/6)}function Fd(e){this._context=e}Fd.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:Pd(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1)}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:Pd(this,e,t)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function Id(e){return new Fd(e)}function Ld(e){this._context=e}Ld.prototype={areaStart:Nd,areaEnd:Nd,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x2,this._y2),this._context.closePath();break;case 2:this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break;case 3:this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4)}},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._x2=e,this._y2=t;break;case 1:this._point=2,this._x3=e,this._y3=t;break;case 2:this._point=3,this._x4=e,this._y4=t,this._context.moveTo((this._x0+4*this._x1+e)/6,(this._y0+4*this._y1+t)/6);break;default:Pd(this,e,t)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function Rd(e){return new Ld(e)}function zd(e){this._context=e}zd.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var n=(this._x0+4*this._x1+e)/6,r=(this._y0+4*this._y1+t)/6;this._line?this._context.lineTo(n,r):this._context.moveTo(n,r);break;case 3:this._point=4;default:Pd(this,e,t)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function Bd(e){return new zd(e)}function Vd(e){this._context=e}Vd.prototype={areaStart:Nd,areaEnd:Nd,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(e,t){e=+e,t=+t,this._point?this._context.lineTo(e,t):(this._point=1,this._context.moveTo(e,t))}};function Hd(e){return new Vd(e)}function Ud(e){return e<0?-1:1}function Wd(e,t,n){var r=e._x1-e._x0,i=t-e._x1,a=(e._y1-e._y0)/(r||i<0&&-0),o=(n-e._y1)/(i||r<0&&-0),s=(a*i+o*r)/(r+i);return(Ud(a)+Ud(o))*Math.min(Math.abs(a),Math.abs(o),.5*Math.abs(s))||0}function Gd(e,t){var n=e._x1-e._x0;return n?(3*(e._y1-e._y0)/n-t)/2:t}function Kd(e,t,n){var r=e._x0,i=e._y0,a=e._x1,o=e._y1,s=(a-r)/3;e._context.bezierCurveTo(r+s,i+s*t,a-s,o-s*n,a,o)}function qd(e){this._context=e}qd.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:Kd(this,this._t0,Gd(this,this._t0))}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){var n=NaN;if(e=+e,t=+t,e!==this._x1||t!==this._y1){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,Kd(this,Gd(this,n=Wd(this,e,t)),n);break;default:Kd(this,this._t0,n=Wd(this,e,t))}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=n}}};function Jd(e){this._context=new Yd(e)}(Jd.prototype=Object.create(qd.prototype)).point=function(e,t){qd.prototype.point.call(this,t,e)};function Yd(e){this._context=e}Yd.prototype={moveTo:function(e,t){this._context.moveTo(t,e)},closePath:function(){this._context.closePath()},lineTo:function(e,t){this._context.lineTo(t,e)},bezierCurveTo:function(e,t,n,r,i,a){this._context.bezierCurveTo(t,e,r,n,a,i)}};function Xd(e){return new qd(e)}function Zd(e){return new Jd(e)}function Qd(e){this._context=e}Qd.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var e=this._x,t=this._y,n=e.length;if(n){if(this._line?this._context.lineTo(e[0],t[0]):this._context.moveTo(e[0],t[0]),n===2)this._context.lineTo(e[1],t[1]);else for(var r=$d(e),i=$d(t),a=0,o=1;o<n;++a,++o)this._context.bezierCurveTo(r[0][a],i[0][a],r[1][a],i[1][a],e[o],t[o])}(this._line||this._line!==0&&n===1)&&this._context.closePath(),this._line=1-this._line,this._x=this._y=null},point:function(e,t){this._x.push(+e),this._y.push(+t)}};function $d(e){var t,n=e.length-1,r,i=Array(n),a=Array(n),o=Array(n);for(i[0]=0,a[0]=2,o[0]=e[0]+2*e[1],t=1;t<n-1;++t)i[t]=1,a[t]=4,o[t]=4*e[t]+2*e[t+1];for(i[n-1]=2,a[n-1]=7,o[n-1]=8*e[n-1]+e[n],t=1;t<n;++t)r=i[t]/a[t-1],a[t]-=r,o[t]-=r*o[t-1];for(i[n-1]=o[n-1]/a[n-1],t=n-2;t>=0;--t)i[t]=(o[t]-i[t+1])/a[t];for(a[n-1]=(e[n]+i[n-1])/2,t=0;t<n-1;++t)a[t]=2*e[t+1]-i[t+1];return[i,a]}function ef(e){return new Qd(e)}function tf(e,t){this._context=e,this._t=t}tf.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=this._y=NaN,this._point=0},lineEnd:function(){0<this._t&&this._t<1&&this._point===2&&this._context.lineTo(this._x,this._y),(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line>=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:if(this._t<=0)this._context.lineTo(this._x,t),this._context.lineTo(e,t);else{var n=this._x*(1-this._t)+e*this._t;this._context.lineTo(n,this._y),this._context.lineTo(n,t)}}this._x=e,this._y=t}};function nf(e){return new tf(e,.5)}function rf(e){return new tf(e,0)}function af(e){return new tf(e,1)}function of(e,t){if((o=e.length)>1)for(var n=1,r,i,a=e[t[0]],o,s=a.length;n<o;++n)for(i=a,a=e[t[n]],r=0;r<s;++r)a[r][1]+=a[r][0]=isNaN(i[r][1])?i[r][0]:i[r][1]}function sf(e){for(var t=e.length,n=Array(t);--t>=0;)n[t]=t;return n}function cf(e,t){return e[t]}function lf(e){let t=[];return t.key=e,t}function uf(){var e=hd([]),t=sf,n=of,r=cf;function i(i){var a=Array.from(e.apply(this,arguments),lf),o,s=a.length,c=-1,l;for(let e of i)for(o=0,++c;o<s;++o)(a[o][c]=[0,+r(e,a[o].key,c,i)]).data=e;for(o=0,l=Cd(t(a));o<s;++o)a[l[o]].index=o;return n(a,l),a}return i.keys=function(t){return arguments.length?(e=typeof t==`function`?t:hd(Array.from(t)),i):e},i.value=function(e){return arguments.length?(r=typeof e==`function`?e:hd(+e),i):r},i.order=function(e){return arguments.length?(t=e==null?sf:typeof e==`function`?e:hd(Array.from(e)),i):t},i.offset=function(e){return arguments.length?(n=e??of,i):n},i}function df(e,t){if((r=e.length)>0){for(var n,r,i=0,a=e[0].length,o;i<a;++i){for(o=n=0;n<r;++n)o+=e[n][i][1]||0;if(o)for(n=0;n<r;++n)e[n][i][1]/=o}of(e,t)}}function ff(e,t){if((i=e.length)>0){for(var n=0,r=e[t[0]],i,a=r.length;n<a;++n){for(var o=0,s=0;o<i;++o)s+=e[o][n][1]||0;r[n][1]+=r[n][0]=-s/2}of(e,t)}}function pf(e,t){if(!(!((o=e.length)>0)||!((a=(i=e[t[0]]).length)>0))){for(var n=0,r=1,i,a,o;r<a;++r){for(var s=0,c=0,l=0;s<o;++s){for(var u=e[t[s]],d=u[r][1]||0,f=(d-(u[r-1][1]||0))/2,p=0;p<s;++p){var m=e[t[p]],h=m[r][1]||0,g=m[r-1][1]||0;f+=h-g}c+=d,l+=f*d}i[r-1][1]+=i[r-1][0]=n,c&&(n-=l/c)}i[r-1][1]+=i[r-1][0]=n,of(e,t)}}var mf=e=>`radius`in e&&`startAngle`in e&&`endAngle`in e,hf=(e,t)=>{if(!e||typeof e==`function`||typeof e==`boolean`)return null;var n=e;if((0,f.isValidElement)(e)&&(n=e.props),typeof n!=`object`&&typeof n!=`function`)return null;var r={};return Object.keys(n).forEach(e=>{Tu(e)&&typeof n[e]==`function`&&(r[e]=t||(t=>n[e](n,t)))}),r},gf=(e,t,n)=>r=>(e(t,n,r),null),_f=(e,t,n)=>{if(e===null||typeof e!=`object`&&typeof e!=`function`)return null;var r=null;return Object.keys(e).forEach(i=>{var a=e[i];Tu(i)&&typeof a==`function`&&(r||={},r[i]=gf(a,t,n))}),r};function vf(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function yf(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?vf(Object(n),!0).forEach(function(t){bf(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):vf(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function bf(e,t,n){return(t=xf(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function xf(e){var t=Sf(e,`string`);return typeof t==`symbol`?t:t+``}function Sf(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function Cf(e,t){var n=yf({},e),r=t;return Object.keys(t).reduce((e,t)=>(e[t]===void 0&&r[t]!==void 0&&(e[t]=r[t]),e),n)}function wf(e,t,n){return t===!0?Jn(e,n):typeof t==`function`?Jn(e,t):e}var Tf=o((e=>{var t=d();function n(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var r=typeof Object.is==`function`?Object.is:n,i=t.useState,a=t.useEffect,o=t.useLayoutEffect,s=t.useDebugValue;function c(e,t){var n=t(),r=i({inst:{value:n,getSnapshot:t}}),c=r[0].inst,u=r[1];return o(function(){c.value=n,c.getSnapshot=t,l(c)&&u({inst:c})},[e,n,t]),a(function(){return l(c)&&u({inst:c}),e(function(){l(c)&&u({inst:c})})},[e]),s(n),n}function l(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!r(e,n)}catch{return!0}}function u(e,t){return t()}var f=typeof window>`u`||window.document===void 0||window.document.createElement===void 0?u:c;e.useSyncExternalStore=t.useSyncExternalStore===void 0?f:t.useSyncExternalStore})),Ef=o(((e,t)=>{t.exports=Tf()})),Df=o((e=>{var t=d(),n=Ef();function r(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var i=typeof Object.is==`function`?Object.is:r,a=n.useSyncExternalStore,o=t.useRef,s=t.useEffect,c=t.useMemo,l=t.useDebugValue;e.useSyncExternalStoreWithSelector=function(e,t,n,r,u){var d=o(null);if(d.current===null){var f={hasValue:!1,value:null};d.current=f}else f=d.current;d=c(function(){function e(e){if(!a){if(a=!0,o=e,e=r(e),u!==void 0&&f.hasValue){var t=f.value;if(u(t,e))return s=t}return s=e}if(t=s,i(o,e))return t;var n=r(e);return u!==void 0&&u(t,n)?(o=e,t):(o=e,s=n)}var a=!1,o,s,c=n===void 0?null:n;return[function(){return e(t())},c===null?void 0:function(){return e(c())}]},[t,n,r,u]);var p=a(e,d[0],d[1]);return s(function(){f.hasValue=!0,f.value=p},[p]),l(p),p}})),Of=o(((e,t)=>{t.exports=Df()})),kf=(0,f.createContext)(null),Af=Of(),jf=e=>e,Mf=()=>{var e=(0,f.useContext)(kf);return e?e.store.dispatch:jf},Nf=()=>{},Pf=()=>Nf,Ff=(e,t)=>e===t;function Q(e){var t=(0,f.useContext)(kf),n=(0,f.useMemo)(()=>t?t=>{if(t!=null)return e(t)}:Nf,[t,e]);return(0,Af.useSyncExternalStoreWithSelector)(t?t.subscription.addNestedSub:Pf,t?t.store.getState:Nf,t?t.store.getState:Nf,n,Ff)}function If(e,t=`expected a function, instead received ${typeof e}`){if(typeof e!=`function`)throw TypeError(t)}function Lf(e,t=`expected all items to be functions, instead received the following types: `){if(!e.every(e=>typeof e==`function`)){let n=e.map(e=>typeof e==`function`?`function ${e.name||`unnamed`}()`:typeof e).join(`, `);throw TypeError(`${t}[${n}]`)}}var Rf=e=>Array.isArray(e)?e:[e];function zf(e){let t=Array.isArray(e[0])?e[0]:e;return Lf(t,`createSelector expects all input-selectors to be functions, but received the following types: `),t}function Bf(e,t){let n=[],{length:r}=e;for(let i=0;i<r;i++)n.push(e[i].apply(null,t));return n}var Vf=class{constructor(e){this.value=e}deref(){return this.value}},Hf=typeof WeakRef>`u`?Vf:WeakRef,Uf=0,Wf=1;function Gf(){return{s:Uf,v:void 0,o:null,p:null}}function Kf(e){return e instanceof Hf?e.deref():e}function qf(e,t={}){let n=Gf(),{resultEqualityCheck:r}=t,i,a=0;function o(){let t=n,{length:o}=arguments;for(let e=0,n=o;e<n;e++){let n=arguments[e];if(typeof n==`function`||typeof n==`object`&&n){let e=t.o;e===null&&(t.o=e=new WeakMap);let r=e.get(n);r===void 0?(t=Gf(),e.set(n,t)):t=r}else{let e=t.p;e===null&&(t.p=e=new Map);let r=e.get(n);r===void 0?(t=Gf(),e.set(n,t)):t=r}}let s=t,c;if(t.s===Wf)c=t.v;else if(c=e.apply(null,arguments),a++,r){let e=Kf(i);e!=null&&r(e,c)&&(c=e,a!==0&&a--),i=typeof c==`object`&&c||typeof c==`function`?new Hf(c):c}return s.s=Wf,s.v=c,c}return o.clearCache=()=>{n=Gf(),o.resetResultsCount()},o.resultsCount=()=>a,o.resetResultsCount=()=>{a=0},o}function Jf(e,...t){let n=typeof e==`function`?{memoize:e,memoizeOptions:t}:e,r=(...e)=>{let t=0,r=0,i,a={},o=e.pop();typeof o==`object`&&(a=o,o=e.pop()),If(o,`createSelector expects an output function after the inputs, but received: [${typeof o}]`);let{memoize:s,memoizeOptions:c=[],argsMemoize:l=qf,argsMemoizeOptions:u=[]}={...n,...a},d=Rf(c),f=Rf(u),p=zf(e),m=s(function(){return t++,o.apply(null,arguments)},...d),h=l(function(){r++;let e=Bf(p,arguments);return i=m.apply(null,e),i},...f);return Object.assign(h,{resultFunc:o,memoizedResultFunc:m,dependencies:p,dependencyRecomputations:()=>r,resetDependencyRecomputations:()=>{r=0},lastResult:()=>i,recomputations:()=>t,resetRecomputations:()=>{t=0},memoize:s,argsMemoize:l})};return Object.assign(r,{withTypes:()=>r}),r}var $=Jf(qf),Yf=e=>e.legend.settings,Xf=e=>e.legend.size;$([e=>e.legend.payload,Yf],(e,t)=>{var n=t.itemSorter,r=e.flat(1);return n?qn(r,n):r});function Zf(e,t){return np(e)||tp(e,t)||$f(e,t)||Qf()}function Qf(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
103
+ `,document.head.appendChild(t)}}function xl({lines:e=3,lastWidth:t=`60%`}){return(0,b.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:8},children:Array.from({length:e}).map((n,r)=>(0,b.jsx)(bl,{width:r===e-1?t:`100%`,height:13},r))})}function Sl(){return(0,b.jsxs)(`div`,{style:{background:`var(--bg2)`,border:`1px solid var(--line)`,borderRadius:`var(--radius)`,padding:`14px 16px`,display:`flex`,flexDirection:`column`,gap:8},children:[(0,b.jsx)(bl,{width:80,height:11}),(0,b.jsx)(bl,{width:60,height:28,borderRadius:8}),(0,b.jsx)(bl,{width:100,height:11})]})}function Cl({count:e=6,columns:t=3}){return(0,b.jsx)(`div`,{style:{display:`grid`,gridTemplateColumns:`repeat(${t}, 1fr)`,gap:12},children:Array.from({length:e}).map((e,t)=>(0,b.jsx)(Sl,{},t))})}function wl({rows:e=5,cols:t=4}){return(0,b.jsxs)(`div`,{style:{padding:`0 0 8px`},children:[(0,b.jsx)(`div`,{style:{display:`grid`,gridTemplateColumns:`repeat(${t}, 1fr)`,gap:12,padding:`10px 16px`,borderBottom:`1px solid var(--line)`},children:Array.from({length:t}).map((e,t)=>(0,b.jsx)(bl,{height:11,width:`50%`},t))}),Array.from({length:e}).map((e,n)=>(0,b.jsx)(`div`,{style:{display:`grid`,gridTemplateColumns:`repeat(${t}, 1fr)`,gap:12,padding:`12px 16px`,borderBottom:`1px solid var(--line)`},children:Array.from({length:t}).map((e,n)=>(0,b.jsx)(bl,{height:13,width:n===0?`80%`:n===t-1?`40%`:`65%`},n))},n))]})}function Tl({rows:e=5,cols:t=4}){return(0,b.jsxs)(`div`,{style:{background:`var(--bg2)`,border:`1px solid var(--line)`,borderRadius:`var(--radius)`,overflow:`hidden`},children:[(0,b.jsx)(`div`,{style:{padding:`12px 16px`,borderBottom:`1px solid var(--line)`},children:(0,b.jsx)(bl,{width:200,height:13})}),(0,b.jsx)(wl,{rows:e,cols:t})]})}function El(){return(0,b.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:20},children:[(0,b.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:12},children:[(0,b.jsx)(bl,{width:44,height:44,borderRadius:`50%`}),(0,b.jsxs)(`div`,{style:{flex:1,display:`flex`,flexDirection:`column`,gap:6},children:[(0,b.jsx)(bl,{width:`60%`,height:14}),(0,b.jsx)(bl,{width:`40%`,height:11})]})]}),(0,b.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:8},children:[(0,b.jsx)(bl,{width:80,height:10}),(0,b.jsx)(bl,{height:32,borderRadius:8})]}),(0,b.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:8},children:[(0,b.jsx)(bl,{width:80,height:10}),(0,b.jsx)(xl,{lines:3,lastWidth:`50%`})]})]})}function Dl(e){return e.includes(`login`)||e.includes(`signin`)||e.includes(`success`)?`badge-green`:e.includes(`fail`)||e.includes(`error`)||e.includes(`locked`)||e.includes(`block`)?`badge-red`:e.includes(`register`)||e.includes(`signup`)||e.includes(`created`)?`badge-accent`:e.includes(`settings`)||e.includes(`admin`)||e.includes(`updated`)?`badge-amber`:`badge-muted`}var Ol=30;function kl({typeFilter:e,page:t,onPage:n,selected:r,onSelect:i,onUnavailable:a}){let[o,s]=(0,f.useState)(!1),{data:c,isLoading:l,error:u,refetch:d}=z({...Vs({type:e||void 0,page:t,size:Ol}),retry:(e,t)=>t&&typeof t==`object`&&`status`in t&&t.status===404?(o||(s(!0),a()),!1):e<1}),p=c?.data??[],m=c?.meta.total??0,h=u&&typeof u==`object`&&`status`in u&&u.status===404;return(0,b.jsx)(`div`,{className:`panel`,children:(0,b.jsx)(vl,{isLoading:l,error:u&&!h?u:void 0,onRetry:d,skeleton:(0,b.jsx)(Tl,{rows:8,cols:4}),children:p.length===0?(0,b.jsxs)(`div`,{className:`empty-state`,children:[(0,b.jsx)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,children:(0,b.jsx)(`path`,{d:`M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2`,strokeLinecap:`round`})}),(0,b.jsx)(`h4`,{children:`No events found`}),(0,b.jsx)(`p`,{children:e?`No events match this filter`:`No audit events recorded yet`})]}):(0,b.jsxs)(`div`,{className:`tbl-wrap`,children:[(0,b.jsxs)(`table`,{children:[(0,b.jsx)(`thead`,{children:(0,b.jsxs)(`tr`,{children:[(0,b.jsx)(`th`,{children:`Type`}),(0,b.jsx)(`th`,{children:`Account`}),(0,b.jsx)(`th`,{children:`IP`}),(0,b.jsx)(`th`,{children:`When`})]})}),(0,b.jsx)(`tbody`,{children:p.map(e=>(0,b.jsxs)(`tr`,{onClick:()=>i(r?.id===e.id?null:e),children:[(0,b.jsx)(`td`,{children:(0,b.jsx)(`span`,{className:`badge ${Dl(e.type)}`,children:e.type})}),(0,b.jsx)(`td`,{children:(0,b.jsx)(`span`,{style:{fontFamily:`var(--mono)`,fontSize:11.5},children:e.email??e.accountId??(0,b.jsx)(`span`,{style:{color:`var(--faint)`},children:`—`})})}),(0,b.jsx)(`td`,{children:(0,b.jsx)(`span`,{className:`code`,children:e.ip??`—`})}),(0,b.jsx)(`td`,{children:(0,b.jsx)(`span`,{style:{fontFamily:`var(--mono)`,fontSize:11,color:`var(--faint)`},children:e.createdAt?new Date(e.createdAt).toLocaleString():`—`})})]},e.id))})]}),(0,b.jsx)(`div`,{style:{padding:`0 16px 12px`},children:(0,b.jsx)(fl,{page:t,total:m,size:Ol,onPage:n})})]})})})}function Al({event:e,onClose:t}){return(0,b.jsxs)(`div`,{className:`panel`,style:{padding:`14px 16px`},children:[(0,b.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,alignItems:`center`,marginBottom:10},children:[(0,b.jsx)(`div`,{style:{fontWeight:600,fontSize:13},children:`Event Detail`}),(0,b.jsx)(`button`,{className:`btn btn-ghost btn-sm`,onClick:t,children:(0,b.jsx)(`svg`,{viewBox:`0 0 16 16`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,children:(0,b.jsx)(`path`,{d:`M3 3l10 10M13 3L3 13`,strokeLinecap:`round`})})})]}),(0,b.jsx)(`pre`,{style:{fontFamily:`var(--mono)`,fontSize:11.5,color:`var(--muted)`,overflow:`auto`,lineHeight:1.6},children:JSON.stringify(e,null,2)})]})}var jl=[``,`login.success`,`login.failed`,`login.mfa_required`,`logout`,`register`,`password_reset`,`settings.updated`,`client.created`,`client.deleted`,`account.disabled`,`account.enabled`];function Ml(){let[e,t]=rl(`page`,qc.withDefault(1)),[n,r]=rl(`type`,Kc.withDefault(``)),[i,a]=(0,f.useState)(null),[o,s]=(0,f.useState)(!1);return o?(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`div`,{className:`page-title`,style:{marginBottom:8},children:`Audit Log`}),(0,b.jsx)(`div`,{className:`error-box`,children:`Audit log is not configured. Add an audit sink to your AuthKit config.`})]}):(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`div`,{className:`page-header-row`,children:(0,b.jsx)(`div`,{children:(0,b.jsx)(`div`,{className:`page-title`,children:`Audit Log`})})}),(0,b.jsx)(`div`,{className:`panel`,style:{marginBottom:0},children:(0,b.jsx)(`div`,{className:`panel-head`,children:(0,b.jsx)(`select`,{className:`input`,style:{width:240},value:n,onChange:e=>{r(e.target.value),t(1)},children:jl.map(e=>(0,b.jsx)(`option`,{value:e,children:e||`All event types`},e))})})}),(0,b.jsx)(kl,{typeFilter:n,page:e,onPage:t,selected:i,onSelect:a,onUnavailable:()=>s(!0)}),i&&(0,b.jsx)(`div`,{style:{marginTop:12},children:(0,b.jsx)(Al,{event:i,onClose:()=>a(null)})})]})}function Nl({open:e,onClose:t,title:n,children:r,footer:i,large:a}){return(0,f.useEffect)(()=>{if(!e)return;let n=e=>{e.key===`Escape`&&t()};return window.addEventListener(`keydown`,n),()=>window.removeEventListener(`keydown`,n)},[e,t]),e?(0,b.jsx)(`div`,{className:`modal-overlay`,onClick:t,children:(0,b.jsxs)(`div`,{className:`modal${a?` modal-lg`:``}`,onClick:e=>e.stopPropagation(),children:[(0,b.jsxs)(`div`,{className:`modal-head`,children:[(0,b.jsx)(`h2`,{children:n}),(0,b.jsx)(`button`,{className:`modal-close`,onClick:t,children:(0,b.jsx)(`svg`,{viewBox:`0 0 16 16`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,children:(0,b.jsx)(`path`,{d:`M3 3l10 10M13 3L3 13`,strokeLinecap:`round`})})})]}),(0,b.jsx)(`div`,{className:`modal-body`,children:r}),i&&(0,b.jsx)(`div`,{className:`modal-foot`,children:i})]})}):null}function Pl(){return(0,b.jsxs)(`div`,{style:{background:`var(--bg2)`,border:`1px solid var(--line)`,borderRadius:`var(--radius)`,padding:`14px 16px`,display:`flex`,flexDirection:`column`,gap:8},children:[(0,b.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8},children:[(0,b.jsx)(bl,{width:`30%`,height:13}),(0,b.jsx)(bl,{width:60,height:18,borderRadius:20})]}),(0,b.jsxs)(`div`,{style:{display:`flex`,gap:6},children:[(0,b.jsx)(bl,{width:100,height:18,borderRadius:20}),(0,b.jsx)(bl,{width:80,height:18,borderRadius:20})]}),(0,b.jsx)(bl,{width:`50%`,height:11})]})}function Fl(){return(0,b.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:10},children:[1,2,3].map(e=>(0,b.jsx)(Pl,{},e))})}function Il({onEdit:e,onDelete:t,onRegenerate:n}){let{data:r,isLoading:i,error:a,refetch:o}=z(Es()),s=r?.data??[],c=r?.canList??!0;return(0,b.jsx)(vl,{isLoading:i,error:a,onRetry:o,skeleton:(0,b.jsx)(Fl,{}),children:c?s.length===0?(0,b.jsxs)(`div`,{className:`empty-state`,children:[(0,b.jsxs)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,children:[(0,b.jsx)(`path`,{d:`M18 13l4-3.5L18 6`,strokeLinecap:`round`,strokeLinejoin:`round`}),(0,b.jsx)(`path`,{d:`M22 9.5H9M6 5H4a1 1 0 00-1 1v12a1 1 0 001 1h2`,strokeLinecap:`round`})]}),(0,b.jsx)(`h4`,{children:`No clients yet`}),(0,b.jsx)(`p`,{children:`Create an OAuth 2.0 / OIDC client to get started`})]}):(0,b.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:10},children:s.map(r=>(0,b.jsx)(`div`,{className:`panel`,style:{padding:`14px 16px`},children:(0,b.jsxs)(`div`,{style:{display:`flex`,alignItems:`flex-start`,gap:14},children:[(0,b.jsxs)(`div`,{style:{flex:1},children:[(0,b.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,marginBottom:6},children:[(0,b.jsx)(`span`,{style:{fontFamily:`var(--mono)`,fontWeight:600,fontSize:13,color:`var(--text)`},children:r.clientId}),(0,b.jsx)(`span`,{className:`badge ${r.confidential?`badge-accent`:`badge-muted`}`,children:r.confidential?`confidential`:`public`})]}),(0,b.jsx)(`div`,{style:{display:`flex`,flexWrap:`wrap`,gap:4,marginBottom:6},children:r.grants.map(e=>(0,b.jsx)(`span`,{className:`badge badge-muted`,children:e},e))}),r.redirectUris.length>0&&(0,b.jsx)(`div`,{style:{fontSize:11,color:`var(--faint)`,display:`flex`,flexWrap:`wrap`,gap:4},children:r.redirectUris.map(e=>(0,b.jsx)(`span`,{className:`code`,children:e},e))})]}),(0,b.jsxs)(`div`,{style:{display:`flex`,gap:6,flexShrink:0},children:[(0,b.jsx)(`button`,{className:`btn btn-sm`,onClick:()=>e(r),children:`Edit`}),(0,b.jsx)(`button`,{className:`btn btn-sm`,onClick:()=>n(r),title:`Regenerate secret`,children:(0,b.jsxs)(`svg`,{viewBox:`0 0 16 16`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.8`,children:[(0,b.jsx)(`path`,{d:`M2 8a6 6 0 016-6 6 6 0 014.24 1.76L14 5`,strokeLinecap:`round`}),(0,b.jsx)(`path`,{d:`M14 2v3h-3M14 8a6 6 0 01-6 6 6 6 0 01-4.24-1.76L2 11`,strokeLinecap:`round`}),(0,b.jsx)(`path`,{d:`M2 14v-3h3`,strokeLinecap:`round`})]})}),(0,b.jsx)(`button`,{className:`btn btn-sm btn-danger`,onClick:()=>t(r),children:(0,b.jsx)(`svg`,{viewBox:`0 0 16 16`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.8`,children:(0,b.jsx)(`path`,{d:`M2 4.5h12M5.5 4.5V3h5v1.5M10.5 4.5v8a1 1 0 01-1 1h-3a1 1 0 01-1-1v-8`,strokeLinecap:`round`})})})]})]})},r.clientId))}):(0,b.jsx)(`div`,{className:`error-box`,children:`Client store does not support listing (no dynamic registration adapter configured).`})})}function Ll(){let{data:e}=z(Es());return e?.data.length??0}var Rl=(0,f.createContext)(null);function zl({children:e}){let[t,n]=(0,f.useState)([]),r=(0,f.useCallback)((e,t)=>{let r=Math.random().toString(36).slice(2);n(n=>[...n,{id:r,type:e,message:t}]),setTimeout(()=>n(e=>e.filter(e=>e.id!==r)),4e3)},[]),i={show:r,success:e=>r(`success`,e),error:e=>r(`error`,e),info:e=>r(`info`,e)};return(0,b.jsxs)(Rl.Provider,{value:i,children:[e,(0,b.jsx)(`div`,{className:`toast-container`,children:t.map(e=>(0,b.jsxs)(`div`,{className:`toast toast-${e.type}`,children:[e.type===`success`&&(0,b.jsxs)(`svg`,{viewBox:`0 0 16 16`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.8`,children:[(0,b.jsx)(`circle`,{cx:`8`,cy:`8`,r:`6.5`}),(0,b.jsx)(`path`,{d:`M5 8l2.2 2.2L11 5.5`,strokeLinecap:`round`,strokeLinejoin:`round`})]}),e.type===`error`&&(0,b.jsxs)(`svg`,{viewBox:`0 0 16 16`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.8`,children:[(0,b.jsx)(`circle`,{cx:`8`,cy:`8`,r:`6.5`}),(0,b.jsx)(`path`,{d:`M6 6l4 4M10 6l-4 4`,strokeLinecap:`round`})]}),e.type===`info`&&(0,b.jsxs)(`svg`,{viewBox:`0 0 16 16`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.8`,children:[(0,b.jsx)(`circle`,{cx:`8`,cy:`8`,r:`6.5`}),(0,b.jsx)(`path`,{d:`M8 7v4M8 5.5v.5`,strokeLinecap:`round`})]}),(0,b.jsx)(`span`,{children:e.message})]},e.id))})]})}function q(){let e=(0,f.useContext)(Rl);if(!e)throw Error(`useToast outside ToastProvider`);return e}var J=[`authorization_code`,`refresh_token`,`client_credentials`,`implicit`],Bl=[`client_secret_basic`,`client_secret_post`,`none`];function Vl(){return{clientIdOverride:``,redirectUris:[],postLogoutRedirectUris:[],grantTypes:[`authorization_code`,`refresh_token`],tokenEndpointAuthMethod:`client_secret_basic`,applicationType:`web`,backchannelLogoutUri:``,backchannelLogoutSessionRequired:!1}}function Hl(){let e=q(),t=S(),n=V(),r=Ll(),[i,a]=(0,f.useState)(!1),[o,s]=(0,f.useState)(null),[c,l]=(0,f.useState)(null),[u,d]=(0,f.useState)(Vl()),[p,m]=(0,f.useState)(``),[h,g]=(0,f.useState)(``),_=B(Ds()),v=B(Os(o?.clientId??``));function y(){d(Vl()),m(``),g(``),a(!0)}function x(e){d({clientIdOverride:``,redirectUris:[...e.redirectUris],postLogoutRedirectUris:[...e.postLogoutRedirectUris],grantTypes:[...e.grants],tokenEndpointAuthMethod:e.tokenEndpointAuthMethod,applicationType:e.applicationType??`web`,backchannelLogoutUri:e.backchannelLogoutUri??``,backchannelLogoutSessionRequired:e.backchannelLogoutSessionRequired}),m(``),g(``),s(e)}function C(e){let t=e===`redirect`?p.trim():h.trim();t&&(e===`redirect`?(d(e=>({...e,redirectUris:[...e.redirectUris,t]})),m(``)):(d(e=>({...e,postLogoutRedirectUris:[...e.postLogoutRedirectUris,t]})),g(``)))}function w(e,t){d(e===`redirect`?e=>({...e,redirectUris:e.redirectUris.filter((e,n)=>n!==t)}):e=>({...e,postLogoutRedirectUris:e.postLogoutRedirectUris.filter((e,n)=>n!==t)}))}function T(e){d(t=>({...t,grantTypes:t.grantTypes.includes(e)?t.grantTypes.filter(t=>t!==e):[...t.grantTypes,e]}))}async function E(n){n.preventDefault();try{let n={clientId:u.clientIdOverride||void 0,redirectUris:u.redirectUris,postLogoutRedirectUris:u.postLogoutRedirectUris,grantTypes:u.grantTypes,tokenEndpointAuthMethod:u.tokenEndpointAuthMethod,applicationType:u.applicationType,backchannelLogoutUri:u.backchannelLogoutUri||void 0,backchannelLogoutSessionRequired:u.backchannelLogoutSessionRequired},r=await _.mutateAsync(n);t.invalidateQueries({queryKey:K.admin.clients()}),a(!1),r.clientSecret?l({clientId:r.clientId,secret:r.clientSecret}):e.success(`Client ${r.clientId} created`)}catch(t){e.error(t instanceof Error?t.message:String(t))}}async function D(n){if(n.preventDefault(),o)try{await v.mutateAsync({redirectUris:u.redirectUris,postLogoutRedirectUris:u.postLogoutRedirectUris,grantTypes:u.grantTypes,tokenEndpointAuthMethod:u.tokenEndpointAuthMethod,applicationType:u.applicationType,backchannelLogoutUri:u.backchannelLogoutUri||void 0,backchannelLogoutSessionRequired:u.backchannelLogoutSessionRequired}),t.invalidateQueries({queryKey:K.admin.clients()}),e.success(`Client updated`),s(null)}catch(t){e.error(t instanceof Error?t.message:String(t))}}async function O(r){if(confirm(`Delete client ${r.clientId}?`))try{await n.admin.clients.remove(r.clientId),t.invalidateQueries({queryKey:K.admin.clients()}),e.success(`Client deleted`)}catch(t){e.error(t instanceof Error?t.message:String(t))}}async function k(t){if(confirm(`Regenerate secret for ${t.clientId}? Existing secret will stop working.`))try{let r=await n.admin.clients.regenerateSecret(t.clientId);r.clientSecret?l({clientId:r.clientId,secret:r.clientSecret}):e.info(`No secret returned (public client)`)}catch(t){e.error(t instanceof Error?t.message:String(t))}}let A=()=>(0,b.jsxs)(`form`,{onSubmit:o?D:E,children:[!o&&(0,b.jsxs)(`div`,{className:`field`,children:[(0,b.jsx)(`label`,{children:`Client ID (optional — auto-generated if blank)`}),(0,b.jsx)(`input`,{className:`input input-mono`,value:u.clientIdOverride,onChange:e=>d(t=>({...t,clientIdOverride:e.target.value})),placeholder:`my-app (auto if blank)`})]}),(0,b.jsxs)(`div`,{className:`field`,children:[(0,b.jsx)(`label`,{children:`Grant Types`}),(0,b.jsx)(`div`,{style:{display:`flex`,flexWrap:`wrap`,gap:6,marginTop:4},children:J.map(e=>(0,b.jsxs)(`label`,{className:`checkbox-row`,style:{padding:`4px 0`},children:[(0,b.jsx)(`input`,{type:`checkbox`,checked:u.grantTypes.includes(e),onChange:()=>T(e)}),(0,b.jsx)(`span`,{className:`chk-label mono`,children:e})]},e))})]}),(0,b.jsxs)(`div`,{className:`field`,children:[(0,b.jsx)(`label`,{children:`Application Type`}),(0,b.jsxs)(`select`,{className:`input`,value:u.applicationType,onChange:e=>{let t=e.target.value===`native`?`native`:`web`;d(e=>({...e,applicationType:t,tokenEndpointAuthMethod:t===`native`?`none`:e.tokenEndpointAuthMethod}))},children:[(0,b.jsx)(`option`,{value:`web`,children:`web`}),(0,b.jsx)(`option`,{value:`native`,children:`native (mobile / desktop app)`})]})]}),(0,b.jsxs)(`div`,{className:`field`,children:[(0,b.jsx)(`label`,{children:`Token Endpoint Auth Method`}),(0,b.jsx)(`select`,{className:`input`,value:u.tokenEndpointAuthMethod,disabled:u.applicationType===`native`,onChange:e=>d(t=>({...t,tokenEndpointAuthMethod:e.target.value})),children:Bl.map(e=>(0,b.jsx)(`option`,{value:e,children:e},e))})]}),(0,b.jsxs)(`div`,{className:`field`,children:[(0,b.jsx)(`label`,{children:`Redirect URIs`}),u.redirectUris.map((e,t)=>(0,b.jsxs)(`div`,{style:{display:`flex`,gap:6,marginBottom:4},children:[(0,b.jsx)(`input`,{className:`input input-mono`,value:e,readOnly:!0,style:{flex:1}}),(0,b.jsx)(`button`,{type:`button`,className:`btn btn-sm btn-danger`,onClick:()=>w(`redirect`,t),children:(0,b.jsx)(`svg`,{viewBox:`0 0 16 16`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,children:(0,b.jsx)(`path`,{d:`M3 3l10 10M13 3L3 13`,strokeLinecap:`round`})})})]},t)),(0,b.jsxs)(`div`,{style:{display:`flex`,gap:6},children:[(0,b.jsx)(`input`,{className:`input input-mono`,value:p,onChange:e=>m(e.target.value),placeholder:u.applicationType===`native`?`com.example.app:/oauth or http://127.0.0.1/callback`:`https://app.example.com/callback`,onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),C(`redirect`))}}),(0,b.jsx)(`button`,{type:`button`,className:`btn btn-sm`,onClick:()=>C(`redirect`),children:`Add`})]})]}),(0,b.jsxs)(`div`,{className:`field`,children:[(0,b.jsx)(`label`,{children:`Post-Logout Redirect URIs`}),u.postLogoutRedirectUris.map((e,t)=>(0,b.jsxs)(`div`,{style:{display:`flex`,gap:6,marginBottom:4},children:[(0,b.jsx)(`input`,{className:`input input-mono`,value:e,readOnly:!0,style:{flex:1}}),(0,b.jsx)(`button`,{type:`button`,className:`btn btn-sm btn-danger`,onClick:()=>w(`logout`,t),children:(0,b.jsx)(`svg`,{viewBox:`0 0 16 16`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,children:(0,b.jsx)(`path`,{d:`M3 3l10 10M13 3L3 13`,strokeLinecap:`round`})})})]},t)),(0,b.jsxs)(`div`,{style:{display:`flex`,gap:6},children:[(0,b.jsx)(`input`,{className:`input input-mono`,value:h,onChange:e=>g(e.target.value),placeholder:`https://app.example.com/logged-out`,onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),C(`logout`))}}),(0,b.jsx)(`button`,{type:`button`,className:`btn btn-sm`,onClick:()=>C(`logout`),children:`Add`})]})]}),(0,b.jsxs)(`div`,{className:`field`,children:[(0,b.jsx)(`label`,{children:`Backchannel Logout URI`}),(0,b.jsx)(`input`,{className:`input input-mono`,value:u.backchannelLogoutUri,onChange:e=>d(t=>({...t,backchannelLogoutUri:e.target.value})),placeholder:`https://app.example.com/backchannel-logout`})]}),(0,b.jsxs)(`label`,{className:`checkbox-row`,children:[(0,b.jsx)(`input`,{type:`checkbox`,checked:u.backchannelLogoutSessionRequired,onChange:e=>d(t=>({...t,backchannelLogoutSessionRequired:e.target.checked}))}),(0,b.jsx)(`span`,{className:`chk-label`,children:`Require session ID in backchannel logout`})]})]});return(0,b.jsxs)(`div`,{children:[(0,b.jsxs)(`div`,{className:`page-header-row`,children:[(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`div`,{className:`page-title`,children:`OAuth Clients`}),(0,b.jsxs)(`div`,{className:`page-sub`,children:[r,` dynamic clients`]})]}),(0,b.jsx)(`div`,{className:`page-actions`,children:(0,b.jsxs)(`button`,{className:`btn btn-primary`,onClick:y,children:[(0,b.jsx)(`svg`,{viewBox:`0 0 16 16`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,children:(0,b.jsx)(`path`,{d:`M8 2v12M2 8h12`,strokeLinecap:`round`})}),`New Client`]})})]}),(0,b.jsx)(Il,{onEdit:x,onDelete:O,onRegenerate:k}),(0,b.jsx)(Nl,{open:i,onClose:()=>a(!1),title:`New OAuth Client`,large:!0,footer:(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(`button`,{className:`btn`,onClick:()=>a(!1),children:`Cancel`}),(0,b.jsx)(`button`,{className:`btn btn-primary`,onClick:E,disabled:_.isPending,children:_.isPending?(0,b.jsx)(`span`,{className:`spinner sm`}):`Create Client`})]}),children:(0,b.jsx)(A,{})}),(0,b.jsx)(Nl,{open:!!o,onClose:()=>s(null),title:`Edit — ${o?.clientId}`,large:!0,footer:(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(`button`,{className:`btn`,onClick:()=>s(null),children:`Cancel`}),(0,b.jsx)(`button`,{className:`btn btn-primary`,onClick:D,disabled:v.isPending,children:v.isPending?(0,b.jsx)(`span`,{className:`spinner sm`}):`Save Changes`})]}),children:(0,b.jsx)(A,{})}),(0,b.jsxs)(Nl,{open:!!c,onClose:()=>l(null),title:`Client Secret — Save Now`,footer:(0,b.jsx)(`button`,{className:`btn btn-primary`,onClick:()=>l(null),children:`I've saved it`}),children:[(0,b.jsx)(`div`,{className:`error-box`,style:{background:`var(--amber-soft)`,borderColor:`rgba(255,180,84,0.3)`,color:`var(--amber)`},children:`This secret will not be shown again. Copy it now.`}),(0,b.jsxs)(`div`,{className:`secret-box`,style:{marginTop:12},children:[(0,b.jsx)(`small`,{children:`Client ID`}),c?.clientId]}),(0,b.jsxs)(`div`,{className:`secret-box`,children:[(0,b.jsx)(`small`,{children:`Client Secret`}),c?.secret]}),(0,b.jsxs)(`button`,{className:`btn btn-sm`,style:{marginTop:4},onClick:()=>navigator.clipboard.writeText(c?.secret??``),children:[(0,b.jsxs)(`svg`,{viewBox:`0 0 16 16`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.7`,children:[(0,b.jsx)(`rect`,{x:`5`,y:`5`,width:`9`,height:`9`,rx:`1.5`}),(0,b.jsx)(`path`,{d:`M3.5 11H3a1.5 1.5 0 01-1.5-1.5V3A1.5 1.5 0 013 1.5h6.5A1.5 1.5 0 0111 3v.5`,strokeLinecap:`round`})]}),`Copy secret`]})]})]})}function Ul(){let e=q(),t=S(),{data:n,isLoading:r,error:i,refetch:a}=z({...Ks(),retry:(e,t)=>t&&typeof t==`object`&&`status`in t&&t.status===501?!1:e<1}),o=B(qs()),s=B(Us()),[c,l]=(0,f.useState)(null),[u,d]=(0,f.useState)(null),[p,m]=(0,f.useState)(null),h=i&&typeof i==`object`&&`status`in i&&i.status===501;if(h)return(0,b.jsxs)(`div`,{className:`error-box`,children:[`Rotação indisponível: o `,(0,b.jsx)(`code`,{children:`jwks`}),` não é `,(0,b.jsx)(`code`,{children:`managed`}),` com um`,` `,(0,b.jsx)(`code`,{children:`store`}),` persistente (ex.:`,` `,(0,b.jsx)(`code`,{children:`{ source: 'managed', store: { driver: 'lucid' } }`}),`). Chaves inline (`,(0,b.jsx)(`code`,{children:`source: 'jwks'`}),`) não rotacionam.`]});let g=n?.policy,_=c??g?.maxAgeDays??90,v=u??g?.keep??2;async function y(n){m(`policy`);try{let r={enabled:n.enabled??g?.enabled??!1,maxAgeDays:n.maxAgeDays??_,keep:n.keep??v};await s.mutateAsync({key:`key_rotation`,value:r}),t.invalidateQueries({queryKey:K.admin.keys()}),l(null),d(null),e.success(`Política de rotação salva`)}catch(t){e.error(t instanceof Error?t.message:String(t))}finally{m(null)}}async function x(n){let r=n?`Isso DESABILITA todas as chaves atuais e cria uma nova. Tokens já emitidos deixam de validar imediatamente. Continuar?`:`Rotacionar agora? Uma chave nova vira a ativa; as antigas continuam validando (janela de grace).`;if(window.confirm(r)){m(n?`retire`:`rotate`);try{let r=await o.mutateAsync(n?{retire:!0}:{keep:v});t.invalidateQueries({queryKey:K.admin.keys()}),e.success(`Rotacionado. Nova chave: ${r.newKid.slice(0,8)}…`)}catch(t){e.error(t instanceof Error?t.message:String(t))}finally{m(null)}}}return(0,b.jsx)(vl,{isLoading:r,error:h?void 0:i,onRetry:a,skeleton:(0,b.jsx)(bl,{width:`100%`,height:220}),children:n&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(`div`,{className:`panel`,style:{marginBottom:16},children:(0,b.jsx)(`div`,{className:`panel-body`,children:(0,b.jsxs)(`div`,{className:`settings-row`,children:[(0,b.jsxs)(`div`,{className:`settings-info`,children:[(0,b.jsx)(`div`,{className:`settings-key`,children:`Chave de assinatura ativa`}),(0,b.jsx)(`div`,{style:{fontFamily:`var(--mono)`,fontSize:12},children:n.keys.find(e=>e.active)?.kid??`—`})]}),(0,b.jsxs)(`div`,{className:`settings-info`,style:{textAlign:`right`},children:[(0,b.jsxs)(`div`,{className:`settings-desc`,children:[`Idade: `,n.ageDays,` dia(s)`]}),(0,b.jsxs)(`div`,{className:`settings-desc`,children:[`Próxima rotação:`,` `,n.nextRotationInDays===null?`— (auto off)`:`~${n.nextRotationInDays} dia(s)`]})]})]})})}),(0,b.jsxs)(`div`,{className:`settings-section`,children:[(0,b.jsx)(`div`,{className:`settings-section-head`,children:(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`h3`,{children:`Rotação automática`}),(0,b.jsx)(`p`,{style:{marginTop:2},children:`Gera uma chave nova quando a ativa passa da idade máxima; mantém as N mais recentes (janela de grace).`})]})}),(0,b.jsx)(`div`,{className:`panel`,children:(0,b.jsxs)(`div`,{className:`panel-body`,style:{padding:0},children:[(0,b.jsxs)(`div`,{className:`settings-row`,children:[(0,b.jsxs)(`div`,{className:`settings-info`,children:[(0,b.jsx)(`div`,{className:`settings-key`,children:`Habilitar rotação agendada`}),(0,b.jsx)(`div`,{className:`settings-desc`,children:`key_rotation.enabled`})]}),(0,b.jsx)(`div`,{className:`settings-control`,children:(0,b.jsxs)(`label`,{className:`toggle`,children:[(0,b.jsx)(`input`,{type:`checkbox`,checked:!!g?.enabled,disabled:p===`policy`,onChange:e=>y({enabled:e.target.checked})}),(0,b.jsx)(`div`,{className:`toggle-track`}),(0,b.jsx)(`div`,{className:`toggle-thumb`})]})})]}),(0,b.jsxs)(`div`,{className:`settings-row`,children:[(0,b.jsxs)(`div`,{className:`settings-info`,children:[(0,b.jsx)(`div`,{className:`settings-key`,children:`Idade máxima (dias)`}),(0,b.jsx)(`div`,{className:`settings-desc`,children:`key_rotation.maxAgeDays`})]}),(0,b.jsxs)(`div`,{className:`settings-control`,children:[(0,b.jsx)(`input`,{className:`input input-mono`,type:`number`,style:{width:90,textAlign:`right`},value:String(_),onChange:e=>l(Number(e.target.value))}),c!==null&&(0,b.jsx)(`button`,{className:`btn btn-primary btn-sm`,disabled:p===`policy`,onClick:()=>y({maxAgeDays:_}),children:`Save`})]})]}),(0,b.jsxs)(`div`,{className:`settings-row`,children:[(0,b.jsxs)(`div`,{className:`settings-info`,children:[(0,b.jsx)(`div`,{className:`settings-key`,children:`Manter N chaves (grace)`}),(0,b.jsx)(`div`,{className:`settings-desc`,children:`key_rotation.keep`})]}),(0,b.jsxs)(`div`,{className:`settings-control`,children:[(0,b.jsx)(`input`,{className:`input input-mono`,type:`number`,style:{width:90,textAlign:`right`},value:String(v),onChange:e=>d(Number(e.target.value))}),u!==null&&(0,b.jsx)(`button`,{className:`btn btn-primary btn-sm`,disabled:p===`policy`,onClick:()=>y({keep:v}),children:`Save`})]})]})]})})]}),(0,b.jsxs)(`div`,{className:`settings-section`,children:[(0,b.jsx)(`div`,{className:`settings-section-head`,children:(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`h3`,{children:`Chaves no keyset`}),(0,b.jsx)(`p`,{style:{marginTop:2},children:`A primeira é a ativa (assina); as demais ainda validam tokens (grace).`})]})}),(0,b.jsx)(`div`,{className:`panel`,children:(0,b.jsx)(`div`,{className:`panel-body`,style:{padding:0},children:n.keys.map(e=>(0,b.jsx)(`div`,{className:`settings-row`,children:(0,b.jsxs)(`div`,{className:`settings-info`,children:[(0,b.jsxs)(`div`,{className:`settings-key`,style:{fontFamily:`var(--mono)`,fontSize:12},children:[e.kid,(0,b.jsx)(`span`,{className:`settings-badge`,style:e.active?{background:`var(--accent-soft, rgba(99,102,241,0.12))`,color:`var(--accent, #6366f1)`}:void 0,children:e.active?`ativa`:`grace`})]}),(0,b.jsxs)(`div`,{className:`settings-desc`,children:[e.alg,` · `,e.ageDays,` dia(s)`]})]})},e.kid))})})]}),(0,b.jsxs)(`div`,{className:`settings-section`,children:[(0,b.jsx)(`div`,{className:`settings-section-head`,children:(0,b.jsx)(`div`,{children:(0,b.jsx)(`h3`,{children:`Ações`})})}),(0,b.jsx)(`div`,{className:`panel`,children:(0,b.jsxs)(`div`,{className:`panel-body`,style:{display:`flex`,gap:12,flexWrap:`wrap`},children:[(0,b.jsx)(`button`,{className:`btn btn-primary`,disabled:!!p,onClick:()=>x(!1),children:p===`rotate`?(0,b.jsx)(`span`,{className:`spinner sm`}):`Rotacionar agora`}),(0,b.jsx)(`button`,{className:`btn btn-ghost`,disabled:!!p,onClick:()=>x(!0),style:{color:`var(--danger, #e5484d)`,borderColor:`var(--danger, #e5484d)`},children:p===`retire`?(0,b.jsx)(`span`,{className:`spinner sm`}):`Desabilitar todas + criar nova`})]})})]})]})})}function Wl(){return(0,b.jsxs)(`div`,{children:[(0,b.jsxs)(`div`,{className:`page-header`,children:[(0,b.jsx)(`div`,{className:`page-title`,children:`Signing Keys`}),(0,b.jsx)(`div`,{className:`page-sub`,children:`Chaves JWKS de assinatura — rotação, grace e status. Mudanças aplicam ao vivo.`})]}),(0,b.jsx)(Ul,{})]})}function Gl({open:e,onClose:t,title:n,children:r}){return(0,f.useEffect)(()=>{if(!e)return;let n=e=>{e.key===`Escape`&&t()};return window.addEventListener(`keydown`,n),()=>window.removeEventListener(`keydown`,n)},[e,t]),e?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(`div`,{className:`drawer-overlay`,onClick:t}),(0,b.jsxs)(`div`,{className:`drawer`,children:[(0,b.jsxs)(`div`,{className:`drawer-head`,children:[(0,b.jsx)(`h2`,{children:n}),(0,b.jsx)(`button`,{className:`modal-close`,onClick:t,children:(0,b.jsx)(`svg`,{viewBox:`0 0 16 16`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,children:(0,b.jsx)(`path`,{d:`M3 3l10 10M13 3L3 13`,strokeLinecap:`round`})})})]}),(0,b.jsx)(`div`,{className:`drawer-body`,children:r})]})]}):null}function Kl(e,t){let[n,r]=(0,f.useState)(e);return(0,f.useEffect)(()=>{let n=setTimeout(()=>r(e),t);return()=>clearTimeout(n)},[e,t]),n}function ql({onPick:e,placeholder:t}){let[n,r]=(0,f.useState)(``),i=Kl(n,250),a=z({...ms({search:i,size:6}),enabled:i.trim().length>=2}),o=a.data?.data??[];return(0,b.jsxs)(`div`,{style:{position:`relative`},children:[(0,b.jsx)(`input`,{className:`input`,value:n,onChange:e=>r(e.target.value),placeholder:t??`Search user by email or name…`}),i.trim().length>=2&&(0,b.jsx)(`div`,{style:{position:`absolute`,top:`100%`,left:0,right:0,zIndex:30,marginTop:4,background:`var(--panel, var(--bg))`,border:`1px solid var(--line)`,borderRadius:6,overflow:`hidden`,boxShadow:`0 8px 24px rgba(0,0,0,0.25)`},children:a.isLoading?(0,b.jsx)(`div`,{style:{padding:`8px 12px`,fontSize:12,color:`var(--faint)`},children:`Searching…`}):o.length===0?(0,b.jsx)(`div`,{style:{padding:`8px 12px`,fontSize:12,color:`var(--faint)`},children:`No users match.`}):o.map(t=>(0,b.jsxs)(`button`,{type:`button`,onClick:()=>e({id:t.id,email:t.email,name:t.name}),style:{display:`block`,width:`100%`,textAlign:`left`,padding:`8px 12px`,background:`none`,border:`none`,cursor:`pointer`,color:`var(--text)`,fontSize:12.5},onMouseEnter:e=>e.currentTarget.style.background=`var(--line)`,onMouseLeave:e=>e.currentTarget.style.background=`none`,children:[(0,b.jsx)(`span`,{style:{fontWeight:600},children:t.name??t.email}),t.name&&(0,b.jsx)(`span`,{style:{color:`var(--muted)`,marginLeft:8},children:t.email})]},t.id))})]})}function Jl({user:e,onClear:t}){return(0,b.jsxs)(`span`,{className:`badge badge-muted`,style:{display:`inline-flex`,alignItems:`center`,gap:6},children:[e.name?`${e.name} · `:``,e.email,(0,b.jsx)(`button`,{type:`button`,onClick:t,style:{background:`none`,border:`none`,cursor:`pointer`,color:`inherit`,padding:0,lineHeight:1},"aria-label":`Clear selected user`,children:`×`})]})}function Yl({label:e,hint:t,children:n}){return(0,b.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:10},children:[(0,b.jsxs)(`div`,{style:{flex:1},children:[(0,b.jsx)(`div`,{style:{fontSize:12,fontWeight:500,color:`var(--text)`},children:e}),t&&(0,b.jsx)(`div`,{style:{fontSize:11,color:`var(--faint)`},children:t})]}),n]})}function Xl({checked:e,onChange:t}){return(0,b.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":e,onClick:()=>t(!e),style:{position:`relative`,width:36,height:20,borderRadius:999,border:`none`,cursor:`pointer`,background:e?`var(--accent)`:`var(--line)`,transition:`background 0.15s`},children:(0,b.jsx)(`span`,{style:{position:`absolute`,top:2,left:e?18:2,width:16,height:16,borderRadius:`50%`,background:`#fff`,transition:`left 0.15s`}})})}function Zl({values:e,onChange:t,locked:n=[],placeholder:r}){let[i,a]=(0,f.useState)(``);function o(){let n=i.trim();!n||e.includes(n)||(t([...e,n]),a(``))}return(0,b.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:6},children:[(0,b.jsx)(`div`,{style:{display:`flex`,gap:6,flexWrap:`wrap`},children:e.map(r=>(0,b.jsxs)(`span`,{className:`badge badge-muted`,style:{display:`inline-flex`,alignItems:`center`,gap:5},children:[r,!n.includes(r)&&(0,b.jsx)(`button`,{type:`button`,onClick:()=>t(e.filter(e=>e!==r)),style:{background:`none`,border:`none`,cursor:`pointer`,color:`inherit`,padding:0,lineHeight:1},"aria-label":`Remove ${r}`,children:`×`})]},r))}),(0,b.jsxs)(`div`,{style:{display:`flex`,gap:6},children:[(0,b.jsx)(`input`,{className:`input`,value:i,onChange:e=>a(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),o())},placeholder:r??`add…`,style:{maxWidth:160}}),(0,b.jsx)(`button`,{type:`button`,className:`btn btn-ghost btn-sm`,onClick:o,children:`Add`})]})]})}var Ql=[`organizations_policy`,`roles_catalog`],$l={organizations_policy:{en:`Organizations policy`,pt:`Política de organizações`},roles_catalog:{en:`Roles catalog`,pt:`Catálogo de papéis`}},eu=[`owner`,`admin`,`member`];function tu(e){let t=e??{};return{allowSelfCreate:!!t.allowSelfCreate,invitationTtlHours:Number(t.invitationTtlHours)||168,roles:Array.isArray(t.roles)&&t.roles.length?t.roles.map(String):eu}}function nu(e){let t=e??{};return{roles:(Array.isArray(t.roles)&&t.roles.length?t.roles:[{name:`ADMIN`,description:`Full access to the admin console`}]).map(e=>({name:String(e.name),description:e.description?String(e.description):void 0}))}}function ru({orgId:e}){let t=q(),n=S(),{data:r,isLoading:i}=z({...Hs(e),retry:!1}),{data:a}=z({...Hs(null),retry:!1}),o=B(Us(e)),s=B(Ws(e)),[c,l]=(0,f.useState)(null),u=r?.data??[],d=a?.data??[];function p(e){return u.find(t=>t.key===e)??null}function m(e){return d.find(t=>t.key===e)??null}async function h(r,i){try{await o.mutateAsync({key:r,value:i}),n.invalidateQueries({queryKey:K.admin.settings(e)}),t.success(`Setting saved for this organization`),l(null)}catch(e){t.error(e instanceof Error?e.message:`Failed to save setting`)}}async function g(r){try{await s.mutateAsync(r),n.invalidateQueries({queryKey:K.admin.settings(e)}),t.success(`Organization setting removed (falls back to global)`)}catch(e){t.error(e instanceof Error?e.message:`Failed to remove setting`)}}return i?null:(0,b.jsxs)(`div`,{style:{borderTop:`1px solid var(--line)`,paddingTop:16},children:[(0,b.jsx)(`div`,{style:{fontSize:10.5,letterSpacing:`0.12em`,textTransform:`uppercase`,color:`var(--faint)`,fontWeight:600,marginBottom:12},children:`Organization Settings`}),(0,b.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:10},children:Ql.map(e=>{let t=p(e),n=m(e),r=$l[e],i=t?{text:`from org`,color:`var(--accent, #4f46e5)`}:n?{text:`from global`,color:`var(--muted)`}:{text:`default`,color:`var(--faint)`},a=c===e,u=t?.value??n?.value??null;return(0,b.jsxs)(`div`,{style:{background:`var(--surface, var(--bg))`,border:`1px solid var(--line)`,borderRadius:6,padding:`10px 12px`},children:[(0,b.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,marginBottom:a?10:0},children:[(0,b.jsxs)(`div`,{style:{flex:1},children:[(0,b.jsx)(`div`,{style:{fontSize:12,fontWeight:600,color:`var(--text)`},children:r.en}),(0,b.jsx)(`div`,{style:{fontSize:11,color:`var(--muted)`},children:r.pt})]}),(0,b.jsx)(`span`,{style:{fontSize:10,padding:`2px 6px`,borderRadius:4,background:`transparent`,border:`1px solid ${i.color}`,color:i.color,fontWeight:600},children:i.text}),!a&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(`button`,{className:`btn btn-ghost btn-sm`,onClick:()=>l(e),children:t?`Edit`:`Override`}),t&&(0,b.jsx)(`button`,{className:`btn btn-ghost btn-sm`,onClick:()=>g(e),disabled:s.isPending,style:{color:`var(--danger, #e53e3e)`},title:`Remove org override (falls back to global)`,children:`Reset`})]})]}),e===`organizations_policy`&&(a?(0,b.jsx)(ou,{initial:tu(u),saving:o.isPending,onSave:t=>h(e,t),onCancel:()=>l(null)}):(0,b.jsx)(iu,{value:tu(u)})),e===`roles_catalog`&&(a?(0,b.jsx)(su,{initial:nu(u),saving:o.isPending,onSave:t=>h(e,t),onCancel:()=>l(null)}):(0,b.jsx)(au,{value:nu(u)}))]},e)})})]})}function iu({value:e}){return(0,b.jsxs)(`div`,{style:{marginTop:8,display:`flex`,gap:6,flexWrap:`wrap`},children:[(0,b.jsxs)(`span`,{className:`badge badge-muted`,children:[`self-create: `,e.allowSelfCreate?`on`:`off`]}),(0,b.jsxs)(`span`,{className:`badge badge-muted`,children:[`invite TTL: `,e.invitationTtlHours,`h`]}),e.roles.map(e=>(0,b.jsx)(`span`,{className:`badge badge-muted`,children:e},e))]})}function au({value:e}){return(0,b.jsx)(`div`,{style:{marginTop:8,display:`flex`,gap:6,flexWrap:`wrap`},children:e.roles.map(e=>(0,b.jsx)(`span`,{className:`badge badge-muted`,title:e.description??``,children:e.name},e.name))})}function ou({initial:e,saving:t,onSave:n,onCancel:r}){let[i,a]=(0,f.useState)(e.allowSelfCreate),[o,s]=(0,f.useState)(e.invitationTtlHours),[c,l]=(0,f.useState)(e.roles);return(0,b.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:12},children:[(0,b.jsx)(Yl,{label:`Allow self-create`,hint:`Members can create their own organizations`,children:(0,b.jsx)(Xl,{checked:i,onChange:a})}),(0,b.jsx)(Yl,{label:`Invitation TTL`,hint:`Hours before a pending invitation expires`,children:(0,b.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:6},children:[(0,b.jsx)(`input`,{className:`input`,type:`number`,min:1,value:o,onChange:e=>s(Number(e.target.value)),style:{width:80}}),(0,b.jsx)(`span`,{style:{fontSize:11,color:`var(--faint)`},children:`h`})]})}),(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`div`,{style:{fontSize:12,fontWeight:500,color:`var(--text)`,marginBottom:6},children:`Organization roles`}),(0,b.jsx)(Zl,{values:c,onChange:l,locked:[`owner`],placeholder:`new role…`})]}),(0,b.jsxs)(`div`,{style:{display:`flex`,gap:8},children:[(0,b.jsx)(`button`,{type:`button`,className:`btn btn-primary btn-sm`,disabled:t,onClick:()=>n({allowSelfCreate:i,invitationTtlHours:o,roles:c}),children:t?`Saving…`:`Save`}),(0,b.jsx)(`button`,{type:`button`,className:`btn btn-ghost btn-sm`,onClick:r,children:`Cancel`})]})]})}function su({initial:e,saving:t,onSave:n,onCancel:r}){let[i,a]=(0,f.useState)(e.roles.map(e=>({name:e.name,description:e.description??``}))),[o,s]=(0,f.useState)(``),[c,l]=(0,f.useState)(``);function u(){let e=o.trim().toUpperCase();!e||i.some(t=>t.name===e)||(a([...i,{name:e,description:c.trim()}]),s(``),l(``))}return(0,b.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:8},children:[i.map((e,t)=>(0,b.jsxs)(`div`,{style:{display:`flex`,gap:6,alignItems:`center`},children:[(0,b.jsx)(`span`,{className:`badge badge-muted`,style:{minWidth:70,justifyContent:`center`},children:e.name}),(0,b.jsx)(`input`,{className:`input`,value:e.description,onChange:e=>a(i.map((n,r)=>r===t?{...n,description:e.target.value}:n)),placeholder:`description…`,style:{flex:1}}),e.name!==`ADMIN`&&(0,b.jsx)(`button`,{type:`button`,className:`btn btn-ghost btn-sm`,style:{color:`var(--danger, #e53e3e)`},onClick:()=>a(i.filter((e,n)=>n!==t)),children:`×`})]},e.name)),(0,b.jsxs)(`div`,{style:{display:`flex`,gap:6},children:[(0,b.jsx)(`input`,{className:`input`,value:o,onChange:e=>s(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),u())},placeholder:`ROLE_NAME`,style:{width:130}}),(0,b.jsx)(`input`,{className:`input`,value:c,onChange:e=>l(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),u())},placeholder:`description…`,style:{flex:1}}),(0,b.jsx)(`button`,{type:`button`,className:`btn btn-ghost btn-sm`,onClick:u,children:`Add`})]}),(0,b.jsxs)(`div`,{style:{display:`flex`,gap:8},children:[(0,b.jsx)(`button`,{type:`button`,className:`btn btn-primary btn-sm`,disabled:t,onClick:()=>n({roles:i.map(e=>({name:e.name,description:e.description||void 0}))}),children:t?`Saving…`:`Save`}),(0,b.jsx)(`button`,{type:`button`,className:`btn btn-ghost btn-sm`,onClick:r,children:`Cancel`})]})]})}function cu({value:e,onChange:t}){let n=eu.includes(e)?eu:[...eu,e];return(0,b.jsx)(`select`,{className:`input`,value:e,onChange:e=>t(e.target.value),style:{width:110},children:n.map(e=>(0,b.jsx)(`option`,{value:e,children:e},e))})}function lu({orgId:e,onDone:t}){let n=q(),r=S(),[i,a]=(0,f.useState)(null),[o,s]=(0,f.useState)(`member`),c=B(Is(e));async function l(a){if(a.preventDefault(),i)try{await c.mutateAsync({accountId:i.id,role:o}),r.invalidateQueries({queryKey:K.admin.org(e)}),r.invalidateQueries({queryKey:K.admin.orgs()}),n.success(`${i.email} added as ${o}`),t()}catch(e){n.error(e instanceof Error?e.message:`Failed to add member`)}}return(0,b.jsx)(`form`,{onSubmit:l,style:{display:`flex`,flexDirection:`column`,gap:8},children:i?(0,b.jsxs)(`div`,{style:{display:`flex`,gap:8,alignItems:`center`,flexWrap:`wrap`},children:[(0,b.jsx)(Jl,{user:i,onClear:()=>a(null)}),(0,b.jsx)(cu,{value:o,onChange:s}),(0,b.jsx)(`button`,{type:`submit`,className:`btn btn-primary btn-sm`,disabled:c.isPending,children:c.isPending?`Adding…`:`Add member`}),(0,b.jsx)(`button`,{type:`button`,className:`btn btn-ghost btn-sm`,onClick:t,children:`Cancel`})]}):(0,b.jsxs)(`div`,{children:[(0,b.jsx)(ql,{onPick:a}),(0,b.jsx)(`div`,{style:{marginTop:6,display:`flex`,justifyContent:`flex-end`},children:(0,b.jsx)(`button`,{type:`button`,className:`btn btn-ghost btn-sm`,onClick:t,children:`Cancel`})})]})})}function uu({orgId:e,onDone:t}){let n=q(),r=S(),[i,a]=(0,f.useState)(``),[o,s]=(0,f.useState)(`member`),c=B(zs(e));async function l(s){if(s.preventDefault(),i.trim())try{await c.mutateAsync({email:i.trim(),role:o}),r.invalidateQueries({queryKey:K.admin.org(e)}),n.success(`Invitation sent`),a(``),t()}catch(e){n.error(e instanceof Error?e.message:`Failed to create invitation`)}}return(0,b.jsxs)(`form`,{onSubmit:l,style:{display:`flex`,gap:8,alignItems:`flex-end`,flexWrap:`wrap`},children:[(0,b.jsxs)(`div`,{style:{flex:1,minWidth:180},children:[(0,b.jsx)(`label`,{className:`field-label`,children:`Email`}),(0,b.jsx)(`input`,{className:`input`,type:`email`,value:i,onChange:e=>a(e.target.value),placeholder:`user@example.com`,required:!0})]}),(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`label`,{className:`field-label`,children:`Role`}),(0,b.jsx)(cu,{value:o,onChange:s})]}),(0,b.jsx)(`button`,{type:`submit`,className:`btn btn-primary btn-sm`,disabled:c.isPending,children:c.isPending?`Sending…`:`Invite`}),(0,b.jsx)(`button`,{type:`button`,className:`btn btn-ghost btn-sm`,onClick:t,children:`Cancel`})]})}function du({orgId:e,member:t}){let n=q(),r=S(),[i,a]=(0,f.useState)(!1),[o,s]=(0,f.useState)(t.role),c=B(Ls(e,t.accountId)),l=B(Rs(e,t.accountId));async function u(){try{await c.mutateAsync(),r.invalidateQueries({queryKey:K.admin.org(e)}),r.invalidateQueries({queryKey:K.admin.orgs()}),n.success(`Member removed`)}catch(e){n.error(e instanceof Error?e.message:`Failed to remove member`)}}async function d(t){t.preventDefault();try{await l.mutateAsync(o),r.invalidateQueries({queryKey:K.admin.org(e)}),n.success(`Role updated`),a(!1)}catch(e){n.error(e instanceof Error?e.message:`Failed to update role`)}}return(0,b.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,padding:`6px 0`,borderBottom:`1px solid var(--line)`},children:[(0,b.jsx)(`div`,{className:`avatar`,style:{width:24,height:24,fontSize:9},children:(t.email??`?`).slice(0,2).toUpperCase()}),(0,b.jsx)(`div`,{style:{flex:1},children:(0,b.jsx)(`div`,{style:{fontSize:12,color:`var(--text)`},children:t.email??t.accountId})}),i?(0,b.jsxs)(`form`,{onSubmit:d,style:{display:`flex`,gap:4},children:[(0,b.jsx)(`input`,{className:`input`,value:o,onChange:e=>s(e.target.value),style:{width:80,padding:`2px 6px`,fontSize:11}}),(0,b.jsx)(`button`,{type:`submit`,className:`btn btn-primary btn-sm`,disabled:l.isPending,children:`✓`}),(0,b.jsx)(`button`,{type:`button`,className:`btn btn-ghost btn-sm`,onClick:()=>a(!1),children:`✕`})]}):(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(`button`,{className:`badge badge-muted`,title:`Click to change role`,onClick:()=>a(!0),style:{cursor:`pointer`,background:`none`,border:`1px solid var(--line)`},children:t.role}),(0,b.jsx)(`button`,{className:`icon-btn`,title:`Remove member`,onClick:u,disabled:c.isPending,style:{color:`var(--danger, #e53e3e)`,fontSize:13},children:`✕`})]})]})}function fu({orgId:e,invitation:t}){let n=q(),r=S(),i=B(Bs(e,t.id));async function a(){try{await i.mutateAsync(),r.invalidateQueries({queryKey:K.admin.org(e)}),n.success(`Invitation revoked`)}catch(e){n.error(e instanceof Error?e.message:`Failed to revoke invitation`)}}return(0,b.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,padding:`6px 0`,borderBottom:`1px solid var(--line)`},children:[(0,b.jsx)(`div`,{style:{flex:1,fontSize:12,color:`var(--muted)`},children:t.email}),(0,b.jsx)(`span`,{className:`badge badge-amber`,children:t.role}),(0,b.jsx)(`button`,{className:`icon-btn`,title:`Revoke invitation`,onClick:a,disabled:i.isPending,style:{color:`var(--danger, #e53e3e)`,fontSize:13},children:`✕`})]})}var pu=20;function mu(e){return e.toLowerCase().normalize(`NFD`).replace(/[̀-ͯ]/g,``).replace(/[^a-z0-9]+/g,`-`).replace(/^-+|-+$/g,``)}function hu({open:e,onClose:t,onCreated:n}){let r=q(),i=S(),[a,o]=(0,f.useState)(``),[s,c]=(0,f.useState)(``),[l,u]=(0,f.useState)(!1),[d,p]=(0,f.useState)(null),m=B(Ns());function h(e){o(e),l||c(mu(e))}async function g(e){if(e.preventDefault(),!(!a.trim()||!s.trim()||!d))try{await m.mutateAsync({name:a.trim(),slug:s.trim(),ownerAccountId:d.id}),i.invalidateQueries({queryKey:K.admin.orgs()}),r.success(`Organization created`),o(``),c(``),p(null),u(!1),n()}catch(e){r.error(e instanceof Error?e.message:`Failed to create organization`)}}return e?(0,b.jsx)(`div`,{className:`modal-backdrop`,onClick:t,children:(0,b.jsxs)(`div`,{className:`modal`,onClick:e=>e.stopPropagation(),children:[(0,b.jsxs)(`div`,{className:`modal-head`,children:[(0,b.jsx)(`span`,{children:`New Organization`}),(0,b.jsx)(`button`,{className:`icon-btn`,onClick:t,children:`✕`})]}),(0,b.jsxs)(`form`,{onSubmit:g,style:{display:`flex`,flexDirection:`column`,gap:14},children:[(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`label`,{className:`field-label`,children:`Name`}),(0,b.jsx)(`input`,{className:`input`,value:a,onChange:e=>h(e.target.value),placeholder:`Acme Inc.`,required:!0})]}),(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`label`,{className:`field-label`,children:`Slug`}),(0,b.jsx)(`input`,{className:`input`,value:s,onChange:e=>{c(e.target.value),u(!0)},placeholder:`acme-inc`,required:!0})]}),(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`label`,{className:`field-label`,children:`Owner`}),d?(0,b.jsx)(Jl,{user:d,onClear:()=>p(null)}):(0,b.jsx)(ql,{onPick:p,placeholder:`Search the initial owner by email…`})]}),(0,b.jsxs)(`div`,{style:{display:`flex`,gap:8,justifyContent:`flex-end`,marginTop:4},children:[(0,b.jsx)(`button`,{type:`button`,className:`btn btn-ghost`,onClick:t,children:`Cancel`}),(0,b.jsx)(`button`,{type:`submit`,className:`btn btn-primary`,disabled:m.isPending,children:m.isPending?`Creating…`:`Create`})]})]})]})}):null}function gu({search:e,page:t,onPage:n,onSelectOrg:r,onUnavailable:i,onCreateClick:a}){let[o,s]=(0,f.useState)(!1),{data:c,isLoading:l,error:u,refetch:d}=z({...js(),retry:(e,t)=>t&&typeof t==`object`&&`status`in t&&t.status===404?(o||(s(!0),i()),!1):e<1}),p=c?.data??[],m=e?p.filter(t=>t.name.toLowerCase().includes(e.toLowerCase())||t.slug.toLowerCase().includes(e.toLowerCase())):p,h=m.length,g=m.slice((t-1)*pu,t*pu),_=u&&typeof u==`object`&&`status`in u&&u.status===404;return(0,b.jsx)(`div`,{className:`panel`,children:(0,b.jsx)(vl,{isLoading:l,error:u&&!_?u:void 0,onRetry:d,skeleton:(0,b.jsx)(Tl,{rows:6,cols:4}),children:g.length===0?(0,b.jsxs)(`div`,{className:`empty-state`,children:[(0,b.jsxs)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,children:[(0,b.jsx)(`rect`,{x:`3`,y:`3`,width:`7`,height:`7`,rx:`1`}),(0,b.jsx)(`rect`,{x:`3`,y:`14`,width:`7`,height:`7`,rx:`1`}),(0,b.jsx)(`rect`,{x:`14`,y:`3`,width:`7`,height:`7`,rx:`1`}),(0,b.jsx)(`path`,{d:`M17.5 14v7M14 17.5h7`,strokeLinecap:`round`})]}),(0,b.jsx)(`h4`,{children:`No organizations`}),(0,b.jsx)(`p`,{children:e?`No results for your search`:`No organizations created yet`}),!e&&(0,b.jsx)(`button`,{className:`btn btn-primary`,style:{marginTop:12},onClick:a,children:`New organization`})]}):(0,b.jsxs)(`div`,{className:`tbl-wrap`,children:[(0,b.jsxs)(`table`,{children:[(0,b.jsx)(`thead`,{children:(0,b.jsxs)(`tr`,{children:[(0,b.jsx)(`th`,{children:`Name`}),(0,b.jsx)(`th`,{children:`Slug`}),(0,b.jsx)(`th`,{children:`Members`}),(0,b.jsx)(`th`,{children:`Created`})]})}),(0,b.jsx)(`tbody`,{children:g.map(e=>(0,b.jsxs)(`tr`,{onClick:()=>r(e.id),children:[(0,b.jsx)(`td`,{children:(0,b.jsx)(`b`,{children:e.name})}),(0,b.jsx)(`td`,{children:(0,b.jsx)(`span`,{className:`code`,children:e.slug})}),(0,b.jsx)(`td`,{children:(0,b.jsx)(`span`,{className:`mono text-sm`,children:e.memberCount??`—`})}),(0,b.jsx)(`td`,{children:(0,b.jsx)(`span`,{style:{fontFamily:`var(--mono)`,fontSize:11,color:`var(--faint)`},children:e.createdAt?new Date(e.createdAt).toLocaleDateString():`—`})})]},e.id))})]}),(0,b.jsx)(`div`,{style:{padding:`0 16px 12px`},children:(0,b.jsx)(fl,{page:t,total:h,size:pu,onPage:n})})]})})})}function _u({orgId:e,currentName:t,currentLogoUrl:n,onDone:r}){let i=q(),a=S(),[o,s]=(0,f.useState)(t),[c,l]=(0,f.useState)(n??``),u=B(Ps(e));async function d(t){t.preventDefault();try{await u.mutateAsync({name:o.trim()||void 0,logoUrl:c.trim()||null}),a.invalidateQueries({queryKey:K.admin.orgs()}),a.invalidateQueries({queryKey:K.admin.org(e)}),i.success(`Organization updated`),r()}catch(e){i.error(e instanceof Error?e.message:`Failed to update organization`)}}return(0,b.jsxs)(`form`,{onSubmit:d,style:{display:`flex`,flexDirection:`column`,gap:10},children:[(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`label`,{className:`field-label`,children:`Name`}),(0,b.jsx)(`input`,{className:`input`,value:o,onChange:e=>s(e.target.value)})]}),(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`label`,{className:`field-label`,children:`Logo URL`}),(0,b.jsx)(`input`,{className:`input`,value:c,onChange:e=>l(e.target.value),placeholder:`https://…`})]}),(0,b.jsxs)(`div`,{style:{display:`flex`,gap:8},children:[(0,b.jsx)(`button`,{type:`submit`,className:`btn btn-primary btn-sm`,disabled:u.isPending,children:u.isPending?`Saving…`:`Save`}),(0,b.jsx)(`button`,{type:`button`,className:`btn btn-ghost btn-sm`,onClick:r,children:`Cancel`})]})]})}function vu({orgId:e,onDeleted:t}){let n=q(),r=S(),{data:i,isLoading:a,error:o,refetch:s}=z(Ms(e)),[c,l]=(0,f.useState)(!1),[u,d]=(0,f.useState)(!1),[p,m]=(0,f.useState)(!1),[h,g]=(0,f.useState)(!1),_=B(Fs(e));async function v(){try{await _.mutateAsync(),r.invalidateQueries({queryKey:K.admin.orgs()}),n.success(`Organization deleted`),t()}catch(e){n.error(e instanceof Error?e.message:`Failed to delete organization`)}}return(0,b.jsx)(vl,{isLoading:a,error:o,onRetry:s,skeleton:(0,b.jsx)(El,{}),children:i&&(0,b.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:20},children:[(0,b.jsxs)(`div`,{children:[(0,b.jsxs)(`div`,{style:{fontSize:10.5,letterSpacing:`0.12em`,textTransform:`uppercase`,color:`var(--faint)`,fontWeight:600,marginBottom:8,display:`flex`,alignItems:`center`,justifyContent:`space-between`},children:[(0,b.jsx)(`span`,{children:`Info`}),!c&&(0,b.jsx)(`button`,{className:`btn btn-ghost btn-sm`,onClick:()=>l(!0),children:`Edit`})]}),c?(0,b.jsx)(_u,{orgId:e,currentName:i.name,currentLogoUrl:i.logoUrl,onDone:()=>l(!1)}):(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(`div`,{className:`code`,children:i.id}),(0,b.jsx)(`div`,{style:{marginTop:6,fontSize:12},children:(0,b.jsx)(`span`,{className:`badge badge-muted`,children:i.slug})})]})]}),(0,b.jsxs)(`div`,{children:[(0,b.jsxs)(`div`,{style:{fontSize:10.5,letterSpacing:`0.12em`,textTransform:`uppercase`,color:`var(--faint)`,fontWeight:600,marginBottom:8,display:`flex`,alignItems:`center`,justifyContent:`space-between`},children:[(0,b.jsxs)(`span`,{children:[`Members (`,i.members.length,`)`]}),!u&&(0,b.jsx)(`button`,{className:`btn btn-ghost btn-sm`,onClick:()=>d(!0),children:`+ Add`})]}),u&&(0,b.jsx)(`div`,{style:{marginBottom:10},children:(0,b.jsx)(lu,{orgId:e,onDone:()=>d(!1)})}),i.members.map(t=>(0,b.jsx)(du,{orgId:e,member:t},t.accountId))]}),(0,b.jsxs)(`div`,{children:[(0,b.jsxs)(`div`,{style:{fontSize:10.5,letterSpacing:`0.12em`,textTransform:`uppercase`,color:`var(--faint)`,fontWeight:600,marginBottom:8,display:`flex`,alignItems:`center`,justifyContent:`space-between`},children:[(0,b.jsxs)(`span`,{children:[`Pending Invitations (`,i.pendingInvitations.length,`)`]}),!p&&(0,b.jsx)(`button`,{className:`btn btn-ghost btn-sm`,onClick:()=>m(!0),children:`+ Invite`})]}),p&&(0,b.jsx)(`div`,{style:{marginBottom:10},children:(0,b.jsx)(uu,{orgId:e,onDone:()=>m(!1)})}),i.pendingInvitations.length===0&&!p&&(0,b.jsx)(`div`,{style:{fontSize:12,color:`var(--faint)`},children:`No pending invitations`}),i.pendingInvitations.map(t=>(0,b.jsx)(fu,{orgId:e,invitation:t},t.id))]}),(0,b.jsx)(ru,{orgId:e}),(0,b.jsxs)(`div`,{style:{borderTop:`1px solid var(--line)`,paddingTop:16},children:[(0,b.jsx)(`div`,{style:{fontSize:10.5,letterSpacing:`0.12em`,textTransform:`uppercase`,color:`var(--danger, #e53e3e)`,fontWeight:600,marginBottom:8},children:`Danger Zone`}),h?(0,b.jsxs)(`div`,{style:{display:`flex`,gap:8,alignItems:`center`,fontSize:13},children:[(0,b.jsx)(`span`,{style:{color:`var(--muted)`},children:`Delete this organization?`}),(0,b.jsx)(`button`,{className:`btn btn-danger btn-sm`,onClick:v,disabled:_.isPending,children:_.isPending?`Deleting…`:`Yes, delete`}),(0,b.jsx)(`button`,{className:`btn btn-ghost btn-sm`,onClick:()=>g(!1),children:`Cancel`})]}):(0,b.jsx)(`button`,{className:`btn btn-danger btn-sm`,onClick:()=>g(!0),children:`Delete organization`})]})]})})}function yu({orgId:e,onClose:t}){let{data:n}=z(Ms(e));return(0,b.jsx)(Gl,{open:!0,onClose:t,title:n?.name??`Organization`,children:(0,b.jsx)(vu,{orgId:e,onDeleted:t})})}function bu(e){let{data:t}=z(js()),n=t?.data??[];return(e?n.filter(t=>t.name.toLowerCase().includes(e.toLowerCase())||t.slug.toLowerCase().includes(e.toLowerCase())):n).length}function xu(){let[e,t]=rl(`page`,qc.withDefault(1)),[n,r]=rl(`q`,Kc.withDefault(``)),[i,a]=rl(`org`),o=Kl(n,300),[s,c]=(0,f.useState)(!1),[l,u]=(0,f.useState)(!1),d=bu(o);return s?(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`div`,{className:`page-title`,style:{marginBottom:8},children:`Organizations`}),(0,b.jsx)(`div`,{className:`error-box`,children:`Organizations are not enabled in this AuthKit installation.`})]}):(0,b.jsxs)(`div`,{children:[(0,b.jsxs)(`div`,{className:`page-header-row`,children:[(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`div`,{className:`page-title`,children:`Organizations`}),(0,b.jsxs)(`div`,{className:`page-sub`,children:[d.toLocaleString(),` orgs`]})]}),(0,b.jsx)(`button`,{className:`btn btn-primary`,onClick:()=>u(!0),children:`New organization`})]}),(0,b.jsx)(`div`,{className:`panel`,style:{marginBottom:0},children:(0,b.jsx)(`div`,{className:`panel-head`,children:(0,b.jsxs)(`div`,{className:`search-input`,style:{flex:1,maxWidth:300},children:[(0,b.jsxs)(`svg`,{className:`search-ico`,viewBox:`0 0 16 16`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.7`,children:[(0,b.jsx)(`circle`,{cx:`7`,cy:`7`,r:`4.5`}),(0,b.jsx)(`path`,{d:`M10 10l3 3`,strokeLinecap:`round`})]}),(0,b.jsx)(`input`,{className:`input`,placeholder:`Search organizations…`,value:n,onChange:e=>{r(e.target.value),t(1)}})]})})}),(0,b.jsx)(gu,{search:o,page:e,onPage:t,onSelectOrg:a,onUnavailable:()=>c(!0),onCreateClick:()=>u(!0)}),i&&(0,b.jsx)(yu,{orgId:i,onClose:()=>a(null)}),(0,b.jsx)(hu,{open:l,onClose:()=>u(!1),onCreated:()=>u(!1)})]})}function Su(e){var t,n,r=``;if(typeof e==`string`||typeof e==`number`)r+=e;else if(typeof e==`object`){if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(n=Su(e[t]))&&(r&&(r+=` `),r+=n)}else for(n in e)e[n]&&(r&&(r+=` `),r+=n)}return r}function Cu(){for(var e,t,n=0,r=``,i=arguments.length;n<i;n++)(e=arguments[n])&&(t=Su(e))&&(r&&(r+=` `),r+=t);return r}var wu=`dangerouslySetInnerHTML.onCopy.onCopyCapture.onCut.onCutCapture.onPaste.onPasteCapture.onCompositionEnd.onCompositionEndCapture.onCompositionStart.onCompositionStartCapture.onCompositionUpdate.onCompositionUpdateCapture.onFocus.onFocusCapture.onBlur.onBlurCapture.onChange.onChangeCapture.onBeforeInput.onBeforeInputCapture.onInput.onInputCapture.onReset.onResetCapture.onSubmit.onSubmitCapture.onInvalid.onInvalidCapture.onLoad.onLoadCapture.onError.onErrorCapture.onKeyDown.onKeyDownCapture.onKeyPress.onKeyPressCapture.onKeyUp.onKeyUpCapture.onAbort.onAbortCapture.onCanPlay.onCanPlayCapture.onCanPlayThrough.onCanPlayThroughCapture.onDurationChange.onDurationChangeCapture.onEmptied.onEmptiedCapture.onEncrypted.onEncryptedCapture.onEnded.onEndedCapture.onLoadedData.onLoadedDataCapture.onLoadedMetadata.onLoadedMetadataCapture.onLoadStart.onLoadStartCapture.onPause.onPauseCapture.onPlay.onPlayCapture.onPlaying.onPlayingCapture.onProgress.onProgressCapture.onRateChange.onRateChangeCapture.onSeeked.onSeekedCapture.onSeeking.onSeekingCapture.onStalled.onStalledCapture.onSuspend.onSuspendCapture.onTimeUpdate.onTimeUpdateCapture.onVolumeChange.onVolumeChangeCapture.onWaiting.onWaitingCapture.onAuxClick.onAuxClickCapture.onClick.onClickCapture.onContextMenu.onContextMenuCapture.onDoubleClick.onDoubleClickCapture.onDrag.onDragCapture.onDragEnd.onDragEndCapture.onDragEnter.onDragEnterCapture.onDragExit.onDragExitCapture.onDragLeave.onDragLeaveCapture.onDragOver.onDragOverCapture.onDragStart.onDragStartCapture.onDrop.onDropCapture.onMouseDown.onMouseDownCapture.onMouseEnter.onMouseLeave.onMouseMove.onMouseMoveCapture.onMouseOut.onMouseOutCapture.onMouseOver.onMouseOverCapture.onMouseUp.onMouseUpCapture.onSelect.onSelectCapture.onTouchCancel.onTouchCancelCapture.onTouchEnd.onTouchEndCapture.onTouchMove.onTouchMoveCapture.onTouchStart.onTouchStartCapture.onPointerDown.onPointerDownCapture.onPointerMove.onPointerMoveCapture.onPointerUp.onPointerUpCapture.onPointerCancel.onPointerCancelCapture.onPointerEnter.onPointerEnterCapture.onPointerLeave.onPointerLeaveCapture.onPointerOver.onPointerOverCapture.onPointerOut.onPointerOutCapture.onGotPointerCapture.onGotPointerCaptureCapture.onLostPointerCapture.onLostPointerCaptureCapture.onScroll.onScrollCapture.onWheel.onWheelCapture.onAnimationStart.onAnimationStartCapture.onAnimationEnd.onAnimationEndCapture.onAnimationIteration.onAnimationIterationCapture.onTransitionEnd.onTransitionEndCapture`.split(`.`);function Tu(e){return typeof e==`string`&&wu.includes(e)}var Eu=new Set(`aria-activedescendant.aria-atomic.aria-autocomplete.aria-busy.aria-checked.aria-colcount.aria-colindex.aria-colspan.aria-controls.aria-current.aria-describedby.aria-details.aria-disabled.aria-errormessage.aria-expanded.aria-flowto.aria-haspopup.aria-hidden.aria-invalid.aria-keyshortcuts.aria-label.aria-labelledby.aria-level.aria-live.aria-modal.aria-multiline.aria-multiselectable.aria-orientation.aria-owns.aria-placeholder.aria-posinset.aria-pressed.aria-readonly.aria-relevant.aria-required.aria-roledescription.aria-rowcount.aria-rowindex.aria-rowspan.aria-selected.aria-setsize.aria-sort.aria-valuemax.aria-valuemin.aria-valuenow.aria-valuetext.className.color.height.id.lang.max.media.method.min.name.style.target.width.role.tabIndex.accentHeight.accumulate.additive.alignmentBaseline.allowReorder.alphabetic.amplitude.arabicForm.ascent.attributeName.attributeType.autoReverse.azimuth.baseFrequency.baselineShift.baseProfile.bbox.begin.bias.by.calcMode.capHeight.clip.clipPath.clipPathUnits.clipRule.colorInterpolation.colorInterpolationFilters.colorProfile.colorRendering.contentScriptType.contentStyleType.cursor.cx.cy.d.decelerate.descent.diffuseConstant.direction.display.divisor.dominantBaseline.dur.dx.dy.edgeMode.elevation.enableBackground.end.exponent.externalResourcesRequired.fill.fillOpacity.fillRule.filter.filterRes.filterUnits.floodColor.floodOpacity.focusable.fontFamily.fontSize.fontSizeAdjust.fontStretch.fontStyle.fontVariant.fontWeight.format.from.fx.fy.g1.g2.glyphName.glyphOrientationHorizontal.glyphOrientationVertical.glyphRef.gradientTransform.gradientUnits.hanging.horizAdvX.horizOriginX.href.ideographic.imageRendering.in2.in.intercept.k1.k2.k3.k4.k.kernelMatrix.kernelUnitLength.kerning.keyPoints.keySplines.keyTimes.lengthAdjust.letterSpacing.lightingColor.limitingConeAngle.local.markerEnd.markerHeight.markerMid.markerStart.markerUnits.markerWidth.mask.maskContentUnits.maskUnits.mathematical.mode.numOctaves.offset.opacity.operator.order.orient.orientation.origin.overflow.overlinePosition.overlineThickness.paintOrder.panose1.pathLength.patternContentUnits.patternTransform.patternUnits.pointerEvents.pointsAtX.pointsAtY.pointsAtZ.preserveAlpha.preserveAspectRatio.primitiveUnits.r.radius.refX.refY.renderingIntent.repeatCount.repeatDur.requiredExtensions.requiredFeatures.restart.result.rotate.rx.ry.seed.shapeRendering.slope.spacing.specularConstant.specularExponent.speed.spreadMethod.startOffset.stdDeviation.stemh.stemv.stitchTiles.stopColor.stopOpacity.strikethroughPosition.strikethroughThickness.string.stroke.strokeDasharray.strokeDashoffset.strokeLinecap.strokeLinejoin.strokeMiterlimit.strokeOpacity.strokeWidth.surfaceScale.systemLanguage.tableValues.targetX.targetY.textAnchor.textDecoration.textLength.textRendering.to.transform.u1.u2.underlinePosition.underlineThickness.unicode.unicodeBidi.unicodeRange.unitsPerEm.vAlphabetic.values.vectorEffect.version.vertAdvY.vertOriginX.vertOriginY.vHanging.vIdeographic.viewTarget.visibility.vMathematical.widths.wordSpacing.writingMode.x1.x2.x.xChannelSelector.xHeight.xlinkActuate.xlinkArcrole.xlinkHref.xlinkRole.xlinkShow.xlinkTitle.xlinkType.xmlBase.xmlLang.xmlns.xmlnsXlink.xmlSpace.y1.y2.y.yChannelSelector.z.zoomAndPan.ref.key.angle`.split(`.`));function Du(e){return typeof e==`string`&&Eu.has(e)}function Ou(e){return typeof e==`string`&&e.startsWith(`data-`)}function ku(e){if(typeof e!=`object`||!e)return{};var t={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(Du(n)||Ou(n))&&(t[n]=e[n]);return t}function Au(e){if(e==null)return null;if((0,f.isValidElement)(e)&&typeof e.props==`object`&&e.props!==null){var t=e.props;return ku(t)}return typeof e==`object`&&!Array.isArray(e)?ku(e):null}function ju(e){var t={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(Du(n)||Ou(n)||Tu(n))&&(t[n]=e[n]);return t}function Mu(e){return e==null?null:(0,f.isValidElement)(e)?ju(e.props):typeof e==`object`&&!Array.isArray(e)?ju(e):null}var Nu=[`children`,`width`,`height`,`viewBox`,`className`,`style`,`title`,`desc`];function Pu(){return Pu=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Pu.apply(null,arguments)}function Fu(e,t){if(e==null)return{};var n,r,i=Iu(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function Iu(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}var Lu=(0,f.forwardRef)((e,t)=>{var n=e.children,r=e.width,i=e.height,a=e.viewBox,o=e.className,s=e.style,c=e.title,l=e.desc,u=Fu(e,Nu),d=a||{width:r,height:i,x:0,y:0},p=Cu(`recharts-surface`,o);return f.createElement(`svg`,Pu({},ju(u),{className:p,width:r,height:i,style:s,viewBox:`${d.x} ${d.y} ${d.width} ${d.height}`,ref:t}),f.createElement(`title`,null,c),f.createElement(`desc`,null,l),n)}),Ru=[`children`,`className`];function zu(){return zu=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},zu.apply(null,arguments)}function Bu(e,t){if(e==null)return{};var n,r,i=Vu(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function Vu(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}var Hu=f.forwardRef((e,t)=>{var n=e.children,r=e.className,i=Bu(e,Ru),a=Cu(`recharts-layer`,r);return f.createElement(`g`,zu({className:a},ju(i),{ref:t}),n)}),Uu=4;function Wu(e){var t=10**(arguments.length>1&&arguments[1]!==void 0?arguments[1]:Uu),n=Math.round(e*t)/t;return Object.is(n,-0)?0:n}function Gu(e){var t=[...arguments].slice(1);return e.reduce((e,n,r)=>{var i=t[r-1];return typeof i==`string`?e+i+n:i===void 0?e+n:e+Wu(i)+n},``)}var Ku=e=>e===0?0:e>0?1:-1,Y=e=>typeof e==`number`&&e!=+e,qu=e=>typeof e==`string`&&e.length>1&&e.indexOf(`%`)===e.length-1,X=e=>(typeof e==`number`||e instanceof Number)&&!Y(e),Ju=e=>X(e)||typeof e==`string`,Yu=0,Xu=e=>{var t=++Yu;return`${e||``}${t}`},Zu=function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,r=arguments.length>3&&arguments[3]!==void 0&&arguments[3];if(!X(e)&&typeof e!=`string`)return n;var i;if(qu(e)){if(t==null)return n;var a=e.indexOf(`%`);i=t*parseFloat(e.slice(0,a))/100}else i=+e;return Y(i)&&(i=n),r&&t!=null&&i>t&&(i=t),i},Qu=e=>{if(!Array.isArray(e))return!1;for(var t=e.length,n={},r=0;r<t;r++)if(!n[String(e[r])])n[String(e[r])]=!0;else return!0;return!1};function $u(e,t,n){return X(e)&&X(t)?Wu(e+n*(t-e)):t}function ed(e,t,n){if(!(!e||!e.length))return e.find(e=>e&&(typeof t==`function`?t(e):H(e,t))===n)}var td=e=>e==null,nd=e=>td(e)?e:`${e.charAt(0).toUpperCase()}${e.slice(1)}`;function rd(e){return e!=null}function id(){}function ad(e){if(e)return{x:e.x,y:e.y,upperWidth:`upperWidth`in e?e.upperWidth:e.width,lowerWidth:`lowerWidth`in e?e.lowerWidth:e.width,width:e.width,height:e.height}}function od(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function sd(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?od(Object(n),!0).forEach(function(t){cd(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):od(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function cd(e,t,n){return(t=ld(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ld(e){var t=ud(e,`string`);return typeof t==`symbol`?t:t+``}function ud(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}var dd=e=>{var t=e.viewBox,n=e.position,r=e.offset,i=r===void 0?0:r,a=e.parentViewBox,o=e.clamp,s=ad(t),c=s.x,l=s.y,u=s.height,d=s.upperWidth,f=s.lowerWidth,p=c,m=c+(d-f)/2,h=(p+m)/2,g=(d+f)/2,_=p+d/2,v=u>=0?1:-1,y=v*i,b=v>0?`end`:`start`,x=v>0?`start`:`end`,S=d>=0?1:-1,C=S*i,w=S>0?`end`:`start`,T=S>0?`start`:`end`,E=a;if(n===`top`){var D={x:p+d/2,y:l-y,horizontalAnchor:`middle`,verticalAnchor:b};return o&&E&&(D.height=Math.max(l-E.y,0),D.width=d),D}if(n===`bottom`){var O={x:m+f/2,y:l+u+y,horizontalAnchor:`middle`,verticalAnchor:x};return o&&E&&(O.height=Math.max(E.y+E.height-(l+u),0),O.width=f),O}if(n===`left`){var k={x:h-C,y:l+u/2,horizontalAnchor:w,verticalAnchor:`middle`};return o&&E&&(k.width=Math.max(k.x-E.x,0),k.height=u),k}if(n===`right`){var A={x:h+g+C,y:l+u/2,horizontalAnchor:T,verticalAnchor:`middle`};return o&&E&&(A.width=Math.max(E.x+E.width-A.x,0),A.height=u),A}var j=o&&E?{width:g,height:u}:{};return n===`insideLeft`?sd({x:h+C,y:l+u/2,horizontalAnchor:T,verticalAnchor:`middle`},j):n===`insideRight`?sd({x:h+g-C,y:l+u/2,horizontalAnchor:w,verticalAnchor:`middle`},j):n===`insideTop`?sd({x:p+d/2,y:l+y,horizontalAnchor:`middle`,verticalAnchor:x},j):n===`insideBottom`?sd({x:m+f/2,y:l+u-y,horizontalAnchor:`middle`,verticalAnchor:b},j):n===`insideTopLeft`?sd({x:p+C,y:l+y,horizontalAnchor:T,verticalAnchor:x},j):n===`insideTopRight`?sd({x:p+d-C,y:l+y,horizontalAnchor:w,verticalAnchor:x},j):n===`insideBottomLeft`?sd({x:m+C,y:l+u-y,horizontalAnchor:T,verticalAnchor:b},j):n===`insideBottomRight`?sd({x:m+f-C,y:l+u-y,horizontalAnchor:w,verticalAnchor:b},j):n&&typeof n==`object`&&(X(n.x)||qu(n.x))&&(X(n.y)||qu(n.y))?sd({x:c+Zu(n.x,g),y:l+Zu(n.y,u),horizontalAnchor:`end`,verticalAnchor:`end`},j):sd({x:_,y:l+u/2,horizontalAnchor:`middle`,verticalAnchor:`middle`},j)},fd=[`top`,`left`,`right`,`bottom`];function pd(e){return e==null?!1:typeof e==`object`||fd.includes(e)}var md=(0,f.createContext)(null);function hd(e){return function(){return e}}var gd=Math.PI,_d=2*gd,vd=1e-6,yd=_d-vd;function bd(e){this._+=e[0];for(let t=1,n=e.length;t<n;++t)this._+=arguments[t]+e[t]}function Z(e){let t=Math.floor(e);if(!(t>=0))throw Error(`invalid digits: ${e}`);if(t>15)return bd;let n=10**t;return function(e){this._+=e[0];for(let t=1,r=e.length;t<r;++t)this._+=Math.round(arguments[t]*n)/n+e[t]}}var xd=class{constructor(e){this._x0=this._y0=this._x1=this._y1=null,this._=``,this._append=e==null?bd:Z(e)}moveTo(e,t){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+t}`}closePath(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._append`Z`)}lineTo(e,t){this._append`L${this._x1=+e},${this._y1=+t}`}quadraticCurveTo(e,t,n,r){this._append`Q${+e},${+t},${this._x1=+n},${this._y1=+r}`}bezierCurveTo(e,t,n,r,i,a){this._append`C${+e},${+t},${+n},${+r},${this._x1=+i},${this._y1=+a}`}arcTo(e,t,n,r,i){if(e=+e,t=+t,n=+n,r=+r,i=+i,i<0)throw Error(`negative radius: ${i}`);let a=this._x1,o=this._y1,s=n-e,c=r-t,l=a-e,u=o-t,d=l*l+u*u;if(this._x1===null)this._append`M${this._x1=e},${this._y1=t}`;else if(d>vd){if(!(Math.abs(u*s-c*l)>vd)||!i)this._append`L${this._x1=e},${this._y1=t}`;else{let f=n-a,p=r-o,m=s*s+c*c,h=f*f+p*p,g=Math.sqrt(m),_=Math.sqrt(d),v=i*Math.tan((gd-Math.acos((m+d-h)/(2*g*_)))/2),y=v/_,b=v/g;Math.abs(y-1)>vd&&this._append`L${e+y*l},${t+y*u}`,this._append`A${i},${i},0,0,${+(u*f>l*p)},${this._x1=e+b*s},${this._y1=t+b*c}`}}}arc(e,t,n,r,i,a){if(e=+e,t=+t,n=+n,a=!!a,n<0)throw Error(`negative radius: ${n}`);let o=n*Math.cos(r),s=n*Math.sin(r),c=e+o,l=t+s,u=1^a,d=a?r-i:i-r;this._x1===null?this._append`M${c},${l}`:(Math.abs(this._x1-c)>vd||Math.abs(this._y1-l)>vd)&&this._append`L${c},${l}`,n&&(d<0&&(d=d%_d+_d),d>yd?this._append`A${n},${n},0,1,${u},${e-o},${t-s}A${n},${n},0,1,${u},${this._x1=c},${this._y1=l}`:d>vd&&this._append`A${n},${n},0,${+(d>=gd)},${u},${this._x1=e+n*Math.cos(i)},${this._y1=t+n*Math.sin(i)}`)}rect(e,t,n,r){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+t}h${n=+n}v${+r}h${-n}Z`}toString(){return this._}};xd.prototype;function Sd(e){let t=3;return e.digits=function(n){if(!arguments.length)return t;if(n==null)t=null;else{let e=Math.floor(n);if(!(e>=0))throw RangeError(`invalid digits: ${n}`);t=e}return e},()=>new xd(t)}Array.prototype.slice;function Cd(e){return typeof e==`object`&&`length`in e?e:Array.from(e)}function wd(e){this._context=e}wd.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._context.lineTo(e,t)}}};function Td(e){return new wd(e)}function Ed(e){return e[0]}function Dd(e){return e[1]}function Od(e,t){var n=hd(!0),r=null,i=Td,a=null,o=Sd(s);e=typeof e==`function`?e:e===void 0?Ed:hd(e),t=typeof t==`function`?t:t===void 0?Dd:hd(t);function s(s){var c,l=(s=Cd(s)).length,u,d=!1,f;for(r??(a=i(f=o())),c=0;c<=l;++c)!(c<l&&n(u=s[c],c,s))===d&&((d=!d)?a.lineStart():a.lineEnd()),d&&a.point(+e(u,c,s),+t(u,c,s));if(f)return a=null,f+``||null}return s.x=function(t){return arguments.length?(e=typeof t==`function`?t:hd(+t),s):e},s.y=function(e){return arguments.length?(t=typeof e==`function`?e:hd(+e),s):t},s.defined=function(e){return arguments.length?(n=typeof e==`function`?e:hd(!!e),s):n},s.curve=function(e){return arguments.length?(i=e,r!=null&&(a=i(r)),s):i},s.context=function(e){return arguments.length?(e==null?r=a=null:a=i(r=e),s):r},s}function kd(e,t,n){var r=null,i=hd(!0),a=null,o=Td,s=null,c=Sd(l);e=typeof e==`function`?e:e===void 0?Ed:hd(+e),t=typeof t==`function`?t:hd(t===void 0?0:+t),n=typeof n==`function`?n:n===void 0?Dd:hd(+n);function l(l){var u,d,f,p=(l=Cd(l)).length,m,h=!1,g,_=Array(p),v=Array(p);for(a??(s=o(g=c())),u=0;u<=p;++u){if(!(u<p&&i(m=l[u],u,l))===h){if(h=!h)d=u,s.areaStart(),s.lineStart();else{for(s.lineEnd(),s.lineStart(),f=u-1;f>=d;--f)s.point(_[f],v[f]);s.lineEnd(),s.areaEnd()}}h&&(_[u]=+e(m,u,l),v[u]=+t(m,u,l),s.point(r?+r(m,u,l):_[u],n?+n(m,u,l):v[u]))}if(g)return s=null,g+``||null}function u(){return Od().defined(i).curve(o).context(a)}return l.x=function(t){return arguments.length?(e=typeof t==`function`?t:hd(+t),r=null,l):e},l.x0=function(t){return arguments.length?(e=typeof t==`function`?t:hd(+t),l):e},l.x1=function(e){return arguments.length?(r=e==null?null:typeof e==`function`?e:hd(+e),l):r},l.y=function(e){return arguments.length?(t=typeof e==`function`?e:hd(+e),n=null,l):t},l.y0=function(e){return arguments.length?(t=typeof e==`function`?e:hd(+e),l):t},l.y1=function(e){return arguments.length?(n=e==null?null:typeof e==`function`?e:hd(+e),l):n},l.lineX0=l.lineY0=function(){return u().x(e).y(t)},l.lineY1=function(){return u().x(e).y(n)},l.lineX1=function(){return u().x(r).y(t)},l.defined=function(e){return arguments.length?(i=typeof e==`function`?e:hd(!!e),l):i},l.curve=function(e){return arguments.length?(o=e,a!=null&&(s=o(a)),l):o},l.context=function(e){return arguments.length?(e==null?a=s=null:s=o(a=e),l):a},l}var Ad=class{constructor(e,t){this._context=e,this._x=t}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line}point(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._x?this._context.bezierCurveTo(this._x0=(this._x0+e)/2,this._y0,this._x0,t,e,t):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+t)/2,e,this._y0,e,t)}this._x0=e,this._y0=t}};function jd(e){return new Ad(e,!0)}function Md(e){return new Ad(e,!1)}function Nd(){}function Pd(e,t,n){e._context.bezierCurveTo((2*e._x0+e._x1)/3,(2*e._y0+e._y1)/3,(e._x0+2*e._x1)/3,(e._y0+2*e._y1)/3,(e._x0+4*e._x1+t)/6,(e._y0+4*e._y1+n)/6)}function Fd(e){this._context=e}Fd.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:Pd(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1)}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:Pd(this,e,t)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function Id(e){return new Fd(e)}function Ld(e){this._context=e}Ld.prototype={areaStart:Nd,areaEnd:Nd,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x2,this._y2),this._context.closePath();break;case 2:this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break;case 3:this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4)}},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._x2=e,this._y2=t;break;case 1:this._point=2,this._x3=e,this._y3=t;break;case 2:this._point=3,this._x4=e,this._y4=t,this._context.moveTo((this._x0+4*this._x1+e)/6,(this._y0+4*this._y1+t)/6);break;default:Pd(this,e,t)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function Rd(e){return new Ld(e)}function zd(e){this._context=e}zd.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var n=(this._x0+4*this._x1+e)/6,r=(this._y0+4*this._y1+t)/6;this._line?this._context.lineTo(n,r):this._context.moveTo(n,r);break;case 3:this._point=4;default:Pd(this,e,t)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function Bd(e){return new zd(e)}function Vd(e){this._context=e}Vd.prototype={areaStart:Nd,areaEnd:Nd,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(e,t){e=+e,t=+t,this._point?this._context.lineTo(e,t):(this._point=1,this._context.moveTo(e,t))}};function Hd(e){return new Vd(e)}function Ud(e){return e<0?-1:1}function Wd(e,t,n){var r=e._x1-e._x0,i=t-e._x1,a=(e._y1-e._y0)/(r||i<0&&-0),o=(n-e._y1)/(i||r<0&&-0),s=(a*i+o*r)/(r+i);return(Ud(a)+Ud(o))*Math.min(Math.abs(a),Math.abs(o),.5*Math.abs(s))||0}function Gd(e,t){var n=e._x1-e._x0;return n?(3*(e._y1-e._y0)/n-t)/2:t}function Kd(e,t,n){var r=e._x0,i=e._y0,a=e._x1,o=e._y1,s=(a-r)/3;e._context.bezierCurveTo(r+s,i+s*t,a-s,o-s*n,a,o)}function qd(e){this._context=e}qd.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:Kd(this,this._t0,Gd(this,this._t0))}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){var n=NaN;if(e=+e,t=+t,e!==this._x1||t!==this._y1){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,Kd(this,Gd(this,n=Wd(this,e,t)),n);break;default:Kd(this,this._t0,n=Wd(this,e,t))}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=n}}};function Jd(e){this._context=new Yd(e)}(Jd.prototype=Object.create(qd.prototype)).point=function(e,t){qd.prototype.point.call(this,t,e)};function Yd(e){this._context=e}Yd.prototype={moveTo:function(e,t){this._context.moveTo(t,e)},closePath:function(){this._context.closePath()},lineTo:function(e,t){this._context.lineTo(t,e)},bezierCurveTo:function(e,t,n,r,i,a){this._context.bezierCurveTo(t,e,r,n,a,i)}};function Xd(e){return new qd(e)}function Zd(e){return new Jd(e)}function Qd(e){this._context=e}Qd.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var e=this._x,t=this._y,n=e.length;if(n){if(this._line?this._context.lineTo(e[0],t[0]):this._context.moveTo(e[0],t[0]),n===2)this._context.lineTo(e[1],t[1]);else for(var r=$d(e),i=$d(t),a=0,o=1;o<n;++a,++o)this._context.bezierCurveTo(r[0][a],i[0][a],r[1][a],i[1][a],e[o],t[o])}(this._line||this._line!==0&&n===1)&&this._context.closePath(),this._line=1-this._line,this._x=this._y=null},point:function(e,t){this._x.push(+e),this._y.push(+t)}};function $d(e){var t,n=e.length-1,r,i=Array(n),a=Array(n),o=Array(n);for(i[0]=0,a[0]=2,o[0]=e[0]+2*e[1],t=1;t<n-1;++t)i[t]=1,a[t]=4,o[t]=4*e[t]+2*e[t+1];for(i[n-1]=2,a[n-1]=7,o[n-1]=8*e[n-1]+e[n],t=1;t<n;++t)r=i[t]/a[t-1],a[t]-=r,o[t]-=r*o[t-1];for(i[n-1]=o[n-1]/a[n-1],t=n-2;t>=0;--t)i[t]=(o[t]-i[t+1])/a[t];for(a[n-1]=(e[n]+i[n-1])/2,t=0;t<n-1;++t)a[t]=2*e[t+1]-i[t+1];return[i,a]}function ef(e){return new Qd(e)}function tf(e,t){this._context=e,this._t=t}tf.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=this._y=NaN,this._point=0},lineEnd:function(){0<this._t&&this._t<1&&this._point===2&&this._context.lineTo(this._x,this._y),(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line>=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:if(this._t<=0)this._context.lineTo(this._x,t),this._context.lineTo(e,t);else{var n=this._x*(1-this._t)+e*this._t;this._context.lineTo(n,this._y),this._context.lineTo(n,t)}}this._x=e,this._y=t}};function nf(e){return new tf(e,.5)}function rf(e){return new tf(e,0)}function af(e){return new tf(e,1)}function of(e,t){if((o=e.length)>1)for(var n=1,r,i,a=e[t[0]],o,s=a.length;n<o;++n)for(i=a,a=e[t[n]],r=0;r<s;++r)a[r][1]+=a[r][0]=isNaN(i[r][1])?i[r][0]:i[r][1]}function sf(e){for(var t=e.length,n=Array(t);--t>=0;)n[t]=t;return n}function cf(e,t){return e[t]}function lf(e){let t=[];return t.key=e,t}function uf(){var e=hd([]),t=sf,n=of,r=cf;function i(i){var a=Array.from(e.apply(this,arguments),lf),o,s=a.length,c=-1,l;for(let e of i)for(o=0,++c;o<s;++o)(a[o][c]=[0,+r(e,a[o].key,c,i)]).data=e;for(o=0,l=Cd(t(a));o<s;++o)a[l[o]].index=o;return n(a,l),a}return i.keys=function(t){return arguments.length?(e=typeof t==`function`?t:hd(Array.from(t)),i):e},i.value=function(e){return arguments.length?(r=typeof e==`function`?e:hd(+e),i):r},i.order=function(e){return arguments.length?(t=e==null?sf:typeof e==`function`?e:hd(Array.from(e)),i):t},i.offset=function(e){return arguments.length?(n=e??of,i):n},i}function df(e,t){if((r=e.length)>0){for(var n,r,i=0,a=e[0].length,o;i<a;++i){for(o=n=0;n<r;++n)o+=e[n][i][1]||0;if(o)for(n=0;n<r;++n)e[n][i][1]/=o}of(e,t)}}function ff(e,t){if((i=e.length)>0){for(var n=0,r=e[t[0]],i,a=r.length;n<a;++n){for(var o=0,s=0;o<i;++o)s+=e[o][n][1]||0;r[n][1]+=r[n][0]=-s/2}of(e,t)}}function pf(e,t){if(!(!((o=e.length)>0)||!((a=(i=e[t[0]]).length)>0))){for(var n=0,r=1,i,a,o;r<a;++r){for(var s=0,c=0,l=0;s<o;++s){for(var u=e[t[s]],d=u[r][1]||0,f=(d-(u[r-1][1]||0))/2,p=0;p<s;++p){var m=e[t[p]],h=m[r][1]||0,g=m[r-1][1]||0;f+=h-g}c+=d,l+=f*d}i[r-1][1]+=i[r-1][0]=n,c&&(n-=l/c)}i[r-1][1]+=i[r-1][0]=n,of(e,t)}}var mf=e=>`radius`in e&&`startAngle`in e&&`endAngle`in e,hf=(e,t)=>{if(!e||typeof e==`function`||typeof e==`boolean`)return null;var n=e;if((0,f.isValidElement)(e)&&(n=e.props),typeof n!=`object`&&typeof n!=`function`)return null;var r={};return Object.keys(n).forEach(e=>{Tu(e)&&typeof n[e]==`function`&&(r[e]=t||(t=>n[e](n,t)))}),r},gf=(e,t,n)=>r=>(e(t,n,r),null),_f=(e,t,n)=>{if(e===null||typeof e!=`object`&&typeof e!=`function`)return null;var r=null;return Object.keys(e).forEach(i=>{var a=e[i];Tu(i)&&typeof a==`function`&&(r||={},r[i]=gf(a,t,n))}),r};function vf(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function yf(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?vf(Object(n),!0).forEach(function(t){bf(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):vf(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function bf(e,t,n){return(t=xf(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function xf(e){var t=Sf(e,`string`);return typeof t==`symbol`?t:t+``}function Sf(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function Cf(e,t){var n=yf({},e),r=t;return Object.keys(t).reduce((e,t)=>(e[t]===void 0&&r[t]!==void 0&&(e[t]=r[t]),e),n)}function wf(e,t,n){return t===!0?Jn(e,n):typeof t==`function`?Jn(e,t):e}var Tf=o((e=>{var t=d();function n(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var r=typeof Object.is==`function`?Object.is:n,i=t.useState,a=t.useEffect,o=t.useLayoutEffect,s=t.useDebugValue;function c(e,t){var n=t(),r=i({inst:{value:n,getSnapshot:t}}),c=r[0].inst,u=r[1];return o(function(){c.value=n,c.getSnapshot=t,l(c)&&u({inst:c})},[e,n,t]),a(function(){return l(c)&&u({inst:c}),e(function(){l(c)&&u({inst:c})})},[e]),s(n),n}function l(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!r(e,n)}catch{return!0}}function u(e,t){return t()}var f=typeof window>`u`||window.document===void 0||window.document.createElement===void 0?u:c;e.useSyncExternalStore=t.useSyncExternalStore===void 0?f:t.useSyncExternalStore})),Ef=o(((e,t)=>{t.exports=Tf()})),Df=o((e=>{var t=d(),n=Ef();function r(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var i=typeof Object.is==`function`?Object.is:r,a=n.useSyncExternalStore,o=t.useRef,s=t.useEffect,c=t.useMemo,l=t.useDebugValue;e.useSyncExternalStoreWithSelector=function(e,t,n,r,u){var d=o(null);if(d.current===null){var f={hasValue:!1,value:null};d.current=f}else f=d.current;d=c(function(){function e(e){if(!a){if(a=!0,o=e,e=r(e),u!==void 0&&f.hasValue){var t=f.value;if(u(t,e))return s=t}return s=e}if(t=s,i(o,e))return t;var n=r(e);return u!==void 0&&u(t,n)?(o=e,t):(o=e,s=n)}var a=!1,o,s,c=n===void 0?null:n;return[function(){return e(t())},c===null?void 0:function(){return e(c())}]},[t,n,r,u]);var p=a(e,d[0],d[1]);return s(function(){f.hasValue=!0,f.value=p},[p]),l(p),p}})),Of=o(((e,t)=>{t.exports=Df()})),kf=(0,f.createContext)(null),Af=Of(),jf=e=>e,Mf=()=>{var e=(0,f.useContext)(kf);return e?e.store.dispatch:jf},Nf=()=>{},Pf=()=>Nf,Ff=(e,t)=>e===t;function Q(e){var t=(0,f.useContext)(kf),n=(0,f.useMemo)(()=>t?t=>{if(t!=null)return e(t)}:Nf,[t,e]);return(0,Af.useSyncExternalStoreWithSelector)(t?t.subscription.addNestedSub:Pf,t?t.store.getState:Nf,t?t.store.getState:Nf,n,Ff)}function If(e,t=`expected a function, instead received ${typeof e}`){if(typeof e!=`function`)throw TypeError(t)}function Lf(e,t=`expected all items to be functions, instead received the following types: `){if(!e.every(e=>typeof e==`function`)){let n=e.map(e=>typeof e==`function`?`function ${e.name||`unnamed`}()`:typeof e).join(`, `);throw TypeError(`${t}[${n}]`)}}var Rf=e=>Array.isArray(e)?e:[e];function zf(e){let t=Array.isArray(e[0])?e[0]:e;return Lf(t,`createSelector expects all input-selectors to be functions, but received the following types: `),t}function Bf(e,t){let n=[],{length:r}=e;for(let i=0;i<r;i++)n.push(e[i].apply(null,t));return n}var Vf=class{constructor(e){this.value=e}deref(){return this.value}},Hf=typeof WeakRef>`u`?Vf:WeakRef,Uf=0,Wf=1;function Gf(){return{s:Uf,v:void 0,o:null,p:null}}function Kf(e){return e instanceof Hf?e.deref():e}function qf(e,t={}){let n=Gf(),{resultEqualityCheck:r}=t,i,a=0;function o(){let t=n,{length:o}=arguments;for(let e=0,n=o;e<n;e++){let n=arguments[e];if(typeof n==`function`||typeof n==`object`&&n){let e=t.o;e===null&&(t.o=e=new WeakMap);let r=e.get(n);r===void 0?(t=Gf(),e.set(n,t)):t=r}else{let e=t.p;e===null&&(t.p=e=new Map);let r=e.get(n);r===void 0?(t=Gf(),e.set(n,t)):t=r}}let s=t,c;if(t.s===Wf)c=t.v;else if(c=e.apply(null,arguments),a++,r){let e=Kf(i);e!=null&&r(e,c)&&(c=e,a!==0&&a--),i=typeof c==`object`&&c||typeof c==`function`?new Hf(c):c}return s.s=Wf,s.v=c,c}return o.clearCache=()=>{n=Gf(),o.resetResultsCount()},o.resultsCount=()=>a,o.resetResultsCount=()=>{a=0},o}function Jf(e,...t){let n=typeof e==`function`?{memoize:e,memoizeOptions:t}:e,r=(...e)=>{let t=0,r=0,i,a={},o=e.pop();typeof o==`object`&&(a=o,o=e.pop()),If(o,`createSelector expects an output function after the inputs, but received: [${typeof o}]`);let{memoize:s,memoizeOptions:c=[],argsMemoize:l=qf,argsMemoizeOptions:u=[]}={...n,...a},d=Rf(c),f=Rf(u),p=zf(e),m=s(function(){return t++,o.apply(null,arguments)},...d),h=l(function(){r++;let e=Bf(p,arguments);return i=m.apply(null,e),i},...f);return Object.assign(h,{resultFunc:o,memoizedResultFunc:m,dependencies:p,dependencyRecomputations:()=>r,resetDependencyRecomputations:()=>{r=0},lastResult:()=>i,recomputations:()=>t,resetRecomputations:()=>{t=0},memoize:s,argsMemoize:l})};return Object.assign(r,{withTypes:()=>r}),r}var $=Jf(qf),Yf=e=>e.legend.settings,Xf=e=>e.legend.size;$([e=>e.legend.payload,Yf],(e,t)=>{var n=t.itemSorter,r=e.flat(1);return n?qn(r,n):r});function Zf(e,t){return np(e)||tp(e,t)||$f(e,t)||Qf()}function Qf(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
104
104
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function $f(e,t){if(e){if(typeof e==`string`)return ep(e,t);var n={}.toString.call(e).slice(8,-1);return n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`?Array.from(e):n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?ep(e,t):void 0}}function ep(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function tp(e,t){var n=e==null?null:typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(n!=null){var r,i,a,o,s=[],c=!0,l=!1;try{if(a=(n=n.call(e)).next,t===0){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(l)throw i}}return s}}function np(e){if(Array.isArray(e))return e}var rp=1;function ip(e,t){return Math.abs(e.height-t.height)>rp||Math.abs(e.left-t.left)>rp||Math.abs(e.top-t.top)>rp||Math.abs(e.width-t.width)>rp}function ap(e){var t=e.getBoundingClientRect();return{height:t.height,left:t.left,top:t.top,width:t.width}}function op(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],t=Zf((0,f.useState)({height:0,left:0,top:0,width:0}),2),n=t[0],r=t[1],i=(0,f.useRef)(null),a=(0,f.useRef)(n);a.current=n;var o=(0,f.useCallback)(e=>{if(i.current!=null&&(i.current.disconnect(),i.current=null),e!=null){var t=ap(e);if(ip(t,a.current)&&r(t),typeof ResizeObserver<`u`){var n=new ResizeObserver(()=>{var t=ap(e);ip(t,a.current)&&r(t)});n.observe(e),i.current=n}}},[...e]);return(0,f.useEffect)(()=>()=>{var e;(e=i.current)==null||e.disconnect()},[]),[n,o]}function sp(e){return`Minified Redux error #${e}; visit https://redux.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}var cp=typeof Symbol==`function`&&Symbol.observable||`@@observable`,lp=()=>Math.random().toString(36).substring(7).split(``).join(`.`),up={INIT:`@@redux/INIT${lp()}`,REPLACE:`@@redux/REPLACE${lp()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${lp()}`};function dp(e){if(typeof e!=`object`||!e)return!1;let t=e;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t||Object.getPrototypeOf(e)===null}function fp(e,t,n){if(typeof e!=`function`)throw Error(sp(2));if(typeof t==`function`&&typeof n==`function`||typeof n==`function`&&typeof arguments[3]==`function`)throw Error(sp(0));if(typeof t==`function`&&n===void 0&&(n=t,t=void 0),n!==void 0){if(typeof n!=`function`)throw Error(sp(1));return n(fp)(e,t)}let r=e,i=t,a=new Map,o=a,s=0,c=!1;function l(){o===a&&(o=new Map,a.forEach((e,t)=>{o.set(t,e)}))}function u(){if(c)throw Error(sp(3));return i}function d(e){if(typeof e!=`function`)throw Error(sp(4));if(c)throw Error(sp(5));let t=!0;l();let n=s++;return o.set(n,e),function(){if(t){if(c)throw Error(sp(6));t=!1,l(),o.delete(n),a=null}}}function f(e){if(!dp(e))throw Error(sp(7));if(e.type===void 0)throw Error(sp(8));if(typeof e.type!=`string`)throw Error(sp(17));if(c)throw Error(sp(9));try{c=!0,i=r(i,e)}finally{c=!1}return(a=o).forEach(e=>{e()}),e}function p(e){if(typeof e!=`function`)throw Error(sp(10));r=e,f({type:up.REPLACE})}function m(){let e=d;return{subscribe(t){if(typeof t!=`object`||!t)throw Error(sp(11));function n(){let e=t;e.next&&e.next(u())}return n(),{unsubscribe:e(n)}},[cp](){return this}}}return f({type:up.INIT}),{dispatch:f,subscribe:d,getState:u,replaceReducer:p,[cp]:m}}function pp(e){Object.keys(e).forEach(t=>{let n=e[t];if(n(void 0,{type:up.INIT})===void 0)throw Error(sp(12));if(n(void 0,{type:up.PROBE_UNKNOWN_ACTION()})===void 0)throw Error(sp(13))})}function mp(e){let t=Object.keys(e),n={};for(let r=0;r<t.length;r++){let i=t[r];typeof e[i]==`function`&&(n[i]=e[i])}let r=Object.keys(n),i;try{pp(n)}catch(e){i=e}return function(e={},t){if(i)throw i;let a=!1,o={};for(let i=0;i<r.length;i++){let s=r[i],c=n[s],l=e[s],u=c(l,t);if(u===void 0)throw t&&t.type,Error(sp(14));o[s]=u,a||=u!==l}return a||=r.length!==Object.keys(e).length,a?o:e}}function hp(...e){return e.length===0?e=>e:e.length===1?e[0]:e.reduce((e,t)=>(...n)=>e(t(...n)))}function gp(...e){return t=>(n,r)=>{let i=t(n,r),a=()=>{throw Error(sp(15))},o={getState:i.getState,dispatch:(e,...t)=>a(e,...t)};return a=hp(...e.map(e=>e(o)))(i.dispatch),{...i,dispatch:a}}}function _p(e){return dp(e)&&`type`in e&&typeof e.type==`string`}var vp=Symbol.for(`immer-nothing`),yp=Symbol.for(`immer-draftable`),bp=Symbol.for(`immer-state`);function xp(e,...t){throw Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var Sp=Object,Cp=Sp.getPrototypeOf,wp=`constructor`,Tp=`prototype`,Ep=`configurable`,Dp=`enumerable`,Op=`writable`,kp=`value`,Ap=e=>!!e&&!!e[bp];function jp(e){return e?Pp(e)||Vp(e)||!!e[yp]||!!e[wp]?.[yp]||Hp(e)||Up(e):!1}var Mp=Sp[Tp][wp].toString(),Np=new WeakMap;function Pp(e){if(!e||!Wp(e))return!1;let t=Cp(e);if(t===null||t===Sp[Tp])return!0;let n=Sp.hasOwnProperty.call(t,wp)&&t[wp];if(n===Object)return!0;if(!Gp(n))return!1;let r=Np.get(n);return r===void 0&&(r=Function.toString.call(n),Np.set(n,r)),r===Mp}function Fp(e,t,n=!0){Ip(e)===0?(n?Reflect.ownKeys(e):Sp.keys(e)).forEach(n=>{t(n,e[n],e)}):e.forEach((n,r)=>t(r,n,e))}function Ip(e){let t=e[bp];return t?t.type_:Vp(e)?1:Hp(e)?2:Up(e)?3:0}var Lp=(e,t,n=Ip(e))=>n===2?e.has(t):Sp[Tp].hasOwnProperty.call(e,t),Rp=(e,t,n=Ip(e))=>n===2?e.get(t):e[t],zp=(e,t,n,r=Ip(e))=>{r===2?e.set(t,n):r===3?e.add(n):e[t]=n};function Bp(e,t){return e===t?e!==0||1/e==1/t:e!==e&&t!==t}var Vp=Array.isArray,Hp=e=>e instanceof Map,Up=e=>e instanceof Set,Wp=e=>typeof e==`object`,Gp=e=>typeof e==`function`,Kp=e=>typeof e==`boolean`;function qp(e){let t=+e;return Number.isInteger(t)&&String(t)===e}var Jp=e=>e.copy_||e.base_,Yp=e=>e.modified_?e.copy_:e.base_;function Xp(e,t){if(Hp(e))return new Map(e);if(Up(e))return new Set(e);if(Vp(e))return Array[Tp].slice.call(e);let n=Pp(e);if(t===!0||t===`class_only`&&!n){let t=Sp.getOwnPropertyDescriptors(e);delete t[bp];let n=Reflect.ownKeys(t);for(let r=0;r<n.length;r++){let i=n[r],a=t[i];a[Op]===!1&&(a[Op]=!0,a[Ep]=!0),(a.get||a.set)&&(t[i]={[Ep]:!0,[Op]:!0,[Dp]:a[Dp],[kp]:e[i]})}return Sp.create(Cp(e),t)}{let t=Cp(e);if(t!==null&&n)return{...e};let r=Sp.create(t);return Sp.assign(r,e)}}function Zp(e,t=!1){return em(e)||Ap(e)||!jp(e)?e:(Ip(e)>1&&Sp.defineProperties(e,{set:$p,add:$p,clear:$p,delete:$p}),Sp.freeze(e),t&&Fp(e,(e,t)=>{Zp(t,!0)},!1),e)}function Qp(){xp(2)}var $p={[kp]:Qp};function em(e){return e===null||!Wp(e)||Sp.isFrozen(e)}var tm=`MapSet`,nm=`Patches`,rm=`ArrayMethods`,im={};function am(e){let t=im[e];return t||xp(0,e),t}var om=e=>!!im[e],sm,cm=()=>sm,lm=(e,t)=>({drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0,handledSet_:new Set,processedForPatches_:new Set,mapSetPlugin_:om(tm)?am(tm):void 0,arrayMethodsPlugin_:om(rm)?am(rm):void 0});function um(e,t){t&&(e.patchPlugin_=am(nm),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function dm(e){fm(e),e.drafts_.forEach(mm),e.drafts_=null}function fm(e){e===sm&&(sm=e.parent_)}var pm=e=>sm=lm(sm,e);function mm(e){let t=e[bp];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function hm(e,t){t.unfinalizedDrafts_=t.drafts_.length;let n=t.drafts_[0];if(e!==void 0&&e!==n){n[bp].modified_&&(dm(t),xp(4)),jp(e)&&(e=gm(t,e));let{patchPlugin_:r}=t;r&&r.generateReplacementPatches_(n[bp].base_,e,t)}else e=gm(t,n);return _m(t,e,!0),dm(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e===vp?void 0:e}function gm(e,t){if(em(t))return t;let n=t[bp];if(!n)return Tm(t,e.handledSet_,e);if(!ym(n,e))return t;if(!n.modified_)return n.base_;if(!n.finalized_){let{callbacks_:t}=n;if(t)for(;t.length>0;)t.pop()(e);Cm(n,e)}return n.copy_}function _m(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&Zp(t,n)}function vm(e){e.finalized_=!0,e.scope_.unfinalizedDrafts_--}var ym=(e,t)=>e.scope_===t,bm=[];function xm(e,t,n,r){let i=Jp(e),a=e.type_;if(r!==void 0&&Rp(i,r,a)===t){zp(i,r,n,a);return}if(!e.draftLocations_){let t=e.draftLocations_=new Map;Fp(i,(e,n)=>{if(Ap(n)){let r=t.get(n)||[];r.push(e),t.set(n,r)}})}let o=e.draftLocations_.get(t)??bm;for(let e of o)zp(i,e,n,a)}function Sm(e,t,n){e.callbacks_.push(function(r){let i=t;if(!i||!ym(i,r))return;r.mapSetPlugin_?.fixSetContents(i);let a=Yp(i);xm(e,i.draft_??i,a,n),Cm(i,r)})}function Cm(e,t){if(e.modified_&&!e.finalized_&&(e.type_===3||e.type_===1&&e.allIndicesReassigned_||(e.assigned_?.size??0)>0)){let{patchPlugin_:n}=t;if(n){let r=n.getPath(e);r&&n.generatePatches_(e,r,t)}vm(e)}}function wm(e,t,n){let{scope_:r}=e;if(Ap(n)){let i=n[bp];ym(i,r)&&i.callbacks_.push(function(){Pm(e),xm(e,n,Yp(i),t)})}else jp(n)&&e.callbacks_.push(function(){let i=Jp(e);e.type_===3?i.has(n)&&Tm(n,r.handledSet_,r):Rp(i,t,e.type_)===n&&r.drafts_.length>1&&(e.assigned_.get(t)??!1)===!0&&e.copy_&&Tm(Rp(e.copy_,t,e.type_),r.handledSet_,r)})}function Tm(e,t,n){return!n.immer_.autoFreeze_&&n.unfinalizedDrafts_<1||Ap(e)||t.has(e)||!jp(e)||em(e)?e:(t.add(e),Fp(e,(r,i)=>{if(Ap(i)){let t=i[bp];ym(t,n)&&(zp(e,r,Yp(t),e.type_),vm(t))}else jp(i)&&Tm(i,t,n)}),e)}function Em(e,t){let n=Vp(e),r={type_:+!!n,scope_:t?t.scope_:cm(),modified_:!1,finalized_:!1,assigned_:void 0,parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1,callbacks_:void 0},i=r,a=Dm;n&&(i=[r],a=Om);let{revoke:o,proxy:s}=Proxy.revocable(i,a);return r.draft_=s,r.revoke_=o,[s,r]}var Dm={get(e,t){if(t===bp)return e;let n=e.scope_.arrayMethodsPlugin_,r=e.type_===1&&typeof t==`string`;if(r&&n?.isArrayOperationMethod(t))return n.createMethodInterceptor(e,t);let i=Jp(e);if(!Lp(i,t,e.type_))return jm(e,i,t);let a=i[t];if(e.finalized_||!jp(a)||r&&e.operationMethod&&n?.isMutatingArrayMethod(e.operationMethod)&&qp(t))return a;if(a===km(e.base_,t)||Am(e,t,a)){Pm(e);let n=e.type_===1?+t:t,r=Im(e.scope_,a,e,n);return e.copy_[n]=r}return a},has(e,t){return t in Jp(e)},ownKeys(e){return Reflect.ownKeys(Jp(e))},set(e,t,n){let r=Mm(Jp(e),t);if(r?.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){let r=km(Jp(e),t),i=r?.[bp];if(i&&i.base_===n)return e.copy_[t]=n,e.assigned_.set(t,!1),!0;if(Bp(n,r)&&(n!==void 0||Lp(e.base_,t,e.type_)))return!0;Pm(e),Nm(e)}return e.copy_[t]===n&&(n!==void 0||Lp(e.copy_,t,e.type_))||Number.isNaN(n)&&Number.isNaN(e.copy_[t])?!0:(e.copy_[t]=n,e.assigned_.set(t,!0),wm(e,t,n),!0)},deleteProperty(e,t){return Pm(e),km(e.base_,t)!==void 0||t in e.base_?(e.assigned_.set(t,!1),Nm(e)):e.assigned_.delete(t),e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){let n=Jp(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r&&{[Op]:!0,[Ep]:e.type_!==1||t!==`length`,[Dp]:r[Dp],[kp]:n[t]}},defineProperty(){xp(11)},getPrototypeOf(e){return Cp(e.base_)},setPrototypeOf(){xp(12)}},Om={};for(let e in Dm){let t=Dm[e];Om[e]=function(){let e=arguments;return e[0]=e[0][0],t.apply(this,e)}}Om.deleteProperty=function(e,t){return Om.set.call(this,e,t,void 0)},Om.set=function(e,t,n){return Dm.set.call(this,e[0],t,n,e[0])};function km(e,t){let n=e[bp];return(n?Jp(n):e)[t]}function Am(e,t,n){return e.type_!==1||!e.allIndicesReassigned_||e.assigned_?.get(t)||!jp(n)||n[bp]?!1:e.baseRefs_.has(n)}function jm(e,t,n){let r=Mm(t,n);return r?kp in r?r[kp]:r.get?.call(e.draft_):void 0}function Mm(e,t){if(!(t in e))return;let n=Cp(e);for(;n;){let e=Object.getOwnPropertyDescriptor(n,t);if(e)return e;n=Cp(n)}}function Nm(e){e.modified_||(e.modified_=!0,e.parent_&&Nm(e.parent_))}function Pm(e){e.copy_||=(e.assigned_=new Map,Xp(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var Fm=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!1,this.produce=(e,t,n)=>{if(Gp(e)&&!Gp(t)){let n=t;t=e;let r=this;return function(e=n,...i){return r.produce(e,e=>t.call(this,e,...i))}}Gp(t)||xp(6),n!==void 0&&!Gp(n)&&xp(7);let r;if(jp(e)){let i=pm(this),a=Im(i,e,void 0),o=!0;try{r=t(a),o=!1}finally{o?dm(i):fm(i)}return um(i,n),hm(r,i)}if(!e||!Wp(e)){if(r=t(e),r===void 0&&(r=e),r===vp&&(r=void 0),this.autoFreeze_&&Zp(r,!0),n){let t=[],i=[];am(nm).generateReplacementPatches_(e,r,{patches_:t,inversePatches_:i}),n(t,i)}return r}xp(1,e)},this.produceWithPatches=(e,t)=>{if(Gp(e))return(t,...n)=>this.produceWithPatches(t,t=>e(t,...n));let n,r;return[this.produce(e,t,(e,t)=>{n=e,r=t}),n,r]},Kp(e?.autoFreeze)&&this.setAutoFreeze(e.autoFreeze),Kp(e?.useStrictShallowCopy)&&this.setUseStrictShallowCopy(e.useStrictShallowCopy),Kp(e?.useStrictIteration)&&this.setUseStrictIteration(e.useStrictIteration)}createDraft(e){jp(e)||xp(8),Ap(e)&&(e=Lm(e));let t=pm(this),n=Im(t,e,void 0);return n[bp].isManual_=!0,fm(t),n}finishDraft(e,t){let n=e&&e[bp];(!n||!n.isManual_)&&xp(9);let{scope_:r}=n;return um(r,t),hm(void 0,r)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}setUseStrictIteration(e){this.useStrictIteration_=e}shouldUseStrictIteration(){return this.useStrictIteration_}applyPatches(e,t){let n;for(n=t.length-1;n>=0;n--){let r=t[n];if(r.path.length===0&&r.op===`replace`){e=r.value;break}}n>-1&&(t=t.slice(n+1));let r=am(nm).applyPatches_;return Ap(e)?r(e,t):this.produce(e,e=>r(e,t))}};function Im(e,t,n,r){let[i,a]=Hp(t)?am(tm).proxyMap_(t,n):Up(t)?am(tm).proxySet_(t,n):Em(t,n);return(n?.scope_??cm()).drafts_.push(i),a.callbacks_=n?.callbacks_??[],a.key_=r,n&&r!==void 0?Sm(n,a,r):a.callbacks_.push(function(e){e.mapSetPlugin_?.fixSetContents(a);let{patchPlugin_:t}=e;a.modified_&&t&&t.generatePatches_(a,[],e)}),i}function Lm(e){return Ap(e)||xp(10,e),Rm(e)}function Rm(e){if(!jp(e)||em(e))return e;let t=e[bp],n,r=!0;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=Xp(e,t.scope_.immer_.useStrictShallowCopy_),r=t.scope_.immer_.shouldUseStrictIteration()}else n=Xp(e,!0);return Fp(n,(e,t)=>{zp(n,e,Rm(t))},r),t&&(t.finalized_=!1),n}globalThis.Iterator?.from;var zm=new Fm().produce,Bm=e=>e;function Vm(e){return({dispatch:t,getState:n})=>r=>i=>typeof i==`function`?i(t,n,e):r(i)}var Hm=Vm(),Um=Vm,Wm=typeof window<`u`&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(arguments.length!==0)return typeof arguments[0]==`object`?hp:hp.apply(null,arguments)};typeof window<`u`&&window.__REDUX_DEVTOOLS_EXTENSION__&&window.__REDUX_DEVTOOLS_EXTENSION__;function Gm(e,t){function n(...n){if(t){let r=t(...n);if(!r)throw Error(eg(0));return{type:e,payload:r.payload,...`meta`in r&&{meta:r.meta},...`error`in r&&{error:r.error}}}return{type:e,payload:n[0]}}return n.toString=()=>`${e}`,n.type=e,n.match=t=>_p(t)&&t.type===e,n}var Km=class e extends Array{constructor(...t){super(...t),Object.setPrototypeOf(this,e.prototype)}static get[Symbol.species](){return e}concat(...e){return super.concat.apply(this,e)}prepend(...t){return t.length===1&&Array.isArray(t[0])?new e(...t[0].concat(this)):new e(...t.concat(this))}};function qm(e){return jp(e)?zm(e,()=>{}):e}function Jm(e,t,n){return e.has(t)?e.get(t):e.set(t,n(t)).get(t)}function Ym(e){return typeof e==`boolean`}var Xm=()=>function(e){let{thunk:t=!0,immutableCheck:n=!0,serializableCheck:r=!0,actionCreatorCheck:i=!0}=e??{},a=new Km;return t&&(Ym(t)?a.push(Hm):a.push(Um(t.extraArgument))),a},Zm=`RTK_autoBatch`,Qm=()=>e=>({payload:e,meta:{[Zm]:!0}}),$m=e=>t=>{setTimeout(t,e)},eh=(e,t)=>n=>{let r=!1,i=()=>{r||(r=!0,cancelAnimationFrame(a),clearTimeout(o),n())},a=e(i),o=setTimeout(i,t)},th=(e={type:`raf`})=>t=>(...n)=>{let r=t(...n),i=!0,a=!1,o=!1,s=new Set,c=e.type===`tick`?queueMicrotask:e.type===`raf`?typeof window<`u`&&window.requestAnimationFrame?eh(window.requestAnimationFrame,100):$m(10):e.type===`callback`?e.queueNotification:$m(e.timeout),l=()=>{o=!1,a&&(a=!1,s.forEach(e=>e()))};return Object.assign({},r,{subscribe(e){let t=r.subscribe(()=>i&&e());return s.add(e),()=>{t(),s.delete(e)}},dispatch(e){try{return i=!e?.meta?.[Zm],a=!i,a&&(o||(o=!0,c(l))),r.dispatch(e)}finally{i=!0}}})},nh=e=>function(t){let{autoBatch:n=!0}=t??{},r=new Km(e);return n&&r.push(th(typeof n==`object`?n:void 0)),r};function rh(e){let t=Xm(),{reducer:n=void 0,middleware:r,devTools:i=!0,duplicateMiddlewareCheck:a=!0,preloadedState:o=void 0,enhancers:s=void 0}=e||{},c;if(typeof n==`function`)c=n;else if(dp(n))c=mp(n);else throw Error(eg(1));let l;l=typeof r==`function`?r(t):t();let u=hp;i&&(u=Wm({trace:!1,...typeof i==`object`&&i}));let d=nh(gp(...l)),f=typeof s==`function`?s(d):d(),p=u(...f);return fp(c,o,p)}function ih(e){let t={},n=[],r,i={addCase(e,n){let r=typeof e==`string`?e:e.type;if(!r)throw Error(eg(28));if(r in t)throw Error(eg(29));return t[r]=n,i},addAsyncThunk(e,r){return r.pending&&(t[e.pending.type]=r.pending),r.rejected&&(t[e.rejected.type]=r.rejected),r.fulfilled&&(t[e.fulfilled.type]=r.fulfilled),r.settled&&n.push({matcher:e.settled,reducer:r.settled}),i},addMatcher(e,t){return n.push({matcher:e,reducer:t}),i},addDefaultCase(e){return r=e,i}};return e(i),[t,n,r]}function ah(e){return typeof e==`function`}function oh(e,t){let[n,r,i]=ih(t),a;if(ah(e))a=()=>qm(e());else{let t=qm(e);a=()=>t}function o(e=a(),t){let o=[n[t.type],...r.filter(({matcher:e})=>e(t)).map(({reducer:e})=>e)];return o.filter(e=>!!e).length===0&&(o=[i]),o.reduce((e,n)=>{if(n){if(Ap(e)){let r=n(e,t);return r===void 0?e:r}if(jp(e))return zm(e,e=>n(e,t));{let r=n(e,t);if(r===void 0){if(e===null)return e;throw Error(`A case reducer on a non-draftable value must not return undefined`)}return r}}return e},e)}return o.getInitialState=a,o}var sh=`ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW`,ch=(e=21)=>{let t=``,n=e;for(;n--;)t+=sh[Math.random()*64|0];return t},lh=Symbol.for(`rtk-slice-createasyncthunk`);function uh(e,t){return`${e}/${t}`}function dh({creators:e}={}){let t=e?.asyncThunk?.[lh];return function(e){let{name:n,reducerPath:r=n}=e;if(!n)throw Error(eg(11));let i=(typeof e.reducers==`function`?e.reducers(mh()):e.reducers)||{},a=Object.keys(i),o={sliceCaseReducersByName:{},sliceCaseReducersByType:{},actionCreators:{},sliceMatchers:[]},s={addCase(e,t){let n=typeof e==`string`?e:e.type;if(!n)throw Error(eg(12));if(n in o.sliceCaseReducersByType)throw Error(eg(13));return o.sliceCaseReducersByType[n]=t,s},addMatcher(e,t){return o.sliceMatchers.push({matcher:e,reducer:t}),s},exposeAction(e,t){return o.actionCreators[e]=t,s},exposeCaseReducer(e,t){return o.sliceCaseReducersByName[e]=t,s}};a.forEach(r=>{let a=i[r],o={reducerName:r,type:uh(n,r),createNotation:typeof e.reducers==`function`};gh(a)?vh(o,a,s,t):hh(o,a,s)});function c(){let[t={},n=[],r=void 0]=typeof e.extraReducers==`function`?ih(e.extraReducers):[e.extraReducers],i={...t,...o.sliceCaseReducersByType};return oh(e.initialState,e=>{for(let t in i)e.addCase(t,i[t]);for(let t of o.sliceMatchers)e.addMatcher(t.matcher,t.reducer);for(let t of n)e.addMatcher(t.matcher,t.reducer);r&&e.addDefaultCase(r)})}let l=e=>e,u=new Map,d=new WeakMap,f;function p(e,t){return f||=c(),f(e,t)}function m(){return f||=c(),f.getInitialState()}function h(t,n=!1){function r(e){let i=e[t];return i===void 0&&n&&(i=Jm(d,r,m)),i}function i(t=l){return Jm(Jm(u,n,()=>new WeakMap),t,()=>{let r={};for(let[i,a]of Object.entries(e.selectors??{}))r[i]=fh(a,t,()=>Jm(d,t,m),n);return r})}return{reducerPath:t,getSelectors:i,get selectors(){return i(r)},selectSlice:r}}let g={name:n,reducer:p,actions:o.actionCreators,caseReducers:o.sliceCaseReducersByName,getInitialState:m,...h(r),injectInto(e,{reducerPath:t,...n}={}){let i=t??r;return e.inject({reducerPath:i,reducer:p},n),{...g,...h(i,!0)}}};return g}}function fh(e,t,n,r){function i(i,...a){let o=t(i);return o===void 0&&r&&(o=n()),e(o,...a)}return i.unwrapped=e,i}var ph=dh();function mh(){function e(e,t){return{_reducerDefinitionType:`asyncThunk`,payloadCreator:e,...t}}return e.withTypes=()=>e,{reducer(e){return Object.assign({[e.name](...t){return e(...t)}}[e.name],{_reducerDefinitionType:`reducer`})},preparedReducer(e,t){return{_reducerDefinitionType:`reducerWithPrepare`,prepare:e,reducer:t}},asyncThunk:e}}function hh({type:e,reducerName:t,createNotation:n},r,i){let a,o;if(`reducer`in r){if(n&&!_h(r))throw Error(eg(17));a=r.reducer,o=r.prepare}else a=r;i.addCase(e,a).exposeCaseReducer(t,a).exposeAction(t,o?Gm(e,o):Gm(e))}function gh(e){return e._reducerDefinitionType===`asyncThunk`}function _h(e){return e._reducerDefinitionType===`reducerWithPrepare`}function vh({type:e,reducerName:t},n,r,i){if(!i)throw Error(eg(18));let{payloadCreator:a,fulfilled:o,pending:s,rejected:c,settled:l,options:u}=n,d=i(e,a,u);r.exposeAction(t,d),o&&r.addCase(d.fulfilled,o),s&&r.addCase(d.pending,s),c&&r.addCase(d.rejected,c),l&&r.addMatcher(d.settled,l),r.exposeCaseReducer(t,{fulfilled:o||yh,pending:s||yh,rejected:c||yh,settled:l||yh})}function yh(){}var bh=`task`,xh=`listener`,Sh=`completed`,Ch=`cancelled`,wh=`task-${Ch}`,Th=`task-${Sh}`,Eh=`${xh}-${Ch}`,Dh=`${xh}-${Sh}`,Oh=class{constructor(e){this.code=e,this.message=`${bh} ${Ch} (reason: ${e})`}code;name=`TaskAbortError`;message},kh=(e,t)=>{if(typeof e!=`function`)throw TypeError(eg(32))},Ah=()=>{},jh=(e,t=Ah)=>(e.catch(t),e),Mh=(e,t)=>(e.addEventListener(`abort`,t,{once:!0}),()=>e.removeEventListener(`abort`,t)),Nh=e=>{if(e.aborted)throw new Oh(e.reason)};function Ph(e,t){let n=Ah;return new Promise((r,i)=>{let a=()=>i(new Oh(e.reason));if(e.aborted){a();return}n=Mh(e,a),t.finally(()=>n()).then(r,i)}).finally(()=>{n=Ah})}var Fh=async(e,t)=>{try{return await Promise.resolve(),{status:`ok`,value:await e()}}catch(e){return{status:e instanceof Oh?`cancelled`:`rejected`,error:e}}finally{t?.()}},Ih=e=>t=>jh(Ph(e,t).then(t=>(Nh(e),t))),Lh=e=>{let t=Ih(e);return e=>t(new Promise(t=>setTimeout(t,e)))},{assign:Rh}=Object,zh={},Bh=`listenerMiddleware`,Vh=(e,t)=>{let n=t=>Mh(e,()=>t.abort(e.reason));return(r,i)=>{kh(r,`taskExecutor`);let a=new AbortController;n(a);let o=Fh(async()=>{Nh(e),Nh(a.signal);let t=await r({pause:Ih(a.signal),delay:Lh(a.signal),signal:a.signal});return Nh(a.signal),t},()=>a.abort(Th));return i?.autoJoin&&t.push(o.catch(Ah)),{result:Ih(e)(o),cancel(){a.abort(wh)}}}},Hh=(e,t)=>{let n=async(n,r)=>{Nh(t);let i=()=>{},a=[new Promise((t,r)=>{let a=e({predicate:n,effect:(e,n)=>{n.unsubscribe(),t([e,n.getState(),n.getOriginalState()])}});i=()=>{a(),r()}})];r!=null&&a.push(new Promise(e=>setTimeout(e,r,null)));try{let e=await Ph(t,Promise.race(a));return Nh(t),e}finally{i()}};return((e,t)=>jh(n(e,t)))},Uh=e=>{let{type:t,actionCreator:n,matcher:r,predicate:i,effect:a}=e;if(t)i=Gm(t).match;else if(n)t=n.type,i=n.match;else if(r)i=r;else if(!i)throw Error(eg(21));return kh(a,`options.listener`),{predicate:i,type:t,effect:a}},Wh=Rh(e=>{let{type:t,predicate:n,effect:r}=Uh(e);return{id:ch(),effect:r,type:t,predicate:n,pending:new Set,unsubscribe:()=>{throw Error(eg(22))}}},{withTypes:()=>Wh}),Gh=(e,t)=>{let{type:n,effect:r,predicate:i}=Uh(t);return Array.from(e.values()).find(e=>(typeof n==`string`?e.type===n:e.predicate===i)&&e.effect===r)},Kh=e=>{e.pending.forEach(e=>{e.abort(Eh)})},qh=(e,t)=>()=>{for(let e of t.keys())Kh(e);e.clear()},Jh=(e,t,n)=>{try{e(t,n)}catch(e){setTimeout(()=>{throw e},0)}},Yh=Rh(Gm(`${Bh}/add`),{withTypes:()=>Yh}),Xh=Gm(`${Bh}/removeAll`),Zh=Rh(Gm(`${Bh}/remove`),{withTypes:()=>Zh}),Qh=(...e)=>{console.error(`${Bh}/error`,...e)},$h=(e={})=>{let t=new Map,n=new Map,r=e=>{let t=n.get(e)??0;n.set(e,t+1)},i=e=>{let t=n.get(e)??1;t===1?n.delete(e):n.set(e,t-1)},{extra:a,onError:o=Qh}=e;kh(o,`onError`);let s=e=>(e.unsubscribe=()=>t.delete(e.id),t.set(e.id,e),t=>{e.unsubscribe(),t?.cancelActive&&Kh(e)}),c=(e=>{let n=Gh(t,e)??Wh(e);return s(n)});Rh(c,{withTypes:()=>c});let l=e=>{let n=Gh(t,e);return n&&(n.unsubscribe(),e.cancelActive&&Kh(n)),!!n};Rh(l,{withTypes:()=>l});let u=async(e,n,s,l)=>{let u=new AbortController,d=Hh(c,u.signal),f=[];try{e.pending.add(u),r(e),await Promise.resolve(e.effect(n,Rh({},s,{getOriginalState:l,condition:(e,t)=>d(e,t).then(Boolean),take:d,delay:Lh(u.signal),pause:Ih(u.signal),extra:a,signal:u.signal,fork:Vh(u.signal,f),unsubscribe:e.unsubscribe,subscribe:()=>{t.set(e.id,e)},cancelActiveListeners:()=>{e.pending.forEach((e,t,n)=>{e!==u&&(e.abort(Eh),n.delete(e))})},cancel:()=>{u.abort(Eh),e.pending.delete(u)},throwIfCancelled:()=>{Nh(u.signal)}})))}catch(e){e instanceof Oh||Jh(o,e,{raisedBy:`effect`})}finally{await Promise.all(f),u.abort(Dh),i(e),e.pending.delete(u)}},d=qh(t,n);return{middleware:e=>n=>r=>{if(!_p(r))return n(r);if(Yh.match(r))return c(r.payload);if(Xh.match(r)){d();return}if(Zh.match(r))return l(r.payload);let i=e.getState(),a=()=>{if(i===zh)throw Error(eg(23));return i},s;try{if(s=n(r),t.size>0){let n=e.getState(),s=Array.from(t.values());for(let t of s){let s=!1;try{s=t.predicate(r,n,i)}catch(e){s=!1,Jh(o,e,{raisedBy:`predicate`})}s&&u(t,r,e,a)}}}finally{i=zh}return s},startListening:c,stopListening:l,clearListeners:d}};function eg(e){return`Minified Redux Toolkit error #${e}; visit https://redux-toolkit.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}var tg=ph({name:`chartLayout`,initialState:{layoutType:`horizontal`,width:0,height:0,margin:{top:5,right:5,bottom:5,left:5},scale:1},reducers:{setLayout(e,t){e.layoutType=t.payload},setChartSize(e,t){e.width=t.payload.width,e.height=t.payload.height},setMargin(e,t){e.margin.top=t.payload.top??0,e.margin.right=t.payload.right??0,e.margin.bottom=t.payload.bottom??0,e.margin.left=t.payload.left??0},setScale(e,t){e.scale=t.payload}}}),ng=tg.actions,rg=ng.setMargin,ig=ng.setLayout,ag=ng.setChartSize,og=ng.setScale,sg=tg.reducer;function cg(e,t,n){return Array.isArray(e)&&e&&t+n!==0?e.slice(t,n+1):e}function lg(e){return Number.isFinite(e)}function ug(e){return typeof e==`number`&&e>0&&Number.isFinite(e)}function dg(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function fg(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?dg(Object(n),!0).forEach(function(t){pg(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):dg(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function pg(e,t,n){return(t=mg(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function mg(e){var t=hg(e,`string`);return typeof t==`symbol`?t:t+``}function hg(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function gg(e,t,n){return td(e)||td(t)?n:Ju(t)?H(e,t,n):typeof t==`function`?t(e):n}var _g=(e,t,n)=>{if(t&&n){var r=n.width,i=n.height,a=t.align,o=t.verticalAlign,s=t.layout,c=t.position,l=t.offset,u=l===void 0?0:l;if(c!=null){if(pd(c)){if(c===`top`&&X(e.top))return fg(fg({},e),{},{top:e.top+(i||0)+u});if(c===`bottom`&&X(e.bottom))return fg(fg({},e),{},{bottom:e.bottom+(i||0)+u});if(c===`left`&&X(e.left))return fg(fg({},e),{},{left:e.left+(r||0)+u});if(c===`right`&&X(e.right))return fg(fg({},e),{},{right:e.right+(r||0)+u})}return e}if((s===`vertical`||s===`horizontal`&&o===`middle`)&&a!==`center`&&X(e[a]))return fg(fg({},e),{},{[a]:e[a]+(r||0)});if((s===`horizontal`||s===`vertical`&&a===`center`)&&o!==`middle`&&X(e[o]))return fg(fg({},e),{},{[o]:e[o]+(i||0)})}return e},vg=(e,t)=>e===`horizontal`&&t===`xAxis`||e===`vertical`&&t===`yAxis`||e===`centric`&&t===`angleAxis`||e===`radial`&&t===`radiusAxis`,yg=(e,t,n,r)=>{if(r)return e.map(e=>e.coordinate);var i,a,o=e.map(e=>(e.coordinate===t&&(i=!0),e.coordinate===n&&(a=!0),e.coordinate));return i||o.push(t),a||o.push(n),o},bg=(e,t,n)=>{if(!e)return null;var r=e.duplicateDomain,i=e.type,a=e.range,o=e.scale,s=e.realScaleType,c=e.isCategorical,l=e.categoricalDomain,u=e.tickCount,d=e.ticks,f=e.niceTicks,p=e.axisType;if(!o)return null;var m=s===`scaleBand`&&o.bandwidth?o.bandwidth()/2:2,h=(t||n)&&i===`category`&&o.bandwidth?o.bandwidth()/m:0;return h=p===`angleAxis`&&a&&a.length>=2?Ku(a[0]-a[1])*2*h:h,t&&(d||f)?(d||f||[]).map((e,t)=>{var n=r?r.indexOf(e):e,i=o.map(n);return lg(i)?{coordinate:i+h,value:e,offset:h,index:t}:null}).filter(rd):c&&l?l.map((e,t)=>{var n=o.map(e);return lg(n)?{coordinate:n+h,value:e,index:t,offset:h}:null}).filter(rd):o.ticks&&!n&&u!=null?o.ticks(u).map((e,t)=>{var n=o.map(e);return lg(n)?{coordinate:n+h,value:e,index:t,offset:h}:null}).filter(rd):o.domain().map((e,t)=>{var n=o.map(e);return lg(n)?{coordinate:n+h,value:r?r[e]:e,index:t,offset:h}:null}).filter(rd)},xg={sign:e=>{var t=e.length;if(!(t<=0)){var n=e[0]?.length;if(!(n==null||n<=0))for(var r=0;r<n;++r)for(var i=0,a=0,o=0;o<t;++o){var s=e[o]?.[r];if(s!=null){var c=s[1],l=s[0],u=Y(c)?l:c;u>=0?(s[0]=i,i+=u,s[1]=i):(s[0]=a,a+=u,s[1]=a)}}}},expand:df,none:of,silhouette:ff,wiggle:pf,positive:e=>{var t=e.length;if(!(t<=0)){var n=e[0]?.length;if(!(n==null||n<=0))for(var r=0;r<n;++r)for(var i=0,a=0;a<t;++a){var o=e[a]?.[r];if(o!=null){var s=Y(o[1])?o[0]:o[1];s>=0?(o[0]=i,i+=s,o[1]=i):(o[0]=0,o[1]=0)}}}}},Sg=(e,t,n)=>{var r=xg[n]??of,i=uf().keys(t).value((e,t)=>Number(gg(e,t,0))).order(sf).offset(r)(e);return i.forEach((n,r)=>{n.forEach((n,i)=>{var a=gg(e[i],t[r],0);Array.isArray(a)&&a.length===2&&X(a[0])&&X(a[1])&&(n[0]=a[0],n[1]=a[1])})}),i};function Cg(e){return e==null?void 0:String(e)}function wg(e){var t=e.axis,n=e.ticks,r=e.bandSize,i=e.entry,a=e.index,o=e.dataKey;if(t.type===`category`){if(!t.allowDuplicatedCategory&&t.dataKey&&!td(i[t.dataKey])){var s=ed(n,`value`,i[t.dataKey]);if(s)return s.coordinate+r/2}return n!=null&&n[a]?n[a].coordinate+r/2:null}var c=gg(i,td(o)?t.dataKey:o),l=t.scale.map(c);return X(l)?l:null}var Tg=e=>{var t=e.flat(2).filter(X);return[Math.min(...t),Math.max(...t)]},Eg=e=>[e[0]===1/0?0:e[0],e[1]===-1/0?0:e[1]],Dg=(e,t,n)=>{if(e!=null&&Object.keys(e).length!==0)return Eg(Object.keys(e).reduce((r,i)=>{var a=e[i];if(!a)return r;var o=a.stackedData.reduce((e,r)=>{var i=Tg(cg(r,t,n));return!lg(i[0])||!lg(i[1])?e:[Math.min(e[0],i[0]),Math.max(e[1],i[1])]},[1/0,-1/0]);return[Math.min(o[0],r[0]),Math.max(o[1],r[1])]},[1/0,-1/0]))},Og=/^dataMin[\s]*-[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,kg=/^dataMax[\s]*\+[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,Ag=(e,t,n)=>{if(e&&e.scale&&e.scale.bandwidth){var r=e.scale.bandwidth();if(!n||r>0)return r}if(e&&t&&t.length>=2){for(var i=qn(t,e=>e.coordinate),a=[],o=0,s=1,c=i.length;s<c;s++){var l=(i[s]?.coordinate||0)-(i[s-1]?.coordinate||0);a.push(l),o=Math.max(l,o)}var u=o*1e-4,d=1/0;for(var f of a)f>u&&(d=Math.min(f,d));return d===1/0?0:d}return n?void 0:0};function jg(e){var t=e.tooltipEntrySettings,n=e.dataKey,r=e.payload,i=e.value,a=e.name;return fg(fg({},t),{},{dataKey:n,payload:r,value:i,name:a})}function Mg(e,t){if(e!=null)return String(e);if(typeof t==`string`)return t}var Ng=(e,t)=>{if(t===`horizontal`)return e.relativeX;if(t===`vertical`)return e.relativeY},Pg=(e,t)=>t===`centric`?e.angle:e.radius,Fg=e=>e.layout.width,Ig=e=>e.layout.height,Lg=e=>e.layout.scale,Rg=e=>e.layout.margin,zg=$(e=>e.cartesianAxis.xAxis,e=>Object.values(e)),Bg=$(e=>e.cartesianAxis.yAxis,e=>Object.values(e)),Vg=`data-recharts-item-index`;function Hg(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Ug(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?Hg(Object(n),!0).forEach(function(t){Wg(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Hg(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Wg(e,t,n){return(t=Gg(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Gg(e){var t=Kg(e,`string`);return typeof t==`symbol`?t:t+``}function Kg(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}var qg=e=>e.brush.height;function Jg(e){return Bg(e).reduce((e,t)=>t.orientation===`left`&&!t.mirror&&!t.hide?e+(typeof t.width==`number`?t.width:60):e,0)}function Yg(e){return Bg(e).reduce((e,t)=>t.orientation===`right`&&!t.mirror&&!t.hide?e+(typeof t.width==`number`?t.width:60):e,0)}function Xg(e){return zg(e).reduce((e,t)=>t.orientation===`top`&&!t.mirror&&!t.hide?e+(typeof t.height==`number`?t.height:30):e,0)}function Zg(e){return zg(e).reduce((e,t)=>t.orientation===`bottom`&&!t.mirror&&!t.hide?e+(typeof t.height==`number`?t.height:30):e,0)}var Qg=$([Fg,Ig,Rg,qg,Jg,Yg,Xg,Zg,Yf,Xf],(e,t,n,r,i,a,o,s,c,l)=>{var u={left:(n.left||0)+i,right:(n.right||0)+a},d=Ug(Ug({},{top:(n.top||0)+o,bottom:(n.bottom||0)+s}),u),f=d.bottom;d.bottom+=r,d=_g(d,c,l);var p=e-d.left-d.right,m=t-d.top-d.bottom;return Ug(Ug({brushBottom:f},d),{},{width:Math.max(p,0),height:Math.max(m,0)})}),$g=$(Qg,e=>({x:e.left,y:e.top,width:e.width,height:e.height})),e_=$(Fg,Ig,(e,t)=>({x:0,y:0,width:e,height:t})),t_=(0,f.createContext)(null),n_=()=>(0,f.useContext)(t_)!=null,r_=e=>e.brush,i_=$([r_,Qg,Rg],(e,t,n)=>({height:e.height,x:X(e.x)?e.x:t.left,y:X(e.y)?e.y:t.top+t.height+t.brushBottom-(n?.bottom||0),width:X(e.width)?e.width:t.width})),a_=function(e,t){var n=[...arguments].slice(2);if(typeof console<`u`&&console.warn&&(t===void 0&&console.warn(`LogUtils requires an error message argument`),!e)){if(t===void 0)console.warn(`Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.`);else{var r=0;console.warn(t.replace(/%s/g,()=>n[r++]))}}},o_={width:`100%`,height:`100%`,debounce:0,minWidth:0,initialDimension:{width:-1,height:-1}},s_=(e,t,n)=>{var r=n.width,i=r===void 0?o_.width:r,a=n.height,o=a===void 0?o_.height:a,s=n.aspect,c=n.maxHeight,l=qu(i)?e:Number(i),u=qu(o)?t:Number(o);return s&&s>0&&(l?u=l/s:u&&(l=u*s),c&&u!=null&&u>c&&(u=c)),{calculatedWidth:l,calculatedHeight:u}},c_={width:0,height:0,overflow:`visible`},l_={width:0,overflowX:`visible`},u_={height:0,overflowY:`visible`},d_={},f_=e=>{var t=e.width,n=e.height,r=qu(t),i=qu(n);return r&&i?c_:r?l_:i?u_:d_};function p_(e){var t=e.width,n=e.height,r=e.aspect,i=t,a=n;return i===void 0&&a===void 0?(i=o_.width,a=o_.height):i===void 0?i=r&&r>0?void 0:o_.width:a===void 0&&(a=r&&r>0?void 0:o_.height),{width:i,height:a}}var m_=[`aspect`,`initialDimension`,`width`,`height`,`minWidth`,`minHeight`,`maxHeight`,`children`,`debounce`,`id`,`className`,`onResize`,`style`];function h_(){return h_=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},h_.apply(null,arguments)}function g_(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function __(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?g_(Object(n),!0).forEach(function(t){v_(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):g_(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function v_(e,t,n){return(t=y_(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function y_(e){var t=b_(e,`string`);return typeof t==`symbol`?t:t+``}function b_(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function x_(e,t){return E_(e)||T_(e,t)||C_(e,t)||S_()}function S_(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
105
105
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function C_(e,t){if(e){if(typeof e==`string`)return w_(e,t);var n={}.toString.call(e).slice(8,-1);return n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`?Array.from(e):n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?w_(e,t):void 0}}function w_(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function T_(e,t){var n=e==null?null:typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(n!=null){var r,i,a,o,s=[],c=!0,l=!1;try{if(a=(n=n.call(e)).next,t===0){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(l)throw i}}return s}}function E_(e){if(Array.isArray(e))return e}function D_(e,t){if(e==null)return{};var n,r,i=O_(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function O_(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}var k_=(0,f.createContext)(o_.initialDimension);function A_(e){return ug(e.width)&&ug(e.height)}function j_(e){var t=e.children,n=e.width,r=e.height,i=(0,f.useMemo)(()=>({width:n,height:r}),[n,r]);return A_(i)?f.createElement(k_.Provider,{value:i},t):null}var M_=()=>(0,f.useContext)(k_),N_=(0,f.forwardRef)((e,t)=>{var n=e.aspect,r=e.initialDimension,i=r===void 0?o_.initialDimension:r,a=e.width,o=e.height,s=e.minWidth,c=s===void 0?o_.minWidth:s,l=e.minHeight,u=e.maxHeight,d=e.children,p=e.debounce,m=p===void 0?o_.debounce:p,h=e.id,g=e.className,_=e.onResize,v=e.style,y=v===void 0?{}:v,b=D_(e,m_),x=(0,f.useRef)(null),S=(0,f.useRef)();S.current=_,(0,f.useImperativeHandle)(t,()=>x.current);var C=x_((0,f.useState)({containerWidth:i.width,containerHeight:i.height}),2),w=C[0],T=C[1],E=(0,f.useCallback)((e,t)=>{T(n=>{var r=Math.round(e),i=Math.round(t);return n.containerWidth===r&&n.containerHeight===i?n:{containerWidth:r,containerHeight:i}})},[]);(0,f.useEffect)(()=>{if(x.current==null||typeof ResizeObserver>`u`)return id;var e=e=>{var t,n=e[0];if(n!=null){var r=n.contentRect,i=r.width,a=r.height;E(i,a),(t=S.current)==null||t.call(S,i,a)}};m>0&&(e=er(e,m,{trailing:!0,leading:!1}));var t=new ResizeObserver(e),n=x.current.getBoundingClientRect(),r=n.width,i=n.height;return E(r,i),t.observe(x.current),()=>{t.disconnect()}},[E,m]);var D=w.containerWidth,O=w.containerHeight;a_(!n||n>0,`The aspect(%s) must be greater than zero.`,n);var k=s_(D,O,{width:a,height:o,aspect:n,maxHeight:u}),A=k.calculatedWidth,j=k.calculatedHeight;return a_(D<0||O<0||A!=null&&A>0||j!=null&&j>0,`The width(%s) and height(%s) of chart should be greater than 0,
106
106
  please check the style of container, or the props width(%s) and height(%s),
@@ -8,7 +8,7 @@
8
8
  <link rel="preconnect" href="https://fonts.googleapis.com">
9
9
  <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
10
10
  <link href="https://fonts.googleapis.com/css2?family=Sora:wght@400;500;600;700&family=JetBrains+Mono:ital,wght@0,400;0,500;0,600;1,400&display=swap" rel="stylesheet">
11
- <script type="module" crossorigin src="/__AUTHKIT_BASE__/assets/index-Dct63ai-.js"></script>
11
+ <script type="module" crossorigin src="/__AUTHKIT_BASE__/assets/index-CIqtoNcO.js"></script>
12
12
  <link rel="stylesheet" crossorigin href="/__AUTHKIT_BASE__/assets/index-DTSmD4RU.css">
13
13
  </head>
14
14
  <body>