bazilion 0.6.0 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (136) hide show
  1. package/README.md +4 -4
  2. package/dist/cli.js +104 -35
  3. package/dist/cli.js.map +1 -1
  4. package/dist/daemon.js +349 -29
  5. package/dist/daemon.js.map +1 -1
  6. package/dist/web/client/assets/AgentAvatar-JYijLvZ2.js +1 -0
  7. package/dist/web/client/assets/AgentTabs-DioGqUVR.js +1 -0
  8. package/dist/web/client/assets/Button-ByiV6fpd.js +1 -0
  9. package/dist/web/client/assets/ChatPane-DzEgOEqS.js +74 -0
  10. package/dist/web/client/assets/ConfigTabs-pY-V0Rie.js +1 -0
  11. package/dist/web/client/assets/FieldRow-CNKma5LE.js +1 -0
  12. package/dist/web/client/assets/MembersEditor-C6UpqDdV.js +1 -0
  13. package/dist/web/client/assets/SpawnTeamModal-BEkNCKXm.js +1 -0
  14. package/dist/web/client/assets/TemplatesTabs-UM04RMO9.js +1 -0
  15. package/dist/web/client/assets/_id-BNJapCT4.js +1 -0
  16. package/dist/web/client/assets/_id-CjGoV8Mr.js +1 -0
  17. package/dist/web/client/assets/_id-DehuCHUw.js +1 -0
  18. package/dist/web/client/assets/_id-Dz9fjcCM.js +1 -0
  19. package/dist/web/client/assets/agents-M6omAXcZ.js +1 -0
  20. package/dist/web/client/assets/config-DIuEc5bm.js +3 -0
  21. package/dist/web/client/assets/groups-DpE2d2zZ.js +1 -0
  22. package/dist/web/client/assets/inbox-BPnLsRNf.js +1 -0
  23. package/dist/web/client/assets/index-MAJuXnie.js +12 -0
  24. package/dist/web/client/assets/jsx-runtime-DGeXAQPT.js +1 -0
  25. package/dist/web/client/assets/login-CawJX16E.js +1 -0
  26. package/dist/web/client/assets/mcp-DIrh9-v_.js +1 -0
  27. package/dist/web/client/assets/memory-BpHbdKsd.js +1 -0
  28. package/dist/web/client/assets/preload-helper-CvnapA2_.js +1 -0
  29. package/dist/web/client/assets/profile-groups-ByoKak0c.js +1 -0
  30. package/dist/web/client/assets/profiles-BEjv8LGo.js +1 -0
  31. package/dist/web/client/assets/routes-D2COHy7v.js +1 -0
  32. package/dist/web/client/assets/services-D212jSK_.js +1 -0
  33. package/dist/web/client/assets/skills-Da0MURjY.js +1 -0
  34. package/dist/web/client/assets/styles-BgE5bCHA.css +2 -0
  35. package/dist/web/client/assets/telegram-Czh2MdVm.js +1 -0
  36. package/dist/web/client/assets/tokens-E_JvO5JN.js +1 -0
  37. package/dist/web/client/assets/triggers-BBRZQOm7.js +1 -0
  38. package/dist/web/client/assets/welcome-Dn-zvmBE.js +1 -0
  39. package/dist/web/server/assets/{_id-C78M9_j9.js → _id-BKev9H1p.js} +2 -2
  40. package/dist/web/server/assets/{_id-Dc8P9sy2.js → _id-BNwlbWHP.js} +1 -1
  41. package/dist/web/server/assets/{_id-GJk3EYTT.js → _id-BdRiQb2H.js} +42 -5
  42. package/dist/web/server/assets/{_id-CrQbC5L8.js → _id-BqnDy_Ca.js} +2 -2
  43. package/dist/web/server/assets/{_id-CHNm7EAd.js → _id-CRqqi8IE.js} +1 -1
  44. package/dist/web/server/assets/{_id-Bm4-_AP-.js → _id-CXg-Blec.js} +1 -1
  45. package/dist/web/server/assets/{_id-BZ-YCWSw.js → _id-CnQflrRv.js} +2 -2
  46. package/dist/web/server/assets/{_id-DF3pfi9M.js → _id-D8duqgd5.js} +1 -1
  47. package/dist/web/server/assets/{_id-pd4S7LTi.js → _id-DDixKEud.js} +1 -1
  48. package/dist/web/server/assets/{_id-CvIGhq4U.js → _id-DUIrFV3G.js} +2 -2
  49. package/dist/web/server/assets/{_id-CGZbudCl.js → _id-D_Ew11ED.js} +1 -1
  50. package/dist/web/server/assets/{_id-Crcw2HhT.js → _id-Sjw0zhA6.js} +1 -1
  51. package/dist/web/server/assets/{_tanstack-start-manifest_v-CPyKYMJg.js → _tanstack-start-manifest_v-D9FLKShQ.js} +45 -41
  52. package/dist/web/server/assets/{agents-70EwQJR6.js → agents-C7SBPN0M.js} +1 -1
  53. package/dist/web/server/assets/{agents-K4Smhnq3.js → agents-ChcAJUI5.js} +2 -2
  54. package/dist/web/server/assets/{agents-Ds4lcREv.js → agents-k5QURC4I.js} +1 -1
  55. package/dist/web/server/assets/{auth-DpAGLHpA.js → auth-DzRAMwVt.js} +1 -1
  56. package/dist/web/server/assets/{config-DxCGYgR9.js → config-Bq3o924J.js} +2 -2
  57. package/dist/web/server/assets/{config-CMXUx_IF.js → config-CHaCv89D.js} +1 -1
  58. package/dist/web/server/assets/{config-DQbCsY_l.js → config-CdVjqjin.js} +18 -9
  59. package/dist/web/server/assets/{createServerRpc-CBTntoKx.js → createServerRpc-CeKECg65.js} +1 -1
  60. package/dist/web/server/assets/{createSsrRpc-DHBVUN8O.js → createSsrRpc-ZBGxhl8t.js} +1 -1
  61. package/dist/web/server/assets/{empty-plugin-adapters-Bos_V2s-.js → empty-plugin-adapters-DKUlnwwl.js} +1 -1
  62. package/dist/web/server/assets/{groups-Cms8cvH5.js → groups-CbSwND2r.js} +2 -2
  63. package/dist/web/server/assets/{groups-CXVew7BP.js → groups-CeRRlZaZ.js} +1 -1
  64. package/dist/web/server/assets/{groups-Dmcvw5ya.js → groups-pk4CYSuf.js} +1 -1
  65. package/dist/web/server/assets/{inbox-0QfwsrGo.js → inbox-Bxb3W04M.js} +2 -2
  66. package/dist/web/server/assets/{inbox-B7UWoICA.js → inbox-CkiSvD14.js} +1 -1
  67. package/dist/web/server/assets/{inbox-8HybA2Ws.js → inbox-DU27iHv_.js} +1 -1
  68. package/dist/web/server/assets/{mcp-DIa0kIOf.js → mcp-BU_kKENi.js} +1 -1
  69. package/dist/web/server/assets/{mcp-DsTjY3uz.js → mcp-BsFKEoXt.js} +1 -1
  70. package/dist/web/server/assets/{mcp-42BrkI1I.js → mcp-CKqwG4mt.js} +2 -2
  71. package/dist/web/server/assets/{memory-Dr0lOM2y.js → memory-BaYnfm7K.js} +1 -1
  72. package/dist/web/server/assets/{memory-BfrMp8iY.js → memory-CQaqWnyM.js} +1 -1
  73. package/dist/web/server/assets/{memory-EEgLDfCj.js → memory-Ns2-Z31p.js} +2 -2
  74. package/dist/web/server/assets/{profile-groups-C5isDI2t.js → profile-groups-CiU06yN1.js} +1 -1
  75. package/dist/web/server/assets/{profile-groups-B_kIT6BU.js → profile-groups-D21MYoLM.js} +1 -1
  76. package/dist/web/server/assets/{profile-groups-BW5gU-fG.js → profile-groups-aoJleXHP.js} +2 -2
  77. package/dist/web/server/assets/{profiles-BbPTpmyq.js → profiles-C6a3RKgu.js} +1 -1
  78. package/dist/web/server/assets/{profiles-Cy5auEj8.js → profiles-CZ5NkmVw.js} +2 -2
  79. package/dist/web/server/assets/{profiles-BP1v-jna.js → profiles-LxcC_L6n.js} +1 -1
  80. package/dist/web/server/assets/{router-CL100-Ly.js → router-BrDascdO.js} +21 -21
  81. package/dist/web/server/assets/{routes-D2H1Hnoh.js → routes-C61gBiXa.js} +1 -1
  82. package/dist/web/server/assets/{routes-Dzk8jvIo.js → routes-Ce2VWrU9.js} +1 -1
  83. package/dist/web/server/assets/{routes-CzJLQxcS.js → routes-V9URcp1v.js} +2 -2
  84. package/dist/web/server/assets/{services-DFenjiw0.js → services-B91w2f-X.js} +1 -1
  85. package/dist/web/server/assets/{services-DEgYsWJ4.js → services-Ccc5s2bS.js} +2 -2
  86. package/dist/web/server/assets/{services-Bgj6M2gC.js → services-DhRiNeq0.js} +1 -1
  87. package/dist/web/server/assets/{skills-BASIP_rT.js → skills-CFIWVg32.js} +1 -1
  88. package/dist/web/server/assets/{skills-DZXN680t.js → skills-D89ND2kR.js} +67 -7
  89. package/dist/web/server/assets/{skills-C-JPRCHh.js → skills-l2cyQ3zS.js} +2 -2
  90. package/dist/web/server/assets/start-CYDpZ6cb.js +4 -0
  91. package/dist/web/server/assets/{telegram-sUckI94O.js → telegram-BdaUIjvs.js} +1 -1
  92. package/dist/web/server/assets/{telegram-BbvqVWxa.js → telegram-DfAddLdv.js} +1 -1
  93. package/dist/web/server/assets/{telegram-Bq49AtnP.js → telegram-T3l9KtiE.js} +2 -2
  94. package/dist/web/server/assets/{tokens-Dwn00iV7.js → tokens-BCz3PSoT.js} +1 -1
  95. package/dist/web/server/assets/{tokens-CImgxhDI.js → tokens-CkKqrtk-.js} +1 -1
  96. package/dist/web/server/assets/{tokens-BERRE0wB.js → tokens-DdpnfV_Y.js} +2 -2
  97. package/dist/web/server/assets/{triggers-TyIjwSYn.js → triggers-BcH_6PW1.js} +1 -1
  98. package/dist/web/server/assets/{triggers-DtexqbNH.js → triggers-BcTTwMfy.js} +2 -2
  99. package/dist/web/server/assets/{triggers-_iSeahif.js → triggers-BzJG1nN5.js} +1 -1
  100. package/dist/web/server/assets/{welcome-BkQ9NC5K.js → welcome-CP4CZ9B6.js} +13 -9
  101. package/dist/web/server/server.js +94 -82
  102. package/dist/worker.js +65 -2
  103. package/dist/worker.js.map +1 -1
  104. package/package.json +17 -17
  105. package/dist/web/client/assets/AgentAvatar-Cq7PVBE_.js +0 -1
  106. package/dist/web/client/assets/AgentTabs-M5K8emJ8.js +0 -1
  107. package/dist/web/client/assets/Button-BefUtjMZ.js +0 -1
  108. package/dist/web/client/assets/ChatPane-C8zQfpzH.js +0 -74
  109. package/dist/web/client/assets/ConfigTabs-DRqAymcN.js +0 -1
  110. package/dist/web/client/assets/FieldRow-BqWnxZiX.js +0 -1
  111. package/dist/web/client/assets/MembersEditor-B-47GLUb.js +0 -1
  112. package/dist/web/client/assets/SpawnTeamModal-DiiC7Nc0.js +0 -1
  113. package/dist/web/client/assets/TemplatesTabs-DB4KERTQ.js +0 -1
  114. package/dist/web/client/assets/_id-B7gv1aPQ.js +0 -1
  115. package/dist/web/client/assets/_id-C7d1AqS0.js +0 -1
  116. package/dist/web/client/assets/_id-DhiwjC8u.js +0 -1
  117. package/dist/web/client/assets/_id-p8lUuNFm.js +0 -1
  118. package/dist/web/client/assets/agents-v8G-wt0M.js +0 -1
  119. package/dist/web/client/assets/config-BdmYpS_y.js +0 -3
  120. package/dist/web/client/assets/groups-DiY_ExGM.js +0 -1
  121. package/dist/web/client/assets/inbox-DtfVx246.js +0 -1
  122. package/dist/web/client/assets/index-BQUL6oyH.js +0 -12
  123. package/dist/web/client/assets/login-CVS70W9g.js +0 -1
  124. package/dist/web/client/assets/mcp-BDLQq8OZ.js +0 -1
  125. package/dist/web/client/assets/memory-6GGuAXwx.js +0 -1
  126. package/dist/web/client/assets/profile-groups-BA8rwZMA.js +0 -1
  127. package/dist/web/client/assets/profiles-C0aAcPZg.js +0 -1
  128. package/dist/web/client/assets/routes-DgAhnKFw.js +0 -1
  129. package/dist/web/client/assets/services-BZ86QEah.js +0 -1
  130. package/dist/web/client/assets/skills-mv_NNNwo.js +0 -1
  131. package/dist/web/client/assets/styles-CmqUskDu.css +0 -2
  132. package/dist/web/client/assets/telegram-5f9WXs3x.js +0 -1
  133. package/dist/web/client/assets/tokens-DHiYsFUh.js +0 -1
  134. package/dist/web/client/assets/triggers-CjC8Ljrz.js +0 -1
  135. package/dist/web/client/assets/welcome-C-Cu-ziL.js +0 -1
  136. package/dist/web/server/assets/start-cOXH7eTI.js +0 -4
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bazilion",
3
- "version": "0.6.0",
3
+ "version": "0.8.0",
4
4
  "description": "Multi-agent runtime CLI — spawn LLM agents, manage profiles/groups/skills, and run the local daemon.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -40,33 +40,33 @@
40
40
  "access": "public"
41
41
  },
42
42
  "dependencies": {
43
- "@earendil-works/pi-agent-core": "^0.77.0",
44
- "@earendil-works/pi-ai": "^0.77.0",
45
- "@earendil-works/pi-coding-agent": "^0.77.0",
46
- "@tanstack/react-router": "1.170.16",
47
- "@hono/node-server": "^2.0.4",
43
+ "@earendil-works/pi-agent-core": "^0.79.10",
44
+ "@earendil-works/pi-ai": "^0.79.10",
45
+ "@earendil-works/pi-coding-agent": "^0.79.10",
46
+ "@hono/node-server": "^2.0.6",
48
47
  "@mozilla/readability": "^0.6.0",
48
+ "@tanstack/react-router": "1.170.16",
49
49
  "@tobilu/qmd": "^2.5.3",
50
50
  "adm-zip": "^0.5.17",
51
51
  "citty": "^0.2.2",
52
- "dompurify": "^3.4.7",
53
- "grammy": "^1.43.0",
54
- "hono": "^4.12.23",
52
+ "dompurify": "^3.4.11",
53
+ "grammy": "^1.44.0",
54
+ "hono": "^4.12.26",
55
55
  "linkedom": "^0.18.12",
56
- "lucide-react": "^1.17.0",
57
- "playwright": "^1.60.0",
56
+ "lucide-react": "^1.21.0",
57
+ "playwright": "^1.61.0",
58
58
  "qrcode-terminal": "^0.12.0",
59
- "react": "^19.2.6",
60
- "react-dom": "^19.2.6",
61
- "typebox": "^1.1.39",
62
- "undici": "^8.3.0",
59
+ "react": "^19.2.7",
60
+ "react-dom": "^19.2.7",
61
+ "typebox": "^1.3.0",
62
+ "undici": "^8.5.0",
63
63
  "yaml": "^2.9.0"
64
64
  },
65
65
  "devDependencies": {
66
66
  "@types/adm-zip": "^0.5.8",
67
67
  "@types/qrcode-terminal": "^0.12.2",
68
- "@bazilion/api-types": "0.6.0",
69
- "@bazilion/client": "0.6.0"
68
+ "@bazilion/api-types": "0.8.0",
69
+ "@bazilion/client": "0.8.0"
70
70
  },
71
71
  "scripts": {
72
72
  "build": "pnpm --filter @bazilion/web build && tsup"
@@ -1 +0,0 @@
1
- import{E as e}from"./index-BQUL6oyH.js";var t=e();function n(e){return e?/^https?:\/\//i.test(e)||/^data:image\//i.test(e):!1}function r({identity:e,size:r=28,className:i}){let a=e?.avatar,o=e?.emoji,s={width:r,height:r},c=`inline-flex shrink-0 items-center justify-center overflow-hidden rounded-full`,l=i?`${c} ${i}`:c;return n(a)?(0,t.jsx)(`img`,{src:a,alt:``,style:s,className:`${l} object-cover`,onError:e=>{e.currentTarget.style.display=`none`}}):(0,t.jsx)(`span`,{style:{...s,fontSize:Math.round(r*.6)},className:`${l} bg-frost leading-none`,"aria-hidden":!0,children:o??`🤖`})}export{r as t};
@@ -1 +0,0 @@
1
- import{E as e}from"./index-BQUL6oyH.js";var t=e(),n=[{key:`chat`,href:e=>`/agents/${e}`,label:`chat`},{key:`inbox`,href:e=>`/agents/${e}/inbox`,label:`inbox`},{key:`triggers`,href:e=>`/agents/${e}/triggers`,label:`triggers`}];function r({agentId:e,active:r,archived:i}){return(0,t.jsxs)(`nav`,{className:`flex gap-1 border-b mb-6`,children:[n.map(n=>(0,t.jsx)(`a`,{href:n.href(e),className:`px-3 py-2 text-sm border-b-2 -mb-px ${n.key===r?`border-primary text-primary font-semibold`:`border-transparent text-muted-foreground hover:text-foreground`}`,children:n.label},n.key)),i&&(0,t.jsx)(`span`,{className:`ml-auto self-center text-xs uppercase tracking-wide text-amber-700 bg-amber-50 border border-amber-200 rounded px-2 py-0.5`,children:`archived`})]})}export{r as t};
@@ -1 +0,0 @@
1
- import{E as e}from"./index-BQUL6oyH.js";var t=e(),n={primary:`btn-primary`,ghost:`ghost-btn`,danger:`danger-btn`};function r({variant:e,type:r,className:i,...a}){let o=i?`${n[e]} ${i}`:n[e];return(0,t.jsx)(`button`,{type:r??`button`,className:o,...a})}export{r as t};
@@ -1,74 +0,0 @@
1
- import{D as e,E as t,O as n}from"./index-BQUL6oyH.js";var r=n(e(),1);function i(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 a(e){if(Array.isArray(e))return e}function o(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 s(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
2
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function c(e,t){return a(e)||o(e,t)||l(e,t)||s()}function l(e,t){if(e){if(typeof e==`string`)return i(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)?i(e,t):void 0}}var u=Object.entries,d=Object.setPrototypeOf,f=Object.isFrozen,p=Object.getPrototypeOf,m=Object.getOwnPropertyDescriptor,h=Object.freeze,g=Object.seal,_=Object.create,v=typeof Reflect<`u`&&Reflect,y=v.apply,ee=v.construct;h||=function(e){return e},g||=function(e){return e},y||=function(e,t){var n=[...arguments].slice(2);return e.apply(t,n)},ee||=function(e){return new e(...[...arguments].slice(1))};var te=D(Array.prototype.forEach),ne=D(Array.prototype.lastIndexOf),re=D(Array.prototype.pop),ie=D(Array.prototype.push),ae=D(Array.prototype.splice),b=Array.isArray,oe=D(String.prototype.toLowerCase),se=D(String.prototype.toString),ce=D(String.prototype.match),le=D(String.prototype.replace),ue=D(String.prototype.indexOf),de=D(String.prototype.trim),fe=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),pe=me(TypeError);function D(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);var n=[...arguments].slice(1);return y(e,t,n)}}function me(e){return function(){return ee(e,[...arguments])}}function O(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:oe;if(d&&d(e,null),!b(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 he(e){for(let t=0;t<e.length;t++)w(e,t)||(e[t]=null);return e}function k(e){let t=_(null);for(let r of u(e)){var n=c(r,2);let i=n[0],a=n[1];w(e,i)&&(b(a)?t[i]=he(a):a&&typeof a==`object`&&a.constructor===Object?t[i]=k(a):t[i]=a)}return t}function ge(e){switch(typeof e){case`string`:return e;case`number`:return fe(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=m(e,t);if(n){if(n.get)return D(n.get);if(typeof n.value==`function`)return D(n.value)}e=p(e)}function n(){return null}return n}function _e(e){try{return E(e,``),!0}catch{return!1}}var ve=h(`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(`.`)),ye=h(`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(`.`)),be=h([`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`]),xe=h([`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`]),j=h(`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(`.`)),Se=h([`maction`,`maligngroup`,`malignmark`,`mlongdiv`,`mscarries`,`mscarry`,`msgroup`,`mstack`,`msline`,`msrow`,`semantics`,`annotation`,`annotation-xml`,`mprescripts`,`none`]),Ce=h([`#text`]),we=h(`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(`.`)),Te=h(`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(`.`)),Ee=h(`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(`.`)),De=h([`xlink:href`,`xml:id`,`xlink:title`,`xml:space`,`xmlns:xlink`]),Oe=g(/{{[\w\W]*|^[\w\W]*}}/g),ke=g(/<%[\w\W]*|^[\w\W]*%>/g),Ae=g(/\${[\w\W]*/g),je=g(/^data-[\-\w.\u00B7-\uFFFF]+$/),Me=g(/^aria-[\-\w]+$/),Ne=g(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Pe=g(/^(?:\w+script|data):/i),Fe=g(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Ie=g(/^html$/i),Le=g(/^[a-z][.\w]*(-[.\w]+)+$/i),M={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,progressingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},Re=function(){return typeof window>`u`?null:window},ze=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}},Be=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function Ve(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Re(),t=e=>Ve(e);if(t.version=`3.4.7`,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,d=e.trustedTypes,f=s.prototype,p=A(f,`cloneNode`),m=A(f,`remove`),g=A(f,`nextSibling`),v=A(f,`childNodes`),y=A(f,`parentNode`),ee=A(f,`shadowRoot`),fe=A(f,`attributes`),x=o&&o.prototype?A(o.prototype,`nodeType`):null,S=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 C,T=``,D=n,me=D.implementation,he=D.createNodeIterator,He=D.createDocumentFragment,Ue=D.getElementsByTagName,We=r.importNode,N=Be();t.isSupported=typeof u==`function`&&typeof y==`function`&&me&&me.createHTMLDocument!==void 0;let P=Oe,F=ke,I=Ae,Ge=je,L=Me,Ke=Pe,qe=Fe,Je=Le,Ye=Ne,R=null,Xe=O({},[...ve,...ye,...be,...j,...Ce]),z=null,Ze=O({},[...we,...Te,...Ee,...De]),B=Object.seal(_(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}})),Qe=null,$e=null,V=Object.seal(_(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}})),et=!0,tt=!0,nt=!1,rt=!0,H=!1,it=!0,U=!1,at=!1,ot=!1,st=!1,ct=!1,lt=!1,ut=!0,dt=!1,ft=`user-content-`,pt=!0,mt=!1,ht={},W=null,gt=O({},[`annotation-xml`,`audio`,`colgroup`,`desc`,`foreignobject`,`head`,`iframe`,`math`,`mi`,`mn`,`mo`,`ms`,`mtext`,`noembed`,`noframes`,`noscript`,`plaintext`,`script`,`style`,`svg`,`template`,`thead`,`title`,`video`,`xmp`]),_t=null,vt=O({},[`audio`,`video`,`img`,`source`,`image`,`track`]),yt=null,bt=O({},[`alt`,`class`,`for`,`id`,`label`,`name`,`pattern`,`placeholder`,`role`,`summary`,`title`,`value`,`style`,`xmlns`]),xt=`http://www.w3.org/1998/Math/MathML`,St=`http://www.w3.org/2000/svg`,G=`http://www.w3.org/1999/xhtml`,Ct=G,wt=!1,Tt=null,Et=O({},[xt,St,G],se),Dt=O({},[`mi`,`mo`,`mn`,`ms`,`mtext`]),Ot=O({},[`annotation-xml`]),kt=O({},[`title`,`style`,`font`,`a`,`script`]),At=null,jt=[`application/xhtml+xml`,`text/html`],K=null,Mt=null,Nt=n.createElement(`form`),Pt=function(e){return e instanceof RegExp||e instanceof Function},Ft=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(Mt&&Mt===e)return;(!e||typeof e!=`object`)&&(e={}),e=k(e),At=jt.indexOf(e.PARSER_MEDIA_TYPE)===-1?`text/html`:e.PARSER_MEDIA_TYPE,K=At===`application/xhtml+xml`?se:oe,R=w(e,`ALLOWED_TAGS`)&&b(e.ALLOWED_TAGS)?O({},e.ALLOWED_TAGS,K):Xe,z=w(e,`ALLOWED_ATTR`)&&b(e.ALLOWED_ATTR)?O({},e.ALLOWED_ATTR,K):Ze,Tt=w(e,`ALLOWED_NAMESPACES`)&&b(e.ALLOWED_NAMESPACES)?O({},e.ALLOWED_NAMESPACES,se):Et,yt=w(e,`ADD_URI_SAFE_ATTR`)&&b(e.ADD_URI_SAFE_ATTR)?O(k(bt),e.ADD_URI_SAFE_ATTR,K):bt,_t=w(e,`ADD_DATA_URI_TAGS`)&&b(e.ADD_DATA_URI_TAGS)?O(k(vt),e.ADD_DATA_URI_TAGS,K):vt,W=w(e,`FORBID_CONTENTS`)&&b(e.FORBID_CONTENTS)?O({},e.FORBID_CONTENTS,K):gt,Qe=w(e,`FORBID_TAGS`)&&b(e.FORBID_TAGS)?O({},e.FORBID_TAGS,K):k({}),$e=w(e,`FORBID_ATTR`)&&b(e.FORBID_ATTR)?O({},e.FORBID_ATTR,K):k({}),ht=w(e,`USE_PROFILES`)?e.USE_PROFILES&&typeof e.USE_PROFILES==`object`?k(e.USE_PROFILES):e.USE_PROFILES:!1,et=e.ALLOW_ARIA_ATTR!==!1,tt=e.ALLOW_DATA_ATTR!==!1,nt=e.ALLOW_UNKNOWN_PROTOCOLS||!1,rt=e.ALLOW_SELF_CLOSE_IN_ATTR!==!1,H=e.SAFE_FOR_TEMPLATES||!1,it=e.SAFE_FOR_XML!==!1,U=e.WHOLE_DOCUMENT||!1,st=e.RETURN_DOM||!1,ct=e.RETURN_DOM_FRAGMENT||!1,lt=e.RETURN_TRUSTED_TYPE||!1,ot=e.FORCE_BODY||!1,ut=e.SANITIZE_DOM!==!1,dt=e.SANITIZE_NAMED_PROPS||!1,pt=e.KEEP_CONTENT!==!1,mt=e.IN_PLACE||!1,Ye=_e(e.ALLOWED_URI_REGEXP)?e.ALLOWED_URI_REGEXP:Ne,Ct=typeof e.NAMESPACE==`string`?e.NAMESPACE:G,Dt=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({},[`mi`,`mo`,`mn`,`ms`,`mtext`]),Ot=w(e,`HTML_INTEGRATION_POINTS`)&&e.HTML_INTEGRATION_POINTS&&typeof e.HTML_INTEGRATION_POINTS==`object`?k(e.HTML_INTEGRATION_POINTS):O({},[`annotation-xml`]);let t=w(e,`CUSTOM_ELEMENT_HANDLING`)&&e.CUSTOM_ELEMENT_HANDLING&&typeof e.CUSTOM_ELEMENT_HANDLING==`object`?k(e.CUSTOM_ELEMENT_HANDLING):_(null);if(B=_(null),w(t,`tagNameCheck`)&&Pt(t.tagNameCheck)&&(B.tagNameCheck=t.tagNameCheck),w(t,`attributeNameCheck`)&&Pt(t.attributeNameCheck)&&(B.attributeNameCheck=t.attributeNameCheck),w(t,`allowCustomizedBuiltInElements`)&&typeof t.allowCustomizedBuiltInElements==`boolean`&&(B.allowCustomizedBuiltInElements=t.allowCustomizedBuiltInElements),H&&(tt=!1),ct&&(st=!0),ht&&(R=O({},Ce),z=_(null),ht.html===!0&&(O(R,ve),O(z,we)),ht.svg===!0&&(O(R,ye),O(z,Te),O(z,De)),ht.svgFilters===!0&&(O(R,be),O(z,Te),O(z,De)),ht.mathMl===!0&&(O(R,j),O(z,Ee),O(z,De))),V.tagCheck=null,V.attributeCheck=null,w(e,`ADD_TAGS`)&&(typeof e.ADD_TAGS==`function`?V.tagCheck=e.ADD_TAGS:b(e.ADD_TAGS)&&(R===Xe&&(R=k(R)),O(R,e.ADD_TAGS,K))),w(e,`ADD_ATTR`)&&(typeof e.ADD_ATTR==`function`?V.attributeCheck=e.ADD_ATTR:b(e.ADD_ATTR)&&(z===Ze&&(z=k(z)),O(z,e.ADD_ATTR,K))),w(e,`ADD_URI_SAFE_ATTR`)&&b(e.ADD_URI_SAFE_ATTR)&&O(yt,e.ADD_URI_SAFE_ATTR,K),w(e,`FORBID_CONTENTS`)&&b(e.FORBID_CONTENTS)&&(W===gt&&(W=k(W)),O(W,e.FORBID_CONTENTS,K)),w(e,`ADD_FORBID_CONTENTS`)&&b(e.ADD_FORBID_CONTENTS)&&(W===gt&&(W=k(W)),O(W,e.ADD_FORBID_CONTENTS,K)),pt&&(R[`#text`]=!0),U&&O(R,[`html`,`head`,`body`]),R.table&&(O(R,[`tbody`]),delete Qe.tbody),e.TRUSTED_TYPES_POLICY){if(typeof e.TRUSTED_TYPES_POLICY.createHTML!=`function`)throw pe(`TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.`);if(typeof e.TRUSTED_TYPES_POLICY.createScriptURL!=`function`)throw pe(`TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.`);C=e.TRUSTED_TYPES_POLICY,T=C.createHTML(``)}else C===void 0&&(C=ze(d,i)),C!==null&&typeof T==`string`&&(T=C.createHTML(``));(N.uponSanitizeElement.length>0||N.uponSanitizeAttribute.length>0)&&R===Xe&&(R=k(R)),N.uponSanitizeAttribute.length>0&&z===Ze&&(z=k(z)),h&&h(e),Mt=e},It=O({},[...ye,...be,...xe]),Lt=O({},[...j,...Se]),Rt=function(e){let t=y(e);(!t||!t.tagName)&&(t={namespaceURI:Ct,tagName:`template`});let n=oe(e.tagName),r=oe(t.tagName);return Tt[e.namespaceURI]?e.namespaceURI===St?t.namespaceURI===G?n===`svg`:t.namespaceURI===xt?n===`svg`&&(r===`annotation-xml`||Dt[r]):!!It[n]:e.namespaceURI===xt?t.namespaceURI===G?n===`math`:t.namespaceURI===St?n===`math`&&Ot[r]:!!Lt[n]:e.namespaceURI===G?t.namespaceURI===St&&!Ot[r]||t.namespaceURI===xt&&!Dt[r]?!1:!Lt[n]&&(kt[n]||!It[n]):!!(At===`application/xhtml+xml`&&Tt[e.namespaceURI]):!1},zt=function(e){ie(t.removed,{element:e});try{y(e).removeChild(e)}catch{m(e)}},q=function(e,n){try{ie(t.removed,{attribute:n.getAttributeNode(e),from:n})}catch{ie(t.removed,{attribute:null,from:n})}if(n.removeAttribute(e),e===`is`)if(st||ct)try{zt(n)}catch{}else try{n.setAttribute(e,``)}catch{}},Bt=function(e){let t=null,r=null;if(ot)e=`<remove></remove>`+e;else{let t=ce(e,/^[\r\n\t ]+/);r=t&&t[0]}At===`application/xhtml+xml`&&Ct===G&&(e=`<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>`+e+`</body></html>`);let i=C?C.createHTML(e):e;if(Ct===G)try{t=new l().parseFromString(i,At)}catch{}if(!t||!t.documentElement){t=me.createDocument(Ct,`template`,null);try{t.documentElement.innerHTML=wt?T:i}catch{}}let a=t.body||t.documentElement;return e&&r&&a.insertBefore(n.createTextNode(r),a.childNodes[0]||null),Ct===G?Ue.call(t,U?`html`:`body`)[0]:U?t.documentElement:a},Vt=function(e){return he.call(e.ownerDocument||e,e,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT|c.SHOW_PROCESSING_INSTRUCTION|c.SHOW_CDATA_SECTION,null)},Ht=function(e){e.normalize();let t=he.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;){let e=n.data;te([P,F,I],t=>{e=le(e,t,` `)}),n.data=e,n=t.nextNode()}},J=function(e){let t=S?S(e):null;return typeof t!=`string`||K(t)!==`form`?!1:typeof e.nodeName!=`string`||typeof e.textContent!=`string`||typeof e.removeChild!=`function`||e.attributes!==fe(e)||typeof e.removeAttribute!=`function`||typeof e.setAttribute!=`function`||typeof e.namespaceURI!=`string`||typeof e.insertBefore!=`function`||typeof e.hasChildNodes!=`function`||e.nodeType!==x(e)||e.childNodes!==v(e)},Ut=function(e){if(!x||typeof e!=`object`||!e)return!1;try{return x(e)===M.documentFragment}catch{return!1}},Wt=function(e){if(!x||typeof e!=`object`||!e)return!1;try{return typeof x(e)==`number`}catch{return!1}};function Y(e,n,r){te(e,e=>{e.call(t,n,r,Mt)})}let Gt=function(e){let n=null;if(Y(N.beforeSanitizeElements,e,null),J(e))return zt(e),!0;let r=K(e.nodeName);if(Y(N.uponSanitizeElement,e,{tagName:r,allowedTags:R}),it&&e.hasChildNodes()&&!Wt(e.firstElementChild)&&E(/<[/\w!]/g,e.innerHTML)&&E(/<[/\w!]/g,e.textContent)||it&&e.namespaceURI===G&&r===`style`&&Wt(e.firstElementChild)||e.nodeType===M.progressingInstruction||it&&e.nodeType===M.comment&&E(/<[/\w]/g,e.data))return zt(e),!0;if(Qe[r]||!(V.tagCheck instanceof Function&&V.tagCheck(r))&&!R[r]){if(!Qe[r]&&Jt(r)&&(B.tagNameCheck instanceof RegExp&&E(B.tagNameCheck,r)||B.tagNameCheck instanceof Function&&B.tagNameCheck(r)))return!1;if(pt&&!W[r]){let t=y(e),n=v(e);if(n&&t){let r=n.length;for(let i=r-1;i>=0;--i){let r=p(n[i],!0);t.insertBefore(r,g(e))}}}return zt(e),!0}return(x?x(e):e.nodeType)===M.element&&!Rt(e)||(r===`noscript`||r===`noembed`||r===`noframes`)&&E(/<\/no(script|embed|frames)/i,e.innerHTML)?(zt(e),!0):(H&&e.nodeType===M.text&&(n=e.textContent,te([P,F,I],e=>{n=le(n,e,` `)}),e.textContent!==n&&(ie(t.removed,{element:e.cloneNode()}),e.textContent=n)),Y(N.afterSanitizeElements,e,null),!1)},Kt=function(e,t,r){if($e[t]||ut&&(t===`id`||t===`name`)&&(r in n||r in Nt))return!1;let i=z[t]||V.attributeCheck instanceof Function&&V.attributeCheck(t,e);if(!(tt&&!$e[t]&&E(Ge,t))&&!(et&&E(L,t))){if(!i||$e[t]){if(!(Jt(e)&&(B.tagNameCheck instanceof RegExp&&E(B.tagNameCheck,e)||B.tagNameCheck instanceof Function&&B.tagNameCheck(e))&&(B.attributeNameCheck instanceof RegExp&&E(B.attributeNameCheck,t)||B.attributeNameCheck instanceof Function&&B.attributeNameCheck(t,e))||t===`is`&&B.allowCustomizedBuiltInElements&&(B.tagNameCheck instanceof RegExp&&E(B.tagNameCheck,r)||B.tagNameCheck instanceof Function&&B.tagNameCheck(r))))return!1}else if(!yt[t]&&!E(Ye,le(r,qe,``))&&!((t===`src`||t===`xlink:href`||t===`href`)&&e!==`script`&&ue(r,`data:`)===0&&_t[e])&&!(nt&&!E(Ke,le(r,qe,``)))&&r)return!1}return!0},qt=O({},[`annotation-xml`,`color-profile`,`font-face`,`font-face-format`,`font-face-name`,`font-face-src`,`font-face-uri`,`missing-glyph`]),Jt=function(e){return!qt[oe(e)]&&E(Je,e)},Yt=function(e){Y(N.beforeSanitizeAttributes,e,null);let n=e.attributes;if(!n||J(e))return;let r={attrName:``,attrValue:``,keepAttr:!0,allowedAttributes:z,forceKeepAttr:void 0},i=n.length;for(;i--;){let a=n[i],o=a.name,s=a.namespaceURI,c=a.value,l=K(o),u=c,f=o===`value`?u:de(u);if(r.attrName=l,r.attrValue=f,r.keepAttr=!0,r.forceKeepAttr=void 0,Y(N.uponSanitizeAttribute,e,r),f=r.attrValue,dt&&(l===`id`||l===`name`)&&ue(f,ft)!==0&&(q(o,e),f=ft+f),it&&E(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,f)){q(o,e);continue}if(l===`attributename`&&ce(f,`href`)){q(o,e);continue}if(r.forceKeepAttr)continue;if(!r.keepAttr){q(o,e);continue}if(!rt&&E(/\/>/i,f)){q(o,e);continue}H&&te([P,F,I],e=>{f=le(f,e,` `)});let p=K(e.nodeName);if(!Kt(p,l,f)){q(o,e);continue}if(C&&typeof d==`object`&&typeof d.getAttributeType==`function`&&!s)switch(d.getAttributeType(p,l)){case`TrustedHTML`:f=C.createHTML(f);break;case`TrustedScriptURL`:f=C.createScriptURL(f);break}if(f!==u)try{s?e.setAttributeNS(s,o,f):e.setAttribute(o,f),J(e)?zt(e):re(t.removed)}catch{q(o,e)}}Y(N.afterSanitizeAttributes,e,null)},Xt=function(e){let t=null,n=Vt(e);for(Y(N.beforeSanitizeShadowDOM,e,null);t=n.nextNode();)if(Y(N.uponSanitizeShadowNode,t,null),Gt(t),Yt(t),Ut(t.content)&&Xt(t.content),(x?x(t):t.nodeType)===M.element){let e=ee?ee(t):t.shadowRoot;Ut(e)&&(X(e),Xt(e))}Y(N.afterSanitizeShadowDOM,e,null)},X=function(e){let t=x?x(e):e.nodeType;if(t===M.element){let t=ee?ee(e):e.shadowRoot;Ut(t)&&(X(t),Xt(t))}let n=v?v(e):e.childNodes;if(!n)return;let r=[];te(n,e=>{ie(r,e)});for(let e of r)X(e);if(t===M.element){let t=S?S(e):null;if(typeof t==`string`&&K(t)===`template`){let t=e.content;Ut(t)&&X(t)}}};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(wt=!e,wt&&(e=`<!-->`),typeof e!=`string`&&!Wt(e)&&(e=ge(e),typeof e!=`string`))throw pe(`dirty is not a string, aborting`);if(!t.isSupported)return e;if(at||Ft(n),t.removed=[],typeof e==`string`&&(mt=!1),mt){let t=S?S(e):e.nodeName;if(typeof t==`string`){let e=K(t);if(!R[e]||Qe[e])throw pe(`root node is forbidden and cannot be sanitized in-place`)}if(J(e))throw pe(`root node is clobbered and cannot be sanitized in-place`);X(e)}else if(Wt(e))i=Bt(`<!---->`),a=i.ownerDocument.importNode(e,!0),a.nodeType===M.element&&a.nodeName===`BODY`||a.nodeName===`HTML`?i=a:i.appendChild(a),X(a);else{if(!st&&!H&&!U&&e.indexOf(`<`)===-1)return C&&lt?C.createHTML(e):e;if(i=Bt(e),!i)return st?null:lt?T:``}i&&ot&&zt(i.firstChild);let c=Vt(mt?e:i);for(;o=c.nextNode();)Gt(o),Yt(o),Ut(o.content)&&Xt(o.content);if(mt)return H&&Ht(e),e;if(st){if(H&&Ht(i),ct)for(s=He.call(i.ownerDocument);i.firstChild;)s.appendChild(i.firstChild);else s=i;return(z.shadowroot||z.shadowrootmode)&&(s=We.call(r,s,!0)),s}let l=U?i.outerHTML:i.innerHTML;return U&&R[`!doctype`]&&i.ownerDocument&&i.ownerDocument.doctype&&i.ownerDocument.doctype.name&&E(Ie,i.ownerDocument.doctype.name)&&(l=`<!DOCTYPE `+i.ownerDocument.doctype.name+`>
3
- `+l),H&&te([P,F,I],e=>{l=le(l,e,` `)}),C&&lt?C.createHTML(l):l},t.setConfig=function(){Ft(arguments.length>0&&arguments[0]!==void 0?arguments[0]:{}),at=!0},t.clearConfig=function(){Mt=null,at=!1},t.isValidAttribute=function(e,t,n){return Mt||Ft({}),Kt(K(e),K(t),n)},t.addHook=function(e,t){typeof t==`function`&&ie(N[e],t)},t.removeHook=function(e,t){if(t!==void 0){let n=ne(N[e],t);return n===-1?void 0:ae(N[e],n,1)[0]}return re(N[e])},t.removeHooks=function(e){N[e]=[]},t.removeAllHooks=function(){N=Be()},t}var He=Ve();function Ue(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var We=Ue();function N(e){We=e}var P={exec:()=>null};function F(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 I(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(L.caret,`$1`),n=n.replace(e,i),r},getRegex:()=>new RegExp(n,t)};return r}var Ge=((e=``)=>{try{return!!RegExp(`(?<=1)(?<!1)`+e)}catch{return!1}})(),L={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:F(e=>RegExp(`^ {0,${e}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)),hrRegex:F(e=>RegExp(`^ {0,${e}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`)),fencesBeginRegex:F(e=>RegExp(`^ {0,${e}}(?:\`\`\`|~~~)`)),headingBeginRegex:F(e=>RegExp(`^ {0,${e}}#`)),htmlBeginRegex:F(e=>RegExp(`^ {0,${e}}<(?:[a-z].*>|!--)`,`i`)),blockquoteBeginRegex:F(e=>RegExp(`^ {0,${e}}>`))},Ke=/^(?:[ \t]*(?:\n|$))+/,qe=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,Je=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,Ye=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,R=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Xe=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,z=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,Ze=I(z).replace(/bull/g,Xe).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(),B=I(z).replace(/bull/g,Xe).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(),Qe=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,$e=/^[^\n]+/,V=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,et=I(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace(`label`,V).replace(`title`,/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),tt=I(/^(bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,Xe).getRegex(),nt=`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`,rt=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,H=I(`^ {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`,rt).replace(`tag`,nt).replace(`attribute`,/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),it=I(Qe).replace(`hr`,Ye).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]`).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,nt).getRegex(),U={blockquote:I(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace(`paragraph`,it).getRegex(),code:qe,def:et,fences:Je,heading:R,hr:Ye,html:H,lheading:Ze,list:tt,newline:Ke,paragraph:it,table:P,text:$e},at=I(`^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)`).replace(`hr`,Ye).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`,nt).getRegex(),ot={...U,lheading:B,table:at,paragraph:I(Qe).replace(`hr`,Ye).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`,``).replace(`table`,at).replace(`blockquote`,` {0,3}>`).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`,nt).getRegex()},st={...U,html:I(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace(`comment`,rt).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:P,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:I(Qe).replace(`hr`,Ye).replace(`heading`,` *#{1,6} *[^
4
- ]`).replace(`lheading`,Ze).replace(`|table`,``).replace(`blockquote`,` {0,3}>`).replace(`|fences`,``).replace(`|list`,``).replace(`|html`,``).replace(`|tag`,``).getRegex()},ct=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,lt=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,ut=/^( {2,}|\\)\n(?!\s*$)/,dt=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,ft=/[\p{P}\p{S}]/u,pt=/[\s\p{P}\p{S}]/u,mt=/[^\s\p{P}\p{S}]/u,ht=I(/^((?![*_])punctSpace)/,`u`).replace(/punctSpace/g,pt).getRegex(),W=/(?!~)[\p{P}\p{S}]/u,gt=/(?!~)[\s\p{P}\p{S}]/u,_t=/(?:[^\s\p{P}\p{S}]|~)/u,vt=I(/link|precode-code|html/,`g`).replace(`link`,/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace(`precode-`,Ge?"(?<!`)()":"(^^|[^`])").replace(`code`,/(?<b>`+)[^`]+\k<b>(?!`)/).replace(`html`,/<(?! )[^<>]*?>/).getRegex(),yt=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,bt=I(yt,`u`).replace(/punct/g,ft).getRegex(),xt=I(yt,`u`).replace(/punct/g,W).getRegex(),St=`^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)`,G=I(St,`gu`).replace(/notPunctSpace/g,mt).replace(/punctSpace/g,pt).replace(/punct/g,ft).getRegex(),Ct=I(St,`gu`).replace(/notPunctSpace/g,_t).replace(/punctSpace/g,gt).replace(/punct/g,W).getRegex(),wt=I(`^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)`,`gu`).replace(/notPunctSpace/g,mt).replace(/punctSpace/g,pt).replace(/punct/g,ft).getRegex(),Tt=I(/^~~?(?:((?!~)punct)|[^\s~])/,`u`).replace(/punct/g,ft).getRegex(),Et=I(`^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)`,`gu`).replace(/notPunctSpace/g,mt).replace(/punctSpace/g,pt).replace(/punct/g,ft).getRegex(),Dt=I(/\\(punct)/,`gu`).replace(/punct/g,ft).getRegex(),Ot=I(/^<(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(),kt=I(rt).replace(`(?:-->|$)`,`-->`).getRegex(),At=I(`^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`,kt).replace(`attribute`,/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),jt=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,K=I(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace(`label`,jt).replace(`href`,/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace(`title`,/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Mt=I(/^!?\[(label)\]\[(ref)\]/).replace(`label`,jt).replace(`ref`,V).getRegex(),Nt=I(/^!?\[(ref)\](?:\[\])?/).replace(`ref`,V).getRegex(),Pt=I(`reflink|nolink(?!\\()`,`g`).replace(`reflink`,Mt).replace(`nolink`,Nt).getRegex(),Ft=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,It={_backpedal:P,anyPunctuation:Dt,autolink:Ot,blockSkip:vt,br:ut,code:lt,del:P,delLDelim:P,delRDelim:P,emStrongLDelim:bt,emStrongRDelimAst:G,emStrongRDelimUnd:wt,escape:ct,link:K,nolink:Nt,punctuation:ht,reflink:Mt,reflinkSearch:Pt,tag:At,text:dt,url:P},Lt={...It,link:I(/^!?\[(label)\]\((.*?)\)/).replace(`label`,jt).getRegex(),reflink:I(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace(`label`,jt).getRegex()},Rt={...It,emStrongRDelimAst:Ct,emStrongLDelim:xt,delLDelim:Tt,delRDelim:Et,url:I(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace(`protocol`,Ft).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:I(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace(`protocol`,Ft).getRegex()},zt={...Rt,br:I(ut).replace(`{2,}`,`*`).getRegex(),text:I(Rt.text).replace(`\\b_`,`\\b_| {2,}\\n`).replace(/\{2,\}/g,`*`).getRegex()},q={normal:U,gfm:ot,pedantic:st},Bt={normal:It,gfm:Rt,breaks:zt,pedantic:Lt},Vt={"&":`&amp;`,"<":`&lt;`,">":`&gt;`,'"':`&quot;`,"'":`&#39;`},Ht=e=>Vt[e];function J(e,t){if(t){if(L.escapeTest.test(e))return e.replace(L.escapeReplace,Ht)}else if(L.escapeTestNoEncode.test(e))return e.replace(L.escapeReplaceNoEncode,Ht);return e}function Ut(e){try{e=encodeURI(e).replace(L.percentDecode,`%`)}catch{return null}return e}function Wt(e,t){let n=e.replace(L.findPipe,(e,t,n)=>{let r=!1,i=t;for(;--i>=0&&n[i]===`\\`;)r=!r;return r?`|`:` |`}).split(L.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(L.slashPipe,`|`);return n}function Y(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 Gt(e){let t=e.split(`
5
- `),n=t.length-1;for(;n>=0&&L.blankLine.test(t[n]);)n--;return t.length-n<=2?e:t.slice(0,n+1).join(`
6
- `)}function Kt(e,t){if(e.indexOf(t[1])===-1)return-1;let n=0;for(let r=0;r<e.length;r++)if(e[r]===`\\`)r++;else if(e[r]===t[0])n++;else if(e[r]===t[1]&&(n--,n<0))return r;return n>0?-2:-1}function qt(e,t=0){let n=t,r=``;for(let t of e)if(t===` `){let e=4-n%4;r+=` `.repeat(e),n+=e}else r+=t,n++;return r}function Jt(e,t,n,r,i){let a=t.href,o=t.title||null,s=e[1].replace(i.other.outputLinkReplace,`$1`);r.state.inLink=!0;let c={type:e[0].charAt(0)===`!`?`image`:`link`,raw:n,href:a,title:o,text:s,tokens:r.inlineTokens(s)};return r.state.inLink=!1,c}function Yt(e,t,n){let r=e.match(n.other.indentCodeCompensation);if(r===null)return t;let i=r[1];return t.split(`
7
- `).map(e=>{let t=e.match(n.other.beginningSpace);if(t===null)return e;let[r]=t;return r.length>=i.length?e.slice(i.length):e}).join(`
8
- `)}var Xt=class{options;rules;lexer;constructor(e){this.options=e||We}space(e){let t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:`space`,raw:t[0]}}code(e){let t=this.rules.block.code.exec(e);if(t){let e=this.options.pedantic?t[0]:Gt(t[0]);return{type:`code`,raw:e,codeBlockStyle:`indented`,text:e.replace(this.rules.other.codeRemoveIndent,``)}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let e=t[0],n=Yt(e,t[3]||``,this.rules);return{type:`code`,raw:e,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,`$1`):t[2],text:n}}}heading(e){let t=this.rules.block.heading.exec(e);if(t){let e=t[2].trim();if(this.rules.other.endingHash.test(e)){let t=Y(e,`#`);(this.options.pedantic||!t||this.rules.other.endingSpaceChar.test(t))&&(e=t.trim())}return{type:`heading`,raw:Y(t[0],`
9
- `),depth:t[1].length,text:e,tokens:this.lexer.inline(e)}}}hr(e){let t=this.rules.block.hr.exec(e);if(t)return{type:`hr`,raw:Y(t[0],`
10
- `)}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let e=Y(t[0],`
11
- `).split(`
12
- `),n=``,r=``,i=[];for(;e.length>0;){let t=!1,a=[],o;for(o=0;o<e.length;o++)if(this.rules.other.blockquoteStart.test(e[o]))a.push(e[o]),t=!0;else if(!t)a.push(e[o]);else break;e=e.slice(o);let s=a.join(`
13
- `),c=s.replace(this.rules.other.blockquoteSetextReplace,`
14
- $1`).replace(this.rules.other.blockquoteSetextReplace2,``);n=n?`${n}
15
- ${s}`:s,r=r?`${r}
16
- ${c}`:c;let l=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(c,i,!0),this.lexer.state.top=l,e.length===0)break;let u=i.at(-1);if(u?.type===`code`)break;if(u?.type===`blockquote`){let t=u,a=t.raw+`
17
- `+e.join(`
18
- `),o=this.blockquote(a);i[i.length-1]=o,n=n.substring(0,n.length-t.raw.length)+o.raw,r=r.substring(0,r.length-t.text.length)+o.text;break}else if(u?.type===`list`){let t=u,a=t.raw+`
19
- `+e.join(`
20
- `),o=this.list(a);i[i.length-1]=o,n=n.substring(0,n.length-u.raw.length)+o.raw,r=r.substring(0,r.length-t.raw.length)+o.raw,e=a.substring(i.at(-1).raw.length).split(`
21
- `);continue}}return{type:`blockquote`,raw:n,tokens:i,text:r}}}list(e){let t=this.rules.block.list.exec(e);if(t){let n=t[1].trim(),r=n.length>1,i={type:`list`,raw:``,ordered:r,start:r?+n.slice(0,-1):``,loose:!1,items:[]};n=r?`\\d{1,9}\\${n.slice(-1)}`:`\\${n}`,this.options.pedantic&&(n=r?n:`[*+-]`);let a=this.rules.other.listItemRegex(n),o=!1;for(;e;){let n=!1,r=``,s=``;if(!(t=a.exec(e))||this.rules.block.hr.test(e))break;r=t[0],e=e.substring(r.length);let c=qt(t[2].split(`
22
- `,1)[0],t[1].length),l=e.split(`
23
- `,1)[0],u=!c.trim(),d=0;if(this.options.pedantic?(d=2,s=c.trimStart()):u?d=t[1].length+1:(d=c.search(this.rules.other.nonSpaceChar),d=d>4?1:d,s=c.slice(d),d+=t[1].length),u&&this.rules.other.blankLine.test(l)&&(r+=l+`
24
- `,e=e.substring(l.length+1),n=!0),!n){let t=this.rules.other.nextBulletRegex(d),n=this.rules.other.hrRegex(d),i=this.rules.other.fencesBeginRegex(d),a=this.rules.other.headingBeginRegex(d),o=this.rules.other.htmlBeginRegex(d),f=this.rules.other.blockquoteBeginRegex(d);for(;e;){let p=e.split(`
25
- `,1)[0],m;if(l=p,this.options.pedantic?(l=l.replace(this.rules.other.listReplaceNesting,` `),m=l):m=l.replace(this.rules.other.tabCharGlobal,` `),i.test(l)||a.test(l)||o.test(l)||f.test(l)||t.test(l)||n.test(l))break;if(m.search(this.rules.other.nonSpaceChar)>=d||!l.trim())s+=`
26
- `+m.slice(d);else{if(u||c.replace(this.rules.other.tabCharGlobal,` `).search(this.rules.other.nonSpaceChar)>=4||i.test(c)||a.test(c)||n.test(c))break;s+=`
27
- `+l}u=!l.trim(),r+=p+`
28
- `,e=e.substring(p.length+1),c=m.slice(d)}}i.loose||(o?i.loose=!0:this.rules.other.doubleBlankLine.test(r)&&(o=!0)),i.items.push({type:`list_item`,raw:r,task:!!this.options.gfm&&this.rules.other.listIsTask.test(s),loose:!1,text:s,tokens:[]}),i.raw+=r}let s=i.items.at(-1);if(s)s.raw=s.raw.trimEnd(),s.text=s.text.trimEnd();else return;i.raw=i.raw.trimEnd();for(let e of i.items){this.lexer.state.top=!1,e.tokens=this.lexer.blockTokens(e.text,[]);let t=e.tokens[0];if(e.task&&(t?.type===`text`||t?.type===`paragraph`)){e.text=e.text.replace(this.rules.other.listReplaceTask,``),t.raw=t.raw.replace(this.rules.other.listReplaceTask,``),t.text=t.text.replace(this.rules.other.listReplaceTask,``);for(let e=this.lexer.inlineQueue.length-1;e>=0;e--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[e].src)){this.lexer.inlineQueue[e].src=this.lexer.inlineQueue[e].src.replace(this.rules.other.listReplaceTask,``);break}let n=this.rules.other.listTaskCheckbox.exec(e.raw);if(n){let t={type:`checkbox`,raw:n[0]+` `,checked:n[0]!==`[ ]`};e.checked=t.checked,i.loose?e.tokens[0]&&[`paragraph`,`text`].includes(e.tokens[0].type)&&`tokens`in e.tokens[0]&&e.tokens[0].tokens?(e.tokens[0].raw=t.raw+e.tokens[0].raw,e.tokens[0].text=t.raw+e.tokens[0].text,e.tokens[0].tokens.unshift(t)):e.tokens.unshift({type:`paragraph`,raw:t.raw,text:t.raw,tokens:[t]}):e.tokens.unshift(t)}}else e.task&&=!1;if(!i.loose){let t=e.tokens.filter(e=>e.type===`space`);i.loose=t.length>0&&t.some(e=>this.rules.other.anyLine.test(e.raw))}}if(i.loose)for(let e of i.items){e.loose=!0;for(let t of e.tokens)t.type===`text`&&(t.type=`paragraph`)}return i}}html(e){let t=this.rules.block.html.exec(e);if(t){let e=Gt(t[0]);return{type:`html`,block:!0,raw:e,pre:t[1]===`pre`||t[1]===`script`||t[1]===`style`,text:e}}}def(e){let t=this.rules.block.def.exec(e);if(t){let e=t[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal,` `),n=t[2]?t[2].replace(this.rules.other.hrefBrackets,`$1`).replace(this.rules.inline.anyPunctuation,`$1`):``,r=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,`$1`):t[3];return{type:`def`,tag:e,raw:Y(t[0],`
29
- `),href:n,title:r}}}table(e){let t=this.rules.block.table.exec(e);if(!t||!this.rules.other.tableDelimiter.test(t[2]))return;let n=Wt(t[1]),r=t[2].replace(this.rules.other.tableAlignChars,``).split(`|`),i=t[3]?.trim()?t[3].replace(this.rules.other.tableRowBlankLine,``).split(`
30
- `):[],a={type:`table`,raw:Y(t[0],`
31
- `),header:[],align:[],rows:[]};if(n.length===r.length){for(let e of r)this.rules.other.tableAlignRight.test(e)?a.align.push(`right`):this.rules.other.tableAlignCenter.test(e)?a.align.push(`center`):this.rules.other.tableAlignLeft.test(e)?a.align.push(`left`):a.align.push(null);for(let e=0;e<n.length;e++)a.header.push({text:n[e],tokens:this.lexer.inline(n[e]),header:!0,align:a.align[e]});for(let e of i)a.rows.push(Wt(e,a.header.length).map((e,t)=>({text:e,tokens:this.lexer.inline(e),header:!1,align:a.align[t]})));return a}}lheading(e){let t=this.rules.block.lheading.exec(e);if(t){let e=t[1].trim();return{type:`heading`,raw:Y(t[0],`
32
- `),depth:t[2].charAt(0)===`=`?1:2,text:e,tokens:this.lexer.inline(e)}}}paragraph(e){let t=this.rules.block.paragraph.exec(e);if(t){let e=t[1].charAt(t[1].length-1)===`
33
- `?t[1].slice(0,-1):t[1];return{type:`paragraph`,raw:t[0],text:e,tokens:this.lexer.inline(e)}}}text(e){let t=this.rules.block.text.exec(e);if(t)return{type:`text`,raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){let t=this.rules.inline.escape.exec(e);if(t)return{type:`escape`,raw:t[0],text:t[1]}}tag(e){let t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&this.rules.other.startATag.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:`html`,raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){let t=this.rules.inline.link.exec(e);if(t){let e=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(e)){if(!this.rules.other.endAngleBracket.test(e))return;let t=Y(e.slice(0,-1),`\\`);if((e.length-t.length)%2==0)return}else{let e=Kt(t[2],`()`);if(e===-2)return;if(e>-1){let n=(t[0].indexOf(`!`)===0?5:4)+t[1].length+e;t[2]=t[2].substring(0,e),t[0]=t[0].substring(0,n).trim(),t[3]=``}}let n=t[2],r=``;if(this.options.pedantic){let e=this.rules.other.pedanticHrefTitle.exec(n);e&&(n=e[1],r=e[3])}else r=t[3]?t[3].slice(1,-1):``;return n=n.trim(),this.rules.other.startAngleBracket.test(n)&&(n=this.options.pedantic&&!this.rules.other.endAngleBracket.test(e)?n.slice(1):n.slice(1,-1)),Jt(t,{href:n&&n.replace(this.rules.inline.anyPunctuation,`$1`),title:r&&r.replace(this.rules.inline.anyPunctuation,`$1`)},t[0],this.lexer,this.rules)}}reflink(e,t){let n;if((n=this.rules.inline.reflink.exec(e))||(n=this.rules.inline.nolink.exec(e))){let e=t[(n[2]||n[1]).replace(this.rules.other.multipleSpaceGlobal,` `).toLowerCase()];if(!e){let e=n[0].charAt(0);return{type:`text`,raw:e,text:e}}return Jt(n,e,n[0],this.lexer,this.rules)}}emStrong(e,t,n=``){let r=this.rules.inline.emStrongLDelim.exec(e);if(!(!r||!r[1]&&!r[2]&&!r[3]&&!r[4]||r[4]&&n.match(this.rules.other.unicodeAlphaNumeric))&&(!(r[1]||r[3])||!n||this.rules.inline.punctuation.exec(n))){let n=[...r[0]].length-1,i,a,o=n,s=0,c=r[0][0]===`*`?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(c.lastIndex=0,t=t.slice(-1*e.length+n);(r=c.exec(t))!==null;){if(i=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!i)continue;if(a=[...i].length,r[3]||r[4]){o+=a;continue}else if((r[5]||r[6])&&n%3&&!((n+a)%3)){s+=a;continue}if(o-=a,o>0)continue;a=Math.min(a,a+o+s);let t=[...r[0]][0].length,c=e.slice(0,n+r.index+t+a);if(Math.min(n,a)%2){let e=c.slice(1,-1);return{type:`em`,raw:c,text:e,tokens:this.lexer.inlineTokens(e)}}let l=c.slice(2,-2);return{type:`strong`,raw:c,text:l,tokens:this.lexer.inlineTokens(l)}}}}codespan(e){let t=this.rules.inline.code.exec(e);if(t){let e=t[2].replace(this.rules.other.newLineCharGlobal,` `),n=this.rules.other.nonSpaceChar.test(e),r=this.rules.other.startingSpaceChar.test(e)&&this.rules.other.endingSpaceChar.test(e);return n&&r&&(e=e.substring(1,e.length-1)),{type:`codespan`,raw:t[0],text:e}}}br(e){let t=this.rules.inline.br.exec(e);if(t)return{type:`br`,raw:t[0]}}del(e,t,n=``){let r=this.rules.inline.delLDelim.exec(e);if(r&&(!r[1]||!n||this.rules.inline.punctuation.exec(n))){let n=[...r[0]].length-1,i,a,o=n,s=this.rules.inline.delRDelim;for(s.lastIndex=0,t=t.slice(-1*e.length+n);(r=s.exec(t))!==null;){if(i=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!i||(a=[...i].length,a!==n))continue;if(r[3]||r[4]){o+=a;continue}if(o-=a,o>0)continue;a=Math.min(a,a+o);let t=[...r[0]][0].length,s=e.slice(0,n+r.index+t+a),c=s.slice(n,-n);return{type:`del`,raw:s,text:c,tokens:this.lexer.inlineTokens(c)}}}}autolink(e){let t=this.rules.inline.autolink.exec(e);if(t){let e,n;return t[2]===`@`?(e=t[1],n=`mailto:`+e):(e=t[1],n=e),{type:`link`,raw:t[0],text:e,href:n,tokens:[{type:`text`,raw:e,text:e}]}}}url(e){let t;if(t=this.rules.inline.url.exec(e)){let e,n;if(t[2]===`@`)e=t[0],n=`mailto:`+e;else{let r;do r=t[0],t[0]=this.rules.inline._backpedal.exec(t[0])?.[0]??``;while(r!==t[0]);e=t[0],n=t[1]===`www.`?`http://`+t[0]:t[0]}return{type:`link`,raw:t[0],text:e,href:n,tokens:[{type:`text`,raw:e,text:e}]}}}inlineText(e){let t=this.rules.inline.text.exec(e);if(t){let e=this.lexer.state.inRawBlock;return{type:`text`,raw:t[0],text:t[0],escaped:e}}}},X=class e{tokens;options;state;inlineQueue;tokenizer;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||We,this.options.tokenizer=this.options.tokenizer||new Xt,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let t={other:L,block:q.normal,inline:Bt.normal};this.options.pedantic?(t.block=q.pedantic,t.inline=Bt.pedantic):this.options.gfm&&(t.block=q.gfm,this.options.breaks?t.inline=Bt.breaks:t.inline=Bt.gfm),this.tokenizer.rules=t}static get rules(){return{block:q,inline:Bt}}static lex(t,n){return new e(n).lex(t)}static lexInline(t,n){return new e(n).inlineTokens(t)}lex(e){e=e.replace(L.carriageReturn,`
34
- `),this.blockTokens(e,this.tokens);for(let e=0;e<this.inlineQueue.length;e++){let t=this.inlineQueue[e];this.inlineTokens(t.src,t.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[],n=!1){this.tokenizer.lexer=this,this.options.pedantic&&(e=e.replace(L.tabCharGlobal,` `).replace(L.spaceLine,``));let r=1/0;for(;e;){if(e.length<r)r=e.length;else{this.infiniteLoopError(e.charCodeAt(0));break}let i;if(this.options.extensions?.block?.some(n=>(i=n.call({lexer:this},e,t))?(e=e.substring(i.raw.length),t.push(i),!0):!1))continue;if(i=this.tokenizer.space(e)){e=e.substring(i.raw.length);let n=t.at(-1);i.raw.length===1&&n!==void 0?n.raw+=`
35
- `:t.push(i);continue}if(i=this.tokenizer.code(e)){e=e.substring(i.raw.length);let n=t.at(-1);n?.type===`paragraph`||n?.type===`text`?(n.raw+=(n.raw.endsWith(`
36
- `)?``:`
37
- `)+i.raw,n.text+=`
38
- `+i.text,this.inlineQueue.at(-1).src=n.text):t.push(i);continue}if(i=this.tokenizer.fences(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.heading(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.hr(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.blockquote(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.list(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.html(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.def(e)){e=e.substring(i.raw.length);let n=t.at(-1);n?.type===`paragraph`||n?.type===`text`?(n.raw+=(n.raw.endsWith(`
39
- `)?``:`
40
- `)+i.raw,n.text+=`
41
- `+i.raw,this.inlineQueue.at(-1).src=n.text):this.tokens.links[i.tag]||(this.tokens.links[i.tag]={href:i.href,title:i.title},t.push(i));continue}if(i=this.tokenizer.table(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.lheading(e)){e=e.substring(i.raw.length),t.push(i);continue}let a=e;if(this.options.extensions?.startBlock){let t=1/0,n=e.slice(1),r;this.options.extensions.startBlock.forEach(e=>{r=e.call({lexer:this},n),typeof r==`number`&&r>=0&&(t=Math.min(t,r))}),t<1/0&&t>=0&&(a=e.substring(0,t+1))}if(this.state.top&&(i=this.tokenizer.paragraph(a))){let r=t.at(-1);n&&r?.type===`paragraph`?(r.raw+=(r.raw.endsWith(`
42
- `)?``:`
43
- `)+i.raw,r.text+=`
44
- `+i.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=r.text):t.push(i),n=a.length!==e.length,e=e.substring(i.raw.length);continue}if(i=this.tokenizer.text(e)){e=e.substring(i.raw.length);let n=t.at(-1);n?.type===`text`?(n.raw+=(n.raw.endsWith(`
45
- `)?``:`
46
- `)+i.raw,n.text+=`
47
- `+i.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=n.text):t.push(i);continue}if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}inlineTokens(e,t=[]){this.tokenizer.lexer=this;let n=e,r=null;if(this.tokens.links){let e=Object.keys(this.tokens.links);if(e.length>0)for(;(r=this.tokenizer.rules.inline.reflinkSearch.exec(n))!==null;)e.includes(r[0].slice(r[0].lastIndexOf(`[`)+1,-1))&&(n=n.slice(0,r.index)+`[`+`a`.repeat(r[0].length-2)+`]`+n.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(r=this.tokenizer.rules.inline.anyPunctuation.exec(n))!==null;)n=n.slice(0,r.index)+`++`+n.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);let i;for(;(r=this.tokenizer.rules.inline.blockSkip.exec(n))!==null;)i=r[2]?r[2].length:0,n=n.slice(0,r.index+i)+`[`+`a`.repeat(r[0].length-i-2)+`]`+n.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);n=this.options.hooks?.emStrongMask?.call({lexer:this},n)??n;let a=!1,o=``,s=1/0;for(;e;){if(e.length<s)s=e.length;else{this.infiniteLoopError(e.charCodeAt(0));break}a||(o=``),a=!1;let r;if(this.options.extensions?.inline?.some(n=>(r=n.call({lexer:this},e,t))?(e=e.substring(r.raw.length),t.push(r),!0):!1))continue;if(r=this.tokenizer.escape(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.tag(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.link(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(r.raw.length);let n=t.at(-1);r.type===`text`&&n?.type===`text`?(n.raw+=r.raw,n.text+=r.text):t.push(r);continue}if(r=this.tokenizer.emStrong(e,n,o)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.codespan(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.br(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.del(e,n,o)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.autolink(e)){e=e.substring(r.raw.length),t.push(r);continue}if(!this.state.inLink&&(r=this.tokenizer.url(e))){e=e.substring(r.raw.length),t.push(r);continue}let i=e;if(this.options.extensions?.startInline){let t=1/0,n=e.slice(1),r;this.options.extensions.startInline.forEach(e=>{r=e.call({lexer:this},n),typeof r==`number`&&r>=0&&(t=Math.min(t,r))}),t<1/0&&t>=0&&(i=e.substring(0,t+1))}if(r=this.tokenizer.inlineText(i)){e=e.substring(r.raw.length),r.raw.slice(-1)!==`_`&&(o=r.raw.slice(-1)),a=!0;let n=t.at(-1);n?.type===`text`?(n.raw+=r.raw,n.text+=r.text):t.push(r);continue}if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return t}infiniteLoopError(e){let t=`Infinite loop on byte: `+e;if(this.options.silent)console.error(t);else throw Error(t)}},Zt=class{options;parser;constructor(e){this.options=e||We}space(e){return``}code({text:e,lang:t,escaped:n}){let r=(t||``).match(L.notSpaceStart)?.[0],i=e.replace(L.endingNewline,``)+`
48
- `;return r?`<pre><code class="language-`+J(r)+`">`+(n?i:J(i,!0))+`</code></pre>
49
- `:`<pre><code>`+(n?i:J(i,!0))+`</code></pre>
50
- `}blockquote({tokens:e}){return`<blockquote>
51
- ${this.parser.parse(e)}</blockquote>
52
- `}html({text:e}){return e}def(e){return``}heading({tokens:e,depth:t}){return`<h${t}>${this.parser.parseInline(e)}</h${t}>
53
- `}hr(e){return`<hr>
54
- `}list(e){let t=e.ordered,n=e.start,r=``;for(let t=0;t<e.items.length;t++){let n=e.items[t];r+=this.listitem(n)}let i=t?`ol`:`ul`,a=t&&n!==1?` start="`+n+`"`:``;return`<`+i+a+`>
55
- `+r+`</`+i+`>
56
- `}listitem(e){return`<li>${this.parser.parse(e.tokens)}</li>
57
- `}checkbox({checked:e}){return`<input `+(e?`checked="" `:``)+`disabled="" type="checkbox"> `}paragraph({tokens:e}){return`<p>${this.parser.parseInline(e)}</p>
58
- `}table(e){let t=``,n=``;for(let t=0;t<e.header.length;t++)n+=this.tablecell(e.header[t]);t+=this.tablerow({text:n});let r=``;for(let t=0;t<e.rows.length;t++){let i=e.rows[t];n=``;for(let e=0;e<i.length;e++)n+=this.tablecell(i[e]);r+=this.tablerow({text:n})}return r&&=`<tbody>${r}</tbody>`,`<table>
59
- <thead>
60
- `+t+`</thead>
61
- `+r+`</table>
62
- `}tablerow({text:e}){return`<tr>
63
- ${e}</tr>
64
- `}tablecell(e){let t=this.parser.parseInline(e.tokens),n=e.header?`th`:`td`;return(e.align?`<${n} align="${e.align}">`:`<${n}>`)+t+`</${n}>
65
- `}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${J(e,!0)}</code>`}br(e){return`<br>`}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,tokens:n}){let r=this.parser.parseInline(n),i=Ut(e);if(i===null)return r;e=i;let a=`<a href="`+e+`"`;return t&&(a+=` title="`+J(t)+`"`),a+=`>`+r+`</a>`,a}image({href:e,title:t,text:n,tokens:r}){r&&(n=this.parser.parseInline(r,this.parser.textRenderer));let i=Ut(e);if(i===null)return J(n);e=i;let a=`<img src="${e}" alt="${J(n)}"`;return t&&(a+=` title="${J(t)}"`),a+=`>`,a}text(e){return`tokens`in e&&e.tokens?this.parser.parseInline(e.tokens):`escaped`in e&&e.escaped?e.text:J(e.text)}},Qt=class{strong({text:e}){return e}em({text:e}){return e}codespan({text:e}){return e}del({text:e}){return e}html({text:e}){return e}text({text:e}){return e}link({text:e}){return``+e}image({text:e}){return``+e}br(){return``}checkbox({raw:e}){return e}},Z=class e{options;renderer;textRenderer;constructor(e){this.options=e||We,this.options.renderer=this.options.renderer||new Zt,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new Qt}static parse(t,n){return new e(n).parse(t)}static parseInline(t,n){return new e(n).parseInline(t)}parse(e){this.renderer.parser=this;let t=``;for(let n=0;n<e.length;n++){let r=e[n];if(this.options.extensions?.renderers?.[r.type]){let e=r,n=this.options.extensions.renderers[e.type].call({parser:this},e);if(n!==!1||![`space`,`hr`,`heading`,`code`,`table`,`blockquote`,`list`,`html`,`def`,`paragraph`,`text`].includes(e.type)){t+=n||``;continue}}let i=r;switch(i.type){case`space`:t+=this.renderer.space(i);break;case`hr`:t+=this.renderer.hr(i);break;case`heading`:t+=this.renderer.heading(i);break;case`code`:t+=this.renderer.code(i);break;case`table`:t+=this.renderer.table(i);break;case`blockquote`:t+=this.renderer.blockquote(i);break;case`list`:t+=this.renderer.list(i);break;case`checkbox`:t+=this.renderer.checkbox(i);break;case`html`:t+=this.renderer.html(i);break;case`def`:t+=this.renderer.def(i);break;case`paragraph`:t+=this.renderer.paragraph(i);break;case`text`:t+=this.renderer.text(i);break;default:{let e=`Token with "`+i.type+`" type was not found.`;if(this.options.silent)return console.error(e),``;throw Error(e)}}}return t}parseInline(e,t=this.renderer){this.renderer.parser=this;let n=``;for(let r=0;r<e.length;r++){let i=e[r];if(this.options.extensions?.renderers?.[i.type]){let e=this.options.extensions.renderers[i.type].call({parser:this},i);if(e!==!1||![`escape`,`html`,`link`,`image`,`strong`,`em`,`codespan`,`br`,`del`,`text`].includes(i.type)){n+=e||``;continue}}let a=i;switch(a.type){case`escape`:n+=t.text(a);break;case`html`:n+=t.html(a);break;case`link`:n+=t.link(a);break;case`image`:n+=t.image(a);break;case`checkbox`:n+=t.checkbox(a);break;case`strong`:n+=t.strong(a);break;case`em`:n+=t.em(a);break;case`codespan`:n+=t.codespan(a);break;case`br`:n+=t.br(a);break;case`del`:n+=t.del(a);break;case`text`:n+=t.text(a);break;default:{let e=`Token with "`+a.type+`" type was not found.`;if(this.options.silent)return console.error(e),``;throw Error(e)}}}return n}},$t=class{options;block;constructor(e){this.options=e||We}static passThroughHooks=new Set([`preprocess`,`postprocess`,`processAllTokens`,`emStrongMask`]);static passThroughHooksRespectAsync=new Set([`preprocess`,`postprocess`,`processAllTokens`]);preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}emStrongMask(e){return e}provideLexer(e=this.block){return e?X.lex:X.lexInline}provideParser(e=this.block){return e?Z.parse:Z.parseInline}},en=new class{defaults=Ue();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=Z;Renderer=Zt;TextRenderer=Qt;Lexer=X;Tokenizer=Xt;Hooks=$t;constructor(...e){this.use(...e)}walkTokens(e,t){let n=[];for(let r of e)switch(n=n.concat(t.call(this,r)),r.type){case`table`:{let e=r;for(let r of e.header)n=n.concat(this.walkTokens(r.tokens,t));for(let r of e.rows)for(let e of r)n=n.concat(this.walkTokens(e.tokens,t));break}case`list`:{let e=r;n=n.concat(this.walkTokens(e.items,t));break}default:{let e=r;this.defaults.extensions?.childTokens?.[e.type]?this.defaults.extensions.childTokens[e.type].forEach(r=>{let i=e[r].flat(1/0);n=n.concat(this.walkTokens(i,t))}):e.tokens&&(n=n.concat(this.walkTokens(e.tokens,t)))}}return n}use(...e){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(e=>{let n={...e};if(n.async=this.defaults.async||n.async||!1,e.extensions&&(e.extensions.forEach(e=>{if(!e.name)throw Error(`extension name required`);if(`renderer`in e){let n=t.renderers[e.name];n?t.renderers[e.name]=function(...t){let r=e.renderer.apply(this,t);return r===!1&&(r=n.apply(this,t)),r}:t.renderers[e.name]=e.renderer}if(`tokenizer`in e){if(!e.level||e.level!==`block`&&e.level!==`inline`)throw Error(`extension level must be 'block' or 'inline'`);let n=t[e.level];n?n.unshift(e.tokenizer):t[e.level]=[e.tokenizer],e.start&&(e.level===`block`?t.startBlock?t.startBlock.push(e.start):t.startBlock=[e.start]:e.level===`inline`&&(t.startInline?t.startInline.push(e.start):t.startInline=[e.start]))}`childTokens`in e&&e.childTokens&&(t.childTokens[e.name]=e.childTokens)}),n.extensions=t),e.renderer){let t=this.defaults.renderer||new Zt(this.defaults);for(let n in e.renderer){if(!(n in t))throw Error(`renderer '${n}' does not exist`);if([`options`,`parser`].includes(n))continue;let r=n,i=e.renderer[r],a=t[r];t[r]=(...e)=>{let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n||``}}n.renderer=t}if(e.tokenizer){let t=this.defaults.tokenizer||new Xt(this.defaults);for(let n in e.tokenizer){if(!(n in t))throw Error(`tokenizer '${n}' does not exist`);if([`options`,`rules`,`lexer`].includes(n))continue;let r=n,i=e.tokenizer[r],a=t[r];t[r]=(...e)=>{let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n}}n.tokenizer=t}if(e.hooks){let t=this.defaults.hooks||new $t;for(let n in e.hooks){if(!(n in t))throw Error(`hook '${n}' does not exist`);if([`options`,`block`].includes(n))continue;let r=n,i=e.hooks[r],a=t[r];$t.passThroughHooks.has(n)?t[r]=e=>{if(this.defaults.async&&$t.passThroughHooksRespectAsync.has(n))return(async()=>{let n=await i.call(t,e);return a.call(t,n)})();let r=i.call(t,e);return a.call(t,r)}:t[r]=(...e)=>{if(this.defaults.async)return(async()=>{let n=await i.apply(t,e);return n===!1&&(n=await a.apply(t,e)),n})();let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n}}n.hooks=t}if(e.walkTokens){let t=this.defaults.walkTokens,r=e.walkTokens;n.walkTokens=function(e){let n=[];return n.push(r.call(this,e)),t&&(n=n.concat(t.call(this,e))),n}}this.defaults={...this.defaults,...n}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return X.lex(e,t??this.defaults)}parser(e,t){return Z.parse(e,t??this.defaults)}parseMarkdown(e){return(t,n)=>{let r={...n},i={...this.defaults,...r},a=this.onError(!!i.silent,!!i.async);if(this.defaults.async===!0&&r.async===!1)return a(Error(`marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise.`));if(typeof t>`u`||t===null)return a(Error(`marked(): input parameter is undefined or null`));if(typeof t!=`string`)return a(Error(`marked(): input parameter is of type `+Object.prototype.toString.call(t)+`, string expected`));if(i.hooks&&(i.hooks.options=i,i.hooks.block=e),i.async)return(async()=>{let n=i.hooks?await i.hooks.preprocess(t):t,r=await(i.hooks?await i.hooks.provideLexer(e):e?X.lex:X.lexInline)(n,i),a=i.hooks?await i.hooks.processAllTokens(r):r;i.walkTokens&&await Promise.all(this.walkTokens(a,i.walkTokens));let o=await(i.hooks?await i.hooks.provideParser(e):e?Z.parse:Z.parseInline)(a,i);return i.hooks?await i.hooks.postprocess(o):o})().catch(a);try{i.hooks&&(t=i.hooks.preprocess(t));let n=(i.hooks?i.hooks.provideLexer(e):e?X.lex:X.lexInline)(t,i);i.hooks&&(n=i.hooks.processAllTokens(n)),i.walkTokens&&this.walkTokens(n,i.walkTokens);let r=(i.hooks?i.hooks.provideParser(e):e?Z.parse:Z.parseInline)(n,i);return i.hooks&&(r=i.hooks.postprocess(r)),r}catch(e){return a(e)}}}onError(e,t){return n=>{if(n.message+=`
66
- Please report this to https://github.com/markedjs/marked.`,e){let e=`<p>An error occurred:</p><pre>`+J(n.message+``,!0)+`</pre>`;return t?Promise.resolve(e):e}if(t)return Promise.reject(n);throw n}}};function Q(e,t){return en.parse(e,t)}Q.options=Q.setOptions=function(e){return en.setOptions(e),Q.defaults=en.defaults,N(Q.defaults),Q},Q.getDefaults=Ue,Q.defaults=We,Q.use=function(...e){return en.use(...e),Q.defaults=en.defaults,N(Q.defaults),Q},Q.walkTokens=function(e,t){return en.walkTokens(e,t)},Q.parseInline=en.parseInline,Q.Parser=Z,Q.parser=Z.parse,Q.Renderer=Zt,Q.TextRenderer=Qt,Q.Lexer=X,Q.lexer=X.lex,Q.Tokenizer=Xt,Q.Hooks=$t,Q.parse=Q,Q.options,Q.setOptions,Q.use,Q.walkTokens,Q.parseInline,Z.parse,X.lex;var tn=!1;function nn(){tn||=(Q.setOptions({breaks:!0,gfm:!0}),He.addHook(`afterSanitizeAttributes`,e=>{e.nodeName===`A`&&(e.setAttribute(`target`,`_blank`),e.setAttribute(`rel`,`noopener noreferrer`))}),!0)}function rn(e){if(!e)return``;if(typeof window>`u`)return an(e);nn();try{let t=Q.parse(e,{async:!1});return He.sanitize(t)}catch{return an(e)}}function an(e){return String(e).replaceAll(`&`,`&amp;`).replaceAll(`<`,`&lt;`).replaceAll(`>`,`&gt;`)}var $=t(),on=`[[bazilion:inbox-wake]]
67
- `,sn=`[conversation summary]`,cn=40,ln=1e4,un=320,dn=200,fn=`slash commands:
68
- /context — context breakdown (system prompt, tools, skills, history)
69
- /compact [N] — summarize the head; keep the last N messages verbatim (default 10)
70
- /reset — reset chat history for this agent
71
- /help — show this list`;function pn(e){if(!e)return``;try{return JSON.stringify(JSON.parse(e),null,2)}catch{return e}}function mn(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KiB`:`${(e/(1024*1024)).toFixed(2)} MiB`}function hn(e){return new Promise((t,n)=>{let r=new FileReader;r.onload=()=>{let n=String(r.result),i=n.indexOf(`,`);t({name:e.name,data:i>=0?n.slice(i+1):n,mimeType:e.type||`application/octet-stream`})},r.onerror=()=>n(r.error),r.readAsDataURL(e)})}var gn=e=>e.startsWith(`image/`);function _n(e){let t=[],n=null;for(let r of e)if(r.role===`user`)n=null,t.push({type:`user`,content:r.content,...r.images&&r.images.length>0?{images:r.images}:{}});else if(r.role===`assistant`){if(r.content&&(n=null,t.push({type:`assistant`,content:r.content})),r.toolCalls&&r.toolCalls.length>0){n||(n={type:`tool`,items:[]},t.push(n));for(let e of r.toolCalls)n.items.push({kind:`call`,id:e.id,name:e.name,body:e.arguments})}}else if(r.role===`tool`){n||(n={type:`tool`,items:[]},t.push(n));let e=r.content.startsWith(`Error:`)||r.content.startsWith(`error:`);n.items.push({kind:e?`error`:`result`,id:r.toolCallId??``,name:r.toolName??``,body:r.content}),r.images&&r.images.length>0&&(t.push({type:`images`,images:r.images}),n=null)}return t}function vn({agentId:e,agentName:t,initialMessages:n,initialSessionHead:i}){let[a,o]=(0,r.useState)(n),[s,c]=(0,r.useState)([]),[l,u]=(0,r.useState)([]),[d,f]=(0,r.useState)(!1),[p,m]=(0,r.useState)(!1),[h,g]=(0,r.useState)(null),[_,v]=(0,r.useState)(``),[y,ee]=(0,r.useState)([]),[te,ne]=(0,r.useState)(!1),[re,ie]=(0,r.useState)(!1),ae=(0,r.useRef)(null),b=(0,r.useRef)(null),oe=(0,r.useRef)(null),se=(0,r.useRef)(null),ce=(0,r.useRef)(0),le=(0,r.useRef)(0),ue=(0,r.useRef)(i??{file:null,size:0}),de=(0,r.useRef)(!1);de.current=p,(0,r.useEffect)(()=>{o(n),c([]),u([]),g(null),v(``),f(!1),m(!1),ie(!1),ue.current=i??{file:null,size:0}},[e]);let fe=(0,r.useRef)(!0);(0,r.useLayoutEffect)(()=>{let e=ae.current;e&&fe.current&&(e.scrollTop=e.scrollHeight)});function x(){let e=ae.current;if(!e){fe.current=!0;return}fe.current=e.scrollHeight-e.scrollTop-e.clientHeight<cn}(0,r.useLayoutEffect)(()=>{let e=oe.current;e&&(e.style.height=`auto`,e.style.height=`${Math.min(e.scrollHeight,dn)}px`)},[_]),(0,r.useEffect)(()=>{let t=`bz_pending_${e}`;function n(){document.visibilityState===`visible`&&sessionStorage.getItem(t)&&(sessionStorage.removeItem(t),window.location.reload())}return document.addEventListener(`visibilitychange`,n),()=>document.removeEventListener(`visibilitychange`,n)},[e]),(0,r.useEffect)(()=>{if(!i)return;let t=!1,n=null;async function r(){if(!t){if(!document.hidden&&!de.current&&!re)try{let t=await fetch(`/api/agents/${encodeURIComponent(e)}/sessions/head`);if(t.ok){let e=await t.json();if(typeof e.size==`number`){let t=ue.current;(e.file!==t.file||e.size!==t.size)&&ie(!0)}}}catch{}n=setTimeout(r,ln)}}return n=setTimeout(r,ln),()=>{t=!0,n&&clearTimeout(n)}},[e,i,re]);async function S(){try{let t=await fetch(`/api/agents/${encodeURIComponent(e)}/sessions/head`);if(!t.ok)return;let n=await t.json();typeof n.size==`number`&&(ue.current={file:n.file??null,size:n.size})}catch{}}function C(e){x(),u(t=>[...t,{id:ce.current++,content:e,afterIdx:le.current}])}async function w(){try{let t=await fetch(`/api/agents/${encodeURIComponent(e)}/chat/context`);if(!t.ok){C(`/context failed: ${t.statusText}`);return}let n=await t.json(),r=(e,t)=>`${e.toLocaleString()} chars (~${t.toLocaleString()} tok)`,i=[];i.push(`context for ${n.agentId}`),i.push(`model: ${n.model}`),i.push(``),i.push(`system prompt: ${r(n.systemPrompt.chars,n.systemPrompt.tokens)}`);for(let e of n.systemPrompt.files)i.push(` - ${e.name}: ${e.chars.toLocaleString()} chars`);i.push(``),i.push(`tools: ${n.tools.count} (${n.tools.schemaChars.toLocaleString()} chars of schema)`);for(let e of n.tools.entries.slice(0,5))i.push(` - ${e.name}: ${e.schemaChars.toLocaleString()} chars`);if(n.skills.count>0){i.push(``),i.push(`skills: ${n.skills.count}`);for(let e of n.skills.entries.slice(0,10))i.push(` - ${e.name}: ${e.blockChars.toLocaleString()} chars`)}i.push(``),i.push(`history: ${n.history.messageEntries} messages / ${n.history.compactionEntries} compactions`),i.push(` ${r(n.history.chars,n.history.tokensEstimate)}`),i.push(` bytes on disk: ${mn(n.history.bytes)}`),i.push(``),i.push(`TOTAL: ${r(n.totals.chars,n.totals.tokens)}`),C(i.join(`
72
- `))}catch(e){C(`/context failed: ${e.message}`)}}async function T(){if(a.length===0){C(`/reset: history already empty`);return}if(confirm(`reset chat history for this agent?`)){O();try{let t=await fetch(`/api/agents/${encodeURIComponent(e)}/chat/reset`,{method:`POST`});if(!t.ok){let e=t.statusText;try{e=(await t.json()).error||e}catch{}C(`/reset failed: ${e}`);return}o([]),c([]),u([]),C(`/reset: history wiped`)}catch(e){C(`/reset failed: ${e.message}`)}}}async function E(t){if(a.length<2){C(`/compact: need ≥2 messages to compact`);return}let n,r=t.trim();if(r){let e=Number(r);Number.isFinite(e)&&e>=0&&(n=Math.floor(e))}O(),m(!0),f(!0);try{let t=await fetch(`/api/agents/${encodeURIComponent(e)}/chat/compact`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify(n===void 0?{}:{keepTail:n})});if(!t.ok){let e=t.statusText;try{e=(await t.json()).error||e}catch{}C(`/compact failed: ${e}`);return}let r=await t.json();C(`/compact: ${r.before} → ${r.after} entries (${r.summarized} summarized, ${r.keptTail} kept verbatim; ~${r.tokensBefore.toLocaleString()} → ~${r.tokensAfter.toLocaleString()} tok). reloading…`),setTimeout(()=>window.location.reload(),400)}catch(e){C(`/compact failed: ${e.message}`)}finally{f(!1),m(!1)}}async function pe(e){let t=e.trim();if(!t.startsWith(`/`))return!1;let n=t.split(/\s+/),r=(n[0]??``).toLowerCase(),i=n.slice(1).join(` `);switch(r){case`/help`:return C(fn),!0;case`/context`:return await w(),!0;case`/reset`:return await T(),!0;case`/compact`:return await E(i),!0;default:return!1}}function D(){for(let e=a.length-1;e>=0;e--)if(a[e]?.role===`user`)return e;return-1}function me(){if(s.length>0||p)return;let e=D();if(e===-1)return;let t=a[e];t&&(g(e),v(t.content),oe.current?.focus())}function O(){g(null)}async function he(e){if(!e)return;let t=Array.from(e);if(t.length===0)return;let n=await Promise.all(t.map(hn));ee(e=>[...e,...n].slice(0,16))}function k(e){let t=Array.from(e.clipboardData.files);t.some(e=>e.type.startsWith(`image/`))&&(e.preventDefault(),he(t))}function ge(e){p||Array.from(e.dataTransfer.types).includes(`Files`)&&(e.preventDefault(),ne(!0))}function A(e){e.currentTarget===e.target&&ne(!1)}function _e(e){e.dataTransfer.files.length>0&&(e.preventDefault(),ne(!1),he(e.dataTransfer.files))}let ve=(0,r.useCallback)(async t=>{let n=y;if(!t.trim()&&n.length===0||p||(v(``),await pe(t)))return;ee([]);let r=null;if(h!==null){let n=h;try{let i=await fetch(`/api/agents/${encodeURIComponent(e)}/chat/truncate`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({keepCount:n})});if(!i.ok){let e=i.statusText;try{e=(await i.json()).error||e}catch{}v(t),alert(`failed to replace last turn: ${e}`);return}r=a.slice(0,n),o(r),g(null)}catch(e){v(t),alert(`failed to replace last turn: ${e.message}`);return}}x();let i=n.filter(e=>gn(e.mimeType)),s=n.filter(e=>!gn(e.mimeType));c([{type:`user`,content:t,...i.length>0?{images:i}:{},...s.length>0?{files:s.map(e=>({name:e.name??`file`}))}:{}}]),sessionStorage.setItem(`bz_pending_${e}`,`1`);let l=new AbortController;se.current=l,m(!0),f(!0);try{let r=await fetch(`/api/agents/${encodeURIComponent(e)}/chat`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({message:t,attachments:n}),signal:l.signal});if(!r.ok||!r.body){let e=r.statusText;try{e=(await r.json()).error||e}catch{}c(t=>[...t,{type:`error`,content:`[error] ${e}`}]);return}let i=r.body.getReader(),a=new TextDecoder,o=``;for(;;){let{done:e,value:t}=await i.read();if(e)break;o+=a.decode(t,{stream:!0});let n=o.split(`
73
- `);o=n.pop()??``;for(let e of n){if(!e.trim())continue;let t;try{t=JSON.parse(e)}catch{continue}ye(t)}}if(o.trim())try{ye(JSON.parse(o))}catch{}await S(),sessionStorage.removeItem(`bz_pending_${e}`)}catch(t){t.name!==`AbortError`&&c(e=>[...e,{type:`error`,content:`[network error] ${t.message}`}]),sessionStorage.removeItem(`bz_pending_${e}`)}finally{f(!1),m(!1),se.current=null}},[e,h,a,p,y]);function ye(e){if(e.kind===`fatal`){c(t=>[...t,{type:`error`,content:`[fatal] ${e.error}`}]);return}if(e.kind===`done`){o(e.messages),c([]);return}if(e.kind!==`event`)return;let t=e.event;if(x(),t.type!==`user_message`){if(t.type===`assistant_delta`){f(!1),c(e=>{let n=[...e],r=n[n.length-1];return r?.type===`assistant`?n[n.length-1]={type:`assistant`,content:r.content+t.delta}:n.push({type:`assistant`,content:t.delta}),n});return}if(t.type===`assistant_message`){f(!1),c(e=>{let n=[...e];return n[n.length-1]?.type===`assistant`?n[n.length-1]={type:`assistant`,content:t.text}:n.push({type:`assistant`,content:t.text}),n});return}if(t.type===`tool_call`||t.type===`tool_result`||t.type===`tool_error`){f(t.type!==`tool_call`);let e=t.type===`tool_call`?{kind:`call`,id:t.id,name:t.name,body:t.arguments}:t.type===`tool_result`?{kind:`result`,id:t.id,name:t.name,body:t.result}:{kind:`error`,id:t.id,name:t.name,body:t.error},n=t.type===`tool_result`?t.images:void 0;c(t=>{let r=[...t],i=r[r.length-1];return i?.type===`tool`?r[r.length-1]={type:`tool`,items:[...i.items,e]}:r.push({type:`tool`,items:[e]}),n&&n.length>0&&r.push({type:`images`,images:n}),r});return}if(t.type===`file`){c(e=>[...e,{type:`file`,name:t.name,mimeType:t.mimeType,data:t.data}]);return}t.type===`error`&&c(e=>[...e,{type:`error`,content:`[error] ${t.error}`}])}}async function be(){try{let t=await fetch(`/api/agents/${encodeURIComponent(e)}/cancel`,{method:`POST`});if(t.ok||t.status===204)return}catch{}se.current?.abort()}function xe(e){e.key===`Enter`&&!e.shiftKey&&!e.nativeEvent.isComposing&&(e.preventDefault(),ve(_))}let j=_n(a);le.current=j.length+s.length;let Se=(()=>{if(s.length>0||p)return-1;for(let e=j.length-1;e>=0;e--)if(j[e]?.type===`user`)return e;return-1})(),Ce=(()=>{if(h===null)return-1;let e=0;for(let t=0;t<j.length;t++)if(j[t]?.type===`user`){if(e===a.slice(0,h+1).filter(e=>e.role===`user`).length-1)return t;e++}return Se})();return(0,$.jsxs)(`div`,{className:`relative flex h-full flex-col overflow-hidden rounded-[16px] border border-frost bg-snow shadow-baziu-sm`,onDragOver:ge,onDragLeave:A,onDrop:_e,children:[te&&(0,$.jsx)(`div`,{className:`pointer-events-none absolute inset-0 z-10 flex items-center justify-center rounded-[16px] border-2 border-dashed border-sapphire bg-sapphire-glow/80 text-[0.95em] font-medium text-sapphire-deep`,children:`drop images or files to attach`}),(0,$.jsxs)(`div`,{className:`flex items-baseline justify-between border-b border-frost px-4 py-2.5`,children:[(0,$.jsx)(`h1`,{className:`font-display text-[1.2rem] text-charcoal`,children:t}),(0,$.jsx)(`a`,{href:`/agents/${e}`,className:`text-xs text-mocha-light hover:text-sapphire`,children:`settings →`})]}),re&&(0,$.jsxs)(`div`,{className:`mx-5 mt-2 flex items-center gap-2 rounded-md border border-sapphire bg-frost px-4 py-2 text-[0.86em] text-mocha`,children:[(0,$.jsx)(`span`,{className:`h-2 w-2 flex-none rounded-full bg-sapphire`,"aria-hidden":`true`}),(0,$.jsx)(`span`,{className:`flex-1`,children:`new activity from another source — reload to see it`}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>window.location.reload(),className:`rounded-sm bg-sapphire px-3 py-1 text-[0.92em] text-snow hover:opacity-90`,children:`reload`}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>ie(!1),className:`px-1 text-mocha-light hover:text-mocha`,"aria-label":`dismiss`,children:`×`})]}),(0,$.jsxs)(`div`,{ref:ae,onScroll:x,className:`min-h-[240px] flex-1 overflow-y-auto px-5 py-5 ${h===null?``:`is-editing`}`,children:[j.length===0&&s.length===0&&l.length===0&&(0,$.jsx)(`p`,{className:`py-12 text-center italic text-fawn`,children:`start a conversation…`}),(()=>{let e=[],t=0,n=n=>{for(;t<l.length&&l[t].afterIdx<=n;){let n=l[t];e.push((0,$.jsx)(yn,{entry:{type:`system`,content:n.content}},`y-${n.id}`)),t++}};n(0);for(let t=0;t<j.length;t++){let r=j[t];e.push((0,$.jsx)(yn,{entry:r,isLastUser:t===Se&&h===null,isWillDrop:Ce!==-1&&t>=Ce,onEdit:me},`s-${t}`)),n(t+1)}for(let t=0;t<s.length;t++){let r=s[t];e.push((0,$.jsx)(yn,{entry:r},`l-${t}`)),n(j.length+t+1)}for(;t<l.length;){let n=l[t];e.push((0,$.jsx)(yn,{entry:{type:`system`,content:n.content}},`y-${n.id}`)),t++}return e})(),d&&(0,$.jsxs)(`div`,{className:`flex items-center gap-2 px-1 py-1 text-[0.85em] text-mocha-light`,children:[(0,$.jsx)(Sn,{}),(0,$.jsx)(Sn,{delay:`0.15s`}),(0,$.jsx)(Sn,{delay:`0.3s`}),(0,$.jsx)(`span`,{children:`agent is thinking…`})]})]}),h!==null&&(0,$.jsxs)(`div`,{className:`flex items-center gap-2 border-t border-frost bg-sapphire-glow px-5 py-2 text-[0.85em] text-sapphire-deep`,children:[(0,$.jsx)(`span`,{children:`editing last message — submit to replace, or`}),(0,$.jsx)(`button`,{type:`button`,onClick:O,className:`ml-auto rounded-sm border border-sapphire-light bg-transparent px-2 py-0.5 text-[0.92em] text-sapphire-deep hover:bg-snow`,children:`cancel`})]}),y.length>0&&(0,$.jsx)(`div`,{className:`flex flex-wrap gap-2 border-t border-frost bg-ivory px-5 pt-3`,children:y.map((e,t)=>{let n=()=>ee(e=>e.filter((e,n)=>n!==t));return gn(e.mimeType)?(0,$.jsxs)(`div`,{className:`relative`,children:[(0,$.jsx)(`img`,{src:`data:${e.mimeType};base64,${e.data}`,alt:`pending attachment`,className:`h-16 w-16 rounded-md border border-frost object-cover`}),(0,$.jsx)(`button`,{type:`button`,onClick:n,className:`absolute -right-1.5 -top-1.5 flex h-5 w-5 items-center justify-center rounded-full border border-frost bg-snow text-[0.7em] text-mocha hover:border-sapphire hover:text-sapphire`,"aria-label":`remove attachment`,children:`✕`})]},`${e.mimeType}-${t}`):(0,$.jsxs)(`div`,{className:`flex items-center gap-1.5 rounded-md border border-frost bg-snow px-2 py-1 text-[0.82em] text-mocha`,children:[(0,$.jsx)(`span`,{children:`📄`}),(0,$.jsx)(`span`,{className:`max-w-[160px] truncate`,children:e.name??`file`}),(0,$.jsx)(`button`,{type:`button`,onClick:n,className:`text-[0.85em] text-mocha hover:text-sapphire`,"aria-label":`remove attachment`,children:`✕`})]},`${e.name??`file`}-${t}`)})}),(0,$.jsxs)(`form`,{className:`flex items-end gap-2 border-t border-frost bg-ivory px-5 py-3`,onSubmit:e=>{e.preventDefault(),ve(_)},children:[(0,$.jsx)(`input`,{ref:b,type:`file`,multiple:!0,className:`hidden`,onChange:e=>{he(e.target.files),e.target.value=``}}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>b.current?.click(),disabled:p,title:`attach images or files`,"aria-label":`attach files`,className:`rounded-md border-[1.5px] border-frost bg-snow px-3 py-2 text-[1em] text-mocha transition-colors hover:border-sapphire hover:text-sapphire disabled:cursor-not-allowed disabled:opacity-50`,children:`📎`}),(0,$.jsx)(`textarea`,{ref:oe,rows:1,value:_,onChange:e=>v(e.target.value),onKeyDown:xe,onPaste:k,disabled:p,placeholder:`say something… (Shift+Enter for newline; paste or 📎 to attach images/files)`,autoComplete:`off`,className:`max-h-[200px] min-h-[2.4rem] flex-1 resize-none overflow-y-auto rounded-md border-[1.5px] border-frost bg-snow px-3 py-2 text-[0.93em] leading-[1.45] text-chocolate outline-none transition-colors focus:border-sapphire focus:shadow-[0_0_0_3px_var(--color-sapphire-glow)]`}),(0,$.jsx)(`button`,{type:`submit`,disabled:p||!_.trim()&&y.length===0,className:`rounded-md bg-sapphire px-4 py-2 text-[0.92em] font-semibold text-snow transition-colors hover:bg-sapphire-deep disabled:cursor-not-allowed disabled:opacity-50`,children:`send`}),p&&(0,$.jsx)(`button`,{type:`button`,onClick:be,className:`rounded-md border-[1.5px] border-frost bg-transparent px-3 py-1.5 text-[0.92em] font-medium text-mocha hover:border-sapphire-light hover:bg-sapphire-glow hover:text-sapphire`,children:`cancel`})]})]})}function yn({entry:e,isLastUser:t,isWillDrop:n,onEdit:r}){let i=n?`opacity-40 [&_.bubble-content]:line-through`:``;if(e.type===`user`){if(e.content.startsWith(on)){let t=e.content.slice(24);return(0,$.jsxs)(`div`,{className:`my-4 flex flex-col items-end ${i}`,children:[(0,$.jsx)(`span`,{className:`mb-1 text-[0.72em] font-semibold uppercase tracking-wider text-mocha opacity-90`,children:`inbox`}),(0,$.jsx)(`div`,{className:`bubble-content max-w-[85%] whitespace-pre-wrap break-words rounded-[14px_14px_4px_14px] border border-fawn border-l-[3px] border-l-mocha-light bg-ivory px-3 py-2 font-mono text-[0.88em] leading-[1.5] text-mocha`,children:t})]})}return(0,$.jsxs)(`div`,{className:`group relative my-4 flex flex-col items-end ${i}`,children:[(0,$.jsx)(`span`,{className:`sr-only`,children:`you`}),e.images&&e.images.length>0&&(0,$.jsx)(`div`,{className:`mb-1 flex max-w-[85%] flex-wrap justify-end gap-1`,children:e.images.map((e,t)=>(0,$.jsx)(`img`,{src:`data:${e.mimeType};base64,${e.data}`,alt:`attachment`,className:`max-h-48 rounded-lg border border-sapphire-light`},t))}),e.files&&e.files.length>0&&(0,$.jsx)(`div`,{className:`mb-1 flex max-w-[85%] flex-wrap justify-end gap-1`,children:e.files.map((e,t)=>(0,$.jsxs)(`span`,{className:`flex items-center gap-1 rounded-md border border-sapphire-light bg-sapphire-glow px-2 py-1 text-[0.8em] text-chocolate`,children:[`📄 `,(0,$.jsx)(`span`,{className:`max-w-[180px] truncate`,children:e.name})]},t))}),e.content&&(0,$.jsx)(`div`,{className:`bubble-content max-w-[85%] whitespace-pre-wrap break-words rounded-[14px_14px_4px_14px] border border-sapphire-light bg-sapphire-glow px-3 py-2 text-chocolate`,children:e.content}),t&&r&&(0,$.jsx)(`button`,{type:`button`,onClick:r,title:`edit and resend — replaces the last turn`,className:`absolute left-1 top-1 rounded-sm border border-fawn bg-ivory px-2 py-0.5 text-[0.78em] font-medium text-mocha opacity-65 transition hover:border-sapphire hover:bg-sapphire-glow hover:text-sapphire hover:opacity-100 group-hover:opacity-100 group-focus-within:opacity-100`,children:`edit`})]})}if(e.type===`assistant`){if(e.content.startsWith(sn)){let t=e.content.slice(22).trim();return(0,$.jsx)(`div`,{className:`my-3 border-y border-dashed border-frost py-2 text-[0.85em] italic text-mocha-light ${i}`,children:(0,$.jsxs)(`details`,{children:[(0,$.jsx)(`summary`,{className:`cursor-pointer select-none text-center [&::-webkit-details-marker]:hidden`,children:`— conversation summary (click to expand) —`}),(0,$.jsx)(`div`,{className:`md-content mt-2 rounded-sm bg-frost/40 p-2 not-italic`,dangerouslySetInnerHTML:{__html:rn(t)}})]})})}return e.content.startsWith(`[error]`)||e.content.startsWith(`[fatal]`)||e.content.startsWith(`[network error]`)?(0,$.jsxs)(`div`,{className:`my-4 flex flex-col items-start ${i}`,children:[(0,$.jsx)(`span`,{className:`mb-1 text-[0.72em] font-semibold uppercase tracking-wider text-[#9B3D3D]`,children:`error`}),(0,$.jsx)(`div`,{className:`bubble-content rounded-r-sm border-l-[3px] border-l-[#9B3D3D] bg-[rgba(196,135,138,0.06)] py-1 pl-3 pr-2 leading-[1.55]`,dangerouslySetInnerHTML:{__html:rn(e.content)}})]}):(0,$.jsxs)(`div`,{className:`my-4 flex flex-col items-start ${i}`,children:[(0,$.jsx)(`span`,{className:`sr-only`,children:`agent`}),(0,$.jsx)(`div`,{className:`md-content bubble-content w-full leading-[1.55] text-chocolate`,dangerouslySetInnerHTML:{__html:rn(e.content)}})]})}if(e.type===`tool`)return(0,$.jsx)(bn,{items:e.items,dropCls:i});if(e.type===`images`)return(0,$.jsx)(`div`,{className:`my-2 space-y-2 ${i}`,children:e.images.map((e,t)=>(0,$.jsx)(`img`,{src:`data:${e.mimeType};base64,${e.data}`,alt:`screenshot`,className:`block max-w-full rounded-lg border border-fawn`},t))});if(e.type===`file`){let t=e.mimeType.startsWith(`image/`),n=`data:${e.mimeType};base64,${e.data}`;return(0,$.jsxs)(`div`,{className:`my-2 ${i}`,children:[t&&(0,$.jsx)(`img`,{src:n,alt:e.name,className:`mb-1 block max-w-full rounded-lg border border-fawn`}),(0,$.jsxs)(`a`,{href:n,download:e.name,className:`inline-flex items-center gap-2 rounded-md border border-fawn bg-ivory px-3 py-2 text-[0.88em] text-mocha hover:border-sapphire hover:text-sapphire`,children:[(0,$.jsx)(`span`,{children:`📄`}),(0,$.jsx)(`span`,{className:`max-w-[260px] truncate`,children:e.name}),(0,$.jsx)(`span`,{className:`text-[0.85em] opacity-70`,children:`download`})]})]})}return e.type===`system`?(0,$.jsxs)(`div`,{className:`my-3 rounded-r-sm border-l-[3px] border-sapphire bg-sapphire-glow px-3 py-1 font-mono text-[0.88em] text-sapphire-deep ${i}`,children:[(0,$.jsx)(`span`,{className:`mr-2 font-semibold uppercase tracking-wider opacity-80`,children:`system`}),(0,$.jsx)(`span`,{className:`whitespace-pre-wrap`,children:e.content})]}):e.type===`error`?(0,$.jsx)(`div`,{className:`my-3 rounded-r-sm border-l-[3px] border-[#9B3D3D] bg-[rgba(196,135,138,0.08)] px-3 py-1 text-[0.92em] text-[#9B3D3D] ${i}`,children:e.content}):null}function bn({items:e,dropCls:t}){let[n,i]=(0,r.useState)(!1),a=(0,r.useRef)(null),[o,s]=(0,r.useState)(!1);return(0,r.useLayoutEffect)(()=>{let e=a.current;e&&s(e.scrollHeight>324)},[e.length]),(0,$.jsxs)(`div`,{className:`my-1.5 rounded-r-sm border-l-[3px] border-fawn bg-ivory px-3 py-2 font-mono text-[0.82em] leading-[1.5] text-mocha-light ${t}`,children:[(0,$.jsxs)(`div`,{ref:a,className:`relative overflow-hidden`,style:{maxHeight:n?`none`:`${un}px`},children:[e.map((e,t)=>(0,$.jsx)(xn,{item:e},t)),o&&!n&&(0,$.jsx)(`div`,{className:`pointer-events-none absolute inset-x-0 bottom-0 h-10`,style:{background:`linear-gradient(to bottom, rgba(247,240,229,0), var(--color-ivory))`}})]}),o&&(0,$.jsx)(`button`,{type:`button`,onClick:()=>i(e=>!e),className:`mt-2 rounded-sm border border-fawn bg-transparent px-2 py-0.5 text-[0.9em] text-mocha hover:border-sapphire hover:text-sapphire-deep`,children:n?`show less ↑`:`show more ↓`})]})}function xn({item:e}){if(e.kind===`call`){let t=pn(e.body),n=t.includes(`
74
- `);return(0,$.jsxs)(`div`,{className:`whitespace-pre-wrap break-words py-0.5`,children:[(0,$.jsx)(`span`,{className:`mr-1 opacity-45`,children:`→`}),(0,$.jsx)(`span`,{className:`font-medium text-mocha`,children:e.name}),n?(0,$.jsx)(`pre`,{className:`ml-4 mt-0.5 rounded-sm bg-[rgba(42,31,22,0.04)] px-2 py-1 font-mono text-[0.95em] leading-[1.4] text-mocha`,children:t}):t?(0,$.jsxs)(`span`,{children:[` (`,t,`)`]}):null]})}return e.kind===`error`?(0,$.jsxs)(`div`,{className:`whitespace-pre-wrap break-words py-0.5 text-rose-baziu`,children:[(0,$.jsx)(`span`,{className:`mr-1 opacity-45`,children:`←`}),e.body]}):(0,$.jsxs)(`div`,{className:`whitespace-pre-wrap break-words py-0.5`,children:[(0,$.jsx)(`span`,{className:`mr-1 opacity-45`,children:`←`}),e.body]})}function Sn({delay:e=`0s`}){return(0,$.jsx)(`span`,{className:`inline-block h-1.5 w-1.5 animate-pulse rounded-full bg-mocha-light/60`,style:{animationDelay:e},"aria-hidden":`true`})}export{vn as t};
@@ -1 +0,0 @@
1
- import{E as e}from"./index-BQUL6oyH.js";var t=e(),n=[{key:`providers`,href:`/config`,label:`providers`},{key:`services`,href:`/config/services`,label:`services`},{key:`mcp`,href:`/config/mcp`,label:`mcp`},{key:`integrations`,href:`/config/integrations/telegram`,label:`integrations`},{key:`tokens`,href:`/config/tokens`,label:`tokens`}];function r({active:e}){return(0,t.jsx)(`nav`,{className:`flex gap-1 border-b mb-6`,children:n.map(n=>(0,t.jsx)(`a`,{href:n.href,className:`px-3 py-2 text-sm border-b-2 -mb-px ${n.key===e?`border-primary text-primary font-semibold`:`border-transparent text-muted-foreground hover:text-foreground`}`,children:n.label},n.key))})}export{r as t};
@@ -1 +0,0 @@
1
- import{D as e,E as t,O as n,T as r}from"./index-BQUL6oyH.js";var i=n(e(),1),a=t();function o({field:e}){let t=r(),[n,o]=(0,i.useState)(e.kind===`config`?e.value??``:``),[s,c]=(0,i.useState)(!1),[l,u]=(0,i.useState)(null),[d,f]=(0,i.useState)(null);async function p(r){r.preventDefault(),c(!0),u(null);try{let r=await fetch(`/api/config/fields/${encodeURIComponent(e.envVar)}`,{method:`PUT`,headers:{"content-type":`application/json`},body:JSON.stringify({value:n})});if(!r.ok){let e=await r.json().catch(()=>({}));throw Error(e.error??`${r.status} ${r.statusText}`)}f(Date.now()),e.kind===`secret`&&o(``),await t.invalidate()}catch(e){u(e.message)}finally{c(!1)}}return(0,a.jsxs)(`form`,{onSubmit:p,className:`grid grid-cols-[12rem_minmax(14rem,1fr)_auto_auto] gap-2 items-center py-2 border-b last:border-0`,children:[(0,a.jsxs)(`div`,{className:`min-w-0`,children:[(0,a.jsx)(`div`,{className:`text-sm`,children:e.label}),(0,a.jsx)(`div`,{className:`font-mono text-xs text-muted-foreground`,children:e.envVar}),e.description&&(0,a.jsx)(`div`,{className:`text-xs text-muted-foreground mt-0.5`,children:e.description})]}),e.kind===`config`?(0,a.jsx)(`input`,{type:`text`,value:n,onChange:e=>o(e.target.value),placeholder:e.placeholder??``,className:`rounded-md border bg-background px-2 py-1.5 text-sm outline-none focus:ring-2 focus:ring-ring/30`}):(0,a.jsx)(`input`,{type:`password`,value:n,onChange:e=>o(e.target.value),placeholder:e.set?`(replace — blank clears)`:e.placeholder??`paste key…`,autoComplete:`off`,className:`rounded-md border bg-background px-2 py-1.5 text-sm outline-none focus:ring-2 focus:ring-ring/30`}),(0,a.jsxs)(`span`,{className:`text-xs`,children:[e.kind===`secret`&&e.set&&(0,a.jsx)(`span`,{className:`rounded-full bg-emerald-100 text-emerald-800 px-1.5 py-0.5`,title:`preview: ${e.preview??``}`,children:`set`}),d&&Date.now()-d<2e3&&(0,a.jsx)(`span`,{className:`text-emerald-700 ml-2`,children:`saved ✓`})]}),(0,a.jsx)(`button`,{type:`submit`,disabled:s,className:`unstyled rounded-md border bg-background px-2 py-1.5 text-xs text-foreground hover:bg-accent disabled:opacity-50`,children:`save`}),l&&(0,a.jsx)(`p`,{className:`col-span-4 text-xs text-rose-700`,children:l})]})}export{o as t};
@@ -1 +0,0 @@
1
- import{E as e}from"./index-BQUL6oyH.js";import{r as t}from"./wire-constants-BkT5-597.js";import{t as n}from"./Button-BefUtjMZ.js";var r=e();function i({members:e,onChange:i,profiles:a,modelGroups:o,emptyHint:s=`No members yet. Add one to define your first team member.`}){function c(t,n){i(e.map((e,r)=>r===t?{...e,...n}:e))}function l(t,n){let r=t+n;if(r<0||r>=e.length)return;let a=[...e],o=a[t],s=a[r];!o||!s||(a[t]=s,a[r]=o,i(a))}function u(t){i(e.filter((e,n)=>n!==t))}function d(){let t=a[0];t&&i([...e,{profileId:t.id,agentName:`agent`,modelOverride:null,reasoningLevel:null}])}return a.length===0?(0,r.jsxs)(`p`,{className:`muted`,children:[`Create a profile first under `,(0,r.jsx)(`a`,{href:`/profiles`,children:`/profiles`}),` — members reference existing profiles.`]}):(0,r.jsxs)(r.Fragment,{children:[e.length===0?(0,r.jsx)(`p`,{className:`muted`,children:s}):(0,r.jsxs)(`table`,{children:[(0,r.jsx)(`thead`,{children:(0,r.jsxs)(`tr`,{children:[(0,r.jsx)(`th`,{children:`#`}),(0,r.jsx)(`th`,{children:`profile`}),(0,r.jsx)(`th`,{children:`agent name`}),(0,r.jsx)(`th`,{children:`model override`}),(0,r.jsx)(`th`,{children:`reasoning`}),(0,r.jsx)(`th`,{})]})}),(0,r.jsx)(`tbody`,{children:e.map((i,s)=>(0,r.jsxs)(`tr`,{children:[(0,r.jsx)(`td`,{children:s}),(0,r.jsx)(`td`,{children:(0,r.jsx)(`select`,{value:i.profileId,onChange:e=>c(s,{profileId:e.target.value}),children:a.map(e=>(0,r.jsx)(`option`,{value:e.id,children:e.id},e.id))})}),(0,r.jsx)(`td`,{children:(0,r.jsx)(`input`,{value:i.agentName,onChange:e=>c(s,{agentName:e.target.value})})}),(0,r.jsx)(`td`,{children:(0,r.jsxs)(`select`,{value:i.modelOverride??``,onChange:e=>c(s,{modelOverride:e.target.value===``?null:e.target.value}),children:[(0,r.jsx)(`option`,{value:``,children:`(use profile default)`}),o.map(e=>(0,r.jsx)(`optgroup`,{label:e.provider,children:e.models.map(t=>(0,r.jsx)(`option`,{value:`${e.provider}:${t}`,children:`${e.provider}:${t}`},t))},e.provider))]})}),(0,r.jsx)(`td`,{children:(0,r.jsxs)(`select`,{value:i.reasoningLevel??``,onChange:e=>c(s,{reasoningLevel:e.target.value===``?null:e.target.value}),children:[(0,r.jsx)(`option`,{value:``,children:`(default: medium)`}),t.map(e=>(0,r.jsx)(`option`,{value:e,children:e},e))]})}),(0,r.jsxs)(`td`,{className:`flex gap-1`,children:[(0,r.jsx)(n,{variant:`ghost`,onClick:()=>l(s,-1),disabled:s===0,title:`move up`,children:`↑`}),(0,r.jsx)(n,{variant:`ghost`,onClick:()=>l(s,1),disabled:s===e.length-1,title:`move down`,children:`↓`}),(0,r.jsx)(n,{variant:`danger`,onClick:()=>u(s),title:`remove member`,children:`✕`})]})]},s))})]}),(0,r.jsx)(`div`,{className:`mt-3`,children:(0,r.jsx)(n,{variant:`ghost`,onClick:d,children:`+ add member`})})]})}export{i as t};
@@ -1 +0,0 @@
1
- import{D as e,E as t,O as n}from"./index-BQUL6oyH.js";import{t as r}from"./Button-BefUtjMZ.js";var i=n(e(),1),a=t();function o({profileGroup:e,groups:t,onClose:n,onSpawned:o}){let[s,c]=(0,i.useState)(``),[l,u]=(0,i.useState)(``),[d,f]=(0,i.useState)(null),[p,m]=(0,i.useState)(!1);async function h(){if(f(null),!s.trim()){f(`target group slug is required`);return}m(!0);try{let t={groupSlug:s.trim()};l&&(t.userMd=l);let n=await fetch(`/api/profile-groups/${e.id}/spawn`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify(t)});if(!n.ok){let e=await n.json().catch(()=>null);throw Error(e?.error??n.statusText)}let r=await n.json();r.orphanAgentIds&&r.orphanAgentIds.length>0&&alert(`Spawn completed with warnings: ${r.orphanAgentIds.length} orphan agent dir(s) left on disk.`),o(r.groupSlug)}catch(e){f(e.message)}finally{m(!1)}}return(0,a.jsx)(`div`,{role:`dialog`,"aria-modal":`true`,className:`fixed inset-0 z-50 flex items-center justify-center bg-black/50`,onClick:n,onKeyDown:e=>{e.key===`Escape`&&n()},children:(0,a.jsxs)(`div`,{className:`card w-full max-w-lg`,onClick:e=>e.stopPropagation(),onKeyDown:e=>e.stopPropagation(),role:`document`,children:[(0,a.jsxs)(`h3`,{children:[`spawn team — `,e.name]}),d&&(0,a.jsx)(`div`,{className:`err`,children:d}),(0,a.jsxs)(`p`,{className:`muted`,children:[`Spawns `,e.memberCount,` agent`,e.memberCount===1?``:`s`,` into the target group. If the group doesn't exist, it'll be created on the fly. Failures roll back the whole spawn.`]}),(0,a.jsxs)(`label`,{children:[`target group slug`,(0,a.jsx)(`input`,{value:s,onChange:e=>c(e.target.value),list:`existing-groups`,required:!0}),(0,a.jsx)(`datalist`,{id:`existing-groups`,children:t.map(e=>(0,a.jsx)(`option`,{value:e.id,children:e.name},e.id))})]}),(0,a.jsxs)(`label`,{children:[`override USER.md (optional — only takes effect on a freshly-created target group)`,(0,a.jsx)(`textarea`,{rows:3,value:l,onChange:e=>u(e.target.value),className:`font-mono text-[0.88em] leading-[1.55]`})]}),(0,a.jsxs)(`div`,{className:`mt-4 flex gap-2 justify-end`,children:[(0,a.jsx)(r,{variant:`ghost`,onClick:n,children:`cancel`}),(0,a.jsx)(r,{variant:`primary`,onClick:h,disabled:p,children:p?`spawning…`:`spawn team`})]})]})})}export{o as t};
@@ -1 +0,0 @@
1
- import{C as e,E as t,S as n}from"./index-BQUL6oyH.js";var r=t();function i(){let t=n({select:e=>e.location.pathname});return(0,r.jsx)(`nav`,{role:`tablist`,className:`-mb-px mb-5 flex gap-1 border-b border-frost`,children:[{to:`/profiles`,label:`profiles`,match:e=>e.startsWith(`/profiles`)},{to:`/profile-groups`,label:`profile groups`,match:e=>e.startsWith(`/profile-groups`)}].map(n=>{let i=n.match(t);return(0,r.jsx)(e,{to:n.to,role:`tab`,"aria-selected":i,className:`unstyled cursor-pointer border-b-2 bg-transparent px-4 py-2 text-[0.9em] font-medium transition-colors ${i?`border-sapphire text-sapphire`:`border-transparent text-mocha hover:text-sapphire`}`,children:n.label},n.to)})})}export{i as t};
@@ -1 +0,0 @@
1
- import{D as e,E as t,O as n,T as r,d as i}from"./index-BQUL6oyH.js";var a=n(e()),o=t();function s(){let{loaded:e,modelGroups:t,skills:n}=i.useLoaderData(),[r,s]=(0,a.useState)(`basics`);return(0,o.jsxs)(`div`,{children:[(0,o.jsxs)(`header`,{className:`mb-1`,children:[(0,o.jsx)(`a`,{href:`/profiles`,className:`mb-1 inline-block text-[0.85em] text-mocha-light hover:text-sapphire`,children:`← profiles`}),(0,o.jsx)(`h1`,{children:e.profile.name}),(0,o.jsxs)(`div`,{className:`mt-1 flex flex-wrap items-center gap-2 text-[0.9em] text-mocha-light`,children:[(0,o.jsx)(`code`,{children:e.profile.id}),(0,o.jsx)(`span`,{children:`·`}),(0,o.jsxs)(`span`,{children:[`model: `,(0,o.jsx)(`code`,{children:e.profile.defaultModel})]})]})]}),(0,o.jsxs)(`p`,{className:`muted my-6`,children:[`These settings and files seed every agent spawned from this profile going forward.`,` `,(0,o.jsx)(`strong`,{children:`Existing agents keep their own copies`}),` — edits here don't propagate to already-spawned agents.`]}),(0,o.jsx)(c,{items:[{id:`basics`,label:`1. basics`},{id:`skills`,label:`2. skills`}],active:r,onChange:e=>s(e)}),r===`basics`&&(0,o.jsxs)(`div`,{children:[(0,o.jsx)(p,{profileId:e.profile.id,initialName:e.profile.name,currentModel:e.profile.defaultModel,modelGroups:t}),(0,o.jsx)(d,{profileId:e.profile.id,file:`SOUL.md`,initialContent:e.files.soul,rows:14}),(0,o.jsx)(d,{profileId:e.profile.id,file:`IDENTITY.md`,initialContent:e.files.identity,rows:10}),e.files.bootstrap===null?(0,o.jsxs)(`section`,{className:`file-card`,children:[(0,o.jsx)(`div`,{className:`file-head`,children:(0,o.jsx)(`h3`,{children:`BOOTSTRAP.md`})}),(0,o.jsx)(`p`,{className:`muted`,children:`This profile was created without a bootstrap prompt. Spawned agents won't see a first-run intro message.`})]}):(0,o.jsx)(d,{profileId:e.profile.id,file:`BOOTSTRAP.md`,initialContent:e.files.bootstrap,rows:10}),(0,o.jsx)(f,{profileId:e.profile.id,file:`AGENTS.md`,initialContent:e.files.agents,hint:`Peers and routing notes — who this agent can hand off to.`}),(0,o.jsx)(f,{profileId:e.profile.id,file:`TOOLS.md`,initialContent:e.files.tools,hint:`Tool playbook. Agent-specific usage notes that go beyond the generic tool descriptions.`}),(0,o.jsx)(f,{profileId:e.profile.id,file:`HEARTBEAT.md`,initialContent:e.files.heartbeat,hint:`Tasks the agent should check on scheduled wake-ups. Pair with a trigger whose message is the canned heartbeat prompt.`})]}),r===`skills`&&(0,o.jsx)(m,{profileId:e.profile.id,initialMode:e.profile.skillsMode,initialPicked:new Set(e.defaultSkills),skills:n})]})}function c({items:e,active:t,onChange:n}){return(0,o.jsx)(`nav`,{role:`tablist`,className:`-mb-px mb-5 flex gap-1 border-b border-frost`,children:e.map(e=>(0,o.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":t===e.id,onClick:()=>n(e.id),className:`unstyled cursor-pointer border-b-2 bg-transparent px-4 py-2 text-[0.9em] font-medium transition-colors ${t===e.id?`border-sapphire text-sapphire`:`border-transparent text-mocha hover:text-sapphire`}`,children:e.label},e.id))})}function l(e){return e===`saved`?`text-sapphire`:e===`error`?`text-[#9B3D3D]`:e===`dirty`?`text-mocha`:`text-mocha-light`}function u({title:e,status:t,children:n}){return(0,o.jsxs)(`section`,{className:`file-card mb-5 rounded-[16px] border border-frost bg-snow p-5 shadow-baziu-sm`,children:[(0,o.jsxs)(`div`,{className:`mb-2 flex items-baseline justify-between`,children:[(0,o.jsx)(`h3`,{className:`m-0 font-mono text-[0.95em] font-semibold normal-case tracking-normal text-chocolate`,children:e}),t&&(0,o.jsx)(`span`,{className:`text-[0.82em] ${l(t.kind)}`,children:t.message})]}),n]})}function d({profileId:e,file:t,initialContent:n,rows:r=10}){let[i,s]=(0,a.useState)(n),[c,l]=(0,a.useState)(n),[d,f]=(0,a.useState)({kind:`idle`,message:``}),p=c!==i&&d.kind!==`saving`&&d.kind!==`error`?{kind:`dirty`,message:`unsaved changes`}:d;async function m(){f({kind:`saving`,message:`saving…`});try{let n=await fetch(`/api/profiles/${encodeURIComponent(e)}/files/${encodeURIComponent(t)}`,{method:`PUT`,headers:{"content-type":`application/json`},body:JSON.stringify({content:c})});if(!n.ok&&n.status!==204){let e=await n.json().catch(()=>null);throw Error(e?.error??n.statusText)}s(c),f({kind:`saved`,message:`saved`})}catch(e){f({kind:`error`,message:`error: ${e.message}`})}}function h(){l(i),f({kind:`idle`,message:``})}return(0,o.jsxs)(u,{title:t,status:p,children:[(0,o.jsx)(`textarea`,{rows:r,value:c,onChange:e=>l(e.target.value),className:`font-mono text-[0.88em] leading-[1.55]`}),(0,o.jsxs)(`div`,{className:`mt-3 flex gap-2`,children:[(0,o.jsx)(`button`,{type:`button`,className:`btn-primary`,onClick:m,disabled:d.kind===`saving`,children:`save`}),(0,o.jsx)(`button`,{type:`button`,className:`ghost-btn`,onClick:h,children:`revert`})]})]})}function f({profileId:e,file:t,initialContent:n,hint:i}){let s=r(),[c,l]=(0,a.useState)(!1),[f,p]=(0,a.useState)({kind:`idle`,message:``});async function m(){l(!0),p({kind:`saving`,message:`creating…`});try{let n=await fetch(`/api/profiles/${encodeURIComponent(e)}/files/${encodeURIComponent(t)}`,{method:`PUT`,headers:{"content-type":`application/json`},body:JSON.stringify({content:``})});if(!n.ok&&n.status!==204){let e=await n.json().catch(()=>null);throw Error(e?.error??n.statusText)}await s.invalidate()}catch(e){p({kind:`error`,message:`error: ${e.message}`}),l(!1)}}return n===null?(0,o.jsxs)(u,{title:t,status:f,children:[(0,o.jsx)(`p`,{className:`muted my-1`,children:i}),(0,o.jsx)(`div`,{className:`mt-3 flex gap-2`,children:(0,o.jsx)(`button`,{type:`button`,className:`btn-primary`,onClick:m,disabled:c,children:c?`creating…`:`create empty`})})]}):(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(`p`,{className:`muted -mb-3 ml-1 mt-2 text-[0.85em]`,children:i}),(0,o.jsx)(d,{profileId:e,file:t,initialContent:n,rows:10})]})}function p({profileId:e,initialName:t,currentModel:n,modelGroups:i}){let s=r(),[c,l]=(0,a.useState)(t),[d,f]=(0,a.useState)(n),[p,m]=(0,a.useState)({kind:`idle`,message:``}),h=!i.flatMap(e=>e.models.map(t=>`${e.provider}:${t}`)).includes(n);async function g(t){t.preventDefault(),m({kind:`saving`,message:`saving…`});try{let t=await fetch(`/api/profiles/${encodeURIComponent(e)}`,{method:`PATCH`,headers:{"content-type":`application/json`},body:JSON.stringify({name:c.trim(),defaultModel:d.trim()})});if(!t.ok){let e=await t.json().catch(()=>null);throw Error(e?.error??t.statusText)}await s.invalidate(),m({kind:`saved`,message:`saved`})}catch(e){m({kind:`error`,message:`error: ${e.message}`})}}return(0,o.jsx)(u,{title:`settings`,status:p,children:(0,o.jsxs)(`form`,{onSubmit:g,children:[(0,o.jsxs)(`div`,{className:`flex gap-4`,children:[(0,o.jsxs)(`label`,{className:`flex-1`,children:[`name`,(0,o.jsx)(`input`,{value:c,onChange:e=>l(e.target.value)})]}),(0,o.jsxs)(`label`,{className:`flex-1`,children:[`default model`,i.length===0?(0,o.jsx)(`select`,{disabled:!0,children:(0,o.jsx)(`option`,{children:`(no models available — enable on /config)`})}):(0,o.jsxs)(`select`,{value:d,onChange:e=>f(e.target.value),children:[h&&(0,o.jsxs)(`option`,{value:n,children:[n,` (not in enabled list)`]}),i.map(e=>(0,o.jsx)(`optgroup`,{label:e.provider,children:e.models.map(t=>(0,o.jsx)(`option`,{value:`${e.provider}:${t}`,children:`${e.provider}:${t}`},t))},e.provider))]})]})]}),(0,o.jsx)(`div`,{className:`mt-3 flex gap-2`,children:(0,o.jsx)(`button`,{type:`submit`,disabled:p.kind===`saving`,children:`save settings`})})]})})}function m({profileId:e,initialMode:t,initialPicked:n,skills:i}){let s=r(),[c,l]=(0,a.useState)(t),[d,f]=(0,a.useState)(n),[p,m]=(0,a.useState)({kind:`idle`,message:``});function h(e){f(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}async function g(t){t.preventDefault(),m({kind:`saving`,message:`saving…`});try{let t=await fetch(`/api/profiles/${encodeURIComponent(e)}`,{method:`PATCH`,headers:{"content-type":`application/json`},body:JSON.stringify({skillsMode:c,defaultSkills:c===`selected`?Array.from(d):[]})});if(!t.ok){let e=await t.json().catch(()=>null);throw Error(e?.error??t.statusText)}await s.invalidate(),m({kind:`saved`,message:`saved`})}catch(e){m({kind:`error`,message:`error: ${e.message}`})}}return(0,o.jsxs)(u,{title:`skills`,status:p,children:[(0,o.jsx)(`p`,{className:`muted my-2`,children:`Choose what agents spawned from this profile inherit. Existing agents aren't affected — they keep whatever skills they were spawned with.`}),(0,o.jsxs)(`form`,{onSubmit:g,children:[(0,o.jsxs)(`label`,{className:`my-2 flex cursor-pointer items-start gap-2`,children:[(0,o.jsx)(`input`,{type:`radio`,checked:c===`all`,onChange:()=>l(`all`)}),(0,o.jsxs)(`span`,{children:[(0,o.jsx)(`strong`,{children:`allow all skills`}),` — every skill on disk is attached at spawn.`]})]}),(0,o.jsxs)(`label`,{className:`my-2 flex cursor-pointer items-start gap-2`,children:[(0,o.jsx)(`input`,{type:`radio`,checked:c===`selected`,onChange:()=>l(`selected`)}),(0,o.jsxs)(`span`,{children:[(0,o.jsx)(`strong`,{children:`select skills`}),` — attach only the ones ticked below.`]})]}),(0,o.jsx)(`div`,{className:`mt-3 max-h-[22rem] overflow-y-auto rounded-md border border-frost p-3 ${c===`all`?`pointer-events-none opacity-50`:``}`,children:i.length===0?(0,o.jsxs)(`p`,{className:`muted`,children:[`No skills installed yet. Import some on `,(0,o.jsx)(`a`,{href:`/skills`,children:`/skills`}),`.`]}):i.map(e=>(0,o.jsxs)(`label`,{className:`my-1.5 flex cursor-pointer items-start gap-2`,children:[(0,o.jsx)(`input`,{type:`checkbox`,checked:d.has(e.name),onChange:()=>h(e.name)}),(0,o.jsxs)(`span`,{children:[(0,o.jsx)(`code`,{children:e.name}),e.description&&(0,o.jsxs)(`span`,{className:`text-[0.9em] text-mocha-light`,children:[` — `,e.description]})]})]},e.name))}),(0,o.jsx)(`div`,{className:`mt-3 flex gap-2`,children:(0,o.jsx)(`button`,{type:`submit`,disabled:p.kind===`saving`,children:`save skills`})})]})]})}export{s as component};
@@ -1 +0,0 @@
1
- import{D as e,E as t,O as n,T as r,a as i}from"./index-BQUL6oyH.js";import{t as a}from"./AgentTabs-M5K8emJ8.js";import{t as o}from"./AgentAvatar-Cq7PVBE_.js";import{t as s}from"./ChatPane-C8zQfpzH.js";import{r as c}from"./wire-constants-BkT5-597.js";var l=n(e(),1),u=t();function d({value:e,className:t,ariaLabel:n=`Copy to clipboard`,title:r=`Copy to clipboard`}){let[i,a]=(0,l.useState)(!1);async function o(){if(!e)return;let t=!1;try{navigator.clipboard?.writeText&&(await navigator.clipboard.writeText(e),t=!0)}catch{}if(!t){let n=document.createElement(`textarea`);n.value=e,n.setAttribute(`readonly`,``),n.style.position=`fixed`,n.style.opacity=`0`,document.body.appendChild(n),n.select();try{t=document.execCommand(`copy`)}catch{}n.remove()}t&&(a(!0),setTimeout(()=>a(!1),1e3))}return(0,u.jsx)(`button`,{type:`button`,onClick:o,title:r,"aria-label":n,className:`inline-flex h-[1.3rem] w-[1.6rem] items-center justify-center rounded-sm border border-transparent text-mocha-light transition-colors hover:border-frost hover:bg-snow hover:text-mocha ${i?`border-[#bcd9bc] bg-[#eef7ee] text-[#3b7a3b] hover:border-[#bcd9bc] hover:bg-[#eef7ee] hover:text-[#3b7a3b]`:``} ${t??``}`,children:i?`✓`:`⧉`})}function f(){let{resolved:e,initialMessages:t,sessionHead:n,groups:c,skills:l,modelGroups:f,telegramConfigured:y}=i.useLoaderData(),b=r();async function x(){confirm(`archive "${e.agent.name}"? (reversible)`)&&(await fetch(`/api/agents/${e.agent.id}/archive`,{method:`POST`}),await b.invalidate())}async function S(){await fetch(`/api/agents/${e.agent.id}/unarchive`,{method:`POST`}),await b.invalidate()}async function C(){let t=`Permanently delete agent "${e.agent.name}"?\n\nThis removes the DB rows (messages, triggers, skill attachments) AND the agent's on-disk directory (memory, templates, state, sessions). This cannot be undone.`;if(!confirm(t))return;let n=await fetch(`/api/agents/${e.agent.id}`,{method:`DELETE`});n.ok||n.status===204?window.location.assign(`/agents`):alert(`failed: ${n.statusText}`)}return(0,u.jsxs)(`div`,{children:[(0,u.jsxs)(`header`,{className:`mb-8`,children:[(0,u.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,u.jsx)(o,{identity:e.agent.identity,size:44}),(0,u.jsxs)(`div`,{children:[(0,u.jsx)(`h1`,{className:`mb-0`,children:e.agent.name}),(e.agent.identity?.creature||e.agent.identity?.vibe)&&(0,u.jsx)(`p`,{className:`muted mt-0.5 text-sm`,children:[e.agent.identity?.creature,e.agent.identity?.vibe].filter(Boolean).join(` · `)})]})]}),(0,u.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-x-5 gap-y-2`,children:[(0,u.jsxs)(m,{children:[(0,u.jsx)(`span`,{className:`px-1.5 font-mono text-[0.95em] text-mocha select-all`,children:e.agent.id}),(0,u.jsx)(d,{value:e.agent.id,ariaLabel:`Copy agent UUID`,title:`Copy UUID to clipboard`})]}),(0,u.jsxs)(m,{children:[`status: `,(0,u.jsx)(`span`,{className:`ml-1`,children:e.agent.status})]}),(0,u.jsxs)(m,{children:[`profile: `,(0,u.jsx)(`code`,{className:`ml-1 bg-transparent px-0`,children:e.profile.id})]}),(0,u.jsxs)(m,{children:[`group:`,` `,(0,u.jsx)(`a`,{href:`/groups/${encodeURIComponent(e.group.id)}`,className:`ml-1 bg-transparent px-0 font-mono underline`,children:e.group.id}),` `,`·`,` `,(0,u.jsx)(`a`,{href:`/groups/${encodeURIComponent(e.group.id)}/memory`,className:`ml-0.5 underline`,children:`shared memory →`})]}),(0,u.jsxs)(m,{children:[`model: `,(0,u.jsx)(`code`,{className:`ml-1 bg-transparent px-0`,children:e.model})]}),(0,u.jsxs)(m,{children:[`reasoning:`,` `,(0,u.jsx)(`code`,{className:`ml-1 bg-transparent px-0`,children:e.reasoningLevel})]})]}),(0,u.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:[e.agent.status===`archived`?(0,u.jsx)(`button`,{type:`button`,onClick:S,className:`ghost-btn`,children:`unarchive`}):(0,u.jsx)(`button`,{type:`button`,onClick:x,className:`ghost-btn`,children:`archive`}),(0,u.jsx)(`button`,{type:`button`,onClick:C,className:`ghost-btn border-[rgba(196,135,138,0.4)] text-[#9B3D3D] hover:bg-[rgba(196,135,138,0.08)]`,children:`delete permanently`})]}),(0,u.jsx)(h,{agentId:e.agent.id,currentModelOverride:e.agent.modelOverride??null,profileDefaultModel:e.profile.defaultModel,currentReasoning:e.reasoningLevel,modelGroups:f})]}),e.agent.status===`archived`&&(0,u.jsxs)(`div`,{className:`mb-4 rounded-md border border-frost bg-fawn/35 px-4 py-2 text-[0.9em] text-chocolate`,children:[(0,u.jsx)(`strong`,{className:`text-[#7a4e2a]`,children:`This agent is archived.`}),` It's hidden from the default agent list; use `,(0,u.jsx)(`em`,{children:`unarchive`}),` above to bring it back, or`,` `,(0,u.jsx)(`em`,{children:`delete permanently`}),` to remove its data entirely.`]}),(0,u.jsx)(a,{agentId:e.agent.id,active:`chat`,archived:e.agent.status===`archived`}),(0,u.jsx)(p,{children:`Chat`}),(0,u.jsx)(`div`,{className:`h-[70vh]`,children:(0,u.jsx)(s,{agentId:e.agent.id,agentName:e.agent.name,initialMessages:t,initialSessionHead:n})}),(0,u.jsx)(`p`,{className:`mt-2 text-[0.82em] text-mocha-light`,children:`chat history persists in bazilion across navigation and restarts.`}),(0,u.jsxs)(`section`,{className:`mt-10`,children:[(0,u.jsx)(p,{children:`Group`}),(0,u.jsxs)(`p`,{className:`text-[0.9em] text-mocha-light`,children:[`Current group: `,(0,u.jsx)(`code`,{children:e.group.id}),` (`,e.group.name,`) —`,` `,(0,u.jsx)(`code`,{children:e.group.path}),`.`,` `,(0,u.jsx)(`a`,{href:`/groups/${e.group.id}`,children:`view / edit USER.md`})]}),(0,u.jsx)(g,{agentId:e.agent.id,currentGroupId:e.group.id,groups:c})]}),(0,u.jsxs)(`section`,{className:`mt-10`,children:[(0,u.jsx)(p,{children:`Skills`}),(0,u.jsx)(_,{agentId:e.agent.id,attached:new Set(e.skills),all:l})]}),y&&(0,u.jsxs)(`section`,{className:`mt-10`,children:[(0,u.jsx)(p,{children:`Telegram`}),(0,u.jsx)(v,{agent:e.agent})]})]})}function p({children:e}){return(0,u.jsx)(`h3`,{className:`mb-3 font-body text-[0.85em] font-semibold uppercase tracking-wider text-mocha-light`,children:e})}function m({children:e}){return(0,u.jsx)(`span`,{className:`inline-flex items-center gap-1 rounded-full border border-frost bg-ivory px-3 py-0.5 text-[0.84em] text-mocha-light`,children:e})}function h({agentId:e,currentModelOverride:t,profileDefaultModel:n,currentReasoning:i,modelGroups:a}){let o=r(),[s,d]=(0,l.useState)(t??``),[f,p]=(0,l.useState)(i),[m,h]=(0,l.useState)(!1),[g,_]=(0,l.useState)(!1),[v,y]=(0,l.useState)(null),b=t!==null&&a.some(e=>e.models.some(n=>`${e.provider}:${n}`===t));async function x(t){t.preventDefault(),h(!0),y(null);try{let t=await fetch(`/api/agents/${encodeURIComponent(e)}`,{method:`PATCH`,headers:{"content-type":`application/json`},body:JSON.stringify({modelOverride:s===``?null:s,reasoningLevel:f})});if(!t.ok){let e=await t.json().catch(()=>null);throw Error(e?.error??t.statusText)}_(!0),setTimeout(()=>_(!1),1500),await o.invalidate()}catch(e){y(e.message)}finally{h(!1)}}return(0,u.jsxs)(`details`,{className:`mt-3 text-[0.9em]`,children:[(0,u.jsx)(`summary`,{className:`cursor-pointer text-mocha-light`,children:`settings`}),(0,u.jsxs)(`form`,{onSubmit:x,className:`mt-2 flex flex-wrap items-end gap-3 border-t border-dashed border-frost py-3`,children:[(0,u.jsxs)(`label`,{className:`flex flex-col gap-1 text-[0.85em] text-mocha-light`,children:[`model override`,(0,u.jsxs)(`select`,{name:`modelOverride`,value:s,onChange:e=>d(e.target.value),className:`min-w-[16rem] rounded-sm border border-frost bg-snow px-2 py-1.5`,children:[(0,u.jsxs)(`option`,{value:``,children:[`inherit from profile (`,n,`)`]}),t!==null&&!b&&(0,u.jsxs)(`option`,{value:t,children:[t,` (not in curated list)`]}),a.map(e=>(0,u.jsx)(`optgroup`,{label:e.provider,children:e.models.map(t=>{let n=`${e.provider}:${t}`;return(0,u.jsx)(`option`,{value:n,children:n},n)})},e.provider))]})]}),(0,u.jsxs)(`label`,{className:`flex flex-col gap-1 text-[0.85em] text-mocha-light`,children:[`reasoning level`,(0,u.jsx)(`select`,{name:`reasoningLevel`,value:f,onChange:e=>p(e.target.value),className:`min-w-[16rem] rounded-sm border border-frost bg-snow px-2 py-1.5`,children:c.map(e=>(0,u.jsx)(`option`,{value:e,children:e},e))})]}),(0,u.jsx)(`button`,{type:`submit`,disabled:m,children:m?`saving…`:`save`}),g&&(0,u.jsx)(`span`,{className:`text-[0.85em] text-[#3b7a3b]`,children:`saved ✓`}),v&&(0,u.jsx)(`span`,{className:`text-[0.85em] text-[#9B3D3D]`,children:v})]})]})}function g({agentId:e,currentGroupId:t,groups:n}){let i=r(),[a,o]=(0,l.useState)(t),[s,c]=(0,l.useState)(!1),[d,f]=(0,l.useState)(null);async function p(n){if(n.preventDefault(),a!==t){c(!0),f(null);try{let t=await fetch(`/api/agents/${encodeURIComponent(e)}/group`,{method:`PATCH`,headers:{"content-type":`application/json`},body:JSON.stringify({groupId:a})});if(!t.ok){let e=await t.json().catch(()=>null);throw Error(e?.error??t.statusText)}await i.invalidate()}catch(e){f(e.message)}finally{c(!1)}}}return(0,u.jsxs)(`form`,{onSubmit:p,className:`mt-2 flex flex-wrap items-end gap-2`,children:[(0,u.jsxs)(`label`,{className:`flex flex-col gap-1 text-[0.85em] text-mocha-light`,children:[`move to:`,(0,u.jsx)(`select`,{value:a,onChange:e=>o(e.target.value),className:`min-w-[18rem] rounded-sm border border-frost bg-snow px-2 py-1.5`,children:n.map(e=>(0,u.jsxs)(`option`,{value:e.id,children:[e.id,` — `,e.path]},e.id))})]}),(0,u.jsx)(`button`,{type:`submit`,disabled:s||a===t,children:s?`moving…`:`move`}),d&&(0,u.jsx)(`span`,{className:`text-[0.85em] text-[#9B3D3D]`,children:d})]})}function _({agentId:e,attached:t,all:n}){let i=r(),[a,o]=(0,l.useState)(null),[s,c]=(0,l.useState)(null);async function d(t){o(t),c(null);try{let n=await fetch(`/api/agents/${encodeURIComponent(e)}/skills`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({skill:t})});if(!n.ok){let e=await n.json().catch(()=>null);throw Error(e?.error??n.statusText)}await i.invalidate()}catch(e){c(e.message)}finally{o(null)}}async function f(t){o(t),c(null);try{let n=await fetch(`/api/agents/${encodeURIComponent(e)}/skills/${encodeURIComponent(t)}`,{method:`DELETE`});if(!n.ok&&n.status!==204){let e=await n.json().catch(()=>null);throw Error(e?.error??n.statusText)}await i.invalidate()}catch(e){c(e.message)}finally{o(null)}}return n.length===0?(0,u.jsx)(`p`,{className:`text-[0.9em] text-mocha-light`,children:`no skills installed`}):(0,u.jsxs)(u.Fragment,{children:[s&&(0,u.jsx)(`p`,{className:`mb-2 text-[0.85em] text-[#9B3D3D]`,children:s}),(0,u.jsxs)(`table`,{children:[(0,u.jsx)(`thead`,{children:(0,u.jsxs)(`tr`,{children:[(0,u.jsx)(`th`,{children:`name`}),(0,u.jsx)(`th`,{children:`description`}),(0,u.jsx)(`th`,{})]})}),(0,u.jsx)(`tbody`,{children:n.map(e=>{let n=t.has(e.name),r=a===e.name;return(0,u.jsxs)(`tr`,{children:[(0,u.jsx)(`td`,{children:(0,u.jsx)(`code`,{children:e.name})}),(0,u.jsx)(`td`,{children:e.description||(0,u.jsx)(`span`,{className:`text-mocha-light`,children:`—`})}),(0,u.jsx)(`td`,{children:n?(0,u.jsx)(`button`,{type:`button`,className:`ghost-btn`,disabled:r,onClick:()=>f(e.name),children:r?`…`:`detach`}):(0,u.jsx)(`button`,{type:`button`,className:`ghost-btn`,disabled:r,onClick:()=>d(e.name),children:r?`…`:`attach`})})]},e.name)})})]})]})}function v({agent:e}){let t=r(),[n,i]=(0,l.useState)(!1),[a,o]=(0,l.useState)(null),[s,c]=(0,l.useState)(e.telegramMirrorMode),[d,f]=(0,l.useState)(e.telegramIconEmoji??``),p=e.telegramTopicId!==null;async function m(){i(!0),o(null);try{let n=await fetch(`/api/agents/${encodeURIComponent(e.id)}/telegram/bind`,{method:`POST`});if(!n.ok){let e=await n.json().catch(()=>null);throw Error(e?.error??n.statusText)}let r=await n.json();window.open(r.deepLink,`_blank`,`noopener`),await t.invalidate()}catch(e){o(e.message)}finally{i(!1)}}async function h(){if(confirm(`Unbind this agent from its Telegram topic? The topic stays in Telegram as an orphan.`)){i(!0),o(null);try{let n=await fetch(`/api/agents/${encodeURIComponent(e.id)}/telegram/binding`,{method:`DELETE`});if(!n.ok)throw Error(n.statusText);await t.invalidate()}catch(e){o(e.message)}finally{i(!1)}}}async function g(n){c(n);try{let r=await fetch(`/api/agents/${encodeURIComponent(e.id)}`,{method:`PATCH`,headers:{"content-type":`application/json`},body:JSON.stringify({telegramMirrorMode:n})});if(!r.ok)throw Error(r.statusText);await t.invalidate()}catch(t){c(e.telegramMirrorMode),o(t.message)}}async function _(){o(null);try{let n=await fetch(`/api/agents/${encodeURIComponent(e.id)}`,{method:`PATCH`,headers:{"content-type":`application/json`},body:JSON.stringify({telegramIconEmoji:d.trim()||null})});if(!n.ok)throw Error(n.statusText);await t.invalidate()}catch(e){o(e.message)}}return(0,u.jsxs)(`div`,{className:`text-[0.9em]`,children:[(0,u.jsx)(`div`,{className:`mb-3 flex items-center gap-3`,children:p?(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(`span`,{className:`rounded-full bg-emerald-100 px-2 py-0.5 text-xs font-semibold text-emerald-800`,children:`bound`}),(0,u.jsxs)(`span`,{className:`font-mono text-mocha`,children:[`topic #`,e.telegramTopicId]}),(0,u.jsx)(`button`,{type:`button`,onClick:m,disabled:n,className:`ghost-btn`,title:`Open the topic in Telegram (works on desktop/Android; iOS shows the topic list)`,children:`open in Telegram`}),(0,u.jsx)(`button`,{type:`button`,onClick:h,disabled:n,className:`ghost-btn border-[rgba(196,135,138,0.4)] text-[#9B3D3D] hover:bg-[rgba(196,135,138,0.08)]`,children:`unbind`})]}):(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(`span`,{className:`rounded-full bg-amber-100 px-2 py-0.5 text-xs font-semibold text-amber-800`,children:`unbound`}),(0,u.jsx)(`button`,{type:`button`,onClick:m,disabled:n,className:`ghost-btn`,title:`Create a Telegram topic for this agent`,children:n?`binding…`:`bind a topic`})]})}),(0,u.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,u.jsx)(`label`,{htmlFor:`mirror-mode`,className:`text-mocha-light`,children:`mirror mode:`}),(0,u.jsxs)(`select`,{id:`mirror-mode`,value:s,onChange:e=>void g(e.target.value),className:`rounded-md border bg-background px-2 py-1 font-mono text-sm`,disabled:n,children:[(0,u.jsx)(`option`,{value:`minimal`,children:`minimal — assistant messages only`}),(0,u.jsx)(`option`,{value:`verbose`,children:`verbose — also tool calls`})]})]}),(0,u.jsxs)(`div`,{className:`mt-2 flex items-center gap-2`,children:[(0,u.jsx)(`label`,{htmlFor:`topic-icon`,className:`text-mocha-light`,children:`topic icon:`}),(0,u.jsx)(`input`,{id:`topic-icon`,value:d,onChange:e=>f(e.target.value),placeholder:`(profile default)`,maxLength:8,className:`w-32 rounded-md border bg-background px-2 py-1 font-mono text-sm`,disabled:n}),(0,u.jsx)(`button`,{type:`button`,onClick:()=>void _(),disabled:n||d===(e.telegramIconEmoji??``),className:`ghost-btn`,children:`save icon`})]}),a&&(0,u.jsx)(`p`,{className:`mt-2 text-sm text-rose-700`,children:a}),(0,u.jsx)(`p`,{className:`mt-3 text-[0.85em] text-mocha-light`,children:`When bound, every assistant turn for this agent gets mirrored to the topic. Typing in the topic triggers a new turn. iOS Telegram clients have a known limitation that prevents inline link deep-links from opening directly into a topic — bound state is still functional; navigate via the topic list manually.`})]})}export{f as component};
@@ -1 +0,0 @@
1
- import{D as e,E as t,O as n,T as r,o as i}from"./index-BQUL6oyH.js";import{t as a}from"./Button-BefUtjMZ.js";var o=n(e()),s=t();function c(){let{group:e,members:t,profileGroups:n}=i.useLoaderData(),c=r(),[d,f]=(0,o.useState)(e.userMd),[p,m]=(0,o.useState)(!1),[h,g]=(0,o.useState)(null),[_,v]=(0,o.useState)(null);async function y(){m(!0),g(null);try{let t=await fetch(`/api/groups/${encodeURIComponent(e.id)}/user-md`,{method:`PUT`,headers:{"content-type":`application/json`},body:JSON.stringify({userMd:d})});if(!t.ok){let e=await t.json().catch(()=>({}));throw Error(e.error??`${t.status} ${t.statusText}`)}v(Date.now()),await c.invalidate()}catch(e){g(e.message)}finally{m(!1)}}return(0,s.jsxs)(`main`,{className:`mx-auto max-w-3xl px-6 py-8`,children:[(0,s.jsxs)(`h1`,{className:`font-serif text-3xl text-foreground`,children:[e.name,` `,(0,s.jsxs)(`span`,{className:`text-muted-foreground text-base`,children:[`(`,e.id,`)`]})]}),(0,s.jsxs)(`p`,{className:`text-muted-foreground text-sm mb-6 mt-1`,children:[(0,s.jsx)(`code`,{className:`font-mono`,children:e.path}),` · `,t.length,` `,`member`,t.length===1?``:`s`,` ·`,` `,(0,s.jsx)(`a`,{href:`/groups/${encodeURIComponent(e.id)}/memory`,className:`text-primary underline`,children:`shared memory →`})]}),(0,s.jsxs)(`section`,{className:`rounded-lg border bg-card p-5 mb-6`,children:[(0,s.jsx)(`h3`,{className:`font-serif text-xl mb-1`,children:`USER.md`}),(0,s.jsx)(`p`,{className:`text-muted-foreground text-sm mb-3`,children:`Read-only context about the human, injected into every member agent's system prompt. 12 KB cap. Agents cannot edit this file — only you can.`}),(0,s.jsx)(`textarea`,{value:d,onChange:e=>f(e.target.value),rows:16,className:`w-full rounded-md border bg-background px-3 py-2 font-mono text-sm outline-none focus:ring-2 focus:ring-ring/30`,placeholder:`What the agent should know about you in this group context…`}),(0,s.jsxs)(`div`,{className:`flex items-center gap-3 mt-3`,children:[(0,s.jsx)(a,{variant:`primary`,onClick:y,disabled:p||d===e.userMd,children:p?`saving…`:`save`}),(0,s.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[d.length,` / 12000 chars`]}),_&&(0,s.jsx)(`span`,{className:`text-xs text-emerald-700`,children:`✓ saved`}),h&&(0,s.jsx)(`span`,{className:`text-xs text-rose-700`,children:h})]})]}),(0,s.jsx)(l,{group:e,sampleAgent:t[0]?.name??`researcher`,onSaved:()=>c.invalidate()}),t.length===0&&(0,s.jsx)(u,{groupId:e.id,profileGroups:n,onSpawned:()=>c.invalidate()}),(0,s.jsxs)(`section`,{className:`rounded-lg border bg-card p-5`,children:[(0,s.jsx)(`h3`,{className:`font-serif text-xl mb-3`,children:`members`}),t.length===0?(0,s.jsx)(`p`,{className:`text-muted-foreground text-sm`,children:`No agents in this group yet.`}):(0,s.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,s.jsx)(`thead`,{className:`text-left text-muted-foreground border-b`,children:(0,s.jsxs)(`tr`,{children:[(0,s.jsx)(`th`,{className:`py-2`,children:`name`}),(0,s.jsx)(`th`,{children:`status`}),(0,s.jsx)(`th`,{children:`profile`}),(0,s.jsx)(`th`,{})]})}),(0,s.jsx)(`tbody`,{children:t.map(e=>(0,s.jsxs)(`tr`,{className:`border-b last:border-0`,children:[(0,s.jsx)(`td`,{className:`py-2`,children:(0,s.jsx)(`a`,{href:`/agents/${e.id}`,className:`text-primary underline`,children:e.name})}),(0,s.jsx)(`td`,{children:e.status}),(0,s.jsx)(`td`,{children:(0,s.jsx)(`code`,{className:`font-mono text-xs`,children:e.profileId})}),(0,s.jsx)(`td`,{children:(0,s.jsxs)(`code`,{className:`font-mono text-xs text-muted-foreground`,children:[e.id.slice(0,8),`…`]})})]},e.id))})]})]})]})}function l({group:e,sampleAgent:t,onSaved:n}){let[r,i]=(0,o.useState)(e.telegramTopicNameFormat??``),[c,l]=(0,o.useState)(!1),[u,d]=(0,o.useState)(null),[f,p]=(0,o.useState)(null),m=r.trim(),h=m?m.replaceAll(`{agent.name}`,t).replaceAll(`{group.name}`,e.name).replaceAll(`{group.slug}`,e.id):e.id===`default`?t:`${e.id} › ${t}`,g=(e.telegramTopicNameFormat??``)!==r;async function _(t){l(!0),d(null);try{let a=await fetch(`/api/groups/${encodeURIComponent(e.id)}/topic-format`,{method:`PUT`,headers:{"content-type":`application/json`},body:JSON.stringify({format:t?null:r})});if(!a.ok){let e=await a.json().catch(()=>({}));throw Error(e.error??`${a.status} ${a.statusText}`)}t&&i(``),p(Date.now()),n()}catch(e){d(e.message)}finally{l(!1)}}return(0,s.jsxs)(`section`,{className:`rounded-lg border bg-card p-5 mb-6`,children:[(0,s.jsx)(`h3`,{className:`font-serif text-xl mb-1`,children:`Telegram topic names`}),(0,s.jsxs)(`p`,{className:`text-muted-foreground text-sm mb-3`,children:[`Template for this group's Telegram forum-topic titles. Leave empty for built-in naming. Tokens: `,(0,s.jsx)(`code`,{className:`font-mono`,children:`{agent.name}`}),` `,(0,s.jsx)(`code`,{className:`font-mono`,children:`{group.name}`}),` `,(0,s.jsx)(`code`,{className:`font-mono`,children:`{group.slug}`}),` — must include`,` `,(0,s.jsx)(`code`,{className:`font-mono`,children:`{agent.name}`}),`. Saving renames existing topics that you haven't manually renamed in Telegram.`]}),(0,s.jsx)(`input`,{value:r,onChange:e=>i(e.target.value),placeholder:`{group.name} / {agent.name}`,className:`w-full rounded-md border bg-background px-3 py-2 font-mono text-sm outline-none focus:ring-2 focus:ring-ring/30`}),(0,s.jsxs)(`p`,{className:`text-xs text-muted-foreground mt-2`,children:[`preview: `,(0,s.jsx)(`span`,{className:`font-mono text-foreground`,children:h})]}),(0,s.jsxs)(`div`,{className:`flex items-center gap-3 mt-3`,children:[(0,s.jsx)(a,{variant:`primary`,onClick:()=>_(!1),disabled:c||!g||m.length===0,children:c?`saving…`:`save`}),e.telegramTopicNameFormat&&(0,s.jsx)(a,{variant:`ghost`,onClick:()=>_(!0),disabled:c,children:`clear`}),f&&(0,s.jsx)(`span`,{className:`text-xs text-emerald-700`,children:`✓ saved`}),u&&(0,s.jsx)(`span`,{className:`text-xs text-rose-700`,children:u})]})]})}function u({groupId:e,profileGroups:t,onSpawned:n}){let r=t.filter(e=>e.memberCount>0),[i,c]=(0,o.useState)(r[0]?.id??``),[l,u]=(0,o.useState)(!1),[d,f]=(0,o.useState)(null);async function p(){if(i){u(!0),f(null);try{let t=await fetch(`/api/profile-groups/${encodeURIComponent(i)}/spawn`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({groupSlug:e})});if(!t.ok){let e=await t.json().catch(()=>({}));throw Error(e.error??`${t.status} ${t.statusText}`)}let r=await t.json();r.orphanAgentIds&&r.orphanAgentIds.length>0&&alert(`Spawn completed with warnings: ${r.orphanAgentIds.length} orphan agent dir(s) left on disk.`),n()}catch(e){f(e.message)}finally{u(!1)}}}return(0,s.jsxs)(`section`,{className:`rounded-lg border bg-card p-5 mb-6`,children:[(0,s.jsx)(`h3`,{className:`font-serif text-xl mb-1`,children:`spawn a team into this group`}),(0,s.jsx)(`p`,{className:`text-muted-foreground text-sm mb-3`,children:`This group is empty. Pick a profile group template to spawn its entire roster into it in one transactional call.`}),r.length===0?(0,s.jsxs)(`p`,{className:`text-muted-foreground text-sm`,children:[`No profile groups with members yet. Build one on`,` `,(0,s.jsx)(`a`,{href:`/profile-groups`,className:`text-primary underline`,children:`/profile-groups`}),` `,`first.`]}):(0,s.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,s.jsx)(`select`,{value:i,onChange:e=>c(e.target.value),className:`rounded-md border bg-background px-3 py-2 text-sm outline-none focus:ring-2 focus:ring-ring/30`,children:r.map(e=>(0,s.jsxs)(`option`,{value:e.id,children:[e.name,` (`,e.memberCount,` member`,e.memberCount===1?``:`s`,`)`]},e.id))}),(0,s.jsx)(a,{variant:`primary`,onClick:p,disabled:l||!i,children:l?`spawning…`:`spawn team`}),d&&(0,s.jsx)(`span`,{className:`text-xs text-rose-700`,children:d})]})]})}export{c as component};
@@ -1 +0,0 @@
1
- import{D as e,E as t,O as n,T as r,u as i}from"./index-BQUL6oyH.js";import{t as a}from"./Button-BefUtjMZ.js";import{t as o}from"./MembersEditor-B-47GLUb.js";var s=n(e()),c=t();function l(e){return{profileId:e.profileId,agentName:e.agentName,modelOverride:e.modelOverride,reasoningLevel:e.reasoningLevel}}function u(){let{detail:e,profiles:t,modelGroups:n}=i.useLoaderData(),a=r(),{group:o}=e;return(0,c.jsxs)(`div`,{children:[(0,c.jsx)(`h1`,{children:o.name}),(0,c.jsxs)(`p`,{className:`muted`,children:[(0,c.jsx)(`code`,{children:o.id}),` · `,e.members.length,` member`,e.members.length===1?``:`s`]}),(0,c.jsx)(d,{group:o,onSaved:()=>a.invalidate()}),(0,c.jsx)(f,{groupId:o.id,initialMembers:e.members.map(l),profiles:t,modelGroups:n,onSaved:()=>a.invalidate()})]})}function d({group:e,onSaved:t}){let[n,r]=(0,s.useState)(e.name),[i,o]=(0,s.useState)(e.userMd??``),[l,u]=(0,s.useState)(null),[d,f]=(0,s.useState)(!1);async function p(){u(null),f(!0);try{let r={name:n};r.userMd=i===``?null:i;let a=await fetch(`/api/profile-groups/${e.id}`,{method:`PATCH`,headers:{"content-type":`application/json`},body:JSON.stringify(r)});if(!a.ok){let e=await a.json().catch(()=>null);throw Error(e?.error??a.statusText)}t()}catch(e){u(e.message)}finally{f(!1)}}return(0,c.jsxs)(`div`,{className:`card`,children:[(0,c.jsx)(`h3`,{children:`basics`}),l&&(0,c.jsx)(`div`,{className:`err`,children:l}),(0,c.jsxs)(`label`,{children:[`name`,(0,c.jsx)(`input`,{value:n,onChange:e=>r(e.target.value)})]}),(0,c.jsxs)(`label`,{children:[`starter USER.md (seeded only into freshly-created target groups)`,(0,c.jsx)(`textarea`,{rows:6,value:i,onChange:e=>o(e.target.value),className:`font-mono text-[0.88em] leading-[1.55]`})]}),(0,c.jsx)(a,{variant:`primary`,onClick:p,disabled:d,children:d?`saving…`:`save basics`})]})}function f({groupId:e,initialMembers:t,profiles:n,modelGroups:r,onSaved:i}){let[l,u]=(0,s.useState)(t),[d,f]=(0,s.useState)(null),[p,m]=(0,s.useState)(!1),h=JSON.stringify(l)!==JSON.stringify(t);async function g(){f(null),m(!0);try{let t=await fetch(`/api/profile-groups/${e}/members`,{method:`PUT`,headers:{"content-type":`application/json`},body:JSON.stringify({members:l})});if(!t.ok){let e=await t.json().catch(()=>null);throw Error(e?.error??t.statusText)}i()}catch(e){f(e.message)}finally{m(!1)}}return(0,c.jsxs)(`div`,{className:`card`,children:[(0,c.jsx)(`h3`,{children:`members`}),d&&(0,c.jsx)(`div`,{className:`err`,children:d}),(0,c.jsxs)(`p`,{className:`muted`,children:[`Each member becomes one agent at spawn time. Duplicate agent-names within a template are fine — the spawn op auto-suffixes collisions with `,(0,c.jsx)(`code`,{children:`-2`}),`, `,(0,c.jsx)(`code`,{children:`-3`}),`, …`]}),(0,c.jsx)(o,{members:l,onChange:u,profiles:n,modelGroups:r}),(0,c.jsx)(`div`,{className:`mt-3`,children:(0,c.jsx)(a,{variant:`primary`,onClick:g,disabled:p||!h,children:p?`saving…`:`save members`})})]})}export{u as component};
@@ -1 +0,0 @@
1
- import{D as e,E as t,O as n,T as r,f as i}from"./index-BQUL6oyH.js";import{t as a}from"./AgentAvatar-Cq7PVBE_.js";var o=n(e()),s=t();function c(){let{agents:e,profiles:t,groups:n,modelGroups:o}=i.useLoaderData(),{all:c}=i.useSearch(),u=c===`1`,d=r();async function f(e){confirm(`archive this agent? (reversible)`)&&(await fetch(`/api/agents/${e}/archive`,{method:`POST`}),await d.invalidate())}async function p(e){await fetch(`/api/agents/${e}/unarchive`,{method:`POST`}),await d.invalidate()}async function m(e){confirm(`permanently delete this agent and all its data?`)&&(await fetch(`/api/agents/${e}`,{method:`DELETE`}),await d.invalidate())}return(0,s.jsxs)(`div`,{children:[(0,s.jsx)(`h1`,{children:`agents`}),(0,s.jsx)(l,{profiles:t,groups:n,modelGroups:o,onSpawned:d.invalidate}),(0,s.jsx)(`p`,{children:(0,s.jsx)(`a`,{href:u?`/agents`:`/agents?all=1`,children:u?`hide archived`:`show archived`})}),(0,s.jsxs)(`table`,{children:[(0,s.jsx)(`thead`,{children:(0,s.jsxs)(`tr`,{children:[(0,s.jsx)(`th`,{children:`id`}),(0,s.jsx)(`th`,{children:`name`}),(0,s.jsx)(`th`,{children:`profile`}),(0,s.jsx)(`th`,{children:`status`}),(0,s.jsx)(`th`,{})]})}),(0,s.jsxs)(`tbody`,{children:[e.length===0&&(0,s.jsx)(`tr`,{children:(0,s.jsx)(`td`,{colSpan:5,className:`muted`,children:`no agents yet`})}),e.map(e=>(0,s.jsxs)(`tr`,{children:[(0,s.jsx)(`td`,{children:(0,s.jsx)(`a`,{href:`/agents/${e.id}`,title:e.id,children:(0,s.jsxs)(`code`,{children:[e.id.slice(0,8),`…`]})})}),(0,s.jsx)(`td`,{children:(0,s.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,s.jsx)(a,{identity:e.identity,size:26}),(0,s.jsxs)(`div`,{className:`leading-tight`,children:[(0,s.jsx)(`div`,{children:e.name}),(e.identity?.creature||e.identity?.vibe)&&(0,s.jsx)(`div`,{className:`muted text-[0.8em]`,children:[e.identity?.creature,e.identity?.vibe].filter(Boolean).join(` · `)})]})]})}),(0,s.jsx)(`td`,{children:(0,s.jsx)(`code`,{children:e.profileId})}),(0,s.jsx)(`td`,{children:e.status}),(0,s.jsx)(`td`,{children:(0,s.jsxs)(`div`,{className:`flex gap-1.5`,children:[e.status===`archived`?(0,s.jsx)(`button`,{type:`button`,className:`ghost-btn`,onClick:()=>p(e.id),children:`unarchive`}):(0,s.jsx)(`button`,{type:`button`,className:`ghost-btn`,onClick:()=>f(e.id),children:`archive`}),(0,s.jsx)(`button`,{type:`button`,className:`ghost-btn`,style:{color:`var(--color-rose-baziu)`},onClick:()=>m(e.id),children:`delete`})]})})]},e.id))]})]})]})}function l({profiles:e,groups:t,modelGroups:n,onSpawned:r}){let[i,a]=(0,o.useState)(``),[c,l]=(0,o.useState)(``),[u,d]=(0,o.useState)(``),[f,p]=(0,o.useState)(t.find(e=>e.id===`default`)?.id??``),[m,h]=(0,o.useState)(!1),[g,_]=(0,o.useState)(null);async function v(e){if(e.preventDefault(),!i){_(`profile is required`);return}h(!0),_(null);try{let e={profile:i};c&&(e.name=c),u&&(e.model=u),f&&(e.groupId=f);let t=await fetch(`/api/agents`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify(e)});if(!t.ok){let e=await t.json().catch(()=>null);throw Error(e?.error??t.statusText)}l(``),d(``),r()}catch(e){_(e.message)}finally{h(!1)}}return(0,s.jsxs)(`form`,{className:`card`,onSubmit:v,children:[(0,s.jsx)(`h3`,{children:`spawn agent`}),g&&(0,s.jsx)(`div`,{className:`err`,children:g}),(0,s.jsx)(`p`,{className:`muted my-2 text-[0.85em]`,children:`Skills come from the profile's defaults at spawn time. Tweak per-agent skills after the fact from the agent detail page.`}),(0,s.jsxs)(`div`,{className:`flex gap-4`,children:[(0,s.jsxs)(`label`,{className:`flex-1`,children:[`profile`,(0,s.jsxs)(`select`,{value:i,onChange:e=>a(e.target.value),required:!0,children:[(0,s.jsx)(`option`,{value:``,children:`--`}),e.map(e=>(0,s.jsx)(`option`,{value:e.id,children:e.id},e.id))]})]}),(0,s.jsxs)(`label`,{className:`flex-1`,children:[`name`,(0,s.jsx)(`input`,{value:c,onChange:e=>l(e.target.value)})]})]}),(0,s.jsxs)(`label`,{children:[`model override`,n.length===0?(0,s.jsx)(`input`,{value:``,disabled:!0,placeholder:`(uses profile default — enable models on /config)`}):(0,s.jsxs)(`select`,{value:u,onChange:e=>d(e.target.value),children:[(0,s.jsx)(`option`,{value:``,children:`(uses profile default)`}),n.map(e=>(0,s.jsx)(`optgroup`,{label:e.provider,children:e.models.map(t=>(0,s.jsx)(`option`,{value:`${e.provider}:${t}`,children:`${e.provider}:${t}`},t))},e.provider))]})]}),(0,s.jsxs)(`label`,{children:[`group`,t.length===0?(0,s.jsx)(`select`,{disabled:!0,children:(0,s.jsx)(`option`,{children:`(no groups — register one on /groups)`})}):(0,s.jsx)(`select`,{value:f,onChange:e=>p(e.target.value),children:t.map(e=>(0,s.jsxs)(`option`,{value:e.id,children:[e.id,` (`,e.name,`)`]},e.id))})]}),(0,s.jsx)(`button`,{type:`submit`,disabled:m,children:m?`spawning…`:`spawn`})]})}export{c as component};
@@ -1,3 +0,0 @@
1
- import{D as e,E as t,O as n,T as r,p as i}from"./index-BQUL6oyH.js";import{t as a}from"./ConfigTabs-DRqAymcN.js";import{t as o}from"./FieldRow-BqWnxZiX.js";var s=n(e()),c=t();function l(){let{providers:e,openaiCodex:t}=i.useLoaderData(),n=e.some(e=>e.enabled&&e.curated.length>0);return(0,c.jsxs)(`main`,{className:`mx-auto max-w-5xl px-6 py-8`,children:[(0,c.jsx)(`h1`,{className:`font-serif text-3xl text-foreground mb-2`,children:`config`}),(0,c.jsx)(a,{active:`providers`}),!n&&(0,c.jsx)(u,{providers:e,openaiCodex:t}),(0,c.jsxs)(`p`,{className:`text-muted-foreground text-sm mb-6`,children:[`Each card configures one LLM provider end to end: credentials (encrypted in the`,` `,(0,c.jsx)(`code`,{className:`font-mono`,children:`secrets`}),` table), URLs and IDs (plaintext in the`,` `,(0,c.jsx)(`code`,{className:`font-mono`,children:`config`}),` table), and the curated model list that powers profile / agent dropdowns.`]}),e.map(e=>(0,c.jsx)(d,{p:e,openaiCodexStatus:e.id===`openai-codex`?t:void 0},e.id))]})}function u({providers:e,openaiCodex:t}){let n=[];for(let r of e)r.enabled&&(r.id===`openai-codex`&&!t.connected&&n.push(`${r.id}: enabled but ChatGPT is not connected — click "Connect ChatGPT" below`),r.curated.length===0&&n.push(`${r.id}: enabled but no curated models — add at least one name in the "curated models" box below and save`));let r=e.filter(e=>e.enabled).length;return(0,c.jsxs)(`div`,{className:`rounded-md border-2 border-amber-400 bg-amber-50 px-4 py-3 mb-4 text-sm`,children:[(0,c.jsx)(`div`,{className:`font-semibold text-amber-900 mb-1`,children:`First-run setup is not complete`}),(0,c.jsxs)(`p`,{className:`text-amber-900 mb-2`,children:[`The rest of the app stays on the Welcome screen until at least one provider is`,` `,(0,c.jsx)(`strong`,{children:`enabled`}),` and has `,(0,c.jsx)(`strong`,{children:`at least one curated model`}),`.`]}),n.length>0?(0,c.jsx)(`ul`,{className:`list-disc pl-5 text-amber-900 space-y-0.5`,children:n.map(e=>(0,c.jsx)(`li`,{children:e},e))}):r===0?(0,c.jsx)(`p`,{className:`text-amber-900`,children:`No providers are enabled yet — pick one below, flip the toggle on, set credentials, and add a model name.`}):null]})}function d({p:e,openaiCodexStatus:t}){let n=r(),[i,a]=(0,s.useState)(e.enabled),[l,u]=(0,s.useState)(e.curated.join(`
2
- `)),[d,h]=(0,s.useState)(!1),[g,_]=(0,s.useState)(null);async function v(t){a(t);try{await fetch(`/api/config/providers/${encodeURIComponent(e.id)}/enabled`,{method:`PUT`,headers:{"content-type":`application/json`},body:JSON.stringify({enabled:t})}),await n.invalidate()}catch{a(!t)}}async function y(t){t.preventDefault(),h(!0),_(null);try{let t=l.split(/\r?\n/).map(e=>e.trim()).filter(Boolean),r=await fetch(`/api/config/providers/${encodeURIComponent(e.id)}/models`,{method:`PUT`,headers:{"content-type":`application/json`},body:JSON.stringify({models:t})});if(!r.ok){let e=await r.json().catch(()=>({}));throw Error(e.error??`${r.status} ${r.statusText}`)}_(`saved ✓`),await n.invalidate()}catch(e){_(`error: ${e.message}`)}finally{h(!1)}}return(0,c.jsxs)(`section`,{className:`rounded-lg border bg-card mb-3 overflow-hidden`,children:[(0,c.jsxs)(`header`,{className:`flex items-center gap-3 px-4 py-3`,children:[(0,c.jsx)(`span`,{className:`font-mono font-semibold`,children:e.id}),(0,c.jsxs)(`span`,{className:`text-muted-foreground text-sm`,children:[`· `,e.displayName]}),(0,c.jsxs)(`label`,{className:`flex items-center gap-1.5 text-xs uppercase tracking-wide font-semibold cursor-pointer`,children:[(0,c.jsx)(`input`,{type:`checkbox`,checked:i,onChange:e=>v(e.target.checked),className:`size-4`}),(0,c.jsx)(`span`,{className:i?`text-emerald-700`:`text-muted-foreground`,children:i?`enabled`:`disabled`})]}),(0,c.jsxs)(`span`,{className:`ml-auto text-xs text-muted-foreground`,children:[e.curated.length>0&&(0,c.jsxs)(`span`,{children:[e.curated.length,` curated`]}),e.catalog.length>0&&(0,c.jsxs)(`span`,{children:[` · `,e.catalog.length,` catalog`]}),e.live&&!e.live.error&&(0,c.jsxs)(`span`,{children:[` · `,e.live.models.length,` live`]})]})]}),i&&(0,c.jsxs)(`div`,{className:`border-t border-dashed px-4 py-3`,children:[e.hint&&(0,c.jsx)(`p`,{className:`text-xs text-muted-foreground mb-2`,children:e.hint}),e.id===`openai-codex`&&t&&(0,c.jsx)(m,{status:t}),e.fields.length===0&&e.envHint&&e.id!==`openai-codex`&&(0,c.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Credentials come from the process env: `,(0,c.jsx)(`code`,{className:`font-mono`,children:e.envHint})]}),e.fields.map(e=>(0,c.jsx)(o,{field:e},e.envVar)),(0,c.jsx)(`h4`,{className:`mt-4 mb-1 text-xs uppercase tracking-wide text-muted-foreground`,children:`curated models (one per line)`}),e.curated.length===0&&(0,c.jsxs)(`p`,{className:`mb-2 text-xs font-medium text-amber-700`,children:[`First-run setup needs at least one model name here — type one (e.g.`,` `,(0,c.jsx)(`code`,{className:`font-mono`,children:f(e.id)}),`) and click`,` `,(0,c.jsx)(`em`,{children:`save models`}),`.`]}),(0,c.jsxs)(`form`,{onSubmit:y,children:[(0,c.jsx)(`textarea`,{value:l,onChange:e=>u(e.target.value),rows:Math.max(3,Math.min(8,l.split(`
3
- `).length)),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`,placeholder:e.catalog.length===0&&!e.live?`Type model names one per line, e.g. qwen3-coder-30b`:`Click catalog chips below, or type names one per line`}),(0,c.jsxs)(`div`,{className:`flex items-center gap-3 mt-2`,children:[(0,c.jsx)(`button`,{type:`submit`,disabled:d,className:`rounded-md bg-primary px-3 py-1.5 text-sm font-medium text-primary-foreground disabled:opacity-50`,children:`save models`}),g&&(0,c.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:g})]})]}),e.catalog.length>0&&(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(`h4`,{className:`mt-4 mb-1 text-xs uppercase tracking-wide text-muted-foreground`,children:`catalog`}),(0,c.jsx)(p,{items:e.catalog,onPick:e=>u(t=>t.includes(e)?t:`${t}\n${e}`.trim())})]}),e.live&&!e.live.error&&e.live.models.length>0&&(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(`h4`,{className:`mt-4 mb-1 text-xs uppercase tracking-wide text-muted-foreground`,children:`live`}),(0,c.jsx)(p,{items:e.live.models,onPick:e=>u(t=>t.includes(e)?t:`${t}\n${e}`.trim())})]}),e.live?.error&&(0,c.jsxs)(`p`,{className:`text-xs text-rose-700 mt-2`,children:[`could not fetch: `,e.live.error]})]})]})}function f(e){switch(e){case`openai-codex`:return`gpt-5.3-codex`;case`openai`:return`gpt-5.5`;case`anthropic`:return`claude-opus-4-8`;case`google`:return`gemini-3-pro-preview`;case`google-vertex`:return`gemini-3-pro-preview`;case`xai`:return`grok-4.3`;case`groq`:return`llama-3.3-70b-versatile`;case`cerebras`:return`zai-glm-4.7`;case`mistral`:return`mistral-large-latest`;case`zai`:return`glm-5.1`;case`huggingface`:return`Qwen/Qwen3.5-397B-A17B`;case`openrouter`:return`anthropic/claude-opus-4.8`;case`vercel-ai-gateway`:return`anthropic/claude-opus-4.8`;case`deepseek`:return`deepseek-v4-pro`;case`fireworks`:return`accounts/fireworks/models/deepseek-v4-pro`;case`together`:return`Qwen/Qwen3.7-Max`;case`moonshotai`:return`kimi-k2.6`;case`kimi-coding`:return`kimi-for-coding`;case`minimax`:return`MiniMax-M2.7`;case`cloudflare-workers-ai`:return`@cf/moonshotai/kimi-k2.6`;case`cloudflare-ai-gateway`:return`claude-opus-4-7`;case`github-copilot`:return`claude-opus-4.7`;case`xiaomi`:return`mimo-v2.5`;case`opencode`:return`claude-opus-4-8`;case`azure-openai`:return`gpt-5.5`;case`bedrock`:return`anthropic.claude-opus-4-8`;case`ollama`:return`llama3.3`;case`lmstudio`:return`qwen3-coder-30b`;case`llamacpp`:return`unsloth/Qwen3.6-35B-A3B-MTP-GGUF:MXFP4_MOE`;default:return`model-name`}}function p({items:e,onPick:t}){return(0,c.jsx)(`div`,{className:`flex flex-wrap gap-1.5 max-h-40 overflow-y-auto rounded-md border bg-background p-1.5`,children:e.map(e=>(0,c.jsx)(`button`,{type:`button`,onClick:()=>t(e),className:`rounded border bg-card px-2 py-0.5 font-mono text-xs hover:border-primary hover:bg-accent`,children:e},e))})}function m({status:e}){let t=r(),[n,i]=(0,s.useState)(!1),[a,o]=(0,s.useState)(null);async function l(){i(!0),o(null);try{let e=await fetch(`/api/auth/openai/login`,{method:`POST`});if(!e.ok){let t=await e.json().catch(()=>({}));throw Error(t.error??`${e.status} ${e.statusText}`)}await t.invalidate()}catch(e){o(e.message)}finally{i(!1)}}async function u(){i(!0),o(null);try{await fetch(`/api/auth/openai`,{method:`DELETE`}),await t.invalidate()}catch(e){o(e.message)}finally{i(!1)}}return(0,c.jsxs)(`div`,{className:`rounded-md border bg-muted/30 p-3 mb-3`,children:[e.connected?(0,c.jsxs)(c.Fragment,{children:[(0,c.jsxs)(`div`,{className:`flex flex-wrap gap-2 items-center mb-2`,children:[(0,c.jsx)(`span`,{className:`rounded-full bg-emerald-100 text-emerald-800 px-2 py-0.5 text-xs font-semibold uppercase`,children:`connected`}),e.accountId&&(0,c.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[`account `,(0,c.jsx)(`code`,{className:`font-mono`,children:e.accountId})]}),e.expiresAt&&(0,c.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[`token expires`,` `,new Date(e.expiresAt).toISOString().replace(/\.\d+Z$/,`Z`)]})]}),(0,c.jsx)(`button`,{type:`button`,onClick:u,disabled:n,className:`rounded-md border px-3 py-1.5 text-sm text-rose-700 hover:bg-rose-50 disabled:opacity-50`,children:`disconnect`})]}):(0,c.jsxs)(c.Fragment,{children:[(0,c.jsxs)(`p`,{className:`text-xs text-muted-foreground mb-2`,children:[`Sign in with your ChatGPT account — the OAuth flow opens a new browser tab. The loopback callback at `,(0,c.jsx)(`code`,{className:`font-mono`,children:`localhost:1455`}),` only works when you're using the web UI on the same machine as the daemon. For remote setups, run `,(0,c.jsx)(`code`,{className:`font-mono`,children:`bazilion auth openai login`}),` on the client.`]}),(0,c.jsx)(`button`,{type:`button`,onClick:l,disabled:n,className:`rounded-md bg-primary px-3 py-1.5 text-sm font-medium text-primary-foreground disabled:opacity-50`,children:n?`opening browser…`:`Connect ChatGPT →`})]}),a&&(0,c.jsx)(`p`,{className:`text-sm text-rose-700 mt-2`,children:a})]})}export{l as component};
@@ -1 +0,0 @@
1
- import{D as e,E as t,O as n,T as r,m as i}from"./index-BQUL6oyH.js";var a=n(e()),o=t();function s(){let{groups:e,memberCounts:t}=i.useLoaderData(),n=r();async function a(e){if(!confirm(`remove this group registration?`))return;let t=await fetch(`/api/groups/${e}`,{method:`DELETE`});if(!t.ok&&t.status!==204){alert(t.statusText);return}await n.invalidate()}return(0,o.jsxs)(`div`,{children:[(0,o.jsx)(`h1`,{children:`groups`}),(0,o.jsx)(`p`,{className:`muted`,children:`A group is a collaboration context: one filesystem root, one USER.md, one roster. Every agent belongs to exactly one group.`}),(0,o.jsx)(c,{onRegistered:()=>n.invalidate()}),(0,o.jsxs)(`table`,{children:[(0,o.jsx)(`thead`,{children:(0,o.jsxs)(`tr`,{children:[(0,o.jsx)(`th`,{children:`id`}),(0,o.jsx)(`th`,{children:`name`}),(0,o.jsx)(`th`,{children:`path`}),(0,o.jsx)(`th`,{children:`members`}),(0,o.jsx)(`th`,{children:`USER.md`}),(0,o.jsx)(`th`,{})]})}),(0,o.jsxs)(`tbody`,{children:[e.length===0&&(0,o.jsx)(`tr`,{children:(0,o.jsx)(`td`,{colSpan:6,className:`muted`,children:`no groups registered`})}),e.map(e=>{let n=t[e.id]??0,r=e.userMd.length;return(0,o.jsxs)(`tr`,{children:[(0,o.jsx)(`td`,{children:(0,o.jsx)(`code`,{children:e.id})}),(0,o.jsx)(`td`,{children:e.name}),(0,o.jsx)(`td`,{children:(0,o.jsx)(`code`,{children:e.path})}),(0,o.jsx)(`td`,{children:n}),(0,o.jsx)(`td`,{children:(0,o.jsx)(`a`,{href:`/groups/${e.id}`,children:r>0?`${r} chars`:`empty`})}),(0,o.jsx)(`td`,{children:n===0?(0,o.jsx)(`button`,{type:`button`,className:`ghost-btn`,onClick:()=>a(e.id),children:`remove`}):(0,o.jsx)(`span`,{className:`muted`,title:`${n} agent(s) belong to this group`,children:`in use`})})]},e.id)})]})]})]})}function c({onRegistered:e}){let[t,n]=(0,a.useState)(``),[r,i]=(0,a.useState)(``),[s,c]=(0,a.useState)(``),[l,u]=(0,a.useState)(null),[d,f]=(0,a.useState)(!1);async function p(a){if(a.preventDefault(),u(null),!t.trim()){u(`id is required`);return}f(!0);try{let a=await fetch(`/api/groups`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({id:t.trim(),name:r.trim()||void 0,link:s.trim()||void 0})});if(!a.ok){let e=await a.json().catch(()=>null);throw Error(e?.error??a.statusText)}n(``),i(``),c(``),e()}catch(e){u(e.message)}finally{f(!1)}}return(0,o.jsxs)(`form`,{className:`card`,onSubmit:p,children:[(0,o.jsx)(`h3`,{children:`register group`}),l&&(0,o.jsx)(`div`,{className:`err`,children:l}),(0,o.jsxs)(`p`,{className:`muted`,children:[`Groups always live under `,(0,o.jsx)(`code`,{children:`~/.bazilion/groups/<slug>/`}),`. Leave the link target blank to create a fresh directory; supply an absolute path to materialize the slot as a symlink to your existing project tree instead.`]}),(0,o.jsxs)(`div`,{className:`flex gap-4`,children:[(0,o.jsxs)(`label`,{className:`flex-1`,children:[`id (slug)`,(0,o.jsx)(`input`,{value:t,onChange:e=>n(e.target.value),required:!0,placeholder:`myproject`})]}),(0,o.jsxs)(`label`,{className:`flex-1`,children:[`name`,(0,o.jsx)(`input`,{value:r,onChange:e=>i(e.target.value),placeholder:`My Project`})]})]}),(0,o.jsxs)(`label`,{children:[`link target (optional, absolute path)`,(0,o.jsx)(`input`,{value:s,onChange:e=>c(e.target.value),placeholder:`/home/user/projects/myproject`})]}),(0,o.jsx)(`button`,{type:`submit`,disabled:d,children:d?`registering…`:`register`})]})}export{s as component};
@@ -1 +0,0 @@
1
- import{E as e,t}from"./index-BQUL6oyH.js";import{t as n}from"./AgentTabs-M5K8emJ8.js";var r=e();function i(e){try{let t=JSON.parse(e);if(typeof t.text==`string`)return t.text}catch{}return e}function a(){let{resolved:e,messages:a,unreadCount:o,selected:s,agentNames:c}=t.useLoaderData(),l=t.useSearch().unread===`1`,u=!!(s&&s.toAgentId!==e.agent.id);function d(e){let t=c[e];return t?`${t} (${e.slice(0,8)})`:e.slice(0,8)}return(0,r.jsxs)(`main`,{className:`mx-auto max-w-5xl px-6 py-8`,children:[(0,r.jsx)(`h1`,{className:`font-serif text-3xl text-foreground mb-1`,children:e.agent.name}),(0,r.jsxs)(`p`,{className:`text-xs text-muted-foreground mb-6`,children:[(0,r.jsxs)(`code`,{className:`font-mono`,children:[e.agent.id.slice(0,8),`…`]}),` · unread: `,o]}),(0,r.jsx)(n,{agentId:e.agent.id,active:`inbox`,archived:e.agent.status===`archived`}),(0,r.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-[360px_1fr] gap-6`,children:[(0,r.jsxs)(`div`,{children:[(0,r.jsxs)(`div`,{className:`flex gap-1 border-b mb-3`,children:[(0,r.jsx)(`a`,{href:`/agents/${e.agent.id}/inbox`,className:`px-3 py-1.5 text-sm border-b-2 -mb-px ${l?`border-transparent text-muted-foreground`:`border-primary text-primary font-semibold`}`,children:`all`}),(0,r.jsx)(`a`,{href:`/agents/${e.agent.id}/inbox?unread=1`,className:`px-3 py-1.5 text-sm border-b-2 -mb-px ${l?`border-primary text-primary font-semibold`:`border-transparent text-muted-foreground`}`,children:`unread`})]}),(0,r.jsx)(`div`,{className:`rounded-lg border bg-card max-h-[640px] overflow-y-auto`,children:a.length===0?(0,r.jsx)(`div`,{className:`p-6 text-center text-muted-foreground italic`,children:l?`no unread messages`:`inbox empty`}):a.map(t=>{let n=i(t.payload),a=n.length>80?`${n.slice(0,80)}…`:n,o=new Date(t.createdAt).toLocaleString(),c=s?.id===t.id,u=t.readAt===null,f=l?`?unread=1&id=${t.id}`:`?id=${t.id}`;return(0,r.jsxs)(`a`,{href:`/agents/${e.agent.id}/inbox${f}`,className:`block border-b last:border-0 px-3 py-2 text-sm hover:bg-accent/30 ${c?`bg-accent/40`:``} ${u?`font-medium`:``}`,children:[(0,r.jsxs)(`div`,{className:`flex justify-between text-xs text-muted-foreground`,children:[(0,r.jsxs)(`span`,{className:`font-mono`,children:[u&&(0,r.jsx)(`span`,{className:`inline-block w-1.5 h-1.5 rounded-full bg-primary mr-1.5 align-middle`}),`from `,d(t.fromAgentId)]}),(0,r.jsx)(`span`,{className:`font-mono`,children:o})]}),(0,r.jsx)(`div`,{className:`text-foreground mt-0.5 truncate`,children:a})]},t.id)})})]}),(0,r.jsxs)(`div`,{children:[s&&!u&&(0,r.jsxs)(`div`,{className:`rounded-lg border bg-card p-5 mb-4`,children:[(0,r.jsxs)(`div`,{className:`font-mono text-xs text-muted-foreground mb-2 space-y-0.5`,children:[(0,r.jsxs)(`div`,{children:[`id: `,(0,r.jsx)(`code`,{children:s.id})]}),(0,r.jsxs)(`div`,{children:[`from: `,(0,r.jsx)(`code`,{children:d(s.fromAgentId)})]}),(0,r.jsxs)(`div`,{children:[`received: `,new Date(s.createdAt).toLocaleString()]}),(0,r.jsxs)(`div`,{children:[`read:`,` `,s.readAt?new Date(s.readAt).toLocaleString():`(unread)`]}),s.replyTo&&(0,r.jsxs)(`div`,{children:[`reply to: `,(0,r.jsx)(`code`,{children:s.replyTo})]})]}),(0,r.jsx)(`div`,{className:`border-t pt-3 font-mono text-sm whitespace-pre-wrap break-words`,children:i(s.payload)})]}),u&&(0,r.jsx)(`div`,{className:`rounded-lg border bg-card p-5 mb-4 text-muted-foreground`,children:`message is not addressed to this agent`}),(0,r.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Agents exchange messages automatically via their`,` `,(0,r.jsx)(`code`,{className:`font-mono`,children:`send_message`}),` tool. An idle recipient's scheduler tick drains unread mail.`]})]})]})]})}export{a as component};