bazilion 0.14.1 → 0.14.2

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 (48) hide show
  1. package/README.md +2 -1
  2. package/dist/cli.js +4 -4
  3. package/dist/cli.js.map +1 -1
  4. package/dist/web/client/assets/{ConfirmDialog-BAiyYC8w.js → ConfirmDialog-_bmG-wVG.js} +1 -1
  5. package/dist/web/client/assets/{FieldRow-DsWhqiIQ.js → FieldRow-Do1cBkRc.js} +1 -1
  6. package/dist/web/client/assets/{ProductionTeamPolicyEditor-CHBKZMpY.js → ProductionTeamPolicyEditor-XP-QJul4.js} +1 -1
  7. package/dist/web/client/assets/{ProfileCommunicationEditor-DZ8yTQvV.js → ProfileCommunicationEditor-CwdFPdpk.js} +1 -1
  8. package/dist/web/client/assets/{TeamTabs-BfC1pfQe.js → TeamTabs-DIRiKcqx.js} +1 -1
  9. package/dist/web/client/assets/{TemplatesTabs-BwsLjN0Q.js → TemplatesTabs-D4WHvs6b.js} +1 -1
  10. package/dist/web/client/assets/{UnsavedChangesGuard-C7U9rsPw.js → UnsavedChangesGuard-B1aLqiK5.js} +1 -1
  11. package/dist/web/client/assets/{_id-CG9YM1tY.js → _id-3w4PFfma.js} +1 -1
  12. package/dist/web/client/assets/{_id-DtHL-U-0.js → _id-BH3v_vI_.js} +1 -1
  13. package/dist/web/client/assets/{_id-J0kM-98d.js → _id-Cx7o4Zmf.js} +1 -1
  14. package/dist/web/client/assets/{_id-DfzTSFBA.js → _id-DIiVVxBl.js} +1 -1
  15. package/dist/web/client/assets/{activity-CBQGMwWo.js → activity-A_HrG1Tv.js} +1 -1
  16. package/dist/web/client/assets/{agents-BWGBjF2Y.js → agents-BeeFCt2c.js} +1 -1
  17. package/dist/web/client/assets/{agents-DTY5RXgO.js → agents-C8OVKq3N.js} +1 -1
  18. package/dist/web/client/assets/{approvals-DwMk9S4Z.js → approvals-BIdZ9BSn.js} +1 -1
  19. package/dist/web/client/assets/{attention-7qYFtwOW.js → attention-B9bUrxiU.js} +1 -1
  20. package/dist/web/client/assets/chevron-right-VWrk_dTX.js +1 -0
  21. package/dist/web/client/assets/{config-D59MT3Y5.js → config-By86S7k-.js} +2 -2
  22. package/dist/web/client/assets/{inbox-CpKuNfOj.js → inbox-DlXQCJLe.js} +1 -1
  23. package/dist/web/client/assets/{index-BVfpuiby.js → index-CLdmsmiN.js} +2 -2
  24. package/dist/web/client/assets/{learning-631_q6a9.js → learning-BqZIw2nA.js} +1 -1
  25. package/dist/web/client/assets/{login-JjfTCGIb.js → login-CCMPXiny.js} +1 -1
  26. package/dist/web/client/assets/{mcp-DHgUOUPG.js → mcp-DKSY2yVa.js} +1 -1
  27. package/dist/web/client/assets/{members-CLCUdo-h.js → members-9GuOiq6J.js} +1 -1
  28. package/dist/web/client/assets/{memory-paAiM6ix.js → memory-DiGMI6FC.js} +1 -1
  29. package/dist/web/client/assets/{policy-Fy_Wnq6p.js → policy-TBGQffw5.js} +1 -1
  30. package/dist/web/client/assets/{routes-DciiC6QA.js → routes-g3yUOhCb.js} +1 -1
  31. package/dist/web/client/assets/{services-i_RmJYAO.js → services-1Z398CES.js} +1 -1
  32. package/dist/web/client/assets/{skills-BX42OGpp.js → skills-BP2gciFt.js} +1 -1
  33. package/dist/web/client/assets/{teams-4ySkP31k.js → teams-DBIivGT7.js} +1 -1
  34. package/dist/web/client/assets/{teams-D6nIPyC0.js → teams-tNoMDJ_M.js} +1 -1
  35. package/dist/web/client/assets/{telegram-CphoIRWP.js → telegram-CJG_DFdI.js} +1 -1
  36. package/dist/web/client/assets/{tokens-2j3NQudt.js → tokens-eDWCGQQ2.js} +1 -1
  37. package/dist/web/client/assets/{triggers-sDA075Nu.js → triggers-DZME3IcK.js} +1 -1
  38. package/dist/web/client/assets/{welcome-Do427w4M.js → welcome-B49sh_uf.js} +1 -1
  39. package/dist/web/client/assets/{wire-constants-B7b2CQp1.js → wire-constants-zZ7Wjb9C.js} +1 -1
  40. package/dist/web/client/assets/{x-CbAF-3_T.js → x-CHc7_-TH.js} +1 -1
  41. package/dist/web/server/assets/{_tanstack-start-manifest_v-DR7wyKcH.js → _tanstack-start-manifest_v-Duhf0z7H.js} +72 -72
  42. package/dist/web/server/assets/{config-XSTLuRaT.js → config-BmLq53tq.js} +3 -3
  43. package/dist/web/server/assets/{config-DQ8n0AwF.js → config-Wy6hnZ-Z.js} +1 -1
  44. package/dist/web/server/assets/{router-M0lutIDA.js → router-CY_pCgP1.js} +2 -2
  45. package/dist/web/server/assets/{welcome-B8nchXdF.js → welcome-BdQGR68o.js} +1 -1
  46. package/dist/web/server/server.js +2 -2
  47. package/package.json +6 -6
  48. package/dist/web/client/assets/chevron-right-DK703skW.js +0 -1
@@ -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-BAiyYC8w.js";import{o as a}from"./index-BVfpuiby.js";import{t as o}from"./Button-ByiV6fpd.js";import{t as s}from"./ConfigPage-BCLp-FUC.js";var c=e(n()),l=t();function u(){let e=a.useLoaderData(),t=r(),[n,u]=(0,c.useState)(``),[g,_]=(0,c.useState)(e.chatId),[v,y]=(0,c.useState)(!1),[b,x]=(0,c.useState)(null),[S,C]=(0,c.useState)(!1),[w,T]=(0,c.useState)(!1),[E,D]=(0,c.useState)(null),[O,k]=(0,c.useState)(!1);async function A(r){if(r.preventDefault(),e.configured&&n.trim().length===0){C(!1),x(g.trim()===e.chatId?`Nothing changed. Paste a replacement token to update credentials.`:`Paste the bot token again when changing the supergroup, so the existing secret is never cleared or reused silently.`);return}y(!0),x(null),C(!1);try{let e=await fetch(`/api/config/telegram`,{method:`PUT`,headers:{"content-type":`application/json`},body:JSON.stringify({botToken:n,chatId:g})});if(!e.ok){let t=await e.json().catch(()=>({}));throw Error(t.error??`${e.status} ${e.statusText}`)}u(``),C(!0),await t.invalidate()}catch(e){x(e.message)}finally{y(!1)}}async function j(){let e=await fetch(`/api/config/telegram`,{method:`DELETE`});if(!e.ok&&e.status!==204){let t=await e.json().catch(()=>null);throw Error(t?.error??`Could not clear Telegram credentials (${e.status})`)}u(``),_(``),D(null),C(!1),x(null),await t.invalidate()}async function M(){k(!0),D(null);try{D(await(await fetch(`/api/config/telegram/health`)).json())}catch(e){D({configured:!0,preflight:null,error:{step:`getMe`,message:e.message},polling:null})}finally{k(!1)}}return(0,l.jsxs)(s,{active:`integrations`,title:`Telegram`,description:`Connect one forum-supergroup bot with one topic per agent, so conversations stay reachable from your phone.`,size:`narrow`,children:[e.migratedChatId&&(0,l.jsx)(p,{toChatId:e.migratedChatId}),(0,l.jsxs)(`section`,{className:`rounded-lg border bg-card p-5`,children:[(0,l.jsx)(`h3`,{className:`text-sm font-semibold uppercase tracking-wide text-muted-foreground mb-3`,children:`Credentials`}),e.configured&&(0,l.jsxs)(`p`,{className:`text-xs text-success mb-3`,children:[`✓ Stored: `,(0,l.jsx)(`code`,{className:`font-mono`,children:e.botTokenPreview}),` `,e.chatId&&(0,l.jsxs)(l.Fragment,{children:[`· chat `,(0,l.jsx)(`code`,{className:`font-mono`,children:e.chatId})]})]}),(0,l.jsxs)(`form`,{onSubmit:A,className:`space-y-3`,children:[(0,l.jsxs)(`label`,{className:`block`,children:[(0,l.jsx)(`span`,{className:`block text-sm font-medium mb-1`,children:`Bot token`}),(0,l.jsx)(`input`,{type:`password`,autoComplete:`off`,value:n,onChange:e=>{u(e.target.value),x(null)},placeholder:e.configured?`(leave blank to keep stored value)`:`1234567890:ABC...`,className:`w-full rounded-md border bg-background px-2 py-1.5 font-mono text-sm outline-none focus:ring-2 focus:ring-ring/30`,required:!e.configured}),(0,l.jsxs)(`p`,{className:`text-xs text-muted-foreground mt-1`,children:[`From @BotFather → /newbot. Disable Privacy Mode in `,(0,l.jsx)(`em`,{children:`Bot Settings → Team Privacy → Turn off`}),`.`]}),e.configured&&(0,l.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:`Blank preserves the stored token. To remove it, use clear credentials and confirm the integration shutdown.`})]}),(0,l.jsxs)(`label`,{className:`block`,children:[(0,l.jsx)(`span`,{className:`block text-sm font-medium mb-1`,children:`Supergroup chat ID`}),(0,l.jsx)(`input`,{type:`text`,value:g,onChange:e=>{_(e.target.value),x(null)},placeholder:`-1001234567890`,className:`w-full rounded-md border bg-background px-2 py-1.5 font-mono text-sm outline-none focus:ring-2 focus:ring-ring/30`,required:!0}),(0,l.jsxs)(`p`,{className:`text-xs text-muted-foreground mt-1`,children:[`Forum-enabled supergroup the bot is admin in (with`,` `,(0,l.jsx)(`code`,{className:`font-mono`,children:`can_manage_topics`}),`).`]})]}),(0,l.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3 pt-1`,children:[(0,l.jsx)(o,{variant:`primary`,type:`submit`,disabled:v,children:v?`saving…`:`save credentials`}),e.configured&&(0,l.jsx)(o,{variant:`danger`,onClick:()=>T(!0),children:`clear credentials`}),S&&(0,l.jsx)(`span`,{className:`text-xs text-success`,children:`saved ✓`}),b&&(0,l.jsxs)(`span`,{role:`alert`,className:`text-xs text-danger`,children:[`error: `,b]})]})]})]}),(0,l.jsxs)(`section`,{className:`rounded-lg border bg-card p-5`,children:[(0,l.jsxs)(`div`,{className:`mb-3 flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between`,children:[(0,l.jsx)(`h3`,{className:`text-sm font-semibold uppercase tracking-wide text-muted-foreground`,children:`Preflight checks`}),(0,l.jsx)(o,{variant:`ghost`,onClick:M,disabled:O||!e.configured,children:O?`checking…`:`run preflight`})]}),!e.configured&&(0,l.jsx)(`p`,{className:`text-xs text-muted-foreground italic`,children:`Save credentials above first.`}),e.configured&&!E&&!O&&(0,l.jsxs)(`p`,{className:`text-xs text-muted-foreground italic`,children:[`Click `,(0,l.jsx)(`em`,{children:`run preflight`}),` to validate the stored credentials against the Telegram Bot API.`]}),E&&(0,l.jsx)(h,{health:E}),E?.polling&&(0,l.jsx)(m,{polling:E.polling})]}),e.configured&&(0,l.jsx)(d,{}),e.configured&&(0,l.jsx)(f,{}),(0,l.jsx)(i,{open:w,title:`Disconnect Telegram?`,description:(0,l.jsx)(`p`,{children:`This permanently removes the saved bot token and supergroup ID. Telegram polling, ingress, and outbound delivery stop until new credentials are saved and pairing is completed again.`}),confirmLabel:`clear credentials and disconnect`,onConfirm:async()=>{try{await j()}catch(e){throw x(e instanceof Error?e.message:String(e)),e}},onOpenChange:T})]})}function d(){let[e,t]=(0,c.useState)(null),[n,r]=(0,c.useState)(null),[a,s]=(0,c.useState)(null),[u,d]=(0,c.useState)(!1),f=async()=>{let e=await fetch(`/api/config/telegram/pairing`);if(!e.ok)throw Error(e.statusText);t(await e.json())};(0,c.useEffect)(()=>{f().catch(e=>s(e.message))},[]);async function p(){s(null);let e=await fetch(`/api/config/telegram/pairing/challenge`,{method:`POST`}),n=await e.json().catch(()=>({}));if(!e.ok||!n.code)return s(n.error??e.statusText);r(n.code),t(n)}async function m(){let e=await fetch(`/api/config/telegram/pairing/challenge`,{method:`DELETE`});if(!e.ok&&e.status!==204){let t=await e.json().catch(()=>null);throw Error(t?.error??`Could not cancel the pairing code`)}r(null),await f()}async function h(){let e=await fetch(`/api/config/telegram/pairing/reset`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({confirm:!0})});if(!e.ok){let t=await e.json().catch(()=>null);throw Error(t?.error??`Could not reset Telegram owner`)}r(null),await f()}return(0,l.jsxs)(`section`,{className:`rounded-lg border bg-card p-5`,children:[(0,l.jsx)(`h3`,{className:`text-sm font-semibold uppercase tracking-wide text-muted-foreground mb-1`,children:`Owner pairing`}),(0,l.jsxs)(`p`,{className:`text-xs text-muted-foreground mb-3`,children:[`Telegram stays closed until one owner consumes a short-lived code in the configured`,` `,(0,l.jsx)(`code`,{className:`font-mono`,children:`⚙ bazilion`}),` service topic.`]}),e?.paired?(0,l.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,l.jsx)(`span`,{className:`text-sm text-success`,children:`✓ owner paired`}),(0,l.jsx)(o,{variant:`danger`,onClick:()=>d(!0),children:`reset owner`})]}):(0,l.jsxs)(`div`,{className:`space-y-2`,children:[(0,l.jsx)(`p`,{className:`text-sm text-warning`,children:`Unpaired — all Telegram ingress is closed.`}),n?(0,l.jsxs)(`div`,{className:`rounded-md border bg-muted/30 p-3 text-sm`,children:[`Send `,(0,l.jsxs)(`code`,{className:`font-mono`,children:[`/pair `,n]}),` in the service topic. This code is shown once and expires in ten minutes.`]}):null,(0,l.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,l.jsx)(o,{variant:`primary`,onClick:p,children:`generate pairing code`}),e?.challengeActive&&(0,l.jsx)(o,{variant:`ghost`,onClick:()=>void m().catch(e=>s(e instanceof Error?e.message:String(e))),children:`cancel code`})]})]}),a&&(0,l.jsx)(`p`,{role:`alert`,className:`mt-2 text-xs text-danger`,children:a}),(0,l.jsx)(i,{open:u,title:`Revoke the paired Telegram owner?`,description:(0,l.jsx)(`p`,{children:`This immediately revokes the current owner and closes all Telegram ingress. No one can use the bot until a new one-time pairing code is generated and consumed.`}),confirmLabel:`revoke owner and close ingress`,onConfirm:async()=>{try{await h()}catch(e){throw s(e instanceof Error?e.message:String(e)),e}},onOpenChange:d})]})}function f(){let[e,t]=(0,c.useState)(null),[n,r]=(0,c.useState)(``),[a,s]=(0,c.useState)(``),[u,d]=(0,c.useState)(!1),[f,p]=(0,c.useState)(null),[m,h]=(0,c.useState)(null);async function g(){try{let e=await fetch(`/api/config/telegram/acl`);if(!e.ok)throw Error(e.statusText);t(await e.json())}catch(e){p(e.message)}}(0,c.useEffect)(()=>{g()},[]);async function _(e){e.preventDefault();let t=Number(n);if(!Number.isInteger(t)){p(`user id must be an integer`);return}d(!0),p(null);try{let e=await fetch(`/api/config/telegram/acl`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({userId:t,label:a.trim()||null})});if(!e.ok){let t=await e.json().catch(()=>({}));throw Error(t.error??e.statusText)}r(``),s(``),await g()}catch(e){p(e.message)}finally{d(!1)}}async function v(e){p(null);let t=await fetch(`/api/config/telegram/acl/${e}`,{method:`DELETE`});if(!t.ok){let e=await t.json().catch(()=>({}));throw Error(e.error??t.statusText)}await g()}return(0,l.jsxs)(`section`,{className:`rounded-lg border bg-card p-5`,children:[(0,l.jsx)(`h3`,{className:`text-sm font-semibold uppercase tracking-wide text-muted-foreground mb-1`,children:`Access control`}),(0,l.jsxs)(`p`,{className:`text-xs text-muted-foreground mb-3`,children:[`Allowlisted Telegram users can use the bot (commands + chat). An empty list is closed; ownership begins only through the one-time pairing flow. Users find their id via`,` `,(0,l.jsx)(`code`,{className:`font-mono`,children:`/whoami`}),`.`]}),e===null?(0,l.jsx)(`p`,{className:`text-xs text-muted-foreground italic`,children:`loading…`}):e.length===0?(0,l.jsx)(`p`,{className:`text-xs text-warning mb-3`,children:`Closed — no paired owner or allowlisted members.`}):(0,l.jsx)(`ul`,{className:`mb-3 space-y-1 text-sm`,children:e.map(e=>(0,l.jsxs)(`li`,{className:`flex flex-wrap items-center gap-2`,children:[(0,l.jsx)(`code`,{className:`font-mono`,children:e.userId}),(0,l.jsxs)(`span`,{className:`text-muted-foreground`,children:[e.label??(e.username?`@${e.username}`:`—`),` · `,e.role]}),e.role!==`owner`&&(0,l.jsx)(o,{variant:`danger`,className:`text-xs`,onClick:()=>h(e),children:`remove`})]},e.userId))}),(0,l.jsxs)(`form`,{onSubmit:_,className:`flex flex-col gap-2 sm:flex-row sm:flex-wrap sm:items-end`,children:[(0,l.jsxs)(`label`,{className:`m-0 flex flex-col gap-1 text-xs font-medium text-foreground`,children:[`Telegram user ID`,(0,l.jsx)(`input`,{value:n,onChange:e=>r(e.target.value),placeholder:`123456789`,inputMode:`numeric`,className:`w-full rounded-md border bg-background px-2 py-1 font-mono text-sm sm:w-32`})]}),(0,l.jsxs)(`label`,{className:`m-0 flex flex-col gap-1 text-xs font-medium text-foreground`,children:[`Label `,(0,l.jsx)(`span`,{className:`font-normal text-muted-foreground`,children:`(optional)`}),(0,l.jsx)(`input`,{value:a,onChange:e=>s(e.target.value),placeholder:`e.g. Pat`,className:`w-full rounded-md border bg-background px-2 py-1 text-sm sm:w-40`})]}),(0,l.jsx)(o,{variant:`ghost`,type:`submit`,disabled:u,children:`add`}),f&&(0,l.jsx)(`span`,{role:`alert`,className:`text-xs text-danger`,children:f})]}),(0,l.jsx)(i,{open:m!==null,title:`Remove ${m?.label??m?.username??m?.userId??``}?`,description:(0,l.jsxs)(`p`,{children:[`Telegram user `,(0,l.jsx)(`code`,{className:`font-mono`,children:m?.userId}),` immediately loses command and chat access. Their Telegram account is not changed, and they can be allowlisted again later.`]}),confirmLabel:`remove Telegram access`,onConfirm:async()=>{if(m)try{await v(m.userId)}catch(e){throw p(e instanceof Error?e.message:String(e)),e}},onOpenChange:e=>{e||h(null)}})]})}function p({toChatId:e}){let[t,n]=(0,c.useState)(!1),[r,i]=(0,c.useState)(null);async function a(){n(!0),i(null);try{let e=await fetch(`/api/config/telegram/reconnect`,{method:`POST`});if(!e.ok){let t=await e.json().catch(()=>({}));throw Error(t.error??e.statusText)}window.location.reload()}catch(e){i(e.message),n(!1)}}return(0,l.jsxs)(`div`,{className:`rounded-md border-2 border-danger/25 bg-danger/10 px-4 py-3 text-sm`,children:[(0,l.jsx)(`div`,{className:`font-semibold text-danger mb-1`,children:`Supergroup chat id changed`}),(0,l.jsxs)(`p`,{className:`text-danger mb-2`,children:[`Telegram migrated this supergroup to a new chat id (`,(0,l.jsx)(`code`,{className:`font-mono`,children:e}),`). The bot is still pointed at the old id. Reconnect to repoint it and re-create the `,(0,l.jsx)(`code`,{className:`font-mono`,children:`⚙ bazilion`}),` `,`service chat in the new team. Agent topic bindings will reconcile on next use.`]}),(0,l.jsx)(o,{variant:`primary`,onClick:a,disabled:t,children:t?`reconnecting…`:`Reconnect to ${e}`}),r&&(0,l.jsx)(`span`,{role:`alert`,className:`ml-3 text-xs text-danger`,children:r})]})}function m({polling:e}){let t=e.startedAt?new Date(e.startedAt).toISOString():null,n=e.lastSuccessfulPollAt?new Date(e.lastSuccessfulPollAt).toISOString():null;return(0,l.jsxs)(`div`,{className:`mt-4 rounded-md border bg-muted/30 px-3 py-2 text-xs space-y-1`,children:[(0,l.jsx)(`p`,{className:`font-semibold uppercase tracking-wide text-muted-foreground`,children:`Polling state`}),(0,l.jsxs)(`div`,{className:`flex flex-wrap gap-x-4 gap-y-1 font-mono`,children:[(0,l.jsx)(`span`,{className:e.running?`text-success`:`text-danger`,children:e.running?`running`:`stopped`}),(0,l.jsx)(`span`,{className:e.activated?`text-success`:`text-warning`,children:e.activated?`activated`:`awaiting activation`}),e.lastUpdateId!==null&&(0,l.jsxs)(`span`,{children:[`last update `,e.lastUpdateId]}),t&&(0,l.jsxs)(`span`,{children:[`started `,t]}),n&&(0,l.jsxs)(`span`,{children:[`last poll `,n]})]}),e.error&&(0,l.jsxs)(`p`,{role:`alert`,className:`text-danger`,children:[`error: `,e.error]})]})}function h({health:e}){if(e.error)return(0,l.jsxs)(`div`,{role:`alert`,className:`rounded-md border border-danger/25 bg-danger/10 px-3 py-2 text-sm`,children:[(0,l.jsxs)(`p`,{className:`font-semibold text-danger`,children:[`Failed at `,(0,l.jsx)(`code`,{className:`font-mono`,children:e.error.step})]}),(0,l.jsx)(`p`,{className:`text-danger mt-1`,children:e.error.message}),_(e.error.step)]});if(!e.preflight)return(0,l.jsx)(`p`,{role:`status`,className:`text-xs text-muted-foreground italic`,children:`No preflight data.`});let t=e.preflight;return(0,l.jsxs)(`ul`,{role:`status`,"aria-live":`polite`,"aria-atomic":`true`,className:`space-y-1.5`,children:[(0,l.jsxs)(g,{ok:t.botUsername.length>0,label:`Bot identity`,children:[`@`,t.botUsername]}),(0,l.jsx)(g,{ok:t.chatTitle.length>0,label:`Supergroup reachable`,children:t.chatTitle}),(0,l.jsx)(g,{ok:t.isForum,label:`Forum topics enabled`,children:t.isForum?`is_forum: true`:`is_forum: false — the supergroup owner must enable Topics in team settings`}),(0,l.jsx)(g,{ok:t.hasManageTopics,label:`Bot has can_manage_topics`,children:t.hasManageTopics?`admin with can_manage_topics`:`promote the bot to admin in the supergroup with the "Manage topics" permission`}),(0,l.jsx)(g,{ok:t.privacyModeOff,label:`Privacy Mode is OFF`,children:t.privacyModeOff?`can_read_all_group_messages: true`:`BotFather → /mybots → select bot → Bot Settings → Team Privacy → Turn off`}),(0,l.jsx)(g,{ok:t.chatIsPrivate,label:`Supergroup is private`,children:t.chatIsPrivate?`no public @username`:`public groups expose topic content to readers`}),(0,l.jsx)(g,{ok:t.memberCount===2,label:`Expected membership`,children:t.memberCount===null?`member count unavailable — verify one owner plus the bot manually`:`${t.memberCount} members reported; secure posture is one owner plus the bot`}),t.ownerPresent!==null&&(0,l.jsx)(g,{ok:t.ownerPresent,label:`Paired owner is present`,children:t.ownerPresent?`owner membership confirmed`:`owner missing — Telegram ingress is degraded`})]})}function g({ok:e,label:t,children:n}){return(0,l.jsxs)(`li`,{className:`flex items-start gap-2 text-sm`,children:[(0,l.jsx)(`span`,{className:`mt-0.5 inline-flex h-4 w-4 items-center justify-center rounded-full text-[10px] font-bold leading-none ${e?`bg-success/10 text-success`:`bg-danger/10 text-danger`}`,"aria-hidden":!0,children:e?`✓`:`✕`}),(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`span`,{className:`font-medium`,children:t}),(0,l.jsx)(`span`,{className:`ml-2 text-xs ${e?`text-muted-foreground`:`text-danger`}`,children:n})]})]})}function _(e){switch(e){case`getMe`:return(0,l.jsx)(`p`,{className:`text-xs text-danger mt-1`,children:`The token is invalid or revoked. Re-issue with @BotFather → /token, or paste a fresh one above.`});case`getChat`:return(0,l.jsx)(`p`,{className:`text-xs text-danger mt-1`,children:`The chat id either doesn't exist, points at a basic team (not a supergroup), or the bot isn't a member. Forward any message from the supergroup to the bot to double-check the id, then add the bot to the team.`});case`getChatMember`:return(0,l.jsx)(`p`,{className:`text-xs text-danger mt-1`,children:`The bot is in the chat but the membership lookup failed. Usually means the bot was kicked or the chat id was migrated — confirm the bot is still in the supergroup.`})}}export{u as component};
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-_bmG-wVG.js";import{o as a}from"./index-CLdmsmiN.js";import{t as o}from"./Button-ByiV6fpd.js";import{t as s}from"./ConfigPage-BCLp-FUC.js";var c=e(n()),l=t();function u(){let e=a.useLoaderData(),t=r(),[n,u]=(0,c.useState)(``),[g,_]=(0,c.useState)(e.chatId),[v,y]=(0,c.useState)(!1),[b,x]=(0,c.useState)(null),[S,C]=(0,c.useState)(!1),[w,T]=(0,c.useState)(!1),[E,D]=(0,c.useState)(null),[O,k]=(0,c.useState)(!1);async function A(r){if(r.preventDefault(),e.configured&&n.trim().length===0){C(!1),x(g.trim()===e.chatId?`Nothing changed. Paste a replacement token to update credentials.`:`Paste the bot token again when changing the supergroup, so the existing secret is never cleared or reused silently.`);return}y(!0),x(null),C(!1);try{let e=await fetch(`/api/config/telegram`,{method:`PUT`,headers:{"content-type":`application/json`},body:JSON.stringify({botToken:n,chatId:g})});if(!e.ok){let t=await e.json().catch(()=>({}));throw Error(t.error??`${e.status} ${e.statusText}`)}u(``),C(!0),await t.invalidate()}catch(e){x(e.message)}finally{y(!1)}}async function j(){let e=await fetch(`/api/config/telegram`,{method:`DELETE`});if(!e.ok&&e.status!==204){let t=await e.json().catch(()=>null);throw Error(t?.error??`Could not clear Telegram credentials (${e.status})`)}u(``),_(``),D(null),C(!1),x(null),await t.invalidate()}async function M(){k(!0),D(null);try{D(await(await fetch(`/api/config/telegram/health`)).json())}catch(e){D({configured:!0,preflight:null,error:{step:`getMe`,message:e.message},polling:null})}finally{k(!1)}}return(0,l.jsxs)(s,{active:`integrations`,title:`Telegram`,description:`Connect one forum-supergroup bot with one topic per agent, so conversations stay reachable from your phone.`,size:`narrow`,children:[e.migratedChatId&&(0,l.jsx)(p,{toChatId:e.migratedChatId}),(0,l.jsxs)(`section`,{className:`rounded-lg border bg-card p-5`,children:[(0,l.jsx)(`h3`,{className:`text-sm font-semibold uppercase tracking-wide text-muted-foreground mb-3`,children:`Credentials`}),e.configured&&(0,l.jsxs)(`p`,{className:`text-xs text-success mb-3`,children:[`✓ Stored: `,(0,l.jsx)(`code`,{className:`font-mono`,children:e.botTokenPreview}),` `,e.chatId&&(0,l.jsxs)(l.Fragment,{children:[`· chat `,(0,l.jsx)(`code`,{className:`font-mono`,children:e.chatId})]})]}),(0,l.jsxs)(`form`,{onSubmit:A,className:`space-y-3`,children:[(0,l.jsxs)(`label`,{className:`block`,children:[(0,l.jsx)(`span`,{className:`block text-sm font-medium mb-1`,children:`Bot token`}),(0,l.jsx)(`input`,{type:`password`,autoComplete:`off`,value:n,onChange:e=>{u(e.target.value),x(null)},placeholder:e.configured?`(leave blank to keep stored value)`:`1234567890:ABC...`,className:`w-full rounded-md border bg-background px-2 py-1.5 font-mono text-sm outline-none focus:ring-2 focus:ring-ring/30`,required:!e.configured}),(0,l.jsxs)(`p`,{className:`text-xs text-muted-foreground mt-1`,children:[`From @BotFather → /newbot. Disable Privacy Mode in `,(0,l.jsx)(`em`,{children:`Bot Settings → Team Privacy → Turn off`}),`.`]}),e.configured&&(0,l.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:`Blank preserves the stored token. To remove it, use clear credentials and confirm the integration shutdown.`})]}),(0,l.jsxs)(`label`,{className:`block`,children:[(0,l.jsx)(`span`,{className:`block text-sm font-medium mb-1`,children:`Supergroup chat ID`}),(0,l.jsx)(`input`,{type:`text`,value:g,onChange:e=>{_(e.target.value),x(null)},placeholder:`-1001234567890`,className:`w-full rounded-md border bg-background px-2 py-1.5 font-mono text-sm outline-none focus:ring-2 focus:ring-ring/30`,required:!0}),(0,l.jsxs)(`p`,{className:`text-xs text-muted-foreground mt-1`,children:[`Forum-enabled supergroup the bot is admin in (with`,` `,(0,l.jsx)(`code`,{className:`font-mono`,children:`can_manage_topics`}),`).`]})]}),(0,l.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3 pt-1`,children:[(0,l.jsx)(o,{variant:`primary`,type:`submit`,disabled:v,children:v?`saving…`:`save credentials`}),e.configured&&(0,l.jsx)(o,{variant:`danger`,onClick:()=>T(!0),children:`clear credentials`}),S&&(0,l.jsx)(`span`,{className:`text-xs text-success`,children:`saved ✓`}),b&&(0,l.jsxs)(`span`,{role:`alert`,className:`text-xs text-danger`,children:[`error: `,b]})]})]})]}),(0,l.jsxs)(`section`,{className:`rounded-lg border bg-card p-5`,children:[(0,l.jsxs)(`div`,{className:`mb-3 flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between`,children:[(0,l.jsx)(`h3`,{className:`text-sm font-semibold uppercase tracking-wide text-muted-foreground`,children:`Preflight checks`}),(0,l.jsx)(o,{variant:`ghost`,onClick:M,disabled:O||!e.configured,children:O?`checking…`:`run preflight`})]}),!e.configured&&(0,l.jsx)(`p`,{className:`text-xs text-muted-foreground italic`,children:`Save credentials above first.`}),e.configured&&!E&&!O&&(0,l.jsxs)(`p`,{className:`text-xs text-muted-foreground italic`,children:[`Click `,(0,l.jsx)(`em`,{children:`run preflight`}),` to validate the stored credentials against the Telegram Bot API.`]}),E&&(0,l.jsx)(h,{health:E}),E?.polling&&(0,l.jsx)(m,{polling:E.polling})]}),e.configured&&(0,l.jsx)(d,{}),e.configured&&(0,l.jsx)(f,{}),(0,l.jsx)(i,{open:w,title:`Disconnect Telegram?`,description:(0,l.jsx)(`p`,{children:`This permanently removes the saved bot token and supergroup ID. Telegram polling, ingress, and outbound delivery stop until new credentials are saved and pairing is completed again.`}),confirmLabel:`clear credentials and disconnect`,onConfirm:async()=>{try{await j()}catch(e){throw x(e instanceof Error?e.message:String(e)),e}},onOpenChange:T})]})}function d(){let[e,t]=(0,c.useState)(null),[n,r]=(0,c.useState)(null),[a,s]=(0,c.useState)(null),[u,d]=(0,c.useState)(!1),f=async()=>{let e=await fetch(`/api/config/telegram/pairing`);if(!e.ok)throw Error(e.statusText);t(await e.json())};(0,c.useEffect)(()=>{f().catch(e=>s(e.message))},[]);async function p(){s(null);let e=await fetch(`/api/config/telegram/pairing/challenge`,{method:`POST`}),n=await e.json().catch(()=>({}));if(!e.ok||!n.code)return s(n.error??e.statusText);r(n.code),t(n)}async function m(){let e=await fetch(`/api/config/telegram/pairing/challenge`,{method:`DELETE`});if(!e.ok&&e.status!==204){let t=await e.json().catch(()=>null);throw Error(t?.error??`Could not cancel the pairing code`)}r(null),await f()}async function h(){let e=await fetch(`/api/config/telegram/pairing/reset`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({confirm:!0})});if(!e.ok){let t=await e.json().catch(()=>null);throw Error(t?.error??`Could not reset Telegram owner`)}r(null),await f()}return(0,l.jsxs)(`section`,{className:`rounded-lg border bg-card p-5`,children:[(0,l.jsx)(`h3`,{className:`text-sm font-semibold uppercase tracking-wide text-muted-foreground mb-1`,children:`Owner pairing`}),(0,l.jsxs)(`p`,{className:`text-xs text-muted-foreground mb-3`,children:[`Telegram stays closed until one owner consumes a short-lived code in the configured`,` `,(0,l.jsx)(`code`,{className:`font-mono`,children:`⚙ bazilion`}),` service topic.`]}),e?.paired?(0,l.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,l.jsx)(`span`,{className:`text-sm text-success`,children:`✓ owner paired`}),(0,l.jsx)(o,{variant:`danger`,onClick:()=>d(!0),children:`reset owner`})]}):(0,l.jsxs)(`div`,{className:`space-y-2`,children:[(0,l.jsx)(`p`,{className:`text-sm text-warning`,children:`Unpaired — all Telegram ingress is closed.`}),n?(0,l.jsxs)(`div`,{className:`rounded-md border bg-muted/30 p-3 text-sm`,children:[`Send `,(0,l.jsxs)(`code`,{className:`font-mono`,children:[`/pair `,n]}),` in the service topic. This code is shown once and expires in ten minutes.`]}):null,(0,l.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,l.jsx)(o,{variant:`primary`,onClick:p,children:`generate pairing code`}),e?.challengeActive&&(0,l.jsx)(o,{variant:`ghost`,onClick:()=>void m().catch(e=>s(e instanceof Error?e.message:String(e))),children:`cancel code`})]})]}),a&&(0,l.jsx)(`p`,{role:`alert`,className:`mt-2 text-xs text-danger`,children:a}),(0,l.jsx)(i,{open:u,title:`Revoke the paired Telegram owner?`,description:(0,l.jsx)(`p`,{children:`This immediately revokes the current owner and closes all Telegram ingress. No one can use the bot until a new one-time pairing code is generated and consumed.`}),confirmLabel:`revoke owner and close ingress`,onConfirm:async()=>{try{await h()}catch(e){throw s(e instanceof Error?e.message:String(e)),e}},onOpenChange:d})]})}function f(){let[e,t]=(0,c.useState)(null),[n,r]=(0,c.useState)(``),[a,s]=(0,c.useState)(``),[u,d]=(0,c.useState)(!1),[f,p]=(0,c.useState)(null),[m,h]=(0,c.useState)(null);async function g(){try{let e=await fetch(`/api/config/telegram/acl`);if(!e.ok)throw Error(e.statusText);t(await e.json())}catch(e){p(e.message)}}(0,c.useEffect)(()=>{g()},[]);async function _(e){e.preventDefault();let t=Number(n);if(!Number.isInteger(t)){p(`user id must be an integer`);return}d(!0),p(null);try{let e=await fetch(`/api/config/telegram/acl`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({userId:t,label:a.trim()||null})});if(!e.ok){let t=await e.json().catch(()=>({}));throw Error(t.error??e.statusText)}r(``),s(``),await g()}catch(e){p(e.message)}finally{d(!1)}}async function v(e){p(null);let t=await fetch(`/api/config/telegram/acl/${e}`,{method:`DELETE`});if(!t.ok){let e=await t.json().catch(()=>({}));throw Error(e.error??t.statusText)}await g()}return(0,l.jsxs)(`section`,{className:`rounded-lg border bg-card p-5`,children:[(0,l.jsx)(`h3`,{className:`text-sm font-semibold uppercase tracking-wide text-muted-foreground mb-1`,children:`Access control`}),(0,l.jsxs)(`p`,{className:`text-xs text-muted-foreground mb-3`,children:[`Allowlisted Telegram users can use the bot (commands + chat). An empty list is closed; ownership begins only through the one-time pairing flow. Users find their id via`,` `,(0,l.jsx)(`code`,{className:`font-mono`,children:`/whoami`}),`.`]}),e===null?(0,l.jsx)(`p`,{className:`text-xs text-muted-foreground italic`,children:`loading…`}):e.length===0?(0,l.jsx)(`p`,{className:`text-xs text-warning mb-3`,children:`Closed — no paired owner or allowlisted members.`}):(0,l.jsx)(`ul`,{className:`mb-3 space-y-1 text-sm`,children:e.map(e=>(0,l.jsxs)(`li`,{className:`flex flex-wrap items-center gap-2`,children:[(0,l.jsx)(`code`,{className:`font-mono`,children:e.userId}),(0,l.jsxs)(`span`,{className:`text-muted-foreground`,children:[e.label??(e.username?`@${e.username}`:`—`),` · `,e.role]}),e.role!==`owner`&&(0,l.jsx)(o,{variant:`danger`,className:`text-xs`,onClick:()=>h(e),children:`remove`})]},e.userId))}),(0,l.jsxs)(`form`,{onSubmit:_,className:`flex flex-col gap-2 sm:flex-row sm:flex-wrap sm:items-end`,children:[(0,l.jsxs)(`label`,{className:`m-0 flex flex-col gap-1 text-xs font-medium text-foreground`,children:[`Telegram user ID`,(0,l.jsx)(`input`,{value:n,onChange:e=>r(e.target.value),placeholder:`123456789`,inputMode:`numeric`,className:`w-full rounded-md border bg-background px-2 py-1 font-mono text-sm sm:w-32`})]}),(0,l.jsxs)(`label`,{className:`m-0 flex flex-col gap-1 text-xs font-medium text-foreground`,children:[`Label `,(0,l.jsx)(`span`,{className:`font-normal text-muted-foreground`,children:`(optional)`}),(0,l.jsx)(`input`,{value:a,onChange:e=>s(e.target.value),placeholder:`e.g. Pat`,className:`w-full rounded-md border bg-background px-2 py-1 text-sm sm:w-40`})]}),(0,l.jsx)(o,{variant:`ghost`,type:`submit`,disabled:u,children:`add`}),f&&(0,l.jsx)(`span`,{role:`alert`,className:`text-xs text-danger`,children:f})]}),(0,l.jsx)(i,{open:m!==null,title:`Remove ${m?.label??m?.username??m?.userId??``}?`,description:(0,l.jsxs)(`p`,{children:[`Telegram user `,(0,l.jsx)(`code`,{className:`font-mono`,children:m?.userId}),` immediately loses command and chat access. Their Telegram account is not changed, and they can be allowlisted again later.`]}),confirmLabel:`remove Telegram access`,onConfirm:async()=>{if(m)try{await v(m.userId)}catch(e){throw p(e instanceof Error?e.message:String(e)),e}},onOpenChange:e=>{e||h(null)}})]})}function p({toChatId:e}){let[t,n]=(0,c.useState)(!1),[r,i]=(0,c.useState)(null);async function a(){n(!0),i(null);try{let e=await fetch(`/api/config/telegram/reconnect`,{method:`POST`});if(!e.ok){let t=await e.json().catch(()=>({}));throw Error(t.error??e.statusText)}window.location.reload()}catch(e){i(e.message),n(!1)}}return(0,l.jsxs)(`div`,{className:`rounded-md border-2 border-danger/25 bg-danger/10 px-4 py-3 text-sm`,children:[(0,l.jsx)(`div`,{className:`font-semibold text-danger mb-1`,children:`Supergroup chat id changed`}),(0,l.jsxs)(`p`,{className:`text-danger mb-2`,children:[`Telegram migrated this supergroup to a new chat id (`,(0,l.jsx)(`code`,{className:`font-mono`,children:e}),`). The bot is still pointed at the old id. Reconnect to repoint it and re-create the `,(0,l.jsx)(`code`,{className:`font-mono`,children:`⚙ bazilion`}),` `,`service chat in the new team. Agent topic bindings will reconcile on next use.`]}),(0,l.jsx)(o,{variant:`primary`,onClick:a,disabled:t,children:t?`reconnecting…`:`Reconnect to ${e}`}),r&&(0,l.jsx)(`span`,{role:`alert`,className:`ml-3 text-xs text-danger`,children:r})]})}function m({polling:e}){let t=e.startedAt?new Date(e.startedAt).toISOString():null,n=e.lastSuccessfulPollAt?new Date(e.lastSuccessfulPollAt).toISOString():null;return(0,l.jsxs)(`div`,{className:`mt-4 rounded-md border bg-muted/30 px-3 py-2 text-xs space-y-1`,children:[(0,l.jsx)(`p`,{className:`font-semibold uppercase tracking-wide text-muted-foreground`,children:`Polling state`}),(0,l.jsxs)(`div`,{className:`flex flex-wrap gap-x-4 gap-y-1 font-mono`,children:[(0,l.jsx)(`span`,{className:e.running?`text-success`:`text-danger`,children:e.running?`running`:`stopped`}),(0,l.jsx)(`span`,{className:e.activated?`text-success`:`text-warning`,children:e.activated?`activated`:`awaiting activation`}),e.lastUpdateId!==null&&(0,l.jsxs)(`span`,{children:[`last update `,e.lastUpdateId]}),t&&(0,l.jsxs)(`span`,{children:[`started `,t]}),n&&(0,l.jsxs)(`span`,{children:[`last poll `,n]})]}),e.error&&(0,l.jsxs)(`p`,{role:`alert`,className:`text-danger`,children:[`error: `,e.error]})]})}function h({health:e}){if(e.error)return(0,l.jsxs)(`div`,{role:`alert`,className:`rounded-md border border-danger/25 bg-danger/10 px-3 py-2 text-sm`,children:[(0,l.jsxs)(`p`,{className:`font-semibold text-danger`,children:[`Failed at `,(0,l.jsx)(`code`,{className:`font-mono`,children:e.error.step})]}),(0,l.jsx)(`p`,{className:`text-danger mt-1`,children:e.error.message}),_(e.error.step)]});if(!e.preflight)return(0,l.jsx)(`p`,{role:`status`,className:`text-xs text-muted-foreground italic`,children:`No preflight data.`});let t=e.preflight;return(0,l.jsxs)(`ul`,{role:`status`,"aria-live":`polite`,"aria-atomic":`true`,className:`space-y-1.5`,children:[(0,l.jsxs)(g,{ok:t.botUsername.length>0,label:`Bot identity`,children:[`@`,t.botUsername]}),(0,l.jsx)(g,{ok:t.chatTitle.length>0,label:`Supergroup reachable`,children:t.chatTitle}),(0,l.jsx)(g,{ok:t.isForum,label:`Forum topics enabled`,children:t.isForum?`is_forum: true`:`is_forum: false — the supergroup owner must enable Topics in team settings`}),(0,l.jsx)(g,{ok:t.hasManageTopics,label:`Bot has can_manage_topics`,children:t.hasManageTopics?`admin with can_manage_topics`:`promote the bot to admin in the supergroup with the "Manage topics" permission`}),(0,l.jsx)(g,{ok:t.privacyModeOff,label:`Privacy Mode is OFF`,children:t.privacyModeOff?`can_read_all_group_messages: true`:`BotFather → /mybots → select bot → Bot Settings → Team Privacy → Turn off`}),(0,l.jsx)(g,{ok:t.chatIsPrivate,label:`Supergroup is private`,children:t.chatIsPrivate?`no public @username`:`public groups expose topic content to readers`}),(0,l.jsx)(g,{ok:t.memberCount===2,label:`Expected membership`,children:t.memberCount===null?`member count unavailable — verify one owner plus the bot manually`:`${t.memberCount} members reported; secure posture is one owner plus the bot`}),t.ownerPresent!==null&&(0,l.jsx)(g,{ok:t.ownerPresent,label:`Paired owner is present`,children:t.ownerPresent?`owner membership confirmed`:`owner missing — Telegram ingress is degraded`})]})}function g({ok:e,label:t,children:n}){return(0,l.jsxs)(`li`,{className:`flex items-start gap-2 text-sm`,children:[(0,l.jsx)(`span`,{className:`mt-0.5 inline-flex h-4 w-4 items-center justify-center rounded-full text-[10px] font-bold leading-none ${e?`bg-success/10 text-success`:`bg-danger/10 text-danger`}`,"aria-hidden":!0,children:e?`✓`:`✕`}),(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`span`,{className:`font-medium`,children:t}),(0,l.jsx)(`span`,{className:`ml-2 text-xs ${e?`text-muted-foreground`:`text-danger`}`,children:n})]})]})}function _(e){switch(e){case`getMe`:return(0,l.jsx)(`p`,{className:`text-xs text-danger mt-1`,children:`The token is invalid or revoked. Re-issue with @BotFather → /token, or paste a fresh one above.`});case`getChat`:return(0,l.jsx)(`p`,{className:`text-xs text-danger mt-1`,children:`The chat id either doesn't exist, points at a basic team (not a supergroup), or the bot isn't a member. Forward any message from the supergroup to the bot to double-check the id, then add the bot to the team.`});case`getChatMember`:return(0,l.jsx)(`p`,{className:`text-xs text-danger mt-1`,children:`The bot is in the chat but the membership lookup failed. Usually means the bot was kicked or the chat id was migrated — confirm the bot is still in the supergroup.`})}}export{u as component};
@@ -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-BAiyYC8w.js";import{_ as a}from"./index-BVfpuiby.js";import{t as o}from"./Button-ByiV6fpd.js";import{t as s}from"./ConfigPage-BCLp-FUC.js";var c=e(n()),l=t();function u(e){return new Date(e).toISOString().slice(0,16).replace(`T`,` `)}function d(){let{tokens:e,sessions:t}=a.useLoaderData(),{all:n}=a.useSearch(),d=n===`1`,f=r(),[p,m]=(0,c.useState)(``),[h,g]=(0,c.useState)(null),[_,v]=(0,c.useState)(`90`),[y,b]=(0,c.useState)(null),[x,S]=(0,c.useState)(!1),[C,w]=(0,c.useState)(null),[T,E]=(0,c.useState)(null);async function D(e){e.preventDefault(),b(null),S(!0);try{let e=await fetch(`/api/tokens`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({label:p,expiresInDays:Number(_)})});if(!e.ok){let t=await e.json().catch(()=>({}));throw Error(t.error??`${e.status} ${e.statusText}`)}g((await e.json()).token),m(``),await f.invalidate()}catch(e){b(e.message)}finally{S(!1)}}async function O(e,t){let n=await fetch(`/api/tokens/${encodeURIComponent(e)}`,{method:`DELETE`});if(!n.ok&&n.status!==204){let e=await n.json().catch(()=>({}));throw Error(e.error??`Could not revoke API token`)}t?window.location.assign(`/login`):await f.invalidate()}async function k(e,t){let n=await fetch(`/api/sessions/${encodeURIComponent(e)}`,{method:`DELETE`});if(!n.ok){let e=await n.json().catch(()=>({}));throw Error(e.error??`Could not revoke browser session`)}t?window.location.assign(`/login`):await f.invalidate()}return(0,l.jsxs)(s,{active:`tokens`,title:`API tokens`,description:(0,l.jsxs)(l.Fragment,{children:[`Manage per-client credentials for the HTTP API and CLI. The`,` `,(0,l.jsx)(`code`,{className:`font-mono`,children:`bootstrap`}),` token from`,` `,(0,l.jsx)(`code`,{className:`font-mono`,children:`~/.bazilion/auth.json`}),` remains protected; mint separate credentials for mobile, LAN, and remote clients.`]}),children:[(0,l.jsxs)(`section`,{className:`rounded-lg border bg-card p-5`,children:[(0,l.jsx)(`h3`,{className:`font-serif text-xl mb-3`,children:`Mint a new token`}),(0,l.jsxs)(`form`,{onSubmit:D,className:`mb-3 flex flex-col items-stretch gap-2 sm:flex-row sm:items-end`,children:[(0,l.jsxs)(`label`,{className:`w-full text-sm sm:w-auto`,children:[`Label`,(0,l.jsx)(`input`,{type:`text`,value:p,onChange:e=>m(e.target.value),required:!0,placeholder:`e.g. laptop-tailscale`,autoComplete:`off`,className:`mt-1 block w-full rounded-md border bg-background px-3 py-2 text-sm sm:w-72`})]}),(0,l.jsxs)(`label`,{className:`w-full text-sm sm:w-auto`,children:[`Expires in days`,(0,l.jsx)(`input`,{type:`number`,min:1,max:365,value:_,onChange:e=>v(e.target.value),required:!0,className:`mt-1 block w-full rounded-md border bg-background px-3 py-2 text-sm sm:w-36`})]}),(0,l.jsx)(o,{variant:`primary`,type:`submit`,disabled:x,children:x?`creating…`:`create`})]}),h&&(0,l.jsxs)(`div`,{className:`rounded-md border border-warning/25 bg-warning/10 p-3`,children:[(0,l.jsx)(`p`,{className:`text-xs text-warning mb-1`,children:`copy this token now — it is not recoverable later.`}),(0,l.jsx)(`pre`,{className:`font-mono text-xs whitespace-pre-wrap break-all`,children:h})]}),y&&(0,l.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:y})]}),(0,l.jsx)(`div`,{children:(0,l.jsxs)(`label`,{className:`text-sm flex items-center gap-2`,children:[(0,l.jsx)(`input`,{type:`checkbox`,checked:d,onChange:e=>{window.location.assign(e.target.checked?`/config/tokens?all=1`:`/config/tokens`)}}),`show revoked`]})}),(0,l.jsx)(`div`,{className:`overflow-x-auto`,children:(0,l.jsxs)(`table`,{className:`w-full min-w-[720px] text-sm`,children:[(0,l.jsx)(`thead`,{className:`text-left text-muted-foreground border-b`,children:(0,l.jsxs)(`tr`,{children:[(0,l.jsx)(`th`,{className:`py-2`,children:`label`}),(0,l.jsx)(`th`,{children:`kind`}),(0,l.jsx)(`th`,{children:`id`}),(0,l.jsx)(`th`,{children:`state`}),(0,l.jsx)(`th`,{children:`created`}),(0,l.jsx)(`th`,{children:`last used`}),(0,l.jsx)(`th`,{children:`expires`}),(0,l.jsx)(`th`,{})]})}),(0,l.jsxs)(`tbody`,{children:[e.length===0&&(0,l.jsx)(`tr`,{children:(0,l.jsx)(`td`,{colSpan:8,className:`py-6 text-center text-muted-foreground italic`,children:`no tokens yet — mint one above`})}),e.map(e=>{let t=e.kind===`bootstrap`;return(0,l.jsxs)(`tr`,{className:`border-b last:border-0 hover:bg-accent/30`,children:[(0,l.jsxs)(`td`,{className:`py-2`,children:[e.label,t&&(0,l.jsx)(`span`,{className:`ml-2 text-[0.7em] uppercase tracking-wide text-muted-foreground`,children:`auth.json`})]}),(0,l.jsx)(`td`,{children:e.kind}),(0,l.jsx)(`td`,{children:(0,l.jsx)(`code`,{className:`font-mono text-xs`,children:e.id})}),(0,l.jsx)(`td`,{children:e.revokedAt?(0,l.jsx)(`span`,{className:`text-muted-foreground`,children:`revoked`}):(0,l.jsx)(`span`,{className:`text-success`,children:`active`})}),(0,l.jsx)(`td`,{className:`text-muted-foreground text-xs`,children:u(e.createdAt)}),(0,l.jsx)(`td`,{className:`text-muted-foreground text-xs`,children:e.lastUsedAt?u(e.lastUsedAt):`(never)`}),(0,l.jsx)(`td`,{className:`text-muted-foreground text-xs`,children:e.expiresAt?u(e.expiresAt):`(never)`}),(0,l.jsx)(`td`,{children:!e.revokedAt&&!t&&(0,l.jsx)(o,{variant:`danger`,className:`text-xs`,onClick:()=>{b(null),w(e)},children:`revoke`})})]},e.id)})]})]})}),(0,l.jsxs)(`section`,{className:`space-y-3`,children:[(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`h3`,{className:`font-serif text-xl`,children:`Browser sessions`}),(0,l.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Sessions expire after 12 idle hours or seven days absolute. Revoking a device also revokes every session created from it.`})]}),(0,l.jsx)(`div`,{className:`overflow-x-auto`,children:(0,l.jsxs)(`table`,{className:`w-full min-w-[720px] text-sm`,children:[(0,l.jsx)(`thead`,{className:`border-b text-left text-muted-foreground`,children:(0,l.jsxs)(`tr`,{children:[(0,l.jsx)(`th`,{className:`py-2`,children:`device`}),(0,l.jsx)(`th`,{children:`session`}),(0,l.jsx)(`th`,{children:`last seen`}),(0,l.jsx)(`th`,{children:`idle expiry`}),(0,l.jsx)(`th`,{children:`absolute expiry`}),(0,l.jsx)(`th`,{})]})}),(0,l.jsxs)(`tbody`,{children:[t.length===0&&(0,l.jsx)(`tr`,{children:(0,l.jsx)(`td`,{colSpan:6,className:`py-6 text-center italic text-muted-foreground`,children:`no active browser sessions`})}),t.map(e=>(0,l.jsxs)(`tr`,{className:`border-b last:border-0 hover:bg-accent/30`,children:[(0,l.jsxs)(`td`,{className:`py-2`,children:[e.deviceLabel,` `,e.current&&(0,l.jsx)(`span`,{className:`text-xs text-success`,children:`current`})]}),(0,l.jsx)(`td`,{children:(0,l.jsx)(`code`,{className:`font-mono text-xs`,children:e.id})}),(0,l.jsx)(`td`,{className:`text-xs text-muted-foreground`,children:u(e.lastSeenAt)}),(0,l.jsx)(`td`,{className:`text-xs text-muted-foreground`,children:u(e.idleExpiresAt)}),(0,l.jsx)(`td`,{className:`text-xs text-muted-foreground`,children:u(e.absoluteExpiresAt)}),(0,l.jsx)(`td`,{children:(0,l.jsx)(o,{variant:`danger`,className:`text-xs`,onClick:()=>{b(null),E(e)},children:`revoke`})})]},e.id))]})]})})]}),(0,l.jsx)(i,{open:C!==null,title:`Revoke ${C?.label??``}?`,description:(0,l.jsxs)(`p`,{children:[`This permanently revokes device token`,` `,(0,l.jsx)(`code`,{className:`font-mono`,children:C?.id}),` and every browser session created from it. Clients using it will be signed out and cannot reconnect with this credential.`,t.some(e=>e.current&&e.deviceTokenId===C?.id)&&` This includes the browser session you are using now.`]}),confirmLabel:`revoke token and sessions`,onConfirm:async()=>{if(C)try{await O(C.id,t.some(e=>e.current&&e.deviceTokenId===C.id))}catch(e){throw b(e instanceof Error?e.message:String(e)),e}},onOpenChange:e=>{e||w(null)}}),(0,l.jsx)(i,{open:T!==null,title:`Revoke ${T?.deviceLabel??``} browser session?`,description:(0,l.jsxs)(`p`,{children:[`This ends browser session `,(0,l.jsx)(`code`,{className:`font-mono`,children:T?.id}),T?.current?` and signs this browser out immediately.`:`. The device token remains active for future logins.`]}),confirmLabel:T?.current?`sign out this browser`:`revoke session`,onConfirm:async()=>{if(T)try{await k(T.id,T.current)}catch(e){throw b(e instanceof Error?e.message:String(e)),e}},onOpenChange:e=>{e||E(null)}})]})}export{d as component};
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-_bmG-wVG.js";import{_ as a}from"./index-CLdmsmiN.js";import{t as o}from"./Button-ByiV6fpd.js";import{t as s}from"./ConfigPage-BCLp-FUC.js";var c=e(n()),l=t();function u(e){return new Date(e).toISOString().slice(0,16).replace(`T`,` `)}function d(){let{tokens:e,sessions:t}=a.useLoaderData(),{all:n}=a.useSearch(),d=n===`1`,f=r(),[p,m]=(0,c.useState)(``),[h,g]=(0,c.useState)(null),[_,v]=(0,c.useState)(`90`),[y,b]=(0,c.useState)(null),[x,S]=(0,c.useState)(!1),[C,w]=(0,c.useState)(null),[T,E]=(0,c.useState)(null);async function D(e){e.preventDefault(),b(null),S(!0);try{let e=await fetch(`/api/tokens`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({label:p,expiresInDays:Number(_)})});if(!e.ok){let t=await e.json().catch(()=>({}));throw Error(t.error??`${e.status} ${e.statusText}`)}g((await e.json()).token),m(``),await f.invalidate()}catch(e){b(e.message)}finally{S(!1)}}async function O(e,t){let n=await fetch(`/api/tokens/${encodeURIComponent(e)}`,{method:`DELETE`});if(!n.ok&&n.status!==204){let e=await n.json().catch(()=>({}));throw Error(e.error??`Could not revoke API token`)}t?window.location.assign(`/login`):await f.invalidate()}async function k(e,t){let n=await fetch(`/api/sessions/${encodeURIComponent(e)}`,{method:`DELETE`});if(!n.ok){let e=await n.json().catch(()=>({}));throw Error(e.error??`Could not revoke browser session`)}t?window.location.assign(`/login`):await f.invalidate()}return(0,l.jsxs)(s,{active:`tokens`,title:`API tokens`,description:(0,l.jsxs)(l.Fragment,{children:[`Manage per-client credentials for the HTTP API and CLI. The`,` `,(0,l.jsx)(`code`,{className:`font-mono`,children:`bootstrap`}),` token from`,` `,(0,l.jsx)(`code`,{className:`font-mono`,children:`~/.bazilion/auth.json`}),` remains protected; mint separate credentials for mobile, LAN, and remote clients.`]}),children:[(0,l.jsxs)(`section`,{className:`rounded-lg border bg-card p-5`,children:[(0,l.jsx)(`h3`,{className:`font-serif text-xl mb-3`,children:`Mint a new token`}),(0,l.jsxs)(`form`,{onSubmit:D,className:`mb-3 flex flex-col items-stretch gap-2 sm:flex-row sm:items-end`,children:[(0,l.jsxs)(`label`,{className:`w-full text-sm sm:w-auto`,children:[`Label`,(0,l.jsx)(`input`,{type:`text`,value:p,onChange:e=>m(e.target.value),required:!0,placeholder:`e.g. laptop-tailscale`,autoComplete:`off`,className:`mt-1 block w-full rounded-md border bg-background px-3 py-2 text-sm sm:w-72`})]}),(0,l.jsxs)(`label`,{className:`w-full text-sm sm:w-auto`,children:[`Expires in days`,(0,l.jsx)(`input`,{type:`number`,min:1,max:365,value:_,onChange:e=>v(e.target.value),required:!0,className:`mt-1 block w-full rounded-md border bg-background px-3 py-2 text-sm sm:w-36`})]}),(0,l.jsx)(o,{variant:`primary`,type:`submit`,disabled:x,children:x?`creating…`:`create`})]}),h&&(0,l.jsxs)(`div`,{className:`rounded-md border border-warning/25 bg-warning/10 p-3`,children:[(0,l.jsx)(`p`,{className:`text-xs text-warning mb-1`,children:`copy this token now — it is not recoverable later.`}),(0,l.jsx)(`pre`,{className:`font-mono text-xs whitespace-pre-wrap break-all`,children:h})]}),y&&(0,l.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:y})]}),(0,l.jsx)(`div`,{children:(0,l.jsxs)(`label`,{className:`text-sm flex items-center gap-2`,children:[(0,l.jsx)(`input`,{type:`checkbox`,checked:d,onChange:e=>{window.location.assign(e.target.checked?`/config/tokens?all=1`:`/config/tokens`)}}),`show revoked`]})}),(0,l.jsx)(`div`,{className:`overflow-x-auto`,children:(0,l.jsxs)(`table`,{className:`w-full min-w-[720px] text-sm`,children:[(0,l.jsx)(`thead`,{className:`text-left text-muted-foreground border-b`,children:(0,l.jsxs)(`tr`,{children:[(0,l.jsx)(`th`,{className:`py-2`,children:`label`}),(0,l.jsx)(`th`,{children:`kind`}),(0,l.jsx)(`th`,{children:`id`}),(0,l.jsx)(`th`,{children:`state`}),(0,l.jsx)(`th`,{children:`created`}),(0,l.jsx)(`th`,{children:`last used`}),(0,l.jsx)(`th`,{children:`expires`}),(0,l.jsx)(`th`,{})]})}),(0,l.jsxs)(`tbody`,{children:[e.length===0&&(0,l.jsx)(`tr`,{children:(0,l.jsx)(`td`,{colSpan:8,className:`py-6 text-center text-muted-foreground italic`,children:`no tokens yet — mint one above`})}),e.map(e=>{let t=e.kind===`bootstrap`;return(0,l.jsxs)(`tr`,{className:`border-b last:border-0 hover:bg-accent/30`,children:[(0,l.jsxs)(`td`,{className:`py-2`,children:[e.label,t&&(0,l.jsx)(`span`,{className:`ml-2 text-[0.7em] uppercase tracking-wide text-muted-foreground`,children:`auth.json`})]}),(0,l.jsx)(`td`,{children:e.kind}),(0,l.jsx)(`td`,{children:(0,l.jsx)(`code`,{className:`font-mono text-xs`,children:e.id})}),(0,l.jsx)(`td`,{children:e.revokedAt?(0,l.jsx)(`span`,{className:`text-muted-foreground`,children:`revoked`}):(0,l.jsx)(`span`,{className:`text-success`,children:`active`})}),(0,l.jsx)(`td`,{className:`text-muted-foreground text-xs`,children:u(e.createdAt)}),(0,l.jsx)(`td`,{className:`text-muted-foreground text-xs`,children:e.lastUsedAt?u(e.lastUsedAt):`(never)`}),(0,l.jsx)(`td`,{className:`text-muted-foreground text-xs`,children:e.expiresAt?u(e.expiresAt):`(never)`}),(0,l.jsx)(`td`,{children:!e.revokedAt&&!t&&(0,l.jsx)(o,{variant:`danger`,className:`text-xs`,onClick:()=>{b(null),w(e)},children:`revoke`})})]},e.id)})]})]})}),(0,l.jsxs)(`section`,{className:`space-y-3`,children:[(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`h3`,{className:`font-serif text-xl`,children:`Browser sessions`}),(0,l.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Sessions expire after 12 idle hours or seven days absolute. Revoking a device also revokes every session created from it.`})]}),(0,l.jsx)(`div`,{className:`overflow-x-auto`,children:(0,l.jsxs)(`table`,{className:`w-full min-w-[720px] text-sm`,children:[(0,l.jsx)(`thead`,{className:`border-b text-left text-muted-foreground`,children:(0,l.jsxs)(`tr`,{children:[(0,l.jsx)(`th`,{className:`py-2`,children:`device`}),(0,l.jsx)(`th`,{children:`session`}),(0,l.jsx)(`th`,{children:`last seen`}),(0,l.jsx)(`th`,{children:`idle expiry`}),(0,l.jsx)(`th`,{children:`absolute expiry`}),(0,l.jsx)(`th`,{})]})}),(0,l.jsxs)(`tbody`,{children:[t.length===0&&(0,l.jsx)(`tr`,{children:(0,l.jsx)(`td`,{colSpan:6,className:`py-6 text-center italic text-muted-foreground`,children:`no active browser sessions`})}),t.map(e=>(0,l.jsxs)(`tr`,{className:`border-b last:border-0 hover:bg-accent/30`,children:[(0,l.jsxs)(`td`,{className:`py-2`,children:[e.deviceLabel,` `,e.current&&(0,l.jsx)(`span`,{className:`text-xs text-success`,children:`current`})]}),(0,l.jsx)(`td`,{children:(0,l.jsx)(`code`,{className:`font-mono text-xs`,children:e.id})}),(0,l.jsx)(`td`,{className:`text-xs text-muted-foreground`,children:u(e.lastSeenAt)}),(0,l.jsx)(`td`,{className:`text-xs text-muted-foreground`,children:u(e.idleExpiresAt)}),(0,l.jsx)(`td`,{className:`text-xs text-muted-foreground`,children:u(e.absoluteExpiresAt)}),(0,l.jsx)(`td`,{children:(0,l.jsx)(o,{variant:`danger`,className:`text-xs`,onClick:()=>{b(null),E(e)},children:`revoke`})})]},e.id))]})]})})]}),(0,l.jsx)(i,{open:C!==null,title:`Revoke ${C?.label??``}?`,description:(0,l.jsxs)(`p`,{children:[`This permanently revokes device token`,` `,(0,l.jsx)(`code`,{className:`font-mono`,children:C?.id}),` and every browser session created from it. Clients using it will be signed out and cannot reconnect with this credential.`,t.some(e=>e.current&&e.deviceTokenId===C?.id)&&` This includes the browser session you are using now.`]}),confirmLabel:`revoke token and sessions`,onConfirm:async()=>{if(C)try{await O(C.id,t.some(e=>e.current&&e.deviceTokenId===C.id))}catch(e){throw b(e instanceof Error?e.message:String(e)),e}},onOpenChange:e=>{e||w(null)}}),(0,l.jsx)(i,{open:T!==null,title:`Revoke ${T?.deviceLabel??``} browser session?`,description:(0,l.jsxs)(`p`,{children:[`This ends browser session `,(0,l.jsx)(`code`,{className:`font-mono`,children:T?.id}),T?.current?` and signs this browser out immediately.`:`. The device token remains active for future logins.`]}),confirmLabel:T?.current?`sign out this browser`:`revoke session`,onConfirm:async()=>{if(T)try{await k(T.id,T.current)}catch(e){throw b(e instanceof Error?e.message:String(e)),e}},onOpenChange:e=>{e||E(null)}})]})}export{d as component};
@@ -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-BAiyYC8w.js";import{a}from"./index-BVfpuiby.js";import{r as o}from"./Page-NV96O47A.js";import{t as s}from"./AgentTabs-BcmmwYJc.js";import{t as c}from"./Button-ByiV6fpd.js";var l=e(n()),u=t();function d(){let{resolved:e,triggers:t,dispatches:n}=a.useLoaderData(),d=r(),[p,m]=(0,l.useState)(null),[h,g]=(0,l.useState)(null),[_,v]=(0,l.useState)(null);async function y(e){v(e.id),g(null);try{let t=await fetch(`/api/triggers/${encodeURIComponent(e.id)}`,{method:`PATCH`,headers:{"content-type":`application/json`},body:JSON.stringify({enabled:!e.enabled})});if(!t.ok){let n=await t.json().catch(()=>null);throw Error(n?.error??`Could not ${e.enabled?`disable`:`enable`} trigger`)}await d.invalidate()}catch(e){g(e instanceof Error?e.message:String(e))}finally{v(null)}}async function b(e){let t=await fetch(`/api/triggers/${encodeURIComponent(e)}`,{method:`DELETE`});if(!t.ok&&t.status!==204){let e=await t.json().catch(()=>null);throw Error(e?.error??`Could not delete trigger`)}await d.invalidate()}return(0,u.jsxs)(o,{children:[(0,u.jsx)(`header`,{className:`mb-6`,children:(0,u.jsx)(`h1`,{children:e.agent.name})}),(0,u.jsx)(s,{agentId:e.agent.id,active:`triggers`,archived:e.agent.status===`archived`}),(0,u.jsx)(f,{agentId:e.agent.id,onAdded:()=>d.invalidate()}),h&&(0,u.jsx)(`p`,{role:`alert`,className:`err mt-4`,children:h}),(0,u.jsx)(`h3`,{className:`mb-3 mt-6 font-body text-[0.85em] font-semibold uppercase tracking-wider text-mocha-light`,children:`Active triggers`}),t.length===0?(0,u.jsx)(`p`,{className:`muted`,children:`no triggers yet — add one above.`}):(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(`div`,{className:`grid gap-3 md:hidden`,children:t.map(e=>{let t=e.kind===`interval`?`every ${e.intervalSec}s`:e.cronExpr,n=e.lastFiredAt?new Date(e.lastFiredAt).toLocaleString():`Never`;return(0,u.jsxs)(`article`,{className:`card min-w-0 ${e.enabled?``:`opacity-60`}`,children:[(0,u.jsxs)(`div`,{className:`flex min-w-0 items-start justify-between gap-3`,children:[(0,u.jsxs)(`div`,{className:`min-w-0`,children:[(0,u.jsx)(`p`,{className:`m-0 break-all font-mono text-xs text-muted-foreground`,children:e.id}),(0,u.jsx)(`p`,{className:`mb-0 mt-1 font-medium text-foreground`,children:t})]}),(0,u.jsx)(`span`,{className:`shrink-0 rounded-sm border border-frost bg-ivory px-2 py-0.5 font-mono text-xs text-mocha`,children:e.kind})]}),(0,u.jsx)(`p`,{className:`my-3 break-words text-sm text-foreground`,children:e.message}),(0,u.jsxs)(`p`,{className:`mb-3 text-xs text-muted-foreground`,children:[`Last fired: `,n]}),(0,u.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,u.jsx)(c,{variant:`ghost`,disabled:_===e.id,onClick:()=>void y(e),children:_===e.id?`Working…`:e.enabled?`Disable`:`Enable`}),(0,u.jsx)(c,{variant:`danger`,disabled:_===e.id,onClick:()=>{g(null),m(e)},children:`Delete`})]})]},e.id)})}),(0,u.jsx)(`div`,{className:`hidden overflow-x-auto md:block`,children:(0,u.jsxs)(`table`,{className:`min-w-full`,children:[(0,u.jsx)(`thead`,{children:(0,u.jsxs)(`tr`,{children:[(0,u.jsx)(`th`,{children:`id`}),(0,u.jsx)(`th`,{children:`kind`}),(0,u.jsx)(`th`,{children:`spec`}),(0,u.jsx)(`th`,{children:`message`}),(0,u.jsx)(`th`,{children:`last fired`}),(0,u.jsx)(`th`,{})]})}),(0,u.jsx)(`tbody`,{children:t.map(e=>{let t=e.kind===`interval`?`every ${e.intervalSec}s`:e.cronExpr,n=e.lastFiredAt?new Date(e.lastFiredAt).toLocaleString():`(never)`;return(0,u.jsxs)(`tr`,{className:e.enabled?``:`opacity-60`,children:[(0,u.jsx)(`td`,{children:(0,u.jsxs)(`code`,{children:[e.id.slice(0,8),`…`]})}),(0,u.jsx)(`td`,{children:(0,u.jsx)(`span`,{className:`inline-block rounded-sm border border-frost bg-ivory px-2 py-0.5 font-mono text-[0.8em] text-mocha`,children:e.kind})}),(0,u.jsx)(`td`,{children:(0,u.jsx)(`code`,{children:t})}),(0,u.jsx)(`td`,{children:e.message.length>60?`${e.message.slice(0,60)}…`:e.message}),(0,u.jsx)(`td`,{className:`text-[0.82em] text-mocha-light`,children:n}),(0,u.jsx)(`td`,{children:(0,u.jsxs)(`div`,{className:`flex gap-1.5`,children:[(0,u.jsx)(c,{variant:`ghost`,disabled:_===e.id,onClick:()=>void y(e),children:_===e.id?`working…`:e.enabled?`disable`:`enable`}),(0,u.jsx)(c,{variant:`danger`,disabled:_===e.id,onClick:()=>{g(null),m(e)},children:`delete`})]})})]},e.id)})})]})})]}),(0,u.jsx)(`h3`,{className:`mb-3 mt-8 font-body text-[0.85em] font-semibold uppercase tracking-wider text-mocha-light`,children:`Recent dispatches`}),n.length===0?(0,u.jsx)(`p`,{className:`muted`,children:`no scheduled occurrences yet.`}):(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(`div`,{className:`grid gap-3 md:hidden`,children:n.map(e=>(0,u.jsxs)(`article`,{className:`card min-w-0`,children:[(0,u.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,u.jsx)(`time`,{className:`text-sm text-foreground`,children:new Date(e.scheduledAt).toLocaleString()}),(0,u.jsx)(`code`,{className:`shrink-0`,children:e.status})]}),(0,u.jsxs)(`p`,{className:`mb-0 mt-2 text-xs text-muted-foreground`,children:[e.attemptCount,` attempt`,e.attemptCount===1?``:`s`]}),e.lastError&&(0,u.jsx)(`p`,{className:`mb-0 mt-2 break-words text-sm text-danger`,children:e.lastError})]},e.id))}),(0,u.jsx)(`div`,{className:`hidden overflow-x-auto md:block`,children:(0,u.jsxs)(`table`,{className:`min-w-full`,children:[(0,u.jsx)(`thead`,{children:(0,u.jsxs)(`tr`,{children:[(0,u.jsx)(`th`,{children:`scheduled`}),(0,u.jsx)(`th`,{children:`status`}),(0,u.jsx)(`th`,{children:`attempts`}),(0,u.jsx)(`th`,{children:`error`})]})}),(0,u.jsx)(`tbody`,{children:n.map(e=>(0,u.jsxs)(`tr`,{children:[(0,u.jsx)(`td`,{className:`text-[0.82em]`,children:new Date(e.scheduledAt).toLocaleString()}),(0,u.jsx)(`td`,{children:(0,u.jsx)(`code`,{children:e.status})}),(0,u.jsx)(`td`,{children:e.attemptCount}),(0,u.jsx)(`td`,{className:`text-[0.82em] text-mocha-light`,children:e.lastError??`—`})]},e.id))})]})})]}),(0,u.jsx)(i,{open:p!==null,title:`Delete ${p?.kind??``} trigger?`,description:(0,u.jsxs)(`p`,{children:[`This permanently removes trigger`,` `,(0,u.jsx)(`code`,{className:`font-mono`,children:p?.id}),`, its recorded dispatch history, and every future scheduled occurrence for `,e.agent.name,`. The Agent itself is not deleted.`]}),confirmLabel:`delete trigger and history`,onConfirm:async()=>{if(p)try{await b(p.id)}catch(e){throw g(e instanceof Error?e.message:String(e)),e}},onOpenChange:e=>{e||m(null)}})]})}function f({agentId:e,onAdded:t}){let[n,r]=(0,l.useState)(`interval`),[i,a]=(0,l.useState)(300),[o,s]=(0,l.useState)(``),[d,f]=(0,l.useState)(``),[p,m]=(0,l.useState)(null),[h,g]=(0,l.useState)(!1);async function _(r){if(r.preventDefault(),m(null),!d.trim()){m(`message is required`);return}if(n===`interval`&&(!Number.isFinite(i)||i<=0)){m(`interval must be a positive number`);return}if(n===`cron`&&!o.trim()){m(`cron expression is required`);return}g(!0);try{let r={kind:n,message:d.trim()};n===`interval`?r.intervalSec=i:r.cronExpr=o.trim();let c=await fetch(`/api/agents/${encodeURIComponent(e)}/triggers`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify(r)});if(!c.ok){let e=await c.json().catch(()=>null);throw Error(e?.error??c.statusText)}f(``),s(``),a(300),t()}catch(e){m(e.message)}finally{g(!1)}}return(0,u.jsxs)(`form`,{className:`card`,onSubmit:_,children:[(0,u.jsx)(`h3`,{children:`Add trigger`}),(0,u.jsxs)(`div`,{className:`mb-3 flex gap-3`,children:[(0,u.jsxs)(`label`,{className:`m-0 inline-flex cursor-pointer items-center gap-1`,children:[(0,u.jsx)(`input`,{type:`radio`,checked:n===`interval`,onChange:()=>r(`interval`)}),`interval (every N seconds)`]}),(0,u.jsxs)(`label`,{className:`m-0 inline-flex cursor-pointer items-center gap-1`,children:[(0,u.jsx)(`input`,{type:`radio`,checked:n===`cron`,onChange:()=>r(`cron`)}),`cron (5-field)`]})]}),n===`interval`?(0,u.jsxs)(`label`,{children:[`interval (seconds)`,(0,u.jsx)(`input`,{type:`number`,min:1,value:i,onChange:e=>a(Number(e.target.value))})]}):(0,u.jsxs)(`label`,{children:[`cron expression (minute hour dom month dow)`,(0,u.jsx)(`input`,{type:`text`,placeholder:`*/15 * * * *`,value:o,onChange:e=>s(e.target.value)})]}),(0,u.jsxs)(`label`,{children:[`message`,(0,u.jsx)(`textarea`,{placeholder:`e.g. check your inbox and act on anything new`,value:d,onChange:e=>f(e.target.value),className:`font-mono text-[0.9em] min-h-[80px]`})]}),(0,u.jsxs)(`div`,{className:`mt-3 flex items-center gap-3`,children:[(0,u.jsx)(c,{variant:`primary`,type:`submit`,disabled:h,children:h?`adding…`:`add`}),p&&(0,u.jsx)(`span`,{role:`alert`,className:`text-[0.85em] text-danger`,children:p})]})]})}export{d as component};
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-_bmG-wVG.js";import{a}from"./index-CLdmsmiN.js";import{r as o}from"./Page-NV96O47A.js";import{t as s}from"./AgentTabs-BcmmwYJc.js";import{t as c}from"./Button-ByiV6fpd.js";var l=e(n()),u=t();function d(){let{resolved:e,triggers:t,dispatches:n}=a.useLoaderData(),d=r(),[p,m]=(0,l.useState)(null),[h,g]=(0,l.useState)(null),[_,v]=(0,l.useState)(null);async function y(e){v(e.id),g(null);try{let t=await fetch(`/api/triggers/${encodeURIComponent(e.id)}`,{method:`PATCH`,headers:{"content-type":`application/json`},body:JSON.stringify({enabled:!e.enabled})});if(!t.ok){let n=await t.json().catch(()=>null);throw Error(n?.error??`Could not ${e.enabled?`disable`:`enable`} trigger`)}await d.invalidate()}catch(e){g(e instanceof Error?e.message:String(e))}finally{v(null)}}async function b(e){let t=await fetch(`/api/triggers/${encodeURIComponent(e)}`,{method:`DELETE`});if(!t.ok&&t.status!==204){let e=await t.json().catch(()=>null);throw Error(e?.error??`Could not delete trigger`)}await d.invalidate()}return(0,u.jsxs)(o,{children:[(0,u.jsx)(`header`,{className:`mb-6`,children:(0,u.jsx)(`h1`,{children:e.agent.name})}),(0,u.jsx)(s,{agentId:e.agent.id,active:`triggers`,archived:e.agent.status===`archived`}),(0,u.jsx)(f,{agentId:e.agent.id,onAdded:()=>d.invalidate()}),h&&(0,u.jsx)(`p`,{role:`alert`,className:`err mt-4`,children:h}),(0,u.jsx)(`h3`,{className:`mb-3 mt-6 font-body text-[0.85em] font-semibold uppercase tracking-wider text-mocha-light`,children:`Active triggers`}),t.length===0?(0,u.jsx)(`p`,{className:`muted`,children:`no triggers yet — add one above.`}):(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(`div`,{className:`grid gap-3 md:hidden`,children:t.map(e=>{let t=e.kind===`interval`?`every ${e.intervalSec}s`:e.cronExpr,n=e.lastFiredAt?new Date(e.lastFiredAt).toLocaleString():`Never`;return(0,u.jsxs)(`article`,{className:`card min-w-0 ${e.enabled?``:`opacity-60`}`,children:[(0,u.jsxs)(`div`,{className:`flex min-w-0 items-start justify-between gap-3`,children:[(0,u.jsxs)(`div`,{className:`min-w-0`,children:[(0,u.jsx)(`p`,{className:`m-0 break-all font-mono text-xs text-muted-foreground`,children:e.id}),(0,u.jsx)(`p`,{className:`mb-0 mt-1 font-medium text-foreground`,children:t})]}),(0,u.jsx)(`span`,{className:`shrink-0 rounded-sm border border-frost bg-ivory px-2 py-0.5 font-mono text-xs text-mocha`,children:e.kind})]}),(0,u.jsx)(`p`,{className:`my-3 break-words text-sm text-foreground`,children:e.message}),(0,u.jsxs)(`p`,{className:`mb-3 text-xs text-muted-foreground`,children:[`Last fired: `,n]}),(0,u.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,u.jsx)(c,{variant:`ghost`,disabled:_===e.id,onClick:()=>void y(e),children:_===e.id?`Working…`:e.enabled?`Disable`:`Enable`}),(0,u.jsx)(c,{variant:`danger`,disabled:_===e.id,onClick:()=>{g(null),m(e)},children:`Delete`})]})]},e.id)})}),(0,u.jsx)(`div`,{className:`hidden overflow-x-auto md:block`,children:(0,u.jsxs)(`table`,{className:`min-w-full`,children:[(0,u.jsx)(`thead`,{children:(0,u.jsxs)(`tr`,{children:[(0,u.jsx)(`th`,{children:`id`}),(0,u.jsx)(`th`,{children:`kind`}),(0,u.jsx)(`th`,{children:`spec`}),(0,u.jsx)(`th`,{children:`message`}),(0,u.jsx)(`th`,{children:`last fired`}),(0,u.jsx)(`th`,{})]})}),(0,u.jsx)(`tbody`,{children:t.map(e=>{let t=e.kind===`interval`?`every ${e.intervalSec}s`:e.cronExpr,n=e.lastFiredAt?new Date(e.lastFiredAt).toLocaleString():`(never)`;return(0,u.jsxs)(`tr`,{className:e.enabled?``:`opacity-60`,children:[(0,u.jsx)(`td`,{children:(0,u.jsxs)(`code`,{children:[e.id.slice(0,8),`…`]})}),(0,u.jsx)(`td`,{children:(0,u.jsx)(`span`,{className:`inline-block rounded-sm border border-frost bg-ivory px-2 py-0.5 font-mono text-[0.8em] text-mocha`,children:e.kind})}),(0,u.jsx)(`td`,{children:(0,u.jsx)(`code`,{children:t})}),(0,u.jsx)(`td`,{children:e.message.length>60?`${e.message.slice(0,60)}…`:e.message}),(0,u.jsx)(`td`,{className:`text-[0.82em] text-mocha-light`,children:n}),(0,u.jsx)(`td`,{children:(0,u.jsxs)(`div`,{className:`flex gap-1.5`,children:[(0,u.jsx)(c,{variant:`ghost`,disabled:_===e.id,onClick:()=>void y(e),children:_===e.id?`working…`:e.enabled?`disable`:`enable`}),(0,u.jsx)(c,{variant:`danger`,disabled:_===e.id,onClick:()=>{g(null),m(e)},children:`delete`})]})})]},e.id)})})]})})]}),(0,u.jsx)(`h3`,{className:`mb-3 mt-8 font-body text-[0.85em] font-semibold uppercase tracking-wider text-mocha-light`,children:`Recent dispatches`}),n.length===0?(0,u.jsx)(`p`,{className:`muted`,children:`no scheduled occurrences yet.`}):(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(`div`,{className:`grid gap-3 md:hidden`,children:n.map(e=>(0,u.jsxs)(`article`,{className:`card min-w-0`,children:[(0,u.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,u.jsx)(`time`,{className:`text-sm text-foreground`,children:new Date(e.scheduledAt).toLocaleString()}),(0,u.jsx)(`code`,{className:`shrink-0`,children:e.status})]}),(0,u.jsxs)(`p`,{className:`mb-0 mt-2 text-xs text-muted-foreground`,children:[e.attemptCount,` attempt`,e.attemptCount===1?``:`s`]}),e.lastError&&(0,u.jsx)(`p`,{className:`mb-0 mt-2 break-words text-sm text-danger`,children:e.lastError})]},e.id))}),(0,u.jsx)(`div`,{className:`hidden overflow-x-auto md:block`,children:(0,u.jsxs)(`table`,{className:`min-w-full`,children:[(0,u.jsx)(`thead`,{children:(0,u.jsxs)(`tr`,{children:[(0,u.jsx)(`th`,{children:`scheduled`}),(0,u.jsx)(`th`,{children:`status`}),(0,u.jsx)(`th`,{children:`attempts`}),(0,u.jsx)(`th`,{children:`error`})]})}),(0,u.jsx)(`tbody`,{children:n.map(e=>(0,u.jsxs)(`tr`,{children:[(0,u.jsx)(`td`,{className:`text-[0.82em]`,children:new Date(e.scheduledAt).toLocaleString()}),(0,u.jsx)(`td`,{children:(0,u.jsx)(`code`,{children:e.status})}),(0,u.jsx)(`td`,{children:e.attemptCount}),(0,u.jsx)(`td`,{className:`text-[0.82em] text-mocha-light`,children:e.lastError??`—`})]},e.id))})]})})]}),(0,u.jsx)(i,{open:p!==null,title:`Delete ${p?.kind??``} trigger?`,description:(0,u.jsxs)(`p`,{children:[`This permanently removes trigger`,` `,(0,u.jsx)(`code`,{className:`font-mono`,children:p?.id}),`, its recorded dispatch history, and every future scheduled occurrence for `,e.agent.name,`. The Agent itself is not deleted.`]}),confirmLabel:`delete trigger and history`,onConfirm:async()=>{if(p)try{await b(p.id)}catch(e){throw g(e instanceof Error?e.message:String(e)),e}},onOpenChange:e=>{e||m(null)}})]})}function f({agentId:e,onAdded:t}){let[n,r]=(0,l.useState)(`interval`),[i,a]=(0,l.useState)(300),[o,s]=(0,l.useState)(``),[d,f]=(0,l.useState)(``),[p,m]=(0,l.useState)(null),[h,g]=(0,l.useState)(!1);async function _(r){if(r.preventDefault(),m(null),!d.trim()){m(`message is required`);return}if(n===`interval`&&(!Number.isFinite(i)||i<=0)){m(`interval must be a positive number`);return}if(n===`cron`&&!o.trim()){m(`cron expression is required`);return}g(!0);try{let r={kind:n,message:d.trim()};n===`interval`?r.intervalSec=i:r.cronExpr=o.trim();let c=await fetch(`/api/agents/${encodeURIComponent(e)}/triggers`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify(r)});if(!c.ok){let e=await c.json().catch(()=>null);throw Error(e?.error??c.statusText)}f(``),s(``),a(300),t()}catch(e){m(e.message)}finally{g(!1)}}return(0,u.jsxs)(`form`,{className:`card`,onSubmit:_,children:[(0,u.jsx)(`h3`,{children:`Add trigger`}),(0,u.jsxs)(`div`,{className:`mb-3 flex gap-3`,children:[(0,u.jsxs)(`label`,{className:`m-0 inline-flex cursor-pointer items-center gap-1`,children:[(0,u.jsx)(`input`,{type:`radio`,checked:n===`interval`,onChange:()=>r(`interval`)}),`interval (every N seconds)`]}),(0,u.jsxs)(`label`,{className:`m-0 inline-flex cursor-pointer items-center gap-1`,children:[(0,u.jsx)(`input`,{type:`radio`,checked:n===`cron`,onChange:()=>r(`cron`)}),`cron (5-field)`]})]}),n===`interval`?(0,u.jsxs)(`label`,{children:[`interval (seconds)`,(0,u.jsx)(`input`,{type:`number`,min:1,value:i,onChange:e=>a(Number(e.target.value))})]}):(0,u.jsxs)(`label`,{children:[`cron expression (minute hour dom month dow)`,(0,u.jsx)(`input`,{type:`text`,placeholder:`*/15 * * * *`,value:o,onChange:e=>s(e.target.value)})]}),(0,u.jsxs)(`label`,{children:[`message`,(0,u.jsx)(`textarea`,{placeholder:`e.g. check your inbox and act on anything new`,value:d,onChange:e=>f(e.target.value),className:`font-mono text-[0.9em] min-h-[80px]`})]}),(0,u.jsxs)(`div`,{className:`mt-3 flex items-center gap-3`,children:[(0,u.jsx)(c,{variant:`primary`,type:`submit`,disabled:h,children:h?`adding…`:`add`}),p&&(0,u.jsx)(`span`,{role:`alert`,className:`text-[0.85em] text-danger`,children:p})]})]})}export{d as component};
@@ -1 +1 @@
1
- import{t as e}from"./jsx-runtime-DGeXAQPT.js";import{q as t}from"./index-BVfpuiby.js";import{i as n,n as r,r as i}from"./Page-NV96O47A.js";var a=t(`arrow-right`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`m12 5 7 7-7 7`,key:`xquz4c`}]]),o=e();function s(){return(0,o.jsxs)(i,{size:`narrow`,children:[(0,o.jsx)(r,{eyebrow:`First run`,title:`Welcome to bazilion`,description:`Configure one model provider to prepare your defaults, then test it before the first conversation.`}),(0,o.jsxs)(n,{title:`Three steps to your first conversation`,children:[(0,o.jsxs)(`p`,{className:`text-sm leading-6 text-muted-foreground`,children:[`Before you can spawn agents, enable a provider and save at least one concrete model id. Bazilion then creates a `,(0,o.jsx)(`code`,{children:`default`}),` Agent template and `,(0,o.jsx)(`code`,{children:`default`}),` Team. Send the small connection test before relying on that model.`]}),(0,o.jsxs)(`ol`,{className:`my-5 space-y-4`,children:[(0,o.jsxs)(c,{n:1,children:[(0,o.jsx)(`strong`,{children:`Choose a provider.`}),` Head to the`,` `,(0,o.jsx)(`a`,{href:`/config`,children:`providers tab`}),`, pick a provider, and set credentials or a local endpoint if that provider needs one. Local providers like Ollama and LM Studio can use their default loopback URLs.`]}),(0,o.jsxs)(c,{n:2,children:[(0,o.jsx)(`strong`,{children:`Enable it and save a model.`}),` Flip the provider's toggle on, then click a catalog chip or type one exact model id (for example`,` `,(0,o.jsx)(`code`,{children:`claude-opus-5`}),`, `,(0,o.jsx)(`code`,{children:`gpt-5.6-sol`}),`, or `,(0,o.jsx)(`code`,{children:`llama3.3`}),`) and press `,(0,o.jsx)(`em`,{children:`save models`}),`.`]}),(0,o.jsxs)(c,{n:3,children:[(0,o.jsx)(`strong`,{children:`Verify and spawn.`}),` Send the short real-model test. When setup is configured, the page gives you a direct action to spawn the first agent from the`,` `,(0,o.jsx)(`code`,{children:`default`}),` template.`]})]}),(0,o.jsxs)(`a`,{href:`/config`,className:`btn-primary no-underline`,children:[`Configure providers `,(0,o.jsx)(a,{className:`h-4 w-4`,"aria-hidden":`true`})]})]})]})}function c({n:e,children:t}){return(0,o.jsxs)(`li`,{className:`grid grid-cols-[2rem_1fr] gap-3 border-t border-frost pt-3 first:border-t-0 first:pt-0`,children:[(0,o.jsx)(`span`,{className:`text-center font-display text-xl text-sapphire`,children:e}),(0,o.jsx)(`div`,{className:`text-[0.92em] leading-relaxed text-mocha`,children:t})]})}export{s as component};
1
+ import{t as e}from"./jsx-runtime-DGeXAQPT.js";import{q as t}from"./index-CLdmsmiN.js";import{i as n,n as r,r as i}from"./Page-NV96O47A.js";var a=t(`arrow-right`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`m12 5 7 7-7 7`,key:`xquz4c`}]]),o=e();function s(){return(0,o.jsxs)(i,{size:`narrow`,children:[(0,o.jsx)(r,{eyebrow:`First run`,title:`Welcome to bazilion`,description:`Configure one model provider to prepare your defaults, then test it before the first conversation.`}),(0,o.jsxs)(n,{title:`Three steps to your first conversation`,children:[(0,o.jsxs)(`p`,{className:`text-sm leading-6 text-muted-foreground`,children:[`Before you can spawn agents, enable a provider and save at least one concrete model id. Bazilion then creates a `,(0,o.jsx)(`code`,{children:`default`}),` Agent template and `,(0,o.jsx)(`code`,{children:`default`}),` Team. Send the small connection test before relying on that model.`]}),(0,o.jsxs)(`ol`,{className:`my-5 space-y-4`,children:[(0,o.jsxs)(c,{n:1,children:[(0,o.jsx)(`strong`,{children:`Choose a provider.`}),` Head to the`,` `,(0,o.jsx)(`a`,{href:`/config`,children:`providers tab`}),`, pick a provider, and set credentials or a local endpoint if that provider needs one. Local providers like Ollama and LM Studio can use their default loopback URLs.`]}),(0,o.jsxs)(c,{n:2,children:[(0,o.jsx)(`strong`,{children:`Enable it and save a model.`}),` Flip the provider's toggle on, then click a catalog chip or type one exact model id (for example`,` `,(0,o.jsx)(`code`,{children:`claude-opus-5`}),`, `,(0,o.jsx)(`code`,{children:`gpt-6-astra`}),`, or `,(0,o.jsx)(`code`,{children:`llama3.3`}),`) and press `,(0,o.jsx)(`em`,{children:`save models`}),`.`]}),(0,o.jsxs)(c,{n:3,children:[(0,o.jsx)(`strong`,{children:`Verify and spawn.`}),` Send the short real-model test. When setup is configured, the page gives you a direct action to spawn the first agent from the`,` `,(0,o.jsx)(`code`,{children:`default`}),` template.`]})]}),(0,o.jsxs)(`a`,{href:`/config`,className:`btn-primary no-underline`,children:[`Configure providers `,(0,o.jsx)(a,{className:`h-4 w-4`,"aria-hidden":`true`})]})]})]})}function c({n:e,children:t}){return(0,o.jsxs)(`li`,{className:`grid grid-cols-[2rem_1fr] gap-3 border-t border-frost pt-3 first:border-t-0 first:pt-0`,children:[(0,o.jsx)(`span`,{className:`text-center font-display text-xl text-sapphire`,children:e}),(0,o.jsx)(`div`,{className:`text-[0.92em] leading-relaxed text-mocha`,children:t})]})}export{s as component};
@@ -1,4 +1,4 @@
1
- import{r as e,t}from"./jsx-runtime-DGeXAQPT.js";import{t as n}from"./react-3W8R1pOO.js";import{t as r}from"./ConfirmDialog-BAiyYC8w.js";import{t as i}from"./Button-ByiV6fpd.js";var a=e(n(),1);function o(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 l(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
1
+ import{r as e,t}from"./jsx-runtime-DGeXAQPT.js";import{t as n}from"./react-3W8R1pOO.js";import{t as r}from"./ConfirmDialog-_bmG-wVG.js";import{t as i}from"./Button-ByiV6fpd.js";var a=e(n(),1);function o(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 l(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
2
2
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function u(e,t){return s(e)||c(e,t)||d(e,t)||l()}function d(e,t){if(e){if(typeof e==`string`)return o(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)?o(e,t):void 0}}var ee=Object.entries,te=Object.setPrototypeOf,f=Object.isFrozen,ne=Object.getPrototypeOf,p=Object.getOwnPropertyDescriptor,m=Object.freeze,h=Object.seal,g=Object.create,_=typeof Reflect<`u`&&Reflect,re=_.apply,ie=_.construct;m||=function(e){return e},h||=function(e){return e},re||=function(e,t){var n=[...arguments].slice(2);return e.apply(t,n)},ie||=function(e){return new e(...[...arguments].slice(1))};var ae=D(Array.prototype.forEach),oe=D(Array.prototype.lastIndexOf),se=D(Array.prototype.pop),ce=D(Array.prototype.push),le=D(Array.prototype.splice),v=Array.isArray,ue=D(String.prototype.toLowerCase),de=D(String.prototype.toString),fe=D(String.prototype.match),y=D(String.prototype.replace),pe=D(String.prototype.indexOf),me=D(String.prototype.trim),b=D(Number.prototype.toString),x=D(Boolean.prototype.toString),S=typeof BigInt>`u`?null:D(BigInt.prototype.toString),C=typeof Symbol>`u`?null:D(Symbol.prototype.toString),w=D(Object.prototype.hasOwnProperty),T=D(Object.prototype.toString),E=D(RegExp.prototype.test),he=ge(TypeError);function D(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);var n=[...arguments].slice(1);return re(e,t,n)}}function ge(e){return function(){return ie(e,[...arguments])}}function O(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:ue;if(te&&te(e,null),!v(t))return e;let r=t.length;for(;r--;){let i=t[r];if(typeof i==`string`){let e=n(i);e!==i&&(f(t)||(t[r]=e),i=e)}e[i]=!0}return e}function _e(e){for(let t=0;t<e.length;t++)w(e,t)||(e[t]=null);return e}function k(e){let t=g(null);for(let r of ee(e)){var n=u(r,2);let i=n[0],a=n[1];w(e,i)&&(v(a)?t[i]=_e(a):a&&typeof a==`object`&&a.constructor===Object?t[i]=k(a):t[i]=a)}return t}function ve(e){switch(typeof e){case`string`:return e;case`number`:return b(e);case`boolean`:return x(e);case`bigint`:return S?S(e):`0`;case`symbol`:return C?C(e):`Symbol()`;case`undefined`:return T(e);case`function`:case`object`:{if(e===null)return T(e);let t=e,n=A(t,`toString`);if(typeof n==`function`){let e=n(t);return typeof e==`string`?e:T(e)}return T(e)}default:return T(e)}}function A(e,t){for(;e!==null;){let n=p(e,t);if(n){if(n.get)return D(n.get);if(typeof n.value==`function`)return D(n.value)}e=ne(e)}function n(){return null}return n}function ye(e){try{return E(e,``),!0}catch{return!1}}var be=m(`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(`.`)),xe=m(`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(`.`)),Se=m([`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`]),Ce=m([`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`]),we=m(`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(`.`)),Te=m([`maction`,`maligngroup`,`malignmark`,`mlongdiv`,`mscarries`,`mscarry`,`msgroup`,`mstack`,`msline`,`msrow`,`semantics`,`annotation`,`annotation-xml`,`mprescripts`,`none`]),Ee=m([`#text`]),De=m(`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(`.`)),Oe=m(`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(`.`)),ke=m(`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(`.`)),Ae=m([`xlink:href`,`xml:id`,`xlink:title`,`xml:space`,`xmlns:xlink`]),je=h(/{{[\w\W]*|^[\w\W]*}}/g),Me=h(/<%[\w\W]*|^[\w\W]*%>/g),Ne=h(/\${[\w\W]*/g),Pe=h(/^data-[\-\w.\u00B7-\uFFFF]+$/),Fe=h(/^aria-[\-\w]+$/),Ie=h(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Le=h(/^(?:\w+script|data):/i),j=h(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Re=h(/^html$/i),ze=h(/^[a-z][.\w]*(-[.\w]+)+$/i),Be=h(/<[/\w!]/g),Ve=h(/<[/\w]/g),He=h(/<\/no(script|embed|frames)/i),Ue=h(/\/>/i),M={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,processingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},We=function(){return typeof window>`u`?null:window},Ge=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}},Ke=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},qe=function(e,t,n,r){return w(e,t)&&v(e[t])?O(r.base?k(r.base):{},e[t],r.transform):n};function Je(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:We(),t=e=>Je(e);if(t.version=`3.4.11`,t.removed=[],!e||!e.document||e.document.nodeType!==M.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,te=A(d,`cloneNode`),f=A(d,`remove`),ne=A(d,`nextSibling`),p=A(d,`childNodes`),_=A(d,`parentNode`),re=A(d,`shadowRoot`),ie=A(d,`attributes`),b=o&&o.prototype?A(o.prototype,`nodeType`):null,x=o&&o.prototype?A(o.prototype,`nodeName`):null;if(typeof a==`function`){let e=n.createElement(`template`);e.content&&e.content.ownerDocument&&(n=e.content.ownerDocument)}let S,C=``,T,D=!1,ge=0,_e=function(){if(ge>0)throw he(`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.`)},Ye=function(e){_e(),ge++;try{return S.createHTML(e)}finally{ge--}},Xe=function(e){_e(),ge++;try{return S.createScriptURL(e)}finally{ge--}},Ze=function(){return D||=(T=Ge(u,i),!0),T},Qe=n,N=Qe.implementation,$e=Qe.createNodeIterator,P=Qe.createDocumentFragment,et=Qe.getElementsByTagName,F=r.importNode,I=Ke();t.isSupported=typeof ee==`function`&&typeof _==`function`&&N&&N.createHTMLDocument!==void 0;let tt=je,nt=Me,rt=Ne,it=Pe,at=Fe,ot=Le,st=j,ct=ze,lt=Ie,L=null,ut=O({},[...be,...xe,...Se,...we,...Ee]),R=null,dt=O({},[...De,...Oe,...ke,...Ae]),z=Object.seal(g(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}})),ft=null,pt=null,B=Object.seal(g(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}})),mt=!0,ht=!0,gt=!1,_t=!0,V=!1,vt=!0,yt=!1,bt=!1,xt=null,St=null,Ct=!1,wt=!1,Tt=!1,Et=!1,Dt=!0,Ot=!1,kt=`user-content-`,At=!0,jt=!1,Mt={},H=null,Nt=O({},`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(`.`)),Pt=null,Ft=O({},[`audio`,`video`,`img`,`source`,`image`,`track`]),It=null,Lt=O({},[`alt`,`class`,`for`,`id`,`label`,`name`,`pattern`,`placeholder`,`role`,`summary`,`title`,`value`,`style`,`xmlns`]),Rt=`http://www.w3.org/1998/Math/MathML`,zt=`http://www.w3.org/2000/svg`,U=`http://www.w3.org/1999/xhtml`,W=U,Bt=!1,Vt=null,Ht=O({},[Rt,zt,U],de),Ut=m([`mi`,`mo`,`mn`,`ms`,`mtext`]),Wt=O({},Ut),Gt=m([`annotation-xml`]),Kt=O({},Gt),qt=O({},[`title`,`style`,`font`,`a`,`script`]),Jt=null,Yt=[`application/xhtml+xml`,`text/html`],G=null,Xt=null,Zt=n.createElement(`form`),K=function(e){return e instanceof RegExp||e instanceof Function},Qt=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(Xt&&Xt===e)return;(!e||typeof e!=`object`)&&(e={}),e=k(e),Jt=Yt.indexOf(e.PARSER_MEDIA_TYPE)===-1?`text/html`:e.PARSER_MEDIA_TYPE,G=Jt===`application/xhtml+xml`?de:ue,L=qe(e,`ALLOWED_TAGS`,ut,{transform:G}),R=qe(e,`ALLOWED_ATTR`,dt,{transform:G}),Vt=qe(e,`ALLOWED_NAMESPACES`,Ht,{transform:de}),It=qe(e,`ADD_URI_SAFE_ATTR`,Lt,{transform:G,base:Lt}),Pt=qe(e,`ADD_DATA_URI_TAGS`,Ft,{transform:G,base:Ft}),H=qe(e,`FORBID_CONTENTS`,Nt,{transform:G}),ft=qe(e,`FORBID_TAGS`,k({}),{transform:G}),pt=qe(e,`FORBID_ATTR`,k({}),{transform:G}),Mt=w(e,`USE_PROFILES`)?e.USE_PROFILES&&typeof e.USE_PROFILES==`object`?k(e.USE_PROFILES):e.USE_PROFILES:!1,mt=e.ALLOW_ARIA_ATTR!==!1,ht=e.ALLOW_DATA_ATTR!==!1,gt=e.ALLOW_UNKNOWN_PROTOCOLS||!1,_t=e.ALLOW_SELF_CLOSE_IN_ATTR!==!1,V=e.SAFE_FOR_TEMPLATES||!1,vt=e.SAFE_FOR_XML!==!1,yt=e.WHOLE_DOCUMENT||!1,wt=e.RETURN_DOM||!1,Tt=e.RETURN_DOM_FRAGMENT||!1,Et=e.RETURN_TRUSTED_TYPE||!1,Ct=e.FORCE_BODY||!1,Dt=e.SANITIZE_DOM!==!1,Ot=e.SANITIZE_NAMED_PROPS||!1,At=e.KEEP_CONTENT!==!1,jt=e.IN_PLACE||!1,lt=ye(e.ALLOWED_URI_REGEXP)?e.ALLOWED_URI_REGEXP:Ie,W=typeof e.NAMESPACE==`string`?e.NAMESPACE:U,Wt=w(e,`MATHML_TEXT_INTEGRATION_POINTS`)&&e.MATHML_TEXT_INTEGRATION_POINTS&&typeof e.MATHML_TEXT_INTEGRATION_POINTS==`object`?k(e.MATHML_TEXT_INTEGRATION_POINTS):O({},Ut),Kt=w(e,`HTML_INTEGRATION_POINTS`)&&e.HTML_INTEGRATION_POINTS&&typeof e.HTML_INTEGRATION_POINTS==`object`?k(e.HTML_INTEGRATION_POINTS):O({},Gt);let t=w(e,`CUSTOM_ELEMENT_HANDLING`)&&e.CUSTOM_ELEMENT_HANDLING&&typeof e.CUSTOM_ELEMENT_HANDLING==`object`?k(e.CUSTOM_ELEMENT_HANDLING):g(null);if(z=g(null),w(t,`tagNameCheck`)&&K(t.tagNameCheck)&&(z.tagNameCheck=t.tagNameCheck),w(t,`attributeNameCheck`)&&K(t.attributeNameCheck)&&(z.attributeNameCheck=t.attributeNameCheck),w(t,`allowCustomizedBuiltInElements`)&&typeof t.allowCustomizedBuiltInElements==`boolean`&&(z.allowCustomizedBuiltInElements=t.allowCustomizedBuiltInElements),h(z),V&&(ht=!1),Tt&&(wt=!0),Mt&&(L=O({},Ee),R=g(null),Mt.html===!0&&(O(L,be),O(R,De)),Mt.svg===!0&&(O(L,xe),O(R,Oe),O(R,Ae)),Mt.svgFilters===!0&&(O(L,Se),O(R,Oe),O(R,Ae)),Mt.mathMl===!0&&(O(L,we),O(R,ke),O(R,Ae))),B.tagCheck=null,B.attributeCheck=null,w(e,`ADD_TAGS`)&&(typeof e.ADD_TAGS==`function`?B.tagCheck=e.ADD_TAGS:v(e.ADD_TAGS)&&(L===ut&&(L=k(L)),O(L,e.ADD_TAGS,G))),w(e,`ADD_ATTR`)&&(typeof e.ADD_ATTR==`function`?B.attributeCheck=e.ADD_ATTR:v(e.ADD_ATTR)&&(R===dt&&(R=k(R)),O(R,e.ADD_ATTR,G))),w(e,`ADD_URI_SAFE_ATTR`)&&v(e.ADD_URI_SAFE_ATTR)&&O(It,e.ADD_URI_SAFE_ATTR,G),w(e,`FORBID_CONTENTS`)&&v(e.FORBID_CONTENTS)&&(H===Nt&&(H=k(H)),O(H,e.FORBID_CONTENTS,G)),w(e,`ADD_FORBID_CONTENTS`)&&v(e.ADD_FORBID_CONTENTS)&&(H===Nt&&(H=k(H)),O(H,e.ADD_FORBID_CONTENTS,G)),At&&(L[`#text`]=!0),yt&&O(L,[`html`,`head`,`body`]),L.table&&(O(L,[`tbody`]),delete ft.tbody),e.TRUSTED_TYPES_POLICY){if(typeof e.TRUSTED_TYPES_POLICY.createHTML!=`function`)throw he(`TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.`);if(typeof e.TRUSTED_TYPES_POLICY.createScriptURL!=`function`)throw he(`TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.`);let t=S;S=e.TRUSTED_TYPES_POLICY;try{C=Ye(``)}catch(e){throw S=t,e}}else e.TRUSTED_TYPES_POLICY===null?(S=void 0,C=``):(S===void 0&&(S=Ze()),S&&typeof C==`string`&&(C=Ye(``)));m&&m(e),Xt=e},$t=O({},[...xe,...Se,...Ce]),q=O({},[...we,...Te]),en=function(e,t,n){return t.namespaceURI===U?e===`svg`:t.namespaceURI===Rt?e===`svg`&&(n===`annotation-xml`||Wt[n]):!!$t[e]},tn=function(e,t,n){return t.namespaceURI===U?e===`math`:t.namespaceURI===zt?e===`math`&&Kt[n]:!!q[e]},nn=function(e,t,n){return t.namespaceURI===zt&&!Kt[n]||t.namespaceURI===Rt&&!Wt[n]?!1:!q[e]&&(qt[e]||!$t[e])},rn=function(e){let t=_(e);(!t||!t.tagName)&&(t={namespaceURI:W,tagName:`template`});let n=ue(e.tagName),r=ue(t.tagName);return Vt[e.namespaceURI]?e.namespaceURI===zt?en(n,t,r):e.namespaceURI===Rt?tn(n,t,r):e.namespaceURI===U?nn(n,t,r):!!(Jt===`application/xhtml+xml`&&Vt[e.namespaceURI]):!1},an=function(e){ce(t.removed,{element:e});try{_(e).removeChild(e)}catch{if(f(e),!_(e))throw he(`a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place`)}},on=function(e){let t=p(e);if(t){let e=[];ae(t,t=>{ce(e,t)}),ae(e,e=>{try{f(e)}catch{}})}let n=ie(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{}}},J=function(e,n){try{ce(t.removed,{attribute:n.getAttributeNode(e),from:n})}catch{ce(t.removed,{attribute:null,from:n})}if(n.removeAttribute(e),e===`is`)if(wt||Tt)try{an(n)}catch{}else try{n.setAttribute(e,``)}catch{}},sn=function(e){let t=ie(e);if(t)for(let n=t.length-1;n>=0;--n){let r=t[n],i=r&&r.name;if(!(typeof i!=`string`||R[G(i)]))try{e.removeAttribute(i)}catch{}}},cn=function(e){let t=[e];for(;t.length>0;){let e=t.pop();(b?b(e):e.nodeType)===M.element&&sn(e);let n=p(e);if(n)for(let e=n.length-1;e>=0;--e)t.push(n[e])}},Y=function(e){let t=null,r=null;if(Ct)e=`<remove></remove>`+e;else{let t=fe(e,/^[\r\n\t ]+/);r=t&&t[0]}Jt===`application/xhtml+xml`&&W===U&&(e=`<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>`+e+`</body></html>`);let i=S?Ye(e):e;if(W===U)try{t=new l().parseFromString(i,Jt)}catch{}if(!t||!t.documentElement){t=N.createDocument(W,`template`,null);try{t.documentElement.innerHTML=Bt?C:i}catch{}}let a=t.body||t.documentElement;return e&&r&&a.insertBefore(n.createTextNode(r),a.childNodes[0]||null),W===U?et.call(t,yt?`html`:`body`)[0]:yt?t.documentElement:a},ln=function(e){return $e.call(e.ownerDocument||e,e,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT|c.SHOW_PROCESSING_INSTRUCTION|c.SHOW_CDATA_SECTION,null)},X=function(e){return e=y(e,tt,` `),e=y(e,nt,` `),e=y(e,rt,` `),e},Z=function(e){e.normalize();let t=$e.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=X(n.data),n=t.nextNode();let r=e.querySelectorAll?.call(e,`template`);r&&ae(r,e=>{dn(e.content)&&Z(e.content)})},un=function(e){let t=x?x(e):null;return typeof t!=`string`||G(t)!==`form`?!1:typeof e.nodeName!=`string`||typeof e.textContent!=`string`||typeof e.removeChild!=`function`||e.attributes!==ie(e)||typeof e.removeAttribute!=`function`||typeof e.setAttribute!=`function`||typeof e.namespaceURI!=`string`||typeof e.insertBefore!=`function`||typeof e.hasChildNodes!=`function`||e.nodeType!==b(e)||e.childNodes!==p(e)},dn=function(e){if(!b||typeof e!=`object`||!e)return!1;try{return b(e)===M.documentFragment}catch{return!1}},fn=function(e){if(!b||typeof e!=`object`||!e)return!1;try{return typeof b(e)==`number`}catch{return!1}};function Q(e,n,r){e.length!==0&&ae(e,e=>{e.call(t,n,r,Xt)})}let $=function(e,t){return!!(vt&&e.hasChildNodes()&&!fn(e.firstElementChild)&&E(Be,e.textContent)&&E(Be,e.innerHTML)||vt&&e.namespaceURI===U&&t===`style`&&fn(e.firstElementChild)||e.nodeType===M.processingInstruction||vt&&e.nodeType===M.comment&&E(Ve,e.data))},pn=function(e,t){if(!ft[t]&&_n(t)&&(z.tagNameCheck instanceof RegExp&&E(z.tagNameCheck,t)||z.tagNameCheck instanceof Function&&z.tagNameCheck(t)))return!1;if(At&&!H[t]){let t=_(e),n=p(e);if(n&&t){let r=n.length;for(let i=r-1;i>=0;--i){let r=jt?n[i]:te(n[i],!0);t.insertBefore(r,ne(e))}}}return an(e),!0},mn=function(e){if(Q(I.beforeSanitizeElements,e,null),un(e))return an(e),!0;let n=G(x?x(e):e.nodeName);if(Q(I.uponSanitizeElement,e,{tagName:n,allowedTags:L}),$(e,n))return an(e),!0;if(ft[n]||!(B.tagCheck instanceof Function&&B.tagCheck(n))&&!L[n])return pn(e,n);if((b?b(e):e.nodeType)===M.element&&!rn(e)||(n===`noscript`||n===`noembed`||n===`noframes`)&&E(He,e.innerHTML))return an(e),!0;if(V&&e.nodeType===M.text){let n=X(e.textContent);e.textContent!==n&&(ce(t.removed,{element:e.cloneNode()}),e.textContent=n)}return Q(I.afterSanitizeElements,e,null),!1},hn=function(e,t,r){if(pt[t]||Dt&&(t===`id`||t===`name`)&&(r in n||r in Zt))return!1;let i=R[t]||B.attributeCheck instanceof Function&&B.attributeCheck(t,e);if(!(ht&&E(it,t))&&!(mt&&E(at,t))){if(!i){if(!(_n(e)&&(z.tagNameCheck instanceof RegExp&&E(z.tagNameCheck,e)||z.tagNameCheck instanceof Function&&z.tagNameCheck(e))&&(z.attributeNameCheck instanceof RegExp&&E(z.attributeNameCheck,t)||z.attributeNameCheck instanceof Function&&z.attributeNameCheck(t,e))||t===`is`&&z.allowCustomizedBuiltInElements&&(z.tagNameCheck instanceof RegExp&&E(z.tagNameCheck,r)||z.tagNameCheck instanceof Function&&z.tagNameCheck(r))))return!1}else if(!It[t]&&!E(lt,y(r,st,``))&&!((t===`src`||t===`xlink:href`||t===`href`)&&e!==`script`&&pe(r,`data:`)===0&&Pt[e])&&!(gt&&!E(ot,y(r,st,``)))&&r)return!1}return!0},gn=O({},[`annotation-xml`,`color-profile`,`font-face`,`font-face-format`,`font-face-name`,`font-face-src`,`font-face-uri`,`missing-glyph`]),_n=function(e){return!gn[ue(e)]&&E(ct,e)},vn=function(e,t,n,r){if(S&&typeof u==`object`&&typeof u.getAttributeType==`function`&&!n)switch(u.getAttributeType(e,t)){case`TrustedHTML`:return Ye(r);case`TrustedScriptURL`:return Xe(r)}return r},yn=function(e,n,r,i){try{r?e.setAttributeNS(r,n,i):e.setAttribute(n,i),un(e)?an(e):se(t.removed)}catch{J(n,e)}},bn=function(e){Q(I.beforeSanitizeAttributes,e,null);let t=e.attributes;if(!t||un(e))return;let n={attrName:``,attrValue:``,keepAttr:!0,allowedAttributes:R,forceKeepAttr:void 0},r=t.length,i=G(e.nodeName);for(;r--;){let a=t[r],o=a.name,s=a.namespaceURI,c=a.value,l=G(o),u=c,d=o===`value`?u:me(u);if(n.attrName=l,n.attrValue=d,n.keepAttr=!0,n.forceKeepAttr=void 0,Q(I.uponSanitizeAttribute,e,n),d=n.attrValue,Ot&&(l===`id`||l===`name`)&&pe(d,kt)!==0&&(J(o,e),d=kt+d),vt&&E(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,d)){J(o,e);continue}if(l===`attributename`&&fe(d,`href`)){J(o,e);continue}if(!n.forceKeepAttr){if(!n.keepAttr){J(o,e);continue}if(!_t&&E(Ue,d)){J(o,e);continue}if(V&&(d=X(d)),!hn(i,l,d)){J(o,e);continue}d=vn(i,l,s,d),d!==u&&yn(e,o,s,d)}}Q(I.afterSanitizeAttributes,e,null)},xn=function(e){let t=null,n=ln(e);for(Q(I.beforeSanitizeShadowDOM,e,null);t=n.nextNode();)if(Q(I.uponSanitizeShadowNode,t,null),mn(t),bn(t),dn(t.content)&&xn(t.content),(b?b(t):t.nodeType)===M.element){let e=re(t);dn(e)&&(Sn(e),xn(e))}Q(I.afterSanitizeShadowDOM,e,null)},Sn=function(e){let t=[{node:e,shadow:null}];for(;t.length>0;){let e=t.pop();if(e.shadow){xn(e.shadow);continue}let n=e.node,r=(b?b(n):n.nodeType)===M.element,i=p(n);if(i)for(let e=i.length-1;e>=0;--e)t.push({node:i[e],shadow:null});if(r){let e=x?x(n):null;if(typeof e==`string`&&G(e)===`template`){let e=n.content;dn(e)&&t.push({node:e,shadow:null})}}if(r){let e=re(n);dn(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(Bt=!e,Bt&&(e=`<!-->`),typeof e!=`string`&&!fn(e)&&(e=ve(e),typeof e!=`string`))throw he(`dirty is not a string, aborting`);if(!t.isSupported)return e;bt?(L=xt,R=St):Qt(n),(I.uponSanitizeElement.length>0||I.uponSanitizeAttribute.length>0)&&(L=k(L)),I.uponSanitizeAttribute.length>0&&(R=k(R)),t.removed=[];let c=jt&&typeof e!=`string`&&fn(e);if(c){let t=x?x(e):e.nodeName;if(typeof t==`string`){let e=G(t);if(!L[e]||ft[e])throw he(`root node is forbidden and cannot be sanitized in-place`)}if(un(e))throw he(`root node is clobbered and cannot be sanitized in-place`);try{Sn(e)}catch(t){throw on(e),t}}else if(fn(e))i=Y(`<!---->`),a=i.ownerDocument.importNode(e,!0),a.nodeType===M.element&&a.nodeName===`BODY`||a.nodeName===`HTML`?i=a:i.appendChild(a),Sn(a);else{if(!wt&&!V&&!yt&&e.indexOf(`<`)===-1)return S&&Et?Ye(e):e;if(i=Y(e),!i)return wt?null:Et?C:``}i&&Ct&&an(i.firstChild);let l=ln(c?e:i);try{for(;o=l.nextNode();)mn(o),bn(o),dn(o.content)&&xn(o.content)}catch(t){throw c&&on(e),t}if(c)return ae(t.removed,e=>{e.element&&cn(e.element)}),V&&Z(e),e;if(wt){if(V&&Z(i),Tt)for(s=P.call(i.ownerDocument);i.firstChild;)s.appendChild(i.firstChild);else s=i;return(R.shadowroot||R.shadowrootmode)&&(s=F.call(r,s,!0)),s}let u=yt?i.outerHTML:i.innerHTML;return yt&&L[`!doctype`]&&i.ownerDocument&&i.ownerDocument.doctype&&i.ownerDocument.doctype.name&&E(Re,i.ownerDocument.doctype.name)&&(u=`<!DOCTYPE `+i.ownerDocument.doctype.name+`>
3
3
  `+u),V&&(u=X(u)),S&&Et?Ye(u):u},t.setConfig=function(){Qt(arguments.length>0&&arguments[0]!==void 0?arguments[0]:{}),bt=!0,xt=L,St=R},t.clearConfig=function(){Xt=null,bt=!1,xt=null,St=null,S=T,C=``},t.isValidAttribute=function(e,t,n){return Xt||Qt({}),hn(G(e),G(t),n)},t.addHook=function(e,t){typeof t==`function`&&w(I,e)&&ce(I[e],t)},t.removeHook=function(e,t){if(w(I,e)){if(t!==void 0){let n=oe(I[e],t);return n===-1?void 0:le(I[e],n,1)[0]}return se(I[e])}},t.removeHooks=function(e){w(I,e)&&(I[e]=[])},t.removeAllHooks=function(){I=Ke()},t}var Ye=Je();function Xe(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var Ze=Xe();function Qe(e){Ze=e}var N={exec:()=>null};function $e(e){let t=[];return n=>{let r=Math.max(0,Math.min(3,n-1)),i=t[r];return i||(i=e(r),t[r]=i),i}}function P(e,t=``){let n=typeof e==`string`?e:e.source,r={replace:(e,t)=>{let i=typeof t==`string`?t:t.source;return i=i.replace(F.caret,`$1`),n=n.replace(e,i),r},getRegex:()=>new RegExp(n,t)};return r}var et=((e=``)=>{try{return!!RegExp(`(?<=1)(?<!1)`+e)}catch{return!1}})(),F={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:e=>RegExp(`^( {0,3}${e})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:$e(e=>RegExp(`^ {0,${e}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)),hrRegex:$e(e=>RegExp(`^ {0,${e}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`)),fencesBeginRegex:$e(e=>RegExp(`^ {0,${e}}(?:\`\`\`|~~~)`)),headingBeginRegex:$e(e=>RegExp(`^ {0,${e}}#`)),htmlBeginRegex:$e(e=>RegExp(`^ {0,${e}}<(?:[a-z].*>|!--)`,`i`)),blockquoteBeginRegex:$e(e=>RegExp(`^ {0,${e}}>`))},I=/^(?:[ \t]*(?:\n|$))+/,tt=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,nt=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,rt=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,it=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,at=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,ot=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,st=P(ot).replace(/bull/g,at).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,``).getRegex(),ct=P(ot).replace(/bull/g,at).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),lt=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,L=/^[^\n]+/,ut=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,R=P(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace(`label`,ut).replace(`title`,/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),dt=P(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g,at).getRegex(),z=`address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul`,ft=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,pt=P(`^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))`,`i`).replace(`comment`,ft).replace(`tag`,z).replace(`attribute`,/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),B=P(lt).replace(`hr`,rt).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`,``).replace(`|table`,``).replace(`blockquote`,` {0,3}>`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace(`list`,` {0,3}(?:[*+-]|1[.)])[ \\t]+[^ \\t\\n]`).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,z).getRegex(),mt={blockquote:P(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace(`paragraph`,B).getRegex(),code:tt,def:R,fences:nt,heading:it,hr:rt,html:pt,lheading:st,list:dt,newline:I,paragraph:B,table:N,text:L},ht=P(`^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)`).replace(`hr`,rt).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`blockquote`,` {0,3}>`).replace(`code`,`(?: {4}| {0,3} )[^\\n]`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace(`list`,` {0,3}(?:[*+-]|1[.)])[ \\t]`).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,z).getRegex(),gt={...mt,lheading:ct,table:ht,paragraph:P(lt).replace(`hr`,rt).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`,``).replace(`table`,ht).replace(`blockquote`,` {0,3}>`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace(`list`,` {0,3}(?:[*+-]|1[.)])[ \\t]+[^ \\t\\n]`).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,z).getRegex()},_t={...mt,html:P(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace(`comment`,ft).replace(/tag/g,`(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b`).getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:N,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:P(lt).replace(`hr`,rt).replace(`heading`,` *#{1,6} *[^
4
4
  ]`).replace(`lheading`,st).replace(`|table`,``).replace(`blockquote`,` {0,3}>`).replace(`|fences`,``).replace(`|list`,``).replace(`|html`,``).replace(`|tag`,``).getRegex()},V=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,vt=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,yt=/^( {2,}|\\)\n(?!\s*$)/,bt=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,xt=/[\p{P}\p{S}]/u,St=/[\s\p{P}\p{S}]/u,Ct=/[^\s\p{P}\p{S}]/u,wt=P(/^((?![*_])punctSpace)/,`u`).replace(/punctSpace/g,St).getRegex(),Tt=/(?!~)[\p{P}\p{S}]/u,Et=/(?!~)[\s\p{P}\p{S}]/u,Dt=/(?:[^\s\p{P}\p{S}]|~)/u,Ot=P(/link|precode-code|html/,`g`).replace(`link`,/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace(`precode-`,et?"(?<!`)()":"(^^|[^`])").replace(`code`,/(?<b>`+)[^`]+\k<b>(?!`)/).replace(`html`,/<(?! )[^<>]*?>/).getRegex(),kt=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,At=P(kt,`u`).replace(/punct/g,xt).getRegex(),jt=P(kt,`u`).replace(/punct/g,Tt).getRegex(),Mt=`^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)`,H=P(Mt,`gu`).replace(/notPunctSpace/g,Ct).replace(/punctSpace/g,St).replace(/punct/g,xt).getRegex(),Nt=P(Mt,`gu`).replace(/notPunctSpace/g,Dt).replace(/punctSpace/g,Et).replace(/punct/g,Tt).getRegex(),Pt=P(`^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)`,`gu`).replace(/notPunctSpace/g,Ct).replace(/punctSpace/g,St).replace(/punct/g,xt).getRegex(),Ft=P(/^~~?(?:((?!~)punct)|[^\s~])/,`u`).replace(/punct/g,xt).getRegex(),It=P(`^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)`,`gu`).replace(/notPunctSpace/g,Ct).replace(/punctSpace/g,St).replace(/punct/g,xt).getRegex(),Lt=P(/\\(punct)/,`gu`).replace(/punct/g,xt).getRegex(),Rt=P(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace(`scheme`,/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace(`email`,/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),zt=P(ft).replace(`(?:-->|$)`,`-->`).getRegex(),U=P(`^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>`).replace(`comment`,zt).replace(`attribute`,/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),W=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,Bt=P(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace(`label`,W).replace(`href`,/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace(`title`,/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Vt=P(/^!?\[(label)\]\[(ref)\]/).replace(`label`,W).replace(`ref`,ut).getRegex(),Ht=P(/^!?\[(ref)\](?:\[\])?/).replace(`ref`,ut).getRegex(),Ut=P(`reflink|nolink(?!\\()`,`g`).replace(`reflink`,Vt).replace(`nolink`,Ht).getRegex(),Wt=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,Gt={_backpedal:N,anyPunctuation:Lt,autolink:Rt,blockSkip:Ot,br:yt,code:vt,del:N,delLDelim:N,delRDelim:N,emStrongLDelim:At,emStrongRDelimAst:H,emStrongRDelimUnd:Pt,escape:V,link:Bt,nolink:Ht,punctuation:wt,reflink:Vt,reflinkSearch:Ut,tag:U,text:bt,url:N},Kt={...Gt,link:P(/^!?\[(label)\]\((.*?)\)/).replace(`label`,W).getRegex(),reflink:P(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace(`label`,W).getRegex()},qt={...Gt,emStrongRDelimAst:Nt,emStrongLDelim:jt,delLDelim:Ft,delRDelim:It,url:P(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace(`protocol`,Wt).replace(`email`,/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:P(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace(`protocol`,Wt).getRegex()},Jt={...qt,br:P(yt).replace(`{2,}`,`*`).getRegex(),text:P(qt.text).replace(`\\b_`,`\\b_| {2,}\\n`).replace(/\{2,\}/g,`*`).getRegex()},Yt={normal:mt,gfm:gt,pedantic:_t},G={normal:Gt,gfm:qt,breaks:Jt,pedantic:Kt},Xt={"&":`&amp;`,"<":`&lt;`,">":`&gt;`,'"':`&quot;`,"'":`&#39;`},Zt=e=>Xt[e];function K(e,t){if(t){if(F.escapeTest.test(e))return e.replace(F.escapeReplace,Zt)}else if(F.escapeTestNoEncode.test(e))return e.replace(F.escapeReplaceNoEncode,Zt);return e}function Qt(e){try{e=encodeURI(e).replace(F.percentDecode,`%`)}catch{return null}return e}function $t(e,t){let n=e.replace(F.findPipe,(e,t,n)=>{let r=!1,i=t;for(;--i>=0&&n[i]===`\\`;)r=!r;return r?`|`:` |`}).split(F.splitPipe),r=0;if(n[0].trim()||n.shift(),n.length>0&&!n.at(-1)?.trim()&&n.pop(),t)if(n.length>t)n.splice(t);else for(;n.length<t;)n.push(``);for(;r<n.length;r++)n[r]=n[r].trim().replace(F.slashPipe,`|`);return n}function q(e,t,n){let r=e.length;if(r===0)return``;let i=0;for(;i<r;){let a=e.charAt(r-i-1);if(a===t&&!n)i++;else if(a!==t&&n)i++;else break}return e.slice(0,r-i)}function en(e){let t=e.split(`
@@ -1 +1 @@
1
- import{q as e}from"./index-BVfpuiby.js";var t=e(`plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]),n=e(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]);export{t as n,n as t};
1
+ import{q as e}from"./index-CLdmsmiN.js";var t=e(`plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]),n=e(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]);export{t as n,n as t};