bazilion 0.19.1 → 0.20.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 (91) hide show
  1. package/dist/cli.js +272 -129
  2. package/dist/cli.js.map +1 -1
  3. package/dist/daemon.js +1667 -707
  4. package/dist/daemon.js.map +1 -1
  5. package/dist/migrations/0001_init.sql +46 -0
  6. package/dist/web/client/assets/{ChatPane-DCyGcqdh.js → ChatPane-CGCtAuD3.js} +1 -1
  7. package/dist/web/client/assets/{ConfirmDialog-C908TxS5.js → ConfirmDialog-Br19uXWH.js} +1 -1
  8. package/dist/web/client/assets/{FieldRow-CELqI-1V.js → FieldRow-Csy3_cH5.js} +1 -1
  9. package/dist/web/client/assets/{ProductionTeamPolicyEditor-DnTcWhG8.js → ProductionTeamPolicyEditor-DG1x4Cqz.js} +1 -1
  10. package/dist/web/client/assets/{ProfileCommunicationEditor-BVIEaW3s.js → ProfileCommunicationEditor-C3odNVkK.js} +1 -1
  11. package/dist/web/client/assets/{ResultSourceConversation-4gbZCh_s.js → ResultSourceConversation-5PFWqXTY.js} +1 -1
  12. package/dist/web/client/assets/{TeamTabs-V17b45X5.js → TeamTabs-BHB_COm0.js} +1 -1
  13. package/dist/web/client/assets/{TemplatesTabs-BMK3Qok_.js → TemplatesTabs-YyytjW7k.js} +1 -1
  14. package/dist/web/client/assets/{UnsavedChangesGuard-BaE-UzyS.js → UnsavedChangesGuard-CredyC3E.js} +1 -1
  15. package/dist/web/client/assets/{_id-CArZR-IO.js → _id-BLm9LVlZ.js} +1 -1
  16. package/dist/web/client/assets/{_id-BU1l9gP7.js → _id-BZ_-4M4s.js} +1 -1
  17. package/dist/web/client/assets/{_id-Bvh5LyUv.js → _id-CIkPtQY0.js} +1 -1
  18. package/dist/web/client/assets/{_id-BVANQm00.js → _id-KXX6nuKc.js} +1 -1
  19. package/dist/web/client/assets/{_id-tUkSe5li.js → _id-nDbQY7f_.js} +1 -1
  20. package/dist/web/client/assets/{activity-CWCnqjqj.js → activity-BE7jG1Mz.js} +1 -1
  21. package/dist/web/client/assets/{agents-CdCnhH06.js → agents-S9lzXrrs.js} +1 -1
  22. package/dist/web/client/assets/{agents-CX4STmGK.js → agents-vOPd-upn.js} +1 -1
  23. package/dist/web/client/assets/{approvals-CnNpwG78.js → approvals-BUfhlUAX.js} +1 -1
  24. package/dist/web/client/assets/{attention-CEE-wWrx.js → attention-C3r-2GSp.js} +1 -1
  25. package/dist/web/client/assets/chevron-right-C7P3Z105.js +1 -0
  26. package/dist/web/client/assets/{config-CSEtI-dq.js → config-AL_EM57n.js} +1 -1
  27. package/dist/web/client/assets/{inbox-MYnBtPdF.js → inbox-LlCpJrMH.js} +1 -1
  28. package/dist/web/client/assets/{index-Ct31TjS-.js → index-CwMw0pnV.js} +2 -2
  29. package/dist/web/client/assets/{learning-BIR5FTgQ.js → learning-zvTJ_9vM.js} +1 -1
  30. package/dist/web/client/assets/{login-DIeceuOs.js → login-BpQ54z8Y.js} +1 -1
  31. package/dist/web/client/assets/{mcp-CX3kJpGu.js → mcp-BD6VzXg_.js} +1 -1
  32. package/dist/web/client/assets/{members-DlhSjye1.js → members-SEDi8SFo.js} +1 -1
  33. package/dist/web/client/assets/{memory-CsDd6b2l.js → memory-zi_dPlMA.js} +1 -1
  34. package/dist/web/client/assets/{policy-DkWDhG0x.js → policy-URjQAAdN.js} +1 -1
  35. package/dist/web/client/assets/{results-BHdhNHJJ.js → results-Bcuy4Flp.js} +1 -1
  36. package/dist/web/client/assets/review-CVH7X9-d.js +1 -0
  37. package/dist/web/client/assets/{routes-DtYD4WJL.js → routes-BJEX6yAE.js} +1 -1
  38. package/dist/web/client/assets/{services-WUlW7oEo.js → services-BTG4F5FL.js} +1 -1
  39. package/dist/web/client/assets/{skills-jNoUfUSZ.js → skills-DwiHS7eD.js} +1 -1
  40. package/dist/web/client/assets/{teams-C1kYRrtP.js → teams-DcROmSGB.js} +1 -1
  41. package/dist/web/client/assets/{teams-D3FaSKE7.js → teams-DfpwQu1i.js} +1 -1
  42. package/dist/web/client/assets/{telegram-D86AO6V9.js → telegram-BLyaaUXE.js} +1 -1
  43. package/dist/web/client/assets/{tokens-B42KDisP.js → tokens-Dp9Vwvfx.js} +1 -1
  44. package/dist/web/client/assets/{triggers-yEfWnQ_K.js → triggers-CtVhrAGA.js} +1 -1
  45. package/dist/web/client/assets/verifications-TC0ccGLY.js +2 -0
  46. package/dist/web/client/assets/{welcome-D8IbF_P0.js → welcome-DML3X1ha.js} +1 -1
  47. package/dist/web/client/assets/{x-CXKABZ7C.js → x-D8yuCam7.js} +1 -1
  48. package/dist/web/server/assets/{_id-bVispdh-.js → _id-Bazctexc.js} +1 -1
  49. package/dist/web/server/assets/{_id-Dab2CVtO2.js → _id-BjvOb4CK2.js} +1 -1
  50. package/dist/web/server/assets/{_id-DL-SnSnK.js → _id-Bn0w00AG.js} +1 -1
  51. package/dist/web/server/assets/{_id-D2bDA1iV.js → _id-DFf_uQiI.js} +1 -1
  52. package/dist/web/server/assets/{_tanstack-start-manifest_v-BcTOb0oj.js → _tanstack-start-manifest_v-BGSoO6CK.js} +79 -79
  53. package/dist/web/server/assets/{activity-CLDAy6rk.js → activity-j_Enmf3L.js} +1 -1
  54. package/dist/web/server/assets/{agents-CdB2kuNN.js → agents-BAi0dE66.js} +1 -1
  55. package/dist/web/server/assets/{agents-DfHcb2H2.js → agents-BHUbTrm7.js} +1 -1
  56. package/dist/web/server/assets/{approvals-Bq846WaP.js → approvals-BcUm6IOo.js} +1 -1
  57. package/dist/web/server/assets/{attention-Sm-U7s_0.js → attention-BQBa0Bu5.js} +1 -1
  58. package/dist/web/server/assets/{auth-PB5dVyvX.js → auth-PDNSxrT-.js} +1 -1
  59. package/dist/web/server/assets/{config-BNGTBu80.js → config-Cf7hhsUR.js} +1 -1
  60. package/dist/web/server/assets/{daemon-client-CWQvck6B.js → daemon-client-DY4jE6KU.js} +15 -0
  61. package/dist/web/server/assets/{git-review-C_h_tezf.js → git-review-RvzReZyD.js} +1 -1
  62. package/dist/web/server/assets/{inbox-DJoU-bla.js → inbox-Du1guYth.js} +1 -1
  63. package/dist/web/server/assets/{learning-DVb0I_3Z.js → learning-CjcixPRH.js} +1 -1
  64. package/dist/web/server/assets/{mcp-CeZqOiDG.js → mcp-BCalFLvt.js} +1 -1
  65. package/dist/web/server/assets/{members-CcYjuqxB.js → members-C4TpK50B.js} +1 -1
  66. package/dist/web/server/assets/{memory-CH2yNT89.js → memory-CLZs-XRY.js} +1 -1
  67. package/dist/web/server/assets/{policy-DrRKinMr.js → policy-BrIXpwxZ.js} +1 -1
  68. package/dist/web/server/assets/publications-BrX3-WJf.js +57 -0
  69. package/dist/web/server/assets/{results-fT2zyiJx.js → results-CJR6dNzB.js} +1 -1
  70. package/dist/web/server/assets/{review-CvUPk4HA.js → review-CRHiZfC8.js} +1 -1
  71. package/dist/web/server/assets/{review-DYcYdUTv.js → review-Dqdts12v.js} +205 -3
  72. package/dist/web/server/assets/{review-packets-e36PsTSX.js → review-packets-D3bZ7QYU.js} +1 -1
  73. package/dist/web/server/assets/{router-NYhuYQCd.js → router-BVhdWkwP.js} +3 -3
  74. package/dist/web/server/assets/{routes-RdppWPiW.js → routes-DizvfkfZ.js} +1 -1
  75. package/dist/web/server/assets/{services-Dgu7dcTC.js → services-DDRj180j.js} +1 -1
  76. package/dist/web/server/assets/{skills-DL7UIWa8.js → skills-Bck9L5oo.js} +1 -1
  77. package/dist/web/server/assets/{teams-DiC-MBg4.js → teams-CSqR5mWl.js} +1 -1
  78. package/dist/web/server/assets/{teams-Cmn7mdx9.js → teams-C_PicOsj.js} +1 -1
  79. package/dist/web/server/assets/{telegram-CLOFnLjF.js → telegram-D0odXx1E.js} +1 -1
  80. package/dist/web/server/assets/{tokens-BVva7GHu.js → tokens-B2O0Di4p.js} +1 -1
  81. package/dist/web/server/assets/{triggers-D4orksJq.js → triggers-DtKMYL2r.js} +1 -1
  82. package/dist/web/server/assets/{verification-C1SHMTX8.js → verification-no5BrOeR.js} +1 -1
  83. package/dist/web/server/assets/{verifications-Ci49n2Km.js → verifications-CM-Bbgjt.js} +114 -91
  84. package/dist/web/server/assets/{verifications-C_ycXrPK.js → verifications-DhGe86E1.js} +1 -1
  85. package/dist/web/server/server.js +56 -48
  86. package/dist/worker.js +36 -0
  87. package/dist/worker.js.map +1 -1
  88. package/package.json +3 -3
  89. package/dist/web/client/assets/chevron-right-CvCEwfSl.js +0 -1
  90. package/dist/web/client/assets/review-Dyw47eM1.js +0 -1
  91. package/dist/web/client/assets/verifications-DrHQEQFx.js +0 -2
@@ -1052,3 +1052,49 @@ CREATE TABLE verification_check_outcomes (
1052
1052
  CHECK (exit_code IS NULL OR state IN ('succeeded', 'failed'))
1053
1053
  );
1054
1054
  CREATE INDEX verification_check_outcomes_command ON verification_check_outcomes(command_id);
1055
+
1056
+ -- BAZ-046: one operator-approved publication of a reviewed revision to a code host.
1057
+ --
1058
+ -- One row is one decision, one attempt and one observed outcome. There is no workflow: a publication
1059
+ -- either published, was refused before anything was sent, or ended in a state that says honestly what is
1060
+ -- and is not known. Retrying a refused publication is a new row, so the earlier refusal stays visible.
1061
+ CREATE TABLE publications (
1062
+ id TEXT PRIMARY KEY,
1063
+ team_id TEXT NOT NULL REFERENCES teams(id) ON DELETE CASCADE,
1064
+ packet_id TEXT NOT NULL REFERENCES review_packets(id) ON DELETE CASCADE,
1065
+ snapshot_id TEXT NOT NULL,
1066
+ -- The host adapter that was used, and the repository as the operator configured it.
1067
+ host TEXT NOT NULL CHECK (host IN ('github', 'local')),
1068
+ repository TEXT NOT NULL CHECK (length(repository) BETWEEN 1 AND 200),
1069
+ base_branch TEXT NOT NULL CHECK (length(base_branch) BETWEEN 1 AND 200),
1070
+ head_branch TEXT NOT NULL CHECK (length(head_branch) BETWEEN 1 AND 200),
1071
+ base_oid TEXT NOT NULL CHECK (length(base_oid) = 40),
1072
+ commit_message TEXT NOT NULL CHECK (length(commit_message) BETWEEN 1 AND 2000),
1073
+ -- The Agent that asked for the review, if one did: it is told the outcome and nothing else.
1074
+ notify_agent_id TEXT REFERENCES agents(id) ON DELETE SET NULL,
1075
+ state TEXT NOT NULL CHECK (state IN (
1076
+ 'pending', 'publishing', 'published', 'refused', 'failed', 'uncertain'
1077
+ )),
1078
+ refusal_reason TEXT CHECK (refusal_reason IS NULL OR length(refusal_reason) <= 64),
1079
+ refusal_detail TEXT CHECK (refusal_detail IS NULL OR length(refusal_detail) <= 400),
1080
+ commit_oid TEXT CHECK (commit_oid IS NULL OR length(commit_oid) = 40),
1081
+ -- Always 0 today: publication commits are unsigned and no code path may claim otherwise.
1082
+ signed INTEGER NOT NULL DEFAULT 0 CHECK (signed = 0),
1083
+ pull_request_number INTEGER,
1084
+ pull_request_url TEXT CHECK (pull_request_url IS NULL OR length(pull_request_url) <= 400),
1085
+ error TEXT CHECK (error IS NULL OR length(error) <= 400),
1086
+ -- Lease ownership, so a restarted daemon can recover an interrupted attempt as unknown rather than
1087
+ -- replaying a push that may already have landed.
1088
+ claimed_by TEXT,
1089
+ lease_expires_at INTEGER,
1090
+ created_at INTEGER NOT NULL,
1091
+ updated_at INTEGER NOT NULL,
1092
+ finished_at INTEGER,
1093
+ -- A refusal is the only state that carries no attempt: everything else was, or may have been, sent.
1094
+ CHECK ((state = 'refused') = (refusal_reason IS NOT NULL)),
1095
+ CHECK ((state IN ('published', 'refused', 'failed', 'uncertain')) = (finished_at IS NOT NULL))
1096
+ );
1097
+ CREATE INDEX publications_team_time ON publications(team_id, created_at, id);
1098
+ -- One successful publication per packet. A refused or failed one does not block a corrected retry.
1099
+ CREATE UNIQUE INDEX publications_packet_published ON publications(packet_id) WHERE state = 'published';
1100
+ CREATE INDEX publications_lease ON publications(state, lease_expires_at);
@@ -1,4 +1,4 @@
1
- import{r as e,t}from"./jsx-runtime-DGeXAQPT.js";import{t as n}from"./react-3W8R1pOO.js";import{h as r}from"./index-Ct31TjS-.js";import{t as i}from"./Button-ByiV6fpd.js";import{n as a,t as o}from"./git-review-presentation-CzHQulDk.js";import{t as s}from"./ResultCard-Cps_lXVN.js";function c(e){let t=e.split(`
1
+ import{r as e,t}from"./jsx-runtime-DGeXAQPT.js";import{t as n}from"./react-3W8R1pOO.js";import{h as r}from"./index-CwMw0pnV.js";import{t as i}from"./Button-ByiV6fpd.js";import{n as a,t as o}from"./git-review-presentation-CzHQulDk.js";import{t as s}from"./ResultCard-Cps_lXVN.js";function c(e){let t=e.split(`
2
2
  `).map(e=>e.trim()).find(e=>/^(?:[A-Za-z]*Error(?: \[[A-Z_]+\])?:|ERR_[A-Z_]+\b)/.test(e));return t?t.length>240?`${t.slice(0,237)}…`:t:null}function l(e){let t=e.split(`
3
3
  `).find(e=>e.startsWith(`--- from `));if(!t)return`Teammate update received`;let n=/^--- from (.+?) \(message [0-9a-f-]+(?:, reply to [0-9a-f-]+)?\) ---$/.exec(t);if(!n)return`Teammate update received`;let r=n[1]?.replace(/ \([0-9a-f-]{36}\)$/,``).trim();return!r||/^[0-9a-f-]{36}$/.test(r)?`Teammate update received`:`Update from ${r.slice(0,100)}`}var u=e(n(),1),d=65536;async function f(e,t=fetch){let n=`/api/teams/${encodeURIComponent(e.teamId)}/coding-commands/${encodeURIComponent(e.commandId)}/log`;try{let e=await t(`${n}?limit=${d}`,{headers:{accept:`application/json`}});if(e.status===403)return{status:`not-shared`};if(e.status===404)return{status:`missing`};if(!e.ok)return{status:`unavailable`,message:`Request failed (${e.status}).`};let r=await e.json(),i=p(r);if(!i)return{status:`unavailable`,message:`Unexpected response from the daemon.`};if(h(r,`page`)===null)return{status:`not-shared`};let a=m(h(r,`page`));return a?{status:`available`,page:a,view:i}:{status:`unavailable`,message:`Unexpected response from the daemon.`}}catch{return{status:`unavailable`,message:`The daemon could not be reached.`}}}function p(e){let t=h(e,`view`);return!g(t)||typeof t.commandId!=`string`||typeof t.availability!=`string`||typeof t.byteLength!=`number`?null:t}function m(e){return!g(e)||typeof e.text!=`string`||typeof e.availability!=`string`||typeof e.offset!=`number`||typeof e.hasMore!=`boolean`||typeof e.byteLength!=`number`?null:e}function h(e,t){return g(e)?e[t]:void 0}function g(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var _=t();function v({name:e,body:t,pending:n=!1,log:r}){if(!n&&t===`Coding context or command evidence retained privately. Captured transport output follows its communication approval; ask the Agent for the relevant result.`)return(0,_.jsxs)(`details`,{className:`py-1 text-xs font-sans`,"aria-label":`Private command details`,children:[(0,_.jsx)(`summary`,{className:`cursor-pointer`,children:`Detailed output isn’t included in this history view`}),(0,_.jsx)(`p`,{className:`mt-1`,children:`The Agent’s summary is shown in the conversation. Ask the Agent to summarize its retained command result if you need more detail.`}),r&&(0,_.jsx)(b,{reference:r})]});let i;try{i=JSON.parse(t)}catch{return(0,_.jsx)(`span`,{children:t})}if(!i||typeof i!=`object`)return(0,_.jsx)(`span`,{children:t});if(n){let t=i;return(0,_.jsxs)(`p`,{className:`py-1 break-words`,children:[e===`coding_command`?`Running`:`Inspecting`,`:`,` `,typeof t.command==`string`?t.command:typeof t.target==`string`?t.target:`command evidence`]})}if(e===`repository_context`){let e=i;return Array.isArray(e.instructions?.files)?(0,_.jsxs)(`details`,{className:`py-1`,children:[(0,_.jsxs)(`summary`,{className:`cursor-pointer`,children:[`Repository: `,e.target,` ·`,` `,e.instructions.state===`complete`?`${e.instructions.files.length} instruction files`:`instructions unavailable`]}),e.instructions.files.map(e=>(0,_.jsx)(`p`,{children:e.path},e.path)),(0,_.jsxs)(`p`,{children:[e.commands?.candidates?.length??0,` suggested commands ·`,` `,e.git?.state===`available`?e.git.branch:`Git unavailable`]}),(0,_.jsx)(`pre`,{className:`max-h-64 overflow-auto whitespace-pre-wrap break-words`,children:t})]}):(0,_.jsx)(`span`,{children:t})}if(e===`coding_log`){let e=i;return typeof e.text!=`string`||typeof e.availability!=`string`?(0,_.jsx)(`span`,{children:t}):(0,_.jsxs)(`details`,{className:`py-1`,"aria-label":`Retained command output`,children:[(0,_.jsxs)(`summary`,{className:`cursor-pointer`,children:[`Retained output: `,e.availability,e.hasMore?` · more available`:``]}),(0,_.jsx)(`pre`,{className:`max-h-64 overflow-auto whitespace-pre-wrap break-words`,children:e.text}),(0,_.jsxs)(`p`,{className:`text-xs`,children:[`bytes `,typeof e.offset==`number`?e.offset:0,`–`,(typeof e.offset==`number`?e.offset:0)+e.text.length,` of`,` `,typeof e.byteLength==`number`?e.byteLength:0]})]})}if(e===`coding_environment`){let e=i;return typeof e.posture==`string`?(0,_.jsxs)(`details`,{className:`py-1`,children:[(0,_.jsxs)(`summary`,{className:`cursor-pointer`,children:[`Environment: `,e.posture,` · `,e.cwd]}),(0,_.jsx)(`p`,{className:`break-all`,children:e.imageId??`Host runtime`}),Array.isArray(e.restrictions)&&e.restrictions.filter(e=>typeof e==`string`).map(e=>(0,_.jsx)(`p`,{children:e},e))]}):(0,_.jsx)(`span`,{children:t})}let a=i,o=e===`coding_receipt`?a.receipt:i;if(!o||typeof o.state!=`string`||typeof o.input?.command!=`string`||typeof o.input?.cwd!=`string`)return(0,_.jsx)(`span`,{children:t});let s=o.state===`failed`&&typeof o.diagnostic==`string`?c(o.diagnostic):null;return(0,_.jsxs)(`div`,{className:`py-2`,"aria-label":`Coding command result`,children:[(0,_.jsxs)(`p`,{className:`font-sans`,children:[(0,_.jsx)(`strong`,{className:o.state===`succeeded`?`text-sapphire-deep`:`text-mocha`,children:o.state.replaceAll(`_`,` `)}),` `,`· `,o.input.purpose,typeof o.exitCode==`number`?` · exit ${o.exitCode}`:``,e===`coding_receipt`?` · ${a.applicability}`:``]}),(0,_.jsx)(`p`,{className:`whitespace-pre-wrap break-words`,children:o.input.command}),(0,_.jsxs)(`p`,{className:`text-xs`,children:[o.input.cwd,` · `,o.environment?.posture,` · result at execution time`]}),s&&(0,_.jsx)(`p`,{className:`mt-1 font-sans text-rose-baziu`,"aria-label":`Command failure summary`,children:s}),typeof o.reason==`string`&&(0,_.jsx)(`p`,{children:o.reason}),(0,_.jsxs)(`details`,{children:[(0,_.jsx)(`summary`,{className:`cursor-pointer`,children:`Output and evidence`}),(0,_.jsx)(`pre`,{className:`max-h-64 overflow-auto whitespace-pre-wrap break-words`,children:o.diagnostic}),o.truncated&&(0,_.jsx)(`p`,{children:`Output truncated.`}),(0,_.jsxs)(`p`,{className:`break-all`,children:[`coding-receipt:`,o.id]}),(0,_.jsx)(y,{teamId:o.teamId,after:o.sourceAfter??null,before:o.sourceBefore??null}),o.environment?.imageId&&(0,_.jsx)(`p`,{className:`break-all`,children:o.environment.imageId})]})]})}function y({teamId:e,after:t,before:n}){let[s,c]=(0,u.useState)(null),[l,d]=(0,u.useState)(!1);async function f(){if(t){d(!0);try{c(await r({data:{teamId:e,snapshotId:t.id}}))}finally{d(!1)}}}let p=s?.status===`ok`?s:null,m=o(p);return(0,_.jsxs)(`p`,{className:a(p)?`text-rose-baziu`:void 0,children:[m,t?(0,_.jsxs)(_.Fragment,{children:[` · tested version `,(0,_.jsx)(`span`,{className:`break-all font-mono`,children:t.id.slice(0,12)}),t.complete?``:` (incomplete)`,p===null&&(0,_.jsxs)(_.Fragment,{children:[` `,(0,_.jsx)(i,{variant:`ghost`,disabled:l,onClick:()=>void f(),children:l?`Checking…`:`Check applicability`})]}),s?.status===`unavailable`&&(0,_.jsxs)(`span`,{children:[` · `,s.message]})]}):` · no source snapshot was captured for this result`,n&&(0,_.jsxs)(_.Fragment,{children:[` · started from `,(0,_.jsx)(`span`,{className:`break-all font-mono`,children:n.id.slice(0,12)})]})]})}function b({reference:e}){let[t,n]=(0,u.useState)(null),[r,a]=(0,u.useState)(!1);async function o(){a(!0);try{n(await f(e))}finally{a(!1)}}return t===null?(0,_.jsx)(`p`,{className:`mt-2`,children:(0,_.jsx)(i,{variant:`ghost`,disabled:r,onClick:()=>void o(),children:r?`Loading…`:`Show retained output`})}):t.status===`not-shared`?(0,_.jsx)(`p`,{className:`mt-2`,children:`This command’s output hasn’t been shared with the conversation yet.`}):t.status===`missing`?(0,_.jsx)(`p`,{className:`mt-2`,children:`This retained output is no longer available.`}):t.status===`unavailable`?(0,_.jsx)(`p`,{className:`mt-2`,role:`alert`,children:t.message}):(0,_.jsxs)(`div`,{className:`mt-2`,children:[(0,_.jsx)(`pre`,{className:`max-h-64 overflow-auto whitespace-pre-wrap break-words rounded-sm bg-[rgba(42,31,22,0.04)] p-2`,children:t.page.text}),(0,_.jsxs)(`p`,{children:[`Retained output: `,t.page.availability,t.page.hasMore?` · earlier output omitted`:``,` · bytes `,t.page.offset,`–`,t.page.offset+t.page.text.length,` of `,t.page.byteLength]})]})}function x(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function S(e){if(Array.isArray(e))return e}function C(e,t){var n=e==null?null:typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(n!=null){var r,i,a,o,s=[],c=!0,l=!1;try{if(a=(n=n.call(e)).next,t!==0)for(;!(c=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(l)throw i}}return s}}function w(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
4
4
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function T(e,t){return S(e)||C(e,t)||E(e,t)||w()}function E(e,t){if(e){if(typeof e==`string`)return x(e,t);var n={}.toString.call(e).slice(8,-1);return n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`?Array.from(e):n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?x(e,t):void 0}}var D=Object.entries,O=Object.setPrototypeOf,k=Object.isFrozen,ee=Object.getPrototypeOf,te=Object.getOwnPropertyDescriptor,A=Object.freeze,j=Object.seal,M=Object.create,N=typeof Reflect<`u`&&Reflect,ne=N.apply,re=N.construct;A||=function(e){return e},j||=function(e){return e},ne||=function(e,t){var n=[...arguments].slice(2);return e.apply(t,n)},re||=function(e){return new e(...[...arguments].slice(1))};var ie=z(Array.prototype.forEach),ae=z(Array.prototype.lastIndexOf),oe=z(Array.prototype.pop),se=z(Array.prototype.push),ce=z(Array.prototype.splice),P=Array.isArray,le=z(String.prototype.toLowerCase),ue=z(String.prototype.toString),de=z(String.prototype.match),fe=z(String.prototype.replace),pe=z(String.prototype.indexOf),me=z(String.prototype.trim),F=z(Number.prototype.toString),he=z(Boolean.prototype.toString),I=typeof BigInt>`u`?null:z(BigInt.prototype.toString),ge=typeof Symbol>`u`?null:z(Symbol.prototype.toString),L=z(Object.prototype.hasOwnProperty),_e=z(Object.prototype.toString),R=z(RegExp.prototype.test),ve=ye(TypeError);function z(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);var n=[...arguments].slice(1);return ne(e,t,n)}}function ye(e){return function(){return re(e,[...arguments])}}function B(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:le;if(O&&O(e,null),!P(t))return e;let r=t.length;for(;r--;){let i=t[r];if(typeof i==`string`){let e=n(i);e!==i&&(k(t)||(t[r]=e),i=e)}e[i]=!0}return e}function V(e){for(let t=0;t<e.length;t++)L(e,t)||(e[t]=null);return e}function H(e){let t=M(null);for(let r of D(e)){var n=T(r,2);let i=n[0],a=n[1];L(e,i)&&(P(a)?t[i]=V(a):a&&typeof a==`object`&&a.constructor===Object?t[i]=H(a):t[i]=a)}return t}function be(e){switch(typeof e){case`string`:return e;case`number`:return F(e);case`boolean`:return he(e);case`bigint`:return I?I(e):`0`;case`symbol`:return ge?ge(e):`Symbol()`;case`undefined`:return _e(e);case`function`:case`object`:{if(e===null)return _e(e);let t=e,n=U(t,`toString`);if(typeof n==`function`){let e=n(t);return typeof e==`string`?e:_e(e)}return _e(e)}default:return _e(e)}}function U(e,t){for(;e!==null;){let n=te(e,t);if(n){if(n.get)return z(n.get);if(typeof n.value==`function`)return z(n.value)}e=ee(e)}function n(){return null}return n}function xe(e){try{return R(e,``),!0}catch{return!1}}var Se=A(`a.abbr.acronym.address.area.article.aside.audio.b.bdi.bdo.big.blink.blockquote.body.br.button.canvas.caption.center.cite.code.col.colgroup.content.data.datalist.dd.decorator.del.details.dfn.dialog.dir.div.dl.dt.element.em.fieldset.figcaption.figure.font.footer.form.h1.h2.h3.h4.h5.h6.head.header.hgroup.hr.html.i.img.input.ins.kbd.label.legend.li.main.map.mark.marquee.menu.menuitem.meter.nav.nobr.ol.optgroup.option.output.p.picture.pre.progress.q.rp.rt.ruby.s.samp.search.section.select.shadow.slot.small.source.spacer.span.strike.strong.style.sub.summary.sup.table.tbody.td.template.textarea.tfoot.th.thead.time.tr.track.tt.u.ul.var.video.wbr`.split(`.`)),Ce=A(`svg.a.altglyph.altglyphdef.altglyphitem.animatecolor.animatemotion.animatetransform.circle.clippath.defs.desc.ellipse.enterkeyhint.exportparts.filter.font.g.glyph.glyphref.hkern.image.inputmode.line.lineargradient.marker.mask.metadata.mpath.part.path.pattern.polygon.polyline.radialgradient.rect.stop.style.switch.symbol.text.textpath.title.tref.tspan.view.vkern`.split(`.`)),we=A([`feBlend`,`feColorMatrix`,`feComponentTransfer`,`feComposite`,`feConvolveMatrix`,`feDiffuseLighting`,`feDisplacementMap`,`feDistantLight`,`feDropShadow`,`feFlood`,`feFuncA`,`feFuncB`,`feFuncG`,`feFuncR`,`feGaussianBlur`,`feImage`,`feMerge`,`feMergeNode`,`feMorphology`,`feOffset`,`fePointLight`,`feSpecularLighting`,`feSpotLight`,`feTile`,`feTurbulence`]),Te=A([`animate`,`color-profile`,`cursor`,`discard`,`font-face`,`font-face-format`,`font-face-name`,`font-face-src`,`font-face-uri`,`foreignobject`,`hatch`,`hatchpath`,`mesh`,`meshgradient`,`meshpatch`,`meshrow`,`missing-glyph`,`script`,`set`,`solidcolor`,`unknown`,`use`]),Ee=A(`math.menclose.merror.mfenced.mfrac.mglyph.mi.mlabeledtr.mmultiscripts.mn.mo.mover.mpadded.mphantom.mroot.mrow.ms.mspace.msqrt.mstyle.msub.msup.msubsup.mtable.mtd.mtext.mtr.munder.munderover.mprescripts`.split(`.`)),De=A([`maction`,`maligngroup`,`malignmark`,`mlongdiv`,`mscarries`,`mscarry`,`msgroup`,`mstack`,`msline`,`msrow`,`semantics`,`annotation`,`annotation-xml`,`mprescripts`,`none`]),Oe=A([`#text`]),ke=A(`accept.action.align.alt.autocapitalize.autocomplete.autopictureinpicture.autoplay.background.bgcolor.border.capture.cellpadding.cellspacing.checked.cite.class.clear.color.cols.colspan.command.commandfor.controls.controlslist.coords.crossorigin.datetime.decoding.default.dir.disabled.disablepictureinpicture.disableremoteplayback.download.draggable.enctype.enterkeyhint.exportparts.face.for.headers.height.hidden.high.href.hreflang.id.inert.inputmode.integrity.ismap.kind.label.lang.list.loading.loop.low.max.maxlength.media.method.min.minlength.multiple.muted.name.nonce.noshade.novalidate.nowrap.open.optimum.part.pattern.placeholder.playsinline.popover.popovertarget.popovertargetaction.poster.preload.pubdate.radiogroup.readonly.rel.required.rev.reversed.role.rows.rowspan.spellcheck.scope.selected.shape.size.sizes.slot.span.srclang.start.src.srcset.step.style.summary.tabindex.title.translate.type.usemap.valign.value.width.wrap.xmlns`.split(`.`)),Ae=A(`accent-height.accumulate.additive.alignment-baseline.amplitude.ascent.attributename.attributetype.azimuth.basefrequency.baseline-shift.begin.bias.by.class.clip.clippathunits.clip-path.clip-rule.color.color-interpolation.color-interpolation-filters.color-profile.color-rendering.cx.cy.d.dx.dy.diffuseconstant.direction.display.divisor.dur.edgemode.elevation.end.exponent.fill.fill-opacity.fill-rule.filter.filterunits.flood-color.flood-opacity.font-family.font-size.font-size-adjust.font-stretch.font-style.font-variant.font-weight.fx.fy.g1.g2.glyph-name.glyphref.gradientunits.gradienttransform.height.href.id.image-rendering.in.in2.intercept.k.k1.k2.k3.k4.kerning.keypoints.keysplines.keytimes.lang.lengthadjust.letter-spacing.kernelmatrix.kernelunitlength.lighting-color.local.marker-end.marker-mid.marker-start.markerheight.markerunits.markerwidth.maskcontentunits.maskunits.max.mask.mask-type.media.method.mode.min.name.numoctaves.offset.operator.opacity.order.orient.orientation.origin.overflow.paint-order.path.pathlength.patterncontentunits.patterntransform.patternunits.points.preservealpha.preserveaspectratio.primitiveunits.r.rx.ry.radius.refx.refy.repeatcount.repeatdur.restart.result.rotate.scale.seed.shape-rendering.slope.specularconstant.specularexponent.spreadmethod.startoffset.stddeviation.stitchtiles.stop-color.stop-opacity.stroke-dasharray.stroke-dashoffset.stroke-linecap.stroke-linejoin.stroke-miterlimit.stroke-opacity.stroke.stroke-width.style.surfacescale.systemlanguage.tabindex.tablevalues.targetx.targety.transform.transform-origin.text-anchor.text-decoration.text-rendering.textlength.type.u1.u2.unicode.values.viewbox.visibility.version.vert-adv-y.vert-origin-x.vert-origin-y.width.word-spacing.wrap.writing-mode.xchannelselector.ychannelselector.x.x1.x2.xmlns.y.y1.y2.z.zoomandpan`.split(`.`)),je=A(`accent.accentunder.align.bevelled.close.columnalign.columnlines.columnspacing.columnspan.denomalign.depth.dir.display.displaystyle.encoding.fence.frame.height.href.id.largeop.length.linethickness.lquote.lspace.mathbackground.mathcolor.mathsize.mathvariant.maxsize.minsize.movablelimits.notation.numalign.open.rowalign.rowlines.rowspacing.rowspan.rspace.rquote.scriptlevel.scriptminsize.scriptsizemultiplier.selection.separator.separators.stretchy.subscriptshift.supscriptshift.symmetric.voffset.width.xmlns`.split(`.`)),Me=A([`xlink:href`,`xml:id`,`xlink:title`,`xml:space`,`xmlns:xlink`]),Ne=j(/{{[\w\W]*|^[\w\W]*}}/g),Pe=j(/<%[\w\W]*|^[\w\W]*%>/g),Fe=j(/\${[\w\W]*/g),Ie=j(/^data-[\-\w.\u00B7-\uFFFF]+$/),Le=j(/^aria-[\-\w]+$/),Re=j(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),ze=j(/^(?:\w+script|data):/i),Be=j(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Ve=j(/^html$/i),He=j(/^[a-z][.\w]*(-[.\w]+)+$/i),Ue=j(/<[/\w!]/g),We=j(/<[/\w]/g),Ge=j(/<\/no(script|embed|frames)/i),Ke=j(/\/>/i),qe={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,processingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},Je=function(){return typeof window>`u`?null:window},Ye=function(e,t){if(typeof e!=`object`||typeof e.createPolicy!=`function`)return null;let n=null,r=`data-tt-policy-suffix`;t&&t.hasAttribute(r)&&(n=t.getAttribute(r));let i=`dompurify`+(n?`#`+n:``);try{return e.createPolicy(i,{createHTML(e){return e},createScriptURL(e){return e}})}catch{return console.warn(`TrustedTypes policy `+i+` could not be created.`),null}},Xe=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},Ze=function(e,t,n,r){return L(e,t)&&P(e[t])?B(r.base?H(r.base):{},e[t],r.transform):n};function Qe(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Je(),t=e=>Qe(e);if(t.version=`3.4.11`,t.removed=[],!e||!e.document||e.document.nodeType!==qe.document||!e.Element)return t.isSupported=!1,t;let n=e.document,r=n,i=r.currentScript;e.DocumentFragment;let a=e.HTMLTemplateElement,o=e.Node,s=e.Element,c=e.NodeFilter;e.NamedNodeMap===void 0&&(e.NamedNodeMap||e.MozNamedAttrMap),e.HTMLFormElement;let l=e.DOMParser,u=e.trustedTypes,d=s.prototype,f=U(d,`cloneNode`),p=U(d,`remove`),m=U(d,`nextSibling`),h=U(d,`childNodes`),g=U(d,`parentNode`),_=U(d,`shadowRoot`),v=U(d,`attributes`),y=o&&o.prototype?U(o.prototype,`nodeType`):null,b=o&&o.prototype?U(o.prototype,`nodeName`):null;if(typeof a==`function`){let e=n.createElement(`template`);e.content&&e.content.ownerDocument&&(n=e.content.ownerDocument)}let x,S=``,C,w=!1,T=0,E=function(){if(T>0)throw ve(`A configured TRUSTED_TYPES_POLICY callback (createHTML or createScriptURL) must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose callbacks wrap DOMPurify as TRUSTED_TYPES_POLICY; see the "DOMPurify and Trusted Types" section of the README.`)},O=function(e){E(),T++;try{return x.createHTML(e)}finally{T--}},k=function(e){E(),T++;try{return x.createScriptURL(e)}finally{T--}},ee=function(){return w||=(C=Ye(u,i),!0),C},te=n,N=te.implementation,ne=te.createNodeIterator,re=te.createDocumentFragment,F=te.getElementsByTagName,he=r.importNode,I=Xe();t.isSupported=typeof D==`function`&&typeof g==`function`&&N&&N.createHTMLDocument!==void 0;let ge=Ne,_e=Pe,z=Fe,ye=Ie,V=Le,$e=ze,et=Be,tt=He,nt=Re,W=null,rt=B({},[...Se,...Ce,...we,...Ee,...Oe]),G=null,it=B({},[...ke,...Ae,...je,...Me]),K=Object.seal(M(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),at=null,ot=null,st=Object.seal(M(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}})),ct=!0,lt=!0,ut=!1,dt=!0,ft=!1,pt=!0,mt=!1,ht=!1,gt=null,_t=null,vt=!1,yt=!1,bt=!1,xt=!1,St=!0,Ct=!1,wt=`user-content-`,Tt=!0,Et=!1,Dt={},q=null,Ot=B({},`annotation-xml.audio.colgroup.desc.foreignobject.head.iframe.math.mi.mn.mo.ms.mtext.noembed.noframes.noscript.plaintext.script.selectedcontent.style.svg.template.thead.title.video.xmp`.split(`.`)),kt=null,At=B({},[`audio`,`video`,`img`,`source`,`image`,`track`]),jt=null,Mt=B({},[`alt`,`class`,`for`,`id`,`label`,`name`,`pattern`,`placeholder`,`role`,`summary`,`title`,`value`,`style`,`xmlns`]),Nt=`http://www.w3.org/1998/Math/MathML`,Pt=`http://www.w3.org/2000/svg`,Ft=`http://www.w3.org/1999/xhtml`,It=Ft,Lt=!1,Rt=null,zt=B({},[Nt,Pt,Ft],ue),Bt=A([`mi`,`mo`,`mn`,`ms`,`mtext`]),Vt=B({},Bt),Ht=A([`annotation-xml`]),Ut=B({},Ht),Wt=B({},[`title`,`style`,`font`,`a`,`script`]),Gt=null,Kt=[`application/xhtml+xml`,`text/html`],J=null,qt=null,Jt=n.createElement(`form`),Yt=function(e){return e instanceof RegExp||e instanceof Function},Xt=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(qt&&qt===e)return;(!e||typeof e!=`object`)&&(e={}),e=H(e),Gt=Kt.indexOf(e.PARSER_MEDIA_TYPE)===-1?`text/html`:e.PARSER_MEDIA_TYPE,J=Gt===`application/xhtml+xml`?ue:le,W=Ze(e,`ALLOWED_TAGS`,rt,{transform:J}),G=Ze(e,`ALLOWED_ATTR`,it,{transform:J}),Rt=Ze(e,`ALLOWED_NAMESPACES`,zt,{transform:ue}),jt=Ze(e,`ADD_URI_SAFE_ATTR`,Mt,{transform:J,base:Mt}),kt=Ze(e,`ADD_DATA_URI_TAGS`,At,{transform:J,base:At}),q=Ze(e,`FORBID_CONTENTS`,Ot,{transform:J}),at=Ze(e,`FORBID_TAGS`,H({}),{transform:J}),ot=Ze(e,`FORBID_ATTR`,H({}),{transform:J}),Dt=L(e,`USE_PROFILES`)?e.USE_PROFILES&&typeof e.USE_PROFILES==`object`?H(e.USE_PROFILES):e.USE_PROFILES:!1,ct=e.ALLOW_ARIA_ATTR!==!1,lt=e.ALLOW_DATA_ATTR!==!1,ut=e.ALLOW_UNKNOWN_PROTOCOLS||!1,dt=e.ALLOW_SELF_CLOSE_IN_ATTR!==!1,ft=e.SAFE_FOR_TEMPLATES||!1,pt=e.SAFE_FOR_XML!==!1,mt=e.WHOLE_DOCUMENT||!1,yt=e.RETURN_DOM||!1,bt=e.RETURN_DOM_FRAGMENT||!1,xt=e.RETURN_TRUSTED_TYPE||!1,vt=e.FORCE_BODY||!1,St=e.SANITIZE_DOM!==!1,Ct=e.SANITIZE_NAMED_PROPS||!1,Tt=e.KEEP_CONTENT!==!1,Et=e.IN_PLACE||!1,nt=xe(e.ALLOWED_URI_REGEXP)?e.ALLOWED_URI_REGEXP:Re,It=typeof e.NAMESPACE==`string`?e.NAMESPACE:Ft,Vt=L(e,`MATHML_TEXT_INTEGRATION_POINTS`)&&e.MATHML_TEXT_INTEGRATION_POINTS&&typeof e.MATHML_TEXT_INTEGRATION_POINTS==`object`?H(e.MATHML_TEXT_INTEGRATION_POINTS):B({},Bt),Ut=L(e,`HTML_INTEGRATION_POINTS`)&&e.HTML_INTEGRATION_POINTS&&typeof e.HTML_INTEGRATION_POINTS==`object`?H(e.HTML_INTEGRATION_POINTS):B({},Ht);let t=L(e,`CUSTOM_ELEMENT_HANDLING`)&&e.CUSTOM_ELEMENT_HANDLING&&typeof e.CUSTOM_ELEMENT_HANDLING==`object`?H(e.CUSTOM_ELEMENT_HANDLING):M(null);if(K=M(null),L(t,`tagNameCheck`)&&Yt(t.tagNameCheck)&&(K.tagNameCheck=t.tagNameCheck),L(t,`attributeNameCheck`)&&Yt(t.attributeNameCheck)&&(K.attributeNameCheck=t.attributeNameCheck),L(t,`allowCustomizedBuiltInElements`)&&typeof t.allowCustomizedBuiltInElements==`boolean`&&(K.allowCustomizedBuiltInElements=t.allowCustomizedBuiltInElements),j(K),ft&&(lt=!1),bt&&(yt=!0),Dt&&(W=B({},Oe),G=M(null),Dt.html===!0&&(B(W,Se),B(G,ke)),Dt.svg===!0&&(B(W,Ce),B(G,Ae),B(G,Me)),Dt.svgFilters===!0&&(B(W,we),B(G,Ae),B(G,Me)),Dt.mathMl===!0&&(B(W,Ee),B(G,je),B(G,Me))),st.tagCheck=null,st.attributeCheck=null,L(e,`ADD_TAGS`)&&(typeof e.ADD_TAGS==`function`?st.tagCheck=e.ADD_TAGS:P(e.ADD_TAGS)&&(W===rt&&(W=H(W)),B(W,e.ADD_TAGS,J))),L(e,`ADD_ATTR`)&&(typeof e.ADD_ATTR==`function`?st.attributeCheck=e.ADD_ATTR:P(e.ADD_ATTR)&&(G===it&&(G=H(G)),B(G,e.ADD_ATTR,J))),L(e,`ADD_URI_SAFE_ATTR`)&&P(e.ADD_URI_SAFE_ATTR)&&B(jt,e.ADD_URI_SAFE_ATTR,J),L(e,`FORBID_CONTENTS`)&&P(e.FORBID_CONTENTS)&&(q===Ot&&(q=H(q)),B(q,e.FORBID_CONTENTS,J)),L(e,`ADD_FORBID_CONTENTS`)&&P(e.ADD_FORBID_CONTENTS)&&(q===Ot&&(q=H(q)),B(q,e.ADD_FORBID_CONTENTS,J)),Tt&&(W[`#text`]=!0),mt&&B(W,[`html`,`head`,`body`]),W.table&&(B(W,[`tbody`]),delete at.tbody),e.TRUSTED_TYPES_POLICY){if(typeof e.TRUSTED_TYPES_POLICY.createHTML!=`function`)throw ve(`TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.`);if(typeof e.TRUSTED_TYPES_POLICY.createScriptURL!=`function`)throw ve(`TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.`);let t=x;x=e.TRUSTED_TYPES_POLICY;try{S=O(``)}catch(e){throw x=t,e}}else e.TRUSTED_TYPES_POLICY===null?(x=void 0,S=``):(x===void 0&&(x=ee()),x&&typeof S==`string`&&(S=O(``)));A&&A(e),qt=e},Zt=B({},[...Ce,...we,...Te]),Qt=B({},[...Ee,...De]),$t=function(e,t,n){return t.namespaceURI===Ft?e===`svg`:t.namespaceURI===Nt?e===`svg`&&(n===`annotation-xml`||Vt[n]):!!Zt[e]},en=function(e,t,n){return t.namespaceURI===Ft?e===`math`:t.namespaceURI===Pt?e===`math`&&Ut[n]:!!Qt[e]},tn=function(e,t,n){return t.namespaceURI===Pt&&!Ut[n]||t.namespaceURI===Nt&&!Vt[n]?!1:!Qt[e]&&(Wt[e]||!Zt[e])},nn=function(e){let t=g(e);(!t||!t.tagName)&&(t={namespaceURI:It,tagName:`template`});let n=le(e.tagName),r=le(t.tagName);return Rt[e.namespaceURI]?e.namespaceURI===Pt?$t(n,t,r):e.namespaceURI===Nt?en(n,t,r):e.namespaceURI===Ft?tn(n,t,r):!!(Gt===`application/xhtml+xml`&&Rt[e.namespaceURI]):!1},rn=function(e){se(t.removed,{element:e});try{g(e).removeChild(e)}catch{if(p(e),!g(e))throw ve(`a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place`)}},an=function(e){let t=h(e);if(t){let e=[];ie(t,t=>{se(e,t)}),ie(e,e=>{try{p(e)}catch{}})}let n=v(e);if(n)for(let t=n.length-1;t>=0;--t){let r=n[t],i=r&&r.name;if(typeof i==`string`)try{e.removeAttribute(i)}catch{}}},on=function(e,n){try{se(t.removed,{attribute:n.getAttributeNode(e),from:n})}catch{se(t.removed,{attribute:null,from:n})}if(n.removeAttribute(e),e===`is`)if(yt||bt)try{rn(n)}catch{}else try{n.setAttribute(e,``)}catch{}},sn=function(e){let t=v(e);if(t)for(let n=t.length-1;n>=0;--n){let r=t[n],i=r&&r.name;if(!(typeof i!=`string`||G[J(i)]))try{e.removeAttribute(i)}catch{}}},cn=function(e){let t=[e];for(;t.length>0;){let e=t.pop();(y?y(e):e.nodeType)===qe.element&&sn(e);let n=h(e);if(n)for(let e=n.length-1;e>=0;--e)t.push(n[e])}},ln=function(e){let t=null,r=null;if(vt)e=`<remove></remove>`+e;else{let t=de(e,/^[\r\n\t ]+/);r=t&&t[0]}Gt===`application/xhtml+xml`&&It===Ft&&(e=`<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>`+e+`</body></html>`);let i=x?O(e):e;if(It===Ft)try{t=new l().parseFromString(i,Gt)}catch{}if(!t||!t.documentElement){t=N.createDocument(It,`template`,null);try{t.documentElement.innerHTML=Lt?S:i}catch{}}let a=t.body||t.documentElement;return e&&r&&a.insertBefore(n.createTextNode(r),a.childNodes[0]||null),It===Ft?F.call(t,mt?`html`:`body`)[0]:mt?t.documentElement:a},un=function(e){return ne.call(e.ownerDocument||e,e,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT|c.SHOW_PROCESSING_INSTRUCTION|c.SHOW_CDATA_SECTION,null)},Y=function(e){return e=fe(e,ge,` `),e=fe(e,_e,` `),e=fe(e,z,` `),e},dn=function(e){e.normalize();let t=ne.call(e.ownerDocument||e,e,c.SHOW_TEXT|c.SHOW_COMMENT|c.SHOW_CDATA_SECTION|c.SHOW_PROCESSING_INSTRUCTION,null),n=t.nextNode();for(;n;)n.data=Y(n.data),n=t.nextNode();let r=e.querySelectorAll?.call(e,`template`);r&&ie(r,e=>{X(e.content)&&dn(e.content)})},fn=function(e){let t=b?b(e):null;return typeof t!=`string`||J(t)!==`form`?!1:typeof e.nodeName!=`string`||typeof e.textContent!=`string`||typeof e.removeChild!=`function`||e.attributes!==v(e)||typeof e.removeAttribute!=`function`||typeof e.setAttribute!=`function`||typeof e.namespaceURI!=`string`||typeof e.insertBefore!=`function`||typeof e.hasChildNodes!=`function`||e.nodeType!==y(e)||e.childNodes!==h(e)},X=function(e){if(!y||typeof e!=`object`||!e)return!1;try{return y(e)===qe.documentFragment}catch{return!1}},pn=function(e){if(!y||typeof e!=`object`||!e)return!1;try{return typeof y(e)==`number`}catch{return!1}};function mn(e,n,r){e.length!==0&&ie(e,e=>{e.call(t,n,r,qt)})}let hn=function(e,t){return!!(pt&&e.hasChildNodes()&&!pn(e.firstElementChild)&&R(Ue,e.textContent)&&R(Ue,e.innerHTML)||pt&&e.namespaceURI===Ft&&t===`style`&&pn(e.firstElementChild)||e.nodeType===qe.processingInstruction||pt&&e.nodeType===qe.comment&&R(We,e.data))},gn=function(e,t){if(!at[t]&&yn(t)&&(K.tagNameCheck instanceof RegExp&&R(K.tagNameCheck,t)||K.tagNameCheck instanceof Function&&K.tagNameCheck(t)))return!1;if(Tt&&!q[t]){let t=g(e),n=h(e);if(n&&t){let r=n.length;for(let i=r-1;i>=0;--i){let r=Et?n[i]:f(n[i],!0);t.insertBefore(r,m(e))}}}return rn(e),!0},_n=function(e){if(mn(I.beforeSanitizeElements,e,null),fn(e))return rn(e),!0;let n=J(b?b(e):e.nodeName);if(mn(I.uponSanitizeElement,e,{tagName:n,allowedTags:W}),hn(e,n))return rn(e),!0;if(at[n]||!(st.tagCheck instanceof Function&&st.tagCheck(n))&&!W[n])return gn(e,n);if((y?y(e):e.nodeType)===qe.element&&!nn(e)||(n===`noscript`||n===`noembed`||n===`noframes`)&&R(Ge,e.innerHTML))return rn(e),!0;if(ft&&e.nodeType===qe.text){let n=Y(e.textContent);e.textContent!==n&&(se(t.removed,{element:e.cloneNode()}),e.textContent=n)}return mn(I.afterSanitizeElements,e,null),!1},vn=function(e,t,r){if(ot[t]||St&&(t===`id`||t===`name`)&&(r in n||r in Jt))return!1;let i=G[t]||st.attributeCheck instanceof Function&&st.attributeCheck(t,e);if(!(lt&&R(ye,t))&&!(ct&&R(V,t))){if(!i){if(!(yn(e)&&(K.tagNameCheck instanceof RegExp&&R(K.tagNameCheck,e)||K.tagNameCheck instanceof Function&&K.tagNameCheck(e))&&(K.attributeNameCheck instanceof RegExp&&R(K.attributeNameCheck,t)||K.attributeNameCheck instanceof Function&&K.attributeNameCheck(t,e))||t===`is`&&K.allowCustomizedBuiltInElements&&(K.tagNameCheck instanceof RegExp&&R(K.tagNameCheck,r)||K.tagNameCheck instanceof Function&&K.tagNameCheck(r))))return!1}else if(!jt[t]&&!R(nt,fe(r,et,``))&&!((t===`src`||t===`xlink:href`||t===`href`)&&e!==`script`&&pe(r,`data:`)===0&&kt[e])&&!(ut&&!R($e,fe(r,et,``)))&&r)return!1}return!0},Z=B({},[`annotation-xml`,`color-profile`,`font-face`,`font-face-format`,`font-face-name`,`font-face-src`,`font-face-uri`,`missing-glyph`]),yn=function(e){return!Z[le(e)]&&R(tt,e)},bn=function(e,t,n,r){if(x&&typeof u==`object`&&typeof u.getAttributeType==`function`&&!n)switch(u.getAttributeType(e,t)){case`TrustedHTML`:return O(r);case`TrustedScriptURL`:return k(r)}return r},Q=function(e,n,r,i){try{r?e.setAttributeNS(r,n,i):e.setAttribute(n,i),fn(e)?rn(e):oe(t.removed)}catch{on(n,e)}},xn=function(e){mn(I.beforeSanitizeAttributes,e,null);let t=e.attributes;if(!t||fn(e))return;let n={attrName:``,attrValue:``,keepAttr:!0,allowedAttributes:G,forceKeepAttr:void 0},r=t.length,i=J(e.nodeName);for(;r--;){let a=t[r],o=a.name,s=a.namespaceURI,c=a.value,l=J(o),u=c,d=o===`value`?u:me(u);if(n.attrName=l,n.attrValue=d,n.keepAttr=!0,n.forceKeepAttr=void 0,mn(I.uponSanitizeAttribute,e,n),d=n.attrValue,Ct&&(l===`id`||l===`name`)&&pe(d,wt)!==0&&(on(o,e),d=wt+d),pt&&R(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,d)){on(o,e);continue}if(l===`attributename`&&de(d,`href`)){on(o,e);continue}if(!n.forceKeepAttr){if(!n.keepAttr){on(o,e);continue}if(!dt&&R(Ke,d)){on(o,e);continue}if(ft&&(d=Y(d)),!vn(i,l,d)){on(o,e);continue}d=bn(i,l,s,d),d!==u&&Q(e,o,s,d)}}mn(I.afterSanitizeAttributes,e,null)},Sn=function(e){let t=null,n=un(e);for(mn(I.beforeSanitizeShadowDOM,e,null);t=n.nextNode();)if(mn(I.uponSanitizeShadowNode,t,null),_n(t),xn(t),X(t.content)&&Sn(t.content),(y?y(t):t.nodeType)===qe.element){let e=_(t);X(e)&&($(e),Sn(e))}mn(I.afterSanitizeShadowDOM,e,null)},$=function(e){let t=[{node:e,shadow:null}];for(;t.length>0;){let e=t.pop();if(e.shadow){Sn(e.shadow);continue}let n=e.node,r=(y?y(n):n.nodeType)===qe.element,i=h(n);if(i)for(let e=i.length-1;e>=0;--e)t.push({node:i[e],shadow:null});if(r){let e=b?b(n):null;if(typeof e==`string`&&J(e)===`template`){let e=n.content;X(e)&&t.push({node:e,shadow:null})}}if(r){let e=_(n);X(e)&&t.push({node:null,shadow:e},{node:e,shadow:null})}}};return t.sanitize=function(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=null,a=null,o=null,s=null;if(Lt=!e,Lt&&(e=`<!-->`),typeof e!=`string`&&!pn(e)&&(e=be(e),typeof e!=`string`))throw ve(`dirty is not a string, aborting`);if(!t.isSupported)return e;ht?(W=gt,G=_t):Xt(n),(I.uponSanitizeElement.length>0||I.uponSanitizeAttribute.length>0)&&(W=H(W)),I.uponSanitizeAttribute.length>0&&(G=H(G)),t.removed=[];let c=Et&&typeof e!=`string`&&pn(e);if(c){let t=b?b(e):e.nodeName;if(typeof t==`string`){let e=J(t);if(!W[e]||at[e])throw ve(`root node is forbidden and cannot be sanitized in-place`)}if(fn(e))throw ve(`root node is clobbered and cannot be sanitized in-place`);try{$(e)}catch(t){throw an(e),t}}else if(pn(e))i=ln(`<!---->`),a=i.ownerDocument.importNode(e,!0),a.nodeType===qe.element&&a.nodeName===`BODY`||a.nodeName===`HTML`?i=a:i.appendChild(a),$(a);else{if(!yt&&!ft&&!mt&&e.indexOf(`<`)===-1)return x&&xt?O(e):e;if(i=ln(e),!i)return yt?null:xt?S:``}i&&vt&&rn(i.firstChild);let l=un(c?e:i);try{for(;o=l.nextNode();)_n(o),xn(o),X(o.content)&&Sn(o.content)}catch(t){throw c&&an(e),t}if(c)return ie(t.removed,e=>{e.element&&cn(e.element)}),ft&&dn(e),e;if(yt){if(ft&&dn(i),bt)for(s=re.call(i.ownerDocument);i.firstChild;)s.appendChild(i.firstChild);else s=i;return(G.shadowroot||G.shadowrootmode)&&(s=he.call(r,s,!0)),s}let u=mt?i.outerHTML:i.innerHTML;return mt&&W[`!doctype`]&&i.ownerDocument&&i.ownerDocument.doctype&&i.ownerDocument.doctype.name&&R(Ve,i.ownerDocument.doctype.name)&&(u=`<!DOCTYPE `+i.ownerDocument.doctype.name+`>
@@ -1 +1 @@
1
- import{r as e,t}from"./jsx-runtime-DGeXAQPT.js";import{t as n}from"./react-3W8R1pOO.js";import{$ as r,Q as i,X as a,Z as o,at as s,ct as c,dt as l,et as u,it as d,nt as f,ot as p,rt as m,st as h,tt as g,ut as _}from"./index-Ct31TjS-.js";import{t as v}from"./Button-ByiV6fpd.js";var y=e(n(),1),b=t(),x=`Dialog`,[S,C]=h(x),[w,T]=S(x),E=e=>{let{__scopeDialog:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!0}=e,c=y.useRef(null),l=y.useRef(null),[u,d]=s({prop:r,defaultProp:i??!1,onChange:a,caller:x});return(0,b.jsx)(w,{scope:t,triggerRef:c,contentRef:l,contentId:m(),titleId:m(),descriptionId:m(),open:u,onOpenChange:d,onOpenToggle:y.useCallback(()=>d(e=>!e),[d]),modal:o,children:n})};E.displayName=x;var D=`DialogTrigger`,O=y.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=T(D,n),a=l(t,i.triggerRef);return(0,b.jsx)(c.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":J(i.open),...r,ref:a,onClick:p(e.onClick,i.onOpenToggle)})});O.displayName=D;var k=`DialogPortal`,[A,j]=S(k,{forceMount:void 0}),M=e=>{let{__scopeDialog:t,forceMount:n,children:i,container:a}=e,o=T(k,t);return(0,b.jsx)(A,{scope:t,forceMount:n,children:y.Children.map(i,e=>(0,b.jsx)(d,{present:n||o.open,children:(0,b.jsx)(r,{asChild:!0,container:a,children:e})}))})};M.displayName=k;var N=`DialogOverlay`,P=y.forwardRef((e,t)=>{let n=j(N,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=T(N,e.__scopeDialog);return a.modal?(0,b.jsx)(d,{present:r||a.open,children:(0,b.jsx)(I,{...i,ref:t})}):null});P.displayName=N;var F=_(`DialogOverlay.RemoveScroll`),I=y.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=T(N,n),a=l(t,f());return(0,b.jsx)(o,{as:F,allowPinchZoom:!0,shards:[i.contentRef],children:(0,b.jsx)(c.div,{"data-state":J(i.open),...r,ref:a,style:{pointerEvents:`auto`,...r.style}})})}),L=`DialogContent`,R=y.forwardRef((e,t)=>{let n=j(L,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=T(L,e.__scopeDialog);return(0,b.jsx)(d,{present:r||a.open,children:a.modal?(0,b.jsx)(z,{...i,ref:t}):(0,b.jsx)(B,{...i,ref:t})})});R.displayName=L;var z=y.forwardRef((e,t)=>{let n=T(L,e.__scopeDialog),r=y.useRef(null),i=l(t,n.contentRef,r);return y.useEffect(()=>{let e=r.current;if(e)return a(e)},[]),(0,b.jsx)(V,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,onCloseAutoFocus:p(e.onCloseAutoFocus,e=>{e.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:p(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0;(t.button===2||n)&&e.preventDefault()}),onFocusOutside:p(e.onFocusOutside,e=>e.preventDefault())})}),B=y.forwardRef((e,t)=>{let n=T(L,e.__scopeDialog),r=y.useRef(!1),i=y.useRef(!1);return(0,b.jsx)(V,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})}),V=y.forwardRef((e,t)=>{let{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:a,onCloseAutoFocus:o,...s}=e,c=T(L,n);return i(),(0,b.jsx)(b.Fragment,{children:(0,b.jsx)(u,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:a,onUnmountAutoFocus:o,children:(0,b.jsx)(g,{role:`dialog`,id:c.contentId,"aria-describedby":c.descriptionId,"aria-labelledby":c.titleId,"data-state":J(c.open),...s,ref:t,deferPointerDownOutside:!0,onDismiss:()=>c.onOpenChange(!1)})})})}),H=`DialogTitle`,U=y.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=T(H,n);return(0,b.jsx)(c.h2,{id:i.titleId,...r,ref:t})});U.displayName=H;var W=`DialogDescription`,G=y.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=T(W,n);return(0,b.jsx)(c.p,{id:i.descriptionId,...r,ref:t})});G.displayName=W;var K=`DialogClose`,q=y.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=T(K,n);return(0,b.jsx)(c.button,{type:`button`,...r,ref:t,onClick:p(e.onClick,()=>i.onOpenChange(!1))})});q.displayName=K;function J(e){return e?`open`:`closed`}var Y=typeof document>`u`?y.useEffect:y.useLayoutEffect;function X(e){let t=e.activeElement;return!t||t===e.body||t===e.documentElement||!(`focus`in t)||typeof t.focus!=`function`?null:t}function Z(e,t){!e||!e.isConnected||e.ownerDocument!==t||e.focus({preventScroll:!0})}function Q({open:e,title:t,description:n,confirmLabel:r,confirmVariant:i=`danger`,onConfirm:a,onOpenChange:o}){let[s,c]=(0,y.useState)(!1),[l,u]=(0,y.useState)(null),d=(0,y.useRef)(null),f=(0,y.useRef)(!1);Y(()=>{e&&!f.current&&(d.current=X(document)),f.current=e},[e]),(0,y.useEffect)(()=>{e||(c(!1),u(null))},[e]);async function p(){c(!0),u(null);try{await a(),o(!1)}catch(e){u(e instanceof Error?e.message:String(e)),c(!1)}}return(0,b.jsx)(E,{open:e,onOpenChange:e=>{!e&&!s&&o(!1)},children:(0,b.jsxs)(M,{children:[(0,b.jsx)(P,{className:`fixed inset-0 z-50 bg-chocolate/35 backdrop-blur-[2px] data-[state=closed]:animate-out data-[state=open]:animate-in data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0`}),(0,b.jsxs)(R,{className:`fixed left-1/2 top-1/2 z-50 grid w-[calc(100%-2rem)] max-w-md -translate-x-1/2 -translate-y-1/2 gap-4 rounded-[16px] border border-frost bg-snow p-5 text-chocolate shadow-baziu-lg outline-none data-[state=closed]:animate-out data-[state=open]:animate-in data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95`,onCloseAutoFocus:e=>{e.preventDefault();let t=d.current;d.current=null,Z(t,document)},onEscapeKeyDown:e=>{s&&e.preventDefault()},onPointerDownOutside:e=>{s&&e.preventDefault()},children:[(0,b.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,b.jsx)(U,{className:`font-serif text-xl text-chocolate`,children:t}),(0,b.jsx)(G,{asChild:!0,children:(0,b.jsx)(`div`,{className:`text-sm leading-6 text-mocha`,children:n})})]}),l&&(0,b.jsx)(`p`,{role:`alert`,className:`rounded-md bg-danger/10 px-3 py-2 text-sm text-danger`,children:l}),(0,b.jsxs)(`div`,{className:`flex flex-col-reverse gap-2 border-t border-frost pt-4 sm:flex-row sm:justify-end`,children:[(0,b.jsx)(v,{variant:`ghost`,disabled:s,onClick:()=>o(!1),children:`cancel`}),(0,b.jsx)(v,{variant:i,disabled:s,onClick:()=>void p(),children:s?`working…`:r})]})]})]})})}export{G as a,U as c,R as i,E as n,P as o,q as r,M as s,Q as t};
1
+ import{r as e,t}from"./jsx-runtime-DGeXAQPT.js";import{t as n}from"./react-3W8R1pOO.js";import{$ as r,Q as i,X as a,Z as o,at as s,ct as c,dt as l,et as u,it as d,nt as f,ot as p,rt as m,st as h,tt as g,ut as _}from"./index-CwMw0pnV.js";import{t as v}from"./Button-ByiV6fpd.js";var y=e(n(),1),b=t(),x=`Dialog`,[S,C]=h(x),[w,T]=S(x),E=e=>{let{__scopeDialog:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!0}=e,c=y.useRef(null),l=y.useRef(null),[u,d]=s({prop:r,defaultProp:i??!1,onChange:a,caller:x});return(0,b.jsx)(w,{scope:t,triggerRef:c,contentRef:l,contentId:m(),titleId:m(),descriptionId:m(),open:u,onOpenChange:d,onOpenToggle:y.useCallback(()=>d(e=>!e),[d]),modal:o,children:n})};E.displayName=x;var D=`DialogTrigger`,O=y.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=T(D,n),a=l(t,i.triggerRef);return(0,b.jsx)(c.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":J(i.open),...r,ref:a,onClick:p(e.onClick,i.onOpenToggle)})});O.displayName=D;var k=`DialogPortal`,[A,j]=S(k,{forceMount:void 0}),M=e=>{let{__scopeDialog:t,forceMount:n,children:i,container:a}=e,o=T(k,t);return(0,b.jsx)(A,{scope:t,forceMount:n,children:y.Children.map(i,e=>(0,b.jsx)(d,{present:n||o.open,children:(0,b.jsx)(r,{asChild:!0,container:a,children:e})}))})};M.displayName=k;var N=`DialogOverlay`,P=y.forwardRef((e,t)=>{let n=j(N,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=T(N,e.__scopeDialog);return a.modal?(0,b.jsx)(d,{present:r||a.open,children:(0,b.jsx)(I,{...i,ref:t})}):null});P.displayName=N;var F=_(`DialogOverlay.RemoveScroll`),I=y.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=T(N,n),a=l(t,f());return(0,b.jsx)(o,{as:F,allowPinchZoom:!0,shards:[i.contentRef],children:(0,b.jsx)(c.div,{"data-state":J(i.open),...r,ref:a,style:{pointerEvents:`auto`,...r.style}})})}),L=`DialogContent`,R=y.forwardRef((e,t)=>{let n=j(L,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=T(L,e.__scopeDialog);return(0,b.jsx)(d,{present:r||a.open,children:a.modal?(0,b.jsx)(z,{...i,ref:t}):(0,b.jsx)(B,{...i,ref:t})})});R.displayName=L;var z=y.forwardRef((e,t)=>{let n=T(L,e.__scopeDialog),r=y.useRef(null),i=l(t,n.contentRef,r);return y.useEffect(()=>{let e=r.current;if(e)return a(e)},[]),(0,b.jsx)(V,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,onCloseAutoFocus:p(e.onCloseAutoFocus,e=>{e.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:p(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0;(t.button===2||n)&&e.preventDefault()}),onFocusOutside:p(e.onFocusOutside,e=>e.preventDefault())})}),B=y.forwardRef((e,t)=>{let n=T(L,e.__scopeDialog),r=y.useRef(!1),i=y.useRef(!1);return(0,b.jsx)(V,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})}),V=y.forwardRef((e,t)=>{let{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:a,onCloseAutoFocus:o,...s}=e,c=T(L,n);return i(),(0,b.jsx)(b.Fragment,{children:(0,b.jsx)(u,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:a,onUnmountAutoFocus:o,children:(0,b.jsx)(g,{role:`dialog`,id:c.contentId,"aria-describedby":c.descriptionId,"aria-labelledby":c.titleId,"data-state":J(c.open),...s,ref:t,deferPointerDownOutside:!0,onDismiss:()=>c.onOpenChange(!1)})})})}),H=`DialogTitle`,U=y.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=T(H,n);return(0,b.jsx)(c.h2,{id:i.titleId,...r,ref:t})});U.displayName=H;var W=`DialogDescription`,G=y.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=T(W,n);return(0,b.jsx)(c.p,{id:i.descriptionId,...r,ref:t})});G.displayName=W;var K=`DialogClose`,q=y.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=T(K,n);return(0,b.jsx)(c.button,{type:`button`,...r,ref:t,onClick:p(e.onClick,()=>i.onOpenChange(!1))})});q.displayName=K;function J(e){return e?`open`:`closed`}var Y=typeof document>`u`?y.useEffect:y.useLayoutEffect;function X(e){let t=e.activeElement;return!t||t===e.body||t===e.documentElement||!(`focus`in t)||typeof t.focus!=`function`?null:t}function Z(e,t){!e||!e.isConnected||e.ownerDocument!==t||e.focus({preventScroll:!0})}function Q({open:e,title:t,description:n,confirmLabel:r,confirmVariant:i=`danger`,onConfirm:a,onOpenChange:o}){let[s,c]=(0,y.useState)(!1),[l,u]=(0,y.useState)(null),d=(0,y.useRef)(null),f=(0,y.useRef)(!1);Y(()=>{e&&!f.current&&(d.current=X(document)),f.current=e},[e]),(0,y.useEffect)(()=>{e||(c(!1),u(null))},[e]);async function p(){c(!0),u(null);try{await a(),o(!1)}catch(e){u(e instanceof Error?e.message:String(e)),c(!1)}}return(0,b.jsx)(E,{open:e,onOpenChange:e=>{!e&&!s&&o(!1)},children:(0,b.jsxs)(M,{children:[(0,b.jsx)(P,{className:`fixed inset-0 z-50 bg-chocolate/35 backdrop-blur-[2px] data-[state=closed]:animate-out data-[state=open]:animate-in data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0`}),(0,b.jsxs)(R,{className:`fixed left-1/2 top-1/2 z-50 grid w-[calc(100%-2rem)] max-w-md -translate-x-1/2 -translate-y-1/2 gap-4 rounded-[16px] border border-frost bg-snow p-5 text-chocolate shadow-baziu-lg outline-none data-[state=closed]:animate-out data-[state=open]:animate-in data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95`,onCloseAutoFocus:e=>{e.preventDefault();let t=d.current;d.current=null,Z(t,document)},onEscapeKeyDown:e=>{s&&e.preventDefault()},onPointerDownOutside:e=>{s&&e.preventDefault()},children:[(0,b.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,b.jsx)(U,{className:`font-serif text-xl text-chocolate`,children:t}),(0,b.jsx)(G,{asChild:!0,children:(0,b.jsx)(`div`,{className:`text-sm leading-6 text-mocha`,children:n})})]}),l&&(0,b.jsx)(`p`,{role:`alert`,className:`rounded-md bg-danger/10 px-3 py-2 text-sm text-danger`,children:l}),(0,b.jsxs)(`div`,{className:`flex flex-col-reverse gap-2 border-t border-frost pt-4 sm:flex-row sm:justify-end`,children:[(0,b.jsx)(v,{variant:`ghost`,disabled:s,onClick:()=>o(!1),children:`cancel`}),(0,b.jsx)(v,{variant:i,disabled:s,onClick:()=>void p(),children:s?`working…`:r})]})]})]})})}export{G as a,U as c,R as i,E as n,P as o,q as r,M as s,Q as t};
@@ -1 +1 @@
1
- import{r as e,t}from"./jsx-runtime-DGeXAQPT.js";import{t as n}from"./react-3W8R1pOO.js";import{d as r}from"./preload-helper-bztXdkDj.js";import{t as i}from"./ConfirmDialog-C908TxS5.js";import{t as a}from"./Button-ByiV6fpd.js";var o=e(n(),1),s=t();function c({field:e}){let t=r(),n=(0,o.useId)(),c=`${n}-description`,[l,u]=(0,o.useState)(e.kind===`config`?e.value??``:``),[d,f]=(0,o.useState)(!1),[p,m]=(0,o.useState)(null),[h,g]=(0,o.useState)(null),[_,v]=(0,o.useState)(!1),y=e.kind===`secret`&&l.trim().length===0;async function b(n){if(n.preventDefault(),y){m(e.set?`Paste a replacement value, or use remove credential to explicitly clear the stored secret.`:`A secret value is required.`);return}f(!0),m(null);try{let n=await fetch(`/api/config/fields/${encodeURIComponent(e.envVar)}`,{method:`PUT`,headers:{"content-type":`application/json`},body:JSON.stringify({value:l})});if(!n.ok){let e=await n.json().catch(()=>({}));throw Error(e.error??`${n.status} ${n.statusText}`)}g(Date.now()),e.kind===`secret`&&u(``),await t.invalidate()}catch(e){m(e.message)}finally{f(!1)}}async function x(){let n=await fetch(`/api/config/fields/${encodeURIComponent(e.envVar)}`,{method:`DELETE`});if(!n.ok&&n.status!==204){let e=await n.json().catch(()=>null);throw Error(e?.error??`${n.status} ${n.statusText}`)}u(``),m(null),g(Date.now()),await t.invalidate()}return(0,s.jsxs)(`form`,{onSubmit:b,className:`grid grid-cols-1 gap-2 border-b py-3 last:border-0 md:grid-cols-[12rem_minmax(0,1fr)_auto_auto] md:items-center`,children:[(0,s.jsxs)(`div`,{className:`min-w-0`,children:[(0,s.jsx)(`label`,{htmlFor:n,className:`text-sm font-medium text-foreground`,children:e.label}),e.description&&(0,s.jsx)(`div`,{id:c,className:`text-xs text-muted-foreground mt-0.5`,children:e.description}),(0,s.jsxs)(`details`,{className:`mt-1 text-xs text-muted-foreground`,children:[(0,s.jsx)(`summary`,{className:`cursor-pointer`,children:`Advanced identifier`}),(0,s.jsx)(`code`,{className:`mt-1 inline-block break-all font-mono`,children:e.envVar})]})]}),(0,s.jsx)(`div`,{className:`min-w-0`,children:e.kind===`config`?(0,s.jsx)(`input`,{id:n,type:`text`,"aria-describedby":e.description?c:void 0,value:l,onChange:e=>u(e.target.value),placeholder:e.placeholder??``,className:`w-full rounded-md border bg-background px-2 py-1.5 text-sm outline-none focus:ring-2 focus:ring-ring/30`}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(`input`,{id:n,type:`password`,"aria-describedby":e.description?c:void 0,value:l,onChange:e=>u(e.target.value),placeholder:e.set?`(paste to replace stored value)`:e.placeholder??`paste key…`,autoComplete:`off`,className:`w-full rounded-md border bg-background px-2 py-1.5 text-sm outline-none focus:ring-2 focus:ring-ring/30`}),e.set&&(0,s.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:`Blank keeps the current credential. Removal is a separate explicit action.`})]})}),(0,s.jsxs)(`span`,{className:`text-xs`,children:[e.kind===`secret`&&e.set&&(0,s.jsx)(`span`,{className:`rounded-full bg-success/10 text-success px-1.5 py-0.5`,title:`preview: ${e.preview??``}`,children:`set`}),h&&Date.now()-h<2e3&&(0,s.jsx)(`span`,{role:`status`,className:`text-success ml-2`,children:`saved ✓`})]}),(0,s.jsxs)(`div`,{className:`flex flex-wrap gap-2 md:justify-self-end`,children:[(0,s.jsx)(a,{variant:`ghost`,type:`submit`,disabled:d||y,className:`text-xs`,children:`save`}),e.kind===`secret`&&e.set&&(0,s.jsx)(a,{variant:`danger`,className:`text-xs`,onClick:()=>v(!0),children:`remove`})]}),p&&(0,s.jsx)(`p`,{role:`alert`,className:`text-xs text-danger md:col-span-4`,children:p}),(0,s.jsx)(i,{open:_,title:`Remove ${e.label}?`,description:(0,s.jsxs)(`p`,{children:[`This permanently deletes the stored `,(0,s.jsx)(`code`,{className:`font-mono`,children:e.envVar}),` `,`credential. Features that use it will fail until you save a replacement.`]}),confirmLabel:`remove stored credential`,onConfirm:x,onOpenChange:v})]})}export{c as t};
1
+ import{r as e,t}from"./jsx-runtime-DGeXAQPT.js";import{t as n}from"./react-3W8R1pOO.js";import{d as r}from"./preload-helper-bztXdkDj.js";import{t as i}from"./ConfirmDialog-Br19uXWH.js";import{t as a}from"./Button-ByiV6fpd.js";var o=e(n(),1),s=t();function c({field:e}){let t=r(),n=(0,o.useId)(),c=`${n}-description`,[l,u]=(0,o.useState)(e.kind===`config`?e.value??``:``),[d,f]=(0,o.useState)(!1),[p,m]=(0,o.useState)(null),[h,g]=(0,o.useState)(null),[_,v]=(0,o.useState)(!1),y=e.kind===`secret`&&l.trim().length===0;async function b(n){if(n.preventDefault(),y){m(e.set?`Paste a replacement value, or use remove credential to explicitly clear the stored secret.`:`A secret value is required.`);return}f(!0),m(null);try{let n=await fetch(`/api/config/fields/${encodeURIComponent(e.envVar)}`,{method:`PUT`,headers:{"content-type":`application/json`},body:JSON.stringify({value:l})});if(!n.ok){let e=await n.json().catch(()=>({}));throw Error(e.error??`${n.status} ${n.statusText}`)}g(Date.now()),e.kind===`secret`&&u(``),await t.invalidate()}catch(e){m(e.message)}finally{f(!1)}}async function x(){let n=await fetch(`/api/config/fields/${encodeURIComponent(e.envVar)}`,{method:`DELETE`});if(!n.ok&&n.status!==204){let e=await n.json().catch(()=>null);throw Error(e?.error??`${n.status} ${n.statusText}`)}u(``),m(null),g(Date.now()),await t.invalidate()}return(0,s.jsxs)(`form`,{onSubmit:b,className:`grid grid-cols-1 gap-2 border-b py-3 last:border-0 md:grid-cols-[12rem_minmax(0,1fr)_auto_auto] md:items-center`,children:[(0,s.jsxs)(`div`,{className:`min-w-0`,children:[(0,s.jsx)(`label`,{htmlFor:n,className:`text-sm font-medium text-foreground`,children:e.label}),e.description&&(0,s.jsx)(`div`,{id:c,className:`text-xs text-muted-foreground mt-0.5`,children:e.description}),(0,s.jsxs)(`details`,{className:`mt-1 text-xs text-muted-foreground`,children:[(0,s.jsx)(`summary`,{className:`cursor-pointer`,children:`Advanced identifier`}),(0,s.jsx)(`code`,{className:`mt-1 inline-block break-all font-mono`,children:e.envVar})]})]}),(0,s.jsx)(`div`,{className:`min-w-0`,children:e.kind===`config`?(0,s.jsx)(`input`,{id:n,type:`text`,"aria-describedby":e.description?c:void 0,value:l,onChange:e=>u(e.target.value),placeholder:e.placeholder??``,className:`w-full rounded-md border bg-background px-2 py-1.5 text-sm outline-none focus:ring-2 focus:ring-ring/30`}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(`input`,{id:n,type:`password`,"aria-describedby":e.description?c:void 0,value:l,onChange:e=>u(e.target.value),placeholder:e.set?`(paste to replace stored value)`:e.placeholder??`paste key…`,autoComplete:`off`,className:`w-full rounded-md border bg-background px-2 py-1.5 text-sm outline-none focus:ring-2 focus:ring-ring/30`}),e.set&&(0,s.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:`Blank keeps the current credential. Removal is a separate explicit action.`})]})}),(0,s.jsxs)(`span`,{className:`text-xs`,children:[e.kind===`secret`&&e.set&&(0,s.jsx)(`span`,{className:`rounded-full bg-success/10 text-success px-1.5 py-0.5`,title:`preview: ${e.preview??``}`,children:`set`}),h&&Date.now()-h<2e3&&(0,s.jsx)(`span`,{role:`status`,className:`text-success ml-2`,children:`saved ✓`})]}),(0,s.jsxs)(`div`,{className:`flex flex-wrap gap-2 md:justify-self-end`,children:[(0,s.jsx)(a,{variant:`ghost`,type:`submit`,disabled:d||y,className:`text-xs`,children:`save`}),e.kind===`secret`&&e.set&&(0,s.jsx)(a,{variant:`danger`,className:`text-xs`,onClick:()=>v(!0),children:`remove`})]}),p&&(0,s.jsx)(`p`,{role:`alert`,className:`text-xs text-danger md:col-span-4`,children:p}),(0,s.jsx)(i,{open:_,title:`Remove ${e.label}?`,description:(0,s.jsxs)(`p`,{children:[`This permanently deletes the stored `,(0,s.jsx)(`code`,{className:`font-mono`,children:e.envVar}),` `,`credential. Features that use it will fail until you save a replacement.`]}),confirmLabel:`remove stored credential`,onConfirm:x,onOpenChange:v})]})}export{c as t};