@plumix/admin 0.1.3 → 0.2.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 (40) hide show
  1. package/README.md +1 -1
  2. package/dist/assets/{-errors-B7tAsyM0.js → -errors-DymGkXzf.js} +1 -1
  3. package/dist/assets/{-locale-param-XM9QLmJ5.js → -locale-param-BBOzOc5c.js} +1 -1
  4. package/dist/assets/{_-o9O44bb8.js → _-DbGPlcLC.js} +1 -1
  5. package/dist/assets/{_authenticated-X8_ZzeVN.js → _authenticated-CxUnTydB.js} +1 -1
  6. package/dist/assets/{_authenticated-BZbICTCy.js → _authenticated-DbZWnirz.js} +1 -1
  7. package/dist/assets/{_name-CsTxHact.js → _name-BWrqcSjK.js} +1 -1
  8. package/dist/assets/{_page-CAfqCxMM.js → _page-BMWM_crl.js} +1 -1
  9. package/dist/assets/{_page-Jgddg0I9.js → _page-ClAHWpJA.js} +1 -1
  10. package/dist/assets/{_slug-CrB5RfaF.js → _slug-BGJ2I-cS.js} +1 -1
  11. package/dist/assets/{_token-9qw8O07B.js → _token-BDyoqyFe.js} +1 -1
  12. package/dist/assets/{allowed-domains-BD1FIWo8.js → allowed-domains-DIQ_LoVq.js} +1 -1
  13. package/dist/assets/{bootstrap-BjA3jejx.js → bootstrap-D1ITzrPN.js} +1 -1
  14. package/dist/assets/{breadcrumb-kPG_yvD8.js → breadcrumb-B-sB8a4_.js} +1 -1
  15. package/dist/assets/{create-CbIyckzX.js → create-BFQqxGF6.js} +1 -1
  16. package/dist/assets/{create-XNWvL9l5.js → create-BrPyaUMW.js} +1 -1
  17. package/dist/assets/{create-c0dH9rwJ.js → create-DwlFRgkL.js} +1 -1
  18. package/dist/assets/{device-CDHXIM5L.js → device-DedwLhBj.js} +1 -1
  19. package/dist/assets/{edit-Q_Ag31Id.js → edit-Ba0VjKvg.js} +1 -1
  20. package/dist/assets/{edit-Cs_d9ypU.js → edit-BdagVECm.js} +1 -1
  21. package/dist/assets/{edit-tkHAT4Yi.js → edit-BgcIFZzf.js} +1 -1
  22. package/dist/assets/{edit-BDJmvbS1.js → edit-CLa1IU8I.js} +1 -1
  23. package/dist/assets/{edit-okoLRzq-.js → edit-CteELL-K.js} +2 -2
  24. package/dist/assets/{edit-D16wc7LS.js → edit-DiaJf7-W.js} +1 -1
  25. package/dist/assets/{index-kTp--tHG.js → index-Ctqj4aiM.js} +2 -2
  26. package/dist/assets/{login-DZOKYIF-.js → login-epTUDW_0.js} +1 -1
  27. package/dist/assets/{mailer-Dyww1jwK.js → mailer-HpDxW8FX.js} +1 -1
  28. package/dist/assets/{meta-box-D-8lfuwU.js → meta-box-Dd1vNvwM.js} +1 -1
  29. package/dist/assets/{meta-box-field-r9w3rM8k.js → meta-box-field-C4Orbu3m.js} +1 -1
  30. package/dist/assets/{meta-box-grid-Dr2ygaxj.js → meta-box-grid-BfWeRDWA.js} +1 -1
  31. package/dist/assets/{plugin-error-boundary-cYpGGruP.js → plugin-error-boundary-DSHOAgQB.js} +1 -1
  32. package/dist/assets/{rich-text-field-B4Til-yn.js → rich-text-field-KC3ZBBIm.js} +1 -1
  33. package/dist/assets/{search-input-BDIFOLpj.js → search-input-J0-6kfsf.js} +1 -1
  34. package/dist/assets/{settings-Bi5BNc6-.js → settings-CkVoTIwd.js} +1 -1
  35. package/dist/assets/{toast-COG8MRHM.js → toast-p1K24g-U.js} +1 -1
  36. package/dist/assets/{use-formatters-ww2p-9js.js → use-formatters-Bq4u-MkS.js} +1 -1
  37. package/dist/assets/{users-CICoUBVu.js → users-S1uN00sD.js} +1 -1
  38. package/dist/assets/{utils-DkCVtsc2.js → utils-ByiwTMhM.js} +1 -1
  39. package/dist/index.html +1 -1
  40. package/package.json +6 -6
@@ -1 +1 @@
1
- import{i as e,t}from"./jsx-runtime-DUAcabCT.js";import{t as n}from"./react-DbyrFoBd.js";import{i as ee,n as r}from"./dist-BL2bKHuR.js";import{f as i,o as a,t as o,u as s}from"./orpc-DURDArDu.js";import{d as c}from"./esm-DfD3iRfG.js";import{n as l,r as u,t as d}from"./-locale-param-XM9QLmJ5.js";import{a as f,i as p,n as m,r as h,t as g}from"./card-L2-kK5VK.js";import{G as te,Pt as _,W as ne,Y as re,at as v}from"./index-kTp--tHG.js";import{t as y}from"./input-xYuLUQID.js";import{a as b,c as x,o as S,r as C,s as w}from"./passkey-C_CqNV1S.js";import{a as T,f as E,i as ie,n as ae,o as oe,s as se,t as ce}from"./form-C94uy6_t.js";import{n as D,t as O}from"./alert-cwX3fWUu.js";import{t as k}from"./valibot-DKJGiWCI.js";import{t as A}from"./separator-u9O31sRo.js";var j=e(n()),M=w({missing_token:{id:`emailChange.error.missingToken`},token_invalid:{id:`emailChange.error.tokenInvalid`},token_expired:{id:`emailChange.error.tokenExpired`},email_taken:{id:`emailChange.error.emailTaken`},user_not_found:{id:`emailChange.error.userNotFound`},account_disabled:{id:`emailChange.error.accountDisabled`}},{id:`emailChange.error.fallback`});M.descriptor;var N=M.useMessage;M._messages;var P=w({missing_token:{id:`magicLink.error.missingToken`},token_invalid:{id:`magicLink.error.tokenInvalid`},token_expired:{id:`magicLink.error.tokenExpired`},account_disabled:{id:`magicLink.error.accountDisabled`},domain_not_allowed:{id:`magicLink.error.domainNotAllowed`},registration_closed:{id:`magicLink.error.registrationClosed`}},{id:`magicLink.error.fallback`});P.descriptor;var F=P.useMessage;P._messages;async function I(e){let t=await fetch(`${a()}/_plumix/auth/magic-link/request`,{method:`POST`,headers:{"content-type":`application/json`,"x-plumix-request":`1`},body:JSON.stringify({email:e}),credentials:`same-origin`});if(t.status===503)throw L.notConfigured();if(t.status===400)throw L.invalidInput();if(!t.ok)throw L.network();return await t.json()}var L=class e extends Error{static{e.prototype.name=`MagicLinkRequestError`}code;constructor(e){super(e),this.code=e}static notConfigured(){return new e(`not_configured`)}static invalidInput(){return new e(`invalid_input`)}static network(){return new e(`network`)}},R=x({not_configured:{id:`magicLinkRequest.error.notConfigured`},invalid_input:{id:`magicLinkRequest.error.invalidInput`},network:{id:`magicLinkRequest.error.network`}},`network`);function z(){let e=R.useMessage();return t=>e(t instanceof L?t.code:`network`)}var B=w({state_invalid:{id:`oauth.error.stateInvalid`},state_expired:{id:`oauth.error.stateExpired`},code_exchange_failed:{id:`oauth.error.codeExchangeFailed`},profile_fetch_failed:{id:`oauth.error.profileFetchFailed`},email_missing:{id:`oauth.error.emailMissing`},email_unverified:{id:`oauth.error.emailUnverified`},domain_not_allowed:{id:`oauth.error.domainNotAllowed`},account_disabled:{id:`oauth.error.accountDisabled`},link_broken:{id:`oauth.error.linkBroken`},registration_closed:{id:`oauth.error.registrationClosed`},provider_not_configured:{id:`oauth.error.providerNotConfigured`}},{id:`oauth.error.fallback`});B.descriptor;var V=B.useMessage;B._messages;var H=e(t());function U(){let e=c(),t=te.useSearch(),n=v(),{i18n:a}=ee(),x=S(),w=F(),M=V(),P=N(),L=z(),[R,B]=(0,j.useState)(null),[U,W]=(0,j.useState)(!1),[G,K]=(0,j.useState)(null),q=i(o.auth.oauthProviders.queryOptions()),J=s({mutationFn:e=>C(e.email),onMutate:()=>B(null),onSuccess:async()=>{await e.options.context.queryClient.invalidateQueries({queryKey:re}),await e.navigate({to:`/`})},onError:e=>{B(e instanceof b?e.code:`unknown`)}}),Y=s({mutationFn:e=>I(e.email),onMutate:()=>{K(null),W(!1)},onSuccess:()=>W(!0),onError:e=>K(L(e))}),X=E({resolver:k(ne),defaultValues:{email:``},mode:`onChange`}),le=X.handleSubmit(({email:e})=>{J.mutate({email:e||void 0})}),ue=()=>{let e=X.getValues(`email`).trim();if(!e){K(a._(`login.magicLink.emailRequired`,void 0,{message:`Enter your email above first.`}));return}Y.mutate({email:e})},de=e=>{l(e),window.location.assign(d(t,e))},Z=M(t.oauth_error),Q=w(t.magic_link_error),$=P(t.email_change_error),fe=!!t.email_change_success;return U?(0,H.jsxs)(g,{"data-testid":`login-magic-link-sent`,children:[(0,H.jsxs)(p,{children:[(0,H.jsx)(f,{children:(0,H.jsx)(`h1`,{"data-testid":`login-heading`,children:(0,H.jsx)(r,{id:`login.magicLink.sent.title`,message:`Check your email`})})}),(0,H.jsx)(h,{children:(0,H.jsx)(r,{id:`login.magicLink.sent.description`,message:`If an account exists for this email, we sent a sign-in link. The link expires in 15 minutes.`})})]}),(0,H.jsx)(m,{children:(0,H.jsx)(_,{type:`button`,variant:`outline`,onClick:()=>W(!1),"data-testid":`login-magic-link-back`,children:(0,H.jsx)(r,{id:`login.magicLink.back`,message:`Back`})})})]}):(0,H.jsxs)(g,{children:[(0,H.jsxs)(p,{children:[(0,H.jsx)(f,{children:(0,H.jsx)(`h1`,{"data-testid":`login-heading`,children:(0,H.jsx)(r,{id:`login.title`,message:`Sign in`})})}),(0,H.jsx)(h,{children:(0,H.jsx)(r,{id:`login.description`,message:`Use a passkey, get a one-time email link, or continue with a provider.`})})]}),(0,H.jsxs)(m,{children:[(0,H.jsx)(ce,{...X,children:(0,H.jsxs)(`form`,{className:`flex flex-col gap-4`,onSubmit:le,children:[(0,H.jsx)(ie,{control:X.control,name:`email`,render:({field:e})=>(0,H.jsxs)(T,{children:[(0,H.jsx)(oe,{children:(0,H.jsx)(r,{id:`login.email.label`,message:`Email`})}),(0,H.jsx)(ae,{children:(0,H.jsx)(y,{type:`email`,autoComplete:`username webauthn`,disabled:J.isPending||Y.isPending,"data-testid":`login-email-input`,...e})}),(0,H.jsx)(se,{})]})}),R?(0,H.jsx)(O,{variant:`destructive`,"data-testid":`login-passkey-error`,children:(0,H.jsx)(D,{children:x(R)})}):null,Z?(0,H.jsx)(O,{variant:`destructive`,"data-testid":`login-oauth-error`,children:(0,H.jsx)(D,{children:Z})}):null,Q?(0,H.jsx)(O,{variant:`destructive`,"data-testid":`login-magic-link-url-error`,children:(0,H.jsx)(D,{children:Q})}):null,G?(0,H.jsx)(O,{variant:`destructive`,"data-testid":`login-magic-link-error`,children:(0,H.jsx)(D,{children:G})}):null,fe?(0,H.jsx)(O,{"data-testid":`login-email-change-success`,children:(0,H.jsx)(D,{children:(0,H.jsx)(r,{id:`login.emailChange.success`,message:`Email confirmed. Sign in with the new address.`})})}):null,$?(0,H.jsx)(O,{variant:`destructive`,"data-testid":`login-email-change-error`,children:(0,H.jsx)(D,{children:$})}):null,(0,H.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row`,children:[(0,H.jsx)(_,{type:`submit`,className:`flex-1`,disabled:J.isPending||Y.isPending,"data-testid":`login-passkey-submit`,children:J.isPending?(0,H.jsx)(r,{id:`login.passkey.pending`,message:`Signing in…`}):(0,H.jsx)(r,{id:`login.passkey.submit`,message:`Sign in with passkey`})}),(0,H.jsx)(_,{type:`button`,variant:`outline`,className:`flex-1`,onClick:ue,disabled:J.isPending||Y.isPending,"data-testid":`login-magic-link-submit`,children:Y.isPending?(0,H.jsx)(r,{id:`login.magicLink.pending`,message:`Sending…`}):(0,H.jsx)(r,{id:`login.magicLink.submit`,message:`Email me a link`})})]})]})}),q.data&&q.data.length>0?(0,H.jsxs)(`div`,{className:`mt-6 flex flex-col gap-3`,"data-testid":`login-oauth-providers`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(A,{className:`flex-1`}),(0,H.jsx)(`span`,{className:`text-muted-foreground text-xs tracking-wide uppercase`,children:(0,H.jsx)(r,{id:`login.oauth.separator`,message:`or`})}),(0,H.jsx)(A,{className:`flex-1`})]}),q.data.map(({key:e,label:t})=>(0,H.jsx)(_,{asChild:!0,variant:`outline`,"data-testid":`login-oauth-${e}`,children:(0,H.jsx)(`a`,{href:`/_plumix/auth/oauth/${e}/start`,children:(0,H.jsx)(r,{id:`login.oauth.continueWith`,message:`Continue with {label}`,values:{label:(0,H.jsx)(`bdi`,{children:t})},comment:`label: the OAuth provider's display name (e.g. 'Google', 'GitHub')`})})},e))]}):null,(0,H.jsx)(u,{currentCode:a.locale,manifest:n,onSelect:de})]})]})}export{U as component};
1
+ import{i as e,t}from"./jsx-runtime-DUAcabCT.js";import{t as n}from"./react-DbyrFoBd.js";import{i as ee,n as r}from"./dist-BL2bKHuR.js";import{f as i,o as a,t as o,u as s}from"./orpc-DURDArDu.js";import{d as c}from"./esm-DfD3iRfG.js";import{n as l,r as u,t as d}from"./-locale-param-BBOzOc5c.js";import{a as f,i as p,n as m,r as h,t as g}from"./card-L2-kK5VK.js";import{G as te,Pt as _,W as ne,Y as re,at as v}from"./index-Ctqj4aiM.js";import{t as y}from"./input-xYuLUQID.js";import{a as b,c as x,o as S,r as C,s as w}from"./passkey-C_CqNV1S.js";import{a as T,f as E,i as ie,n as ae,o as oe,s as se,t as ce}from"./form-C94uy6_t.js";import{n as D,t as O}from"./alert-cwX3fWUu.js";import{t as k}from"./valibot-DKJGiWCI.js";import{t as A}from"./separator-u9O31sRo.js";var j=e(n()),M=w({missing_token:{id:`emailChange.error.missingToken`},token_invalid:{id:`emailChange.error.tokenInvalid`},token_expired:{id:`emailChange.error.tokenExpired`},email_taken:{id:`emailChange.error.emailTaken`},user_not_found:{id:`emailChange.error.userNotFound`},account_disabled:{id:`emailChange.error.accountDisabled`}},{id:`emailChange.error.fallback`});M.descriptor;var N=M.useMessage;M._messages;var P=w({missing_token:{id:`magicLink.error.missingToken`},token_invalid:{id:`magicLink.error.tokenInvalid`},token_expired:{id:`magicLink.error.tokenExpired`},account_disabled:{id:`magicLink.error.accountDisabled`},domain_not_allowed:{id:`magicLink.error.domainNotAllowed`},registration_closed:{id:`magicLink.error.registrationClosed`}},{id:`magicLink.error.fallback`});P.descriptor;var F=P.useMessage;P._messages;async function I(e){let t=await fetch(`${a()}/_plumix/auth/magic-link/request`,{method:`POST`,headers:{"content-type":`application/json`,"x-plumix-request":`1`},body:JSON.stringify({email:e}),credentials:`same-origin`});if(t.status===503)throw L.notConfigured();if(t.status===400)throw L.invalidInput();if(!t.ok)throw L.network();return await t.json()}var L=class e extends Error{static{e.prototype.name=`MagicLinkRequestError`}code;constructor(e){super(e),this.code=e}static notConfigured(){return new e(`not_configured`)}static invalidInput(){return new e(`invalid_input`)}static network(){return new e(`network`)}},R=x({not_configured:{id:`magicLinkRequest.error.notConfigured`},invalid_input:{id:`magicLinkRequest.error.invalidInput`},network:{id:`magicLinkRequest.error.network`}},`network`);function z(){let e=R.useMessage();return t=>e(t instanceof L?t.code:`network`)}var B=w({state_invalid:{id:`oauth.error.stateInvalid`},state_expired:{id:`oauth.error.stateExpired`},code_exchange_failed:{id:`oauth.error.codeExchangeFailed`},profile_fetch_failed:{id:`oauth.error.profileFetchFailed`},email_missing:{id:`oauth.error.emailMissing`},email_unverified:{id:`oauth.error.emailUnverified`},domain_not_allowed:{id:`oauth.error.domainNotAllowed`},account_disabled:{id:`oauth.error.accountDisabled`},link_broken:{id:`oauth.error.linkBroken`},registration_closed:{id:`oauth.error.registrationClosed`},provider_not_configured:{id:`oauth.error.providerNotConfigured`}},{id:`oauth.error.fallback`});B.descriptor;var V=B.useMessage;B._messages;var H=e(t());function U(){let e=c(),t=te.useSearch(),n=v(),{i18n:a}=ee(),x=S(),w=F(),M=V(),P=N(),L=z(),[R,B]=(0,j.useState)(null),[U,W]=(0,j.useState)(!1),[G,K]=(0,j.useState)(null),q=i(o.auth.oauthProviders.queryOptions()),J=s({mutationFn:e=>C(e.email),onMutate:()=>B(null),onSuccess:async()=>{await e.options.context.queryClient.invalidateQueries({queryKey:re}),await e.navigate({to:`/`})},onError:e=>{B(e instanceof b?e.code:`unknown`)}}),Y=s({mutationFn:e=>I(e.email),onMutate:()=>{K(null),W(!1)},onSuccess:()=>W(!0),onError:e=>K(L(e))}),X=E({resolver:k(ne),defaultValues:{email:``},mode:`onChange`}),le=X.handleSubmit(({email:e})=>{J.mutate({email:e||void 0})}),ue=()=>{let e=X.getValues(`email`).trim();if(!e){K(a._(`login.magicLink.emailRequired`,void 0,{message:`Enter your email above first.`}));return}Y.mutate({email:e})},de=e=>{l(e),window.location.assign(d(t,e))},Z=M(t.oauth_error),Q=w(t.magic_link_error),$=P(t.email_change_error),fe=!!t.email_change_success;return U?(0,H.jsxs)(g,{"data-testid":`login-magic-link-sent`,children:[(0,H.jsxs)(p,{children:[(0,H.jsx)(f,{children:(0,H.jsx)(`h1`,{"data-testid":`login-heading`,children:(0,H.jsx)(r,{id:`login.magicLink.sent.title`,message:`Check your email`})})}),(0,H.jsx)(h,{children:(0,H.jsx)(r,{id:`login.magicLink.sent.description`,message:`If an account exists for this email, we sent a sign-in link. The link expires in 15 minutes.`})})]}),(0,H.jsx)(m,{children:(0,H.jsx)(_,{type:`button`,variant:`outline`,onClick:()=>W(!1),"data-testid":`login-magic-link-back`,children:(0,H.jsx)(r,{id:`login.magicLink.back`,message:`Back`})})})]}):(0,H.jsxs)(g,{children:[(0,H.jsxs)(p,{children:[(0,H.jsx)(f,{children:(0,H.jsx)(`h1`,{"data-testid":`login-heading`,children:(0,H.jsx)(r,{id:`login.title`,message:`Sign in`})})}),(0,H.jsx)(h,{children:(0,H.jsx)(r,{id:`login.description`,message:`Use a passkey, get a one-time email link, or continue with a provider.`})})]}),(0,H.jsxs)(m,{children:[(0,H.jsx)(ce,{...X,children:(0,H.jsxs)(`form`,{className:`flex flex-col gap-4`,onSubmit:le,children:[(0,H.jsx)(ie,{control:X.control,name:`email`,render:({field:e})=>(0,H.jsxs)(T,{children:[(0,H.jsx)(oe,{children:(0,H.jsx)(r,{id:`login.email.label`,message:`Email`})}),(0,H.jsx)(ae,{children:(0,H.jsx)(y,{type:`email`,autoComplete:`username webauthn`,disabled:J.isPending||Y.isPending,"data-testid":`login-email-input`,...e})}),(0,H.jsx)(se,{})]})}),R?(0,H.jsx)(O,{variant:`destructive`,"data-testid":`login-passkey-error`,children:(0,H.jsx)(D,{children:x(R)})}):null,Z?(0,H.jsx)(O,{variant:`destructive`,"data-testid":`login-oauth-error`,children:(0,H.jsx)(D,{children:Z})}):null,Q?(0,H.jsx)(O,{variant:`destructive`,"data-testid":`login-magic-link-url-error`,children:(0,H.jsx)(D,{children:Q})}):null,G?(0,H.jsx)(O,{variant:`destructive`,"data-testid":`login-magic-link-error`,children:(0,H.jsx)(D,{children:G})}):null,fe?(0,H.jsx)(O,{"data-testid":`login-email-change-success`,children:(0,H.jsx)(D,{children:(0,H.jsx)(r,{id:`login.emailChange.success`,message:`Email confirmed. Sign in with the new address.`})})}):null,$?(0,H.jsx)(O,{variant:`destructive`,"data-testid":`login-email-change-error`,children:(0,H.jsx)(D,{children:$})}):null,(0,H.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row`,children:[(0,H.jsx)(_,{type:`submit`,className:`flex-1`,disabled:J.isPending||Y.isPending,"data-testid":`login-passkey-submit`,children:J.isPending?(0,H.jsx)(r,{id:`login.passkey.pending`,message:`Signing in…`}):(0,H.jsx)(r,{id:`login.passkey.submit`,message:`Sign in with passkey`})}),(0,H.jsx)(_,{type:`button`,variant:`outline`,className:`flex-1`,onClick:ue,disabled:J.isPending||Y.isPending,"data-testid":`login-magic-link-submit`,children:Y.isPending?(0,H.jsx)(r,{id:`login.magicLink.pending`,message:`Sending…`}):(0,H.jsx)(r,{id:`login.magicLink.submit`,message:`Email me a link`})})]})]})}),q.data&&q.data.length>0?(0,H.jsxs)(`div`,{className:`mt-6 flex flex-col gap-3`,"data-testid":`login-oauth-providers`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(A,{className:`flex-1`}),(0,H.jsx)(`span`,{className:`text-muted-foreground text-xs tracking-wide uppercase`,children:(0,H.jsx)(r,{id:`login.oauth.separator`,message:`or`})}),(0,H.jsx)(A,{className:`flex-1`})]}),q.data.map(({key:e,label:t})=>(0,H.jsx)(_,{asChild:!0,variant:`outline`,"data-testid":`login-oauth-${e}`,children:(0,H.jsx)(`a`,{href:`/_plumix/auth/oauth/${e}/start`,children:(0,H.jsx)(r,{id:`login.oauth.continueWith`,message:`Continue with {label}`,values:{label:(0,H.jsx)(`bdi`,{children:t})},comment:`label: the OAuth provider's display name (e.g. 'Google', 'GitHub')`})})},e))]}):null,(0,H.jsx)(u,{currentCode:a.locale,manifest:n,onSelect:de})]})]})}export{U as component};
@@ -1 +1 @@
1
- import{i as e,t}from"./jsx-runtime-DUAcabCT.js";import{t as n}from"./react-DbyrFoBd.js";import{n as r}from"./dist-BL2bKHuR.js";import{t as i,u as a}from"./orpc-DURDArDu.js";import{t as o}from"./use-label-CykSHq9A.js";import{D as s,T as c,h as l,r as u,w as d,y as f}from"./dist-ClOzYsk5.js";import{o as p}from"./validation-CwFumc7a.js";import{a as m,i as h,n as g,r as _,t as v}from"./card-L2-kK5VK.js";import{O as y,Pt as b}from"./index-kTp--tHG.js";import{t as x}from"./input-xYuLUQID.js";import{a as S,f as C,i as w,n as T,o as E,s as D,t as O}from"./form-C94uy6_t.js";import{n as k,t as A}from"./alert-cwX3fWUu.js";import{t as j}from"./valibot-DKJGiWCI.js";import{n as M}from"./orpc-errors-DWk96ZMY.js";var N=e(n()),P={notConfigured:{id:`mailer.test.error.notConfigured`},sendFailed:{id:`mailer.test.error.sendFailed`},fallback:{id:`mailer.test.error.fallback`}};function F(e){let t=M(e);return t===`mailer_not_configured`?P.notConfigured:t===`mailer_send_failed`?P.sendFailed:e instanceof Error?e.message:P.fallback}var I=e(t()),L=l({to:f(d(),s(),c(),u(p({id:`mailer.test.recipient.invalid`})))}),R={placeholder:{id:`mailer.test.recipient.placeholder`}};function z(){let{user:e}=y.useRouteContext(),t=o(),[n,s]=(0,N.useState)(null),c=C({resolver:j(L),defaultValues:{to:e.email},mode:`onBlur`}),l=a({mutationFn:e=>i.auth.mailer.testSend.call(e),onMutate:()=>{s(null)},onSuccess:(e,t)=>{s({kind:`ok`,to:t.to})},onError:e=>{s({kind:`error`,message:F(e)})}}),u=c.handleSubmit(e=>{l.mutate({to:e.to})}),d=n?.kind===`ok`?(0,I.jsx)(`bdi`,{children:n.to}):null;return(0,I.jsxs)(`div`,{className:`mx-auto flex w-full max-w-2xl flex-col gap-4`,children:[(0,I.jsxs)(`header`,{className:`flex flex-col gap-1`,children:[(0,I.jsx)(`h1`,{className:`text-2xl font-semibold`,"data-testid":`mailer-heading`,children:(0,I.jsx)(r,{id:`mailer.title`,message:`Mailer`})}),(0,I.jsx)(`p`,{className:`text-muted-foreground text-sm`,children:(0,I.jsx)(r,{id:`mailer.description`,message:`Test that the configured outbound-email transport actually delivers. Used by magic-link sign-in, invite emails, and any plugin that opts into the shared mailer.`})})]}),(0,I.jsxs)(v,{children:[(0,I.jsxs)(h,{children:[(0,I.jsx)(m,{children:(0,I.jsx)(r,{id:`mailer.test.title`,message:`Send a test message`})}),(0,I.jsx)(_,{children:(0,I.jsx)(r,{id:`mailer.test.description`,message:`Sends a one-off message via the same transport magic-link uses. Failures surface here verbatim — distinct from the magic-link request flow, which intentionally swallows mailer errors so the response shape can't leak whether an email is registered.`})})]}),(0,I.jsx)(g,{children:(0,I.jsx)(O,{...c,children:(0,I.jsxs)(`form`,{className:`flex flex-col gap-4`,onSubmit:u,children:[(0,I.jsx)(w,{control:c.control,name:`to`,render:({field:e})=>(0,I.jsxs)(S,{children:[(0,I.jsx)(E,{children:(0,I.jsx)(r,{id:`mailer.test.recipient.label`,message:`Recipient`})}),(0,I.jsx)(T,{children:(0,I.jsx)(x,{type:`email`,autoComplete:`email`,placeholder:t(R.placeholder),disabled:l.isPending,"data-testid":`mailer-test-recipient`,...e})}),(0,I.jsx)(D,{})]})}),n?.kind===`ok`?(0,I.jsx)(A,{"data-testid":`mailer-test-feedback`,children:(0,I.jsx)(k,{children:(0,I.jsx)(r,{id:`mailer.test.feedback.ok`,message:`Test message sent to {to}. If it doesn't arrive within a minute, check your transport adapter's logs.`,values:{to:d},comment:`to: the recipient email address the test was sent to`})})}):null,n?.kind===`error`?(0,I.jsx)(A,{variant:`destructive`,"data-testid":`mailer-test-error`,children:(0,I.jsx)(k,{children:t(n.message)})}):null,(0,I.jsx)(`div`,{className:`flex justify-end`,children:(0,I.jsx)(b,{type:`submit`,disabled:l.isPending,"data-testid":`mailer-test-submit`,children:l.isPending?(0,I.jsx)(r,{id:`mailer.test.submit.pending`,message:`Sending…`}):(0,I.jsx)(r,{id:`mailer.test.submit.idle`,message:`Send test`})})})]})})})]})]})}export{z as component};
1
+ import{i as e,t}from"./jsx-runtime-DUAcabCT.js";import{t as n}from"./react-DbyrFoBd.js";import{n as r}from"./dist-BL2bKHuR.js";import{t as i,u as a}from"./orpc-DURDArDu.js";import{t as o}from"./use-label-CykSHq9A.js";import{D as s,T as c,h as l,r as u,w as d,y as f}from"./dist-ClOzYsk5.js";import{o as p}from"./validation-CwFumc7a.js";import{a as m,i as h,n as g,r as _,t as v}from"./card-L2-kK5VK.js";import{O as y,Pt as b}from"./index-Ctqj4aiM.js";import{t as x}from"./input-xYuLUQID.js";import{a as S,f as C,i as w,n as T,o as E,s as D,t as O}from"./form-C94uy6_t.js";import{n as k,t as A}from"./alert-cwX3fWUu.js";import{t as j}from"./valibot-DKJGiWCI.js";import{n as M}from"./orpc-errors-DWk96ZMY.js";var N=e(n()),P={notConfigured:{id:`mailer.test.error.notConfigured`},sendFailed:{id:`mailer.test.error.sendFailed`},fallback:{id:`mailer.test.error.fallback`}};function F(e){let t=M(e);return t===`mailer_not_configured`?P.notConfigured:t===`mailer_send_failed`?P.sendFailed:e instanceof Error?e.message:P.fallback}var I=e(t()),L=l({to:f(d(),s(),c(),u(p({id:`mailer.test.recipient.invalid`})))}),R={placeholder:{id:`mailer.test.recipient.placeholder`}};function z(){let{user:e}=y.useRouteContext(),t=o(),[n,s]=(0,N.useState)(null),c=C({resolver:j(L),defaultValues:{to:e.email},mode:`onBlur`}),l=a({mutationFn:e=>i.auth.mailer.testSend.call(e),onMutate:()=>{s(null)},onSuccess:(e,t)=>{s({kind:`ok`,to:t.to})},onError:e=>{s({kind:`error`,message:F(e)})}}),u=c.handleSubmit(e=>{l.mutate({to:e.to})}),d=n?.kind===`ok`?(0,I.jsx)(`bdi`,{children:n.to}):null;return(0,I.jsxs)(`div`,{className:`mx-auto flex w-full max-w-2xl flex-col gap-4`,children:[(0,I.jsxs)(`header`,{className:`flex flex-col gap-1`,children:[(0,I.jsx)(`h1`,{className:`text-2xl font-semibold`,"data-testid":`mailer-heading`,children:(0,I.jsx)(r,{id:`mailer.title`,message:`Mailer`})}),(0,I.jsx)(`p`,{className:`text-muted-foreground text-sm`,children:(0,I.jsx)(r,{id:`mailer.description`,message:`Test that the configured outbound-email transport actually delivers. Used by magic-link sign-in, invite emails, and any plugin that opts into the shared mailer.`})})]}),(0,I.jsxs)(v,{children:[(0,I.jsxs)(h,{children:[(0,I.jsx)(m,{children:(0,I.jsx)(r,{id:`mailer.test.title`,message:`Send a test message`})}),(0,I.jsx)(_,{children:(0,I.jsx)(r,{id:`mailer.test.description`,message:`Sends a one-off message via the same transport magic-link uses. Failures surface here verbatim — distinct from the magic-link request flow, which intentionally swallows mailer errors so the response shape can't leak whether an email is registered.`})})]}),(0,I.jsx)(g,{children:(0,I.jsx)(O,{...c,children:(0,I.jsxs)(`form`,{className:`flex flex-col gap-4`,onSubmit:u,children:[(0,I.jsx)(w,{control:c.control,name:`to`,render:({field:e})=>(0,I.jsxs)(S,{children:[(0,I.jsx)(E,{children:(0,I.jsx)(r,{id:`mailer.test.recipient.label`,message:`Recipient`})}),(0,I.jsx)(T,{children:(0,I.jsx)(x,{type:`email`,autoComplete:`email`,placeholder:t(R.placeholder),disabled:l.isPending,"data-testid":`mailer-test-recipient`,...e})}),(0,I.jsx)(D,{})]})}),n?.kind===`ok`?(0,I.jsx)(A,{"data-testid":`mailer-test-feedback`,children:(0,I.jsx)(k,{children:(0,I.jsx)(r,{id:`mailer.test.feedback.ok`,message:`Test message sent to {to}. If it doesn't arrive within a minute, check your transport adapter's logs.`,values:{to:d},comment:`to: the recipient email address the test was sent to`})})}):null,n?.kind===`error`?(0,I.jsx)(A,{variant:`destructive`,"data-testid":`mailer-test-error`,children:(0,I.jsx)(k,{children:t(n.message)})}):null,(0,I.jsx)(`div`,{className:`flex justify-end`,children:(0,I.jsx)(b,{type:`submit`,disabled:l.isPending,"data-testid":`mailer-test-submit`,children:l.isPending?(0,I.jsx)(r,{id:`mailer.test.submit.pending`,message:`Sending…`}):(0,I.jsx)(r,{id:`mailer.test.submit.idle`,message:`Send test`})})})]})})})]})]})}export{z as component};
@@ -1 +1 @@
1
- import{i as e,t}from"./jsx-runtime-DUAcabCT.js";import"./utils-DkCVtsc2.js";import{t as n}from"./use-label-CykSHq9A.js";import{a as r,i,n as a,r as o,t as s}from"./card-L2-kK5VK.js";import{t as c}from"./meta-box-field-r9w3rM8k.js";import{t as l}from"./meta-box-grid-Dr2ygaxj.js";var u=e(t(),1);function d({box:e,basePath:t,disabled:c=!1}){let l=n();return(0,u.jsxs)(s,{className:`@container`,"data-testid":`meta-box-${e.id}`,children:[(0,u.jsxs)(i,{children:[(0,u.jsx)(r,{children:(0,u.jsx)(`h2`,{className:`text-lg font-semibold`,"data-testid":`meta-box-heading-${e.id}`,children:l(e.label)})}),e.description?(0,u.jsx)(o,{children:l(e.description)}):null]}),(0,u.jsx)(a,{children:(0,u.jsx)(f,{box:e,basePath:t,disabled:c})})]})}function f({box:e,basePath:t,disabled:n}){return(0,u.jsx)(`div`,{className:`grid grid-cols-12 gap-4`,children:e.fields.map(e=>(0,u.jsx)(c,{field:e,name:`${t}.${e.key}`,disabled:n??!1,className:l(e.span)},e.key))})}export{d as t};
1
+ import{i as e,t}from"./jsx-runtime-DUAcabCT.js";import"./utils-ByiwTMhM.js";import{t as n}from"./use-label-CykSHq9A.js";import{a as r,i,n as a,r as o,t as s}from"./card-L2-kK5VK.js";import{t as c}from"./meta-box-field-C4Orbu3m.js";import{t as l}from"./meta-box-grid-BfWeRDWA.js";var u=e(t(),1);function d({box:e,basePath:t,disabled:c=!1}){let l=n();return(0,u.jsxs)(s,{className:`@container`,"data-testid":`meta-box-${e.id}`,children:[(0,u.jsxs)(i,{children:[(0,u.jsx)(r,{children:(0,u.jsx)(`h2`,{className:`text-lg font-semibold`,"data-testid":`meta-box-heading-${e.id}`,children:l(e.label)})}),e.description?(0,u.jsx)(o,{children:l(e.description)}):null]}),(0,u.jsx)(a,{children:(0,u.jsx)(f,{box:e,basePath:t,disabled:c})})]})}function f({box:e,basePath:t,disabled:n}){return(0,u.jsx)(`div`,{className:`grid grid-cols-12 gap-4`,children:e.fields.map(e=>(0,u.jsx)(c,{field:e,name:`${t}.${e.key}`,disabled:n??!1,className:l(e.span)},e.key))})}export{d as t};
@@ -1 +1 @@
1
- import{i as e,t}from"./jsx-runtime-DUAcabCT.js";import{t as n}from"./react-DbyrFoBd.js";import{i as r,n as i}from"./dist-BL2bKHuR.js";import{f as a,t as o}from"./orpc-DURDArDu.js";import{c as s,d as c,f as l,l as u,p as d}from"./breadcrumb-kPG_yvD8.js";import{n as f,r as p,t as m}from"./textarea-BsZaGkV-.js";import{M as h,X as g,j as _,m as v,n as y,t as b,w as x}from"./utils-DkCVtsc2.js";import{t as S}from"./use-label-CykSHq9A.js";import{i as C,t as w}from"./type-labels-DEpt0nSb.js";import{t as T}from"./skeleton-BnBM1862.js";import{F as E,I as D,L as O,P as k,Pt as A,Q as j,R as M,u as N}from"./index-kTp--tHG.js";import{t as P}from"./input-xYuLUQID.js";import{a as F,i as I,n as L,o as R,r as z,s as B}from"./form-C94uy6_t.js";function V(){let e=S();return(t,n)=>{if(t!==null)return t;if(n!==void 0){let t=j(n);if(t)return e(w(t,`untitledItem`))}return e(C.untitledItem)}}var H=e(n(),1),U=e(t(),1),W={resolveError:{id:`metaBox.multiReference.resolveError`},emptyValue:{id:`metaBox.multiReference.emptyValue`},orphan:{id:`metaBox.multiReference.orphan`},selectIdle:{id:`metaBox.multiReference.selectIdle`},addMore:{id:`metaBox.multiReference.addMore`},loading:{id:`metaBox.multiReference.loading`},noMatches:{id:`metaBox.multiReference.noMatches`},dialogDescription:{id:`metaBox.multiReference.dialogDescription`},searchPlaceholder:{id:`metaBox.multiReference.searchPlaceholder`}};function G({value:e,onChange:t,kind:n,scope:f,max:p,disabled:m=!1,required:h=!1,label:g,testId:_}){let{i18n:y}=r(),b=S(),x=V(),[C,w]=(0,H.useState)(!1),[E,D]=(0,H.useState)(``),O=a({...o.lookup.list.queryOptions({input:{kind:n,scope:f,ids:[...e]}}),enabled:e.length>0}),k=(0,H.useMemo)(()=>{let e=new Map;for(let t of O.data?.items??[])e.set(t.id,t);return e},[O.data]),j=a({...o.lookup.list.queryOptions({input:{kind:n,query:E.trim()||void 0,scope:f,limit:20}}),enabled:C}),M=j.data?.items??[],N=new Set(e),P=p!==void 0&&e.length>=p,F=n=>{N.has(n)||P||t([...e,n])},I=n=>{t(e.filter(e=>e!==n))},L=e=>{t(e.map(e=>e.id))},R=e.length>0&&O.data===void 0&&!O.isError,z=e.map(e=>{let t=k.get(e)??null;return{id:e,result:t,pending:t===null&&R}}),B=y._(W.dialogDescription.id,{kind:n},{message:W.dialogDescription.message}),G=y._(W.searchPlaceholder.id,{kind:n},{message:W.searchPlaceholder.message});return(0,U.jsxs)(`div`,{className:`flex flex-col gap-2`,"data-testid":_,children:[O.isError?(0,U.jsx)(`p`,{className:`text-destructive text-sm`,"data-testid":`${_}-resolve-error`,children:(0,U.jsx)(i,{id:`metaBox.multiReference.resolveError`,message:`Couldn’t load selected items — refresh to retry.`})}):null,e.length===0?(0,U.jsx)(`p`,{className:`text-muted-foreground text-sm`,"data-testid":`${_}-empty`,children:(0,U.jsx)(i,{id:`metaBox.multiReference.emptyValue`,message:`None selected`})}):(0,U.jsx)(v,{items:z,onReorder:L,onRemove:h&&e.length===1?void 0:I,renderItem:e=>e.result?(0,U.jsxs)(`div`,{className:`text-sm`,children:[(0,U.jsx)(`p`,{className:`truncate font-medium`,children:x(e.result.label,e.result.targetType)}),e.result.subtitle?(0,U.jsx)(`p`,{className:`text-muted-foreground truncate text-xs`,children:e.result.subtitle}):null]}):e.pending?(0,U.jsxs)(`div`,{className:`flex flex-col gap-1.5`,"data-testid":`${_}-resolving-${e.id}`,"aria-busy":`true`,children:[(0,U.jsx)(T,{className:`h-4 w-32`}),(0,U.jsx)(T,{className:`h-3 w-20`})]}):(0,U.jsx)(`p`,{className:`text-destructive text-sm`,"data-testid":`${_}-orphan-${e.id}`,children:(0,U.jsx)(i,{id:`metaBox.multiReference.orphan`,message:`Reference missing — remove or re-pick`})}),disabled:m,testId:`${_}-list`}),(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,U.jsx)(A,{type:`button`,variant:`outline`,size:`sm`,disabled:m||P,onClick:()=>{D(``),w(!0)},"data-testid":`${_}-add`,children:e.length===0?b(W.selectIdle):b(W.addMore)}),p===void 0?null:(0,U.jsxs)(`span`,{className:`text-muted-foreground text-xs`,"data-testid":`${_}-count`,children:[e.length,` / `,p]})]}),(0,U.jsxs)(s,{open:C,onOpenChange:w,title:g,description:B,children:[(0,U.jsx)(c,{placeholder:G,value:E,onValueChange:D,"data-testid":`${_}-search`}),(0,U.jsx)(d,{children:j.isLoading?(0,U.jsx)(u,{children:(0,U.jsx)(i,{id:`metaBox.multiReference.loading`,message:`Loading…`})}):M.length===0?(0,U.jsx)(u,{children:(0,U.jsx)(i,{id:`metaBox.multiReference.noMatches`,message:`No matches`})}):M.map(e=>{let t=N.has(e.id);return(0,U.jsx)(l,{value:`${e.label??``} ${e.subtitle??``}`,disabled:t||P,onSelect:()=>{F(e.id)},"data-testid":`${_}-option-${e.id}`,children:(0,U.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,U.jsxs)(`span`,{className:`text-sm font-medium`,children:[x(e.label,e.targetType),t?` ✓`:``]}),e.subtitle?(0,U.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:e.subtitle}):null]})},e.id)})})]})]})}var ee=class extends H.Component{constructor(e){super(e),this.state={error:null,resetKey:e.resetKey}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return e.resetKey===t.resetKey?null:{error:null,resetKey:e.resetKey}}componentDidCatch(e,t){console.error(`[plumix] plugin field renderer for "${this.props.inputType}" (field "${this.props.fieldKey}") crashed:`,e,t)}render(){return this.state.error?(0,U.jsx)(`p`,{className:`text-destructive text-sm`,"data-testid":`${this.props.testId}-plugin-error`,children:(0,U.jsx)(i,{id:`metaBox.pluginField.crashed`,message:`This field couldn’t render. Check the browser console for details.`})}):this.props.children}},K={selectIdle:{id:`metaBox.reference.selectIdle`},selectChange:{id:`metaBox.reference.selectChange`},clear:{id:`metaBox.reference.clear`},emptyValue:{id:`metaBox.reference.emptyValue`},orphan:{id:`metaBox.reference.orphan`},loading:{id:`metaBox.reference.loading`},noMatches:{id:`metaBox.reference.noMatches`},dialogDescription:{id:`metaBox.reference.dialogDescription`},searchPlaceholder:{id:`metaBox.reference.searchPlaceholder`}};function te({value:e,onChange:t,kind:n,scope:i,disabled:l=!1,required:u=!1,label:f,testId:p}){let{i18n:m}=r(),h=S(),g=V(),[_,v]=(0,H.useState)(!1),[y,b]=(0,H.useState)(``),x=a({...o.lookup.resolve.queryOptions({input:{kind:n,id:e??``,scope:i}}),enabled:e!==null}),C=a({...o.lookup.list.queryOptions({input:{kind:n,query:y.trim()||void 0,scope:i,limit:20}}),enabled:_}),w=e===null?null:x.data?.result??null,T=C.data?.items??[],E=m._(K.dialogDescription.id,{kind:n},{message:K.dialogDescription.message}),D=m._(K.searchPlaceholder.id,{kind:n},{message:K.searchPlaceholder.message});return(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,"data-testid":p,children:[(0,U.jsx)(`div`,{className:`min-w-0 flex-1`,children:ne({testId:p,value:e,selected:w,isResolving:x.isLoading,untitledLabel:g})}),(0,U.jsx)(A,{type:`button`,variant:`outline`,size:`sm`,disabled:l,onClick:()=>{b(``),v(!0)},"data-testid":`${p}-open`,children:h(e===null?K.selectIdle:K.selectChange)}),e!==null&&!u?(0,U.jsx)(A,{type:`button`,variant:`ghost`,size:`sm`,disabled:l,onClick:()=>{t(null)},"data-testid":`${p}-clear`,children:h(K.clear)}):null,(0,U.jsxs)(s,{open:_,onOpenChange:v,title:f,description:E,children:[(0,U.jsx)(c,{placeholder:D,value:y,onValueChange:b,"data-testid":`${p}-search`}),(0,U.jsx)(d,{children:re({isLoading:C.isLoading,items:T,testId:p,onSelect:e=>{t(e),v(!1)},untitledLabel:g})})]})]})}function ne({testId:e,value:t,selected:n,isResolving:r,untitledLabel:a}){return t===null?(0,U.jsx)(`p`,{className:`text-muted-foreground text-sm`,"data-testid":`${e}-empty`,children:(0,U.jsx)(i,{id:`metaBox.reference.emptyValue`,message:`None selected`})}):n?(0,U.jsxs)(`div`,{className:`text-sm`,"data-testid":`${e}-selected`,children:[(0,U.jsx)(`p`,{className:`truncate font-medium`,children:a(n.label,n.targetType)}),n.subtitle?(0,U.jsx)(`p`,{className:`text-muted-foreground truncate text-xs`,children:n.subtitle}):null]}):r?(0,U.jsxs)(`div`,{className:`flex flex-col gap-1.5`,"data-testid":`${e}-resolving`,"aria-busy":`true`,children:[(0,U.jsx)(T,{className:`h-4 w-32`}),(0,U.jsx)(T,{className:`h-3 w-20`})]}):(0,U.jsx)(`p`,{className:`text-destructive text-sm`,"data-testid":`${e}-orphan`,children:(0,U.jsx)(i,{id:`metaBox.reference.orphan`,message:`Reference missing — re-pick or clear`})})}function re({isLoading:e,items:t,testId:n,onSelect:r,untitledLabel:a}){return e?(0,U.jsx)(u,{children:(0,U.jsx)(i,{id:`metaBox.reference.loading`,message:`Loading…`})}):t.length===0?(0,U.jsx)(u,{children:(0,U.jsx)(i,{id:`metaBox.reference.noMatches`,message:`No matches`})}):t.map(e=>(0,U.jsx)(l,{value:`${e.label??``} ${e.subtitle??``}`,onSelect:()=>{r(e.id)},"data-testid":`${n}-option-${e.id}`,children:(0,U.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,U.jsx)(`span`,{className:`text-sm font-medium`,children:a(e.label,e.targetType)}),e.subtitle?(0,U.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:e.subtitle}):null]})},e.id))}function ie(e){return Array.isArray(e)?e.filter(e=>typeof e==`object`&&!!e&&!Array.isArray(e)):[]}function ae({field:e,rhf:t,disabled:n,testId:r}){let a=e.subFields??[],o=typeof e.max==`number`?e.max:void 0,s=typeof e.min==`number`?e.min:void 0,c=ie(t.value),l=(0,H.useId)(),u=o!==void 0&&c.length>=o,d=c.map((e,t)=>({id:`${l}-r${t}`,index:t})),f=e=>{t.onChange(e)};return(0,U.jsxs)(`div`,{"data-testid":r,className:`border-input flex flex-col gap-2 rounded-md border p-2`,children:[c.length===0?(0,U.jsx)(`p`,{className:`text-muted-foreground text-sm`,"data-testid":`${r}-empty`,children:(0,U.jsx)(i,{id:`metaBox.repeater.empty`,message:`No rows`})}):(0,U.jsx)(v,{items:d,onReorder:e=>{f(e.map(e=>c[e.index]??{}))},onRemove:n?void 0:e=>{let t=d.findIndex(t=>t.id===e);if(t===-1)return;let n=[...c];n.splice(t,1),f(n)},disabled:n,testId:`${r}-list`,renderItem:e=>(0,U.jsx)(se,{subFields:a,rowName:`${t.name}.${e.index}`,disabled:n,testId:`${r}-row-${e.index}`})}),(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,U.jsxs)(A,{type:`button`,variant:`outline`,size:`sm`,disabled:n||u,onClick:()=>{if(u)return;let e={};for(let t of a)e[t.key]=t.default??null;f([...c,e])},"data-testid":`${r}-add`,children:[(0,U.jsx)(g,{className:`size-4`}),c.length===0?(0,U.jsx)(i,{id:`metaBox.repeater.addFirst`,message:`Add row`}):(0,U.jsx)(i,{id:`metaBox.repeater.addAnother`,message:`Add another`})]}),o!==void 0||s!==void 0?(0,U.jsxs)(`span`,{className:`text-muted-foreground text-xs`,"data-testid":`${r}-count`,children:[c.length,(0,U.jsx)(oe,{min:s,max:o})]}):null]})]})}function oe({min:e,max:t}){return e!==void 0&&t!==void 0?(0,U.jsx)(i,{id:`metaBox.repeater.countSuffixBoth`,message:` / min {min} / max {max}`,values:{min:e,max:t},comment:`min, max: integers bounding the repeater row count`}):e===void 0?t===void 0?null:(0,U.jsx)(i,{id:`metaBox.repeater.countSuffixMax`,message:` / max {max}`,values:{max:t},comment:`max: upper bound on the repeater row count`}):(0,U.jsx)(i,{id:`metaBox.repeater.countSuffixMin`,message:` / min {min}`,values:{min:e},comment:`min: lower bound on the repeater row count`})}function se({subFields:e,rowName:t,disabled:n,testId:r}){return(0,U.jsx)(`div`,{className:`flex flex-col gap-2`,"data-testid":r,children:e.map(e=>(0,U.jsx)(q,{field:e,name:`${t}.${e.key}`,disabled:n},e.key))})}var ce={invalidJson:{id:`metaBox.field.json.invalid`}};function q({field:e,name:t,disabled:n=!1,className:r}){let i=S(),a=i(e.label),o=`meta-box-field-${e.key}`,s=`${o}-input`;return(0,U.jsx)(I,{name:t,render:({field:t})=>e.inputType===`checkbox`?(0,U.jsxs)(F,{className:r,"data-testid":o,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,U.jsx)(L,{children:(0,U.jsx)(h,{name:t.name,checked:t.value===!0,required:e.required,disabled:n,onBlur:t.onBlur,onCheckedChange:e=>{t.onChange(e===!0)},"data-testid":s})}),(0,U.jsx)(R,{children:a})]}),e.description?(0,U.jsx)(z,{"data-testid":`${o}-description`,children:i(e.description)}):null,(0,U.jsx)(B,{})]}):e.inputType===`select`&&N(e.inputType)===void 0?(0,U.jsxs)(F,{className:r,"data-testid":o,children:[(0,U.jsx)(R,{children:a}),(0,U.jsxs)(k,{name:t.name,value:Y($(t.value)),onValueChange:e=>{t.onChange(le(e))},disabled:n,required:e.required,children:[(0,U.jsx)(L,{children:(0,U.jsx)(O,{className:`w-full`,onBlur:t.onBlur,"data-testid":s,children:(0,U.jsx)(M,{})})}),(0,U.jsx)(E,{children:(e.options??[]).map(e=>(0,U.jsx)(D,{value:Y(e.value),"data-testid":`${s}-option-${e.value}`,children:i(e.label)},e.value))})]}),e.description?(0,U.jsx)(z,{"data-testid":`${o}-description`,children:i(e.description)}):null,(0,U.jsx)(B,{})]}):(0,U.jsxs)(F,{className:r,"data-testid":o,children:[(0,U.jsx)(R,{children:a}),(0,U.jsx)(L,{children:Se({field:e,rhf:t,disabled:n,testId:s,renderLabel:i})}),e.description?(0,U.jsx)(z,{"data-testid":`${o}-description`,children:i(e.description)}):null,(0,U.jsx)(B,{})]})})}var J=`__plumix_empty__`;function Y(e){return e===``?J:e}function le(e){return e===J?``:e}function X({rhf:e,field:t,disabled:n,testId:r}){return{name:e.name,ref:e.ref,required:t.required,disabled:n,onBlur:e.onBlur,"data-testid":r}}function Z({field:e,renderLabel:t}){return e.placeholder?t(e.placeholder):void 0}function ue(e){let{field:t,rhf:n}=e,r=Z(e);return(0,U.jsx)(m,{...X(e),value:$(n.value),maxLength:t.maxLength,placeholder:r,rows:3,onChange:e=>{n.onChange(e.target.value)},className:`min-h-20`})}function de(e){let{field:t,rhf:n}=e,r=Z(e);return(0,U.jsx)(P,{...X(e),type:`number`,value:Ce(n.value),placeholder:r,min:t.min,max:t.max,step:t.step??1,onChange:e=>{let t=e.target.value;if(t===``){n.onChange(null);return}let r=Number(t);Number.isFinite(r)&&n.onChange(r)}})}function fe({field:e,rhf:t,disabled:n,testId:r}){return(0,U.jsx)(_,{value:$(t.value),onChange:e=>{t.onChange(e)},disabled:n,required:e.required,name:t.name,testId:r})}function pe({field:e,rhf:t,disabled:n,testId:r,renderLabel:i}){let a=i(e.label),o=typeof t.value==`number`?t.value:Number(t.value),s=we(e.min,0),c=we(e.max,100),l=Number.isFinite(o)?o:s;return(0,U.jsxs)(`div`,{className:`flex items-center gap-3`,"data-testid":r,children:[(0,U.jsx)(x,{name:t.name,min:s,max:c,step:e.step??1,value:[l],disabled:n,onValueChange:e=>{let n=e[0];typeof n==`number`&&Number.isFinite(n)&&t.onChange(n)},onBlur:t.onBlur,"aria-label":a,"aria-required":e.required,"data-testid":`${r}-slider`,className:`flex-1`}),(0,U.jsx)(`span`,{className:`text-muted-foreground min-w-[3ch] text-end text-sm tabular-nums`,"data-testid":`${r}-display`,children:Number.isFinite(o)?o:`–`})]})}function me({field:e,rhf:t,disabled:n,testId:r}){return(0,U.jsx)(ae,{field:e,rhf:t,disabled:n,testId:r})}function he({field:e,rhf:t,disabled:n,testId:r,renderLabel:i}){let a=i(e.label);return(0,U.jsx)(b,{type:`multiple`,variant:`outline`,spacing:1,value:Array.isArray(t.value)?t.value.filter(e=>typeof e==`string`):[],disabled:n,onValueChange:e=>{t.onChange(e)},onBlur:t.onBlur,"aria-label":a,"data-testid":r,children:(e.options??[]).map(e=>(0,U.jsx)(y,{value:e.value,"data-testid":`${r}-${e.value}`,children:i(e.label)},e.value))})}function ge({rhf:e,disabled:t,testId:n}){return(0,U.jsx)(Te,{value:e.value,onChange:e.onChange,onBlur:e.onBlur,name:e.name,disabled:t,testId:n})}function _e({field:e,rhf:t,disabled:n,renderLabel:r}){return(0,U.jsx)(m,{className:`font-mono text-xs`,value:typeof t.value==`string`?t.value:JSON.stringify(t.value),onChange:e=>t.onChange(e.target.value),disabled:n,"aria-label":r(e.label),"data-testid":`meta-box-field-${e.key}-input`})}function Q(e){let{field:t,rhf:n}=e,r=t.inputType===`datetime`?`datetime-local`:t.inputType;return(0,U.jsx)(P,{...X(e),type:r,value:$(n.value),min:t.min,max:t.max,onChange:e=>{let t=e.target.value;n.onChange(t===``?null:t)}})}function ve({field:e,rhf:t,disabled:n,testId:r,renderLabel:i}){let a=i(e.label);return(0,U.jsx)(f,{name:t.name,value:Y($(t.value)),onValueChange:e=>{t.onChange(le(e))},onBlur:t.onBlur,disabled:n,required:e.required,"aria-label":a,className:`gap-1`,"data-testid":r,children:(e.options??[]).map(e=>(0,U.jsxs)(`div`,{className:`flex items-center gap-2 text-sm`,children:[(0,U.jsx)(p,{value:Y(e.value),id:`${r}-${e.value}`,"data-testid":`${r}-${e.value}`}),(0,U.jsx)(`label`,{htmlFor:`${r}-${e.value}`,children:i(e.label)})]},e.value))})}function ye(e){let{field:t,rhf:n}=e,r=Z(e);t.inputType!==`text`&&t.inputType!==`email`&&t.inputType!==`url`&&t.inputType!==`password`&&console.warn(`[plumix] unknown meta-box field inputType "${t.inputType}" — falling back to text input. Register a custom renderer or use a built-in type (text/textarea/number/email/url/password/date/datetime/time/color/range/multiselect/json/richtext/repeater/user/userList/entry/entryList/term/termList/select/radio/checkbox).`);let i=t.inputType===`email`||t.inputType===`url`||t.inputType===`password`?t.inputType:`text`;return(0,U.jsx)(P,{...X(e),type:i,value:$(n.value),placeholder:r,maxLength:t.maxLength,onChange:e=>{n.onChange(e.target.value)}})}var be={textarea:ue,number:de,color:fe,range:pe,repeater:me},xe={multiselect:he,json:ge,richtext:_e,date:Q,datetime:Q,time:Q,radio:ve};function Se(e){let{field:t,rhf:n,disabled:r,testId:i,renderLabel:a}=e,o=a(t.label),s=N(t.inputType);if(s)return(0,U.jsx)(ee,{fieldKey:t.key,inputType:t.inputType,testId:i,resetKey:De(n.value),children:(0,U.jsx)(s,{field:t,rhf:n,disabled:r,testId:i})});let c=be[t.inputType];if(c)return c(e);if(t.referenceTarget?.multiple===!0)return(0,U.jsx)(G,{value:Array.isArray(n.value)?n.value.filter(e=>typeof e==`string`):[],onChange:e=>{n.onChange(e)},kind:t.referenceTarget.kind,scope:t.referenceTarget.scope,max:typeof t.max==`number`?t.max:void 0,disabled:r,required:t.required,label:o,testId:i});if(t.referenceTarget&&(t.inputType===`user`||t.inputType===`entry`||t.inputType===`term`))return(0,U.jsx)(te,{value:typeof n.value==`string`&&n.value!==``?n.value:null,onChange:e=>{n.onChange(e)},kind:t.referenceTarget.kind,scope:t.referenceTarget.scope,disabled:r,required:t.required,label:o,testId:i});let l=xe[t.inputType];return l?l(e):ye(e)}function $(e){return e==null?``:typeof e==`string`?e:typeof e==`number`||typeof e==`boolean`?String(e):``}function Ce(e){return typeof e==`number`&&!Number.isNaN(e)?e:``}function we(e,t){if(typeof e==`number`&&Number.isFinite(e))return e;if(typeof e==`string`){let t=Number(e);if(Number.isFinite(t))return t}return t}function Te({value:e,onChange:t,onBlur:n,name:r,disabled:i,testId:a}){let o=S(),s=Ee(e),[c,l]=(0,H.useState)(s),[u,d]=(0,H.useState)(null),[f,p]=(0,H.useState)(s);return s!==f&&(p(s),l(s),d(null)),(0,U.jsxs)(`div`,{className:`flex flex-col gap-1`,"data-testid":`${a}-shell`,children:[(0,U.jsx)(m,{name:r,value:c,disabled:i,onBlur:n,onChange:e=>{let n=e.target.value;if(l(n),n.trim()===``){d(null),t(null);return}try{let e=JSON.parse(n);d(null),t(e)}catch(e){d(e instanceof Error?e.message:o(ce.invalidJson))}},rows:6,spellCheck:!1,"aria-invalid":u?!0:void 0,"data-testid":a,className:`min-h-32 font-mono text-xs`}),u?(0,U.jsx)(`p`,{className:`text-destructive text-xs`,"data-testid":`${a}-error`,children:u}):null]})}function Ee(e){if(e==null)return``;try{return JSON.stringify(e,null,2)}catch{return``}}function De(e){if(typeof e==`string`)return e;if(e==null)return``;try{return JSON.stringify(e)}catch{return`__unserializable__`}}export{q as t};
1
+ import{i as e,t}from"./jsx-runtime-DUAcabCT.js";import{t as n}from"./react-DbyrFoBd.js";import{i as r,n as i}from"./dist-BL2bKHuR.js";import{f as a,t as o}from"./orpc-DURDArDu.js";import{c as s,d as c,f as l,l as u,p as d}from"./breadcrumb-B-sB8a4_.js";import{n as f,r as p,t as m}from"./textarea-BsZaGkV-.js";import{M as h,X as g,j as _,m as v,n as y,t as b,w as x}from"./utils-ByiwTMhM.js";import{t as S}from"./use-label-CykSHq9A.js";import{i as C,t as w}from"./type-labels-DEpt0nSb.js";import{t as T}from"./skeleton-BnBM1862.js";import{F as E,I as D,L as O,P as k,Pt as A,Q as j,R as M,u as N}from"./index-Ctqj4aiM.js";import{t as P}from"./input-xYuLUQID.js";import{a as F,i as I,n as L,o as R,r as z,s as B}from"./form-C94uy6_t.js";function V(){let e=S();return(t,n)=>{if(t!==null)return t;if(n!==void 0){let t=j(n);if(t)return e(w(t,`untitledItem`))}return e(C.untitledItem)}}var H=e(n(),1),U=e(t(),1),W={resolveError:{id:`metaBox.multiReference.resolveError`},emptyValue:{id:`metaBox.multiReference.emptyValue`},orphan:{id:`metaBox.multiReference.orphan`},selectIdle:{id:`metaBox.multiReference.selectIdle`},addMore:{id:`metaBox.multiReference.addMore`},loading:{id:`metaBox.multiReference.loading`},noMatches:{id:`metaBox.multiReference.noMatches`},dialogDescription:{id:`metaBox.multiReference.dialogDescription`},searchPlaceholder:{id:`metaBox.multiReference.searchPlaceholder`}};function G({value:e,onChange:t,kind:n,scope:f,max:p,disabled:m=!1,required:h=!1,label:g,testId:_}){let{i18n:y}=r(),b=S(),x=V(),[C,w]=(0,H.useState)(!1),[E,D]=(0,H.useState)(``),O=a({...o.lookup.list.queryOptions({input:{kind:n,scope:f,ids:[...e]}}),enabled:e.length>0}),k=(0,H.useMemo)(()=>{let e=new Map;for(let t of O.data?.items??[])e.set(t.id,t);return e},[O.data]),j=a({...o.lookup.list.queryOptions({input:{kind:n,query:E.trim()||void 0,scope:f,limit:20}}),enabled:C}),M=j.data?.items??[],N=new Set(e),P=p!==void 0&&e.length>=p,F=n=>{N.has(n)||P||t([...e,n])},I=n=>{t(e.filter(e=>e!==n))},L=e=>{t(e.map(e=>e.id))},R=e.length>0&&O.data===void 0&&!O.isError,z=e.map(e=>{let t=k.get(e)??null;return{id:e,result:t,pending:t===null&&R}}),B=y._(W.dialogDescription.id,{kind:n},{message:W.dialogDescription.message}),G=y._(W.searchPlaceholder.id,{kind:n},{message:W.searchPlaceholder.message});return(0,U.jsxs)(`div`,{className:`flex flex-col gap-2`,"data-testid":_,children:[O.isError?(0,U.jsx)(`p`,{className:`text-destructive text-sm`,"data-testid":`${_}-resolve-error`,children:(0,U.jsx)(i,{id:`metaBox.multiReference.resolveError`,message:`Couldn’t load selected items — refresh to retry.`})}):null,e.length===0?(0,U.jsx)(`p`,{className:`text-muted-foreground text-sm`,"data-testid":`${_}-empty`,children:(0,U.jsx)(i,{id:`metaBox.multiReference.emptyValue`,message:`None selected`})}):(0,U.jsx)(v,{items:z,onReorder:L,onRemove:h&&e.length===1?void 0:I,renderItem:e=>e.result?(0,U.jsxs)(`div`,{className:`text-sm`,children:[(0,U.jsx)(`p`,{className:`truncate font-medium`,children:x(e.result.label,e.result.targetType)}),e.result.subtitle?(0,U.jsx)(`p`,{className:`text-muted-foreground truncate text-xs`,children:e.result.subtitle}):null]}):e.pending?(0,U.jsxs)(`div`,{className:`flex flex-col gap-1.5`,"data-testid":`${_}-resolving-${e.id}`,"aria-busy":`true`,children:[(0,U.jsx)(T,{className:`h-4 w-32`}),(0,U.jsx)(T,{className:`h-3 w-20`})]}):(0,U.jsx)(`p`,{className:`text-destructive text-sm`,"data-testid":`${_}-orphan-${e.id}`,children:(0,U.jsx)(i,{id:`metaBox.multiReference.orphan`,message:`Reference missing — remove or re-pick`})}),disabled:m,testId:`${_}-list`}),(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,U.jsx)(A,{type:`button`,variant:`outline`,size:`sm`,disabled:m||P,onClick:()=>{D(``),w(!0)},"data-testid":`${_}-add`,children:e.length===0?b(W.selectIdle):b(W.addMore)}),p===void 0?null:(0,U.jsxs)(`span`,{className:`text-muted-foreground text-xs`,"data-testid":`${_}-count`,children:[e.length,` / `,p]})]}),(0,U.jsxs)(s,{open:C,onOpenChange:w,title:g,description:B,children:[(0,U.jsx)(c,{placeholder:G,value:E,onValueChange:D,"data-testid":`${_}-search`}),(0,U.jsx)(d,{children:j.isLoading?(0,U.jsx)(u,{children:(0,U.jsx)(i,{id:`metaBox.multiReference.loading`,message:`Loading…`})}):M.length===0?(0,U.jsx)(u,{children:(0,U.jsx)(i,{id:`metaBox.multiReference.noMatches`,message:`No matches`})}):M.map(e=>{let t=N.has(e.id);return(0,U.jsx)(l,{value:`${e.label??``} ${e.subtitle??``}`,disabled:t||P,onSelect:()=>{F(e.id)},"data-testid":`${_}-option-${e.id}`,children:(0,U.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,U.jsxs)(`span`,{className:`text-sm font-medium`,children:[x(e.label,e.targetType),t?` ✓`:``]}),e.subtitle?(0,U.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:e.subtitle}):null]})},e.id)})})]})]})}var ee=class extends H.Component{constructor(e){super(e),this.state={error:null,resetKey:e.resetKey}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return e.resetKey===t.resetKey?null:{error:null,resetKey:e.resetKey}}componentDidCatch(e,t){console.error(`[plumix] plugin field renderer for "${this.props.inputType}" (field "${this.props.fieldKey}") crashed:`,e,t)}render(){return this.state.error?(0,U.jsx)(`p`,{className:`text-destructive text-sm`,"data-testid":`${this.props.testId}-plugin-error`,children:(0,U.jsx)(i,{id:`metaBox.pluginField.crashed`,message:`This field couldn’t render. Check the browser console for details.`})}):this.props.children}},K={selectIdle:{id:`metaBox.reference.selectIdle`},selectChange:{id:`metaBox.reference.selectChange`},clear:{id:`metaBox.reference.clear`},emptyValue:{id:`metaBox.reference.emptyValue`},orphan:{id:`metaBox.reference.orphan`},loading:{id:`metaBox.reference.loading`},noMatches:{id:`metaBox.reference.noMatches`},dialogDescription:{id:`metaBox.reference.dialogDescription`},searchPlaceholder:{id:`metaBox.reference.searchPlaceholder`}};function te({value:e,onChange:t,kind:n,scope:i,disabled:l=!1,required:u=!1,label:f,testId:p}){let{i18n:m}=r(),h=S(),g=V(),[_,v]=(0,H.useState)(!1),[y,b]=(0,H.useState)(``),x=a({...o.lookup.resolve.queryOptions({input:{kind:n,id:e??``,scope:i}}),enabled:e!==null}),C=a({...o.lookup.list.queryOptions({input:{kind:n,query:y.trim()||void 0,scope:i,limit:20}}),enabled:_}),w=e===null?null:x.data?.result??null,T=C.data?.items??[],E=m._(K.dialogDescription.id,{kind:n},{message:K.dialogDescription.message}),D=m._(K.searchPlaceholder.id,{kind:n},{message:K.searchPlaceholder.message});return(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,"data-testid":p,children:[(0,U.jsx)(`div`,{className:`min-w-0 flex-1`,children:ne({testId:p,value:e,selected:w,isResolving:x.isLoading,untitledLabel:g})}),(0,U.jsx)(A,{type:`button`,variant:`outline`,size:`sm`,disabled:l,onClick:()=>{b(``),v(!0)},"data-testid":`${p}-open`,children:h(e===null?K.selectIdle:K.selectChange)}),e!==null&&!u?(0,U.jsx)(A,{type:`button`,variant:`ghost`,size:`sm`,disabled:l,onClick:()=>{t(null)},"data-testid":`${p}-clear`,children:h(K.clear)}):null,(0,U.jsxs)(s,{open:_,onOpenChange:v,title:f,description:E,children:[(0,U.jsx)(c,{placeholder:D,value:y,onValueChange:b,"data-testid":`${p}-search`}),(0,U.jsx)(d,{children:re({isLoading:C.isLoading,items:T,testId:p,onSelect:e=>{t(e),v(!1)},untitledLabel:g})})]})]})}function ne({testId:e,value:t,selected:n,isResolving:r,untitledLabel:a}){return t===null?(0,U.jsx)(`p`,{className:`text-muted-foreground text-sm`,"data-testid":`${e}-empty`,children:(0,U.jsx)(i,{id:`metaBox.reference.emptyValue`,message:`None selected`})}):n?(0,U.jsxs)(`div`,{className:`text-sm`,"data-testid":`${e}-selected`,children:[(0,U.jsx)(`p`,{className:`truncate font-medium`,children:a(n.label,n.targetType)}),n.subtitle?(0,U.jsx)(`p`,{className:`text-muted-foreground truncate text-xs`,children:n.subtitle}):null]}):r?(0,U.jsxs)(`div`,{className:`flex flex-col gap-1.5`,"data-testid":`${e}-resolving`,"aria-busy":`true`,children:[(0,U.jsx)(T,{className:`h-4 w-32`}),(0,U.jsx)(T,{className:`h-3 w-20`})]}):(0,U.jsx)(`p`,{className:`text-destructive text-sm`,"data-testid":`${e}-orphan`,children:(0,U.jsx)(i,{id:`metaBox.reference.orphan`,message:`Reference missing — re-pick or clear`})})}function re({isLoading:e,items:t,testId:n,onSelect:r,untitledLabel:a}){return e?(0,U.jsx)(u,{children:(0,U.jsx)(i,{id:`metaBox.reference.loading`,message:`Loading…`})}):t.length===0?(0,U.jsx)(u,{children:(0,U.jsx)(i,{id:`metaBox.reference.noMatches`,message:`No matches`})}):t.map(e=>(0,U.jsx)(l,{value:`${e.label??``} ${e.subtitle??``}`,onSelect:()=>{r(e.id)},"data-testid":`${n}-option-${e.id}`,children:(0,U.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,U.jsx)(`span`,{className:`text-sm font-medium`,children:a(e.label,e.targetType)}),e.subtitle?(0,U.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:e.subtitle}):null]})},e.id))}function ie(e){return Array.isArray(e)?e.filter(e=>typeof e==`object`&&!!e&&!Array.isArray(e)):[]}function ae({field:e,rhf:t,disabled:n,testId:r}){let a=e.subFields??[],o=typeof e.max==`number`?e.max:void 0,s=typeof e.min==`number`?e.min:void 0,c=ie(t.value),l=(0,H.useId)(),u=o!==void 0&&c.length>=o,d=c.map((e,t)=>({id:`${l}-r${t}`,index:t})),f=e=>{t.onChange(e)};return(0,U.jsxs)(`div`,{"data-testid":r,className:`border-input flex flex-col gap-2 rounded-md border p-2`,children:[c.length===0?(0,U.jsx)(`p`,{className:`text-muted-foreground text-sm`,"data-testid":`${r}-empty`,children:(0,U.jsx)(i,{id:`metaBox.repeater.empty`,message:`No rows`})}):(0,U.jsx)(v,{items:d,onReorder:e=>{f(e.map(e=>c[e.index]??{}))},onRemove:n?void 0:e=>{let t=d.findIndex(t=>t.id===e);if(t===-1)return;let n=[...c];n.splice(t,1),f(n)},disabled:n,testId:`${r}-list`,renderItem:e=>(0,U.jsx)(se,{subFields:a,rowName:`${t.name}.${e.index}`,disabled:n,testId:`${r}-row-${e.index}`})}),(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,U.jsxs)(A,{type:`button`,variant:`outline`,size:`sm`,disabled:n||u,onClick:()=>{if(u)return;let e={};for(let t of a)e[t.key]=t.default??null;f([...c,e])},"data-testid":`${r}-add`,children:[(0,U.jsx)(g,{className:`size-4`}),c.length===0?(0,U.jsx)(i,{id:`metaBox.repeater.addFirst`,message:`Add row`}):(0,U.jsx)(i,{id:`metaBox.repeater.addAnother`,message:`Add another`})]}),o!==void 0||s!==void 0?(0,U.jsxs)(`span`,{className:`text-muted-foreground text-xs`,"data-testid":`${r}-count`,children:[c.length,(0,U.jsx)(oe,{min:s,max:o})]}):null]})]})}function oe({min:e,max:t}){return e!==void 0&&t!==void 0?(0,U.jsx)(i,{id:`metaBox.repeater.countSuffixBoth`,message:` / min {min} / max {max}`,values:{min:e,max:t},comment:`min, max: integers bounding the repeater row count`}):e===void 0?t===void 0?null:(0,U.jsx)(i,{id:`metaBox.repeater.countSuffixMax`,message:` / max {max}`,values:{max:t},comment:`max: upper bound on the repeater row count`}):(0,U.jsx)(i,{id:`metaBox.repeater.countSuffixMin`,message:` / min {min}`,values:{min:e},comment:`min: lower bound on the repeater row count`})}function se({subFields:e,rowName:t,disabled:n,testId:r}){return(0,U.jsx)(`div`,{className:`flex flex-col gap-2`,"data-testid":r,children:e.map(e=>(0,U.jsx)(q,{field:e,name:`${t}.${e.key}`,disabled:n},e.key))})}var ce={invalidJson:{id:`metaBox.field.json.invalid`}};function q({field:e,name:t,disabled:n=!1,className:r}){let i=S(),a=i(e.label),o=`meta-box-field-${e.key}`,s=`${o}-input`;return(0,U.jsx)(I,{name:t,render:({field:t})=>e.inputType===`checkbox`?(0,U.jsxs)(F,{className:r,"data-testid":o,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,U.jsx)(L,{children:(0,U.jsx)(h,{name:t.name,checked:t.value===!0,required:e.required,disabled:n,onBlur:t.onBlur,onCheckedChange:e=>{t.onChange(e===!0)},"data-testid":s})}),(0,U.jsx)(R,{children:a})]}),e.description?(0,U.jsx)(z,{"data-testid":`${o}-description`,children:i(e.description)}):null,(0,U.jsx)(B,{})]}):e.inputType===`select`&&N(e.inputType)===void 0?(0,U.jsxs)(F,{className:r,"data-testid":o,children:[(0,U.jsx)(R,{children:a}),(0,U.jsxs)(k,{name:t.name,value:Y($(t.value)),onValueChange:e=>{t.onChange(le(e))},disabled:n,required:e.required,children:[(0,U.jsx)(L,{children:(0,U.jsx)(O,{className:`w-full`,onBlur:t.onBlur,"data-testid":s,children:(0,U.jsx)(M,{})})}),(0,U.jsx)(E,{children:(e.options??[]).map(e=>(0,U.jsx)(D,{value:Y(e.value),"data-testid":`${s}-option-${e.value}`,children:i(e.label)},e.value))})]}),e.description?(0,U.jsx)(z,{"data-testid":`${o}-description`,children:i(e.description)}):null,(0,U.jsx)(B,{})]}):(0,U.jsxs)(F,{className:r,"data-testid":o,children:[(0,U.jsx)(R,{children:a}),(0,U.jsx)(L,{children:Se({field:e,rhf:t,disabled:n,testId:s,renderLabel:i})}),e.description?(0,U.jsx)(z,{"data-testid":`${o}-description`,children:i(e.description)}):null,(0,U.jsx)(B,{})]})})}var J=`__plumix_empty__`;function Y(e){return e===``?J:e}function le(e){return e===J?``:e}function X({rhf:e,field:t,disabled:n,testId:r}){return{name:e.name,ref:e.ref,required:t.required,disabled:n,onBlur:e.onBlur,"data-testid":r}}function Z({field:e,renderLabel:t}){return e.placeholder?t(e.placeholder):void 0}function ue(e){let{field:t,rhf:n}=e,r=Z(e);return(0,U.jsx)(m,{...X(e),value:$(n.value),maxLength:t.maxLength,placeholder:r,rows:3,onChange:e=>{n.onChange(e.target.value)},className:`min-h-20`})}function de(e){let{field:t,rhf:n}=e,r=Z(e);return(0,U.jsx)(P,{...X(e),type:`number`,value:Ce(n.value),placeholder:r,min:t.min,max:t.max,step:t.step??1,onChange:e=>{let t=e.target.value;if(t===``){n.onChange(null);return}let r=Number(t);Number.isFinite(r)&&n.onChange(r)}})}function fe({field:e,rhf:t,disabled:n,testId:r}){return(0,U.jsx)(_,{value:$(t.value),onChange:e=>{t.onChange(e)},disabled:n,required:e.required,name:t.name,testId:r})}function pe({field:e,rhf:t,disabled:n,testId:r,renderLabel:i}){let a=i(e.label),o=typeof t.value==`number`?t.value:Number(t.value),s=we(e.min,0),c=we(e.max,100),l=Number.isFinite(o)?o:s;return(0,U.jsxs)(`div`,{className:`flex items-center gap-3`,"data-testid":r,children:[(0,U.jsx)(x,{name:t.name,min:s,max:c,step:e.step??1,value:[l],disabled:n,onValueChange:e=>{let n=e[0];typeof n==`number`&&Number.isFinite(n)&&t.onChange(n)},onBlur:t.onBlur,"aria-label":a,"aria-required":e.required,"data-testid":`${r}-slider`,className:`flex-1`}),(0,U.jsx)(`span`,{className:`text-muted-foreground min-w-[3ch] text-end text-sm tabular-nums`,"data-testid":`${r}-display`,children:Number.isFinite(o)?o:`–`})]})}function me({field:e,rhf:t,disabled:n,testId:r}){return(0,U.jsx)(ae,{field:e,rhf:t,disabled:n,testId:r})}function he({field:e,rhf:t,disabled:n,testId:r,renderLabel:i}){let a=i(e.label);return(0,U.jsx)(b,{type:`multiple`,variant:`outline`,spacing:1,value:Array.isArray(t.value)?t.value.filter(e=>typeof e==`string`):[],disabled:n,onValueChange:e=>{t.onChange(e)},onBlur:t.onBlur,"aria-label":a,"data-testid":r,children:(e.options??[]).map(e=>(0,U.jsx)(y,{value:e.value,"data-testid":`${r}-${e.value}`,children:i(e.label)},e.value))})}function ge({rhf:e,disabled:t,testId:n}){return(0,U.jsx)(Te,{value:e.value,onChange:e.onChange,onBlur:e.onBlur,name:e.name,disabled:t,testId:n})}function _e({field:e,rhf:t,disabled:n,renderLabel:r}){return(0,U.jsx)(m,{className:`font-mono text-xs`,value:typeof t.value==`string`?t.value:JSON.stringify(t.value),onChange:e=>t.onChange(e.target.value),disabled:n,"aria-label":r(e.label),"data-testid":`meta-box-field-${e.key}-input`})}function Q(e){let{field:t,rhf:n}=e,r=t.inputType===`datetime`?`datetime-local`:t.inputType;return(0,U.jsx)(P,{...X(e),type:r,value:$(n.value),min:t.min,max:t.max,onChange:e=>{let t=e.target.value;n.onChange(t===``?null:t)}})}function ve({field:e,rhf:t,disabled:n,testId:r,renderLabel:i}){let a=i(e.label);return(0,U.jsx)(f,{name:t.name,value:Y($(t.value)),onValueChange:e=>{t.onChange(le(e))},onBlur:t.onBlur,disabled:n,required:e.required,"aria-label":a,className:`gap-1`,"data-testid":r,children:(e.options??[]).map(e=>(0,U.jsxs)(`div`,{className:`flex items-center gap-2 text-sm`,children:[(0,U.jsx)(p,{value:Y(e.value),id:`${r}-${e.value}`,"data-testid":`${r}-${e.value}`}),(0,U.jsx)(`label`,{htmlFor:`${r}-${e.value}`,children:i(e.label)})]},e.value))})}function ye(e){let{field:t,rhf:n}=e,r=Z(e);t.inputType!==`text`&&t.inputType!==`email`&&t.inputType!==`url`&&t.inputType!==`password`&&console.warn(`[plumix] unknown meta-box field inputType "${t.inputType}" — falling back to text input. Register a custom renderer or use a built-in type (text/textarea/number/email/url/password/date/datetime/time/color/range/multiselect/json/richtext/repeater/user/userList/entry/entryList/term/termList/select/radio/checkbox).`);let i=t.inputType===`email`||t.inputType===`url`||t.inputType===`password`?t.inputType:`text`;return(0,U.jsx)(P,{...X(e),type:i,value:$(n.value),placeholder:r,maxLength:t.maxLength,onChange:e=>{n.onChange(e.target.value)}})}var be={textarea:ue,number:de,color:fe,range:pe,repeater:me},xe={multiselect:he,json:ge,richtext:_e,date:Q,datetime:Q,time:Q,radio:ve};function Se(e){let{field:t,rhf:n,disabled:r,testId:i,renderLabel:a}=e,o=a(t.label),s=N(t.inputType);if(s)return(0,U.jsx)(ee,{fieldKey:t.key,inputType:t.inputType,testId:i,resetKey:De(n.value),children:(0,U.jsx)(s,{field:t,rhf:n,disabled:r,testId:i})});let c=be[t.inputType];if(c)return c(e);if(t.referenceTarget?.multiple===!0)return(0,U.jsx)(G,{value:Array.isArray(n.value)?n.value.filter(e=>typeof e==`string`):[],onChange:e=>{n.onChange(e)},kind:t.referenceTarget.kind,scope:t.referenceTarget.scope,max:typeof t.max==`number`?t.max:void 0,disabled:r,required:t.required,label:o,testId:i});if(t.referenceTarget&&(t.inputType===`user`||t.inputType===`entry`||t.inputType===`term`))return(0,U.jsx)(te,{value:typeof n.value==`string`&&n.value!==``?n.value:null,onChange:e=>{n.onChange(e)},kind:t.referenceTarget.kind,scope:t.referenceTarget.scope,disabled:r,required:t.required,label:o,testId:i});let l=xe[t.inputType];return l?l(e):ye(e)}function $(e){return e==null?``:typeof e==`string`?e:typeof e==`number`||typeof e==`boolean`?String(e):``}function Ce(e){return typeof e==`number`&&!Number.isNaN(e)?e:``}function we(e,t){if(typeof e==`number`&&Number.isFinite(e))return e;if(typeof e==`string`){let t=Number(e);if(Number.isFinite(t))return t}return t}function Te({value:e,onChange:t,onBlur:n,name:r,disabled:i,testId:a}){let o=S(),s=Ee(e),[c,l]=(0,H.useState)(s),[u,d]=(0,H.useState)(null),[f,p]=(0,H.useState)(s);return s!==f&&(p(s),l(s),d(null)),(0,U.jsxs)(`div`,{className:`flex flex-col gap-1`,"data-testid":`${a}-shell`,children:[(0,U.jsx)(m,{name:r,value:c,disabled:i,onBlur:n,onChange:e=>{let n=e.target.value;if(l(n),n.trim()===``){d(null),t(null);return}try{let e=JSON.parse(n);d(null),t(e)}catch(e){d(e instanceof Error?e.message:o(ce.invalidJson))}},rows:6,spellCheck:!1,"aria-invalid":u?!0:void 0,"data-testid":a,className:`min-h-32 font-mono text-xs`}),u?(0,U.jsx)(`p`,{className:`text-destructive text-xs`,"data-testid":`${a}-error`,children:u}):null]})}function Ee(e){if(e==null)return``;try{return JSON.stringify(e,null,2)}catch{return``}}function De(e){if(typeof e==`string`)return e;if(e==null)return``;try{return JSON.stringify(e)}catch{return`__unserializable__`}}export{q as t};
@@ -1 +1 @@
1
- import{t as e}from"./utils-DKOQrNEG.js";import"./utils-DkCVtsc2.js";var t={1:`col-span-1`,2:`col-span-2`,3:`col-span-3`,4:`col-span-4`,5:`col-span-5`,6:`col-span-6`,7:`col-span-7`,8:`col-span-8`,9:`col-span-9`,10:`col-span-10`,11:`col-span-11`,12:`col-span-12`},n={1:`@sm:col-span-1`,2:`@sm:col-span-2`,3:`@sm:col-span-3`,4:`@sm:col-span-4`,5:`@sm:col-span-5`,6:`@sm:col-span-6`,7:`@sm:col-span-7`,8:`@sm:col-span-8`,9:`@sm:col-span-9`,10:`@sm:col-span-10`,11:`@sm:col-span-11`,12:`@sm:col-span-12`},r={1:`@md:col-span-1`,2:`@md:col-span-2`,3:`@md:col-span-3`,4:`@md:col-span-4`,5:`@md:col-span-5`,6:`@md:col-span-6`,7:`@md:col-span-7`,8:`@md:col-span-8`,9:`@md:col-span-9`,10:`@md:col-span-10`,11:`@md:col-span-11`,12:`@md:col-span-12`},i={1:`@lg:col-span-1`,2:`@lg:col-span-2`,3:`@lg:col-span-3`,4:`@lg:col-span-4`,5:`@lg:col-span-5`,6:`@lg:col-span-6`,7:`@lg:col-span-7`,8:`@lg:col-span-8`,9:`@lg:col-span-9`,10:`@lg:col-span-10`,11:`@lg:col-span-11`,12:`@lg:col-span-12`},a=12;function o(e){if(!Number.isFinite(e))return a;let t=Math.round(e);return t<1?1:t>12?12:t}function s(s){return typeof s==`number`?t[o(s)]:e(t[o(s?.base??a)],s?.sm!==void 0&&n[o(s.sm)],s?.md!==void 0&&r[o(s.md)],s?.lg!==void 0&&i[o(s.lg)])}export{s as t};
1
+ import{t as e}from"./utils-DKOQrNEG.js";import"./utils-ByiwTMhM.js";var t={1:`col-span-1`,2:`col-span-2`,3:`col-span-3`,4:`col-span-4`,5:`col-span-5`,6:`col-span-6`,7:`col-span-7`,8:`col-span-8`,9:`col-span-9`,10:`col-span-10`,11:`col-span-11`,12:`col-span-12`},n={1:`@sm:col-span-1`,2:`@sm:col-span-2`,3:`@sm:col-span-3`,4:`@sm:col-span-4`,5:`@sm:col-span-5`,6:`@sm:col-span-6`,7:`@sm:col-span-7`,8:`@sm:col-span-8`,9:`@sm:col-span-9`,10:`@sm:col-span-10`,11:`@sm:col-span-11`,12:`@sm:col-span-12`},r={1:`@md:col-span-1`,2:`@md:col-span-2`,3:`@md:col-span-3`,4:`@md:col-span-4`,5:`@md:col-span-5`,6:`@md:col-span-6`,7:`@md:col-span-7`,8:`@md:col-span-8`,9:`@md:col-span-9`,10:`@md:col-span-10`,11:`@md:col-span-11`,12:`@md:col-span-12`},i={1:`@lg:col-span-1`,2:`@lg:col-span-2`,3:`@lg:col-span-3`,4:`@lg:col-span-4`,5:`@lg:col-span-5`,6:`@lg:col-span-6`,7:`@lg:col-span-7`,8:`@lg:col-span-8`,9:`@lg:col-span-9`,10:`@lg:col-span-10`,11:`@lg:col-span-11`,12:`@lg:col-span-12`},a=12;function o(e){if(!Number.isFinite(e))return a;let t=Math.round(e);return t<1?1:t>12?12:t}function s(s){return typeof s==`number`?t[o(s)]:e(t[o(s?.base??a)],s?.sm!==void 0&&n[o(s.sm)],s?.md!==void 0&&r[o(s.md)],s?.lg!==void 0&&i[o(s.lg)])}export{s as t};
@@ -1 +1 @@
1
- import{i as e,t}from"./jsx-runtime-DUAcabCT.js";import{t as n}from"./react-DbyrFoBd.js";import{Et as r,Rt as i}from"./index-kTp--tHG.js";import{n as a,t as o}from"./alert-cwX3fWUu.js";var s=e(n(),1),c=e(t(),1),l={unknownPlugin:{id:`plugin.errorBoundary.unknownPlugin`},pageTitle:{id:`plugin.errorBoundary.pageTitle`},pageBody:{id:`plugin.errorBoundary.pageBody`},widgetBody:{id:`plugin.errorBoundary.widgetBody`},inlineStub:{id:`plugin.errorBoundary.inlineStub`},iconAria:{id:`plugin.errorBoundary.iconAria`}},u=class extends s.Component{state={error:null};static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e){console.error(`[plumix] plugin component threw:`,e)}render(){if(this.state.error===null)return this.props.children;let{kind:e,pluginLabel:t}=this.props,n=this.state.error.message,s=t??i._(l.unknownPlugin);return e===`icon`?(0,c.jsx)(r,{"aria-label":i._(l.iconAria),className:`text-destructive`,"data-testid":`plugin-icon__error`}):e===`page`?(0,c.jsx)(`div`,{className:`mx-auto max-w-2xl py-12`,"data-testid":`plugin-page__error`,children:(0,c.jsxs)(o,{variant:`destructive`,children:[(0,c.jsx)(r,{className:`size-4`}),(0,c.jsxs)(a,{children:[(0,c.jsx)(`p`,{className:`font-semibold`,children:i._(l.pageTitle)}),(0,c.jsx)(`p`,{className:`mt-1`,children:i._(l.pageBody.id,{label:s},{message:l.pageBody.message})}),(0,c.jsx)(`pre`,{className:`bg-muted mt-2 overflow-x-auto rounded p-2 font-mono text-xs`,children:n})]})]})}):e===`widget`?(0,c.jsxs)(o,{variant:`destructive`,"data-testid":`plugin-widget__error`,children:[(0,c.jsx)(r,{className:`size-4`}),(0,c.jsx)(a,{children:i._(l.widgetBody.id,{label:s},{message:l.widgetBody.message})})]}):(0,c.jsxs)(`span`,{className:`border-destructive/50 bg-destructive/10 text-destructive inline-flex items-center gap-1 rounded border px-2 py-0.5 text-xs`,"data-testid":`plugin-${e}__error`,title:n,children:[(0,c.jsx)(r,{className:`size-3`}),i._(l.inlineStub.id,{label:s,kind:e},{message:l.inlineStub.message})]})}};export{u as t};
1
+ import{i as e,t}from"./jsx-runtime-DUAcabCT.js";import{t as n}from"./react-DbyrFoBd.js";import{Et as r,Rt as i}from"./index-Ctqj4aiM.js";import{n as a,t as o}from"./alert-cwX3fWUu.js";var s=e(n(),1),c=e(t(),1),l={unknownPlugin:{id:`plugin.errorBoundary.unknownPlugin`},pageTitle:{id:`plugin.errorBoundary.pageTitle`},pageBody:{id:`plugin.errorBoundary.pageBody`},widgetBody:{id:`plugin.errorBoundary.widgetBody`},inlineStub:{id:`plugin.errorBoundary.inlineStub`},iconAria:{id:`plugin.errorBoundary.iconAria`}},u=class extends s.Component{state={error:null};static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e){console.error(`[plumix] plugin component threw:`,e)}render(){if(this.state.error===null)return this.props.children;let{kind:e,pluginLabel:t}=this.props,n=this.state.error.message,s=t??i._(l.unknownPlugin);return e===`icon`?(0,c.jsx)(r,{"aria-label":i._(l.iconAria),className:`text-destructive`,"data-testid":`plugin-icon__error`}):e===`page`?(0,c.jsx)(`div`,{className:`mx-auto max-w-2xl py-12`,"data-testid":`plugin-page__error`,children:(0,c.jsxs)(o,{variant:`destructive`,children:[(0,c.jsx)(r,{className:`size-4`}),(0,c.jsxs)(a,{children:[(0,c.jsx)(`p`,{className:`font-semibold`,children:i._(l.pageTitle)}),(0,c.jsx)(`p`,{className:`mt-1`,children:i._(l.pageBody.id,{label:s},{message:l.pageBody.message})}),(0,c.jsx)(`pre`,{className:`bg-muted mt-2 overflow-x-auto rounded p-2 font-mono text-xs`,children:n})]})]})}):e===`widget`?(0,c.jsxs)(o,{variant:`destructive`,"data-testid":`plugin-widget__error`,children:[(0,c.jsx)(r,{className:`size-4`}),(0,c.jsx)(a,{children:i._(l.widgetBody.id,{label:s},{message:l.widgetBody.message})})]}):(0,c.jsxs)(`span`,{className:`border-destructive/50 bg-destructive/10 text-destructive inline-flex items-center gap-1 rounded border px-2 py-0.5 text-xs`,"data-testid":`plugin-${e}__error`,title:n,children:[(0,c.jsx)(r,{className:`size-3`}),i._(l.inlineStub.id,{label:s,kind:e},{message:l.inlineStub.message})]})}};export{u as t};
@@ -1,4 +1,4 @@
1
- import{i as e,t}from"./jsx-runtime-DUAcabCT.js";import{t as n}from"./react-DbyrFoBd.js";import{t as r}from"./react-dom-i-Mcm3wj.js";import{n as i}from"./dist-BL2bKHuR.js";import{n as a,t as o}from"./with-selector-Bf4HMdmS.js";import{t as s}from"./createLucideIcon-C0O-yxZG.js";import{a as c,i as l,n as u,o as d,r as f,t as p}from"./underline-CoVrqZEk.js";import{J as m,K as h,Y as g}from"./utils-DkCVtsc2.js";import{t as _}from"./trash-2-Bn-rv3EX.js";import{F as ee,I as v,L as y,P as te,Pt as ne,R as re,bt as ie,mt as ae,xt as oe}from"./index-kTp--tHG.js";import{t as se}from"./input-xYuLUQID.js";import{t as ce}from"./toggle-BfrQLxbv.js";var le=s(`highlighter`,[[`path`,{d:`m9 11-6 6v3h9l3-3`,key:`1a3l36`}],[`path`,{d:`m22 12-4.6 4.6a2 2 0 0 1-2.8 0l-5.2-5.2a2 2 0 0 1 0-2.8L14 4`,key:`14a9rk`}]]),ue=s(`quote`,[[`path`,{d:`M16 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z`,key:`rib7q0`}],[`path`,{d:`M5 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z`,key:`1ymkrd`}]]),de=s(`remove-formatting`,[[`path`,{d:`M4 7V4h16v3`,key:`9msm58`}],[`path`,{d:`M5 20h6`,key:`1h6pxn`}],[`path`,{d:`M13 4 8 20`,key:`kqq6aj`}],[`path`,{d:`m15 15 5 5`,key:`me55sn`}],[`path`,{d:`m20 15-5 5`,key:`11p7ol`}]]),fe=s(`subscript`,[[`path`,{d:`m4 5 8 8`,key:`1eunvl`}],[`path`,{d:`m12 5-8 8`,key:`1ah0jp`}],[`path`,{d:`M20 19h-4c0-1.5.44-2 1.5-2.5S20 15.33 20 14c0-.47-.17-.93-.48-1.29a2.11 2.11 0 0 0-2.62-.44c-.42.24-.74.62-.9 1.07`,key:`e8ta8j`}]]),pe=s(`superscript`,[[`path`,{d:`m4 19 8-8`,key:`hr47gm`}],[`path`,{d:`m12 19-8-8`,key:`1dhhmo`}],[`path`,{d:`M20 12h-4c0-1.5.442-2 1.5-2.5S20 8.334 20 7.002c0-.472-.17-.93-.484-1.29a2.105 2.105 0 0 0-2.617-.436c-.42.239-.738.614-.899 1.06`,key:`1dfcux`}]]);function b(e){this.content=e}b.prototype={constructor:b,find:function(e){for(var t=0;t<this.content.length;t+=2)if(this.content[t]===e)return t;return-1},get:function(e){var t=this.find(e);return t==-1?void 0:this.content[t+1]},update:function(e,t,n){var r=n&&n!=e?this.remove(n):this,i=r.find(e),a=r.content.slice();return i==-1?a.push(n||e,t):(a[i+1]=t,n&&(a[i]=n)),new b(a)},remove:function(e){var t=this.find(e);if(t==-1)return this;var n=this.content.slice();return n.splice(t,2),new b(n)},addToStart:function(e,t){return new b([e,t].concat(this.remove(e).content))},addToEnd:function(e,t){var n=this.remove(e).content.slice();return n.push(e,t),new b(n)},addBefore:function(e,t,n){var r=this.remove(t),i=r.content.slice(),a=r.find(e);return i.splice(a==-1?i.length:a,0,t,n),new b(i)},forEach:function(e){for(var t=0;t<this.content.length;t+=2)e(this.content[t],this.content[t+1])},prepend:function(e){return e=b.from(e),e.size?new b(e.content.concat(this.subtract(e).content)):this},append:function(e){return e=b.from(e),e.size?new b(this.subtract(e).content.concat(e.content)):this},subtract:function(e){var t=this;e=b.from(e);for(var n=0;n<e.content.length;n+=2)t=t.remove(e.content[n]);return t},toObject:function(){var e={};return this.forEach(function(t,n){e[t]=n}),e},get size(){return this.content.length>>1}},b.from=function(e){if(e instanceof b)return e;var t=[];if(e)for(var n in e)t.push(n,e[n]);return new b(t)};function me(e,t,n){for(let r=0;;r++){if(r==e.childCount||r==t.childCount)return e.childCount==t.childCount?null:n;let i=e.child(r),a=t.child(r);if(i==a){n+=i.nodeSize;continue}if(!i.sameMarkup(a))return n;if(i.isText&&i.text!=a.text){let e=i.text,t=a.text,r=0;for(;e[r]==t[r];r++)n++;return r&&r<e.length&&r<t.length&&_e(e.charCodeAt(r-1))&&ge(e.charCodeAt(r))&&n--,n}if(i.content.size||a.content.size){let e=me(i.content,a.content,n+1);if(e!=null)return e}n+=i.nodeSize}}function he(e,t,n,r){for(let i=e.childCount,a=t.childCount;;){if(i==0||a==0)return i==a?null:{a:n,b:r};let o=e.child(--i),s=t.child(--a),c=o.nodeSize;if(o==s){n-=c,r-=c;continue}if(!o.sameMarkup(s))return{a:n,b:r};if(o.isText&&o.text!=s.text){let e=o.text,t=s.text,i=e.length,a=t.length;for(;i>0&&a>0&&e[i-1]==t[a-1];)i--,a--,n--,r--;return i&&a&&i<e.length&&_e(e.charCodeAt(i-1))&&ge(e.charCodeAt(i))&&(n++,r++),{a:n,b:r}}if(o.content.size||s.content.size){let e=he(o.content,s.content,n-1,r-1);if(e)return e}n-=c,r-=c}}function ge(e){return e>=56320&&e<57344}function _e(e){return e>=55296&&e<56320}var x=class e{constructor(e,t){if(this.content=e,this.size=t||0,t==null)for(let t=0;t<e.length;t++)this.size+=e[t].nodeSize}nodesBetween(e,t,n,r=0,i){for(let a=0,o=0;o<t;a++){let s=this.content[a],c=o+s.nodeSize;if(c>e&&n(s,r+o,i||null,a)!==!1&&s.content.size){let i=o+1;s.nodesBetween(Math.max(0,e-i),Math.min(s.content.size,t-i),n,r+i)}o=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,n,r){let i=``,a=!0;return this.nodesBetween(e,t,(o,s)=>{let c=o.isText?o.text.slice(Math.max(e,s)-s,t-s):o.isLeaf?r?typeof r==`function`?r(o):r:o.type.spec.leafText?o.type.spec.leafText(o):``:``;o.isBlock&&(o.isLeaf&&c||o.isTextblock)&&n&&(a?a=!1:i+=n),i+=c},0),i}append(t){if(!t.size)return this;if(!this.size)return t;let n=this.lastChild,r=t.firstChild,i=this.content.slice(),a=0;for(n.isText&&n.sameMarkup(r)&&(i[i.length-1]=n.withText(n.text+r.text),a=1);a<t.content.length;a++)i.push(t.content[a]);return new e(i,this.size+t.size)}cut(t,n=this.size){if(t==0&&n==this.size)return this;let r=[],i=0;if(n>t)for(let e=0,a=0;a<n;e++){let o=this.content[e],s=a+o.nodeSize;s>t&&((a<t||s>n)&&(o=o.isText?o.cut(Math.max(0,t-a),Math.min(o.text.length,n-a)):o.cut(Math.max(0,t-a-1),Math.min(o.content.size,n-a-1))),r.push(o),i+=o.nodeSize),a=s}return new e(r,i)}cutByIndex(t,n){return t==n?e.empty:t==0&&n==this.content.length?this:new e(this.content.slice(t,n))}replaceChild(t,n){let r=this.content[t];if(r==n)return this;let i=this.content.slice(),a=this.size+n.nodeSize-r.nodeSize;return i[t]=n,new e(i,a)}addToStart(t){return new e([t].concat(this.content),this.size+t.nodeSize)}addToEnd(t){return new e(this.content.concat(t),this.size+t.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let t=this.content[e];if(!t)throw RangeError(`Index `+e+` out of range for `+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,n=0;t<this.content.length;t++){let r=this.content[t];e(r,n,t),n+=r.nodeSize}}findDiffStart(e,t=0){return me(this,e,t)}findDiffEnd(e,t=this.size,n=e.size){return he(this,e,t,n)}findIndex(e){if(e==0)return ye(0,e);if(e==this.size)return ye(this.content.length,e);if(e>this.size||e<0)throw RangeError(`Position ${e} outside of fragment (${this})`);for(let t=0,n=0;;t++){let r=this.child(t),i=n+r.nodeSize;if(i>=e)return i==e?ye(t+1,i):ye(t,n);n=i}}toString(){return`<`+this.toStringInner()+`>`}toStringInner(){return this.content.join(`, `)}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(t,n){if(!n)return e.empty;if(!Array.isArray(n))throw RangeError(`Invalid input for Fragment.fromJSON`);return e.fromArray(n.map(t.nodeFromJSON))}static fromArray(t){if(!t.length)return e.empty;let n,r=0;for(let e=0;e<t.length;e++){let i=t[e];r+=i.nodeSize,e&&i.isText&&t[e-1].sameMarkup(i)?(n||=t.slice(0,e),n[n.length-1]=i.withText(n[n.length-1].text+i.text)):n&&n.push(i)}return new e(n||t,r)}static from(t){if(!t)return e.empty;if(t instanceof e)return t;if(Array.isArray(t))return this.fromArray(t);if(t.attrs)return new e([t],t.nodeSize);throw RangeError(`Can not convert `+t+` to a Fragment`+(t.nodesBetween?` (looks like multiple versions of prosemirror-model were loaded)`:``))}};x.empty=new x([],0);var ve={index:0,offset:0};function ye(e,t){return ve.index=e,ve.offset=t,ve}function be(e,t){if(e===t)return!0;if(!(e&&typeof e==`object`)||!(t&&typeof t==`object`))return!1;let n=Array.isArray(e);if(Array.isArray(t)!=n)return!1;if(n){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!be(e[n],t[n]))return!1}else{for(let n in e)if(!(n in t)||!be(e[n],t[n]))return!1;for(let n in t)if(!(n in e))return!1}return!0}var S=class e{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,n=!1;for(let r=0;r<e.length;r++){let i=e[r];if(this.eq(i))return e;if(this.type.excludes(i.type))t||=e.slice(0,r);else if(i.type.excludes(this.type))return e;else!n&&i.type.rank>this.type.rank&&(t||=e.slice(0,r),t.push(this),n=!0),t&&t.push(i)}return t||=e.slice(),n||t.push(this),t}removeFromSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return e.slice(0,t).concat(e.slice(t+1));return e}isInSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return!0;return!1}eq(e){return this==e||this.type==e.type&&be(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,t){if(!t)throw RangeError(`Invalid input for Mark.fromJSON`);let n=e.marks[t.type];if(!n)throw RangeError(`There is no mark type ${t.type} in this schema`);let r=n.create(t.attrs);return n.checkAttrs(r.attrs),r}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!e[n].eq(t[n]))return!1;return!0}static setFrom(t){if(!t||Array.isArray(t)&&t.length==0)return e.none;if(t instanceof e)return[t];let n=t.slice();return n.sort((e,t)=>e.type.rank-t.type.rank),n}};S.none=[];var xe=class extends Error{},C=class e{constructor(e,t,n){this.content=e,this.openStart=t,this.openEnd=n}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(t,n){let r=Ce(this.content,t+this.openStart,n,this.openStart+1,this.openEnd+1);return r&&new e(r,this.openStart,this.openEnd)}removeBetween(t,n){return new e(Se(this.content,t+this.openStart,n+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+`(`+this.openStart+`,`+this.openEnd+`)`}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(t,n){if(!n)return e.empty;let r=n.openStart||0,i=n.openEnd||0;if(typeof r!=`number`||typeof i!=`number`)throw RangeError(`Invalid input for Slice.fromJSON`);return new e(x.fromJSON(t,n.content),r,i)}static maxOpen(t,n=!0){let r=0,i=0;for(let e=t.firstChild;e&&!e.isLeaf&&(n||!e.type.spec.isolating);e=e.firstChild)r++;for(let e=t.lastChild;e&&!e.isLeaf&&(n||!e.type.spec.isolating);e=e.lastChild)i++;return new e(t,r,i)}};C.empty=new C(x.empty,0,0);function Se(e,t,n){let{index:r,offset:i}=e.findIndex(t),a=e.maybeChild(r),{index:o,offset:s}=e.findIndex(n);if(i==t||a.isText){if(s!=n&&!e.child(o).isText)throw RangeError(`Removing non-flat range`);return e.cut(0,t).append(e.cut(n))}if(r!=o)throw RangeError(`Removing non-flat range`);return e.replaceChild(r,a.copy(Se(a.content,t-i-1,n-i-1)))}function Ce(e,t,n,r,i,a){let{index:o,offset:s}=e.findIndex(t),c=e.maybeChild(o);if(s==t||c.isText)return a&&r<=0&&i<=0&&!a.canReplace(o,o,n)?null:e.cut(0,t).append(n).append(e.cut(t));let l=Ce(c.content,t-s-1,n,o==0?r-1:0,o==e.childCount-1?i-1:0,c);return l&&e.replaceChild(o,c.copy(l))}function we(e,t,n){if(n.openStart>e.depth)throw new xe(`Inserted content deeper than insertion position`);if(e.depth-n.openStart!=t.depth-n.openEnd)throw new xe(`Inconsistent open depths`);return Te(e,t,n,0)}function Te(e,t,n,r){let i=e.index(r),a=e.node(r);if(i==t.index(r)&&r<e.depth-n.openStart){let o=Te(e,t,n,r+1);return a.copy(a.content.replaceChild(i,o))}else if(!n.content.size)return Ae(a,Me(e,t,r));else if(!n.openStart&&!n.openEnd&&e.depth==r&&t.depth==r){let r=e.parent,i=r.content;return Ae(r,i.cut(0,e.parentOffset).append(n.content).append(i.cut(t.parentOffset)))}else{let{start:i,end:o}=Ne(n,e);return Ae(a,je(e,i,o,t,r))}}function Ee(e,t){if(!t.type.compatibleContent(e.type))throw new xe(`Cannot join `+t.type.name+` onto `+e.type.name)}function De(e,t,n){let r=e.node(n);return Ee(r,t.node(n)),r}function Oe(e,t){let n=t.length-1;n>=0&&e.isText&&e.sameMarkup(t[n])?t[n]=e.withText(t[n].text+e.text):t.push(e)}function ke(e,t,n,r){let i=(t||e).node(n),a=0,o=t?t.index(n):i.childCount;e&&(a=e.index(n),e.depth>n?a++:e.textOffset&&(Oe(e.nodeAfter,r),a++));for(let e=a;e<o;e++)Oe(i.child(e),r);t&&t.depth==n&&t.textOffset&&Oe(t.nodeBefore,r)}function Ae(e,t){if(!e.type.validContent(t))throw new xe(`Invalid content for node `+e.type.name);return e.copy(t)}function je(e,t,n,r,i){let a=e.depth>i&&De(e,t,i+1),o=r.depth>i&&De(n,r,i+1),s=[];return ke(null,e,i,s),a&&o&&t.index(i)==n.index(i)?(Ee(a,o),Oe(Ae(a,je(e,t,n,r,i+1)),s)):(a&&Oe(Ae(a,Me(e,t,i+1)),s),ke(t,n,i,s),o&&Oe(Ae(o,Me(n,r,i+1)),s)),ke(r,null,i,s),new x(s)}function Me(e,t,n){let r=[];return ke(null,e,n,r),e.depth>n&&Oe(Ae(De(e,t,n+1),Me(e,t,n+1)),r),ke(t,null,n,r),new x(r)}function Ne(e,t){let n=t.depth-e.openStart,r=t.node(n).copy(e.content);for(let e=n-1;e>=0;e--)r=t.node(e).copy(x.from(r));return{start:r.resolveNoCache(e.openStart+n),end:r.resolveNoCache(r.content.size-e.openEnd-n)}}var Pe=class e{constructor(e,t,n){this.pos=e,this.path=t,this.parentOffset=n,this.depth=t.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw RangeError(`There is no position before the top-level node`);return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw RangeError(`There is no position after the top-level node`);return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,t=this.index(this.depth);if(t==e.childCount)return null;let n=this.pos-this.path[this.path.length-1],r=e.child(t);return n?e.child(t).cut(n):r}get nodeBefore(){let e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):e==0?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let n=this.path[t*3],r=t==0?0:this.path[t*3-1]+1;for(let t=0;t<e;t++)r+=n.child(t).nodeSize;return r}marks(){let e=this.parent,t=this.index();if(e.content.size==0)return S.none;if(this.textOffset)return e.child(t).marks;let n=e.maybeChild(t-1),r=e.maybeChild(t);if(!n){let e=n;n=r,r=e}let i=n.marks;for(var a=0;a<i.length;a++)i[a].type.spec.inclusive===!1&&(!r||!i[a].isInSet(r.marks))&&(i=i[a--].removeFromSet(i));return i}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let n=t.marks,r=e.parent.maybeChild(e.index());for(var i=0;i<n.length;i++)n[i].type.spec.inclusive===!1&&(!r||!n[i].isInSet(r.marks))&&(n=n[i--].removeFromSet(n));return n}sharedDepth(e){for(let t=this.depth;t>0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){if(e.pos<this.pos)return e.blockRange(this);for(let n=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);n>=0;n--)if(e.pos<=this.end(n)&&(!t||t(this.node(n))))return new Re(this,e,n);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e=``;for(let t=1;t<=this.depth;t++)e+=(e?`/`:``)+this.node(t).type.name+`_`+this.index(t-1);return e+`:`+this.parentOffset}static resolve(t,n){if(!(n>=0&&n<=t.content.size))throw RangeError(`Position `+n+` out of range`);let r=[],i=0,a=n;for(let e=t;;){let{index:t,offset:n}=e.content.findIndex(a),o=a-n;if(r.push(e,t,i+n),!o||(e=e.child(t),e.isText))break;a=o-1,i+=n+1}return new e(n,r,a)}static resolveCached(t,n){let r=Le.get(t);if(r)for(let e=0;e<r.elts.length;e++){let t=r.elts[e];if(t.pos==n)return t}else Le.set(t,r=new Fe);let i=r.elts[r.i]=e.resolve(t,n);return r.i=(r.i+1)%Ie,i}},Fe=class{constructor(){this.elts=[],this.i=0}},Ie=12,Le=new WeakMap,Re=class{constructor(e,t,n){this.$from=e,this.$to=t,this.depth=n}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}},ze=Object.create(null),Be=class e{constructor(e,t,n,r=S.none){this.type=e,this.attrs=t,this.marks=r,this.content=n||x.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,t,n,r=0){this.content.nodesBetween(e,t,n,r,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,``)}textBetween(e,t,n,r){return this.content.textBetween(e,t,n,r)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,t,n){return this.type==e&&be(this.attrs,t||e.defaultAttrs||ze)&&S.sameSet(this.marks,n||S.none)}copy(t=null){return t==this.content?this:new e(this.type,this.attrs,t,this.marks)}mark(t){return t==this.marks?this:new e(this.type,this.attrs,this.content,t)}cut(e,t=this.content.size){return e==0&&t==this.content.size?this:this.copy(this.content.cut(e,t))}slice(e,t=this.content.size,n=!1){if(e==t)return C.empty;let r=this.resolve(e),i=this.resolve(t),a=n?0:r.sharedDepth(t),o=r.start(a);return new C(r.node(a).content.cut(r.pos-o,i.pos-o),r.depth-a,i.depth-a)}replace(e,t,n){return we(this.resolve(e),this.resolve(t),n)}nodeAt(e){for(let t=this;;){let{index:n,offset:r}=t.content.findIndex(e);if(t=t.maybeChild(n),!t)return null;if(r==e||t.isText)return t;e-=r+1}}childAfter(e){let{index:t,offset:n}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:n}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:t,offset:n}=this.content.findIndex(e);if(n<e)return{node:this.content.child(t),index:t,offset:n};let r=this.content.child(t-1);return{node:r,index:t-1,offset:n-r.nodeSize}}resolve(e){return Pe.resolveCached(this,e)}resolveNoCache(e){return Pe.resolve(this,e)}rangeHasMark(e,t,n){let r=!1;return t>e&&this.nodesBetween(e,t,e=>(n.isInSet(e.marks)&&(r=!0),!r)),r}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+=`(`+this.content.toStringInner()+`)`),He(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw Error(`Called contentMatchAt on a node with invalid content`);return t}canReplace(e,t,n=x.empty,r=0,i=n.childCount){let a=this.contentMatchAt(e).matchFragment(n,r,i),o=a&&a.matchFragment(this.content,t);if(!o||!o.validEnd)return!1;for(let e=r;e<i;e++)if(!this.type.allowsMarks(n.child(e).marks))return!1;return!0}canReplaceWith(e,t,n,r){if(r&&!this.type.allowsMarks(r))return!1;let i=this.contentMatchAt(e).matchType(n),a=i&&i.matchFragment(this.content,t);return a?a.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=S.none;for(let t=0;t<this.marks.length;t++){let n=this.marks[t];n.type.checkAttrs(n.attrs),e=n.addToSet(e)}if(!S.sameSet(e,this.marks))throw RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(e=>e.type.name)}`);this.content.forEach(e=>e.check())}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(e=>e.toJSON())),e}static fromJSON(e,t){if(!t)throw RangeError(`Invalid input for Node.fromJSON`);let n;if(t.marks){if(!Array.isArray(t.marks))throw RangeError(`Invalid mark data for Node.fromJSON`);n=t.marks.map(e.markFromJSON)}if(t.type==`text`){if(typeof t.text!=`string`)throw RangeError(`Invalid text node in JSON`);return e.text(t.text,n)}let r=x.fromJSON(e,t.content),i=e.nodeType(t.type).create(t.attrs,r,n);return i.type.checkAttrs(i.attrs),i}};Be.prototype.text=void 0;var Ve=class e extends Be{constructor(e,t,n,r){if(super(e,t,null,r),!n)throw RangeError(`Empty text nodes are not allowed`);this.text=n}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):He(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,t){return this.text.slice(e,t)}get nodeSize(){return this.text.length}mark(t){return t==this.marks?this:new e(this.type,this.attrs,this.text,t)}withText(t){return t==this.text?this:new e(this.type,this.attrs,t,this.marks)}cut(e=0,t=this.text.length){return e==0&&t==this.text.length?this:this.withText(this.text.slice(e,t))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}};function He(e,t){for(let n=e.length-1;n>=0;n--)t=e[n].type.name+`(`+t+`)`;return t}var Ue=class e{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(t,n){let r=new We(t,n);if(r.next==null)return e.empty;let i=Ge(r);r.next&&r.err(`Unexpected trailing text`);let a=tt(Qe(i));return nt(a,r),a}matchType(e){for(let t=0;t<this.next.length;t++)if(this.next[t].type==e)return this.next[t].next;return null}matchFragment(e,t=0,n=e.childCount){let r=this;for(let i=t;r&&i<n;i++)r=r.matchType(e.child(i).type);return r}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:t}=this.next[e];if(!(t.isText||t.hasRequiredAttrs()))return t}return null}compatible(e){for(let t=0;t<this.next.length;t++)for(let n=0;n<e.next.length;n++)if(this.next[t].type==e.next[n].type)return!0;return!1}fillBefore(e,t=!1,n=0){let r=[this];function i(a,o){let s=a.matchFragment(e,n);if(s&&(!t||s.validEnd))return x.from(o.map(e=>e.createAndFill()));for(let e=0;e<a.next.length;e++){let{type:t,next:n}=a.next[e];if(!(t.isText||t.hasRequiredAttrs())&&r.indexOf(n)==-1){r.push(n);let e=i(n,o.concat(t));if(e)return e}}return null}return i(this,[])}findWrapping(e){for(let t=0;t<this.wrapCache.length;t+=2)if(this.wrapCache[t]==e)return this.wrapCache[t+1];let t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),n=[{match:this,type:null,via:null}];for(;n.length;){let r=n.shift(),i=r.match;if(i.matchType(e)){let e=[];for(let t=r;t.type;t=t.via)e.push(t.type);return e.reverse()}for(let e=0;e<i.next.length;e++){let{type:a,next:o}=i.next[e];!a.isLeaf&&!a.hasRequiredAttrs()&&!(a.name in t)&&(!r.type||o.validEnd)&&(n.push({match:a.contentMatch,type:a,via:r}),t[a.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function t(n){e.push(n);for(let r=0;r<n.next.length;r++)e.indexOf(n.next[r].next)==-1&&t(n.next[r].next)}return t(this),e.map((t,n)=>{let r=n+(t.validEnd?`*`:` `)+` `;for(let n=0;n<t.next.length;n++)r+=(n?`, `:``)+t.next[n].type.name+`->`+e.indexOf(t.next[n].next);return r}).join(`
1
+ import{i as e,t}from"./jsx-runtime-DUAcabCT.js";import{t as n}from"./react-DbyrFoBd.js";import{t as r}from"./react-dom-i-Mcm3wj.js";import{n as i}from"./dist-BL2bKHuR.js";import{n as a,t as o}from"./with-selector-Bf4HMdmS.js";import{t as s}from"./createLucideIcon-C0O-yxZG.js";import{a as c,i as l,n as u,o as d,r as f,t as p}from"./underline-CoVrqZEk.js";import{J as m,K as h,Y as g}from"./utils-ByiwTMhM.js";import{t as _}from"./trash-2-Bn-rv3EX.js";import{F as ee,I as v,L as y,P as te,Pt as ne,R as re,bt as ie,mt as ae,xt as oe}from"./index-Ctqj4aiM.js";import{t as se}from"./input-xYuLUQID.js";import{t as ce}from"./toggle-BfrQLxbv.js";var le=s(`highlighter`,[[`path`,{d:`m9 11-6 6v3h9l3-3`,key:`1a3l36`}],[`path`,{d:`m22 12-4.6 4.6a2 2 0 0 1-2.8 0l-5.2-5.2a2 2 0 0 1 0-2.8L14 4`,key:`14a9rk`}]]),ue=s(`quote`,[[`path`,{d:`M16 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z`,key:`rib7q0`}],[`path`,{d:`M5 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z`,key:`1ymkrd`}]]),de=s(`remove-formatting`,[[`path`,{d:`M4 7V4h16v3`,key:`9msm58`}],[`path`,{d:`M5 20h6`,key:`1h6pxn`}],[`path`,{d:`M13 4 8 20`,key:`kqq6aj`}],[`path`,{d:`m15 15 5 5`,key:`me55sn`}],[`path`,{d:`m20 15-5 5`,key:`11p7ol`}]]),fe=s(`subscript`,[[`path`,{d:`m4 5 8 8`,key:`1eunvl`}],[`path`,{d:`m12 5-8 8`,key:`1ah0jp`}],[`path`,{d:`M20 19h-4c0-1.5.44-2 1.5-2.5S20 15.33 20 14c0-.47-.17-.93-.48-1.29a2.11 2.11 0 0 0-2.62-.44c-.42.24-.74.62-.9 1.07`,key:`e8ta8j`}]]),pe=s(`superscript`,[[`path`,{d:`m4 19 8-8`,key:`hr47gm`}],[`path`,{d:`m12 19-8-8`,key:`1dhhmo`}],[`path`,{d:`M20 12h-4c0-1.5.442-2 1.5-2.5S20 8.334 20 7.002c0-.472-.17-.93-.484-1.29a2.105 2.105 0 0 0-2.617-.436c-.42.239-.738.614-.899 1.06`,key:`1dfcux`}]]);function b(e){this.content=e}b.prototype={constructor:b,find:function(e){for(var t=0;t<this.content.length;t+=2)if(this.content[t]===e)return t;return-1},get:function(e){var t=this.find(e);return t==-1?void 0:this.content[t+1]},update:function(e,t,n){var r=n&&n!=e?this.remove(n):this,i=r.find(e),a=r.content.slice();return i==-1?a.push(n||e,t):(a[i+1]=t,n&&(a[i]=n)),new b(a)},remove:function(e){var t=this.find(e);if(t==-1)return this;var n=this.content.slice();return n.splice(t,2),new b(n)},addToStart:function(e,t){return new b([e,t].concat(this.remove(e).content))},addToEnd:function(e,t){var n=this.remove(e).content.slice();return n.push(e,t),new b(n)},addBefore:function(e,t,n){var r=this.remove(t),i=r.content.slice(),a=r.find(e);return i.splice(a==-1?i.length:a,0,t,n),new b(i)},forEach:function(e){for(var t=0;t<this.content.length;t+=2)e(this.content[t],this.content[t+1])},prepend:function(e){return e=b.from(e),e.size?new b(e.content.concat(this.subtract(e).content)):this},append:function(e){return e=b.from(e),e.size?new b(this.subtract(e).content.concat(e.content)):this},subtract:function(e){var t=this;e=b.from(e);for(var n=0;n<e.content.length;n+=2)t=t.remove(e.content[n]);return t},toObject:function(){var e={};return this.forEach(function(t,n){e[t]=n}),e},get size(){return this.content.length>>1}},b.from=function(e){if(e instanceof b)return e;var t=[];if(e)for(var n in e)t.push(n,e[n]);return new b(t)};function me(e,t,n){for(let r=0;;r++){if(r==e.childCount||r==t.childCount)return e.childCount==t.childCount?null:n;let i=e.child(r),a=t.child(r);if(i==a){n+=i.nodeSize;continue}if(!i.sameMarkup(a))return n;if(i.isText&&i.text!=a.text){let e=i.text,t=a.text,r=0;for(;e[r]==t[r];r++)n++;return r&&r<e.length&&r<t.length&&_e(e.charCodeAt(r-1))&&ge(e.charCodeAt(r))&&n--,n}if(i.content.size||a.content.size){let e=me(i.content,a.content,n+1);if(e!=null)return e}n+=i.nodeSize}}function he(e,t,n,r){for(let i=e.childCount,a=t.childCount;;){if(i==0||a==0)return i==a?null:{a:n,b:r};let o=e.child(--i),s=t.child(--a),c=o.nodeSize;if(o==s){n-=c,r-=c;continue}if(!o.sameMarkup(s))return{a:n,b:r};if(o.isText&&o.text!=s.text){let e=o.text,t=s.text,i=e.length,a=t.length;for(;i>0&&a>0&&e[i-1]==t[a-1];)i--,a--,n--,r--;return i&&a&&i<e.length&&_e(e.charCodeAt(i-1))&&ge(e.charCodeAt(i))&&(n++,r++),{a:n,b:r}}if(o.content.size||s.content.size){let e=he(o.content,s.content,n-1,r-1);if(e)return e}n-=c,r-=c}}function ge(e){return e>=56320&&e<57344}function _e(e){return e>=55296&&e<56320}var x=class e{constructor(e,t){if(this.content=e,this.size=t||0,t==null)for(let t=0;t<e.length;t++)this.size+=e[t].nodeSize}nodesBetween(e,t,n,r=0,i){for(let a=0,o=0;o<t;a++){let s=this.content[a],c=o+s.nodeSize;if(c>e&&n(s,r+o,i||null,a)!==!1&&s.content.size){let i=o+1;s.nodesBetween(Math.max(0,e-i),Math.min(s.content.size,t-i),n,r+i)}o=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,n,r){let i=``,a=!0;return this.nodesBetween(e,t,(o,s)=>{let c=o.isText?o.text.slice(Math.max(e,s)-s,t-s):o.isLeaf?r?typeof r==`function`?r(o):r:o.type.spec.leafText?o.type.spec.leafText(o):``:``;o.isBlock&&(o.isLeaf&&c||o.isTextblock)&&n&&(a?a=!1:i+=n),i+=c},0),i}append(t){if(!t.size)return this;if(!this.size)return t;let n=this.lastChild,r=t.firstChild,i=this.content.slice(),a=0;for(n.isText&&n.sameMarkup(r)&&(i[i.length-1]=n.withText(n.text+r.text),a=1);a<t.content.length;a++)i.push(t.content[a]);return new e(i,this.size+t.size)}cut(t,n=this.size){if(t==0&&n==this.size)return this;let r=[],i=0;if(n>t)for(let e=0,a=0;a<n;e++){let o=this.content[e],s=a+o.nodeSize;s>t&&((a<t||s>n)&&(o=o.isText?o.cut(Math.max(0,t-a),Math.min(o.text.length,n-a)):o.cut(Math.max(0,t-a-1),Math.min(o.content.size,n-a-1))),r.push(o),i+=o.nodeSize),a=s}return new e(r,i)}cutByIndex(t,n){return t==n?e.empty:t==0&&n==this.content.length?this:new e(this.content.slice(t,n))}replaceChild(t,n){let r=this.content[t];if(r==n)return this;let i=this.content.slice(),a=this.size+n.nodeSize-r.nodeSize;return i[t]=n,new e(i,a)}addToStart(t){return new e([t].concat(this.content),this.size+t.nodeSize)}addToEnd(t){return new e(this.content.concat(t),this.size+t.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let t=this.content[e];if(!t)throw RangeError(`Index `+e+` out of range for `+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,n=0;t<this.content.length;t++){let r=this.content[t];e(r,n,t),n+=r.nodeSize}}findDiffStart(e,t=0){return me(this,e,t)}findDiffEnd(e,t=this.size,n=e.size){return he(this,e,t,n)}findIndex(e){if(e==0)return ye(0,e);if(e==this.size)return ye(this.content.length,e);if(e>this.size||e<0)throw RangeError(`Position ${e} outside of fragment (${this})`);for(let t=0,n=0;;t++){let r=this.child(t),i=n+r.nodeSize;if(i>=e)return i==e?ye(t+1,i):ye(t,n);n=i}}toString(){return`<`+this.toStringInner()+`>`}toStringInner(){return this.content.join(`, `)}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(t,n){if(!n)return e.empty;if(!Array.isArray(n))throw RangeError(`Invalid input for Fragment.fromJSON`);return e.fromArray(n.map(t.nodeFromJSON))}static fromArray(t){if(!t.length)return e.empty;let n,r=0;for(let e=0;e<t.length;e++){let i=t[e];r+=i.nodeSize,e&&i.isText&&t[e-1].sameMarkup(i)?(n||=t.slice(0,e),n[n.length-1]=i.withText(n[n.length-1].text+i.text)):n&&n.push(i)}return new e(n||t,r)}static from(t){if(!t)return e.empty;if(t instanceof e)return t;if(Array.isArray(t))return this.fromArray(t);if(t.attrs)return new e([t],t.nodeSize);throw RangeError(`Can not convert `+t+` to a Fragment`+(t.nodesBetween?` (looks like multiple versions of prosemirror-model were loaded)`:``))}};x.empty=new x([],0);var ve={index:0,offset:0};function ye(e,t){return ve.index=e,ve.offset=t,ve}function be(e,t){if(e===t)return!0;if(!(e&&typeof e==`object`)||!(t&&typeof t==`object`))return!1;let n=Array.isArray(e);if(Array.isArray(t)!=n)return!1;if(n){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!be(e[n],t[n]))return!1}else{for(let n in e)if(!(n in t)||!be(e[n],t[n]))return!1;for(let n in t)if(!(n in e))return!1}return!0}var S=class e{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,n=!1;for(let r=0;r<e.length;r++){let i=e[r];if(this.eq(i))return e;if(this.type.excludes(i.type))t||=e.slice(0,r);else if(i.type.excludes(this.type))return e;else!n&&i.type.rank>this.type.rank&&(t||=e.slice(0,r),t.push(this),n=!0),t&&t.push(i)}return t||=e.slice(),n||t.push(this),t}removeFromSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return e.slice(0,t).concat(e.slice(t+1));return e}isInSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return!0;return!1}eq(e){return this==e||this.type==e.type&&be(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,t){if(!t)throw RangeError(`Invalid input for Mark.fromJSON`);let n=e.marks[t.type];if(!n)throw RangeError(`There is no mark type ${t.type} in this schema`);let r=n.create(t.attrs);return n.checkAttrs(r.attrs),r}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!e[n].eq(t[n]))return!1;return!0}static setFrom(t){if(!t||Array.isArray(t)&&t.length==0)return e.none;if(t instanceof e)return[t];let n=t.slice();return n.sort((e,t)=>e.type.rank-t.type.rank),n}};S.none=[];var xe=class extends Error{},C=class e{constructor(e,t,n){this.content=e,this.openStart=t,this.openEnd=n}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(t,n){let r=Ce(this.content,t+this.openStart,n,this.openStart+1,this.openEnd+1);return r&&new e(r,this.openStart,this.openEnd)}removeBetween(t,n){return new e(Se(this.content,t+this.openStart,n+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+`(`+this.openStart+`,`+this.openEnd+`)`}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(t,n){if(!n)return e.empty;let r=n.openStart||0,i=n.openEnd||0;if(typeof r!=`number`||typeof i!=`number`)throw RangeError(`Invalid input for Slice.fromJSON`);return new e(x.fromJSON(t,n.content),r,i)}static maxOpen(t,n=!0){let r=0,i=0;for(let e=t.firstChild;e&&!e.isLeaf&&(n||!e.type.spec.isolating);e=e.firstChild)r++;for(let e=t.lastChild;e&&!e.isLeaf&&(n||!e.type.spec.isolating);e=e.lastChild)i++;return new e(t,r,i)}};C.empty=new C(x.empty,0,0);function Se(e,t,n){let{index:r,offset:i}=e.findIndex(t),a=e.maybeChild(r),{index:o,offset:s}=e.findIndex(n);if(i==t||a.isText){if(s!=n&&!e.child(o).isText)throw RangeError(`Removing non-flat range`);return e.cut(0,t).append(e.cut(n))}if(r!=o)throw RangeError(`Removing non-flat range`);return e.replaceChild(r,a.copy(Se(a.content,t-i-1,n-i-1)))}function Ce(e,t,n,r,i,a){let{index:o,offset:s}=e.findIndex(t),c=e.maybeChild(o);if(s==t||c.isText)return a&&r<=0&&i<=0&&!a.canReplace(o,o,n)?null:e.cut(0,t).append(n).append(e.cut(t));let l=Ce(c.content,t-s-1,n,o==0?r-1:0,o==e.childCount-1?i-1:0,c);return l&&e.replaceChild(o,c.copy(l))}function we(e,t,n){if(n.openStart>e.depth)throw new xe(`Inserted content deeper than insertion position`);if(e.depth-n.openStart!=t.depth-n.openEnd)throw new xe(`Inconsistent open depths`);return Te(e,t,n,0)}function Te(e,t,n,r){let i=e.index(r),a=e.node(r);if(i==t.index(r)&&r<e.depth-n.openStart){let o=Te(e,t,n,r+1);return a.copy(a.content.replaceChild(i,o))}else if(!n.content.size)return Ae(a,Me(e,t,r));else if(!n.openStart&&!n.openEnd&&e.depth==r&&t.depth==r){let r=e.parent,i=r.content;return Ae(r,i.cut(0,e.parentOffset).append(n.content).append(i.cut(t.parentOffset)))}else{let{start:i,end:o}=Ne(n,e);return Ae(a,je(e,i,o,t,r))}}function Ee(e,t){if(!t.type.compatibleContent(e.type))throw new xe(`Cannot join `+t.type.name+` onto `+e.type.name)}function De(e,t,n){let r=e.node(n);return Ee(r,t.node(n)),r}function Oe(e,t){let n=t.length-1;n>=0&&e.isText&&e.sameMarkup(t[n])?t[n]=e.withText(t[n].text+e.text):t.push(e)}function ke(e,t,n,r){let i=(t||e).node(n),a=0,o=t?t.index(n):i.childCount;e&&(a=e.index(n),e.depth>n?a++:e.textOffset&&(Oe(e.nodeAfter,r),a++));for(let e=a;e<o;e++)Oe(i.child(e),r);t&&t.depth==n&&t.textOffset&&Oe(t.nodeBefore,r)}function Ae(e,t){if(!e.type.validContent(t))throw new xe(`Invalid content for node `+e.type.name);return e.copy(t)}function je(e,t,n,r,i){let a=e.depth>i&&De(e,t,i+1),o=r.depth>i&&De(n,r,i+1),s=[];return ke(null,e,i,s),a&&o&&t.index(i)==n.index(i)?(Ee(a,o),Oe(Ae(a,je(e,t,n,r,i+1)),s)):(a&&Oe(Ae(a,Me(e,t,i+1)),s),ke(t,n,i,s),o&&Oe(Ae(o,Me(n,r,i+1)),s)),ke(r,null,i,s),new x(s)}function Me(e,t,n){let r=[];return ke(null,e,n,r),e.depth>n&&Oe(Ae(De(e,t,n+1),Me(e,t,n+1)),r),ke(t,null,n,r),new x(r)}function Ne(e,t){let n=t.depth-e.openStart,r=t.node(n).copy(e.content);for(let e=n-1;e>=0;e--)r=t.node(e).copy(x.from(r));return{start:r.resolveNoCache(e.openStart+n),end:r.resolveNoCache(r.content.size-e.openEnd-n)}}var Pe=class e{constructor(e,t,n){this.pos=e,this.path=t,this.parentOffset=n,this.depth=t.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw RangeError(`There is no position before the top-level node`);return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw RangeError(`There is no position after the top-level node`);return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,t=this.index(this.depth);if(t==e.childCount)return null;let n=this.pos-this.path[this.path.length-1],r=e.child(t);return n?e.child(t).cut(n):r}get nodeBefore(){let e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):e==0?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let n=this.path[t*3],r=t==0?0:this.path[t*3-1]+1;for(let t=0;t<e;t++)r+=n.child(t).nodeSize;return r}marks(){let e=this.parent,t=this.index();if(e.content.size==0)return S.none;if(this.textOffset)return e.child(t).marks;let n=e.maybeChild(t-1),r=e.maybeChild(t);if(!n){let e=n;n=r,r=e}let i=n.marks;for(var a=0;a<i.length;a++)i[a].type.spec.inclusive===!1&&(!r||!i[a].isInSet(r.marks))&&(i=i[a--].removeFromSet(i));return i}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let n=t.marks,r=e.parent.maybeChild(e.index());for(var i=0;i<n.length;i++)n[i].type.spec.inclusive===!1&&(!r||!n[i].isInSet(r.marks))&&(n=n[i--].removeFromSet(n));return n}sharedDepth(e){for(let t=this.depth;t>0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){if(e.pos<this.pos)return e.blockRange(this);for(let n=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);n>=0;n--)if(e.pos<=this.end(n)&&(!t||t(this.node(n))))return new Re(this,e,n);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e=``;for(let t=1;t<=this.depth;t++)e+=(e?`/`:``)+this.node(t).type.name+`_`+this.index(t-1);return e+`:`+this.parentOffset}static resolve(t,n){if(!(n>=0&&n<=t.content.size))throw RangeError(`Position `+n+` out of range`);let r=[],i=0,a=n;for(let e=t;;){let{index:t,offset:n}=e.content.findIndex(a),o=a-n;if(r.push(e,t,i+n),!o||(e=e.child(t),e.isText))break;a=o-1,i+=n+1}return new e(n,r,a)}static resolveCached(t,n){let r=Le.get(t);if(r)for(let e=0;e<r.elts.length;e++){let t=r.elts[e];if(t.pos==n)return t}else Le.set(t,r=new Fe);let i=r.elts[r.i]=e.resolve(t,n);return r.i=(r.i+1)%Ie,i}},Fe=class{constructor(){this.elts=[],this.i=0}},Ie=12,Le=new WeakMap,Re=class{constructor(e,t,n){this.$from=e,this.$to=t,this.depth=n}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}},ze=Object.create(null),Be=class e{constructor(e,t,n,r=S.none){this.type=e,this.attrs=t,this.marks=r,this.content=n||x.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,t,n,r=0){this.content.nodesBetween(e,t,n,r,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,``)}textBetween(e,t,n,r){return this.content.textBetween(e,t,n,r)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,t,n){return this.type==e&&be(this.attrs,t||e.defaultAttrs||ze)&&S.sameSet(this.marks,n||S.none)}copy(t=null){return t==this.content?this:new e(this.type,this.attrs,t,this.marks)}mark(t){return t==this.marks?this:new e(this.type,this.attrs,this.content,t)}cut(e,t=this.content.size){return e==0&&t==this.content.size?this:this.copy(this.content.cut(e,t))}slice(e,t=this.content.size,n=!1){if(e==t)return C.empty;let r=this.resolve(e),i=this.resolve(t),a=n?0:r.sharedDepth(t),o=r.start(a);return new C(r.node(a).content.cut(r.pos-o,i.pos-o),r.depth-a,i.depth-a)}replace(e,t,n){return we(this.resolve(e),this.resolve(t),n)}nodeAt(e){for(let t=this;;){let{index:n,offset:r}=t.content.findIndex(e);if(t=t.maybeChild(n),!t)return null;if(r==e||t.isText)return t;e-=r+1}}childAfter(e){let{index:t,offset:n}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:n}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:t,offset:n}=this.content.findIndex(e);if(n<e)return{node:this.content.child(t),index:t,offset:n};let r=this.content.child(t-1);return{node:r,index:t-1,offset:n-r.nodeSize}}resolve(e){return Pe.resolveCached(this,e)}resolveNoCache(e){return Pe.resolve(this,e)}rangeHasMark(e,t,n){let r=!1;return t>e&&this.nodesBetween(e,t,e=>(n.isInSet(e.marks)&&(r=!0),!r)),r}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+=`(`+this.content.toStringInner()+`)`),He(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw Error(`Called contentMatchAt on a node with invalid content`);return t}canReplace(e,t,n=x.empty,r=0,i=n.childCount){let a=this.contentMatchAt(e).matchFragment(n,r,i),o=a&&a.matchFragment(this.content,t);if(!o||!o.validEnd)return!1;for(let e=r;e<i;e++)if(!this.type.allowsMarks(n.child(e).marks))return!1;return!0}canReplaceWith(e,t,n,r){if(r&&!this.type.allowsMarks(r))return!1;let i=this.contentMatchAt(e).matchType(n),a=i&&i.matchFragment(this.content,t);return a?a.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=S.none;for(let t=0;t<this.marks.length;t++){let n=this.marks[t];n.type.checkAttrs(n.attrs),e=n.addToSet(e)}if(!S.sameSet(e,this.marks))throw RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(e=>e.type.name)}`);this.content.forEach(e=>e.check())}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(e=>e.toJSON())),e}static fromJSON(e,t){if(!t)throw RangeError(`Invalid input for Node.fromJSON`);let n;if(t.marks){if(!Array.isArray(t.marks))throw RangeError(`Invalid mark data for Node.fromJSON`);n=t.marks.map(e.markFromJSON)}if(t.type==`text`){if(typeof t.text!=`string`)throw RangeError(`Invalid text node in JSON`);return e.text(t.text,n)}let r=x.fromJSON(e,t.content),i=e.nodeType(t.type).create(t.attrs,r,n);return i.type.checkAttrs(i.attrs),i}};Be.prototype.text=void 0;var Ve=class e extends Be{constructor(e,t,n,r){if(super(e,t,null,r),!n)throw RangeError(`Empty text nodes are not allowed`);this.text=n}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):He(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,t){return this.text.slice(e,t)}get nodeSize(){return this.text.length}mark(t){return t==this.marks?this:new e(this.type,this.attrs,this.text,t)}withText(t){return t==this.text?this:new e(this.type,this.attrs,t,this.marks)}cut(e=0,t=this.text.length){return e==0&&t==this.text.length?this:this.withText(this.text.slice(e,t))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}};function He(e,t){for(let n=e.length-1;n>=0;n--)t=e[n].type.name+`(`+t+`)`;return t}var Ue=class e{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(t,n){let r=new We(t,n);if(r.next==null)return e.empty;let i=Ge(r);r.next&&r.err(`Unexpected trailing text`);let a=tt(Qe(i));return nt(a,r),a}matchType(e){for(let t=0;t<this.next.length;t++)if(this.next[t].type==e)return this.next[t].next;return null}matchFragment(e,t=0,n=e.childCount){let r=this;for(let i=t;r&&i<n;i++)r=r.matchType(e.child(i).type);return r}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:t}=this.next[e];if(!(t.isText||t.hasRequiredAttrs()))return t}return null}compatible(e){for(let t=0;t<this.next.length;t++)for(let n=0;n<e.next.length;n++)if(this.next[t].type==e.next[n].type)return!0;return!1}fillBefore(e,t=!1,n=0){let r=[this];function i(a,o){let s=a.matchFragment(e,n);if(s&&(!t||s.validEnd))return x.from(o.map(e=>e.createAndFill()));for(let e=0;e<a.next.length;e++){let{type:t,next:n}=a.next[e];if(!(t.isText||t.hasRequiredAttrs())&&r.indexOf(n)==-1){r.push(n);let e=i(n,o.concat(t));if(e)return e}}return null}return i(this,[])}findWrapping(e){for(let t=0;t<this.wrapCache.length;t+=2)if(this.wrapCache[t]==e)return this.wrapCache[t+1];let t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),n=[{match:this,type:null,via:null}];for(;n.length;){let r=n.shift(),i=r.match;if(i.matchType(e)){let e=[];for(let t=r;t.type;t=t.via)e.push(t.type);return e.reverse()}for(let e=0;e<i.next.length;e++){let{type:a,next:o}=i.next[e];!a.isLeaf&&!a.hasRequiredAttrs()&&!(a.name in t)&&(!r.type||o.validEnd)&&(n.push({match:a.contentMatch,type:a,via:r}),t[a.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function t(n){e.push(n);for(let r=0;r<n.next.length;r++)e.indexOf(n.next[r].next)==-1&&t(n.next[r].next)}return t(this),e.map((t,n)=>{let r=n+(t.validEnd?`*`:` `)+` `;for(let n=0;n<t.next.length;n++)r+=(n?`, `:``)+t.next[n].type.name+`->`+e.indexOf(t.next[n].next);return r}).join(`
2
2
  `)}};Ue.empty=new Ue(!0);var We=class{constructor(e,t){this.string=e,this.nodeTypes=t,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==``&&this.tokens.pop(),this.tokens[0]==``&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw SyntaxError(e+` (in content expression '`+this.string+`')`)}};function Ge(e){let t=[];do t.push(Ke(e));while(e.eat(`|`));return t.length==1?t[0]:{type:`choice`,exprs:t}}function Ke(e){let t=[];do t.push(qe(e));while(e.next&&e.next!=`)`&&e.next!=`|`);return t.length==1?t[0]:{type:`seq`,exprs:t}}function qe(e){let t=Ze(e);for(;;)if(e.eat(`+`))t={type:`plus`,expr:t};else if(e.eat(`*`))t={type:`star`,expr:t};else if(e.eat(`?`))t={type:`opt`,expr:t};else if(e.eat(`{`))t=Ye(e,t);else break;return t}function Je(e){/\D/.test(e.next)&&e.err(`Expected number, got '`+e.next+`'`);let t=Number(e.next);return e.pos++,t}function Ye(e,t){let n=Je(e),r=n;return e.eat(`,`)&&(r=e.next==`}`?-1:Je(e)),e.eat(`}`)||e.err(`Unclosed braced range`),{type:`range`,min:n,max:r,expr:t}}function Xe(e,t){let n=e.nodeTypes,r=n[t];if(r)return[r];let i=[];for(let e in n){let r=n[e];r.isInGroup(t)&&i.push(r)}return i.length==0&&e.err(`No node type or group '`+t+`' found`),i}function Ze(e){if(e.eat(`(`)){let t=Ge(e);return e.eat(`)`)||e.err(`Missing closing paren`),t}else if(/\W/.test(e.next))e.err(`Unexpected token '`+e.next+`'`);else{let t=Xe(e,e.next).map(t=>(e.inline==null?e.inline=t.isInline:e.inline!=t.isInline&&e.err(`Mixing inline and block content`),{type:`name`,value:t}));return e.pos++,t.length==1?t[0]:{type:`choice`,exprs:t}}}function Qe(e){let t=[[]];return i(a(e,0),n()),t;function n(){return t.push([])-1}function r(e,n,r){let i={term:r,to:n};return t[e].push(i),i}function i(e,t){e.forEach(e=>e.to=t)}function a(e,t){if(e.type==`choice`)return e.exprs.reduce((e,n)=>e.concat(a(n,t)),[]);if(e.type==`seq`)for(let r=0;;r++){let o=a(e.exprs[r],t);if(r==e.exprs.length-1)return o;i(o,t=n())}else if(e.type==`star`){let o=n();return r(t,o),i(a(e.expr,o),o),[r(o)]}else if(e.type==`plus`){let o=n();return i(a(e.expr,t),o),i(a(e.expr,o),o),[r(o)]}else if(e.type==`opt`)return[r(t)].concat(a(e.expr,t));else if(e.type==`range`){let o=t;for(let t=0;t<e.min;t++){let t=n();i(a(e.expr,o),t),o=t}if(e.max==-1)i(a(e.expr,o),o);else for(let t=e.min;t<e.max;t++){let t=n();r(o,t),i(a(e.expr,o),t),o=t}return[r(o)]}else if(e.type==`name`)return[r(t,void 0,e.value)];else throw Error(`Unknown expr type`)}}function $e(e,t){return t-e}function et(e,t){let n=[];return r(t),n.sort($e);function r(t){let i=e[t];if(i.length==1&&!i[0].term)return r(i[0].to);n.push(t);for(let e=0;e<i.length;e++){let{term:t,to:a}=i[e];!t&&n.indexOf(a)==-1&&r(a)}}}function tt(e){let t=Object.create(null);return n(et(e,0));function n(r){let i=[];r.forEach(t=>{e[t].forEach(({term:t,to:n})=>{if(!t)return;let r;for(let e=0;e<i.length;e++)i[e][0]==t&&(r=i[e][1]);et(e,n).forEach(e=>{r||i.push([t,r=[]]),r.indexOf(e)==-1&&r.push(e)})})});let a=t[r.join(`,`)]=new Ue(r.indexOf(e.length-1)>-1);for(let e=0;e<i.length;e++){let r=i[e][1].sort($e);a.next.push({type:i[e][0],next:t[r.join(`,`)]||n(r)})}return a}}function nt(e,t){for(let n=0,r=[e];n<r.length;n++){let e=r[n],i=!e.validEnd,a=[];for(let t=0;t<e.next.length;t++){let{type:n,next:o}=e.next[t];a.push(n.name),i&&!(n.isText||n.hasRequiredAttrs())&&(i=!1),r.indexOf(o)==-1&&r.push(o)}i&&t.err(`Only non-generatable nodes (`+a.join(`, `)+`) in a required position (see https://prosemirror.net/docs/guide/#generatable)`)}}function rt(e){let t=Object.create(null);for(let n in e){let r=e[n];if(!r.hasDefault)return null;t[n]=r.default}return t}function it(e,t){let n=Object.create(null);for(let r in e){let i=t&&t[r];if(i===void 0){let t=e[r];if(t.hasDefault)i=t.default;else throw RangeError(`No value supplied for attribute `+r)}n[r]=i}return n}function at(e,t,n,r){for(let i in t)if(!(i in e))throw RangeError(`Unsupported attribute ${i} for ${n} of type ${r}`);for(let n in e)e[n].validate&&e[n].validate(t[n])}function ot(e,t){let n=Object.create(null);if(t)for(let r in t)n[r]=new lt(e,r,t[r]);return n}var st=class e{constructor(e,t,n){this.name=e,this.schema=t,this.spec=n,this.markSet=null,this.groups=n.group?n.group.split(` `):[],this.attrs=ot(e,n.attrs),this.defaultAttrs=rt(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(n.inline||e==`text`),this.isText=e==`text`}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==Ue.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}isInGroup(e){return this.groups.indexOf(e)>-1}get whitespace(){return this.spec.whitespace||(this.spec.code?`pre`:`normal`)}hasRequiredAttrs(){for(let e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}compatibleContent(e){return this==e||this.contentMatch.compatible(e.contentMatch)}computeAttrs(e){return!e&&this.defaultAttrs?this.defaultAttrs:it(this.attrs,e)}create(e=null,t,n){if(this.isText)throw Error(`NodeType.create can't construct text nodes`);return new Be(this,this.computeAttrs(e),x.from(t),S.setFrom(n))}createChecked(e=null,t,n){return t=x.from(t),this.checkContent(t),new Be(this,this.computeAttrs(e),t,S.setFrom(n))}createAndFill(e=null,t,n){if(e=this.computeAttrs(e),t=x.from(t),t.size){let e=this.contentMatch.fillBefore(t);if(!e)return null;t=e.append(t)}let r=this.contentMatch.matchFragment(t),i=r&&r.fillBefore(x.empty,!0);return i?new Be(this,e,t.append(i),S.setFrom(n)):null}validContent(e){let t=this.contentMatch.matchFragment(e);if(!t||!t.validEnd)return!1;for(let t=0;t<e.childCount;t++)if(!this.allowsMarks(e.child(t).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}checkAttrs(e){at(this.attrs,e,`node`,this.name)}allowsMarkType(e){return this.markSet==null||this.markSet.indexOf(e)>-1}allowsMarks(e){if(this.markSet==null)return!0;for(let t=0;t<e.length;t++)if(!this.allowsMarkType(e[t].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let t;for(let n=0;n<e.length;n++)this.allowsMarkType(e[n].type)?t&&t.push(e[n]):t||=e.slice(0,n);return t?t.length?t:S.none:e}static compile(t,n){let r=Object.create(null);t.forEach((t,i)=>r[t]=new e(t,n,i));let i=n.spec.topNode||`doc`;if(!r[i])throw RangeError(`Schema is missing its top node type ('`+i+`')`);if(!r.text)throw RangeError(`Every schema needs a 'text' type`);for(let e in r.text.attrs)throw RangeError(`The text node type should not have attributes`);return r}};function ct(e,t,n){let r=n.split(`|`);return n=>{let i=n===null?`null`:typeof n;if(r.indexOf(i)<0)throw RangeError(`Expected value of type ${r} for attribute ${t} on type ${e}, got ${i}`)}}var lt=class{constructor(e,t,n){this.hasDefault=Object.prototype.hasOwnProperty.call(n,`default`),this.default=n.default,this.validate=typeof n.validate==`string`?ct(e,t,n.validate):n.validate}get isRequired(){return!this.hasDefault}},ut=class e{constructor(e,t,n,r){this.name=e,this.rank=t,this.schema=n,this.spec=r,this.attrs=ot(e,r.attrs),this.excluded=null;let i=rt(this.attrs);this.instance=i?new S(this,i):null}create(e=null){return!e&&this.instance?this.instance:new S(this,it(this.attrs,e))}static compile(t,n){let r=Object.create(null),i=0;return t.forEach((t,a)=>r[t]=new e(t,i++,n,a)),r}removeFromSet(e){for(var t=0;t<e.length;t++)e[t].type==this&&(e=e.slice(0,t).concat(e.slice(t+1)),t--);return e}isInSet(e){for(let t=0;t<e.length;t++)if(e[t].type==this)return e[t]}checkAttrs(e){at(this.attrs,e,`mark`,this.name)}excludes(e){return this.excluded.indexOf(e)>-1}},dt=class{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let t=this.spec={};for(let n in e)t[n]=e[n];t.nodes=b.from(e.nodes),t.marks=b.from(e.marks||{}),this.nodes=st.compile(this.spec.nodes,this),this.marks=ut.compile(this.spec.marks,this);let n=Object.create(null);for(let e in this.nodes){if(e in this.marks)throw RangeError(e+` can not be both a node and a mark`);let t=this.nodes[e],r=t.spec.content||``,i=t.spec.marks;if(t.contentMatch=n[r]||(n[r]=Ue.parse(r,this.nodes)),t.inlineContent=t.contentMatch.inlineContent,t.spec.linebreakReplacement){if(this.linebreakReplacement)throw RangeError(`Multiple linebreak nodes defined`);if(!t.isInline||!t.isLeaf)throw RangeError(`Linebreak replacement nodes must be inline leaf nodes`);this.linebreakReplacement=t}t.markSet=i==`_`?null:i?ft(this,i.split(` `)):i==``||!t.inlineContent?[]:null}for(let e in this.marks){let t=this.marks[e],n=t.spec.excludes;t.excluded=n==null?[t]:n==``?[]:ft(this,n.split(` `))}this.nodeFromJSON=e=>Be.fromJSON(this,e),this.markFromJSON=e=>S.fromJSON(this,e),this.topNodeType=this.nodes[this.spec.topNode||`doc`],this.cached.wrappings=Object.create(null)}node(e,t=null,n,r){if(typeof e==`string`)e=this.nodeType(e);else if(!(e instanceof st))throw RangeError(`Invalid node type: `+e);else if(e.schema!=this)throw RangeError(`Node type from different schema used (`+e.name+`)`);return e.createChecked(t,n,r)}text(e,t){let n=this.nodes.text;return new Ve(n,n.defaultAttrs,e,S.setFrom(t))}mark(e,t){return typeof e==`string`&&(e=this.marks[e]),e.create(t)}nodeType(e){let t=this.nodes[e];if(!t)throw RangeError(`Unknown node type: `+e);return t}};function ft(e,t){let n=[];for(let r=0;r<t.length;r++){let i=t[r],a=e.marks[i],o=a;if(a)n.push(a);else for(let t in e.marks){let r=e.marks[t];(i==`_`||r.spec.group&&r.spec.group.split(` `).indexOf(i)>-1)&&n.push(o=r)}if(!o)throw SyntaxError(`Unknown mark type: '`+t[r]+`'`)}return n}function pt(e){return e.tag!=null}function mt(e){return e.style!=null}var ht=class e{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[];let n=this.matchedStyles=[];t.forEach(e=>{if(pt(e))this.tags.push(e);else if(mt(e)){let t=/[^=]*/.exec(e.style)[0];n.indexOf(t)<0&&n.push(t),this.styles.push(e)}}),this.normalizeLists=!this.tags.some(t=>{if(!/^(ul|ol)\b/.test(t.tag)||!t.node)return!1;let n=e.nodes[t.node];return n.contentMatch.matchType(n)})}parse(e,t={}){let n=new wt(this,t,!1);return n.addAll(e,S.none,t.from,t.to),n.finish()}parseSlice(e,t={}){let n=new wt(this,t,!0);return n.addAll(e,S.none,t.from,t.to),C.maxOpen(n.finish())}matchTag(e,t,n){for(let r=n?this.tags.indexOf(n)+1:0;r<this.tags.length;r++){let n=this.tags[r];if(Et(e,n.tag)&&(n.namespace===void 0||e.namespaceURI==n.namespace)&&(!n.context||t.matchesContext(n.context))){if(n.getAttrs){let t=n.getAttrs(e);if(t===!1)continue;n.attrs=t||void 0}return n}}}matchStyle(e,t,n,r){for(let i=r?this.styles.indexOf(r)+1:0;i<this.styles.length;i++){let r=this.styles[i],a=r.style;if(!(a.indexOf(e)!=0||r.context&&!n.matchesContext(r.context)||a.length>e.length&&(a.charCodeAt(e.length)!=61||a.slice(e.length+1)!=t))){if(r.getAttrs){let e=r.getAttrs(t);if(e===!1)continue;r.attrs=e||void 0}return r}}}static schemaRules(e){let t=[];function n(e){let n=e.priority==null?50:e.priority,r=0;for(;r<t.length;r++){let e=t[r];if((e.priority==null?50:e.priority)<n)break}t.splice(r,0,e)}for(let t in e.marks){let r=e.marks[t].spec.parseDOM;r&&r.forEach(e=>{n(e=Dt(e)),e.mark||e.ignore||e.clearMark||(e.mark=t)})}for(let t in e.nodes){let r=e.nodes[t].spec.parseDOM;r&&r.forEach(e=>{n(e=Dt(e)),e.node||e.ignore||e.mark||(e.node=t)})}return t}static fromSchema(t){return t.cached.domParser||(t.cached.domParser=new e(t,e.schemaRules(t)))}},gt={address:!0,article:!0,aside:!0,blockquote:!0,body:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},_t={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},vt={ol:!0,ul:!0},yt=1,bt=2,xt=4;function St(e,t,n){return t==null?e&&e.whitespace==`pre`?3:n&-5:(t?yt:0)|(t===`full`?bt:0)}var Ct=class{constructor(e,t,n,r,i,a){this.type=e,this.attrs=t,this.marks=n,this.solid=r,this.options=a,this.content=[],this.activeMarks=S.none,this.match=i||(a&xt?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(x.from(e));if(t)this.match=this.type.contentMatch.matchFragment(t);else{let t=this.type.contentMatch,n;return(n=t.findWrapping(e.type))?(this.match=t,n):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&yt)){let e=this.content[this.content.length-1],t;if(e&&e.isText&&(t=/[ \t\r\n\u000c]+$/.exec(e.text))){let n=e;e.text.length==t[0].length?this.content.pop():this.content[this.content.length-1]=n.withText(n.text.slice(0,n.text.length-t[0].length))}}let t=x.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(x.empty,!0))),this.type?this.type.create(this.attrs,t,this.marks):t}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!gt.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}},wt=class{constructor(e,t,n){this.parser=e,this.options=t,this.isOpen=n,this.open=0,this.localPreserveWS=!1;let r=t.topNode,i,a=St(null,t.preserveWhitespace,0)|(n?xt:0);i=r?new Ct(r.type,r.attrs,S.none,!0,t.topMatch||r.type.contentMatch,a):n?new Ct(null,null,S.none,!0,null,a):new Ct(e.schema.topNodeType,null,S.none,!0,null,a),this.nodes=[i],this.find=t.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,t){e.nodeType==3?this.addTextNode(e,t):e.nodeType==1&&this.addElement(e,t)}addTextNode(e,t){let n=e.nodeValue,r=this.top,i=r.options&bt?`full`:this.localPreserveWS||(r.options&yt)>0,{schema:a}=this.parser;if(i===`full`||r.inlineContext(e)||/[^ \t\r\n\u000c]/.test(n)){if(!i){if(n=n.replace(/[ \t\r\n\u000c]+/g,` `),/^[ \t\r\n\u000c]/.test(n)&&this.open==this.nodes.length-1){let t=r.content[r.content.length-1],i=e.previousSibling;(!t||i&&i.nodeName==`BR`||t.isText&&/[ \t\r\n\u000c]$/.test(t.text))&&(n=n.slice(1))}}else if(i===`full`)n=n.replace(/\r\n?/g,`
3
3
  `);else if(a.linebreakReplacement&&/[\r\n]/.test(n)&&this.top.findWrapping(a.linebreakReplacement.create())){let e=n.split(/\r?\n|\r/);for(let n=0;n<e.length;n++)n&&this.insertNode(a.linebreakReplacement.create(),t,!0),e[n]&&this.insertNode(a.text(e[n]),t,!/\S/.test(e[n]));n=``}else n=n.replace(/\r?\n|\r/g,` `);n&&this.insertNode(a.text(n),t,!/\S/.test(n)),this.findInText(e)}else this.findInside(e)}addElement(e,t,n){let r=this.localPreserveWS,i=this.top;(e.tagName==`PRE`||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let a=e.nodeName.toLowerCase(),o;vt.hasOwnProperty(a)&&this.parser.normalizeLists&&Tt(e);let s=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(o=this.parser.matchTag(e,this,n));out:if(s?s.ignore:_t.hasOwnProperty(a))this.findInside(e),this.ignoreFallback(e,t);else if(!s||s.skip||s.closeParent){s&&s.closeParent?this.open=Math.max(0,this.open-1):s&&s.skip.nodeType&&(e=s.skip);let n,r=this.needsBlock;if(gt.hasOwnProperty(a))i.content.length&&i.content[0].isInline&&this.open&&(this.open--,i=this.top),n=!0,i.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,t);break out}let o=s&&s.skip?t:this.readStyles(e,t);o&&this.addAll(e,o),n&&this.sync(i),this.needsBlock=r}else{let n=this.readStyles(e,t);n&&this.addElementByRule(e,s,n,s.consuming===!1?o:void 0)}this.localPreserveWS=r}leafFallback(e,t){e.nodeName==`BR`&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
4
4
  `),t)}ignoreFallback(e,t){e.nodeName==`BR`&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text(`-`),t,!0)}readStyles(e,t){let n=e.style;if(n&&n.length)for(let e=0;e<this.parser.matchedStyles.length;e++){let r=this.parser.matchedStyles[e],i=n.getPropertyValue(r);if(i)for(let e;;){let n=this.parser.matchStyle(r,i,this,e);if(!n)break;if(n.ignore)return null;if(t=n.clearMark?t.filter(e=>!n.clearMark(e)):t.concat(this.parser.schema.marks[n.mark].create(n.attrs)),n.consuming===!1)e=n;else break}}return t}addElementByRule(e,t,n,r){let i,a;if(t.node)if(a=this.parser.schema.nodes[t.node],a.isLeaf)this.insertNode(a.create(t.attrs),n,e.nodeName==`BR`)||this.leafFallback(e,n);else{let e=this.enter(a,t.attrs||null,n,t.preserveWhitespace);e&&(i=!0,n=e)}else{let e=this.parser.schema.marks[t.mark];n=n.concat(e.create(t.attrs))}let o=this.top;if(a&&a.isLeaf)this.findInside(e);else if(r)this.addElement(e,n,r);else if(t.getContent)this.findInside(e),t.getContent(e,this.parser.schema).forEach(e=>this.insertNode(e,n,!1));else{let r=e;typeof t.contentElement==`string`?r=e.querySelector(t.contentElement):typeof t.contentElement==`function`?r=t.contentElement(e):t.contentElement&&(r=t.contentElement),this.findAround(e,r,!0),this.addAll(r,n),this.findAround(e,r,!1)}i&&this.sync(o)&&this.open--}addAll(e,t,n,r){let i=n||0;for(let a=n?e.childNodes[n]:e.firstChild,o=r==null?null:e.childNodes[r];a!=o;a=a.nextSibling,++i)this.findAtPoint(e,i),this.addDOM(a,t);this.findAtPoint(e,i)}findPlace(e,t,n){let r,i;for(let t=this.open,a=0;t>=0;t--){let o=this.nodes[t],s=o.findWrapping(e);if(s&&(!r||r.length>s.length+a)&&(r=s,i=o,!s.length))break;if(o.solid){if(n)break;a+=2}}if(!r)return null;this.sync(i);for(let e=0;e<r.length;e++)t=this.enterInner(r[e],null,t,!1);return t}insertNode(e,t,n){if(e.isInline&&this.needsBlock&&!this.top.type){let e=this.textblockFromContext();e&&(t=this.enterInner(e,null,t))}let r=this.findPlace(e,t,n);if(r){this.closeExtra();let t=this.top;t.match&&=t.match.matchType(e.type);let n=S.none;for(let i of r.concat(e.marks))(t.type?t.type.allowsMarkType(i.type):Ot(i.type,e.type))&&(n=i.addToSet(n));return t.content.push(e.mark(n)),!0}return!1}enter(e,t,n,r){let i=this.findPlace(e.create(t),n,!1);return i&&=this.enterInner(e,t,n,!0,r),i}enterInner(e,t,n,r=!1,i){this.closeExtra();let a=this.top;a.match=a.match&&a.match.matchType(e);let o=St(e,i,a.options);a.options&xt&&a.content.length==0&&(o|=xt);let s=S.none;return n=n.filter(t=>(a.type?a.type.allowsMarkType(t.type):Ot(t.type,e))?(s=t.addToSet(s),!1):!0),this.nodes.push(new Ct(e,t,s,r,null,o)),this.open++,n}closeExtra(e=!1){let t=this.nodes.length-1;if(t>this.open){for(;t>this.open;t--)this.nodes[t-1].content.push(this.nodes[t].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(e){for(let t=this.open;t>=0;t--)if(this.nodes[t]==e)return this.open=t,!0;else this.localPreserveWS&&(this.nodes[t].options|=yt);return!1}get currentPos(){this.closeExtra();let e=0;for(let t=this.open;t>=0;t--){let n=this.nodes[t].content;for(let t=n.length-1;t>=0;t--)e+=n[t].nodeSize;t&&e++}return e}findAtPoint(e,t){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].node==e&&this.find[n].offset==t&&(this.find[n].pos=this.currentPos)}findInside(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].pos==null&&e.nodeType==1&&e.contains(this.find[t].node)&&(this.find[t].pos=this.currentPos)}findAround(e,t,n){if(e!=t&&this.find)for(let r=0;r<this.find.length;r++)this.find[r].pos==null&&e.nodeType==1&&e.contains(this.find[r].node)&&t.compareDocumentPosition(this.find[r].node)&(n?2:4)&&(this.find[r].pos=this.currentPos)}findInText(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].node==e&&(this.find[t].pos=this.currentPos-(e.nodeValue.length-this.find[t].offset))}matchesContext(e){if(e.indexOf(`|`)>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let t=e.split(`/`),n=this.options.context,r=!this.isOpen&&(!n||n.parent.type==this.nodes[0].type),i=-(n?n.depth+1:0)+ +!r,a=(e,o)=>{for(;e>=0;e--){let s=t[e];if(s==``){if(e==t.length-1||e==0)continue;for(;o>=i;o--)if(a(e-1,o))return!0;return!1}else{let e=o>0||o==0&&r?this.nodes[o].type:n&&o>=i?n.node(o-i).type:null;if(!e||e.name!=s&&!e.isInGroup(s))return!1;o--}}return!0};return a(t.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let t=e.depth;t>=0;t--){let n=e.node(t).contentMatchAt(e.indexAfter(t)).defaultType;if(n&&n.isTextblock&&n.defaultAttrs)return n}for(let e in this.parser.schema.nodes){let t=this.parser.schema.nodes[e];if(t.isTextblock&&t.defaultAttrs)return t}}};function Tt(e){for(let t=e.firstChild,n=null;t;t=t.nextSibling){let e=t.nodeType==1?t.nodeName.toLowerCase():null;e&&vt.hasOwnProperty(e)&&n?(n.appendChild(t),t=n):e==`li`?n=t:e&&(n=null)}}function Et(e,t){return(e.matches||e.msMatchesSelector||e.webkitMatchesSelector||e.mozMatchesSelector).call(e,t)}function Dt(e){let t={};for(let n in e)t[n]=e[n];return t}function Ot(e,t){let n=t.schema.nodes;for(let r in n){let i=n[r];if(!i.allowsMarkType(e))continue;let a=[],o=e=>{a.push(e);for(let n=0;n<e.edgeCount;n++){let{type:r,next:i}=e.edge(n);if(r==t||a.indexOf(i)<0&&o(i))return!0}};if(o(i.contentMatch))return!0}}var kt=class e{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},n){n||=jt(t).createDocumentFragment();let r=n,i=[];return e.forEach(e=>{if(i.length||e.marks.length){let n=0,a=0;for(;n<i.length&&a<e.marks.length;){let t=e.marks[a];if(!this.marks[t.type.name]){a++;continue}if(!t.eq(i[n][0])||t.type.spec.spanning===!1)break;n++,a++}for(;n<i.length;)r=i.pop()[1];for(;a<e.marks.length;){let n=e.marks[a++],o=this.serializeMark(n,e.isInline,t);o&&(i.push([n,r]),r.appendChild(o.dom),r=o.contentDOM||o.dom)}}r.appendChild(this.serializeNodeInner(e,t))}),n}serializeNodeInner(e,t){if(e.isText)return jt(t).createTextNode(e.text);let{dom:n,contentDOM:r}=Ft(jt(t),this.nodes[e.type.name](e),null,e.attrs);if(r){if(e.isLeaf)throw RangeError(`Content hole not allowed in a leaf node spec`);this.serializeFragment(e.content,t,r)}return n}serializeNode(e,t={}){let n=this.serializeNodeInner(e,t);for(let r=e.marks.length-1;r>=0;r--){let i=this.serializeMark(e.marks[r],e.isInline,t);i&&((i.contentDOM||i.dom).appendChild(n),n=i.dom)}return n}serializeMark(e,t,n={}){let r=this.marks[e.type.name];return r&&Ft(jt(n),r(e,t),null,e.attrs)}static renderSpec(e,t,n=null,r){return typeof t==`string`?{dom:e.createTextNode(t)}:Ft(e,t,n,r)}static fromSchema(t){return t.cached.domSerializer||(t.cached.domSerializer=new e(this.nodesFromSchema(t),this.marksFromSchema(t)))}static nodesFromSchema(e){let t=At(e.nodes);return t.text||=e=>e.text,t}static marksFromSchema(e){return At(e.marks)}};function At(e){let t={};for(let n in e){let r=e[n].spec.toDOM;r&&(t[n]=r)}return t}function jt(e){return e.document||window.document}var Mt=new WeakMap;function Nt(e){let t=Mt.get(e);return t===void 0&&Mt.set(e,t=Pt(e)),t}function Pt(e){let t=null;function n(e){if(e&&typeof e==`object`)if(Array.isArray(e))if(typeof e[0]==`string`)t||=[],t.push(e);else for(let t=0;t<e.length;t++)n(e[t]);else for(let t in e)n(e[t])}return n(e),t}function Ft(e,t,n,r){if(t.nodeType==1)return{dom:t};if(t.dom&&t.dom.nodeType==1)return t;let i=t[0],a;if(typeof i!=`string`)throw RangeError(`Invalid array passed to renderSpec`);if(r&&(a=Nt(r))&&a.indexOf(t)>-1)throw RangeError(`Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.`);let o=i.indexOf(` `);o>0&&(n=i.slice(0,o),i=i.slice(o+1));let s,c=n?e.createElementNS(n,i):e.createElement(i),l=t[1],u=1;if(l&&typeof l==`object`&&l.nodeType==null&&!Array.isArray(l)){u=2;for(let e in l)if(l[e]!=null){let t=e.indexOf(` `);t>0?c.setAttributeNS(e.slice(0,t),e.slice(t+1),l[e]):e==`style`&&c.style?c.style.cssText=l[e]:c.setAttribute(e,l[e])}}for(let i=u;i<t.length;i++){let a=t[i];if(a===0){if(i<t.length-1||i>u)throw RangeError(`Content hole must be the only child of its parent node`);return{dom:c,contentDOM:c}}else if(typeof a==`string`)c.appendChild(e.createTextNode(a));else{let{dom:t,contentDOM:i}=Ft(e,a,n,r);if(c.appendChild(t),i){if(s)throw RangeError(`Multiple content holes`);s=i}}}return{dom:c,contentDOM:s}}var It=65535,Lt=2**16;function Rt(e,t){return e+t*Lt}function zt(e){return e&It}function Bt(e){return(e-(e&It))/Lt}var Vt=1,Ht=2,Ut=4,Wt=8,Gt=class{constructor(e,t,n){this.pos=e,this.delInfo=t,this.recover=n}get deleted(){return(this.delInfo&Wt)>0}get deletedBefore(){return(this.delInfo&5)>0}get deletedAfter(){return(this.delInfo&6)>0}get deletedAcross(){return(this.delInfo&Ut)>0}},Kt=class e{constructor(t,n=!1){if(this.ranges=t,this.inverted=n,!t.length&&e.empty)return e.empty}recover(e){let t=0,n=zt(e);if(!this.inverted)for(let e=0;e<n;e++)t+=this.ranges[e*3+2]-this.ranges[e*3+1];return this.ranges[n*3]+t+Bt(e)}mapResult(e,t=1){return this._map(e,t,!1)}map(e,t=1){return this._map(e,t,!0)}_map(e,t,n){let r=0,i=this.inverted?2:1,a=this.inverted?1:2;for(let o=0;o<this.ranges.length;o+=3){let s=this.ranges[o]-(this.inverted?r:0);if(s>e)break;let c=this.ranges[o+i],l=this.ranges[o+a],u=s+c;if(e<=u){let i=c?e==s?-1:e==u?1:t:t,a=s+r+(i<0?0:l);if(n)return a;let d=e==(t<0?s:u)?null:Rt(o/3,e-s),f=e==s?Ht:e==u?Vt:Ut;return(t<0?e!=s:e!=u)&&(f|=Wt),new Gt(a,f,d)}r+=l-c}return n?e+r:new Gt(e+r,0,null)}touches(e,t){let n=0,r=zt(t),i=this.inverted?2:1,a=this.inverted?1:2;for(let t=0;t<this.ranges.length;t+=3){let o=this.ranges[t]-(this.inverted?n:0);if(o>e)break;let s=this.ranges[t+i];if(e<=o+s&&t==r*3)return!0;n+=this.ranges[t+a]-s}return!1}forEach(e){let t=this.inverted?2:1,n=this.inverted?1:2;for(let r=0,i=0;r<this.ranges.length;r+=3){let a=this.ranges[r],o=a-(this.inverted?i:0),s=a+(this.inverted?0:i),c=this.ranges[r+t],l=this.ranges[r+n];e(o,o+c,s,s+l),i+=l-c}}invert(){return new e(this.ranges,!this.inverted)}toString(){return(this.inverted?`-`:``)+JSON.stringify(this.ranges)}static offset(t){return t==0?e.empty:new e(t<0?[0,-t,0]:[0,0,t])}};Kt.empty=new Kt([]);var qt=class e{constructor(e,t,n=0,r=e?e.length:0){this.mirror=t,this.from=n,this.to=r,this._maps=e||[],this.ownData=!(e||t)}get maps(){return this._maps}slice(t=0,n=this.maps.length){return new e(this._maps,this.mirror,t,n)}appendMap(e,t){this.ownData||=(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),!0),this.to=this._maps.push(e),t!=null&&this.setMirror(this._maps.length-1,t)}appendMapping(e){for(let t=0,n=this._maps.length;t<e._maps.length;t++){let r=e.getMirror(t);this.appendMap(e._maps[t],r!=null&&r<t?n+r:void 0)}}getMirror(e){if(this.mirror){for(let t=0;t<this.mirror.length;t++)if(this.mirror[t]==e)return this.mirror[t+(t%2?-1:1)]}}setMirror(e,t){this.mirror||=[],this.mirror.push(e,t)}appendMappingInverted(e){for(let t=e.maps.length-1,n=this._maps.length+e._maps.length;t>=0;t--){let r=e.getMirror(t);this.appendMap(e._maps[t].invert(),r!=null&&r>t?n-r-1:void 0)}}invert(){let t=new e;return t.appendMappingInverted(this),t}map(e,t=1){if(this.mirror)return this._map(e,t,!0);for(let n=this.from;n<this.to;n++)e=this._maps[n].map(e,t);return e}mapResult(e,t=1){return this._map(e,t,!1)}_map(e,t,n){let r=0;for(let n=this.from;n<this.to;n++){let i=this._maps[n].mapResult(e,t);if(i.recover!=null){let t=this.getMirror(n);if(t!=null&&t>n&&t<this.to){n=t,e=this._maps[t].recover(i.recover);continue}}r|=i.delInfo,e=i.pos}return n?e:new Gt(e,r,null)}},Jt=Object.create(null),w=class{getMap(){return Kt.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw RangeError(`Invalid input for Step.fromJSON`);let n=Jt[t.stepType];if(!n)throw RangeError(`No step type ${t.stepType} defined`);return n.fromJSON(e,t)}static jsonID(e,t){if(e in Jt)throw RangeError(`Duplicate use of step JSON ID `+e);return Jt[e]=t,t.prototype.jsonID=e,t}},T=class e{constructor(e,t){this.doc=e,this.failed=t}static ok(t){return new e(t,null)}static fail(t){return new e(null,t)}static fromReplace(t,n,r,i){try{return e.ok(t.replace(n,r,i))}catch(t){if(t instanceof xe)return e.fail(t.message);throw t}}};function Yt(e,t,n){let r=[];for(let i=0;i<e.childCount;i++){let a=e.child(i);a.content.size&&(a=a.copy(Yt(a.content,t,a))),a.isInline&&(a=t(a,n,i)),r.push(a)}return x.fromArray(r)}var Xt=class e extends w{constructor(e,t,n){super(),this.from=e,this.to=t,this.mark=n}apply(e){let t=e.slice(this.from,this.to),n=e.resolve(this.from),r=n.node(n.sharedDepth(this.to)),i=new C(Yt(t.content,(e,t)=>!e.isAtom||!t.type.allowsMarkType(this.mark.type)?e:e.mark(this.mark.addToSet(e.marks)),r),t.openStart,t.openEnd);return T.fromReplace(e,this.from,this.to,i)}invert(){return new Zt(this.from,this.to,this.mark)}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new e(n.pos,r.pos,this.mark)}merge(t){return t instanceof e&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new e(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark):null}toJSON(){return{stepType:`addMark`,mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(t,n){if(typeof n.from!=`number`||typeof n.to!=`number`)throw RangeError(`Invalid input for AddMarkStep.fromJSON`);return new e(n.from,n.to,t.markFromJSON(n.mark))}};w.jsonID(`addMark`,Xt);var Zt=class e extends w{constructor(e,t,n){super(),this.from=e,this.to=t,this.mark=n}apply(e){let t=e.slice(this.from,this.to),n=new C(Yt(t.content,e=>e.mark(this.mark.removeFromSet(e.marks)),e),t.openStart,t.openEnd);return T.fromReplace(e,this.from,this.to,n)}invert(){return new Xt(this.from,this.to,this.mark)}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new e(n.pos,r.pos,this.mark)}merge(t){return t instanceof e&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new e(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark):null}toJSON(){return{stepType:`removeMark`,mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(t,n){if(typeof n.from!=`number`||typeof n.to!=`number`)throw RangeError(`Invalid input for RemoveMarkStep.fromJSON`);return new e(n.from,n.to,t.markFromJSON(n.mark))}};w.jsonID(`removeMark`,Zt);var Qt=class e extends w{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return T.fail(`No node at mark step's position`);let n=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return T.fromReplace(e,this.pos,this.pos+1,new C(x.from(n),0,+!t.isLeaf))}invert(t){let n=t.nodeAt(this.pos);if(n){let t=this.mark.addToSet(n.marks);if(t.length==n.marks.length){for(let r=0;r<n.marks.length;r++)if(!n.marks[r].isInSet(t))return new e(this.pos,n.marks[r]);return new e(this.pos,this.mark)}}return new $t(this.pos,this.mark)}map(t){let n=t.mapResult(this.pos,1);return n.deletedAfter?null:new e(n.pos,this.mark)}toJSON(){return{stepType:`addNodeMark`,pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(t,n){if(typeof n.pos!=`number`)throw RangeError(`Invalid input for AddNodeMarkStep.fromJSON`);return new e(n.pos,t.markFromJSON(n.mark))}};w.jsonID(`addNodeMark`,Qt);var $t=class e extends w{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return T.fail(`No node at mark step's position`);let n=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return T.fromReplace(e,this.pos,this.pos+1,new C(x.from(n),0,+!t.isLeaf))}invert(e){let t=e.nodeAt(this.pos);return!t||!this.mark.isInSet(t.marks)?this:new Qt(this.pos,this.mark)}map(t){let n=t.mapResult(this.pos,1);return n.deletedAfter?null:new e(n.pos,this.mark)}toJSON(){return{stepType:`removeNodeMark`,pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(t,n){if(typeof n.pos!=`number`)throw RangeError(`Invalid input for RemoveNodeMarkStep.fromJSON`);return new e(n.pos,t.markFromJSON(n.mark))}};w.jsonID(`removeNodeMark`,$t);var en=class e extends w{constructor(e,t,n,r=!1){super(),this.from=e,this.to=t,this.slice=n,this.structure=r}apply(e){return this.structure&&tn(e,this.from,this.to)?T.fail(`Structure replace would overwrite content`):T.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new Kt([this.from,this.to-this.from,this.slice.size])}invert(t){return new e(this.from,this.from+this.slice.size,t.slice(this.from,this.to))}map(t){let n=t.mapResult(this.to,-1),r=this.from==this.to&&e.MAP_BIAS<0?n:t.mapResult(this.from,1);return r.deletedAcross&&n.deletedAcross?null:new e(r.pos,Math.max(r.pos,n.pos),this.slice,this.structure)}merge(t){if(!(t instanceof e)||t.structure||this.structure)return null;if(this.from+this.slice.size==t.from&&!this.slice.openEnd&&!t.slice.openStart){let n=this.slice.size+t.slice.size==0?C.empty:new C(this.slice.content.append(t.slice.content),this.slice.openStart,t.slice.openEnd);return new e(this.from,this.to+(t.to-t.from),n,this.structure)}else if(t.to==this.from&&!this.slice.openStart&&!t.slice.openEnd){let n=this.slice.size+t.slice.size==0?C.empty:new C(t.slice.content.append(this.slice.content),t.slice.openStart,this.slice.openEnd);return new e(t.from,this.to,n,this.structure)}else return null}toJSON(){let e={stepType:`replace`,from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(t,n){if(typeof n.from!=`number`||typeof n.to!=`number`)throw RangeError(`Invalid input for ReplaceStep.fromJSON`);return new e(n.from,n.to,C.fromJSON(t,n.slice),!!n.structure)}};en.MAP_BIAS=1,w.jsonID(`replace`,en);var E=class e extends w{constructor(e,t,n,r,i,a,o=!1){super(),this.from=e,this.to=t,this.gapFrom=n,this.gapTo=r,this.slice=i,this.insert=a,this.structure=o}apply(e){if(this.structure&&(tn(e,this.from,this.gapFrom)||tn(e,this.gapTo,this.to)))return T.fail(`Structure gap-replace would overwrite content`);let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return T.fail(`Gap is not a flat range`);let n=this.slice.insertAt(this.insert,t.content);return n?T.fromReplace(e,this.from,this.to,n):T.fail(`Content does not fit in gap`)}getMap(){return new Kt([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(t){let n=this.gapTo-this.gapFrom;return new e(this.from,this.from+this.slice.size+n,this.from+this.insert,this.from+this.insert+n,t.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1),i=this.from==this.gapFrom?n.pos:t.map(this.gapFrom,-1),a=this.to==this.gapTo?r.pos:t.map(this.gapTo,1);return n.deletedAcross&&r.deletedAcross||i<n.pos||a>r.pos?null:new e(n.pos,r.pos,i,a,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:`replaceAround`,from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(t,n){if(typeof n.from!=`number`||typeof n.to!=`number`||typeof n.gapFrom!=`number`||typeof n.gapTo!=`number`||typeof n.insert!=`number`)throw RangeError(`Invalid input for ReplaceAroundStep.fromJSON`);return new e(n.from,n.to,n.gapFrom,n.gapTo,C.fromJSON(t,n.slice),n.insert,!!n.structure)}};w.jsonID(`replaceAround`,E);function tn(e,t,n){let r=e.resolve(t),i=n-t,a=r.depth;for(;i>0&&a>0&&r.indexAfter(a)==r.node(a).childCount;)a--,i--;if(i>0){let e=r.node(a).maybeChild(r.indexAfter(a));for(;i>0;){if(!e||e.isLeaf)return!0;e=e.firstChild,i--}}return!1}function nn(e,t,n,r){let i=[],a=[],o,s;e.doc.nodesBetween(t,n,(e,c,l)=>{if(!e.isInline)return;let u=e.marks;if(!r.isInSet(u)&&l.type.allowsMarkType(r.type)){let l=Math.max(c,t),d=Math.min(c+e.nodeSize,n),f=r.addToSet(u);for(let e=0;e<u.length;e++)u[e].isInSet(f)||(o&&o.to==l&&o.mark.eq(u[e])?o.to=d:i.push(o=new Zt(l,d,u[e])));s&&s.to==l?s.to=d:a.push(s=new Xt(l,d,r))}}),i.forEach(t=>e.step(t)),a.forEach(t=>e.step(t))}function rn(e,t,n,r){let i=[],a=0;e.doc.nodesBetween(t,n,(e,o)=>{if(!e.isInline)return;a++;let s=null;if(r instanceof ut){let t=e.marks,n;for(;n=r.isInSet(t);)(s||=[]).push(n),t=n.removeFromSet(t)}else r?r.isInSet(e.marks)&&(s=[r]):s=e.marks;if(s&&s.length){let r=Math.min(o+e.nodeSize,n);for(let e=0;e<s.length;e++){let n=s[e],c;for(let e=0;e<i.length;e++){let t=i[e];t.step==a-1&&n.eq(i[e].style)&&(c=t)}c?(c.to=r,c.step=a):i.push({style:n,from:Math.max(o,t),to:r,step:a})}}}),i.forEach(t=>e.step(new Zt(t.from,t.to,t.style)))}function an(e,t,n,r=n.contentMatch,i=!0){let a=e.doc.nodeAt(t),o=[],s=t+1;for(let t=0;t<a.childCount;t++){let c=a.child(t),l=s+c.nodeSize,u=r.matchType(c.type);if(!u)o.push(new en(s,l,C.empty));else{r=u;for(let t=0;t<c.marks.length;t++)n.allowsMarkType(c.marks[t].type)||e.step(new Zt(s,l,c.marks[t]));if(i&&c.isText&&n.whitespace!=`pre`){let e,t=/\r?\n|\r/g,r;for(;e=t.exec(c.text);)r||=new C(x.from(n.schema.text(` `,n.allowedMarks(c.marks))),0,0),o.push(new en(s+e.index,s+e.index+e[0].length,r))}}s=l}if(!r.validEnd){let t=r.fillBefore(x.empty,!0);e.replace(s,s,new C(t,0,0))}for(let t=o.length-1;t>=0;t--)e.step(o[t])}function on(e,t,n){return(t==0||e.canReplace(t,e.childCount))&&(n==e.childCount||e.canReplace(0,n))}function sn(e){let t=e.parent.content.cutByIndex(e.startIndex,e.endIndex);for(let n=e.depth,r=0,i=0;;--n){let a=e.$from.node(n),o=e.$from.index(n)+r,s=e.$to.indexAfter(n)-i;if(n<e.depth&&a.canReplace(o,s,t))return n;if(n==0||a.type.spec.isolating||!on(a,o,s))break;o&&(r=1),s<a.childCount&&(i=1)}return null}function cn(e,t,n){let{$from:r,$to:i,depth:a}=t,o=r.before(a+1),s=i.after(a+1),c=o,l=s,u=x.empty,d=0;for(let e=a,t=!1;e>n;e--)t||r.index(e)>0?(t=!0,u=x.from(r.node(e).copy(u)),d++):c--;let f=x.empty,p=0;for(let e=a,t=!1;e>n;e--)t||i.after(e+1)<i.end(e)?(t=!0,f=x.from(i.node(e).copy(f)),p++):l++;e.step(new E(c,l,o,s,new C(u.append(f),d,p),u.size-d,!0))}function ln(e,t,n=null,r=e){let i=dn(e,t),a=i&&fn(r,t);return a?i.map(un).concat({type:t,attrs:n}).concat(a.map(un)):null}function un(e){return{type:e,attrs:null}}function dn(e,t){let{parent:n,startIndex:r,endIndex:i}=e,a=n.contentMatchAt(r).findWrapping(t);if(!a)return null;let o=a.length?a[0]:t;return n.canReplaceWith(r,i,o)?a:null}function fn(e,t){let{parent:n,startIndex:r,endIndex:i}=e,a=n.child(r),o=t.contentMatch.findWrapping(a.type);if(!o)return null;let s=(o.length?o[o.length-1]:t).contentMatch;for(let e=r;s&&e<i;e++)s=s.matchType(n.child(e).type);return!s||!s.validEnd?null:o}function pn(e,t,n){let r=x.empty;for(let e=n.length-1;e>=0;e--){if(r.size){let t=n[e].type.contentMatch.matchFragment(r);if(!t||!t.validEnd)throw RangeError(`Wrapper type given to Transform.wrap does not form valid content of its parent wrapper`)}r=x.from(n[e].type.create(n[e].attrs,r))}let i=t.start,a=t.end;e.step(new E(i,a,i,a,new C(r,0,0),n.length,!0))}function mn(e,t,n,r,i){if(!r.isTextblock)throw RangeError(`Type given to setBlockType should be a textblock`);let a=e.steps.length;e.doc.nodesBetween(t,n,(t,n)=>{let o=typeof i==`function`?i(t):i;if(t.isTextblock&&!t.hasMarkup(r,o)&&_n(e.doc,e.mapping.slice(a).map(n),r)){let i=null;if(r.schema.linebreakReplacement){let e=r.whitespace==`pre`,t=!!r.contentMatch.matchType(r.schema.linebreakReplacement);e&&!t?i=!1:!e&&t&&(i=!0)}i===!1&&gn(e,t,n,a),an(e,e.mapping.slice(a).map(n,1),r,void 0,i===null);let s=e.mapping.slice(a),c=s.map(n,1),l=s.map(n+t.nodeSize,1);return e.step(new E(c,l,c+1,l-1,new C(x.from(r.create(o,null,t.marks)),0,0),1,!0)),i===!0&&hn(e,t,n,a),!1}})}function hn(e,t,n,r){t.forEach((i,a)=>{if(i.isText){let o,s=/\r?\n|\r/g;for(;o=s.exec(i.text);){let i=e.mapping.slice(r).map(n+1+a+o.index);e.replaceWith(i,i+1,t.type.schema.linebreakReplacement.create())}}})}function gn(e,t,n,r){t.forEach((i,a)=>{if(i.type==i.type.schema.linebreakReplacement){let i=e.mapping.slice(r).map(n+1+a);e.replaceWith(i,i+1,t.type.schema.text(`
@@ -1,4 +1,4 @@
1
- import{i as e,t}from"./jsx-runtime-DUAcabCT.js";import{t as n}from"./react-DbyrFoBd.js";import{n as r}from"./dist-BL2bKHuR.js";import{t as i}from"./utils-DKOQrNEG.js";import{t as a}from"./createLucideIcon-C0O-yxZG.js";import{X as o,Z as s}from"./breadcrumb-kPG_yvD8.js";import{D as c,E as l,T as u,c as d,d as f,f as p,l as m,s as h,u as g}from"./utils-DkCVtsc2.js";import{t as ee}from"./use-label-CykSHq9A.js";import{t as te}from"./skeleton-BnBM1862.js";import{Pt as _}from"./index-kTp--tHG.js";import{t as v}from"./input-xYuLUQID.js";var y=a(`chevron-left`,[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]),b=e(n(),1);function x(e,t){return typeof e==`function`?e(t):e}function S(e,t){return n=>{t.setState(t=>({...t,[e]:x(n,t[e])}))}}function C(e){return e instanceof Function}function ne(e){return Array.isArray(e)&&e.every(e=>typeof e==`number`)}function re(e,t){let n=[],r=e=>{e.forEach(e=>{n.push(e);let i=t(e);i!=null&&i.length&&r(i)})};return r(e),n}function w(e,t,n){let r=[],i;return a=>{let o;n.key&&n.debug&&(o=Date.now());let s=e(a);if(!(s.length!==r.length||s.some((e,t)=>r[t]!==e)))return i;r=s;let c;if(n.key&&n.debug&&(c=Date.now()),i=t(...s),n==null||n.onChange==null||n.onChange(i),n.key&&n.debug&&n!=null&&n.debug()){let e=Math.round((Date.now()-o)*100)/100,t=Math.round((Date.now()-c)*100)/100,r=t/16,i=(e,t)=>{for(e=String(e);e.length<t;)e=` `+e;return e};console.info(`%c⏱ ${i(t,5)} /${i(e,5)} ms`,`
1
+ import{i as e,t}from"./jsx-runtime-DUAcabCT.js";import{t as n}from"./react-DbyrFoBd.js";import{n as r}from"./dist-BL2bKHuR.js";import{t as i}from"./utils-DKOQrNEG.js";import{t as a}from"./createLucideIcon-C0O-yxZG.js";import{X as o,Z as s}from"./breadcrumb-B-sB8a4_.js";import{D as c,E as l,T as u,c as d,d as f,f as p,l as m,s as h,u as g}from"./utils-ByiwTMhM.js";import{t as ee}from"./use-label-CykSHq9A.js";import{t as te}from"./skeleton-BnBM1862.js";import{Pt as _}from"./index-Ctqj4aiM.js";import{t as v}from"./input-xYuLUQID.js";var y=a(`chevron-left`,[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]),b=e(n(),1);function x(e,t){return typeof e==`function`?e(t):e}function S(e,t){return n=>{t.setState(t=>({...t,[e]:x(n,t[e])}))}}function C(e){return e instanceof Function}function ne(e){return Array.isArray(e)&&e.every(e=>typeof e==`number`)}function re(e,t){let n=[],r=e=>{e.forEach(e=>{n.push(e);let i=t(e);i!=null&&i.length&&r(i)})};return r(e),n}function w(e,t,n){let r=[],i;return a=>{let o;n.key&&n.debug&&(o=Date.now());let s=e(a);if(!(s.length!==r.length||s.some((e,t)=>r[t]!==e)))return i;r=s;let c;if(n.key&&n.debug&&(c=Date.now()),i=t(...s),n==null||n.onChange==null||n.onChange(i),n.key&&n.debug&&n!=null&&n.debug()){let e=Math.round((Date.now()-o)*100)/100,t=Math.round((Date.now()-c)*100)/100,r=t/16,i=(e,t)=>{for(e=String(e);e.length<t;)e=` `+e;return e};console.info(`%c⏱ ${i(t,5)} /${i(e,5)} ms`,`
2
2
  font-size: .6rem;
3
3
  font-weight: bold;
4
4
  color: hsl(${Math.max(0,Math.min(120-120*r,120))}deg 100% 31%);`,n?.key)}return i}}function T(e,t,n,r){return{debug:()=>e?.debugAll??e[t],key:!1,onChange:r}}function ie(e,t,n,r){let i={id:`${t.id}_${n.id}`,row:t,column:n,getValue:()=>t.getValue(r),renderValue:()=>i.getValue()??e.options.renderFallbackValue,getContext:w(()=>[e,n,t,i],(e,t,n,r)=>({table:e,column:t,row:n,cell:r,getValue:r.getValue,renderValue:r.renderValue}),T(e.options,`debugCells`,`cell.getContext`))};return e._features.forEach(r=>{r.createCell==null||r.createCell(i,n,t,e)},{}),i}function ae(e,t,n,r){let i={...e._getDefaultColumnDef(),...t},a=i.accessorKey,o=i.id??(a?typeof String.prototype.replaceAll==`function`?a.replaceAll(`.`,`_`):a.replace(/\./g,`_`):void 0)??(typeof i.header==`string`?i.header:void 0),s;if(i.accessorFn?s=i.accessorFn:a&&(s=a.includes(`.`)?e=>{let t=e;for(let e of a.split(`.`))t=t?.[e];return t}:e=>e[i.accessorKey]),!o)throw Error();let c={id:`${String(o)}`,accessorFn:s,parent:r,depth:n,columnDef:i,columns:[],getFlatColumns:w(()=>[!0],()=>[c,...c.columns?.flatMap(e=>e.getFlatColumns())],T(e.options,`debugColumns`,`column.getFlatColumns`)),getLeafColumns:w(()=>[e._getOrderColumnsFn()],e=>{var t;return(t=c.columns)!=null&&t.length?e(c.columns.flatMap(e=>e.getLeafColumns())):[c]},T(e.options,`debugColumns`,`column.getLeafColumns`))};for(let t of e._features)t.createColumn==null||t.createColumn(c,e);return c}var E=`debugHeaders`;function oe(e,t,n){let r={id:n.id??t.id,column:t,index:n.index,isPlaceholder:!!n.isPlaceholder,placeholderId:n.placeholderId,depth:n.depth,subHeaders:[],colSpan:0,rowSpan:0,headerGroup:null,getLeafHeaders:()=>{let e=[],t=n=>{n.subHeaders&&n.subHeaders.length&&n.subHeaders.map(t),e.push(n)};return t(r),e},getContext:()=>({table:e,header:r,column:t})};return e._features.forEach(t=>{t.createHeader==null||t.createHeader(r,e)}),r}var se={createTable:e=>{e.getHeaderGroups=w(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(t,n,r,i)=>{let a=r?.map(e=>n.find(t=>t.id===e)).filter(Boolean)??[],o=i?.map(e=>n.find(t=>t.id===e)).filter(Boolean)??[],s=n.filter(e=>!(r!=null&&r.includes(e.id))&&!(i!=null&&i.includes(e.id)));return D(t,[...a,...s,...o],e)},T(e.options,E,`getHeaderGroups`)),e.getCenterHeaderGroups=w(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(t,n,r,i)=>(n=n.filter(e=>!(r!=null&&r.includes(e.id))&&!(i!=null&&i.includes(e.id))),D(t,n,e,`center`)),T(e.options,E,`getCenterHeaderGroups`)),e.getLeftHeaderGroups=w(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left],(t,n,r)=>D(t,r?.map(e=>n.find(t=>t.id===e)).filter(Boolean)??[],e,`left`),T(e.options,E,`getLeftHeaderGroups`)),e.getRightHeaderGroups=w(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.right],(t,n,r)=>D(t,r?.map(e=>n.find(t=>t.id===e)).filter(Boolean)??[],e,`right`),T(e.options,E,`getRightHeaderGroups`)),e.getFooterGroups=w(()=>[e.getHeaderGroups()],e=>[...e].reverse(),T(e.options,E,`getFooterGroups`)),e.getLeftFooterGroups=w(()=>[e.getLeftHeaderGroups()],e=>[...e].reverse(),T(e.options,E,`getLeftFooterGroups`)),e.getCenterFooterGroups=w(()=>[e.getCenterHeaderGroups()],e=>[...e].reverse(),T(e.options,E,`getCenterFooterGroups`)),e.getRightFooterGroups=w(()=>[e.getRightHeaderGroups()],e=>[...e].reverse(),T(e.options,E,`getRightFooterGroups`)),e.getFlatHeaders=w(()=>[e.getHeaderGroups()],e=>e.map(e=>e.headers).flat(),T(e.options,E,`getFlatHeaders`)),e.getLeftFlatHeaders=w(()=>[e.getLeftHeaderGroups()],e=>e.map(e=>e.headers).flat(),T(e.options,E,`getLeftFlatHeaders`)),e.getCenterFlatHeaders=w(()=>[e.getCenterHeaderGroups()],e=>e.map(e=>e.headers).flat(),T(e.options,E,`getCenterFlatHeaders`)),e.getRightFlatHeaders=w(()=>[e.getRightHeaderGroups()],e=>e.map(e=>e.headers).flat(),T(e.options,E,`getRightFlatHeaders`)),e.getCenterLeafHeaders=w(()=>[e.getCenterFlatHeaders()],e=>e.filter(e=>{var t;return!((t=e.subHeaders)!=null&&t.length)}),T(e.options,E,`getCenterLeafHeaders`)),e.getLeftLeafHeaders=w(()=>[e.getLeftFlatHeaders()],e=>e.filter(e=>{var t;return!((t=e.subHeaders)!=null&&t.length)}),T(e.options,E,`getLeftLeafHeaders`)),e.getRightLeafHeaders=w(()=>[e.getRightFlatHeaders()],e=>e.filter(e=>{var t;return!((t=e.subHeaders)!=null&&t.length)}),T(e.options,E,`getRightLeafHeaders`)),e.getLeafHeaders=w(()=>[e.getLeftHeaderGroups(),e.getCenterHeaderGroups(),e.getRightHeaderGroups()],(e,t,n)=>[...e[0]?.headers??[],...t[0]?.headers??[],...n[0]?.headers??[]].map(e=>e.getLeafHeaders()).flat(),T(e.options,E,`getLeafHeaders`))}};function D(e,t,n,r){let i=0,a=function(e,t){t===void 0&&(t=1),i=Math.max(i,t),e.filter(e=>e.getIsVisible()).forEach(e=>{var n;(n=e.columns)!=null&&n.length&&a(e.columns,t+1)},0)};a(e);let o=[],s=(e,t)=>{let i={depth:t,id:[r,`${t}`].filter(Boolean).join(`_`),headers:[]},a=[];e.forEach(e=>{let o=[...a].reverse()[0],s=e.column.depth===i.depth,c,l=!1;if(s&&e.column.parent?c=e.column.parent:(c=e.column,l=!0),o&&o?.column===c)o.subHeaders.push(e);else{let i=oe(n,c,{id:[r,t,c.id,e?.id].filter(Boolean).join(`_`),isPlaceholder:l,placeholderId:l?`${a.filter(e=>e.column===c).length}`:void 0,depth:t,index:a.length});i.subHeaders.push(e),a.push(i)}i.headers.push(e),e.headerGroup=i}),o.push(i),t>0&&s(a,t-1)};s(t.map((e,t)=>oe(n,e,{depth:i,index:t})),i-1),o.reverse();let c=e=>e.filter(e=>e.column.getIsVisible()).map(e=>{let t=0,n=0,r=[0];e.subHeaders&&e.subHeaders.length?(r=[],c(e.subHeaders).forEach(e=>{let{colSpan:n,rowSpan:i}=e;t+=n,r.push(i)})):t=1;let i=Math.min(...r);return n+=i,e.colSpan=t,e.rowSpan=n,{colSpan:t,rowSpan:n}});return c(o[0]?.headers??[]),o}var ce=(e,t,n,r,i,a,o)=>{let s={id:t,index:r,original:n,depth:i,parentId:o,_valuesCache:{},_uniqueValuesCache:{},getValue:t=>{if(s._valuesCache.hasOwnProperty(t))return s._valuesCache[t];let n=e.getColumn(t);if(n!=null&&n.accessorFn)return s._valuesCache[t]=n.accessorFn(s.original,r),s._valuesCache[t]},getUniqueValues:t=>{if(s._uniqueValuesCache.hasOwnProperty(t))return s._uniqueValuesCache[t];let n=e.getColumn(t);if(n!=null&&n.accessorFn)return n.columnDef.getUniqueValues?(s._uniqueValuesCache[t]=n.columnDef.getUniqueValues(s.original,r),s._uniqueValuesCache[t]):(s._uniqueValuesCache[t]=[s.getValue(t)],s._uniqueValuesCache[t])},renderValue:t=>s.getValue(t)??e.options.renderFallbackValue,subRows:a??[],getLeafRows:()=>re(s.subRows,e=>e.subRows),getParentRow:()=>s.parentId?e.getRow(s.parentId,!0):void 0,getParentRows:()=>{let e=[],t=s;for(;;){let n=t.getParentRow();if(!n)break;e.push(n),t=n}return e.reverse()},getAllCells:w(()=>[e.getAllLeafColumns()],t=>t.map(t=>ie(e,s,t,t.id)),T(e.options,`debugRows`,`getAllCells`)),_getAllCellsByColumnId:w(()=>[s.getAllCells()],e=>e.reduce((e,t)=>(e[t.column.id]=t,e),{}),T(e.options,`debugRows`,`getAllCellsByColumnId`))};for(let t=0;t<e._features.length;t++){let n=e._features[t];n==null||n.createRow==null||n.createRow(s,e)}return s},le={createColumn:(e,t)=>{e._getFacetedRowModel=t.options.getFacetedRowModel&&t.options.getFacetedRowModel(t,e.id),e.getFacetedRowModel=()=>e._getFacetedRowModel?e._getFacetedRowModel():t.getPreFilteredRowModel(),e._getFacetedUniqueValues=t.options.getFacetedUniqueValues&&t.options.getFacetedUniqueValues(t,e.id),e.getFacetedUniqueValues=()=>e._getFacetedUniqueValues?e._getFacetedUniqueValues():new Map,e._getFacetedMinMaxValues=t.options.getFacetedMinMaxValues&&t.options.getFacetedMinMaxValues(t,e.id),e.getFacetedMinMaxValues=()=>{if(e._getFacetedMinMaxValues)return e._getFacetedMinMaxValues()}}},O=(e,t,n)=>{var r,i;let a=n==null||(r=n.toString())==null?void 0:r.toLowerCase();return!!(!((i=e.getValue(t))==null||(i=i.toString())==null||(i=i.toLowerCase())==null)&&i.includes(a))};O.autoRemove=e=>N(e);var ue=(e,t,n)=>{var r;return!!(!((r=e.getValue(t))==null||(r=r.toString())==null)&&r.includes(n))};ue.autoRemove=e=>N(e);var de=(e,t,n)=>{var r;return((r=e.getValue(t))==null||(r=r.toString())==null?void 0:r.toLowerCase())===n?.toLowerCase()};de.autoRemove=e=>N(e);var fe=(e,t,n)=>e.getValue(t)?.includes(n);fe.autoRemove=e=>N(e);var k=(e,t,n)=>!n.some(n=>{var r;return!((r=e.getValue(t))!=null&&r.includes(n))});k.autoRemove=e=>N(e)||!(e!=null&&e.length);var A=(e,t,n)=>n.some(n=>e.getValue(t)?.includes(n));A.autoRemove=e=>N(e)||!(e!=null&&e.length);var pe=(e,t,n)=>e.getValue(t)===n;pe.autoRemove=e=>N(e);var me=(e,t,n)=>e.getValue(t)==n;me.autoRemove=e=>N(e);var j=(e,t,n)=>{let[r,i]=n,a=e.getValue(t);return a>=r&&a<=i};j.resolveFilterValue=e=>{let[t,n]=e,r=typeof t==`number`?t:parseFloat(t),i=typeof n==`number`?n:parseFloat(n),a=t===null||Number.isNaN(r)?-1/0:r,o=n===null||Number.isNaN(i)?1/0:i;if(a>o){let e=a;a=o,o=e}return[a,o]},j.autoRemove=e=>N(e)||N(e[0])&&N(e[1]);var M={includesString:O,includesStringSensitive:ue,equalsString:de,arrIncludes:fe,arrIncludesAll:k,arrIncludesSome:A,equals:pe,weakEquals:me,inNumberRange:j};function N(e){return e==null||e===``}var he={getDefaultColumnDef:()=>({filterFn:`auto`}),getInitialState:e=>({columnFilters:[],...e}),getDefaultOptions:e=>({onColumnFiltersChange:S(`columnFilters`,e),filterFromLeafRows:!1,maxLeafRowFilterDepth:100}),createColumn:(e,t)=>{e.getAutoFilterFn=()=>{let n=t.getCoreRowModel().flatRows[0]?.getValue(e.id);return typeof n==`string`?M.includesString:typeof n==`number`?M.inNumberRange:typeof n==`boolean`||typeof n==`object`&&n?M.equals:Array.isArray(n)?M.arrIncludes:M.weakEquals},e.getFilterFn=()=>C(e.columnDef.filterFn)?e.columnDef.filterFn:e.columnDef.filterFn===`auto`?e.getAutoFilterFn():t.options.filterFns?.[e.columnDef.filterFn]??M[e.columnDef.filterFn],e.getCanFilter=()=>(e.columnDef.enableColumnFilter??!0)&&(t.options.enableColumnFilters??!0)&&(t.options.enableFilters??!0)&&!!e.accessorFn,e.getIsFiltered=()=>e.getFilterIndex()>-1,e.getFilterValue=()=>{var n;return(n=t.getState().columnFilters)==null||(n=n.find(t=>t.id===e.id))==null?void 0:n.value},e.getFilterIndex=()=>t.getState().columnFilters?.findIndex(t=>t.id===e.id)??-1,e.setFilterValue=n=>{t.setColumnFilters(t=>{let r=e.getFilterFn(),i=t?.find(t=>t.id===e.id),a=x(n,i?i.value:void 0);if(ge(r,a,e))return t?.filter(t=>t.id!==e.id)??[];let o={id:e.id,value:a};return i?t?.map(t=>t.id===e.id?o:t)??[]:t!=null&&t.length?[...t,o]:[o]})}},createRow:(e,t)=>{e.columnFilters={},e.columnFiltersMeta={}},createTable:e=>{e.setColumnFilters=t=>{let n=e.getAllLeafColumns();e.options.onColumnFiltersChange==null||e.options.onColumnFiltersChange(e=>x(t,e)?.filter(e=>{let t=n.find(t=>t.id===e.id);return!(t&&ge(t.getFilterFn(),e.value,t))}))},e.resetColumnFilters=t=>{e.setColumnFilters(t?[]:e.initialState?.columnFilters??[])},e.getPreFilteredRowModel=()=>e.getCoreRowModel(),e.getFilteredRowModel=()=>(!e._getFilteredRowModel&&e.options.getFilteredRowModel&&(e._getFilteredRowModel=e.options.getFilteredRowModel(e)),e.options.manualFiltering||!e._getFilteredRowModel?e.getPreFilteredRowModel():e._getFilteredRowModel())}};function ge(e,t,n){return(e&&e.autoRemove?e.autoRemove(t,n):!1)||t===void 0||typeof t==`string`&&!t}var P={sum:(e,t,n)=>n.reduce((t,n)=>{let r=n.getValue(e);return t+(typeof r==`number`?r:0)},0),min:(e,t,n)=>{let r;return n.forEach(t=>{let n=t.getValue(e);n!=null&&(r>n||r===void 0&&n>=n)&&(r=n)}),r},max:(e,t,n)=>{let r;return n.forEach(t=>{let n=t.getValue(e);n!=null&&(r<n||r===void 0&&n>=n)&&(r=n)}),r},extent:(e,t,n)=>{let r,i;return n.forEach(t=>{let n=t.getValue(e);n!=null&&(r===void 0?n>=n&&(r=i=n):(r>n&&(r=n),i<n&&(i=n)))}),[r,i]},mean:(e,t)=>{let n=0,r=0;if(t.forEach(t=>{let i=t.getValue(e);i!=null&&(i=+i)>=i&&(++n,r+=i)}),n)return r/n},median:(e,t)=>{if(!t.length)return;let n=t.map(t=>t.getValue(e));if(!ne(n))return;if(n.length===1)return n[0];let r=Math.floor(n.length/2),i=n.sort((e,t)=>e-t);return n.length%2==0?(i[r-1]+i[r])/2:i[r]},unique:(e,t)=>Array.from(new Set(t.map(t=>t.getValue(e))).values()),uniqueCount:(e,t)=>new Set(t.map(t=>t.getValue(e))).size,count:(e,t)=>t.length},_e={getDefaultColumnDef:()=>({aggregatedCell:e=>{var t;return((t=e.getValue())==null||t.toString==null?void 0:t.toString())??null},aggregationFn:`auto`}),getInitialState:e=>({grouping:[],...e}),getDefaultOptions:e=>({onGroupingChange:S(`grouping`,e),groupedColumnMode:`reorder`}),createColumn:(e,t)=>{e.toggleGrouping=()=>{t.setGrouping(t=>t!=null&&t.includes(e.id)?t.filter(t=>t!==e.id):[...t??[],e.id])},e.getCanGroup=()=>(e.columnDef.enableGrouping??!0)&&(t.options.enableGrouping??!0)&&(!!e.accessorFn||!!e.columnDef.getGroupingValue),e.getIsGrouped=()=>t.getState().grouping?.includes(e.id),e.getGroupedIndex=()=>t.getState().grouping?.indexOf(e.id),e.getToggleGroupingHandler=()=>{let t=e.getCanGroup();return()=>{t&&e.toggleGrouping()}},e.getAutoAggregationFn=()=>{let n=t.getCoreRowModel().flatRows[0]?.getValue(e.id);if(typeof n==`number`)return P.sum;if(Object.prototype.toString.call(n)===`[object Date]`)return P.extent},e.getAggregationFn=()=>{if(!e)throw Error();return C(e.columnDef.aggregationFn)?e.columnDef.aggregationFn:e.columnDef.aggregationFn===`auto`?e.getAutoAggregationFn():t.options.aggregationFns?.[e.columnDef.aggregationFn]??P[e.columnDef.aggregationFn]}},createTable:e=>{e.setGrouping=t=>e.options.onGroupingChange==null?void 0:e.options.onGroupingChange(t),e.resetGrouping=t=>{e.setGrouping(t?[]:e.initialState?.grouping??[])},e.getPreGroupedRowModel=()=>e.getFilteredRowModel(),e.getGroupedRowModel=()=>(!e._getGroupedRowModel&&e.options.getGroupedRowModel&&(e._getGroupedRowModel=e.options.getGroupedRowModel(e)),e.options.manualGrouping||!e._getGroupedRowModel?e.getPreGroupedRowModel():e._getGroupedRowModel())},createRow:(e,t)=>{e.getIsGrouped=()=>!!e.groupingColumnId,e.getGroupingValue=n=>{if(e._groupingValuesCache.hasOwnProperty(n))return e._groupingValuesCache[n];let r=t.getColumn(n);return r!=null&&r.columnDef.getGroupingValue?(e._groupingValuesCache[n]=r.columnDef.getGroupingValue(e.original),e._groupingValuesCache[n]):e.getValue(n)},e._groupingValuesCache={}},createCell:(e,t,n,r)=>{e.getIsGrouped=()=>t.getIsGrouped()&&t.id===n.groupingColumnId,e.getIsPlaceholder=()=>!e.getIsGrouped()&&t.getIsGrouped(),e.getIsAggregated=()=>{var t;return!e.getIsGrouped()&&!e.getIsPlaceholder()&&!!((t=n.subRows)!=null&&t.length)}}};function ve(e,t,n){if(!(t!=null&&t.length)||!n)return e;let r=e.filter(e=>!t.includes(e.id));return n===`remove`?r:[...t.map(t=>e.find(e=>e.id===t)).filter(Boolean),...r]}var ye={getInitialState:e=>({columnOrder:[],...e}),getDefaultOptions:e=>({onColumnOrderChange:S(`columnOrder`,e)}),createColumn:(e,t)=>{e.getIndex=w(e=>[B(t,e)],t=>t.findIndex(t=>t.id===e.id),T(t.options,`debugColumns`,`getIndex`)),e.getIsFirstColumn=n=>B(t,n)[0]?.id===e.id,e.getIsLastColumn=n=>{let r=B(t,n);return r[r.length-1]?.id===e.id}},createTable:e=>{e.setColumnOrder=t=>e.options.onColumnOrderChange==null?void 0:e.options.onColumnOrderChange(t),e.resetColumnOrder=t=>{e.setColumnOrder(t?[]:e.initialState.columnOrder??[])},e._getOrderColumnsFn=w(()=>[e.getState().columnOrder,e.getState().grouping,e.options.groupedColumnMode],(e,t,n)=>r=>{let i=[];if(!(e!=null&&e.length))i=r;else{let t=[...e],n=[...r];for(;n.length&&t.length;){let e=t.shift(),r=n.findIndex(t=>t.id===e);r>-1&&i.push(n.splice(r,1)[0])}i=[...i,...n]}return ve(i,t,n)},T(e.options,`debugTable`,`_getOrderColumnsFn`))}},F=()=>({left:[],right:[]}),be={getInitialState:e=>({columnPinning:F(),...e}),getDefaultOptions:e=>({onColumnPinningChange:S(`columnPinning`,e)}),createColumn:(e,t)=>{e.pin=n=>{let r=e.getLeafColumns().map(e=>e.id).filter(Boolean);t.setColumnPinning(e=>n===`right`?{left:(e?.left??[]).filter(e=>!(r!=null&&r.includes(e))),right:[...(e?.right??[]).filter(e=>!(r!=null&&r.includes(e))),...r]}:n===`left`?{left:[...(e?.left??[]).filter(e=>!(r!=null&&r.includes(e))),...r],right:(e?.right??[]).filter(e=>!(r!=null&&r.includes(e)))}:{left:(e?.left??[]).filter(e=>!(r!=null&&r.includes(e))),right:(e?.right??[]).filter(e=>!(r!=null&&r.includes(e)))})},e.getCanPin=()=>e.getLeafColumns().some(e=>(e.columnDef.enablePinning??!0)&&(t.options.enableColumnPinning??t.options.enablePinning??!0)),e.getIsPinned=()=>{let n=e.getLeafColumns().map(e=>e.id),{left:r,right:i}=t.getState().columnPinning,a=n.some(e=>r?.includes(e)),o=n.some(e=>i?.includes(e));return a?`left`:o?`right`:!1},e.getPinnedIndex=()=>{var n;let r=e.getIsPinned();return r?((n=t.getState().columnPinning)==null||(n=n[r])==null?void 0:n.indexOf(e.id))??-1:0}},createRow:(e,t)=>{e.getCenterVisibleCells=w(()=>[e._getAllVisibleCells(),t.getState().columnPinning.left,t.getState().columnPinning.right],(e,t,n)=>{let r=[...t??[],...n??[]];return e.filter(e=>!r.includes(e.column.id))},T(t.options,`debugRows`,`getCenterVisibleCells`)),e.getLeftVisibleCells=w(()=>[e._getAllVisibleCells(),t.getState().columnPinning.left],(e,t)=>(t??[]).map(t=>e.find(e=>e.column.id===t)).filter(Boolean).map(e=>({...e,position:`left`})),T(t.options,`debugRows`,`getLeftVisibleCells`)),e.getRightVisibleCells=w(()=>[e._getAllVisibleCells(),t.getState().columnPinning.right],(e,t)=>(t??[]).map(t=>e.find(e=>e.column.id===t)).filter(Boolean).map(e=>({...e,position:`right`})),T(t.options,`debugRows`,`getRightVisibleCells`))},createTable:e=>{e.setColumnPinning=t=>e.options.onColumnPinningChange==null?void 0:e.options.onColumnPinningChange(t),e.resetColumnPinning=t=>e.setColumnPinning(t?F():e.initialState?.columnPinning??F()),e.getIsSomeColumnsPinned=t=>{let n=e.getState().columnPinning;return t?!!n[t]?.length:!!(n.left?.length||n.right?.length)},e.getLeftLeafColumns=w(()=>[e.getAllLeafColumns(),e.getState().columnPinning.left],(e,t)=>(t??[]).map(t=>e.find(e=>e.id===t)).filter(Boolean),T(e.options,`debugColumns`,`getLeftLeafColumns`)),e.getRightLeafColumns=w(()=>[e.getAllLeafColumns(),e.getState().columnPinning.right],(e,t)=>(t??[]).map(t=>e.find(e=>e.id===t)).filter(Boolean),T(e.options,`debugColumns`,`getRightLeafColumns`)),e.getCenterLeafColumns=w(()=>[e.getAllLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(e,t,n)=>{let r=[...t??[],...n??[]];return e.filter(e=>!r.includes(e.id))},T(e.options,`debugColumns`,`getCenterLeafColumns`))}};function xe(e){return e||(typeof document<`u`?document:null)}var I={size:150,minSize:20,maxSize:2**53-1},L=()=>({startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,isResizingColumn:!1,columnSizingStart:[]}),Se={getDefaultColumnDef:()=>I,getInitialState:e=>({columnSizing:{},columnSizingInfo:L(),...e}),getDefaultOptions:e=>({columnResizeMode:`onEnd`,columnResizeDirection:`ltr`,onColumnSizingChange:S(`columnSizing`,e),onColumnSizingInfoChange:S(`columnSizingInfo`,e)}),createColumn:(e,t)=>{e.getSize=()=>{let n=t.getState().columnSizing[e.id];return Math.min(Math.max(e.columnDef.minSize??I.minSize,n??e.columnDef.size??I.size),e.columnDef.maxSize??I.maxSize)},e.getStart=w(e=>[e,B(t,e),t.getState().columnSizing],(t,n)=>n.slice(0,e.getIndex(t)).reduce((e,t)=>e+t.getSize(),0),T(t.options,`debugColumns`,`getStart`)),e.getAfter=w(e=>[e,B(t,e),t.getState().columnSizing],(t,n)=>n.slice(e.getIndex(t)+1).reduce((e,t)=>e+t.getSize(),0),T(t.options,`debugColumns`,`getAfter`)),e.resetSize=()=>{t.setColumnSizing(t=>{let{[e.id]:n,...r}=t;return r})},e.getCanResize=()=>(e.columnDef.enableResizing??!0)&&(t.options.enableColumnResizing??!0),e.getIsResizing=()=>t.getState().columnSizingInfo.isResizingColumn===e.id},createHeader:(e,t)=>{e.getSize=()=>{let t=0,n=e=>{e.subHeaders.length?e.subHeaders.forEach(n):t+=e.column.getSize()??0};return n(e),t},e.getStart=()=>{if(e.index>0){let t=e.headerGroup.headers[e.index-1];return t.getStart()+t.getSize()}return 0},e.getResizeHandler=n=>{let r=t.getColumn(e.column.id),i=r?.getCanResize();return a=>{if(!r||!i||(a.persist==null||a.persist(),z(a)&&a.touches&&a.touches.length>1))return;let o=e.getSize(),s=e?e.getLeafHeaders().map(e=>[e.column.id,e.column.getSize()]):[[r.id,r.getSize()]],c=z(a)?Math.round(a.touches[0].clientX):a.clientX,l={},u=(e,n)=>{typeof n==`number`&&(t.setColumnSizingInfo(e=>{let r=t.options.columnResizeDirection===`rtl`?-1:1,i=(n-(e?.startOffset??0))*r,a=Math.max(i/(e?.startSize??0),-.999999);return e.columnSizingStart.forEach(e=>{let[t,n]=e;l[t]=Math.round(Math.max(n+n*a,0)*100)/100}),{...e,deltaOffset:i,deltaPercentage:a}}),(t.options.columnResizeMode===`onChange`||e===`end`)&&t.setColumnSizing(e=>({...e,...l})))},d=e=>u(`move`,e),f=e=>{u(`end`,e),t.setColumnSizingInfo(e=>({...e,isResizingColumn:!1,startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,columnSizingStart:[]}))},p=xe(n),m={moveHandler:e=>d(e.clientX),upHandler:e=>{p?.removeEventListener(`mousemove`,m.moveHandler),p?.removeEventListener(`mouseup`,m.upHandler),f(e.clientX)}},h={moveHandler:e=>(e.cancelable&&(e.preventDefault(),e.stopPropagation()),d(e.touches[0].clientX),!1),upHandler:e=>{p?.removeEventListener(`touchmove`,h.moveHandler),p?.removeEventListener(`touchend`,h.upHandler),e.cancelable&&(e.preventDefault(),e.stopPropagation()),f(e.touches[0]?.clientX)}},g=Ce()?{passive:!1}:!1;z(a)?(p?.addEventListener(`touchmove`,h.moveHandler,g),p?.addEventListener(`touchend`,h.upHandler,g)):(p?.addEventListener(`mousemove`,m.moveHandler,g),p?.addEventListener(`mouseup`,m.upHandler,g)),t.setColumnSizingInfo(e=>({...e,startOffset:c,startSize:o,deltaOffset:0,deltaPercentage:0,columnSizingStart:s,isResizingColumn:r.id}))}}},createTable:e=>{e.setColumnSizing=t=>e.options.onColumnSizingChange==null?void 0:e.options.onColumnSizingChange(t),e.setColumnSizingInfo=t=>e.options.onColumnSizingInfoChange==null?void 0:e.options.onColumnSizingInfoChange(t),e.resetColumnSizing=t=>{e.setColumnSizing(t?{}:e.initialState.columnSizing??{})},e.resetHeaderSizeInfo=t=>{e.setColumnSizingInfo(t?L():e.initialState.columnSizingInfo??L())},e.getTotalSize=()=>e.getHeaderGroups()[0]?.headers.reduce((e,t)=>e+t.getSize(),0)??0,e.getLeftTotalSize=()=>e.getLeftHeaderGroups()[0]?.headers.reduce((e,t)=>e+t.getSize(),0)??0,e.getCenterTotalSize=()=>e.getCenterHeaderGroups()[0]?.headers.reduce((e,t)=>e+t.getSize(),0)??0,e.getRightTotalSize=()=>e.getRightHeaderGroups()[0]?.headers.reduce((e,t)=>e+t.getSize(),0)??0}},R=null;function Ce(){if(typeof R==`boolean`)return R;let e=!1;try{let t={get passive(){return e=!0,!1}},n=()=>{};window.addEventListener(`test`,n,t),window.removeEventListener(`test`,n)}catch{e=!1}return R=e,R}function z(e){return e.type===`touchstart`}var we={getInitialState:e=>({columnVisibility:{},...e}),getDefaultOptions:e=>({onColumnVisibilityChange:S(`columnVisibility`,e)}),createColumn:(e,t)=>{e.toggleVisibility=n=>{e.getCanHide()&&t.setColumnVisibility(t=>({...t,[e.id]:n??!e.getIsVisible()}))},e.getIsVisible=()=>{let n=e.columns;return(n.length?n.some(e=>e.getIsVisible()):t.getState().columnVisibility?.[e.id])??!0},e.getCanHide=()=>(e.columnDef.enableHiding??!0)&&(t.options.enableHiding??!0),e.getToggleVisibilityHandler=()=>t=>{e.toggleVisibility==null||e.toggleVisibility(t.target.checked)}},createRow:(e,t)=>{e._getAllVisibleCells=w(()=>[e.getAllCells(),t.getState().columnVisibility],e=>e.filter(e=>e.column.getIsVisible()),T(t.options,`debugRows`,`_getAllVisibleCells`)),e.getVisibleCells=w(()=>[e.getLeftVisibleCells(),e.getCenterVisibleCells(),e.getRightVisibleCells()],(e,t,n)=>[...e,...t,...n],T(t.options,`debugRows`,`getVisibleCells`))},createTable:e=>{let t=(t,n)=>w(()=>[n(),n().filter(e=>e.getIsVisible()).map(e=>e.id).join(`_`)],e=>e.filter(e=>e.getIsVisible==null?void 0:e.getIsVisible()),T(e.options,`debugColumns`,t));e.getVisibleFlatColumns=t(`getVisibleFlatColumns`,()=>e.getAllFlatColumns()),e.getVisibleLeafColumns=t(`getVisibleLeafColumns`,()=>e.getAllLeafColumns()),e.getLeftVisibleLeafColumns=t(`getLeftVisibleLeafColumns`,()=>e.getLeftLeafColumns()),e.getRightVisibleLeafColumns=t(`getRightVisibleLeafColumns`,()=>e.getRightLeafColumns()),e.getCenterVisibleLeafColumns=t(`getCenterVisibleLeafColumns`,()=>e.getCenterLeafColumns()),e.setColumnVisibility=t=>e.options.onColumnVisibilityChange==null?void 0:e.options.onColumnVisibilityChange(t),e.resetColumnVisibility=t=>{e.setColumnVisibility(t?{}:e.initialState.columnVisibility??{})},e.toggleAllColumnsVisible=t=>{t??=!e.getIsAllColumnsVisible(),e.setColumnVisibility(e.getAllLeafColumns().reduce((e,n)=>({...e,[n.id]:t||!(n.getCanHide!=null&&n.getCanHide())}),{}))},e.getIsAllColumnsVisible=()=>!e.getAllLeafColumns().some(e=>!(e.getIsVisible!=null&&e.getIsVisible())),e.getIsSomeColumnsVisible=()=>e.getAllLeafColumns().some(e=>e.getIsVisible==null?void 0:e.getIsVisible()),e.getToggleAllColumnsVisibilityHandler=()=>t=>{e.toggleAllColumnsVisible(t.target?.checked)}}};function B(e,t){return t?t===`center`?e.getCenterVisibleLeafColumns():t===`left`?e.getLeftVisibleLeafColumns():e.getRightVisibleLeafColumns():e.getVisibleLeafColumns()}var Te={createTable:e=>{e._getGlobalFacetedRowModel=e.options.getFacetedRowModel&&e.options.getFacetedRowModel(e,`__global__`),e.getGlobalFacetedRowModel=()=>e.options.manualFiltering||!e._getGlobalFacetedRowModel?e.getPreFilteredRowModel():e._getGlobalFacetedRowModel(),e._getGlobalFacetedUniqueValues=e.options.getFacetedUniqueValues&&e.options.getFacetedUniqueValues(e,`__global__`),e.getGlobalFacetedUniqueValues=()=>e._getGlobalFacetedUniqueValues?e._getGlobalFacetedUniqueValues():new Map,e._getGlobalFacetedMinMaxValues=e.options.getFacetedMinMaxValues&&e.options.getFacetedMinMaxValues(e,`__global__`),e.getGlobalFacetedMinMaxValues=()=>{if(e._getGlobalFacetedMinMaxValues)return e._getGlobalFacetedMinMaxValues()}}},Ee={getInitialState:e=>({globalFilter:void 0,...e}),getDefaultOptions:e=>({onGlobalFilterChange:S(`globalFilter`,e),globalFilterFn:`auto`,getColumnCanGlobalFilter:t=>{var n;let r=(n=e.getCoreRowModel().flatRows[0])==null||(n=n._getAllCellsByColumnId()[t.id])==null?void 0:n.getValue();return typeof r==`string`||typeof r==`number`}}),createColumn:(e,t)=>{e.getCanGlobalFilter=()=>(e.columnDef.enableGlobalFilter??!0)&&(t.options.enableGlobalFilter??!0)&&(t.options.enableFilters??!0)&&((t.options.getColumnCanGlobalFilter==null?void 0:t.options.getColumnCanGlobalFilter(e))??!0)&&!!e.accessorFn},createTable:e=>{e.getGlobalAutoFilterFn=()=>M.includesString,e.getGlobalFilterFn=()=>{let{globalFilterFn:t}=e.options;return C(t)?t:t===`auto`?e.getGlobalAutoFilterFn():e.options.filterFns?.[t]??M[t]},e.setGlobalFilter=t=>{e.options.onGlobalFilterChange==null||e.options.onGlobalFilterChange(t)},e.resetGlobalFilter=t=>{e.setGlobalFilter(t?void 0:e.initialState.globalFilter)}}},De={getInitialState:e=>({expanded:{},...e}),getDefaultOptions:e=>({onExpandedChange:S(`expanded`,e),paginateExpandedRows:!0}),createTable:e=>{let t=!1,n=!1;e._autoResetExpanded=()=>{if(!t){e._queue(()=>{t=!0});return}if(e.options.autoResetAll??e.options.autoResetExpanded??!e.options.manualExpanding){if(n)return;n=!0,e._queue(()=>{e.resetExpanded(),n=!1})}},e.setExpanded=t=>e.options.onExpandedChange==null?void 0:e.options.onExpandedChange(t),e.toggleAllRowsExpanded=t=>{t??!e.getIsAllRowsExpanded()?e.setExpanded(!0):e.setExpanded({})},e.resetExpanded=t=>{e.setExpanded(t?{}:e.initialState?.expanded??{})},e.getCanSomeRowsExpand=()=>e.getPrePaginationRowModel().flatRows.some(e=>e.getCanExpand()),e.getToggleAllRowsExpandedHandler=()=>t=>{t.persist==null||t.persist(),e.toggleAllRowsExpanded()},e.getIsSomeRowsExpanded=()=>{let t=e.getState().expanded;return t===!0||Object.values(t).some(Boolean)},e.getIsAllRowsExpanded=()=>{let t=e.getState().expanded;return typeof t==`boolean`?t===!0:!(!Object.keys(t).length||e.getRowModel().flatRows.some(e=>!e.getIsExpanded()))},e.getExpandedDepth=()=>{let t=0;return(e.getState().expanded===!0?Object.keys(e.getRowModel().rowsById):Object.keys(e.getState().expanded)).forEach(e=>{let n=e.split(`.`);t=Math.max(t,n.length)}),t},e.getPreExpandedRowModel=()=>e.getSortedRowModel(),e.getExpandedRowModel=()=>(!e._getExpandedRowModel&&e.options.getExpandedRowModel&&(e._getExpandedRowModel=e.options.getExpandedRowModel(e)),e.options.manualExpanding||!e._getExpandedRowModel?e.getPreExpandedRowModel():e._getExpandedRowModel())},createRow:(e,t)=>{e.toggleExpanded=n=>{t.setExpanded(r=>{let i=r===!0?!0:!!(r!=null&&r[e.id]),a={};if(r===!0?Object.keys(t.getRowModel().rowsById).forEach(e=>{a[e]=!0}):a=r,n??=!i,!i&&n)return{...a,[e.id]:!0};if(i&&!n){let{[e.id]:t,...n}=a;return n}return r})},e.getIsExpanded=()=>{let n=t.getState().expanded;return!!((t.options.getIsRowExpanded==null?void 0:t.options.getIsRowExpanded(e))??(n===!0||n?.[e.id]))},e.getCanExpand=()=>{var n;return(t.options.getRowCanExpand==null?void 0:t.options.getRowCanExpand(e))??((t.options.enableExpanding??!0)&&!!((n=e.subRows)!=null&&n.length))},e.getIsAllParentsExpanded=()=>{let n=!0,r=e;for(;n&&r.parentId;)r=t.getRow(r.parentId,!0),n=r.getIsExpanded();return n},e.getToggleExpandedHandler=()=>{let t=e.getCanExpand();return()=>{t&&e.toggleExpanded()}}}},V=0,H=10,U=()=>({pageIndex:V,pageSize:H}),Oe={getInitialState:e=>({...e,pagination:{...U(),...e?.pagination}}),getDefaultOptions:e=>({onPaginationChange:S(`pagination`,e)}),createTable:e=>{let t=!1,n=!1;e._autoResetPageIndex=()=>{if(!t){e._queue(()=>{t=!0});return}if(e.options.autoResetAll??e.options.autoResetPageIndex??!e.options.manualPagination){if(n)return;n=!0,e._queue(()=>{e.resetPageIndex(),n=!1})}},e.setPagination=t=>e.options.onPaginationChange==null?void 0:e.options.onPaginationChange(e=>x(t,e)),e.resetPagination=t=>{e.setPagination(t?U():e.initialState.pagination??U())},e.setPageIndex=t=>{e.setPagination(n=>{let r=x(t,n.pageIndex),i=e.options.pageCount===void 0||e.options.pageCount===-1?2**53-1:e.options.pageCount-1;return r=Math.max(0,Math.min(r,i)),{...n,pageIndex:r}})},e.resetPageIndex=t=>{var n;e.setPageIndex(t?V:((n=e.initialState)==null||(n=n.pagination)==null?void 0:n.pageIndex)??V)},e.resetPageSize=t=>{var n;e.setPageSize(t?H:((n=e.initialState)==null||(n=n.pagination)==null?void 0:n.pageSize)??H)},e.setPageSize=t=>{e.setPagination(e=>{let n=Math.max(1,x(t,e.pageSize)),r=e.pageSize*e.pageIndex,i=Math.floor(r/n);return{...e,pageIndex:i,pageSize:n}})},e.setPageCount=t=>e.setPagination(n=>{let r=x(t,e.options.pageCount??-1);return typeof r==`number`&&(r=Math.max(-1,r)),{...n,pageCount:r}}),e.getPageOptions=w(()=>[e.getPageCount()],e=>{let t=[];return e&&e>0&&(t=[...Array(e)].fill(null).map((e,t)=>t)),t},T(e.options,`debugTable`,`getPageOptions`)),e.getCanPreviousPage=()=>e.getState().pagination.pageIndex>0,e.getCanNextPage=()=>{let{pageIndex:t}=e.getState().pagination,n=e.getPageCount();return n===-1?!0:n===0?!1:t<n-1},e.previousPage=()=>e.setPageIndex(e=>e-1),e.nextPage=()=>e.setPageIndex(e=>e+1),e.firstPage=()=>e.setPageIndex(0),e.lastPage=()=>e.setPageIndex(e.getPageCount()-1),e.getPrePaginationRowModel=()=>e.getExpandedRowModel(),e.getPaginationRowModel=()=>(!e._getPaginationRowModel&&e.options.getPaginationRowModel&&(e._getPaginationRowModel=e.options.getPaginationRowModel(e)),e.options.manualPagination||!e._getPaginationRowModel?e.getPrePaginationRowModel():e._getPaginationRowModel()),e.getPageCount=()=>e.options.pageCount??Math.ceil(e.getRowCount()/e.getState().pagination.pageSize),e.getRowCount=()=>e.options.rowCount??e.getPrePaginationRowModel().rows.length}},W=()=>({top:[],bottom:[]}),ke={getInitialState:e=>({rowPinning:W(),...e}),getDefaultOptions:e=>({onRowPinningChange:S(`rowPinning`,e)}),createRow:(e,t)=>{e.pin=(n,r,i)=>{let a=r?e.getLeafRows().map(e=>{let{id:t}=e;return t}):[],o=i?e.getParentRows().map(e=>{let{id:t}=e;return t}):[],s=new Set([...o,e.id,...a]);t.setRowPinning(e=>n===`bottom`?{top:(e?.top??[]).filter(e=>!(s!=null&&s.has(e))),bottom:[...(e?.bottom??[]).filter(e=>!(s!=null&&s.has(e))),...Array.from(s)]}:n===`top`?{top:[...(e?.top??[]).filter(e=>!(s!=null&&s.has(e))),...Array.from(s)],bottom:(e?.bottom??[]).filter(e=>!(s!=null&&s.has(e)))}:{top:(e?.top??[]).filter(e=>!(s!=null&&s.has(e))),bottom:(e?.bottom??[]).filter(e=>!(s!=null&&s.has(e)))})},e.getCanPin=()=>{let{enableRowPinning:n,enablePinning:r}=t.options;return typeof n==`function`?n(e):n??r??!0},e.getIsPinned=()=>{let n=[e.id],{top:r,bottom:i}=t.getState().rowPinning,a=n.some(e=>r?.includes(e)),o=n.some(e=>i?.includes(e));return a?`top`:o?`bottom`:!1},e.getPinnedIndex=()=>{let n=e.getIsPinned();return n?((n===`top`?t.getTopRows():t.getBottomRows())?.map(e=>{let{id:t}=e;return t}))?.indexOf(e.id)??-1:-1}},createTable:e=>{e.setRowPinning=t=>e.options.onRowPinningChange==null?void 0:e.options.onRowPinningChange(t),e.resetRowPinning=t=>e.setRowPinning(t?W():e.initialState?.rowPinning??W()),e.getIsSomeRowsPinned=t=>{let n=e.getState().rowPinning;return t?!!n[t]?.length:!!(n.top?.length||n.bottom?.length)},e._getPinnedRows=(t,n,r)=>(e.options.keepPinnedRows??!0?(n??[]).map(t=>{let n=e.getRow(t,!0);return n.getIsAllParentsExpanded()?n:null}):(n??[]).map(e=>t.find(t=>t.id===e))).filter(Boolean).map(e=>({...e,position:r})),e.getTopRows=w(()=>[e.getRowModel().rows,e.getState().rowPinning.top],(t,n)=>e._getPinnedRows(t,n,`top`),T(e.options,`debugRows`,`getTopRows`)),e.getBottomRows=w(()=>[e.getRowModel().rows,e.getState().rowPinning.bottom],(t,n)=>e._getPinnedRows(t,n,`bottom`),T(e.options,`debugRows`,`getBottomRows`)),e.getCenterRows=w(()=>[e.getRowModel().rows,e.getState().rowPinning.top,e.getState().rowPinning.bottom],(e,t,n)=>{let r=new Set([...t??[],...n??[]]);return e.filter(e=>!r.has(e.id))},T(e.options,`debugRows`,`getCenterRows`))}},Ae={getInitialState:e=>({rowSelection:{},...e}),getDefaultOptions:e=>({onRowSelectionChange:S(`rowSelection`,e),enableRowSelection:!0,enableMultiRowSelection:!0,enableSubRowSelection:!0}),createTable:e=>{e.setRowSelection=t=>e.options.onRowSelectionChange==null?void 0:e.options.onRowSelectionChange(t),e.resetRowSelection=t=>e.setRowSelection(t?{}:e.initialState.rowSelection??{}),e.toggleAllRowsSelected=t=>{e.setRowSelection(n=>{t=t===void 0?!e.getIsAllRowsSelected():t;let r={...n},i=e.getPreGroupedRowModel().flatRows;return t?i.forEach(e=>{e.getCanSelect()&&(r[e.id]=!0)}):i.forEach(e=>{delete r[e.id]}),r})},e.toggleAllPageRowsSelected=t=>e.setRowSelection(n=>{let r=t===void 0?!e.getIsAllPageRowsSelected():t,i={...n};return e.getRowModel().rows.forEach(t=>{G(i,t.id,r,!0,e)}),i}),e.getPreSelectedRowModel=()=>e.getCoreRowModel(),e.getSelectedRowModel=w(()=>[e.getState().rowSelection,e.getCoreRowModel()],(t,n)=>Object.keys(t).length?K(e,n):{rows:[],flatRows:[],rowsById:{}},T(e.options,`debugTable`,`getSelectedRowModel`)),e.getFilteredSelectedRowModel=w(()=>[e.getState().rowSelection,e.getFilteredRowModel()],(t,n)=>Object.keys(t).length?K(e,n):{rows:[],flatRows:[],rowsById:{}},T(e.options,`debugTable`,`getFilteredSelectedRowModel`)),e.getGroupedSelectedRowModel=w(()=>[e.getState().rowSelection,e.getSortedRowModel()],(t,n)=>Object.keys(t).length?K(e,n):{rows:[],flatRows:[],rowsById:{}},T(e.options,`debugTable`,`getGroupedSelectedRowModel`)),e.getIsAllRowsSelected=()=>{let t=e.getFilteredRowModel().flatRows,{rowSelection:n}=e.getState(),r=!!(t.length&&Object.keys(n).length);return r&&t.some(e=>e.getCanSelect()&&!n[e.id])&&(r=!1),r},e.getIsAllPageRowsSelected=()=>{let t=e.getPaginationRowModel().flatRows.filter(e=>e.getCanSelect()),{rowSelection:n}=e.getState(),r=!!t.length;return r&&t.some(e=>!n[e.id])&&(r=!1),r},e.getIsSomeRowsSelected=()=>{let t=Object.keys(e.getState().rowSelection??{}).length;return t>0&&t<e.getFilteredRowModel().flatRows.length},e.getIsSomePageRowsSelected=()=>{let t=e.getPaginationRowModel().flatRows;return e.getIsAllPageRowsSelected()?!1:t.filter(e=>e.getCanSelect()).some(e=>e.getIsSelected()||e.getIsSomeSelected())},e.getToggleAllRowsSelectedHandler=()=>t=>{e.toggleAllRowsSelected(t.target.checked)},e.getToggleAllPageRowsSelectedHandler=()=>t=>{e.toggleAllPageRowsSelected(t.target.checked)}},createRow:(e,t)=>{e.toggleSelected=(n,r)=>{let i=e.getIsSelected();t.setRowSelection(a=>{if(n=n===void 0?!i:n,e.getCanSelect()&&i===n)return a;let o={...a};return G(o,e.id,n,r?.selectChildren??!0,t),o})},e.getIsSelected=()=>{let{rowSelection:n}=t.getState();return q(e,n)},e.getIsSomeSelected=()=>{let{rowSelection:n}=t.getState();return J(e,n)===`some`},e.getIsAllSubRowsSelected=()=>{let{rowSelection:n}=t.getState();return J(e,n)===`all`},e.getCanSelect=()=>typeof t.options.enableRowSelection==`function`?t.options.enableRowSelection(e):t.options.enableRowSelection??!0,e.getCanSelectSubRows=()=>typeof t.options.enableSubRowSelection==`function`?t.options.enableSubRowSelection(e):t.options.enableSubRowSelection??!0,e.getCanMultiSelect=()=>typeof t.options.enableMultiRowSelection==`function`?t.options.enableMultiRowSelection(e):t.options.enableMultiRowSelection??!0,e.getToggleSelectedHandler=()=>{let t=e.getCanSelect();return n=>{t&&e.toggleSelected(n.target?.checked)}}}},G=(e,t,n,r,i)=>{var a;let o=i.getRow(t,!0);n?(o.getCanMultiSelect()||Object.keys(e).forEach(t=>delete e[t]),o.getCanSelect()&&(e[t]=!0)):delete e[t],r&&(a=o.subRows)!=null&&a.length&&o.getCanSelectSubRows()&&o.subRows.forEach(t=>G(e,t.id,n,r,i))};function K(e,t){let n=e.getState().rowSelection,r=[],i={},a=function(e,t){return e.map(e=>{var t;let o=q(e,n);if(o&&(r.push(e),i[e.id]=e),(t=e.subRows)!=null&&t.length&&(e={...e,subRows:a(e.subRows)}),o)return e}).filter(Boolean)};return{rows:a(t.rows),flatRows:r,rowsById:i}}function q(e,t){return t[e.id]??!1}function J(e,t,n){var r;if(!((r=e.subRows)!=null&&r.length))return!1;let i=!0,a=!1;return e.subRows.forEach(e=>{if(!(a&&!i)&&(e.getCanSelect()&&(q(e,t)?a=!0:i=!1),e.subRows&&e.subRows.length)){let n=J(e,t);n===`all`?a=!0:(n===`some`&&(a=!0),i=!1)}}),i?`all`:a?`some`:!1}var Y=/([0-9]+)/gm,je=(e,t,n)=>Le(Z(e.getValue(n)).toLowerCase(),Z(t.getValue(n)).toLowerCase()),Me=(e,t,n)=>Le(Z(e.getValue(n)),Z(t.getValue(n))),Ne=(e,t,n)=>X(Z(e.getValue(n)).toLowerCase(),Z(t.getValue(n)).toLowerCase()),Pe=(e,t,n)=>X(Z(e.getValue(n)),Z(t.getValue(n))),Fe=(e,t,n)=>{let r=e.getValue(n),i=t.getValue(n);return r>i?1:r<i?-1:0},Ie=(e,t,n)=>X(e.getValue(n),t.getValue(n));function X(e,t){return e===t?0:e>t?1:-1}function Z(e){return typeof e==`number`?isNaN(e)||e===1/0||e===-1/0?``:String(e):typeof e==`string`?e:``}function Le(e,t){let n=e.split(Y).filter(Boolean),r=t.split(Y).filter(Boolean);for(;n.length&&r.length;){let e=n.shift(),t=r.shift(),i=parseInt(e,10),a=parseInt(t,10),o=[i,a].sort();if(isNaN(o[0])){if(e>t)return 1;if(t>e)return-1;continue}if(isNaN(o[1]))return isNaN(i)?-1:1;if(i>a)return 1;if(a>i)return-1}return n.length-r.length}var Q={alphanumeric:je,alphanumericCaseSensitive:Me,text:Ne,textCaseSensitive:Pe,datetime:Fe,basic:Ie},Re=[se,we,ye,be,le,he,Te,Ee,{getInitialState:e=>({sorting:[],...e}),getDefaultColumnDef:()=>({sortingFn:`auto`,sortUndefined:1}),getDefaultOptions:e=>({onSortingChange:S(`sorting`,e),isMultiSortEvent:e=>e.shiftKey}),createColumn:(e,t)=>{e.getAutoSortingFn=()=>{let n=t.getFilteredRowModel().flatRows.slice(10),r=!1;for(let t of n){let n=t?.getValue(e.id);if(Object.prototype.toString.call(n)===`[object Date]`)return Q.datetime;if(typeof n==`string`&&(r=!0,n.split(Y).length>1))return Q.alphanumeric}return r?Q.text:Q.basic},e.getAutoSortDir=()=>typeof t.getFilteredRowModel().flatRows[0]?.getValue(e.id)==`string`?`asc`:`desc`,e.getSortingFn=()=>{if(!e)throw Error();return C(e.columnDef.sortingFn)?e.columnDef.sortingFn:e.columnDef.sortingFn===`auto`?e.getAutoSortingFn():t.options.sortingFns?.[e.columnDef.sortingFn]??Q[e.columnDef.sortingFn]},e.toggleSorting=(n,r)=>{let i=e.getNextSortingOrder(),a=n!=null;t.setSorting(o=>{let s=o?.find(t=>t.id===e.id),c=o?.findIndex(t=>t.id===e.id),l=[],u,d=a?n:i===`desc`;return u=o!=null&&o.length&&e.getCanMultiSort()&&r?s?`toggle`:`add`:o!=null&&o.length&&c!==o.length-1?`replace`:s?`toggle`:`replace`,u===`toggle`&&(a||i||(u=`remove`)),u===`add`?(l=[...o,{id:e.id,desc:d}],l.splice(0,l.length-(t.options.maxMultiSortColCount??2**53-1))):l=u===`toggle`?o.map(t=>t.id===e.id?{...t,desc:d}:t):u===`remove`?o.filter(t=>t.id!==e.id):[{id:e.id,desc:d}],l})},e.getFirstSortDir=()=>e.columnDef.sortDescFirst??t.options.sortDescFirst??e.getAutoSortDir()===`desc`?`desc`:`asc`,e.getNextSortingOrder=n=>{let r=e.getFirstSortDir(),i=e.getIsSorted();return i?i!==r&&(t.options.enableSortingRemoval??!0)&&(!n||(t.options.enableMultiRemove??!0))?!1:i===`desc`?`asc`:`desc`:r},e.getCanSort=()=>(e.columnDef.enableSorting??!0)&&(t.options.enableSorting??!0)&&!!e.accessorFn,e.getCanMultiSort=()=>e.columnDef.enableMultiSort??t.options.enableMultiSort??!!e.accessorFn,e.getIsSorted=()=>{let n=t.getState().sorting?.find(t=>t.id===e.id);return n?n.desc?`desc`:`asc`:!1},e.getSortIndex=()=>t.getState().sorting?.findIndex(t=>t.id===e.id)??-1,e.clearSorting=()=>{t.setSorting(t=>t!=null&&t.length?t.filter(t=>t.id!==e.id):[])},e.getToggleSortingHandler=()=>{let n=e.getCanSort();return r=>{n&&(r.persist==null||r.persist(),e.toggleSorting==null||e.toggleSorting(void 0,e.getCanMultiSort()?t.options.isMultiSortEvent==null?void 0:t.options.isMultiSortEvent(r):!1))}}},createTable:e=>{e.setSorting=t=>e.options.onSortingChange==null?void 0:e.options.onSortingChange(t),e.resetSorting=t=>{e.setSorting(t?[]:e.initialState?.sorting??[])},e.getPreSortedRowModel=()=>e.getGroupedRowModel(),e.getSortedRowModel=()=>(!e._getSortedRowModel&&e.options.getSortedRowModel&&(e._getSortedRowModel=e.options.getSortedRowModel(e)),e.options.manualSorting||!e._getSortedRowModel?e.getPreSortedRowModel():e._getSortedRowModel())}},_e,De,Oe,ke,Ae,Se];function ze(e){let t=[...Re,...e._features??[]],n={_features:t},r=n._features.reduce((e,t)=>Object.assign(e,t.getDefaultOptions==null?void 0:t.getDefaultOptions(n)),{}),i=e=>n.options.mergeOptions?n.options.mergeOptions(r,e):{...r,...e},a={...e.initialState??{}};n._features.forEach(e=>{a=(e.getInitialState==null?void 0:e.getInitialState(a))??a});let o=[],s=!1,c={_features:t,options:{...r,...e},initialState:a,_queue:e=>{o.push(e),s||(s=!0,Promise.resolve().then(()=>{for(;o.length;)o.shift()();s=!1}).catch(e=>setTimeout(()=>{throw e})))},reset:()=>{n.setState(n.initialState)},setOptions:e=>{n.options=i(x(e,n.options))},getState:()=>n.options.state,setState:e=>{n.options.onStateChange==null||n.options.onStateChange(e)},_getRowId:(e,t,r)=>(n.options.getRowId==null?void 0:n.options.getRowId(e,t,r))??`${r?[r.id,t].join(`.`):t}`,getCoreRowModel:()=>(n._getCoreRowModel||=n.options.getCoreRowModel(n),n._getCoreRowModel()),getRowModel:()=>n.getPaginationRowModel(),getRow:(e,t)=>{let r=(t?n.getPrePaginationRowModel():n.getRowModel()).rowsById[e];if(!r&&(r=n.getCoreRowModel().rowsById[e],!r))throw Error();return r},_getDefaultColumnDef:w(()=>[n.options.defaultColumn],e=>(e??={},{header:e=>{let t=e.header.column.columnDef;return t.accessorKey?t.accessorKey:t.accessorFn?t.id:null},cell:e=>{var t;return((t=e.renderValue())==null||t.toString==null?void 0:t.toString())??null},...n._features.reduce((e,t)=>Object.assign(e,t.getDefaultColumnDef==null?void 0:t.getDefaultColumnDef()),{}),...e}),T(e,`debugColumns`,`_getDefaultColumnDef`)),_getColumnDefs:()=>n.options.columns,getAllColumns:w(()=>[n._getColumnDefs()],e=>{let t=function(e,r,i){return i===void 0&&(i=0),e.map(e=>{let a=ae(n,e,i,r),o=e;return a.columns=o.columns?t(o.columns,a,i+1):[],a})};return t(e)},T(e,`debugColumns`,`getAllColumns`)),getAllFlatColumns:w(()=>[n.getAllColumns()],e=>e.flatMap(e=>e.getFlatColumns()),T(e,`debugColumns`,`getAllFlatColumns`)),_getAllFlatColumnsById:w(()=>[n.getAllFlatColumns()],e=>e.reduce((e,t)=>(e[t.id]=t,e),{}),T(e,`debugColumns`,`getAllFlatColumnsById`)),getAllLeafColumns:w(()=>[n.getAllColumns(),n._getOrderColumnsFn()],(e,t)=>t(e.flatMap(e=>e.getLeafColumns())),T(e,`debugColumns`,`getAllLeafColumns`)),getColumn:e=>n._getAllFlatColumnsById()[e]};Object.assign(n,c);for(let e=0;e<n._features.length;e++){let t=n._features[e];t==null||t.createTable==null||t.createTable(n)}return n}function Be(){return e=>w(()=>[e.options.data],t=>{let n={rows:[],flatRows:[],rowsById:{}},r=function(t,i,a){i===void 0&&(i=0);let o=[];for(let c=0;c<t.length;c++){let l=ce(e,e._getRowId(t[c],c,a),t[c],c,i,void 0,a?.id);if(n.flatRows.push(l),n.rowsById[l.id]=l,o.push(l),e.options.getSubRows){var s;l.originalSubRows=e.options.getSubRows(t[c],c),(s=l.originalSubRows)!=null&&s.length&&(l.subRows=r(l.originalSubRows,i+1,l))}}return o};return n.rows=r(t),n},T(e.options,`debugTable`,`getRowModel`,()=>e._autoResetPageIndex()))}function Ve(e,t){return e?He(e)?b.createElement(e,t):e:null}function He(e){return Ue(e)||typeof e==`function`||We(e)}function Ue(e){return typeof e==`function`&&(()=>{let t=Object.getPrototypeOf(e);return t.prototype&&t.prototype.isReactComponent})()}function We(e){return typeof e==`object`&&typeof e.$$typeof==`symbol`&&[`react.memo`,`react.forward_ref`].includes(e.$$typeof.description)}function Ge(e){let t={state:{},onStateChange:()=>{},renderFallbackValue:null,...e},[n]=b.useState(()=>({current:ze(t)})),[r,i]=b.useState(()=>n.current.initialState);return n.current.setOptions(t=>({...t,...e,state:{...r,...e.state},onStateChange:t=>{i(t),e.onStateChange==null||e.onStateChange(t)}})),n.current}var $=e(t(),1),Ke={loading:{id:`dataTable.loading`}};function qe({columns:e,data:t,isLoading:n=!1,emptyState:a,loadingLabel:o,rowSelection:s,onRowSelectionChange:c,getRowId:l}){let u=ee(),te=o??u(Ke.loading),_=s!==void 0,v=Ge({data:t,columns:e,getCoreRowModel:Be(),..._?{enableRowSelection:!0,state:{rowSelection:s},onRowSelectionChange:c,...l?{getRowId:l}:{}}:{}}),y=v.getRowModel().rows;return(0,$.jsx)(`div`,{className:`bg-card rounded-md border`,"aria-busy":n||void 0,role:n?`region`:void 0,"aria-label":n?te:void 0,"data-testid":n?`data-table-loading`:`data-table`,children:(0,$.jsxs)(h,{children:[(0,$.jsx)(f,{children:v.getHeaderGroups().map(e=>(0,$.jsx)(p,{children:e.headers.map(e=>(0,$.jsx)(g,{colSpan:e.colSpan,className:i(e.column.columnDef.meta?.className),children:e.isPlaceholder?null:Ve(e.column.columnDef.header,e.getContext())},e.id))},e.id))}),(0,$.jsx)(d,{children:n?(0,$.jsx)(Je,{columns:e.length}):y.length>0?y.map(e=>(0,$.jsx)(p,{"data-state":e.getIsSelected()?`selected`:void 0,className:`group/row`,children:e.getVisibleCells().map(e=>(0,$.jsx)(m,{className:i(e.column.columnDef.meta?.className),children:Ve(e.column.columnDef.cell,e.getContext())},e.id))},e.id)):(0,$.jsx)(p,{children:(0,$.jsx)(m,{colSpan:e.length,className:`text-muted-foreground h-32 text-center`,children:a??(0,$.jsx)(r,{id:`dataTable.emptyState`,message:`No results.`})})})})]})})}function Je({columns:e}){return(0,$.jsx)($.Fragment,{children:Array.from({length:5}).map((t,n)=>(0,$.jsx)(p,{children:Array.from({length:e}).map((e,t)=>(0,$.jsx)(m,{children:(0,$.jsx)(te,{className:`h-4 w-full`})},`skeleton-${String(n)}-${String(t)}`))},`skeleton-${String(n)}`))})}var Ye={prevAria:{id:`listPagination.prev.aria`},nextAria:{id:`listPagination.next.aria`}};function Xe({page:e,canPrev:t,canNext:n,isLoading:i,onPageChange:a}){let o=ee();return(0,$.jsxs)(u,{className:`justify-between`,children:[(0,$.jsx)(`span`,{className:`text-muted-foreground text-sm`,children:(0,$.jsx)(r,{id:`listPagination.page`,message:`Page {page}`,values:{page:e},comment:`page: 1-based current page number in the list`})}),(0,$.jsxs)(l,{children:[(0,$.jsx)(c,{children:(0,$.jsxs)(_,{variant:`ghost`,size:`sm`,disabled:!t||i,onClick:()=>{a(e-1)},"aria-label":o(Ye.prevAria),"data-testid":`list-pagination-prev`,children:[(0,$.jsx)(y,{className:`rtl:rotate-180`}),(0,$.jsx)(`span`,{className:`hidden sm:inline`,children:(0,$.jsx)(r,{id:`listPagination.prev.label`,message:`Previous`})})]})}),(0,$.jsx)(c,{children:(0,$.jsxs)(_,{variant:`ghost`,size:`sm`,disabled:!n||i,onClick:()=>{a(e+1)},"aria-label":o(Ye.nextAria),"data-testid":`list-pagination-next`,children:[(0,$.jsx)(`span`,{className:`hidden sm:inline`,children:(0,$.jsx)(r,{id:`listPagination.next.label`,message:`Next`})}),(0,$.jsx)(s,{className:`rtl:rotate-180`})]})})]})]})}var Ze=250;function Qe({initialValue:e,placeholder:t,testId:n,onCommit:r}){let[i,a]=(0,b.useState)(e);return(0,b.useEffect)(()=>{if(i===e)return;let t=setTimeout(()=>{r(i.length===0?void 0:i)},Ze);return()=>{clearTimeout(t)}},[i,e,r]),(0,$.jsxs)(`div`,{className:`relative`,children:[(0,$.jsx)(o,{"aria-hidden":!0,className:`text-muted-foreground pointer-events-none absolute start-3 top-1/2 size-4 -translate-y-1/2`}),(0,$.jsx)(v,{type:`search`,role:`searchbox`,value:i,maxLength:200,placeholder:t,"aria-label":t,"data-testid":n,onChange:e=>{a(e.target.value)},className:`h-9 w-64 ps-9`})]})}export{Xe as n,qe as r,Qe as t};
@@ -1 +1 @@
1
- import{i as e,t}from"./jsx-runtime-DUAcabCT.js";import{n}from"./dist-BL2bKHuR.js";import{l as r}from"./esm-DfD3iRfG.js";import{t as i}from"./settings-K6TF73jB.js";import{t as a}from"./use-label-CykSHq9A.js";import{a as o,i as s,n as c,r as l,t as u}from"./card-L2-kK5VK.js";import{At as d,Mt as f,Nt as p,Ot as m,jt as h,k as g,ut as _}from"./index-kTp--tHG.js";var v=e(t());function y(){let{user:e}=g.useRouteContext(),t=_(e.capabilities),y=a(),b=(0,v.jsx)(`h1`,{className:`text-2xl font-semibold`,"data-testid":`settings-heading`,children:(0,v.jsx)(n,{id:`settings.title`,message:`Settings`})});return t.length===0?(0,v.jsxs)(`div`,{className:`mx-auto flex w-full max-w-3xl flex-col gap-4`,children:[b,(0,v.jsx)(u,{"data-testid":`settings-empty-state`,children:(0,v.jsx)(m,{children:(0,v.jsxs)(h,{children:[(0,v.jsx)(f,{variant:`icon`,children:(0,v.jsx)(i,{})}),(0,v.jsx)(p,{children:(0,v.jsx)(n,{id:`settings.empty.title`,message:`No settings registered yet`})}),(0,v.jsx)(d,{children:(0,v.jsx)(n,{id:`settings.empty.description`,message:`Core ships no settings by design — plugins (or your own plumix.config) declare pages + groups via <0>ctx.registerSettingsPage</0> and <1>ctx.registerSettingsGroup</1>. Registered pages appear here with one card per page.`,components:{0:(0,v.jsx)(`code`,{className:`font-mono text-xs`}),1:(0,v.jsx)(`code`,{className:`font-mono text-xs`})}})})]})})})]}):(0,v.jsxs)(`div`,{className:`mx-auto flex w-full max-w-3xl flex-col gap-4`,children:[b,(0,v.jsx)(`div`,{className:`grid gap-3`,"data-testid":`settings-page-list`,children:t.map(e=>(0,v.jsx)(r,{to:`/settings/$page`,params:{page:e.name},className:`block`,"data-testid":`settings-page-link-${e.name}`,children:(0,v.jsxs)(u,{className:`hover:border-primary transition-colors`,children:[(0,v.jsxs)(s,{children:[(0,v.jsx)(o,{children:(0,v.jsx)(`h2`,{className:`text-base font-semibold`,children:y(e.label)})}),e.description?(0,v.jsx)(l,{children:y(e.description)}):null]}),(0,v.jsx)(c,{children:(0,v.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:(0,v.jsx)(n,{id:`settings.pageSummary`,message:`{count, plural, one {# group} other {# groups}}`,values:{count:e.groups.length},comment:`count: number of settings groups this page surfaces`})})})]})},e.name))})]})}export{y as component};
1
+ import{i as e,t}from"./jsx-runtime-DUAcabCT.js";import{n}from"./dist-BL2bKHuR.js";import{l as r}from"./esm-DfD3iRfG.js";import{t as i}from"./settings-K6TF73jB.js";import{t as a}from"./use-label-CykSHq9A.js";import{a as o,i as s,n as c,r as l,t as u}from"./card-L2-kK5VK.js";import{At as d,Mt as f,Nt as p,Ot as m,jt as h,k as g,ut as _}from"./index-Ctqj4aiM.js";var v=e(t());function y(){let{user:e}=g.useRouteContext(),t=_(e.capabilities),y=a(),b=(0,v.jsx)(`h1`,{className:`text-2xl font-semibold`,"data-testid":`settings-heading`,children:(0,v.jsx)(n,{id:`settings.title`,message:`Settings`})});return t.length===0?(0,v.jsxs)(`div`,{className:`mx-auto flex w-full max-w-3xl flex-col gap-4`,children:[b,(0,v.jsx)(u,{"data-testid":`settings-empty-state`,children:(0,v.jsx)(m,{children:(0,v.jsxs)(h,{children:[(0,v.jsx)(f,{variant:`icon`,children:(0,v.jsx)(i,{})}),(0,v.jsx)(p,{children:(0,v.jsx)(n,{id:`settings.empty.title`,message:`No settings registered yet`})}),(0,v.jsx)(d,{children:(0,v.jsx)(n,{id:`settings.empty.description`,message:`Core ships no settings by design — plugins (or your own plumix.config) declare pages + groups via <0>ctx.registerSettingsPage</0> and <1>ctx.registerSettingsGroup</1>. Registered pages appear here with one card per page.`,components:{0:(0,v.jsx)(`code`,{className:`font-mono text-xs`}),1:(0,v.jsx)(`code`,{className:`font-mono text-xs`})}})})]})})})]}):(0,v.jsxs)(`div`,{className:`mx-auto flex w-full max-w-3xl flex-col gap-4`,children:[b,(0,v.jsx)(`div`,{className:`grid gap-3`,"data-testid":`settings-page-list`,children:t.map(e=>(0,v.jsx)(r,{to:`/settings/$page`,params:{page:e.name},className:`block`,"data-testid":`settings-page-link-${e.name}`,children:(0,v.jsxs)(u,{className:`hover:border-primary transition-colors`,children:[(0,v.jsxs)(s,{children:[(0,v.jsx)(o,{children:(0,v.jsx)(`h2`,{className:`text-base font-semibold`,children:y(e.label)})}),e.description?(0,v.jsx)(l,{children:y(e.description)}):null]}),(0,v.jsx)(c,{children:(0,v.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:(0,v.jsx)(n,{id:`settings.pageSummary`,message:`{count, plural, one {# group} other {# groups}}`,values:{count:e.groups.length},comment:`count: number of settings groups this page surfaces`})})})]})},e.name))})]})}export{y as component};
@@ -1 +1 @@
1
- import{i as e,t}from"./jsx-runtime-DUAcabCT.js";import{t as n}from"./react-DbyrFoBd.js";import{i as r}from"./dist-BL2bKHuR.js";import{t as i}from"./utils-DKOQrNEG.js";import{t as a}from"./createLucideIcon-C0O-yxZG.js";import{d as o,f as s,l as c,p as l,s as u,u as d}from"./breadcrumb-kPG_yvD8.js";import{t as f}from"./chevrons-up-down-DmmG8bmI.js";import{J as p,K as m,N as h,Y as g}from"./utils-DkCVtsc2.js";import{t as _}from"./use-label-CykSHq9A.js";import{J as v,Pt as y,Tt as b}from"./index-kTp--tHG.js";import{r as x,t as S}from"./tree-BUpunTXw.js";var C=a(`arrow-down`,[[`path`,{d:`M12 5v14`,key:`s699le`}],[`path`,{d:`m19 12-7 7-7-7`,key:`1idqje`}]]),w=a(`arrow-up`,[[`path`,{d:`m5 12 7-7 7 7`,key:`hav0vg`}],[`path`,{d:`M12 19V5`,key:`x0mq9r`}]]),T=e(n(),1),E=e(t(),1),D={defaultTriggerPlaceholder:{id:`form.multiSelect.placeholder`},defaultSearchPlaceholder:{id:`form.multiSelect.search`},defaultEmpty:{id:`form.multiSelect.empty`},selectedCount:{id:`form.multiSelect.selectedCount`}};function O({id:e,options:t,value:n,onChange:a,placeholder:v,searchPlaceholder:x,emptyText:S,className:C,testId:w,disabled:O=!1,"aria-label":k}){let[A,j]=(0,T.useState)(!1),{i18n:M}=r(),N=_(),P=v??N(D.defaultTriggerPlaceholder),F=x??N(D.defaultSearchPlaceholder),I=S??N(D.defaultEmpty),L=new Set(n),R=n.length===0?P:n.length===1?t.find(e=>e.value===n[0])?.label??n[0]:M._(D.selectedCount.id,{count:n.length},{message:D.selectedCount.message}),z=e=>{L.has(e)?a(n.filter(t=>t!==e)):a([...n,e])};return(0,E.jsxs)(m,{open:A,onOpenChange:j,children:[(0,E.jsx)(g,{asChild:!0,children:(0,E.jsxs)(y,{id:e,type:`button`,variant:`outline`,size:`sm`,role:`combobox`,"aria-expanded":A,"aria-label":k,disabled:O,"data-testid":w,className:i(`justify-between gap-2 font-normal`,n.length===0&&`text-muted-foreground`,C),children:[(0,E.jsx)(`span`,{className:`truncate`,children:R}),n.length>1?(0,E.jsx)(h,{variant:`secondary`,className:`ms-1`,children:n.length}):null,(0,E.jsx)(f,{className:`ms-auto opacity-50`})]})}),(0,E.jsx)(p,{className:`w-64 p-0`,align:`start`,children:(0,E.jsxs)(u,{children:[(0,E.jsx)(o,{placeholder:F}),(0,E.jsxs)(l,{children:[(0,E.jsx)(c,{children:I}),(0,E.jsx)(d,{children:t.map(e=>{let t=L.has(e.value);return(0,E.jsxs)(s,{value:`${e.label} ${e.value}`,onSelect:()=>{z(e.value)},"data-testid":w?`${w}-option-${e.value}`:void 0,children:[(0,E.jsx)(b,{className:i(`me-2 size-4`,t?`opacity-100`:`opacity-0`)}),(0,E.jsx)(`span`,{style:e.depth&&e.depth>0?{paddingInlineStart:`${String(e.depth*12)}px`}:void 0,children:e.label})]},e.value)})})]})]})})]})}function k(e,t){return t?x(S(e)).map(({term:e,depth:t})=>({value:String(e.id),label:e.name,depth:t})):e.map(e=>({value:String(e.id),label:e.name,depth:0})).sort((e,t)=>e.label.localeCompare(t.label))}function A(e,t){return t?x(S(e)).map(({term:e,depth:t})=>({value:e.slug,label:e.name,depth:t})):e.map(e=>({value:e.slug,label:e.name,depth:0})).sort((e,t)=>e.label.localeCompare(t.label))}function j(e){v.success((0,E.jsx)(`span`,{"data-testid":`toast-success`,children:e}))}function M(e){v.error((0,E.jsx)(`span`,{"data-testid":`toast-error`,children:e}))}export{O as a,A as i,j as n,w as o,k as r,C as s,M as t};
1
+ import{i as e,t}from"./jsx-runtime-DUAcabCT.js";import{t as n}from"./react-DbyrFoBd.js";import{i as r}from"./dist-BL2bKHuR.js";import{t as i}from"./utils-DKOQrNEG.js";import{t as a}from"./createLucideIcon-C0O-yxZG.js";import{d as o,f as s,l as c,p as l,s as u,u as d}from"./breadcrumb-B-sB8a4_.js";import{t as f}from"./chevrons-up-down-DmmG8bmI.js";import{J as p,K as m,N as h,Y as g}from"./utils-ByiwTMhM.js";import{t as _}from"./use-label-CykSHq9A.js";import{J as v,Pt as y,Tt as b}from"./index-Ctqj4aiM.js";import{r as x,t as S}from"./tree-BUpunTXw.js";var C=a(`arrow-down`,[[`path`,{d:`M12 5v14`,key:`s699le`}],[`path`,{d:`m19 12-7 7-7-7`,key:`1idqje`}]]),w=a(`arrow-up`,[[`path`,{d:`m5 12 7-7 7 7`,key:`hav0vg`}],[`path`,{d:`M12 19V5`,key:`x0mq9r`}]]),T=e(n(),1),E=e(t(),1),D={defaultTriggerPlaceholder:{id:`form.multiSelect.placeholder`},defaultSearchPlaceholder:{id:`form.multiSelect.search`},defaultEmpty:{id:`form.multiSelect.empty`},selectedCount:{id:`form.multiSelect.selectedCount`}};function O({id:e,options:t,value:n,onChange:a,placeholder:v,searchPlaceholder:x,emptyText:S,className:C,testId:w,disabled:O=!1,"aria-label":k}){let[A,j]=(0,T.useState)(!1),{i18n:M}=r(),N=_(),P=v??N(D.defaultTriggerPlaceholder),F=x??N(D.defaultSearchPlaceholder),I=S??N(D.defaultEmpty),L=new Set(n),R=n.length===0?P:n.length===1?t.find(e=>e.value===n[0])?.label??n[0]:M._(D.selectedCount.id,{count:n.length},{message:D.selectedCount.message}),z=e=>{L.has(e)?a(n.filter(t=>t!==e)):a([...n,e])};return(0,E.jsxs)(m,{open:A,onOpenChange:j,children:[(0,E.jsx)(g,{asChild:!0,children:(0,E.jsxs)(y,{id:e,type:`button`,variant:`outline`,size:`sm`,role:`combobox`,"aria-expanded":A,"aria-label":k,disabled:O,"data-testid":w,className:i(`justify-between gap-2 font-normal`,n.length===0&&`text-muted-foreground`,C),children:[(0,E.jsx)(`span`,{className:`truncate`,children:R}),n.length>1?(0,E.jsx)(h,{variant:`secondary`,className:`ms-1`,children:n.length}):null,(0,E.jsx)(f,{className:`ms-auto opacity-50`})]})}),(0,E.jsx)(p,{className:`w-64 p-0`,align:`start`,children:(0,E.jsxs)(u,{children:[(0,E.jsx)(o,{placeholder:F}),(0,E.jsxs)(l,{children:[(0,E.jsx)(c,{children:I}),(0,E.jsx)(d,{children:t.map(e=>{let t=L.has(e.value);return(0,E.jsxs)(s,{value:`${e.label} ${e.value}`,onSelect:()=>{z(e.value)},"data-testid":w?`${w}-option-${e.value}`:void 0,children:[(0,E.jsx)(b,{className:i(`me-2 size-4`,t?`opacity-100`:`opacity-0`)}),(0,E.jsx)(`span`,{style:e.depth&&e.depth>0?{paddingInlineStart:`${String(e.depth*12)}px`}:void 0,children:e.label})]},e.value)})})]})]})})]})}function k(e,t){return t?x(S(e)).map(({term:e,depth:t})=>({value:String(e.id),label:e.name,depth:t})):e.map(e=>({value:String(e.id),label:e.name,depth:0})).sort((e,t)=>e.label.localeCompare(t.label))}function A(e,t){return t?x(S(e)).map(({term:e,depth:t})=>({value:e.slug,label:e.name,depth:t})):e.map(e=>({value:e.slug,label:e.name,depth:0})).sort((e,t)=>e.label.localeCompare(t.label))}function j(e){v.success((0,E.jsx)(`span`,{"data-testid":`toast-success`,children:e}))}function M(e){v.error((0,E.jsx)(`span`,{"data-testid":`toast-error`,children:e}))}export{O as a,A as i,j as n,w as o,k as r,C as s,M as t};
@@ -1 +1 @@
1
- import{i as e}from"./jsx-runtime-DUAcabCT.js";import{t}from"./react-DbyrFoBd.js";import{i as n}from"./dist-BL2bKHuR.js";import{Lt as r}from"./index-kTp--tHG.js";var i=r.date,a=r.number,o=[{unit:`year`,ms:365*24*60*6e4},{unit:`month`,ms:720*60*6e4},{unit:`week`,ms:10080*6e4},{unit:`day`,ms:1440*6e4},{unit:`hour`,ms:60*6e4},{unit:`minute`,ms:6e4},{unit:`second`,ms:1e3}];function s(e,t,n){let{now:r,...i}=n??{},a=(r??new Date).getTime(),s=t.getTime()-a,c=Math.abs(s),l=s<0?-1:1,u=o.find(e=>c>=e.ms)??{unit:`second`,ms:1e3},d=Math.round(c/u.ms)*l;return new Intl.RelativeTimeFormat(e,i).format(d,u.unit)}var c=e(t(),1);function l(){let{i18n:e}=n(),t=e.locale;return(0,c.useMemo)(()=>({formatDate:(e,n)=>i(t,e,n),formatNumber:(e,n)=>a(t,e,n),formatRelative:(e,n)=>s(t,e,{numeric:`auto`,...n})}),[t])}export{l as t};
1
+ import{i as e}from"./jsx-runtime-DUAcabCT.js";import{t}from"./react-DbyrFoBd.js";import{i as n}from"./dist-BL2bKHuR.js";import{Lt as r}from"./index-Ctqj4aiM.js";var i=r.date,a=r.number,o=[{unit:`year`,ms:365*24*60*6e4},{unit:`month`,ms:720*60*6e4},{unit:`week`,ms:10080*6e4},{unit:`day`,ms:1440*6e4},{unit:`hour`,ms:60*6e4},{unit:`minute`,ms:6e4},{unit:`second`,ms:1e3}];function s(e,t,n){let{now:r,...i}=n??{},a=(r??new Date).getTime(),s=t.getTime()-a,c=Math.abs(s),l=s<0?-1:1,u=o.find(e=>c>=e.ms)??{unit:`second`,ms:1e3},d=Math.round(c/u.ms)*l;return new Intl.RelativeTimeFormat(e,i).format(d,u.unit)}var c=e(t(),1);function l(){let{i18n:e}=n(),t=e.locale;return(0,c.useMemo)(()=>({formatDate:(e,n)=>i(t,e,n),formatNumber:(e,n)=>a(t,e,n),formatRelative:(e,n)=>s(t,e,{numeric:`auto`,...n})}),[t])}export{l as t};